@polka-codes/runner 0.7.23 → 0.7.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 +13 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25790,7 +25790,7 @@ var {
|
|
|
25790
25790
|
Help
|
|
25791
25791
|
} = import__.default;
|
|
25792
25792
|
// package.json
|
|
25793
|
-
var version = "0.7.
|
|
25793
|
+
var version = "0.7.24";
|
|
25794
25794
|
|
|
25795
25795
|
// src/runner.ts
|
|
25796
25796
|
import { execSync } from "node:child_process";
|
|
@@ -36359,11 +36359,10 @@ class AgentBase {
|
|
|
36359
36359
|
ai;
|
|
36360
36360
|
config;
|
|
36361
36361
|
handlers;
|
|
36362
|
-
#messages;
|
|
36362
|
+
#messages = [];
|
|
36363
36363
|
#originalTask;
|
|
36364
|
-
constructor(name2, ai, config
|
|
36364
|
+
constructor(name2, ai, config) {
|
|
36365
36365
|
this.ai = ai;
|
|
36366
|
-
this.#messages = messages;
|
|
36367
36366
|
if (config.agents && config.agents.length > 0) {
|
|
36368
36367
|
const agents = agentsPrompt(config.agents, name2);
|
|
36369
36368
|
config.systemPrompt += `
|
|
@@ -36380,7 +36379,7 @@ ${agents}`;
|
|
|
36380
36379
|
return this.#messages;
|
|
36381
36380
|
}
|
|
36382
36381
|
setMessages(messages) {
|
|
36383
|
-
this.#messages = messages;
|
|
36382
|
+
this.#messages = [...messages];
|
|
36384
36383
|
}
|
|
36385
36384
|
async#callback(event) {
|
|
36386
36385
|
await this.config.callback?.(event);
|
|
@@ -36390,19 +36389,13 @@ ${agents}`;
|
|
|
36390
36389
|
this.#callback({ kind: "StartTask" /* StartTask */, agent: this, systemPrompt: this.config.systemPrompt });
|
|
36391
36390
|
return await this.#processLoop(prompt);
|
|
36392
36391
|
}
|
|
36393
|
-
async step(
|
|
36394
|
-
if (messages) {
|
|
36395
|
-
this.#messages = messages;
|
|
36396
|
-
}
|
|
36392
|
+
async step(prompt) {
|
|
36397
36393
|
if (this.#messages.length === 0) {
|
|
36398
36394
|
this.#callback({ kind: "StartTask" /* StartTask */, agent: this, systemPrompt: this.config.systemPrompt });
|
|
36399
36395
|
}
|
|
36400
|
-
return await this.#request(
|
|
36396
|
+
return await this.#request(prompt);
|
|
36401
36397
|
}
|
|
36402
|
-
async handleStepResponse(response
|
|
36403
|
-
if (messages) {
|
|
36404
|
-
this.#messages = messages;
|
|
36405
|
-
}
|
|
36398
|
+
async handleStepResponse(response) {
|
|
36406
36399
|
return this.#handleResponse(response);
|
|
36407
36400
|
}
|
|
36408
36401
|
async#processLoop(userMessage) {
|
|
@@ -54827,7 +54820,7 @@ class Runner {
|
|
|
54827
54820
|
if (statusCode.startsWith("R")) {
|
|
54828
54821
|
const parts2 = path4.split(" -> ");
|
|
54829
54822
|
if (parts2.length === 2) {
|
|
54830
|
-
const [
|
|
54823
|
+
const [oldPath, newPath] = parts2;
|
|
54831
54824
|
changes.push({
|
|
54832
54825
|
status: "renamed",
|
|
54833
54826
|
path: newPath,
|
|
@@ -54860,6 +54853,11 @@ class Runner {
|
|
|
54860
54853
|
console.log(`Sent content for file: ${path4}`);
|
|
54861
54854
|
} else {
|
|
54862
54855
|
console.error(`File not found: ${path4}`);
|
|
54856
|
+
this.wsManager.sendMessage({
|
|
54857
|
+
type: "error",
|
|
54858
|
+
message: "File not found",
|
|
54859
|
+
details: path4
|
|
54860
|
+
});
|
|
54863
54861
|
}
|
|
54864
54862
|
} catch (error) {
|
|
54865
54863
|
console.error(`Error reading file ${path4}:`, error);
|