@join-pantheon/cli 0.35.2-rc.2 → 0.35.3-rc.1

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.
@@ -658,11 +658,13 @@ export function renderTeam(d) {
658
658
  || (m.online ? `<span class="chip plain">connected</span>` : `<span class="quiet">offline</span>`);
659
659
  return `<tr><td class="span"><b class="who">${esc(cap(m.name))}</b>${m.founder ? ` <span class="chip plain">founder</span>` : ""}${m.admitted ? "" : ` <span class="chip line">waiting to be admitted</span>`}<span class="sub">${esc(m.agent || "agent unknown")}${m.mayWake ? "" : " · may not wake workers"}</span></td><td data-l="Connected now" class="span">${chips}${m.worker?.state === "unavailable" || m.worker?.state === "holding" ? `<span class="sub">${esc(workerWords(m.worker.reason))}</span>` : ""}</td><td data-l="Build">${m.build ? `<span class="mono">${esc(m.build)}</span><span class="sub">${m.behind ? "missed the self-upgrade" : "current"}</span>` : `<span class="quiet">unknown</span>`}</td><td data-l="Last seen">${m.online ? "now" : when(m.lastSeen, "full")}</td><td data-l="Delivered, not yet seen" class="r num">${m.unseen === null ? noReport(m.reportsSince) : m.unseen ? m.unseen : `<span class="quiet">0</span>`}</td></tr>`;
660
660
  }).join("");
