@stigmer/react 3.1.2 → 3.1.4

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 (285) hide show
  1. package/composer/SessionComposer.d.ts +37 -5
  2. package/composer/SessionComposer.d.ts.map +1 -1
  3. package/composer/SessionComposer.js +13 -5
  4. package/composer/SessionComposer.js.map +1 -1
  5. package/execution/ArtifactApplyButton.d.ts +25 -0
  6. package/execution/ArtifactApplyButton.d.ts.map +1 -0
  7. package/execution/ArtifactApplyButton.js +21 -0
  8. package/execution/ArtifactApplyButton.js.map +1 -0
  9. package/execution/ArtifactContentBody.d.ts +36 -0
  10. package/execution/ArtifactContentBody.d.ts.map +1 -0
  11. package/execution/ArtifactContentBody.js +62 -0
  12. package/execution/ArtifactContentBody.js.map +1 -0
  13. package/execution/ArtifactDocument.d.ts +48 -0
  14. package/execution/ArtifactDocument.d.ts.map +1 -0
  15. package/execution/ArtifactDocument.js +89 -0
  16. package/execution/ArtifactDocument.js.map +1 -0
  17. package/execution/ArtifactPreviewModal.d.ts +9 -9
  18. package/execution/ArtifactPreviewModal.d.ts.map +1 -1
  19. package/execution/ArtifactPreviewModal.js +18 -145
  20. package/execution/ArtifactPreviewModal.js.map +1 -1
  21. package/execution/ArtifactRow.d.ts +49 -0
  22. package/execution/ArtifactRow.d.ts.map +1 -0
  23. package/execution/ArtifactRow.js +56 -0
  24. package/execution/ArtifactRow.js.map +1 -0
  25. package/execution/ArtifactsWidget.d.ts +6 -9
  26. package/execution/ArtifactsWidget.d.ts.map +1 -1
  27. package/execution/ArtifactsWidget.js +15 -19
  28. package/execution/ArtifactsWidget.js.map +1 -1
  29. package/execution/FileChangeProgressBar.d.ts +47 -0
  30. package/execution/FileChangeProgressBar.d.ts.map +1 -0
  31. package/execution/FileChangeProgressBar.js +49 -0
  32. package/execution/FileChangeProgressBar.js.map +1 -0
  33. package/execution/FileChangesView.d.ts.map +1 -1
  34. package/execution/FileChangesView.js +19 -4
  35. package/execution/FileChangesView.js.map +1 -1
  36. package/execution/FileReviewAtoms.d.ts +27 -0
  37. package/execution/FileReviewAtoms.d.ts.map +1 -0
  38. package/execution/FileReviewAtoms.js +64 -0
  39. package/execution/FileReviewAtoms.js.map +1 -0
  40. package/execution/FileReviewCard.d.ts +2 -2
  41. package/execution/FileReviewCard.d.ts.map +1 -1
  42. package/execution/FileReviewCard.js +32 -62
  43. package/execution/FileReviewCard.js.map +1 -1
  44. package/execution/MessageEntry.d.ts +0 -9
  45. package/execution/MessageEntry.d.ts.map +1 -1
  46. package/execution/MessageEntry.js +1 -11
  47. package/execution/MessageEntry.js.map +1 -1
  48. package/execution/MessageThread.d.ts +3 -4
  49. package/execution/MessageThread.d.ts.map +1 -1
  50. package/execution/MessageThread.js +25 -11
  51. package/execution/MessageThread.js.map +1 -1
  52. package/execution/PlanArtifactCard.d.ts +16 -10
  53. package/execution/PlanArtifactCard.d.ts.map +1 -1
  54. package/execution/PlanArtifactCard.js +31 -7
  55. package/execution/PlanArtifactCard.js.map +1 -1
  56. package/execution/PlanCompletionCard.d.ts +4 -4
  57. package/execution/PlanCompletionCard.d.ts.map +1 -1
  58. package/execution/PlanCompletionCard.js +4 -4
  59. package/execution/PlanCompletionCard.js.map +1 -1
  60. package/execution/PlanStreamingCard.d.ts +7 -2
  61. package/execution/PlanStreamingCard.d.ts.map +1 -1
  62. package/execution/PlanStreamingCard.js +11 -6
  63. package/execution/PlanStreamingCard.js.map +1 -1
  64. package/execution/index.d.ts +12 -2
  65. package/execution/index.d.ts.map +1 -1
  66. package/execution/index.js +6 -1
  67. package/execution/index.js.map +1 -1
  68. package/execution/use-build-from-plan-hotkey.d.ts +1 -1
  69. package/execution/use-build-from-plan-hotkey.js +1 -1
  70. package/execution/useArtifactContent.d.ts +6 -1
  71. package/execution/useArtifactContent.d.ts.map +1 -1
  72. package/execution/useArtifactContent.js +7 -2
  73. package/execution/useArtifactContent.js.map +1 -1
  74. package/execution/useArtifactCopy.d.ts +51 -0
  75. package/execution/useArtifactCopy.d.ts.map +1 -0
  76. package/execution/useArtifactCopy.js +75 -0
  77. package/execution/useArtifactCopy.js.map +1 -0
  78. package/execution/useArtifactDownload.d.ts.map +1 -1
  79. package/execution/useArtifactDownload.js +17 -5
  80. package/execution/useArtifactDownload.js.map +1 -1
  81. package/execution/useArtifactInspection.d.ts +85 -0
  82. package/execution/useArtifactInspection.d.ts.map +1 -0
  83. package/execution/useArtifactInspection.js +143 -0
  84. package/execution/useArtifactInspection.js.map +1 -0
  85. package/execution/useCreateAgentExecution.d.ts +16 -3
  86. package/execution/useCreateAgentExecution.d.ts.map +1 -1
  87. package/execution/useCreateAgentExecution.js +1 -0
  88. package/execution/useCreateAgentExecution.js.map +1 -1
  89. package/index.d.ts +4 -4
  90. package/index.d.ts.map +1 -1
  91. package/index.js +3 -3
  92. package/index.js.map +1 -1
  93. package/internal/MermaidDiagram.d.ts +47 -0
  94. package/internal/MermaidDiagram.d.ts.map +1 -0
  95. package/internal/MermaidDiagram.js +118 -0
  96. package/internal/MermaidDiagram.js.map +1 -0
  97. package/internal/file-tree/FileTreeNode.d.ts.map +1 -1
  98. package/internal/file-tree/FileTreeNode.js +2 -2
  99. package/internal/file-tree/FileTreeNode.js.map +1 -1
  100. package/internal/markdown-components.d.ts.map +1 -1
  101. package/internal/markdown-components.js +34 -0
  102. package/internal/markdown-components.js.map +1 -1
  103. package/internal/mermaid-loader.d.ts +26 -0
  104. package/internal/mermaid-loader.d.ts.map +1 -0
  105. package/internal/mermaid-loader.js +34 -0
  106. package/internal/mermaid-loader.js.map +1 -0
  107. package/internal/mermaid-theme-css.d.ts +41 -0
  108. package/internal/mermaid-theme-css.d.ts.map +1 -0
  109. package/internal/mermaid-theme-css.js +179 -0
  110. package/internal/mermaid-theme-css.js.map +1 -0
  111. package/internal/slug.d.ts +9 -5
  112. package/internal/slug.d.ts.map +1 -1
  113. package/internal/slug.js +10 -6
  114. package/internal/slug.js.map +1 -1
  115. package/library/detect-plan-artifact.d.ts +27 -9
  116. package/library/detect-plan-artifact.d.ts.map +1 -1
  117. package/library/detect-plan-artifact.js +26 -6
  118. package/library/detect-plan-artifact.js.map +1 -1
  119. package/library/index.d.ts +1 -1
  120. package/library/index.d.ts.map +1 -1
  121. package/library/index.js +1 -1
  122. package/library/index.js.map +1 -1
  123. package/package.json +5 -4
  124. package/session/PlanEditor.js +1 -1
  125. package/session/PlanEditor.js.map +1 -1
  126. package/session/SessionViewer.d.ts.map +1 -1
  127. package/session/SessionViewer.js +122 -30
  128. package/session/SessionViewer.js.map +1 -1
  129. package/session/artifact-document.d.ts +13 -0
  130. package/session/artifact-document.d.ts.map +1 -0
  131. package/session/artifact-document.js +22 -0
  132. package/session/artifact-document.js.map +1 -0
  133. package/session/facets/ArtifactsTab.d.ts +30 -4
  134. package/session/facets/ArtifactsTab.d.ts.map +1 -1
  135. package/session/facets/ArtifactsTab.js +32 -10
  136. package/session/facets/ArtifactsTab.js.map +1 -1
  137. package/session/index.d.ts +2 -1
  138. package/session/index.d.ts.map +1 -1
  139. package/session/index.js +4 -1
  140. package/session/index.js.map +1 -1
  141. package/session/plan-document.d.ts +14 -2
  142. package/session/plan-document.d.ts.map +1 -1
  143. package/session/plan-document.js +14 -3
  144. package/session/plan-document.js.map +1 -1
  145. package/session/usePlanDraft.d.ts +1 -1
  146. package/session/useSessionArtifacts.d.ts +17 -0
  147. package/session/useSessionArtifacts.d.ts.map +1 -1
  148. package/session/useSessionArtifacts.js +16 -5
  149. package/session/useSessionArtifacts.js.map +1 -1
  150. package/session/useSessionConversation.d.ts +26 -3
  151. package/session/useSessionConversation.d.ts.map +1 -1
  152. package/session/useSessionConversation.js +51 -6
  153. package/session/useSessionConversation.js.map +1 -1
  154. package/session/useSessionPageFlow.d.ts.map +1 -1
  155. package/session/useSessionPageFlow.js +1 -0
  156. package/session/useSessionPageFlow.js.map +1 -1
  157. package/session/useSessionPanel.d.ts +20 -0
  158. package/session/useSessionPanel.d.ts.map +1 -1
  159. package/session/useSessionPanel.js +13 -0
  160. package/session/useSessionPanel.js.map +1 -1
  161. package/session/useSessionRailViews.d.ts +13 -1
  162. package/session/useSessionRailViews.d.ts.map +1 -1
  163. package/session/useSessionRailViews.js +5 -3
  164. package/session/useSessionRailViews.js.map +1 -1
  165. package/src/composer/SessionComposer.tsx +76 -7
  166. package/src/composer/__tests__/SessionComposer-editing.test.tsx +128 -0
  167. package/src/execution/ArtifactApplyButton.tsx +79 -0
  168. package/src/execution/ArtifactContentBody.tsx +255 -0
  169. package/src/execution/ArtifactDocument.tsx +344 -0
  170. package/src/execution/ArtifactPreviewModal.tsx +49 -415
  171. package/src/execution/ArtifactRow.tsx +165 -0
  172. package/src/execution/ArtifactsWidget.tsx +24 -33
  173. package/src/execution/FileChangeProgressBar.tsx +121 -0
  174. package/src/execution/FileChangesView.tsx +18 -4
  175. package/src/execution/FileReviewAtoms.tsx +89 -0
  176. package/src/execution/FileReviewCard.tsx +57 -90
  177. package/src/execution/MessageEntry.tsx +0 -62
  178. package/src/execution/MessageThread.tsx +29 -15
  179. package/src/execution/PlanArtifactCard.tsx +130 -52
  180. package/src/execution/PlanCompletionCard.tsx +5 -5
  181. package/src/execution/PlanStreamingCard.tsx +15 -11
  182. package/src/execution/__tests__/ArtifactContentBody.test.tsx +131 -0
  183. package/src/execution/__tests__/ArtifactDocument.test.tsx +100 -0
  184. package/src/execution/__tests__/ArtifactPreviewModal.test.tsx +6 -6
  185. package/src/execution/__tests__/ArtifactRow.test.tsx +139 -0
  186. package/src/execution/__tests__/ArtifactsWidget.test.tsx +78 -0
  187. package/src/execution/__tests__/FileChangeProgressBar.test.tsx +125 -0
  188. package/src/execution/__tests__/FileReviewCard.test.tsx +66 -7
  189. package/src/execution/__tests__/MessageThread.test.tsx +1 -1
  190. package/src/execution/__tests__/PlanArtifactCard.test.tsx +52 -18
  191. package/src/execution/__tests__/PlanCompletionCard.test.tsx +2 -2
  192. package/src/execution/__tests__/PlanStreamingCard.test.tsx +11 -4
  193. package/src/execution/__tests__/buildThreadItems-plan-completion.test.ts +104 -8
  194. package/src/execution/__tests__/message-entry.test.tsx +56 -39
  195. package/src/execution/__tests__/useArtifactCopy.test.tsx +90 -0
  196. package/src/execution/__tests__/useArtifactDownload.test.tsx +2 -0
  197. package/src/execution/__tests__/useArtifactInspection.test.tsx +151 -0
  198. package/src/execution/__tests__/useCreateAgentExecution.test.tsx +35 -0
  199. package/src/execution/index.ts +20 -2
  200. package/src/execution/use-build-from-plan-hotkey.ts +1 -1
  201. package/src/execution/useArtifactContent.ts +7 -0
  202. package/src/execution/useArtifactCopy.ts +109 -0
  203. package/src/execution/useArtifactDownload.ts +17 -5
  204. package/src/execution/useArtifactInspection.ts +252 -0
  205. package/src/execution/useCreateAgentExecution.ts +17 -3
  206. package/src/index.ts +17 -2
  207. package/src/internal/MermaidDiagram.tsx +164 -0
  208. package/src/internal/__tests__/a11y/mermaid-theme.a11y.test.tsx +122 -0
  209. package/src/internal/__tests__/markdown-components.test.tsx +93 -1
  210. package/src/internal/__tests__/mermaid-diagram.test.tsx +282 -0
  211. package/src/internal/file-tree/FileTreeNode.tsx +13 -2
  212. package/src/internal/markdown-components.tsx +36 -1
  213. package/src/internal/mermaid-loader.ts +44 -0
  214. package/src/internal/mermaid-theme-css.ts +178 -0
  215. package/src/internal/slug.ts +10 -6
  216. package/src/library/__tests__/detect-plan-artifact.test.ts +21 -0
  217. package/src/library/detect-plan-artifact.ts +32 -10
  218. package/src/library/index.ts +2 -0
  219. package/src/session/PlanEditor.tsx +1 -1
  220. package/src/session/SessionViewer.tsx +227 -51
  221. package/src/session/__tests__/PlanEditor.test.tsx +4 -4
  222. package/src/session/__tests__/PlanStreamingDocument.test.tsx +1 -1
  223. package/src/session/__tests__/SessionViewer-artifactTabs.test.tsx +210 -0
  224. package/src/session/__tests__/SessionViewer-editResubmit.test.tsx +233 -0
  225. package/src/session/__tests__/SessionViewer-fileReviewDock.test.tsx +57 -0
  226. package/src/session/__tests__/useSessionArtifacts.test.ts +57 -0
  227. package/src/session/__tests__/useSessionConversation.test.tsx +216 -1
  228. package/src/session/__tests__/useSessionPanel.test.ts +70 -1
  229. package/src/session/artifact-document.ts +23 -0
  230. package/src/session/facets/ArtifactsTab.tsx +66 -18
  231. package/src/session/facets/__tests__/ArtifactsTab.test.tsx +111 -47
  232. package/src/session/index.ts +5 -1
  233. package/src/session/plan-document.ts +14 -3
  234. package/src/session/usePlanDraft.ts +1 -1
  235. package/src/session/useSessionArtifacts.ts +16 -5
  236. package/src/session/useSessionConversation.ts +80 -10
  237. package/src/session/useSessionPageFlow.ts +1 -0
  238. package/src/session/useSessionPanel.ts +41 -0
  239. package/src/session/useSessionRailViews.tsx +21 -1
  240. package/src/workspace/EditorTabs.tsx +38 -9
  241. package/src/workspace/ExplorerTree.tsx +10 -4
  242. package/src/workspace/FileViewer.tsx +27 -6
  243. package/src/workspace/WorkspaceContentSearch.tsx +44 -20
  244. package/src/workspace/WorkspaceEditor.tsx +19 -16
  245. package/src/workspace/WorkspaceFileSearch.tsx +51 -28
  246. package/src/workspace/WorkspaceSurface.tsx +106 -48
  247. package/src/workspace/__tests__/EditorTabs.test.tsx +4 -2
  248. package/src/workspace/__tests__/ExplorerTree.test.tsx +52 -0
  249. package/src/workspace/__tests__/FileViewer.test.tsx +18 -0
  250. package/src/workspace/__tests__/WorkspaceContentSearch.test.tsx +38 -5
  251. package/src/workspace/__tests__/WorkspaceEditor-initialPanel.test.tsx +19 -0
  252. package/src/workspace/__tests__/WorkspaceFileSearch.test.tsx +27 -6
  253. package/src/workspace/__tests__/WorkspaceSurface.test.tsx +70 -0
  254. package/src/workspace/__tests__/a11y/harness.tsx +140 -0
  255. package/src/workspace/__tests__/a11y/mock-capabilities.ts +138 -0
  256. package/src/workspace/__tests__/a11y/workspace-editor.a11y.test.tsx +65 -0
  257. package/src/workspace/__tests__/a11y/workspace-explorer-search.a11y.test.tsx +112 -0
  258. package/src/workspace/__tests__/a11y/workspace-viewer-tabs.a11y.test.tsx +69 -0
  259. package/styles.css +1 -1
  260. package/workspace/EditorTabs.d.ts +21 -3
  261. package/workspace/EditorTabs.d.ts.map +1 -1
  262. package/workspace/EditorTabs.js +18 -6
  263. package/workspace/EditorTabs.js.map +1 -1
  264. package/workspace/ExplorerTree.js +8 -4
  265. package/workspace/ExplorerTree.js.map +1 -1
  266. package/workspace/FileViewer.d.ts.map +1 -1
  267. package/workspace/FileViewer.js +19 -8
  268. package/workspace/FileViewer.js.map +1 -1
  269. package/workspace/WorkspaceContentSearch.d.ts.map +1 -1
  270. package/workspace/WorkspaceContentSearch.js +23 -2
  271. package/workspace/WorkspaceContentSearch.js.map +1 -1
  272. package/workspace/WorkspaceEditor.d.ts.map +1 -1
  273. package/workspace/WorkspaceEditor.js +8 -10
  274. package/workspace/WorkspaceEditor.js.map +1 -1
  275. package/workspace/WorkspaceFileSearch.d.ts.map +1 -1
  276. package/workspace/WorkspaceFileSearch.js +23 -3
  277. package/workspace/WorkspaceFileSearch.js.map +1 -1
  278. package/workspace/WorkspaceSurface.d.ts.map +1 -1
  279. package/workspace/WorkspaceSurface.js +54 -18
  280. package/workspace/WorkspaceSurface.js.map +1 -1
  281. package/execution/ArtifactCard.d.ts +0 -81
  282. package/execution/ArtifactCard.d.ts.map +0 -1
  283. package/execution/ArtifactCard.js +0 -130
  284. package/execution/ArtifactCard.js.map +0 -1
  285. package/src/execution/ArtifactCard.tsx +0 -320
