@vtstech/pi-react-fallback 1.1.7 → 1.1.9
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.
- package/package.json +2 -2
- package/react-fallback.js +12 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtstech/pi-react-fallback",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "ReAct fallback extension for Pi Coding Agent",
|
|
5
5
|
"main": "react-fallback.js",
|
|
6
6
|
"keywords": ["pi-extensions"],
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "https://github.com/VTSTech/pi-coding-agent"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@vtstech/pi-shared": "1.1.
|
|
17
|
+
"@vtstech/pi-shared": "1.1.9"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@mariozechner/pi-coding-agent": ">=0.66"
|
package/react-fallback.js
CHANGED
|
@@ -4,17 +4,14 @@ import * as fs from "node:fs";
|
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { section, ok, fail, warn, info } from "@vtstech/pi-shared/format";
|
|
6
6
|
import { EXTENSION_VERSION } from "@vtstech/pi-shared/ollama";
|
|
7
|
+
import { debugLog } from "@vtstech/pi-shared/debug";
|
|
7
8
|
import {
|
|
8
9
|
sanitizeModelJson,
|
|
9
10
|
extractToolFromJson,
|
|
10
11
|
parseReact,
|
|
11
|
-
parseReactWithPatterns,
|
|
12
12
|
detectReactDialect,
|
|
13
13
|
fuzzyMatchToolName,
|
|
14
|
-
normalizeArguments,
|
|
15
14
|
looksLikeSchemaDump,
|
|
16
|
-
REACT_DIALECTS,
|
|
17
|
-
ALL_DIALECT_PATTERNS,
|
|
18
15
|
FINAL_ANSWER_RE
|
|
19
16
|
} from "@vtstech/pi-shared/react-parser";
|
|
20
17
|
var REACT_CONFIG_PATH = path.join(os.homedir(), ".pi", "agent", "react-mode.json");
|
|
@@ -24,7 +21,8 @@ function readReactConfig() {
|
|
|
24
21
|
const raw = JSON.parse(fs.readFileSync(REACT_CONFIG_PATH, "utf-8"));
|
|
25
22
|
if (typeof raw.enabled === "boolean") return raw;
|
|
26
23
|
}
|
|
27
|
-
} catch {
|
|
24
|
+
} catch (err) {
|
|
25
|
+
debugLog("react-fallback", "failed to read ReAct config", err);
|
|
28
26
|
}
|
|
29
27
|
return { enabled: false };
|
|
30
28
|
}
|
|
@@ -95,6 +93,13 @@ The bridge will match your tool name (fuzzy matching supported) and normalize ar
|
|
|
95
93
|
isError: true
|
|
96
94
|
};
|
|
97
95
|
}
|
|
96
|
+
if (targetToolName === "tool_call") {
|
|
97
|
+
stats.parseFailures++;
|
|
98
|
+
return {
|
|
99
|
+
content: [{ type: "text", text: `Error: The tool_call bridge cannot call itself \u2014 this would create an infinite loop. Please call the real tool directly with these arguments: ${argsJson}` }],
|
|
100
|
+
isError: true
|
|
101
|
+
};
|
|
102
|
+
}
|
|
98
103
|
const normalizedArgs = Object.keys(args).length > 0 ? args : {};
|
|
99
104
|
stats.argNormalizations++;
|
|
100
105
|
const argsJson = JSON.stringify(normalizedArgs);
|
|
@@ -204,7 +209,8 @@ ${argsJson}`
|
|
|
204
209
|
}
|
|
205
210
|
}
|
|
206
211
|
}
|
|
207
|
-
} catch {
|
|
212
|
+
} catch (err) {
|
|
213
|
+
debugLog("react-fallback", "failed to extract JSON from parse test input", err);
|
|
208
214
|
}
|
|
209
215
|
if (looksLikeSchemaDump(text)) {
|
|
210
216
|
lines.push(warn("Text appears to be a tool schema dump (not a tool call)"));
|
|
@@ -221,18 +227,6 @@ ${argsJson}`
|
|
|
221
227
|
});
|
|
222
228
|
}
|
|
223
229
|
});
|
|
224
|
-
pi._reactParser = {
|
|
225
|
-
parseReact,
|
|
226
|
-
parseReactWithPatterns,
|
|
227
|
-
detectReactDialect,
|
|
228
|
-
sanitizeModelJson,
|
|
229
|
-
extractToolFromJson,
|
|
230
|
-
fuzzyMatchToolName,
|
|
231
|
-
normalizeArguments,
|
|
232
|
-
looksLikeSchemaDump,
|
|
233
|
-
REACT_DIALECTS,
|
|
234
|
-
ALL_DIALECT_PATTERNS
|
|
235
|
-
};
|
|
236
230
|
}
|
|
237
231
|
export {
|
|
238
232
|
react_fallback_temp_default as default
|