@staix/agent-hub 0.39.0 → 0.40.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 +39 -0
- package/README.md +12 -6
- package/docs/adding-an-ai-tool.md +1 -1
- package/docs/agent-notes/README.md +7 -0
- package/docs/agent-notes/adapters.md +5 -3
- package/docs/agent-notes/benchmarks.md +2 -0
- package/docs/agent-notes/budget.md +1 -0
- package/docs/agent-notes/bus.md +1 -0
- package/docs/agent-notes/daemon.md +8 -3
- package/docs/agent-notes/local-worker.md +3 -1
- package/docs/agent-notes/security-review.md +1 -0
- package/docs/agent-notes/tasks.md +7 -2
- package/docs/agent-notes/tests.md +7 -7
- package/docs/contracts/companion-cli-v1.json +4 -0
- package/docs/design/adapters.md +91 -0
- package/docs/design/agent-hub-architecture.md +17 -0
- package/docs/design/agent-hub.md +10 -0
- package/docs/design/bus.md +7 -0
- package/docs/design/cli-output.md +183 -0
- package/docs/design/execution-reference.md +6 -1
- package/docs/design/roadmap.md +191 -0
- package/docs/design/task-board.md +34 -0
- package/docs/dogfood.md +11 -4
- package/docs/events.md +4 -4
- package/docs/memory.md +3 -3
- package/docs/operations.md +153 -41
- package/docs/profiles.md +1 -0
- package/docs/quickstart.md +17 -4
- package/docs/sdlc.md +3 -1
- package/docs/security.md +40 -4
- package/docs/verification/2026-11-14-codex-0169-reviewer-isolation.md +70 -0
- package/docs/verification/2026-11-14-codex-0169-reviewer-tool-call.md +48 -0
- package/docs/verification/2026-11-14-pi-152-compat.md +45 -0
- package/docs/verification/2026-11-15-0.40.0.md +39 -0
- package/docs/verification/2026-11-16-pi-loopback-1447.md +39 -0
- package/docs/verification/pi-152-model-free.ts +57 -0
- package/docs/verification/pi-152-native.mjs +21 -0
- package/docs/verified.json +22 -22
- package/package.json +3 -3
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/kimi-hook.js +332 -89
- package/plugins/agent-hub/kimi-review-policy-worker.js +16 -11
- package/plugins/agent-hub/server.js +417 -160
- package/src/adapters/agy/definition.ts +1 -1
- package/src/adapters/claude-channel.ts +1 -1
- package/src/adapters/codex-review-isolation.ts +61 -17
- package/src/adapters/compat.ts +7 -7
- package/src/adapters/definitions/builtin-metadata.ts +6 -6
- package/src/adapters/definitions/native-config-defaults.ts +1 -1
- package/src/adapters/definitions/native-config-policy.ts +1 -1
- package/src/adapters/definitions/qwen.ts +1 -1
- package/src/adapters/local-worker.ts +5 -3
- package/src/adapters/pi.ts +54 -11
- package/src/adapters/registry-types.ts +2 -1
- package/src/adapters/reviewer-print.ts +2 -1
- package/src/cli/answer-args.ts +11 -3
- package/src/cli/console-question.ts +1 -1
- package/src/cli/console-state.ts +95 -10
- package/src/cli/console.ts +6 -2
- package/src/cli/error-format.ts +19 -0
- package/src/cli/help.ts +290 -25
- package/src/cli/identity-audit.ts +8 -7
- package/src/cli/identity.ts +17 -0
- package/src/cli/init.ts +102 -9
- package/src/cli/main.js +2 -2
- package/src/cli/main.ts +57 -21
- package/src/cli/output-standard.ts +56 -0
- package/src/cli/output.ts +143 -8
- package/src/cli/roadmap.ts +215 -0
- package/src/cli/smoke-pty-bridge.ts +7 -24
- package/src/cli/task-output.ts +3 -1
- package/src/cli/upgrade-presentation-flags.ts +2 -2
- package/src/hub/board.ts +200 -3
- package/src/hub/bus.ts +9 -0
- package/src/hub/check-runner.ts +3 -4
- package/src/hub/ci-watch.ts +19 -4
- package/src/hub/control-client.ts +1 -1
- package/src/hub/daemon.ts +245 -43
- package/src/hub/events.ts +2 -2
- package/src/hub/execution-reference.ts +1 -1
- package/src/hub/github-import.ts +81 -0
- package/src/hub/hub-tools.ts +34 -9
- package/src/hub/install-policy.ts +23 -0
- package/src/hub/lifecycle-schema.ts +2 -2
- package/src/hub/no-writes.ts +3 -0
- package/src/hub/operational-authority.ts +3 -1
- package/src/hub/operational-view.ts +1 -1
- package/src/hub/pi-failure.ts +7 -0
- package/src/hub/question-desk.ts +26 -7
- package/src/hub/questions.ts +33 -5
- package/src/hub/restart.ts +7 -0
- package/src/hub/roadmap-triage.ts +86 -0
- package/src/hub/roadmap-unplaced.ts +169 -0
- package/src/hub/roadmap-view.ts +83 -0
- package/src/hub/roadmap.ts +127 -0
- package/src/hub/sdlc-merge.ts +5 -4
- package/src/hub/sdlc-queue.ts +3 -3
- package/src/hub/sdlc.ts +37 -2
- package/src/hub/specs-task.ts +7 -0
- package/src/hub/task-sweep.ts +29 -2
- package/src/hub/task-worktree.ts +37 -0
- package/src/hub/tasks.ts +381 -7
- package/src/pi/dependency-publish.ts +50 -0
- package/src/pi/extension.ts +1 -1
- package/src/pi/launch.ts +1 -1
- package/src/pi/task-dependencies.ts +249 -0
- package/src/ui/index.html +53 -13
- package/src/ui/plugin-questions.ts +5 -0
- package/src/ui/plugin.ts +6 -1
- package/templates/config.json +1 -1
package/src/cli/console-state.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { consoleNeeds, characterAttentionLine, attentionCommand } from "./attention.ts";
|
|
2
2
|
import { CHARACTERS, petFrame, petSize, petFooterRows, type CharacterId, type PetSize, type PetPose } from "../pet/frame.ts";
|
|
3
3
|
import { PEER_PALETTE } from "../ui/peer-palette.ts";
|
|
4
|
+
import { SGR_RESET, TONE_SGR, ROLE_SGR, MARKERS, MARKER_COLUMN, SECTION_MARKER, cellWidth, markerCell, resolveColor, asciiMarkers, streamEnv, MARKER_NAMES, type Role, type MarkerName, type ColorEnv } from "./output-standard.ts";
|
|
5
|
+
export { SGR_RESET, TONE_SGR, ROLE_SGR, MARKERS, MARKER_COLUMN, SECTION_MARKER, cellWidth, markerCell, resolveColor, asciiMarkers, streamEnv, MARKER_NAMES, type Role, type MarkerName, type ColorEnv };
|
|
4
6
|
import { PERMISSION_MODES, permissionBoundary } from "../hub/permission-mode.ts";
|
|
5
7
|
import { PLANNER_PEERS, definitionOf, nativeStreamTone, createProjectAdapterCatalog } from "../adapters/registry.ts";
|
|
6
8
|
import { taskProgress } from "../ui/task-progress.ts";
|
|
@@ -133,17 +135,22 @@ export function terminalText(value: unknown): string {
|
|
|
133
135
|
.replace(/\x1b[^\n]?/g, "").replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g, ""));
|
|
134
136
|
}
|
|
135
137
|
export type Tone = "info" | "strong" | "success" | "attention" | "failure" | "muted" | "peerClaude" | "peerCodex" | "taskKeyword" | "number" | "issueRef" | "taskRef";
|
|
136
|
-
|
|
138
|
+
/** A report span names a semantic role (CLI output standard v1, docs/design/cli-output.md) or, for the console, a tone; a role wins. */
|
|
139
|
+
export interface Span { text: string; tone?: Tone; role?: Role }
|
|
137
140
|
export const PALETTE: Readonly<Record<Tone, string>> = Object.freeze({
|
|
138
|
-
info: PEER_PALETTE.hub.ansi, strong:
|
|
141
|
+
info: PEER_PALETTE.hub.ansi, strong: TONE_SGR.strong, success: PEER_PALETTE.local.ansi, attention: PEER_PALETTE.pi.ansi, failure: TONE_SGR.failure, muted: PEER_PALETTE.other.ansi,
|
|
139
142
|
peerClaude: PEER_PALETTE.claude.ansi, peerCodex: PEER_PALETTE.codex.ansi,
|
|
140
|
-
taskKeyword: PEER_PALETTE.kimi.ansi, number:
|
|
143
|
+
taskKeyword: PEER_PALETTE.kimi.ansi, number: TONE_SGR.number, issueRef: TONE_SGR.issueRef, taskRef: TONE_SGR.taskRef,
|
|
144
|
+
});
|
|
145
|
+
/** The console's tones onto roles. A tone that is not here names an identity (a peer, a task keyword, a reference), never a status. */
|
|
146
|
+
export const TONE_ROLE: Readonly<Partial<Record<Tone, Role>>> = Object.freeze({
|
|
147
|
+
info: "accent", strong: "header", success: "success", attention: "warning", failure: "error", muted: "hint", number: "value",
|
|
141
148
|
});
|
|
142
149
|
export function paint(line: Span[], color: boolean): string {
|
|
143
150
|
return line.map(span => {
|
|
144
151
|
const text = terminalText(span.text);
|
|
145
|
-
const sgr = span.tone && Object.hasOwn(PALETTE, span.tone) ? PALETTE[span.tone] : undefined;
|
|
146
|
-
return color && sgr && text ? sgr + text +
|
|
152
|
+
const sgr = span.role && Object.hasOwn(ROLE_SGR, span.role) ? ROLE_SGR[span.role] : span.tone && Object.hasOwn(PALETTE, span.tone) ? PALETTE[span.tone] : undefined;
|
|
153
|
+
return color && sgr && text ? sgr + text + SGR_RESET : text;
|
|
147
154
|
}).join("");
|
|
148
155
|
}
|
|
149
156
|
/** Console stream headers only. Tokenize sanitized text; bodies and command output stay plain. */
|
|
@@ -223,11 +230,89 @@ export function wrapStreamTokens(value: string, columns: number, tone?: Tone, ki
|
|
|
223
230
|
return out;
|
|
224
231
|
});
|
|
225
232
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
233
|
+
/**
|
|
234
|
+
* The layout grammar of standard v1 as one builder, so every report has the same header, section, key/value row, bullet row, next step
|
|
235
|
+
* and summary line. Blank lines follow the standard: exactly one before each section, none after it, never two in a row, none at the
|
|
236
|
+
* end. Lines are Span arrays; `paint(line, color)` prints them. The builder never colors by itself: it names roles.
|
|
237
|
+
*/
|
|
238
|
+
export class Report {
|
|
239
|
+
private readonly out: Span[][] = [];
|
|
240
|
+
/** `columns` undefined means no wrap width: standard v1 wraps on a pipe only when COLUMNS is set, so a script reading `ahub doctor | grep` gets whole lines. */
|
|
241
|
+
constructor(readonly columns: number | undefined = undefined, readonly ascii = false) {}
|
|
242
|
+
/** The text as lines at most `room` cells wide, or as one line per source line when there is no wrap width. */
|
|
243
|
+
private fit(text: string, room: number): string[] {
|
|
244
|
+
return this.columns === undefined ? terminalText(text).split("\n").map(line => line.replace(/\t/g, " ")) : wrap(text, Math.max(10, room), 0);
|
|
245
|
+
}
|
|
246
|
+
private push(line: Span[]) { this.out.push(line); }
|
|
247
|
+
/** ` <tool> <Report>` in `header`, then one line of context in `hint` on the same line. At most one per report. */
|
|
248
|
+
header(tool: string, name: string, context?: string): this {
|
|
249
|
+
this.push([{ text: ` ${tool} ${name}`, role: "header" }, ...(context ? [{ text: ` ${context}`, role: "hint" as const }] : [])]);
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
/** One blank line, then `▸ <Name>` (ASCII `> <Name>`) in `section`, with an optional count in `hint`. */
|
|
253
|
+
section(name: string, count?: string): this {
|
|
254
|
+
if (this.out.length && this.out.at(-1)!.length) this.push([]);
|
|
255
|
+
this.push([{ text: `${this.ascii ? SECTION_MARKER.ascii : SECTION_MARKER.glyph} ${name}`, role: "section" }, ...(count ? [{ text: ` (${count})`, role: "hint" as const }] : [])]);
|
|
256
|
+
return this;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Key/value rows of one section: two-space indent, `Key:` padded to the widest key, two spaces, value. A key wider than 28 cells
|
|
260
|
+
* puts its value on the next line at a four-space indent. An empty value is `(unset)` in `hint`.
|
|
261
|
+
*/
|
|
262
|
+
kv(rows: readonly (readonly [string, unknown])[], indent = 2): this {
|
|
263
|
+
const keys = rows.map(([key]) => cellWidth(`${terminalText(key)}:`));
|
|
264
|
+
const pad = Math.max(0, ...keys.filter(width => width <= 28));
|
|
265
|
+
for (const [index, [key, raw]] of rows.entries()) {
|
|
266
|
+
const label = `${terminalText(key)}:`, text = terminalText(raw ?? "").trim();
|
|
267
|
+
const value = (line: string): Span => text ? { text: line, role: "value" } : { text: "(unset)", role: "hint" };
|
|
268
|
+
const lead = " ".repeat(indent);
|
|
269
|
+
if (keys[index]! > 28) {
|
|
270
|
+
this.push([{ text: `${lead}${label}`, role: "key" }]);
|
|
271
|
+
for (const line of text ? this.fit(text, (this.columns ?? 0) - indent - 2) : [""]) this.push([{ text: `${lead} ` }, value(line)]);
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
const gap = " ".repeat(pad - keys[index]! + 2), room = (this.columns ?? 0) - indent - pad - 2;
|
|
275
|
+
const lines = text ? this.fit(text, room) : [""];
|
|
276
|
+
this.push([{ text: lead }, { text: label, role: "key" }, { text: gap }, value(lines[0]!)]);
|
|
277
|
+
for (const line of lines.slice(1)) this.push([{ text: " ".repeat(indent + pad + 2) }, value(line)]);
|
|
278
|
+
}
|
|
279
|
+
return this;
|
|
280
|
+
}
|
|
281
|
+
/** ` <marker> <text>`; a nested detail line uses four spaces. The text carries the state word, so meaning survives without color. */
|
|
282
|
+
bullet(name: MarkerName, text: string, nested = false): this {
|
|
283
|
+
const indent = nested ? " " : " ", lead = indent.length + MARKER_COLUMN + 1;
|
|
284
|
+
const lines = this.fit(text, (this.columns ?? 0) - lead);
|
|
285
|
+
this.push([{ text: indent }, { text: markerCell(name, this.ascii), role: MARKERS[name].role }, { text: " " }, { text: lines[0]! }]);
|
|
286
|
+
for (const line of lines.slice(1)) this.push([{ text: " ".repeat(lead) + line }]);
|
|
287
|
+
return this;
|
|
288
|
+
}
|
|
289
|
+
/** Lines another renderer built (a table), placed as they are. A section's blank line is still added by `section()`. */
|
|
290
|
+
append(lines: readonly Span[][]): this { for (const line of lines) this.push([...line]); return this; }
|
|
291
|
+
/** A free line in one role, indented two cells (a pointer to more detail, a note). */
|
|
292
|
+
note(text: string, role: Role = "hint"): this {
|
|
293
|
+
for (const line of this.fit(text, (this.columns ?? 0) - 2)) this.push([{ text: " " }, { text: line, role }]);
|
|
294
|
+
return this;
|
|
295
|
+
}
|
|
296
|
+
/** ` → <command>` in `accent`: complete and copyable, never shortened. */
|
|
297
|
+
next(command: string): this {
|
|
298
|
+
this.push([{ text: " " }, { text: `${markerCell("next", this.ascii)} ${terminalText(command)}`, role: "accent" }]);
|
|
299
|
+
return this;
|
|
300
|
+
}
|
|
301
|
+
/** The last line of a check command: `✗ 2 failed ⚠ 3 warnings ✓ 18 ok`, zero counts omitted, unknowns as `? 2 unknown`. */
|
|
302
|
+
summary(counts: { failed?: number; warnings?: number; unknown?: number; ok?: number }): this {
|
|
303
|
+
const parts: Span[] = [];
|
|
304
|
+
const add = (n: number | undefined, name: MarkerName, word: string) => {
|
|
305
|
+
if (!n) return;
|
|
306
|
+
if (parts.length) parts.push({ text: " " });
|
|
307
|
+
parts.push({ text: `${this.ascii ? MARKERS[name].ascii : MARKERS[name].glyph} ${n} ${word}`, role: MARKERS[name].role });
|
|
308
|
+
};
|
|
309
|
+
add(counts.failed, "fail", "failed"); add(counts.warnings, "warn", counts.warnings === 1 ? "warning" : "warnings"); add(counts.unknown, "unknown", "unknown"); add(counts.ok, "ok", "ok");
|
|
310
|
+
if (parts.length) { if (this.out.length) this.push([]); this.push(parts); }
|
|
311
|
+
return this;
|
|
312
|
+
}
|
|
313
|
+
lines(): Span[][] { return this.out.map(line => line.map(item => ({ ...item }))); }
|
|
314
|
+
/** The report as text: one painted string per line, no trailing blank line. */
|
|
315
|
+
render(color: boolean): string[] { return this.out.map(line => paint(line, color)); }
|
|
231
316
|
}
|
|
232
317
|
export function stateTone(state: string): Tone | undefined {
|
|
233
318
|
if (state === "idle" || state === "approved") return "success";
|
package/src/cli/console.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { ControlClient } from "../hub/control-client.ts";
|
|
|
6
6
|
import { contextLine } from "./status-lines.ts";
|
|
7
7
|
import { renderTailEvent } from "./tail-render.ts";
|
|
8
8
|
import { reviewResult } from "./console-review.ts";
|
|
9
|
-
import { syncPermissionDefaults, permissionDefaultText, approvalFrom, initialConsoleState, keyTable, notify, paint, permissionText, plural, pruneApprovals, reduceConsole, renderConsoleLines, resolveColor, stateTone, streamTokens, wrapStreamTokens, terminalText, wrap, captureConsoleSelection, selectedPanelRow, appendEvent, FIRST_KEYS, LAST_KEYS } from "./console-state.ts";
|
|
9
|
+
import { syncPermissionDefaults, permissionDefaultText, approvalFrom, initialConsoleState, keyTable, notify, paint, permissionText, plural, pruneApprovals, reduceConsole, renderConsoleLines, resolveColor, streamEnv, stateTone, streamTokens, wrapStreamTokens, terminalText, wrap, captureConsoleSelection, selectedPanelRow, appendEvent, FIRST_KEYS, LAST_KEYS } from "./console-state.ts";
|
|
10
10
|
import type { ConsoleEffect, ConsoleEvent, Detail, Tone } from "./console-state.ts";
|
|
11
11
|
import type { BusEvent } from "../hub/bus.ts";
|
|
12
12
|
import { consoleNeeds, attentionFacts, attentionResults } from "./attention.ts";
|
|
@@ -95,7 +95,7 @@ function labeled(text: string): Detail {
|
|
|
95
95
|
/** One terminal client, no daemon ownership. All text crosses terminalText before writing. */
|
|
96
96
|
export async function runConsole(options: ConsoleOptions): Promise<void> {
|
|
97
97
|
const { client } = options; const terminal = options.terminal ?? nativeTerminal();
|
|
98
|
-
const color = options.color ?? resolveColor(undefined,
|
|
98
|
+
const color = options.color ?? resolveColor(undefined, streamEnv(terminal.isTTY)) === true;
|
|
99
99
|
let state = initialConsoleState(!!options.panels); state.project = basename(options.cwd);
|
|
100
100
|
let pet = loadPetConfig(options.cwd);
|
|
101
101
|
let petSignature = JSON.stringify([pet.enabled, pet.character, pet.size, pet.glyphs, pet.blink, pet.bell]);
|
|
@@ -196,6 +196,7 @@ export async function runConsole(options: ConsoleOptions): Promise<void> {
|
|
|
196
196
|
notice(`detail ${id} changed or is no longer available`);
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
|
+
let instructedAnswersSeen = new Set<string>();
|
|
199
200
|
const refresh = async () => {
|
|
200
201
|
if (polling || !active) { if (active) refreshPending = true; return; }
|
|
201
202
|
polling = true;
|
|
@@ -232,6 +233,9 @@ export async function runConsole(options: ConsoleOptions): Promise<void> {
|
|
|
232
233
|
}
|
|
233
234
|
} catch { /* retain running console presentation while a config file is unreadable */ }
|
|
234
235
|
if (questionReply?.ok === true) {
|
|
236
|
+
const instructed = Array.isArray(questionReply.answeredQuestions) ? questionReply.answeredQuestions.filter((row: any) => row.state === "answered" && row.instructed === true && typeof row.provenance === "string") : [];
|
|
237
|
+
for (const row of instructed) if (!instructedAnswersSeen.has(row.set)) stream({ text: ` ${terminalText(String(row.set))}: ${terminalText(row.provenance)}`, peer: row.peer, kind: "question", tone: "success" });
|
|
238
|
+
instructedAnswersSeen = new Set(instructed.map((row: any) => String(row.set)));
|
|
235
239
|
const rows = questionRows(questionReply.questions);
|
|
236
240
|
// A set the person has not been told about gets one stream line with no question text: A answers it, or ahub answer.
|
|
237
241
|
const seen = new Set(state.questionsSeen ?? []);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MARKERS, terminalText } from "./console-state.ts";
|
|
2
|
+
|
|
3
|
+
// CLI output standard v1, Messages. Pure, so a test reads the exact text without starting the CLI (main.ts runs on import).
|
|
4
|
+
/**
|
|
5
|
+
* 2 for a usage error (standard v1: an unknown command or flag, a bad argument), 1 for every other failure. A usage error is one whose text starts with
|
|
6
|
+
* `usage:` or names an unknown command, or that carries its usage as a line of its own (`<what is wrong>\nusage: ...`, the form `ahub study` prints), or is a flag
|
|
7
|
+
* with no value (`--task needs a value`), or is the release command's malformed-arguments refusal, or names an argument, option or flag the command does not take (`unknown argument`, `unknown option`, `unknown flag`).
|
|
8
|
+
* A NEW usage error must start with `usage:` (or use one of these forms) to exit 2; any other text exits 1, so a later call site would otherwise exit 1 by accident. A refusal that changed nothing (`never-ask requires --yes`) is not a usage error and keeps exit 1.
|
|
9
|
+
*/
|
|
10
|
+
export function failureExitCode(message: string): 1 | 2 {
|
|
11
|
+
return /^(usage:|unknown command )|\nusage:|^--[a-z][a-z-]* needs a value|^invalid release command$|^(ahub [a-z-]+: )?unknown (argument|option) |; unknown flag |^unknown flag /i.test(message) ? 2 : 1;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** The error line and its optional next step, as `fail()` prints them; pure so a test reads the exact text. */
|
|
15
|
+
export function errorLines(message: string, next: string | undefined, terminal: boolean, ascii: boolean): string[] {
|
|
16
|
+
const line = `ahub: ${message}`;
|
|
17
|
+
const first = terminal ? `${MARKERS.fail[ascii ? "ascii" : "glyph"]} ${line}` : line;
|
|
18
|
+
return next ? [first, ` ${MARKERS.next[ascii ? "ascii" : "glyph"]} ${terminalText(next)}`] : [first];
|
|
19
|
+
}
|