@polka-codes/runner 0.7.19 → 0.7.20
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/dist/index.js +14 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22957,7 +22957,7 @@ var {
|
|
|
22957
22957
|
Help
|
|
22958
22958
|
} = import__.default;
|
|
22959
22959
|
// package.json
|
|
22960
|
-
var version = "0.7.
|
|
22960
|
+
var version = "0.7.20";
|
|
22961
22961
|
|
|
22962
22962
|
// ../cli-shared/src/config.ts
|
|
22963
22963
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -33634,6 +33634,7 @@ ${agents}`;
|
|
|
33634
33634
|
}
|
|
33635
33635
|
async#handleResponse(response) {
|
|
33636
33636
|
const toolReponses = [];
|
|
33637
|
+
let hasPause = false;
|
|
33637
33638
|
outer:
|
|
33638
33639
|
for (const content of response) {
|
|
33639
33640
|
switch (content.type) {
|
|
@@ -33645,7 +33646,7 @@ ${agents}`;
|
|
|
33645
33646
|
switch (toolResp.type) {
|
|
33646
33647
|
case "Reply" /* Reply */:
|
|
33647
33648
|
await this.#callback({ kind: "ToolReply" /* ToolReply */, agent: this, tool: content.name });
|
|
33648
|
-
toolReponses.push({ tool: content.name, response: toolResp.message });
|
|
33649
|
+
toolReponses.push({ type: "response", tool: content.name, response: toolResp.message });
|
|
33649
33650
|
break;
|
|
33650
33651
|
case "Exit" /* Exit */:
|
|
33651
33652
|
if (toolReponses.length > 0) {
|
|
@@ -33654,11 +33655,11 @@ ${agents}`;
|
|
|
33654
33655
|
return { type: "exit", reason: toolResp };
|
|
33655
33656
|
case "Invalid" /* Invalid */:
|
|
33656
33657
|
await this.#callback({ kind: "ToolInvalid" /* ToolInvalid */, agent: this, tool: content.name });
|
|
33657
|
-
toolReponses.push({ tool: content.name, response: toolResp.message });
|
|
33658
|
+
toolReponses.push({ type: "response", tool: content.name, response: toolResp.message });
|
|
33658
33659
|
break outer;
|
|
33659
33660
|
case "Error" /* Error */:
|
|
33660
33661
|
await this.#callback({ kind: "ToolError" /* ToolError */, agent: this, tool: content.name });
|
|
33661
|
-
toolReponses.push({ tool: content.name, response: toolResp.message });
|
|
33662
|
+
toolReponses.push({ type: "response", tool: content.name, response: toolResp.message });
|
|
33662
33663
|
break outer;
|
|
33663
33664
|
case "Interrupted" /* Interrupted */:
|
|
33664
33665
|
await this.#callback({ kind: "ToolInterrupted" /* ToolInterrupted */, agent: this, tool: content.name });
|
|
@@ -33703,15 +33704,23 @@ ${agents}`;
|
|
|
33703
33704
|
});
|
|
33704
33705
|
return { type: "exit", reason: delegateResp };
|
|
33705
33706
|
}
|
|
33707
|
+
case "Pause" /* Pause */: {
|
|
33708
|
+
await this.#callback({ kind: "ToolPause" /* ToolPause */, agent: this, tool: content.name, object: toolResp.object });
|
|
33709
|
+
toolReponses.push({ type: "pause", tool: content.name, object: toolResp.object });
|
|
33710
|
+
hasPause = true;
|
|
33711
|
+
}
|
|
33706
33712
|
}
|
|
33707
33713
|
break;
|
|
33708
33714
|
}
|
|
33709
33715
|
}
|
|
33710
33716
|
}
|
|
33717
|
+
if (hasPause) {
|
|
33718
|
+
return { type: "exit", reason: { type: "Pause", responses: toolReponses } };
|
|
33719
|
+
}
|
|
33711
33720
|
if (toolReponses.length === 0) {
|
|
33712
33721
|
return { type: "reply", message: responsePrompts.requireUseTool };
|
|
33713
33722
|
}
|
|
33714
|
-
const finalResp = toolReponses.map(({ tool, response: response2 }) => responsePrompts.toolResults(tool, response2)).join(`
|
|
33723
|
+
const finalResp = toolReponses.filter((resp) => resp.type === "response").map(({ tool, response: response2 }) => responsePrompts.toolResults(tool, response2)).join(`
|
|
33715
33724
|
|
|
33716
33725
|
`);
|
|
33717
33726
|
return { type: "reply", message: finalResp };
|