@mstar-harness/dsh 3.8.0 → 3.8.2

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.
Files changed (51) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +142 -194
  3. package/README.zh.md +29 -17
  4. package/bundle/README.md +83 -171
  5. package/dist/client/index.d.ts +17 -8
  6. package/dist/client/panel/MstarPanelTitle.d.ts +13 -0
  7. package/dist/client/panel/PanelView.d.ts +56 -52
  8. package/dist/client/panel/TabNav.d.ts +17 -14
  9. package/dist/client/panel/definition.d.ts +23 -0
  10. package/dist/client/panel/engine-status-client.d.ts +84 -6
  11. package/dist/client/panel/graph/project-graph.d.ts +35 -64
  12. package/dist/client/panel/graph/schema.d.ts +1 -2
  13. package/dist/client/panel/guards.d.ts +41 -1
  14. package/dist/client/panel/locale.d.ts +1 -1
  15. package/dist/client/panel/mstar-glyph.d.ts +22 -0
  16. package/dist/client/panel/pages/AgentListPage.d.ts +71 -0
  17. package/dist/client/panel/pages/EventLogPage.d.ts +7 -4
  18. package/dist/client/panel/pages/IterationInfoSection.d.ts +16 -13
  19. package/dist/client/panel/pages/IterationTaskPage.d.ts +13 -14
  20. package/dist/client/panel/panel-store.d.ts +28 -0
  21. package/dist/client/panel/sidebar.d.ts +13 -7
  22. package/dist/client/panel/state-section.d.ts +25 -3
  23. package/dist/client/panel/use-mstar-engine-status.d.ts +39 -14
  24. package/dist/client/panel/zones/Legend.d.ts +5 -3
  25. package/dist/client/panel/zones/TaskBoard.d.ts +13 -9
  26. package/dist/client.js +1038 -1242
  27. package/dist/engine-status-endpoint.d.ts +85 -8
  28. package/dist/engine-status-store.d.ts +91 -1
  29. package/dist/engine-status-wire.d.ts +9 -0
  30. package/dist/gates/_shared.d.ts +61 -9
  31. package/dist/gates/adapter.d.ts +32 -2
  32. package/dist/gates/agent-flow.d.ts +312 -60
  33. package/dist/gates/catalog.d.ts +59 -38
  34. package/dist/gates/dispatch.d.ts +11 -2
  35. package/dist/gates/goal-bridge.d.ts +10 -130
  36. package/dist/gates/plan-mode-bridge.d.ts +20 -11
  37. package/dist/gates/role-persona.d.ts +16 -0
  38. package/dist/gates/steering.d.ts +41 -0
  39. package/dist/gates/workflow-ledger.d.ts +31 -4
  40. package/dist/gates/workflow-selection.d.ts +41 -20
  41. package/dist/index.js +1208 -394
  42. package/dist/types.d.ts +50 -18
  43. package/harness-commands/amazing-pr-review.md +2 -0
  44. package/harness-commands/codebase-audit.md +2 -0
  45. package/harness-skills/mstar-host/SKILL.md +3 -1
  46. package/harness-skills/mstar-host/references/dsh-workflow-scripts.md +424 -0
  47. package/harness-skills/mstar-host/references/dsh.md +259 -266
  48. package/harness-skills/mstar-roles/references/project-manager.md +2 -0
  49. package/harness-skills/mstar-sdd/SKILL.md +2 -0
  50. package/package.json +66 -64
  51. package/dist/client/panel/pages/AgentCanvasPage.d.ts +0 -345
@@ -1,60 +1,67 @@
1
1
  /**
2
- * Morning Star workflow panel page — the `conversation.view` tab component
3
- * (spec §4.2): render of the session's engine-status snapshot.
2
+ * Morning Star workflow panel page — the right-Sidebar pane body (the keyed
3
+ * `sidebar.right.pane.tab` seat component, plan sidebar §L1.5): render of the
4
+ * session's engine-status snapshot.
4
5
  *
5
- * Inputs: the session standard kit (`ConvViewProps` + the session-list seat),
6
- * the plugin's engine-status client (bound to the client `connection` service
7
- * by the plugin entry) and the typed `t` seat (`locale: 'mstar-panel'`). The
8
- * `useMstarEngineStatus()` hook turns the anchor row + the served snapshot
9
- * into ONE explicit render state (spec §5) — the render body is a pure
10
- * function of (state, payload, snapshot `at`, t).
6
+ * Inputs: the sidebar seat's props (`MstarPanelBodyProps` — the seat's
7
+ * runtime share incl. the framework-injected `useTabInfo()` + the session
8
+ * standard kit + the entry store share (`useStore` + baked `select`, backed
9
+ * by the registration's `store` option) + the plugin's engine-status client
10
+ * bound by the plugin entry + the typed `t` seat (`locale: 'mstar-panel'`)).
11
+ * The `useMstarEngineStatus()` hook turns the anchor row + the served
12
+ * snapshot into ONE explicit render state (spec §5) — the render body is a
13
+ * pure function of (state, payload, snapshot `at`, t).
11
14
  *
12
- * Layout (spec panel-tabs §2): root grid
13
- * `"main sidebar"` fills the Tab (height 100%, overflow hidden — the page
14
- * never scrolls); the right sidebar is RESIDENT (all tabs share it, its props
15
- * `{ t, state, source }` unchanged); main = the fixed header nav (TabNav, 3
16
- * MenuTabs) + the content region (switches per tab) + the freshness footer.
17
- * The `data-mstar-graph` anchor now marks the CONTENT container (spec §6.1 —
18
- * previously the canvas container), so tests pin the layout contract, not the
19
- * per-tab page internals.
15
+ * Visibility (plan sidebar §L2.6): a docked body is projected only while its
16
+ * sidebar column is expanded and the tab is active —
17
+ * `useTabInfo().tab.visible` — so a collapsed column renders NOTHING (no
18
+ * projection, no DOM). A floating pane is always visible.
20
19
  *
21
- * Tab state (spec §6.2): local `useState<PanelTab>` (default 'tasks', D1, no
22
- * routing) — `renderToStaticMarkup` renders the default tasks page, keeping
23
- * SSR assertions stable. The tasks tab renders the IterationTaskPage (Content
24
- * Head + Steps 横排/收拢 + full-width kanban, spec §3 —
25
- * replacing the WorkflowCanvas zone dashboard); the agents tab renders the
26
- * draggable AgentCanvasPage (spec §4 — replacing the muted placeholder + the AgentFlowZone); the events tab
27
- * renders the EventLogPage (spec §5 — the non-canvas log page with per-row
28
- * `<details>` expansion, replacing
29
- * the muted placeholder AND the AgentEventDock — 无双份日志).
20
+ * Layout (plan sidebar §L2.1): the narrow-column shell is a single flex
21
+ * column with exactly three zones — the section nav (`flex: none`), the
22
+ * panel-owned scroll body (`[data-mstar-scroll]`, flex: 1 1 auto ·
23
+ * min-height: 0 · the ONLY `overflow-y: auto` element in the panel; it also
24
+ * carries the `data-mstar-graph` content-container anchor), and the pinned
25
+ * meta dock (`flex: none`). The workspace-state digest renders IN FLOW at the
26
+ * end of the scroll body (the old 300px sibling column and its nested
27
+ * scroller are gone); the freshness footer follows it in the same flow.
30
28
  *
31
- * Empty branches (spec §2): waiting / loading / unavailable / no-harness render
32
- * no tabs and no sidebar — each with its OWN anchor and copy, so a degraded
33
- * read is never mistakable for an empty workspace. Waiting keeps the muted
34
- * hint; loading states the pending read; unavailable carries the
35
- * machine-readable reason; the no-harness branch renders a CENTERED
36
- * inactive-state card (icon + title + hint) with the freshness footer, and its
37
- * main keeps `data-mstar-graph` on the content container. Degradation stays
38
- * total: `projectGraph` never throws; no iteration → the IterationTaskPage's
39
- * collapsed muted head (spec §8); `state` null / plans missing → muted kanban
40
- * skeleton.
29
+ * Section state (plan sidebar §L2.4): the entry store, keyed by
30
+ * `tabInfo.tab.id` (default `'tasks'`, D1) — it survives the body's unmount
31
+ * when another pane tab activates, which `useState` cannot. The render is
32
+ * SSR-stable: an untouched store reads `undefined` → the default tasks page.
33
+ *
34
+ * Empty branches (spec §2): waiting / loading / unavailable / no-harness
35
+ * render no tabs, no digest and no meta dock — each with its OWN anchor and
36
+ * copy, so a degraded read is never mistakable for an empty workspace.
37
+ * Degradation stays total: `projectGraph` never throws; no iteration → the
38
+ * IterationTaskPage's collapsed muted head (spec §8); `state` null / plans
39
+ * missing → muted kanban skeleton.
41
40
  */
