@staix/agent-hub 0.36.0 → 0.37.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 (102) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +6 -2
  3. package/THIRD_PARTY_NOTICES.md +0 -18
  4. package/docs/agent-notes/README.md +13 -3
  5. package/docs/agent-notes/daemon.md +4 -4
  6. package/docs/agent-notes/local-worker.md +1 -0
  7. package/docs/agent-notes/models.md +2 -1
  8. package/docs/agent-notes/tasks.md +1 -1
  9. package/docs/agent-notes/tests.md +1 -2
  10. package/docs/contracts/companion-cli-v1.json +70 -0
  11. package/docs/design/adapters.md +43 -2
  12. package/docs/design/agent-hub-architecture.md +9 -1
  13. package/docs/design/guidance-probes.md +802 -0
  14. package/docs/design/model-routes.md +437 -12
  15. package/docs/dogfood.md +11 -13
  16. package/docs/events.md +20 -1
  17. package/docs/memory.md +3 -3
  18. package/docs/operations.md +112 -148
  19. package/docs/quickstart.md +9 -3
  20. package/docs/research.md +1 -1
  21. package/docs/sdlc.md +5 -3
  22. package/docs/security.md +21 -1
  23. package/docs/specs/2026-09-19-agent-hub-design.md +9 -7
  24. package/docs/specs/2026-10-04-switchyard-source-port-design.md +3 -1
  25. package/docs/verification/2026-11-08-qwen-0269-model-setter-1317.md +25 -11
  26. package/docs/verification/2026-11-09-qwen-0270-model-setter-1317.md +21 -6
  27. package/docs/verification/2026-11-11-0.37.0.md +40 -0
  28. package/docs/verification/2026-11-11-guidance-probe-t2-1226.md +153 -0
  29. package/docs/verification/2026-11-11-qwen-setter-suggestions-off.md +167 -0
  30. package/docs/verified.json +24 -24
  31. package/package.json +3 -4
  32. package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
  33. package/plugins/agent-hub/kimi-hook.js +2373 -1436
  34. package/plugins/agent-hub/server.js +2445 -1497
  35. package/src/adapters/channel-peer.ts +7 -1
  36. package/src/adapters/compat.ts +1 -1
  37. package/src/adapters/local-probe.ts +174 -0
  38. package/src/adapters/local-worker.ts +232 -21
  39. package/src/cli/console-state.ts +25 -6
  40. package/src/cli/console-versions.ts +99 -0
  41. package/src/cli/console.ts +13 -1
  42. package/src/cli/help.ts +2 -1
  43. package/src/cli/install-paths.ts +7 -2
  44. package/src/cli/main.ts +60 -4
  45. package/src/cli/runtime-version-warning.ts +2 -2
  46. package/src/cli/sdlc-output.ts +9 -5
  47. package/src/hub/config-apply.ts +4 -2
  48. package/src/hub/config-trust.ts +6 -1
  49. package/src/hub/control-client.ts +5 -2
  50. package/src/hub/daemon.ts +169 -9
  51. package/src/hub/events.ts +3 -2
  52. package/src/hub/guidance-probe-store.ts +713 -0
  53. package/src/hub/guidance-probes.ts +358 -0
  54. package/src/hub/inference.ts +18 -5
  55. package/src/hub/operational-authority.ts +13 -1
  56. package/src/hub/peers.ts +5 -0
  57. package/src/hub/ports.ts +1 -1
  58. package/src/hub/progress.ts +23 -16
  59. package/src/hub/report.ts +2 -0
  60. package/src/hub/research.ts +1 -0
  61. package/src/hub/restart.ts +7 -0
  62. package/src/hub/sdlc-release-authorization.ts +139 -17
  63. package/src/hub/sdlc-release-policy.ts +100 -0
  64. package/src/hub/sdlc-release.ts +59 -7
  65. package/src/hub/tasks.ts +317 -6
  66. package/src/local/probe-errors.ts +28 -0
  67. package/src/local/probe-sandbox.ts +224 -0
  68. package/src/local/probe-types.ts +108 -0
  69. package/src/local/probe-workspace.ts +237 -0
  70. package/src/local/sandbox.ts +71 -2
  71. package/src/local/tools.ts +135 -9
  72. package/src/models/route/advisor-trigger.ts +88 -0
  73. package/src/models/route/config.ts +21 -17
  74. package/src/models/route/conversation-view.ts +179 -0
  75. package/src/models/route/decision-evidence.ts +1 -1
  76. package/src/models/route/decision.ts +114 -19
  77. package/src/models/route/escalation-control.ts +30 -0
  78. package/src/models/route/hub-prompts.ts +97 -0
  79. package/src/models/route/judge-choice.ts +155 -0
  80. package/src/models/route/judge-replies.ts +102 -0
  81. package/src/models/route/labels.ts +14 -70
  82. package/src/models/route/observation-signals.ts +250 -0
  83. package/src/models/route/plan-execute-choice.ts +27 -0
  84. package/src/models/route/relay-selector.ts +2 -2
  85. package/src/models/route/runtime.ts +115 -52
  86. package/src/models/route/turn-state.ts +77 -0
  87. package/src/omniroute/client.ts +3 -0
  88. package/src/ui/plugin.ts +70 -20
  89. package/src/version.ts +4 -0
  90. package/templates/adec/README.md +32 -0
  91. package/templates/adec/ahub.plan-execute.json +23 -0
  92. package/templates/adec/ahub.stage.json +23 -0
  93. package/LICENSES/Apache-2.0.txt +0 -204
  94. package/src/models/route/advisor.ts +0 -102
  95. package/src/models/route/escalation.ts +0 -82
  96. package/src/models/route/judge.ts +0 -23
  97. package/src/models/route/normalize.ts +0 -103
  98. package/src/models/route/plan-execute.ts +0 -52
  99. package/src/models/route/prompts.ts +0 -8
  100. package/src/models/route/signals.ts +0 -247
  101. package/src/models/route/state.ts +0 -54
  102. package/src/models/route/text.ts +0 -61
package/src/hub/daemon.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import { parseGuidanceCreateInput, parseGuidanceIdQuery } from "./guidance-variants.ts";
2
+ import { GuidanceProbeStore } from "./guidance-probe-store.ts";
3
+ import { GuidanceProbeError, probeSessionGeneration } from "./guidance-probes.ts";
4
+ import { executionText, EXECUTION_REFERENCE_LIMITS } from "./execution-reference.ts";
2
5
  import { publicDeliveryBodies } from "./delivery-public.ts";
3
6
  import { GeneratedNoteRegistry, type GeneratedNoteProof } from "../memory/record-provenance.ts";
4
7
  import { RecordCapture, type RecordCapturePolicy } from "../memory/records.ts";
