@staix/agent-hub 0.35.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 (165) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +25 -4
  3. package/THIRD_PARTY_NOTICES.md +0 -18
  4. package/docs/agent-notes/README.md +71 -1
  5. package/docs/agent-notes/adapters.md +5 -2
  6. package/docs/agent-notes/bus.md +1 -0
  7. package/docs/agent-notes/daemon.md +7 -6
  8. package/docs/agent-notes/local-worker.md +1 -0
  9. package/docs/agent-notes/models.md +5 -3
  10. package/docs/agent-notes/tasks.md +9 -2
  11. package/docs/agent-notes/tests.md +1 -1
  12. package/docs/contracts/companion-cli-v1.json +70 -0
  13. package/docs/design/adapters.md +115 -2
  14. package/docs/design/agent-hub-architecture.md +10 -2
  15. package/docs/design/bus.md +8 -0
  16. package/docs/design/execution-reference.md +171 -11
  17. package/docs/design/guidance-experiments.md +438 -0
  18. package/docs/design/guidance-probes.md +802 -0
  19. package/docs/design/model-routes.md +1053 -0
  20. package/docs/design/supervision.md +121 -0
  21. package/docs/design/task-board.md +111 -0
  22. package/docs/dogfood.md +24 -15
  23. package/docs/events.md +20 -1
  24. package/docs/memory.md +3 -3
  25. package/docs/operations.md +366 -133
  26. package/docs/profiles.md +2 -2
  27. package/docs/quickstart.md +114 -3
  28. package/docs/research.md +5 -3
  29. package/docs/sdlc.md +113 -7
  30. package/docs/security.md +88 -6
  31. package/docs/specs/2026-09-19-agent-hub-design.md +14 -11
  32. package/docs/specs/2026-10-04-switchyard-source-port-design.md +3 -1
  33. package/docs/verification/2026-10-25-qwen-dual-output-t0.md +22 -0
  34. package/docs/verification/2026-11-08-qwen-0269-model-setter-1317.md +25 -11
  35. package/docs/verification/2026-11-09-qwen-0270-acp.md +181 -0
  36. package/docs/verification/2026-11-09-qwen-0270-model-setter-1317.md +61 -0
  37. package/docs/verification/2026-11-10-0.36.0.md +59 -0
  38. package/docs/verification/2026-11-10-claude-implementer-2.1.322.md +59 -0
  39. package/docs/verification/2026-11-10-qwen-0270-dual-output.md +367 -0
  40. package/docs/verification/2026-11-10-qwen-0271-dual-output.md +101 -0
  41. package/docs/verification/2026-11-11-0.37.0.md +40 -0
  42. package/docs/verification/2026-11-11-guidance-probe-t2-1226.md +153 -0
  43. package/docs/verification/2026-11-11-qwen-setter-suggestions-off.md +167 -0
  44. package/docs/verification/claude-shell-wrapper-native.py +1 -1
  45. package/docs/verified.json +27 -27
  46. package/package.json +3 -4
  47. package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
  48. package/plugins/agent-hub/kimi-hook.js +3570 -1800
  49. package/plugins/agent-hub/server.js +4112 -1913
  50. package/src/adapters/channel-peer.ts +7 -1
  51. package/src/adapters/claude-channel.ts +7 -4
  52. package/src/adapters/compat.ts +10 -10
  53. package/src/adapters/local-probe.ts +174 -0
  54. package/src/adapters/local-worker.ts +233 -22
  55. package/src/adapters/qwen-dual.ts +324 -44
  56. package/src/cli/console-state.ts +25 -6
  57. package/src/cli/console-versions.ts +99 -0
  58. package/src/cli/console.ts +13 -1
  59. package/src/cli/guidance.ts +67 -0
  60. package/src/cli/help.ts +12 -4
  61. package/src/cli/identity.ts +10 -3
  62. package/src/cli/init-prompt.ts +15 -2
  63. package/src/cli/init-required-checks.ts +122 -0
  64. package/src/cli/init-settings.ts +10 -4
  65. package/src/cli/init.ts +39 -3
  66. package/src/cli/install-paths.ts +7 -2
  67. package/src/cli/lineage.ts +78 -0
  68. package/src/cli/main.ts +171 -14
  69. package/src/cli/runtime-version-warning.ts +2 -2
  70. package/src/cli/sdlc-output.ts +9 -5
  71. package/src/cli/setup-research.ts +10 -0
  72. package/src/hub/autonomy-defaults.ts +20 -9
  73. package/src/hub/board.ts +346 -4
  74. package/src/hub/build-entry.ts +11 -0
  75. package/src/hub/bus.ts +12 -0
  76. package/src/hub/ci-watch.ts +4 -4
  77. package/src/hub/config-apply.ts +6 -3
  78. package/src/hub/config-trust.ts +7 -1
  79. package/src/hub/control-client.ts +5 -2
  80. package/src/hub/daemon.ts +508 -26
  81. package/src/hub/delivery-hints.ts +4 -2
  82. package/src/hub/delivery-journal.ts +50 -2
  83. package/src/hub/delivery-public.ts +51 -0
  84. package/src/hub/dogfood-profile.ts +8 -4
  85. package/src/hub/events.ts +3 -2
  86. package/src/hub/execution-lineage-owner.ts +272 -0
  87. package/src/hub/execution-lineage.ts +52 -8
  88. package/src/hub/execution-links.ts +85 -0
  89. package/src/hub/guidance-probe-store.ts +713 -0
  90. package/src/hub/guidance-probes.ts +358 -0
  91. package/src/hub/guidance-variants.ts +398 -0
  92. package/src/hub/handoff.ts +1 -0
  93. package/src/hub/hub-tools.ts +43 -2
  94. package/src/hub/inference.ts +18 -5
  95. package/src/hub/manager.ts +44 -2
  96. package/src/hub/memory-policy.ts +2 -2
  97. package/src/hub/operational-authority.ts +13 -1
  98. package/src/hub/peers.ts +6 -1
  99. package/src/hub/planning.ts +1 -1
  100. package/src/hub/ports.ts +1 -1
  101. package/src/hub/progress.ts +47 -23
  102. package/src/hub/report.ts +2 -0
  103. package/src/hub/research.ts +1 -0
  104. package/src/hub/restart.ts +20 -0
  105. package/src/hub/roles.ts +26 -0
  106. package/src/hub/routing.ts +4 -1
  107. package/src/hub/sdlc-merge.ts +39 -1
  108. package/src/hub/sdlc-release-authorization.ts +139 -17
  109. package/src/hub/sdlc-release-policy.ts +100 -0
  110. package/src/hub/sdlc-release.ts +60 -8
  111. package/src/hub/sdlc.ts +62 -11
  112. package/src/hub/settings.ts +2 -0
  113. package/src/hub/supervision-proposals.ts +405 -0
  114. package/src/hub/supervision-rules.ts +388 -0
  115. package/src/hub/supervision.ts +2 -0
  116. package/src/hub/task-approval.ts +2 -2
  117. package/src/hub/task-repository.ts +5 -0
  118. package/src/hub/tasks.ts +917 -53
  119. package/src/local/probe-errors.ts +28 -0
  120. package/src/local/probe-sandbox.ts +224 -0
  121. package/src/local/probe-types.ts +108 -0
  122. package/src/local/probe-workspace.ts +237 -0
  123. package/src/local/sandbox.ts +71 -2
  124. package/src/local/tools.ts +135 -9
  125. package/src/memory/capture.ts +2 -2
  126. package/src/models/relay.ts +9 -2
  127. package/src/models/route/advisor-trigger.ts +88 -0
  128. package/src/models/route/config.ts +39 -8
  129. package/src/models/route/conversation-view.ts +179 -0
  130. package/src/models/route/decision-evidence.ts +1 -1
  131. package/src/models/route/decision.ts +193 -26
  132. package/src/models/route/escalation-control.ts +30 -0
  133. package/src/models/route/hub-prompts.ts +97 -0
  134. package/src/models/route/judge-choice.ts +155 -0
  135. package/src/models/route/judge-replies.ts +102 -0
  136. package/src/models/route/labels.ts +14 -70
  137. package/src/models/route/observation-signals.ts +250 -0
  138. package/src/models/route/plan-execute-choice.ts +27 -0
  139. package/src/models/route/relay-selector.ts +10 -9
  140. package/src/models/route/runtime.ts +129 -60
  141. package/src/models/route/stage-diagnostics.ts +22 -0
  142. package/src/models/route/stage-evidence.ts +55 -0
  143. package/src/models/route/stage-fallback.ts +58 -0
  144. package/src/models/route/stage-input.ts +155 -0
  145. package/src/models/route/stage.ts +5 -147
  146. package/src/models/route/turn-state.ts +77 -0
  147. package/src/omniroute/client.ts +3 -0
  148. package/src/ui/guidance-panel.ts +156 -0
  149. package/src/ui/guidance-view.ts +43 -0
  150. package/src/ui/lineage-view.ts +34 -0
  151. package/src/ui/plugin.ts +141 -27
  152. package/src/version.ts +4 -0
  153. package/templates/adec/README.md +32 -0
  154. package/templates/adec/ahub.plan-execute.json +23 -0
  155. package/templates/adec/ahub.stage.json +23 -0
  156. package/LICENSES/Apache-2.0.txt +0 -204
  157. package/src/models/route/advisor.ts +0 -102
  158. package/src/models/route/escalation.ts +0 -82
  159. package/src/models/route/judge.ts +0 -23
  160. package/src/models/route/normalize.ts +0 -103
  161. package/src/models/route/plan-execute.ts +0 -52
  162. package/src/models/route/prompts.ts +0 -8
  163. package/src/models/route/signals.ts +0 -247
  164. package/src/models/route/state.ts +0 -54
  165. package/src/models/route/text.ts +0 -61
