@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
@@ -0,0 +1,99 @@
1
+ import { closeSync, fstatSync, openSync, readSync, constants } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { DOCTOR_PLUGIN_PROBE } from "../adapters/registry.ts";
4
+ import { childEnv } from "../hub/child-process.ts";
5
+ import { withoutOrcaEnv } from "../hub/orca-env.ts";
6
+ import { displayVersion } from "../version.ts";
7
+ import { globalCliRoot } from "./install-paths.ts";
8
+ import { runtimeVersionWarnings } from "./runtime-version-warning.ts";
9
+ import { parseList, pluginState, type InstalledPlugin } from "./setup.ts";
10
+
11
+ /** #1385: the agent-hub versions the console shows. Every value is display only; a missing one is unknown, never matching. */
12
+ export interface ConsoleVersions {
13
+ daemon?: string;
14
+ cli: string;
15
+ global?: string;
16
+ plugin?: string;
17
+ /** The ones older than the running daemon, by the comparison `ahub doctor` prints (`runtimeVersionWarnings`), plus a global install older than it. */
18
+ older: ("cli" | "global" | "plugin")[];
19
+ }
20
+
21
+ // Contract: a package.json is a few KiB; a larger file is not an agent-hub manifest.
22
+ const MANIFEST_BYTES = 64 * 1024;
23
+ // Contract: the same bound `ahub doctor` and `ahub upgrade` give the plugin listing.
24
+ const PLUGIN_PROBE_MS = 10_000;
25
+ // Contract: a Claude plugin listing is a few KiB; more is not one.
26
+ const PLUGIN_PROBE_BYTES = 256 * 1024;
27
+
28
+ /** The version in the `package.json` of the `ahub` on PATH, read without running it. Unknown when no `ahub` resolves to a package root or its manifest is unreadable. */
29
+ export function globalCliVersion(env: NodeJS.ProcessEnv = process.env): string | undefined {
30
+ const root = globalCliRoot(env);
31
+ if (!root) return;
32
+ let fd: number | undefined;
33
+ try {
34
+ fd = openSync(join(root, "package.json"), constants.O_RDONLY | constants.O_NOFOLLOW);
35
+ const size = fstatSync(fd).size;
36
+ if (size > MANIFEST_BYTES) return;
37
+ const buffer = Buffer.alloc(size);
38
+ readSync(fd, buffer, 0, size, 0);
39
+ const manifest = JSON.parse(buffer.toString("utf8")) as { name?: unknown; version?: unknown };
40
+ return manifest.name === "@staix/agent-hub" ? displayVersion(manifest.version) : undefined;
41
+ } catch { return; } finally { if (fd !== undefined) closeSync(fd); }
42
+ }
43
+
44
+ /** The installed Claude plugin's version from the `claude plugin list --json` listing `ahub doctor` reads, once, bounded. A missing `claude`, a failure or an unreadable list is unknown. */
45
+ export async function installedPluginVersion(packageRoot: string): Promise<string | undefined> {
46
+ try {
47
+ const child = Bun.spawn([DOCTOR_PLUGIN_PROBE.command, ...DOCTOR_PLUGIN_PROBE.argv], { env: withoutOrcaEnv(childEnv()), stdin: "ignore", stdout: "pipe", stderr: "ignore" });
48
+ const timer = setTimeout(() => child.kill(), PLUGIN_PROBE_MS);
49
+ try {
50
+ const reader = child.stdout.getReader();
51
+ const chunks: Uint8Array[] = [];
52
+ let bytes = 0;
53
+ for (;;) {
54
+ const { done, value } = await reader.read();
55
+ if (done) break;
56
+ bytes += value.byteLength;
57
+ if (bytes > PLUGIN_PROBE_BYTES) { child.kill(); await reader.cancel(); return; }
58
+ chunks.push(value);
59
+ }
60
+ if (await child.exited !== 0) return;
61
+ const state = pluginState(parseList<InstalledPlugin>(Buffer.concat(chunks).toString("utf8")), packageRoot);
62
+ return state.state === "missing" ? undefined : displayVersion(state.version);
63
+ } finally { clearTimeout(timer); }
64
+ } catch { return; }
65
+ }
66
+
67
+ /** Both readings for `ahub console`, started once at launch so no draw waits on them. */
68
+ export async function installedVersions(packageRoot: string): Promise<{ global?: string; plugin?: string }> {
69
+ const global = globalCliVersion(), plugin = await installedPluginVersion(packageRoot);
70
+ return { ...(global ? { global } : {}), ...(plugin ? { plugin } : {}) };
71
+ }
72
+
73
+ export function consoleVersions(daemon: unknown, cli: string, global: string | undefined, plugin: string | undefined): ConsoleVersions {
74
+ const running = displayVersion(daemon);
75
+ const older: ConsoleVersions["older"] = [];
76
+ if (running) {
77
+ const warned = new Set(runtimeVersionWarnings(running, cli, plugin).filter(row => row.level === "warn").map(row => row.name));
78
+ if (warned.has("CLI versus daemon")) older.push("cli");
79
+ try { if (global && Bun.semver.order(global, running) < 0) older.push("global"); } catch { /* not comparable: shown, never flagged */ }
80
+ if (warned.has("plugin versus daemon")) older.push("plugin");
81
+ }
82
+ return { ...(running ? { daemon: running } : {}), cli, ...(global ? { global } : {}), ...(plugin ? { plugin } : {}), older };
83
+ }
84
+
85
+ /** What a peer's AHUB cell and detail say, from its status `ahub`/`ahubTools`; `differs` when any loaded version is not the daemon's. Older hubs send neither: `-`. */
86
+ export function peerHubVersion(row: { ahub?: { runs?: unknown; version?: unknown }; ahubTools?: unknown }, daemon: string | undefined): { cell: string; differs: boolean; unknown?: boolean; detail?: string } {
87
+ const runs = row.ahub?.runs, own = displayVersion(row.ahub?.version);
88
+ const tools = Array.isArray(row.ahubTools) ? row.ahubTools.filter((v): v is string => typeof v === "string" && (v === "unreported" || !!displayVersion(v))) : [];
89
+ const parts = [runs === "daemon" ? "daemon" : runs === "client" ? own ?? "unreported" : undefined, ...(tools.length ? [`tools ${tools.join(",")}`] : [])].filter((p): p is string => !!p);
90
+ if (!parts.length) return { cell: "-", differs: false };
91
+ // An unreported version is unknown, never a difference: only a version someone reported can differ from the daemon's.
92
+ const loaded = [...(runs === "client" && own ? [own] : []), ...tools.filter(v => v !== "unreported")];
93
+ const unknown = runs === "client" && !own || tools.includes("unreported");
94
+ const differs = !!daemon && loaded.some(v => v !== daemon);
95
+ const detail = `${runs === "daemon" ? `runs inside the daemon (${daemon ?? "unknown"})` : runs === "client" ? `client ${own ?? "unreported"}` : "no client attached"}${tools.length ? `; tools connections ${tools.join(", ")}` : ""}`
96
+ + (differs ? `; differs from the daemon ${daemon}: update the global CLI and run ahub setup, then restart that agent's session to load it` : "")
97
+ + (unknown ? "; an unreported version is unknown (a client older than #1385 sends none)" : "");
98
+ return { cell: parts.join(" "), differs, unknown, detail };
99
+ }
@@ -17,6 +17,8 @@ import { pasteFlow, questionRows } from "./console-question.ts";
17
17
  import { characterAttentionLine } from "./attention.ts";
