@vtstech/pi-react-fallback 1.2.0 → 1.2.2

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/react-fallback.js +10 -5
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@vtstech/pi-react-fallback",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "ReAct fallback extension for Pi Coding Agent",
5
5
  "main": "react-fallback.js",
6
- "keywords": ["pi-extensions"],
6
+ "keywords": ["pi-package", "pi", "pi-coding-agent", "pi-extensions"],
7
7
  "license": "MIT",
8
8
  "access": "public",
9
9
  "type": "module",
@@ -14,7 +14,7 @@
14
14
  "url": "https://github.com/VTSTech/pi-coding-agent"
15
15
  },
16
16
  "dependencies": {
17
- "@vtstech/pi-shared": "1.2.0"
17
+ "@vtstech/pi-shared": "1.2.2"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@mariozechner/pi-coding-agent": ">=0.66"
package/react-fallback.js CHANGED
@@ -33,6 +33,7 @@ function writeReactConfig(config) {
33
33
  }
34
34
  function react_fallback_temp_default(pi) {
35
35
  let reactModeEnabled = readReactConfig().enabled;
36
+ let bridgeRegistered = false;
36
37
  let stats = { bridgeCalls: 0, fuzzyMatches: 0, argNormalizations: 0, parseFailures: 0 };
37
38
  const branding = [
38
39
  ` \u26A1 Pi ReAct Fallback Extension v${EXTENSION_VERSION}`,
@@ -93,6 +94,9 @@ The bridge will match your tool name (fuzzy matching supported) and normalize ar
93
94
  isError: true
94
95
  };
95
96
  }
97
+ const normalizedArgs = Object.keys(args).length > 0 ? args : {};
98
+ stats.argNormalizations++;
99
+ const argsJson = JSON.stringify(normalizedArgs);
96
100
  if (targetToolName === "tool_call") {
97
101
  stats.parseFailures++;
98
102
  return {
@@ -100,9 +104,6 @@ The bridge will match your tool name (fuzzy matching supported) and normalize ar
100
104
  isError: true
101
105
  };
102
106
  }
103
- const normalizedArgs = Object.keys(args).length > 0 ? args : {};
104
- stats.argNormalizations++;
105
- const argsJson = JSON.stringify(normalizedArgs);
106
107
  return {
107
108
  content: [{
108
109
  type: "text",
@@ -116,7 +117,8 @@ ${argsJson}`
116
117
  }
117
118
  });
118
119
  }
119
- if (reactModeEnabled) {
120
+ if (reactModeEnabled && !bridgeRegistered) {
121
+ bridgeRegistered = true;
120
122
  registerBridgeTool();
121
123
  }
122
124
  pi.on("context", (event) => {
@@ -149,7 +151,10 @@ ${argsJson}`
149
151
  lines.push(info(`Argument normalizations: ${stats.argNormalizations}`));
150
152
  lines.push(info(`Parse failures: ${stats.parseFailures}`));
151
153
  if (reactModeEnabled) {
152
- registerBridgeTool();
154
+ if (!bridgeRegistered) {
155
+ bridgeRegistered = true;
156
+ registerBridgeTool();
157
+ }
153
158
  lines.push(ok("The tool_call bridge tool is now available to the model"));
154
159
  lines.push(info("ReAct system prompt instructions have been added"));
155
160
  lines.push(info("Run /reload to make the bridge tool available to the current model"));