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,4 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin"
|
||||
import { getProvider } from "../../features/hashline-provider-state"
|
||||
import { computeLineHash } from "../../tools/hashline-edit/hash-computation"
|
||||
|
||||
interface HashlineReadEnhancerConfig {
|
||||
@@ -12,15 +11,8 @@ function isReadTool(toolName: string): boolean {
|
||||
return toolName.toLowerCase() === "read"
|
||||
}
|
||||
|
||||
function shouldProcess(sessionID: string, config: HashlineReadEnhancerConfig): boolean {
|
||||
if (!config.hashline_edit?.enabled) {
|
||||
return false
|
||||
}
|
||||
const providerID = getProvider(sessionID)
|
||||
if (providerID === "openai") {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
function shouldProcess(config: HashlineReadEnhancerConfig): boolean {
|
||||
return config.hashline_edit?.enabled ?? false
|
||||
}
|
||||
|
||||
function isTextFile(output: string): boolean {
|
||||
@@ -65,7 +57,7 @@ export function createHashlineReadEnhancerHook(
|
||||
if (typeof output.output !== "string") {
|
||||
return
|
||||
}
|
||||
if (!shouldProcess(input.sessionID, config)) {
|
||||
if (!shouldProcess(config)) {
|
||||
return
|
||||
}
|
||||
output.output = transformOutput(output.output)
|
||||
|
||||
Reference in New Issue
Block a user