@staix/agent-hub 0.35.0 → 0.36.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 (104) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +21 -4
  3. package/docs/agent-notes/README.md +60 -0
  4. package/docs/agent-notes/adapters.md +5 -2
  5. package/docs/agent-notes/bus.md +1 -0
  6. package/docs/agent-notes/daemon.md +5 -4
  7. package/docs/agent-notes/models.md +4 -3
  8. package/docs/agent-notes/tasks.md +8 -1
  9. package/docs/agent-notes/tests.md +1 -0
  10. package/docs/design/adapters.md +72 -0
  11. package/docs/design/agent-hub-architecture.md +1 -1
  12. package/docs/design/bus.md +8 -0
  13. package/docs/design/execution-reference.md +171 -11
  14. package/docs/design/guidance-experiments.md +438 -0
  15. package/docs/design/model-routes.md +628 -0
  16. package/docs/design/supervision.md +121 -0
  17. package/docs/design/task-board.md +111 -0
  18. package/docs/dogfood.md +15 -4
  19. package/docs/operations.md +291 -22
  20. package/docs/profiles.md +2 -2
  21. package/docs/quickstart.md +106 -1
  22. package/docs/research.md +4 -2
  23. package/docs/sdlc.md +108 -4
  24. package/docs/security.md +67 -5
  25. package/docs/specs/2026-09-19-agent-hub-design.md +5 -4
  26. package/docs/verification/2026-10-25-qwen-dual-output-t0.md +22 -0
  27. package/docs/verification/2026-11-09-qwen-0270-acp.md +181 -0
  28. package/docs/verification/2026-11-09-qwen-0270-model-setter-1317.md +46 -0
  29. package/docs/verification/2026-11-10-0.36.0.md +59 -0
  30. package/docs/verification/2026-11-10-claude-implementer-2.1.322.md +59 -0
  31. package/docs/verification/2026-11-10-qwen-0270-dual-output.md +367 -0
  32. package/docs/verification/2026-11-10-qwen-0271-dual-output.md +101 -0
  33. package/docs/verification/claude-shell-wrapper-native.py +1 -1
  34. package/docs/verified.json +27 -27
  35. package/package.json +1 -1
  36. package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
  37. package/plugins/agent-hub/kimi-hook.js +1201 -368
  38. package/plugins/agent-hub/server.js +1682 -431
  39. package/src/adapters/claude-channel.ts +7 -4
  40. package/src/adapters/compat.ts +10 -10
  41. package/src/adapters/local-worker.ts +1 -1
  42. package/src/adapters/qwen-dual.ts +324 -44
  43. package/src/cli/guidance.ts +67 -0
  44. package/src/cli/help.ts +10 -3
  45. package/src/cli/identity.ts +10 -3
  46. package/src/cli/init-prompt.ts +15 -2
  47. package/src/cli/init-required-checks.ts +122 -0
  48. package/src/cli/init-settings.ts +10 -4
  49. package/src/cli/init.ts +39 -3
  50. package/src/cli/lineage.ts +78 -0
  51. package/src/cli/main.ts +111 -10
  52. package/src/cli/setup-research.ts +10 -0
  53. package/src/hub/autonomy-defaults.ts +20 -9
  54. package/src/hub/board.ts +346 -4
  55. package/src/hub/build-entry.ts +11 -0
  56. package/src/hub/bus.ts +12 -0
  57. package/src/hub/ci-watch.ts +4 -4
  58. package/src/hub/config-apply.ts +2 -1
  59. package/src/hub/config-trust.ts +1 -0
  60. package/src/hub/control-client.ts +1 -1
  61. package/src/hub/daemon.ts +342 -20
  62. package/src/hub/delivery-hints.ts +4 -2
  63. package/src/hub/delivery-journal.ts +50 -2
  64. package/src/hub/delivery-public.ts +51 -0
  65. package/src/hub/dogfood-profile.ts +8 -4
  66. package/src/hub/execution-lineage-owner.ts +272 -0
  67. package/src/hub/execution-lineage.ts +52 -8
  68. package/src/hub/execution-links.ts +85 -0
  69. package/src/hub/guidance-variants.ts +398 -0
  70. package/src/hub/handoff.ts +1 -0
  71. package/src/hub/hub-tools.ts +43 -2
  72. package/src/hub/manager.ts +44 -2
  73. package/src/hub/memory-policy.ts +2 -2
  74. package/src/hub/peers.ts +1 -1
  75. package/src/hub/planning.ts +1 -1
  76. package/src/hub/progress.ts +24 -7
  77. package/src/hub/restart.ts +13 -0
  78. package/src/hub/roles.ts +26 -0
  79. package/src/hub/routing.ts +4 -1
  80. package/src/hub/sdlc-merge.ts +39 -1
  81. package/src/hub/sdlc-release.ts +1 -1
  82. package/src/hub/sdlc.ts +62 -11
  83. package/src/hub/settings.ts +2 -0
  84. package/src/hub/supervision-proposals.ts +405 -0
  85. package/src/hub/supervision-rules.ts +388 -0
  86. package/src/hub/supervision.ts +2 -0
  87. package/src/hub/task-approval.ts +2 -2
  88. package/src/hub/task-repository.ts +5 -0
  89. package/src/hub/tasks.ts +603 -50
  90. package/src/memory/capture.ts +2 -2
  91. package/src/models/relay.ts +9 -2
  92. package/src/models/route/config.ts +27 -0
  93. package/src/models/route/decision.ts +87 -15
  94. package/src/models/route/relay-selector.ts +8 -7
  95. package/src/models/route/runtime.ts +22 -16
  96. package/src/models/route/stage-diagnostics.ts +22 -0
  97. package/src/models/route/stage-evidence.ts +55 -0
  98. package/src/models/route/stage-fallback.ts +58 -0
  99. package/src/models/route/stage-input.ts +155 -0
  100. package/src/models/route/stage.ts +5 -147
  101. package/src/ui/guidance-panel.ts +156 -0
  102. package/src/ui/guidance-view.ts +43 -0
  103. package/src/ui/lineage-view.ts +34 -0
  104. package/src/ui/plugin.ts +71 -7
