@staix/agent-hub 0.48.3 → 0.49.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +1 -1
  3. package/docs/agent-notes/daemon.md +2 -2
  4. package/docs/agent-notes/tasks.md +1 -1
  5. package/docs/design/adapters.md +4 -7
  6. package/docs/design/agent-hub-architecture.md +1 -1
  7. package/docs/design/agent-hub.md +1 -1
  8. package/docs/design/bus.md +2 -2
  9. package/docs/design/cli-output-inventory.md +39 -38
  10. package/docs/design/cli-output.md +7 -3
  11. package/docs/design/guidance-experiments.md +3 -1
  12. package/docs/design/guidance-probes.md +33 -31
  13. package/docs/design/model-routes.md +11 -14
  14. package/docs/design/roadmap.md +10 -9
  15. package/docs/design/supervision.md +6 -6
  16. package/docs/design/task-board.md +2 -2
  17. package/docs/dogfood.md +1 -1
  18. package/docs/operations.md +12 -7
  19. package/docs/quickstart.md +19 -1
  20. package/docs/roadmap.json +519 -1
  21. package/docs/roadmap.md +94 -0
  22. package/docs/security.md +3 -1
  23. package/docs/verification/2026-11-26-compat-pi-1.6.1.md +28 -0
  24. package/docs/verification/2026-11-27-0.48.4.md +37 -0
  25. package/docs/verification/2026-11-28-0.49.0.md +53 -0
  26. package/docs/verified.json +19 -19
  27. package/package.json +1 -1
  28. package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
  29. package/plugins/agent-hub/kimi-hook.js +29 -4
  30. package/plugins/agent-hub/server.js +34 -5
  31. package/src/adapters/channel-peer.ts +5 -2
  32. package/src/adapters/claude-channel.ts +1 -0
  33. package/src/adapters/compat.ts +4 -4
  34. package/src/adapters/definitions/native-cli-entry-claude.ts +22 -1
  35. package/src/cli/agents-output.ts +13 -0
  36. package/src/cli/agents.ts +16 -7
  37. package/src/cli/answer-output.ts +67 -0
  38. package/src/cli/broker.ts +9 -2
  39. package/src/cli/launch.ts +1 -1
  40. package/src/cli/main.ts +96 -127
  41. package/src/cli/recovery-package.ts +78 -26
  42. package/src/cli/reset-output.ts +50 -0
  43. package/src/cli/sdlc-output.ts +57 -0
  44. package/src/cli/settings-output.ts +80 -0
  45. package/src/hub/check-runner.ts +7 -3
  46. package/src/hub/claude-launch-proof.ts +12 -2
  47. package/src/hub/claude-state.ts +3 -0
  48. package/src/hub/control-client.ts +2 -0
  49. package/src/hub/daemon.ts +102 -40
  50. package/src/hub/memory-profile.ts +12 -1
  51. package/src/hub/roadmap-export.ts +12 -9
  52. package/src/hub/roadmap-issue-states.ts +35 -0
  53. package/src/hub/runtime-capture-prune.ts +21 -6
  54. package/src/hub/runtime-package-assets.ts +6 -0
  55. package/src/hub/supervision-proposals.ts +3 -3
  56. package/src/hub/supervision-rules.ts +2 -2
  57. package/src/hub/task-sweep.ts +1 -1
  58. package/src/hub/tasks.ts +37 -20
package/src/hub/daemon.ts CHANGED
@@ -94,7 +94,7 @@ import { agentVersionsAsync, type AgentVersionRow } from "../cli/agents.ts";
94
94
  import { driftedAgents, noticeDrift, type DriftedAgent } from "./agent-drift.ts";
95
95
  import { jcodeMcpReady } from "../cli/jcode-mcp.ts";
96
96
  import { loadSdlc, readSpecEdit, sdlcGh, type SdlcConfig, type SdlcGh } from "./sdlc.ts";
97
- import { claudePeer as defaultChannelPeer, claudeStateFile, ownTerminalRow, pathEvidence, transcriptPersisted } from "./claude-state.ts";
97
+ import { claudePeer as defaultChannelPeer, claudeStateFile, isClaudeSessionUuid, ownTerminalRow, pathEvidence, transcriptPersisted } from "./claude-state.ts";
98
98
  import { peerRosterConfig, rosterAllows, staleInstanceKey, type PeerRoster } from "./roster.ts";
99
99
  import { KNOWN_PEERS, OPTIONAL_PEERS, PLANNER_PEERS, SUPPORTED_PEERS, START_MODE_PEERS, isSupportedPeer, STARTABLE_PEERS, isStartablePeer } from "../adapters/registry.ts";
100
100
  import { RecoveryDeferredHubError } from "./deferred-hub.ts";
@@ -953,6 +953,7 @@ interface Client {
953
953
  /** agent-hub#1036: this connection is a distinct session; `peer` is the id the daemon minted for it (`<peer>~<origin>`), never a bus peer. */
954
954
  session?: true;
955
955
  launchId?: string;
956
+ claudeSessionId?: string;
956
957
  /** Display-only retained standby id; peer operations stay fenced until ownsSocket confirms attachment. */
957
958
  standbyId?: string;
958
959
  /** Host-minted per connection and durable only as a private replay comparator; never a token, live authority or wire claim. */
@@ -1497,14 +1498,7 @@ export async function startDaemon(opts: DaemonOptions) {
1497
1498
  parsed = JSON.parse(String(data));
1498
1499
  onControlMessage(sock, parsed);
1499
1500
  } catch (e) {
1500
- if (isDatabaseBusy(e) && sock.data.authed && Number.isSafeInteger(parsed?.rid)) {
1501
- const busy = new RecoveryDatabaseBusy();
1502
- try { log(`control ${sanitize(String(parsed.t))} database contention: ${databaseBusySite(e).join("\n")}`); } catch { /* the reply still settles its rid */ }
1503
- sock.send(JSON.stringify({ rid: parsed.rid, ok: false, error: busy.message, code: busy.code, retryable: busy.retryable }));
1504
- return;
1505
- }
1506
- log("control operation failed; inspect delivery storage and recovery status");
1507
- if (sock.data.authed && Number.isSafeInteger(parsed?.rid)) sock.send(JSON.stringify({ rid: parsed.rid, ok: false, error: "operation failed; inspect delivery storage and recovery status before retrying" }));
1501
+ controlOperationFailed(sock, parsed, e);
1508
1502
  }
1509
1503
  },
