agent-dag 1.33.138 → 1.33.140

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/agent-dag.js CHANGED
@@ -35,6 +35,7 @@ import { connect } from "node:net";
35
35
  import { dirname, join } from "node:path";
36
36
  import { fileURLToPath } from "node:url";
37
37
  import { killTree } from "../src/server/exec.mjs";
38
+ import { invokedAs } from "../src/server/invoked-as.mjs";
38
39
  import { npxFailureHint, npxFailureSummary, npxLaunch, npxPrefetch } from "../src/server/npx.mjs";
39
40
  import {
40
41
  bareSpecName, claimRestartFailureKey, clearRestartFailure, installedVersion, lastKnownLatest,
@@ -50,6 +51,15 @@ const PKG_ROOT = dirname(BIN_DIR);
50
51
 
51
52
  const VERSION = installedVersion(PKG_ROOT) ?? "?";
52
53
 
54
+ // Which of the three published commands the user typed, when that is knowable.
55
+ // This process is the one the shell exec'd, so its argv[1] is the only place
56
+ // the answer exists — the worker's is `…/bin/deck.js` under every one of them —
57
+ // and launch() carries it down rather than letting the worker ask a question it
58
+ // cannot answer. Null wherever it cannot be proven, which is a Windows global
59
+ // install and a git checkout; see src/server/invoked-as.mjs for why those two
60
+ // have to stay silent rather than guess.
61
+ const INVOKED_AS = invokedAs({ pkgRoot: PKG_ROOT, argv1: process.argv[1], platform: process.platform });
62
+
53
63
  // The supervisor prints exactly one line of its own — the fetch — and it has to
54
64
  // look like it came from the same product as the worker's rows. That is all the
55
65
  // presentation this file gets: it is the process that is never replaced, and a
@@ -108,6 +118,12 @@ function launch(respawn) {
108
118
  // is what would make a restart feel like a restart.
109
119
  AGENTS_DECK_RESPAWN: respawn ? "1" : "",
110
120
  AGENTS_DECK_RESTARTS: String(restarts),
121
+ // Empty for "we could not tell", which knownCommand reads as unknown just
122
+ // like an absent one. Set on the worker's environment only: the npx
123
+ // relaunch below spawns a whole new supervisor, and that one has to ask
124
+ // its own _npx directory rather than inherit an answer about a cache
125
+ // directory it is not running from.
126
+ AGENTS_DECK_INVOKED_AS: INVOKED_AS ?? "",
111
127
  },
112
128
  });
113
129
 
package/bin/deck.js CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  pulseText, spinnerFrames, statusLine, supportsHyperlinks, termColumns, unicodeOK, wordmark,
15
15
  } from "../src/server/term.mjs";
16
16
  import { PRODUCT } from "../src/server/brand.mjs";
17
+ import { invokedName, renameNotice } from "../src/server/invoked-as.mjs";
17
18
 
18
19
  const __dirname = dirname(fileURLToPath(import.meta.url));
19
20
  const PKG_ROOT = resolve(__dirname, "..");
@@ -22,6 +23,11 @@ const PKG_VERSION = (() => {
22
23
  catch { return "0.0.0"; }
23
24
  })();
24
25
 
26
+ // The command the user typed, handed down by the supervisor — our own argv[1]
27
+ // is this file under every one of the three names. Null when it cannot be
28
+ // proven, and null is the answer that prints nothing.
29
+ const INVOKED_AS = invokedName({ pkgRoot: PKG_ROOT });
30
+
25
31
  const argv = process.argv.slice(2);
26
32
  const flags = parseArgs(argv);
27
33
 
@@ -156,7 +162,7 @@ process.on("SIGHUP", () => { showCursor(); dieOfSignal("SIGHUP"); });
156
162
  // longer, silently broke the alignment of every other one.
157
163
  const LABELS = [
158
164
  "workspace", "Claude hooks", "Codex sessions", "claude-swap", "accounts",
159
- "ccusage", "update", "server ready", "log",
165
+ "ccusage", "update", "name", "server ready", "log",
160
166
  ];
161
167
  const LABEL_W = labelColumn(LABELS);
162
168
 
@@ -333,6 +339,22 @@ async function reportStartup(jobs) {
333
339
  detail: `v${upgrade.notice.to} available ${G.dash} ${upgrade.command}`,
334
340
  }));
335
341
  }
342
+
343
+ // Which name this deck was started under, when that is knowable — a notice,
344
+ // never a refusal. 95% of installs are on the two old names and the update
345
+ // path runs through this very process, so a build that declined to boot under
346
+ // one of them would kill the deck on the machine where the deck is what would
347
+ // have explained why. Nothing at all is printed wherever the typed name
348
+ // cannot be proven (a Windows global install, a git checkout): telling
349
+ // somebody who already types `ccdeck` to type `ccdeck` is the one failure
350
+ // that would make this row worth ignoring. See src/server/invoked-as.mjs.
351
+ const rename = renameNotice({ invoked: INVOKED_AS, pkgRoot: PKG_ROOT, dash: G.dash });
352
+ if (rename) {
353
+ write(row({ mark: G.warn, tone: P.warn, label: "name", detail: rename.said }));
354
+ // The line that carries the value: for a global install there is nothing to
355
+ // install and nothing to download, only six different characters to type.
356
+ write(row({ label: "", detail: rename.fix }));
357
+ }
336
358
  }
337
359
 
338
360
  // Everything above is once-per-session setup — hook install, tool probes,