@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.
- package/CHANGELOG.md +43 -0
- package/README.md +25 -4
- package/THIRD_PARTY_NOTICES.md +0 -18
- package/docs/agent-notes/README.md +71 -1
- package/docs/agent-notes/adapters.md +5 -2
- package/docs/agent-notes/bus.md +1 -0
- package/docs/agent-notes/daemon.md +7 -6
- package/docs/agent-notes/local-worker.md +1 -0
- package/docs/agent-notes/models.md +5 -3
- package/docs/agent-notes/tasks.md +9 -2
- package/docs/agent-notes/tests.md +1 -1
- package/docs/contracts/companion-cli-v1.json +70 -0
- package/docs/design/adapters.md +115 -2
- package/docs/design/agent-hub-architecture.md +10 -2
- package/docs/design/bus.md +8 -0
- package/docs/design/execution-reference.md +171 -11
- package/docs/design/guidance-experiments.md +438 -0
- package/docs/design/guidance-probes.md +802 -0
- package/docs/design/model-routes.md +1053 -0
- package/docs/design/supervision.md +121 -0
- package/docs/design/task-board.md +111 -0
- package/docs/dogfood.md +24 -15
- package/docs/events.md +20 -1
- package/docs/memory.md +3 -3
- package/docs/operations.md +366 -133
- package/docs/profiles.md +2 -2
- package/docs/quickstart.md +114 -3
- package/docs/research.md +5 -3
- package/docs/sdlc.md +113 -7
- package/docs/security.md +88 -6
- package/docs/specs/2026-09-19-agent-hub-design.md +14 -11
- package/docs/specs/2026-10-04-switchyard-source-port-design.md +3 -1
- package/docs/verification/2026-10-25-qwen-dual-output-t0.md +22 -0
- package/docs/verification/2026-11-08-qwen-0269-model-setter-1317.md +25 -11
- package/docs/verification/2026-11-09-qwen-0270-acp.md +181 -0
- package/docs/verification/2026-11-09-qwen-0270-model-setter-1317.md +61 -0
- package/docs/verification/2026-11-10-0.36.0.md +59 -0
- package/docs/verification/2026-11-10-claude-implementer-2.1.322.md +59 -0
- package/docs/verification/2026-11-10-qwen-0270-dual-output.md +367 -0
- package/docs/verification/2026-11-10-qwen-0271-dual-output.md +101 -0
- package/docs/verification/2026-11-11-0.37.0.md +40 -0
- package/docs/verification/2026-11-11-guidance-probe-t2-1226.md +153 -0
- package/docs/verification/2026-11-11-qwen-setter-suggestions-off.md +167 -0
- package/docs/verification/claude-shell-wrapper-native.py +1 -1
- package/docs/verified.json +27 -27
- package/package.json +3 -4
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/kimi-hook.js +3570 -1800
- package/plugins/agent-hub/server.js +4112 -1913
- package/src/adapters/channel-peer.ts +7 -1
- package/src/adapters/claude-channel.ts +7 -4
- package/src/adapters/compat.ts +10 -10
- package/src/adapters/local-probe.ts +174 -0
- package/src/adapters/local-worker.ts +233 -22
- package/src/adapters/qwen-dual.ts +324 -44
- package/src/cli/console-state.ts +25 -6
- package/src/cli/console-versions.ts +99 -0
- package/src/cli/console.ts +13 -1
- package/src/cli/guidance.ts +67 -0
- package/src/cli/help.ts +12 -4
- package/src/cli/identity.ts +10 -3
- package/src/cli/init-prompt.ts +15 -2
- package/src/cli/init-required-checks.ts +122 -0
- package/src/cli/init-settings.ts +10 -4
- package/src/cli/init.ts +39 -3
- package/src/cli/install-paths.ts +7 -2
- package/src/cli/lineage.ts +78 -0
- package/src/cli/main.ts +171 -14
- package/src/cli/runtime-version-warning.ts +2 -2
- package/src/cli/sdlc-output.ts +9 -5
- package/src/cli/setup-research.ts +10 -0
- package/src/hub/autonomy-defaults.ts +20 -9
- package/src/hub/board.ts +346 -4
- package/src/hub/build-entry.ts +11 -0
- package/src/hub/bus.ts +12 -0
- package/src/hub/ci-watch.ts +4 -4
- package/src/hub/config-apply.ts +6 -3
- package/src/hub/config-trust.ts +7 -1
- package/src/hub/control-client.ts +5 -2
- package/src/hub/daemon.ts +508 -26
- package/src/hub/delivery-hints.ts +4 -2
- package/src/hub/delivery-journal.ts +50 -2
- package/src/hub/delivery-public.ts +51 -0
- package/src/hub/dogfood-profile.ts +8 -4
- package/src/hub/events.ts +3 -2
- package/src/hub/execution-lineage-owner.ts +272 -0
- package/src/hub/execution-lineage.ts +52 -8
- package/src/hub/execution-links.ts +85 -0
- package/src/hub/guidance-probe-store.ts +713 -0
- package/src/hub/guidance-probes.ts +358 -0
- package/src/hub/guidance-variants.ts +398 -0
- package/src/hub/handoff.ts +1 -0
- package/src/hub/hub-tools.ts +43 -2
- package/src/hub/inference.ts +18 -5
- package/src/hub/manager.ts +44 -2
- package/src/hub/memory-policy.ts +2 -2
- package/src/hub/operational-authority.ts +13 -1
- package/src/hub/peers.ts +6 -1
- package/src/hub/planning.ts +1 -1
- package/src/hub/ports.ts +1 -1
- package/src/hub/progress.ts +47 -23
- package/src/hub/report.ts +2 -0
- package/src/hub/research.ts +1 -0
- package/src/hub/restart.ts +20 -0
- package/src/hub/roles.ts +26 -0
- package/src/hub/routing.ts +4 -1
- package/src/hub/sdlc-merge.ts +39 -1
- package/src/hub/sdlc-release-authorization.ts +139 -17
- package/src/hub/sdlc-release-policy.ts +100 -0
- package/src/hub/sdlc-release.ts +60 -8
- package/src/hub/sdlc.ts +62 -11
- package/src/hub/settings.ts +2 -0
- package/src/hub/supervision-proposals.ts +405 -0
- package/src/hub/supervision-rules.ts +388 -0
- package/src/hub/supervision.ts +2 -0
- package/src/hub/task-approval.ts +2 -2
- package/src/hub/task-repository.ts +5 -0
- package/src/hub/tasks.ts +917 -53
- package/src/local/probe-errors.ts +28 -0
- package/src/local/probe-sandbox.ts +224 -0
- package/src/local/probe-types.ts +108 -0
- package/src/local/probe-workspace.ts +237 -0
- package/src/local/sandbox.ts +71 -2
- package/src/local/tools.ts +135 -9
- package/src/memory/capture.ts +2 -2
- package/src/models/relay.ts +9 -2
- package/src/models/route/advisor-trigger.ts +88 -0
- package/src/models/route/config.ts +39 -8
- package/src/models/route/conversation-view.ts +179 -0
- package/src/models/route/decision-evidence.ts +1 -1
- package/src/models/route/decision.ts +193 -26
- package/src/models/route/escalation-control.ts +30 -0
- package/src/models/route/hub-prompts.ts +97 -0
- package/src/models/route/judge-choice.ts +155 -0
- package/src/models/route/judge-replies.ts +102 -0
- package/src/models/route/labels.ts +14 -70
- package/src/models/route/observation-signals.ts +250 -0
- package/src/models/route/plan-execute-choice.ts +27 -0
- package/src/models/route/relay-selector.ts +10 -9
- package/src/models/route/runtime.ts +129 -60
- package/src/models/route/stage-diagnostics.ts +22 -0
- package/src/models/route/stage-evidence.ts +55 -0
- package/src/models/route/stage-fallback.ts +58 -0
- package/src/models/route/stage-input.ts +155 -0
- package/src/models/route/stage.ts +5 -147
- package/src/models/route/turn-state.ts +77 -0
- package/src/omniroute/client.ts +3 -0
- package/src/ui/guidance-panel.ts +156 -0
- package/src/ui/guidance-view.ts +43 -0
- package/src/ui/lineage-view.ts +34 -0
- package/src/ui/plugin.ts +141 -27
- package/src/version.ts +4 -0
- package/templates/adec/README.md +32 -0
- package/templates/adec/ahub.plan-execute.json +23 -0
- package/templates/adec/ahub.stage.json +23 -0
- package/LICENSES/Apache-2.0.txt +0 -204
- package/src/models/route/advisor.ts +0 -102
- package/src/models/route/escalation.ts +0 -82
- package/src/models/route/judge.ts +0 -23
- package/src/models/route/normalize.ts +0 -103
- package/src/models/route/plan-execute.ts +0 -52
- package/src/models/route/prompts.ts +0 -8
- package/src/models/route/signals.ts +0 -247
- package/src/models/route/state.ts +0 -54
- 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
|
+
}
|