agent-dag 1.33.52 → 1.33.53

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.
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>agents-deck</title>
7
7
  <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='84' font-size='84'%3E%E2%97%89%3C/text%3E%3C/svg%3E" />
8
- <script type="module" crossorigin src="/assets/index-BrU7jrAW.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-atrK5cmE.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-CF2yG9oG.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-dag",
3
- "version": "1.33.52",
3
+ "version": "1.33.53",
4
4
  "description": "Live deck of Claude Code and Codex agents — watch parallel subagents fork, call tools, and return on one calm canvas. Also available as npx ccdeck and npx agent-dag.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,49 @@
1
+ // The one decision bin/agent-dag.js makes when the worker dies: bring it back,
2
+ // fetch a newer one, or let the whole thing stop.
3
+ //
4
+ // It lives here rather than inline in the supervisor because the supervisor
5
+ // launches a real child process the moment it is imported, so the rule could
6
+ // not be checked any other way — and it is a rule with a race in it.
7
+ //
8
+ // The race: the worker exits 75 because the user clicked Restart, and Ctrl+C
9
+ // lands in the same instant. The supervisor's signal handler runs first and
10
+ // sets `stopping`, then the exit event arrives carrying 75 — and a supervisor
11
+ // that reads the code without asking whether it is still supposed to be
12
+ // running spawns a fresh deck AFTER the user stopped it. That deck prints
13
+ // `restarted → vX` over the shutdown and keeps serving until the handler's
14
+ // 2.5s retry timer happens to kill it; the 76 variant starts a whole npx
15
+ // registry fetch first. So `stopping` outranks the code, always.
16
+ //
17
+ // Ctrl+C reaches this process on every platform we support — POSIX delivers it
18
+ // to the foreground process group, and on Windows the console raises
19
+ // CTRL_C_EVENT for every process attached to it, which Node surfaces as
20
+ // 'SIGINT'. What differs is only how the child dies, which is not this
21
+ // function's business.
22
+
23
+ // Chosen because they mean nothing else here: the worker exits 0 normally and
24
+ // non-zero on failure, both of which must pass straight through.
25
+ export const RESTART_CODE = 75; // come back running the files on disk
26
+ export const UPGRADE_CODE = 76; // come back through npx, which fetches newer files
27
+
28
+ /**
29
+ * What a dead worker means.
30
+ *
31
+ * { relaunch: "disk" } — spawn it again from the files on disk
32
+ * { relaunch: "npx" } — spawn it again through npx, which fetches newer ones
33
+ * { relaunch: null, code } — stop, exiting with `code`
34
+ *
35
+ * `stopping` is a parameter rather than the supervisor's module-level flag for
36
+ * the same reason `spawnSpec` takes a platform: it is the input that decides
37
+ * the answer, and both answers have to be testable.
38
+ *
39
+ * A stop exits 0 for 75 and 76. Those two are a private protocol between the
40
+ * worker and its supervisor — nobody outside knows they mean "come back", and
41
+ * 75 is EX_TEMPFAIL to anything that reads sysexits, so handing either to the
42
+ * shell would report a failure the user did not have. Every other code is the
43
+ * worker's own verdict and passes through untouched.
44
+ */
45
+ export function workerExitAction(code, stopping) {
46
+ const ours = code === RESTART_CODE || code === UPGRADE_CODE;
47
+ if (ours && !stopping) return { relaunch: code === UPGRADE_CODE ? "npx" : "disk" };
48
+ return { relaunch: null, code: ours ? 0 : code ?? 0 };
49
+ }