42
41
  import * as React from 'react';
43
- import type { ConvViewProps } from '@deepseek-ai/dsh-client-ui-conversation/client';
44
- import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots';
42
+ import type { PropsLocale, PropsRuntime, TranslateNS } from '@deepseek-ai/dsh-client-ui-slots';
45
43
  import type { SessionId } from '@deepseek-ai/dsh-session';
46
44
  import type { MstarEngineStatusPayload } from '../../types.ts';
45
+ import type { PropsStore } from '@deepseek-ai/dsh-client-store';
47
46
  import type { MstarEngineStatusClient } from './engine-status-client.ts';
48
- import { type PanelTab } from './TabNav.tsx';
49
47
  import { type UseSessions } from './use-mstar-engine-status.ts';
50
- export interface MstarPanelViewProps extends ConvViewProps {
48
+ import { createPanelStore, type PanelSection } from './panel-store.ts';
49
+ /**
50
+ * The sidebar body seat's props (plan sidebar §L1.5): the seat's runtime
51
+ * share (owner + keyed + the seat's inject face — `useTabInfo()` — + the
52
+ * session standard kit, incl. the ui-chat-merged `useChat`) + the entry
53
+ * store share (plan §L2.4 — the registration's `store` option) + the typed
54
+ * `t` seat from the registration's `locale:` option.
55
+ */
56
+ export interface MstarPanelBodyProps extends PropsRuntime<'sidebar.right.pane.tab'>, PropsStore<ReturnType<typeof createPanelStore>>, PropsLocale<'mstar-panel'> {
51
57
  /** Namespace-bound translate seat (`locale: 'mstar-panel'`). */
52
58
  t: TranslateNS<'mstar-panel'>;
53
59
  /**
54
60
  * Current session identity — the session standard kit's own prop. Declared
55
61
  * here (rather than inherited) because this package does not depend on the
56
62
  * ui-session adapter that merges the session-kit declarations into
57
- * `ConvViewProps`; the view ring always supplies it at runtime.
63
+ * `SessionStandardProps`; the seat's session scope always supplies it at
64
+ * runtime.
58
65
  */
59
66
  sessionId?: SessionId;
60
67
  /** Host session-list selector hook (the global standard seat, same reason). */
@@ -67,20 +74,17 @@ export interface MstarPanelViewProps extends ConvViewProps {
67
74
  engineStatus?: MstarEngineStatusClient;
68
75
  }
69
76
  export interface PanelContentProps {
70
- tab: PanelTab;
77
+ /** The active panel section (plan sidebar §L1.5 vocabulary — not a sidebar tab record). */
78
+ section: PanelSection;
71
79
  source: MstarEngineStatusPayload;
72
80
  t: TranslateNS<'mstar-panel'>;
73
81
  }
74
82
  /**
75
- * Tab → page mapping (spec §6.2): the only per-tab-switching part of the
76
- * layout. tasks = the IterationTaskPage (spec §3 — Content Head + Steps
77
- * 横排/收拢 + full-width kanban, it replaced the
78
- * WorkflowCanvas zone dashboard, whose file is removed by the plan close);
79
- * agents = the draggable AgentCanvasPage (spec §4 — full KNOWN_AGENTS roster
80
- * + idle states + AgentEdge collaboration edges; it replaced the muted placeholder and the AgentFlowZone); events =
81
- * the real EventLogPage (spec §5 — non-canvas log page: Agent 流转事件 +
82
- * 违规记录 partitions with per-row `<details>` expansion; it replaced the muted placeholder AND the
83
- * AgentEventDock — 无双份日志, the dock is removed with this plan).
83
+ * Section → page mapping (spec §6.2): the only per-section-switching part of
84
+ * the layout. tasks = the IterationTaskPage (spec §3 — Content Head + Steps
85
+ * + the plan board); agents = the AgentListPage (spec §4 — the vertical
86
+ * grouped list, plan sidebar §L3); events = the EventLogPage (spec §5 — the
87
+ * log page with per-row `<details>` expansion).
84
88
  */
85
- export declare function PanelContent({ tab, source, t }: PanelContentProps): React.JSX.Element;
86
- export declare function PanelView({ t, useChat, useSessions, sessionId, engineStatus }: MstarPanelViewProps): React.JSX.Element;
89
+ export declare function PanelContent({ section, source, t }: PanelContentProps): React.JSX.Element;
90
+ export declare function PanelView({ t, useChat, useSessions, sessionId, engineStatus, useTabInfo, useStore, actions }: MstarPanelBodyProps): React.JSX.Element | null;
@@ -1,28 +1,31 @@
1
1
  /**
2
2
  * TabNav (spec panel-tabs §2/§6.1) —
3
- * the fixed header nav: 3 MenuTabs (任务迭代 / 代理执行 / 事件记录, F1.2)
4
- * switching the main content. Tab state is owned by PanelView
5
- * (`useState<PanelTab>`, default 'tasks', no routing — SSR-stable under
6
- * `renderToStaticMarkup`); TabNav is a controlled component receiving
7
- * `active` + `onChange` (spec §6.1 interface contract).
3
+ * the section nav, the shell's first flex zone (`flex: none`): the three
4
+ * internal sections (任务迭代 / 代理执行 / 事件记录) of the one sidebar tab.
5
+ * Section state is owned by the panel entry store (plan sidebar §L2.4 —
6
+ * keyed by the sidebar tab record, default 'tasks', no routing); TabNav is a
7
+ * controlled component receiving `active` + `onChange` (spec §6.1 interface
8
+ * contract).
8
9
  *
9
10
  * Anchors: `data-mstar-tab-nav` (the nav frame), `data-mstar-tab="{id}"` on
10
11
  * every tab and `data-mstar-tab-active="true|false"` (activation state). The
11
12
  * active tab gets the business-token underline; inactive tabs stay secondary.
13
+ * Visual language (plan sidebar §L2.3): the strip ABOVE this nav is the dsh
14
+ * tab chrome (chips with borders — the host's, untouched); this nav is
15
+ * content — `role="tablist"`, `role="tab"` + `aria-selected`, the underline
16
+ * via `box-shadow`, no borders on the tabs.
12
17
  *
13
- * A11y: the nav is a WAI-ARIA tablist and each tab is a
14
- * `role="tab"` button with `aria-selected` (APG Tabs pattern, replacing the
15
- * former `aria-pressed` toggle). Deliberately minimal: every tab stays Tab-
16
- * reachable (no roving tabindex / arrow-key handling — that behavior would
17
- * be scope creep without an explicit keyboard contract).
18
+ * A11y: WAI-ARIA tablist, each tab a `role="tab"` button with
19
+ * `aria-selected` (APG Tabs pattern). Deliberately minimal: every tab stays
20
+ * Tab-reachable (no roving tabindex / arrow-key handling — that behavior
21
+ * would be scope creep without an explicit keyboard contract).
18
22
  */
19
23
  import * as React from 'react';
20
24
  import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots';
21
- /** The three fixed panel tabs (spec §2 — D1 default = 'tasks'). */
22
- export type PanelTab = 'tasks' | 'agents' | 'events';
25
+ import type { PanelSection } from './panel-store.ts';
23
26
  export interface TabNavProps {
24
- active: PanelTab;
25
- onChange: (tab: PanelTab) => void;
27
+ active: PanelSection;
28
+ onChange: (tab: PanelSection) => void;
26
29
  t: TranslateNS<'mstar-panel'>;
27
30
  }
28
31
  export declare function TabNav({ active, onChange, t }: TabNavProps): React.JSX.Element;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The panel's right-Sidebar tab-type definition (plan sidebar §L1.2) — stage
3
+ * one of the two-stage seat registration: what the panel IS in the tab
4
+ * system. Stage two (the keyed `sidebar.right.pane.tab` body and
5
+ * `sidebar.right.pane.tab.title` chip under the same `id`) lives in the
6
+ * plugin entry (`src/client/index.ts`).
7
+ *
8
+ * A page type: `patterns`/`canOpen` omitted (it recognizes no resource
9
+ * address — it is opened by `kind`), `priority` omitted (defaults to the
10
+ * `extension` band, the right band for a type from outside the product), and
11
+ * exactly one guide entry so the start page carries the MStar capsule. The
12
+ * `title` thunk is re-read on every use, so the guide capsule follows the
13
+ * current locale; the chip's copy is captured at open time by the host.
14
+ */
15
+ import type { SidebarRightTabDefinition } from '@deepseek-ai/dsh-client-ui-sidebar-right/client';
16
+ import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots';
17
+ /** This implementation's identity in the tab system — the key its body and title register under. */
18
+ export declare const MSTAR_PANEL_ID = "@mstar-harness/dsh";
19
+ /** The page kind the panel owns (U2: one sidebar tab). */
20
+ export declare const MSTAR_PANEL_KIND = "mstar-workflow";
21
+ /** The guide capsule's position among every registered type's entries (files ships order 10). */
22
+ export declare const MSTAR_GUIDE_ORDER = 20;
23
+ export declare function mstarPanelDefinition(t: TranslateNS<'mstar-panel'>): SidebarRightTabDefinition;
@@ -22,7 +22,13 @@
22
22
  * on arrival ({@link MstarEngineStatusClient.write}) and the next render
23
23
  * re-issues it. Without the fence an in-flight pre-reconnect answer would
24
24
  * repopulate the cache and then suppress the repull the invalidation exists to
25
- * force.
25
+ * force. A PICKER COMMIT uses the same fence PER SESSION
26
+ * ({@link MstarEngineStatusClient.invalidateSession}): the durable binding
27
+ * changed, so an in-flight pre-pick answer must not land — and the session's
28
+ * cached entry, which still answers the anchor row (a pick writes no row),
29
+ * must be re-pulled for its `binding` while the last emitted `payload` stays on
30
+ * screen (the plans / Event Log are the last MODEL emission until the next real
31
+ * one).
26
32
  *
27
33
  * DEADLINES: the gateway is a network hop, so one request is bounded
28
34
  * ({@link MstarEngineStatusClientOptions.timeoutMs}) and a request that
@@ -41,9 +47,10 @@
41
47
  * @module @mstar-harness/dsh/client/panel/engine-status-client
42
48
  */
43
49
  import type { ConnectionRpcResult } from '@deepseek-ai/dsh-client-connection/client';
44
- import { ENGINE_STATUS_CHANNEL, ENGINE_STATUS_ENDPOINT } from '../../engine-status-wire.ts';
45
- import { type MstarEngineStatusFetch } from './guards.ts';
46
- export { ENGINE_STATUS_CHANNEL, ENGINE_STATUS_ENDPOINT };
50
+ import { ENGINE_STATUS_CHANNEL, ENGINE_STATUS_ENDPOINT, SELECT_WORKFLOW_ENDPOINT } from '../../engine-status-wire.ts';
51
+ import { type MstarEngineStatusFetch, type MstarSelectWorkflowFetch } from './guards.ts';
52
+ export { ENGINE_STATUS_CHANNEL, ENGINE_STATUS_ENDPOINT, SELECT_WORKFLOW_ENDPOINT };
53
+ export type { MstarSelectWorkflowFetch };
47
54
  /** Deadline for one `/api/mstar/engineStatus` request (a hanging gateway must not pin `loading`). */
48
55
  export declare const ENGINE_STATUS_REQUEST_TIMEOUT_MS = 5000;
49
56
  /** How often a served snapshot is re-pulled (D3's "explicit refresh", modest interval). */
@@ -84,9 +91,28 @@ export interface MstarEngineStatusEntry {
84
91
  readonly fetchedAt: number;
85
92
  readonly fetch: MstarEngineStatusFetch;
86
93
  }
87
- /** The observable store value: at most one entry per session. */
94
+ /**
95
+ * The picker state of ONE session (D4 control feedback, never a selection
96
+ * source of truth): idle, a submission awaiting the host, the acknowledged
97
+ * workflow id, or the explicit failure reason. The panel disables a second
98
+ * submission while `pending` and shows `failed` beside the picker instead of a
99
+ * fake selection.
100
+ */
101
+ export type MstarSelectionState = {
102
+ readonly state: 'idle';
103
+ } | {
104
+ readonly state: 'pending';
105
+ } | {
106
+ readonly state: 'selected';
107
+ readonly workflowId: string;
108
+ } | {
109
+ readonly state: 'failed';
110
+ readonly reason: string;
111
+ };
112
+ /** The observable store value: at most one entry per session (+ its picker state). */
88
113
  export interface MstarEngineStatusSnapshot {
89
114
  readonly entries: ReadonlyMap<string, MstarEngineStatusEntry>;
115
+ readonly selections: ReadonlyMap<string, MstarSelectionState>;
90
116
  }
91
117
  /**
92
118
  * The panel's engine-status client: one `/api/mstar/engineStatus` request per
@@ -106,6 +132,19 @@ export declare class MstarEngineStatusClient {
106
132
  private generationDisposer;
107
133
  /** Connection generation: bumped by {@link invalidate}; a mismatched answer is dropped. */
108
134
  private generation;
135
+ /**
136
+ * Per-session request generation: bumped by {@link invalidateSession} (a
137
+ * picker commit). A fetch captures the session's generation when it is
138
+ * issued, and its answer is dropped when that generation moved — the fence
139
+ * that keeps a late pre-pick answer from overwriting post-pick state.
140
+ */
141
+ private readonly sessionGenerations;
142
+ /**
143
+ * Sessions whose cached entry no longer describes their durable binding: the
144
+ * next `ensure` for that entry's own anchor re-pulls it instead of serving it.
145
+ * Set by {@link invalidateSession}, cleared when the answer lands.
146
+ */
147
+ private readonly stale;
109
148
  private disposed;
110
149
  /**
111
150
  * @param connection - the client `connection` service, or undefined in a
@@ -135,6 +174,41 @@ export declare class MstarEngineStatusClient {
135
174
  * repull this invalidation exists to force would be suppressed by them.
136
175
  */
137
176
  invalidate(): void;
177
+ /**
178
+ * Mark ONE session's cached answer stale and fence off the requests already on
179
+ * the wire (a picker commit changed that session's durable binding).
180
+ *
181
+ * The entry is KEPT — the last emitted payload is still the last model
182
+ * emission, and spec §Picker contract 2 keeps plans / Event Log on it until
183
+ * the next real `agent/pre-step` replaces it. What must change is `binding`,
184
+ * the host's current control state, which the next {@link ensure} re-pulls for
185
+ * the same anchor ({@link stale}), because an entry that already answers the
186
+ * anchor would otherwise short-circuit the request and the panel would keep
187
+ * rendering the pre-pick selection.
188
+ *
189
+ * The fence is per session: a pre-pick answer issued before this call belongs
190
+ * to the superseded control state and is dropped on arrival, and no other
191
+ * session's cache is touched.
192
+ */
193
+ invalidateSession(sessionId: string): void;
194
+ /**
195
+ * Commit this session's workflow pick over the host's shared gateway (the
196
+ * `selectWorkflow` UI control). Never optimistic: the returned state is
197
+ * `pending` until the host acknowledges, then either `selected` (with the
198
+ * acknowledged id) or `failed` (with the host's reason) — and a success
199
+ * invalidates THIS session only, so the next `ensure()` re-reads the
200
+ * acknowledged binding while every other session's cache is untouched.
201
+ * @param sessionId - the session the panel is showing.
202
+ * @param cwd - the session's workspace directory (the host cross-checks it).
203
+ * @param workflowId - the chosen ACTIVE workflow id.
204
+ */
205
+ selectWorkflow(sessionId: string, cwd: string, workflowId: string): Promise<MstarSelectWorkflowFetch>;
206
+ /** One `selectWorkflow` round trip (never throws — every fault is a reason). */
207
+ private callSelect;
208
+ /** Publish one session's picker state (store write outside a render). */
209
+ private setSelection;
210
+ /** One session's current request generation. */
211
+ private sessionGen;
138
212
  /** Stop accepting writes, abort in-flight requests and end the refresh interval (plugin teardown). */
139
213
  dispose(): void;
140
214
  /**
@@ -170,7 +244,11 @@ export declare class MstarEngineStatusClient {
170
244
  * An answer issued under a superseded connection generation is DROPPED: it
171
245
  * describes the connection that is gone, and publishing it would both render
172
246
  * pre-reconnect data as `ok` and suppress the repull `invalidate()` forces
173
- * (the stale answer would satisfy `ensure`'s anchor check).
247
+ * (the stale answer would satisfy `ensure`'s anchor check). An answer issued
248
+ * under a superseded SESSION generation is dropped for the same reason after a
249
+ * picker commit ({@link invalidateSession}): it describes the pre-pick control
250
+ * state and would otherwise repopulate the very entry the acknowledgement
251
+ * invalidated.
174
252
  *
175
253
  * An answer for a SUPERSEDED anchor is dropped for the same class of reason:
176
254
  * a refresh issues its request for the anchor it saw, and a newer anchor row
@@ -35,8 +35,7 @@
35
35
  * (the stage skeleton + entities/edges now live in the `agents` projection —
36
36
  * spec §4);
37
37
  * - added: `iteration.steps / currentStep / branches`, `tasks.columns / total
38
- * / truncated`, `agents` (entities + actual/supervise edges + executing/
39
- * pending counts — spec §4).
38
+ * / truncated`, `agents` (entities + executing/pending counts — spec §4).
40
39
  *
41
40
  * Agent-entity semantics (the per-role aggregation): entities aggregate by ROLE, not by session
42
41
  * — a KNOWN_AGENTS roster role keys its own card (same role across sessions
@@ -48,8 +47,8 @@
48
47
  * RENDER places `zone: 'general'` entities in an unknown sub-partition at
49
48
  * the bottom of the LAST column (the standalone rightmost unknown column
50
49
  * is superseded: 4 columns total). The SDD loop back-edge (sdd-implement →
51
- * general) stays REMOVED from the projection; the supervise line is a SEPARATE sub-bucket edge
52
- * (`kind: 'supervise'`, see `superviseEdges`). The event-log `unexpected`
50
+ * general) and the sub-bucket supervise line are both REMOVED from the
51
+ * projection — the agents zone projects entities only. The event-log `unexpected`
53
52
  * badge is a SEPARATE, unchanged semantic (`expected` ⟺ role ∈
54
53
  * EXPECTED_ROLE_FLOW union). The `sdd-implement` column is further split
55
54
  * into implementor / reviewer SUB-BUCKETS: every entity carries a projected `bucket` field ('implementor' /
@@ -101,15 +100,15 @@ export interface FlowEventView {
101
100
  /** `${ts}-${kind}-${index}` — stable id (index = position in the projected window). */
102
101
  id: string;
103
102
  ts: number;
104
- /** The ledger kind verbatim: dispatch | settle | the three workflow kinds | any unknown kind string (generic row). */
105
- kind: 'dispatch' | 'settle' | 'workflow-run' | 'workflow-agent' | 'workflow-run-end' | (string & {});
103
+ /** The ledger kind verbatim: dispatch | settle | subagent-link | the three workflow kinds | any unknown kind string (generic row). */
104
+ kind: 'dispatch' | 'settle' | 'subagent-link' | 'workflow-run' | 'workflow-agent' | 'workflow-run-end' | (string & {});
106
105
  /** `Execute as`; '' for settle rows without a paired identity and for workflow/unknown rows. */
107
106
  role: string;
108
107
  planId: string | null;
109
108
  taskId: string | null;
110
109
  taskCategory: string | null;
111
110
  agent: string | null;
112
- /** dispatch → dispatched|advisory|denied; settle → ok|error|denied; workflow/unknown → unknown (spec §2.4). */
111
+ /** dispatch → dispatched|advisory|denied; settle → ok|error|denied; link/workflow/unknown → unknown (spec §2.4). */
113
112
  status: FlowEventStatus;
114
113
  /** `role` ∈ the EXPECTED_ROLE_FLOW role union (spec §2.3 exact-string match). */
115
114
  expected: boolean;
@@ -135,8 +134,19 @@ export interface FlowEventView {
135
134
  readonly label?: string;
136
135
  /** Run-member phase (workflow-agent rows only, when carried). */
137
136
  readonly phase?: string;
138
- /** The published member's child session identity (workflow-agent rows only). */
137
+ /**
138
+ * Child session identity when the source supplied one: workflow-agent —
139
+ * the published member; settle — the foreground `runId` or a background
140
+ * catalog join; `subagent-link` — the required catalog child id. Omitted
141
+ * when the row carried none. Never a registry job id (that is `taskRef`).
142
+ */
139
143
  readonly childId?: string;
144
+ /**
145
+ * Settle + `subagent-link` rows: the registry background-job id, when
146
+ * carried. A jobs-registry key, never a child session id. Omitted when
147
+ * the row carried none.
148
+ */
149
+ readonly taskRef?: string;
140
150
  /** Terminal workflow run reason (workflow-run-end rows only). */
141
151
  readonly stopReason?: string;
142
152
  }
@@ -215,7 +225,7 @@ export interface AgentEntityView {
215
225
  * non-roster dispatch); the KNOWN_AGENTS role id for idle cards. INVARIANT
216
226
  * (spec §6.2): keys are UNIQUE across the whole `entities` array —
217
227
  * an evidence-derived `general` key suppresses the idle general twin in
218
- * `idleEntities`, so the React `key` / `layoutAgents` `cards.set` never see
228
+ * `idleEntities`, so the render layer's entity `key` space never sees
219
229
  * duplicates.
220
230
  */
221
231
  key: string;
@@ -291,58 +301,22 @@ export type AgentEmphasis = 'current' | 'next' | 'off' | null;
291
301
  export type AgentEntityStatus = 'running' | 'settled' | 'error' | 'denied'
292
302
  /** Retained for shape compat; the derivation (entityStatus) no longer emits it. */
293
303
  | 'advisory' | 'idle';
294
- /** Edge kinds (spec §4 — the finalized line semantics, design doc §2.2): handoff / sub-bucket
295
- * supervision arrows. `expected` (stage skeleton) and `next` (running
296
- * animation) are REMOVED — the column order implies the flow, the running
297
- * card glow/status point carries the position. */
298
- export type AgentEdgeKind = 'actual' | 'supervise';
299
- /**
300
- * One agents-zone arrow (spec §4):
301
- * - `actual`: same-plan handoff between ts-adjacent dispatch ENTITY keys
302
- * (source/target = entity key — role-based). The line set filters
303
- * general-bucket endpoints
304
- * (a general handoff is noise, not a meaningful transfer) and keeps at most
305
- * ONE edge per entity-key pair (the latest direction) — design doc §2.2;
306
- * - `supervise`: ONE static sub-bucket line inside the `sdd-implement`
307
- * column — implementor ↔ reviewer mutual supervision (the mstar-sdd
308
- * mutual-supervision contract; the render draws it as a bidirectional
309
- * double arrow).
310
- * source/target embed the column id as an anchor prefix:
311
- * `<stage-id>:implementor` / `<stage-id>:reviewer`. NOT per-entity pairs —
312
- * drawing per-role pairs would fabricate concrete supervision relations
313
- * where no evidence exists (evidence-level handoffs are covered by
314
- * `actualEdges`). STATIC presence (design knowledge) + evidence-driven
315
- * lighting via `evidenced` (dim without implement/review dispatch
316
- * evidence, lit with it — never a fabricated activation).
317
- */
318
- export interface AgentEdge {
319
- kind: AgentEdgeKind;
320
- /** actual: entity key; supervise: `<stage-id>:implementor|reviewer`. */
321
- source: string;
322
- target: string;
323
- /** Unused by the line edge set (the removed `next` arrow carried the
324
- * running entity key); kept for shape stability — always null. */
325
- entityKey: string | null;
326
- /** Supervise edges only:
327
- * evidence-driven lighting — true when any dispatch row's role belongs to
328
- * an SDD sub-bucket (implementor ∪ reviewer), false otherwise (dim).
329
- * Absent (undefined) for actual. */
330
- evidenced?: boolean;
331
- }
332
304
  /**
333
305
  * The canvas degradation-note classification (spec §8): the projection
334
306
  * decides the note from the RAW ledger (never a UI-side heuristic on the
335
- * entity list): `empty` = 0 events; `settle-only` = events present but NO
336
- * dispatch row (all settle / garbage rows — genuinely no dispatch evidence);
337
- * `null` = dispatch evidence present (incl. anonymous dispatch rows — they
338
- * are evidence, not settle-only). The unreadable-ledger case is the SEPARATE
339
- * `degraded` flag, not a note value.
307
+ * entity list): `empty` = 0 events; `link-only` = the readable window
308
+ * contains ONLY `subagent-link` rows (identity records — neither dispatch
309
+ * nor settlement evidence); `settle-only` = events present but NO dispatch
310
+ * and not link-only (settles / garbage / workflow — genuinely no dispatch
311
+ * evidence); `null` = dispatch evidence present (incl. anonymous dispatch
312
+ * rows — they are evidence, not settle-only). The unreadable-ledger case
313
+ * is the SEPARATE `degraded` flag, not a note value.
340
314
  */
341
- export type AgentZoneNote = 'empty' | 'settle-only' | null;
315
+ export type AgentZoneNote = 'empty' | 'settle-only' | 'link-only' | null;
342
316
  /**
343
317
  * The projected agents zone (spec §4 + §6.2): the EXPECTED_ROLE_FLOW stage
344
- * skeleton plus the dispatch-derived entity cards and the actual/supervise
345
- * arrows. Total function — NEVER throws and NEVER fabricates: the KNOWN_AGENTS
318
+ * skeleton plus the dispatch-derived entity cards. Total function — NEVER
319
+ * throws and NEVER fabricates: the KNOWN_AGENTS
346
320
  * roster always projects as entities (idle cards when there is no evidence) —
347
321
  * agentFlow missing/unreadable → `degraded` (full idle roster + no
348
322
  * executing/pending claims); 0 events → `empty` (full idle roster + pending
@@ -360,8 +334,6 @@ export interface AgentZoneView {
360
334
  note: AgentZoneNote;
361
335
  /** Evidence-derived dispatch entities ∪ idle KNOWN_AGENTS cards — the full roster is NEVER hidden (spec §6.2). */
362
336
  entities: readonly AgentEntityView[];
363
- /** expected (stage skeleton) + actual (same-plan handoffs) + at most one next (latest running). */
364
- edges: readonly AgentEdge[];
365
337
  /** `running` entity count — the summary "N 执行中" (idle cards never count). */
366
338
  executing: number;
367
339
  /** Sum of expected roles of stages with no dispatch evidence — the summary "M 待执行". */
@@ -458,8 +430,7 @@ export declare function projectGraph(source: MstarEngineStatusPayload | null): Z
458
430
  * role is pending);
459
431
  * - otherwise: entities aggregated from dispatch rows (with `idle: false`),
460
432
  * statuses via the shared pairing walk, the un-evidenced KNOWN_AGENTS
461
- * members appended as idle cards, actual/supervise edges (design doc §2.2 —
462
- * the `expected` skeleton and `next` animation edges are REMOVED), and the
433
+ * members appended as idle cards, and the
463
434
  * executing (running entities — idle never counts) / pending
464
435
  * (un-evidenced stage roles) counts.
465
436
  *
@@ -468,13 +439,13 @@ export declare function projectGraph(source: MstarEngineStatusPayload | null): Z
468
439
  * suppresses a known role's idle card when its id already exists as an
469
440
  * evidence-derived entity key (a NON-roster dispatch produces a lit `general`
470
441
  * key while the roster `general` id stays un-evidenced — the twin is
471
- * suppressed via `litKeys`), so the render layer's `key`/`cards.set` never
472
- * collide.
442
+ * suppressed via `litKeys`), so the render layer's entity `key` space never
443
+ * collides.
473
444
  *
