fix(compaction): remove hardcoded Claude model from compaction hooks
This commit is contained in:
+10
-18
@@ -107,6 +107,7 @@ import {
|
||||
OPENCODE_NATIVE_AGENTS_INJECTION_VERSION,
|
||||
injectServerAuthIntoClient,
|
||||
} from "./shared";
|
||||
import { filterDisabledTools } from "./shared/disabled-tools";
|
||||
import { loadPluginConfig } from "./plugin-config";
|
||||
import { createModelCacheState } from "./plugin-state";
|
||||
import { createConfigHandler } from "./plugin-handlers";
|
||||
@@ -121,7 +122,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
|
||||
const pluginConfig = loadPluginConfig(ctx.directory, ctx);
|
||||
const disabledHooks = new Set(pluginConfig.disabled_hooks ?? []);
|
||||
const disabledTools = new Set(pluginConfig.disabled_tools ?? []);
|
||||
const firstMessageVariantGate = createFirstMessageVariantGate();
|
||||
|
||||
const tmuxConfig = {
|
||||
@@ -537,15 +537,10 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
...taskToolsRecord,
|
||||
};
|
||||
|
||||
const filteredTools: Record<string, ToolDefinition> =
|
||||
disabledTools.size > 0 ? {} : allTools;
|
||||
if (disabledTools.size > 0) {
|
||||
for (const [toolName, toolDefinition] of Object.entries(allTools)) {
|
||||
if (!disabledTools.has(toolName)) {
|
||||
filteredTools[toolName] = toolDefinition;
|
||||
}
|
||||
}
|
||||
}
|
||||
const filteredTools: Record<string, ToolDefinition> = filterDisabledTools(
|
||||
allTools,
|
||||
pluginConfig.disabled_tools,
|
||||
);
|
||||
|
||||
return {
|
||||
tool: filteredTools,
|
||||
@@ -891,17 +886,14 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
await taskResumeInfo["tool.execute.after"](input, output);
|
||||
},
|
||||
|
||||
"experimental.session.compacting": async (input: { sessionID: string }) => {
|
||||
"experimental.session.compacting": async (
|
||||
_input: { sessionID: string },
|
||||
output: { context: string[] },
|
||||
): Promise<void> => {
|
||||
if (!compactionContextInjector) {
|
||||
return;
|
||||
}
|
||||
await compactionContextInjector({
|
||||
sessionID: input.sessionID,
|
||||
providerID: "anthropic",
|
||||
modelID: "claude-opus-4-6",
|
||||
usageRatio: 0.8,
|
||||
directory: ctx.directory,
|
||||
});
|
||||
output.context.push(compactionContextInjector());
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user