@uniqbit/mate-core 1.0.0-canary.2 → 1.0.0-canary.5

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 (189) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
  2. package/claude-plugin/hooks/hooks.json +21 -1
  3. package/claude-plugin/hooks/session-attention.mjs +10 -0
  4. package/claude-plugin/hooks/session-end.mjs +9 -0
  5. package/claude-plugin/hooks/session-guidance.mjs +1 -1
  6. package/opencode-plugin/src/server.ts +13 -2
  7. package/opencode-plugin/src/tui.tsx +1 -1
  8. package/opencode-plugin/tui.tsx +2 -1
  9. package/package.json +1 -1
  10. package/src/cli/commands/artifact/delivery/archive.ts +2 -2
  11. package/src/cli/commands/artifact/delivery/link.ts +22 -5
  12. package/src/cli/commands/artifact/delivery/output.ts +9 -1
  13. package/src/cli/commands/artifact/finish/openspec.ts +1 -3
  14. package/src/cli/commands/companion/companion.ts +1 -1
  15. package/src/cli/commands/companion/link.ts +36 -4
  16. package/src/cli/commands/companion/open.ts +40 -12
  17. package/src/cli/commands/doctor.ts +122 -0
  18. package/src/cli/commands/session/prepare.ts +32 -4
  19. package/src/cli/commands/session/registry.ts +90 -0
  20. package/src/cli/commands/studio/companion-removal.ts +79 -0
  21. package/src/cli/commands/studio/mate-inventory.ts +1 -1
  22. package/src/cli/commands/studio/payload.ts +12 -1
  23. package/src/cli/commands/studio/server.ts +39 -16
  24. package/src/cli/commands/studio/services.ts +20 -0
  25. package/src/cli/commands/studio/skill-files.ts +133 -0
  26. package/src/cli/commands/studio/vault.ts +218 -44
  27. package/src/cli/commands/studio/views/model.ts +0 -5
  28. package/src/cli/commands/studio/views/vault/markdown-tree.ts +255 -4
  29. package/src/cli/commands/unwrap.ts +8 -0
  30. package/src/cli/commands/update.ts +26 -8
  31. package/src/cli/commands/vscode/setup.ts +155 -0
  32. package/src/cli/commands/vscode/vsix.ts +73 -0
  33. package/src/cli/commands/working/cleanup.ts +34 -10
  34. package/src/cli/commands/working/worktree.ts +58 -8
  35. package/src/cli/commands/wrap.ts +33 -7
  36. package/src/cli/main.ts +9 -2
  37. package/src/cli/usage.ts +6 -1
  38. package/src/hooks/companion-instructions.ts +19 -11
  39. package/src/hooks/hook-io.ts +15 -0
  40. package/src/hooks/session-banner.ts +5 -3
  41. package/src/hooks/session-end.ts +10 -0
  42. package/src/hooks/session-guidance.ts +10 -6
  43. package/src/hooks/session-prepare.ts +47 -31
  44. package/src/hooks/session-register.ts +199 -0
  45. package/src/hooks/tokensave-route.ts +7 -3
  46. package/src/hooks/validate-artifact-path.ts +9 -2
  47. package/src/lib/delivery/archive-change.ts +0 -1
  48. package/src/lib/delivery/branches.ts +15 -0
  49. package/src/lib/delivery/record-delivery.ts +94 -39
  50. package/src/lib/delivery/record.ts +30 -28
  51. package/src/lib/delivery/refresh.ts +37 -17
  52. package/src/lib/delivery/resolve-branch.ts +258 -37
  53. package/src/lib/factory/outcomes/index.ts +11 -1
  54. package/src/lib/factory/runtime.ts +10 -1
  55. package/src/lib/opencode-server.ts +238 -0
  56. package/src/lib/orchestrator/adapters/claude.ts +147 -2
  57. package/src/lib/orchestrator/adapters/opencode.ts +53 -2
  58. package/src/lib/orchestrator/checkout-adoption.ts +125 -0
  59. package/src/lib/orchestrator/companion-registry-store.ts +6 -2
  60. package/src/lib/orchestrator/editor.ts +2 -2
  61. package/src/lib/orchestrator/framework-context.ts +26 -14
  62. package/src/lib/orchestrator/global-config-store.ts +11 -0
  63. package/src/lib/orchestrator/launcher.ts +15 -2
  64. package/src/lib/orchestrator/projection-claude-links.ts +52 -5
  65. package/src/lib/orchestrator/projection-claude-skills.ts +28 -2
  66. package/src/lib/orchestrator/projection-companion-link.ts +12 -1
  67. package/src/lib/orchestrator/registry-checkouts.ts +177 -0
  68. package/src/lib/orchestrator/repository-link.ts +216 -57
  69. package/src/lib/orchestrator/serving-claude-wrap.ts +43 -0
  70. package/src/lib/orchestrator/session-context-link.ts +11 -5
  71. package/src/lib/orchestrator/session-prepare.ts +36 -6
  72. package/src/lib/orchestrator/types.ts +5 -0
  73. package/src/lib/orchestrator/workspace-inventory.ts +5 -1
  74. package/src/lib/public-npm.ts +17 -0
  75. package/src/lib/session-attribution.ts +52 -0
  76. package/src/lib/session-state.ts +285 -0
  77. package/src/lib/session-stop.ts +64 -0
  78. package/src/lib/workset/record.ts +20 -0
  79. package/src/lib/workset/worktree.ts +85 -17
  80. package/src/opencode/background-server.ts +145 -0
  81. package/src/opencode/companion-hooks.ts +3 -1
  82. package/src/opencode/companion-policy.ts +2 -2
  83. package/src/opencode/projected-guidance.ts +2 -1
  84. package/src/opencode/session-register.ts +176 -0
  85. package/src/opencode/tui.tsx +19 -29
  86. package/src/runtime/claude-delivery-plan.ts +14 -3
  87. package/src/runtime/current-branch.ts +10 -0
  88. package/src/runtime/env.ts +13 -7
  89. package/src/runtime/git-layout.ts +164 -17
  90. package/src/runtime/launch-env-guard.ts +65 -0
  91. package/src/runtime/opencode-server-record.ts +136 -0
  92. package/src/runtime/projection.ts +40 -6
  93. package/src/runtime/repo-local.ts +6 -1
  94. package/src/runtime/serving-claude-wrap.ts +28 -0
  95. package/src/runtime/session-context.ts +4 -3
  96. package/src/runtime/session-registry.ts +434 -0
  97. package/src/runtime/tokensave-route.ts +10 -5
  98. package/src/runtime/wrap-state.ts +31 -0
  99. package/src/studio.ts +2 -0
  100. package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +49 -21
  101. package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +0 -5
  102. package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +2 -8
  103. package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +1 -3
  104. package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +2 -4
  105. package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +49 -21
  106. package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +0 -5
  107. package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +2 -8
  108. package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +1 -3
  109. package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +2 -4
  110. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +404 -30
  111. package/src/tools/setup/dynamic-plugins/hydrate.ts +4 -3
  112. package/src/tools/setup/providers/claude-plugin-hooks.ts +26 -0
  113. package/src/tools/setup/providers/claude.ts +21 -1
  114. package/studio-dist/client/assets/app-CdPiFv59.css +2 -0
  115. package/studio-dist/client/assets/button-BIIHE0EQ.js +3 -0
  116. package/studio-dist/client/assets/companion-view-DM6YyXaR.js +1 -0
  117. package/studio-dist/client/assets/delivery-path-DELxj0Av.js +1 -0
  118. package/studio-dist/client/assets/factory-BZy0E8ty.js +4 -0
  119. package/studio-dist/client/assets/index-B3wkMzjA.js +40 -0
  120. package/studio-dist/client/assets/markdown-view-pQ2Qp_i5.js +1 -0
  121. package/studio-dist/client/assets/panel-CbajlC3p.js +1 -0
  122. package/studio-dist/client/assets/{prepaint-CD5OpmTM.js → prepaint-CwSrpdFA.js} +7 -4
  123. package/studio-dist/client/assets/react-CN2GSx7x.js +1 -0
  124. package/studio-dist/client/assets/reports-DllhYQ5_.js +1 -0
  125. package/studio-dist/client/assets/routes-COm-G3mK.js +1 -0
  126. package/studio-dist/client/assets/skills-DmWAy-jZ.js +1 -0
  127. package/studio-dist/client/assets/specs-BG3Wi3ln.js +1 -0
  128. package/studio-dist/client/assets/steps-DFsH3Neu.js +1 -0
  129. package/studio-dist/client/assets/vault-B2q1nBY5.js +1 -0
  130. package/studio-dist/client/assets/warnings-BSXIyuSQ.js +1 -0
  131. package/studio-dist/client/assets/workflow-DlsQD6Hc.js +1 -0
  132. package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-BQKuMdJW.js → __23tanstack-start-server-fn-resolver-M2GBs8s3.js} +179 -9
  133. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +35 -25
  134. package/studio-dist/server/assets/button-CIJqAhni.js +11929 -0
  135. package/studio-dist/server/assets/{companion-view-aBady57v.js → companion-view-DISASvdJ.js} +13 -7
  136. package/studio-dist/server/assets/companions-BYbHWKOZ.js +15 -0
  137. package/studio-dist/server/assets/delivery-path-C29fBynY.js +654 -0
  138. package/studio-dist/server/assets/{factory-DT3UzHlh.js → factory-DGPmNGbo.js} +1 -0
  139. package/studio-dist/server/assets/{factory-D6xnjedJ.js → factory-DUTa0eDs.js} +317 -530
  140. package/studio-dist/server/assets/markdown-view-Bn7xPdks.js +86 -0
  141. package/studio-dist/server/assets/panel-3Jmn4awF.js +169 -0
  142. package/studio-dist/server/assets/{prepaint-BMke0fo1.js → prepaint-DJfTQ_VH.js} +6 -2
  143. package/studio-dist/server/assets/{react-COs0LHn-.js → react-Ce6dj15C.js} +4 -9
  144. package/studio-dist/server/assets/reports-C06RXVE2.js +18 -0
  145. package/studio-dist/server/assets/reports-D6YMqhnO.js +142 -0
  146. package/studio-dist/server/assets/router-C8MGqlAY.js +13713 -0
  147. package/studio-dist/server/assets/routes-BcFgvqf7.js +622 -0
  148. package/studio-dist/server/assets/{shell-CboT2f66.js → shell-DS3wUexh.js} +1 -0
  149. package/studio-dist/server/assets/skills-BEnOxiDl.js +266 -0
  150. package/studio-dist/server/assets/skills-CtrBAtX3.js +28 -0
  151. package/studio-dist/server/assets/specs-C8rv34-5.js +211 -0
  152. package/studio-dist/server/assets/{start-BW5ovN0k.js → start-h3ICWwd2.js} +4 -1
  153. package/studio-dist/server/assets/steps-Dq_CwY_s.js +181 -0
  154. package/studio-dist/server/assets/{vault-BGulVoNh.js → vault-BmWnryh3.js} +16 -1
  155. package/studio-dist/server/assets/vault-Fvxt2Tzl.js +1032 -0
  156. package/studio-dist/server/assets/{views-Bd7cRr27.js → views-BgYa-za2.js} +1 -3
  157. package/studio-dist/server/assets/warnings-DzR6fyZh.js +23 -0
  158. package/studio-dist/server/assets/workflow-liRYecHk.js +73 -0
  159. package/studio-dist/server/server.js +3 -157
  160. package/studio-dist/client/assets/companion-view-Csva26Ir.js +0 -1
  161. package/studio-dist/client/assets/delivery-path-DJMpRmiY.js +0 -1
  162. package/studio-dist/client/assets/factory-B7l9ZQyx.js +0 -4
  163. package/studio-dist/client/assets/index-n6uo_92S.js +0 -40
  164. package/studio-dist/client/assets/queries-CN3JwMBX.js +0 -1
  165. package/studio-dist/client/assets/react-CabXf2Ds.js +0 -1
  166. package/studio-dist/client/assets/report-time-Dc-KOqQu.js +0 -1
  167. package/studio-dist/client/assets/reports-C01RsnMA.js +0 -1
  168. package/studio-dist/client/assets/routes-4pbC-2Hj.js +0 -1
  169. package/studio-dist/client/assets/skills-CihQganl.js +0 -1
  170. package/studio-dist/client/assets/spec-areas-C2L48N4C.js +0 -1
  171. package/studio-dist/client/assets/specs-D24_35_K.js +0 -1
  172. package/studio-dist/client/assets/studio-DKxfi691.css +0 -1
  173. package/studio-dist/client/assets/studio-queries-rvbJupCy.js +0 -3
  174. package/studio-dist/client/assets/vault-Bd4CQiTK.js +0 -1
  175. package/studio-dist/client/assets/warnings-V_Ys51wJ.js +0 -1
  176. package/studio-dist/client/assets/workflow-BJejeVwQ.js +0 -1
  177. package/studio-dist/server/assets/delivery-path-BkKNjgkf.js +0 -778
  178. package/studio-dist/server/assets/queries-Ag2iL8q2.js +0 -107
  179. package/studio-dist/server/assets/report-time-DAfzln-N.js +0 -8
  180. package/studio-dist/server/assets/reports-BnUNJVtx.js +0 -126
  181. package/studio-dist/server/assets/router-BH--drIx.js +0 -4298
  182. package/studio-dist/server/assets/routes-khSDK1bV.js +0 -361
  183. package/studio-dist/server/assets/skills-MWYnWoKs.js +0 -106
  184. package/studio-dist/server/assets/spec-areas-DcnO6vW-.js +0 -16
  185. package/studio-dist/server/assets/specs-DE3w8hZP.js +0 -155
  186. package/studio-dist/server/assets/studio-queries-CLnP9kGu.js +0 -3365
  187. package/studio-dist/server/assets/vault-CuyyhLyB.js +0 -832
  188. package/studio-dist/server/assets/warnings-BH05rOuG.js +0 -15
  189. package/studio-dist/server/assets/workflow-BSuIKWqH.js +0 -42
