orchestrating 0.1.12 → 0.1.14
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 +32 -6
- package/package.json +1 -1
package/bin/orch
CHANGED
|
@@ -213,7 +213,7 @@ if (commandArgs.length === 0) {
|
|
|
213
213
|
|
|
214
214
|
const command = commandArgs[0];
|
|
215
215
|
const spawnArgs = commandArgs.slice(1);
|
|
216
|
-
|
|
216
|
+
let sessionId;
|
|
217
217
|
const hostname = os.hostname();
|
|
218
218
|
const serverUrl = process.env.ORC_URL || process.env.CAST_URL || "wss://api.orchestrat.ing/ws";
|
|
219
219
|
const authToken = getAuthToken();
|
|
@@ -321,12 +321,25 @@ if (adapter) {
|
|
|
321
321
|
promptParts.push(arg);
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
-
const prompt = promptParts.join(" ");
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
324
|
+
const prompt = promptParts.join(" ") || (adapterFlags.continue ? "continue" : "hello");
|
|
325
|
+
|
|
326
|
+
// Session reuse: persist session ID per cwd so `-c` reconnects the same dashboard session
|
|
327
|
+
const SESSION_FILE = path.join(process.cwd(), ".orch-session");
|
|
328
|
+
if (adapterFlags.continue) {
|
|
329
|
+
try {
|
|
330
|
+
const stored = readFileSync(SESSION_FILE, "utf-8").trim();
|
|
331
|
+
if (stored) {
|
|
332
|
+
sessionId = stored;
|
|
333
|
+
process.stderr.write(`${DIM}[orch] Reusing session ${sessionId.slice(0, 8)}…${RESET}\n`);
|
|
334
|
+
}
|
|
335
|
+
} catch {}
|
|
336
|
+
}
|
|
337
|
+
if (!sessionId) {
|
|
338
|
+
sessionId = randomUUID();
|
|
329
339
|
}
|
|
340
|
+
try {
|
|
341
|
+
writeFileSync(SESSION_FILE, sessionId + "\n");
|
|
342
|
+
} catch {}
|
|
330
343
|
|
|
331
344
|
// Confirmation-type tools — these need "yes" response, not permission grants
|
|
332
345
|
const CONFIRMATION_TOOLS = new Set(["ExitPlanMode", "EnterPlanMode"]);
|
|
@@ -523,11 +536,21 @@ if (adapter) {
|
|
|
523
536
|
const newMode = msg.mode;
|
|
524
537
|
yoloMode = newMode === "yolo";
|
|
525
538
|
process.stderr.write(`${BOLD}[mode] ${yoloMode ? "YOLO" : "Normal"}${RESET}\n`);
|
|
539
|
+
} else if (msg.type === "stop_session") {
|
|
540
|
+
process.stderr.write(`${RED}[orch] Stopped from dashboard${RESET}\n`);
|
|
541
|
+
exitRequested = true;
|
|
542
|
+
if (childRunning) {
|
|
543
|
+
child.kill("SIGINT");
|
|
544
|
+
} else {
|
|
545
|
+
cleanup();
|
|
546
|
+
process.exit(0);
|
|
547
|
+
}
|
|
526
548
|
}
|
|
527
549
|
};
|
|
528
550
|
|
|
529
551
|
} else {
|
|
530
552
|
// ======== PTY MODE (existing behavior for bash, etc.) ========
|
|
553
|
+
sessionId = randomUUID();
|
|
531
554
|
const cols = process.stdout.columns || 80;
|
|
532
555
|
const rows = process.stdout.rows || 24;
|
|
533
556
|
const shell = process.env.SHELL || "/bin/zsh";
|
|
@@ -604,6 +627,9 @@ if (adapter) {
|
|
|
604
627
|
child.stdin.write(Buffer.from(msg.data, "base64"));
|
|
605
628
|
} else if (msg.type === "resize" && msg.cols && msg.rows) {
|
|
606
629
|
child.stdin.write(`\x1b]R;${msg.cols};${msg.rows}\x07`);
|
|
630
|
+
} else if (msg.type === "stop_session") {
|
|
631
|
+
process.stderr.write(`${RED}[orch] Stopped from dashboard${RESET}\n`);
|
|
632
|
+
child.kill("SIGINT");
|
|
607
633
|
}
|
|
608
634
|
};
|
|
609
635
|
}
|