feat(coding-agent): added matcherDigest hook for TTSR wire-format normalization
- Added optional `AgentTool.matcherDigest(args)` hook so tools can expose plain source text instead of wire-encoded arguments to TTSR rule matchers. - Implemented `matcherDigest` on edit (all modes: hashline, patch, apply_patch, replace) and write tools, stripping patch prefixes and JSON escaping. - Added `TtsrManager.checkSnapshot()` to replace the scoped buffer with a tool digest rather than appending raw deltas. - Fixed TTSR conditions never matching streamed edit/write calls whose wire format obscured real content.
This commit is contained in:
@@ -273,6 +273,12 @@ export class WriteTool implements AgentTool<typeof writeSchema, WriteToolDetails
|
||||
readonly loadMode = "discoverable";
|
||||
readonly summary = "Write content to a file (creates or overwrites)";
|
||||
|
||||
/** Stream matchers should see the real file content, not its JSON-escaped argument encoding. */
|
||||
matcherDigest(args: unknown): string | undefined {
|
||||
const content = (args as Partial<WriteParams>).content;
|
||||
return typeof content === "string" ? content : undefined;
|
||||
}
|
||||
|
||||
readonly #writethrough: WritethroughCallback;
|
||||
|
||||
constructor(private readonly session: ToolSession) {
|
||||
|
||||
Reference in New Issue
Block a user