474
445
  * Canvas note: `note` classifies the readable ledger in
475
- * the projection ('empty' / 'settle-only' / null — see `AgentZoneNote`); the
476
- * UI consumes it directly and never infers settle-only from the entity list
477
- * (garbage rows would fake it).
446
+ * the projection ('empty' / 'link-only' / 'settle-only' / null — see
447
+ * `AgentZoneNote`); the UI consumes it directly and never infers
448
+ * settle-only from the entity list (garbage rows would fake it).
478
449
  *
479
450
  * Current-plan note: `activePlanId` / `activePlanCount` ride the
480
451
  * `state.plans[]` InProgress rows (catalog order) — the Phase 2 group label
@@ -82,8 +82,7 @@ export declare const TRANSITION_TO_PHASE: Readonly<Record<string, PhaseId>>;
82
82
  * placement (BOTTOM INSIDE the `sdd-implement` column bucket) is
83
83
  * superseded by the F5; the former SDD implement ↔ review
84
84
  * skeleton EDGE (sdd-implement → general back-edge, the `loop: true` arrow)
85
- * stays REMOVED from the projection ; the F5 supervise line is a SEPARATE sub-bucket edge (see
86
- * project-graph.ts `superviseEdges`).
85
+ * and the F5 sub-bucket supervise line are both REMOVED from the projection.
87
86
  *
