orchestrating 0.3.1 → 0.3.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.
- package/bin/orch +57 -5
- package/package.json +1 -1
package/bin/orch
CHANGED
|
@@ -676,6 +676,43 @@ async function handleDaemon(projectsDir) {
|
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
678
|
|
|
679
|
+
if (msg.type === "update_cli") {
|
|
680
|
+
process.stderr.write(`${GREEN}${PREFIX} Update requested — running npm i -g orchestrating${RESET}\n`);
|
|
681
|
+
try {
|
|
682
|
+
const result = execSync("npm i -g orchestrating 2>&1", { encoding: "utf-8", timeout: 60_000 });
|
|
683
|
+
// Get the new version
|
|
684
|
+
let ver = "unknown";
|
|
685
|
+
try {
|
|
686
|
+
ver = execSync("npm list -g orchestrating --depth=0 2>/dev/null", { encoding: "utf-8" })
|
|
687
|
+
.match(/orchestrating@([\d.]+)/)?.[1] || "unknown";
|
|
688
|
+
} catch {}
|
|
689
|
+
process.stderr.write(`${GREEN}${PREFIX} Updated to v${ver}${RESET}\n`);
|
|
690
|
+
if (sock.readyState === WebSocket.OPEN) {
|
|
691
|
+
sock.send(JSON.stringify({
|
|
692
|
+
type: "update_result",
|
|
693
|
+
hostname,
|
|
694
|
+
success: true,
|
|
695
|
+
version: ver,
|
|
696
|
+
}));
|
|
697
|
+
}
|
|
698
|
+
// Restart daemon after a short delay so the result message gets sent
|
|
699
|
+
process.stderr.write(`${GREEN}${PREFIX} Restarting daemon...${RESET}\n`);
|
|
700
|
+
setTimeout(() => {
|
|
701
|
+
process.exit(0); // launchd/systemd will restart us with the new version
|
|
702
|
+
}, 1000);
|
|
703
|
+
} catch (err) {
|
|
704
|
+
process.stderr.write(`${RED}${PREFIX} Update failed: ${err.message}${RESET}\n`);
|
|
705
|
+
if (sock.readyState === WebSocket.OPEN) {
|
|
706
|
+
sock.send(JSON.stringify({
|
|
707
|
+
type: "update_result",
|
|
708
|
+
hostname,
|
|
709
|
+
success: false,
|
|
710
|
+
error: err.message,
|
|
711
|
+
}));
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
679
716
|
if (msg.type === "browse_directory") {
|
|
680
717
|
const { requestId: browseReqId, path: dirPath } = msg;
|
|
681
718
|
try {
|
|
@@ -1067,8 +1104,8 @@ if (adapter) {
|
|
|
1067
1104
|
if (yoloMode && event.kind === "permission_denied") {
|
|
1068
1105
|
process.stderr.write(`${GREEN}[yolo] Auto-approving: ${event.toolName}${RESET}\n`);
|
|
1069
1106
|
approvePermission(event.toolName, "session");
|
|
1070
|
-
//
|
|
1071
|
-
|
|
1107
|
+
// Permissions are file-based — need respawn for Claude to pick them up
|
|
1108
|
+
respawnWithContinue(`Permission for ${event.toolName} was granted. Please retry your last action.`);
|
|
1072
1109
|
}
|
|
1073
1110
|
}
|
|
1074
1111
|
});
|
|
@@ -1093,6 +1130,20 @@ if (adapter) {
|
|
|
1093
1130
|
return proc;
|
|
1094
1131
|
}
|
|
1095
1132
|
|
|
1133
|
+
// Respawn claude with -c (only needed for permission grants — file-based permission system)
|
|
1134
|
+
function respawnWithContinue(prompt) {
|
|
1135
|
+
if (child && child.exitCode === null) {
|
|
1136
|
+
child.kill("SIGTERM");
|
|
1137
|
+
}
|
|
1138
|
+
const args = ["--output-format", "stream-json", "--input-format", "stream-json", "--verbose", "-c"];
|
|
1139
|
+
if (yoloMode) args.push("--dangerously-skip-permissions");
|
|
1140
|
+
spawnClaude(args);
|
|
1141
|
+
// Send the prompt via stdin after spawning
|
|
1142
|
+
if (prompt) {
|
|
1143
|
+
setTimeout(() => sendFollowUp(prompt), 500);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1096
1147
|
// Send a follow-up message via stdin (no respawn!)
|
|
1097
1148
|
function sendFollowUp(text) {
|
|
1098
1149
|
if (!child || child.exitCode !== null) return;
|
|
@@ -1257,11 +1308,12 @@ if (adapter) {
|
|
|
1257
1308
|
const scope = msg.scope || "session";
|
|
1258
1309
|
approvePermission(msg.tool, scope);
|
|
1259
1310
|
process.stderr.write(`${GREEN}Permission granted (${scope}): ${msg.tool}${RESET}\n`);
|
|
1260
|
-
//
|
|
1261
|
-
|
|
1311
|
+
// Permissions are file-based in Claude Code — need to restart the process
|
|
1312
|
+
// so it picks up the updated settings.local.json
|
|
1313
|
+
respawnWithContinue(`Permission for ${msg.tool} was granted. Please retry your last action.`);
|
|
1262
1314
|
} else if (msg.type === "agent_permission" && msg.tool && msg.action === "deny") {
|
|
1263
1315
|
process.stderr.write(`${RED}Permission denied: ${msg.tool}${RESET}\n`);
|
|
1264
|
-
|
|
1316
|
+
respawnWithContinue(`Permission for ${msg.tool} was denied by the user. Do not retry this tool — find an alternative approach or skip this step.`);
|
|
1265
1317
|
} else if (msg.type === "agent_permission" && msg.tool && msg.action === "revoke") {
|
|
1266
1318
|
removePermission(msg.tool);
|
|
1267
1319
|
broadcastPermissions();
|