@staix/agent-hub 0.38.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 +84 -0
- package/README.md +28 -12
- package/docs/adding-an-ai-tool.md +7 -5
- package/docs/agent-notes/README.md +23 -0
- package/docs/agent-notes/adapters.md +9 -5
- package/docs/agent-notes/benchmarks.md +2 -0
- package/docs/agent-notes/budget.md +9 -0
- package/docs/agent-notes/bus.md +1 -0
- package/docs/agent-notes/daemon.md +21 -9
- package/docs/agent-notes/local-worker.md +4 -2
- package/docs/agent-notes/security-review.md +56 -0
- package/docs/agent-notes/tasks.md +22 -6
- package/docs/agent-notes/tests.md +10 -9
- package/docs/contracts/companion-cli-v1.json +4 -0
- package/docs/design/adapters.md +142 -0
- package/docs/design/agent-hub-architecture.md +46 -1
- 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 +185 -5
- package/docs/dogfood.md +30 -9
- package/docs/events.md +7 -7
- package/docs/memory.md +5 -5
- package/docs/operations.md +315 -54
- package/docs/profiles.md +101 -8
- package/docs/quickstart.md +47 -6
- package/docs/research.md +6 -3
- package/docs/roles.md +52 -0
- package/docs/sdlc.md +190 -2
- package/docs/security.md +90 -15
- 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/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 +48 -25
- package/package.json +4 -4
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/kimi-hook.js +2266 -530
- package/plugins/agent-hub/kimi-review-policy-worker.js +16 -11
- package/plugins/agent-hub/server.js +2423 -645
- 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 +2 -2
- 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 +63 -17
- package/src/adapters/compat.ts +10 -10
- 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 +12 -12
- package/src/adapters/definitions/native-cli-jcode-mcp.ts +18 -3
- package/src/adapters/definitions/native-config-defaults.ts +1 -1
- package/src/adapters/definitions/native-config-policy.ts +1 -1
- package/src/adapters/definitions/native-quota.ts +122 -0
- package/src/adapters/definitions/native-recovery.ts +3 -0
- package/src/adapters/definitions/qwen.ts +2 -2
- package/src/adapters/kimi-review.ts +23 -0
- package/src/adapters/kimi-wire-usage.ts +39 -16
- package/src/adapters/local-worker.ts +9 -4
- package/src/adapters/pi-state-model.ts +12 -0
- package/src/adapters/pi.ts +76 -11
- package/src/adapters/print-result-model.ts +24 -0
- package/src/adapters/registry-types.ts +12 -2
- package/src/adapters/registry.ts +19 -2
- package/src/adapters/reviewer-print.ts +132 -16
- 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/answer-args.ts +11 -3
- package/src/cli/console-question.ts +1 -1
- package/src/cli/console-state.ts +98 -11
- package/src/cli/console.ts +6 -2
- package/src/cli/error-format.ts +19 -0
- package/src/cli/free-text.ts +20 -0
- package/src/cli/handoff-args.ts +1 -1
- package/src/cli/help.ts +350 -30
- package/src/cli/identity-audit.ts +8 -7
- package/src/cli/identity.ts +27 -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 +232 -17
- package/src/cli/main.js +2 -2
- package/src/cli/main.ts +250 -69
- package/src/cli/model.ts +1 -1
- package/src/cli/output-standard.ts +56 -0
- package/src/cli/output.ts +199 -9
- 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/roadmap.ts +215 -0
- package/src/cli/role-doctor.ts +39 -0
- package/src/cli/sdlc-output.ts +66 -1
- package/src/cli/smoke-pty-bridge.ts +7 -24
- package/src/cli/study-output.ts +54 -0
- package/src/cli/study.ts +14 -1
- package/src/cli/task-output.ts +3 -1
- package/src/cli/terminal-recovery.ts +14 -0
- package/src/cli/upgrade-presentation-flags.ts +2 -2
- 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 +677 -15
- package/src/hub/budget.ts +54 -4
- 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/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 +585 -98
- package/src/hub/deliverable-files.ts +17 -1
- package/src/hub/dogfood-profile.ts +3 -2
- package/src/hub/events.ts +25 -4
- package/src/hub/execution-reference.ts +1 -1
- package/src/hub/folder-trigger.ts +11 -4
- package/src/hub/github-import.ts +81 -0
- package/src/hub/hub-tools.ts +117 -20
- package/src/hub/install-policy.ts +23 -0
- 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 +5 -0
- package/src/hub/operational-authority.ts +8 -1
- package/src/hub/operational-view.ts +6 -2
- package/src/hub/peers.ts +2 -0
- package/src/hub/pi-failure.ts +7 -0
- package/src/hub/plan-conformance.ts +20 -2
- package/src/hub/question-desk.ts +26 -7
- package/src/hub/questions.ts +33 -5
- 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 +21 -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/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/routing.ts +7 -3
- package/src/hub/sdlc-merge.ts +6 -5
- package/src/hub/sdlc-queue.ts +17 -7
- package/src/hub/sdlc-release.ts +1 -1
- package/src/hub/sdlc.ts +47 -8
- 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/specs-task.ts +7 -0
- 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/task-sweep.ts +29 -2
- package/src/hub/task-worktree.ts +37 -0
- package/src/hub/tasks.ts +1464 -76
- package/src/hub/text-projection.ts +11 -1
- package/src/memory/capture.ts +2 -1
- 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 +56 -13
- package/src/ui/office-model.ts +11 -3
- package/src/ui/office-space.ts +50 -30
- package/src/ui/plugin-questions.ts +5 -0
- package/src/ui/plugin.ts +27 -12
- package/templates/config.json +1 -1
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
|
}
|
|
@@ -54,3 +54,8 @@ export function personEvidence(features: readonly string[] | undefined, meta: Ac
|
|
|
54
54
|
return { ok: false, error: "The person's identity and the target come from the console; remove those fields and retry." };
|
|
55
55
|
return { ok: true, identity: value.identity.trim().slice(0, 200) };
|
|
56
56
|
}
|
|
57
|
+
|
|
58
|
+
/** Settled instructed answers are read-only provenance, never another answer form or the stored quote. */
|
|
59
|
+
export function instructedAnswerItem(row: { set: string; peer: string; created: number; person: string; provenance: string }, project: { id: string; name: string }): QuestionItem {
|
|
60
|
+
return { id: questionItemId(project.id, row.set), group: "decision", kind: "decision", title: `${flat(row.set, 64)}: ${flat(row.provenance, 240)}`, actor: row.person, project: project.name, at: new Date(row.created).toISOString(), chip: { text: "answered", tone: "warn" }, verbs: [{ id: "open", label: "Open Agents" }], link: { panel: "agents", params: { project: project.id } } };
|
|
61
|
+
}
|
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";
|
|
@@ -20,7 +21,7 @@ import { DASHBOARD_VIEWS, renderDashboard } from "../hub/ui.ts";
|
|
|
20
21
|
import { parseLineageResult } from "../hub/execution-lineage.ts";
|
|
21
22
|
import { executionLineageLines } from "./lineage-view.ts";
|
|
22
23
|
import { officeModel, type OfficeScene } from "./office-model.ts";
|
|
23
|
-
import { personEvidence, questionItem, QUESTION_ITEM, type InboxAnswers, type QuestionRowView } from "./plugin-questions.ts";
|
|
24
|
+
import { instructedAnswerItem, personEvidence, questionItem, QUESTION_ITEM, type InboxAnswers, type QuestionRowView } from "./plugin-questions.ts";
|
|
24
25
|
import { canPublishResults, receiptEvidence, resultItem, RESULT_ACTIONS, RESULT_ITEM, type ResultAction, type ResultRowView } from "./plugin-results.ts";
|
|
25
26
|
import { mergeSpaces, officeSpace } from "./office-space.ts";
|
|
26
27
|
import type { DeliverablePorts } from "../hub/deliverable-files.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
|
|
|
@@ -277,6 +275,11 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
|
|
|
277
275
|
seen.set(item.id, item.at);
|
|
278
276
|
items.push(item);
|
|
279
277
|
}
|
|
278
|
+
for (const row of Array.isArray(snap.answeredQuestions) ? snap.answeredQuestions : []) {
|
|
279
|
+
if (typeof row?.set !== "string" || typeof row.peer !== "string" || typeof row.person !== "string" || typeof row.provenance !== "string" || !Number.isSafeInteger(row.created)) continue;
|
|
280
|
+
const item = instructedAnswerItem(row, { id: project.id, name });
|
|
281
|
+
seen.set(item.id, item.at); items.push(item);
|
|
282
|
+
}
|
|
280
283
|
// #1054 T6: unread results, only to a console that renders the `result` group AND gives a receipt person evidence. Otherwise they stay in the ahub panel, `ahub console`, `ahub status`
|
|
281
284
|
// and `ahub results`. A row that is not well formed is dropped, never rendered; the detail is what the hub built at display (a stub when private).
|
|
282
285
|
if (canPublishResults(options.features)) {
|
|
@@ -414,9 +417,11 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
|
|
|
414
417
|
const cursor = Number.isSafeInteger(snap.cursor) && Number(snap.cursor) >= 0 ? Number(snap.cursor) : 0;
|
|
415
418
|
next.set(project.id, { instanceId: project.instanceId, cursor, model });
|
|
416
419
|
cursors.push([project.id, project.instanceId, cursor]);
|
|
417
|
-
|
|
420
|
+
// #1375: the project is the scene's group, always named by its directory, so the console shows the group instead of a
|
|
421
|
+
// name prefix on every actor (a lone project's id is not a human name).
|
|
422
|
+
const label = project.root.split("/").filter(Boolean).pop() ?? project.id;
|
|
418
423
|
// 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,
|
|
424
|
+
scenes.push(officeSpace(model, { id: project.id, label }, Date.now()));
|
|
420
425
|
}
|
|
421
426
|
const scene = mergeSpaces(scenes);
|
|
422
427
|
if (generation !== inboxGeneration) return { scene, cursor: 0 };
|
|
@@ -643,11 +648,21 @@ export function createProvider(options: { visualPolicy?: (cwd: string) => Promis
|
|
|
643
648
|
}
|
|
644
649
|
}
|
|
645
650
|
|
|
651
|
+
/**
|
|
652
|
+
* #1375 (acon#105): how long acon may reuse a snapshot instead of asking again, 0-60000 ms. The inbox provider serves a
|
|
653
|
+
* result under its own `inboxFreshMs` as it is and recomputes past it, so declaring more than that would hand the console a
|
|
654
|
+
* value the provider would already have refreshed, and a person acts on an approval it missed. A Space scene's only
|
|
655
|
+
* time-dependent content is its message arcs, which expire on a 10 s window, so one poll interval of reuse cannot show the
|
|
656
|
+
* page anything older than the poll it would have drawn anyway.
|
|
657
|
+
*/
|
|
658
|
+
const POLL_MS = 2_000, INBOX_MAX_AGE_MS = 1_000, SPACE_MAX_AGE_MS = POLL_MS;
|
|
659
|
+
|
|
646
660
|
const plugin: ConsolePlugin = {
|
|
647
661
|
manifest: {
|
|
648
|
-
api: 1, tool: "ahub", version, title: "agent-hub", icon: "agents", pollMs:
|
|
662
|
+
api: 1, tool: "ahub", version, title: "agent-hub", icon: "agents", pollMs: POLL_MS,
|
|
649
663
|
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,
|
|
664
|
+
capabilities: { actions: [...FORWARDED, ...INBOX_VERBS, ...QUESTION_ACTIONS, ...RESULT_ADVERTISED, ...REVIEW_ACTIONS], confirm: true, multiProject: true,
|
|
665
|
+
inbox: true, inboxMaxAgeMs: INBOX_MAX_AGE_MS, space: true, spaceMaxAgeMs: SPACE_MAX_AGE_MS },
|
|
651
666
|
},
|
|
652
667
|
async open(ctx) { return createProvider({ home: ctx.home, log: ctx.log, features: ctx.features }); },
|
|
653
668
|
};
|
package/templates/config.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"qwen_cmd": ["qwen", "--acp"],
|
|
5
5
|
"jcode_cmd": ["jcode"],
|
|
6
6
|
"codex_bin": "codex",
|
|
7
|
-
"pi": { "enabled": false, "auto_start": false, "cmd": ["pi"], "backend": "auto", "dgx_coding": "coding", "dgx_fast": "fast", "max_steps":
|
|
7
|
+
"pi": { "enabled": false, "auto_start": false, "cmd": ["pi"], "backend": "auto", "dgx_coding": "coding", "dgx_fast": "fast", "max_steps": 100 },
|
|
8
8
|
"batch_max": 3,
|
|
9
9
|
"batch_ms": 15000,
|
|
10
10
|
"queue_cap": 200,
|