@stigmer/react 3.1.1 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (426) hide show
  1. package/composer/SessionComposer.d.ts +24 -1
  2. package/composer/SessionComposer.d.ts.map +1 -1
  3. package/composer/SessionComposer.js +19 -8
  4. package/composer/SessionComposer.js.map +1 -1
  5. package/execution/ArtifactContentRenderer.d.ts +11 -1
  6. package/execution/ArtifactContentRenderer.d.ts.map +1 -1
  7. package/execution/ArtifactContentRenderer.js +39 -15
  8. package/execution/ArtifactContentRenderer.js.map +1 -1
  9. package/execution/FilePathContext.d.ts +8 -1
  10. package/execution/FilePathContext.d.ts.map +1 -1
  11. package/execution/FilePathContext.js.map +1 -1
  12. package/execution/FilePathLink.d.ts.map +1 -1
  13. package/execution/FilePathLink.js +21 -6
  14. package/execution/FilePathLink.js.map +1 -1
  15. package/execution/MessageEntry.d.ts +29 -0
  16. package/execution/MessageEntry.d.ts.map +1 -1
  17. package/execution/MessageEntry.js +29 -5
  18. package/execution/MessageEntry.js.map +1 -1
  19. package/execution/MessageThread.d.ts +76 -13
  20. package/execution/MessageThread.d.ts.map +1 -1
  21. package/execution/MessageThread.js +178 -24
  22. package/execution/MessageThread.js.map +1 -1
  23. package/execution/PlanArtifactCard.d.ts +27 -18
  24. package/execution/PlanArtifactCard.d.ts.map +1 -1
  25. package/execution/PlanArtifactCard.js +13 -23
  26. package/execution/PlanArtifactCard.js.map +1 -1
  27. package/execution/PlanDocumentMessage.d.ts +32 -0
  28. package/execution/PlanDocumentMessage.d.ts.map +1 -0
  29. package/execution/PlanDocumentMessage.js +37 -0
  30. package/execution/PlanDocumentMessage.js.map +1 -0
  31. package/execution/PlanStreamingCard.d.ts +45 -0
  32. package/execution/PlanStreamingCard.d.ts.map +1 -0
  33. package/execution/PlanStreamingCard.js +35 -0
  34. package/execution/PlanStreamingCard.js.map +1 -0
  35. package/execution/index.d.ts +5 -1
  36. package/execution/index.d.ts.map +1 -1
  37. package/execution/index.js +2 -0
  38. package/execution/index.js.map +1 -1
  39. package/execution/useCreateAgentExecution.d.ts +10 -0
  40. package/execution/useCreateAgentExecution.d.ts.map +1 -1
  41. package/execution/useCreateAgentExecution.js +5 -1
  42. package/execution/useCreateAgentExecution.js.map +1 -1
  43. package/github/decodeGitHubContent.d.ts +29 -0
  44. package/github/decodeGitHubContent.d.ts.map +1 -0
  45. package/github/decodeGitHubContent.js +72 -0
  46. package/github/decodeGitHubContent.js.map +1 -0
  47. package/github/index.d.ts +1 -0
  48. package/github/index.d.ts.map +1 -1
  49. package/github/index.js +1 -0
  50. package/github/index.js.map +1 -1
  51. package/github/useGitHubFileReader.d.ts +26 -0
  52. package/github/useGitHubFileReader.d.ts.map +1 -0
  53. package/github/useGitHubFileReader.js +106 -0
  54. package/github/useGitHubFileReader.js.map +1 -0
  55. package/github/useGitHubTreeLister.d.ts.map +1 -1
  56. package/github/useGitHubTreeLister.js +6 -2
  57. package/github/useGitHubTreeLister.js.map +1 -1
  58. package/index.d.ts +9 -9
  59. package/index.d.ts.map +1 -1
  60. package/index.js +5 -5
  61. package/index.js.map +1 -1
  62. package/internal/ResizableSplit.d.ts +72 -22
  63. package/internal/ResizableSplit.d.ts.map +1 -1
  64. package/internal/ResizableSplit.js +96 -38
  65. package/internal/ResizableSplit.js.map +1 -1
  66. package/internal/VirtualizedThread.d.ts +5 -3
  67. package/internal/VirtualizedThread.d.ts.map +1 -1
  68. package/internal/VirtualizedThread.js +6 -4
  69. package/internal/VirtualizedThread.js.map +1 -1
  70. package/internal/file-icons/index.d.ts +17 -0
  71. package/internal/file-icons/index.d.ts.map +1 -0
  72. package/internal/file-icons/index.js +60 -0
  73. package/internal/file-icons/index.js.map +1 -0
  74. package/internal/file-tree/FileTreeNode.d.ts +18 -1
  75. package/internal/file-tree/FileTreeNode.d.ts.map +1 -1
  76. package/internal/file-tree/FileTreeNode.js +11 -2
  77. package/internal/file-tree/FileTreeNode.js.map +1 -1
  78. package/internal/markdown-components.d.ts +38 -1
  79. package/internal/markdown-components.d.ts.map +1 -1
  80. package/internal/markdown-components.js +86 -11
  81. package/internal/markdown-components.js.map +1 -1
  82. package/{workflow → internal}/motion-preference.d.ts +7 -4
  83. package/internal/motion-preference.d.ts.map +1 -0
  84. package/{workflow → internal}/motion-preference.js +7 -4
  85. package/internal/motion-preference.js.map +1 -0
  86. package/internal/store/index.d.ts +33 -0
  87. package/internal/store/index.d.ts.map +1 -1
  88. package/internal/store/index.js +59 -0
  89. package/internal/store/index.js.map +1 -1
  90. package/internal/store/workspace-editors-store.d.ts +145 -0
  91. package/internal/store/workspace-editors-store.d.ts.map +1 -0
  92. package/internal/store/workspace-editors-store.js +208 -0
  93. package/internal/store/workspace-editors-store.js.map +1 -0
  94. package/internal/store/workspace-file-selection-store.d.ts +38 -0
  95. package/internal/store/workspace-file-selection-store.d.ts.map +1 -0
  96. package/internal/store/workspace-file-selection-store.js +62 -0
  97. package/internal/store/workspace-file-selection-store.js.map +1 -0
  98. package/internal/useRevealLine.d.ts +49 -0
  99. package/internal/useRevealLine.d.ts.map +1 -0
  100. package/internal/useRevealLine.js +43 -0
  101. package/internal/useRevealLine.js.map +1 -0
  102. package/library/detect-plan-artifact.d.ts +21 -0
  103. package/library/detect-plan-artifact.d.ts.map +1 -1
  104. package/library/detect-plan-artifact.js +20 -0
  105. package/library/detect-plan-artifact.js.map +1 -1
  106. package/library/detect-streaming-plan.d.ts +45 -0
  107. package/library/detect-streaming-plan.d.ts.map +1 -0
  108. package/library/detect-streaming-plan.js +83 -0
  109. package/library/detect-streaming-plan.js.map +1 -0
  110. package/library/index.d.ts +4 -1
  111. package/library/index.d.ts.map +1 -1
  112. package/library/index.js +2 -1
  113. package/library/index.js.map +1 -1
  114. package/package.json +4 -4
  115. package/session/NewSessionViewer.d.ts +19 -4
  116. package/session/NewSessionViewer.d.ts.map +1 -1
  117. package/session/NewSessionViewer.js +52 -25
  118. package/session/NewSessionViewer.js.map +1 -1
  119. package/session/PlanEditor.d.ts +55 -0
  120. package/session/PlanEditor.d.ts.map +1 -0
  121. package/session/PlanEditor.js +88 -0
  122. package/session/PlanEditor.js.map +1 -0
  123. package/session/PlanStreamingDocument.d.ts +30 -0
  124. package/session/PlanStreamingDocument.d.ts.map +1 -0
  125. package/session/PlanStreamingDocument.js +37 -0
  126. package/session/PlanStreamingDocument.js.map +1 -0
  127. package/session/SessionPanelChip.d.ts +26 -0
  128. package/session/SessionPanelChip.d.ts.map +1 -0
  129. package/session/SessionPanelChip.js +40 -0
  130. package/session/SessionPanelChip.js.map +1 -0
  131. package/session/SessionViewer.d.ts +34 -7
  132. package/session/SessionViewer.d.ts.map +1 -1
  133. package/session/SessionViewer.js +315 -33
  134. package/session/SessionViewer.js.map +1 -1
  135. package/session/{inspector → facets}/ArtifactsTab.d.ts +10 -2
  136. package/session/facets/ArtifactsTab.d.ts.map +1 -0
  137. package/session/{inspector → facets}/ArtifactsTab.js +8 -3
  138. package/session/facets/ArtifactsTab.js.map +1 -0
  139. package/session/{inspector → facets}/ChangesTab.d.ts +3 -3
  140. package/session/facets/ChangesTab.d.ts.map +1 -0
  141. package/session/{inspector → facets}/ChangesTab.js +3 -3
  142. package/session/facets/ChangesTab.js.map +1 -0
  143. package/session/facets/InspectTab.d.ts.map +1 -0
  144. package/session/facets/InspectTab.js.map +1 -0
  145. package/session/{inspector → facets}/SetupTab.d.ts +11 -2
  146. package/session/facets/SetupTab.d.ts.map +1 -0
  147. package/session/{inspector → facets}/SetupTab.js +4 -3
  148. package/session/facets/SetupTab.js.map +1 -0
  149. package/session/{inspector → facets}/UsageTab.d.ts +1 -1
  150. package/session/facets/UsageTab.d.ts.map +1 -0
  151. package/session/{inspector → facets}/UsageTab.js +1 -1
  152. package/session/facets/UsageTab.js.map +1 -0
  153. package/session/{inspector → facets}/index.d.ts +0 -6
  154. package/session/facets/index.d.ts.map +1 -0
  155. package/session/{inspector → facets}/index.js +0 -3
  156. package/session/facets/index.js.map +1 -0
  157. package/session/index.d.ts +11 -2
  158. package/session/index.d.ts.map +1 -1
  159. package/session/index.js +15 -2
  160. package/session/index.js.map +1 -1
  161. package/session/plan-document.d.ts +9 -0
  162. package/session/plan-document.d.ts.map +1 -0
  163. package/session/plan-document.js +17 -0
  164. package/session/plan-document.js.map +1 -0
  165. package/session/useOpenFileChange.d.ts +20 -0
  166. package/session/useOpenFileChange.d.ts.map +1 -0
  167. package/session/useOpenFileChange.js +31 -0
  168. package/session/useOpenFileChange.js.map +1 -0
  169. package/session/usePlanDraft.d.ts +52 -0
  170. package/session/usePlanDraft.d.ts.map +1 -0
  171. package/session/usePlanDraft.js +63 -0
  172. package/session/usePlanDraft.js.map +1 -0
  173. package/session/useSessionConversation.d.ts +6 -0
  174. package/session/useSessionConversation.d.ts.map +1 -1
  175. package/session/useSessionConversation.js +1 -0
  176. package/session/useSessionConversation.js.map +1 -1
  177. package/session/useSessionPageFlow.d.ts.map +1 -1
  178. package/session/useSessionPageFlow.js +1 -0
  179. package/session/useSessionPageFlow.js.map +1 -1
  180. package/session/useSessionPanel.d.ts +120 -0
  181. package/session/useSessionPanel.d.ts.map +1 -0
  182. package/session/useSessionPanel.js +130 -0
  183. package/session/useSessionPanel.js.map +1 -0
  184. package/session/useSessionRailViews.d.ts +45 -0
  185. package/session/useSessionRailViews.d.ts.map +1 -0
  186. package/session/useSessionRailViews.js +105 -0
  187. package/session/useSessionRailViews.js.map +1 -0
  188. package/src/composer/SessionComposer.tsx +52 -10
  189. package/src/composer/__tests__/SessionComposer-contract.test.tsx +58 -4
  190. package/src/execution/ArtifactContentRenderer.tsx +101 -24
  191. package/src/execution/FilePathContext.tsx +8 -1
  192. package/src/execution/FilePathLink.tsx +22 -6
  193. package/src/execution/MessageEntry.tsx +111 -1
  194. package/src/execution/MessageThread.tsx +291 -36
  195. package/src/execution/PlanArtifactCard.tsx +63 -31
  196. package/src/execution/PlanDocumentMessage.tsx +96 -0
  197. package/src/execution/PlanStreamingCard.tsx +137 -0
  198. package/src/execution/__tests__/ArtifactContentRenderer.test.tsx +80 -1
  199. package/src/execution/__tests__/FilePathLink.test.tsx +87 -0
  200. package/src/execution/__tests__/MessageThread.test.tsx +101 -0
  201. package/src/execution/__tests__/PlanArtifactCard.test.tsx +66 -12
  202. package/src/execution/__tests__/PlanDocumentMessage.test.tsx +55 -0
  203. package/src/execution/__tests__/PlanStreamingCard.test.tsx +49 -0
  204. package/src/execution/__tests__/buildThreadItems-plan-completion.test.ts +504 -22
  205. package/src/execution/__tests__/message-entry.test.tsx +48 -0
  206. package/src/execution/__tests__/useCreateAgentExecution.test.tsx +85 -0
  207. package/src/execution/index.ts +7 -1
  208. package/src/execution/useCreateAgentExecution.ts +16 -1
  209. package/src/github/__tests__/decodeGitHubContent.test.ts +102 -0
  210. package/src/github/__tests__/useGitHubFileReader.test.ts +183 -0
  211. package/src/github/decodeGitHubContent.ts +83 -0
  212. package/src/github/index.ts +1 -0
  213. package/src/github/useGitHubFileReader.ts +152 -0
  214. package/src/github/useGitHubTreeLister.ts +6 -2
  215. package/src/index.ts +63 -9
  216. package/src/internal/ResizableSplit.tsx +184 -51
  217. package/src/internal/VirtualizedThread.tsx +12 -4
  218. package/src/internal/__tests__/ResizableSplit.test.tsx +125 -3
  219. package/src/internal/__tests__/markdown-components.test.tsx +68 -0
  220. package/src/internal/__tests__/useRevealLine.test.tsx +97 -0
  221. package/src/internal/file-icons/__tests__/file-icons.test.tsx +35 -0
  222. package/src/internal/file-icons/index.tsx +137 -0
  223. package/src/internal/file-tree/FileTreeNode.tsx +43 -3
  224. package/src/internal/file-tree/__tests__/FileTreeNode-explorer.test.tsx +86 -0
  225. package/src/internal/markdown-components.tsx +116 -11
  226. package/src/{workflow → internal}/motion-preference.ts +7 -4
  227. package/src/internal/store/__tests__/workspace-editors-store.test.ts +216 -0
  228. package/src/internal/store/__tests__/workspace-file-selection-store.test.ts +118 -0
  229. package/src/internal/store/index.ts +94 -0
  230. package/src/internal/store/workspace-editors-store.ts +315 -0
  231. package/src/internal/store/workspace-file-selection-store.ts +88 -0
  232. package/src/internal/useRevealLine.ts +81 -0
  233. package/src/library/__tests__/detect-plan-artifact.test.ts +48 -0
  234. package/src/library/__tests__/detect-streaming-plan.test.ts +234 -0
  235. package/src/library/detect-plan-artifact.ts +35 -0
  236. package/src/library/detect-streaming-plan.ts +108 -0
  237. package/src/library/index.ts +5 -0
  238. package/src/session/NewSessionViewer.tsx +123 -55
  239. package/src/session/PlanEditor.tsx +361 -0
  240. package/src/session/PlanStreamingDocument.tsx +97 -0
  241. package/src/session/SessionPanelChip.tsx +103 -0
  242. package/src/session/SessionViewer.tsx +617 -90
  243. package/src/session/__tests__/NewSessionViewer.test.tsx +148 -0
  244. package/src/session/__tests__/PlanEditor.test.tsx +217 -0
  245. package/src/session/__tests__/PlanStreamingDocument.test.tsx +50 -0
  246. package/src/session/__tests__/SessionPanelChip.test.tsx +42 -0
  247. package/src/session/__tests__/SessionViewer-fileReviewDock.test.tsx +9 -4
  248. package/src/session/__tests__/SessionViewer-transcriptFileOpen.test.tsx +205 -0
  249. package/src/session/__tests__/audienceWiring.test.tsx +55 -19
  250. package/src/session/__tests__/useOpenFileChange.test.tsx +82 -0
  251. package/src/session/__tests__/usePlanDraft.test.ts +102 -0
  252. package/src/session/__tests__/useSessionPanel.test.ts +298 -0
  253. package/src/session/__tests__/useSessionRailViews.test.tsx +124 -0
  254. package/src/session/{inspector → facets}/ArtifactsTab.tsx +27 -5
  255. package/src/session/{inspector → facets}/ChangesTab.tsx +3 -3
  256. package/src/session/{inspector → facets}/SetupTab.tsx +13 -1
  257. package/src/session/{inspector → facets}/UsageTab.tsx +1 -1
  258. package/src/session/{inspector → facets}/__tests__/ArtifactsTab.test.tsx +35 -1
  259. package/src/session/facets/__tests__/SetupTab.test.tsx +44 -0
  260. package/src/session/{inspector → facets}/index.ts +0 -16
  261. package/src/session/index.ts +30 -13
  262. package/src/session/plan-document.ts +19 -0
  263. package/src/session/useOpenFileChange.ts +53 -0
  264. package/src/session/usePlanDraft.ts +109 -0
  265. package/src/session/useSessionConversation.ts +7 -0
  266. package/src/session/useSessionPageFlow.ts +1 -0
  267. package/src/session/useSessionPanel.ts +288 -0
  268. package/src/session/useSessionRailViews.tsx +200 -0
  269. package/src/workflow/WorkflowExecutionGraph.tsx +1 -1
  270. package/src/workflow/index.ts +1 -1
  271. package/src/workflow/useFollowExecution.ts +1 -1
  272. package/src/workspace/EditorTabs.tsx +145 -0
  273. package/src/workspace/ExplorerTree.tsx +247 -0
  274. package/src/workspace/FileViewer.tsx +516 -0
  275. package/src/workspace/WorkspaceContentSearch.tsx +478 -0
  276. package/src/workspace/WorkspaceContentSearcher.ts +70 -0
  277. package/src/workspace/WorkspaceFileLister.ts +11 -0
  278. package/src/workspace/WorkspaceFileReader.ts +57 -0
  279. package/src/workspace/WorkspaceFileSearch.tsx +429 -0
  280. package/src/workspace/WorkspaceSurface.tsx +781 -0
  281. package/src/workspace/__tests__/EditorTabs.test.tsx +100 -0
  282. package/src/workspace/__tests__/ExplorerTree.test.tsx +152 -0
  283. package/src/workspace/__tests__/FileViewer.test.tsx +421 -0
  284. package/src/workspace/__tests__/WorkspaceContentSearch.test.tsx +196 -0
  285. package/src/workspace/__tests__/WorkspaceFileSearch.test.tsx +206 -0
  286. package/src/workspace/__tests__/WorkspaceSurface.test.tsx +348 -0
  287. package/src/workspace/__tests__/findChangeForSelection.test.ts +132 -0
  288. package/src/workspace/__tests__/matchContentPreview.test.ts +55 -0
  289. package/src/workspace/__tests__/matchWorkspaceFiles.test.ts +104 -0
  290. package/src/workspace/__tests__/resolveWorkspaceFileSelection.test.ts +135 -0
  291. package/src/workspace/__tests__/useWorkspaceContentSearch.test.tsx +196 -0
  292. package/src/workspace/__tests__/useWorkspaceFileContent.test.tsx +190 -0
  293. package/src/workspace/__tests__/useWorkspaceFileSearch.test.tsx +162 -0
  294. package/src/workspace/findChangeForSelection.ts +61 -0
  295. package/src/workspace/index.ts +56 -2
  296. package/src/workspace/matchContentPreview.ts +51 -0
  297. package/src/workspace/matchWorkspaceFiles.ts +86 -0
  298. package/src/workspace/resolveWorkspaceFileSelection.ts +119 -0
  299. package/src/workspace/useWorkspaceContentSearch.ts +228 -0
  300. package/src/workspace/useWorkspaceFileContent.ts +129 -0
  301. package/src/workspace/useWorkspaceFileSearch.ts +184 -0
  302. package/src/workspace/useWorkspaceFiles.ts +27 -27
  303. package/src/workspace/workspaceListingCache.ts +93 -0
  304. package/styles.css +1 -1
  305. package/workflow/WorkflowExecutionGraph.js +1 -1
  306. package/workflow/WorkflowExecutionGraph.js.map +1 -1
  307. package/workflow/index.d.ts +1 -1
  308. package/workflow/index.d.ts.map +1 -1
  309. package/workflow/index.js +1 -1
  310. package/workflow/index.js.map +1 -1
  311. package/workflow/useFollowExecution.js +1 -1
  312. package/workflow/useFollowExecution.js.map +1 -1
  313. package/workspace/EditorTabs.d.ts +29 -0
  314. package/workspace/EditorTabs.d.ts.map +1 -0
  315. package/workspace/EditorTabs.js +66 -0
  316. package/workspace/EditorTabs.js.map +1 -0
  317. package/workspace/ExplorerTree.d.ts +32 -0
  318. package/workspace/ExplorerTree.d.ts.map +1 -0
  319. package/workspace/ExplorerTree.js +45 -0
  320. package/workspace/ExplorerTree.js.map +1 -0
  321. package/workspace/FileViewer.d.ts +93 -0
  322. package/workspace/FileViewer.d.ts.map +1 -0
  323. package/workspace/FileViewer.js +182 -0
  324. package/workspace/FileViewer.js.map +1 -0
  325. package/workspace/WorkspaceContentSearch.d.ts +41 -0
  326. package/workspace/WorkspaceContentSearch.d.ts.map +1 -0
  327. package/workspace/WorkspaceContentSearch.js +195 -0
  328. package/workspace/WorkspaceContentSearch.js.map +1 -0
  329. package/workspace/WorkspaceContentSearcher.d.ts +59 -0
  330. package/workspace/WorkspaceContentSearcher.d.ts.map +1 -0
  331. package/workspace/WorkspaceContentSearcher.js +7 -0
  332. package/workspace/WorkspaceContentSearcher.js.map +1 -0
  333. package/workspace/WorkspaceFileLister.d.ts +11 -0
  334. package/workspace/WorkspaceFileLister.d.ts.map +1 -1
  335. package/workspace/WorkspaceFileReader.d.ts +48 -0
  336. package/workspace/WorkspaceFileReader.d.ts.map +1 -0
  337. package/workspace/WorkspaceFileReader.js +11 -0
  338. package/workspace/WorkspaceFileReader.js.map +1 -0
  339. package/workspace/WorkspaceFileSearch.d.ts +32 -0
  340. package/workspace/WorkspaceFileSearch.d.ts.map +1 -0
  341. package/workspace/WorkspaceFileSearch.js +155 -0
  342. package/workspace/WorkspaceFileSearch.js.map +1 -0
  343. package/workspace/WorkspaceSurface.d.ts +151 -0
  344. package/workspace/WorkspaceSurface.d.ts.map +1 -0
  345. package/workspace/WorkspaceSurface.js +184 -0
  346. package/workspace/WorkspaceSurface.js.map +1 -0
  347. package/workspace/findChangeForSelection.d.ts +19 -0
  348. package/workspace/findChangeForSelection.d.ts.map +1 -0
  349. package/workspace/findChangeForSelection.js +46 -0
  350. package/workspace/findChangeForSelection.js.map +1 -0
  351. package/workspace/index.d.ts +24 -2
  352. package/workspace/index.d.ts.map +1 -1
  353. package/workspace/index.js +13 -1
  354. package/workspace/index.js.map +1 -1
  355. package/workspace/matchContentPreview.d.ts +21 -0
  356. package/workspace/matchContentPreview.d.ts.map +1 -0
  357. package/workspace/matchContentPreview.js +36 -0
  358. package/workspace/matchContentPreview.js.map +1 -0
  359. package/workspace/matchWorkspaceFiles.d.ts +30 -0
  360. package/workspace/matchWorkspaceFiles.d.ts.map +1 -0
  361. package/workspace/matchWorkspaceFiles.js +58 -0
  362. package/workspace/matchWorkspaceFiles.js.map +1 -0
  363. package/workspace/resolveWorkspaceFileSelection.d.ts +19 -0
  364. package/workspace/resolveWorkspaceFileSelection.d.ts.map +1 -0
  365. package/workspace/resolveWorkspaceFileSelection.js +115 -0
  366. package/workspace/resolveWorkspaceFileSelection.js.map +1 -0
  367. package/workspace/useWorkspaceContentSearch.d.ts +69 -0
  368. package/workspace/useWorkspaceContentSearch.d.ts.map +1 -0
  369. package/workspace/useWorkspaceContentSearch.js +154 -0
  370. package/workspace/useWorkspaceContentSearch.js.map +1 -0
  371. package/workspace/useWorkspaceFileContent.d.ts +73 -0
  372. package/workspace/useWorkspaceFileContent.d.ts.map +1 -0
  373. package/workspace/useWorkspaceFileContent.js +57 -0
  374. package/workspace/useWorkspaceFileContent.js.map +1 -0
  375. package/workspace/useWorkspaceFileSearch.d.ts +61 -0
  376. package/workspace/useWorkspaceFileSearch.d.ts.map +1 -0
  377. package/workspace/useWorkspaceFileSearch.js +119 -0
  378. package/workspace/useWorkspaceFileSearch.js.map +1 -0
  379. package/workspace/useWorkspaceFiles.d.ts +13 -5
  380. package/workspace/useWorkspaceFiles.d.ts.map +1 -1
  381. package/workspace/useWorkspaceFiles.js +18 -19
  382. package/workspace/useWorkspaceFiles.js.map +1 -1
  383. package/workspace/workspaceListingCache.d.ts +47 -0
  384. package/workspace/workspaceListingCache.d.ts.map +1 -0
  385. package/workspace/workspaceListingCache.js +55 -0
  386. package/workspace/workspaceListingCache.js.map +1 -0
  387. package/session/inspector/ArtifactsTab.d.ts.map +0 -1
  388. package/session/inspector/ArtifactsTab.js.map +0 -1
  389. package/session/inspector/ChangesTab.d.ts.map +0 -1
  390. package/session/inspector/ChangesTab.js.map +0 -1
  391. package/session/inspector/InspectTab.d.ts.map +0 -1
  392. package/session/inspector/InspectTab.js.map +0 -1
  393. package/session/inspector/SessionInspector.d.ts +0 -64
  394. package/session/inspector/SessionInspector.d.ts.map +0 -1
  395. package/session/inspector/SessionInspector.js +0 -53
  396. package/session/inspector/SessionInspector.js.map +0 -1
  397. package/session/inspector/SetupTab.d.ts.map +0 -1
  398. package/session/inspector/SetupTab.js.map +0 -1
  399. package/session/inspector/UsageTab.d.ts.map +0 -1
  400. package/session/inspector/UsageTab.js.map +0 -1
  401. package/session/inspector/WorkspaceTab.d.ts +0 -35
  402. package/session/inspector/WorkspaceTab.d.ts.map +0 -1
  403. package/session/inspector/WorkspaceTab.js +0 -75
  404. package/session/inspector/WorkspaceTab.js.map +0 -1
  405. package/session/inspector/index.d.ts.map +0 -1
  406. package/session/inspector/index.js.map +0 -1
  407. package/session/inspector/useSessionInspector.d.ts +0 -49
  408. package/session/inspector/useSessionInspector.d.ts.map +0 -1
  409. package/session/inspector/useSessionInspector.js +0 -122
  410. package/session/inspector/useSessionInspector.js.map +0 -1
  411. package/src/session/inspector/SessionInspector.tsx +0 -162
  412. package/src/session/inspector/WorkspaceTab.tsx +0 -245
  413. package/src/session/inspector/__tests__/useSessionInspector.test.ts +0 -251
  414. package/src/session/inspector/useSessionInspector.ts +0 -178
  415. package/src/workspace/WorkspaceEntryFiles.tsx +0 -196
  416. package/workflow/motion-preference.d.ts.map +0 -1
  417. package/workflow/motion-preference.js.map +0 -1
  418. package/workspace/WorkspaceEntryFiles.d.ts +0 -22
  419. package/workspace/WorkspaceEntryFiles.d.ts.map +0 -1
  420. package/workspace/WorkspaceEntryFiles.js +0 -58
  421. package/workspace/WorkspaceEntryFiles.js.map +0 -1
  422. /package/session/{inspector → facets}/InspectTab.d.ts +0 -0
  423. /package/session/{inspector → facets}/InspectTab.js +0 -0
  424. /package/src/{workflow → internal}/__tests__/motion-preference.test.ts +0 -0
  425. /package/src/session/{inspector → facets}/InspectTab.tsx +0 -0
  426. /package/src/session/{inspector → facets}/__tests__/ChangesTab.test.tsx +0 -0
