@staix/agent-hub 0.48.3 → 0.49.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 (58) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +1 -1
  3. package/docs/agent-notes/daemon.md +2 -2
  4. package/docs/agent-notes/tasks.md +1 -1
  5. package/docs/design/adapters.md +4 -7
  6. package/docs/design/agent-hub-architecture.md +1 -1
  7. package/docs/design/agent-hub.md +1 -1
  8. package/docs/design/bus.md +2 -2
  9. package/docs/design/cli-output-inventory.md +39 -38
  10. package/docs/design/cli-output.md +7 -3
  11. package/docs/design/guidance-experiments.md +3 -1
  12. package/docs/design/guidance-probes.md +33 -31
  13. package/docs/design/model-routes.md +11 -14
  14. package/docs/design/roadmap.md +10 -9
  15. package/docs/design/supervision.md +6 -6
  16. package/docs/design/task-board.md +2 -2
  17. package/docs/dogfood.md +1 -1
  18. package/docs/operations.md +12 -7
  19. package/docs/quickstart.md +19 -1
  20. package/docs/roadmap.json +519 -1
  21. package/docs/roadmap.md +94 -0
  22. package/docs/security.md +3 -1
  23. package/docs/verification/2026-11-26-compat-pi-1.6.1.md +28 -0
  24. package/docs/verification/2026-11-27-0.48.4.md +37 -0
  25. package/docs/verification/2026-11-28-0.49.0.md +53 -0
  26. package/docs/verified.json +19 -19
  27. package/package.json +1 -1
  28. package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
  29. package/plugins/agent-hub/kimi-hook.js +29 -4
  30. package/plugins/agent-hub/server.js +34 -5
  31. package/src/adapters/channel-peer.ts +5 -2
  32. package/src/adapters/claude-channel.ts +1 -0
  33. package/src/adapters/compat.ts +4 -4
  34. package/src/adapters/definitions/native-cli-entry-claude.ts +22 -1
  35. package/src/cli/agents-output.ts +13 -0
  36. package/src/cli/agents.ts +16 -7
  37. package/src/cli/answer-output.ts +67 -0
  38. package/src/cli/broker.ts +9 -2
  39. package/src/cli/launch.ts +1 -1
  40. package/src/cli/main.ts +96 -127
  41. package/src/cli/recovery-package.ts +78 -26
  42. package/src/cli/reset-output.ts +50 -0
  43. package/src/cli/sdlc-output.ts +57 -0
  44. package/src/cli/settings-output.ts +80 -0
  45. package/src/hub/check-runner.ts +7 -3
  46. package/src/hub/claude-launch-proof.ts +12 -2
  47. package/src/hub/claude-state.ts +3 -0
  48. package/src/hub/control-client.ts +2 -0
  49. package/src/hub/daemon.ts +102 -40
  50. package/src/hub/memory-profile.ts +12 -1
  51. package/src/hub/roadmap-export.ts +12 -9
  52. package/src/hub/roadmap-issue-states.ts +35 -0
  53. package/src/hub/runtime-capture-prune.ts +21 -6
  54. package/src/hub/runtime-package-assets.ts +6 -0
  55. package/src/hub/supervision-proposals.ts +3 -3
  56. package/src/hub/supervision-rules.ts +2 -2
  57. package/src/hub/task-sweep.ts +1 -1
  58. package/src/hub/tasks.ts +37 -20
