@sandagent/runner-cli 0.9.2 → 0.9.3
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 +46 -15
- package/package.json +3 -3
package/dist/bundle.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import { resolve as
|
|
4
|
+
import { resolve as resolve3 } from "node:path";
|
|
5
5
|
import { config } from "dotenv";
|
|
6
6
|
import { parseArgs } from "node:util";
|
|
7
7
|
|
|
@@ -503,7 +503,7 @@ function createCanUseToolCallback(claudeOptions) {
|
|
|
503
503
|
}
|
|
504
504
|
} catch {
|
|
505
505
|
}
|
|
506
|
-
await new Promise((
|
|
506
|
+
await new Promise((resolve4) => setTimeout(resolve4, 500));
|
|
507
507
|
}
|
|
508
508
|
try {
|
|
509
509
|
fs2.unlinkSync(approvalFile);
|
|
@@ -671,7 +671,7 @@ Documentation: https://platform.claude.com/docs/en/agent-sdk/typescript-v2-previ
|
|
|
671
671
|
id: textId,
|
|
672
672
|
delta: word + " "
|
|
673
673
|
});
|
|
674
|
-
await new Promise((
|
|
674
|
+
await new Promise((resolve4) => setTimeout(resolve4, 20));
|
|
675
675
|
}
|
|
676
676
|
yield formatDataStream({ type: "text-end", id: textId });
|
|
677
677
|
yield formatDataStream({
|
|
@@ -847,7 +847,7 @@ function createCodexRunner(options) {
|
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
|
-
} catch (
|
|
850
|
+
} catch (_e) {
|
|
851
851
|
}
|
|
852
852
|
const streamedTurn = await thread.runStreamed(inputToCodex, {
|
|
853
853
|
signal: options.abortController?.signal
|
|
@@ -1196,15 +1196,41 @@ function createOpenCodeRunner(options = {}) {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
|
|
1198
1198
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
1199
|
-
import { appendFileSync as appendFileSync2, existsSync as
|
|
1199
|
+
import { appendFileSync as appendFileSync2, existsSync as existsSync4, unlinkSync as unlinkSync3 } from "node:fs";
|
|
1200
1200
|
import { join as join5 } from "node:path";
|
|
1201
1201
|
import { getModel } from "@mariozechner/pi-ai";
|
|
1202
1202
|
import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@mariozechner/pi-coding-agent";
|
|
1203
1203
|
|
|
1204
1204
|
// ../../packages/runner-pi/dist/sandagent-resource-loader.js
|
|
1205
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
1205
1206
|
import { homedir } from "node:os";
|
|
1206
|
-
import { join as join4 } from "node:path";
|
|
1207
|
+
import { isAbsolute, join as join4, resolve as resolve2 } from "node:path";
|
|
1207
1208
|
import { DefaultResourceLoader, loadSkills } from "@mariozechner/pi-coding-agent";
|
|
1209
|
+
var LOG_PREFIX = "[sandagent:pi]";
|
|
1210
|
+
function logSkillLoad(cwd, agentDir, skillPaths, result) {
|
|
1211
|
+
const lines = [
|
|
1212
|
+
`${LOG_PREFIX} loadSkills`,
|
|
1213
|
+
` cwd: ${cwd}`,
|
|
1214
|
+
` agentDir: ${agentDir}`,
|
|
1215
|
+
` extra skillPaths (${skillPaths.length}):`
|
|
1216
|
+
];
|
|
1217
|
+
for (const raw of skillPaths) {
|
|
1218
|
+
const abs = isAbsolute(raw) ? raw : resolve2(cwd, raw);
|
|
1219
|
+
lines.push(` ${raw} -> ${abs} (exists: ${existsSync3(abs) ? "yes" : "no"})`);
|
|
1220
|
+
}
|
|
1221
|
+
lines.push(` loaded skills: ${result.skills.length}`);
|
|
1222
|
+
if (result.skills.length > 0) {
|
|
1223
|
+
lines.push(` skill names: ${result.skills.map((s) => s.name).join(", ")}`);
|
|
1224
|
+
}
|
|
1225
|
+
if (result.diagnostics.length > 0) {
|
|
1226
|
+
lines.push(` diagnostics (${result.diagnostics.length}):`);
|
|
1227
|
+
for (const d of result.diagnostics) {
|
|
1228
|
+
const pathPart = d.path !== void 0 ? ` path=${d.path}` : "";
|
|
1229
|
+
lines.push(` [${d.type}] ${d.message}${pathPart}`);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
console.error(lines.join("\n"));
|
|
1233
|
+
}
|
|
1208
1234
|
var SandagentResourceLoader = class {
|
|
1209
1235
|
constructor(options = {}) {
|
|
1210
1236
|
this.cwd = options.cwd ?? process.cwd();
|
|
@@ -1227,6 +1253,9 @@ var SandagentResourceLoader = class {
|
|
|
1227
1253
|
agentDir: this.agentDir,
|
|
1228
1254
|
skillPaths: this.skillPaths
|
|
1229
1255
|
});
|
|
1256
|
+
if (this.skillPaths.length > 0) {
|
|
1257
|
+
logSkillLoad(this.cwd, this.agentDir, this.skillPaths, this.cachedSkills);
|
|
1258
|
+
}
|
|
1230
1259
|
}
|
|
1231
1260
|
return this.cachedSkills;
|
|
1232
1261
|
}
|
|
@@ -1258,6 +1287,7 @@ var SandagentResourceLoader = class {
|
|
|
1258
1287
|
};
|
|
1259
1288
|
|
|
1260
1289
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
1290
|
+
var LOG_PREFIX2 = "[sandagent:pi]";
|
|
1261
1291
|
function parseModelSpec(model) {
|
|
1262
1292
|
const trimmed = model.trim();
|
|
1263
1293
|
const separator = trimmed.indexOf(":");
|
|
@@ -1347,7 +1377,7 @@ function traceRawMessage(debugCwd, data, reset = false) {
|
|
|
1347
1377
|
return;
|
|
1348
1378
|
try {
|
|
1349
1379
|
const file = join5(debugCwd, "pi-message-stream-debug.json");
|
|
1350
|
-
if (reset &&
|
|
1380
|
+
if (reset && existsSync4(file))
|
|
1351
1381
|
unlinkSync3(file);
|
|
1352
1382
|
const type = data !== null && typeof data === "object" ? data.type : void 0;
|
|
1353
1383
|
let payload = data;
|
|
@@ -1416,6 +1446,9 @@ function createPiRunner(options = {}) {
|
|
|
1416
1446
|
return SessionManager.create(cwd);
|
|
1417
1447
|
})();
|
|
1418
1448
|
const resourceLoader = options.skillPaths ? new SandagentResourceLoader({ cwd, skillPaths: options.skillPaths }) : void 0;
|
|
1449
|
+
if (options.skillPaths && options.skillPaths.length > 0) {
|
|
1450
|
+
console.error(`${LOG_PREFIX2} runner: cwd=${cwd} skillPaths=${JSON.stringify(options.skillPaths)}`);
|
|
1451
|
+
}
|
|
1419
1452
|
if (resourceLoader) {
|
|
1420
1453
|
await resourceLoader.reload();
|
|
1421
1454
|
}
|
|
@@ -1428,8 +1461,6 @@ function createPiRunner(options = {}) {
|
|
|
1428
1461
|
});
|
|
1429
1462
|
if (options.systemPrompt != null && options.systemPrompt !== "") {
|
|
1430
1463
|
session.agent.setSystemPrompt(options.systemPrompt);
|
|
1431
|
-
} else {
|
|
1432
|
-
session.agent.setSystemPrompt("You are a helpful coding assistant.");
|
|
1433
1464
|
}
|
|
1434
1465
|
const eventQueue = [];
|
|
1435
1466
|
let isComplete = false;
|
|
@@ -1478,7 +1509,7 @@ function createPiRunner(options = {}) {
|
|
|
1478
1509
|
}
|
|
1479
1510
|
}
|
|
1480
1511
|
}
|
|
1481
|
-
} catch (
|
|
1512
|
+
} catch (_e) {
|
|
1482
1513
|
}
|
|
1483
1514
|
const promptPromise = session.prompt(promptText, images ? { images } : void 0);
|
|
1484
1515
|
const messageId = `msg_${Date.now()}_${Math.random().toString(36).slice(2)}`;
|
|
@@ -1576,8 +1607,8 @@ function createPiRunner(options = {}) {
|
|
|
1576
1607
|
break;
|
|
1577
1608
|
}
|
|
1578
1609
|
if (!isComplete && eventQueue.length === 0) {
|
|
1579
|
-
await new Promise((
|
|
1580
|
-
wakeConsumer =
|
|
1610
|
+
await new Promise((resolve4) => {
|
|
1611
|
+
wakeConsumer = resolve4;
|
|
1581
1612
|
});
|
|
1582
1613
|
}
|
|
1583
1614
|
}
|
|
@@ -1673,9 +1704,9 @@ async function runAgent(options) {
|
|
|
1673
1704
|
}
|
|
1674
1705
|
|
|
1675
1706
|
// src/cli.ts
|
|
1676
|
-
config({ path:
|
|
1677
|
-
config({ path:
|
|
1678
|
-
config({ path:
|
|
1707
|
+
config({ path: resolve3(process.cwd(), ".env") });
|
|
1708
|
+
config({ path: resolve3(process.cwd(), "../.env") });
|
|
1709
|
+
config({ path: resolve3(process.cwd(), "../../.env") });
|
|
1679
1710
|
function getSubcommand() {
|
|
1680
1711
|
for (let i = 2; i < process.argv.length; i++) {
|
|
1681
1712
|
const a = process.argv[i];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sandagent/runner-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
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": {
|
|
@@ -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-codex": "0.6.2",
|
|
57
|
-
"@sandagent/runner-claude": "0.6.2",
|
|
58
56
|
"@sandagent/runner-core": "0.1.0",
|
|
57
|
+
"@sandagent/runner-claude": "0.6.2",
|
|
59
58
|
"@sandagent/runner-gemini": "0.6.2",
|
|
60
59
|
"@sandagent/runner-opencode": "0.6.2",
|
|
60
|
+
"@sandagent/runner-codex": "0.6.2",
|
|
61
61
|
"@sandagent/runner-pi": "0.6.3"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|