clawmatrix 0.1.22 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -126,13 +126,20 @@ async function executeExec(params: ExecParams): Promise<ToolResult> {
126
126
 
127
127
  // ── read/write/edit: reuse pi-coding-agent factories ───────────────
128
128
 
129
- const piToolCache = new Map<string, { execute: Function }>();
129
+ /** Cache key includes cwd so tools are recreated if the working directory changes. */
130
+ let piToolCache = new Map<string, { execute: Function }>();
131
+ let piToolCwd = "";
130
132
 
131
133
  function getPiTool(name: string): { execute: Function } {
134
+ const cwd = process.cwd();
135
+ if (cwd !== piToolCwd) {
136
+ piToolCache = new Map();
137
+ piToolCwd = cwd;
138
+ }
139
+
132
140
  let tool = piToolCache.get(name);
133
141
  if (tool) return tool;
134
142
 
135
- const cwd = process.cwd();
136
143
  switch (name) {
137
144
  case "read":
138
145
  tool = createReadTool(cwd);