@@ -0,0 +1,67 @@
1
+ import type { AskResult } from "../hub/ask.ts";
2
+ import type { QuestionRow } from "../hub/questions.ts";
3
+ import { Report, cellWidth, fit, terminalText, type Span } from "./console-state.ts";
4
+
5
+ const EVIDENCE_WIDTH = 150;
6
+ const lines = (text: string): Span[][] => text.split("\n").map(line => [{ text: line }]);
7
+
8
+ export function renderAskAnswer(view: AskResult & { saved?: string }, columns?: number, _now = Date.now(), ascii = false): Span[][] {
9
+ const report = new Report(columns, ascii).titled("ahub", "Ask").section("Answer")
10
+ .append(lines(terminalText(view.answer ?? `(${view.note})`)));
11
+ // Evidence alone must not look like an answer when the search found nothing.
12
+ if (view.evidence.length && (view.found || view.note)) {
13
+ report.section("Evidence");
14
+ for (const item of view.evidence) {
15
+ const text = item.text.slice(0, EVIDENCE_WIDTH);
16
+ report.append(lines(` ${item.id.padEnd(12)} ${cellWidth(text) > EVIDENCE_WIDTH ? fit(text, EVIDENCE_WIDTH) : text}`));
17
+ }
18
+ }
19
+ if (view.pii) report.section("Privacy").append(lines("(PII is involved: shown here only, not saved anywhere)"));
20
+ if (view.saved) report.section("Saved").append(lines(view.saved));
21
+ return report.lines();
22
+ }
23
+
24
+ export function renderQuestions(rows: readonly Pick<QuestionRow, "set" | "peer" | "private" | "questions">[], columns?: number, _now = Date.now(), ascii = false): Span[][] {
25
+ const report = new Report(columns, ascii);
26
+ if (!rows.length) return report.append(lines("no open questions")).lines();
27
+ report.titled("ahub", "Questions");
28
+ for (const row of rows) {
29
+ report.section(`${row.set} ${row.peer} asks${row.private ? " (private)" : ""}`);
30
+ for (const question of row.questions) {
31
+ report.append(lines(` ${question.id}: ${terminalText(String(question.prompt))}${question.multi ? " (choose any)" : ""}${question.allowOther ? " (or --other <text>)" : ""}`));
32
+ for (const option of question.options)
33
+ report.append(lines(` ${option.id} ${terminalText(String(option.label))}${option.description ? ` - ${terminalText(String(option.description))}` : ""}`));
34
+ }
35
+ report.next(`ahub answer ${row.set} ${row.questions.map(question => `${question.id}=${question.options[0]?.id ?? "<option>"}`).join(" ")}`);
36
+ }
37
+ return report.lines();
38
+ }
39
+
40
+ type Receipt =
41
+ | { kind: "answer"; set: string; actor?: string }
42
+ | { kind: "read"; id: string }
43
+ | { kind: "read-all"; marked: number }
44
+ | { kind: "unread-last"; unread: number };
45
+
46
+ export function renderAnswerReceipt(view: Receipt): Span[][] {
47
+ const report = new Report();
48
+ switch (view.kind) {
49
+ case "answer": return report.append(lines(`answered ${view.set}${view.actor === undefined ? "" : `; answered by ${terminalText(view.actor)} on the person's instruction`}`)).lines();
50
+ case "read": return report.append(lines(`marked ${view.id} read`)).lines();
51
+ case "read-all": return report.append(lines(`marked ${view.marked} ${view.marked === 1 ? "result" : "results"} read`)).lines();
52
+ case "unread-last": return report.append(lines(`marked ${view.unread} unread again`)).lines();
53
+ }
54
+ }
55
+
56
+ interface ResultRow { id: string; read: boolean; title: string; settledAt: number; ms: number }
57
+ export function renderResults(view: { rows: readonly ResultRow[]; unread: boolean; more: number }): Span[][] {
58
+ const report = new Report();
59
+ if (!view.rows.length) return report.append(lines(view.unread ? "no unread results" : "no results")).lines();
60
+ // Keep exactly one line per result, including the unread prefix used by terminal readers.
61
+ for (const row of view.rows) {
62
+ const time = new Date(Number(row.settledAt)).toISOString().replace("T", " ").slice(0, 16);
63
+ report.append(lines(`${row.read ? " " : "*"} ${row.id} ${terminalText(String(row.title))} ${time} ${Math.round(Number(row.ms) / 1000)}s${row.read ? "" : ` ahub results --read ${row.id}`}`));
64
+ }
65
+ if (view.more > 0) report.append(lines(`... and ${view.more} older unread; ahub results --read-all marks them all, or read the newest ones first`));
66
+ return report.lines();
67
+ }
package/src/cli/broker.ts CHANGED
@@ -4,6 +4,7 @@ import { BrokerStore, BrokerStoreError } from "../broker/store.ts";
4
4
  import { decodeBase64url, RoomCryptoError } from "../rooms/crypto.ts";
5
5
  import { startBroker, BrokerServerError, type BrokerOptions } from "../broker/server.ts";
6
6
  import { warnLine } from "./warn-line.ts";
7
+ import { Report, asciiMarkers, terminalText } from "./console-state.ts";
7
8
 
8
9
  export const BROKER_USAGE = "usage: ahub broker serve [--hostname <host>] [--port <0..65535>] [--public-url <ws[s]://host/>] [--owner <fingerprint>]... [--state-dir <dir>] | broker room drop <room> --yes [--state-dir <dir>]";
9
10
  export function brokerOptions(args: readonly string[], stateDir: string): BrokerOptions {
@@ -36,16 +37,22 @@ export function brokerDropOptions(args: readonly string[], stateDir: string): {
36
37
  return { room, stateDir: selected };
37
38
  }
38
39
  export async function runBrokerCommand(args: readonly string[], stateDir: string): Promise<void> {
40
+ const print = (report: Report) => { process.stdout.write(report.render(false).join("\n") + "\n"); };
39
41
  if (args[0] === "room") {
40
42
  const drop = brokerDropOptions(args, stateDir);
41
43
  const store = await BrokerStore.open({ stateDir: drop.stateDir, create: false });
42
- try { console.log(`broker room ${store.dropRoom(drop.room).removed ? "dropped" : "not found"}: ${drop.room}`); }
44
+ try {
45
+ const { removed } = store.dropRoom(drop.room);
46
+ print(new Report(undefined, asciiMarkers(process.env)).titled("ahub", "Broker room")
47
+ .section("Result").bullet(removed ? "ok" : "unknown", `broker room ${removed ? "dropped" : "not found"}: ${drop.room}`));
48
+ }
43
49
  finally { store.close(); }
44
50
  return;
45
51
  }
46
52
  const options = brokerOptions(args, stateDir);
47
53
  const broker = await startBroker(options);
48
- console.log(`broker listening at ${broker.publicUrl} (ciphertext relay; application delivery is not acknowledged here)`);
54
+ // A machine-readable readiness line is intentionally unwrapped and uncolored.
55
+ print(new Report().header("ahub", `broker listening at ${terminalText(broker.publicUrl)} (ciphertext relay; application delivery is not acknowledged here)`));
49
56
  const stop = () => { void broker.stop().catch(() => { process.exitCode = 1; warnLine("broker: stop failed"); }); };
50
57
  process.once("SIGINT", stop); process.once("SIGTERM", stop);
51
58
  try { await broker.closed; }
package/src/cli/launch.ts CHANGED
@@ -112,7 +112,7 @@ export function cleanupStaleClaudeSettings(stateDir: string, previous: unknown,
112
112
  }
113
113
 
114
114
  export interface ClaudeLaunchRecord extends Record<string, unknown> {
115
- instanceId: string; launchId: string; settingsFile?: string; launcherPid: number; launcherSignature?: string;
115
+ instanceId: string; launchId: string; nativeSessionId?: string; settingsFile?: string; launcherPid: number; launcherSignature?: string;
116
116
  /** A claude-<name> instance (#450 I3); absent for the builtin claude peer, whose file keeps its original name. */
117
117
  peer?: string;
118
118
  /** Validated terminal instance root; absent for legacy/canonical launches. */