@sandagent/runner-cli 0.9.16-beta.1 → 0.9.16-beta.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.
Files changed (2) hide show
  1. package/dist/bundle.mjs +34 -34
  2. package/package.json +4 -4
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, createCodingTools, ModelRegistry, SessionManager } from "@mariozechner/pi-coding-agent";
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,34 @@ var SandagentResourceLoader = class {
1297
1297
  };
1298
1298
 
1299
1299
  // ../../packages/runner-pi/dist/pi-runner.js
1300
+ function redactSecrets(text, secrets) {
1301
+ let result = text;
1302
+ for (const value of Object.values(secrets)) {
1303
+ if (value.length < 4)
1304
+ continue;
1305
+ result = result.split(value).join("[REDACTED]");
1306
+ }
1307
+ return result;
1308
+ }
1309
+ function buildEnvInjectedBashTool(cwd, extraEnv) {
1310
+ const bashAgentTool = createBashTool(cwd, {
1311
+ spawnHook: (ctx) => ({
1312
+ ...ctx,
1313
+ env: { ...ctx.env, ...extraEnv }
1314
+ })
1315
+ });
1316
+ return {
1317
+ name: bashAgentTool.name,
1318
+ label: bashAgentTool.label ?? "bash",
1319
+ description: bashAgentTool.description,
1320
+ // biome-ignore lint/suspicious/noExplicitAny: TypeBox schema from pi internals
1321
+ parameters: bashAgentTool.parameters,
1322
+ execute(toolCallId, params, signal, onUpdate) {
1323
+ return bashAgentTool.execute(toolCallId, params, signal, onUpdate);
1324
+ }
1325
+ };
1326
+ }
1300
1327
  var LOG_PREFIX2 = "[sandagent:pi]";
1301
- var DEBUG_ENABLED = process.env.DEBUG === "true" || process.env.DEBUG === "1";
1302
1328
  function parseModelSpec(model) {
1303
1329
  const trimmed = model.trim();
1304
1330
  const separator = trimmed.indexOf(":");
@@ -1383,7 +1409,8 @@ function getErrorFromAgentEndMessages(messages) {
1383
1409
  return void 0;
1384
1410
  }
1385
1411
  function traceRawMessage(debugCwd, data, reset = false) {
1386
- if (!DEBUG_ENABLED)
1412
+ const enabled = process.env.DEBUG === "true" || process.env.DEBUG === "1";
1413
+ if (!enabled)
1387
1414
  return;
1388
1415
  try {
1389
1416
  const file = join5(debugCwd, "pi-message-stream-debug.json");
@@ -1444,10 +1471,6 @@ function createPiRunner(options = {}) {
1444
1471
  applyModelOverrides(model, provider, options.env);
1445
1472
  return {
1446
1473
  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
1474
  if (inlineApiKey !== void 0) {
1452
1475
  modelRegistry.authStorage.setRuntimeApiKey(provider, inlineApiKey);
1453
1476
  }
@@ -1471,38 +1494,14 @@ function createPiRunner(options = {}) {
1471
1494
  if (resourceLoader) {
1472
1495
  await resourceLoader.reload();
1473
1496
  }
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
- }
1497
+ const customTools = options.env && Object.keys(options.env).length > 0 ? [buildEnvInjectedBashTool(cwd, options.env)] : [];
1499
1498
  const { session } = await createAgentSession({
1500
1499
  cwd,
1501
1500
  model,
1502
1501
  sessionManager,
1503
1502
  modelRegistry,
1504
1503
  resourceLoader,
1505
- tools
1504
+ customTools
1506
1505
  });
1507
1506
  if (options.systemPrompt != null && options.systemPrompt !== "") {
1508
1507
  const existing = session.agent.state.systemPrompt ?? "";
@@ -1659,7 +1658,8 @@ ${options.systemPrompt}` : options.systemPrompt);
1659
1658
 
1660
1659
  `;
1661
1660
  } else if (event.type === "tool_execution_end") {
1662
- const output = extractToolResultText(event.result);
1661
+ const rawOutput = extractToolResultText(event.result);
1662
+ const output = event.toolName === "bash" && options.env && Object.keys(options.env).length > 0 ? redactSecrets(rawOutput, options.env) : rawOutput;
1663
1663
  yield `data: ${JSON.stringify({ type: "tool-output-available", toolCallId: event.toolCallId, output, isError: event.isError, dynamic: true, providerExecuted: true })}
1664
1664
 
1665
1665
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sandagent/runner-cli",
3
- "version": "0.9.16-beta.1",
3
+ "version": "0.9.16-beta.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,12 +53,12 @@
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-codex": "0.6.2",
59
57
  "@sandagent/runner-gemini": "0.6.2",
60
58
  "@sandagent/runner-opencode": "0.6.2",
61
- "@sandagent/runner-pi": "0.6.4-beta.0"
59
+ "@sandagent/runner-core": "0.1.1-beta.0",
60
+ "@sandagent/runner-pi": "0.6.4-beta.0",
61
+ "@sandagent/runner-codex": "0.6.2"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "tsc && pnpm bundle",