@@ -1,24 +1,42 @@
1
1
  import type { AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
2
2
  import type { ExecutionArtifact } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/artifact_pb";
3
3
  /**
4
- * The session's current plan: the published `plan.md` artifact of the most
5
- * recent execution that produced one, plus the execution it belongs to
6
- * (artifact content RPCs are execution-scoped).
4
+ * The session's current plan: the published plan artifact (a `*.plan.md` FILE)
5
+ * of the most recent execution that produced one, plus the execution it belongs
6
+ * to (artifact content RPCs are execution-scoped).
7
7
  */
8
8
  export interface SessionPlan {
9
9
  /** ID of the execution that published the plan. */
10
10
  readonly executionId: string;
11
- /** The published `plan.md` artifact. */
11
+ /** The published plan artifact (`*.plan.md`). */
12
12
  readonly artifact: ExecutionArtifact;
13
13
  }
14
14
  /**
15
- * Canonical filename a Plan-mode execution publishes its plan under. Kept in
16
- * sync with the runner's `publishPlanArtifact` (shared/plan-artifact.ts).
15
+ * Legacy plan filename. Detection-only: {@link isPlanArtifactName} still
16
+ * accepts this exact name so plans published before named artifacts existed
17
+ * keep working. The runner never freshly emits it (a titleless plan falls back
18
+ * to a bare `<id>.plan.md`). Kept in sync with the runner's
19
+ * `PLAN_ARTIFACT_NAME` (shared/plan-artifact.ts).
17
20
  */
18
21
  export declare const PLAN_ARTIFACT_NAME = "plan.md";
19
22
  /**
20
- * Returns `true` when an artifact is the published plan: a FILE artifact named
21
- * `plan.md`.
23
+ * Suffix every named plan artifact carries (`<slug>_<id>.plan.md`, or a bare
24
+ * `<id>.plan.md` when untitled). The runner derives the slug from the plan's
25
+ * title and the `<id>` from its content hash; detection keys on this suffix.
26
+ * Kept in sync with the runner's `PLAN_ARTIFACT_SUFFIX` (shared/plan-artifact.ts)
27
+ * — the runner and browser SDK have disjoint module graphs, so the constant is
28
+ * duplicated by design, mirroring {@link PLAN_ARTIFACT_NAME}.
29
+ */
30
+ export declare const PLAN_ARTIFACT_SUFFIX = ".plan.md";
31
+ /**
32
+ * Returns `true` when a filename is a plan's: the legacy exact `plan.md`, or
33
+ * any `*.plan.md`. Accepting the legacy name keeps plans published before named
34
+ * artifacts existed detectable.
35
+ */
36
+ export declare function isPlanArtifactName(name: string): boolean;
37
+ /**
38
+ * Returns `true` when an artifact is the published plan: a FILE artifact whose
39
+ * name satisfies {@link isPlanArtifactName}.
22
40
  *
23
41
  * Detection is by convention — the same lightweight, content-free approach used
24
42
  * for skill packages ({@link isSkillPackage}) — so the UI never needs an extra
@@ -36,7 +54,7 @@ export declare function isPlanArtifact(artifact: ExecutionArtifact): boolean;
36
54
  export declare function findPlanArtifact(execution: AgentExecution | null | undefined): ExecutionArtifact | undefined;
37
55
  /**
38
56
  * Finds the session's LATEST plan across all executions — the plan the panel's
39
- * plan document tab edits and "Build from plan" implements. Executions are
57
+ * plan document tab edits and the "Build" action implements. Executions are
40
58
  * scanned newest-first (the array is chronological), mirroring the thread's
41
59
  * latest-plan-owns-the-build-action rule so every surface agrees on which
42
60
  * plan is current.
@@ -1 +1 @@
1
- {"version":3,"file":"detect-plan-artifact.d.ts","sourceRoot":"","sources":["../../src/library/detect-plan-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kEAAkE,CAAC;AAG1G;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;CACtC;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAKnE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,GAC3C,iBAAiB,GAAG,SAAS,CAO/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,SAAS,cAAc,EAAE,GACpC,WAAW,GAAG,SAAS,CAUzB"}
1
+ {"version":3,"file":"detect-plan-artifact.d.ts","sourceRoot":"","sources":["../../src/library/detect-plan-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kEAAkE,CAAC;AAG1G;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;CACtC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAKnE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,GAC3C,iBAAiB,GAAG,SAAS,CAO/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,SAAS,cAAc,EAAE,GACpC,WAAW,GAAG,SAAS,CAUzB"}
@@ -1,12 +1,32 @@
1
1
  import { ExecutionArtifactKind } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
2
2
  /**
3
- * Canonical filename a Plan-mode execution publishes its plan under. Kept in
4
- * sync with the runner's `publishPlanArtifact` (shared/plan-artifact.ts).
3
+ * Legacy plan filename. Detection-only: {@link isPlanArtifactName} still
4
+ * accepts this exact name so plans published before named artifacts existed
5
+ * keep working. The runner never freshly emits it (a titleless plan falls back
6
+ * to a bare `<id>.plan.md`). Kept in sync with the runner's
7
+ * `PLAN_ARTIFACT_NAME` (shared/plan-artifact.ts).
5
8
  */
6
9
  export const PLAN_ARTIFACT_NAME = "plan.md";
7
10
  /**
8
- * Returns `true` when an artifact is the published plan: a FILE artifact named
9
- * `plan.md`.
11
+ * Suffix every named plan artifact carries (`<slug>_<id>.plan.md`, or a bare
12
+ * `<id>.plan.md` when untitled). The runner derives the slug from the plan's
13
+ * title and the `<id>` from its content hash; detection keys on this suffix.
14
+ * Kept in sync with the runner's `PLAN_ARTIFACT_SUFFIX` (shared/plan-artifact.ts)
15
+ * — the runner and browser SDK have disjoint module graphs, so the constant is
16
+ * duplicated by design, mirroring {@link PLAN_ARTIFACT_NAME}.
17
+ */
18
+ export const PLAN_ARTIFACT_SUFFIX = ".plan.md";
19
+ /**
20
+ * Returns `true` when a filename is a plan's: the legacy exact `plan.md`, or
21
+ * any `*.plan.md`. Accepting the legacy name keeps plans published before named
22
+ * artifacts existed detectable.
23
+ */
24
+ export function isPlanArtifactName(name) {
25
+ return name === PLAN_ARTIFACT_NAME || name.endsWith(PLAN_ARTIFACT_SUFFIX);
26
+ }
27
+ /**
28
+ * Returns `true` when an artifact is the published plan: a FILE artifact whose
29
+ * name satisfies {@link isPlanArtifactName}.
10
30
  *
11
31
  * Detection is by convention — the same lightweight, content-free approach used
12
32
  * for skill packages ({@link isSkillPackage}) — so the UI never needs an extra
@@ -15,7 +35,7 @@ export const PLAN_ARTIFACT_NAME = "plan.md";
15
35
  */
16
36
  export function isPlanArtifact(artifact) {
17
37
  return (artifact.kind === ExecutionArtifactKind.FILE &&
18
- artifact.name === PLAN_ARTIFACT_NAME);
38
+ isPlanArtifactName(artifact.name));
19
39
  }