@@ -39,8 +42,9 @@ import { ActionBudgets, actionPolicyConfig, floorEnforcement, floorReads, type A
39
42
  import { actionGate, claudeActionClasses } from "./action-enforce.ts";
40
43
  import type { FloorFacts } from "./action-class.ts";
41
44
  import { ReleaseAuthorizations, releaseAuthorizationError } from "./sdlc-release-authorization.ts";
45
+ import { readCommittedReleasePolicy } from "./sdlc-release-policy.ts";
42
46
  import { parseReleaseGuardArgv, parseReleasePushUpdates } from "../cli/sdlc-release-guard.ts";
43
- import type { DocEvidence } from "./sdlc-release.ts";
47
+ import type { DocEvidence, ReleaseReportPolicy } from "./sdlc-release.ts";
44
48
  import { loadExternalAdapterDefinitions, readAdapterModuleDeclarations, externalModuleIdentity, externalModuleIdentityCurrent, type AdapterModuleDeclaration } from "../adapters/external-modules.ts";
45
49
  import { WsPeer, isWsPeer } from "../adapters/channel-peer.ts";
46
50
  import { ownerToolEffect, canonicalWriteUnknown } from "./no-writes.ts";
@@ -91,7 +95,7 @@ import { INSTANCE_CONFIG_FILES, readInstanceConfig, withoutInertInstancePolicy,
91
95
  import { instanceBudgetHooks, projectBudgetHeadroom } from "./instance-budget.ts";
92
96
  import { resolveInstanceExecutionCwd } from "./instance-execution.ts";
93
97
  import { ProgressObserver, normalizeCodexObservation, normalizeClaudeObservation } from "./progress.ts";
94
- import type { ToolObservation } from "../models/route/signals.ts";
98
+ import type { NativeToolObservation as ToolObservation } from "./progress.ts";
95
99
  import { createHash, randomBytes, randomUUID } from "node:crypto";
96
100
  import { appendFileSync, chmodSync, existsSync, fstatSync, mkdirSync, readFileSync, renameSync, rmSync, watchFile, unwatchFile, writeFileSync } from "node:fs";
97
101
  import { join, relative, resolve } from "node:path";
@@ -219,7 +223,7 @@ import { MAX_HOP, isInvocationKind, newEnvelope, parseMarker, replyParent, sanit
219
223
  import { BasePeer, DEFAULT_WATCHDOG_MS, type FrontendProxyPort, type PeerAdapter, type PeerTakeoverClaim } from "./peers.ts";
220
224
  import { ClaudeTodoSource, DoingTracker, readAiTitle, DOING_STUB, SESSION_TITLE_HINT, sessionTitleText, sessionTitleBindings, unnamedSessionLabel, type DoingKind, type PeerDoing, type TitleCursor } from "./peer-doing.ts";
221
225
  import { MemoryClient } from "../memory/client.ts";
222
- import { VERSION } from "../version.ts";
226
+ import { VERSION, displayVersion } from "../version.ts";
223
227
  import { appendRecords, taskRecords } from "./research.ts";
224
228
  import { readEvidence } from "./research-record.ts";
225
229
  import { memoryFigures, onlyTaskMemory, UNKNOWN_MEMORY_FIGURES, type MemoryFigures } from "./research-memory.ts";
@@ -365,6 +369,8 @@ export interface HubConfig {
365
369
  pet?: false | Record<string, unknown>;
366
370
  /** Machine-local fields a config file set but git could not vouch for, and why (issue #17). */
367
371
  ignored?: string[];
372
+ /** Reporting-only notice that machine-local release policy was ignored; never part of accepted policy authority. */
373
+ releasePolicyNotices?: string[];
368
374
  /** Settings that were removed or are about to be (issue #83): what each does now, for `hub.log` and `ahub doctor`. */
369
375
  retired?: string[];
370
376
  }
@@ -539,6 +545,7 @@ export function loadConfig(cwd: string, layers?: readonly ConfigLayer[], routing
539
545
  const instances = instanceConfig.instances;
540
546
  const adapterCatalog = instanceConfig.catalog;
541
547
  const ignored: string[] = [...instanceConfig.ignored];
548
+ const releasePolicyNotices: string[] = [];
542
549
  const inertModuleRoster = !!instanceConfig.adapter_modules?.length;
543
550
  const appliedPermissionSources: NonNullable<HubConfig["permission_default_sources"]> = {};
544
551
  let retiredPetWindow = false;
@@ -594,7 +601,14 @@ export function loadConfig(cwd: string, layers?: readonly ConfigLayer[], routing
594
601
  if (file.research !== undefined && (!file.research || typeof file.research !== "object" || Array.isArray(file.research))) throw new Error("research must be an object");
595
602
  const hasRunners = file.research && Object.hasOwn(file.research, "runners"), runnerDeclarations: unknown = hasRunners ? file.research.runners : undefined;
596
603
  const why = stripUntrusted(file, DEFAULT_CONFIG, cwd, name);
597
- if (why) ignored.push(why);
604
+ if (why) {
605
+ const notices = why.split("; ");
606
+ releasePolicyNotices.push(...notices.filter(notice => notice.startsWith("release in .agenthub/config.local.json ignored:")));
607
+ const existingNotices = notices.filter(notice => !notice.startsWith("release in .agenthub/config.local.json ignored:"));
608
+ if (existingNotices.length) ignored.push(existingNotices.join("; "));
609
+ }
610
+ // Release policy is read directly from the candidate commit by the S6 host reader, never runtime config.
611
+ delete file.release;
598
612
  if (hasRunners) file.research.runners = parseResearchRunners(runnerDeclarations);
599
613
  for (const [peer, mode] of Object.entries(permissionDefaults(file.permission_modes, instances, adapterCatalog))) appliedPermissionSources[peer] = { mode, source: `.agenthub/${name}` };
600
614
  return [file];
@@ -698,6 +712,7 @@ export function loadConfig(cwd: string, layers?: readonly ConfigLayer[], routing
698
712
  capabilities: { ...file.capabilities },
699
713
  mlx,
700
714
  ...(ignored.length ? { ignored } : {}),
715
+ ...(releasePolicyNotices.length ? { releasePolicyNotices } : {}),
701
716
  ...(retired.length ? { retired } : {}),
702
717
  };
703
718
  }
@@ -852,12 +867,16 @@ interface Client {
852
867
  launchId?: string;
853
868
  /** Display-only retained standby id; peer operations stay fenced until ownsSocket confirms attachment. */
854
869
  standbyId?: string;
870
+ /** Host-minted per connection and durable only as a private replay comparator; never a token, live authority or wire claim. */
871
+ guidanceProbeConnectionId?: string;
855
872
  retainStandby?: boolean;
856
873
  peerGeneration?: string | number;
857
874
  detachedByPerson?: boolean;
858
875
  channel?: boolean;
859
876
  channelEvidence?: "development-channel-launch" | "inherited-marker" | "launch-unverified" | "unknown" | "unreported";
860
877
  clientPid?: number;
878
+ /** #1385: the agent-hub version the client's hello reported, kept only when `displayVersion` accepts it. Display only. */
879
+ clientVersion?: string;
861
880
  cwd?: string;
862
881
  externalOwner?: { owner: PeerAdapter; launchId: string; generation?: string };
863
882
  toolsOwner?: { owner: PeerAdapter; launchId: string; generation: string; cwd: string };
@@ -869,6 +888,13 @@ interface Client {
869
888
  closed?: true;
870
889
  }
871
890
  type Sock = ServerWebSocket<Client>;
891
+ interface GuidanceProbeRequestContext {
892
+ actor: PeerId;
893
+ requestConnectionId: string;
894
+ generation: string | number;
895
+ nativeSession: string | null;
896
+ current: () => void;
897
+ }
872
898
 
873
899
 
874
900
  /**
@@ -1160,6 +1186,7 @@ export async function startDaemon(opts: DaemonOptions) {
1160
1186
  mkdirSync(opts.stateDir, { recursive: true });
1161
1187
  const operationalLogSubscribers=new Map<Sock,()=>void>();
1162
1188
  const operationalContext=new AsyncLocalStorage<{actor:string;current:()=>void}|undefined>();
1189
+ const guidanceProbeRequestContext = new AsyncLocalStorage<GuidanceProbeRequestContext>();
1163
1190
  const checkOperational=(authority:SettingAuthority)=>{if(authority==="conductor"){const scope=operationalContext.getStore();if(!scope)throw new OperationalAuthorityError("operational conductor authority unavailable");scope.current();}};
1164
1191
  const logFile = join(opts.stateDir, "hub.log");
1165
1192
  // The state dir can vanish under a running hub (issue #56): a log line must never take a handler down with it.
@@ -1384,6 +1411,7 @@ export async function startDaemon(opts: DaemonOptions) {
1384
1411
  }
1385
1412
  if (sock.data.session && sock.data.peer) sessionIds.delete(sock.data.peer);
1386
1413
  consoles.delete(sock);
1414
+ toolsSockets.delete(sock);
1387
1415
  operationalLogSubscribers.delete(sock);
1388
1416
  sock.data.tail?.();
1389
1417
  sock.data.watch?.();
@@ -2261,6 +2289,26 @@ export async function startDaemon(opts: DaemonOptions) {
2261
2289
  const uiEvents: { seq: number; event: BusEvent }[] = [];
2262
2290
  let uiSequence = 0;
2263
2291
  const consoles = new Set<Sock>();
2292
+ /** #1385: admitted `tools` connections (the MCP servers Codex, Kimi, agy and Jcode run), only so status can show the agent-hub version each one loaded. */
2293
+ const toolsSockets = new Set<Sock>();
2294
+ /** Per peer, the sorted distinct versions its open tools connections reported (`unreported` for a hello without one). One pass per status read. */
2295
+ const toolsVersions = (): Map<string, string[]> => {
2296
+ const byPeer = new Map<string, Set<string>>();
2297
+ for (const sock of toolsSockets) {
2298
+ const peer = sock.data.peer;
2299
+ if (!peer || sock.data.closed) continue;
2300
+ const seen = byPeer.get(peer) ?? new Set<string>();
2301
+ seen.add(sock.data.clientVersion ?? "unreported");
2302
+ byPeer.set(peer, seen);
2303
+ }
2304
+ return new Map([...byPeer].map(([peer, seen]) => [peer, [...seen].sort()]));
2305
+ };
2306
+ /** #1385: what agent-hub code a peer runs (status `peerVersions`): the daemon's own for an in-daemon adapter, else what its attached client reported. Absent while no client is attached. */
2307
+ const ahubStatus = (p: PeerAdapter | undefined, tools: string[] | undefined) => {
2308
+ const client = p?.hubClient;
2309
+ const ahub = !p ? undefined : !client ? { runs: "daemon" as const, version: VERSION } : client.attached ? { runs: "client" as const, version: client.version ?? "unreported" } : undefined;
2310
+ return { ...(ahub ? { ahub } : {}), ...(tools?.length ? { ahubTools: tools } : {}) };
2311
+ };
2264
2312
  /** A line for the human: hub.log and every open `ahub tail`. */
2265
2313
  const notify = (line: string) => {
2266
2314
  log(line);
@@ -2274,19 +2322,30 @@ export async function startDaemon(opts: DaemonOptions) {
2274
2322
  const inboxPolling = new InboxPolling();
2275
2323
  startupTimings.mark("model_runtime");
2276
2324
  const board = new Board(join(opts.stateDir, "hub.db"));
2325
+ let guidanceProbeStore: GuidanceProbeStore;
2326
+ try { guidanceProbeStore = new GuidanceProbeStore(join(opts.stateDir, "hub.db")); }
2327
+ catch { board.close(); throw new Error("guidance probe storage is unavailable; inspect retained probe state and hub.db before restarting"); }
2277
2328
  try {
2278
2329
  const retainedExecutionReferences = board.executionReferencesIntegrity(), expected = restored?.integrity?.executionReferences;
2279
2330
  if (restored?.integrity && (expected ? expected.count !== retainedExecutionReferences.count || expected.digest !== retainedExecutionReferences.digest : retainedExecutionReferences.count !== 0)) throw new Error("changed recovery binding");
2280
2331
  } catch {
2281
- board.close(); throw new Error("execution reference state or recovery binding is unavailable; restore trusted project state and choose a compatible recovery target before retrying");
2332
+ guidanceProbeStore.close(); board.close(); throw new Error("execution reference state or recovery binding is unavailable; restore trusted project state and choose a compatible recovery target before retrying");
2282
2333
  }
2283
2334
  try {
2284
2335
  const retainedGuidance = board.guidanceVariantsIntegrity(), expected = restored?.integrity?.guidanceVariants;
2285
2336
  if (restored?.integrity && (expected ? expected.experiments !== retainedGuidance.experiments || expected.variants !== retainedGuidance.variants
2286
2337
  || expected.digest !== retainedGuidance.digest : retainedGuidance.experiments !== 0 || retainedGuidance.variants !== 0)) throw new Error("changed recovery binding");
2287
2338
  } catch {
2288
- board.close(); throw new Error("guidance variant state or recovery binding is unavailable; restore trusted project state and choose a supporting target before retrying");
2339
+ guidanceProbeStore.close(); board.close(); throw new Error("guidance variant state or recovery binding is unavailable; restore trusted project state and choose a supporting target before retrying");
2340
+ }
2341
+ try {
2342
+ const retained = guidanceProbeStore.integrity(), expected = restored?.integrity?.guidanceProbes;
2343
+ if (restored && (expected ? expected.experiments !== retained.experiments || expected.sessions !== retained.sessions || expected.digest !== retained.digest
2344
+ : retained.experiments !== 0 || retained.sessions !== 0)) throw new Error("changed recovery binding");
2345
+ } catch {
2346
+ guidanceProbeStore.close(); board.close(); throw new Error("guidance probe state or recovery binding is unavailable; restore trusted project state and choose a compatible target before retrying");
2289
2347
  }
2348
+ startupCleanup.push(() => guidanceProbeStore.close());
2290
2349
  const visuals = new VisualStore(join(opts.stateDir, "hub.db"));
2291
2350
  startupCleanup.push(() => visuals.close());
2292
2351
  // Held recovery must compare the source's exact rows before any retention mutation.
@@ -2570,6 +2629,7 @@ export async function startDaemon(opts: DaemonOptions) {
2570
2629
  if (strayChecks.length) log(`checks ignored for ${strayChecks.join(", ")}: not a task class with a command (classes: ${CLASSES.join(", ")})`);
2571
2630
  // Commands and the other machine-local fields came only from a file git vouched for (loadConfig, issue #17).
2572
2631
  for (const line of config.ignored ?? []) log(`${line}; only a config file nobody committed may set it`);
2632
+ for (const line of config.releasePolicyNotices ?? []) log(`config: ${line}`);
2573
2633
  for (const line of config.retired ?? []) log(`config: ${line}`);
2574
2634
  const checksAllowed = Object.keys(checkCommands).length > 0;
2575
2635
  const checkTimeoutS = typeof config.checks.timeout_s === "number" && config.checks.timeout_s >= 1 ? Math.min(config.checks.timeout_s, 3600) : 600;
@@ -2856,7 +2916,13 @@ export async function startDaemon(opts: DaemonOptions) {
2856
2916
  && left.cwd === right.cwd && left.socket === right.socket && left.launchId === right.launchId && left.generation === right.generation && left.repo === right.repo;
2857
2917
  const projectSpecs = specInspectorAt(opts.cwd);
2858
2918
  let specsMissingBlockHintShown = false;
2919
+ let releaseReportPolicy: ((head: string, repo: string) => ReleaseReportPolicy | undefined) | undefined;
2859
2920
  const tasks: Tasks = new Tasks({
2921
+ guidanceProbes: { store: guidanceProbeStore, session: by => {
2922
+ const request = guidanceProbeRequestContext.getStore();
2923
+ return request?.actor === by ? { generation: request.generation, nativeSession: request.nativeSession,
2924
+ requestConnectionId: request.requestConnectionId, current: request.current } : undefined;
2925
+ } },
2860
2926
  releaseWindow,
2861
2927
  researchRunners: () => {
2862
2928
  if (config.research.runners === undefined) return {};
@@ -2959,7 +3025,12 @@ export async function startDaemon(opts: DaemonOptions) {
2959
3025
  return report;
2960
3026
  },
2961
3027
  specsRead: (action, paths) => projectSpecs.read(action, paths),
2962
- sdlc: { config: () => lifecycleConfig, gh: (args, timeout, _cwd, bound) => sdlcGh(args, timeout, opts.cwd, bound) },
3028
+ sdlc: {
3029
+ config: () => lifecycleConfig,
3030
+ gh: (args, timeout, _cwd, bound) => sdlcGh(args, timeout, opts.cwd, bound),
3031
+ reportPolicy: (head, repo) => releaseReportPolicy ? releaseReportPolicy(head, repo)
3032
+ : { versionSource: "unknown", docsSource: "unknown", authorization: "unavailable" },
3033
+ },
2963
3034
  board,
2964
3035
  bus,
2965
3036
  executionBudget,
@@ -6506,14 +6577,18 @@ export async function startDaemon(opts: DaemonOptions) {
6506
6577
 
6507
6578
  const releaseAuthorizations = new ReleaseAuthorizations(opts.cwd, {
6508
6579
  docs: opts.releaseDocEvidence,
6580
+ policy: (commit, git) => readCommittedReleasePolicy(git, commit),
6509
6581
  gh: (args, timeout) => sdlcGh(args, timeout, opts.cwd),
6510
6582
  current: () => !stopping && !recoveryActive() && !bus.isRecoveryHeld,
6511
6583
  conductor: () => {
6512
6584
  const peer = conductorPeer(config.roles);
6513
6585
  return peer && !turns.get(peer)?.private && !contextPii(peer) ? peer : undefined;
6514
6586
  },
6515
- record: receipt => event({ type: "release_authorization", by: receipt.by, authorization: receipt.id, commit: receipt.commit, version: receipt.version, docsDigest: receipt.docs.digest, documents: receipt.docs.documents }),
6587
+ record: receipt => event("source" in receipt.docs
6588
+ ? { type: "release_authorization", by: receipt.by, authorization: receipt.id, commit: receipt.commit, version: receipt.version, docs: "none" }
6589
+ : { type: "release_authorization", by: receipt.by, authorization: receipt.id, commit: receipt.commit, version: receipt.version, docsDigest: receipt.docs.digest, documents: receipt.docs.documents }),
6516
6590
  });
6591
+ releaseReportPolicy = (head, repo) => releaseAuthorizations.reportPolicy(head, repo);
6517
6592
  const terminalReads = terminalOwnerReads();
6518
6593
  const terminalLaunches = new TerminalLaunches({
6519
6594
  owner: row => {
@@ -6559,6 +6634,7 @@ export async function startDaemon(opts: DaemonOptions) {
6559
6634
  let releasing = false; // gone-owner release (#6) and the ready sweep (#34): one run at a time, and a recovery commit waits for it
6560
6635
  const recoveryReady = () => {
6561
6636
  if (!recoveryActive() || releasing || taskOpsInFlight !== 0 || tasks.checksPending() !== 0 || piCallsInFlight() !== 0 || permissions.size !== 0 || starting.size !== 0 || requestedPeerStops.size !== 0 || rosterChanging !== undefined || !budget.recoverySettled || [...bus.peers.values()].filter(peer => !peer.id.includes("@")).some((peer) => peer.state === "busy" || ("recoveryReady" in peer && peer.recoveryReady !== true))) return false;
6637
+ if (tasks.guidanceProbesPending() !== 0) return false; // Active and uncertain fixture work retains its project lane.
6562
6638
  if (checkPending.size !== 0) return false;
6563
6639
  if (tasks.autoPullsPending() !== 0) return false; // #785 P1c: an automatic backlog pull mid-admission would write after the commit's digest; its own line keeps the line above exact for scripts/seeds.json
6564
6640
  if (tasks.queuePressureRechecksPending() !== 0) return false;
@@ -6871,13 +6947,14 @@ export async function startDaemon(opts: DaemonOptions) {
6871
6947
  const researchRunners = board.runnerReceiptIntegrity();
6872
6948
  const researchEvidence = board.researchEvidenceIntegrity();
6873
6949
  const guidanceVariants = board.guidanceVariantsIntegrity();
6950
+ const guidanceProbes = guidanceProbeStore.integrity();
6874
6951
  const executionReferences = board.executionReferencesIntegrity();
6875
6952
  const reviewComments = board.reviewCommentsIntegrity();
6876
6953
  const modelState = modelOverrides.integrity();
6877
6954
  const visualIntegrity = visuals.integrity();
6878
6955
  if (!Number.isSafeInteger(visualIntegrity.count) || visualIntegrity.count < 0 || !/^[a-f0-9]{64}$/.test(visualIntegrity.digest))
6879
6956
  throw new Error("visual recovery integrity unavailable; inspect the retained store before recovery");
6880
- return { queues, manualPaused: [...manualPaused].sort(), boardDigest: digest(boardState), budgetDigest: digest(budgetState), ...(modelState.count ? { modelOverrides: modelState } : {}), ...(research.campaigns || research.units ? { research } : {}), ...(researchDispatch.activations || researchDispatch.handoffs ? { researchDispatch } : {}), ...(researchExperiments.protocols || researchExperiments.attempts || researchExperiments.events || researchExperiments.observations ? { researchExperiments } : {}), ...(researchComparisons.plans || researchComparisons.approvals || researchComparisons.contexts ? { researchComparisons } : {}), ...(researchRunners.count ? { researchRunners } : {}), ...(researchEvidence.links || researchEvidence.revisions ? { researchEvidence } : {}), ...(guidanceVariants.experiments || guidanceVariants.variants ? { guidanceVariants } : {}), ...(executionReferences.count ? { executionReferences } : {}), ...(reviewComments.comments || reviewComments.packages ? { reviewComments } : {}), ...(visualIntegrity.count ? { visuals: visualIntegrity } : {}), ...(allExternalInstanceIds().length ? { externalBindingsDigest: digest(allExternalInstanceIds().sort().map(id => [id, (externalRefusedRows.has(id) ? externalBindings.get(id) : retainedExternalBinding(id)) ?? null])) } : {}) };
6957
+ return { queues, manualPaused: [...manualPaused].sort(), boardDigest: digest(boardState), budgetDigest: digest(budgetState), ...(modelState.count ? { modelOverrides: modelState } : {}), ...(research.campaigns || research.units ? { research } : {}), ...(researchDispatch.activations || researchDispatch.handoffs ? { researchDispatch } : {}), ...(researchExperiments.protocols || researchExperiments.attempts || researchExperiments.events || researchExperiments.observations ? { researchExperiments } : {}), ...(researchComparisons.plans || researchComparisons.approvals || researchComparisons.contexts ? { researchComparisons } : {}), ...(researchRunners.count ? { researchRunners } : {}), ...(researchEvidence.links || researchEvidence.revisions ? { researchEvidence } : {}), ...(guidanceVariants.experiments || guidanceVariants.variants ? { guidanceVariants } : {}), ...(guidanceProbes.experiments || guidanceProbes.sessions ? { guidanceProbes } : {}), ...(executionReferences.count ? { executionReferences } : {}), ...(reviewComments.comments || reviewComments.packages ? { reviewComments } : {}), ...(visualIntegrity.count ? { visuals: visualIntegrity } : {}), ...(allExternalInstanceIds().length ? { externalBindingsDigest: digest(allExternalInstanceIds().sort().map(id => [id, (externalRefusedRows.has(id) ? externalBindings.get(id) : retainedExternalBinding(id)) ?? null])) } : {}) };
6881
6958
  };
6882
6959
  /** The integrity in the shape `expected` was recorded in: the current one unless only an older shape matches. */
6883
6960
  const integrityAs = (expected: unknown) => {
@@ -6960,6 +7037,9 @@ export async function startDaemon(opts: DaemonOptions) {
6960
7037
  const queueBackpressure = tasks.queuePressureStatus(peerIds);
6961
7038
  const crashLines = crashView();
6962
7039
  const deliveryFailures = bus.failedDeliveryCounts();
7040
+ const toolsByPeer = toolsVersions();
7041
+ // #1385: separate metadata, like roleInfo (#295), so the legacy peer row keeps its shape.
7042
+ const peerVersions = Object.fromEntries(peerIds.map(id => [id, ahubStatus(bus.peers.get(id), toolsByPeer.get(id))] as const).filter(([, row]) => Object.keys(row).length));
6963
7043
  const view = {
6964
7044
  ...(deliveryFailures ? { deliveryFailures } : {}),
6965
7045
  ...runtimeModelProjection(),
@@ -7011,6 +7091,7 @@ export async function startDaemon(opts: DaemonOptions) {
7011
7091
  peers: Object.fromEntries(
7012
7092
  peerIds.map((id) => { const p = bus.peers.get(id); const summary = bus.queueSummary(id); const pressure = queueBackpressure?.peers[id]; const oldestQueuedAt = pressure ? pressure.oldestQueuedAt : summary.oldestQueuedAt; const context = contexts.view(id, contextSession(id), !!p && ["idle", "busy", "paused"].includes(bus.stateOf(id))); const statusNotice = isFixedBuiltinDefinition(definitionOf(id)) ? p?.statusNotice : undefined; const reviewObserverHoldNote = reviewObserverSessionIdentityHoldNote(id); return [id, { state: bus.stateOf(id), ...(includeAttentionItems && isExternalInstance(id) && !externalRefusedRows.has(id) && retainedExternalBinding(id) ? { externalInstance: retainedExternalBinding(id) } : {}), ...(!membershipAllowed(id) ? { rostered: false, rosterNote: "off roster" } : {}), ...permissionStatus(id, p), ...(statusNotice ? { statusNotice } : {}), ...(reviewObserverHoldNote ? { reviewObserverHoldNote } : {}), ...(context.source !== null || context.measuredAt !== null ? { context } : {}), queued: bus.queued(id), ...(p ? {} : { attached: false }), ...(includeAttentionItems && p?.standbySessions?.length ? { standbySessions: p.standbySessions } : {}), ...(includeAttentionItems && p?.ownerAttachment ? { ownerAttachment: p.ownerAttachment } : {}), ...(declarations[id] && config.roles[id]?.includes("implementer") && definitionOf(id)?.transport === "claude-channel" ? { ownerIsolation: ownerIsolation[id] === true, ...(ownerIsolation[id] !== true ? { ownerIsolationNote: "terminal execution root not verified; owner admission refused" } : {}) } : {}), ...(summary.needsReview ? { needsReview: summary.needsReview } : {}), ...(summary.liveAccepted ? { liveAccepted: summary.liveAccepted, settlementNote: "awaiting adapter completion (Claude: correlated reply or hub_delivery_done); task state is independent" } : {}), ...queueHoldStatus(id, summary.heldBy), ...(typeof oldestQueuedAt === "number" ? { oldestQueuedAt } : {}), ...(bus.queuedImportant(id) ? { queuedImportant: bus.queuedImportant(id) } : {}), ...importantWaitingStatus(id, p), ...pausedNote(id), ...(reviewerUnavailable.has(id) ? { reviewerUnavailable: reviewerUnavailable.get(id) } : {}), ...jcodeModelSource(id), ...(reviewOnlyPeer(id) ? { reviewScope: reviewScopeOf(id) } : {}), ...(isLocalPeer(p) && p.lastServedBy ? { servedBy: p.lastServedBy } : {}), ...(isWsPeer(p) ? { ...(p.claiming ? { claiming: true } : {}), ...(definitionOf(id)?.transport === "claude-channel" && p.attached ? { attachMode: p.attachMode, attachEvidence: p.attachEvidence } : {}) } : {}), ...(isWsPeer(p) && p.pullOnly ? { pullOnly: true, toolsOnly: definitionOf(id)?.attach?.pullOnlyNotice ?? "tools-only: messages wait for hub_inbox; for pushes restart Claude with ahub claude", lastInboxAt: p.lastInboxAt ?? null } : {}), ...(isPiPeer(p) ? { requestedModel: p.getRequestedModel(), backends: modelRelays.get(id)?.status().backends ?? [] } : {}) }]; }),
7013
7093
  ),
7094
+ peerVersions,
7014
7095
  taskWip: tasks.wipBreakdown(peerIds),
7015
7096
  boardReadCapabilities: { releaseFilter: true, columnMetadata: true },
7016
7097
  actionPolicyInfo: Object.fromEntries(peerIds.map(id => { const e = actionEnforcement(id); return [id, actionBudgets.status(id, e.enforced, e.reason)]; })),
@@ -9469,6 +9550,7 @@ export async function startDaemon(opts: DaemonOptions) {
9469
9550
  }
9470
9551
  function declaredPaths(value: unknown, prefix = ""): string[] {
9471
9552
  if (prefix === "_autonomy" || prefix.startsWith("_autonomy.")) return [];
9553
+ if (prefix === "release" || prefix.startsWith("release.")) return [];
9472
9554
  if (prefix === "pet.window") return [];
9473
9555
  // Retired dictionaries never enter active publication; hub ids remain opaque keys.
9474
9556
  if (prefix === "routing.targets" || prefix === "routing.routes") return [];
@@ -9578,11 +9660,13 @@ export async function startDaemon(opts: DaemonOptions) {
9578
9660
  guarded.length = 0; previews.length = 0;
9579
9661
  }
9580
9662
  candidate.retired = fileConfig.retired;
9663
+ candidate.releasePolicyNotices = fileConfig.releasePolicyNotices;
9581
9664
  routing.retired = sources.routing.retired;
9582
9665
  const changes = configChanges({ ...config, roles: policyRoles }, candidate, [{ catalog: adapterCatalog, instances: declarations }, configIdentityScope(acceptedSources.identity), configIdentityScope(sources.identity)]);
9583
9666
  const running = structuredClone({ ...config, roles: policyRoles });
9584
9667
  for (const change of changes) if (change.applies !== "restart") putConfig(running, change.key, change.after);
9585
9668
  running.retired = fileConfig.retired;
9669
+ running.releasePolicyNotices = fileConfig.releasePolicyNotices;
9586
9670
  validateEffectiveConfig(running, adapterCatalog);
9587
9671
  conductorPeer(running.roles);
9588
9672
  for (const peer of Object.keys(running.catalog_roles ?? {})) selectedRoles(peer, running.roles, { ...resolvedProfile.catalog_roles, ...catalogAssignments(running.catalog_roles) }, catalog);
@@ -9663,6 +9747,9 @@ export async function startDaemon(opts: DaemonOptions) {
9663
9747
  const priorRetired = new Set(config.retired ?? []);
9664
9748
  config.retired = prepared.running.retired;
9665
9749
  for (const line of config.retired ?? []) if (!priorRetired.has(line)) log(`config: ${line}`);
9750
+ const priorReleaseNotices = new Set(config.releasePolicyNotices ?? []);
9751
+ config.releasePolicyNotices = prepared.running.releasePolicyNotices;
9752
+ for (const line of config.releasePolicyNotices ?? []) if (!priorReleaseNotices.has(line)) log(`config: ${line}`);
9666
9753
  config.permission_default_sources = candidate.permission_default_sources;
9667
9754
  refreshAutonomyConsent(prepared.fileConfig);
9668
9755
  for (const peer of changedPermissionDefaults) applyPendingPermissionDefault(peer);
@@ -10336,6 +10423,7 @@ export async function startDaemon(opts: DaemonOptions) {
10336
10423
  // #272: the rest of what recoveryReady() waits for, so the upgrade screen can name the wait. Display only.
10337
10424
  ...(taskOpsInFlight !== 0 ? ["a task command in flight"] : []),
10338
10425
  ...(tasks.checksPending() !== 0 ? ["completion checks queued or running"] : []),
10426
+ ...(tasks.guidanceProbesPending() !== 0 ? ["guidance probe work in flight"] : []),
10339
10427
  ...(tasks.autoPullsPending() !== 0 ? ["an automatic backlog pull in flight"] : []),
10340
10428
  ...(tasks.queuePressureRechecksPending() !== 0 ? ["a queue-pressure assignment recheck in flight"] : []),
10341
10429
  ...(tasks.schedulesPending() !== 0 ? ["a scheduled task proposal in flight"] : []),
@@ -10368,6 +10456,10 @@ export async function startDaemon(opts: DaemonOptions) {
10368
10456
  ? `target lacks task_cancel; cancelled tasks: ${ids.map(id => `#${id}`).join(", ")}` : undefined;
10369
10457
  };
10370
10458
  const incompatibleRecoveryTarget = () => {
10459
+ if (!Array.isArray(msg.targetFeatures) || !msg.targetFeatures.includes("guidance_probes")) {
10460
+ try { if (guidanceProbeStore.hasRecords()) return "target lacks guidance_probes; retained probe declarations or held work require a supporting daemon; choose a target advertising guidance_probes"; }
10461
+ catch { return "guidance probe compatibility is unknown; inspect retained probe state or choose a supporting target"; }
10462
+ }
10371
10463
  if (!Array.isArray(msg.targetFeatures) || !msg.targetFeatures.includes("guidance_variants")) {
10372
10464
  try { if (board.hasGuidanceVariants()) return "target lacks guidance_variants; retained immutable variants require a supporting daemon; choose a target advertising guidance_variants"; }
10373
10465
  catch { return "guidance variant compatibility is unknown; inspect retained storage or choose a supporting target"; }
@@ -10892,6 +10984,8 @@ export async function startDaemon(opts: DaemonOptions) {
10892
10984
  c.authed = true;
10893
10985
  c.protocol = selectedProtocol;
10894
10986
  c.role = msg.role;
10987
+ c.guidanceProbeConnectionId = randomUUID(); // Private comparator only; never sent, persisted separately or accepted from hello.
10988
+ c.clientVersion = displayVersion(msg.clientVersion);
10895
10989
  if (c.role === "console") consoles.add(sock);
10896
10990
  else if (c.role === "tools" && sessionHello(msg)) {
10897
10991
  // 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
@@ -10958,6 +11052,7 @@ export async function startDaemon(opts: DaemonOptions) {
10958
11052
  if (typeof msg.cwd === "string" && msg.cwd.length <= 4096) sock.data.cwd = msg.cwd;
10959
11053
  const clientPid = Number.isSafeInteger(msg.clientPid) && msg.clientPid > 0 && msg.clientPid <= 2_147_483_647 ? msg.clientPid as number : undefined;
10960
11054
  sock.data.clientPid = clientPid;
11055
+ sock.data.clientVersion = c.clientVersion;
10961
11056
  const pushOverPullOnly = msg.channel !== false && ws.attached && ws.pullOnly && !ws.claiming;
10962
11057
  const hasLiveHolder = ws.attached || ws.claiming;
10963
11058
  if (c.retainStandby && hasLiveHolder && !pushOverPullOnly) {
@@ -10986,6 +11081,7 @@ export async function startDaemon(opts: DaemonOptions) {
10986
11081
  }
10987
11082
  }
10988
11083
  // #604 PR B: one attach event per admitted peer or tools hello, with the same fields an envelope's `origin` carries. A refused hello returned above and writes none.
11084
+ if (c.role === "tools" && !c.session) toolsSockets.add(sock);
10989
11085
  if (c.role === "peer" || c.role === "tools") event(attachEvent({ role: c.role, peer: c.peer, launchId: c.launchId, ...(c.session ? { session: true } : {}) }));
10990
11086
  return void reply({ t: "welcome", projectId, instanceId, cwd: opts.cwd, protocol: c.protocol, protocolMin: PROTOCOL_MIN, protocolMax: PROTOCOL, features: DAEMON_FEATURES,
10991
11087
  ...(c.session ? { session: c.peer } : {}), ...(c.standbyId ? { standby: true, standbyId: c.standbyId } : {}) });
@@ -12193,6 +12289,67 @@ export async function startDaemon(opts: DaemonOptions) {
12193
12289
  error => reply({ ok: false, error: error instanceof Error ? error.message : "guidance write is unconfirmed; inspect the task guidance before explicitly retrying" }));
12194
12290
  return;
12195
12291
  }
12292
+ case "guidance_probe_register":
12293
+ case "guidance_probe_start":
12294
+ case "guidance_probe_show":
12295
+ case "guidance_probe_cancel": {
12296
+ const role = c.role, actor = role === "console" ? USER : role === "tools" && typeof c.peer === "string" && PEER_ID.test(c.peer) ? c.peer : undefined;
12297
+ if ((role !== "console" && role !== "tools") || !actor) return void reply({ ok: false, error: "guidance probes require a person or the current configured conductor" });
12298
+ if (stopping || recoveryActive() || bus.isRecoveryHeld) return void reply({ ok: false, error: "recovery or shutdown is holding guidance probe operations; inspect retained state after release" });
12299
+ const operation = msg.t === "guidance_probe_register" ? "guidance probe register" : msg.t === "guidance_probe_start" ? "guidance probe start"
12300
+ : msg.t === "guidance_probe_show" ? "guidance probe show" : "guidance probe cancel";
12301
+ let authorityCurrent: () => void;
12302
+ if (role === "tools") {
12303
+ try { authorityCurrent = admitOperational(sock, operation); }
12304
+ catch (error) { return void reply(operationalFailure(error)); }
12305
+ } else authorityCurrent = () => {
12306
+ if (sock.data !== c || c.closed || sock.readyState !== WebSocket.OPEN || c.role !== "console" || stopping)
12307
+ throw new PreEffectToolRefusal("guidance probe console session changed; reconnect and inspect retained state");
12308
+ };
12309
+ const requestConnectionId = c.guidanceProbeConnectionId;
12310
+ if (!executionText(requestConnectionId, EXECUTION_REFERENCE_LIMITS.id))
12311
+ return void reply({ ok: false, error: "guidance probe request identity is unavailable; reconnect through the authenticated project connection" });
12312
+ let generation: string | number, nativeSession: string | null, owner: PeerAdapter | undefined;
12313
+ if (role === "console") {
12314
+ generation = requestConnectionId;
12315
+ nativeSession = null;
12316
+ } else {
12317
+ owner = bus.peers.get(actor);
12318
+ const peerGeneration = owner?.sessionGeneration, peerNativeSession = owner?.nativeSession;
12319
+ if (!owner || !("sessionGeneration" in owner) || !probeSessionGeneration(peerGeneration)
12320
+ || !("nativeSession" in owner) || typeof peerNativeSession !== "string"
12321
+ || !executionText(peerNativeSession, EXECUTION_REFERENCE_LIMITS.id))
12322
+ return void reply({ ok: false, error: "guidance probe conductor session identity is unavailable; reconnect the current native peer session" });
12323
+ generation = peerGeneration;
12324
+ nativeSession = peerNativeSession;
12325
+ }
12326
+ const current = (): void => {
12327
+ if (sock.data !== c || c.closed || sock.readyState !== WebSocket.OPEN || c.role !== role || c.guidanceProbeConnectionId !== requestConnectionId
12328
+ || role === "tools" && (c.peer !== actor || bus.peers.get(actor) !== owner || owner!.sessionGeneration !== generation || owner!.nativeSession !== nativeSession))
12329
+ throw new PreEffectToolRefusal("guidance probe request connection or native peer session changed; inspect retained state and reconnect");
12330
+ authorityCurrent();
12331
+ };
12332
+ const requestContext: GuidanceProbeRequestContext = { actor, requestConnectionId, generation, nativeSession, current };
12333
+ const input = msg.registration;
12334
+ taskOpsInFlight++;
12335
+ const run = () => {
12336
+ current();
12337
+ if (recoveryActive() || bus.isRecoveryHeld || stopping) throw new PreEffectToolRefusal("recovery or shutdown is holding guidance probe operations; inspect retained state after release");
12338
+ const action = () => msg.t === "guidance_probe_register" ? tasks.guidanceProbeRegister(actor, input)
12339
+ : msg.t === "guidance_probe_start" ? tasks.guidanceProbeStart(actor, msg.id, msg.revision, msg.variantId)
12340
+ : msg.t === "guidance_probe_show" ? tasks.guidanceProbeShow(actor, msg.id)
12341
+ : tasks.guidanceProbeCancel(actor, msg.id, msg.revision);
12342
+ const withRequest = () => guidanceProbeRequestContext.run(requestContext, action);
12343
+ return role === "tools" ? operationalContext.run({ actor, current }, withRequest) : withRequest();
12344
+ };
12345
+ void Promise.resolve().then(run).then(value => reply(msg.t === "guidance_probe_show" ? { ok: true, status: value } : { ok: true, receipt: value }), error => {
12346
+ if (error instanceof PreEffectToolRefusal || error instanceof GuidanceProbeError) return reply({ ok: false, error: error.message });
12347
+ if (error instanceof OperationalAuthorityError) return reply(operationalFailure(error));
12348
+ return reply({ ok: false, error: "guidance probe operation is unconfirmed; inspect retained state before retrying" });
12349
+ })
12350
+ .finally(() => { taskOpsInFlight--; }).catch(() => {});
12351
+ return;
12352
+ }
12196
12353
  case "lineage_show":
12197
12354
  case "lineage_link": {
12198
12355
  const role = c.role, actor = role === "console" ? USER : role === "tools" && typeof c.peer === "string" && PEER_ID.test(c.peer) ? c.peer : undefined;
@@ -12581,6 +12738,8 @@ export async function startDaemon(opts: DaemonOptions) {
12581
12738
  }
12582
12739
  async function stopOnce(): Promise<void> {
12583
12740
  stopping = true;
12741
+ // A failed bounded probe drain must return before teardown/finalization. The retained DB, owned fixture handles and retryable shutdown remain available.
12742
+ await tasks.stopGuidanceProbes();
12584
12743
  kimiUsage.stop();
12585
12744
  controlWriteTelemetry?.stop();
12586
12745
  const roomsStopped = roomCommands.stop().catch(() => { log("room shutdown failed; inspect ahub room status after restart"); });
@@ -12651,6 +12810,7 @@ export async function startDaemon(opts: DaemonOptions) {
12651
12810
  memoryStore?.close();
12652
12811
  modelPreviews.clear(); modelOverrides.close();
12653
12812
  visuals.close();
12813
+ guidanceProbeStore.close();
12654
12814
  board.close();
12655
12815
  turnLog?.close();
12656
12816
  server.stop(true);
package/src/hub/events.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { appendFileSync, closeSync, existsSync, fstatSync, openSync, readFileSync, readSync } from "node:fs";
2
2
  import type { TaskAttribution } from "./attribution.ts";
3
3
  import type { PeerId } from "./envelope.ts";
4
- import type { SwitchTrace } from "../models/route/stage.ts";
4
+ import type { StageSwitchTrace as SwitchTrace } from "../models/route/stage-fallback.ts";
5
5
  import type { ScreenRecord } from "./inference.ts";
6
6
 
7
7
  export interface RoleIdentity { id: string; layer: "shipped" | "project"; hash: string }
@@ -16,6 +16,7 @@ export const EVENTS_SCHEMA = 1;
16
16
  export type HubEvent =
17
17
  | { type: "model_change"; peer: string; previousModel: string | null; model: string | null; by: "person"; source: "cli" | "dashboard"; appliesFrom: "next_turn"; afterTurn?: string }
18
18
  | { type: "release_authorization"; by: PeerId; authorization: string; commit: string; version: string; docsDigest: string; documents: number }
19
+ | { type: "release_authorization"; by: PeerId; authorization: string; commit: string; version: string; docs: "none" }
19
20
  | { type: "permission_mode"; peer: string; from: import("./permission-mode.ts").PermissionMode; to: import("./permission-mode.ts").PermissionMode }
20
21
  | { type: "role"; peer?: string; task?: number; actor: string; stage: "prepared" | "assigned"; roles: { id: string; layer: "shipped" | "project"; hash: string }[] }
21
22
  /** A settings change (#269): the registry key, the bounded registry values before/after and their source; an optional person reason is sanitized and capped at 400 UTF-8 bytes. */
@@ -35,7 +36,7 @@ export type HubEvent =
35
36
  | { type: "quiet"; id: string; from: string; peers: string[] }
36
37
  | { type: "fact"; peer: string; id: string; files: number; plans: number; unknown: number; named: number; bytes: number; via: "hook" | "steer" | "done"; ms?: number; hookMs?: number; rttMs?: number; accepted?: boolean; unanswered?: boolean; probe?: boolean; coverage?: boolean }
37
38
  | { type: "fact_ack"; peer: string; id: string; via: string; ms: number }
38
- | ({ type: "route"; peer: string; route: string; tier: string; source: "override" | "dimensions" | "hold" | "classifier" | "default" | "load" | "cooldown" | "pin" | "decision"; score: number; ms: number; decisionMode?: "off" | "shadow"; chosenAlias?: string | null; chosenEffort?: string | null; margin?: number; decisionLatencyMs?: number; decisionReason?: string; fallbackApplied?: boolean; decider?: { provider: string; model: string; version?: string; latencyMs: number } | null; stateless?: boolean; decision?: string; turn?: string; task?: number; pii?: boolean; severity?: number; spinning?: number; exploring?: number; production?: number } & Partial<SwitchTrace>)
39
+ | ({ type: "route"; peer: string; route: string; tier: string; source: "override" | "dimensions" | "hold" | "classifier" | "default" | "load" | "cooldown" | "pin" | "decision"; score: number; ms: number; decisionTarget?: "judge"; decisionMode?: "off" | "shadow"; chosenAlias?: string | null; chosenEffort?: string | null; margin?: number; decisionLatencyMs?: number; decisionReason?: string; fallbackApplied?: boolean; decider?: { provider: string; model: string; version?: string; latencyMs: number } | null; stateless?: boolean; decision?: string; turn?: string; task?: number; pii?: boolean; severity?: number; spinning?: number; exploring?: number; production?: number } & Partial<SwitchTrace>)
39
40
  | { type: "cooldown"; peer: string; alias: string; event: "start" | "end"; failures: number; ms?: number }
40
41
  | { type: "route_outcome"; peer: string; decision: string; turnId: string; turn: "completed" | "failed"; task?: number; pii: boolean; latched: boolean; next?: { severity: number; tests: "pass" | "fail" | "none"; repeat: boolean }; advisor?: "approve" | "redo" | "failed" }
41
42
  | { type: "advisor"; peer: string; route: string; trigger: string; verdict: "approve" | "redo" | "failed"; discardedChars: number }