package/src/ui/plugin.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { guidancePanelAssets } from "./guidance-panel.ts";
2
+ import { guidanceLines } from "./guidance-view.ts";
1
3
  /**
2
4
  * acon console plugin for agent-hub (#935, plan entelecheia/ai-workspace#60 §2.5).
3
5
  *
@@ -15,6 +17,8 @@ import { Registry } from "../hub/registry.ts";
15
17
  import { projectConsole, type Lifecycle, type ManagerOptions } from "../hub/manager.ts";
16
18
  // lifecycle.ts reaches the whole daemon; it is imported only when a project is inspected, started or stopped.
17
19
  import { DASHBOARD_VIEWS, renderDashboard } from "../hub/ui.ts";
20
+ import { parseLineageResult } from "../hub/execution-lineage.ts";
21
+ import { executionLineageLines } from "./lineage-view.ts";
18
22
  import { officeModel, type OfficeScene } from "./office-model.ts";
19
23
  import { personEvidence, questionItem, QUESTION_ITEM, type InboxAnswers, type QuestionRowView } from "./plugin-questions.ts";
20
24
  import { canPublishResults, receiptEvidence, resultItem, RESULT_ACTIONS, RESULT_ITEM, type ResultAction, type ResultRowView } from "./plugin-results.ts";
@@ -61,9 +65,13 @@ const QUESTION_ACTIONS = ["answer"] as const;
61
65
  /** #1054 T6: the receipt actions, advertised so acon lets the inbox and the page send them, never forwarded: `action()` checks the console's person meta, then calls the dedicated `projectConsole(...).receipt` port (`receiptVerb`). */
62
66
  const RESULT_ADVERTISED = RESULT_ACTIONS;
63
67
  const REVIEW_ACTIONS = ["review_comment_put", "review_comment_delete", "review_comment_send"] as const;
64
- const INBOX_VERBS = ["approve", "deny", "open"] as const;
68
+ /** #1221 T2 AC5: the two verbs an advisory supervision row offers; both reach the hub's own `decide`, as the person. */
69
+ const SUPERVISION_VERBS = ["supervision_accept", "supervision_dismiss"] as const;
70
+ const SUPERVISION_ITEM = /^supervision:([^:]+):(sup-[0-9a-f]{12})$/;
71
+ const INBOX_VERBS = ["approve", "deny", "open", ...SUPERVISION_VERBS] as const;
65
72
  /** Outward or destructive: answered needsConfirm first (agent-console AGENTS.md); previews are read-only and stay direct. */