@@ -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,CAAC;AAErG;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAE5C;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,QAA2B;IACxD,OAAO,CACL,QAAQ,CAAC,IAAI,KAAK,qBAAqB,CAAC,IAAI;QAC5C,QAAQ,CAAC,IAAI,KAAK,kBAAkB,CACrC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAA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CAAC;IACxD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAqC;IAErC,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,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"}
@@ -0,0 +1,45 @@
1
+ import type { AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
2
+ /**
3
+ * A plan being written by a live Plan-mode execution, detected mid-stream so
4
+ * the UI can promote it to a document surface (panel plan tab + compact thread
5
+ * card) instead of letting it dump into the chat as a giant streaming bubble.
6
+ */
7
+ export interface StreamingPlan {
8
+ /** Index of the plan message in `execution.status.messages`. */
9
+ readonly messageIndex: number;
10
+ /**
11
+ * The plan text to render on document surfaces: the message content with
12
+ * any enclosing plan fence stripped, streaming-tolerantly (an unterminated
13
+ * opening fence is stripped too — see {@link findStreamingPlan}). Purely a
14
+ * display projection; the stored message is never mutated.
15
+ */
16
+ readonly displayText: string;
17
+ }
18
+ /**
19
+ * Detects the plan a live Plan-mode execution is currently writing, or
20
+ * `undefined` when the execution has no recognizable plan in flight.
21
+ *
22
+ * This is the third leg of the plan convention, alongside the runner's prompt
23
+ * directive ("your FINAL message IS the plan, starting with a single `#`
24
+ * title" — `plan-mode-prompt.ts`) and the completion-time artifact detection
25
+ * by filename ({@link isPlanArtifact}). Completion makes the plan unambiguous
26
+ * (the published `plan.md` artifact); mid-stream it must be inferred, and the
27
+ * directive's mandated shape is the inference:
28
+ *
29
+ * - the execution runs in Plan mode and is **non-terminal** (a completed turn
30
+ * is owned by the artifact path; a stopped/failed turn has no live plan),
31
+ * - the candidate is the **last content-bearing `MESSAGE_AI`** — the exact
32
+ * selection rule the runner's `extractFinalPlanText` and the thread's
33
+ * `findPlanMessageIndex` share, so all three stay in lockstep,
34
+ * - and that candidate opens with an `# H1` title (after tolerating an
35
+ * enclosing plan fence, see {@link unwrapStreamingPlanFence}) — the shape
36
+ * the directive mandates and narration essentially never has.
37
+ *
38
+ * Degradation is graceful by design: a model that ignores the directive
39
+ * simply streams its plan in the thread as before, and the completion-time
40
+ * pipeline is unaffected either way. Only the LAST content-bearing AI message
41
+ * is ever considered — an earlier message is settled narration, and falling
42
+ * back to it would promote the wrong text.
43
+ */
44
+ export declare function findStreamingPlan(execution: AgentExecution | null | undefined): StreamingPlan | undefined;
45
+ //# sourceMappingURL=detect-streaming-plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-streaming-plan.d.ts","sourceRoot":"","sources":["../../src/library/detect-streaming-plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAOlG;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAqCD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,GAC3C,aAAa,GAAG,SAAS,CAoB3B"}
@@ -0,0 +1,83 @@
1
+ import { InteractionMode, MessageType, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
2
+ import { isTerminalPhase } from "@stigmer/sdk";
3
+ /**
4
+ * Opening line of a whole-message plan fence: ``` with no language tag, or
5
+ * tagged `markdown`/`md`. Any other tag (```python …) means the message opens
6
+ * with a genuine code block, not a wrapped plan, and is never unwrapped —
7
+ * mirroring `unwrapEnclosingMarkdownFence`'s tag rules.
8
+ */
9
+ const OPENING_PLAN_FENCE_RE = /^(`{3,})(?:markdown|md)?[ \t]*\r?\n/;
10
+ /** A streaming plan message qualifies when it opens with an `# H1` title. */
11
+ const LEADING_H1_RE = /^#[ \t]/;
12
+ /**
13
+ * Streaming-tolerant unwrap of a whole-message plan fence.
14
+ *
15
+ * `unwrapEnclosingMarkdownFence` deliberately no-ops until the closing fence
16
+ * arrives (transcripts must stay faithful while a genuine code block is still
17
+ * open). A plan surface can't wait: mid-stream the closing fence hasn't
18
+ * streamed yet, and rendering the fence as-is turns the whole live plan into
19
+ * one giant code block. Because Plan mode's output IS a markdown document by
20
+ * contract, a message that OPENS with a bare/markdown fence is a wrapped plan
21
+ * — so this strips the opening fence immediately and the closing fence
22
+ * whenever it shows up as the final line.
23
+ */
24
+ function unwrapStreamingPlanFence(content) {
25
+ const trimmed = content.trim();
26
+ const open = OPENING_PLAN_FENCE_RE.exec(trimmed);
27
+ if (!open)
28
+ return content;
29
+ const body = trimmed.slice(open[0].length);
30
+ // Strip the closing fence only when it is the final line (same backtick
31
+ // run); a fence anywhere else belongs to a code block inside the plan.
32
+ const close = new RegExp(`(?:^|\\r?\\n)${open[1]}[ \\t]*$`);
33
+ const closeMatch = close.exec(body);
34
+ return closeMatch ? body.slice(0, closeMatch.index) : body;
35
+ }
36
+ /**
37
+ * Detects the plan a live Plan-mode execution is currently writing, or
38
+ * `undefined` when the execution has no recognizable plan in flight.
39
+ *
40
+ * This is the third leg of the plan convention, alongside the runner's prompt
41
+ * directive ("your FINAL message IS the plan, starting with a single `#`
42
+ * title" — `plan-mode-prompt.ts`) and the completion-time artifact detection
43
+ * by filename ({@link isPlanArtifact}). Completion makes the plan unambiguous
44
+ * (the published `plan.md` artifact); mid-stream it must be inferred, and the
45
+ * directive's mandated shape is the inference:
46
+ *
47
+ * - the execution runs in Plan mode and is **non-terminal** (a completed turn
48
+ * is owned by the artifact path; a stopped/failed turn has no live plan),
49
+ * - the candidate is the **last content-bearing `MESSAGE_AI`** — the exact
50
+ * selection rule the runner's `extractFinalPlanText` and the thread's
51
+ * `findPlanMessageIndex` share, so all three stay in lockstep,
52
+ * - and that candidate opens with an `# H1` title (after tolerating an
53
+ * enclosing plan fence, see {@link unwrapStreamingPlanFence}) — the shape
54
+ * the directive mandates and narration essentially never has.
55
+ *
56
+ * Degradation is graceful by design: a model that ignores the directive
57
+ * simply streams its plan in the thread as before, and the completion-time
58
+ * pipeline is unaffected either way. Only the LAST content-bearing AI message
59
+ * is ever considered — an earlier message is settled narration, and falling
60
+ * back to it would promote the wrong text.
61
+ */
62
+ export function findStreamingPlan(execution) {
63
+ if (execution?.spec?.executionConfig?.interactionMode !== InteractionMode.PLAN) {
64
+ return undefined;
65
+ }
66
+ const phase = execution.status?.phase;
67
+ if (phase === undefined || isTerminalPhase(phase))
68
+ return undefined;
69
+ const messages = execution.status?.messages ?? [];
70
+ for (let i = messages.length - 1; i >= 0; i--) {
71
+ const msg = messages[i];
72
+ if (msg.type !== MessageType.MESSAGE_AI)
73
+ continue;
74
+ if (msg.content.trim().length === 0)
75
+ continue;
76
+ const displayText = unwrapStreamingPlanFence(msg.content);
77
+ return LEADING_H1_RE.test(displayText.trimStart())
78
+ ? { messageIndex: i, displayText }
79
+ : undefined;
80
+ }
81
+ return undefined;
82
+ }
83
+ //# sourceMappingURL=detect-streaming-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-streaming-plan.js","sourceRoot":"","sources":["../../src/library/detect-streaming-plan.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,WAAW,GACZ,MAAM,8DAA8D,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAmB/C;;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M,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC,UAAU;YAAE,SAAS;QAClD,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAC9C,MAAM,WAAW,GAAG,wBAAwB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1D,OAAO,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;YAChD,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,WAAW,EAAE;YAClC,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -8,7 +8,10 @@ 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, PLAN_ARTIFACT_NAME, } from "./detect-plan-artifact.js";
11
+ export { isPlanArtifact, findPlanArtifact, findLatestSessionPlan, PLAN_ARTIFACT_NAME, } from "./detect-plan-artifact.js";
12
+ export type { SessionPlan } from "./detect-plan-artifact.js";
13
+ export { findStreamingPlan } from "./detect-streaming-plan.js";
14
+ export type { StreamingPlan } from "./detect-streaming-plan.js";
12
15
  export { useDetectSkillPackage } from "./useDetectSkillPackage.js";
13
16
  export type { UseDetectSkillPackageReturn } from "./useDetectSkillPackage.js";
14
17
  export { parseResourceYaml } from "./parse-resource-yaml.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/library/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBA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AE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EACV,YAAY,EACZ,aAAa,EACb,uBAAuB,GACxB,MAAM,wBAAwB,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,8 @@ 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, PLAN_ARTIFACT_NAME, } from "./detect-plan-artifact.js";
7
+ export { isPlanArtifact, findPlanArtifact, findLatestSessionPlan, PLAN_ARTIFACT_NAME, } from "./detect-plan-artifact.js";
8
+ export { findStreamingPlan } from "./detect-streaming-plan.js";
8
9
  export { useDetectSkillPackage } from "./useDetectSkillPackage.js";
9
10
  export { parseResourceYaml } from "./parse-resource-yaml.js";
10
11
  export { serializeAgentYaml, serializeMcpServerYaml, serializeAgentInputYaml, serializeMcpServerInputYaml, } from "./serialize-resource-yaml.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","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;AAG/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAMrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EACL,cAAc,EACd,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAElG,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAOzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAM3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAO3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG9E,OAAO,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AAM,wBAAwB,CAAC;AAO3D,OAAO,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.1",
3
+ "version": "3.1.2",
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.1",
40
+ "@stigmer/theme": "3.1.2",
41
41
  "diff": "^8.0.3",
42
42
  "fflate": "^0.8.2",
43
43
  "hast-util-to-jsx-runtime": "^2.3.6",
@@ -60,8 +60,8 @@
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.1",
64
- "@stigmer/sdk": "3.1.1",
63
+ "@stigmer/protos": "3.1.2",
64
+ "@stigmer/sdk": "3.1.2",
65
65
  "@tanstack/react-table": "^8.20.0",
66
66
  "@xyflow/react": "^12.0.0",
67
67
  "elkjs": "^0.9.0",
@@ -2,6 +2,8 @@ import { type ReactNode } from "react";
2
2
  import type { ResourceRef } from "@stigmer/sdk";
3
3
  import type { UseGitHubConnectionReturn } from "../github/useGitHubConnection.js";
4
4
  import type { WorkspaceFileLister } from "../workspace/WorkspaceFileLister.js";
5
+ import type { WorkspaceFileReader } from "../workspace/WorkspaceFileReader.js";
6
+ import type { WorkspaceContentSearcher } from "../workspace/WorkspaceContentSearcher.js";
5
7
  import type { HarnessOption } from "../models/harness.js";
6
8
  import type { RuntimeEnvProvider } from "./runtime-env.js";
7
9
  import type { SessionAudience } from "./audience.js";
@@ -34,6 +36,18 @@ export interface NewSessionViewerProps {
34
36
  * expandable file tree. (DD-004 capability injection, DD-011 opt-in.)
35
37
  */
36
38
  readonly workspaceFileLister?: WorkspaceFileLister;
39
+ /**
40
+ * Platform-injected content reader for the read-only file viewer. When set,
41
+ * clicking a file in the Workspace tree opens it in a contextual "Viewer"
42
+ * tab — the same capability `SessionViewer` accepts (DD-016 parity).
43
+ */
44
+ readonly workspaceFileReader?: WorkspaceFileReader;
45
+ /**
46
+ * Platform-injected content (text) searcher — the same capability
47
+ * `SessionViewer` accepts (DD-016 parity). Desktop injects a native
48
+ * ripgrep-backed searcher; web leaves it undefined (DD-09).
49
+ */
50
+ readonly workspaceContentSearcher?: WorkspaceContentSearcher;
37
51
  /**
38
52
  * Supplies host-app environment variables for the session's first
39
53
  * execution (e.g. short-lived credentials for MCP tools, minted as
@@ -99,9 +113,10 @@ export interface NewSessionViewerProps {
99
113
  * Owns `useNewSessionFlow` internally and composes:
100
114
  * - **Centered composer** (primary pane): `SessionComposer` with all
101
115
  * context pickers (agent, workspace, MCP servers, skills)
102
- * - **SessionInspector** (secondary pane): progressively revealed when
103
- * context is attached (workspace/agent/MCP/skills/vars non-empty),
104
- * showing only the Setup tab with interactive workspace actions.
116
+ * - **Session panel** (secondary pane): the unified `WorkspaceSurface` with a
117
+ * Config rail view collapsed by default behind a persistent top-right chip
118
+ * and homing on the Config facet when opened. Same layout model as
119
+ * `SessionViewer` (DD-016).
105
120
  *
106
121
  * Framework-agnostic — no Next.js, no Tauri, no routing deps. Host
107
122
  * apps inject platform-specific values via props (DD-004/DD-016).
@@ -127,5 +142,5 @@ export interface NewSessionViewerProps {
127
142
  * />
128
143
  * ```
129
144
  */
130
- export declare function NewSessionViewer({ org, onSessionCreated, onError, gitHubConnection, enableGitHub, enableLocal, onBrowseLocalFolder, workspaceFileLister, getRuntimeEnv, audience, defaultHarness, initialAgentRef, initialInstanceId, initialAttachments, heading, placeholder, initialRows, autoFocus, footerContent, className, }: NewSessionViewerProps): import("react/jsx-runtime").JSX.Element;
145
+ export declare function NewSessionViewer({ org, onSessionCreated, onError, gitHubConnection, enableGitHub, enableLocal, onBrowseLocalFolder, workspaceFileLister, workspaceFileReader, workspaceContentSearcher, getRuntimeEnv, audience, defaultHarness, initialAgentRef, initialInstanceId, initialAttachments, heading, placeholder, initialRows, autoFocus, footerContent, className, }: NewSessionViewerProps): import("react/jsx-runtime").JSX.Element;
131
146
  //# sourceMappingURL=NewSessionViewer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NewSessionViewer.d.ts","sourceRoot":"","sources":["../../src/session/NewSessionViewer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAG/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAK1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC,wDAAwD;IACxD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,QAAQ,CAAC,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACvD,sEAAsE;I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E,OAAO,CAAC;IAE7B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC;IAEnC,yDAAyD;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,gBAAgB,EAChB,OAAO,EACP,gBAAgB,EAChB,YAAmB,EACnB,WAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,QAAuB,EACvB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,OAA2C,EAC3C,WAAsD,EACtD,WAAe,EACf,SAAgB,EAChB,aAAa,EACb,SAAS,GACV,EAAE,qBAAqB,2CA6NvB"}
@@ -4,8 +4,12 @@ import { useCallback, useMemo, useState } from "react";
4
4
  import { cn } from "@stigmer/theme";
5
5
  import { SessionComposer } from "../composer/index.js";
6
6
  import { ResizableSplit } from "../internal/ResizableSplit.js";
7
- import { SessionInspector } from "./inspector/SessionInspector.js";
7
+ import { useWorkspaceEditors } from "../internal/store/index.js";
8
+ import { WorkspaceSurface } from "../workspace/WorkspaceSurface.js";
8
9
  import { useNewSessionFlow } from "./useNewSessionFlow.js";
10
+ import { useSessionPanel } from "./useSessionPanel.js";
11
+ import { useSessionRailViews } from "./useSessionRailViews.js";
12
+ import { SessionPanelChip } from "./SessionPanelChip.js";
9
13
  /**
10
14
  * Full-featured new-session launcher organism — the pre-session analog
11
15
  * of `SessionViewer`.
@@ -13,9 +17,10 @@ import { useNewSessionFlow } from "./useNewSessionFlow.js";
13
17
  * Owns `useNewSessionFlow` internally and composes:
14
18
  * - **Centered composer** (primary pane): `SessionComposer` with all
15
19
  * context pickers (agent, workspace, MCP servers, skills)
16
- * - **SessionInspector** (secondary pane): progressively revealed when
17
- * context is attached (workspace/agent/MCP/skills/vars non-empty),
18
- * showing only the Setup tab with interactive workspace actions.
20
+ * - **Session panel** (secondary pane): the unified `WorkspaceSurface` with a
21
+ * Config rail view collapsed by default behind a persistent top-right chip
22
+ * and homing on the Config facet when opened. Same layout model as
23
+ * `SessionViewer` (DD-016).
19
24
  *
20
25
  * Framework-agnostic — no Next.js, no Tauri, no routing deps. Host
21
26
  * apps inject platform-specific values via props (DD-004/DD-016).
@@ -41,7 +46,7 @@ import { useNewSessionFlow } from "./useNewSessionFlow.js";
41
46
  * />
42
47
  * ```
43
48
  */
44
- export function NewSessionViewer({ org, onSessionCreated, onError, gitHubConnection, enableGitHub = true, enableLocal = false, onBrowseLocalFolder, workspaceFileLister, getRuntimeEnv, audience = "integrator", defaultHarness, initialAgentRef, initialInstanceId, initialAttachments, heading = "What would you like to work on?", placeholder = "Describe what you need help with\u2026", initialRows = 3, autoFocus = true, footerContent, className, }) {
49
+ export function NewSessionViewer({ org, onSessionCreated, onError, gitHubConnection, enableGitHub = true, enableLocal = false, onBrowseLocalFolder, workspaceFileLister, workspaceFileReader, workspaceContentSearcher, getRuntimeEnv, audience = "integrator", defaultHarness, initialAgentRef, initialInstanceId, initialAttachments, heading = "What would you like to work on?", placeholder = "Describe what you need help with\u2026", initialRows = 3, autoFocus = true, footerContent, className, }) {
45
50
  const flow = useNewSessionFlow({
46
51
  org,
47
52
  onSessionCreated,
@@ -51,11 +56,21 @@ export function NewSessionViewer({ org, onSessionCreated, onError, gitHubConnect
51
56
  });
52
57
  const [interactionMode, setInteractionMode] = useState("agent");
53
58
  const isEndUser = audience === "endUser";
54
- const hasContext = flow.workspace.hasEntries ||
55
- flow.agentRef !== null ||
56
- flow.mcpServerUsages.length > 0 ||
57
- flow.skillRefs.length > 0 ||
58
- (flow.sessionVariables != null && !flow.sessionVariables.isEmpty);
59
+ // The unified-panel controller (shared with SessionViewer, DD-016). The
60
+ // launcher has no execution yet, so the FSM inputs are static. It has no
61
+ // streaming column to isolate either, so subscribing to the editor group in
62
+ // the body is harmless — unlike `SessionViewer`, which subscribes one level
63
+ // down. Homes on Config: pre-session the Explorer is empty, while Config
64
+ // carries the run defaults (harness/model) worth seeing before starting.
65
+ const panel = useSessionPanel({
66
+ phase: null,
67
+ hasChanges: false,
68
+ defaultView: "configure",
69
+ });
70
+ const { editors, activeKey, activeFile, reveal } = useWorkspaceEditors(panel.editorsStore);
71
+ // Honor a jump-to-line reveal only while it targets the active editor
72
+ // (DD-016 parity with SessionViewer).
73
+ const activeReveal = reveal && reveal.key === activeKey ? reveal : undefined;
59
74
  const handleRemoveAgent = useCallback(() => {
60
75
  flow.setAgentRef(null);
61
76
  flow.setResolution(null);
@@ -89,20 +104,32 @@ export function NewSessionViewer({ org, onSessionCreated, onError, gitHubConnect
89
104
  flow.sessionVariables, flow.harness, flow.modelId,
90
105
  isEndUser, handleRemoveAgent, handleRemoveMcp, handleRemoveSkill,
91
106
  ]);
92
- const workspaceConfig = useMemo(() => ({
93
- actions: {
94
- workspace: flow.workspace,
95
- enableGitHub,
96
- enableLocal,
97
- gitHubConnection,
98
- onBrowseLocalFolder,
99
- workspaceFileLister,
100
- },
101
- }), [flow.workspace, enableGitHub, enableLocal, gitHubConnection, onBrowseLocalFolder, workspaceFileLister]);
102
- const composerNode = (_jsx("div", { className: "flex h-full flex-col items-center overflow-y-auto px-4", children: _jsxs("div", { className: cn("w-full max-w-2xl space-y-6", hasContext ? "my-6" : "my-auto"), children: [_jsx("h1", { className: "text-center text-lg font-medium text-foreground", children: heading }), _jsx(SessionComposer, { onSubmit: flow.submit, isSubmitting: flow.isSubmitting, org: org, workspace: flow.workspace, gitHubConnection: enableGitHub ? gitHubConnection : undefined, enableGitHub: enableGitHub, enableLocal: enableLocal, onBrowseLocalFolder: onBrowseLocalFolder, agentRef: flow.agentRef, onAgentRefChange: flow.setAgentRef, onAgentResolutionChange: flow.setResolution, initialAgentRef: initialAgentRef, initialInstanceId: initialInstanceId, initialAttachments: initialAttachments, lockAgent: isEndUser && initialAgentRef != null, 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, showHarnessSelector: true, harness: flow.harness, onHarnessChange: flow.setHarness, interactionMode: interactionMode, onInteractionModeChange: setInteractionMode, showInteractionModePicker: true, defaultModelId: flow.modelId, onModelChange: flow.setModelId, placeholder: placeholder, initialRows: initialRows, autoFocus: autoFocus, ariaLabel: "Start a new session" }), footerContent, _jsx("p", { className: "text-center text-[0.65rem] text-muted-foreground", children: "Press Enter to send, Shift+Enter for a new line" })] }) }));
103
- if (!hasContext) {
104
- return (_jsx("div", { className: cn("flex h-full w-full flex-col", className), children: composerNode }));
105
- }
106
- return (_jsx("div", { className: cn("flex h-full w-full flex-col", className), children: _jsx(ResizableSplit, { defaultSize: 320, minSize: 240, maxSize: 480, storageKey: "stgm-new-session-inspector-width", className: cn("min-h-0 flex-1", "[&>*:nth-child(2)]:max-lg:hidden [&>*:nth-child(3)]:max-lg:hidden"), primary: composerNode, secondary: _jsx("aside", { className: "flex h-full flex-col overflow-hidden", children: _jsx(SessionInspector, { displayExecution: null, allExecutions: [], org: org, selectedItem: null, sessionConfig: sessionConfig, workspaceConfig: workspaceConfig, className: "min-h-0 flex-1" }) }) }) }));
107
+ // Launcher facets: Config only — no executions exist yet, so the
108
+ // execution-derived facets (Changes/Artifacts/Usage) don't apply.
109
+ const railViews = useSessionRailViews({
110
+ allExecutions: [],
111
+ org,
112
+ sessionConfig,
113
+ selectedItem: null,
114
+ includeExecutionFacets: false,
115
+ });
116
+ // Explorer-footer folder attach (desktop only — needs the native picker).
117
+ const canAddLocalFolder = enableLocal && !!onBrowseLocalFolder;
118
+ const handleAddLocalFolder = useCallback(async () => {
119
+ const path = await onBrowseLocalFolder?.();
120
+ if (path)
121
+ flow.workspace.addLocalPath(path);
122
+ }, [onBrowseLocalFolder, flow.workspace.addLocalPath]);
123
+ const composerNode = (
124
+ // `my-auto` centers the composer vertically whether or not context is
125
+ // attached — safe-centering, not a special case: auto margins absorb free
126
+ // space when the composer is shorter than the pane and collapse to zero
127
+ // when it outgrows it, degrading to a normal top-aligned scroll. The
128
+ // scroll container's `py-6` keeps breathing room in that overflow case.
129
+ // Do NOT reintroduce a context-driven position flip: the composer must not
130
+ // move as context is attached (DD-16's layout-stability rationale — chrome
131
+ // that shifts with attached context reads as instability).
132
+ _jsx("div", { className: "flex h-full flex-col items-center overflow-y-auto px-4 py-6", children: _jsxs("div", { className: "my-auto w-full max-w-2xl space-y-6", children: [_jsx("h1", { className: "text-center text-lg font-medium text-foreground", children: heading }), _jsx(SessionComposer, { onSubmit: flow.submit, isSubmitting: flow.isSubmitting, org: org, workspace: flow.workspace, gitHubConnection: enableGitHub ? gitHubConnection : undefined, enableGitHub: enableGitHub, enableLocal: enableLocal, onBrowseLocalFolder: onBrowseLocalFolder, agentRef: flow.agentRef, onAgentRefChange: flow.setAgentRef, onAgentResolutionChange: flow.setResolution, initialAgentRef: initialAgentRef, initialInstanceId: initialInstanceId, initialAttachments: initialAttachments, lockAgent: isEndUser && initialAgentRef != null, 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, showHarnessSelector: true, harness: flow.harness, onHarnessChange: flow.setHarness, interactionMode: interactionMode, onInteractionModeChange: setInteractionMode, showInteractionModePicker: true, defaultModelId: flow.modelId, onModelChange: flow.setModelId, placeholder: placeholder, initialRows: initialRows, autoFocus: autoFocus, ariaLabel: "Start a new session" }), footerContent, _jsx("p", { className: "text-center text-[0.65rem] text-muted-foreground", children: "Press Enter to send, Shift+Enter for a new line" })] }) }));
133
+ return (_jsxs("div", { className: cn("relative flex h-full w-full flex-col", className), children: [_jsx("div", { className: "absolute top-2 right-6 z-10", children: _jsx(SessionPanelChip, { isOpen: panel.isOpen, onToggle: panel.isOpen ? panel.closePanel : panel.openPanel }) }), _jsx(ResizableSplit, { resizablePane: "primary", collapsedPane: panel.isOpen ? "none" : "secondary", defaultSize: 420, minSize: 320, maxSize: 640, storageKey: "stgm-new-session-chat-width", responsiveCollapse: panel.isOpen ? "primary" : "none", ariaLabel: "Resize composer panel", className: "min-h-0 flex-1", primary: composerNode, secondary: panel.isOpen ? (_jsx(WorkspaceSurface, { entries: flow.workspace.entries, lister: workspaceFileLister, reader: workspaceFileReader, searcher: workspaceContentSearcher, view: panel.view, onViewChange: panel.setView, extraViews: railViews, onRemoveEntry: flow.workspace.remove, onAddLocalFolder: canAddLocalFolder ? handleAddLocalFolder : undefined, editors: editors, selectedFile: activeFile, onOpenFile: panel.openFile, onActivateEditor: panel.activateEditor, onPinEditor: panel.pinEditor, onCloseEditor: panel.closeEditor, onCollapse: panel.closePanel, reveal: activeReveal, className: "h-full" })) : null })] }));
107
134
  }
108
135
  //# sourceMappingURL=NewSessionViewer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NewSessionViewer.js","sourceRoot":"","sources":["../../src/session/NewSessionViewer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAKpC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAqG3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,UAAU,g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,YAAY,EAAE,UAAU,EACxB,UAAU,EAAE,KAAK,CAAC,QAAQ,EAC1B,gBAAgB,EAAE,KAAK,CAAC,cAAc,EACtC,WAAW,EAAE,KAAK,CAAC,SAAS,EAC5B,aAAa,EAAE,KAAK,CAAC,WAAW,EAChC,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,MAAM,EAAE,YAAY,EACpB,SAAS,EAAC,QAAQ,GAClB,CACH,CAAC,CAAC,CAAC,IAAI,GAEV,IACE,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,55 @@
1
+ import type { SessionPlan } from "../library/detect-plan-artifact.js";
2
+ import type { PlanDraftController } from "./usePlanDraft.js";
3
+ /** Props for {@link PlanEditor}. */
4
+ export interface PlanEditorProps {
5
+ /** The plan to display (latest, or a superseded plan opened from its card). */
6
+ readonly plan: SessionPlan;
7
+ /**
8
+ * Draft controller owned by the viewer (survives panel collapse/unmounts).
9
+ * Consulted only when editable — a read-only (superseded) plan renders its
10
+ * own artifact text, never the current plan's draft.
11
+ */
12
+ readonly draft?: PlanDraftController;
13
+ /** Builds from the plan — the same action as the thread card's primary. */
14
+ readonly onBuildFromPlan?: () => void;
15
+ /** Disables the Build action (execution in flight, or build submitting). */
16
+ readonly buildDisabled?: boolean;
17
+ /**
18
+ * Renders the plan as a historical, read-only document: no Edit view, no
19
+ * Build action, and a "superseded" notice. Used when the user opens a plan
20
+ * that a newer plan has since replaced.
21
+ */
22
+ readonly readOnly?: boolean;
23
+ }
24
+ /**
25
+ * The plan document for the workspace surface's editor area — the wide-pane
26
+ * successor of the retired Plan sidebar facet, mounted as a virtual document
27
+ * (`SurfaceVirtualDocument`) under the {@link PLAN_DOCUMENT_ENTRY_ID} tab.
28
+ *
29
+ * Three views over one text:
30
+ * - **Rendered** — the plan as a document (same typography as the thread's
31
+ * plan rendering, title lifted from the leading H1).
32
+ * - **Source** — the raw markdown.
33
+ * - **Edit** — a plain-textarea editor over a LOCAL draft
34
+ * ({@link PlanDraftController}); the published artifact is never mutated.
35
+ * Building from an edited plan delivers the draft to the implement
36
+ * execution (edit-as-input).
37
+ *
38
+ * All views show the *effective* plan — the draft when one exists, the
39
+ * published artifact otherwise — so what the user reviews is exactly what
40
+ * Build will implement. An "Edited" indicator plus Revert makes the overlay
41
+ * visible and reversible.
42
+ *
43
+ * Editing is disabled for truncated content (the content RPC caps at 512 KB):
44
+ * editing a truncated plan would silently drop its tail on handoff. The
45
+ * document still renders read-only with the truncation notice.
46
+ *
47
+ * Holds no must-survive local state: the panel region unmounts wholesale on
48
+ * collapse, so anything that must outlive it (the draft, the fetched content
49
+ * cache) is owned above. The view pick resetting to Rendered on reopen is
50
+ * deliberate.
51
+ *
52
+ * All visual properties flow through `--stgm-*` tokens.
53
+ */
54
+ export declare function PlanEditor({ plan, draft, onBuildFromPlan, buildDisabled, readOnly, }: PlanEditorProps): import("react/jsx-runtime").JSX.Element;
55
+ //# sourceMappingURL=PlanEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlanEditor.d.ts","sourceRoot":"","sources":["../../src/session/PlanEditor.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,oCAAoC;AACpC,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC;IACrC,2EAA2E;IAC3E,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IACtC,4EAA4E;IAC5E,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,eAAe,EACf,aAAa,EACb,QAAQ,GACT,EAAE,eAAe,2CAoKjB"}
@@ -0,0 +1,88 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useMemo, useState } from "react";
4
+ import Markdown from "react-markdown";
5
+ import { cn } from "@stigmer/theme";
6
+ import { PLAN_DOCUMENT_MARKDOWN_COMPONENTS, REMARK_PLUGINS, extractLeadingH1, unwrapEnclosingMarkdownFence, } from "../internal/markdown-components.js";
7
+ import { useArtifactContent } from "../execution/useArtifactContent.js";
8
+ import { useBuildFromPlanHotkey } from "../execution/use-build-from-plan-hotkey.js";
9
+ import { formatArtifactSize } from "../execution/artifact-utils.js";
10
+ /**
11
+ * The plan document for the workspace surface's editor area — the wide-pane
12
+ * successor of the retired Plan sidebar facet, mounted as a virtual document
13
+ * (`SurfaceVirtualDocument`) under the {@link PLAN_DOCUMENT_ENTRY_ID} tab.
14
+ *
15
+ * Three views over one text:
16
+ * - **Rendered** — the plan as a document (same typography as the thread's
17
+ * plan rendering, title lifted from the leading H1).
18
+ * - **Source** — the raw markdown.
19
+ * - **Edit** — a plain-textarea editor over a LOCAL draft
20
+ * ({@link PlanDraftController}); the published artifact is never mutated.
21
+ * Building from an edited plan delivers the draft to the implement
22
+ * execution (edit-as-input).
23
+ *
24
+ * All views show the *effective* plan — the draft when one exists, the
25
+ * published artifact otherwise — so what the user reviews is exactly what
26
+ * Build will implement. An "Edited" indicator plus Revert makes the overlay
27
+ * visible and reversible.
28
+ *
29
+ * Editing is disabled for truncated content (the content RPC caps at 512 KB):
30
+ * editing a truncated plan would silently drop its tail on handoff. The
31
+ * document still renders read-only with the truncation notice.
32
+ *
33
+ * Holds no must-survive local state: the panel region unmounts wholesale on
34
+ * collapse, so anything that must outlive it (the draft, the fetched content
35
+ * cache) is owned above. The view pick resetting to Rendered on reopen is
36
+ * deliberate.
37
+ *
38
+ * All visual properties flow through `--stgm-*` tokens.
39
+ */
40
+ export function PlanEditor({ plan, draft, onBuildFromPlan, buildDisabled, readOnly, }) {
41
+ const [view, setView] = useState("rendered");
42
+ const canBuild = !readOnly && onBuildFromPlan !== undefined;
43
+ const handleKeyDown = useBuildFromPlanHotkey(canBuild ? onBuildFromPlan : undefined, buildDisabled);
44
+ const { content, isTruncated, isLoading, error, refetch } = useArtifactContent(plan.executionId, plan.artifact.storageKey, undefined, plan.artifact.contentHash);
45
+ const activeDraft = readOnly ? undefined : draft;
46
+ const effectiveText = activeDraft?.draftText ?? content;
47
+ // A read-only plan (or one without a draft controller) never offers Edit;
48
+ // a truncated plan only keeps it while an existing draft needs rescuing.
49
+ const canEdit = activeDraft !== undefined && (!isTruncated || activeDraft.isEdited);
50
+ const activeView = view === "edit" && !canEdit ? "rendered" : view;
51
+ if (isLoading) {
52
+ return (_jsx(PlanEditorFrame, { children: _jsx(PlanEditorSkeleton, {}) }));
53
+ }
54
+ if (error || effectiveText === null) {
55
+ return (_jsx(PlanEditorFrame, { children: _jsxs("div", { className: "flex flex-col items-center gap-2 px-4 py-8 text-center", children: [_jsxs("p", { className: "text-xs text-muted-foreground", children: ["Couldn\u2019t load the plan", error ? `: ${error.message}` : "."] }), _jsx("button", { type: "button", onClick: refetch, className: "rounded text-xs font-medium text-foreground underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: "Retry" })] }) }));
56
+ }
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
+ ? "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." }))] }));
60
+ }
61
+ /**
62
+ * The editor-area envelope: a centered document column so the plan reads as a
63
+ * page rather than stretching across the full pane width.
64
+ */
65
+ function PlanEditorFrame({ children, onKeyDown, }) {
66
+ return (_jsx("div", { role: "article", "aria-label": "Plan document", onKeyDown: onKeyDown, className: "mx-auto flex w-full max-w-3xl flex-col gap-3 px-4 py-3", children: children }));
67
+ }
68
+ /**
69
+ * The plan document: title lifted from the leading H1, body in the shared
70
+ * plan-document typography — identical treatment to the thread's plan
71
+ * rendering, so the plan reads the same on every surface.
72
+ */
73
+ function RenderedPlan({ text }) {
74
+ const { title, body } = useMemo(() => extractLeadingH1(unwrapEnclosingMarkdownFence(text, true)), [text]);
75
+ return (_jsxs("div", { className: "overflow-hidden rounded-lg border border-border-muted bg-card", children: [title && (_jsx("header", { className: "border-b border-border-muted bg-muted-faint px-4 py-2.5", children: _jsx("span", { className: "block truncate text-sm font-semibold text-foreground", children: title }) })), _jsx("div", { className: "stgm-prose px-4 py-4", children: _jsx(Markdown, { remarkPlugins: REMARK_PLUGINS, components: PLAN_DOCUMENT_MARKDOWN_COMPONENTS, children: body }) })] }));
76
+ }
77
+ function PlanEditorSkeleton() {
78
+ return (_jsxs("div", { className: "space-y-2 py-2", "aria-hidden": "true", children: [_jsx("div", { className: "h-8 w-full animate-pulse rounded-md bg-muted" }), _jsx("div", { className: "h-4 w-2/3 animate-pulse rounded bg-muted" }), _jsx("div", { className: "h-4 w-full animate-pulse rounded bg-muted" }), _jsx("div", { className: "h-4 w-5/6 animate-pulse rounded bg-muted" })] }));
79
+ }
80
+ function ViewTab({ active, onClick, label, disabled, title, }) {
81
+ return (_jsx("button", { type: "button", role: "tab", "aria-selected": active, onClick: onClick, disabled: disabled, title: title, className: cn("rounded px-2 py-0.5 text-[0.65rem] font-medium transition-colors", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", active
82
+ ? "bg-card text-foreground shadow-sm"
83
+ : "text-muted-foreground hover:text-foreground", "disabled:pointer-events-none disabled:opacity-50"), children: label }));
84
+ }
85
+ function ImplementIcon() {
86
+ return (_jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M2 6h8M7 3l3 3-3 3" }) }));
87
+ }
88
+ //# sourceMappingURL=PlanEditor.js.map