88
87
  * Matching rules (spec §2.3 — implemented by `projectGraph`'s flow
89
88
  * projection): `expected` ⟺ `event.role` ∈ the union of ALL `roles` below
@@ -10,7 +10,7 @@
10
10
  * payload is a remote answer the panel never authored, so a malformed
11
11
  * envelope degrades to `unavailable` — never to a half-parsed view.
12
12
  */
13
- import type { MstarEngineStatusPayload } from '../../types.ts';
13
+ import type { MstarEngineStatusPayload, WorkflowSelectionView } from '../../types.ts';
14
14
  /** String field: non-empty string, else null (missing → `unknown`). */
15
15
  export declare function str(value: unknown): string | null;
16
16
  /** Boolean field: real boolean, else null. */
@@ -33,10 +33,35 @@ export type MstarEngineStatusFetch = {
33
33
  readonly at: string;
34
34
  /** The agent turn the row was emitted for. */
35
35
  readonly turn: number;
36
+ /**
37
+ * The session's CURRENT control-state selection, when the host served one
38
+ * (D4). It is deliberately separate from `payload.state.selection`, which
39
+ * keeps recording the LAST MODEL EMISSION — the picker's acknowledgement
40
+ * shows here immediately while plans / Event Log stay on the last snapshot.
41
+ * Null when the response carries none (an older host, or a malformed one).
42
+ */
43
+ readonly binding: WorkflowSelectionView | null;
36
44
  } | {
37
45
  readonly status: 'unavailable';
38
46
  readonly reason: string;
39
47
  };
