refactor(hashline): override native edit tool instead of separate tool + disabler hook
Replace 3-component hashline system (separate hashline_edit tool + edit disabler hook + OpenAI-exempted read enhancer) with 2-component system that directly overrides the native edit tool key, matching the delegate_task pattern. - Register hashline tool as 'edit' key to override native edit - Delete hashline-edit-disabler hook (no longer needed) - Delete hashline-provider-state module (no remaining consumers) - Remove OpenAI exemption from read enhancer (explicit opt-in means all providers) - Remove setProvider wiring from chat-params
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import { setProvider } from "../features/hashline-provider-state"
|
||||
|
||||
type ChatParamsInput = {
|
||||
sessionID: string
|
||||
agent: { name?: string }
|
||||
@@ -68,8 +66,6 @@ export function createChatParamsHandler(args: {
|
||||
if (!normalizedInput) return
|
||||
if (!isChatParamsOutput(output)) return
|
||||
|
||||
setProvider(normalizedInput.sessionID, normalizedInput.model.providerID)
|
||||
|
||||
await args.anthropicEffort?.["chat.params"]?.(normalizedInput, output)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
createRulesInjectorHook,
|
||||
createTasksTodowriteDisablerHook,
|
||||
createWriteExistingFileGuardHook,
|
||||
createHashlineEditDisablerHook,
|
||||
createHashlineReadEnhancerHook,
|
||||
} from "../../hooks"
|
||||
import {
|
||||
@@ -30,7 +29,6 @@ export type ToolGuardHooks = {
|
||||
rulesInjector: ReturnType<typeof createRulesInjectorHook> | null
|
||||
tasksTodowriteDisabler: ReturnType<typeof createTasksTodowriteDisablerHook> | null
|
||||
writeExistingFileGuard: ReturnType<typeof createWriteExistingFileGuardHook> | null
|
||||
hashlineEditDisabler: ReturnType<typeof createHashlineEditDisablerHook> | null
|
||||
hashlineReadEnhancer: ReturnType<typeof createHashlineReadEnhancerHook> | null
|
||||
}
|
||||
|
||||
@@ -89,10 +87,6 @@ export function createToolGuardHooks(args: {
|
||||
? safeHook("write-existing-file-guard", () => createWriteExistingFileGuardHook(ctx))
|
||||
: null
|
||||
|
||||
const hashlineEditDisabler = isHookEnabled("hashline-edit-disabler")
|
||||
? safeHook("hashline-edit-disabler", () => createHashlineEditDisablerHook(pluginConfig))
|
||||
: null
|
||||
|
||||
const hashlineReadEnhancer = isHookEnabled("hashline-read-enhancer")
|
||||
? safeHook("hashline-read-enhancer", () => createHashlineReadEnhancerHook(ctx, { hashline_edit: { enabled: pluginConfig.experimental?.hashline_edit ?? false } }))
|
||||
: null
|
||||
@@ -106,7 +100,6 @@ export function createToolGuardHooks(args: {
|
||||
rulesInjector,
|
||||
tasksTodowriteDisabler,
|
||||
writeExistingFileGuard,
|
||||
hashlineEditDisabler,
|
||||
hashlineReadEnhancer,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,6 @@ export function createToolExecuteBeforeHandler(args: {
|
||||
await hooks.prometheusMdOnly?.["tool.execute.before"]?.(input, output)
|
||||
await hooks.sisyphusJuniorNotepad?.["tool.execute.before"]?.(input, output)
|
||||
await hooks.atlasHook?.["tool.execute.before"]?.(input, output)
|
||||
await hooks.hashlineEditDisabler?.["tool.execute.before"]?.(input, output)
|
||||
|
||||
if (input.tool === "task") {
|
||||
const argsObject = output.args
|
||||
const category = typeof argsObject.category === "string" ? argsObject.category : undefined
|
||||
|
||||
@@ -120,7 +120,7 @@ export function createToolRegistry(args: {
|
||||
|
||||
const hashlineEnabled = pluginConfig.experimental?.hashline_edit ?? false
|
||||
const hashlineToolsRecord: Record<string, ToolDefinition> = hashlineEnabled
|
||||
? { hashline_edit: createHashlineEditTool() }
|
||||
? { edit: createHashlineEditTool() }
|
||||
: {}
|
||||
|
||||
const allTools: Record<string, ToolDefinition> = {
|
||||
|
||||
Reference in New Issue
Block a user