@staix/agent-hub 0.38.0 → 0.39.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 +45 -0
- package/README.md +17 -7
- package/docs/adding-an-ai-tool.md +6 -4
- package/docs/agent-notes/README.md +16 -0
- package/docs/agent-notes/adapters.md +4 -2
- package/docs/agent-notes/budget.md +8 -0
- package/docs/agent-notes/daemon.md +15 -8
- package/docs/agent-notes/local-worker.md +1 -1
- package/docs/agent-notes/security-review.md +55 -0
- package/docs/agent-notes/tasks.md +15 -4
- package/docs/agent-notes/tests.md +3 -2
- package/docs/design/adapters.md +51 -0
- package/docs/design/agent-hub-architecture.md +29 -1
- package/docs/design/task-board.md +151 -5
- package/docs/dogfood.md +20 -6
- package/docs/events.md +3 -3
- package/docs/memory.md +5 -5
- package/docs/operations.md +177 -28
- package/docs/profiles.md +100 -8
- package/docs/quickstart.md +32 -4
- package/docs/research.md +6 -3
- package/docs/roles.md +52 -0
- package/docs/sdlc.md +187 -1
- package/docs/security.md +50 -11
- package/docs/text-projection.md +1 -0
- package/docs/verification/2026-11-13-claude-implementer-2.1.323.md +59 -0
- package/docs/verification/2026-11-13-codex-01672-reviewer-isolation.md +69 -0
- package/docs/verification/2026-11-14-0.39.0.md +51 -0
- package/docs/verified.json +48 -25
- package/package.json +3 -3
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/kimi-hook.js +1953 -460
- package/plugins/agent-hub/server.js +2019 -498
- package/src/adapters/acp-model-policy.ts +1 -1
- package/src/adapters/acp-session-model.ts +35 -0
- package/src/adapters/acp.ts +14 -0
- package/src/adapters/agy/definition.ts +1 -1
- package/src/adapters/agy/hooks.ts +7 -0
- package/src/adapters/claude-channel.ts +1 -1
- package/src/adapters/claude-implementer.ts +8 -0
- package/src/adapters/claude-print-child.ts +26 -2
- package/src/adapters/claude-print.ts +4 -0
- package/src/adapters/codex-appserver.ts +90 -16
- package/src/adapters/codex-review-isolation.ts +2 -0
- package/src/adapters/compat.ts +4 -4
- package/src/adapters/conformance/fakes/acp-server.ts +11 -2
- package/src/adapters/conformance/fakes/app-server.ts +5 -1
- package/src/adapters/conformance/fakes/pi-rpc.ts +1 -1
- package/src/adapters/definitions/builtin-metadata.ts +6 -6
- package/src/adapters/definitions/native-cli-jcode-mcp.ts +18 -3
- package/src/adapters/definitions/native-quota.ts +122 -0
- package/src/adapters/definitions/native-recovery.ts +3 -0
- package/src/adapters/definitions/qwen.ts +1 -1
- package/src/adapters/kimi-review.ts +23 -0
- package/src/adapters/kimi-wire-usage.ts +39 -16
- package/src/adapters/local-worker.ts +6 -3
- package/src/adapters/pi-state-model.ts +12 -0
- package/src/adapters/pi.ts +22 -0
- package/src/adapters/print-result-model.ts +24 -0
- package/src/adapters/registry-types.ts +10 -1
- package/src/adapters/registry.ts +19 -2
- package/src/adapters/reviewer-print.ts +130 -15
- package/src/adapters/role-eligibility.ts +99 -0
- package/src/adapters/same-directory.ts +16 -0
- package/src/cli/agy-mcp.ts +18 -7
- package/src/cli/console-state.ts +3 -1
- package/src/cli/free-text.ts +20 -0
- package/src/cli/handoff-args.ts +1 -1
- package/src/cli/help.ts +61 -6
- package/src/cli/identity.ts +10 -4
- package/src/cli/init-prompt.ts +31 -2
- package/src/cli/init-roles.ts +156 -0
- package/src/cli/init-settings.ts +24 -2
- package/src/cli/init.ts +139 -17
- package/src/cli/main.ts +194 -49
- package/src/cli/model.ts +1 -1
- package/src/cli/output.ts +56 -1
- package/src/cli/preview.ts +1 -1
- package/src/cli/recovery-launch.ts +114 -0
- package/src/cli/recovery-package.ts +14 -7
- package/src/cli/recovery-version-preflight.ts +104 -0
- package/src/cli/role-doctor.ts +39 -0
- package/src/cli/sdlc-output.ts +66 -1
- package/src/cli/study-output.ts +54 -0
- package/src/cli/study.ts +14 -1
- package/src/cli/terminal-recovery.ts +14 -0
- package/src/cli/upgrade-presentation.ts +4 -0
- package/src/cli/upgrade-restore-state.ts +12 -3
- package/src/cli/upgrade-runtime.ts +40 -2
- package/src/cli/upgrade.ts +8 -4
- package/src/hub/advisor-survey.ts +139 -0
- package/src/hub/audit-source.ts +66 -0
- package/src/hub/board.ts +479 -14
- package/src/hub/budget.ts +54 -4
- package/src/hub/conductor.ts +14 -8
- package/src/hub/config-apply.ts +2 -1
- package/src/hub/config-edit-host.ts +77 -5
- package/src/hub/considered-findings.ts +47 -0
- package/src/hub/control-client.ts +1 -1
- package/src/hub/daemon.ts +343 -58
- package/src/hub/deliverable-files.ts +17 -1
- package/src/hub/dogfood-profile.ts +3 -2
- package/src/hub/events.ts +23 -2
- package/src/hub/folder-trigger.ts +11 -4
- package/src/hub/hub-tools.ts +88 -16
- package/src/hub/kimi-usage.ts +34 -2
- package/src/hub/lifecycle-schema.ts +3 -3
- package/src/hub/memory-profile.ts +9 -1
- package/src/hub/memory-sync-state.ts +1 -0
- package/src/hub/model-overrides.ts +2 -1
- package/src/hub/no-writes.ts +2 -0
- package/src/hub/operational-authority.ts +6 -1
- package/src/hub/operational-view.ts +5 -1
- package/src/hub/peers.ts +2 -0
- package/src/hub/plan-conformance.ts +20 -2
- package/src/hub/quota-account.ts +34 -0
- package/src/hub/recovery-policy.ts +18 -4
- package/src/hub/research-evidence.ts +51 -3
- package/src/hub/research.ts +77 -13
- package/src/hub/restart.ts +14 -0
- package/src/hub/review-budget.ts +88 -0
- package/src/hub/review-findings.ts +93 -12
- package/src/hub/reviewer-pool-config.ts +6 -2
- package/src/hub/reviewer-pool.ts +39 -6
- package/src/hub/routing.ts +7 -3
- package/src/hub/sdlc-merge.ts +1 -1
- package/src/hub/sdlc-queue.ts +14 -4
- package/src/hub/sdlc-release.ts +1 -1
- package/src/hub/sdlc.ts +10 -6
- package/src/hub/security-audit.ts +178 -0
- package/src/hub/security-pass.ts +115 -0
- package/src/hub/settings.ts +11 -5
- package/src/hub/source-read.ts +80 -2
- package/src/hub/sources.ts +57 -9
- package/src/hub/startup-event-seeds.ts +5 -3
- package/src/hub/startup-timing.ts +1 -0
- package/src/hub/synthesis-readiness.ts +279 -0
- package/src/hub/tasks.ts +1083 -69
- package/src/hub/text-projection.ts +11 -1
- package/src/memory/capture.ts +2 -1
- package/src/ui/index.html +3 -0
- package/src/ui/office-model.ts +11 -3
- package/src/ui/office-space.ts +50 -30
- package/src/ui/plugin.ts +21 -11
|
@@ -10,7 +10,8 @@ import { profile, sandboxAvailable } from "../local/sandbox.ts";
|
|
|
10
10
|
export type ProjectionConfig = Record<string, string[]>;
|
|
11
11
|
const EMPTY_ROOT = "/var/empty";
|
|
12
12
|
export const MAX_PROJECTION_INPUT = 16 * 1024 * 1024;
|
|
13
|
-
const
|
|
13
|
+
export const MAX_PROJECTION_TEXT = 256 * 1024;
|
|
14
|
+
const MAX_INPUT = MAX_PROJECTION_INPUT, MAX_TEXT = MAX_PROJECTION_TEXT;
|
|
14
15
|
/** Only machine-local config chooses programs; no implicit shell or command-string parsing. */
|
|
15
16
|
export function projectionConfig(raw: unknown): ProjectionConfig {
|
|
16
17
|
if (raw === undefined) return {};
|
|
@@ -67,6 +68,15 @@ export class TextProjections {
|
|
|
67
68
|
}
|
|
68
69
|
get enabled(): boolean { return Object.keys(this.options.config).length > 0; }
|
|
69
70
|
handles(file: string): boolean { return !!this.options.config[extname(file).toLowerCase()]; }
|
|
71
|
+
/** Current configured converter identity, without reading a source or running conversion. */
|
|
72
|
+
fingerprint(file: string): string | undefined {
|
|
73
|
+
const argv = this.options.config[extname(file).toLowerCase()];
|
|
74
|
+
if (!argv) return undefined;
|
|
75
|
+
try {
|
|
76
|
+
const commandHash = commandFingerprint(this.options.cwd, argv);
|
|
77
|
+
return this.options.projectRoot === undefined ? commandHash : hash(commandHash + "\nproject-root:" + realPath(this.options.projectRoot));
|
|
78
|
+
} catch { return undefined; }
|
|
79
|
+
}
|
|
70
80
|
project(file: string): ProjectedText | undefined {
|
|
71
81
|
const ext = extname(file).toLowerCase(), argv = this.options.config[ext];
|
|
72
82
|
if (!argv) return undefined;
|
package/src/memory/capture.ts
CHANGED
|
@@ -40,7 +40,8 @@ export class Capture {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
observe(call: { tool: string; args: string; output: string; id: string; paths: string[]; sourceId?: string }): void {
|
|
43
|
-
if (
|
|
43
|
+
if (call.tool.replace(/^mcp__[^ ]+__/, "") === "hub_survey_report") return;
|
|
44
|
+
if (!this.sessionId || GUIDANCE_TOOL_NAMES.has(call.tool.replace(/^mcp__[^ ]+__/, "")) || call.tool.replace(/^mcp__[^ ]+__/, "") === "hub_audit_report" || LINEAGE_TOOL_NAMES.has(call.tool.replace(/^mcp__[^ ]+__/, "")) || reviewCaptureExcluded(call.tool, call.args) || ((MEMORY_READ_TOOLS.has(call.tool.replace(/^mcp__[^ ]+__/, "")) || BOUNDED_TASK_TOOLS.has(call.tool.replace(/^mcp__[^ ]+__/, "")) || CAPABILITY_TOOLS.has(call.tool.replace(/^mcp__[^ ]+__/, "")) || STUDY_TOOLS.has(call.tool.replace(/^mcp__[^ ]+__/, "")) || HANDOFF_TOOLS.has(call.tool.replace(/^mcp__[^ ]+__/, ""))) || call.tool.replace(/^mcp__[^ ]+__/, "") === "hub_memory_correct") || call.tool.replace(/^mcp__[^ ]+__/, "") === "hub_source_read" || call.tool.replace(/^mcp__[^ ]+__/, "") === "hub_set_title" || call.tool.replace(/^mcp__[^ ]+__/, "") === "hub_evidence_read" || call.tool.replace(/^mcp__[^ ]+__/, "") === "hub_evidence_record" || this.opts.skip?.includes(call.tool)) return;
|
|
44
45
|
// #1053: a question and its answer are the person's and the peer's words: never memory evidence, whatever the call's paths say.
|
|
45
46
|
if (QUESTION_TOOLS.has(call.tool.replace(/^mcp__[^ ]+__/, ""))) return;
|
|
46
47
|
// Anything that names a denylisted path is kept out of memory entirely, input and output alike.
|
package/src/ui/index.html
CHANGED
|
@@ -855,6 +855,9 @@ function settingRow(row, raise) {
|
|
|
855
855
|
select.value = current[index] || ''; actions.append(select); return select;
|
|
856
856
|
});
|
|
857
857
|
read = () => choices.map(select => select.value).filter(Boolean);
|
|
858
|
+
} else if (row.type === 'number-or-off') {
|
|
859
|
+
const input=el('input');input.type='text';input.id=id;input.name=row.key;input.value=fileValue===null ? '' : String(fileValue);input.placeholder='0..1 or off; empty inherits';input.autocomplete='off';input.autocapitalize='none';input.setAttribute('autocorrect','off');input.spellcheck=false;
|
|
860
|
+
read=()=>{const value=input.value.trim();return value==='' ? null : value==='off' ? 'off' : Number.isFinite(Number(value)) ? Number(value) : value;};actions.append(input);
|
|
858
861
|
} else if (row.type === 'integer' || row.type === 'number') {
|
|
859
862
|
const input=el('input');input.type='number';input.id=id;input.step=row.type === 'number' ? 'any' : '1';input.min=String(row.min ?? 0);input.max=String(row.max ?? Number.MAX_SAFE_INTEGER);const current=fileValue;input.value=current===null ? '' : String(current);input.placeholder='Empty inherits';
|
|
860
863
|
read=()=>input.value==='' ? null : Number(input.value);actions.append(input);
|
package/src/ui/office-model.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { OFFICE_PEER_ORDER } from "../adapters/registry.ts";
|
|
|
3
3
|
/**
|
|
4
4
|
* Pure office scene model for the dashboard (#264, phase 1: the static Flat view).
|
|
5
5
|
* Self-contained so `src/hub/ui.ts` injects it into the page by toString(), exactly like
|
|
6
|
-
* task-progress.ts. Inputs are allowlisted: peer states, queue counts and modes;
|
|
7
|
-
* classes, states, owners, reviewers, deps and public titles; approval counts by peer; budget
|
|
6
|
+
* task-progress.ts. Inputs are allowlisted: peer states, queue counts and modes; a peer's configured roles and the open
|
|
7
|
+
* turn's start; task ids, classes, states, owners, reviewers, deps and public titles; approval counts by peer; budget
|
|
8
8
|
* pause readings. env.body, task detail, approval titles, paths and symbols never enter;
|
|
9
9
|
* test/office-model.test.ts pins that with a marker fixture.
|
|
10
10
|
*/
|
|
@@ -121,6 +121,10 @@ export interface OfficeDesk {
|
|
|
121
121
|
approvals: number;
|
|
122
122
|
tray: { queued: number; important: number; heldBy: string; needsReview: number };
|
|
123
123
|
mode: string;
|
|
124
|
+
/** The project's configured `roles` for this peer (#1375), as configured; absent when it has none. */
|
|
125
|
+
roles?: readonly string[];
|
|
126
|
+
/** The open turn's start, in epoch ms (#1375): the one state-change time the model knows. Absent without a reported turn. */
|
|
127
|
+
turnSince?: number;
|
|
124
128
|
/** "#id class" of the turn's attributed task (phase 3, exact), else of the peer's single in_progress task; empty when unknown. Never guessed. */
|
|
125
129
|
bubble: string;
|
|
126
130
|
/** The peer is paused with a turn still open: "finishing a turn" under the Break sign. */
|
|
@@ -351,6 +355,7 @@ export function officeModel(snapshot: OfficeSnapshotInput, previous: OfficeScene
|
|
|
351
355
|
// The open turn's attributed task names the bubble exactly (phase 3); without it the
|
|
352
356
|
// single-in_progress-task heuristic applies, and otherwise there is no bubble. Never guessed.
|
|
353
357
|
const turn = peer.turn && typeof peer.turn === "object" ? peer.turn : undefined;
|
|
358
|
+
const turnSince = turn && typeof turn.since === "number" && Number.isFinite(turn.since) ? turn.since : undefined;
|
|
354
359
|
const turnTask = turn && typeof turn.task === "number" && Number.isSafeInteger(turn.task) ? turn.task : undefined;
|
|
355
360
|
const bubble = turnTask !== undefined ? `#${turnTask} ${classById.get(turnTask) ?? "task"}`
|
|
356
361
|
: !Object.hasOwn(peer, "turn") && current.length === 1 ? `#${current[0]!.id} ${text(current[0]!.class) || "task"}` : "";
|
|
@@ -363,7 +368,9 @@ export function officeModel(snapshot: OfficeSnapshotInput, previous: OfficeScene
|
|
|
363
368
|
if (finishing) parts.push("finishing a turn");
|
|
364
369
|
if (condition !== "waiting" && count > 0) parts.push(`${count} approval${count === 1 ? "" : "s"} waiting`);
|
|
365
370
|
if (!attached) parts.push("disconnected, work retained");
|
|
366
|
-
const
|
|
371
|
+
const flowRoles = snapshot.status?.roleInfo?.[id]?.flowRoles;
|
|
372
|
+
const roles = Array.isArray(flowRoles) ? flowRoles.filter((role): role is string => typeof role === "string") : [];
|
|
373
|
+
const planner = roles.includes("planner");
|
|
367
374
|
if (planner) parts.push(`planner, ${unplanned} unplanned backlog cards`);
|
|
368
375
|
// An over-full desk shows two chips and a "+N more" line in the third slot.
|
|
369
376
|
const shown = work.length > DESK_CARDS ? work.slice(0, DESK_CARDS - 1) : work;
|
|
@@ -373,6 +380,7 @@ export function officeModel(snapshot: OfficeSnapshotInput, previous: OfficeScene
|
|
|
373
380
|
dimmed: condition === "offline", attached, approvals: count,
|
|
374
381
|
tray: { queued: num(peer.queued), important: num(peer.queuedImportant), heldBy: text(peer.heldBy), needsReview: num(peer.needsReview) },
|
|
375
382
|
mode: text(peer.permissionMode), bubble, breakNote, breakResetsAt,
|
|
383
|
+
...(roles.length ? { roles } : {}), ...(turnSince !== undefined ? { turnSince } : {}),
|
|
376
384
|
finishing,
|
|
377
385
|
cards: shown.map((task, index) => card(task, x + 0.8, y + 8.5 + index * 2.5, DESK_W - 1.6, 2)),
|
|
378
386
|
extraCards: work.length - shown.length,
|
package/src/ui/office-space.ts
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* officeModel() -> acon SpaceScene (#1012 Part 2). Pure: no DOM, no I/O, no clock beyond the model's own.
|
|
2
|
+
* officeModel() -> acon SpaceScene (#1012 Part 2, #1375). Pure: no DOM, no I/O, no clock beyond the model's own.
|
|
3
3
|
*
|
|
4
|
-
* Reads only the scene officeModel built, which is allowlisted by #264 (peer states, queue counts
|
|
5
|
-
* classes, states, owners and public titles; approval counts; link and arc ids). No envelope body, task
|
|
6
|
-
* approval title, path or symbol can reach it, and test/acon-plugin.test.ts pins that with the #264 marker fixture.
|
|
4
|
+
* Reads only the scene officeModel built, which is allowlisted by #264 (peer states, queue counts, modes and configured
|
|
5
|
+
* roles; task ids, classes, states, owners and public titles; approval counts; link and arc ids). No envelope body, task
|
|
6
|
+
* detail, approval title, path or symbol can reach it, and test/acon-plugin.test.ts pins that with the #264 marker fixture.
|
|
7
|
+
*
|
|
8
|
+
* The scene type is acon's own, imported type-only from its pinned contract entry rather than hand-copied, so a field or
|
|
9
|
+
* cap drift fails typecheck here instead of at a person's console.
|
|
7
10
|
*/
|
|
11
|
+
import type { SpaceScene, Tone } from "@staix/agent-console/contract";
|
|
8
12
|
import type { OfficeScene } from "./office-model.ts";
|
|
9
13
|
|
|
10
|
-
type
|
|
11
|
-
|
|
12
|
-
type
|
|
13
|
-
type
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
marks?: { kind: "approval" | "inbox" | "paused" | "mode"; text: string }[]; link: Link }[];
|
|
18
|
-
zones: { id: string; title: string; kind?: ZoneKind; count: number }[];
|
|
19
|
-
cards: { id: string; title: string; zone: string; owner?: string; tone?: Tone; link: Link }[];
|
|
20
|
-
links?: { kind: LinkKind; from: string; to: string; label?: string; at?: string }[];
|
|
21
|
-
}
|
|
14
|
+
export type { SpaceScene };
|
|
15
|
+
|
|
16
|
+
type ActorState = SpaceScene["actors"][number]["state"];
|
|
17
|
+
type ZoneKind = NonNullable<SpaceScene["zones"][number]["kind"]>;
|
|
18
|
+
type LinkKind = NonNullable<SpaceScene["links"]>[number]["kind"];
|
|
19
|
+
type Link = SpaceScene["actors"][number]["link"];
|
|
20
|
+
type Group = NonNullable<SpaceScene["groups"]>[number];
|
|
22
21
|
|
|
23
22
|
const ZONES: Record<string, { kind: ZoneKind; title: string }> = {
|
|
24
23
|
backlog: { kind: "queue", title: "Backlog" },
|
|
@@ -28,6 +27,10 @@ const ZONES: Record<string, { kind: ZoneKind; title: string }> = {
|
|
|
28
27
|
const clip = (text: string, max = 200) => text.length > max ? `${text.slice(0, max - 1)}…` : text;
|
|
29
28
|
const ID = /[^A-Za-z0-9._:-]/g;
|
|
30
29
|
const safeId = (text: string) => text.replace(ID, "_").slice(0, 128);
|
|
30
|
+
const ROLE_LIMIT = 4, ROLE_TEXT_LIMIT = 32;
|
|
31
|
+
/** acon's role bounds: at most 4 public role names of at most 32 characters, in the configured order. */
|
|
32
|
+
const rolesOf = (configured: readonly string[] | undefined): string[] =>
|
|
33
|
+
(configured ?? []).filter((role) => typeof role === "string" && role.trim().length > 0 && role.length <= ROLE_TEXT_LIMIT).slice(0, ROLE_LIMIT);
|
|
31
34
|
|
|
32
35
|
/** officeModel desk condition -> SpaceScene actor state (the shell picks pet rows by state). */
|
|
33
36
|
function actorState(condition: string, attached: boolean, approvals: number, needsReview: number): ActorState {
|
|
@@ -40,12 +43,13 @@ function actorState(condition: string, attached: boolean, approvals: number, nee
|
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
/**
|
|
43
|
-
* Maps one project's office scene. `project.id` prefixes every id so scenes from several projects never collide
|
|
44
|
-
*
|
|
46
|
+
* Maps one project's office scene. `project.id` prefixes every id so scenes from several projects never collide, and it
|
|
47
|
+
* names the scene's group too (#1375): every actor, zone and card carries that `group`, and actor names stay bare because
|
|
48
|
+
* the console shows the group itself. `project.label` titles the group when the caller has a human name for the project.
|
|
45
49
|
*/
|
|
46
50
|
export function officeSpace(model: OfficeScene, project: { id: string; label?: string }, now?: number): SpaceScene {
|
|
47
51
|
const pre = (id: string | number) => safeId(`${project.id}:${id}`);
|
|
48
|
-
const
|
|
52
|
+
const group: Group = { id: safeId(project.id), title: clip((project.label ?? project.id).trim(), 200) || safeId(project.id) };
|
|
49
53
|
// Links name the owning project so a multi-project console opens the right one (the panel's show() selects it).
|
|
50
54
|
const board: Link = { panel: "board", params: { project: project.id } }, agents: Link = { panel: "agents", params: { project: project.id } };
|
|
51
55
|
const actors: SpaceScene["actors"] = model.desks.map((desk) => {
|
|
@@ -58,10 +62,14 @@ export function officeSpace(model: OfficeScene, project: { id: string; label?: s
|
|
|
58
62
|
// The card is only the bubble's attributed task ("#id ..."): a peer reviewing #2 while owning #1 shows #2, an empty bubble shows none.
|
|
59
63
|
const attributed = /^#(\d+) /.exec(desk.bubble)?.[1];
|
|
60
64
|
const card = attributed ? { id: Number(attributed) } : undefined;
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
// `since` is only what the model holds: the open turn's start, so it is present while the actor is working and absent
|
|
66
|
+
// for every other state, which has no change time here. Roles are the project's configured ones, bounded by acon.
|
|
67
|
+
const roles = rolesOf(desk.roles);
|
|
68
|
+
const since = desk.condition === "busy" && desk.turnSince !== undefined ? new Date(desk.turnSince).toISOString() : undefined;
|
|
69
|
+
return { id: pre(desk.id), name: clip(desk.id, 64), state: actorState(desk.condition, desk.attached, desk.approvals, desk.tray.needsReview), group: group.id,
|
|
70
|
+
...(card ? { card: pre(card.id) } : {}), ...(roles.length ? { roles } : {}), ...(since ? { since } : {}), ...(marks.length ? { marks } : {}), link: agents };
|
|
63
71
|
});
|
|
64
|
-
const zones: SpaceScene["zones"] = model.rooms.map((room) => ({ id: pre(room.id), title: ZONES[room.id]?.title ?? clip(room.label, 60), ...(ZONES[room.id] ? { kind: ZONES[room.id]!.kind } : {}), count: Math.max(0, room.count) }));
|
|
72
|
+
const zones: SpaceScene["zones"] = model.rooms.map((room) => ({ id: pre(room.id), title: ZONES[room.id]?.title ?? clip(room.label, 60), ...(ZONES[room.id] ? { kind: ZONES[room.id]!.kind } : {}), count: Math.max(0, room.count), group: group.id }));
|
|
65
73
|
const zoneOf = (placement: string | undefined): string | undefined => {
|
|
66
74
|
if (!placement) return undefined;
|
|
67
75
|
if (placement.startsWith("room:")) return pre(placement.slice(5));
|
|
@@ -78,7 +86,7 @@ export function officeSpace(model: OfficeScene, project: { id: string; label?: s
|
|
|
78
86
|
if (!zone) continue;
|
|
79
87
|
const tone: Tone = card.rework ? "err" : card.waiting ? "warn" : card.state === "approved" ? "ok" : "neutral";
|
|
80
88
|
// label is "#id public title"; the public view already stubs a private task as [pii].
|
|
81
|
-
cards.push({ id: pre(card.id), title: clip(card.label), zone, ...(card.owner ? { owner: pre(card.owner) } : {}), tone, link: board });
|
|
89
|
+
cards.push({ id: pre(card.id), title: clip(card.label), zone, ...(card.owner ? { owner: pre(card.owner) } : {}), tone, group: group.id, link: board });
|
|
82
90
|
}
|
|
83
91
|
const desks = new Set(model.desks.map((d) => d.id));
|
|
84
92
|
const links: NonNullable<SpaceScene["links"]> = [];
|
|
@@ -100,20 +108,32 @@ export function officeSpace(model: OfficeScene, project: { id: string; label?: s
|
|
|
100
108
|
// An attributed task that is not on the floor (not placed) has no card to point at.
|
|
101
109
|
const placedCards = new Set(cards.map((c) => c.id));
|
|
102
110
|
for (const actor of actors) if (actor.card && !placedCards.has(actor.card)) delete actor.card;
|
|
103
|
-
return { actors, zones, cards, links };
|
|
111
|
+
return { groups: [group], actors, zones, cards, links };
|
|
104
112
|
}
|
|
105
113
|
|
|
106
|
-
/** acon's
|
|
107
|
-
export const SPACE_CAPS = { actors:
|
|
114
|
+
/** acon's caps: `actors`, `cards` and `links` are its SPACE_CAPS, `groups` its item bound; over them a scene fails conformance. */
|
|
115
|
+
export const SPACE_CAPS = { actors: 96, groups: 200, cards: 200, links: 128 } as const;
|
|
108
116
|
|
|
109
|
-
/** Joins per-project scenes within acon's caps. */
|
|
117
|
+
/** Joins per-project scenes within acon's caps, keeping every reference inside what was kept. */
|
|
110
118
|
export function mergeSpaces(scenes: SpaceScene[]): SpaceScene {
|
|
119
|
+
// Declare groups first: a record's `group` must reference one of them, so a scene past the group bound loses the reference
|
|
120
|
+
// (pruned like `owner` and `card` below, never left as a dangling id) instead of the whole scene failing conformance; one
|
|
121
|
+
// group per project, so only 200+ running projects reach that.
|
|
122
|
+
const groups: Group[] = [], declared = new Set<string>();
|
|
123
|
+
for (const group of scenes.flatMap((s) => s.groups ?? [])) {
|
|
124
|
+
if (groups.length >= SPACE_CAPS.groups) break;
|
|
125
|
+
if (declared.has(group.id)) continue;
|
|
126
|
+
declared.add(group.id);
|
|
127
|
+
groups.push({ id: group.id, title: group.title });
|
|
128
|
+
}
|
|
129
|
+
const grouped = <T extends { group?: string }>(row: T): T => row.group === undefined || declared.has(row.group) ? row : (({ group: _group, ...rest }) => rest as T)(row);
|
|
111
130
|
// Cap actors and cards first, then keep only references inside what was kept, so links to cut actors never crowd out visible ones.
|
|
112
|
-
const actors = scenes.flatMap((s) => s.actors).slice(0, SPACE_CAPS.actors);
|
|
131
|
+
const actors = scenes.flatMap((s) => s.actors).slice(0, SPACE_CAPS.actors).map(grouped);
|
|
113
132
|
const actorIds = new Set(actors.map((a) => a.id));
|
|
114
|
-
const cards = scenes.flatMap((s) => s.cards).slice(0, SPACE_CAPS.cards).map((c) => c.owner && !actorIds.has(c.owner) ? (({ owner: _owner, ...rest }) => rest)(c) : c);
|
|
133
|
+
const cards = scenes.flatMap((s) => s.cards).slice(0, SPACE_CAPS.cards).map((c) => c.owner && !actorIds.has(c.owner) ? (({ owner: _owner, ...rest }) => rest)(c) : c).map(grouped);
|
|
115
134
|
const cardIds = new Set(cards.map((c) => c.id));
|
|
116
135
|
const kept = actors.map((a) => a.card && !cardIds.has(a.card) ? (({ card: _card, ...rest }) => rest)(a) : a);
|
|
136
|
+
const zones = scenes.flatMap((s) => s.zones).map(grouped);
|
|
117
137
|
const links = scenes.flatMap((s) => s.links ?? []).filter((l) => actorIds.has(l.from) && actorIds.has(l.to));
|
|
118
|
-
return { actors: kept, zones
|
|
138
|
+
return { groups, actors: kept, zones, cards, links: links.slice(Math.max(0, links.length - SPACE_CAPS.links)) };
|
|
119
139
|
}
|
package/src/ui/plugin.ts
CHANGED
|
@@ -8,9 +8,10 @@ import { guidanceLines, guidanceProbeStatusLines } from "./guidance-view.ts";
|
|
|
8
8
|
* no action: every action is checked against the manager's own whitelist, and every view against DASHBOARD_VIEWS.
|
|
9
9
|
* D2: the panel is the `ahub ui` dashboard itself, built from renderDashboard(), with post() routed to the host.
|
|
10
10
|
*
|
|
11
|
-
* Contract: @staix/agent-console api 1
|
|
11
|
+
* Contract: @staix/agent-console api 1. The manifest type is acon's own, imported type-only (#1375); the provider and item
|
|
12
|
+
* shapes below stay structural so agent-hub keeps zero runtime dependencies.
|
|
12
13
|
*/
|
|
13
|
-
import type { VisualPayload, VisualSide, ActionMeta } from "@staix/agent-console/contract";
|
|
14
|
+
import type { VisualPayload, VisualSide, ActionMeta, ConsolePanelManifest } from "@staix/agent-console/contract";
|
|
14
15
|
import { createHash } from "node:crypto";
|
|
15
16
|
import { join } from "node:path";
|
|
16
17
|
import { Registry } from "../hub/registry.ts";
|
|
@@ -49,11 +50,8 @@ export interface ConsoleProvider {
|
|
|
49
50
|
close?(): Promise<void>;
|
|
50
51
|
}
|
|
51
52
|
export interface ConsolePlugin {
|
|
52
|
-
manifest:
|
|
53
|
-
|
|
54
|
-
panels: { id: string; title: string; order?: number }[];
|
|
55
|
-
capabilities?: { actions?: string[]; confirm?: boolean; multiProject?: boolean; inbox?: boolean; space?: boolean };
|
|
56
|
-
};
|
|
53
|
+
/** acon's own manifest type, imported type-only: a field or bound the console does not know fails typecheck here (#1375). */
|
|
54
|
+
manifest: ConsolePanelManifest;
|
|
57
55
|
open(ctx: { home: string; log(line: string): void; features?: readonly string[] }): Promise<ConsoleProvider>;
|
|
58
56
|
}
|
|
59
57
|
|
|
@@ -414,9 +412,11 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
|
|
|
414
412
|
const cursor = Number.isSafeInteger(snap.cursor) && Number(snap.cursor) >= 0 ? Number(snap.cursor) : 0;
|
|
415
413
|
next.set(project.id, { instanceId: project.instanceId, cursor, model });
|
|
416
414
|
cursors.push([project.id, project.instanceId, cursor]);
|
|
417
|
-
|
|
415
|
+
// #1375: the project is the scene's group, always named by its directory, so the console shows the group instead of a
|
|
416
|
+
// name prefix on every actor (a lone project's id is not a human name).
|
|
417
|
+
const label = project.root.split("/").filter(Boolean).pop() ?? project.id;
|
|
418
418
|
// Keep the wall clock here even when the model is reused: message arcs expire without a daemon event.
|
|
419
|
-
scenes.push(officeSpace(model, { id: project.id,
|
|
419
|
+
scenes.push(officeSpace(model, { id: project.id, label }, Date.now()));
|
|
420
420
|
}
|
|
421
421
|
const scene = mergeSpaces(scenes);
|
|
422
422
|
if (generation !== inboxGeneration) return { scene, cursor: 0 };
|
|
@@ -643,11 +643,21 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
|
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
645
|
|
|
646
|
+
/**
|
|
647
|
+
* #1375 (acon#105): how long acon may reuse a snapshot instead of asking again, 0-60000 ms. The inbox provider serves a
|
|
648
|
+
* result under its own `inboxFreshMs` as it is and recomputes past it, so declaring more than that would hand the console a
|
|
649
|
+
* value the provider would already have refreshed, and a person acts on an approval it missed. A Space scene's only
|
|
650
|
+
* time-dependent content is its message arcs, which expire on a 10 s window, so one poll interval of reuse cannot show the
|
|
651
|
+
* page anything older than the poll it would have drawn anyway.
|
|
652
|
+
*/
|
|
653
|
+
const POLL_MS = 2_000, INBOX_MAX_AGE_MS = 1_000, SPACE_MAX_AGE_MS = POLL_MS;
|
|
654
|
+
|
|
646
655
|
const plugin: ConsolePlugin = {
|
|
647
656
|
manifest: {
|
|
648
|
-
api: 1, tool: "ahub", version, title: "agent-hub", icon: "agents", pollMs:
|
|
657
|
+
api: 1, tool: "ahub", version, title: "agent-hub", icon: "agents", pollMs: POLL_MS,
|
|
649
658
|
panels: [...DASHBOARD_VIEWS.map((id, order) => ({ id, title: TITLES[id], order })), { id: "guidance", title: "Guidance", order: DASHBOARD_VIEWS.length }],
|
|
650
|
-
capabilities: { actions: [...FORWARDED, ...INBOX_VERBS, ...QUESTION_ACTIONS, ...RESULT_ADVERTISED, ...REVIEW_ACTIONS], confirm: true, multiProject: true,
|
|
659
|
+
capabilities: { actions: [...FORWARDED, ...INBOX_VERBS, ...QUESTION_ACTIONS, ...RESULT_ADVERTISED, ...REVIEW_ACTIONS], confirm: true, multiProject: true,
|
|
660
|
+
inbox: true, inboxMaxAgeMs: INBOX_MAX_AGE_MS, space: true, spaceMaxAgeMs: SPACE_MAX_AGE_MS },
|
|
651
661
|
},
|
|
652
662
|
async open(ctx) { return createProvider({ home: ctx.home, log: ctx.log, features: ctx.features }); },
|
|
653
663
|
};
|