fix(hashline-read-enhancer): simplify write tool output to line count summary

Replace full hashlined file content in write tool response with a simple
'File written successfully. N lines written.' summary to reduce context
bloat.
This commit is contained in:
minpeter
2026-02-24 15:58:36 +09:00
parent 2aeb96c3f6
commit c6a69899d8
2 changed files with 7 additions and 11 deletions
+2 -7
View File
@@ -1,6 +1,5 @@
import type { PluginInput } from "@opencode-ai/plugin"
import { computeLineHash } from "../../tools/hashline-edit/hash-computation"
import { toHashlineContent } from "../../tools/hashline-edit/diff-utils"
interface HashlineReadEnhancerConfig {
hashline_edit?: { enabled: boolean }
@@ -137,10 +136,6 @@ function extractFilePath(metadata: unknown): string | undefined {
}
async function appendWriteHashlineOutput(output: { output: string; metadata: unknown }): Promise<void> {
if (output.output.includes("Updated file (LINE#ID|content):")) {
return
}
const filePath = extractFilePath(output.metadata)
if (!filePath) {
return
@@ -152,8 +147,8 @@ async function appendWriteHashlineOutput(output: { output: string; metadata: unk
}
const content = await file.text()
const hashlined = toHashlineContent(content)
output.output = `${output.output}\n\nUpdated file (LINE#ID|content):\n${hashlined}`
const lineCount = content === "" ? 0 : content.split("\n").length
output.output = `File written successfully. ${lineCount} lines written.`
}
export function createHashlineReadEnhancerHook(