48
+ /** One workflow-pick acknowledgement (the `selectWorkflow` wire result). */
49
+ export type MstarSelectWorkflowFetch = {
50
+ readonly status: 'selected';
51
+ readonly sessionId: string;
52
+ readonly workflowId: string;
53
+ } | {
54
+ readonly status: 'unavailable';
55
+ readonly reason: string;
56
+ };
57
+ /**
58
+ * Narrow one untrusted workflow-selection view. Every arm must carry its
59
+ * discriminants as non-empty strings; the picker rows (`activeWorkflowIds`)
60
+ * survive only as a string array. Anything else is null — the caller then
61
+ * falls back to the emitted payload's own selection rather than rendering a
62
+ * guessed one.
63
+ */
64
+ export declare function selectionView(value: unknown): WorkflowSelectionView | null;
40
65
  /**
41
66
  * Validate one `/api/mstar/engineStatus` response into the panel's state.
42
67
  *
@@ -59,3 +84,18 @@ export type MstarEngineStatusFetch = {
59
84
  * @returns the validated snapshot state, or the explicit unavailable state.
60
85
  */
61
86
  export declare function parseEngineStatusResult(raw: unknown, sessionId: string, cwd?: string): MstarEngineStatusFetch;
87
+ /**
88
+ * Validate one `/api/mstar/selectWorkflow` response into the picker's state.
89
+ *
90
+ * Like {@link parseEngineStatusResult} the whole envelope is untrusted: the
91
+ * transport result, the endpoint result and the acknowledged identity are all
92
+ * checked. A success MUST name the session AND the workflow this client asked
93
+ * for — a foreign acknowledgement is refused rather than rendered as this
94
+ * session's pick.
95
+ *
96
+ * @param raw - the value returned by `connection.rpc.call` (untrusted).
97
+ * @param sessionId - the session this client ASKED for.
98
+ * @param workflowId - the workflow id this client asked to select.
99
+ * @returns the acknowledged pick, or the explicit unavailable state.
100
+ */
101
+ export declare function parseSelectWorkflowResult(raw: unknown, sessionId: string, workflowId: string): MstarSelectWorkflowFetch;
@@ -122,7 +122,7 @@ import type { LocaleDictOf } from '@deepseek-ai/dsh-client-ui-slots';
122
122
  /** Locale namespace id for the workflow-viz panel. */
