MCPcopy
hub / github.com/OpenCoworkAI/open-codesign / trackFsMutations

Function trackFsMutations

packages/core/src/agent.ts:581–604  ·  view source on GitHub ↗
(
  fs: TextEditorFsCallbacks,
  resourceState: ResourceStateV1,
)

Source from the content-addressed store, hash-verified

579}
580
581function trackFsMutations(
582 fs: TextEditorFsCallbacks,
583 resourceState: ResourceStateV1,
584): TextEditorFsCallbacks {
585 return {
586 view: (path) => fs.view(path),
587 listDir: (dir) => fs.listDir(dir),
588 async create(path, content) {
589 const result = await fs.create(path, content);
590 recordMutation(resourceState);
591 return result;
592 },
593 async strReplace(path, oldStr, newStr) {
594 const result = await fs.strReplace(path, oldStr, newStr);
595 recordMutation(resourceState);
596 return result;
597 },
598 async insert(path, line, text) {
599 const result = await fs.insert(path, line, text);
600 recordMutation(resourceState);
601 return result;
602 },
603 };
604}
605
606function wrapSkillState(
607 tool: AgentTool<TSchema, unknown>,

Callers 1

generateViaAgentFunction · 0.85

Calls 2

viewMethod · 0.80
listDirMethod · 0.80

Tested by

no test coverage detected