18
18
  import { projectRoomStatus } from "../rooms/status.ts";
19
19
  import { LIVE_TEST_PERSON_REFUSAL } from "./identity.ts";
20
+ import { consoleVersions } from "./console-versions.ts";
21
+ import { VERSION } from "../version.ts";
20
22
 
21
23
  export interface ConsoleTerminal {
22
24
  columns: number; rows: number; isTTY: boolean; isRaw?: boolean;
@@ -40,6 +42,8 @@ export interface ConsoleOptions {
40
42
  /** Injected command runner must use argv, closed stdin, and return a cancellation handle. */
41
43
  runCommand?: (args: string[], output: (text: string) => void, done: (code?: number) => void, columns?: number) => (() => void);
42
44
  pollMs?: number;
45
+ /** #1385: the global CLI and installed plugin versions, read once off the render loop; absent reads as unknown. */
46
+ installed?: Promise<{ global?: string; plugin?: string }>;
43
47
  }
44
48
  /** Exact navigation sequences only (#309, #441); anything else in a multi-character read is a paste. */
45
49
  const NAVIGATION = ["\x1b[A", "\x1b[B", "\x1b[C", "\x1b[D", ...FIRST_KEYS, ...LAST_KEYS].filter(key => key.startsWith("\x1b"));
@@ -107,6 +111,8 @@ export async function runConsole(options: ConsoleOptions): Promise<void> {
107
111
  let resolveDone: () => void = () => {}; const done = new Promise<void>(resolve => { resolveDone = resolve; });
108
112
  let pendingStream: ConsoleEvent[] = []; let droppedStream = 0;
109
113
  let presentation = consoleOperationalSnapshot(undefined);
114
+ let installed: { global?: string; plugin?: string } = {};
115
+ options.installed?.then(value => { installed = value; if (state.versions) state.versions = consoleVersions(state.versions.daemon, VERSION, installed.global, installed.plugin); }, () => {});
110
116
  let priorStreamFooterStart: number | undefined;
111
117
  let lastExpandedNotice = "";
112
118
  const notice = (text: string, tone: Tone = "failure") => notify(state, text, Date.now(), tone);
@@ -238,6 +244,10 @@ export async function runConsole(options: ConsoleOptions): Promise<void> {
238
244
  if (status.status && status.ok !== false) state.pendingRestart = Array.isArray(status.status.pendingRestart) ? status.status.pendingRestart : [];
239
245
  if (status.status && status.ok !== false) state.retainedConfig = Array.isArray(status.status.retainedConfig) ? status.status.retainedConfig : [];
240
246
  if (status.status) state.features = Array.isArray(status.status.features) ? status.status.features : [];
247
+ if (status.status && status.ok !== false) {
248
+ state.versions = consoleVersions(status.status.version, VERSION, installed.global, installed.plugin);
249
+ state.agentDrift = Array.isArray(status.status.agentDrift) ? status.status.agentDrift : [];
250
+ }
241
251
  if (status.status && status.ok !== false) {
242
252
  const rooms = status.status.rooms;
243
253
  state.rooms = rooms === undefined ? undefined : rooms === null ? null : Array.isArray(rooms) ? projectRoomStatus(rooms).sort((a, b) => a.name.localeCompare(b.name)) : null;
@@ -252,7 +262,9 @@ export async function runConsole(options: ConsoleOptions): Promise<void> {
252
262
  }
253
263
  if (status.status?.peers) state.peers = Object.fromEntries(Object.entries(status.status.peers).map(([peer, value]) => [peer, { ...(value as object), ...status.status.roleInfo?.[peer],
254
264
  ...(typeof status.status.ownerIsolation?.[peer] === "boolean" ? { ownerIsolation: status.status.ownerIsolation[peer] } : {}),
255
- ...(typeof status.status.ownerIsolationNotes?.[peer] === "string" ? { ownerIsolationNote: status.status.ownerIsolationNotes[peer] } : {}) }]));
265
+ ...(typeof status.status.ownerIsolationNotes?.[peer] === "string" ? { ownerIsolationNote: status.status.ownerIsolationNotes[peer] } : {}),
266
+ ...(status.status.peerVersions?.[peer]?.ahub ? { ahub: status.status.peerVersions[peer].ahub } : {}),
267
+ ...(status.status.peerVersions?.[peer]?.ahubTools ? { ahubTools: status.status.peerVersions[peer].ahubTools } : {}) }]));
256
268
  if (status.status && status.ok !== false) {
257
269
  state.taskWip = status.status.taskWip ?? {};
258
270
  state.attentionFacts = attentionFacts(status.status.attentionItems);
package/src/cli/help.ts CHANGED
@@ -29,7 +29,7 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
29
29
  ["ahub sdlc queue <owner/repo> | release <owner/repo> [live-issue...] [--json] [--color=auto|always|never]", "read-only merge and release evidence; open to any agent as public readback of the checkout's repositories, never an authorization"],
30
30
  ["ahub sdlc adopt-merge <task> --pr <n>", "record an already merged PR at the task's recorded head with green required checks and no open Important finding; approve and release dependents (person or current conductor)"],
31
31
  ["ahub sdlc merge <task> [--dry-run] [--json] [--color=auto|always|never]", "guarded squash merge of an approved task at its approved head after every gate is re-read; follows sdlc.toml auto_merge (off, dry-run, on); --dry-run only reports (person or conductor)"],
32
- ["ahub sdlc authorize-release <version> [--json] [--color=auto|always|never]", "approve this daemon checkout commit, version and fresh docs (person or unique configured conductor on the person's explicit release instruction naming the release in its own session; hub/task/review/file/peer relays never qualify; restart revokes)"],
32
+ ["ahub sdlc authorize-release <version> [--json] [--color=auto|always|never]", "approve this daemon checkout commit, configured version source and docs policy (person or unique configured conductor on the person's explicit release instruction naming the release in its own session; hub/task/review/file/peer relays never qualify; restart revokes)"],
33
33
  ["ahub sdlc release-guard -- <literal git push|gh release create|npm publish argv>", "read-only authorization preflight; init --release-guard installs the tag pre-push hook"],
34
34
  ["ahub sdlc release-guard-hook <remote-name> <remote-url>", "internal pre-push readback; validates version tags and forwards exact stdin on success"],
35
35
  ["ahub sdlc accept <task> --issue <n> [--repo owner/repo]", "accept the task's spec issue at its current body; build entry needs it in enforce (person only)"],
@@ -139,6 +139,7 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
139
139
  ["ahub budget execution configure <config.json> | disable <id> [--json] [--color=auto|always|never]", "opt-in limits on model calls, tool calls, time and tokens for pi and local"],
140
140
  ]],