66
- const CONFIRMED = new Set(["review_comment_delete", "review_comment_send", "stop", "permit", "setting", "setting_undo", "setting_reload", "config_edit_apply", "start_peer", "backlog_split", "send", "approve", "deny", "worktree_override_set", "worktrees_refresh_prs"]);
73
+ // A supervision acceptance runs the proposal's existing action, so it is confirmed like an approval; a dismissal runs nothing and is not.
74
+ const CONFIRMED = new Set(["review_comment_delete", "review_comment_send", "stop", "permit", "setting", "setting_undo", "setting_reload", "config_edit_apply", "start_peer", "backlog_split", "send", "approve", "deny", "worktree_override_set", "worktrees_refresh_prs", "supervision_accept"]);
67
75
  const fingerprintOf = (input: Record<string, unknown>) => {
68
76
  const { confirmed: _c, fingerprint: _f, reason: _r, ...rest } = input;
69
77
  return createHash("sha256").update(JSON.stringify(Object.keys(rest).sort().map((key) => [key, rest[key]]))).digest("hex");
@@ -151,6 +159,8 @@ ${body}
151
159
  }
152
160
 
153
161
  interface ProjectRow { id: string; root: string; state: string; instanceId: string | null }
162
+ /** #1220 T3: the closed lineage selectors a page may send; the manager refuses anything else, and `after` is the shell's own field. */
163
+ const LINEAGE_QUERY = ["taskId", "attemptId", "root", "task", "cursor", "nodes", "edges", "bytes"] as const;
154
164
  /** #727: the inbox reply is bounded; `more` counts what was left out. Most urgent first: a decision waits on the person, then a review, a result, a candidate, an alert. */
155
165
  const INBOX_MAX_ITEMS = 50;
156
166
  const INBOX_GROUP_RANK: Record<InboxItem["group"], number> = { decision: 0, review: 1, result: 2, candidate: 3, alert: 4 };
@@ -171,8 +181,17 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
171
181
  const registry = options.registry ?? new Registry(join(options.home, "registry.db"));
172
182
  const owned = !options.registry;
173
183
  const lifecycle = options.lifecycle ?? lazyLifecycle();
174
- const { list, act, answer, receipt, consoleControl } = projectConsole({ registry, lifecycle, home: options.home, forwardTimeoutMs: options.forwardTimeoutMs });
175
- const assets = panelAssets();
184
+ const { list, act, answer, receipt, consoleControl, lineage, guidance } = projectConsole({ registry, lifecycle, home: options.home, forwardTimeoutMs: options.forwardTimeoutMs });
185
+ const dashboard = panelAssets(), guide = guidancePanelAssets();
186
+ const assets = { css: `${dashboard.css}\n${guide.css}`, js: `${dashboard.js.replace("export default (host) => {", "const createDashboard = (host) => {")}\n${guide.js.replace("export default (host) => {", "const createGuidance = (host) => {")}\nexport default (host) => {
187
+ const dashboardMount = host.mount.ownerDocument.createElement('div'), guidanceMount = host.mount.ownerDocument.createElement('div');
188
+ dashboardMount.hidden = true; guidanceMount.hidden = true; host.mount.append(dashboardMount, guidanceMount);
189
+ const dashboard = createDashboard({...host,mount:dashboardMount}), guidance = createGuidance({...host,mount:guidanceMount});
190
+ return { show(panel,params) { const guide = panel === 'guidance'; dashboardMount.hidden = guide; guidanceMount.hidden = !guide;
191
+ if (guide) { dashboard.hide(); guidance.show(panel,params); } else { guidance.hide(); dashboard.show(panel,params); } },
192
+ hide() { dashboard.hide(); guidance.hide(); dashboardMount.hidden = true; guidanceMount.hidden = true; },
193
+ destroy() { dashboard.destroy(); guidance.destroy(); dashboardMount.remove(); guidanceMount.remove(); } };
194
+ };` };
176
195
  const seen = new Map<string, string>(); // inbox item id -> first-seen ISO time, so `at` stays stable
177
196
 
178
197
  async function running(): Promise<ProjectRow[]> {
@@ -279,6 +298,20 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
279
298
  items.push({ id, group: "review", kind: "review", title: `#${t.id} ${t.title}`.slice(0, 200), ...(t.owner ? { actor: t.owner } : {}), project: name, at,
280
299
  chip: { text: "review", tone: "neutral" }, verbs: [{ id: "open", label: "Open board", primary: true }], link: { panel: "board", params: { project: project.id } } });
281
300
  }
