@polka-codes/cli-shared 0.7.19 → 0.7.21
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 +21 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -30522,7 +30522,7 @@ var toolInfo9 = {
|
|
|
30522
30522
|
},
|
|
30523
30523
|
{
|
|
30524
30524
|
name: "file_pattern",
|
|
30525
|
-
description: '
|
|
30525
|
+
description: 'Comma-separated glob pattern to filter files (e.g., "*.ts" for TypeScript files or "*.ts,*.js" for both TypeScript and JavaScript files). If not provided, it will search all files (*).',
|
|
30526
30526
|
required: false,
|
|
30527
30527
|
usageValue: "file pattern here (optional)"
|
|
30528
30528
|
}
|
|
@@ -30541,7 +30541,7 @@ var toolInfo9 = {
|
|
|
30541
30541
|
},
|
|
30542
30542
|
{
|
|
30543
30543
|
name: "file_pattern",
|
|
30544
|
-
value: "*.ts"
|
|
30544
|
+
value: "*.ts,*.tsx"
|
|
30545
30545
|
}
|
|
30546
30546
|
]
|
|
30547
30547
|
}
|
|
@@ -31205,6 +31205,7 @@ ${agents}`;
|
|
|
31205
31205
|
}
|
|
31206
31206
|
async#handleResponse(response) {
|
|
31207
31207
|
const toolReponses = [];
|
|
31208
|
+
let hasPause = false;
|
|
31208
31209
|
outer:
|
|
31209
31210
|
for (const content of response) {
|
|
31210
31211
|
switch (content.type) {
|
|
@@ -31216,7 +31217,7 @@ ${agents}`;
|
|
|
31216
31217
|
switch (toolResp.type) {
|
|
31217
31218
|
case "Reply" /* Reply */:
|
|
31218
31219
|
await this.#callback({ kind: "ToolReply" /* ToolReply */, agent: this, tool: content.name });
|
|
31219
|
-
toolReponses.push({ tool: content.name, response: toolResp.message });
|
|
31220
|
+
toolReponses.push({ type: "response", tool: content.name, response: toolResp.message });
|
|
31220
31221
|
break;
|
|
31221
31222
|
case "Exit" /* Exit */:
|
|
31222
31223
|
if (toolReponses.length > 0) {
|
|
@@ -31225,11 +31226,11 @@ ${agents}`;
|
|
|
31225
31226
|
return { type: "exit", reason: toolResp };
|
|
31226
31227
|
case "Invalid" /* Invalid */:
|
|
31227
31228
|
await this.#callback({ kind: "ToolInvalid" /* ToolInvalid */, agent: this, tool: content.name });
|
|
31228
|
-
toolReponses.push({ tool: content.name, response: toolResp.message });
|
|
31229
|
+
toolReponses.push({ type: "response", tool: content.name, response: toolResp.message });
|
|
31229
31230
|
break outer;
|
|
31230
31231
|
case "Error" /* Error */:
|
|
31231
31232
|
await this.#callback({ kind: "ToolError" /* ToolError */, agent: this, tool: content.name });
|
|
31232
|
-
toolReponses.push({ tool: content.name, response: toolResp.message });
|
|
31233
|
+
toolReponses.push({ type: "response", tool: content.name, response: toolResp.message });
|
|
31233
31234
|
break outer;
|
|
31234
31235
|
case "Interrupted" /* Interrupted */:
|
|
31235
31236
|
await this.#callback({ kind: "ToolInterrupted" /* ToolInterrupted */, agent: this, tool: content.name });
|
|
@@ -31274,15 +31275,23 @@ ${agents}`;
|
|
|
31274
31275
|
});
|
|
31275
31276
|
return { type: "exit", reason: delegateResp };
|
|
31276
31277
|
}
|
|
31278
|
+
case "Pause" /* Pause */: {
|
|
31279
|
+
await this.#callback({ kind: "ToolPause" /* ToolPause */, agent: this, tool: content.name, object: toolResp.object });
|
|
31280
|
+
toolReponses.push({ type: "pause", tool: content.name, object: toolResp.object });
|
|
31281
|
+
hasPause = true;
|
|
31282
|
+
}
|
|
31277
31283
|
}
|
|
31278
31284
|
break;
|
|
31279
31285
|
}
|
|
31280
31286
|
}
|
|
31281
31287
|
}
|
|
31288
|
+
if (hasPause) {
|
|
31289
|
+
return { type: "exit", reason: { type: "Pause", responses: toolReponses } };
|
|
31290
|
+
}
|
|
31282
31291
|
if (toolReponses.length === 0) {
|
|
31283
31292
|
return { type: "reply", message: responsePrompts.requireUseTool };
|
|
31284
31293
|
}
|
|
31285
|
-
const finalResp = toolReponses.map(({ tool, response: response2 }) => responsePrompts.toolResults(tool, response2)).join(`
|
|
31294
|
+
const finalResp = toolReponses.filter((resp) => resp.type === "response").map(({ tool, response: response2 }) => responsePrompts.toolResults(tool, response2)).join(`
|
|
31286
31295
|
|
|
31287
31296
|
`);
|
|
31288
31297
|
return { type: "reply", message: finalResp };
|
|
@@ -41332,7 +41341,12 @@ async function searchFiles(path2, regex, filePattern, cwd, excludeFiles) {
|
|
|
41332
41341
|
"--smart-case"
|
|
41333
41342
|
];
|
|
41334
41343
|
if (filePattern && filePattern !== "*") {
|
|
41335
|
-
|
|
41344
|
+
const patterns = filePattern.split(",").map((p2) => p2.trim()).filter(Boolean);
|
|
41345
|
+
for (const pattern of patterns) {
|
|
41346
|
+
if (pattern) {
|
|
41347
|
+
args2.push("--glob", pattern);
|
|
41348
|
+
}
|
|
41349
|
+
}
|
|
41336
41350
|
}
|
|
41337
41351
|
if (excludeFiles) {
|
|
41338
41352
|
for (const pattern of excludeFiles) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polka-codes/cli-shared",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.21",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"author": "github@polka.codes",
|
|
6
6
|
"type": "module",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"build": "bun build src/index.ts --outdir dist --target node"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@polka-codes/core": "0.7.
|
|
18
|
+
"@polka-codes/core": "0.7.20",
|
|
19
19
|
"@vscode/ripgrep": "^1.15.10",
|
|
20
20
|
"ignore": "^7.0.3",
|
|
21
21
|
"lodash": "^4.17.21",
|