141
141
  ["History and reports", [
142
+ ["ahub guidance probe register --file JSON [--json] | start --id HASH --revision N [--variant G1-HASH] [--json] | show --id HASH [--json] | cancel --id HASH --revision N [--json]", "person or configured conductor only: bounded T1 declaration and fake-only probe lifecycle; production execution is unavailable"],
142
143
  ["ahub guidance create --file JSON [--json]", "record a bounded immutable advisory proposal through current task authority; no activation or probe"],
143
144
  ["ahub guidance list --task N --task-created MS [--cursor TOKEN] [--json]", "bounded guidance metadata pages; withdrawn history and withheld fields remain explicit"],
144
145
  ["ahub guidance show --task N --task-created MS --id HASH [--json]", "screened editable-section diff selected by existing variant id, never a displayed experiment label"],
@@ -53,11 +53,16 @@ export function stableBunRuntime(options: { runtime?: string; pathRuntime?: stri
53
53
  return candidate && lexicalTarget(candidate) && samePath(candidate, runtime) ? candidate : runtime;
54
54
  }
55
55
 
56
+ /** The package root of the `ahub` on PATH, when it is a proven CLI entry (#1385). */
57
+ export function globalCliRoot(env: NodeJS.ProcessEnv = process.env): string | undefined {
58
+ const invocation = Bun.which("ahub", { PATH: env.PATH ?? "" });
59
+ return invocation ? pathPackageRoot(invocation) : undefined;
60
+ }
61
+
56
62
  /** Advice only; a staged daemon upgrade does not update the person's global CLI installation. */
57
63
  export function globalCliUpdateStep(version?: string, options: InstallPathOptions = {}): string {
58
64
  const env = options.env ?? process.env;
59
- const invocation = Bun.which("ahub", { PATH: env.PATH ?? "" });
60
- const root = invocation ? pathPackageRoot(invocation) : undefined;
65
+ const root = globalCliRoot(env);
61
66
  const generic = `update the global CLI${version ? ` to ${version}` : ""} the way it was installed`;
62
67
  if (!root) return generic;
63
68
  const global = join(env.BUN_INSTALL || join(options.home ?? homedir(), ".bun"), "install/global/node_modules");
package/src/cli/main.ts CHANGED
@@ -129,6 +129,7 @@ import { COMPLETION_SHELLS, completionScript } from "./completion.ts";
129
129
  import { agentShellCause, classifyPeerCommand, cliCommandLabel, detectCliIdentity, LIVE_TEST_PERSON_REFUSAL, liveTestRefusal, peerCommandRefusal } from "./identity.ts";
130
130
  import { recordCliAudit, recordDelegatedCliAudit } from "./identity-audit.ts";
131
131
  import { runConsole } from "./console.ts";
132
+ import { installedVersions } from "./console-versions.ts";
132
133
  import { paint, permissionBoundary, resolveColor, wrap, type Span } from "./console-state.ts";
133
134
  import { outputWidth, renderRuntimeModels, renderRoster, renderStatus, renderBoard, renderBacklog, renderBoardColumns, boardColumnModel, renderBudget, renderDoctor, renderProjects, renderQueue, renderTurns, renderOrphans, renderOrphanCleanup, renderQueueShow, renderModelsStatus, renderExecutionBudgetStatus, renderReport, renderUsage, renderLimits, renderTotal, type DoctorCheck } from "./output.ts";
134
135
  import { renderHelp, configuredAcpHelp } from "./help.ts";
@@ -248,12 +249,14 @@ const requireNamedPeerFeature = (hub: ControlClient, peer: string | undefined) =
248
249
  const projectConfig = () => {
249
250
  const config = loadConfig(cwd);
250
251
  for (const line of config.ignored ?? []) console.error(`note: ${line}; only a config file nobody committed may set it`);
252
+ for (const line of config.releasePolicyNotices ?? []) console.error(`note: ${line}`);
251
253
  return config;
252
254
  };
253
255
  const stateDir = selected.stateDir;
254
256
  var operationalAuditReady=false, operationalRefusalRecorded=false;
255
257
  const caller = declaredInstances ? detectCliIdentity(process.env, declaredInstances) : unboundCaller;
256
- const commandLabel = cliCommandLabel(cmd, args, projectCatalog);
258
+ const commandLabel = cmd === "guidance" && args[0] === "probe" && ["register", "start", "show", "cancel"].includes(args[1] ?? "")
259
+ ? `guidance probe ${args[1]}` : cliCommandLabel(cmd, args, projectCatalog);
257
260
  let commandAccess = classifyPeerCommand(cmd, args, projectCatalog);
258
261
  const continuationPeer = process.env.AGENTHUB_RECOVERY_CONDUCTOR;
259
262
  const continuationId = process.env.AGENTHUB_RECOVERY_OPERATION;
@@ -275,7 +278,10 @@ if (continuationPeer !== undefined) {
275
278
  }
276
279
  const conductorPeer = !liveTest && caller.role === "tools" && (recoveryRunnerContinuation || ["restart", "upgrade", "recovery"].includes(cmd) && commandAccess === "conductor") ? caller.peer : undefined;
277
280
  // Agent-authored content keeps its peer. Operational starts/holds may borrow console authority for live verification.
278
- const delegationRefused = liveTest && caller.role === "tools" && commandAccess !== "allowed" && liveTestRefusal(cmd, args);
281
+ const guidanceProbeDelegationRefused = liveTest && caller.role === "tools" && cmd === "guidance"
282
+ && args[0] === "probe" && ["register", "start", "show", "cancel"].includes(args[1] ?? "");
283
+ const delegationRefused = liveTest && caller.role === "tools" && commandAccess !== "allowed"
284
+ && (liveTestRefusal(cmd, args) || guidanceProbeDelegationRefused);
279
285
  const delegatedPeer = liveTest && caller.role === "tools" && commandAccess !== "allowed" && !delegationRefused ? caller.peer : undefined;
280
286
  const identity = delegatedPeer || recoveryLauncher ? { role: "console" as const } : caller;
281
287
  operationalAuditReady=identity.role==="tools" && commandAccess==="conductor" && conductorOperation(cmd,args)!==undefined;
@@ -872,6 +878,8 @@ const LOCAL_OPERATION_ARGS: Record<string, () => void> = {
872
878
  "source add": () => { const operands = args.filter(arg => arg !== "--json" && arg !== "--full" && !arg.startsWith("--color=")); if (operands[0] !== "add" || operands.length !== 2 || !operands[1]) fail(SOURCE_USAGE); },
873
879
  };
874
880
 
881
+ // Outside the command bodies: test/lifecycle-starting-1232.test.ts runs the `up` body as a plain function, where import.meta does not parse.
882
+ const consoleInstalled = () => installedVersions(join(import.meta.dir, "..", ".."));
875
883
  const commands: Record<string, () => Promise<void> | void> = {
876
884
  upgrade: () => upgrade("upgrade"),
877
885
  restart: () => upgrade("restart"),
@@ -1192,7 +1200,7 @@ const commands: Record<string, () => Promise<void> | void> = {
1192
1200
  if (args.some(arg => arg !== "--panels" && arg !== "--no-pet" && !arg.startsWith("--color=")) || args.filter(arg => arg.startsWith("--color=")).length > 1) fail("usage: ahub console [--panels] [--no-pet] [--color=auto|always|never]");
1193
1201
  const color = resolveColor(args.find(arg => arg.startsWith("--color="))?.slice("--color=".length), { isTTY: !!process.stdin.isTTY && !!process.stdout.isTTY, TERM: process.env.TERM, NO_COLOR: process.env.NO_COLOR });
1194
1202
  if (color instanceof Error) return fail("usage: ahub console [--panels] [--no-pet] [--color=auto|always|never]");
1195
- await runConsole({ client: await connect(), cwd, stateDir, liveTest, panels: args.includes("--panels"), noPet: args.includes("--no-pet"), color });
1203
+ await runConsole({ client: await connect(), cwd, stateDir, liveTest, panels: args.includes("--panels"), noPet: args.includes("--no-pet"), color, installed: consoleInstalled() });
1196
1204
  },
1197
1205
 
1198
1206
  up: async () => {
@@ -1209,7 +1217,7 @@ const commands: Record<string, () => Promise<void> | void> = {
1209
1217
  for (const line of await startProjectAgents({ root: cwd, stateDir }, chosen.agents)) console.log(terminalText(line));
1210
1218
  } catch (error) { console.error(`default agents were not started: ${terminalText((error as Error).message)}`); }
1211
1219
  }
1212
- if (process.stdin.isTTY && process.stdout.isTTY && !args.includes("--no-console")) await runConsole({ client: await connect(), cwd, stateDir, liveTest });
1220
+ if (process.stdin.isTTY && process.stdout.isTTY && !args.includes("--no-console")) await runConsole({ client: await connect(), cwd, stateDir, liveTest, installed: consoleInstalled() });
1213
1221
  },
1214
1222
 
1215
1223
  ...Object.fromEntries(BUILTIN_CLI_ENTRIES.map(entry => [entry.command, async () => {
@@ -1242,6 +1250,53 @@ const commands: Record<string, () => Promise<void> | void> = {
1242
1250
  guidance: async () => {
1243
1251
  const { parseGuidanceCommand, validateGuidancePageReply, validateGuidanceDiffReply, validateGuidanceReceipt, renderGuidance, renderGuidanceReceipt } = await import("./guidance.ts");
1244
1252
  const { parseGuidanceVariantV1, GUIDANCE_RECORD_MAX_BYTES } = await import("../hub/guidance-variants.ts");
1253
+ const { parseGuidanceProbeSubcommand, parseGuidanceProbeRegistration, GUIDANCE_PROBE_REGISTRATION_BYTES,
1254
+ parseGuidanceProbePublicReceipt, parseGuidanceProbePublicStatus } = await import("../hub/guidance-probes.ts");
1255
+ let probeCommand;
1256
+ try { probeCommand = parseGuidanceProbeSubcommand(args); } catch { return fail("invalid guidance probe command; use probe register, start, show or cancel with the documented bounded arguments"); }
1257
+ if (probeCommand) {
1258
+ if (liveTest) return fail("live-test cannot perform guidance probe operations as the person; use a current person or configured conductor session");
1259
+ let registration: ReturnType<typeof parseGuidanceProbeRegistration> | undefined;
1260
+ if (probeCommand.op === "register") {
1261
+ try {
1262
+ const fd = openSync(resolve(invokedFrom, probeCommand.file), constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
1263
+ try {
1264
+ if (!fstatSync(fd).isFile()) return fail("the guidance probe file must be a bounded regular JSON file");
1265
+ const bytes = Buffer.alloc(GUIDANCE_PROBE_REGISTRATION_BYTES + 1); let got = 0;
1266
+ while (got < bytes.length) { const read = readSync(fd, bytes, got, bytes.length - got, null); if (!read) break; got += read; }
1267
+ if (got > GUIDANCE_PROBE_REGISTRATION_BYTES) return fail("the guidance probe registration exceeds its derived envelope bound");
1268
+ registration = parseGuidanceProbeRegistration(JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes.subarray(0, got))));
1269
+ if (!registration) return fail("invalid guidance probe registration; retain its complete bounded manifest and snapshots without trimming");
1270
+ } finally { closeSync(fd); }
1271
+ } catch { return fail("cannot read a valid bounded guidance probe registration; check its closed V1 manifest and snapshots"); }
1272
+ }
1273
+ const hub = await connect();
1274
+ try {
1275
+ if (!hub.features.includes("guidance_probes")) return fail("running hub lacks guidance_probes; upgrade and restart the hub, then retry ahub guidance");
1276
+ const request = probeCommand.op === "register" ? { t: "guidance_probe_register", registration: registration! }
1277
+ : probeCommand.op === "start" ? { t: "guidance_probe_start", id: probeCommand.id, revision: probeCommand.revision, ...(probeCommand.variantId ? { variantId: probeCommand.variantId } : {}) }
1278
+ : probeCommand.op === "cancel" ? { t: "guidance_probe_cancel", id: probeCommand.id, revision: probeCommand.revision }
1279
+ : { t: "guidance_probe_show", id: probeCommand.id };
1280
+ const result = await hub.request(request);
1281
+ if (result.ok !== true) {
1282
+ const detail = terminalText(result.error ?? "guidance probe outcome is unconfirmed").replace(/[\r\n]+/g, " ").slice(0, 512);
1283
+ const nextStep = probeCommand.op === "register" ? "" : `; inspect ahub guidance probe show --id ${probeCommand.id} before any explicit retry`;
1284
+ return fail(`${detail}${nextStep}`);
1285
+ }
1286
+ if (probeCommand.op === "show") {
1287
+ const status = parseGuidanceProbePublicStatus(result.status);
1288
+ if (!status) return fail("guidance probe status is malformed; refresh its id and current task context");
1289
+ if (args.includes("--json")) console.log(JSON.stringify(status, null, 2));
1290
+ else console.log(`guidance probe ${status.id}: ${status.state}; revision ${status.revision}; evidence ${status.evidence}; workers ${status.counters.workerAttempts}; editors ${status.counters.editorAttempts}; model calls ${status.counters.modelCalls}; tool calls ${status.counters.toolCalls}; token usage ${status.counters.usageUnknown || status.counters.modelCalls === 0 ? "unknown" : status.counters.tokensObservedKnown}; cancelled ${status.cancelRequested ? "yes" : "no"}`);
1291
+ } else {
1292
+ const receipt = parseGuidanceProbePublicReceipt(result.receipt);
1293
+ if (!receipt) return fail("guidance probe receipt is malformed; inspect retained probe state before retrying");
1294
+ if (args.includes("--json")) console.log(JSON.stringify(receipt, null, 2));
1295
+ else console.log(`guidance probe ${receipt.id}: ${receipt.state}; revision ${receipt.revision}; evidence ${receipt.evidence}${receipt.already ? "; already recorded" : ""}`);
1296
+ }
1297
+ } finally { hub.close(); }
1298
+ return;
1299
+ }
1245
1300
  let command; try { command = parseGuidanceCommand(args); } catch (error) { return fail((error as Error).message); }
1246
1301
  if (liveTest && (command.op === "create" || command.op === "withdraw")) return fail("live-test cannot write guidance declarations as the person; use the current task actor without --live-test");
1247
1302
  let variant: ReturnType<typeof parseGuidanceVariantV1> | undefined;
@@ -3094,6 +3149,7 @@ const commands: Record<string, () => Promise<void> | void> = {
3094
3149
 
3095
3150
  const config = loadConfig(cwd);
3096
3151
  row(!config.ignored, "config", config.ignored ? `${config.ignored.join("; ")} (move them to .agenthub/config.local.json)` : "no machine-local field ignored");
3152
+ for (const line of config.releasePolicyNotices ?? []) row(false, "release policy", line);
3097
3153
  for (const line of config.retired ?? []) row(false, "retired setting", line);
3098
3154
  const { routing, errors: routingErrors } = inspectDoctorRouting(cwd);
3099
3155
  for (const error of routingErrors) row(false, "routing", error);
@@ -1,9 +1,9 @@
1
1
  import { globalCliUpdateStep, type InstallPathOptions } from "./install-paths.ts";
2
2
  import type { DoctorCheck } from "./output.ts";
3
3
  import { parseList, pluginState, type InstalledPlugin } from "./setup.ts";
4
+ import { displayVersion } from "../version.ts";
4
5
 
5
- const VERSION = /^[0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?(?:\+[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?$/;
6
- const version = (value: unknown): string | undefined => typeof value === "string" && value.length <= 64 && VERSION.exec(value)?.[0] === value ? value : undefined;
6
+ const version = displayVersion;
7
7
 
8
8
  /** Authenticated daemon status and the existing plugin inventory only. Suggestions never run an update. */
9
9
  export function runtimeVersionWarnings(daemonVersion: unknown, cliVersion: unknown, pluginVersion: unknown, install: InstallPathOptions = {}): DoctorCheck[] {
@@ -169,17 +169,21 @@ export function renderSdlcRelease(reply: unknown, columns?: number, now = Date.n
169
169
  const r = (reply as any)?.report ?? {};
170
170
  const out: Line[] = [...heading(`Release readiness ${r.repo ?? "unknown repository"}`, columns)];
171
171
  const w = 12;
172
- out.push(...pair("version", r.version ?? "unknown", columns, w), ...pair("head", short(r.head), columns, w), ...pair("tag", r.tag ? `${r.tag} at ${short(r.tagCommit)}` : "none", columns, w));
172
+ out.push(...pair("version", r.version ?? (r.releasePolicy ? "undetermined" : "unknown"), columns, w), ...pair("head", short(r.head), columns, w), ...pair("tag", r.tag ? `${r.tag} at ${short(r.tagCommit)}` : "none", columns, w));
173
173
  out.push(...pair("source ready", yes(r.sourceReady), columns, w, readyTone(r.sourceReady)), ...pair("native", String(r.native ?? "unverified"), columns, w, "attention"), ...pair("release ready", yes(r.ready), columns, w, readyTone(r.ready)));
174
174
  out.push(...pair("commits", `${plural(list(r.commits).length, "commit")} since the last tag`, columns, w));
175
175
  if (list(r.mergedPrs).length) out.push(...pair("merged PRs", list(r.mergedPrs).map((p: any) => `#${p.pr}`).join(", "), columns, w));
176
176
  const docs = r.documents;
177
- out.push(blank, ...pair("documents", docs ? `${docs.fresh ? "fresh" : "not fresh"}, ${plural(docs.errors ?? 0, "error")}, ${plural(list(docs.documents).length, "document")}` : "not read", columns, w, docs?.fresh ? "success" : "attention"));
178
- for (const d of list(docs?.documents)) if (d.state !== "fresh") out.push(...pair(d.state, `${d.path ?? "(path withheld)"}${d.dirty ? " (uncommitted changes)" : ""}`, columns, w, "attention", " "));
177
+ if (r.releasePolicy?.docsSource === "none") out.push(blank, ...pair("documents", r.releasePolicy.authorization === "matched" ? "none (explicit exemption recorded)" : "none (configured exemption; no matching authorization)", columns, w, "muted"));
178
+ else {
179
+ out.push(blank, ...pair("documents", docs ? `${docs.fresh ? "fresh" : "not fresh"}, ${plural(docs.errors ?? 0, "error")}, ${plural(list(docs.documents).length, "document")}` : "not read", columns, w, docs?.fresh ? "success" : "attention"));
180
+ for (const d of list(docs?.documents)) if (d.state !== "fresh") out.push(...pair(d.state, `${d.path ?? "(path withheld)"}${d.dirty ? " (uncommitted changes)" : ""}`, columns, w, "attention", " "));
181
+ }
182
+ if (r.releasePolicy) out.push(...pair("release policy", `version ${r.releasePolicy.versionSource}, docs ${r.releasePolicy.docsSource}, authorization ${r.releasePolicy.authorization}`, columns, w, r.releasePolicy.authorization === "matched" ? "success" : "attention"));
179
183
  if (list(r.liveIssues).length) out.push(blank, ...grid(["ISSUE", "STATE"], list(r.liveIssues).map((i: any) => [s(`#${i.id}`, "issueRef"), s(i.state, i.state === "closed" ? "success" : "attention")]), columns));
180
184
  const a = r.authorization;
181
185
  if (a) out.push(blank, ...pair("authorization", `${a.state}: version ${a.receipt?.version ?? "unknown"} at ${short(a.receipt?.commit)}, approved ${moment(a.receipt?.at, now)}`, columns, w, a.state === "matched" ? "success" : "attention"));
182
- else out.push(blank, ...pair("authorization", "none recorded: run ahub sdlc authorize-release <version>", columns, w, "muted"));
186
+ else out.push(blank, ...pair("authorization", r.releasePolicy ? `none recorded for ${r.releasePolicy.versionSource}: run ahub sdlc authorize-release <version>` : "none recorded: run ahub sdlc authorize-release <version>", columns, w, "muted"));
183
187
  for (const t of list(r.trains)) out.push(...pair(`train #${t.release?.id ?? "?"}`, `${t.readiness?.trigger ?? "unknown"}${list(t.readiness?.blockers).length ? `, ${list(t.readiness.blockers).join("; ")}` : ""}`, columns, w, list(t.readiness?.blockers).length ? "attention" : undefined));
184
188
  const rm = r.releaseMetrics;
185
189
  if (rm) {
@@ -249,7 +253,7 @@ export function renderAuthorization(authorization: unknown, columns?: number, no
249
253
  const w = 8;
250
254
  return [...heading("Release authorized", columns),
251
255
  ...pair("version", a?.version ?? "unknown", columns, w), ...pair("commit", short(a?.commit), columns, w), ...pair("by", a?.by ?? "unknown", columns, w),
252
- ...pair("at", moment(a?.at, now), columns, w), ...pair("docs", a?.docs ? `${a.docs.fresh ? "fresh" : "not fresh"}, ${plural(a.docs.documents ?? 0, "document")}, digest ${short(a.docs.digest)}` : "unknown", columns, w),
256
+ ...pair("at", moment(a?.at, now), columns, w), ...pair("docs", a?.docs?.source === "none" ? "none (explicit exemption)" : a?.docs ? `${a.docs.fresh ? "fresh" : "not fresh"}, ${plural(a.docs.documents ?? 0, "document")}, digest ${short(a.docs.digest)}` : "unknown", columns, w),
253
257
  ...pair("id", a?.id ?? "unknown", columns, w, "muted"), blank,
254
258
  ...para("A daemon restart revokes this authorization.", columns, "muted")];
255
259
  }
@@ -204,6 +204,8 @@ const schema: Record<string, Check> = {
204
204
  text_projection: v => { projectionConfig(v); },
205
205
  corpus: v => { corpusConfig(v); },
206
206
  specs: (v, k) => { block({ enabled: bool, review: words(["off", "report", "require"]), roots: strings, stamps_file: text })(v, k); parseSpecsConfig(v); },
207
+ // S6 owns this closed schema at the committed candidate boundary; config.local is ignored before runtime publication.
208
+ release: () => {},
207
209
  conductor: block({ feed: words(["own", "all", "off"]), approval_wait_s: number(0, 2_147_483_647 / 1000) }),
208
210
  budget: block({ gate: number(0, 1), stale_min: timerMinutes, poll_min: timerMinutes, checkpoint_timeout_s: timerSeconds, kimi_tokens_5h: number(0), wait_max_min: number(0) }),
209
211
  context: block({ gate: number(0, 1), stale_min: timerMinutes, max_assignment_used: number(0, 1) }),
@@ -259,7 +261,7 @@ export function validateRawConfig(raw: unknown, declarations?: InstancesConfig,
259
261
  }
260
262
  export function validateEffectiveConfig(value: unknown, catalog?: ProjectAdapterCatalog): asserts value is HubConfig {
261
263
  const raw = { ...object(value, "config") };
262
- delete raw.ignored; delete raw.retired; delete raw.permission_default_sources;
264
+ delete raw.ignored; delete raw.retired; delete raw.releasePolicyNotices; delete raw.permission_default_sources;
263
265
  validateRawConfig(raw, undefined, catalog);
264
266
  const profile = resolveProfile(raw.profile, raw.profile_overrides);
265
267
  for (const key of Object.keys(object(raw.checks, "checks"))) if (!["timeout_s", "runner", "remote", ...CLASSES, ...Object.keys(profile.classes)].includes(key)) fail(`checks.${key}`, "unknown task class");
@@ -327,7 +329,7 @@ export function configChanges(running: HubConfig, next: HubConfig, scopes: reado
327
329
  changes.push({ key, before, after, ...(stale ? { applies: "live" as const } : configApply(key, scopes)) });
328
330
  }
329
331
  };
330
- const clean = (v: HubConfig) => Object.fromEntries(Object.entries(v).filter(([key]) => !["ignored", "retired", "permission_default_sources"].includes(key)));
332
+ const clean = (v: HubConfig) => Object.fromEntries(Object.entries(v).filter(([key]) => !["ignored", "retired", "releasePolicyNotices", "permission_default_sources"].includes(key)));
331
333
  walk(clean(running), clean(next), ""); return changes.sort((a, b) => a.key.localeCompare(b.key));
332
334
  }
333
335
 
@@ -105,6 +105,8 @@ const drop = (file: Record<string, unknown>, path: string) => {
105
105
  * once resolved to the project root). A committed copy of the template sets them to defaults and asks git nothing.
106
106
  */
107
107
  export function stripUntrusted(file: Record<string, unknown>, defaults: object, cwd: string, name: string): string | undefined {
108
+ const releaseLocal = name === "config.local.json" && Object.hasOwn(file, "release");
109
+ if (releaseLocal) delete file.release;
108
110
  const research = file.research;
109
111
  if (research && typeof research === "object" && Object.hasOwn(research, "runners")) {
110
112
  if (name !== "config.local.json") throw new Error("research.runners requires untracked config.local.json");
@@ -114,7 +116,10 @@ export function stripUntrusted(file: Record<string, unknown>, defaults: object,
114
116
  if (name !== "config.local.json") delete file.rooms;
115
117
  const localOnly = name !== "config.local.json" && file.action_policy !== undefined;
116
118
  if (localOnly) delete file.action_policy;
117
- const originNotice = localOnly ? "action_policy ignored: only .agenthub/config.local.json may set it" : undefined;
119
+ const originNotice = [
120
+ localOnly ? "action_policy ignored: only .agenthub/config.local.json may set it" : undefined,
121
+ releaseLocal ? "release in .agenthub/config.local.json ignored: only committed .agenthub/config.json may set release policy" : undefined,
122
+ ].filter(Boolean).join("; ") || undefined;
118
123
  for (const p of ALL_MACHINE_LOCAL) if (!EMPTY_IS_VALUE.includes(p) && valueAt(file, p) !== undefined && !chooses(valueAt(file, p))) drop(file, p);
119
124
  const set = ALL_MACHINE_LOCAL.filter((p) => {
120
125
  const v = valueAt(file, p);
@@ -5,6 +5,7 @@ import { newToolRequestId, TOOL_WRITE_FEATURE, toolWriteOperation, toolWriteUnkn
5
5
  import { externalAdapterMetadata, externalInstanceCatalog, type ExternalInstanceCatalog, type ExternalAdapterMetadata } from "../adapters/external-metadata.ts";
6
6
  import { negotiateProtocol, protocolWindow, type ProtocolWindow } from "./protocol-window.ts";
7
7
  import { ControlWriteTelemetry, controlWriteMetadata, controlWriteSpan } from "./control-write-trace.ts";
8
+ import { VERSION } from "../version.ts";
8
9
 
9
10
  // The client has no authoritative task privacy view. Keep kind/timing only, never its args or task id.
10
11
  const clientWriteTelemetry = new ControlWriteTelemetry({ emit: line => {
@@ -21,7 +22,7 @@ export const PROTOCOL = 17;
21
22
  /** The descriptor's legacy protocol field remains this floor for previous published clients. */
22
23
  export const PROTOCOL_MIN = 16;
23
24
  // Literal metadata is read without executing a recovery target; consistency is pinned in tests.
24
- export const DAEMON_FEATURES = ["guidance_views", "guidance_variants", "execution_lineage", "model_overrides", "visuals", "project_autonomy", "conductor_recovery", "encrypted_rooms", "external_adapter_instances", "external_adapter_modules", "configured_acp", "native_hook_launch", "task_cancel", "invocation", "recovery_deferred_hub", "peer_instances", "role_stages", "task_planners", "release_trains", "reviewer_pool", "native_tui_launch", "terminal_owner", "cli_audit_delegated", "action_policy_floor", "calendar_schedules", "research_records", "research_dispatch", "research_dropped_offers", "research_experiments", "research_comparisons", "research_runners", "task_handoff", "session_identity", "schema_guard", "design_specs", "queue_discard_states", "tool_write_idempotency", "research_evidence", "review_comments", "questions", "accepted_delivery_settlement", "completions", "review_observer_input_state", "task_handoff_key", "task_handoff_seq", "peer_takeover"] as const;
25
+ export const DAEMON_FEATURES = ["guidance_views", "guidance_variants", "guidance_probes", "execution_lineage", "model_overrides", "visuals", "project_autonomy", "conductor_recovery", "encrypted_rooms", "external_adapter_instances", "external_adapter_modules", "configured_acp", "native_hook_launch", "task_cancel", "invocation", "recovery_deferred_hub", "peer_instances", "role_stages", "task_planners", "release_trains", "reviewer_pool", "native_tui_launch", "terminal_owner", "cli_audit_delegated", "action_policy_floor", "calendar_schedules", "research_records", "research_dispatch", "research_dropped_offers", "research_experiments", "research_comparisons", "research_runners", "task_handoff", "session_identity", "schema_guard", "design_specs", "queue_discard_states", "tool_write_idempotency", "research_evidence", "review_comments", "questions", "accepted_delivery_settlement", "completions", "review_observer_input_state", "task_handoff_key", "task_handoff_seq", "peer_takeover"] as const;
25
26
  /** Protocols a current coordinator may authenticate while upgrading a running source. */
26
27
  export const RECOVERY_SOURCE_PROTOCOLS = [9, 10, 11, 12, 13, 14, 15, 16, PROTOCOL] as const;
27
28
 
@@ -76,6 +77,8 @@ export interface Hello {
76
77
  retainStandby?: true;
77
78
  /** Display-only process id, never native-session or authorization evidence. */
78
79
  clientPid?: number;
80
+ /** #1385: the agent-hub version this client was built from. `connect` always sets it from `VERSION`; display only, never admission, compatibility or authorization evidence. */
81
+ clientVersion?: string;
79
82
  projectId?: string;
80
83
  instanceId?: string;
81
84
  projectRoot?: string;
@@ -230,7 +233,7 @@ export class ControlClient {
230
233
  client.pending.delete(msg.rid);
231
234
  done(msg);
232
235
  };
233
- ws.onopen = () => void client.request({ t: "hello", token: control.token, ...hello, ...expected, v: selected, vMin: remote?.vMin === undefined ? selected : Math.max(local.vMin, remote.vMin) }, timeoutMs).then((reply) => {
236
+ ws.onopen = () => void client.request({ t: "hello", token: control.token, ...hello, ...expected, clientVersion: VERSION, v: selected, vMin: remote?.vMin === undefined ? selected : Math.max(local.vMin, remote.vMin) }, timeoutMs).then((reply) => {
234
237
  if (reply.t !== "welcome" || reply.ok === false) return refuse(new Error(reply.error ?? "hub refused handshake"));
235
238
  if ((expected.projectId && reply.projectId !== expected.projectId) ||
236
239
  (expected.instanceId && reply.instanceId !== expected.instanceId) ||