@mstar-harness/dsh 2.1.1
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/README.i18n.yaml +7 -0
- package/README.md +448 -0
- package/README.zh.md +221 -0
- package/bundle/README.md +312 -0
- package/bundle/cordis.patch.yml +17 -0
- package/dist/client/index.d.ts +14 -0
- package/dist/client/panel/PanelView.d.ts +67 -0
- package/dist/client/panel/TabNav.d.ts +28 -0
- package/dist/client/panel/graph/event-log.d.ts +76 -0
- package/dist/client/panel/graph/project-graph.d.ts +499 -0
- package/dist/client/panel/graph/schema.d.ts +224 -0
- package/dist/client/panel/guards.d.ts +12 -0
- package/dist/client/panel/locale.d.ts +134 -0
- package/dist/client/panel/pages/AgentCanvasPage.d.ts +363 -0
- package/dist/client/panel/pages/EventLogPage.d.ts +48 -0
- package/dist/client/panel/pages/IterationInfoSection.d.ts +80 -0
- package/dist/client/panel/pages/IterationTaskPage.d.ts +37 -0
- package/dist/client/panel/panel-meta.d.ts +18 -0
- package/dist/client/panel/plan-sort.d.ts +54 -0
- package/dist/client/panel/sidebar.d.ts +17 -0
- package/dist/client/panel/state-section.d.ts +23 -0
- package/dist/client/panel/use-mstar-engine-status.d.ts +42 -0
- package/dist/client/panel/zones/Legend.d.ts +18 -0
- package/dist/client/panel/zones/TaskBoard.d.ts +40 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +4486 -0
- package/dist/gates/_shared.d.ts +198 -0
- package/dist/gates/adapter.d.ts +131 -0
- package/dist/gates/agent-flow.d.ts +320 -0
- package/dist/gates/catalog.d.ts +118 -0
- package/dist/gates/dispatch.d.ts +152 -0
- package/dist/gates/seams.d.ts +152 -0
- package/dist/gates/skill-lint.d.ts +87 -0
- package/dist/gates/status.d.ts +81 -0
- package/dist/gates/tools.d.ts +37 -0
- package/dist/index.d.ts +107 -0
- package/dist/index.js +5748 -0
- package/dist/invariant.d.ts +15 -0
- package/dist/invariant.js +29 -0
- package/dist/service.d.ts +96 -0
- package/dist/types.d.ts +241 -0
- package/harness-commands/codebase-audit.md +40 -0
- package/harness-commands/iteration-drive.md +129 -0
- package/harness-commands/iteration-loop.md +139 -0
- package/harness-commands/iteration-start.md +179 -0
- package/harness-skills/grill-me/SKILL.md +10 -0
- package/harness-skills/mstar-audit/SKILL.md +183 -0
- package/harness-skills/mstar-audit/references/audit-playbook.md +130 -0
- package/harness-skills/mstar-audit/references/finding-format.md +65 -0
- package/harness-skills/mstar-branch-worktree/SKILL.md +219 -0
- package/harness-skills/mstar-branch-worktree/references/parallel-writable-pre-dispatch.md +68 -0
- package/harness-skills/mstar-coding-behavior/SKILL.md +147 -0
- package/harness-skills/mstar-compound/SKILL.md +105 -0
- package/harness-skills/mstar-compound/assets/resolution-template.md +94 -0
- package/harness-skills/mstar-compound/references/category-mapping.md +37 -0
- package/harness-skills/mstar-compound/references/compound-workflow.md +155 -0
- package/harness-skills/mstar-compound/references/concepts-vocabulary.md +44 -0
- package/harness-skills/mstar-compound/references/schema.yaml +122 -0
- package/harness-skills/mstar-compound-refresh/SKILL.md +140 -0
- package/harness-skills/mstar-compound-refresh/references/project-knowledge-bootstrap.md +164 -0
- package/harness-skills/mstar-design-md/SKILL.md +142 -0
- package/harness-skills/mstar-design-md/references/completeness-checklist.md +181 -0
- package/harness-skills/mstar-design-md/references/design-md-spec.md +508 -0
- package/harness-skills/mstar-design-md/references/vercel-example.md +200 -0
- package/harness-skills/mstar-design-md/templates/DESIGN.dark.md.template +354 -0
- package/harness-skills/mstar-design-md/templates/DESIGN.md.template +474 -0
- package/harness-skills/mstar-dispatch-gates/SKILL.md +128 -0
- package/harness-skills/mstar-dispatch-gates/references/leaf-executor-checklist.md +23 -0
- package/harness-skills/mstar-harness-core/SKILL.md +180 -0
- package/harness-skills/mstar-host/SKILL.md +78 -0
- package/harness-skills/mstar-host/references/_shared/host-role-binding-core.md +51 -0
- package/harness-skills/mstar-host/references/_shared/plan-mode-bridge-core.md +91 -0
- package/harness-skills/mstar-host/references/codex.md +61 -0
- package/harness-skills/mstar-host/references/cursor-plan-mode-bridge.md +159 -0
- package/harness-skills/mstar-host/references/cursor.md +183 -0
- package/harness-skills/mstar-host/references/dsh.md +502 -0
- package/harness-skills/mstar-host/references/kimi-plan-mode-bridge.md +36 -0
- package/harness-skills/mstar-host/references/kimi.md +136 -0
- package/harness-skills/mstar-host/references/omp-plan-mode-bridge.md +32 -0
- package/harness-skills/mstar-host/references/omp.md +244 -0
- package/harness-skills/mstar-host/references/opencode.md +76 -0
- package/harness-skills/mstar-host/references/parallel-dispatch.md +68 -0
- package/harness-skills/mstar-host/references/zcode-plan-mode-bridge.md +36 -0
- package/harness-skills/mstar-host/references/zcode.md +129 -0
- package/harness-skills/mstar-iteration/SKILL.md +393 -0
- package/harness-skills/mstar-iteration/references/autonomous-direction-lock.md +90 -0
- package/harness-skills/mstar-iteration/references/iteration-artifact-boundaries.md +103 -0
- package/harness-skills/mstar-iteration/references/iteration-compass-template.md +142 -0
- package/harness-skills/mstar-iteration/references/iteration-corpus-hygiene.md +45 -0
- package/harness-skills/mstar-iteration/references/iteration-workspace-readme-template.md +27 -0
- package/harness-skills/mstar-iteration/references/phase-2-worktree-lease.md +193 -0
- package/harness-skills/mstar-iteration/references/phase-3-iteration-close.md +95 -0
- package/harness-skills/mstar-iteration/references/phase-4-5-pr-delivery.md +84 -0
- package/harness-skills/mstar-iteration/references/phase5-helper-discovery.md +24 -0
- package/harness-skills/mstar-phase-gates/SKILL.md +112 -0
- package/harness-skills/mstar-plan-artifacts/SKILL.md +46 -0
- package/harness-skills/mstar-plan-artifacts/references/done-compaction.md +88 -0
- package/harness-skills/mstar-plan-artifacts/references/knowledge-and-designs.md +100 -0
- package/harness-skills/mstar-plan-artifacts/references/plan-files-and-reports.md +99 -0
- package/harness-skills/mstar-plan-artifacts/references/plan-quality-bar.md +99 -0
- package/harness-skills/mstar-plan-artifacts/references/status-and-residuals.md +570 -0
- package/harness-skills/mstar-plan-artifacts/templates/README.md +9 -0
- package/harness-skills/mstar-plan-artifacts/templates/notes.empty.json +5 -0
- package/harness-skills/mstar-plan-artifacts/templates/plan.main.md +54 -0
- package/harness-skills/mstar-plan-artifacts/templates/plans-done.empty.json +3 -0
- package/harness-skills/mstar-plan-artifacts/templates/status.empty.json +7 -0
- package/harness-skills/mstar-plan-conventions/SKILL.md +165 -0
- package/harness-skills/mstar-plan-conventions/references/artifact-storage-paths.md +50 -0
- package/harness-skills/mstar-plan-conventions/references/effort-estimation.md +38 -0
- package/harness-skills/mstar-plan-conventions/references/harness-bootstrap-and-agents-layering.md +93 -0
- package/harness-skills/mstar-review-qc/SKILL.md +60 -0
- package/harness-skills/mstar-review-qc/references/review-responsibility-boundaries.md +54 -0
- package/harness-skills/mstar-roles/SKILL.md +86 -0
- package/harness-skills/mstar-roles/references/_shared/leaf-executor-core.md +46 -0
- package/harness-skills/mstar-roles/references/architect.md +114 -0
- package/harness-skills/mstar-roles/references/code-reviewer.md +109 -0
- package/harness-skills/mstar-roles/references/frontend-dev.md +70 -0
- package/harness-skills/mstar-roles/references/fullstack-dev-shared.md +89 -0
- package/harness-skills/mstar-roles/references/ops-engineer.md +78 -0
- package/harness-skills/mstar-roles/references/product-manager.md +107 -0
- package/harness-skills/mstar-roles/references/project-manager/dispatch-and-assignment.md +198 -0
- package/harness-skills/mstar-roles/references/project-manager/plan-management.md +61 -0
- package/harness-skills/mstar-roles/references/project-manager/qa-trigger-matrix.md +56 -0
- package/harness-skills/mstar-roles/references/project-manager/qc-and-residuals.md +98 -0
- package/harness-skills/mstar-roles/references/project-manager/routing-and-dev-allocation.md +99 -0
- package/harness-skills/mstar-roles/references/project-manager.md +310 -0
- package/harness-skills/mstar-roles/references/prompt-engineer.md +71 -0
- package/harness-skills/mstar-roles/references/qa-engineer/acceptance-gate.md +62 -0
- package/harness-skills/mstar-roles/references/qa-engineer.md +79 -0
- package/harness-skills/mstar-roles/references/qc-specialist/deep-review-lenses.md +95 -0
- package/harness-skills/mstar-roles/references/qc-specialist/report-template.md +72 -0
- package/harness-skills/mstar-roles/references/qc-specialist/reviewer-checklist.md +44 -0
- package/harness-skills/mstar-roles/references/qc-specialist/reviewer-workflow.md +57 -0
- package/harness-skills/mstar-roles/references/qc-specialist-shared.md +128 -0
- package/harness-skills/mstar-roles/references/writing-specialist.md +59 -0
- package/harness-skills/mstar-sdd/SKILL.md +133 -0
- package/harness-skills/mstar-sdd/references/file-handoffs.md +83 -0
- package/harness-skills/mstar-sdd/references/implementer-continuation-prompt.md +44 -0
- package/harness-skills/mstar-sdd/references/implementer-prompt.md +56 -0
- package/harness-skills/mstar-sdd/references/sticky-implementer-session.md +103 -0
- package/harness-skills/mstar-sdd/references/task-reviewer-prompt.md +53 -0
- package/harness-skills/mstar-skill-authoring/SKILL.md +162 -0
- package/harness-skills/mstar-skill-authoring/references/skillsbench-authoring.md +117 -0
- package/harness-skills/mstar-strategy/SKILL.md +130 -0
- package/harness-skills/pm/SKILL.md +40 -0
- package/package.json +92 -0
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `projectGraph(source): ZoneView` — the pure projection of the
|
|
3
|
+
* `mstar-engine-status` catalog source onto the zone dashboard view model
|
|
4
|
+
* (spec panel-zones §3). Total function: NEVER throws, produces no
|
|
5
|
+
* React render types, and degrades per field instead of guessing — the
|
|
6
|
+
* same philosophy as `selectEngineStatus`'s try/catch fallback and the
|
|
7
|
+
* `guards.ts` contract (missing → `unknown`, never a fabricated value).
|
|
8
|
+
*
|
|
9
|
+
* Two strictly separated inputs (spec §3):
|
|
10
|
+
* - schema constants (`./schema.ts`) — the 5 iteration steps (PHASE_IDS), the
|
|
11
|
+
* 5 kanban buckets (PLAN_STATE_IDS — Blocked/unknown merged into
|
|
12
|
+
* `blocked-unknown`, plan 20260813-panel-quick-fixes Task 1) and the
|
|
13
|
+
* expected role pipeline (EXPECTED_ROLE_FLOW), all client-side design
|
|
14
|
+
* knowledge;
|
|
15
|
+
* - catalog evidence — `iteration.gate.transition` lights the current step
|
|
16
|
+
* (steps before it become `done` — plan 20260812-panel-f5-iteration-zone-fix
|
|
17
|
+
* Task 1, its forward target becomes `next`), `gate.ok/violations` become
|
|
18
|
+
* the PASS/FAIL verdict + count, and `state.plans[].status` rows fall into
|
|
19
|
+
* the exact-match kanban buckets. `iteration.compassStatus` (the steering
|
|
20
|
+
* compass frontmatter `status`, `'active' | 'locked'` — spec panel-f4 §2.3
|
|
21
|
+
* R9 / §5 D5) re-derives the current step during Phase 1: `'active'` WITH a
|
|
22
|
+
* `phase-2-execute` transition (compass and gate mutually consistent — QC
|
|
23
|
+
* wave F-001) → Step 1 (iteration-start) is current with verdict 'unknown'
|
|
24
|
+
* (Phase 1 has no gate evaluation → no PASS/FAIL badge) + next Step 2;
|
|
25
|
+
* `'active'` with a transition past Phase 2 (an inconsistent harness
|
|
26
|
+
* state), `'locked'`, or missing → the transition-driven logic below
|
|
27
|
+
* (Step 2→4 + gate verdict).
|
|
28
|
+
*
|
|
29
|
+
* Migration from the legacy graph GraphView (spec §3, per field):
|
|
30
|
+
* - kept & moved: `violations` / `flow.events` / `flow.unexpected` → top-level
|
|
31
|
+
* `violations` / `events` / `unexpected` (FlowEventView projection unchanged,
|
|
32
|
+
* incl. the `settled` pairing marker — shared with the agent-entity status
|
|
33
|
+
* derivation via the single `pairSettleStatus` pairing walk); `iterationId`
|
|
34
|
+
* → `iteration.iterationId`;
|
|
35
|
+
* - deleted (legacy graph structure): `phases`, `phaseEdges`,
|
|
36
|
+
* `planStates`, `planEdges`, `connector`, `currentPhase`, `flow.stages`
|
|
37
|
+
* (the stage skeleton + entities/edges now live in the `agents` projection —
|
|
38
|
+
* spec §4);
|
|
39
|
+
* - added: `iteration.steps / currentStep / branches`, `tasks.columns / total
|
|
40
|
+
* / truncated`, `agents` (entities + actual/supervise edges + executing/
|
|
41
|
+
* pending counts — spec §4).
|
|
42
|
+
*
|
|
43
|
+
* Agent-entity semantics (plan 20260811-panel-f3-agent-general — the
|
|
44
|
+
* per-role aggregation refactor): entities aggregate by ROLE, not by session
|
|
45
|
+
* — a KNOWN_AGENTS roster role keys its own card (same role across sessions
|
|
46
|
+
* folds into one card ×N), and EVERY non-roster dispatch (`scout`,
|
|
47
|
+
* unregistered roles, anonymous `role === ''`) folds into the single
|
|
48
|
+
* `general` bucket entity (key `'general'`, role shown `'general'`). The
|
|
49
|
+
* legacy `unexpected` zone is GONE — stage-null non-on-demand entities now
|
|
50
|
+
* project `zone: 'general'`. Placement (plan 20260812-panel-f5-agent-layout
|
|
51
|
+
* Task 1, user 2026-08-12): the projection only declares the zone — the
|
|
52
|
+
* RENDER places `zone: 'general'` entities in an unknown sub-partition at
|
|
53
|
+
* the bottom of the LAST column (plan 20260812-panel-f5-design-system Task
|
|
54
|
+
* 5, user 2026-08-12 feedback #3 — the standalone rightmost unknown column
|
|
55
|
+
* is superseded: 4 columns total). The SDD loop back-edge (sdd-implement →
|
|
56
|
+
* general) stays REMOVED from the projection (plan 20260811-panel-f4-agent-view
|
|
57
|
+
* Task 1); the F5 supervise line is a SEPARATE sub-bucket edge
|
|
58
|
+
* (`kind: 'supervise'`, see `superviseEdges`). The event-log `unexpected`
|
|
59
|
+
* badge is a SEPARATE, unchanged semantic (`expected` ⟺ role ∈
|
|
60
|
+
* EXPECTED_ROLE_FLOW union). The `sdd-implement` column is further split
|
|
61
|
+
* into implementor / reviewer SUB-BUCKETS (plan 20260812-panel-f5-agent-layout
|
|
62
|
+
* Task 1): every entity carries a projected `bucket` field ('implementor' /
|
|
63
|
+
* 'reviewer' / null via SDD_BUCKET_ROLES — a layout dimension ORTHOGONAL to
|
|
64
|
+
* expectedness: on-demand roles keep their `unexpected` badge inside the
|
|
65
|
+
* implementor bucket).
|
|
66
|
+
*
|
|
67
|
+
* Degradation (spec §8): `source === null` → legal empty view (the panel
|
|
68
|
+
* never mounts the graph for that case, but the projection stays total);
|
|
69
|
+
* missing iteration / unresolvable transition → `active: false` + 5 idle
|
|
70
|
+
* steps + `degraded.iteration` (the old `degraded.transition` is merged into
|
|
71
|
+
* `iteration.active === false` — `degraded.iteration ⟺ !active`); `state`
|
|
72
|
+
* null → 5-column skeleton (count 0) + `degraded.state`; `state.plans`
|
|
73
|
+
* missing → same skeleton + `degraded.plans`; `state.agentFlow`
|
|
74
|
+
* missing/unreadable → agents roster + `degraded` (full KNOWN_AGENTS idle
|
|
75
|
+
* cards, no executing/pending claims); 0 events → `empty` (idle roster +
|
|
76
|
+
* pending skeleton). `iteration.compassStatus` missing, non-union (old
|
|
77
|
+
* catalog rows / fixtures — the field is OPTIONAL, spec D5), or `'active'`
|
|
78
|
+
* with a transition past Phase 2 (an inconsistent harness state — QC wave
|
|
79
|
+
* F-001) degrades to the existing transition-driven current-step logic
|
|
80
|
+
* (Step 2→4) — backward compatible, `active` semantics unchanged.
|
|
81
|
+
*/
|
|
82
|
+
import type { MstarEngineStatusSource } from '../../../types.ts';
|
|
83
|
+
import { type AgentZone, type PhaseId, type PlanStateId } from './schema.ts';
|
|
84
|
+
/** Current-step verdict from `gate.ok` (spec §3). */
|
|
85
|
+
export type PhaseVerdict = 'pass' | 'fail' | 'unknown';
|
|
86
|
+
/** One gate violation row, str()-guarded (drives the footer collapsible list, spec §2). */
|
|
87
|
+
export interface GraphViolation {
|
|
88
|
+
severity: string;
|
|
89
|
+
code: string;
|
|
90
|
+
message: string;
|
|
91
|
+
}
|
|
92
|
+
/** Event status coloring: dispatch → dispatched|advisory|denied; settle → ok|error|denied. */
|
|
93
|
+
export type FlowEventStatus = 'dispatched' | 'advisory' | 'denied' | 'ok' | 'error';
|
|
94
|
+
/**
|
|
95
|
+
* One projected agent-flow event (spec agent-flow-catalog-graph §2.4 —
|
|
96
|
+
* unchanged by the zone refactor). Every field degrades individually via
|
|
97
|
+
* `guards.ts` — a missing/illegal value becomes `null`/''/`0`/a base status,
|
|
98
|
+
* never a throw and never a guessed value. Rows whose `kind` is not
|
|
99
|
+
* dispatch/settle cannot be classified and are skipped entirely
|
|
100
|
+
* (belt-and-suspenders: the T1 ledger reader already normalizes kind).
|
|
101
|
+
*/
|
|
102
|
+
export interface FlowEventView {
|
|
103
|
+
/** `${ts}-${kind}-${index}` — stable id (index = position in the projected window). */
|
|
104
|
+
id: string;
|
|
105
|
+
ts: number;
|
|
106
|
+
kind: 'dispatch' | 'settle';
|
|
107
|
+
/** `Execute as`; '' for settle rows without a paired identity. */
|
|
108
|
+
role: string;
|
|
109
|
+
planId: string | null;
|
|
110
|
+
taskId: string | null;
|
|
111
|
+
taskCategory: string | null;
|
|
112
|
+
agent: string | null;
|
|
113
|
+
/** dispatch → dispatched|advisory|denied; settle → ok|error|denied (spec §2.4). */
|
|
114
|
+
status: FlowEventStatus;
|
|
115
|
+
/** `role` ∈ the EXPECTED_ROLE_FLOW role union (spec §2.3 exact-string match). */
|
|
116
|
+
expected: boolean;
|
|
117
|
+
/** The matched expected stage; null → unexpected role. */
|
|
118
|
+
stage: {
|
|
119
|
+
phase: PhaseId;
|
|
120
|
+
stage: string;
|
|
121
|
+
} | null;
|
|
122
|
+
/** dispatch: has an EXACT-identity-paired settle (exact pairing; an unpaired settle stays unpaired — honest); settle: always false. */
|
|
123
|
+
settled: boolean;
|
|
124
|
+
/** Settle rows only (plan `20260811-panel-f4-timeliness` Task 1): the settle carries the PAIRED dispatch's identity (exact pairing). */
|
|
125
|
+
paired?: boolean;
|
|
126
|
+
durationMs: number | null;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* One iteration step (spec §3 + plan 20260812-panel-f5-iteration-zone-fix
|
|
130
|
+
* Task 1): the PHASE_IDS skeleton with current/next/done/idle lit by
|
|
131
|
+
* `gate.transition` evidence — the CURRENT step, its forward target (`next`)
|
|
132
|
+
* and every step BEFORE it (`done` — completed: the Task 1 fix, a finished
|
|
133
|
+
* Step 1 must not read as idle「待命」 while Step 2 is current). The `step`
|
|
134
|
+
* number is 1-based (1..5). `verdict` is carried by the CURRENT step only.
|
|
135
|
+
*/
|
|
136
|
+
export interface IterationStepView {
|
|
137
|
+
id: PhaseId;
|
|
138
|
+
/** 1-based position in PHASE_IDS (1..5). */
|
|
139
|
+
step: number;
|
|
140
|
+
/** 'current' (the gate transition) / 'next' (its forward target) / 'done'
|
|
141
|
+
* (a step BEFORE the current one — completed) / 'idle' (schema-only). */
|
|
142
|
+
state: 'current' | 'next' | 'done' | 'idle';
|
|
143
|
+
/** Current-step gate verdict; 'unknown' on non-current steps. */
|
|
144
|
+
verdict: PhaseVerdict;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* One kanban column (spec §3 + plan 20260813-panel-quick-fixes Task 1): the
|
|
148
|
+
* PLAN_STATE_IDS skeleton with plan rows bucketed by status — `Blocked` and
|
|
149
|
+
* any non-matching status (the former `unknown` catch-all) both fold into the
|
|
150
|
+
* single `blocked-unknown` column. `count` is the FULL column count; `plans`
|
|
151
|
+
* keeps EVERY row (no slice — the render truncates to PLAN_CAP and offers a
|
|
152
|
+
* 「更多」 expand). The Done column is additionally sorted with the shared
|
|
153
|
+
* plan-sort key (`plan-sort.ts`); every other column keeps input order.
|
|
154
|
+
* `capped` carries PLAN_CAP when the column overflows, else null.
|
|
155
|
+
*/
|
|
156
|
+
export interface KanbanColumnView {
|
|
157
|
+
id: PlanStateId;
|
|
158
|
+
/** ALL rows (Done: plan-sort order; others: input order). */
|
|
159
|
+
plans: {
|
|
160
|
+
id: string;
|
|
161
|
+
status: string;
|
|
162
|
+
}[];
|
|
163
|
+
/** Full column count (equal to `plans.length`). */
|
|
164
|
+
count: number;
|
|
165
|
+
/** PLAN_CAP when the column overflows (count > PLAN_CAP); null otherwise. */
|
|
166
|
+
capped: number | null;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* One agent-pipeline stage (spec §4): the EXPECTED_ROLE_FLOW skeleton with its
|
|
170
|
+
* expected role chips. No dispatch evidence → the stage renders as a dashed
|
|
171
|
+
* "待执行" placeholder and its expected roles count into `pending`.
|
|
172
|
+
*/
|
|
173
|
+
export interface AgentZoneStage {
|
|
174
|
+
/** `${phase}:${stage}`. */
|
|
175
|
+
id: string;
|
|
176
|
+
phase: PhaseId;
|
|
177
|
+
stage: string;
|
|
178
|
+
roles: readonly string[];
|
|
179
|
+
/**
|
|
180
|
+
* Dispatch evidence (spec §4): any dispatch row's role maps to this stage —
|
|
181
|
+
* the render shows the dashed "待执行" placeholder ONLY for un-evidenced
|
|
182
|
+
* stages (the `pending` count is the same per-stage test). Evidence comes
|
|
183
|
+
* from ALL dispatch rows, not just each entity's latest — an agent
|
|
184
|
+
* re-dispatched under another role still lights its earlier stage.
|
|
185
|
+
*/
|
|
186
|
+
evidenced: boolean;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* One agent entity card (spec §4 + §6.2 + plan 20260811-panel-f3-agent-general):
|
|
190
|
+
* either a ROLE aggregated across its dispatch rows (count + latest ts;
|
|
191
|
+
* identity fields reflect the LATEST dispatch — the same dispatch that
|
|
192
|
+
* decides the status; `agent` / `task` are record fields, never the title)
|
|
193
|
+
* or a synthesized `idle` card for a KNOWN_AGENTS roster member with NO
|
|
194
|
+
* dispatch evidence (key = role id; count 0 / ts 0 — never a guessed status).
|
|
195
|
+
* Non-roster dispatches (former `generalPurpose` / `scout` / anonymous '')
|
|
196
|
+
* aggregate into the single `general` bucket entity.
|
|
197
|
+
*/
|
|
198
|
+
export interface AgentEntityView {
|
|
199
|
+
/**
|
|
200
|
+
* THE ROLE id for lit cards (KNOWN_AGENTS membership — `general` for every
|
|
201
|
+
* non-roster dispatch); the KNOWN_AGENTS role id for idle cards. INVARIANT
|
|
202
|
+
* (spec §6.2, F-001): keys are UNIQUE across the whole `entities` array —
|
|
203
|
+
* an evidence-derived `general` key suppresses the idle general twin in
|
|
204
|
+
* `idleEntities`, so the React `key` / `layoutAgents` `cards.set` never see
|
|
205
|
+
* duplicates.
|
|
206
|
+
*/
|
|
207
|
+
key: string;
|
|
208
|
+
/** The raw session id of the LATEST dispatch; null for idle cards. */
|
|
209
|
+
agent: string | null;
|
|
210
|
+
/** Display name = `agent ?? key` (spec §4); the role id for idle cards. */
|
|
211
|
+
name: string;
|
|
212
|
+
/** Role chip — the raw role of the latest dispatch; `'general'` for the
|
|
213
|
+
* bucket entity; the known role id for idle cards. */
|
|
214
|
+
role: string;
|
|
215
|
+
/** Task tag `${planId}#${taskId}` (missing planId → null; taskId missing → planId); null for idle cards. */
|
|
216
|
+
task: string | null;
|
|
217
|
+
/** Spec §4 hardcoded priority: latest-dispatch verdict → paired settle → running. */
|
|
218
|
+
status: AgentEntityStatus;
|
|
219
|
+
/** No dispatch evidence → the idle (muted "未工作") card; idle never counts into `executing`. */
|
|
220
|
+
idle: boolean;
|
|
221
|
+
/** Dispatch count of this entity in the window (settles never count); 0 for idle cards. */
|
|
222
|
+
count: number;
|
|
223
|
+
/** Latest dispatch ts (the status/identity source); 0 for idle cards. */
|
|
224
|
+
ts: number;
|
|
225
|
+
/** Latest dispatch's stage via `roleStageIndex` (first constant-order match); null → off-pipeline role; KNOWN_AGENTS stage for idle cards. */
|
|
226
|
+
stage: {
|
|
227
|
+
phase: PhaseId;
|
|
228
|
+
stage: string;
|
|
229
|
+
} | null;
|
|
230
|
+
/** Column zone (plan 20260811-panel-f3-agent-general — projection-owned,
|
|
231
|
+
* the render NEVER heuristically guesses): 'flow' (stage columns), 'on-demand'
|
|
232
|
+
* (ops-engineer / prompt-engineer — implementor-sub-bucket dispatches with
|
|
233
|
+
* an on-demand badge; the standalone on-demand column is REMOVED, plan
|
|
234
|
+
* 20260812-panel-f5-agent-layout Task 2) or 'general' (the general bucket —
|
|
235
|
+
* the rightmost UNKNOWN column, Task 2). Derived from the role for lit
|
|
236
|
+
* cards, from the KnownAgent `zone` for idle cards. */
|
|
237
|
+
zone: AgentZone;
|
|
238
|
+
/** SDD sub-bucket (plan 20260812-panel-f5-agent-layout Task 1 —
|
|
239
|
+
* projection-derived, the render ONLY consumes it): role ∈
|
|
240
|
+
* SDD_BUCKET_ROLES.implementor → 'implementor' (incl. on-demand roles),
|
|
241
|
+
* role ∈ SDD_BUCKET_ROLES.reviewer → 'reviewer' (code-reviewer); every
|
|
242
|
+
* other role (qc/qa/review-edit-chain/general) → null. Same rule for idle
|
|
243
|
+
* cards (KNOWN_AGENTS id → SDD_BUCKET_ROLES lookup). */
|
|
244
|
+
bucket: AgentBucket | null;
|
|
245
|
+
/** Transparency tier (plan 20260812-panel-f5-design-system Task 4 — the
|
|
246
|
+
* TIME dimension, design doc §3): the iteration's current phase vs the
|
|
247
|
+
* entity's pipeline-stage phase — 'current' (chrome full-strength), 'next'
|
|
248
|
+
* (mid transparency), 'off' (low transparency — passed phases, on-demand /
|
|
249
|
+
* general bucket), null (no iteration/plan — NO override, idle status quo).
|
|
250
|
+
* ORTHOGONAL to `bucket` (space: same-column partition) / `zone` (column) /
|
|
251
|
+
* `status` (evidence): the render fades the card CHROME only — the status
|
|
252
|
+
* point and the running ring/glow NEVER fade (design doc §3.4 HARD). */
|
|
253
|
+
emphasis: AgentEmphasis;
|
|
254
|
+
}
|
|
255
|
+
/** The SDD sub-bucket a role belongs to within the `sdd-implement` column
|
|
256
|
+
* (plan 20260812-panel-f5-agent-layout Task 1): 'implementor' | 'reviewer';
|
|
257
|
+
* roles in neither bucket project `null`. The bucket is a LAYOUT dimension,
|
|
258
|
+
* ORTHOGONAL to expectedness (SDD_BUCKET_ROLES vs EXPECTED_ROLE_FLOW — an
|
|
259
|
+
* on-demand role in the implementor bucket stays OUTSIDE the expected union). */
|
|
260
|
+
export type AgentBucket = 'implementor' | 'reviewer';
|
|
261
|
+
/** Transparency tier (plan 20260812-panel-f5-design-system Task 4 — design
|
|
262
|
+
* doc §3.1): the TIME dimension of an entity — the iteration's current phase
|
|
263
|
+
* vs the entity's pipeline-stage phase. 'current' → chrome full-strength,
|
|
264
|
+
* 'next' → mid transparency (expected but not yet), 'off' → low transparency
|
|
265
|
+
* (already-passed phase, or NO stage — on-demand / general bucket), null →
|
|
266
|
+
* no iteration/plan (NO override — the render keeps the idle status quo). */
|
|
267
|
+
export type AgentEmphasis = 'current' | 'next' | 'off' | null;
|
|
268
|
+
/**
|
|
269
|
+
* Entity status (spec §4, hardcoded priority; plan
|
|
270
|
+
* 20260813-panel-quick-fixes Task 2): `denied` comes from the LATEST dispatch's
|
|
271
|
+
* verdict (the only terminal verdict — settle-independent); `error`/`settled`
|
|
272
|
+
* come from the settle paired with that dispatch; `running` = no paired settle
|
|
273
|
+
* yet (exact identity pairing — an unpaired settle stays unpaired, honest);
|
|
274
|
+
* `idle` = a KNOWN_AGENTS roster member with no dispatch evidence (spec §6.2 —
|
|
275
|
+
* never guessed as running/settled). `advisory` is RETAINED as a union member
|
|
276
|
+
* for backward shape, but the derivation (entityStatus) no longer emits it —
|
|
277
|
+
* an advisory-verdict dispatch now falls through to its settle pair (or
|
|
278
|
+
* `running`); the advisory VERDICT still renders in the event log.
|
|
279
|
+
*/
|
|
280
|
+
export type AgentEntityStatus = 'running' | 'settled' | 'error' | 'denied'
|
|
281
|
+
/** Retained for shape compat; the derivation (entityStatus) no longer emits it. */
|
|
282
|
+
| 'advisory' | 'idle';
|
|
283
|
+
/** Edge kinds (spec §4 + plan 20260812-panel-f5-design-system Task 5 — the
|
|
284
|
+
* 2026-08-12 finalized line semantics, design doc §2.2): handoff / sub-bucket
|
|
285
|
+
* supervision arrows. `expected` (stage skeleton) and `next` (running
|
|
286
|
+
* animation) are REMOVED — the column order implies the flow, the running
|
|
287
|
+
* card glow/status point carries the position (user feedback #1/#5). */
|
|
288
|
+
export type AgentEdgeKind = 'actual' | 'supervise';
|
|
289
|
+
/**
|
|
290
|
+
* One agents-zone arrow (spec §4 + plan 20260812-panel-f5-agent-layout Task
|
|
291
|
+
* 1 + plan 20260812-panel-f5-design-system Task 5):
|
|
292
|
+
* - `actual`: same-plan handoff between ts-adjacent dispatch ENTITY keys
|
|
293
|
+
* (source/target = entity key — role-based since plan
|
|
294
|
+
* 20260811-panel-f3-agent-general). Task 5 filters general-bucket endpoints
|
|
295
|
+
* (a general handoff is noise, not a meaningful transfer) and keeps at most
|
|
296
|
+
* ONE edge per entity-key pair (the latest direction) — design doc §2.2;
|
|
297
|
+
* - `supervise`: ONE static sub-bucket line inside the `sdd-implement`
|
|
298
|
+
* column — implementor ↔ reviewer mutual supervision (mstar-sdd contract;
|
|
299
|
+
* the render draws it as a bidirectional double arrow, Task 2).
|
|
300
|
+
* source/target embed the column id as an anchor prefix:
|
|
301
|
+
* `<stage-id>:implementor` / `<stage-id>:reviewer`. NOT per-entity pairs —
|
|
302
|
+
* drawing per-role pairs would fabricate concrete supervision relations
|
|
303
|
+
* where no evidence exists (evidence-level handoffs are covered by
|
|
304
|
+
* `actualEdges`). STATIC presence (design knowledge) + evidence-driven
|
|
305
|
+
* lighting via `evidenced` (dim without implement/review dispatch
|
|
306
|
+
* evidence, lit with it — never a fabricated activation).
|
|
307
|
+
*/
|
|
308
|
+
export interface AgentEdge {
|
|
309
|
+
kind: AgentEdgeKind;
|
|
310
|
+
/** actual: entity key; supervise: `<stage-id>:implementor|reviewer`. */
|
|
311
|
+
source: string;
|
|
312
|
+
target: string;
|
|
313
|
+
/** Unused by the Task 5 line set (the removed `next` arrow carried the
|
|
314
|
+
* running entity key); kept for shape stability — always null. */
|
|
315
|
+
entityKey: string | null;
|
|
316
|
+
/** Supervise edges only (plan 20260812-panel-f5-agent-layout Task 1):
|
|
317
|
+
* evidence-driven lighting — true when any dispatch row's role belongs to
|
|
318
|
+
* an SDD sub-bucket (implementor ∪ reviewer), false otherwise (dim).
|
|
319
|
+
* Absent (undefined) for actual. */
|
|
320
|
+
evidenced?: boolean;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* The canvas degradation-note classification (spec §8, F-002): the projection
|
|
324
|
+
* decides the note from the RAW ledger (never a UI-side heuristic on the
|
|
325
|
+
* entity list): `empty` = 0 events; `settle-only` = events present but NO
|
|
326
|
+
* dispatch row (all settle / garbage rows — genuinely no dispatch evidence);
|
|
327
|
+
* `null` = dispatch evidence present (incl. anonymous dispatch rows — they
|
|
328
|
+
* are evidence, not settle-only). The unreadable-ledger case is the SEPARATE
|
|
329
|
+
* `degraded` flag, not a note value.
|
|
330
|
+
*/
|
|
331
|
+
export type AgentZoneNote = 'empty' | 'settle-only' | null;
|
|
332
|
+
/**
|
|
333
|
+
* The projected agents zone (spec §4 + §6.2): the EXPECTED_ROLE_FLOW stage
|
|
334
|
+
* skeleton plus the dispatch-derived entity cards and the actual/supervise
|
|
335
|
+
* arrows. Total function — NEVER throws and NEVER fabricates: the KNOWN_AGENTS
|
|
336
|
+
* roster always projects as entities (idle cards when there is no evidence) —
|
|
337
|
+
* agentFlow missing/unreadable → `degraded` (full idle roster + no
|
|
338
|
+
* executing/pending claims); 0 events → `empty` (full idle roster + pending
|
|
339
|
+
* skeleton); settle-only ledger → full idle roster (settles never produce
|
|
340
|
+
* cards) + full pending skeleton.
|
|
341
|
+
*/
|
|
342
|
+
export interface AgentZoneView {
|
|
343
|
+
/** The EXPECTED_ROLE_FLOW skeleton (pending stages). */
|
|
344
|
+
stages: readonly AgentZoneStage[];
|
|
345
|
+
/** `state.agentFlow` missing/unreadable (ledger absent → no evidence to show). */
|
|
346
|
+
degraded: boolean;
|
|
347
|
+
/** `state.agentFlow` present but 0 events (recording started at plan merge). */
|
|
348
|
+
empty: boolean;
|
|
349
|
+
/** The projected canvas note (spec §8, F-002 — see `AgentZoneNote`). */
|
|
350
|
+
note: AgentZoneNote;
|
|
351
|
+
/** Evidence-derived dispatch entities ∪ idle KNOWN_AGENTS cards — the full roster is NEVER hidden (spec §6.2). */
|
|
352
|
+
entities: readonly AgentEntityView[];
|
|
353
|
+
/** expected (stage skeleton) + actual (same-plan handoffs) + at most one next (latest running). */
|
|
354
|
+
edges: readonly AgentEdge[];
|
|
355
|
+
/** `running` entity count — the summary "N 执行中" (idle cards never count). */
|
|
356
|
+
executing: number;
|
|
357
|
+
/** Sum of expected roles of stages with no dispatch evidence — the summary "M 待执行". */
|
|
358
|
+
pending: number;
|
|
359
|
+
/** The FIRST `state.plans[]` row with status 'InProgress' (catalog order);
|
|
360
|
+
* null when no plan is in progress (plan 20260812-panel-f5-design-system
|
|
361
|
+
* Task 8 — the Phase 2 group's current-plan annotation, user 2026-08-12
|
|
362
|
+
* feedback #2). Total function: state/plans missing or no InProgress row →
|
|
363
|
+
* null (never fabricated). */
|
|
364
|
+
activePlanId: string | null;
|
|
365
|
+
/** How many `state.plans[]` rows are InProgress (the render shows
|
|
366
|
+
* `+N more` when several plans run in parallel — honest, same shape as the
|
|
367
|
+
* kanban overflow hint; never hides the count behind the first id). */
|
|
368
|
+
activePlanCount: number;
|
|
369
|
+
}
|
|
370
|
+
export interface ZoneView {
|
|
371
|
+
iteration: {
|
|
372
|
+
/** Iteration exists AND `gate.transition` resolves (spec §3; `degraded.iteration ⟺ !active`). */
|
|
373
|
+
active: boolean;
|
|
374
|
+
iterationId: string | null;
|
|
375
|
+
/** 5 steps in PHASE_IDS order (spec §3). */
|
|
376
|
+
steps: IterationStepView[];
|
|
377
|
+
/** 1-based index of the current step in PHASE_IDS; null = inactive. */
|
|
378
|
+
currentStep: number | null;
|
|
379
|
+
/** Branch anchors from `state`; null while inactive (rendered only when active, spec §3). */
|
|
380
|
+
branches: {
|
|
381
|
+
iterationBase: string | null;
|
|
382
|
+
target: string | null;
|
|
383
|
+
specIntegration: string | null;
|
|
384
|
+
} | null;
|
|
385
|
+
/** Current-step gate verdict; 'unknown' when inactive. */
|
|
386
|
+
verdict: PhaseVerdict;
|
|
387
|
+
/** Current-step `gate.violations` count; null when inactive. */
|
|
388
|
+
violationCount: number | null;
|
|
389
|
+
};
|
|
390
|
+
tasks: {
|
|
391
|
+
/** 5 columns: Todo/InProgress/InReview/Done/blocked-unknown (spec §3). */
|
|
392
|
+
columns: KanbanColumnView[];
|
|
393
|
+
/** Plan total across all columns, the merged column included. */
|
|
394
|
+
total: number;
|
|
395
|
+
/** Any column overflow (rows > PLAN_CAP). */
|
|
396
|
+
truncated: boolean;
|
|
397
|
+
};
|
|
398
|
+
agents: AgentZoneView;
|
|
399
|
+
/** Current-step gate verdict — footer gate-summary seat (spec §3). */
|
|
400
|
+
verdict: PhaseVerdict;
|
|
401
|
+
/** Gate violations (str()-guarded), for the footer list. */
|
|
402
|
+
violations: GraphViolation[];
|
|
403
|
+
/** Actual agent-flow events, latest first, ≤50 (spec §3; `flow.events` moved top-level). */
|
|
404
|
+
events: FlowEventView[];
|
|
405
|
+
/** Off-pipeline-role DISPATCH events (settles never appear). */
|
|
406
|
+
unexpected: FlowEventView[];
|
|
407
|
+
degraded: {
|
|
408
|
+
iteration: boolean;
|
|
409
|
+
state: boolean;
|
|
410
|
+
plans: boolean;
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
export declare function projectGraph(source: MstarEngineStatusSource | null): ZoneView;
|
|
414
|
+
/**
|
|
415
|
+
* `projectAgents(source, currentStep): AgentZoneView` — the agents zone (spec
|
|
416
|
+
* §4 + §6.2). `currentStep` is the ITERATION's current step (1-based into
|
|
417
|
+
* PHASE_IDS, null when inactive — already computed by `projectGraph`, spec
|
|
418
|
+
* §3): it drives each entity's `emphasis` tier (plan
|
|
419
|
+
* 20260812-panel-f5-design-system Task 4 — design doc §3.3; `null` → every
|
|
420
|
+
* entity `emphasis: null`, no override).
|
|
421
|
+
* Total function: NEVER throws and NEVER fabricates values:
|
|
422
|
+
*
|
|
423
|
+
* - `state.agentFlow` null/unreadable → `degraded`: the FULL KNOWN_AGENTS
|
|
424
|
+
* roster as idle entities + skeleton (executing 0, pending 0 — never a
|
|
425
|
+
* guessed count; the roster is never hidden);
|
|
426
|
+
* - a MISSING ledger file reads as the server's empty view → present with 0
|
|
427
|
+
* events → `empty`: full idle roster + pending skeleton (every expected
|
|
428
|
+
* role is pending);
|
|
429
|
+
* - otherwise: entities aggregated from dispatch rows (with `idle: false`),
|
|
430
|
+
* statuses via the shared pairing walk, the un-evidenced KNOWN_AGENTS
|
|
431
|
+
* members appended as idle cards, actual/supervise edges (design doc §2.2 —
|
|
432
|
+
* the `expected` skeleton and `next` animation edges are REMOVED by plan
|
|
433
|
+
* 20260812-panel-f5-design-system Task 5), and the
|
|
434
|
+
* executing (running entities — idle never counts) / pending
|
|
435
|
+
* (un-evidenced stage roles) counts.
|
|
436
|
+
*
|
|
437
|
+
* Entity-key invariant (F-001 — qc1/qc2 Warning): the concatenated key space
|
|
438
|
+
* (evidence keys ∪ idle role ids) is UNIQUE by construction — `idleEntities`
|
|
439
|
+
* suppresses a known role's idle card when its id already exists as an
|
|
440
|
+
* evidence-derived entity key (a NON-roster dispatch produces a lit `general`
|
|
441
|
+
* key while the roster `general` id stays un-evidenced — the twin is
|
|
442
|
+
* suppressed via `litKeys`), so the render layer's `key`/`cards.set` never
|
|
443
|
+
* collide.
|
|
444
|
+
*
|
|
445
|
+
* Canvas note (F-002 — qc1 Warning): `note` classifies the readable ledger in
|
|
446
|
+
* the projection ('empty' / 'settle-only' / null — see `AgentZoneNote`); the
|
|
447
|
+
* UI consumes it directly and never infers settle-only from the entity list
|
|
448
|
+
* (garbage rows would fake it).
|
|
449
|
+
*
|
|
450
|
+
* Phase-2 plan note (plan 20260812-panel-f5-design-system Task 8 — user
|
|
451
|
+
* 2026-08-12 feedback #2): `activePlanId` / `activePlanCount` ride the
|
|
452
|
+
* `state.plans[]` InProgress rows (catalog order) — the Phase 2 group label
|
|
453
|
+
* annotates the current plan; degraded/empty branches include the note too
|
|
454
|
+
* (it is a state.plans annotation, independent of the ledger evidence).
|
|
455
|
+
*/
|
|
456
|
+
export declare function projectAgents(source: MstarEngineStatusSource | null, currentStep: number | null): AgentZoneView;
|
|
457
|
+
/** One row of the pairing walk — the identity a PAIRED settle carries (plan
|
|
458
|
+
* `20260811-panel-f4-timeliness` Task 1, spec R1: exact identity pairing,
|
|
459
|
+
* never owner+time guessing). */
|
|
460
|
+
interface PairingRow {
|
|
461
|
+
kind: 'dispatch' | 'settle';
|
|
462
|
+
agent: string | null;
|
|
463
|
+
role?: string;
|
|
464
|
+
planId?: string | null;
|
|
465
|
+
taskId?: string | null;
|
|
466
|
+
/** Settle rows only: true → the settle carries the paired dispatch's identity (exact pairing). */
|
|
467
|
+
paired?: boolean;
|
|
468
|
+
status?: FlowEventStatus;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* The paired dispatch index set (spec §4): the events projection's `settled`
|
|
472
|
+
* marker. Same walk as the entity status derivation — `pairSettleStatus`
|
|
473
|
+
* minus the settle statuses.
|
|
474
|
+
*/
|
|
475
|
+
export declare function pairSettleIndexes(rows: readonly PairingRow[]): ReadonlySet<number>;
|
|
476
|
+
/**
|
|
477
|
+
* `projectFlowEvents(source): { events, unexpected }` — the flow events
|
|
478
|
+
* projection (spec §3: `flow.events` / `flow.unexpected` moved top-level;
|
|
479
|
+
* `flow.stages` merged into the plan-3 agents projection). Total function:
|
|
480
|
+
* NEVER throws, NEVER fabricates values.
|
|
481
|
+
*
|
|
482
|
+
* - events: the actual events, latest first, ≤50 (dispatch + settle rows);
|
|
483
|
+
* - unexpected: DISPATCH events whose role is not in the expected role union
|
|
484
|
+
* (e.g. `general` / `explore` / `scout`). Settle rows are completion
|
|
485
|
+
* records — they carry no role at all, so they never flag as unexpected
|
|
486
|
+
* even though their `expected` field is false ('' ∉ union);
|
|
487
|
+
* - settled: EXACT identity pairing via `pairSettleIndexes` (the same walk the
|
|
488
|
+
* agent-entity status derivation uses; an unpaired settle stays unpaired —
|
|
489
|
+
* honest). The panel never depends on the pairing's correctness;
|
|
490
|
+
* - degradation: agentFlow null/unreadable → no events (the `agents`
|
|
491
|
+
* skeleton carries the `degraded` marker); the MISSING ledger file reads as
|
|
492
|
+
* the server's empty view → present with 0 events → no events either (the
|
|
493
|
+
* `agents` skeleton carries `empty`).
|
|
494
|
+
*/
|
|
495
|
+
export declare function projectFlowEvents(source: MstarEngineStatusSource | null): {
|
|
496
|
+
events: FlowEventView[];
|
|
497
|
+
unexpected: FlowEventView[];
|
|
498
|
+
};
|
|
499
|
+
export {};
|