orchestrating 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/bin/orch +23 -7
  2. package/package.json +1 -1
package/bin/orch CHANGED
@@ -829,6 +829,7 @@ if (commandArgs.length === 0) {
829
829
  }
830
830
 
831
831
  // Resolve claude binary: prefer bundled @anthropic-ai/claude-code, fall back to system PATH
832
+ const commandName = commandArgs[0]; // original name for adapter lookup
832
833
  let command = commandArgs[0];
833
834
  let claudeBundled = false;
834
835
  if (command === "claude") {
@@ -952,7 +953,7 @@ function removePermission(tool) {
952
953
  }
953
954
 
954
955
  // --- Determine mode: structured adapter or PTY ---
955
- const adapter = ADAPTERS[command];
956
+ const adapter = ADAPTERS[commandName];
956
957
 
957
958
  // Check for python3 in PTY mode
958
959
  if (!adapter) {
@@ -1066,8 +1067,8 @@ if (adapter) {
1066
1067
  if (yoloMode && event.kind === "permission_denied") {
1067
1068
  process.stderr.write(`${GREEN}[yolo] Auto-approving: ${event.toolName}${RESET}\n`);
1068
1069
  approvePermission(event.toolName, "session");
1069
- // Send follow-up via stdin to retry (no respawn needed)
1070
- sendFollowUp(`Permission for ${event.toolName} was granted. Please retry your last action.`);
1070
+ // Permissions are file-based need respawn for Claude to pick them up
1071
+ respawnWithContinue(`Permission for ${event.toolName} was granted. Please retry your last action.`);
1071
1072
  }
1072
1073
  }
1073
1074
  });
@@ -1092,6 +1093,20 @@ if (adapter) {
1092
1093
  return proc;
1093
1094
  }
1094
1095
 
1096
+ // Respawn claude with -c (only needed for permission grants — file-based permission system)
1097
+ function respawnWithContinue(prompt) {
1098
+ if (child && child.exitCode === null) {
1099
+ child.kill("SIGTERM");
1100
+ }
1101
+ const args = ["--output-format", "stream-json", "--input-format", "stream-json", "--verbose", "-c"];
1102
+ if (yoloMode) args.push("--dangerously-skip-permissions");
1103
+ spawnClaude(args);
1104
+ // Send the prompt via stdin after spawning
1105
+ if (prompt) {
1106
+ setTimeout(() => sendFollowUp(prompt), 500);
1107
+ }
1108
+ }
1109
+
1095
1110
  // Send a follow-up message via stdin (no respawn!)
1096
1111
  function sendFollowUp(text) {
1097
1112
  if (!child || child.exitCode !== null) return;
@@ -1256,11 +1271,12 @@ if (adapter) {
1256
1271
  const scope = msg.scope || "session";
1257
1272
  approvePermission(msg.tool, scope);
1258
1273
  process.stderr.write(`${GREEN}Permission granted (${scope}): ${msg.tool}${RESET}\n`);
1259
- // Send permission grant as follow-up via stdin
1260
- sendFollowUp(`Permission for ${msg.tool} was granted. Please retry your last action.`);
1274
+ // Permissions are file-based in Claude Code — need to restart the process
1275
+ // so it picks up the updated settings.local.json
1276
+ respawnWithContinue(`Permission for ${msg.tool} was granted. Please retry your last action.`);
1261
1277
  } else if (msg.type === "agent_permission" && msg.tool && msg.action === "deny") {
1262
1278
  process.stderr.write(`${RED}Permission denied: ${msg.tool}${RESET}\n`);
1263
- sendFollowUp(`Permission for ${msg.tool} was denied by the user. Do not retry this tool — find an alternative approach or skip this step.`);
1279
+ respawnWithContinue(`Permission for ${msg.tool} was denied by the user. Do not retry this tool — find an alternative approach or skip this step.`);
1264
1280
  } else if (msg.type === "agent_permission" && msg.tool && msg.action === "revoke") {
1265
1281
  removePermission(msg.tool);
1266
1282
  broadcastPermissions();
@@ -1584,7 +1600,7 @@ async function connectWs() {
1584
1600
  token: authToken,
1585
1601
  sessionId,
1586
1602
  label: effectiveLabel,
1587
- command,
1603
+ command: commandName,
1588
1604
  args: spawnArgs,
1589
1605
  cwd: process.cwd(),
1590
1606
  hostname,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orchestrating",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Stream terminal sessions to the orchestrat.ing dashboard",
5
5
  "type": "module",
6
6
  "bin": {