20
40
  /**
21
41
  * Finds the plan artifact on a completed execution, or `undefined` when none
@@ -36,7 +56,7 @@ export function findPlanArtifact(execution) {
36
56
  }
37
57
  /**
38
58
  * Finds the session's LATEST plan across all executions — the plan the panel's
39
- * plan document tab edits and "Build from plan" implements. Executions are
59
+ * plan document tab edits and the "Build" action implements. Executions are
40
60
  * scanned newest-first (the array is chronological), mirroring the thread's
41
61
  * latest-plan-owns-the-build-action rule so every surface agrees on which
42
62
  * plan is current.
@@ -1 +1 @@
1
- {"version":3,"file":"detect-plan-artifact.js","sourceRoot":"","sources":["../../src/library/detect-plan-artifact.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8DAA8D,C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E,CAAC;QAChD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC7C,MAAM,WAAW,GAAG,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC3C,IAAI,QAAQ,IAAI,WAAW,EAAE,CAAC;YAC5B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;QACnC,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -8,7 +8,7 @@ export type { StigmerResourceKind, StigmerResourceDetection, } from "./detect-st
8
8
  export { useDetectStigmerResource } from "./useDetectStigmerResource.js";
9
9
  export { isSkillPackage, detectSkillPackage, } from "./detect-skill-package.js";
10
10
  export type { SkillPackageDetection } from "./detect-skill-package.js";
11
- export { isPlanArtifact, findPlanArtifact, findLatestSessionPlan, PLAN_ARTIFACT_NAME, } from "./detect-plan-artifact.js";
11
+ export { isPlanArtifact, isPlanArtifactName, findPlanArtifact, findLatestSessionPlan, PLAN_ARTIFACT_NAME, PLAN_ARTIFACT_SUFFIX, } from "./detect-plan-artifact.js";
12
12
  export type { SessionPlan } from "./detect-plan-artifact.js";
13
13
  export { findStreamingPlan } from "./detect-streaming-plan.js";
14
14
  export type { StreamingPlan } from "./detect-streaming-plan.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/library/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,EAA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wB,CAAC;AAEhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAE3E,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC9E,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,eAAe,EACf,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,gCAAgC,EAChC,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,YAAY,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EACV,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,YAAY,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC"}
package/library/index.js CHANGED
@@ -4,7 +4,7 @@ export { ResourceCountCard } from "./ResourceCountCard.js";
4
4
  export { detectStigmerResource } from "./detect-stigmer-resource.js";
5
5
  export { useDetectStigmerResource } from "./useDetectStigmerResource.js";
6
6
  export { isSkillPackage, detectSkillPackage, } from "./detect-skill-package.js";
7
- export { isPlanArtifact, findPlanArtifact, findLatestSessionPlan, PLAN_ARTIFACT_NAME, } from "./detect-plan-artifact.js";
7
+ export { isPlanArtifact, isPlanArtifactName, findPlanArtifact, findLatestSessionPlan, PLAN_ARTIFACT_NAME, PLAN_ARTIFACT_SUFFIX, } from "./detect-plan-artifact.js";
8
8
  export { findStreamingPlan } from "./detect-streaming-plan.js";
9
9
  export { useDetectSkillPackage } from "./useDetectSkillPackage.js";
10
10
  export { parseResourceYaml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O,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG9E,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,eAAe,EACf,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAM/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigmer/react",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "description": "React provider and client hook for the Stigmer platform SDK",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@bufbuild/protovalidate": "^1.1.1",
39
39
  "@dagrejs/dagre": "^1.1.4",
40
- "@stigmer/theme": "3.1.2",
40
+ "@stigmer/theme": "3.1.4",
41
41
  "diff": "^8.0.3",
42
42
  "fflate": "^0.8.2",
43
43
  "hast-util-to-jsx-runtime": "^2.3.6",
@@ -60,12 +60,13 @@
60
60
  "@codemirror/state": "^6.0.0",
61
61
  "@codemirror/view": "^6.0.0",
62
62
  "@lezer/highlight": "^1.0.0",
63
- "@stigmer/protos": "3.1.2",
64
- "@stigmer/sdk": "3.1.2",
63
+ "@stigmer/protos": "3.1.4",
64
+ "@stigmer/sdk": "3.1.4",
65
65
  "@tanstack/react-table": "^8.20.0",
66
66
  "@xyflow/react": "^12.0.0",
67
67
  "elkjs": "^0.9.0",
68
68
  "lucide-react": ">=0.400.0",
69
+ "mermaid": "^11.0.0",
69
70
  "react": "^19.0.0",
70
71
  "react-dom": "^19.0.0",
71
72
  "react-virtuoso": "^4.0.0",
@@ -56,7 +56,7 @@ export function PlanEditor({ plan, draft, onBuildFromPlan, buildDisabled, readOn
56
56
  }
57
57
  return (_jsxs(PlanEditorFrame, { onKeyDown: handleKeyDown, children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [_jsxs("div", { className: "inline-flex shrink-0 rounded-md bg-muted p-0.5", role: "tablist", "aria-label": "Plan view", children: [_jsx(ViewTab, { active: activeView === "rendered", onClick: () => setView("rendered"), label: "Rendered" }), _jsx(ViewTab, { active: activeView === "source", onClick: () => setView("source"), label: "Source" }), activeDraft !== undefined && (_jsx(ViewTab, { active: activeView === "edit", onClick: () => setView("edit"), label: "Edit", disabled: !canEdit, title: !canEdit
58
58
  ? "This plan is too large to edit in place — download it instead."
59
- : undefined }))] }), _jsx("span", { className: "text-[0.65rem] tabular-nums text-muted-foreground-faint", children: formatArtifactSize(plan.artifact.sizeBytes) }), _jsxs("div", { className: "ml-auto flex min-w-0 flex-wrap items-center gap-3", children: [activeDraft?.isEdited && (_jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx("span", { className: "rounded-md bg-accent px-1.5 py-0.5 text-[0.65rem] font-medium text-muted-foreground", children: "Edited" }), _jsx("button", { type: "button", onClick: () => activeDraft.setDraft(null), className: "rounded text-[0.65rem] font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: "Revert" })] })), readOnly ? (_jsx("span", { role: "status", className: "rounded-md bg-muted px-2 py-0.5 text-[0.65rem] font-medium text-muted-foreground", children: "Superseded by a newer plan" })) : (onBuildFromPlan && (_jsxs("button", { type: "button", disabled: buildDisabled, onClick: onBuildFromPlan, className: cn("inline-flex min-w-0 items-center gap-1.5 rounded-md px-3 py-1.5", "text-xs font-medium transition-colors", "bg-primary text-primary-foreground hover:bg-primary-hover", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "disabled:pointer-events-none disabled:opacity-50"), children: [_jsx(ImplementIcon, {}), _jsx("span", { className: "truncate", children: buildDisabled ? "Starting build…" : "Build from plan" })] })))] })] }), activeView === "rendered" && _jsx(RenderedPlan, { text: effectiveText }), activeView === "source" && (_jsx("pre", { className: "overflow-x-auto rounded-md bg-muted p-3 font-mono text-xs whitespace-pre-wrap text-foreground", children: effectiveText })), activeView === "edit" && activeDraft !== undefined && (_jsx("textarea", { value: effectiveText, onChange: (e) => activeDraft.setDraft(e.target.value), "aria-label": "Edit plan", spellCheck: false, rows: 28, className: cn("w-full flex-1 resize-y rounded-md border border-border bg-card p-3", "font-mono text-xs leading-relaxed text-foreground", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring") })), isTruncated && (_jsx("p", { role: "status", className: "text-[0.65rem] text-muted-foreground", children: "Preview truncated \u2014 download the artifact for the full plan." }))] }));
59
+ : undefined }))] }), _jsx("span", { className: "text-[0.65rem] tabular-nums text-muted-foreground-faint", children: formatArtifactSize(plan.artifact.sizeBytes) }), _jsxs("div", { className: "ml-auto flex min-w-0 flex-wrap items-center gap-3", children: [activeDraft?.isEdited && (_jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx("span", { className: "rounded-md bg-accent px-1.5 py-0.5 text-[0.65rem] font-medium text-muted-foreground", children: "Edited" }), _jsx("button", { type: "button", onClick: () => activeDraft.setDraft(null), className: "rounded text-[0.65rem] font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: "Revert" })] })), readOnly ? (_jsx("span", { role: "status", className: "rounded-md bg-muted px-2 py-0.5 text-[0.65rem] font-medium text-muted-foreground", children: "Superseded by a newer plan" })) : (onBuildFromPlan && (_jsxs("button", { type: "button", disabled: buildDisabled, onClick: onBuildFromPlan, className: cn("inline-flex min-w-0 items-center gap-1.5 rounded-md px-3 py-1.5", "text-xs font-medium transition-colors", "bg-primary text-primary-foreground hover:bg-primary-hover", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "disabled:pointer-events-none disabled:opacity-50"), children: [_jsx(ImplementIcon, {}), _jsx("span", { className: "truncate", children: buildDisabled ? "Starting build…" : "Build" })] })))] })] }), activeView === "rendered" && _jsx(RenderedPlan, { text: effectiveText }), activeView === "source" && (_jsx("pre", { className: "overflow-x-auto rounded-md bg-muted p-3 font-mono text-xs whitespace-pre-wrap text-foreground", children: effectiveText })), activeView === "edit" && activeDraft !== undefined && (_jsx("textarea", { value: effectiveText, onChange: (e) => activeDraft.setDraft(e.target.value), "aria-label": "Edit plan", spellCheck: false, rows: 28, className: cn("w-full flex-1 resize-y rounded-md border border-border bg-card p-3", "font-mono text-xs leading-relaxed text-foreground", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring") })), isTruncated && (_jsx("p", { role: "status", className: "text-[0.65rem] text-muted-foreground", children: "Preview truncated \u2014 download the artifact for the full plan." }))] }));
60
60
  }
61
61
  /**
62
62
  * The editor-area envelope: a centered document column so the plan reads as a
@@ -1 +1 @@
1
- {"version":3,"file":"PlanEditor.js","sourceRoot":"","sources":["../../src/session/PlanEditor.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EACL,iCAAiC,EACjC,cAAc,EACd,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AA4BpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,eAAe,EACf,aAAa,EACb,QAAQ,GACQ;IAChB,MAAM,CAAC,IAAI,EAAE,OAAO,CA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C,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,GAAG,EACH,gBAAgB,EAChB,YAAmB,EACnB,WAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,QAAuB,EACvB,aAAa,EACb,UAAU,EACV,SAAS,EACT,SAAS,GACV,EAAE,kBAAkB,2CA0TpB"}
@@ -13,12 +13,14 @@ import { useWorkspaceEditors, isVirtualEntryId } from "../internal/store/index.j
13
13
  import { ThreadSelectionContext } from "../execution/ThreadSelectionContext.js";
14
14
  import { useSelectedThreadItem } from "../execution/useThreadSelection.js";
15
15
  import { MessageThread } from "../execution/MessageThread.js";
16
+ import { FileChangeProgressBar } from "../execution/FileChangeProgressBar.js";
16
17
  import { FileReviewDock } from "../execution/FileReviewDock.js";
18
+ import { FilePathContext, } from "../execution/FilePathContext.js";
17
19
  import { ThreadSkeleton } from "../execution/ThreadSkeleton.js";
18
20
  import { SessionComposer } from "../composer/index.js";
19
21
  import { SecretFlowErrorGuide, isSecretFlowError } from "../error/index.js";
20
22
  import { useStigmer } from "../hooks.js";
21
- import { PLAN_ARTIFACT_NAME, findLatestSessionPlan, findPlanArtifact, } from "../library/detect-plan-artifact.js";
23
+ import { findLatestSessionPlan, findPlanArtifact, } from "../library/detect-plan-artifact.js";
22
24
  import { findStreamingPlan } from "../library/detect-streaming-plan.js";
23
25
  import { useSessionPageFlow } from "./useSessionPageFlow.js";
24
26
  import { useOpenFileChange } from "./useOpenFileChange.js";
@@ -26,27 +28,33 @@ import { usePlanDraft, planDraftKey } from "./usePlanDraft.js";
26
28
  import { PlanEditor } from "./PlanEditor.js";
27
29
  import { PlanStreamingDocument } from "./PlanStreamingDocument.js";
28
30
  import { PLAN_DOCUMENT_ENTRY_ID, PLAN_DOCUMENT_PATH } from "./plan-document.js";
31
+ import { ARTIFACT_DOCUMENT_ENTRY_ID } from "./artifact-document.js";
32
+ import { ArtifactDocument } from "../execution/ArtifactDocument.js";
29
33
  import { useSessionRailViews } from "./useSessionRailViews.js";
30
34
  import { useSessionPanel } from "./useSessionPanel.js";
31
35
  import { SessionPanelChip } from "./SessionPanelChip.js";
32
36
  import { useSessionWriteBacks } from "./useSessionWriteBacks.js";
33
- import { useSessionArtifacts } from "./useSessionArtifacts.js";
37
+ import { useSessionArtifacts, artifactKey, } from "./useSessionArtifacts.js";
34
38
  import { ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
35
39
  /**
36
40
  * Where the approved plan mounts in the implement execution's workspace —
37
41
  * the harnesses' standard attachment inputs directory, where the runner's
38
42
  * implement-plan directive points the agent (shared/implement-plan-prompt.ts).
39
- * Attaching at this exact path is what makes the build implement the document
40
- * the user approved (including in-place edits), not a paraphrase from memory.
43
+ * Attaching under the plan's own filename (e.g. `feature-x_a1b2c3d4.plan.md`) is what
44
+ * makes the build implement the document the user approved (including in-place
45
+ * edits), not a paraphrase from memory; the runner detects it by the plan
46
+ * filename convention (`isPlanArtifactName`), so the exact name is free to vary.
41
47
  */
