feat(coding-agent): removed insertBefore and substr hashline edit operations

- Removed insertBefore and substr hashline edit operations, simplifying the edit API to support only replaceLine, replaceLines, and insertAfter operations.
- Updated hashline edit schema and type definitions to remove insertBefore and substr operation types from the ParsedRefs union and edit validation logic.
- Removed insertBefore and substr test cases from hashline test suite, including tests for insert-before functionality, anchor echo stripping, and substring matching.
- Updated benchmark runner to refactor edit operations from src/dst format to discriminated union types (replaceLine, replaceLines, insertAfter) and adjusted insertAfter line references.
This commit is contained in:
can1357
2026-02-11 08:12:08 +01:00
parent 4c0cba5984
commit 6c5fa149da
8 changed files with 36 additions and 200 deletions
-15
View File
@@ -144,24 +144,10 @@ const hashlineInsertAfterSchema = Type.Object({
content: Type.String({ description: "Content to insert (\\n-separated); must be non-empty" }),
}),
});
const hashlineInsertBeforeSchema = Type.Object({
insertBefore: Type.Object({
loc: Type.String({ description: 'Insert before this line "LINE:HASH"' }),
content: Type.String({ description: "Content to insert (\\n-separated); must be non-empty" }),
}),
});
const hashlineSubstrSchema = Type.Object({
substr: Type.Object({
needle: Type.String({ description: "Unique substring to find in the target line" }),
content: Type.String({ description: "Replacement for the needle (single-line only)" }),
}),
});
const hashlineEditItemSchema = Type.Union([
hashlineReplaceLineSchema,
hashlineReplaceLinesSchema,
hashlineInsertAfterSchema,
hashlineInsertBeforeSchema,
hashlineSubstrSchema,
]);
const hashlineEditSchema = Type.Object({
path: Type.String({ description: "File path (relative or absolute)" }),
@@ -428,7 +414,6 @@ export class EditTool implements AgentTool<TInput> {
if ("replaceLine" in edit) refs.push(edit.replaceLine.loc);
else if ("replaceLines" in edit) refs.push(edit.replaceLines.start, edit.replaceLines.end);
else if ("insertAfter" in edit) refs.push(edit.insertAfter.loc);
else if ("insertBefore" in edit) refs.push(edit.insertBefore.loc);
for (const ref of refs) {
const parsed = parseLineRef(ref);
if (parsed.line >= 1 && parsed.line <= lines.length) {