1510
1504
  close(sock) {
@@ -2984,10 +2978,8 @@ export async function startDaemon(opts: DaemonOptions) {
2984
2978
  const checkRunner = opts.boundedTools?.runner?.(checkOptions) ?? (config.checks.runner === "remote" ? new RemoteRunner(checkOptions) : new ContainerRunner(checkOptions));
2985
2979
  const runnerRefreshAbort = new AbortController();
2986
2980
  startupCleanup.push(() => { runnerRefreshAbort.abort(); void checkRunner.stopAll(); });
2987
- // #1445 step 2: the first runner probe (a remote runner takes about 8 s: ssh, docker version, image inspect, a launched and torn down
2988
- // probe container) no longer holds startup. It runs single-flight beside the orphan sweep and the spec probe, and startup waits for it
2989
- // only STARTUP_RUNNER_WAIT_MS. A probe that is not done yet leaves `runnerState` unavailable with a fixed reason, and every reader that
2990
- // needs the answer (`check_run` awaits `refreshRunner()`) joins the same promise, so the settled state equals the one a blocking start gives.
2981
+ // #1445: run all three checks concurrently and spend at most STARTUP_RUNNER_WAIT_MS waiting for runner availability.
2982
+ // Check and spec requests join the shared work before using its result.
2991
2983
  let runnerState: RunnerState = { available: false, reason: "runner probe in progress" };
2992
2984
  let runnerStateAt = 0, refreshingRunner: Promise<void> | undefined;
2993
2985
  // `stopping` is declared far below and a probe can settle during startup, so the runner keeps its own closed flag, set where `stopping` is.
@@ -2999,9 +2991,20 @@ export async function startDaemon(opts: DaemonOptions) {
2999
2991
  if (runnerClosed || runnerRefreshAbort.signal.aborted) return;
3000
2992
  runnerState = { available: false, reason: config.checks.runner === "remote" ? "remote runner unavailable" : "container unavailable" }; runnerStateAt = Date.now();
3001
2993
  }).finally(() => { refreshingRunner = undefined; });
3002
- const orphanChecks = (await checkRunner.sweep()).map(line => boundedSafe(line) ? sanitize(line) : "orphan check: details withheld by privacy policy");
2994
+ let orphanChecks: string[] | undefined;
2995
+ const orphanSweep = Promise.resolve().then(() => checkRunner.sweep(runnerRefreshAbort.signal)).then(lines => {
2996
+ if (runnerClosed || runnerRefreshAbort.signal.aborted) return;
2997
+ orphanChecks = lines.map(line => boundedSafe(line) ? sanitize(line) : "orphan check: details withheld by privacy policy");
2998
+ }).catch(() => {
2999
+ if (runnerClosed || runnerRefreshAbort.signal.aborted) return;
3000
+ orphanChecks = ["orphan check: sweep unavailable"];
3001
+ });
3003
3002
  const firstRunnerProbe = refreshingRunner = settleRunner(checkRunner.available(runnerRefreshAbort.signal));
3004
- if (opts.boundedTools?.specAvailable || !opts.config && (config.pi.enabled || config.checks.runner === "container" || config.checks.runner === "remote")) await ensureSpec();
3003
+ const firstSpecProbe = opts.boundedTools?.specAvailable || !opts.config && (config.pi.enabled || config.checks.runner === "container" || config.checks.runner === "remote")
3004
+ ? ensureSpec() : undefined;
3005
+ let firstSpecSettled = firstSpecProbe === undefined;
3006
+ void firstSpecProbe?.finally(() => { firstSpecSettled = true; });
3007
+ const startupSpecPending = () => !firstSpecSettled;
3005
3008
  await Promise.race([firstRunnerProbe, new Promise<void>(resolve => { const timer = setTimeout(resolve, STARTUP_RUNNER_WAIT_MS); timer.unref?.(); void firstRunnerProbe.finally(() => clearTimeout(timer)); })]);
3006
3009
  startupTimings.mark("task_checks");
3007
3010
  const refreshRunner = (): Promise<void> => {
@@ -3322,7 +3325,7 @@ export async function startDaemon(opts: DaemonOptions) {
3322
3325
  ? projections.fingerprint(join(opts.cwd, `source${receipt.converter.extension}`)) : SOURCE_UTF8_PROJECTION_VERSION,
3323
3326
  });
3324
3327
  },
3325
- experimentCheck: run => checkRunner.result(run),
3328
+ experimentCheck: async run => { await orphanSweep; return checkRunner.result(run); },
3326
3329
  // The PII screen (issue #198): the model on this machine when MLX/Ollama is enabled, else the gateway on campus only.