301
+ // #1221 T2 AC5: an advisory supervision proposal. The hub sends this field only in advisory mode, and it never
302
+ // carries a private task or task text; the row offers the hub's own two verbs and nothing else.
303
+ const advisory = snap.supervision as { mode?: string; proposals?: { id: string; task: number; rule: string; action: string; reason: string; created?: number }[] } | undefined;
304
+ for (const p of advisory?.mode === "advisory" && Array.isArray(advisory.proposals) ? advisory.proposals : []) {
305
+ if (!p || typeof p.id !== "string" || !/^sup-[0-9a-f]{12}$/.test(p.id) || !Number.isSafeInteger(p.task)) continue;
306
+ const id = `supervision:${project.id}:${p.id}`;
307
+ const at = typeof p.created === "number" ? new Date(p.created).toISOString() : (seen.get(id) ?? new Date().toISOString());
308
+ seen.set(id, at);
309
+ items.push({ id, group: "candidate", kind: "supervision", title: `#${p.task}: ${String(p.action).slice(0, 32)}`.slice(0, 200),
310
+ detail: `${String(p.rule).slice(0, 64)} (${String(p.reason).slice(0, 64)})`, project: name, at,
311
+ chip: { text: "supervision", tone: "neutral" },
312
+ verbs: [{ id: "supervision_accept", label: "Accept", primary: true }, { id: "supervision_dismiss", label: "Dismiss" }],
313
+ link: { panel: "board", params: { project: project.id } } });
314
+ }
282
315
  if (generation === inboxGeneration) lastProjectItems.set(project.id, { generation, items: items.slice(firstItem) });
283
316
  }
284
317
  for (const id of lastProjectItems.keys()) if (!projects.some((project) => project.id === id)) lastProjectItems.delete(id);
@@ -388,8 +421,21 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
388
421
  return { ok: true, message: name === "result_seen" ? "Marked read" : name === "results_read_all" ? `Marked ${Number(result.marked) || 0} read` : "Marked unread again" };
389
422
  }
390
423
 
391
- /** approve/deny resolve to the hub's own `permit` with the request's option; nothing else is reachable from an item. */
424
+ /**
425
+ * approve/deny resolve to the hub's own `permit` with the request's option, and a supervision verb to the hub's own
426
+ * `supervision` action as the person; nothing else is reachable from an item, and the page never names the task, the
427
+ * actor or the action.
428
+ */
392
429
  async function inboxVerb(input: Record<string, unknown>): Promise<ActionResult> {
430
+ const supervision = typeof input.id === "string" ? SUPERVISION_ITEM.exec(input.id) : null;
431
+ if (supervision && (input.action === "supervision_accept" || input.action === "supervision_dismiss")) {
432
+ const project = (await running()).find((p) => p.id === supervision[1]);
433
+ if (!project) return { ok: false, error: "project is not running" };
434
+ const result = await act({ action: "supervision", projectId: project.id, instanceId: project.instanceId, id: supervision[2], verb: input.action === "supervision_accept" ? "accept" : "dismiss" }) as Record<string, unknown>;
435
+ if (result.ok !== true) return { ok: false, error: String(result.error ?? "the supervision decision was refused") };
436
+ const receipt = result.receipt as { outcome?: string; detail?: string } | undefined;
437
+ return { ok: true, message: input.action === "supervision_dismiss" ? "Dismissed" : receipt?.outcome === "ran" ? "Accepted and run" : receipt?.outcome === "unknown" ? "Accepted; the outcome is unconfirmed, check the task" : "Accepted" };
438
+ }
393
439
  const m = typeof input.id === "string" ? /^perm:([^:]+):(.+)$/.exec(input.id) : null;
394
440
  if (input.action === "open") return { ok: true, message: typeof input.id === "string" && (input.id.startsWith("worktrees:") || input.id.startsWith("question:") || input.id.startsWith("result:")) ? `Open the Agents panel to ${input.id.startsWith("question:") ? "answer" : input.id.startsWith("result:") ? "read the result" : "review the shelf"}.` : "Open the Board panel to review." };
395
441
  if (!m) return { ok: false, error: "unknown inbox item" };
@@ -415,6 +461,23 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
415
461
  }
416
462
  if (input.panel === "inbox") return { ...await inboxSnapshot() };
417
463
  if (input.panel === "space") return { scene: await space() };