42
- const APPROVED_PLAN_MOUNT_PATH = `.stigmer/inputs/${PLAN_ARTIFACT_NAME}`;
48
+ function approvedPlanMountPath(planFileName) {
49
+ return `.stigmer/inputs/${planFileName}`;
50
+ }
43
51
  /**
44
52
  * The build turn's user message — a short human-readable label, NOT the
45
53
  * implement instruction. The agent-facing instruction is runner-injected
46
- * (keyed off `executionConfig.buildFromPlan`), so this text exists for
47
- * humans: the thread renders the turn as a compact chip from the same flag,
48
- * and surfaces without the chip treatment (the CLI, older clients) show
49
- * this label as-is.
54
+ * (keyed off `executionConfig.buildFromPlan`). The thread hides the turn
55
+ * entirely from the same flag (the plan card above it is the visible cause);
56
+ * this label exists for surfaces without that treatment (the CLI, execution
57
+ * history, older clients), which show it as-is.
50
58
  */
51
59
  const BUILD_FROM_PLAN_MESSAGE = "Build from plan";
52
60
  /**
@@ -205,7 +213,7 @@ export function SessionViewer({ sessionId, org, gitHubConnection, enableGitHub =
205
213
  setInteractionMode("agent");
206
214
  setPlanAttachFailed(false);
207
215
  // `buildFromPlan` (not message text) is what tells the runner to inject
208
- // the implement directive and the thread to render the compact chip
216
+ // the implement directive and the thread to hide the turn's message
209
217
  // with or without the attachment (the runner picks the directive variant).
210
218
  const submitImplementTurn = (attachments) => {
211
219
  composerRef.current?.submit(BUILD_FROM_PLAN_MESSAGE, {
@@ -224,19 +232,22 @@ export function SessionViewer({ sessionId, org, gitHubConnection, enableGitHub =
224
232
  // execution. The published artifact itself stays immutable; the approved
225
233
  // copy is a new input on the build turn (edit-as-input provenance).
226
234
  setIsBuildingFromPlan(true);
235
+ // The approved copy keeps the published plan's filename, so the mounted
236
+ // input, the download, and the plan card all agree on one name.
237
+ const planFileName = sessionPlan.artifact.name;
227
238
  void (async () => {
228
239
  try {
229
240
  const approvedText = planDraft.readDraft() ?? (await fetchPlanText(stigmer, sessionPlan));
230
241
  const response = await stigmer.agentExecution.uploadAttachment(create(UploadAttachmentRequestSchema, {
231
- filename: PLAN_ARTIFACT_NAME,
242
+ filename: planFileName,
232
243
  content: new TextEncoder().encode(approvedText),
233
244
  contentType: "text/markdown",
234
245
  }));
235
246
  submitImplementTurn([
236
247
  {
237
- filename: PLAN_ARTIFACT_NAME,
248
+ filename: planFileName,
238
249
  storageKey: response.storageKey,
239
- mountPath: APPROVED_PLAN_MOUNT_PATH,
250
+ mountPath: approvedPlanMountPath(planFileName),
240
251
  contentType: "text/markdown",
241
252
  },
242
253
  ]);
@@ -262,6 +273,20 @@ export function SessionViewer({ sessionId, org, gitHubConnection, enableGitHub =
262
273
  : executionId);
263
274
  panel.openPlanDocument();
264
275
  }, [sessionPlan, panel.openPlanDocument]);
276
+ // "Open artifact" (an Artifacts-facet row) → an editor-pane document tab.
277
+ // Writing the editors store re-renders only the panel subtree (which
278
+ // subscribes), never this streaming column. Plan artifacts are routed to the
279
+ // plan tab upstream (in ArtifactsTab), so they never reach here.
280
+ const handleOpenArtifact = useCallback((entry) => {
281
+ panel.openArtifact(entry.artifact);
282
+ }, [panel.openArtifact]);
283
+ // Double-click an artifact row → pin its tab (the leading single click already
284
+ // opened the preview via `handleOpenArtifact`). Mirrors the file tree's
285
+ // preview/pin split; plan artifacts are routed to the plan tab upstream (in
286
+ // ArtifactsTab) and never reach here.
287
+ const handleActivateArtifact = useCallback((entry) => {
288
+ panel.pinArtifact(entry.artifact);
289
+ }, [panel.pinArtifact]);
265
290
  // Open a transcript tool-call file path in the panel's read-only editor.
266
291
  // Resolves the (possibly absolute / subdir-prefixed) path to a
267
292
  // repo/root-relative selection the editor can fetch; on a definite hit it
@@ -285,7 +310,7 @@ export function SessionViewer({ sessionId, org, gitHubConnection, enableGitHub =
285
310
  if (!conv.session && !conv.isLoading) {
286
311
  return _jsx(SessionStarting, {});
287
312
  }
288
- return (_jsxs("div", { className: cn("relative flex h-full w-full flex-col", className), children: [_jsxs("div", { className: "absolute top-2 right-6 z-10 flex items-center gap-2", children: [headerActions, _jsx(SessionPanelChip, { isOpen: panel.isOpen, onToggle: panel.isOpen ? panel.closePanel : panel.openPanel, badgeCount: writeBackCount + artifactCount })] }), _jsx(ThreadSelectionContext.Provider, { value: selectionStore, children: _jsx(ResizableSplit, { resizablePane: "primary", collapsedPane: panel.isOpen ? "none" : "secondary", defaultSize: 420, minSize: 320, maxSize: 640, storageKey: "stgm-session-chat-width", responsiveCollapse: panel.isOpen ? "primary" : "none", ariaLabel: "Resize chat panel", className: "min-h-0 flex-1", primary: _jsx(ConversationColumn, { flow: flow, modelId: modelId, setModelId: setModelId, interactionMode: interactionMode, setInteractionMode: setInteractionMode, composerRef: composerRef, org: org, gitHubConnection: gitHubConnection, enableGitHub: enableGitHub, enableLocal: enableLocal, onBrowseLocalFolder: onBrowseLocalFolder, onBuildFromPlan: handleBuildFromPlan, onOpenPlan: handleOpenPlan, isBuildingFromPlan: isBuildingFromPlan, planAttachFailed: planAttachFailed, onDismissPlanAttachFailed: () => setPlanAttachFailed(false), onFilePathClick: handleTranscriptFilePathClick, isEndUser: isEndUser }), secondary: panel.isOpen ? (_jsx(SessionPanelRegion, { flow: flow, org: org, panel: panel, accessSlot: accessSlot, onApplied: onApplied, onImplementPlan: handleBuildFromPlan, implementPlanDisabled: !conv.canSendFollowUp || isBuildingFromPlan, sessionPlan: sessionPlan, streamingPlan: streamingPlan, planDraft: planDraft, openPlanExecutionId: openPlanExecutionId, onOpenPlan: handleOpenPlan, enableLocal: enableLocal, onBrowseLocalFolder: onBrowseLocalFolder, workspaceFileLister: workspaceFileLister, workspaceFileReader: workspaceFileReader, workspaceContentSearcher: workspaceContentSearcher, isEndUser: isEndUser })) : null }) })] }));
313
+ return (_jsxs("div", { className: cn("relative flex h-full w-full flex-col", className), children: [_jsxs("div", { className: "absolute top-2 right-6 z-10 flex items-center gap-2", children: [headerActions, _jsx(SessionPanelChip, { isOpen: panel.isOpen, onToggle: panel.isOpen ? panel.closePanel : panel.openPanel, badgeCount: writeBackCount + artifactCount })] }), _jsx(ThreadSelectionContext.Provider, { value: selectionStore, children: _jsx(ResizableSplit, { resizablePane: "primary", collapsedPane: panel.isOpen ? "none" : "secondary", defaultSize: 420, minSize: 320, maxSize: 640, storageKey: "stgm-session-chat-width", responsiveCollapse: panel.isOpen ? "primary" : "none", ariaLabel: "Resize chat panel", className: "min-h-0 flex-1", primary: _jsx(ConversationColumn, { flow: flow, modelId: modelId, setModelId: setModelId, interactionMode: interactionMode, setInteractionMode: setInteractionMode, composerRef: composerRef, org: org, gitHubConnection: gitHubConnection, enableGitHub: enableGitHub, enableLocal: enableLocal, onBrowseLocalFolder: onBrowseLocalFolder, onBuildFromPlan: handleBuildFromPlan, onOpenPlan: handleOpenPlan, isBuildingFromPlan: isBuildingFromPlan, planAttachFailed: planAttachFailed, onDismissPlanAttachFailed: () => setPlanAttachFailed(false), onFilePathClick: handleTranscriptFilePathClick, isEndUser: isEndUser }), secondary: panel.isOpen ? (_jsx(SessionPanelRegion, { flow: flow, org: org, panel: panel, accessSlot: accessSlot, onApplied: onApplied, onImplementPlan: handleBuildFromPlan, implementPlanDisabled: !conv.canSendFollowUp || isBuildingFromPlan, sessionPlan: sessionPlan, streamingPlan: streamingPlan, planDraft: planDraft, openPlanExecutionId: openPlanExecutionId, onOpenPlan: handleOpenPlan, onOpenArtifact: handleOpenArtifact, onActivateArtifact: handleActivateArtifact, enableLocal: enableLocal, onBrowseLocalFolder: onBrowseLocalFolder, workspaceFileLister: workspaceFileLister, workspaceFileReader: workspaceFileReader, workspaceContentSearcher: workspaceContentSearcher, isEndUser: isEndUser })) : null }) })] }));
289
314
  }
290
315
  const ConversationColumn = memo(function ConversationColumn({ flow, modelId, setModelId, interactionMode, setInteractionMode, composerRef, org, gitHubConnection, enableGitHub, enableLocal, onBrowseLocalFolder, onBuildFromPlan, onOpenPlan, isBuildingFromPlan, planAttachFailed, onDismissPlanAttachFailed, onFilePathClick, isEndUser, }) {
291
316
  const { conv } = flow;
@@ -305,21 +330,55 @@ const ConversationColumn = memo(function ConversationColumn({ flow, modelId, set
305
330
  const handleStop = useCallback(() => {
306
331
  void conv.stop();
307
332
  }, [conv.stop]);
308
- // Edit-and-resubmit: stop the in-flight turn and pre-fill the composer with
309
- // the original text. The append-only execution log can't be rewritten, so
310
- // the user reviews the prefilled message and resubmits it as a NEW execution
311
- // through the normal Send pipeline. The cancelled turn stays in history with
312
- // its phase badge an honest record rather than a silent edit.
333
+ // Edit-and-resubmit: stop the in-flight turn, pre-fill the composer with
334
+ // the original text, and remember which execution is being edited. The
335
+ // append-only execution log is never rewritten submitting while editing
336
+ // creates a NEW execution that carries `supersedesExecutionId`, and the
337
+ // conversation read model hides the superseded turn so the edited message
338
+ // replaces the original in place (Cursor-style, stigmer/stigmer#181).
339
+ //
340
+ // The editing state is explicit (banner + cancel in the composer) so the
341
+ // supersede link only attaches when the user actually resubmits the edit.
342
+ // Cancelling drops the link — a subsequent unrelated message appends
343
+ // normally without hiding any history.
344
+ const [editingExecutionId, setEditingExecutionId] = useState(null);
345
+ const activeExecutionId = conv.activeStreamExecution?.metadata?.id ?? null;
313
346
  const handleEditMessage = useCallback((text) => {
314
347
  void conv.stop();
348
+ setEditingExecutionId(activeExecutionId);
315
349
  composerRef.current?.setMessage(text);
316
350
  composerRef.current?.focus();
317
- }, [conv.stop, composerRef]);
318
- return (_jsxs("div", { className: "flex h-full min-w-0 flex-col", children: [_jsx(MessageThread, { executions: conv.completedExecutions, activeStreamExecution: conv.activeStreamExecution, pendingUserMessage: conv.pendingUserMessage, pendingMessageFailed: !!conv.sendError && !!conv.pendingUserMessage, onRetrySend: conv.retryLastSend, onRetryExecution: onRetryExecution, onApprovalSubmit: flow.submitApproval, submittingApprovalIds: conv.submittingApprovalIds, approvalErrors: conv.approvalErrors, showFileReviewRecords: true, onEditMessage: conv.isStoppable ? handleEditMessage : undefined, workspaceEntries: conv.workspaceEntries, onFilePathClick: onFilePathClick, sandboxWorkspaceRoot: flow.sandboxWorkspaceRoot, onBuildFromPlan: onBuildFromPlan, onOpenPlan: onOpenPlan, org: org, planActionsDisabled: !conv.canSendFollowUp || isBuildingFromPlan, planBuildPending: isBuildingFromPlan, contentColumn: "center", className: "flex-1" }), _jsxs("div", { className: CONVERSATION_COLUMN_CLASS, children: [planAttachFailed && (_jsx(PlanAttachFailedNotice, { onDismiss: onDismissPlanAttachFailed })), conv.isReconnecting && _jsx(ReconnectingIndicator, {}), conv.connectTimedOut && (_jsx(ConnectTimedOutBanner, { onRetry: conv.reconnectStream })), conv.isSlow && !conv.connectTimedOut && _jsx(SlowIndicator, {}), conv.streamError && (_jsx(StreamErrorBanner, { error: conv.streamError, onReconnect: conv.reconnectStream })), sendError && _jsx(SendErrorBanner, { error: sendError }), flow.autoApproveAll && (_jsx(AutoApproveIndicator, { onTurnOff: () => flow.setAutoApproveAll(false) })), _jsx(FileReviewDock, { changeSets: conv.fileChangeSets, onSubmit: conv.submitFileDecision, submittingDecisionKeys: conv.submittingFileDecisionKeys, decisionErrors: conv.fileDecisionErrors }), _jsx(SessionComposer, { ref: composerRef, onSubmit: flow.handleSubmit, isSubmitting: conv.isSending, disabled: !conv.canSendFollowUp, onStop: conv.isStoppable ? handleStop : undefined, isStopping: conv.isStopping, org: org, harness: flow.harness, defaultModelId: modelId, onModelChange: setModelId, interactionMode: interactionMode, onInteractionModeChange: setInteractionMode, showInteractionModePicker: true, workspace: flow.workspace, gitHubConnection: gitHubConnection, enableGitHub: enableGitHub, enableLocal: enableLocal, onBrowseLocalFolder: onBrowseLocalFolder, agentRef: flow.agentRef, onAgentRefChange: flow.setAgentRef, onAgentResolutionChange: flow.setResolution, isDefaultAgent: flow.isDefaultAgent, lockAgent: isEndUser, mcpServerUsages: isEndUser ? undefined : flow.mcpServerUsages, onMcpServerUsagesChange: isEndUser ? undefined : flow.setMcpServerUsages, skillRefs: isEndUser ? undefined : flow.skillRefs, onSkillRefsChange: isEndUser ? undefined : flow.setSkillRefs, sessionVariables: isEndUser ? undefined : flow.sessionVariables, className: "px-4 py-3" })] })] }));
351
+ }, [conv.stop, activeExecutionId, composerRef]);
352
+ const handleCancelEdit = useCallback(() => {
353
+ setEditingExecutionId(null);
354
+ composerRef.current?.setMessage("");
355
+ }, [composerRef]);
356
+ // Submit wrapper that attaches the supersede link while editing, then
357
+ // exits editing mode. Ordinary (non-editing) submits pass through as-is.
358
+ const handleComposerSubmit = useCallback((message, modelName, context) => {
359
+ void flow.handleSubmit(message, modelName, editingExecutionId
360
+ ? { ...context, supersedesExecutionId: editingExecutionId }
361
+ : context);
362
+ setEditingExecutionId(null);
363
+ }, [flow.handleSubmit, editingExecutionId]);
364
+ // The composer-docked FileReviewDock sits OUTSIDE MessageThread, so the
365
+ // thread's own FilePathContext provider does not reach it. This provider
366
+ // gives the dock's file list the same path resolution and click routing
367
+ // (open in the panel's viewer; GitHub/copy fallback) as the transcript —
368
+ // one click behavior for a path everywhere in the session. Memoized so the
369
+ // dock's memoized cards are not invalidated by unrelated renders (DD-010).
370
+ const dockFilePathCtx = useMemo(() => ({
371
+ workspaceEntries: conv.workspaceEntries ?? [],
372
+ onFilePathClick,
373
+ }), [conv.workspaceEntries, onFilePathClick]);
374
+ return (_jsxs("div", { className: "flex h-full min-w-0 flex-col", children: [_jsx(MessageThread, { executions: conv.completedExecutions, activeStreamExecution: conv.activeStreamExecution, pendingUserMessage: conv.pendingUserMessage, pendingMessageFailed: !!conv.sendError && !!conv.pendingUserMessage, onRetrySend: conv.retryLastSend, onRetryExecution: onRetryExecution, onApprovalSubmit: flow.submitApproval, submittingApprovalIds: conv.submittingApprovalIds, approvalErrors: conv.approvalErrors, showFileReviewRecords: true, onEditMessage: conv.isStoppable ? handleEditMessage : undefined, workspaceEntries: conv.workspaceEntries, onFilePathClick: onFilePathClick, sandboxWorkspaceRoot: flow.sandboxWorkspaceRoot, onBuildFromPlan: onBuildFromPlan, onOpenPlan: onOpenPlan, org: org, planActionsDisabled: !conv.canSendFollowUp || isBuildingFromPlan, planBuildPending: isBuildingFromPlan, contentColumn: "center", className: "flex-1" }), _jsxs("div", { className: CONVERSATION_COLUMN_CLASS, children: [planAttachFailed && (_jsx(PlanAttachFailedNotice, { onDismiss: onDismissPlanAttachFailed })), conv.isReconnecting && _jsx(ReconnectingIndicator, {}), conv.connectTimedOut && (_jsx(ConnectTimedOutBanner, { onRetry: conv.reconnectStream })), conv.isSlow && !conv.connectTimedOut && _jsx(SlowIndicator, {}), conv.streamError && (_jsx(StreamErrorBanner, { error: conv.streamError, onReconnect: conv.reconnectStream })), sendError && _jsx(SendErrorBanner, { error: sendError }), flow.autoApproveAll && (_jsx(AutoApproveIndicator, { onTurnOff: () => flow.setAutoApproveAll(false) })), _jsxs(FilePathContext.Provider, { value: dockFilePathCtx, children: [_jsx(FileChangeProgressBar, { progress: conv.fileChangeProgress }), _jsx(FileReviewDock, { changeSets: conv.fileChangeSets, onSubmit: conv.submitFileDecision, submittingDecisionKeys: conv.submittingFileDecisionKeys, decisionErrors: conv.fileDecisionErrors })] }), _jsx(SessionComposer, { ref: composerRef, onSubmit: handleComposerSubmit, isSubmitting: conv.isSending, disabled: !conv.canSendFollowUp, onStop: conv.isStoppable ? handleStop : undefined, isStopping: conv.isStopping, isEditing: editingExecutionId != null, onCancelEdit: handleCancelEdit, org: org, harness: flow.harness, defaultModelId: modelId, onModelChange: setModelId, interactionMode: interactionMode, onInteractionModeChange: setInteractionMode, showInteractionModePicker: true, workspace: flow.workspace, gitHubConnection: gitHubConnection, enableGitHub: enableGitHub, enableLocal: enableLocal, onBrowseLocalFolder: onBrowseLocalFolder, agentRef: flow.agentRef, onAgentRefChange: flow.setAgentRef, onAgentResolutionChange: flow.setResolution, isDefaultAgent: flow.isDefaultAgent, lockAgent: isEndUser, mcpServerUsages: isEndUser ? undefined : flow.mcpServerUsages, onMcpServerUsagesChange: isEndUser ? undefined : flow.setMcpServerUsages, skillRefs: isEndUser ? undefined : flow.skillRefs, onSkillRefsChange: isEndUser ? undefined : flow.setSkillRefs, sessionVariables: isEndUser ? undefined : flow.sessionVariables, className: "px-4 py-3" })] })] }));
319
375
  });
320
- function SessionPanelRegion({ flow, org, panel, accessSlot, onApplied, onImplementPlan, implementPlanDisabled, sessionPlan, streamingPlan, planDraft, openPlanExecutionId, onOpenPlan, enableLocal, onBrowseLocalFolder, workspaceFileLister, workspaceFileReader, workspaceContentSearcher, isEndUser, }) {
376
+ function SessionPanelRegion({ flow, org, panel, accessSlot, onApplied, onImplementPlan, implementPlanDisabled, sessionPlan, streamingPlan, planDraft, openPlanExecutionId, onOpenPlan, onOpenArtifact, onActivateArtifact, enableLocal, onBrowseLocalFolder, workspaceFileLister, workspaceFileReader, workspaceContentSearcher, isEndUser, }) {
321
377
  const selectedItem = useSelectedThreadItem();
322
378
  const { editors, activeKey, activeFile, reveal } = useWorkspaceEditors(panel.editorsStore);
379
+ // Session artifacts, deduped by identity — the source both the Artifacts
380
+ // rail-view badge and the open artifact document tabs resolve against.
381
+ const { artifacts: sessionArtifacts } = useSessionArtifacts(flow.allExecutions);
323
382
  // Honor a pending jump-to-line reveal only while it targets the active editor
324
383
  // (an EditorReveal is structurally a RevealTarget). Switching tabs changes
325
384
  // activeKey, so a stale reveal for another tab is naturally ignored.
@@ -360,14 +419,12 @@ function SessionPanelRegion({ flow, org, panel, accessSlot, onApplied, onImpleme
360
419
  // tab and its turn then ended without publishing, with no earlier plan to
361
420
  // fall back to.
362
421
  const openPlanIsLatest = openPlan?.executionId === sessionPlan?.executionId;
363
- const virtualDocuments = useMemo(() => {
364
- return [
365
- {
366
- entryId: PLAN_DOCUMENT_ENTRY_ID,
367
- path: PLAN_DOCUMENT_PATH,
368
- content: streamingPlan ? (_jsx(PlanStreamingDocument, { displayText: streamingPlan.displayText }, `streaming-${streamingPlan.executionId}`)) : openPlan ? (_jsx(PlanEditor, { plan: openPlan, draft: openPlanIsLatest ? planDraft : undefined, onBuildFromPlan: openPlanIsLatest ? onImplementPlan : undefined, buildDisabled: implementPlanDisabled, readOnly: !openPlanIsLatest }, planDraftKey(openPlan))) : (_jsx(PlanUnavailableNotice, {})),
369
- },
370
- ];
422
+ const planVirtualDocument = useMemo(() => {
423
+ return {
424
+ entryId: PLAN_DOCUMENT_ENTRY_ID,
425
+ path: PLAN_DOCUMENT_PATH,
426
+ content: streamingPlan ? (_jsx(PlanStreamingDocument, { displayText: streamingPlan.displayText }, `streaming-${streamingPlan.executionId}`)) : openPlan ? (_jsx(PlanEditor, { plan: openPlan, draft: openPlanIsLatest ? planDraft : undefined, onBuildFromPlan: openPlanIsLatest ? onImplementPlan : undefined, buildDisabled: implementPlanDisabled, readOnly: !openPlanIsLatest }, planDraftKey(openPlan))) : (_jsx(PlanUnavailableNotice, {})),
427
+ };
371
428
  }, [
372
429
  streamingPlan,
373
430
  openPlan,
@@ -376,6 +433,30 @@ function SessionPanelRegion({ flow, org, panel, accessSlot, onApplied, onImpleme
376
433
  onImplementPlan,
377
434
  implementPlanDisabled,
378
435
  ]);
436
+ // The open artifact document tabs (the artifact virtual-document FAMILY).
437
+ // Built in a SEPARATE memo from the plan doc so artifact-tab churn never
438
+ // recreates the plan doc (and vice versa). Bounded to what is actually open:
439
+ // one document per editor whose entry id is the artifact family's, resolved
440
+ // back to its `SessionArtifactEntry` by the same `artifactKey` used to open
441
+ // it (single source of truth for artifact identity). Only the ACTIVE doc's
442
+ // `content` is mounted by the surface, so building these elements is cheap;
443
+ // keying on `contentHash` remounts a tab whose artifact was overwritten by a
444
+ // later execution. A tab whose artifact no longer exists degrades to an
445
+ // honest notice rather than vanishing.
446
+ const artifactByKey = useMemo(() => new Map(sessionArtifacts.map((entry) => [artifactKey(entry.artifact), entry])), [sessionArtifacts]);
447
+ const artifactVirtualDocuments = useMemo(() => {
448
+ return editors
449
+ .filter((editor) => editor.entryId === ARTIFACT_DOCUMENT_ENTRY_ID)
450
+ .map((editor) => {
451
+ const entry = artifactByKey.get(editor.path);
452
+ return {
453
+ entryId: ARTIFACT_DOCUMENT_ENTRY_ID,
454
+ path: editor.path,
455
+ content: entry ? (_jsx(ArtifactDocument, { artifact: entry.artifact, executionId: entry.executionId, org: org, isTerminal: entry.isTerminal, onApplied: onApplied }, entry.artifact.contentHash || editor.path)) : (_jsx(ArtifactUnavailableNotice, {})),
456
+ };
457
+ });
458
+ }, [editors, artifactByKey, org, onApplied]);
459
+ const virtualDocuments = useMemo(() => [planVirtualDocument, ...artifactVirtualDocuments], [planVirtualDocument, artifactVirtualDocuments]);
379
460
  const handleRemoveAgent = useCallback(() => {
380
461
  flow.setAgentRef(null);
381
462
  flow.setResolution(null);
@@ -421,6 +502,8 @@ function SessionPanelRegion({ flow, org, panel, accessSlot, onApplied, onImpleme
421
502
  onApplied,
422
503
  onImplementPlan,
423
504
  onOpenPlan,
505
+ onOpenArtifact,
506
+ onActivateArtifact,
424
507
  });
425
508
  // Explorer-footer folder attach (desktop only — needs the native picker).
426
509
  // Same wiring the retired Workspace tab used.
@@ -460,6 +543,15 @@ function AutoApproveIndicator({ onTurnOff }) {
460
543
  function PlanUnavailableNotice() {
461
544
  return (_jsxs("div", { role: "status", className: "mx-auto flex w-full max-w-3xl flex-col items-center gap-1 px-4 py-8 text-center", children: [_jsx("p", { className: "text-xs font-medium text-foreground", children: "This turn ended before a plan was completed." }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Any partial plan text remains in the conversation." })] }));
462
545
  }
546
+ /**
547
+ * Shown in an artifact document tab whose artifact is no longer among the
548
+ * session's outputs (an edge only reachable if the executions backing the tab
549
+ * changed underneath it). The tab stays closable; the content is honest rather
550
+ * than blank.
551
+ */
552
+ function ArtifactUnavailableNotice() {
553
+ return (_jsxs("div", { role: "status", className: "mx-auto flex w-full max-w-3xl flex-col items-center gap-1 px-4 py-8 text-center", children: [_jsx("p", { className: "text-xs font-medium text-foreground", children: "This artifact is no longer available." }), _jsx("p", { className: "text-xs text-muted-foreground", children: "It may have been replaced by a newer version of this session." })] }));
554
+ }
463
555
  /**
464
556
  * Non-blocking notice for a build that fell back to message-only implement
465
557
  * (the approved plan.md could not be uploaded/attached). The build itself