@@ -0,0 +1,654 @@
1
+ import { i as __toESM } from "./rolldown-runtime-DYf_mQCB.js";
2
+ import { j as require_react, u as require_jsx_runtime } from "./__23tanstack-start-server-fn-resolver-M2GBs8s3.js";
3
+ import { $ as CommandLine, Ar as cn, at as Pills, et as Count, nt as ListCard, rt as PAGE_PAD } from "./button-CIJqAhni.js";
4
+ import { n as PanelSection, r as SidePanel, t as PanelHead } from "./panel-3Jmn4awF.js";
5
+ import { n as workflowPlan, t as PHASE_LABELS } from "./steps-Dq_CwY_s.js";
6
+ // src/views/workflow/graph.ts
7
+ var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
8
+ var stageNode = (step) => ({
9
+ id: step.id,
10
+ kind: "stage",
11
+ step
12
+ });
13
+ function columnsOf(path) {
14
+ const columns = path.map.map((entry) => {
15
+ if (entry.kind === "stage") return {
16
+ nodes: [stageNode(entry.step)],
17
+ optional: entry.step.optional,
18
+ phase: entry.step.phase
19
+ };
20
+ if (entry.group === "human") return {
21
+ nodes: [{
22
+ id: "reviews",
23
+ kind: "review-group",
24
+ steps: entry.steps
25
+ }],
26
+ optional: false,
27
+ phase: entry.steps[0].phase
28
+ };
29
+ return {
30
+ nodes: entry.steps.map(stageNode),
31
+ optional: true,
32
+ phase: entry.steps[0].phase
33
+ };
34
+ });
35
+ columns.unshift({
36
+ nodes: [{
37
+ id: "start",
38
+ kind: "start"
39
+ }],
40
+ optional: false,
41
+ phase: columns[0]?.phase ?? "plan"
42
+ });
43
+ return columns;
44
+ }
45
+ function entersNewSession(node) {
46
+ if (node.kind === "stage") return Boolean(node.step.sessionBreakBefore);
47
+ if (node.kind === "review-group") return Boolean(node.steps[0].sessionBreakBefore);
48
+ return false;
49
+ }
50
+ function edgesOf(columns) {
51
+ const edges = [];
52
+ const link = (from, to, kind) => {
53
+ for (const a of from) for (const b of to) edges.push({
54
+ from: a.id,
55
+ to: b.id,
56
+ kind,
57
+ newSession: entersNewSession(b)
58
+ });
59
+ };
60
+ columns.forEach((column, index) => {
61
+ const next = columns[index + 1];
62
+ if (next) link(column.nodes, next.nodes, "flow");
63
+ const before = columns[index - 1];
64
+ if (column.optional && before && next) link(before.nodes, next.nodes, "bypass");
65
+ });
66
+ return edges;
67
+ }
68
+ function bandsOf(columns) {
69
+ const bands = [];
70
+ columns.forEach((column, index) => {
71
+ const band = bands.at(-1);
72
+ if (band?.phase === column.phase) {
73
+ band.to = index + 1;
74
+ return;
75
+ }
76
+ bands.push({
77
+ phase: column.phase,
78
+ label: PHASE_LABELS[column.phase],
79
+ from: index,
80
+ to: index + 1
81
+ });
82
+ });
83
+ return bands;
84
+ }
85
+ /** Changes archive before they publish, so everything up to Archive change repeats per change. */
86
+ function cycleOf(columns) {
87
+ const archive = columns.findIndex((column) => column.nodes.some((node) => node.id === "archive"));
88
+ return archive === -1 ? null : {
89
+ from: 0,
90
+ to: archive + 1
91
+ };
92
+ }
93
+ /** The path's node graph. Single nodes span every row; peers take a row each. */
94
+ function workflowGraph(path) {
95
+ const columns = columnsOf(path);
96
+ const rows = Math.max(1, ...columns.map((column) => column.nodes.length));
97
+ const nodes = columns.flatMap((column, index) => column.nodes.map((node, row) => column.nodes.length === 1 ? {
98
+ ...node,
99
+ column: index,
100
+ row: 0,
101
+ rowSpan: rows
102
+ } : {
103
+ ...node,
104
+ column: index,
105
+ row,
106
+ rowSpan: 1
107
+ }));
108
+ return {
109
+ columns: columns.length,
110
+ rows,
111
+ nodes,
112
+ edges: edgesOf(columns),
113
+ bands: bandsOf(columns),
114
+ cycle: cycleOf(columns)
115
+ };
116
+ }
117
+ var graphAcross = (graph) => graph.rows * 2 + 1;
118
+ function nodeCenter(node) {
119
+ return {
120
+ along: node.column + .5,
121
+ across: node.row * 2 + node.rowSpan
122
+ };
123
+ }
124
+ var round = (value) => Math.round(value * 1e4) / 1e4;
125
+ var percent = (part, whole) => `${round(part / whole * 100)}%`;
126
+ /** An SVG `x y` pair: across is horizontal, along runs down. */
127
+ var pair = ({ along, across }) => `${round(across)} ${round(along)}`;
128
+ function endpoints(graph, edge) {
129
+ const at = (id) => {
130
+ const node = graph.nodes.find((candidate) => candidate.id === id);
131
+ if (!node) throw new Error(`Unknown graph node: ${id}`);
132
+ return nodeCenter(node);
133
+ };
134
+ return [at(edge.from), at(edge.to)];
135
+ }
136
+ /** Center to center: nodes are opaque and drawn over the edges, so a line meets each border. */
137
+ function edgePath(graph, edge) {
138
+ const [a, b] = endpoints(graph, edge);
139
+ if (edge.kind === "bypass") {
140
+ const lane = graphAcross(graph);
141
+ return `M ${pair(a)} C ${pair({
142
+ along: a.along,
143
+ across: lane
144
+ })}, ${pair({
145
+ along: b.along,
146
+ across: lane
147
+ })}, ${pair(b)}`;
148
+ }
149
+ const middle = (a.along + b.along) / 2;
150
+ return `M ${pair(a)} C ${pair({
151
+ along: middle,
152
+ across: a.across
153
+ })}, ${pair({
154
+ along: middle,
155
+ across: b.across
156
+ })}, ${pair(b)}`;
157
+ }
158
+ /** Midpoint of an edge's curve, where a new-session mark sits. */
159
+ function edgeMidpoint(graph, edge) {
160
+ const [a, b] = endpoints(graph, edge);
161
+ const along = (a.along + b.along) / 2;
162
+ if (edge.kind === "bypass") return {
163
+ along,
164
+ across: (a.across + b.across) / 8 + graphAcross(graph) * 3 / 4
165
+ };
166
+ return {
167
+ along,
168
+ across: (a.across + b.across) / 2
169
+ };
170
+ }
171
+ /** A point as percentages of the drawing, for undistorted marks. */
172
+ function percentOf(graph, point) {
173
+ return {
174
+ x: percent(point.across, graphAcross(graph)),
175
+ y: percent(point.along, graph.columns)
176
+ };
177
+ }
178
+ /** A column range's vertical extent as percentages of the drawing: a band or the cycle. */
179
+ function bandSpan(graph, band) {
180
+ return {
181
+ top: percent(band.from, graph.columns),
182
+ height: percent(band.to - band.from, graph.columns)
183
+ };
184
+ }
185
+ // src/views/workflow/delivery-path.tsx
186
+ var import_jsx_runtime = require_jsx_runtime();
187
+ var NO_COUNTS = {};
188
+ var NO_STAGES = [];
189
+ function DeliveryPathView({ payload, counts = NO_COUNTS, changesByStage = NO_STAGES }) {
190
+ const plan = workflowPlan({
191
+ skills: payload.skills && payload.skills.length > 0 ? payload.skills : void 0,
192
+ topology: payload.topology
193
+ });
194
+ const [schema, setSchema] = (0, import_react.useState)(plan.paths[0].schema);
195
+ const path = plan.paths.find((entry) => entry.schema === schema) ?? plan.paths[0];
196
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
197
+ className: "workflow-delivery-path @container grid content-start gap-2",
198
+ "aria-label": "Delivery Path",
199
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
200
+ className: cn(PAGE_PAD, "flex flex-wrap items-center gap-3"),
201
+ "data-workflow-schema-root": true,
202
+ children: [
203
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
204
+ className: "text-sm text-muted",
205
+ children: "OpenSpec schema"
206
+ }),
207
+ plan.paths.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pills, {
208
+ label: "OpenSpec schema",
209
+ value: schema,
210
+ onChange: setSchema,
211
+ options: plan.paths.map((entry) => ({
212
+ value: entry.schema,
213
+ label: entry.label
214
+ }))
215
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
216
+ className: "font-mono text-sm",
217
+ children: path.label
218
+ }),
219
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
220
+ className: "text-sm text-muted",
221
+ children: path.tagline
222
+ })
223
+ ]
224
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PathBody, {
225
+ path,
226
+ counts,
227
+ changesByStage
228
+ }, path.schema)]
229
+ });
230
+ }
231
+ var nodeOf = (step) => step.kind === "human" ? "reviews" : step.id;
232
+ /** The graph on the page; one stage's detail opens in the slide-over panel. */
233
+ function PathBody({ path, counts, changesByStage }) {
234
+ const [selected, setSelected] = (0, import_react.useState)(null);
235
+ const step = path.steps.find((entry) => entry.id === selected) ?? null;
236
+ const placed = changesByStage.filter((group) => group.changes.length > 0);
237
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
238
+ className: cn(PAGE_PAD, "workflow-path grid grid-cols-[minmax(380px,520px)_minmax(260px,1fr)] items-start gap-10 pt-10 pb-12 @max-[880px]:grid-cols-1"),
239
+ "data-workflow-schema-panel": path.schema,
240
+ children: [
241
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
242
+ className: "workflow-path-graph grid min-w-0 justify-items-center gap-9 px-8",
243
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(WorkflowGraphView, {
244
+ path,
245
+ selected,
246
+ onSelect: setSelected,
247
+ counts
248
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GraphLegend, {})]
249
+ }),
250
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
251
+ className: "workflow-detail-overview grid content-start gap-5",
252
+ id: overviewId(path),
253
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
254
+ className: "grid gap-2 text-sm leading-relaxed text-muted",
255
+ children: [
256
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
257
+ className: "workflow-description m-0 text-text",
258
+ children: path.description
259
+ }),
260
+ !path.reviewsKnown ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
261
+ className: "workflow-description m-0",
262
+ children: "The schema's artifacts could not be read, so its review stages are unknown."
263
+ }) : null,
264
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
265
+ className: "workflow-description m-0",
266
+ children: "A workset is one or more changes published together: after Archive change, start again at the top for the next change, and publish once they are archived."
267
+ }),
268
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
269
+ className: "workflow-detail-hint m-0",
270
+ children: "Choose a stage to see what it does and the prompt that runs it."
271
+ })
272
+ ]
273
+ }), placed.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListCard, {
274
+ title: "Where your changes are",
275
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
276
+ className: "m-0 list-none p-0",
277
+ children: placed.map((group) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", {
278
+ className: "grid gap-1 border-t border-rule-soft px-4 py-2 first:border-t-0",
279
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
280
+ className: "flex items-center gap-2 text-sm font-semibold",
281
+ children: [group.label, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Count, { value: group.changes.length })]
282
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
283
+ className: "truncate font-mono text-xs text-muted",
284
+ children: group.changes.join(", ")
285
+ })]
286
+ }, group.node))
287
+ })
288
+ }) : null]
289
+ }),
290
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidePanel, {
291
+ items: path.steps.map((entry) => entry.id),
292
+ current: step?.id ?? null,
293
+ onSelect: setSelected,
294
+ title: step ? `Stage ${step.label}` : "Stage",
295
+ children: step ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StageDetail, {
296
+ step,
297
+ changes: changesByStage.find((group) => group.node === nodeOf(step))?.changes ?? []
298
+ }) : null
299
+ })
300
+ ]
301
+ });
302
+ }
303
+ var overviewId = (path) => `workflow-${path.schema}-overview`;
304
+ /** Each node's progress, by column: everything left of the current node is done. */
305
+ function progressOf(graph, progress) {
306
+ if (!progress) return () => void 0;
307
+ const at = currentColumn(graph, progress.current);
308
+ return (node) => {
309
+ if (node.column < at) return "done";
310
+ return node.id === progress.current ? "current" : "next";
311
+ };
312
+ }
313
+ /** The current node's column; past the last column when `complete`. */
314
+ function currentColumn(graph, current) {
315
+ const found = graph.nodes.find((node) => node.id === current);
316
+ if (found) return found.column;
317
+ if (current === "complete") return graph.columns;
318
+ return -1;
319
+ }
320
+ var COUNT_NAMES = { reviews: (count) => `${count} ${count === 1 ? "change waits" : "changes wait"} for review` };
321
+ var countName = (node, label, count) => COUNT_NAMES[node]?.(count) ?? `${count} ${count === 1 ? "change" : "changes"} at ${label}`;
322
+ /** How many of the companion's changes are at a node; named for assistive technology. */
323
+ function CountBadge({ count, name }) {
324
+ if (!count) return null;
325
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
326
+ className: "workflow-graph-count absolute -top-2.5 -right-2.5 z-1 inline-grid h-5 min-w-5 place-items-center rounded-full border border-[color-mix(in_srgb,var(--accent)_45%,var(--border))] bg-accent-soft px-1.5 font-sans text-2xs font-bold text-text",
327
+ "aria-label": name,
328
+ role: "img",
329
+ children: count
330
+ });
331
+ }
332
+ /**
333
+ * Stage buttons are the only announced part: their document order is the stage order. Bands,
334
+ * edges, and marks are decorative and hidden from assistive technology. With `progress` the
335
+ * map shows one item's position, and nodes are plain labels.
336
+ */
337
+ function WorkflowGraphView({ path, progress, label = "Delivery Path map", selected = null, onSelect, counts = NO_COUNTS }) {
338
+ const graph = workflowGraph(path);
339
+ const stateOf = progressOf(graph, progress);
340
+ const plain = Boolean(progress) || !onSelect;
341
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", {
342
+ className: "workflow-graph",
343
+ "aria-label": label,
344
+ "data-progress-activity": progress?.activity,
345
+ style: {
346
+ "--graph-columns": String(graph.columns),
347
+ "--graph-rows": String(graph.rows)
348
+ },
349
+ children: [
350
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
351
+ className: "workflow-graph-bands",
352
+ "aria-hidden": "true",
353
+ children: [
354
+ graph.bands.map((band) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
355
+ className: "workflow-graph-band",
356
+ "data-band": band.phase,
357
+ style: bandSpan(graph, band),
358
+ children: band.label
359
+ }, band.phase)),
360
+ graph.cycle ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
361
+ className: "workflow-graph-cycle",
362
+ style: bandSpan(graph, graph.cycle),
363
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "repeats for each change" })
364
+ }) : null,
365
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
366
+ className: "workflow-graph-workset",
367
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "workset" })
368
+ })
369
+ ]
370
+ }),
371
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GraphLayer, {
372
+ graph,
373
+ stateOf
374
+ }),
375
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", {
376
+ className: "workflow-graph-nodes",
377
+ children: graph.nodes.map((node) => node.kind === "start" ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", {
378
+ className: "workflow-graph-node",
379
+ "data-node-kind": node.kind,
380
+ "data-progress": stateOf(node),
381
+ "aria-current": stateOf(node) === "current" ? "step" : void 0,
382
+ style: {
383
+ "--graph-row": String(node.column + 1),
384
+ "--graph-lane": String(node.row + 1),
385
+ "--graph-span": String(node.rowSpan)
386
+ },
387
+ children: node.kind === "stage" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
388
+ className: "relative max-w-full",
389
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NodeLink, {
390
+ step: node.step,
391
+ box: true,
392
+ plain,
393
+ current: selected === node.step.id,
394
+ onSelect,
395
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressNote, {
396
+ progress,
397
+ state: stateOf(node)
398
+ })
399
+ }), plain ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CountBadge, {
400
+ count: counts[node.id],
401
+ name: countName(node.id, node.step.label, counts[node.id] ?? 0)
402
+ })]
403
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
404
+ className: "workflow-graph-box workflow-graph-group relative",
405
+ "data-map-group": "human",
406
+ "data-current": node.steps.some((step) => step.id === selected) ? "true" : void 0,
407
+ children: [
408
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
409
+ className: "workflow-graph-group-label",
410
+ children: "Human review"
411
+ }),
412
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { children: node.steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NodeLink, {
413
+ step,
414
+ plain,
415
+ current: selected === step.id,
416
+ onSelect
417
+ }) }, step.id)) }),
418
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressNote, {
419
+ progress,
420
+ state: stateOf(node)
421
+ }),
422
+ plain ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CountBadge, {
423
+ count: counts.reviews,
424
+ name: countName("reviews", "Human review", counts.reviews ?? 0)
425
+ })
426
+ ]
427
+ })
428
+ }, node.id))
429
+ })
430
+ ]
431
+ });
432
+ }
433
+ /** Explains the graph's visual marks; the panel states the same facts per stage. */
434
+ function GraphLegend() {
435
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", {
436
+ className: "workflow-graph-legend",
437
+ "aria-hidden": "true",
438
+ children: [
439
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: "workflow-legend-optional" }), "optional"] }),
440
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: "workflow-graph-openspec" }), "OpenSpec"] }),
441
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: "workflow-legend-session" }), "new session"] }),
442
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: "workflow-legend-skip" }), "can be skipped"] })
443
+ ]
444
+ });
445
+ }
446
+ /** The current node's note, plus the done mark for assistive technology. */
447
+ function ProgressNote({ progress, state }) {
448
+ if (state === "done") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
449
+ className: "sr-only",
450
+ children: ", done"
451
+ });
452
+ if (state !== "current" || !progress?.note) return null;
453
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
454
+ className: "workflow-graph-note",
455
+ children: progress.note
456
+ });
457
+ }
458
+ function GraphLayer({ graph, stateOf }) {
459
+ /** A flow edge into a done or current node is the way the item came. */
460
+ const travelled = (edge) => {
461
+ const to = graph.nodes.find((node) => node.id === edge.to);
462
+ const state = to ? stateOf(to) : void 0;
463
+ return edge.kind === "flow" && (state === "done" || state === "current");
464
+ };
465
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", {
466
+ className: "workflow-graph-layer",
467
+ "aria-hidden": "true",
468
+ focusable: "false",
469
+ children: [
470
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
471
+ viewBox: `0 0 ${graphAcross(graph)} ${graph.columns}`,
472
+ preserveAspectRatio: "none",
473
+ overflow: "visible",
474
+ children: graph.edges.map((edge) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
475
+ className: "workflow-graph-edge",
476
+ d: edgePath(graph, edge),
477
+ "data-edge-kind": edge.kind,
478
+ "data-edge-from": edge.from,
479
+ "data-edge-to": edge.to,
480
+ "data-new-session": edge.newSession ? "true" : void 0,
481
+ "data-travelled": travelled(edge) ? "true" : void 0
482
+ }, `${edge.kind}-${edge.from}-${edge.to}`))
483
+ }),
484
+ graph.nodes.map((node) => {
485
+ if (node.kind !== "start") return null;
486
+ const { x, y } = percentOf(graph, nodeCenter(node));
487
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", {
488
+ className: "workflow-graph-start",
489
+ cx: x,
490
+ cy: y,
491
+ r: "3.5"
492
+ }, node.id);
493
+ }),
494
+ graph.edges.map((edge) => {
495
+ if (!edge.newSession) return null;
496
+ const { x, y } = percentOf(graph, edgeMidpoint(graph, edge));
497
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", {
498
+ className: "workflow-graph-session",
499
+ "data-session-mark": edge.to,
500
+ cx: x,
501
+ cy: y,
502
+ r: "3.5"
503
+ }, `${edge.from}-${edge.to}`);
504
+ })
505
+ ]
506
+ });
507
+ }
508
+ /**
509
+ * `box` marks a standalone node; stages inside the review group share its box. `plain` renders
510
+ * a label, for a map that opens nothing.
511
+ */
512
+ function NodeLink({ step, box, plain, current, onSelect, children }) {
513
+ const shared = {
514
+ className: box ? "workflow-graph-link workflow-graph-box" : "workflow-graph-link",
515
+ "data-map-stage": step.id,
516
+ "data-stage-kind": step.kind,
517
+ "data-optional": step.optional ? "true" : void 0
518
+ };
519
+ const body = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
520
+ step.badges.includes("openspec") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
521
+ className: "workflow-graph-openspec",
522
+ "aria-hidden": "true"
523
+ }) : null,
524
+ step.kind === "human" ? step.artifact : step.label,
525
+ children
526
+ ] });
527
+ if (plain) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
528
+ ...shared,
529
+ children: body
530
+ });
531
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
532
+ type: "button",
533
+ ...shared,
534
+ "aria-label": step.kind === "human" ? step.label : void 0,
535
+ "aria-current": current ? "true" : void 0,
536
+ onClick: () => onSelect?.(step.id),
537
+ children: body
538
+ });
539
+ }
540
+ /** One stage in the panel: what it does, how it runs, and the changes at it. */
541
+ function StageDetail({ step, changes }) {
542
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", {
543
+ className: "workflow-card",
544
+ "data-stage": step.id,
545
+ "data-stage-kind": step.kind,
546
+ "data-optional": step.optional ? "true" : void 0,
547
+ children: [
548
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelHead, {
549
+ title: step.label,
550
+ kicker: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
551
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: PHASE_LABELS[step.phase] }),
552
+ step.optional ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "· optional" }) : null,
553
+ step.kind === "human" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
554
+ className: "text-why",
555
+ children: "· human review"
556
+ }) : null,
557
+ step.badges.includes("openspec") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "· OpenSpec" }) : null
558
+ ] }),
559
+ children: step.skill || step.sessionBreakBefore ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
560
+ className: "m-0 flex flex-wrap items-center gap-2 text-sm text-muted",
561
+ children: [step.skill ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
562
+ className: "font-mono text-text",
563
+ children: step.skill
564
+ }) : null, step.sessionBreakBefore ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
565
+ className: "workflow-card-session inline-flex items-center gap-1.5 text-accent",
566
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
567
+ className: "size-2 rounded-full border-[1.5px] border-accent",
568
+ "aria-hidden": "true"
569
+ }), "New session / clean chat"]
570
+ }) : null]
571
+ }) : null
572
+ }),
573
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PanelSection, {
574
+ title: step.kind === "human" ? "How it runs" : "Run",
575
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StageRun, { step }), step.missingSkill ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
576
+ className: "workflow-missing-skill m-0 text-sm text-warn",
577
+ role: "note",
578
+ children: [
579
+ "Skill not reported for this companion:",
580
+ " ",
581
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
582
+ className: "font-mono",
583
+ children: step.missingSkill
584
+ }),
585
+ ". Run",
586
+ " ",
587
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
588
+ className: "font-mono",
589
+ children: "mate companion update"
590
+ }),
591
+ "; this stage is not complete."
592
+ ]
593
+ }) : null]
594
+ }),
595
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelSection, {
596
+ title: "What",
597
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
598
+ className: "m-0 text-sm leading-relaxed",
599
+ children: step.what
600
+ })
601
+ }),
602
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelSection, {
603
+ title: "Why",
604
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
605
+ className: "m-0 text-sm leading-relaxed",
606
+ children: step.why
607
+ })
608
+ }),
609
+ changes.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelSection, {
610
+ title: "Changes at this stage",
611
+ aside: String(changes.length),
612
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
613
+ className: "m-0 grid list-none gap-1 p-0",
614
+ children: changes.map((name) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", {
615
+ className: "truncate font-mono text-sm",
616
+ children: name
617
+ }, name))
618
+ })
619
+ }) : null
620
+ ]
621
+ });
622
+ }
623
+ /** How a stage runs: a person's review, a choice of prompts, or its one prompt. */
624
+ function StageRun({ step }) {
625
+ if (step.kind === "human") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
626
+ className: "workflow-card-human m-0 text-sm",
627
+ children: [
628
+ "Review ",
629
+ step.artifact,
630
+ " yourself — no skill, no prompt"
631
+ ]
632
+ });
633
+ if (step.alternatives?.length) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
634
+ className: "workflow-option-list grid gap-3",
635
+ children: step.alternatives.map((alternative) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
636
+ className: "workflow-option grid gap-1.5",
637
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CommandLine, {
638
+ text: alternative.prompt,
639
+ copy: alternative.copyPrompt,
640
+ label: `${alternative.name} prompt`
641
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
642
+ className: "text-xs text-muted",
643
+ children: alternative.description
644
+ })]
645
+ }, alternative.name))
646
+ });
647
+ if (!step.prompt) return null;
648
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CommandLine, {
649
+ text: step.prompt,
650
+ copy: step.copyPrompt ?? step.prompt,
651
+ label: `${step.label} prompt`
652
+ });
653
+ }
654
+ export { WorkflowGraphView as n, DeliveryPathView as t };
@@ -53,6 +53,7 @@ var getFactory = createServerFn({ method: "GET" }).validator((input) => {
53
53
  payload: payload ? {
54
54
  worksets: payload.worksets,
55
55
  linkedRepositories: payload.linkedRepositories,
56
+ ticketFormat: payload.ticketFormat,
56
57
  topology: payload.topology,
57
58
  worksetProblems: payload.worksetProblems,
58
59
  warnings: payload.warnings