@polka-codes/runner 0.9.22 → 0.9.24
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 +71 -44
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -18209,7 +18209,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
18209
18209
|
define2(module.exports, Symbol.for("setupWindows"), setupWindows);
|
|
18210
18210
|
});
|
|
18211
18211
|
|
|
18212
|
-
//
|
|
18212
|
+
// ../cli-shared/node_modules/mime-types/node_modules/mime-db/db.json
|
|
18213
18213
|
var require_db = __commonJS((exports, module) => {
|
|
18214
18214
|
module.exports = {
|
|
18215
18215
|
"application/1d-interleaved-parityfec": {
|
|
@@ -27555,7 +27555,7 @@ var require_db = __commonJS((exports, module) => {
|
|
|
27555
27555
|
};
|
|
27556
27556
|
});
|
|
27557
27557
|
|
|
27558
|
-
//
|
|
27558
|
+
// ../cli-shared/node_modules/mime-types/node_modules/mime-db/index.js
|
|
27559
27559
|
var require_mime_db = __commonJS((exports, module) => {
|
|
27560
27560
|
/*!
|
|
27561
27561
|
* mime-db
|
|
@@ -27566,7 +27566,7 @@ var require_mime_db = __commonJS((exports, module) => {
|
|
|
27566
27566
|
module.exports = require_db();
|
|
27567
27567
|
});
|
|
27568
27568
|
|
|
27569
|
-
//
|
|
27569
|
+
// ../cli-shared/node_modules/mime-types/mimeScore.js
|
|
27570
27570
|
var require_mimeScore = __commonJS((exports, module) => {
|
|
27571
27571
|
var FACET_SCORES = {
|
|
27572
27572
|
"prs.": 100,
|
|
@@ -30458,7 +30458,7 @@ var {
|
|
|
30458
30458
|
Help
|
|
30459
30459
|
} = import__.default;
|
|
30460
30460
|
// package.json
|
|
30461
|
-
var version = "0.9.
|
|
30461
|
+
var version = "0.9.24";
|
|
30462
30462
|
|
|
30463
30463
|
// src/runner.ts
|
|
30464
30464
|
import { execSync } from "node:child_process";
|
|
@@ -66765,13 +66765,14 @@ Retrying request ${i + 2} of ${retryCount}`);
|
|
|
66765
66765
|
return resp;
|
|
66766
66766
|
};
|
|
66767
66767
|
let hasPause = false;
|
|
66768
|
+
const toolUseContents = response.filter((c) => c.type === "tool_use");
|
|
66768
66769
|
outer:
|
|
66769
66770
|
for (const content of response) {
|
|
66770
66771
|
switch (content.type) {
|
|
66771
66772
|
case "text":
|
|
66772
66773
|
break;
|
|
66773
66774
|
case "tool_use": {
|
|
66774
|
-
await this.#callback({ kind: "ToolUse" /* ToolUse */, agent: this, tool: content.name,
|
|
66775
|
+
await this.#callback({ kind: "ToolUse" /* ToolUse */, agent: this, tool: content.name, params: content.params });
|
|
66775
66776
|
const toolResp = await this.#invokeTool(content.name, content.params);
|
|
66776
66777
|
switch (toolResp.type) {
|
|
66777
66778
|
case "Reply" /* Reply */: {
|
|
@@ -66780,52 +66781,73 @@ Retrying request ${i + 2} of ${retryCount}`);
|
|
|
66780
66781
|
break;
|
|
66781
66782
|
}
|
|
66782
66783
|
case "Exit" /* Exit */:
|
|
66784
|
+
case "HandOver" /* HandOver */:
|
|
66785
|
+
case "Delegate" /* Delegate */: {
|
|
66786
|
+
if (this.config.toolFormat === "native" && toolUseContents.length > 1) {
|
|
66787
|
+
const message = {
|
|
66788
|
+
type: "Error" /* Error */,
|
|
66789
|
+
message: {
|
|
66790
|
+
type: "error-text",
|
|
66791
|
+
value: `Error: The tool '${content.name}' must be called alone, but it was called with other tools.`
|
|
66792
|
+
},
|
|
66793
|
+
canRetry: false
|
|
66794
|
+
};
|
|
66795
|
+
await this.#callback({ kind: "ToolError" /* ToolError */, agent: this, tool: content.name, error: message });
|
|
66796
|
+
toolResponses.push({
|
|
66797
|
+
type: "response",
|
|
66798
|
+
tool: content.name,
|
|
66799
|
+
response: processResponse(message.message),
|
|
66800
|
+
id: content.id
|
|
66801
|
+
});
|
|
66802
|
+
break;
|
|
66803
|
+
}
|
|
66783
66804
|
if (toolResponses.length > 0) {
|
|
66784
66805
|
break outer;
|
|
66785
66806
|
}
|
|
66786
|
-
|
|
66807
|
+
if (toolResp.type === "Exit" /* Exit */) {
|
|
66808
|
+
return { type: "exit", reason: toolResp };
|
|
66809
|
+
}
|
|
66810
|
+
if (toolResp.type === "HandOver" /* HandOver */) {
|
|
66811
|
+
await this.#callback({
|
|
66812
|
+
kind: "ToolHandOver" /* ToolHandOver */,
|
|
66813
|
+
agent: this,
|
|
66814
|
+
tool: content.name,
|
|
66815
|
+
agentName: toolResp.agentName,
|
|
66816
|
+
task: toolResp.task,
|
|
66817
|
+
context: toolResp.context,
|
|
66818
|
+
files: toolResp.files
|
|
66819
|
+
});
|
|
66820
|
+
return { type: "exit", reason: toolResp };
|
|
66821
|
+
}
|
|
66822
|
+
if (toolResp.type === "Delegate" /* Delegate */) {
|
|
66823
|
+
await this.#callback({
|
|
66824
|
+
kind: "ToolDelegate" /* ToolDelegate */,
|
|
66825
|
+
agent: this,
|
|
66826
|
+
tool: content.name,
|
|
66827
|
+
agentName: toolResp.agentName,
|
|
66828
|
+
task: toolResp.task,
|
|
66829
|
+
context: toolResp.context,
|
|
66830
|
+
files: toolResp.files
|
|
66831
|
+
});
|
|
66832
|
+
return { type: "exit", reason: toolResp };
|
|
66833
|
+
}
|
|
66834
|
+
break;
|
|
66835
|
+
}
|
|
66787
66836
|
case "Invalid" /* Invalid */: {
|
|
66788
66837
|
await this.#callback({ kind: "ToolInvalid" /* ToolInvalid */, agent: this, tool: content.name, content: toolResp.message });
|
|
66789
66838
|
toolResponses.push({ type: "response", tool: content.name, response: processResponse(toolResp.message), id: content.id });
|
|
66790
|
-
|
|
66791
|
-
}
|
|
66792
|
-
case "Error" /* Error */: {
|
|
66793
|
-
await this.#callback({ kind: "ToolError" /* ToolError */, agent: this, tool: content.name, content: toolResp.message });
|
|
66794
|
-
toolResponses.push({ type: "response", tool: content.name, response: processResponse(toolResp.message), id: content.id });
|
|
66795
|
-
break outer;
|
|
66796
|
-
}
|
|
66797
|
-
case "Interrupted" /* Interrupted */:
|
|
66798
|
-
await this.#callback({ kind: "ToolInterrupted" /* ToolInterrupted */, agent: this, tool: content.name, content: toolResp.message });
|
|
66799
|
-
return { type: "exit", reason: toolResp };
|
|
66800
|
-
case "HandOver" /* HandOver */: {
|
|
66801
|
-
if (toolResponses.length > 0) {
|
|
66839
|
+
if (this.config.toolFormat !== "native") {
|
|
66802
66840
|
break outer;
|
|
66803
66841
|
}
|
|
66804
|
-
|
|
66805
|
-
kind: "ToolHandOver" /* ToolHandOver */,
|
|
66806
|
-
agent: this,
|
|
66807
|
-
tool: content.name,
|
|
66808
|
-
agentName: toolResp.agentName,
|
|
66809
|
-
task: toolResp.task,
|
|
66810
|
-
context: toolResp.context,
|
|
66811
|
-
files: toolResp.files
|
|
66812
|
-
});
|
|
66813
|
-
return { type: "exit", reason: toolResp };
|
|
66842
|
+
break;
|
|
66814
66843
|
}
|
|
66815
|
-
case "
|
|
66816
|
-
|
|
66844
|
+
case "Error" /* Error */: {
|
|
66845
|
+
await this.#callback({ kind: "ToolError" /* ToolError */, agent: this, tool: content.name, error: toolResp.message });
|
|
66846
|
+
toolResponses.push({ type: "response", tool: content.name, response: processResponse(toolResp.message), id: content.id });
|
|
66847
|
+
if (this.config.toolFormat !== "native") {
|
|
66817
66848
|
break outer;
|
|
66818
66849
|
}
|
|
66819
|
-
|
|
66820
|
-
kind: "ToolDelegate" /* ToolDelegate */,
|
|
66821
|
-
agent: this,
|
|
66822
|
-
tool: content.name,
|
|
66823
|
-
agentName: toolResp.agentName,
|
|
66824
|
-
task: toolResp.task,
|
|
66825
|
-
context: toolResp.context,
|
|
66826
|
-
files: toolResp.files
|
|
66827
|
-
});
|
|
66828
|
-
return { type: "exit", reason: toolResp };
|
|
66850
|
+
break;
|
|
66829
66851
|
}
|
|
66830
66852
|
case "Pause" /* Pause */: {
|
|
66831
66853
|
await this.#callback({ kind: "ToolPause" /* ToolPause */, agent: this, tool: content.name, object: toolResp.object });
|
|
@@ -67445,8 +67467,13 @@ class MultiAgent {
|
|
|
67445
67467
|
throw new Error("An active agent already exists");
|
|
67446
67468
|
}
|
|
67447
67469
|
this.#originalTask = options.task;
|
|
67448
|
-
|
|
67449
|
-
|
|
67470
|
+
const userContent = options.files ?? [];
|
|
67471
|
+
userContent.push({
|
|
67472
|
+
type: "text",
|
|
67473
|
+
text: `<task>${options.task}</task>
|
|
67474
|
+
<context>${options.context}</context>`
|
|
67475
|
+
});
|
|
67476
|
+
return this.#startTask(options.agentName, userContent);
|
|
67450
67477
|
}
|
|
67451
67478
|
async continueTask(userMessage) {
|
|
67452
67479
|
if (!this.#agents.length) {
|
|
@@ -67959,7 +67986,7 @@ var handler15 = async (provider2, args) => {
|
|
|
67959
67986
|
commandParts.push(commitRange);
|
|
67960
67987
|
}
|
|
67961
67988
|
if (file3) {
|
|
67962
|
-
commandParts.push("--", file3);
|
|
67989
|
+
commandParts.push("--", `'${file3}'`);
|
|
67963
67990
|
}
|
|
67964
67991
|
const command = commandParts.join(" ");
|
|
67965
67992
|
try {
|
|
@@ -73445,7 +73472,7 @@ ${page}${helpTipBottom}${choiceDescription}${import_ansi_escapes2.default.cursor
|
|
|
73445
73472
|
// ../cli-shared/src/provider.ts
|
|
73446
73473
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
73447
73474
|
|
|
73448
|
-
//
|
|
73475
|
+
// ../cli-shared/node_modules/mime-types/index.js
|
|
73449
73476
|
/*!
|
|
73450
73477
|
* mime-types
|
|
73451
73478
|
* Copyright(c) 2014 Jonathan Ong
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polka-codes/runner",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.24",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"author": "github@polka.codes",
|
|
6
6
|
"type": "module",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"build": "bun build src/index.ts --outdir dist --target node"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@polka-codes/cli-shared": "0.9.
|
|
21
|
-
"@polka-codes/core": "0.9.
|
|
20
|
+
"@polka-codes/cli-shared": "0.9.22",
|
|
21
|
+
"@polka-codes/core": "0.9.22",
|
|
22
22
|
"commander": "^14.0.0",
|
|
23
23
|
"dotenv": "^16.4.7",
|
|
24
24
|
"ignore": "^7.0.3",
|