@staix/agent-hub 0.46.1 → 0.48.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 +85 -0
- package/README.md +12 -6
- package/docs/adding-an-ai-tool.md +20 -4
- package/docs/agent-notes/adapters.md +3 -3
- package/docs/agent-notes/benchmarks.md +7 -1
- package/docs/agent-notes/daemon.md +5 -4
- package/docs/agent-notes/tasks.md +4 -2
- package/docs/agent-notes/tests.md +3 -0
- package/docs/contracts/companion-cli-v1.json +3 -0
- package/docs/data-policy.md +9 -0
- package/docs/design/adapters.md +14 -0
- package/docs/design/cli-output-inventory.md +362 -0
- package/docs/design/cli-output.md +42 -1
- package/docs/design/execution-reference.md +5 -2
- package/docs/design/guidance-probes.md +14 -2
- package/docs/design/refusal-inventory.md +26 -0
- package/docs/design/roadmap.md +4 -0
- package/docs/design/task-board.md +17 -1
- package/docs/dogfood.md +27 -11
- package/docs/events.md +9 -0
- package/docs/friction.md +46 -0
- package/docs/memory.md +35 -3
- package/docs/operations.md +95 -16
- package/docs/profiles.md +1 -0
- package/docs/quickstart.md +14 -2
- package/docs/roles.md +6 -0
- package/docs/sdlc.md +44 -1
- package/docs/security.md +29 -12
- package/docs/specs/2026-09-19-agent-hub-design.md +17 -0
- package/docs/specs/2026-09-19-multi-project-design.md +7 -1
- package/docs/verification/2026-11-25-agy-1.5.16.md +31 -0
- package/docs/verification/2026-11-25-claude-implementer-2.1.332.md +47 -0
- package/docs/verification/2026-11-25-codex-0172-reviewer-isolation.md +47 -0
- package/docs/verification/2026-11-25-kimi-272-reviewer-compat.md +38 -0
- package/docs/verification/2026-11-25-kimi-tui-272.md +14 -0
- package/docs/verification/2026-11-25-pi-160-compat.md +40 -0
- package/docs/verification/2026-11-26-0.47.0.md +43 -0
- package/docs/verification/2026-11-26-0.48.0.md +45 -0
- package/docs/verification/2026-11-26-codex-0172-reviewer-tool-call.md +29 -0
- package/docs/verification/dogfood/2026-11-24.md +2829 -0
- package/docs/verification/pi-160-model-free.ts +57 -0
- package/docs/verification/pi-160-native.mjs +21 -0
- package/docs/verified.json +44 -32
- package/package.json +2 -2
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/kimi-hook.js +598 -131
- package/plugins/agent-hub/server.js +687 -143
- package/src/adapters/acp.ts +5 -0
- package/src/adapters/channel-peer.ts +7 -0
- package/src/adapters/claude-print-child.ts +27 -5
- package/src/adapters/codex-appserver.ts +9 -0
- package/src/adapters/compat.ts +12 -11
- package/src/adapters/configured-acp.ts +45 -2
- package/src/adapters/configured-print.ts +163 -0
- package/src/adapters/conformance/index.ts +1 -0
- package/src/adapters/conformance/print.ts +57 -0
- package/src/adapters/definitions/native-activity.ts +57 -0
- package/src/adapters/definitions/native-factories.ts +4 -2
- package/src/adapters/jcode.ts +10 -2
- package/src/adapters/local-probe.ts +59 -14
- package/src/adapters/local-worker.ts +20 -6
- package/src/adapters/registry-types.ts +5 -3
- package/src/adapters/role-eligibility.ts +5 -0
- package/src/cli/bench.ts +2 -1
- package/src/cli/broker.ts +2 -1
- package/src/cli/capabilities-output.ts +10 -14
- package/src/cli/configured-acp-entry.ts +10 -2
- package/src/cli/console-state.ts +25 -5
- package/src/cli/error-format.ts +2 -0
- package/src/cli/guidance.ts +1 -1
- package/src/cli/handoff-output.ts +20 -17
- package/src/cli/help.ts +79 -41
- package/src/cli/init-settings.ts +15 -0
- package/src/cli/intake-output.ts +13 -13
- package/src/cli/launch.ts +3 -2
- package/src/cli/learn-output.ts +40 -21
- package/src/cli/main.ts +150 -79
- package/src/cli/memory.ts +47 -2
- package/src/cli/output.ts +54 -31
- package/src/cli/roadmap.ts +2 -2
- package/src/cli/room-output.ts +71 -0
- package/src/cli/room.ts +19 -33
- package/src/cli/schedule-output.ts +20 -19
- package/src/cli/sdlc-output.ts +188 -170
- package/src/cli/source-output.ts +17 -14
- package/src/cli/specs.ts +13 -13
- package/src/cli/study-output.ts +66 -69
- package/src/cli/task-output.ts +106 -158
- package/src/cli/terminal-recovery.ts +2 -1
- package/src/cli/upgrade-runtime.ts +2 -1
- package/src/cli/warn-line.ts +18 -0
- package/src/cli/worktrees-output.ts +25 -23
- package/src/hub/audit-source.ts +45 -0
- package/src/hub/board.ts +141 -5
- package/src/hub/bus.ts +13 -2
- package/src/hub/config-apply.ts +14 -1
- package/src/hub/config-trust.ts +1 -0
- package/src/hub/control-client.ts +1 -1
- package/src/hub/daemon.ts +390 -47
- package/src/hub/guidance-probe-store.ts +51 -10
- package/src/hub/guidance-probes.ts +25 -7
- package/src/hub/handoff.ts +5 -1
- package/src/hub/hub-tools.ts +23 -5
- package/src/hub/instance-config.ts +3 -3
- package/src/hub/learn-followup.ts +103 -0
- package/src/hub/learning.ts +63 -1
- package/src/hub/manager.ts +15 -1
- package/src/hub/memory-policy.ts +2 -1
- package/src/hub/memory-review.ts +217 -0
- package/src/hub/peer-activity.ts +37 -0
- package/src/hub/peers.ts +3 -0
- package/src/hub/project-move.ts +258 -0
- package/src/hub/registry.ts +16 -5
- package/src/hub/restart.ts +7 -0
- package/src/hub/review-brief.ts +8 -4
- package/src/hub/review-checkout.ts +26 -0
- package/src/hub/review-findings.ts +6 -3
- package/src/hub/risk-tier.ts +129 -0
- package/src/hub/roadmap-check.ts +1 -0
- package/src/hub/routing.ts +3 -1
- package/src/hub/sdlc-merge.ts +9 -0
- package/src/hub/sdlc-metrics.ts +24 -1
- package/src/hub/sdlc-queue.ts +1 -1
- package/src/hub/sdlc.ts +15 -6
- package/src/hub/settings.ts +2 -0
- package/src/hub/spec-readback.ts +136 -0
- package/src/hub/specs.ts +1 -1
- package/src/hub/task-list-page.ts +1 -1
- package/src/hub/tasks.ts +586 -80
- package/src/hub/ui.ts +4 -2
- package/src/local/probe-types.ts +1 -0
- package/src/local/probe-workspace.ts +49 -0
- package/src/omniroute/client.ts +19 -3
- package/src/ui/guidance-panel.ts +2 -2
- package/src/ui/guidance-view.ts +4 -2
- package/src/ui/index.html +26 -2
- package/src/ui/overview-model.ts +138 -0
- package/src/ui/plugin.ts +30 -4
- package/templates/roles/ops/project-manager.md +1 -1
package/src/hub/ui.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { officeModel } from "../ui/office-model.ts";
|
|
|
8
8
|
import { OFFICE_PEER_ORDER, ADAPTER_DISPLAY } from "../adapters/registry.ts";
|
|
9
9
|
import { needs } from "../ui/needs.ts";
|
|
10
10
|
import { roadmapModel } from "../ui/roadmap-model.ts";
|
|
11
|
+
import { overviewModel } from "../ui/overview-model.ts";
|
|
11
12
|
import { createHash, randomBytes } from "node:crypto";
|
|
12
13
|
import { readFileSync } from "node:fs";
|
|
13
14
|
|
|
@@ -27,7 +28,7 @@ const SESSION_MS = 60 * 60_000;
|
|
|
27
28
|
/** How long a session opened by `ahub ui --settings` may change settings that raise authority; it stays an ordinary session after. */
|
|
28
29
|
export const SETTINGS_MS = 15 * 60_000;
|
|
29
30
|
/** The page's view names (index.html DASHBOARD_VIEWS): the only values a snapshot request's `view` may carry to a project hub. */
|
|
30
|
-
export const DASHBOARD_VIEWS = ["board", "office", "stream", "agents", "message", "memory", "settings", "roadmap"] as const;
|
|
31
|
+
export const DASHBOARD_VIEWS = ["board", "office", "stream", "agents", "message", "memory", "settings", "roadmap", "overview"] as const;
|
|
31
32
|
export const dashboardView = (value: unknown): typeof DASHBOARD_VIEWS[number] | undefined => (DASHBOARD_VIEWS as readonly unknown[]).includes(value) ? value as typeof DASHBOARD_VIEWS[number] : undefined;
|
|
32
33
|
const LIMIT = 64;
|
|
33
34
|
const secret = () => randomBytes(32).toString("hex");
|
|
@@ -43,7 +44,8 @@ export function renderDashboard(): { html: string; styles: string[]; markup: str
|
|
|
43
44
|
.replace("/* PEER_START_RETRY_MS */", () => `const PEER_START_RETRY_MS = ${PEER_START_RETRY_MS};`)
|
|
44
45
|
.replace("/* OFFICE_MODEL */", () => `const officeModel = ((OFFICE_PEER_ORDER) => ${officeModel.toString()})(${JSON.stringify(OFFICE_PEER_ORDER)});`)
|
|
45
46
|
.replace("/* NEEDS_MODEL */", () => `const needs = ${needs.toString()};`)
|
|
46
|
-
.replace("/* ROADMAP_MODEL */", () => `const roadmapModel = ${roadmapModel.toString()};`)
|
|
47
|
+
.replace("/* ROADMAP_MODEL */", () => `const roadmapModel = ${roadmapModel.toString()};`)
|
|
48
|
+
.replace("/* OVERVIEW_MODEL */", () => `const overviewModel = ${overviewModel.toString()};`);
|
|
47
49
|
const blocks = (tag: string) => [...html.matchAll(new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`, "g"))].map((m) => m[1]!);
|
|
48
50
|
const body = /<body>([\s\S]*)<\/body>/.exec(html)?.[1] ?? "";
|
|
49
51
|
return { html, styles: blocks("style"), markup: body.replace(/<script>[\s\S]*?<\/script>/g, ""), script: blocks("script").join("\n") };
|
package/src/local/probe-types.ts
CHANGED
|
@@ -50,6 +50,7 @@ export interface ProbeLocalSession {
|
|
|
50
50
|
config: Readonly<ProbeLocalModelConfig>;
|
|
51
51
|
accounting: ProbeLocalEffectScope;
|
|
52
52
|
reserve(charges: ProbeResourceCharges, descriptor: string): Promise<void>;
|
|
53
|
+
pinnedChat?: Awaited<ReturnType<OmniRoute["pinCampusChat"]>>;
|
|
53
54
|
}
|
|
54
55
|
export interface ProbeLocalResult {
|
|
55
56
|
answer: string;
|
|
@@ -224,6 +224,55 @@ export function probeWorkspaceCurrent(workspace: ProbeWorkspace): void {
|
|
|
224
224
|
}
|
|
225
225
|
export function probeWorkspacePrivateRoot(workspace: ProbeWorkspace): string { probeWorkspaceCurrent(workspace); return workspaces.get(workspace)!.parent; }
|
|
226
226
|
export function probeWorkspaceTemporaryRoot(workspace: ProbeWorkspace): string { probeWorkspaceCurrent(workspace); return workspaces.get(workspace)!.temporaryRoot; }
|
|
227
|
+
|
|
228
|
+
/** Release an empty-source live workspace after its owner joined the stop and collected output. */
|
|
229
|
+
export function releaseEmptyProbeWorkspace(workspace: ProbeWorkspace): void {
|
|
230
|
+
probeWorkspacePhysical(workspace);
|
|
231
|
+
const state = workspaces.get(workspace)!;
|
|
232
|
+
if (state.identities.length || workspace.files.length) refused();
|
|
233
|
+
const directories = new Map(state.directories.map(entry => [entry.file, entry])), allowedDirectories = new Set(directories.keys());
|
|
234
|
+
const writable = new Set(workspace.allowedWrites);
|
|
235
|
+
for (const file of writable) {
|
|
236
|
+
for (let directory = dirname(file); !allowedDirectories.has(directory); directory = dirname(directory)) {
|
|
237
|
+
if (directory === dirname(directory)) refused();
|
|
238
|
+
allowedDirectories.add(directory);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
const files: { file: string; dev: number; ino: number }[] = [];
|
|
242
|
+
const find = (directory: string): void => {
|
|
243
|
+
const handle = opendirSync(directory);
|
|
244
|
+
try {
|
|
245
|
+
for (let entry = handle.readSync(); entry; entry = handle.readSync()) {
|
|
246
|
+
const file = join(directory, entry.name);
|
|
247
|
+
if (allowedDirectories.has(file)) {
|
|
248
|
+
const existing = directories.get(file);
|
|
249
|
+
if (existing) requireDirectory(existing);
|
|
250
|
+
else directories.set(file, directoryIdentity(file));
|
|
251
|
+
find(file);
|
|
252
|
+
} else if (writable.has(file)) {
|
|
253
|
+
const stat = lstatSync(file);
|
|
254
|
+
if (!stat.isFile() || stat.nlink !== 1) refused();
|
|
255
|
+
files.push({ file, dev: stat.dev, ino: stat.ino });
|
|
256
|
+
} else refused();
|
|
257
|
+
}
|
|
258
|
+
} finally { handle.closeSync(); }
|
|
259
|
+
};
|
|
260
|
+
find(state.parent);
|
|
261
|
+
const requireParents = (file: string): void => {
|
|
262
|
+
for (let directory = dirname(file); directories.has(directory); directory = dirname(directory))
|
|
263
|
+
requireDirectory(directories.get(directory)!);
|
|
264
|
+
};
|
|
265
|
+
for (const entry of files) {
|
|
266
|
+
requireParents(entry.file);
|
|
267
|
+
const stat = lstatSync(entry.file);
|
|
268
|
+
if (!stat.isFile() || stat.nlink !== 1 || stat.dev !== entry.dev || stat.ino !== entry.ino) refused();
|
|
269
|
+
unlinkSync(entry.file);
|
|
270
|
+
}
|
|
271
|
+
for (const entry of [...directories.values()].sort((a, b) => b.file.length - a.file.length)) {
|
|
272
|
+
requireParents(entry.file); requireDirectory(entry); rmdirSync(entry.file);
|
|
273
|
+
}
|
|
274
|
+
workspaces.delete(workspace);
|
|
275
|
+
}
|
|
227
276
|
/** Local conservative ceiling, called before the owner ledger's compound admission; never performs a second ledger effect. */
|
|
228
277
|
export function reserveProbeWorkspaceBytes(workspace: ProbeWorkspace, bytes: number): void {
|
|
229
278
|
probeWorkspaceCurrent(workspace); const state = workspaces.get(workspace)!;
|
package/src/omniroute/client.ts
CHANGED
|
@@ -45,6 +45,7 @@ export interface ChatOptions {
|
|
|
45
45
|
onCampusOnly?: boolean;
|
|
46
46
|
signal?: AbortSignal;
|
|
47
47
|
}
|
|
48
|
+
type ChatRequest = { model: string; messages: ChatMessage[]; tools?: unknown[]; max_tokens?: number; temperature?: number; reasoning_effort?: string };
|
|
48
49
|
|
|
49
50
|
const readSecret = (file?: string) => {
|
|
50
51
|
try {
|
|
@@ -155,10 +156,24 @@ export class OmniRoute {
|
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
|
|
158
|
-
async chat(body:
|
|
159
|
+
async chat(body: ChatRequest, opts: ChatOptions = {}): Promise<ChatResult> {
|
|
159
160
|
const base = await this.base();
|
|
160
161
|
if (!base) throw new Error("no model gateway is configured or reachable (omniroute.urls in .agenthub/config.json; see ahub doctor)");
|
|
161
162
|
if (opts.onCampusOnly && this.isAccessHost(base)) throw new Error("PII model calls require the confirmed campus gateway");
|
|
163
|
+
return this.chatAt(base, body, opts);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** A single endpoint and model for a confined experiment, with no route selection after admission. */
|
|
167
|
+
async pinCampusChat(model: string): Promise<(body: Omit<ChatRequest, "model">, signal: AbortSignal) => Promise<ChatResult>> {
|
|
168
|
+
const onCampus = await this.onCampus();
|
|
169
|
+
const base = this.live;
|
|
170
|
+
if (!base) throw new Error("campus gateway unavailable (no healthy endpoint); run ahub doctor");
|
|
171
|
+
if (this.isAccessHost(base)) throw new Error("campus gateway unavailable (Access endpoint selected); run ahub doctor on campus");
|
|
172
|
+
if (!onCampus) throw new Error("campus gateway unavailable (campus connection unconfirmed); run ahub doctor");
|
|
173
|
+
return (body, signal) => this.chatAt(base, { ...body, model }, { signal }, true);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private async chatAt(base: string, body: ChatRequest, opts: ChatOptions, pinned = false): Promise<ChatResult> {
|
|
162
177
|
const headers: Record<string, string> = { "content-type": "application/json" };
|
|
163
178
|
const key = this.apiKey();
|
|
164
179
|
if (!key) throw new Error("no OmniRoute API key (set OMNIROUTE_API_KEY or omniroute.api_key_file)");
|
|
@@ -167,15 +182,16 @@ export class OmniRoute {
|
|
|
167
182
|
try {
|
|
168
183
|
res = await fetch(`${base}/chat/completions`, {
|
|
169
184
|
method: "POST",
|
|
185
|
+
...(pinned ? { redirect: "error" as const } : {}),
|
|
170
186
|
headers,
|
|
171
187
|
body: JSON.stringify({ ...body, messages: body.messages.map(({ is_error: _internalError, ...message }) => message), stream: false }),
|
|
172
188
|
...(opts.signal ? { signal: opts.signal } : {}),
|
|
173
189
|
});
|
|
174
190
|
} catch (e) {
|
|
175
|
-
this.live = undefined; // probe again next time: the VPN may have dropped
|
|
191
|
+
if (!pinned) this.live = undefined; // probe again next time: the VPN may have dropped
|
|
176
192
|
throw e;
|
|
177
193
|
}
|
|
178
|
-
if (!res.ok) throw new Error(`model call failed: HTTP ${res.status} ${(await res.text()).slice(0, 300)}`);
|
|
194
|
+
if (!res.ok) throw new Error(`model call failed: HTTP ${res.status}${pinned ? "" : ` ${(await res.text()).slice(0, 300)}`}`);
|
|
179
195
|
const json = (await res.json()) as { choices?: { message?: ChatMessage }[]; usage?: unknown; model?: unknown };
|
|
180
196
|
const message = json.choices?.[0]?.message;
|
|
181
197
|
if (!message) throw new Error("model call returned no message");
|
package/src/ui/guidance-panel.ts
CHANGED
|
@@ -20,7 +20,7 @@ export default (host) => {
|
|
|
20
20
|
const probeLabel = node('label'); probeLabel.append(node('span', 'Probe ID (64 hex)'), probeId);
|
|
21
21
|
const probeButton = node('button', 'Read probe status'); probeButton.type = 'submit';
|
|
22
22
|
probeForm.append(probeLabel, probeButton);
|
|
23
|
-
const probeNote = node('p', 'Probe status
|
|
23
|
+
const probeNote = node('p', 'Probe status reads sealed receipts and the outcome denominator. A run with fixture evidence only claims no live model or worker trial.');
|
|
24
24
|
const probeOutput = node('pre', undefined, 'ahub-guidance-output');
|
|
25
25
|
probeOutput.tabIndex = 0; probeOutput.setAttribute('aria-label', 'Guidance probe status');
|
|
26
26
|
const scopeForm = node('form', undefined, 'ahub-guidance-scope');
|
|
@@ -145,7 +145,7 @@ export default (host) => {
|
|
|
145
145
|
state(typeof result?.error === 'string' && result.ok === false ? result.error : 'Probe status unavailable. Refresh the probe id or check access and guidance_probe_receipts support.'); return;
|
|
146
146
|
}
|
|
147
147
|
probeOutput.textContent = result.lines.join('\n');
|
|
148
|
-
state('Probe status read. Fixture evidence only; every unknown stays unknown.');
|
|
148
|
+
state(result.probe.slots?.some(slot => slot.receipt?.mode === 'live') ? 'Probe status read. Live attempt evidence.' : 'Probe status read. Fixture evidence only; every unknown stays unknown.');
|
|
149
149
|
} catch { if (active(token)) state('Probe status unavailable. Refresh the probe id or check access and guidance_probe_receipts support.'); }
|
|
150
150
|
finally { if (active(token)) { busy = false; update(); } }
|
|
151
151
|
}
|
package/src/ui/guidance-view.ts
CHANGED
|
@@ -49,7 +49,7 @@ const known = (value: number | null): string => value === null ? "unknown" : Str
|
|
|
49
49
|
/**
|
|
50
50
|
* T4 (#1226): the producer's probe status, one text for the plugin panel and the CLI. It states what the host observed and nothing more: a fixture run says
|
|
51
51
|
* `fixture`, a missing measurement says `unknown` and never zero, and every state that is not a success stays visible, so a failed, cancelled or unavailable
|
|
52
|
-
* arm cannot disappear from the denominator.
|
|
52
|
+
* arm cannot disappear from the denominator. Only a host-sealed live record is rendered as a live attempt.
|
|
53
53
|
*/
|
|
54
54
|
export function guidanceProbeStatusLines(exported: ProbeReceiptExport): string[] {
|
|
55
55
|
const status = exported.status, counts = exported.counts;
|
|
@@ -60,7 +60,9 @@ export function guidanceProbeStatusLines(exported: ProbeReceiptExport): string[]
|
|
|
60
60
|
`Attempts: ${status.counters.workerAttempts} worker, ${status.counters.editorAttempts} editor; model calls ${status.counters.modelCalls}; tool calls ${status.counters.toolCalls}.`,
|
|
61
61
|
`Token usage: ${status.counters.usageUnknown || status.counters.modelCalls === 0 ? "unknown" : status.counters.tokensObservedKnown}.`,
|
|
62
62
|
`Cancel requested: ${status.cancelRequested ? "yes" : "no"}.`,
|
|
63
|
-
|
|
63
|
+
exported.slots.some(slot => slot.receipt?.mode === "live")
|
|
64
|
+
? "Live attempt evidence. Upstream fallback policy and sampling control remain unknown."
|
|
65
|
+
: "Fixture evidence only: no live model or worker trial, sampling control, provider behaviour or model quality is claimed."];
|
|
64
66
|
for (const slot of exported.slots) {
|
|
65
67
|
const receipt = slot.receipt;
|
|
66
68
|
lines.push(`Slot ${plain(slot.slotId)}: ${slot.stage}/${slot.role}/${slot.arm}; session ${slot.state}; retained output ${slot.retention}.`);
|
package/src/ui/index.html
CHANGED
|
@@ -240,6 +240,8 @@ details.settings-group .row:last-child{border-bottom:0}
|
|
|
240
240
|
.task-card .task-stage{font-size:var(--text-xs)}
|
|
241
241
|
.board-columns .empty{padding:var(--space-2) 0}
|
|
242
242
|
/* #1483 R5: the roadmap view. Lanes stack at 900px so the page never scrolls sideways on a phone. */
|
|
243
|
+
.overview-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-3);padding:var(--space-4)}.overview-card{border:1px solid var(--line);border-radius:8px;padding:var(--space-3);min-width:0}.overview-card h3{margin:0 0 var(--space-2);font-size:1rem}.overview-card ul{margin:0;padding:0;list-style:none}.overview-card li{display:flex;justify-content:space-between;gap:var(--space-2);overflow-wrap:anywhere}.overview-bars{display:flex;align-items:flex-end;gap:2px;height:48px}.overview-bars i{flex:1;background:currentColor;opacity:.6;min-height:1px}
|
|
244
|
+
@media(max-width:900px){.overview-grid{grid-template-columns:minmax(0,1fr);padding:var(--space-3)}}
|
|
243
245
|
.roadmap-lanes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--space-3);padding:var(--space-4)}
|
|
244
246
|
.roadmap-lane{display:flex;flex-direction:column;gap:var(--space-2);min-width:0}
|
|
245
247
|
.roadmap-lane h3{font-size:var(--text-sm);color:var(--muted)}
|
|
@@ -461,6 +463,7 @@ main[data-stale]>:not(#notice):not(#disconnected){opacity:.6;transition:opacity
|
|
|
461
463
|
<button type="button" data-view-target="memory"><svg class="icon" aria-hidden="true" focusable="false"><use href="#i-memory"/></svg><span class="nav-label">Memory</span></button>
|
|
462
464
|
<button type="button" data-view-target="settings"><svg class="icon" aria-hidden="true" focusable="false"><use href="#i-settings"/></svg><span class="nav-label">Settings</span></button>
|
|
463
465
|
<button type="button" data-view-target="roadmap"><svg class="icon" aria-hidden="true" focusable="false"><use href="#i-board"/></svg><span class="nav-label">Roadmap</span></button>
|
|
466
|
+
<button type="button" data-view-target="overview"><svg class="icon" aria-hidden="true" focusable="false"><use href="#i-board"/></svg><span class="nav-label">Overview</span></button>
|
|
464
467
|
</nav>
|
|
465
468
|
<div class="shell-body">
|
|
466
469
|
<main id="main-content" tabindex="-1">
|
|
@@ -468,6 +471,7 @@ main[data-stale]>:not(#notice):not(#disconnected){opacity:.6;transition:opacity
|
|
|
468
471
|
<div id="notice" class="notice" role="status" aria-live="polite" aria-label="Notices"></div>
|
|
469
472
|
<section class="task-board-section" aria-labelledby="tasks-title" data-view="board"><div class="section-head"><h2 id="tasks-title">Task board</h2><div class="filters"><select id="task-filter" aria-label="Filter tasks by state"><option value="">All states</option><option value="backlog">Backlog</option><option value="proposed">To Do</option><option value="work">Work (including rework)</option><option value="in_progress">In progress</option><option value="in_review">In review</option><option value="approved">Approved</option><option value="cancelled">Cancelled</option><option value="changes_requested">Changes requested</option></select><span id="task-count" class="meta"></span><span id="task-scope" class="meta"></span></div></div><div id="task-progress" class="task-progress" aria-live="polite"></div><div class="board-toolbar"><button id="plan-open" type="button" class="primary" aria-haspopup="dialog">Plan</button><button id="board-back" type="button" hidden>Back to board</button><span id="board-focus-title" class="meta" hidden></span><label for="task-peer-filter">Agent<select id="task-peer-filter"><option value="">All agents</option></select></label><label for="task-milestone-filter">Milestone<select id="task-milestone-filter"><option value="">All milestones</option></select></label><label for="task-release-filter">Release<select id="task-release-filter"><option value="">All releases</option></select></label><label for="task-lanes">View<select id="task-lanes"><option value="columns">By state</option><option value="agents">By agent</option><option value="releases">By release</option></select></label></div><div id="task-legend" class="agent-legend" role="group" aria-label="Agent legend and assignment targets"></div><div id="tasks" class="task-list"><div class="skeleton skeleton-board" aria-hidden="true"><div class="skeleton-col"><span class="skeleton-bar"></span><span class="skeleton-bar skeleton-tall"></span><span class="skeleton-bar skeleton-tall"></span></div><div class="skeleton-col"><span class="skeleton-bar"></span><span class="skeleton-bar skeleton-tall"></span></div><div class="skeleton-col"><span class="skeleton-bar"></span><span class="skeleton-bar skeleton-tall"></span></div><div class="skeleton-col"><span class="skeleton-bar"></span></div><div class="skeleton-col"><span class="skeleton-bar"></span><span class="skeleton-bar skeleton-tall"></span></div></div><p class="empty">Loading the board...</p></div></section>
|
|
470
473
|
<div class="stack">
|
|
474
|
+
<section id="overview-section" aria-labelledby="overview-title" data-view="overview" hidden><div class="section-head"><h2 id="overview-title">Overview</h2><span id="overview-count" class="meta"></span></div><div id="overview-grid" class="overview-grid"><p class="empty">Loading the overview...</p></div></section>
|
|
471
475
|
<section id="roadmap-section" aria-labelledby="roadmap-title" data-view="roadmap" hidden><div class="section-head"><h2 id="roadmap-title">Roadmap</h2><div class="filters"><button id="roadmap-new" type="button" class="primary" aria-haspopup="dialog">New milestone</button><button id="roadmap-check" type="button">Check drift</button><span id="roadmap-count" class="meta"></span></div></div><p id="roadmap-drift" class="meta" role="status" aria-live="polite"></p><div id="roadmap-lanes" class="roadmap-lanes"><p class="empty">Loading the roadmap...</p></div><section id="roadmap-unplaced" aria-labelledby="roadmap-unplaced-title" hidden><div class="section-head"><h3 id="roadmap-unplaced-title">Unplaced</h3><div class="filters"><button id="roadmap-triage" type="button">Suggest placements</button><span id="roadmap-unplaced-count" class="meta"></span></div></div><div id="roadmap-tray" class="roadmap-tray"></div></section></section>
|
|
472
476
|
<section id="office-section" aria-labelledby="office-title" data-view="office" hidden><div class="section-head"><h2 id="office-title">Office</h2><div class="filters"><label for="office-view">Office mode</label><select id="office-view"><option value="off">Off</option><option value="flat">Flat</option><option value="isometric">Isometric</option></select></div></div><div id="office" class="content"></div></section>
|
|
473
477
|
<section aria-labelledby="stream-title" data-view="stream" hidden><div class="section-head"><h2 id="stream-title">Live stream</h2><div class="filters"><div id="stream-filters" class="chips" role="group" aria-label="Filter events by kind"></div><label><input id="follow" type="checkbox" checked> Follow latest</label></div></div><div id="stream" class="stream" tabindex="0" aria-label="Recent hub events"><p class="empty">Waiting for hub activity...</p></div><p id="stream-empty" class="empty" hidden>No events match this filter.</p></section>
|
|
@@ -536,7 +540,7 @@ main[data-stale]>:not(#notice):not(#disconnected){opacity:.6;transition:opacity
|
|
|
536
540
|
<dialog id="task-detail-dialog" aria-labelledby="task-detail-title"><div class="dialog-head"><h2 id="task-detail-title">Task details</h2><button id="task-detail-close" type="button" autofocus>Close details</button></div><div id="task-detail-content"></div></dialog>
|
|
537
541
|
<dialog id="roadmap-detail-dialog" aria-labelledby="roadmap-detail-title"><div class="dialog-head"><h2 id="roadmap-detail-title">Milestone</h2><button id="roadmap-detail-close" type="button" autofocus>Close milestone</button></div><div id="roadmap-detail-content"></div></dialog>
|
|
538
542
|
<dialog id="keys-dialog" aria-labelledby="keys-title"><div class="dialog-head"><h2 id="keys-title">Keyboard shortcuts</h2><button type="button" id="keys-close" aria-label="Close shortcuts"><svg class="icon" aria-hidden="true" focusable="false"><use href="#i-close"/></svg></button></div>
|
|
539
|
-
<dl class="keys-list"><div><dt><kbd>1</kbd>-<kbd>
|
|
543
|
+
<dl class="keys-list"><div><dt><kbd>1</kbd>-<kbd>9</kbd></dt><dd>Switch view: Board, Office, Stream, Agents, Message, Memory, Settings, Roadmap, Overview</dd></div><div><dt><kbd>?</kbd></dt><dd>Show this list</dd></div><div><dt><kbd>Esc</kbd></dt><dd>Close the open sheet or task detail</dd></div></dl>
|
|
540
544
|
<p class="meta">Keys are ignored while you type in a field, and with Ctrl, Alt or Cmd held.</p></dialog>
|
|
541
545
|
<footer>Loopback session. Private task content stays in the terminal. Reopen with <code>ahub ui</code> when your session expires.</footer>
|
|
542
546
|
<script>
|
|
@@ -546,6 +550,7 @@ main[data-stale]>:not(#notice):not(#disconnected){opacity:.6;transition:opacity
|
|
|
546
550
|
/* BOARD_MODEL */
|
|
547
551
|
/* ADAPTER_DISPLAY */
|
|
548
552
|
/* NEEDS_MODEL */
|
|
553
|
+
/* OVERVIEW_MODEL */
|
|
549
554
|
/* ROADMAP_MODEL */
|
|
550
555
|
/* OFFICE_MODEL */
|
|
551
556
|
const officeView = (() => {
|
|
@@ -556,7 +561,7 @@ const officeView = (() => {
|
|
|
556
561
|
const themeControl = document.getElementById('theme'); themeControl.value = dashboardTheme.get(); themeControl.addEventListener('change', () => dashboardTheme.set(themeControl.value));
|
|
557
562
|
const officeControl = document.getElementById('office-view'); officeControl.value = officeView.get(); document.getElementById('office-section').hidden = officeView.get() === 'off'; officeControl.addEventListener('change', () => { officeView.set(officeControl.value); if (lastSnapshot) render(lastSnapshot); else document.getElementById('office-section').hidden = officeView.get() === 'off'; applyDashboardView(); });
|
|
558
563
|
// dashboard-navigation-begin
|
|
559
|
-
const DASHBOARD_VIEWS = ['board','office','stream','agents','message','memory','settings','roadmap'];
|
|
564
|
+
const DASHBOARD_VIEWS = ['board','office','stream','agents','message','memory','settings','roadmap','overview'];
|
|
560
565
|
let currentView = dashboardCookie.get('agent-hub-view', 'board');
|
|
561
566
|
if (!DASHBOARD_VIEWS.includes(currentView)) currentView = 'board';
|
|
562
567
|
function applyDashboardView() {
|
|
@@ -2162,6 +2167,24 @@ async function roadmapSettleSuggestion(actionName, id, button) {
|
|
|
2162
2167
|
catch (error) { if (!stopped) notice(error.message, true); }
|
|
2163
2168
|
finally { if (button && !stopped) button.disabled = false; }
|
|
2164
2169
|
}
|
|
2170
|
+
function renderOverview(snapshot) {
|
|
2171
|
+
const block = snapshot && snapshot.overview;
|
|
2172
|
+
if (!block || !Array.isArray(block.throughput)) { if (currentView === 'overview') update('overview-grid', 'loading', target => empty(target, 'Loading the overview...')); return; }
|
|
2173
|
+
const pct = (rate) => rate === null || rate === undefined ? 'unknown' : Math.round(rate * 100) + '%';
|
|
2174
|
+
const when = (time) => time === null || time === undefined ? 'unknown' : new Date(time).toISOString().replace('T', ' ').replace(/:[0-9.]+Z$/, '');
|
|
2175
|
+
const card = (title, body) => { const box = el('div', '', 'overview-card'); box.append(el('h3', title)); box.append(body); return box; };
|
|
2176
|
+
const list = (rows, empty_) => { const ul = el('ul'); if (!rows.length) ul.append(el('li', empty_)); for (const [a, b] of rows) { const li = el('li'); li.append(el('span', a), el('span', b)); ul.append(li); } return ul; };
|
|
2177
|
+
const bars = (values, label) => { const wrap = el('div', '', 'overview-bars'); const max = values.reduce((top, value) => value > top ? value : top, 0) || 1; for (const value of values) { const bar = document.createElement('i'); bar.style.height = Math.round((value / max) * 100) + '%'; bar.title = label + ' ' + value; wrap.append(bar); } return wrap; };
|
|
2178
|
+
$('overview-count').textContent = block.withheld ? block.withheld + ' private withheld' : '';
|
|
2179
|
+
update('overview-grid', block, target => {
|
|
2180
|
+
const weekly = el('div'); weekly.append(bars(block.throughput.map(w => w.done), 'done'), list([['proposed / done, 8 weeks', block.throughput.map(w => w.proposed + '/' + w.done).join(' ')]], ''));
|
|
2181
|
+
target.append(card('Throughput per week', weekly));
|
|
2182
|
+
target.append(card('Pulse per day', bars(block.pulse.map(d => d.events), 'events')));
|
|
2183
|
+
target.append(card('Peer health, 30 days', list(block.health.map(h => [h.peer, 'first pass ' + pct(h.firstPass.rate) + ' of ' + h.firstPass.n + (h.firstPass.unknown ? ' (' + h.firstPass.unknown + ' unknown)' : '') + ', turn errors unknown']), 'No owned tasks.')));
|
|
2184
|
+
target.append(card('Peer workload', list(block.workload.map(w => [w.peer, w.open + ' open: ' + Object.entries(w.states).map(([s, n]) => s + ' ' + n).join(', ')]), 'No open owned tasks.')));
|
|
2185
|
+
target.append(card('Recent trouble', list(block.trouble.map(r => ['#' + r.task + ' ' + r.title, r.kind + ' ' + when(r.at)]), 'Nothing failed recently.')));
|
|
2186
|
+
});
|
|
2187
|
+
}
|
|
2165
2188
|
function renderRoadmap(snapshot) {
|
|
2166
2189
|
const block = roadmapData(snapshot);
|
|
2167
2190
|
if (!block) {
|
|
@@ -2393,6 +2416,7 @@ function render(snapshot) {
|
|
|
2393
2416
|
if (signatures.get('peer-options') !== peerSignature) { signatures.set('peer-options', peerSignature); peerOptions($('owner'), assignable, 'Automatic'); peerOptions($('recipient'), ids, 'All peers'); if (draftChoicesPending) { restoreDraft(true); draftChoicesPending = false; } }
|
|
2394
2417
|
renderBoard(snapshot, peers, ids);
|
|
2395
2418
|
renderRoadmap(snapshot);
|
|
2419
|
+
renderOverview(snapshot);
|
|
2396
2420
|
if (roadmapDetailId !== null) refreshRoadmapDetail();
|
|
2397
2421
|
renderSources(snapshot.sources);
|
|
2398
2422
|
renderApprovals(snapshot.permissions);
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #1514: the dashboard Overview view's pure projection. The daemon hands it the public board history it already holds (the same
|
|
3
|
+
* rows `ahub sdlc metrics` reads), and it returns the five widgets as plain numbers and ids, so the page holds no rule of its
|
|
4
|
+
* own and a test pins every figure without a browser.
|
|
5
|
+
*
|
|
6
|
+
* Self-contained on purpose: the dashboard injects this function's source into the page (`renderDashboard` in
|
|
7
|
+
* `src/hub/ui.ts`), so it keeps every helper inside itself and closes over nothing from this module.
|
|
8
|
+
*
|
|
9
|
+
* A figure the board cannot derive is `null` and the page prints `unknown`, never 0. A private task never reaches a widget: it
|
|
10
|
+
* is counted once in `withheld` and contributes no title, detail, owner or time.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** The slice of a board task the Overview reads: ids, enums and times, never text from a private task. */
|
|
14
|
+
export interface OverviewTask {
|
|
15
|
+
id: number;
|
|
16
|
+
private?: boolean;
|
|
17
|
+
/** Public title; the caller passes `tasks.publicView(task).title`, never the raw one. */
|
|
18
|
+
title: string;
|
|
19
|
+
state: string;
|
|
20
|
+
owner: string | null;
|
|
21
|
+
created: number;
|
|
22
|
+
history: { at: number; by?: string; event: string; evidenceOnly?: true }[];
|
|
23
|
+
/**
|
|
24
|
+
* The task's first-pass approval and the time it counts at, taken by the caller from `taskSample` (src/hub/sdlc-metrics.ts), the
|
|
25
|
+
* one definition `ahub sdlc metrics` uses. Null is unknown. The model never re-derives it, so the two views cannot disagree.
|
|
26
|
+
*/
|
|
27
|
+
firstPass?: 0 | 1 | null;
|
|
28
|
+
sampleAt?: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface OverviewInput {
|
|
32
|
+
tasks: readonly OverviewTask[];
|
|
33
|
+
/** Open stalls (task id and kind), already limited to visible tasks by the caller. */
|
|
34
|
+
stalls?: readonly { task: number; kind: string; at?: number }[];
|
|
35
|
+
now: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface OverviewWeek { start: number; proposed: number; done: number }
|
|
39
|
+
interface OverviewDay { start: number; events: number }
|
|
40
|
+
interface OverviewPeerHealth {
|
|
41
|
+
peer: string;
|
|
42
|
+
/** First-pass approvals over the window: `n` known tasks, `unknown` tasks with no verdict yet, `rate` null when none is known. */
|
|
43
|
+
firstPass: { n: number; unknown: number; rate: number | null };
|
|
44
|
+
/** Turns ended in error is not on the board (it lives in the event log), so it is unknown here, never 0. */
|
|
45
|
+
turnErrors: null;
|
|
46
|
+
}
|
|
47
|
+
interface OverviewWorkload { peer: string; states: Record<string, number>; open: number }
|
|
48
|
+
interface OverviewTrouble { task: number; title: string; kind: "check failed" | "changes_requested" | "stall"; at: number | null }
|
|
49
|
+
interface OverviewView {
|
|
50
|
+
throughput: OverviewWeek[];
|
|
51
|
+
pulse: OverviewDay[];
|
|
52
|
+
health: OverviewPeerHealth[];
|
|
53
|
+
workload: OverviewWorkload[];
|
|
54
|
+
trouble: OverviewTrouble[];
|
|
55
|
+
/** Private tasks, counted and nothing else. */
|
|
56
|
+
withheld: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function overviewModel(input: OverviewInput): OverviewView {
|
|
60
|
+
const DAY = 86_400_000, WEEK = 7 * DAY;
|
|
61
|
+
const now = Number.isFinite(input.now) ? input.now : 0;
|
|
62
|
+
const visible = input.tasks.filter(task => task.private !== true);
|
|
63
|
+
const withheld = input.tasks.length - visible.length;
|
|
64
|
+
const at = (value: unknown): number | null => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
|
|
65
|
+
// Weeks and days are aligned to UTC midnight so a figure does not move with the reader's zone.
|
|
66
|
+
const dayStart = (time: number) => Math.floor(time / DAY) * DAY;
|
|
67
|
+
const today = dayStart(now);
|
|
68
|
+
|
|
69
|
+
// Throughput: tasks proposed vs done per week, the last 8 weeks, oldest first. A task counts as done at its first approval.
|
|
70
|
+
const throughput: OverviewWeek[] = [];
|
|
71
|
+
for (let i = 7; i >= 0; i--) throughput.push({ start: today - (i * 7 + 6) * DAY, proposed: 0, done: 0 });
|
|
72
|
+
const weekOf = (time: number) => {
|
|
73
|
+
const from = throughput[0]!.start, to = throughput[7]!.start + WEEK;
|
|
74
|
+
return time < from || time >= to ? undefined : throughput[Math.floor((time - from) / WEEK)];
|
|
75
|
+
};
|
|
76
|
+
for (const task of visible) {
|
|
77
|
+
const proposed = at(task.created) ?? at(task.history[0]?.at);
|
|
78
|
+
if (proposed !== null) { const week = weekOf(proposed); if (week) week.proposed++; }
|
|
79
|
+
const approved = task.history.find(entry => entry.event === "approved");
|
|
80
|
+
const doneAt = approved ? at(approved.at) : null;
|
|
81
|
+
if (doneAt !== null) { const week = weekOf(doneAt); if (week) week.done++; }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Pulse: board events per day, the last 12 weeks (84 days), oldest first.
|
|
85
|
+
const pulse: OverviewDay[] = [];
|
|
86
|
+
for (let i = 83; i >= 0; i--) pulse.push({ start: today - i * DAY, events: 0 });
|
|
87
|
+
for (const task of visible) for (const entry of task.history) {
|
|
88
|
+
const time = at(entry.at);
|
|
89
|
+
if (time === null) continue;
|
|
90
|
+
const index = Math.floor((dayStart(time) - pulse[0]!.start) / DAY);
|
|
91
|
+
if (index >= 0 && index < pulse.length) pulse[index]!.events++;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Peer health: per owner, first-pass approvals over the last 30 days, from the caller's `taskSample` values. A task whose sample
|
|
95
|
+
// falls before the window is not part of it; a task with no verdict yet counts as unknown, never as a failure.
|
|
96
|
+
const cutoff = now - 30 * DAY;
|
|
97
|
+
const owners = new Map<string, (0 | 1 | null)[]>();
|
|
98
|
+
for (const task of visible) {
|
|
99
|
+
if (!task.owner) continue;
|
|
100
|
+
const sampleAt = at(task.sampleAt);
|
|
101
|
+
if (sampleAt !== null && sampleAt < cutoff) continue;
|
|
102
|
+
const list = owners.get(task.owner) ?? [];
|
|
103
|
+
list.push(task.firstPass === 0 || task.firstPass === 1 ? task.firstPass : null);
|
|
104
|
+
owners.set(task.owner, list);
|
|
105
|
+
}
|
|
106
|
+
const health: OverviewPeerHealth[] = [...owners.entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([peer, values]) => {
|
|
107
|
+
const known = values.filter((value): value is 0 | 1 => value !== null);
|
|
108
|
+
const rate = known.length ? Math.round((known.reduce<number>((sum, value) => sum + value, 0) / known.length) * 1000) / 1000 : null;
|
|
109
|
+
return { peer, firstPass: { n: known.length, unknown: values.length - known.length, rate }, turnErrors: null };
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Peer workload: open tasks per owner by state. An unowned open task is not any peer's workload and is left out.
|
|
113
|
+
const open = new Set(["backlog", "proposed", "in_progress", "in_review", "changes_requested"]);
|
|
114
|
+
const byOwner = new Map<string, Record<string, number>>();
|
|
115
|
+
for (const task of visible) {
|
|
116
|
+
if (!task.owner || !open.has(task.state)) continue;
|
|
117
|
+
const states = byOwner.get(task.owner) ?? {};
|
|
118
|
+
states[task.state] = (states[task.state] ?? 0) + 1;
|
|
119
|
+
byOwner.set(task.owner, states);
|
|
120
|
+
}
|
|
121
|
+
const workload: OverviewWorkload[] = [...byOwner.entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)
|
|
122
|
+
.map(([peer, states]) => ({ peer, states, open: Object.values(states).reduce((sum, count) => sum + count, 0) }));
|
|
123
|
+
|
|
124
|
+
// Recent trouble: the last 20 failed checks, changes_requested verdicts and open stalls, newest first. A stall that has no
|
|
125
|
+
// time of its own sorts last and shows its time as unknown.
|
|
126
|
+
const trouble: OverviewTrouble[] = [];
|
|
127
|
+
for (const task of visible) for (const entry of task.history) {
|
|
128
|
+
const time = at(entry.at);
|
|
129
|
+
if (time === null) continue;
|
|
130
|
+
if (entry.event === "check failed" || entry.event === "check run failed") trouble.push({ task: task.id, title: task.title, kind: "check failed", at: time });
|
|
131
|
+
else if (entry.event === "changes_requested" && entry.evidenceOnly !== true) trouble.push({ task: task.id, title: task.title, kind: "changes_requested", at: time });
|
|
132
|
+
}
|
|
133
|
+
const titles = new Map(visible.map(task => [task.id, task.title] as const));
|
|
134
|
+
for (const stall of input.stalls ?? []) if (titles.has(stall.task)) trouble.push({ task: stall.task, title: titles.get(stall.task)!, kind: "stall", at: at(stall.at) });
|
|
135
|
+
trouble.sort((a, b) => (b.at ?? -1) - (a.at ?? -1) || a.task - b.task);
|
|
136
|
+
|
|
137
|
+
return { throughput, pulse, health, workload, trouble: trouble.slice(0, 20), withheld };
|
|
138
|
+
}
|
package/src/ui/plugin.ts
CHANGED
|
@@ -42,11 +42,15 @@ type ActionResult =
|
|
|
42
42
|
| ({ ok: true } & Record<string, unknown>)
|
|
43
43
|
| { ok: false; error: string; unconfirmed?: true }
|
|
44
44
|
| { ok: false; needsConfirm: true; preview: string[]; fingerprint: string; verb?: string; warnings?: string[] };
|
|
45
|
+
/** #1635: scopes answered per `revision()` call; the rest are dropped, and each key is cut to 200 characters. */
|
|
46
|
+
const REVISION_MAX_SCOPES = 20;
|
|
45
47
|
export interface ConsoleProvider {
|
|
46
48
|
assets: { js: string; css?: string };
|
|
47
49
|
snapshot(input: { after: number; panel: string } & Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
48
50
|
action(input: { action: string; confirmed?: true; fingerprint?: string } & Record<string, unknown>, meta?: ActionMeta): Promise<ActionResult>;
|
|
49
51
|
asset?(input: { id: string }): Promise<{ bytes: Uint8Array; mime: string; name: string } | null>;
|
|
52
|
+
/** #1635: an opaque change token per scope, so a console polls cheaply. `board` changes on every task-board write across the running projects; any other scope is "0". */
|
|
53
|
+
revision?(scopes: string[]): Promise<Record<string, string>>;
|
|
50
54
|
close?(): Promise<void>;
|
|
51
55
|
}
|
|
52
56
|
export interface ConsolePlugin {
|
|
@@ -55,7 +59,7 @@ export interface ConsolePlugin {
|
|
|
55
59
|
open(ctx: { home: string; log(line: string): void; features?: readonly string[] }): Promise<ConsoleProvider>;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
const TITLES: Record<(typeof DASHBOARD_VIEWS)[number], string> = { board: "Board", office: "Office", stream: "Stream", agents: "Agents", message: "Message", memory: "Memory", settings: "Settings", roadmap: "Roadmap" };
|
|
62
|
+
const TITLES: Record<(typeof DASHBOARD_VIEWS)[number], string> = { board: "Board", office: "Office", stream: "Stream", agents: "Agents", message: "Message", memory: "Memory", settings: "Settings", roadmap: "Roadmap", overview: "Overview" };
|
|
59
63
|
/** The dashboard's own actions plus the inbox verbs; the manager whitelist is still applied to each forwarded call. */
|
|
60
64
|
const FORWARDED = ["start", "stop", "send", "pause", "resume", "permit", "propose", "intake", "assign", "backlog_pull", "backlog_return", "planning", "planning_undo", "planner_pull", "backlog_split", "release_new", "release_change", "setting", "setting_undo", "setting_preview", "model_preview", "model_confirm", "setting_reload", "config_edit_preview", "config_edit_apply", "start_peer", "sdlc_queue", "sdlc_release", "worktree_override_set", "worktree_override_clear", "worktrees_refresh_prs",
|
|
61
65
|
// #1483 R5: the roadmap view's writes and reads. The writes raise authority as the person and are confirmed like the
|
|
@@ -183,7 +187,7 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
|
|
|
183
187
|
const registry = options.registry ?? new Registry(join(options.home, "registry.db"));
|
|
184
188
|
const owned = !options.registry;
|
|
185
189
|
const lifecycle = options.lifecycle ?? lazyLifecycle();
|
|
186
|
-
const { list, act, answer, receipt, consoleControl, lineage, guidance, guidanceProbe } = projectConsole({ registry, lifecycle, home: options.home, forwardTimeoutMs: options.forwardTimeoutMs });
|
|
190
|
+
const { list, act, answer, receipt, consoleControl, lineage, guidance, guidanceProbe, boardRevision } = projectConsole({ registry, lifecycle, home: options.home, forwardTimeoutMs: options.forwardTimeoutMs });
|
|
187
191
|
const dashboard = panelAssets(), guide = guidancePanelAssets();
|
|
188
192
|
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) => {
|
|
189
193
|
const dashboardMount = host.mount.ownerDocument.createElement('div'), guidanceMount = host.mount.ownerDocument.createElement('div');
|
|
@@ -604,6 +608,21 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
|
|
|
604
608
|
return null;
|
|
605
609
|
}
|
|
606
610
|
},
|
|
611
|
+
async revision(scopes) {
|
|
612
|
+
const out: Record<string, string> = {};
|
|
613
|
+
for (const scope of scopes.slice(0, REVISION_MAX_SCOPES)) {
|
|
614
|
+
const key = typeof scope === "string" ? scope.slice(0, 200) : "";
|
|
615
|
+
out[key] = "0";
|
|
616
|
+
if (key !== "board") continue;
|
|
617
|
+
const projects = await running();
|
|
618
|
+
// A bare number per running project from the cheap console-role `board_revision` read, never the board snapshot. Only ids and numbers are folded, never a title or any task text.
|
|
619
|
+
// One unknown counter (an older hub, a failed read, a project that vanished) makes the whole value "0": the console fetches, instead of believing the board never changes.
|
|
620
|
+
const counters = await Promise.all(projects.map(async (project) => ({ project, counter: await boardRevision({ projectId: project.id, instanceId: project.instanceId }) })));
|
|
621
|
+
out[key] = counters.length && counters.every(({ counter }) => counter !== undefined)
|
|
622
|
+
? createHash("sha256").update(counters.map(({ project, counter }) => `${project.id}:${project.instanceId}:${counter}`).sort().join("|")).digest("hex").slice(0, 32) : "0";
|
|
623
|
+
}
|
|
624
|
+
return out;
|
|
625
|
+
},
|
|
607
626
|
async close() { if (owned) registry.close(); },
|
|
608
627
|
};
|
|
609
628
|
|
|
@@ -661,12 +680,19 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
|
|
|
661
680
|
*/
|
|
662
681
|
const POLL_MS = 2_000, INBOX_MAX_AGE_MS = 1_000, SPACE_MAX_AGE_MS = POLL_MS;
|
|
663
682
|
|
|
683
|
+
// The pinned console contract accepts extra manifest fields and continues using panels as its route allowlist.
|
|
684
|
+
const capabilities = {
|
|
685
|
+
actions: [...FORWARDED, ...INBOX_VERBS, ...QUESTION_ACTIONS, ...RESULT_ADVERTISED, ...REVIEW_ACTIONS],
|
|
686
|
+
reads: ["lineage"], confirm: true, multiProject: true, inbox: true, inboxMaxAgeMs: INBOX_MAX_AGE_MS,
|
|
687
|
+
space: true, spaceMaxAgeMs: SPACE_MAX_AGE_MS,
|
|
688
|
+
// ponytail: `revision: true` is not declared. The pinned @staix/agent-console 0.2.0 has no revision contract (agent-console#123); the provider answers revision() already. Ceiling: a console that never asks. Upgrade: declare it when the pin moves to the 0.3.x that ships the contract.
|
|
689
|
+
};
|
|
690
|
+
|
|
664
691
|
const plugin: ConsolePlugin = {
|
|
665
692
|
manifest: {
|
|
666
693
|
api: 1, tool: "ahub", version, title: "agent-hub", icon: "agents", pollMs: POLL_MS,
|
|
667
694
|
panels: [...DASHBOARD_VIEWS.map((id, order) => ({ id, title: TITLES[id], order })), { id: "guidance", title: "Guidance", order: DASHBOARD_VIEWS.length }],
|
|
668
|
-
capabilities
|
|
669
|
-
inbox: true, inboxMaxAgeMs: INBOX_MAX_AGE_MS, space: true, spaceMaxAgeMs: SPACE_MAX_AGE_MS },
|
|
695
|
+
capabilities,
|
|
670
696
|
},
|
|
671
697
|
async open(ctx) { return createProvider({ home: ctx.home, log: ctx.log, features: ctx.features }); },
|
|
672
698
|
};
|
|
@@ -17,7 +17,7 @@ Do not invent progress, assign authority through prose or commit other people to
|
|
|
17
17
|
Reviewable task plan, dependency and risk notes, owner and date proposals, acceptance criteria, and decisions or missing inputs requiring a person.
|
|
18
18
|
|
|
19
19
|
## Hub use
|
|
20
|
-
Use the existing planning flow and task board. Reference the source request and affected paths; surface overlap, blockers and scope changes through the established coordination tools.
|
|
20
|
+
Use the existing planning flow and task board. Reference the source request and affected paths; surface overlap, blockers and scope changes through the established coordination tools. Split or hand off only for a named `reason` on `hub_task_propose` (explore, parallel, context, verify, capability, person); parallel siblings need disjoint paths.
|
|
21
21
|
|
|
22
22
|
## Review duties
|
|
23
23
|
Check that each proposed outcome has an owner, a feasible dependency order and observable completion evidence. Keep unknown capacity and unaccepted dates explicit.
|