3327
3330
  piiScreen: (text) => {
3328
3331
  const screen = () => (opts.piiScreen ?? ((value: string) => screenPii(value, { ...(config.mlx.enabled === false ? {} : { device: () => ensureMlx(config.mlx) }), onCampus, omni, fixedModel: () => activeRouting().local.fixed_model })))(text);
@@ -3422,7 +3425,7 @@ export async function startDaemon(opts: DaemonOptions) {
3422
3425
  if (!tasks.isPii(row)) { const edits = editEvidence.snapshot(row.id, taskRevision(side).revision); if (edits) facts.edits = [edits]; }
3423
3426
  const window = side.history.slice(taskRevision(side).from);
3424
3427
  // Hashing is only owed when this revision recorded a check pass over delivered ids; otherwise the rule says so itself.
3425
- if (!tasks.isPii(row) && window.some((entry) => entry.event === "check passed") && window.some((entry) => (entry.deliverables?.length ?? 0) > 0)) {
3428
+ if (!tasks.isPii(row) && window.some((entry) => entry.event === "check passed" || entry.event === "check run passed") && window.some((entry) => (entry.deliverables?.length ?? 0) > 0)) {
3426
3429
  const status = await tasks.deliverableStatus(row);
3427
3430
  if (status) {
3428
3431
  facts.deliverables = [{
@@ -3502,7 +3505,7 @@ export async function startDaemon(opts: DaemonOptions) {
3502
3505
  } catch { /* An unknown projection never reaches a model. */ }
3503
3506
  if (!binding || binding.owner !== peer || !currentCheck(binding) || !outputSafe) {
3504
3507
  checkBindings.delete(run);
3505
- void checkRunner.markStale(run).catch(() => {});
3508
+ void orphanSweep.then(() => runnerClosed ? undefined : checkRunner.markStale(run)).catch(() => {});
3506
3509
  return false;
3507
3510
  }
3508
3511
  return true;
@@ -3810,7 +3813,7 @@ export async function startDaemon(opts: DaemonOptions) {
3810
3813
  /** #1555 AC6: ephemeral per-task state of a task that reached approved or cancelled. Retention only: a failure keeps the rows and the files, and no board row, rollup row or history field is read or written. */
3811
3814
  const compactClosedTask = (task: number) => {
3812
3815
  try { turnLog?.pruneTouches([task]); } catch { log("touches retention pass failed; the table keeps its rows"); }
3813
- void checkRunner.compactTask?.(task).catch(() => { log("check output retention pass failed; the files stay"); });
3816
+ void orphanSweep.then(() => runnerClosed ? undefined : checkRunner.compactTask?.(task)).catch(() => { log("check output retention pass failed; the files stay"); });
3814
3817
  };
3815
3818
  const compactedTasks = new Set<number>();
3816
3819
  const roadmapStates = new Map(board.list().map(task => [task.id, task.state]));
@@ -5693,6 +5696,9 @@ export async function startDaemon(opts: DaemonOptions) {
5693
5696
  }
5694
5697
  if (changed.size) void handoffCatchUp(changed); // one request for the whole changed set: none of them waits for another to finish
5695
5698
  };
5699
+ // Routing can skip a sandboxed owner that needs the issue. The board's read-only tools remain available while auth is probed.
5700
+ const specRoutingOps = new Set(["hub_task_propose", "hub_task_accept", "hub_task_decline", "hub_task_cancel", "hub_task_wait",
5701
+ "hub_roadmap_decompose", "hub_backlog_pull", "hub_backlog_split", "task_assign", "task_assign_checked", "task_unassign", "task_escalate", "route_explain"]);
5696
5702
  const conductedMutations = new Set(["hub_task_propose", "hub_task_accept", "hub_task_decline", "hub_task_done", "hub_review", "hub_checkpoint", "hub_remember"]);
5697
5703
  const taskOp = async (...args: Parameters<typeof taskOpBody>): Promise<string> => {
5698
5704
  const [by, op, input] = args;
@@ -6099,6 +6105,11 @@ export async function startDaemon(opts: DaemonOptions) {
6099
6105
  : op === "list" ? tasks.guidanceVariantList(by, input) : tasks.guidanceVariantDiff(by, input) };
6100
6106
  }
6101
6107
  async function taskOpBody(by: PeerId, op: string, a: Record<string, any>, inProcess = false, piiTurn = false): Promise<string> {
6108
+ if (startupSpecPending() && specRoutingOps.has(op)) {
6109
+ await firstSpecProbe;
6110
+ // refusal:by-design world-action: routing is held by the hub until it finishes stopping or recovering.
6111
+ if (stopping || recoveryActive()) throw new PreEffectToolRefusal("task routing is held by recovery or shutdown");
6112
+ }
6102
6113
  if (op === "hub_visual" || op === "hub_visual_show") return visualTool(by, op, a, piiTurn);
6103
6114
  // #1646 T3: a brief file read is the reviewer's read of the commit it approves. A PII or private turn reads none: its words
6104
6115
  // may carry the PII, and the file body would be a second carrier of it.
@@ -6353,7 +6364,7 @@ export async function startDaemon(opts: DaemonOptions) {
6353
6364
  if (a.check !== "test" && a.check !== "typecheck"
6354
6365
  || a.check === "test" && (!Array.isArray(a.files) || a.files.length < 1 || a.files.length > 32 || a.files.some((file: unknown) => typeof file !== "string" || !/^test\/[A-Za-z0-9._/-]+\.test\.ts$/.test(file) || file.split("/").some(part => !part || part === "." || part === "..")))
6355
6366
  || a.check === "typecheck" && a.files !== undefined) throw new PreEffectToolRefusal("invalid check request");
6356
- await refreshRunner();
6367
+ await Promise.all([refreshRunner(), orphanSweep]);
6357
6368
  const current = authorized();
6358
6369
  if (current.updated !== updated || current.history.length !== revision || connectionGeneration(by) !== generation || !may(by, "check_run") || stopping || recoveryActive()) throw new PreEffectToolRefusal("check unavailable");
6359
6370
  if (!runnerState.available) throw new PreEffectToolRefusal(`runner unavailable: ${runnerState.reason ?? "unknown"}`);
@@ -6385,6 +6396,7 @@ export async function startDaemon(opts: DaemonOptions) {
6385
6396
  return JSON.stringify({ run: handle.run });
6386
6397
  }
6387
6398
  if (op === "hub_check_result" || op === "hub_check_cancel") {
6399
+ await orphanSweep;
6388
6400
  need("check_run", "read or cancel isolated checks");
6389
6401
  let receipt = await checkRunner.result(a.run);
6390
6402
  const task = receipt ? board.get(receipt.task) : undefined;
@@ -8024,7 +8036,7 @@ export async function startDaemon(opts: DaemonOptions) {
8024
8036
  reviewFallback: { required: config.review.pool !== undefined, sameFamily: config.review.same_family ?? "fallback" },
8025
8037
  ...(pendingPermissionDefaults.size ? { permissionDefaults: [...pendingPermissionDefaults].map(([peer, source]) => ({ peer, mode: "never-ask", source })) } : {}),
8026
8038
  ...(modelRelay ? { models: modelRelay.status() } : {}),
8027
- isolatedChecks: { pending: checkPending.size, orphans: orphanChecks, unknownReceipts: checkRunner.unknownReceipts ?? [], maintenanceUnavailable: checkRunner.maintenanceUnavailable === true },
8039
+ ...(orphanChecks && { isolatedChecks: { pending: checkPending.size, orphans: orphanChecks, unknownReceipts: checkRunner.unknownReceipts ?? [], maintenanceUnavailable: checkRunner.maintenanceUnavailable === true } }),
8028
8040
  taskCapabilities: peerCapabilities(),
8029
8041
  tasks: board.counts(),
8030
8042
  ...(board.personRunIds().length ? { personRun: board.personRunIds() } : {}), // #1176: cards waiting on the person (ids only)
@@ -8151,7 +8163,8 @@ export async function startDaemon(opts: DaemonOptions) {
8151
8163
  writeStatus();
8152
8164
  } finally { reportingQueues = false; }
8153
8165
  if (ready) {
8154
- tasks.scheduleQueuePressureRecheck(); tasks.refreshReviewerQuotaWaits();
8166
+ if (!startupSpecPending()) tasks.scheduleQueuePressureRecheck();
8167
+ tasks.refreshReviewerQuotaWaits();
8155
8168
  const policy = queuePolicy();
8156
8169
  if ((policy.max_queued > 0 || policy.max_oldest_s > 0) && !queuePressureStatusQueued) {
8157
8170
  queuePressureStatusQueued = true;
@@ -8421,7 +8434,7 @@ export async function startDaemon(opts: DaemonOptions) {
8421
8434
  roomCommands.changed();
8422
8435
  log(`state ${e.peer} -> ${e.state}`);
8423
8436
  event({ type: "state", peer: e.peer, state: e.state });
8424
- if (ready) { tasks.scheduleQueuePressureRecheck(); tasks.refreshReviewerQuotaWaits(); }
8437
+ if (ready) { if (!startupSpecPending()) tasks.scheduleQueuePressureRecheck(); tasks.refreshReviewerQuotaWaits(); }
8425
8438
  if (e.peer.includes("@")) { if (!stopping) writeStatus(); return; }
8426
8439
  // #248: the add-ons it works with, once per attach (names and versions only).
8427
8440
  // A result is written unless a later attachment began meanwhile: a peer that detached before its probe settled
@@ -10505,6 +10518,11 @@ export async function startDaemon(opts: DaemonOptions) {
10505
10518
  try { return { milestones: tasks.milestoneList(USER), person: session?.liveTest !== true }; }
10506
10519
  catch { return { unavailable: true, person: false }; }
10507
10520
  }
10521
+ async function dashboardSnapshot(...args: Parameters<typeof uiMemorySnapshot>) {
10522
+ if (startupSpecPending()) await firstSpecProbe;
10523
+ return uiMemorySnapshot(...args);
10524
+ }
10525
+
10508
10526
  async function uiMemorySnapshot(after: number, input?: Record<string, unknown>, session?: DashboardSession) {
10509
10527
  const query = input?.memory as Record<string, unknown> | undefined;
10510
10528
  const start = input?.view === "memory" && query && query.codeNeighbours === true && typeof query.node === "string" && query.node.startsWith("symbol:") && Buffer.byteLength(query.node) <= 512 ? query.node : undefined;
@@ -12205,6 +12223,17 @@ export async function startDaemon(opts: DaemonOptions) {
12205
12223
  return overflow ? { ok: false, error: "instruction output exceeded its limit; inspect the target before retrying because the effect may have occurred" } : { ok: code === 0, exitCode: code, output: output.toString("utf8") };
12206
12224
  }
12207
12225
 
12226
+ function controlOperationFailed(sock: Sock, parsed: any, e: unknown): void {
12227
+ if (isDatabaseBusy(e) && sock.data.authed && Number.isSafeInteger(parsed?.rid)) {
12228
+ const busy = new RecoveryDatabaseBusy();
12229
+ try { log(`control ${sanitize(String(parsed.t))} database contention: ${databaseBusySite(e).join("\n")}`); } catch { /* the reply still settles its rid */ }
12230
+ sock.send(JSON.stringify({ rid: parsed.rid, ok: false, error: busy.message, code: busy.code, retryable: busy.retryable }));
12231
+ return;
12232
+ }
12233
+ log("control operation failed; inspect delivery storage and recovery status");
12234
+ if (sock.data.authed && Number.isSafeInteger(parsed?.rid)) sock.send(JSON.stringify({ rid: parsed.rid, ok: false, error: "operation failed; inspect delivery storage and recovery status before retrying" }));
12235
+ }
12236
+
12208
12237
  function onControlMessage(sock: Sock, msg: any): void {
12209
12238
  const client = sock.data;
12210
12239
  if (client.instructed && instructedExecution.getStore() !== client.instructed) {
@@ -12341,6 +12370,7 @@ export async function startDaemon(opts: DaemonOptions) {
12341
12370
  c.role = msg.role;
12342
12371
  c.guidanceProbeConnectionId = randomUUID(); // Private comparator only; never sent, persisted separately or accepted from hello.
12343
12372
  c.clientVersion = displayVersion(msg.clientVersion);
12373
+ if (isClaudeSessionUuid(msg.claudeSessionId)) c.claudeSessionId = msg.claudeSessionId;
12344
12374
  if (c.role === "console") { if (!c.instructed) consoles.add(sock); }
12345
12375
  else if (c.role === "tools" && sessionHello(msg)) {
12346
12376
  // agent-hub#1036: a connection that names a peer id but is not that peer's current session gets an id of its own instead of becoming the peer. It can send and read; it holds none of the
@@ -12399,7 +12429,12 @@ export async function startDaemon(opts: DaemonOptions) {
12399
12429
  }
12400
12430
  let peer = bus.peers.get(c.peer);
12401
12431
  if (kimiPull && isAcpPeer(peer) && peer.state === "offline") peer = undefined;
12402
- if (!peer) bus.add((peer = new WsPeer(c.peer)));
12432
+ if (!peer) {
12433
+ const id = c.peer;
12434
+ bus.add((peer = new WsPeer(id, definitionOf(id)?.transport === "claude-channel"
12435
+ ? socket => claudeLaunchProof.attestedSession(id, socket.data.launchId, socket.data.claudeSessionId)
12436
+ : undefined)));
12437
+ }
12403
12438
  if (!isWsPeer(peer)) return sock.close(4409, "peer id is taken by a hub-managed adapter");
12404
12439
  const ws = peer;
12405
12440
  const channelEvidence = ["development-channel-launch", "inherited-marker", "launch-unverified", "unknown"].includes(msg.channelEvidence) ? msg.channelEvidence : msg.channelEvidence === undefined ? "unreported" : "unknown";
@@ -13438,7 +13473,7 @@ export async function startDaemon(opts: DaemonOptions) {
13438
13473
  case "ui":
13439
13474
  if (c.role !== "console") return void reply({ t: "ui", ok: false, error: "ui is a console command" });
13440
13475
  try {
13441
- dashboard ??= startDashboard({ snapshot: uiMemorySnapshot, action: uiAction });
13476
+ dashboard ??= startDashboard({ snapshot: dashboardSnapshot, action: uiAction });
13442
13477
  writeStatus();
13443
13478
  // #269: `ahub ui --settings` is the same person's command; its ticket marks the session it opens.
13444
13479
  if (msg.settings === true) notify("settings session opened from ahub ui --settings: for 15 minutes that dashboard session may change permission modes, routing and start settings");
@@ -13765,16 +13800,24 @@ export async function startDaemon(opts: DaemonOptions) {
13765
13800
  return void reply({ ok: false, error: "unknown room operation" });
13766
13801
  }
13767
13802
  case "status": {
13768
- const current = status(c.role === "console", false, true, c.role === "console" || (c.role === "tools" || c.role === "peer") && c.peer === conductorPeer(config.roles), c.role === "console");
13769
- if ((c.role === "console" || c.role === "tools") && msg.specs === true) {
13770
- const summary = projectSpecs.status();
13771
- if (summary) {
13772
- const missingBlockHint = !specsMissingBlockHintShown && projectSpecs.missingBlock() === true;
13773
- if (missingBlockHint) specsMissingBlockHintShown = true;
13774
- return void reply({ t: "status", status: { ...current, specs: { ...summary, ...(missingBlockHint ? { missingBlockHint: true } : {}) } } });
13803
+ const sendStatus = () => {
13804
+ const current = status(c.role === "console", false, true, c.role === "console" || (c.role === "tools" || c.role === "peer") && c.peer === conductorPeer(config.roles), c.role === "console");
13805
+ if ((c.role === "console" || c.role === "tools") && msg.specs === true) {
13806
+ const summary = projectSpecs.status();
13807
+ if (summary) {
13808
+ const missingBlockHint = !specsMissingBlockHintShown && projectSpecs.missingBlock() === true;
13809
+ if (missingBlockHint) specsMissingBlockHintShown = true;
13810
+ return void reply({ t: "status", status: { ...current, specs: { ...summary, ...(missingBlockHint ? { missingBlockHint: true } : {}) } } });
13811
+ }
13775
13812
  }
13776
- }
13777
- return void reply({ t: "status", status: current });
13813
+ return void reply({ t: "status", status: current });
13814
+ };
13815
+ if (orphanChecks && !startupSpecPending()) return sendStatus();
13816
+ void Promise.all([orphanSweep, firstSpecProbe]).then(() => {
13817
+ if (stopping) return void reply({ ok: false, error: "hub stopping; run ahub status again after it restarts" });
13818
+ sendStatus();
13819
+ }).catch(error => controlOperationFailed(sock, msg, error));
13820
+ return;
13778
13821
  }
13779
13822
  case "peer_takeover": {
13780
13823
  if (c.role !== "console") return void reply({ t: "peer_takeover", ok: false, error: "peer takeover is a person-only command; run it from the console or a terminal" });
@@ -13845,7 +13888,7 @@ export async function startDaemon(opts: DaemonOptions) {
13845
13888
  case "ui_snapshot":
13846
13889
  if (c.role !== "console") return void reply({ ok: false, error: "ui_snapshot is a console command" });
13847
13890
  if (!Number.isSafeInteger(msg.after ?? 0) || (msg.after ?? 0) < 0) return void reply({ ok: false, error: "invalid cursor" });
13848
- void uiMemorySnapshot(msg.after ?? 0, msg.memory !== undefined || msg.reviewRefresh === true || dashboardView(msg.view) || msg.visual !== undefined || msg.visualTask !== undefined || msg.visualAsset !== undefined ? { ...(msg.visual !== undefined ? { visual: msg.visual } : {}), ...(msg.visualTask !== undefined ? { visualTask: msg.visualTask } : {}), ...(msg.visualAsset !== undefined ? { visualAsset: msg.visualAsset } : {}), ...(msg.memory !== undefined ? { memory: msg.memory } : {}), ...(msg.reviewRefresh === true && msg.reviewTask !== undefined ? { reviewTask: msg.reviewTask, reviewRefresh: true } : {}), ...(dashboardView(msg.view) ? { view: msg.view } : {}) } : undefined).then(value => reply(value), () => reply({ ok: false, error: "memory view unavailable" }));
13891
+ void dashboardSnapshot(msg.after ?? 0, msg.memory !== undefined || msg.reviewRefresh === true || dashboardView(msg.view) || msg.visual !== undefined || msg.visualTask !== undefined || msg.visualAsset !== undefined ? { ...(msg.visual !== undefined ? { visual: msg.visual } : {}), ...(msg.visualTask !== undefined ? { visualTask: msg.visualTask } : {}), ...(msg.visualAsset !== undefined ? { visualAsset: msg.visualAsset } : {}), ...(msg.memory !== undefined ? { memory: msg.memory } : {}), ...(msg.reviewRefresh === true && msg.reviewTask !== undefined ? { reviewTask: msg.reviewTask, reviewRefresh: true } : {}), ...(dashboardView(msg.view) ? { view: msg.view } : {}) } : undefined).then(value => reply(value), () => reply({ ok: false, error: "memory view unavailable" }));
13849
13892
  return;
13850
13893
  case "ui_action":
13851
13894
  if (c.role !== "console") return void reply({ ok: false, error: "ui_action is a console command" });
@@ -13907,6 +13950,12 @@ export async function startDaemon(opts: DaemonOptions) {
13907
13950
  if (!executionText(requestConnectionId, EXECUTION_REFERENCE_LIMITS.id))
13908
13951
  return void reply({ ok: false, error: "guidance probe request identity is unavailable; reconnect through the authenticated project connection" });
13909
13952
  let generation: string | number, nativeSession: string | null, owner: PeerAdapter | undefined;
13953
+ const claudeChannel = role === "tools" && definitionOf(actor)?.transport === "claude-channel";
13954
+ const attestedClaude = () => {
13955
+ const peer = claudeLaunchProof.owner(actor);
13956
+ return peer === owner && peer
13957
+ ? claudeLaunchProof.attestedSession(actor, peer.managedLaunchId, c.claudeSessionId) : undefined;
13958
+ };
13910
13959
  if (role === "console") {
13911
13960
  generation = requestConnectionId;
13912
13961
  nativeSession = null;
@@ -13916,13 +13965,18 @@ export async function startDaemon(opts: DaemonOptions) {
13916
13965
  if (!owner || !("sessionGeneration" in owner) || !probeSessionGeneration(peerGeneration)
13917
13966
  || !("nativeSession" in owner) || typeof peerNativeSession !== "string"
13918
13967
  || !executionText(peerNativeSession, EXECUTION_REFERENCE_LIMITS.id))
13919
- return void reply({ ok: false, error: "guidance probe conductor session identity is unavailable; reconnect the current native peer session" });
13968
+ return void reply({ ok: false, error: claudeChannel
13969
+ ? "guidance probe conductor session identity is unavailable; start a new session with ahub claude"
13970
+ : "guidance probe conductor session identity is unavailable; reconnect the current native peer session" });
13971
+ if (claudeChannel && attestedClaude() !== peerNativeSession)
13972
+ return void reply({ ok: false, error: "guidance probe conductor session is not attested; start a new session with ahub claude" });
13920
13973
  generation = peerGeneration;
13921
13974
  nativeSession = peerNativeSession;
13922
13975
  }
13923
13976
  const current = (): void => {
13924
13977
  if (sock.data !== c || c.closed || sock.readyState !== WebSocket.OPEN || c.role !== role || c.guidanceProbeConnectionId !== requestConnectionId
13925
- || role === "tools" && (c.peer !== actor || bus.peers.get(actor) !== owner || owner!.sessionGeneration !== generation || owner!.nativeSession !== nativeSession))
13978
+ || role === "tools" && (c.peer !== actor || bus.peers.get(actor) !== owner || owner!.sessionGeneration !== generation || owner!.nativeSession !== nativeSession
13979
+ || claudeChannel && attestedClaude() !== nativeSession))
13926
13980
  throw new PreEffectToolRefusal("guidance probe request connection or native peer session changed; inspect retained state and reconnect");
13927
13981
  authorityCurrent();
13928
13982
  };
@@ -14310,7 +14364,7 @@ export async function startDaemon(opts: DaemonOptions) {
14310
14364
  // Counted like a task op: a recovery commit waits for it (`recoveryReady` reads `taskOpsInFlight`), and the fence is asked again right before the board write, after the PII screen.
14311
14365
  taskOpsInFlight++;
14312
14366
  const recoveryFence = (): string | undefined => recoveryActive() || stopping ? "recovery or shutdown is holding mutations; hand the task off again after it ends" : undefined;
14313
- void tasks.handoffIn(msg.origin ?? {}, msg.request, recoveryFence).then(
14367
+ void Promise.resolve(startupSpecPending() ? firstSpecProbe : undefined).then(() => tasks.handoffIn(msg.origin ?? {}, msg.request, recoveryFence)).then(
14314
14368
  result => reply({ t: "task_handoff", ok: true, ...result }),
14315
14369
  error => reply({ t: "task_handoff", ok: false, error: error instanceof HandoffRefusal ? error.message : "the handoff was refused" })).finally(() => { taskOpsInFlight--; });
14316
14370
  return;
@@ -14398,7 +14452,7 @@ export async function startDaemon(opts: DaemonOptions) {
14398
14452
  // A peer can still be inside memory recall or its native handshake when kill arrives.
14399
14453
  // Drain those starts before taking the final owned-process snapshot.
14400
14454
  // Fence/abort the runner now, but slow container teardown must not consume the peer-stop deadline.
14401
- const runnerStopped = Promise.allSettled([checkRunner.stopAll(), refreshingRunner ?? Promise.resolve()]);
14455
+ const runnerStopped = Promise.allSettled([checkRunner.stopAll(), refreshingRunner, orphanSweep, specProbe]);
14402
14456
  await Promise.allSettled([...starting.values()]);
14403
14457
  // A fingerprint still being detected belongs in the research records written below; its peer must still be
14404
14458
  // attached when it settles, so this comes before the peers stop (each detection is bounded by its probe deadline).
@@ -14473,6 +14527,13 @@ export async function startDaemon(opts: DaemonOptions) {
14473
14527
  reconstructRuns();
14474
14528
  ready = true;
14475
14529
  startupTimings.mark("ready");
14530
+ // Keep the connection manifest available immediately, then publish each settled projection even on an idle hub.
14531
+ if (!orphanChecks) void orphanSweep.then(() => { if (!stopping) writeStatus(); });
14532
+ if (startupSpecPending()) void firstSpecProbe?.then(() => {
14533
+ if (stopping) return;
14534
+ writeStatus();
14535
+ tasks.scheduleQueuePressureRecheck();
14536
+ });
14476
14537
  controlWriteTelemetry?.start();
14477
14538
  void handoffCatchUp();
14478
14539
  // #733: the periodic catch-up and the descriptor watch. Unref'd, cleared with the other intervals at stop; each pass is guarded by `stopping` and never overlaps another.
@@ -14480,7 +14541,8 @@ export async function startDaemon(opts: DaemonOptions) {
14480
14541
  const periodic = setInterval(() => void handoffCatchUp(), every), descriptorWatch = setInterval(handoffWatch, watch);
14481
14542
  periodic.unref?.(); descriptorWatch.unref?.(); intervals.push(periodic, descriptorWatch); }
14482
14543
  startupTimings.mark("post_ready_handoff");
14483
- tasks.scheduleQueuePressureRecheck(); tasks.refreshReviewerQuotaWaits();
14544
+ if (!startupSpecPending()) tasks.scheduleQueuePressureRecheck();
14545
+ tasks.refreshReviewerQuotaWaits();
14484
14546
  startupTimings.mark("post_ready_queue");
14485
14547
  for (const name of opts.configWatch === false ? [] : CONFIG_SOURCE_FILES) {
14486
14548
  const path = join(opts.cwd, ".agenthub", name);
@@ -320,8 +320,19 @@ export class MemoryProfileBinding {
320
320
  }
321
321
  }
322
322
 
323
+ /** #1747: the fence stamp of the last status read whose full check passed. */
324
+ private verifiedStamp: string | undefined;
325
+
323
326
  status(store?: MemoryStore, opts: { skippedRows?: boolean } = {}): MemoryProfileReceipt {
324
- try { this.assertCurrent(); } catch { /* Report the latched state without exposing metadata errors. */ }
327
+ // #1747: status is read on every status answer, and the full fence re-resolves the profile through agent-mem (every shard placement through
328
+ // canonicalJSON). Run it only when the cheap stamp moved since the last passing check. The stamp is taken first, so a change during the check
329
+ // is seen by the next read; run() stays a full check on every call.
330
+ // ponytail: a change the stamp does not cover (an append to an existing placement journal, see fenceObjects) shows in status only after the
331
+ // next run() latches the binding; stamp that journal too if status alone must report it.
332
+ const stamp = this.fenceStamp();
333
+ if (stamp === "unavailable" || stamp !== this.verifiedStamp) {
334
+ try { this.assertCurrent(); this.verifiedStamp = stamp; } catch { /* Report the latched state without exposing metadata errors. */ }
335
+ }
325
336
  let skippedRows = 0;
326
337
  if (opts.skippedRows !== false && !this.unavailable && store) {
327
338
  try { skippedRows = store.bridgeStatus()?.skippedRows ?? 0; } catch { this.invalidate(); }
@@ -1,17 +1,20 @@
1
1
  import type { MilestoneView } from "./roadmap-view.ts";
2
2
 
3
3
  /** A projection of the already screened roadmap view; never accepts raw task records. */
4
- export function roadmapExport(views: readonly MilestoneView[]): { json: string; markdown: string } {
4
+ export function roadmapExport(views: readonly MilestoneView[], issueStates: ReadonlyMap<string, "open" | "closed"> = new Map()): { json: string; markdown: string } {
5
5
  const horizonOrder = { now: 0, next: 1, later: 2 } as const;
6
6
  const compare = (a: string, b: string): number => a < b ? -1 : a > b ? 1 : 0;
7
- const milestones = [...views].sort((a, b) => horizonOrder[a.horizon] - horizonOrder[b.horizon] || a.order - b.order || a.id - b.id).map(view => ({
8
- id: view.id, title: view.title, outcome: view.outcome, state: view.state, horizon: view.horizon,
9
- order: view.order, target: view.target, parent: view.parent,
10
- issues: [...view.issues].map(issue => ({ ref: issue.ref, state: issue.state })).sort((a, b) => compare(a.ref, b.ref)),
11
- specs: [...view.specs].map(spec => ({ id: spec.id, state: spec.state })).sort((a, b) => compare(a.id, b.id)),
12
- progress: { tasks: { ...view.rollup.tasks }, issues: { ...view.rollup.issues }, specs: { ...view.rollup.specs }, releases: { ...view.rollup.releases } },
13
- withheld: view.withheld,
14
- }));
7
+ const milestones = [...views].sort((a, b) => horizonOrder[a.horizon] - horizonOrder[b.horizon] || a.order - b.order || a.id - b.id).map(view => {
8
+ const issues = view.issues.map(({ ref }) => ({ ref, state: issueStates.get(ref) ?? "unknown" })).sort((a, b) => compare(a.ref, b.ref));
9
+ return {
10
+ id: view.id, title: view.title, outcome: view.outcome, state: view.state, horizon: view.horizon,
11
+ order: view.order, target: view.target, parent: view.parent,
12
+ issues,
13
+ specs: [...view.specs].map(spec => ({ id: spec.id, state: spec.state })).sort((a, b) => compare(a.id, b.id)),
14
+ progress: { tasks: { ...view.rollup.tasks }, issues: { closed: issues.filter(issue => issue.state === "closed").length, total: issues.length, unknown: issues.filter(issue => issue.state === "unknown").length }, specs: { ...view.rollup.specs }, releases: { ...view.rollup.releases } },
15
+ withheld: view.withheld,
16
+ };
17
+ });
15
18
  const json = `${JSON.stringify({ version: 1, milestones }, null, 2)}\n`;
16
19
  const inline = (value: string): string => value.replace(/[\\`*_\[\]<>]/g, "\\$&").replace(/[\r\n]+/g, " ");
17
20
  const lines = ["# Roadmap", "", "Generated from the public roadmap view."];
@@ -0,0 +1,35 @@
1
+ import { readPlanIssueMetadata, type SdlcGh } from "./sdlc.ts";
2
+
3
+ type IssueState = "open" | "closed";
4
+
5
+ /** Live evidence for one roadmap snapshot. Missing keys are unknown. */
6
+ export async function roadmapIssueStates(refs: ReadonlySet<string>, gh: SdlcGh, current: () => void): Promise<Map<string, IssueState>> {
7
+ const pending = [...refs].sort().slice(0, 100), states = new Map<string, IssueState>();
8
+ const deadline = performance.now() + 20_000;
9
+ let next = 0, stopped = false;
10
+ const worker = async () => {
11
+ try {
12
+ while (!stopped && next < pending.length && performance.now() < deadline) {
13
+ const ref = pending[next++]!;
14
+ const match = /^([^#]+)#([1-9][0-9]*)$/.exec(ref);
15
+ if (!match) continue;
16
+ current();
17
+ const value = await readPlanIssueMetadata(match[1]!, Number(match[2]), (args, timeout, cwd, cap) => {
18
+ const remaining = deadline - performance.now();
19
+ return remaining > 0
20
+ ? gh([...args.slice(0, 2), "--hostname", "github.com", ...args.slice(2)], Math.min(timeout ?? remaining, remaining), cwd, cap)
21
+ : Promise.resolve({ code: 1, stdout: "" });
22
+ });
23
+ current();
24
+ if (value && performance.now() < deadline) states.set(ref, value.state === "CLOSED" ? "closed" : "open");
25
+ }
26
+ } catch (error) {
27
+ stopped = true;
28
+ throw error;
29
+ }
30
+ };
31
+ // Drain already started reads before surfacing a revoked snapshot.
32
+ const results = await Promise.allSettled(Array.from({ length: Math.min(4, pending.length) }, worker));
33
+ for (const result of results) if (result.status === "rejected") throw result.reason;
34
+ return states;
35
+ }
@@ -10,6 +10,7 @@ import { hubHome, realPath } from "./project.ts";
10
10
  import { readProjectRuntimeReference, projectRuntimeFile } from "./project-runtime-state.ts";
11
11
  import { Registry, REGISTRY_DB_BUSY_TIMEOUT_MS } from "./registry.ts";
12
12
  import { anyRecoveryHold, retireOperation } from "./recovery-store.ts";
13
+ import { MEMORY_RUNTIME_LAYOUTS } from "./runtime-package-assets.ts";
13
14
 
14
15
  export interface RuntimeCapturePrunePlan { remove: string[]; kept: string[]; deferred?: string }
15
16
  export interface RuntimeCapturePruneResult { removed: string[]; kept: string[]; quarantined?: string[]; deferred?: string }
@@ -77,16 +78,17 @@ function entries(directory: string, observation?: Observation, budget?: LockBudg
77
78
  }
78
79
  return rows;
79
80
  }
80
- function metadata(file: string, observation: Observation): unknown {
81
+ function metadata(file: string, observation?: Observation): unknown {
81
82
  const fd = openSync(file, constants.O_RDONLY | constants.O_NOFOLLOW);
82
83
  try {
83
84
  const info = fstatSync(fd);
84
- if (!info.isFile() || info.nlink !== 1 || info.size > MAX_METADATA_BYTES || observation.bytes + info.size > MAX_INVENTORY_BYTES)
85
+ if (!info.isFile() || info.nlink !== 1 || info.size > MAX_METADATA_BYTES || (observation?.bytes ?? 0) + info.size > MAX_INVENTORY_BYTES)
85
86
  fail("runtime retention metadata is unreadable or oversized");
86
87
  const bytes = Buffer.alloc(MAX_METADATA_BYTES + 1), count = readSync(fd, bytes, 0, bytes.length, 0), after = fstatSync(fd);
87
88
  if (count > MAX_METADATA_BYTES || count !== info.size || stamp(after) !== stamp(info)
88
89
  || stamp(optionalInfo(file)) !== stamp(after)) fail("runtime retention metadata changed or exceeded its bound");
89
- observation.bytes += count; remember(observation, file, stamp(after));
90
+ if (observation) observation.bytes += count;
91
+ remember(observation, file, stamp(after));
90
92
  try { return JSON.parse(bytes.subarray(0, count).toString("utf8")); } catch { return fail("runtime retention metadata is invalid"); }
91
93
  } finally { closeSync(fd); }
92
94
  }
@@ -276,9 +278,22 @@ function captureLayout(root: string): void {
276
278
  if (optionalInfo(join(root, "scripts"))) knownLayout(join(root, "scripts"), [], ["check-docs.mjs"]);
277
279
  const modules = join(root, "node_modules");
278
280
  if (optionalInfo(modules)) {
279
- knownLayout(modules, ["@staix"], []); const scope = join(modules, "@staix"); knownLayout(scope, ["agent-mem"], [], ["cli-output"]);
280
- knownLayout(join(scope, "agent-mem"), ["src", "bin"], ["package.json", "README.md", "LICENSE"]);
281
- if (optionalInfo(join(scope, "cli-output"))) knownLayout(join(scope, "cli-output"), ["src"], ["package.json", "README.md", "LICENSE"]);
281
+ knownLayout(modules, ["@staix"], []);
282
+ const scope = join(modules, "@staix"), layouts = Object.entries(MEMORY_RUNTIME_LAYOUTS);
283
+ knownLayout(scope, ["agent-mem"], [], layouts.map(([name]) => basename(name)));
284
+ const memory = join(scope, "agent-mem");
285
+ knownLayout(memory, ["src", "bin"], ["package.json", "README.md", "LICENSE"]);
286
+ const present = layouts.filter(([name]) => optionalInfo(join(scope, basename(name))));
287
+ // New siblings must be part of the capture's hashed dependency graph. An unrelated directory
288
+ // using a reviewed package name must not become eligible for deletion.
289
+ if (present.some(([name]) => name !== "@staix/cli-output")) {
290
+ type Manifest = { dependencies?: Record<string, unknown> } | null;
291
+ const hub = metadata(join(root, "package.json")) as Manifest;
292
+ const manifest = metadata(join(memory, "package.json")) as Manifest;
293
+ if (typeof hub?.dependencies?.["@staix/agent-mem"] !== "string" || present.some(([name]) => name !== "@staix/cli-output" && !Object.hasOwn(manifest?.dependencies ?? {}, name)))
294
+ fail("a runtime capture contains an undeclared agent-mem dependency");
295
+ }
296
+ for (const [name, { directories, files }] of present) knownLayout(join(scope, basename(name)), directories, files);
282
297
  }
283
298
  }
284
299
  function verifyQuarantine(root: string, capture: Capture): void {
@@ -0,0 +1,6 @@
1
+ /** Reviewed agent-mem dependency assets. Directory order followed by file order is the recovery digest order. */
2
+ export const MEMORY_RUNTIME_LAYOUTS = {
3
+ "@staix/cli-output": { directories: ["src"], files: ["package.json", "README.md", "LICENSE"] },
4
+ "@staix/mcp-stdio": { directories: ["src", "fixtures"], files: ["package.json", "README.md", "LICENSE"] },
5
+ "@staix/agent-hosts": { directories: ["src", "fixtures"], files: ["package.json", "README.md", "LICENSE"] },
6
+ } as const;
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * The rule layer (`supervision-rules.ts`) answers whether one of a closed set of conditions holds. This module is the
5
5
  * only place that turns such a reading into something a present role can decide on, and it decides nothing itself: it
6
- * stores proposals (three additive tables in hub.db, no format bump — an older hub ignores them, the way
7
- * `completions-store.ts` does), and it has no timer, no worker and no action of its own. Observation attaches to board
8
- * events the daemon already handles, and one reconcile pass runs at startup.
6
+ * stores proposals in the additive `supervision_proposals` table in hub.db and creates one index, with no format bump.
7
+ * It has no timer, worker or action of its own. Observation attaches to board events the daemon already handles,
8
+ * and one reconcile pass runs at startup.
9
9
  *
10
10
  * What an acceptance runs is an existing action, through that action's own authority: the port `run` is supplied by the
11
11
  * caller and its outcome is recorded as a receipt beside the decision, never inside the task's own result. Intent
@@ -8,8 +8,8 @@ import type { DeliverableRecord } from "./deliverables.ts";
8
8
  * declared-overlap reading. No note, review finding, transcript, file body or private task is read, there is no clock,
9
9
  * no dependency object and no emit path, so an observation cannot turn a worker, write an action or notify anyone.
10
10
  * `src/hub/supervision.ts` is the neighbour: it turns board milestones into conductor notices and owns their batching.
11
- * This module decides only whether one of a closed set of conditions holds, and T2 (unauthorized here) is what would
12
- * carry a decision to a person. Nothing imports it yet, and that is the point of a shadow rule.
11
+ * This module evaluates a closed set of conditions. The daemon and the T2 proposal layer consume its readings
12
+ * and own decisions and effects.
13
13
  */
14
14
 
15
15
  export const SUPERVISION_RULES = ["repeated_failure", "deliverable_invalidated_check", "declared_overlap_without_integration"] as const;
@@ -85,7 +85,7 @@ export const TASK_WAIT_MAX_MS = 14 * 24 * 3_600_000;
85
85
  /** #1454: the reason a wait carries is public text; longer text is refused, never cut. */
86
86
  export const TASK_WAIT_REASON_MAX = 200;
87
87
  /** History events that leave a recorded wait in force: bookkeeping that neither moves the task nor is owner activity on it. Anything else (done, decline, return, reassignment, cancel) ends it. */
88
- const WAIT_KEEPING_EVENTS = new Set(["wait recorded", "idle sweep", "answer", "reviewer changed", "memory reference started", "ready held", "plan observed", "planner changed", "claim verdict", "invocation", "shell branch bound"]);
88
+ const WAIT_KEEPING_EVENTS = new Set(["wait recorded", "idle sweep", "answer", "reviewer changed", "memory reference started", "ready held", "plan observed", "planner changed", "claim verdict", "invocation", "shell branch bound", "check run passed", "check run failed"]);
89
89
  export interface TaskWait { until: number; at: number; by: string; owner: string }
90
90
  /** The wait that is still in force on an in_progress task: the latest `wait recorded` entry, for the current owner, with no state-changing entry after it. A passed `until` still counts (the planner groom view lists it); `nextSweep` is what lets the ladder restart. */
91
91
  export function taskWait(task: Pick<Task, "state" | "owner" | "history">): TaskWait | undefined {