@point-seven-studio/jq-deck 0.3.2 → 0.4.0

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  One command, one local page: every Claude Code session on your machine, the setup check for each repository, and the mailbox between sessions.
4
4
 
5
- It is [jq-agents](https://www.npmjs.com/package/@point-seven-studio/jq-agents), [jq-groundcrew](https://www.npmjs.com/package/@point-seven-studio/jq-groundcrew) and [jq-crosstalk](https://www.npmjs.com/package/@point-seven-studio/jq-crosstalk) behind one page. It reads what they read and writes nothing.
5
+ It is [jq-agents](https://www.npmjs.com/package/@point-seven-studio/jq-agents), [jq-groundcrew](https://www.npmjs.com/package/@point-seven-studio/jq-groundcrew) and [jq-crosstalk](https://www.npmjs.com/package/@point-seven-studio/jq-crosstalk) behind one page. It reads what they read. It writes one small note while its page runs, so the other JQ pages can link to it, and nothing else unless you run `jq-deck join`.
6
6
 
7
7
  ![The JQ Deck overview: one row per repository with its sessions, setup score and unread mail.](https://raw.githubusercontent.com/point-seven-studio/jq-tools/main/packages/deck/docs/screenshot.png)
8
8
 
@@ -74,6 +74,28 @@ Every interval (60 seconds, or `--interval`), your command receives one JSON rep
74
74
  - **Question text is not sent unless you opt a folder in:** `--send-questions ~/code/shop` (or `sendQuestions` in the config file) adds what each waiting session under that folder asked. `--questions` is about your own screen and sends nothing. The repository must also be one you report. The relay says at start whether question text is being sent.
75
75
  - If the command fails, jq-deck says so each time.
76
76
 
77
+ ### Keep reporting after a restart: `jq-deck join`
78
+
79
+ `--watch` reports only while its terminal stays open. `join` sets a machine up once:
80
+
81
+ ```sh
82
+ npm install -g @point-seven-studio/jq-deck @point-seven-studio/jq-deck-server
83
+ export JQ_DECK_TOKEN=jqm_...
84
+ jq-deck join --url https://deck.example.com --repos shop,api
85
+ ```
86
+
87
+ - **It sends one report first.** If the board refuses it (a wrong address or token), nothing is written.
88
+ - **It saves the token** in `~/.jq/deck-token`, readable by you only. Without `$JQ_DECK_TOKEN` it asks for the token in the terminal.
89
+ - **It writes the list you gave** as `report` in the config file, and a short script, `~/.jq/deck-report.sh`, that you can read. The script holds no token: it reads the file.
90
+ - **It installs a login job** that runs that script: a launchd job on macOS, a systemd user unit on Linux. On another system, or with `--no-service`, it installs none and tells you the command to keep running.
91
+ - **It says which named repositories have no session,** so a spelling slip shows at once.
92
+ - `--board ADDRESS` saves the board's own page as `team`, so the local pages link to it. `--send-questions` is as for `--watch`. There is no `--all-repos` here: a machine that reports by itself reports only what you named.
93
+ - `jq-deck leave` stops the job and removes the job file, the script and the token file. The token itself works until you remove the machine on the board.
94
+
95
+ **On macOS, a login job cannot read Desktop, Documents or Downloads.** A repository kept there is still reported, but its row may have no git remote and no setup score. `join` tells you when this applies and gives the two ways out: give `node` Full Disk Access in System Settings, or keep the reporter in a terminal.
96
+
97
+ It must be installed, not run through `npx`: the login job has to find it after a restart. It needs `jq-deck-server` installed too, which is what sends each report; `jq-deck` itself still makes no outbound call.
98
+
77
99
  ## As a library
78
100
 
79
101
  ```js
@@ -89,6 +111,12 @@ console.log(overview.headline)
89
111
  - Everything each tool lists as a limit applies here: jq-agents depends on Claude Code internals and samples resources on macOS only; a mailbox has no access control.
90
112
  - Every page load reads again. With many repositories the Overview runs the setup check on each, which takes a moment.
91
113
 
114
+ ## Links to the other tools
115
+
116
+ The served page has a bar at the bottom with a link to each of the other JQ tools. A tool that is running on this machine is a link to the port it is really on. One that is not says "not running" and gives the command that starts it. The team board is a link when `~/.jq/config.json` holds a `"team"` line with its address, and says "not set up" otherwise.
117
+
118
+ How a page knows what is running, without a network call: while a tool serves its page it keeps a small note in `~/.jq/running/` (the tool, its port, its process id), and removes it when it stops. The other pages read those notes and ignore one whose process is gone. The bar is as of the last page load. A page written with `--html`, or shown inside JQ Deck, has no bar.
119
+
92
120
  ## Related tools
93
121
 
94
122
  - [jq-deck-server](https://www.npmjs.com/package/@point-seven-studio/jq-deck-server): the same view for a team, across machines.
package/dist/index.mjs CHANGED
@@ -246,16 +246,16 @@ function lastActivityAt(records) {
246
246
  }
247
247
  return null;
248
248
  }
249
- function deriveState(alive, lastActivityIso, now) {
250
- if (!alive) return "dead";
249
+ function deriveState(alive2, lastActivityIso, now) {
250
+ if (!alive2) return "dead";
251
251
  if (!lastActivityIso) return "stale";
252
252
  const ageS = Math.max(0, (now - Date.parse(lastActivityIso)) / 1e3);
253
253
  if (ageS <= LIVE_WITHIN_S) return "live";
254
254
  if (ageS <= IDLE_WITHIN_S) return "idle";
255
255
  return "stale";
256
256
  }
257
- function deriveWaiting(rec, alive) {
258
- if (!alive || !rec || rec.type !== "assistant") return false;
257
+ function deriveWaiting(rec, alive2) {
258
+ if (!alive2 || !rec || rec.type !== "assistant") return false;
259
259
  return rec.message?.stop_reason === "end_turn";
260
260
  }
261
261
  function deriveAttention(state, waiting) {
@@ -269,7 +269,7 @@ function isTreeAllowed(workingTree, allowlist) {
269
269
  return allowlist.some((t) => t && (workingTree === t || workingTree.startsWith(t.replace(/\/+$/, "") + "/")));
270
270
  }
271
271
  function buildStatusRow(opts) {
272
- const { machine, records, sessionIdFallback, alive, pid, allowlist, now, workingTreeOverride } = opts;
272
+ const { machine, records, sessionIdFallback, alive: alive2, pid, allowlist, now, workingTreeOverride } = opts;
273
273
  const withCwd = [...records].reverse().find((r) => r?.cwd);
274
274
  const workingTree = workingTreeOverride || withCwd?.cwd || "";
275
275
  if (!workingTree) return null;
@@ -279,8 +279,8 @@ function buildStatusRow(opts) {
279
279
  const substantive = lastSubstantive(records);
280
280
  const assistant = lastAssistant(records);
281
281
  const activity = lastActivityAt(records);
282
- const state = deriveState(alive, activity, now);
283
- const waiting = deriveWaiting(substantive, alive);
282
+ const state = deriveState(alive2, activity, now);
283
+ const waiting = deriveWaiting(substantive, alive2);
284
284
  const rawText = assistant ? messageText(assistant) : "";
285
285
  const allowed = isTreeAllowed(workingTree, allowlist);
286
286
  let blocked_question = null;
@@ -686,6 +686,23 @@ async function snapshot(opts = {}) {
686
686
  if (opts.evidence) snap.local = { turn_check };
687
687
  return snap;
688
688
  }
689
+ var TOOLBAR_CSS = `
690
+ body{padding-bottom:64px}
691
+ .jqbar{position:fixed;left:0;right:0;bottom:0;z-index:5;display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;padding:8px 16px;font:13px/1.4 system-ui,sans-serif;background:var(--card,Canvas);color:var(--fg,CanvasText);border-top:1px solid var(--line,GrayText)}
692
+ .jqbar a{color:var(--link,LinkText)}
693
+ .jqbar .here{font-weight:700}
694
+ .jqbar details[open]{order:-1;flex-basis:100%}
695
+ .jqbar summary{cursor:pointer;color:var(--mut,GrayText);list-style:none;display:inline-block;padding:2px 0}
696
+ .jqbar summary::-webkit-details-marker{display:none}
697
+ .jqbar summary::after{content:" \u25B8"}
698
+ .jqbar details[open] summary::after{content:" \u25BE"}
699
+ .jqbar summary small,.jqbar a small{font-size:11px;font-weight:400}
700
+ .jqbar details>div{margin:4px 0 6px;padding:8px 10px;max-width:640px;border:1px solid var(--line,GrayText);border-radius:8px;background:var(--well,Canvas)}
701
+ .jqbar details>div p{margin:0 0 4px}
702
+ .jqbar code{font:12px ui-monospace,Menlo,monospace;word-break:break-all}
703
+ .jqbar a:focus-visible,.jqbar summary:focus-visible{outline:2px solid var(--link,LinkText);outline-offset:2px}
704
+ @media print{.jqbar{display:none}body{padding-bottom:0}}
705
+ `;
689
706
  var esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
690
707
  function ago(iso, now) {
691
708
  if (!iso) return "unknown";
@@ -749,9 +766,9 @@ function correctionsPanel(snap, m) {
749
766
  return `<li><span>Dismissed: <span class="mut">${esc(row3 ? `${row3.product} \xB7 ${row3.branch || "no branch"}` : `session ${session.slice(0, 8)}`)}</span></span>${form(m, { action: "undismiss", session }, "Undo")}</li>`;
750
767
  })
751
768
  ];
752
- return '<section class="card fix"><h2>Your corrections to the check label</h2>' + (items.length ? `<ul>${items.join("")}</ul>` : '<p class="mut pad">None yet. A label you think is wrong has a "Why, and is it wrong?" link under it.</p>') + '<p class="mut pad">Saved in <code>~/.jq/config.json</code> on this machine. This is the only file JQ Agents writes.</p></section>';
769
+ return '<section class="card fix"><h2>Your corrections to the check label</h2>' + (items.length ? `<ul>${items.join("")}</ul>` : '<p class="mut pad">None yet. A label you think is wrong has a "Why, and is it wrong?" link under it.</p>') + '<p class="mut pad">Saved in <code>~/.jq/config.json</code> on this machine. Apart from its own running note in <code>~/.jq/running/</code>, this is the only file JQ Agents writes.</p></section>';
753
770
  }
754
- function renderPage(snap, now = Date.now(), manage) {
771
+ function renderPage(snap, now = Date.now(), manage, bar = "") {
755
772
  const t = totals(snap.sessions);
756
773
  const b = snap.bottleneck;
757
774
  const chip = !b ? '<p class="mut">Host not sampled.</p>' : b.kind === "none" ? "" : `<p class="chip">${b.kind === "unknown" ? "Could not tell what this machine is short of." : `Bottleneck: ${esc(b.kind)}${b.reason ? ` (${esc(b.reason)})` : ""}`}</p>`;
@@ -779,14 +796,14 @@ code{font:12px ui-monospace,Menlo,monospace;background:var(--well);border-radius
779
796
  button{font:600 12px system-ui,sans-serif;color:var(--fg);background:var(--card);border:1px solid var(--line);border-radius:6px;padding:5px 10px;min-height:30px;cursor:pointer}
780
797
  button:hover{border-color:var(--mut)}button:focus-visible{outline:2px solid var(--fg);outline-offset:2px}.pad{margin:0;padding:8px 12px}
781
798
  pre{white-space:pre-wrap;word-break:break-word;background:var(--well);margin:8px 0 2px;padding:10px;border-radius:8px;font-size:12px}.q{margin:6px 0 0}
782
- </style></head><body><main>
799
+ ${bar ? TOOLBAR_CSS : ""}</style></head><body><main>
783
800
  <h1>JQ Agents</h1>
784
801
  <p class="mut">${esc(snap.machine)} \xB7 read ${esc(snap.generated_at)}. Refresh to read again. Read-only: answer a session where it is running.</p>
785
802
  <div class="tot"><div><b>${t.needs_you}</b><span class="mut">waiting on a person</span></div><div><b>${t.abandoned}</b><span class="mut">asked, then left</span></div><div><b>${t.live}</b><span class="mut">live</span></div><div><b>${t.sessions}</b><span class="mut">sessions in ${t.trees} ${t.trees === 1 ? "tree" : "trees"}</span></div></div>
786
803
  ${chip}
787
804
  ${trees || '<p class="mut">No session has been active in the window read.</p>'}
788
805
  ${manage ? correctionsPanel(snap, manage) : ""}
789
- </main></body></html>`;
806
+ </main>${bar}</body></html>`;
790
807
  }
791
808
  function defaultConfigFile() {
792
809
  return process.env.JQ_CONFIG || path2.join(os3.homedir(), ".jq", "config.json");
@@ -975,6 +992,7 @@ import path6 from "path";
975
992
  // ../crosstalk/dist/index.mjs
976
993
  import { existsSync as existsSync4, readdirSync, readFileSync as readFileSync3, statSync } from "fs";
977
994
  import path4 from "path";
995
+ import { createHash as createHash2, createPrivateKey, createPublicKey, generateKeyPairSync, sign, verify } from "crypto";
978
996
  var BOARD = "board";
979
997
  var DAY_MS = 864e5;
980
998
  function ageDays(sentAt, now) {
@@ -993,7 +1011,9 @@ function summarize(m, now) {
993
1011
  sent_at: m.sent_at,
994
1012
  acked: m.acked,
995
1013
  age_days: ageDays(m.sent_at, now),
996
- kind: m.kind ?? null
1014
+ kind: m.kind ?? null,
1015
+ author: m.author ?? null,
1016
+ signature_state: m.signature_state ?? null
997
1017
  };
998
1018
  }
999
1019
  var plural2 = (n, one, many) => n === 1 ? one : many;
@@ -1162,6 +1182,7 @@ function parseMessage(filename, raw, recipient, acked) {
1162
1182
  let kind = null;
1163
1183
  let thread = null;
1164
1184
  let replyTo = null;
1185
+ let author = null;
1165
1186
  let from = "";
1166
1187
  let subject = null;
1167
1188
  let sent = null;
@@ -1184,6 +1205,7 @@ function parseMessage(filename, raw, recipient, acked) {
1184
1205
  } else if (m[1] === "expires") expires = /^\d{4}-\d{2}-\d{2}$/.test(m[2].trim()) ? m[2].trim() : null;
1185
1206
  else if (m[1] === "evidence") evidence = m[2].trim() || null;
1186
1207
  else if (m[1] === "settled_by") settledBy = m[2].trim() || null;
1208
+ else if (m[1] === "author") author = m[2].trim() || null;
1187
1209
  }
1188
1210
  }
1189
1211
  if (!from) from = "unknown";
@@ -1202,29 +1224,105 @@ function parseMessage(filename, raw, recipient, acked) {
1202
1224
  tags,
1203
1225
  expires_on: expires,
1204
1226
  evidence: evidence && ["verified", "assumed"].includes(evidence) ? evidence : null,
1205
- settled_by: settledBy && SETTLED_BY.includes(settledBy) ? settledBy : null
1227
+ settled_by: settledBy && SETTLED_BY.includes(settledBy) ? settledBy : null,
1228
+ author
1206
1229
  };
1207
1230
  }
1231
+ var VERSION = "jq-crosstalk-signed-v1";
1232
+ function signingPayload(f) {
1233
+ return Buffer.from(
1234
+ JSON.stringify([VERSION, f.filename, f.from, f.to, f.subject, f.sent, f.kind, f.thread, f.reply_to, f.author, f.body.trim()]),
1235
+ "utf8"
1236
+ );
1237
+ }
1238
+ function fingerprint(publicKey) {
1239
+ return createHash2("sha256").update(Buffer.from(publicKey, "base64")).digest("hex").slice(0, 16);
1240
+ }
1241
+ function parseSigners(text) {
1242
+ const signers = /* @__PURE__ */ new Map();
1243
+ for (const line of text.split("\n")) {
1244
+ const m = line.match(/^([a-z0-9][a-z0-9-]*):\s*([A-Za-z0-9+/=]+)\s*$/);
1245
+ if (m) signers.set(m[1], m[2]);
1246
+ }
1247
+ return signers;
1248
+ }
1249
+ function splitMessage(filename, raw) {
1250
+ const fields = { filename, from: "", to: "", subject: "", sent: "", kind: "", thread: "", reply_to: "", author: "", body: raw };
1251
+ let signature = "";
1252
+ const fm = raw.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
1253
+ if (!fm) return { fields, signature };
1254
+ fields.body = fm[2];
1255
+ for (const line of fm[1].split("\n")) {
1256
+ const m = line.match(/^(\w+):\s*(.*)$/);
1257
+ if (!m) continue;
1258
+ const value = m[2].trim();
1259
+ if (m[1] === "signature") signature = value;
1260
+ else if (m[1] === "from" || m[1] === "to" || m[1] === "subject" || m[1] === "sent" || m[1] === "kind" || m[1] === "thread" || m[1] === "reply_to" || m[1] === "author") {
1261
+ fields[m[1]] = value;
1262
+ }
1263
+ }
1264
+ return { fields, signature };
1265
+ }
1266
+ function checkSignature(filename, raw, signers) {
1267
+ const { fields, signature } = splitMessage(filename, raw);
1268
+ const publicKey = signers.get(fields.from);
1269
+ const base = { from: fields.from, author: fields.author };
1270
+ if (!publicKey) return { ...base, state: signature ? "unknown-signer" : "not-required", key: "" };
1271
+ const key = fingerprint(publicKey);
1272
+ if (!signature) return { ...base, state: "unsigned", key };
1273
+ try {
1274
+ const ok = verify(
1275
+ null,
1276
+ signingPayload(fields),
1277
+ createPublicKey({ key: Buffer.from(publicKey, "base64"), format: "der", type: "spki" }),
1278
+ Buffer.from(signature, "base64")
1279
+ );
1280
+ return { ...base, state: ok ? "verified" : "failed", key };
1281
+ } catch {
1282
+ return { ...base, state: "failed", key };
1283
+ }
1284
+ }
1208
1285
  function names(dir) {
1209
1286
  if (!existsSync4(dir)) return [];
1210
1287
  return readdirSync(dir).filter((n) => statSync(path4.join(dir, n)).isDirectory());
1211
1288
  }
1212
1289
  function readMailbox(root) {
1213
1290
  if (!existsSync4(path4.join(root, "inbox"))) throw new Error(`not a crosstalk mailbox (no inbox/ folder): ${root}`);
1291
+ const signersFile = path4.join(root, "registry", "signers.txt");
1292
+ const signers = existsSync4(signersFile) ? parseSigners(readFileSync3(signersFile, "utf8")) : /* @__PURE__ */ new Map();
1214
1293
  const byKey = /* @__PURE__ */ new Map();
1215
1294
  for (const [base, acked] of [["inbox", false], ["archive", true]]) {
1216
1295
  for (const name of names(path4.join(root, base))) {
1217
1296
  const dir = path4.join(root, base, name);
1218
1297
  for (const file of readdirSync(dir).filter((f) => f.endsWith(".md"))) {
1219
- const row22 = parseMessage(file, readFileSync3(path4.join(dir, file), "utf8"), name, acked);
1298
+ const raw = readFileSync3(path4.join(dir, file), "utf8");
1299
+ const row22 = parseMessage(file, raw, name, acked);
1300
+ const state = checkSignature(file, raw, signers).state;
1220
1301
  const key = `${name}/${file}`;
1221
1302
  const prev = byKey.get(key);
1222
- if (!prev || acked && !prev.acked) byKey.set(key, { id: key, ...row22 });
1303
+ if (!prev || acked && !prev.acked) byKey.set(key, { id: key, ...row22, signature_state: state === "not-required" ? null : state });
1223
1304
  }
1224
1305
  }
1225
1306
  }
1226
1307
  return [...byKey.values()].sort((a, b) => a.id.localeCompare(b.id));
1227
1308
  }
1309
+ var TOOLBAR_CSS2 = `
1310
+ body{padding-bottom:64px}
1311
+ .jqbar{position:fixed;left:0;right:0;bottom:0;z-index:5;display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;padding:8px 16px;font:13px/1.4 system-ui,sans-serif;background:var(--card,Canvas);color:var(--fg,CanvasText);border-top:1px solid var(--line,GrayText)}
1312
+ .jqbar a{color:var(--link,LinkText)}
1313
+ .jqbar .here{font-weight:700}
1314
+ .jqbar details[open]{order:-1;flex-basis:100%}
1315
+ .jqbar summary{cursor:pointer;color:var(--mut,GrayText);list-style:none;display:inline-block;padding:2px 0}
1316
+ .jqbar summary::-webkit-details-marker{display:none}
1317
+ .jqbar summary::after{content:" \u25B8"}
1318
+ .jqbar details[open] summary::after{content:" \u25BE"}
1319
+ .jqbar summary small,.jqbar a small{font-size:11px;font-weight:400}
1320
+ .jqbar details>div{margin:4px 0 6px;padding:8px 10px;max-width:640px;border:1px solid var(--line,GrayText);border-radius:8px;background:var(--well,Canvas)}
1321
+ .jqbar details>div p{margin:0 0 4px}
1322
+ .jqbar code{font:12px ui-monospace,Menlo,monospace;word-break:break-all}
1323
+ .jqbar a:focus-visible,.jqbar summary:focus-visible{outline:2px solid var(--link,LinkText);outline-offset:2px}
1324
+ @media print{.jqbar{display:none}body{padding-bottom:0}}
1325
+ `;
1228
1326
  var esc2 = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
1229
1327
  var age = (d) => d === null ? "no date" : d === 0 ? "today" : d === 1 ? "1 day" : `${d} days`;
1230
1328
  var SETTLED = {
@@ -1237,14 +1335,16 @@ var SETTLED = {
1237
1335
  function row(m, bodies, note, showTo = false) {
1238
1336
  const kind = m.kind && m.kind !== "brief" ? `<span class="kind">${esc2(m.kind)}</span> ` : "";
1239
1337
  const to = showTo ? ` <span class="mut">to</span> <span class="chip">${esc2(m.to_session)}</span>` : "";
1240
- return `<details><summary><span class="chip">${esc2(m.from_session)}</span>${to} ${kind}<span class="subj">${esc2(m.subject || "(no subject)")}</span> <span class="note">${esc2(note)}</span></summary><p class="file">${esc2(m.filename)}</p><pre>${esc2(bodies[m.id] ?? "")}</pre></details>`;
1338
+ const who = m.author ? ` <span class="mut">${esc2(m.author)}</span>` : "";
1339
+ const signed = m.signature_state === "verified" ? ' <span class="kind">signed</span>' : m.signature_state ? ` <span class="kind">${m.signature_state === "unknown-signer" ? "signature not checked" : "NOT VERIFIED"}</span>` : "";
1340
+ return `<details><summary><span class="chip">${esc2(m.from_session)}</span>${who}${signed}${to} ${kind}<span class="subj">${esc2(m.subject || "(no subject)")}</span> <span class="note">${esc2(note)}</span></summary><p class="file">${esc2(m.filename)}</p><pre>${esc2(bodies[m.id] ?? "")}</pre></details>`;
1241
1341
  }
1242
1342
  function post(p, bodies) {
1243
1343
  const state = p.state === "closed" ? SETTLED[p.settled_by ?? ""] ?? "closed" : p.state === "expired" ? `past its date (${p.expires_on})` : `open until ${p.expires_on ?? "closed"}`;
1244
1344
  const replies = p.replies.map((r) => row(r, bodies, r.evidence === "verified" ? "checked" : r.evidence === "assumed" ? "from memory, not checked" : "did not say how they know")).join("");
1245
1345
  return `<section class="card"><h3>${esc2(p.title || "(no title)")} ${p.tags.map((t) => `<span class="tag">${esc2(t)}</span>`).join(" ")} <span class="state ${p.state}">${esc2(state)}</span></h3>${row(p.post, bodies, p.post.age_days ? `asked ${age(p.post.age_days)} ago` : "asked today")}${replies}${p.closing ? row(p.closing, bodies, "closing note") : ""}${p.replies.length === 0 && p.state !== "closed" ? '<p class="mut">No replies yet.</p>' : ""}</section>`;
1246
1346
  }
1247
- function renderPage2(r) {
1347
+ function renderPage2(r, bar = "") {
1248
1348
  const waiting = r.waiting.inboxes.map(
1249
1349
  (i) => `<section class="card"><h3>${esc2(i.product)} inbox <span class="note">${i.unread} unread, oldest ${age(i.oldest_age_days)}</span></h3>${i.items.map((m) => row(m, r.bodies, `unread, ${age(m.age_days)}`)).join("")}</section>`
1250
1350
  ).join("");
@@ -1267,14 +1367,14 @@ details{border-top:1px solid var(--line)}summary{cursor:pointer;padding:8px 12px
1267
1367
  .subj{font-weight:500}.file{font-family:ui-monospace,monospace;margin:0;padding:0 12px;word-break:break-all}
1268
1368
  pre{white-space:pre-wrap;word-break:break-word;background:var(--well);margin:8px 12px 12px;padding:10px;border-radius:8px;font-size:12px;max-height:420px;overflow:auto}
1269
1369
  .state{font-size:12px}.state.open{color:var(--ok)}.state.expired{color:var(--bad)}.state.closed{color:var(--mut)}
1270
- </style></head><body><main>
1370
+ ${bar ? TOOLBAR_CSS2 : ""}</style></head><body><main>
1271
1371
  <h1>Crosstalk</h1>
1272
1372
  <p class="note">${esc2(r.mailbox)} \xB7 ${r.total} messages \xB7 read ${esc2(r.generated_at)}. Refresh to read again. This page is read-only.</p>
1273
1373
  <h2>Waiting</h2><p class="lead">${esc2(r.waiting.headline)}</p>${waiting}
1274
1374
  <h2>Board</h2><p class="lead">${esc2(r.board.headline)}</p>${r.board.open.map((p) => post(p, r.bodies)).join("")}
1275
1375
  ${r.board.closed.length ? `<details class="card"><summary>${r.board.closed.length} closed</summary>${r.board.closed.map((p) => post(p, r.bodies)).join("")}</details>` : ""}
1276
1376
  <h2>Threads</h2><p class="note">The ${r.threads.length} with the newest activity. Where a message carries no thread id, threads are worked out from replies that cite a message or reuse its subject, so some related mail shows as separate.</p>${threads}
1277
- </main></body></html>`;
1377
+ </main>${bar}</body></html>`;
1278
1378
  }
1279
1379
  var THREADS_SHOWN = 60;
1280
1380
  function buildReport(root, now = Date.now()) {
@@ -1944,7 +2044,24 @@ function gather(project) {
1944
2044
  }
1945
2045
  };
1946
2046
  }
1947
- var esc3 = (text) => text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
2047
+ var TOOLBAR_CSS3 = `
2048
+ body{padding-bottom:64px}
2049
+ .jqbar{position:fixed;left:0;right:0;bottom:0;z-index:5;display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;padding:8px 16px;font:13px/1.4 system-ui,sans-serif;background:var(--card,Canvas);color:var(--fg,CanvasText);border-top:1px solid var(--line,GrayText)}
2050
+ .jqbar a{color:var(--link,LinkText)}
2051
+ .jqbar .here{font-weight:700}
2052
+ .jqbar details[open]{order:-1;flex-basis:100%}
2053
+ .jqbar summary{cursor:pointer;color:var(--mut,GrayText);list-style:none;display:inline-block;padding:2px 0}
2054
+ .jqbar summary::-webkit-details-marker{display:none}
2055
+ .jqbar summary::after{content:" \u25B8"}
2056
+ .jqbar details[open] summary::after{content:" \u25BE"}
2057
+ .jqbar summary small,.jqbar a small{font-size:11px;font-weight:400}
2058
+ .jqbar details>div{margin:4px 0 6px;padding:8px 10px;max-width:640px;border:1px solid var(--line,GrayText);border-radius:8px;background:var(--well,Canvas)}
2059
+ .jqbar details>div p{margin:0 0 4px}
2060
+ .jqbar code{font:12px ui-monospace,Menlo,monospace;word-break:break-all}
2061
+ .jqbar a:focus-visible,.jqbar summary:focus-visible{outline:2px solid var(--link,LinkText);outline-offset:2px}
2062
+ @media print{.jqbar{display:none}body{padding-bottom:0}}
2063
+ `;
2064
+ var esc22 = (text) => text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1948
2065
  var STATUS = {
1949
2066
  fail: { icon: "\u2715", word: "Fix" },
1950
2067
  warn: { icon: "!", word: "Look" },
@@ -1993,15 +2110,15 @@ function done(){b.textContent='Copied';setTimeout(function(){b.textContent='Copy
1993
2110
  function old(){var a=document.createElement('textarea');a.value=t;document.body.appendChild(a);a.select();document.execCommand('copy');a.remove();done()}
1994
2111
  if(navigator.clipboard&&window.isSecureContext){navigator.clipboard.writeText(t).then(done,old)}else{old()}});`;
1995
2112
  var dot = (status) => `<span class="dot s-${status}" aria-hidden="true">${STATUS[status].icon}</span>`;
1996
- var sourceLink = (check) => `<a href="${esc3(check.source)}" target="_blank" rel="noopener noreferrer">${esc3(check.source.replace(/^https:\/\/code\.claude\.com\/docs\/en\//, "docs: ").replace(/\.md$/, ""))}</a>`;
2113
+ var sourceLink = (check) => `<a href="${esc22(check.source)}" target="_blank" rel="noopener noreferrer">${esc22(check.source.replace(/^https:\/\/code\.claude\.com\/docs\/en\//, "docs: ").replace(/\.md$/, ""))}</a>`;
1997
2114
  function fixCard(check) {
1998
2115
  const status = STATUS[check.status];
1999
2116
  const id = anchor(check);
2000
2117
  const isCommand = check.prompt.startsWith("/");
2001
- const prompt = check.prompt ? `<div class="prompt"><header>${isCommand ? "Type this command in Claude Code" : "Paste this into Claude Code"}<button type="button" data-copy="${id}-prompt">Copy</button></header><pre id="${id}-prompt">${esc3(check.prompt)}</pre></div>` : "";
2002
- return `<section class="check s-${check.status}" id="${id}"><h3>${dot(check.status)}${esc3(check.title)}<span class="word">${status.word}</span></h3><p>${esc3(check.detail)}</p>${check.fix ? `<p class="fix"><b>What to change:</b> ${esc3(check.fix)}</p>` : ""}${prompt}<p class="src mut">Rests on ${sourceLink(check)}</p></section>`;
2118
+ const prompt = check.prompt ? `<div class="prompt"><header>${isCommand ? "Type this command in Claude Code" : "Paste this into Claude Code"}<button type="button" data-copy="${id}-prompt">Copy</button></header><pre id="${id}-prompt">${esc22(check.prompt)}</pre></div>` : "";
2119
+ return `<section class="check s-${check.status}" id="${id}"><h3>${dot(check.status)}${esc22(check.title)}<span class="word">${status.word}</span></h3><p>${esc22(check.detail)}</p>${check.fix ? `<p class="fix"><b>What to change:</b> ${esc22(check.fix)}</p>` : ""}${prompt}<p class="src mut">Rests on ${sourceLink(check)}</p></section>`;
2003
2120
  }
2004
- var row2 = (check) => `<li>${dot(check.status)}<b>${esc3(check.title)}<span class="mut"> \xB7 ${STATUS[check.status].word}</span></b><span class="d">${esc3(check.detail)}</span><span class="src mut">${sourceLink(check)}</span></li>`;
2121
+ var row2 = (check) => `<li>${dot(check.status)}<b>${esc22(check.title)}<span class="mut"> \xB7 ${STATUS[check.status].word}</span></b><span class="d">${esc22(check.detail)}</span><span class="src mut">${sourceLink(check)}</span></li>`;
2005
2122
  var LAYER_DOT = { fix: "fail", look: "warn", good: "pass", facts: "info", none: "info" };
2006
2123
  function layerCount(row22) {
2007
2124
  const judged = row22.pass + row22.warn + row22.fail;
@@ -2011,23 +2128,23 @@ function layerCount(row22) {
2011
2128
  function layerPanel(checks) {
2012
2129
  const rows = layerSummary(checks).map((row22) => {
2013
2130
  const about = LAYERS.find((l) => l.key === row22.layer);
2014
- return `<li>${dot(LAYER_DOT[row22.state])}<b>${about.title}<span class="mut"> \xB7 ${layerCount(row22)}</span></b><span class="d">${esc3(about.what)} <span class="mut">${esc3(about.unchecked)}</span></span></li>`;
2131
+ return `<li>${dot(LAYER_DOT[row22.state])}<b>${about.title}<span class="mut"> \xB7 ${layerCount(row22)}</span></b><span class="d">${esc22(about.what)} <span class="mut">${esc22(about.unchecked)}</span></span></li>`;
2015
2132
  });
2016
2133
  return `<h2>Your harness, layer by layer</h2><p class="mut">An agent is a model and what surrounds it. These are six parts of what surrounds it, with what the checks below found in each.</p><ul class="rows">${rows.join("")}</ul>`;
2017
2134
  }
2018
- function renderPage3(report2) {
2135
+ function renderPage3(report2, toolsBar = "") {
2019
2136
  const { summary } = report2;
2020
2137
  const judged = summary.pass + summary.warn + summary.fail;
2021
2138
  const bar = ["fail", "warn", "pass"].filter((s) => summary[s] > 0).map((s) => `<i class="b-${s}" style="flex:${summary[s]}"></i>`).join("");
2022
2139
  const sorted = [...report2.checks].sort((a, b) => ORDER.indexOf(a.status) - ORDER.indexOf(b.status));
2023
2140
  const fixes = sorted.filter(needsFix);
2024
- const todo = fixes.length ? `<h2>Do these first</h2><ul class="todo">${fixes.map((c) => `<li>${dot(c.status)}<a href="#${anchor(c)}">${esc3(c.title)}</a><span class="mut">${GROUP_TITLE[c.group]}</span></li>`).join("")}</ul>` : '<h2>Nothing to fix</h2><p class="mut">Every check that can fail passes.</p>';
2141
+ const todo = fixes.length ? `<h2>Do these first</h2><ul class="todo">${fixes.map((c) => `<li>${dot(c.status)}<a href="#${anchor(c)}">${esc22(c.title)}</a><span class="mut">${GROUP_TITLE[c.group]}</span></li>`).join("")}</ul>` : '<h2>Nothing to fix</h2><p class="mut">Every check that can fail passes.</p>';
2025
2142
  const groups = GROUPS.map((group) => {
2026
2143
  const mine = sorted.filter((c) => c.group === group.key);
2027
2144
  const rest = mine.filter((c) => !needsFix(c));
2028
2145
  return `<h2>${GROUP_TITLE[group.key]}</h2><p class="mut">${group.intro}</p>${mine.filter(needsFix).map(fixCard).join("")}` + (rest.length ? `<ul class="rows">${rest.map(row2).join("")}</ul>` : "");
2029
2146
  }).join("");
2030
- return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>JQ Groundcrew: ${esc3(report2.project)}</title><style>${CSS}</style></head><body><main><h1>JQ Groundcrew</h1><p class="mut">The setup check for Claude Code. How it is set up for <code>${esc3(report2.project)}</code>. Read ${esc3(report2.generatedAt)}. Refresh to read again.</p><div class="score"><div class="tile"><b>${summary.fail}</b><span>to fix</span></div><div class="tile"><b>${summary.warn}</b><span>to look at</span></div><div class="tile"><b>${summary.pass}</b><span>good</span></div><div class="tile"><b>${summary.score}%</b><span>of ${judged} checks pass</span></div></div><div class="bar" role="img" aria-label="${summary.fail} to fix, ${summary.warn} to look at, ${summary.pass} good">${bar}</div>` + todo + layerPanel(report2.checks) + groups + `<footer><p>This page was made on your machine from the files below, and it loads nothing, so nothing left the machine. Its one script copies a prompt to your clipboard when you press Copy. It read settings and your instruction files, and counted the rest. It did not read the contents of any secret file, and it read no session transcript.</p><p>A suggested prompt asks Claude Code to show its plan or its diff first. Read that before you approve it.</p><ul>${report2.filesRead.map((file) => `<li><code>${esc3(file)}</code></li>`).join("")}</ul><p>Each check names the page of Anthropic\u2019s Claude Code documentation it rests on. The documentation was checked on 2026-11-14 and can change.</p></footer></main><script>${COPY_SCRIPT}</script></body></html>
2147
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>JQ Groundcrew: ${esc22(report2.project)}</title><style>${CSS}${toolsBar ? TOOLBAR_CSS3 : ""}</style></head><body><main><h1>JQ Groundcrew</h1><p class="mut">The setup check for Claude Code. How it is set up for <code>${esc22(report2.project)}</code>. Read ${esc22(report2.generatedAt)}. Refresh to read again.</p><div class="score"><div class="tile"><b>${summary.fail}</b><span>to fix</span></div><div class="tile"><b>${summary.warn}</b><span>to look at</span></div><div class="tile"><b>${summary.pass}</b><span>good</span></div><div class="tile"><b>${summary.score}%</b><span>of ${judged} checks pass</span></div></div><div class="bar" role="img" aria-label="${summary.fail} to fix, ${summary.warn} to look at, ${summary.pass} good">${bar}</div>` + todo + layerPanel(report2.checks) + groups + `<footer><p>This page was made on your machine from the files below, and it loads nothing, so nothing left the machine. Its one script copies a prompt to your clipboard when you press Copy. It read settings and your instruction files, and counted the rest. It did not read the contents of any secret file, and it read no session transcript.</p><p>A suggested prompt asks Claude Code to show its plan or its diff first. Read that before you approve it.</p><ul>${report2.filesRead.map((file) => `<li><code>${esc22(file)}</code></li>`).join("")}</ul><p>Each check names the page of Anthropic\u2019s Claude Code documentation it rests on. The documentation was checked on 2026-11-14 and can change.</p></footer></main>${toolsBar}<script>${COPY_SCRIPT}</script></body></html>
2031
2148
  `;
2032
2149
  }
2033
2150
  function report(project) {
@@ -2092,6 +2209,99 @@ async function collectOverview(opts) {
2092
2209
  return buildOverview({ snapshot: snap, trees, setups, waiting, inboxes, mailbox: opts.mailbox, mailNote, names: opts.names, remotes });
2093
2210
  }
2094
2211
 
2212
+ // src/presence.ts
2213
+ import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync as readdirSync4, readFileSync as readFileSync6, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
2214
+ import os6 from "os";
2215
+ import path7 from "path";
2216
+ var TOOLS = [
2217
+ { id: "deck", name: "JQ Deck", what: "sessions, setup and mail on one page", port: 4316, run: "npx @point-seven-studio/jq-deck" },
2218
+ { id: "agents", name: "JQ Agents", what: "every session, and which wait on a person", port: 4319, run: "npx @point-seven-studio/jq-agents" },
2219
+ { id: "groundcrew", name: "JQ Groundcrew", what: "the setup check for one project", port: 4317, run: "npx @point-seven-studio/jq-groundcrew" },
2220
+ { id: "crosstalk", name: "JQ Crosstalk", what: "the mailbox between sessions", port: 4318, run: "npx @point-seven-studio/jq-crosstalk view" }
2221
+ ];
2222
+ var esc3 = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
2223
+ function runningDir(env = process.env) {
2224
+ return env.JQ_RUNNING_DIR || path7.join(os6.homedir(), ".jq", "running");
2225
+ }
2226
+ var isTool = (id) => TOOLS.some((t) => t.id === id);
2227
+ var validPort = (n) => typeof n === "number" && Number.isInteger(n) && n >= 1 && n <= 65535;
2228
+ function alive(pid) {
2229
+ try {
2230
+ process.kill(pid, 0);
2231
+ return true;
2232
+ } catch (e) {
2233
+ return e?.code === "EPERM";
2234
+ }
2235
+ }
2236
+ function readRunning(dir = runningDir(), isAlive = alive) {
2237
+ const found = { deck: null, groundcrew: null, crosstalk: null, agents: null };
2238
+ if (!existsSync7(dir)) return found;
2239
+ let files;
2240
+ try {
2241
+ files = readdirSync4(dir).filter((f) => f.endsWith(".json"));
2242
+ } catch {
2243
+ return found;
2244
+ }
2245
+ for (const file of files) {
2246
+ try {
2247
+ const entry = JSON.parse(readFileSync6(path7.join(dir, file), "utf-8"));
2248
+ if (!isTool(entry?.tool) || !validPort(entry.port) || typeof entry.pid !== "number" || !isAlive(entry.pid)) continue;
2249
+ const usual = TOOLS.find((t) => t.id === entry.tool).port;
2250
+ if (found[entry.tool] === null || entry.port === usual) found[entry.tool] = entry.port;
2251
+ } catch {
2252
+ }
2253
+ }
2254
+ return found;
2255
+ }
2256
+ function readTeamUrl(file = process.env.JQ_CONFIG || path7.join(os6.homedir(), ".jq", "config.json")) {
2257
+ try {
2258
+ const team = JSON.parse(readFileSync6(file, "utf-8"))?.team;
2259
+ if (typeof team !== "string") return null;
2260
+ const url = new URL(team);
2261
+ if (url.protocol !== "https:" && url.protocol !== "http:") return null;
2262
+ if (url.username || url.password) return null;
2263
+ return url.href;
2264
+ } catch {
2265
+ return null;
2266
+ }
2267
+ }
2268
+ var TOOLBAR_CSS4 = `
2269
+ body{padding-bottom:64px}
2270
+ .jqbar{position:fixed;left:0;right:0;bottom:0;z-index:5;display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;padding:8px 16px;font:13px/1.4 system-ui,sans-serif;background:var(--card,Canvas);color:var(--fg,CanvasText);border-top:1px solid var(--line,GrayText)}
2271
+ .jqbar a{color:var(--link,LinkText)}
2272
+ .jqbar .here{font-weight:700}
2273
+ .jqbar details[open]{order:-1;flex-basis:100%}
2274
+ .jqbar summary{cursor:pointer;color:var(--mut,GrayText);list-style:none;display:inline-block;padding:2px 0}
2275
+ .jqbar summary::-webkit-details-marker{display:none}
2276
+ .jqbar summary::after{content:" \u25B8"}
2277
+ .jqbar details[open] summary::after{content:" \u25BE"}
2278
+ .jqbar summary small,.jqbar a small{font-size:11px;font-weight:400}
2279
+ .jqbar details>div{margin:4px 0 6px;padding:8px 10px;max-width:640px;border:1px solid var(--line,GrayText);border-radius:8px;background:var(--well,Canvas)}
2280
+ .jqbar details>div p{margin:0 0 4px}
2281
+ .jqbar code{font:12px ui-monospace,Menlo,monospace;word-break:break-all}
2282
+ .jqbar a:focus-visible,.jqbar summary:focus-visible{outline:2px solid var(--link,LinkText);outline-offset:2px}
2283
+ @media print{.jqbar{display:none}body{padding-bottom:0}}
2284
+ `;
2285
+ var local = (port) => `http://127.0.0.1:${port}`;
2286
+ function toolItem(t, o) {
2287
+ if (o.here === t.id) return `<span class="here" aria-current="page">${esc3(t.name)}</span>`;
2288
+ const start = `<p>To start it: <code>${esc3(t.run)}</code></p>`;
2289
+ if (o.running === null) {
2290
+ return `<details><summary>${esc3(t.name)} <small>on your computer</small></summary><div><p>${esc3(t.name)} shows ${esc3(t.what)}. It runs on your own computer, and this page cannot see whether it is running there.</p><p>If it is, it is at <a href="${local(t.port)}">${local(t.port)}</a>.</p>${start}</div></details>`;
2291
+ }
2292
+ const port = o.running[t.id];
2293
+ if (port !== null) return `<a href="${local(port)}" title="${esc3(t.what)}">${esc3(t.name)}</a>`;
2294
+ return `<details><summary>${esc3(t.name)} <small>not running</small></summary><div><p>${esc3(t.name)} shows ${esc3(t.what)}. It is not running on this machine.</p>${start}<p>Then refresh this page.</p></div></details>`;
2295
+ }
2296
+ function teamItem(o) {
2297
+ if (o.here === "team") return '<span class="here" aria-current="page">Team board</span>';
2298
+ if (o.team) return `<a href="${esc3(o.team)}" title="every machine on the team, on one page">Team board</a>`;
2299
+ return '<details><summary>Team board <small>not set up</small></summary><div><p>A team board shows every machine on a team on one page. This machine has no address for one.</p><p>If your team has one, add a <code>"team"</code> line holding its address to <code>~/.jq/config.json</code>.</p><p>To host one: <code>npx @point-seven-studio/jq-deck-server</code></p></div></details>';
2300
+ }
2301
+ function toolbar(o) {
2302
+ return `<nav class="jqbar" aria-label="JQ tools">${TOOLS.map((t) => toolItem(t, o)).join("")}${teamItem(o)}</nav>`;
2303
+ }
2304
+
2095
2305
  // src/page.ts
2096
2306
  var TABS = ["overview", "sessions", "setup", "mail"];
2097
2307
  var TAB_TITLE = { overview: "Overview", sessions: "Sessions", setup: "Setup", mail: "Mail" };
@@ -2141,7 +2351,7 @@ function mailTab(o) {
2141
2351
  }
2142
2352
  return '<iframe title="Mailbox" src="/raw/mail"></iframe>';
2143
2353
  }
2144
- function renderShell(o, tab, repo, version) {
2354
+ function renderShell(o, tab, repo, version, bar = "") {
2145
2355
  const body = tab === "overview" ? overview(o) : tab === "sessions" ? '<iframe title="Sessions" src="/raw/sessions"></iframe>' : tab === "setup" ? setupTab(o, repo) : mailTab(o);
2146
2356
  const needs = o.repos.reduce((n, r) => n + r.needs_you, 0);
2147
2357
  const failing = o.repos.filter((r) => r.setup && r.setup.fail > 0).length;
@@ -2177,7 +2387,7 @@ tbody th{font-weight:600}.path{display:block;font-weight:400;font-size:12px;colo
2177
2387
  .chip.on{border-color:var(--fg);font-weight:600}
2178
2388
  code,pre{font:12px ui-monospace,monospace;background:var(--well);border-radius:4px;padding:1px 4px}pre{padding:10px;overflow-x:auto}
2179
2389
  @media (max-width:640px){thead{display:none}tr{display:block;border-top:1px solid var(--line);padding:8px 0}th,td{display:block;border:0;padding:3px 12px}td::before{content:attr(data-l) ": ";color:var(--mut);font-size:12px}}
2180
- </style></head><body>
2390
+ ${bar ? TOOLBAR_CSS4 : ""}</style></head><body>
2181
2391
  <header>
2182
2392
  <h1>JQ Deck</h1>
2183
2393
  <p class="head">${esc4(o.headline)}</p>
@@ -2186,17 +2396,18 @@ code,pre{font:12px ui-monospace,monospace;background:var(--well);border-radius:4
2186
2396
  </header>
2187
2397
  <main>${body}</main>
2188
2398
  <footer class="mut" style="max-width:1000px;width:100%;margin:0 auto;padding:0 16px 16px">JQ Deck ${esc4(version)} \xB7 this machine only</footer>
2189
- </body></html>`;
2399
+ ${bar}</body></html>`;
2190
2400
  }
2191
2401
 
2192
2402
  // src/cli.ts
2193
- import path7 from "path";
2403
+ import path8 from "path";
2194
2404
  var DEFAULT_PORT = 4316;
2195
2405
  var list = (s) => (s || "").split(",").map((x) => x.trim()).filter(Boolean);
2196
2406
  function parseArgs(argv, env = {}) {
2197
2407
  const a = {
2198
2408
  json: false,
2199
2409
  watch: false,
2410
+ quiet: false,
2200
2411
  exec: null,
2201
2412
  intervalS: Number(env.JQ_DECK_INTERVAL_S) || 60,
2202
2413
  repos: null,
@@ -2219,6 +2430,7 @@ function parseArgs(argv, env = {}) {
2219
2430
  const f = argv[i];
2220
2431
  if (f === "--json") a.json = true;
2221
2432
  else if (f === "--watch") a.watch = true;
2433
+ else if (f === "--quiet") a.quiet = true;
2222
2434
  else if (f === "--exec") a.exec = value(i++, f);
2223
2435
  else if (f === "--repos") a.repos = list(value(i++, f));
2224
2436
  else if (f === "--all-repos") a.allRepos = true;
@@ -2251,18 +2463,19 @@ function reportList(a, fromConfig) {
2251
2463
  function buildContext(a, env, cwd, version) {
2252
2464
  const config = loadConfig(expandHome(a.config));
2253
2465
  return {
2466
+ runningDir: runningDir(env),
2254
2467
  configFile: expandHome(a.config),
2255
2468
  port: a.port,
2256
2469
  version,
2257
2470
  probe: a.probe,
2258
2471
  sample: a.sample,
2259
2472
  report: a.watch ? reportList(a, config.report) : null,
2260
- sendQuestions: a.watch ? (a.sendQuestions ?? config.sendQuestions ?? []).map((t) => path7.resolve(expandHome(t))) : [],
2473
+ sendQuestions: a.watch ? (a.sendQuestions ?? config.sendQuestions ?? []).map((t) => path8.resolve(expandHome(t))) : [],
2261
2474
  deck: {
2262
2475
  mailbox: findMailbox({ flag: a.mailbox, config: config.mailbox, env: env.CROSSTALK_DIR, cwd }),
2263
2476
  names: config.names,
2264
2477
  // Off unless asked for: question text is a session's own words.
2265
- questionTrees: (a.questionTrees ?? config.questions ?? []).map((t) => path7.resolve(expandHome(t))),
2478
+ questionTrees: (a.questionTrees ?? config.questions ?? []).map((t) => path8.resolve(expandHome(t))),
2266
2479
  maxAgeDays: a.maxAgeDays,
2267
2480
  cwd
2268
2481
  }
@@ -2279,7 +2492,8 @@ async function handle(url, host, ctx, overview2 = collectOverview) {
2279
2492
  if (u.pathname === "/") {
2280
2493
  const asked = u.searchParams.get("tab");
2281
2494
  const tab = TABS.includes(asked ?? "") ? asked : "overview";
2282
- return html(renderShell(await overview2(ctx.deck), tab, u.searchParams.get("repo"), ctx.version));
2495
+ const bar = toolbar({ here: "deck", running: readRunning(ctx.runningDir), team: readTeamUrl(ctx.configFile) });
2496
+ return html(renderShell(await overview2(ctx.deck), tab, u.searchParams.get("repo"), ctx.version, bar));
2283
2497
  }
2284
2498
  if (u.pathname === "/raw/sessions") {
2285
2499
  return html(renderPage(await snapshot({ questionTrees: ctx.deck.questionTrees, maxAgeDays: ctx.deck.maxAgeDays, projectsDir: ctx.deck.projectsDir, sockDir: ctx.deck.sockDir, probe: ctx.probe, sample: ctx.sample, turnCheck: readTurnCheckConfig(ctx.configFile) })));