@@ -0,0 +1,85 @@
1
+ import { createHash } from "node:crypto";
2
+ import { types } from "node:util";
3
+ import { executionReferenceKey, executionText, parseExecutionReference, EXECUTION_REFERENCE_LIMITS, type ExecutionReferenceV1 } from "./execution-reference.ts";
4
+
5
+ export const EXECUTION_LINK_LIMITS = Object.freeze({ perTask: 64, read: 65, referenceBytes: 2048, actor: 32 });
6
+ export interface ExecutionLinkInput {
7
+ taskId: number; taskCreated: number; flowRevision: number;
8
+ from?: ExecutionReferenceV1; reference: ExecutionReferenceV1;
9
+ }
10
+ export interface ExecutionLinkRecord {
11
+ id: string; projectKey: string; taskId: number; taskCreated: number;
12
+ from: ExecutionReferenceV1; reference: ExecutionReferenceV1;
13
+ strength: "declared"; recordedBy: string; recordedAt: number;
14
+ }
15
+ export interface ExecutionLinkFence { by: string; at: number }
16
+ export class ExecutionLinkError extends Error {
17
+ constructor(readonly code: "invalid" | "changed" | "limit" | "corrupt") {
18
+ super({
19
+ invalid: "invalid execution reference metadata; read the current task and supply its identity, revision and bounded ExecutionReferenceV1 fields before retrying",
20
+ changed: "execution reference task authority or revision changed; read the current task and retry with an authorized current role outside private context",
21
+ limit: "execution reference task limit reached; inspect the recorded lineage and reuse an existing reference before adding another",
22
+ corrupt: "execution reference storage is invalid; stop the hub, restore a trusted hub.db backup, then restart and retry",
23
+ }[code]);
24
+ this.name = "ExecutionLinkError";
25
+ }
26
+ }
27
+ const invalid = (): never => { throw new ExecutionLinkError("invalid"); };
28
+ function object(value: unknown, keys: readonly string[]): Record<string, unknown> {
29
+ if (!value || typeof value !== "object" || types.isProxy(value) || Array.isArray(value)
30
+ || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) return invalid();
31
+ const own = Reflect.ownKeys(value);
32
+ if (own.length > keys.length) return invalid();
33
+ const result: Record<string, unknown> = Object.create(null);
34
+ for (const key of own) {
35
+ if (typeof key !== "string" || !keys.includes(key)) return invalid();
36
+ const field = Object.getOwnPropertyDescriptor(value, key);
37
+ if (!field || !("value" in field) || !field.enumerable) return invalid();
38
+ result[key] = field.value;
39
+ }
40
+ return result;
41
+ }
42
+ export const executionLinkInteger = (value: unknown, minimum = 0): value is number =>
43
+ typeof value === "number" && Number.isSafeInteger(value) && value >= minimum;
44
+ export const executionLinkActor = (value: unknown): value is string =>
45
+ typeof value === "string" && value.length <= EXECUTION_LINK_LIMITS.actor && /^[a-z][a-z0-9-]*$/.test(value);
46
+ export function parseExecutionLinkInput(value: unknown): ExecutionLinkInput {
47
+ try {
48
+ const input = object(value, ["taskId", "taskCreated", "flowRevision", "from", "reference"]);
49
+ if (!executionLinkInteger(input.taskId, 1) || !executionLinkInteger(input.taskCreated) || !executionLinkInteger(input.flowRevision)) return invalid();
50
+ return { taskId: input.taskId, taskCreated: input.taskCreated, flowRevision: input.flowRevision,
51
+ ...(Object.hasOwn(input, "from") ? { from: parseExecutionReference(input.from) } : {}), reference: parseExecutionReference(input.reference) };
52
+ } catch { return invalid(); }
53
+ }
54
+ /** Task epoch is an existing source identity. Mutable history revision remains a separate write fence. */
55
+ export function taskExecutionReference(projectKey: string, taskId: number, taskCreated: number): ExecutionReferenceV1 {
56
+ if (!executionLinkInteger(taskId, 1) || !executionLinkInteger(taskCreated)) return invalid();
57
+ try { return parseExecutionReference({ v: 1, tool: "ahub", projectKey, kind: "task", id: `${taskId}:${taskCreated}` }); }
58
+ catch { return invalid(); }
59
+ }
60
+ export function executionLinkReferences(projectKey: string, value: ExecutionLinkInput): { from: ExecutionReferenceV1; reference: ExecutionReferenceV1 } {
61
+ if (!executionText(projectKey, EXECUTION_REFERENCE_LIMITS.projectKey)) return invalid();
62
+ const input = parseExecutionLinkInput(value), from = input.from ?? taskExecutionReference(projectKey, input.taskId, input.taskCreated);
63
+ if (from.tool !== "ahub" || from.projectKey !== projectKey || input.reference.tool === "ahub" && input.reference.projectKey !== projectKey) return invalid();
64
+ return { from, reference: input.reference };
65
+ }
66
+ export const executionReferenceDigest = (ref: ExecutionReferenceV1): string => createHash("sha256").update(executionReferenceKey(ref)).digest("hex");
67
+ /** Actor, time and observed task revision are guards/audit, not dedup identity. */
68
+ export function executionLinkId(projectKey: string, value: ExecutionLinkInput): string {
69
+ const input = parseExecutionLinkInput(value), refs = executionLinkReferences(projectKey, input);
70
+ return createHash("sha256").update(JSON.stringify(["agent-hub.execution-link/v1", projectKey, input.taskId, input.taskCreated, refs.from, refs.reference])).digest("hex");
71
+ }
72
+ /** Stored rows are authenticated by their owner read, not by this address/digest validation. */
73
+ export function parseExecutionLinkRecord(value: unknown): ExecutionLinkRecord {
74
+ try {
75
+ const row = object(value, ["id", "projectKey", "taskId", "taskCreated", "from", "reference", "strength", "recordedBy", "recordedAt"]);
76
+ if (typeof row.id !== "string" || !/^[a-f0-9]{64}$/.test(row.id) || !executionText(row.projectKey, EXECUTION_REFERENCE_LIMITS.projectKey)
77
+ || !executionLinkInteger(row.taskId, 1) || !executionLinkInteger(row.taskCreated) || row.strength !== "declared"
78
+ || !executionLinkActor(row.recordedBy) || !executionLinkInteger(row.recordedAt)) throw new Error();
79
+ const input = { taskId: row.taskId, taskCreated: row.taskCreated, flowRevision: 0, from: parseExecutionReference(row.from), reference: parseExecutionReference(row.reference) };
80
+ const refs = executionLinkReferences(row.projectKey, input);
81
+ if (executionLinkId(row.projectKey, input) !== row.id) throw new Error();
82
+ return { id: row.id, projectKey: row.projectKey, taskId: row.taskId, taskCreated: row.taskCreated, ...refs,
83
+ strength: "declared", recordedBy: row.recordedBy, recordedAt: row.recordedAt };
84
+ } catch { throw new ExecutionLinkError("corrupt"); }
85
+ }