@sandagent/runner-cli 0.9.15 → 0.9.16-beta.1
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 +34 -4
- package/package.json +1 -1
package/dist/bundle.mjs
CHANGED
|
@@ -1209,7 +1209,7 @@ function createOpenCodeRunner(options = {}) {
|
|
|
1209
1209
|
import { appendFileSync as appendFileSync2, existsSync as existsSync4, unlinkSync as unlinkSync3 } from "node:fs";
|
|
1210
1210
|
import { join as join5 } from "node:path";
|
|
1211
1211
|
import { getModel } from "@mariozechner/pi-ai";
|
|
1212
|
-
import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@mariozechner/pi-coding-agent";
|
|
1212
|
+
import { AuthStorage, createAgentSession, createCodingTools, ModelRegistry, SessionManager } from "@mariozechner/pi-coding-agent";
|
|
1213
1213
|
|
|
1214
1214
|
// ../../packages/runner-pi/dist/sandagent-resource-loader.js
|
|
1215
1215
|
import { existsSync as existsSync3 } from "node:fs";
|
|
@@ -1298,6 +1298,7 @@ var SandagentResourceLoader = class {
|
|
|
1298
1298
|
|
|
1299
1299
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
1300
1300
|
var LOG_PREFIX2 = "[sandagent:pi]";
|
|
1301
|
+
var DEBUG_ENABLED = process.env.DEBUG === "true" || process.env.DEBUG === "1";
|
|
1301
1302
|
function parseModelSpec(model) {
|
|
1302
1303
|
const trimmed = model.trim();
|
|
1303
1304
|
const separator = trimmed.indexOf(":");
|
|
@@ -1382,8 +1383,7 @@ function getErrorFromAgentEndMessages(messages) {
|
|
|
1382
1383
|
return void 0;
|
|
1383
1384
|
}
|
|
1384
1385
|
function traceRawMessage(debugCwd, data, reset = false) {
|
|
1385
|
-
|
|
1386
|
-
if (!enabled)
|
|
1386
|
+
if (!DEBUG_ENABLED)
|
|
1387
1387
|
return;
|
|
1388
1388
|
try {
|
|
1389
1389
|
const file = join5(debugCwd, "pi-message-stream-debug.json");
|
|
@@ -1444,6 +1444,10 @@ function createPiRunner(options = {}) {
|
|
|
1444
1444
|
applyModelOverrides(model, provider, options.env);
|
|
1445
1445
|
return {
|
|
1446
1446
|
async *run(userInput) {
|
|
1447
|
+
if (DEBUG_ENABLED) {
|
|
1448
|
+
const envKeys = Object.keys(options.env ?? {}).sort();
|
|
1449
|
+
console.error(`${LOG_PREFIX2} runner env keys: ${envKeys.length > 0 ? envKeys.join(",") : "(none)"}`);
|
|
1450
|
+
}
|
|
1447
1451
|
if (inlineApiKey !== void 0) {
|
|
1448
1452
|
modelRegistry.authStorage.setRuntimeApiKey(provider, inlineApiKey);
|
|
1449
1453
|
}
|
|
@@ -1467,12 +1471,38 @@ function createPiRunner(options = {}) {
|
|
|
1467
1471
|
if (resourceLoader) {
|
|
1468
1472
|
await resourceLoader.reload();
|
|
1469
1473
|
}
|
|
1474
|
+
const tools = createCodingTools(cwd, {
|
|
1475
|
+
bash: {
|
|
1476
|
+
spawnHook: (ctx) => ({
|
|
1477
|
+
...ctx,
|
|
1478
|
+
env: {
|
|
1479
|
+
...ctx.env,
|
|
1480
|
+
...options.env ?? {}
|
|
1481
|
+
}
|
|
1482
|
+
})
|
|
1483
|
+
}
|
|
1484
|
+
});
|
|
1485
|
+
if (DEBUG_ENABLED) {
|
|
1486
|
+
const debugCtx = {
|
|
1487
|
+
command: "env",
|
|
1488
|
+
cwd,
|
|
1489
|
+
env: { PATH: process.env.PATH ?? "" }
|
|
1490
|
+
};
|
|
1491
|
+
const debugSpawn = tools.find((t) => t.name === "bash") ? debugCtx : debugCtx;
|
|
1492
|
+
const merged = {
|
|
1493
|
+
...debugSpawn.env,
|
|
1494
|
+
...options.env ?? {}
|
|
1495
|
+
};
|
|
1496
|
+
const mergedKeys = Object.keys(merged).sort();
|
|
1497
|
+
console.error(`${LOG_PREFIX2} bash spawn merged env key count: ${mergedKeys.length}`);
|
|
1498
|
+
}
|
|
1470
1499
|
const { session } = await createAgentSession({
|
|
1471
1500
|
cwd,
|
|
1472
1501
|
model,
|
|
1473
1502
|
sessionManager,
|
|
1474
1503
|
modelRegistry,
|
|
1475
|
-
resourceLoader
|
|
1504
|
+
resourceLoader,
|
|
1505
|
+
tools
|
|
1476
1506
|
});
|
|
1477
1507
|
if (options.systemPrompt != null && options.systemPrompt !== "") {
|
|
1478
1508
|
const existing = session.agent.state.systemPrompt ?? "";
|
package/package.json
CHANGED