orchestrating 0.1.13 → 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.
Files changed (2) hide show
  1. package/bin/orch +32 -1
  2. 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
- const sessionId = randomUUID();
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();
@@ -323,6 +323,24 @@ if (adapter) {
323
323
  }
324
324
  const prompt = promptParts.join(" ") || (adapterFlags.continue ? "continue" : "hello");
325
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();
339
+ }
340
+ try {
341
+ writeFileSync(SESSION_FILE, sessionId + "\n");
342
+ } catch {}
343
+
326
344
  // Confirmation-type tools — these need "yes" response, not permission grants
327
345
  const CONFIRMATION_TOOLS = new Set(["ExitPlanMode", "EnterPlanMode"]);
328
346
 
@@ -518,11 +536,21 @@ if (adapter) {
518
536
  const newMode = msg.mode;
519
537
  yoloMode = newMode === "yolo";
520
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
+ }
521
548
  }
522
549
  };
523
550
 
524
551
  } else {
525
552
  // ======== PTY MODE (existing behavior for bash, etc.) ========
553
+ sessionId = randomUUID();
526
554
  const cols = process.stdout.columns || 80;
527
555
  const rows = process.stdout.rows || 24;
528
556
  const shell = process.env.SHELL || "/bin/zsh";
@@ -599,6 +627,9 @@ if (adapter) {
599
627
  child.stdin.write(Buffer.from(msg.data, "base64"));
600
628
  } else if (msg.type === "resize" && msg.cols && msg.rows) {
601
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");
602
633
  }
603
634
  };
604
635
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orchestrating",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Stream terminal sessions to the orchestrat.ing dashboard",
5
5
  "type": "module",
6
6
  "bin": {