@sandagent/runner-cli 0.2.19 → 0.2.21

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 +21 -6
  2. package/package.json +2 -2
package/dist/bundle.mjs CHANGED
@@ -256,6 +256,13 @@ var AISDKStreamConverter = class {
256
256
  }
257
257
  throw new Error("Part ID not found");
258
258
  }
259
+ /** Returns part ID for index or undefined if not tracked (e.g. content_block_stop without a prior start). */
260
+ tryGetPartId(index) {
261
+ if (!this.sessionId)
262
+ return void 0;
263
+ const partIdKey = `${this.sessionId}-${index}`;
264
+ return this.partIdMap.get(partIdKey);
265
+ }
259
266
  /**
260
267
  * Helper to emit tool call
261
268
  */
@@ -296,9 +303,18 @@ var AISDKStreamConverter = class {
296
303
  delta: event.delta.text
297
304
  });
298
305
  }
306
+ if (event.type === "content_block_start" && event.content_block.type === "thinking") {
307
+ const partId = `reasoning_${generateId()}`;
308
+ this.setPartId(event.index, partId);
309
+ }
310
+ if (event.type === "content_block_delta" && event.delta?.type === "thinking_delta") {
311
+ if (event.delta.thinking) {
312
+ yield this.emit({ type: "reasoning", text: event.delta.thinking });
313
+ }
314
+ }
299
315
  if (event.type === "content_block_stop") {
300
- const partId = this.getPartId(event.index);
301
- if (partId.startsWith("text_")) {
316
+ const partId = this.tryGetPartId(event.index);
317
+ if (partId?.startsWith("text_")) {
302
318
  yield this.emit({ type: "text-end", id: partId });
303
319
  }
304
320
  }
@@ -579,6 +595,7 @@ async function* runWithClaudeAgentSDK(sdk, options, userInput) {
579
595
  }
580
596
  }
581
597
  function createSDKOptions(options) {
598
+ const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
582
599
  return {
583
600
  model: options.model,
584
601
  systemPrompt: options.systemPrompt,
@@ -594,10 +611,8 @@ function createSDKOptions(options) {
594
611
  resume: options.resume,
595
612
  settingSources: ["project", "user"],
596
613
  canUseTool: createCanUseToolCallback(options),
597
- // Bypass all permission checks for automated execution
598
- permissionMode: "bypassPermissions",
599
- allowDangerouslySkipPermissions: true,
600
- // Enable partial messages for streaming
614
+ permissionMode: isRoot ? "default" : "bypassPermissions",
615
+ allowDangerouslySkipPermissions: !isRoot,
601
616
  includePartialMessages: options.includePartialMessages
602
617
  };
603
618
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sandagent/runner-cli",
3
- "version": "0.2.19",
3
+ "version": "0.2.21",
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,7 +41,7 @@
41
41
  "anthropic"
42
42
  ],
43
43
  "dependencies": {
44
- "@anthropic-ai/claude-agent-sdk": ">=0.1.70"
44
+ "@anthropic-ai/claude-agent-sdk": "0.2.69"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "^20.10.0",