orchestrating 0.1.4 → 0.1.5

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 +21 -7
  2. package/package.json +1 -1
package/bin/orch CHANGED
@@ -342,6 +342,7 @@ if (adapter) {
342
342
 
343
343
  // Spawn a claude process and wire up output handling
344
344
  function spawnClaude(claudeArgs) {
345
+ process.stderr.write(`${DIM}[orch] Spawning: ${command} ${claudeArgs.join(" ")}${RESET}\n`);
345
346
  const proc = spawn(command, claudeArgs, {
346
347
  stdio: ["pipe", "pipe", "pipe"],
347
348
  cwd: process.cwd(),
@@ -349,12 +350,16 @@ if (adapter) {
349
350
  });
350
351
  childRunning = true;
351
352
  child = proc;
353
+ process.stderr.write(`${DIM}[orch] Child PID: ${proc.pid}${RESET}\n`);
352
354
 
353
355
  // Parse NDJSON from stdout line-by-line
354
356
  const rl = readline.createInterface({ input: proc.stdout });
355
357
  let permissionsSent = false;
358
+ let lineCount = 0;
356
359
 
357
360
  rl.on("line", (line) => {
361
+ lineCount++;
362
+ process.stderr.write(`${DIM}[orch] stdout line #${lineCount}: ${line.slice(0, 120)}${RESET}\n`);
358
363
  if (!permissionsSent) {
359
364
  permissionsSent = true;
360
365
  broadcastPermissions();
@@ -364,11 +369,13 @@ if (adapter) {
364
369
  try {
365
370
  raw = JSON.parse(line);
366
371
  } catch {
372
+ process.stderr.write(`${DIM}[orch] JSON parse failed for line${RESET}\n`);
367
373
  return;
368
374
  }
369
375
 
370
376
  // Normalize and relay each event
371
377
  const events = normalizeClaudeEvent(raw);
378
+ process.stderr.write(`${DIM}[orch] Normalized ${events.length} events (type=${raw.type})${RESET}\n`);
372
379
  for (const event of events) {
373
380
  printLocalEvent(event);
374
381
  sendToServer({ type: "agent_event", sessionId, event });
@@ -381,19 +388,23 @@ if (adapter) {
381
388
  }
382
389
  });
383
390
 
391
+ proc.stdout.on("end", () => {
392
+ process.stderr.write(`${DIM}[orch] stdout stream ended (${lineCount} lines total)${RESET}\n`);
393
+ });
394
+
384
395
  proc.stderr.on("data", (buf) => {
396
+ process.stderr.write(`${DIM}[orch] child stderr: ${RESET}`);
385
397
  process.stderr.write(buf);
386
398
  });
387
399
 
388
- proc.on("exit", (code) => {
400
+ proc.on("exit", (code, signal) => {
389
401
  childRunning = false;
402
+ process.stderr.write(`${DIM}[orch] Child exited: code=${code} signal=${signal}${RESET}\n`);
390
403
  const exitCode = code ?? 0;
391
404
  if (exitCode !== 0 || exitRequested) {
392
- // Non-zero exit or user interrupted — shut down
393
405
  sendToServer({ type: "exit", sessionId, exitCode });
394
406
  setTimeout(() => process.exit(exitCode), 200);
395
407
  } else {
396
- // Successful completion — stay alive for follow-up from dashboard
397
408
  sendToServer({
398
409
  type: "agent_event", sessionId,
399
410
  event: { kind: "status", status: "idle" },
@@ -403,7 +414,7 @@ if (adapter) {
403
414
 
404
415
  proc.on("error", (err) => {
405
416
  childRunning = false;
406
- console.error("Failed to start:", err.message);
417
+ process.stderr.write(`${RED}[orch] Spawn error: ${err.message}${RESET}\n`);
407
418
  process.exit(1);
408
419
  });
409
420
 
@@ -759,6 +770,8 @@ function connectWs() {
759
770
  ws = new WebSocket(serverUrl);
760
771
 
761
772
  ws.on("open", () => {
773
+ process.stderr.write(`${DIM}[orch] WS connected to ${serverUrl}${RESET}\n`);
774
+ process.stderr.write(`${DIM}[orch] Token: ${authToken ? authToken.slice(0, 20) + "..." : "(none)"}${RESET}\n`);
762
775
  ws.send(JSON.stringify({
763
776
  type: "register",
764
777
  token: authToken,
@@ -803,7 +816,8 @@ function connectWs() {
803
816
  } catch {}
804
817
  });
805
818
 
806
- ws.on("close", () => {
819
+ ws.on("close", (code, reason) => {
820
+ process.stderr.write(`${DIM}[orch] WS closed: code=${code} reason=${reason}${RESET}\n`);
807
821
  wsReady = false;
808
822
  ws = null;
809
823
  if (!authFailed) {
@@ -811,8 +825,8 @@ function connectWs() {
811
825
  }
812
826
  });
813
827
 
814
- ws.on("error", () => {
815
- // Will trigger close
828
+ ws.on("error", (err) => {
829
+ process.stderr.write(`${DIM}[orch] WS error: ${err.message}${RESET}\n`);
816
830
  });
817
831
  }
818
832
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orchestrating",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Stream terminal sessions to the orchestrat.ing dashboard",
5
5
  "type": "module",
6
6
  "bin": {