@sandagent/runner-cli 0.9.16-beta.1 → 0.9.16-beta.2
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 +23 -33
- 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,
|
|
1212
|
+
import { AuthStorage, createAgentSession, createBashTool, 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";
|
|
@@ -1297,8 +1297,25 @@ var SandagentResourceLoader = class {
|
|
|
1297
1297
|
};
|
|
1298
1298
|
|
|
1299
1299
|
// ../../packages/runner-pi/dist/pi-runner.js
|
|
1300
|
+
function buildEnvInjectedBashTool(cwd, extraEnv) {
|
|
1301
|
+
const bashAgentTool = createBashTool(cwd, {
|
|
1302
|
+
spawnHook: (ctx) => ({
|
|
1303
|
+
...ctx,
|
|
1304
|
+
env: { ...ctx.env, ...extraEnv }
|
|
1305
|
+
})
|
|
1306
|
+
});
|
|
1307
|
+
return {
|
|
1308
|
+
name: bashAgentTool.name,
|
|
1309
|
+
label: bashAgentTool.label ?? "bash",
|
|
1310
|
+
description: bashAgentTool.description,
|
|
1311
|
+
// biome-ignore lint/suspicious/noExplicitAny: schema is a TypeBox object from pi internals
|
|
1312
|
+
parameters: bashAgentTool.parameters,
|
|
1313
|
+
execute(toolCallId, params, signal, onUpdate) {
|
|
1314
|
+
return bashAgentTool.execute(toolCallId, params, signal, onUpdate);
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1300
1318
|
var LOG_PREFIX2 = "[sandagent:pi]";
|
|
1301
|
-
var DEBUG_ENABLED = process.env.DEBUG === "true" || process.env.DEBUG === "1";
|
|
1302
1319
|
function parseModelSpec(model) {
|
|
1303
1320
|
const trimmed = model.trim();
|
|
1304
1321
|
const separator = trimmed.indexOf(":");
|
|
@@ -1383,7 +1400,8 @@ function getErrorFromAgentEndMessages(messages) {
|
|
|
1383
1400
|
return void 0;
|
|
1384
1401
|
}
|
|
1385
1402
|
function traceRawMessage(debugCwd, data, reset = false) {
|
|
1386
|
-
|
|
1403
|
+
const enabled = process.env.DEBUG === "true" || process.env.DEBUG === "1";
|
|
1404
|
+
if (!enabled)
|
|
1387
1405
|
return;
|
|
1388
1406
|
try {
|
|
1389
1407
|
const file = join5(debugCwd, "pi-message-stream-debug.json");
|
|
@@ -1444,10 +1462,6 @@ function createPiRunner(options = {}) {
|
|
|
1444
1462
|
applyModelOverrides(model, provider, options.env);
|
|
1445
1463
|
return {
|
|
1446
1464
|
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
|
-
}
|
|
1451
1465
|
if (inlineApiKey !== void 0) {
|
|
1452
1466
|
modelRegistry.authStorage.setRuntimeApiKey(provider, inlineApiKey);
|
|
1453
1467
|
}
|
|
@@ -1471,38 +1485,14 @@ function createPiRunner(options = {}) {
|
|
|
1471
1485
|
if (resourceLoader) {
|
|
1472
1486
|
await resourceLoader.reload();
|
|
1473
1487
|
}
|
|
1474
|
-
const
|
|
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
|
-
}
|
|
1488
|
+
const customTools = options.env && Object.keys(options.env).length > 0 ? [buildEnvInjectedBashTool(cwd, options.env)] : [];
|
|
1499
1489
|
const { session } = await createAgentSession({
|
|
1500
1490
|
cwd,
|
|
1501
1491
|
model,
|
|
1502
1492
|
sessionManager,
|
|
1503
1493
|
modelRegistry,
|
|
1504
1494
|
resourceLoader,
|
|
1505
|
-
|
|
1495
|
+
customTools
|
|
1506
1496
|
});
|
|
1507
1497
|
if (options.systemPrompt != null && options.systemPrompt !== "") {
|
|
1508
1498
|
const existing = session.agent.state.systemPrompt ?? "";
|
package/package.json
CHANGED