464
+ // #1220 T3: the execution-lineage read (AC5). A provider port, not a panel id: the shell's own panels are
465
+ // DASHBOARD_VIEWS and neither that list nor the dashboard's action list grows. Reading executes nothing, and
466
+ // an unavailable or unsupported source stays a refusal here rather than an empty successful graph.
467
+ if (input.panel === "guidance") {
468
+ const { panel: _panel, after: _after, projectId, instanceId, op, ...query } = input;
469
+ if (op !== "list" && op !== "show") return { ok: false, panel: "guidance", error: "guidance console is read-only; select list/show and a current task scope" };
470
+ const result = await guidance({ projectId, instanceId }, op, query);
471
+ if (!result.ok || !("guidance" in result) || !result.guidance) return { ok: false, panel: "guidance", error: "error" in result ? result.error : "guidance read unavailable" };
472
+ return { ok: true, panel: "guidance", guidance: result.guidance, lines: guidanceLines(result.guidance) };
473
+ }
474
+ if (input.panel === "lineage") {
475
+ const query = Object.fromEntries(LINEAGE_QUERY.filter((key) => input[key] !== undefined).map((key) => [key, input[key]]));
476
+ const reply = await lineage({ projectId: input.projectId, instanceId: input.instanceId }, query);
477
+ if (reply.ok === false) return { ok: false, panel: "lineage", error: String(reply.error ?? "lineage read failed") };
478
+ try { const page = parseLineageResult(reply.lineage); return { ok: true, panel: "lineage", lineage: page, lines: executionLineageLines(page) }; }
479
+ catch (error) { return { ok: false, panel: "lineage", error: (error as Error).message }; }
480
+ }
418
481
  const view = (DASHBOARD_VIEWS as readonly string[]).includes(String(input.view)) ? input.view : (DASHBOARD_VIEWS as readonly string[]).includes(input.panel) ? input.panel : undefined;
419
482
  if (typeof input.projectId !== "string" || typeof input.instanceId !== "string") {
420
483
  // A bare panel poll (the shell's own, and conformance) gets the listing; the dashboard polls with a project.
@@ -508,6 +571,7 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
508
571
  const preview = name === "review_comment_delete" ? [`Delete or dismiss this review comment on task #${String(input.task ?? "?")}.`]
509
572
  : name === "approve" || name === "deny" ? [`${name === "approve" ? "Allow" : "Deny"} this tool request once.`]
510
573
  : name === "send" ? [`Send a message as you${target ? ` in ${target}` : ""}.`]
574
+ : name === "supervision_accept" ? [`Accept a supervision proposal${target ? ` in ${target}` : ""} and run the action it names once.`]
511
575
  : [`Run ${name}${target ? ` in ${target}` : ""}.`];
512
576
  return { ok: false, needsConfirm: true, preview, fingerprint, verb: name === "approve" ? "Allow once" : name === "deny" ? "Deny" : name };
513
577
  }
@@ -516,7 +580,7 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
516
580
  return await consoleControl({ projectId, instanceId }, name as typeof REVIEW_ACTIONS[number], payload, meta) as ActionResult;
517
581
  }
518
582
  const { confirmed: _c, fingerprint: _f, ...forward } = input;
519
- if (name === "approve" || name === "deny" || name === "open") return await inboxVerb(forward);
583
+ if (name === "approve" || name === "deny" || name === "open" || (SUPERVISION_VERBS as readonly string[]).includes(name)) return await inboxVerb(forward);
520
584
  const result = await act(forward) as Record<string, unknown>;
521
585
  return (result.ok === false ? { ok: false, error: String(result.error ?? "action failed"), ...(result.unconfirmed === true ? { unconfirmed: true as const } : {}) } : { ...result, ok: true }) as ActionResult;
522
586
  }
@@ -525,7 +589,7 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
525
589
  const plugin: ConsolePlugin = {
526
590
  manifest: {
527
591
  api: 1, tool: "ahub", version, title: "agent-hub", icon: "agents", pollMs: 2000,
528
- panels: DASHBOARD_VIEWS.map((id, order) => ({ id, title: TITLES[id], order })),
592
+ panels: [...DASHBOARD_VIEWS.map((id, order) => ({ id, title: TITLES[id], order })), { id: "guidance", title: "Guidance", order: DASHBOARD_VIEWS.length }],
529
593
  capabilities: { actions: [...FORWARDED, ...INBOX_VERBS, ...QUESTION_ACTIONS, ...RESULT_ADVERTISED, ...REVIEW_ACTIONS], confirm: true, multiProject: true, inbox: true, space: true },
530
594
  },
531
595
  async open(ctx) { return createProvider({ home: ctx.home, log: ctx.log, features: ctx.features }); },