@sandagent/runner-cli 0.9.19-beta.3 → 0.9.19-beta.5
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/bundle.mjs +28 -26
- package/package.json +6 -6
package/dist/bundle.mjs
CHANGED
|
@@ -1246,6 +1246,7 @@ var SandagentResourceLoader = class {
|
|
|
1246
1246
|
this.cwd = options.cwd ?? process.cwd();
|
|
1247
1247
|
this.agentDir = options.agentDir ?? join4(homedir(), ".pi", "agent");
|
|
1248
1248
|
this.skillPaths = options.skillPaths ?? [];
|
|
1249
|
+
this.extraAppendPrompt = options.appendSystemPrompt;
|
|
1249
1250
|
this.delegate = new DefaultResourceLoader({
|
|
1250
1251
|
cwd: this.cwd,
|
|
1251
1252
|
agentDir: this.agentDir,
|
|
@@ -1286,10 +1287,12 @@ var SandagentResourceLoader = class {
|
|
|
1286
1287
|
return this.delegate.getSystemPrompt();
|
|
1287
1288
|
}
|
|
1288
1289
|
getAppendSystemPrompt() {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1290
|
+
const base = this.delegate.getAppendSystemPrompt();
|
|
1291
|
+
if (this.extraAppendPrompt) {
|
|
1292
|
+
console.error(`${LOG_PREFIX} getAppendSystemPrompt: appending extra prompt (${this.extraAppendPrompt.length} chars)`);
|
|
1293
|
+
return [...base, this.extraAppendPrompt];
|
|
1294
|
+
}
|
|
1295
|
+
return base;
|
|
1293
1296
|
}
|
|
1294
1297
|
extendResources(paths) {
|
|
1295
1298
|
this.delegate.extendResources(paths);
|
|
@@ -1301,16 +1304,13 @@ function redactSecrets(text, secrets) {
|
|
|
1301
1304
|
if (Object.keys(secrets).length === 0)
|
|
1302
1305
|
return text;
|
|
1303
1306
|
let result = text;
|
|
1304
|
-
const
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
result = result.replace(new RegExp(
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
if (v.length >= 8) {
|
|
1312
|
-
result = result.split(v).join("***");
|
|
1313
|
-
}
|
|
1307
|
+
const escapeRegex = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1308
|
+
const values = Object.values(secrets).filter((v) => v.length >= 8).sort((a, b) => b.length - a.length);
|
|
1309
|
+
for (const v of values) {
|
|
1310
|
+
const ev = escapeRegex(v);
|
|
1311
|
+
result = result.replace(new RegExp(`^\\S+=.*${ev}.*$\\n?`, "gm"), "");
|
|
1312
|
+
result = result.replace(new RegExp(`\\s*["']?\\w+["']?\\s*:\\s*['"][^'"]*${ev}[^'"]*['"],?`, "g"), "");
|
|
1313
|
+
result = result.split(v).join("***");
|
|
1314
1314
|
}
|
|
1315
1315
|
result = result.replace(/\n{3,}/g, "\n\n");
|
|
1316
1316
|
return result.trim();
|
|
@@ -1450,7 +1450,7 @@ function createPiRunner(options = {}) {
|
|
|
1450
1450
|
const cwd = options.cwd || process.cwd();
|
|
1451
1451
|
const apiKeyEnvKey = `${provider.toUpperCase().replace(/-/g, "_")}_API_KEY`;
|
|
1452
1452
|
const inlineApiKey = typeof options.env?.[apiKeyEnvKey] === "string" && options.env[apiKeyEnvKey].length > 0 ? options.env[apiKeyEnvKey] : void 0;
|
|
1453
|
-
const modelRegistry =
|
|
1453
|
+
const modelRegistry = ModelRegistry.inMemory(AuthStorage.create());
|
|
1454
1454
|
const defaultModel = getModel(provider, modelName);
|
|
1455
1455
|
let model = defaultModel ?? modelRegistry.find(provider, modelName);
|
|
1456
1456
|
if (model == null) {
|
|
@@ -1500,7 +1500,11 @@ function createPiRunner(options = {}) {
|
|
|
1500
1500
|
}
|
|
1501
1501
|
return SessionManager.create(cwd);
|
|
1502
1502
|
})();
|
|
1503
|
-
const resourceLoader = options.skillPaths ? new SandagentResourceLoader({
|
|
1503
|
+
const resourceLoader = options.skillPaths ? new SandagentResourceLoader({
|
|
1504
|
+
cwd,
|
|
1505
|
+
skillPaths: options.skillPaths,
|
|
1506
|
+
appendSystemPrompt: options.systemPrompt
|
|
1507
|
+
}) : void 0;
|
|
1504
1508
|
if (options.skillPaths && options.skillPaths.length > 0) {
|
|
1505
1509
|
console.error(`${LOG_PREFIX2} runner: cwd=${cwd} skillPaths=${JSON.stringify(options.skillPaths)}`);
|
|
1506
1510
|
}
|
|
@@ -1516,14 +1520,6 @@ function createPiRunner(options = {}) {
|
|
|
1516
1520
|
resourceLoader,
|
|
1517
1521
|
customTools
|
|
1518
1522
|
});
|
|
1519
|
-
if (options.systemPrompt != null && options.systemPrompt !== "") {
|
|
1520
|
-
const existing = session.agent.state.systemPrompt ?? "";
|
|
1521
|
-
session.agent.setSystemPrompt(existing ? `${existing}
|
|
1522
|
-
|
|
1523
|
-
---
|
|
1524
|
-
|
|
1525
|
-
${options.systemPrompt}` : options.systemPrompt);
|
|
1526
|
-
}
|
|
1527
1523
|
const eventQueue = [];
|
|
1528
1524
|
let isComplete = false;
|
|
1529
1525
|
let aborted = false;
|
|
@@ -1646,8 +1642,11 @@ ${options.systemPrompt}` : options.systemPrompt);
|
|
|
1646
1642
|
yield* endTextStreamIfOpen();
|
|
1647
1643
|
yield* beginTextStream();
|
|
1648
1644
|
} else if (sub.type === "text_delta") {
|
|
1649
|
-
|
|
1645
|
+
let delta = sub.delta;
|
|
1650
1646
|
if (delta) {
|
|
1647
|
+
if (options.env && Object.keys(options.env).length > 0) {
|
|
1648
|
+
delta = redactSecrets(delta, options.env);
|
|
1649
|
+
}
|
|
1651
1650
|
if (!textStreamOpen) {
|
|
1652
1651
|
yield* beginTextStream();
|
|
1653
1652
|
}
|
|
@@ -1671,7 +1670,10 @@ ${options.systemPrompt}` : options.systemPrompt);
|
|
|
1671
1670
|
|
|
1672
1671
|
`;
|
|
1673
1672
|
} else if (event.type === "tool_execution_end") {
|
|
1674
|
-
|
|
1673
|
+
let output = extractToolResultText(event.result);
|
|
1674
|
+
if (options.env && Object.keys(options.env).length > 0) {
|
|
1675
|
+
output = redactSecrets(output, options.env);
|
|
1676
|
+
}
|
|
1675
1677
|
yield `data: ${JSON.stringify({ type: "tool-output-available", toolCallId: event.toolCallId, output, isError: event.isError, dynamic: true, providerExecuted: true })}
|
|
1676
1678
|
|
|
1677
1679
|
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sandagent/runner-cli",
|
|
3
|
-
"version": "0.9.19-beta.
|
|
3
|
+
"version": "0.9.19-beta.5",
|
|
4
4
|
"description": "SandAgent Runner CLI - Like gemini-cli or claude-code, runs in your local terminal with AI SDK UI streaming",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@anthropic-ai/claude-agent-sdk": "0.2.70",
|
|
44
|
-
"@mariozechner/pi-agent-core": "
|
|
45
|
-
"@mariozechner/pi-ai": "
|
|
46
|
-
"@mariozechner/pi-coding-agent": "
|
|
44
|
+
"@mariozechner/pi-agent-core": "0.64.0",
|
|
45
|
+
"@mariozechner/pi-ai": "0.64.0",
|
|
46
|
+
"@mariozechner/pi-coding-agent": "0.64.0",
|
|
47
47
|
"@openai/codex-sdk": "^0.110.0",
|
|
48
48
|
"dotenv": "^17.3.1",
|
|
49
49
|
"zod": "^4.0.0"
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"esbuild": "^0.27.2",
|
|
54
54
|
"typescript": "^5.3.0",
|
|
55
55
|
"vitest": "^1.6.1",
|
|
56
|
-
"@sandagent/runner-core": "0.1.1-beta.0",
|
|
57
56
|
"@sandagent/runner-claude": "0.6.2",
|
|
58
|
-
"@sandagent/runner-opencode": "0.6.2",
|
|
59
57
|
"@sandagent/runner-gemini": "0.6.2",
|
|
58
|
+
"@sandagent/runner-core": "0.1.1-beta.0",
|
|
60
59
|
"@sandagent/runner-pi": "0.6.4-beta.0",
|
|
60
|
+
"@sandagent/runner-opencode": "0.6.2",
|
|
61
61
|
"@sandagent/runner-codex": "0.6.2"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|