123
123
  export declare const NS = "mstar-panel";
124
124
  /** Panel dictionary keys (union of every translatable string the panel renders). */
125
- export type PanelKey = 'view.mstar-workflow' | 'tab.tasks' | 'tab.agents' | 'tab.events' | 'page.iteration.not-started' | 'page.iteration.expand' | 'page.iteration.collapse' | 'event-log.section.events' | 'event-log.section.violations' | 'event-log.empty' | 'event-log.empty.events' | 'event-log.empty.violations' | 'event-log.field.role' | 'event-log.field.agent' | 'event-log.field.stage' | 'event-log.field.plan' | 'event-log.field.task' | 'event-log.field.category' | 'event-log.field.time' | 'event-log.field.kind' | 'event-log.field.status' | 'event-log.field.expected' | 'event-log.field.settled' | 'event-log.field.duration' | 'event-log.field.run-id' | 'event-log.field.name' | 'event-log.field.members' | 'event-log.field.stop-reason' | 'event-log.field.severity' | 'event-log.field.code' | 'event-log.field.message' | 'event-log.kind.dispatch' | 'event-log.kind.settle' | 'event-log.yes' | 'event-log.no' | 'empty.waiting' | 'empty.loading' | 'empty.unavailable' | 'empty.no-harness' | 'empty.no-harness-hint' | 'watermark.version' | 'watermark.harness' | 'watermark.none' | 'panel.unknown' | 'graph.pass' | 'graph.fail' | 'zone.legend.title' | 'zone.legend.agent-running' | 'zone.legend.agent-settled' | 'zone.legend.agent-idle' | 'zone.iteration.step-label' | 'zone.iteration.step-badge' | 'zone.iteration.step.current' | 'zone.iteration.step.next' | 'zone.iteration.step.done' | 'zone.iteration.step.idle' | 'zone.phase.iteration-start' | 'zone.phase.autonomous-execute' | 'zone.phase.iteration-close' | 'zone.phase.pr-delivery' | 'zone.phase.merge-ready' | 'zone.branches.title' | 'zone.branches.iteration-base' | 'zone.branches.target' | 'zone.branches.spec-integration' | 'zone.tasks.title' | 'zone.tasks.total' | 'zone.tasks.no-plans' | 'zone.tasks.more' | 'zone.tasks.collapse' | 'zone.project.title' | 'zone.project.milestones' | 'zone.project.residuals' | 'zone.project.none' | 'zone.state.Todo' | 'zone.state.InProgress' | 'zone.state.InReview' | 'zone.state.Done' | 'zone.state.blocked-unknown' | 'zone.agents.title' | 'zone.agents.summary' | 'zone.agents.on-demand' | 'zone.agents.unknown-sub' | 'zone.agents.bucket.implementor' | 'zone.agents.bucket.reviewer' | 'zone.agents.group.phase-1' | 'zone.agents.group.phase-2' | 'zone.agents.group.phase-n' | 'zone.agents.group.plan' | 'zone.agents.group.no-plan' | 'zone.agents.group.plan-more' | 'flow.empty' | 'flow.settle-only' | 'flow.degraded' | 'flow.unexpected' | 'flow.in-flight' | 'flow.settled-ok' | 'flow.error' | 'flow.advisory' | 'flow.denied' | 'state.title' | 'state.selection' | 'state.selection.history' | 'state.plans' | 'state.residuals' | 'state.policy' | 'state.leases' | 'state.knowledge' | 'state.direction' | 'state.none' | 'state.enforcement' | 'state.enforcement.hard' | 'state.enforcement.soft' | 'state.plans.more' | 'state.residual.more' | 'state.policy.push' | 'state.policy.worktree' | 'state.policy.control-worktree' | 'state.knowledge.docs' | 'freshness.last-updated' | 'freshness.refresh-note';
125
+ export type PanelKey = 'view.mstar-workflow' | 'guide.description' | 'tab.tasks' | 'tab.agents' | 'tab.events' | 'page.iteration.not-started' | 'page.iteration.expand' | 'page.iteration.collapse' | 'event-log.section.events' | 'event-log.section.violations' | 'event-log.empty' | 'event-log.empty.events' | 'event-log.empty.violations' | 'event-log.field.role' | 'event-log.field.agent' | 'event-log.field.stage' | 'event-log.field.plan' | 'event-log.field.task' | 'event-log.field.category' | 'event-log.field.time' | 'event-log.field.kind' | 'event-log.field.status' | 'event-log.field.expected' | 'event-log.field.settled' | 'event-log.field.duration' | 'event-log.field.child-id' | 'event-log.field.run-id' | 'event-log.field.name' | 'event-log.field.members' | 'event-log.field.stop-reason' | 'event-log.field.severity' | 'event-log.field.code' | 'event-log.field.message' | 'event-log.kind.dispatch' | 'event-log.kind.settle' | 'event-log.yes' | 'event-log.no' | 'empty.waiting' | 'empty.loading' | 'empty.unavailable' | 'empty.no-harness' | 'empty.no-harness-hint' | 'watermark.version' | 'watermark.harness' | 'watermark.none' | 'panel.unknown' | 'graph.pass' | 'graph.fail' | 'zone.legend.title' | 'zone.legend.agent-running' | 'zone.legend.agent-settled' | 'zone.legend.agent-idle' | 'zone.iteration.step-label' | 'zone.iteration.step-badge' | 'zone.iteration.step.current' | 'zone.iteration.step.next' | 'zone.iteration.step.done' | 'zone.iteration.step.idle' | 'zone.phase.iteration-start' | 'zone.phase.autonomous-execute' | 'zone.phase.iteration-close' | 'zone.phase.pr-delivery' | 'zone.phase.merge-ready' | 'zone.branches.title' | 'zone.branches.iteration-base' | 'zone.branches.target' | 'zone.branches.spec-integration' | 'zone.tasks.title' | 'zone.tasks.total' | 'zone.tasks.no-plans' | 'zone.tasks.more' | 'zone.tasks.collapse' | 'zone.project.title' | 'zone.project.milestones' | 'zone.project.residuals' | 'zone.project.none' | 'zone.state.Todo' | 'zone.state.InProgress' | 'zone.state.InReview' | 'zone.state.Done' | 'zone.state.blocked-unknown' | 'zone.agents.title' | 'zone.agents.summary' | 'zone.agents.on-demand' | 'zone.agents.unknown-sub' | 'zone.agents.bucket.implementor' | 'zone.agents.bucket.reviewer' | 'zone.agents.group.phase-1' | 'zone.agents.group.phase-2' | 'zone.agents.group.phase-n' | 'zone.agents.group.plan' | 'zone.agents.group.no-plan' | 'zone.agents.group.plan-more' | 'flow.empty' | 'flow.settle-only' | 'flow.link-only' | 'flow.degraded' | 'flow.unexpected' | 'flow.in-flight' | 'flow.settled-ok' | 'flow.error' | 'flow.advisory' | 'flow.denied' | 'state.title' | 'state.selection' | 'state.selection.history' | 'state.selection.unbound' | 'state.selection.pick' | 'state.selection.pending' | 'state.selection.failed' | 'state.plans' | 'state.residuals' | 'state.policy' | 'state.leases' | 'state.knowledge' | 'state.direction' | 'state.none' | 'state.enforcement' | 'state.enforcement.hard' | 'state.enforcement.soft' | 'state.plans.more' | 'state.residual.more' | 'state.policy.push' | 'state.policy.worktree' | 'state.policy.control-worktree' | 'state.knowledge.docs' | 'freshness.last-updated' | 'freshness.refresh-note';
126
126
  declare module '@deepseek-ai/dsh-client-ui-slots' {
127
127
  interface LocaleNamespaceMap {
128
128
  'mstar-panel': PanelKey;