661
- const goalRows = f.goals.map((g) => `<tr><td class="span"><b>${esc(g.title)}</b>${g.worklist ? ` <span class="chip plain">worklist</span>` : ""}<span class="sub">${g.why ? esc(g.why) : g.closedAt ? `closed ${when(g.closedAt, "full")}` : ""}</span><a class="more seeflow" href="/admin/goal?space=${enc}&amp;id=${esc(encodeURIComponent(g.id))}">See how it moved</a></td>
662
- <td data-l="State">${g.state === "OPEN" ? `<span class="chip">open</span>` : g.state === "CLOSED" ? `<span class="chip plain">closed</span>` : g.state === "STALLED" ? `<span class="chip line">${SEAL} out of acts</span>` : `<span class="chip line">${SEAL} blocked</span>`}</td>
661
+ const goalRow = (g) => `<tr><td class="span"><b>${esc(g.title)}</b>${g.worklist ? ` <span class="chip plain">worklist</span>` : ""}<span class="sub">${g.why ? esc(g.why) : g.closedAt ? `closed ${when(g.closedAt, "full")}` : ""}</span><a class="more seeflow" href="/admin/goal?space=${enc}&amp;id=${esc(encodeURIComponent(g.id))}">See how it moved</a></td>
662
+ <td data-l="State">${g.settled ? `<span class="chip plain">settled</span>` : g.state === "OPEN" ? `<span class="chip">open</span>` : g.state === "CLOSED" ? `<span class="chip plain">closed</span>` : g.state === "STALLED" ? `<span class="chip line">${SEAL} out of acts</span>` : `<span class="chip line">${SEAL} blocked</span>`}</td>
663
663
  <td data-l="Acts used"><span class="meter"><i style="width:${Math.min(100, pct(g.acts, g.budget))}%"></i></span><span class="num">${g.acts} / ${g.budget}</span></td>
664
664
  <td data-l="Deadline">${g.deadline ? `${when(g.deadline, "full")}${g.overdueMs !== null ? ` <span class="chip line">overdue ${dur(g.overdueMs)}</span>` : ""}` : `<span class="quiet">none</span>`}</td>
665
- <td data-l="Open items" class="r num">${g.open || `<span class="quiet">0</span>`}</td></tr>`).join("");
665
+ <td data-l="Open items" class="r num">${g.open || `<span class="quiet">0</span>`}</td></tr>`;
666
+ const goalRows = f.goals.filter((g) => !g.settled).map(goalRow).join("");
667
+ const settledGoals = f.goals.filter((g) => g.settled);
666
668
  const q = d.feed.q;
667
669
  const feedLink = (extra) => {
668
670
  const p = new URLSearchParams({ name: d.name });
@@ -748,8 +750,12 @@ export function renderTeam(d) {
748
750
  <div class="sechead"><h2 id="h-goals">Goals</h2><p>${d.stateNote?.kind === "rebuild" ? "not shown until this team rebuilds" : `${f.goals.filter((g) => g.state !== "CLOSED").length} open · ${f.goals.filter((g) => g.state === "CLOSED").length} closed ${range} · "See how it moved" draws who handed what to whom`}</p></div>
749
751
  <div class="card"><table class="rt">
750
752
  <thead><tr><th>Goal</th><th>State</th><th>Acts used</th><th>Deadline</th><th class="r">Open items</th></tr></thead>
751
- <tbody>${goalRows || `<tr><td colspan="5" class="empty">${d.stateNote?.kind === "rebuild" ? NOT_SHOWN : "No goals."}</td></tr>`}</tbody>
753
+ <tbody>${goalRows || `<tr><td colspan="5" class="empty">${d.stateNote?.kind === "rebuild" ? NOT_SHOWN : settledGoals.length ? "Every open goal is settled." : "No goals."}</td></tr>`}</tbody>
752
754
  </table></div>
755
+ ${settledGoals.length ? `<details class="card settled"><summary>Settled — close it? (${settledGoals.length}) · open, nothing owed, quiet three days after their last answer or delivery; whoever opened one closes it</summary><table class="rt">
756
+ <thead><tr><th>Goal</th><th>State</th><th>Acts used</th><th>Deadline</th><th class="r">Open items</th></tr></thead>
757
+ <tbody>${settledGoals.map(goalRow).join("")}</tbody>
758
+ </table></details>` : ""}
753
759
  </section>
754
760
 
755
761
  <section class="sec" id="conversation" aria-labelledby="h-msg">
package/dist/admin-ui.js CHANGED
@@ -217,6 +217,8 @@ td.empty{color:var(--muted);text-align:center;padding:22px 14px}
217
217
  .chart svg[tabindex]:focus-visible{outline:3px solid var(--focus);outline-offset:4px}
218
218
  .col.kbd .hit{stroke:var(--focus);stroke-width:3}.col.kbd rect,.col.kbd path{opacity:.85}
219
219
  details.tv{margin-top:8px;font-size:14px}
220
+ details.settled{margin-top:10px}
221
+ details.settled summary{cursor:pointer;color:var(--muted);padding:10px 14px}
220
222
  details.tv summary{cursor:pointer;color:var(--muted)}
221
223
  details.tv table{margin-top:8px}
222
224
  details.tv td,details.tv th{padding:4px 10px}
@@ -37,7 +37,7 @@ const COPILOT_HELP = [
37
37
  const KINDS = {
38
38
  "claude-code": [
39
39
  { re: /^Your organization has disabled Claude subscription access for Claude Code\b/, why: PLAN, wait: 6 * HOUR },
40
- { re: /^(?:Claude AI usage limit reached\|\d{10}|(?:5-hour|Weekly|Opus|Session) limit reached [·∙] resets \S.*|You(?:'|’)ve hit your (?:usage )?limit [·∙] resets \S.*|You(?:'|’)re out of extra usage [·∙] resets \S.*|Credit balance is too low)$/, why: LIMIT, wait: HOUR },
40
+ { re: /^(?:Claude AI usage limit reached\|\d{10}|(?:5-hour|weekly|opus|sonnet|session) limit reached [·∙] resets \S.*|You(?:'|’)ve hit your (?:usage |weekly |session |opus |sonnet |5-hour )?limit [·∙] resets \S.*|You(?:'|’)re out of extra usage [·∙] resets \S.*|Credit balance is too low)$/i, why: LIMIT, wait: HOUR },
41
41
  { re: /^(?:(?:Invalid API key|Not logged in|Login expired|OAuth token (?:has expired|revoked)) [·∙] Please run \/login|Invalid API key [·∙] Fix external API key|Failed to authenticate: (?:OAuth session expired and could not be refreshed\.?|OAuth token revoked\. Please log in again or contact your administrator\.)|Failed to authenticate\. API Error: 401 (?:OAuth access token is invalid\.|\{"type":"error","error":\{"type":"authentication_error".*\})(?: [·∙] Please run \/login)?|API Error: 401 \{"type":"error","error":\{"type":"authentication_error".*\} [·∙] Please run \/login)$/, why: SIGNIN, wait: HOUR,
42
42
  claude: claudeCred },
43
43
  { re: /^Your apiKeyHelper script is failing [·∙] This usually means you need to re-authenticate with your provider [·∙] Run \/status to see the script's error output$/, why: SIGNIN, wait: HOUR,
@@ -151,7 +151,7 @@ function namedTime(line, now) {
151
151
  const u = rel[2].toLowerCase();
152
152
  return { t: now + n * (u.startsWith("d") ? 24 * HOUR : u.startsWith("h") ? HOUR : MIN), dated: false };
153
153
  }
154
- const dated = /(?:resets?|reset at|try again (?:at|after))\s+(?:at\s+)?(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\.?\s+(\d{1,2})(?:st|nd|rd|th)?,?\s+(?:(\d{4}),?\s+)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)\b/i.exec(line);
154
+ const dated = /(?:resets?|reset at|try again (?:at|after))\s+(?:at\s+)?(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\.?\s+(\d{1,2})(?:st|nd|rd|th)?,?\s+(?:(\d{4}),?\s+)?(?:at\s+)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)\b/i.exec(line);
155
155
  if (dated) {
156
156
  const month = MONTHS.indexOf(dated[1].slice(0, 3).toLowerCase());
157
157
  const day = Number(dated[2]);
package/dist/agents.js CHANGED
@@ -698,6 +698,7 @@ export function headlessSpawn(opts) {
698
698
  let env = claudeEnv;
699
699
  let rulesOnArgv = bashRules;
700
700
  let osSandbox = false;
701
+ let sandboxedRun = false;
701
702
  if (opts.claude && opts.runHome) {
702
703
  const runTmp = runTmpDir(opts.runHome);
703
704
  const c = claudeRunSettings({
@@ -720,8 +721,10 @@ export function headlessSpawn(opts) {
720
721
  extra.push("--settings", file);
721
722
  rulesOnArgv = [];
722
723
  notes.push(...c.notes);
723
- if (c.sandboxed)
724
+ if (c.sandboxed) {
724
725
  env = { ...claudeEnv, ...sandboxCacheEnv(runTmp) };
726
+ sandboxedRun = true;
727
+ }
725
728
  osSandbox = "sandbox" in c.settings;
726
729
  }
727
730
  else if (f.disallowedTools) {
@@ -755,6 +758,7 @@ export function headlessSpawn(opts) {
755
758
  ...(notes.length ? { notes } : {}),
756
759
  ...(extra.includes("--setting-sources") ? { repoSettingsIgnored: true } : {}),
757
760
  ...(osSandbox ? { osSandbox: true } : {}),
761
+ ...(sandboxedRun ? { sandboxed: true } : {}),
758
762
  };
759
763
  }
760
764
  if (opts.backend.id === "codex") {
package/dist/board.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ACT_WORDS } from "./plain.js";
2
+ import { cleanOutcome, OUTCOME_MAX } from "./done-outcome.js";
2
3
  import { createServer } from "node:http";
3
4
  import { createHash, createHmac, randomBytes, timingSafeEqual } from "node:crypto";
4
5
  import { spawn } from "node:child_process";
@@ -14,6 +15,7 @@ import { which } from "./which.js";
14
15
  import { VERSION } from "./version.js";
15
16
  import { withoutAgentMarkers } from "./setup-changes.js";
16
17
  import { shellArg } from "./team-name.js";
18
+ import { BOARD_CARDS } from "./decision-ui.js";
17
19
  import { POLL_MS, powerNow } from "./power.js";
18
20
  import { runsTodayLine } from "./spend.js";
19
21
  import { QUEUED_SURFACE_WAIT_MS } from "./hud-queue.js";
@@ -29,6 +31,7 @@ catch {
29
31
  } };
30
32
  export const LANES = [
31
33
  { id: "now", title: "Needs you now", empty: "Nothing needs you right now." },
34
+ { id: "stale", title: "Still needed?", empty: "No decision of yours has gone quiet." },
32
35
  { id: "handling", title: "Your agents are handling", empty: "Your agents are not working on anything for the team." },
33
36
  { id: "waiting", title: "Waiting", empty: "You are not waiting on anyone." },
34
37
  { id: "older", title: "Older", empty: "Nothing has been stuck for over a week." },
@@ -245,7 +248,11 @@ export function hudActionFor(op, item) {
245
248
  case "done":
246
249
  if (item.kind !== "decision")
247
250
  return { error: "only your own decision can be marked done" };
248
- return { action: "done", decision: item.id, ...space, ...ref };
251
+ return { action: "done", decision: item.id, ...space, ...ref, ...(op.outcome ? { body: op.outcome } : {}) };
252
+ case "moot":
253
+ if (item.kind !== "decision")
254
+ return { error: "only your own decision can be set aside" };
255
+ return { action: "moot", decision: item.id, ...space, ...ref };
249
256
  case "choose": {
250
257
  const c = item.choices?.[op.index];
251
258
  if (!c)
@@ -276,7 +283,7 @@ export function hudActionFor(op, item) {
276
283
  }
277
284
  }
278
285
  export function parseBoardAction(raw) {
279
- const v = strictObject(raw, ["op", "id", "space", "index", "kind", "body", "act", "client"]);
286
+ const v = strictObject(raw, ["op", "id", "space", "index", "kind", "body", "act", "client", "outcome"]);
280
287
  if (!v)
281
288
  return null;
282
289
  const space = v.space === undefined ? undefined : str(v.space, SPACE_RE);
@@ -294,7 +301,17 @@ export function parseBoardAction(raw) {
294
301
  return null;
295
302
  const only = (keys) => Object.keys(v).every((k) => ["op", "id", "space", ...keys].includes(k));
296
303
  switch (v.op) {
297
- case "done": return only([]) ? { op: "done", id, ...sp } : null;
304
+ case "done": {
305
+ if (!only(["outcome"]))
306
+ return null;
307
+ if (v.outcome === undefined)
308
+ return { op: "done", id, ...sp };
309
+ if (typeof v.outcome !== "string" || v.outcome.length > OUTCOME_MAX)
310
+ return null;
311
+ const outcome = cleanOutcome(v.outcome);
312
+ return { op: "done", id, ...sp, ...(outcome ? { outcome } : {}) };
313
+ }
314
+ case "moot": return only([]) ? { op: "moot", id, ...sp } : null;
298
315
  case "open": return only([]) ? { op: "open", id, ...sp } : null;
299
316
  case "wake-allow":
300
317
  case "wake-deny": return only([]) ? { op: v.op, id, ...sp } : null;
@@ -302,6 +319,7 @@ export function parseBoardAction(raw) {
302
319
  case "stop": return only([]) ? { op: v.op, id, ...sp } : null;
303
320
  case "change-approve":
304
321
  case "change-keep": return only([]) && /^c_[0-9a-f]{8}$/.test(id) ? { op: v.op, id, ...sp } : null;
322
+ case "close-settled": return only([]) ? { op: "close-settled", id, ...sp } : null;
305
323
  case "choose":
306
324
  return only(["index"]) && Number.isInteger(v.index) && v.index >= 0 && v.index < 10
307
325
  ? { op: "choose", id, ...sp, index: v.index } : null;
@@ -611,6 +629,18 @@ export async function startBoardServer(o = {}) {
611
629
  sendJson(res, 200, { ok: r.code === 0, message: r.code === 0 ? `Removed ${g.name} from this computer.` : (why ?? "it could not be removed — run pantheon leave in a terminal") });
612
630
  return;
613
631
  }
632
+ if (op.op === "close-settled") {
633
+ const g = ((await status()).settled_goals ?? []).find((x) => x.id === op.id && (op.space === undefined || x.space === op.space));
634
+ if (!g) {
635
+ sendJson(res, 200, { ok: false, message: "that goal is no longer listed as settled" });
636
+ return;
637
+ }
638
+ const r = await deps.cli(["goal", "close", g.id, "--settled", ...(g.space ? ["--space", g.space] : [])], 30_000);
639
+ const done = r.code === 0 && /^(closed|already closed)/m.test(r.out);
640
+ const why = /^not sent: (.*)$/m.exec(r.out)?.[1]?.trim();
641
+ sendJson(res, 200, { ok: done, message: done ? `Closed “${g.title}”.` : (why ?? "it could not be closed — pantheon goal close in a terminal") });
642
+ return;
643
+ }
614
644
  if (op.op === "retract") {
615
645
  const s = sent.get(op.act);
616
646
  if (!s || deps.now() - s.at > SENT_KEEP_MS) {
@@ -1003,6 +1033,8 @@ export function renderWatch(s, o = { now: Date.now() }) {
1003
1033
  lines.push(Y(l));
1004
1034
  for (const g of s.gone_spaces ?? [])
1005
1035
  lines.push(fit(`${termSafe(g.line)} · Remove from this computer: pantheon leave ${termSafe(shellArg(g.space))}`));
1036
+ if (s.settled_goals?.length)
1037
+ lines.push(D(fit(`Settled — close it? (${s.settled_goals.length}): ${s.settled_goals.slice(0, 2).map((g) => `pantheon goal close ${g.id} --settled`).join(" · ")}${s.settled_goals.length > 2 ? " · …" : ""}`)));
1006
1038
  if (s.relay_ok === false || s.decisions_ok === false)
1007
1039
  lines.push(Y(fit(`! Could not reach: ${termSafe((s.unavailable_spaces ?? []).join(", ") || "the relay")} — what is shown may be incomplete`)));
1008
1040
  const items = s.items ?? [];
@@ -1126,6 +1158,11 @@ export function boardHtml(nonce) {
1126
1158
  <div id="problem" class="banner problem" role="status" hidden><strong id="problem-lead"></strong> <span id="problem-text"></span></div>
1127
1159
  <div id="stuck" class="banner problem" role="status" hidden></div>
1128
1160
  <ul id="gone" class="gone" hidden></ul>
1161
+ <details id="settled" class="unsent settled" hidden>
1162
+ <summary>Settled — close it? <span class="count" id="c-settled"></span></summary>
1163
+ <p class="muted">Goals you opened with nothing left in them: nothing owed, and quiet for three days since their last answer or delivery. Close one to record it as done for everyone in it.</p>
1164
+ <ul id="l-settled" class="gone"></ul>
1165
+ </details>
1129
1166
  <section id="unsent" class="unsent" aria-labelledby="h-unsent" hidden>
1130
1167
  <h2 id="h-unsent">Not sent</h2>
1131
1168
  <p class="muted">Words you typed on something that is no longer on your board. Copy what you still need.</p>
@@ -1134,11 +1171,15 @@ export function boardHtml(nonce) {
1134
1171
  <div id="banner" class="banner" role="alert" hidden></div>
1135
1172
  <main id="board" tabindex="-1" aria-busy="true">
1136
1173
  <p id="loading" class="muted">Loading your board…</p>
1137
- ${LANES.map((l) => ` <section class="lane lane-${l.id}" aria-labelledby="h-${l.id}">
1174
+ ${LANES.map((l) => l.id === "now" ? ` <section class="lane lane-${l.id}" aria-labelledby="h-${l.id}">
1138
1175
  <h2 id="h-${l.id}">${l.title} <span class="count" id="c-${l.id}"></span></h2>
1139
- <ul id="l-${l.id}" class="${l.id === "now" ? "cards" : "rows"}"></ul>
1176
+ <ul id="l-${l.id}" class="cards"></ul>
1177
+ <p id="e-${l.id}" class="empty muted" hidden>${l.empty}</p>
1178
+ </section>` : ` <details class="lane lane-${l.id}" id="lane-${l.id}" data-lane="${l.id}">
1179
+ <summary><h2 id="h-${l.id}">${l.title} <span class="count" id="c-${l.id}"></span></h2></summary>
1180
+ <ul id="l-${l.id}" class="${l.id === "stale" ? "cards" : "rows"}"></ul>
1140
1181
  <p id="e-${l.id}" class="empty muted" hidden>${l.empty}</p>
1141
- </section>`).join("\n")}
1182
+ </details>`).join("\n")}
1142
1183
  </main>
1143
1184
  <dialog id="detail" aria-labelledby="d-title">
1144
1185
  <div class="dlg">
@@ -1183,6 +1224,9 @@ body{margin:0;background:var(--bg);color:var(--text);font:15px/1.45 system-ui,-a
1183
1224
  main{max-width:980px;margin:0 auto;padding:12px 16px 48px}
1184
1225
  main:focus{outline:none}
1185
1226
  .lane h2{font-size:16px;margin:24px 0 8px}
1227
+ details.lane>summary{cursor:pointer;list-style-position:outside}
1228
+ details.lane>summary h2{display:inline-block}
1229
+ details.more>summary,details.earlier>summary{cursor:pointer;color:var(--muted);margin:4px 0 10px}
1186
1230
  .count{color:var(--muted);font-weight:400}
1187
1231
  ul{list-style:none;margin:0;padding:0}
1188
1232
  .cards>li{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:14px 16px;margin:0 0 10px}
@@ -1209,6 +1253,7 @@ button[disabled]{opacity:.55;cursor:default}
1209
1253
  .empty{margin:4px 0}
1210
1254
  .unsent{max-width:980px;margin:12px auto 0}
1211
1255
  .unsent>h2{font-size:1rem;margin:0 0 4px}
1256
+ .settled>summary{cursor:pointer;font-weight:600}
1212
1257
  .unsent .words{flex:1 1 100%;margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
1213
1258
  @media (max-width:1012px){.unsent{margin-left:16px;margin-right:16px}}
1214
1259
  dialog{border:1px solid var(--line);border-radius:12px;padding:0;background:var(--card);color:var(--text);width:min(760px,96vw);max-height:92vh}
@@ -1267,6 +1312,14 @@ let current = null;
1267
1312
  const keyOf = (item) => (item ? item.space + "|" + item.id : "");
1268
1313
  const drafts = new Map(); // keyOf(item) -> { text, kind }: the words and the kind of reply chosen for them
1269
1314
  // A click's dialog closes only if it is still the dialog of what was clicked (#79): never the one opened since.
1315
+ // Mark done, with one optional line on what happened — whoever asked reads it (0.35.3). Empty to skip; Cancel sends nothing.
1316
+ function markDone(item, btn) {
1317
+ // (A page with no prompt — the tests' sandbox — marks it done with no line, as before.)
1318
+ const said = typeof prompt === "function" ? prompt("Mark done. What happened? (optional, one line: whoever asked will read it)", "") : "";
1319
+ if (said === null) return Promise.resolve(null);
1320
+ const outcome = said.replace(/\\s+/g, " ").trim().slice(0, ${OUTCOME_MAX});
1321
+ return act(Object.assign({ op: "done", id: item.id, space: item.space }, outcome ? { outcome } : {}), btn, undefined, item);
1322
+ }
1270
1323
  const closeIf = (item, r) => { if (r && r.ok && keyOf(current) === keyOf(item)) $("detail").close(); };
1271
1324
  const sentFor = new Map(); // keyOf(item) -> { sent, until }
1272
1325
  // A send in flight belongs to its decision (#105, #110): Send is off for that decision only, also
@@ -1496,6 +1549,22 @@ function render() {
1496
1549
  }));
1497
1550
  return li;
1498
1551
  }));
1552
+ // Goals this person opened with nothing left in them (settled.ts): collapsed, a Close each. Never an alert.
1553
+ const settledGoals = s.settled_goals || [];
1554
+ $("settled").hidden = !settledGoals.length;
1555
+ $("c-settled").textContent = "(" + settledGoals.length + ")";
1556
+ $("l-settled").replaceChildren(...settledGoals.map((g) => {
1557
+ const li = el("li");
1558
+ li.append(el("span", "", g.title + (multi() && g.space ? " · " + g.space : "") + (g.quiet ? " · " + g.quiet : "")));
1559
+ li.append(button("Close", async (ev) => {
1560
+ const b = ev.currentTarget;
1561
+ b.disabled = true;
1562
+ try { const r = await api("/api/action", Object.assign({ op: "close-settled", id: g.id }, g.space ? { space: g.space } : {})); toast(r.message || (r.ok ? "Closed." : "It could not be closed.")); if (r.ok) await refresh(); }
1563
+ catch (e) { toast("It could not be closed: " + e.message); }
1564
+ finally { b.disabled = false; }
1565
+ }));
1566
+ return li;
1567
+ }));
1499
1568
  // "Your agent ran N teammate requests today (M min)" — the words spend.ts runsTodayLine uses; hidden when none ran.
1500
1569
  const rt = s.runs_today || null;
1501
1570
  const rn = rt && rt.n > 0 ? rt.n : 0;
@@ -1517,9 +1586,10 @@ function render() {
1517
1586
  for (const lane of LANES) {
1518
1587
  const list = $("l-" + lane);
1519
1588
  const mine = items.filter((i) => i.lane === lane);
1589
+ // The count is every one (the badge's number); the rows fold repeats and, on "now", the cards past BOARD_CARDS.
1520
1590
  $("c-" + lane).textContent = "(" + mine.length + ")";
1521
1591
  $("e-" + lane).hidden = mine.length > 0;
1522
- list.replaceChildren(...mine.map((i) => row(i, lane === "now")));
1592
+ list.replaceChildren(...laneRows(mine, lane));
1523
1593
  }
1524
1594
  if (keep && keep.k) {
1525
1595
  for (const b of document.querySelectorAll("[data-k]")) if (b.dataset.k === keep.k && b.dataset.a === keep.a) { b.focus(); break; }
@@ -1551,13 +1621,47 @@ function renderUnsent() {
1551
1621
 
1552
1622
  function tag(b, item, a) { b.dataset.k = key(item); b.dataset.a = a; return b; }
1553
1623
 
1624
+ // A lane's rows (0.35.3): a decision standing for earlier ones in its goal shows them under it ("+2 earlier"),
1625
+ // each still answered on its own; "now" shows BOARD_CARDS cards, then "N more need you". What is opened
1626
+ // stays open across the board's refreshes.
1627
+ const extraOpen = new Set();
1628
+ function fold(k, summary, rows) {
1629
+ const d = el("details", k.startsWith("more|") ? "more" : "earlier");
1630
+ d.open = extraOpen.has(k);
1631
+ d.addEventListener("toggle", () => { if (d.open) extraOpen.add(k); else extraOpen.delete(k); });
1632
+ d.append(el("summary", "", summary));
1633
+ const ul = el("ul", "cards");
1634
+ ul.append(...rows);
1635
+ d.append(ul);
1636
+ return d;
1637
+ }
1638
+ function laneRows(mine, lane) {
1639
+ const card = lane === "now" || lane === "stale";
1640
+ const here = new Set(mine.map((i) => key(i)));
1641
+ const under = (i) => i.repeat_of && here.has((i.space || "") + "|" + i.repeat_of);
1642
+ const top = mine.filter((i) => !under(i));
1643
+ const earlierOf = (i) => mine.filter((x) => under(x) && x.repeat_of === i.id && (x.space || "") === (i.space || ""));
1644
+ const out = top.map((i) => {
1645
+ const li = row(i, card);
1646
+ const earlier = earlierOf(i);
1647
+ if (earlier.length) li.append(fold("earlier|" + key(i), "+" + earlier.length + " earlier in this goal", earlier.map((x) => row(x, card))));
1648
+ return li;
1649
+ });
1650
+ if (lane !== "now" || out.length <= ${BOARD_CARDS}) return out;
1651
+ const li = el("li", "more");
1652
+ // Every decision past the first five, the earlier ones under them included — the menu bar's count too.
1653
+ const more = top.slice(${BOARD_CARDS}).reduce((n, i) => n + 1 + earlierOf(i).length, 0);
1654
+ li.append(fold("more|now", more + " more need you", out.slice(${BOARD_CARDS})));
1655
+ return [...out.slice(0, ${BOARD_CARDS}), li];
1656
+ }
1657
+
1554
1658
  function row(item, card) {
1555
1659
  const li = el("li");
1556
1660
  const h = el("h3");
1557
1661
  h.append(tag(button(item.headline || item.title, () => openDetail(item), "linkish"), item, "open"));
1558
1662
  li.append(h);
1559
1663
  const meta = el("p", "meta");
1560
- meta.append(el("span", "", [item.who, ago(item.when)].filter(Boolean).join(" · ")));
1664
+ meta.append(el("span", "", [item.who, ago(item.when), item.overdue ? "overdue" : "", item.options ? item.options + " options" : "", item.stale || ""].filter(Boolean).join(" · ")));
1561
1665
  if (multi() && item.space) meta.append(el("span", "chip", item.space));
1562
1666
  if (item.kind === "change") meta.append(el("span", "chip", "your setup"));
1563
1667
  else if (item.kind === "decision") meta.append(el("span", "chip", "your decision"));
@@ -1582,7 +1686,9 @@ function row(item, card) {
1582
1686
  acts.append(tag(button("Reply…", () => openDetail(item, true)), item, "reply"));
1583
1687
  } else if (card) {
1584
1688
  (item.choices || []).forEach((c, idx) => acts.append(tag(button(c.label, (ev) => act({ op: "choose", id: item.id, space: item.space, index: idx }, ev.currentTarget, c.label + " — sent.", item).then((r) => settled(item, r)), idx === 0 ? "primary" : ""), item, "c" + idx)));
1585
- if (item.kind === "decision") acts.append(tag(button("Mark done", (ev) => act({ op: "done", id: item.id, space: item.space }, ev.currentTarget, undefined, item).then((r) => settled(item, r)), ""), item, "done"));
1689
+ if (item.kind === "decision") acts.append(tag(button("Mark done", (ev) => markDone(item, ev.currentTarget).then((r) => settled(item, r)), ""), item, "done"));
1690
+ // Under "Still needed?": the person says the question has gone — never sent for them.
1691
+ if (item.kind === "decision" && item.lane === "stale") acts.append(tag(button("No longer needed", (ev) => act({ op: "moot", id: item.id, space: item.space }, ev.currentTarget, undefined, item).then((r) => settled(item, r)), ""), item, "moot"));
1586
1692
  acts.append(tag(button("Reply…", () => openDetail(item, true)), item, "reply"));
1587
1693
  acts.append(tag(button("Explain in " + surface(), (ev) => act({ op: "open", id: item.id, space: item.space }, ev.currentTarget, undefined, item)), item, "explain"));
1588
1694
  } else {
@@ -1719,7 +1825,8 @@ async function openDetail(item, focusReply) {
1719
1825
  $("d-close").focus();
1720
1826
  return;
1721
1827
  }
1722
- if (item.kind === "decision" && !item.wake) actions.append(button("Mark done", (ev) => act({ op: "done", id: item.id, space: item.space }, ev.currentTarget, undefined, item).then((r) => { if (!settled(item, r)) closeIf(item, r); })));
1828
+ if (item.kind === "decision" && !item.wake) actions.append(button("Mark done", (ev) => markDone(item, ev.currentTarget).then((r) => { if (!settled(item, r)) closeIf(item, r); })));
1829
+ if (item.kind === "decision" && !item.wake && item.lane === "stale") actions.append(button("No longer needed", (ev) => act({ op: "moot", id: item.id, space: item.space }, ev.currentTarget, undefined, item).then((r) => { if (!settled(item, r)) closeIf(item, r); })));
1723
1830
  actions.append(button("Explain in " + surface(), (ev) => act({ op: "open", id: item.id, space: item.space }, ev.currentTarget, undefined, item)));
1724
1831
  if (item.goal && item.space) actions.append(button("Show the thread", () => thread(item)));
1725
1832
  actions.append(button("Copy the question", () => copy(item.prompt)));
@@ -1996,6 +2103,21 @@ function stop() { if (timer) { clearInterval(timer); timer = null; } }
1996
2103
  function schedule() { stop(); if (!document.hidden) timer = setInterval(refresh, refreshMs); }
1997
2104
 
1998
2105
  $("refresh").addEventListener("click", () => refresh());
2106
+ // The counted lanes are closed until the person opens one, and stay as they left them (0.35.3): which
2107
+ // are open is kept in this browser's localStorage, a view preference only — it may be off, or throw.
2108
+ const OPEN_KEY = "pantheon-board-lanes";
2109
+ (() => {
2110
+ let open = [];
2111
+ try { const j = JSON.parse(localStorage.getItem(OPEN_KEY) || "[]"); if (Array.isArray(j)) open = j.filter((x) => typeof x === "string"); } catch { open = []; }
2112
+ const folds = LANES.map((l) => [l, $("lane-" + l)]).filter(([, d]) => d);
2113
+ for (const [l, d] of folds) {
2114
+ d.open = open.includes(l);
2115
+ d.addEventListener("toggle", () => {
2116
+ const now = folds.filter(([, x]) => x.open).map(([x]) => x);
2117
+ try { localStorage.setItem(OPEN_KEY, JSON.stringify(now)); } catch { /* storage off: this page only */ }
2118
+ });
2119
+ }
2120
+ })();
1999
2121
  $("d-close").addEventListener("click", () => $("detail").close());
2000
2122
  $("detail").addEventListener("close", () => { current = null; });
2001
2123
  $("d-send").addEventListener("click", () => send());