@stigmer/react 3.1.3 → 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 (151) hide show
  1. package/composer/SessionComposer.d.ts +31 -0
  2. package/composer/SessionComposer.d.ts.map +1 -1
  3. package/composer/SessionComposer.js +12 -4
  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 +4 -4
  18. package/execution/ArtifactPreviewModal.d.ts.map +1 -1
  19. package/execution/ArtifactPreviewModal.js +15 -142
  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/index.d.ts +8 -2
  30. package/execution/index.d.ts.map +1 -1
  31. package/execution/index.js +4 -1
  32. package/execution/index.js.map +1 -1
  33. package/execution/useArtifactContent.d.ts +6 -1
  34. package/execution/useArtifactContent.d.ts.map +1 -1
  35. package/execution/useArtifactContent.js +7 -2
  36. package/execution/useArtifactContent.js.map +1 -1
  37. package/execution/useArtifactInspection.d.ts +85 -0
  38. package/execution/useArtifactInspection.d.ts.map +1 -0
  39. package/execution/useArtifactInspection.js +143 -0
  40. package/execution/useArtifactInspection.js.map +1 -0
  41. package/execution/useCreateAgentExecution.d.ts +11 -0
  42. package/execution/useCreateAgentExecution.d.ts.map +1 -1
  43. package/execution/useCreateAgentExecution.js +1 -0
  44. package/execution/useCreateAgentExecution.js.map +1 -1
  45. package/index.d.ts +3 -3
  46. package/index.d.ts.map +1 -1
  47. package/index.js +2 -2
  48. package/index.js.map +1 -1
  49. package/internal/MermaidDiagram.d.ts +47 -0
  50. package/internal/MermaidDiagram.d.ts.map +1 -0
  51. package/internal/MermaidDiagram.js +118 -0
  52. package/internal/MermaidDiagram.js.map +1 -0
  53. package/internal/markdown-components.d.ts.map +1 -1
  54. package/internal/markdown-components.js +34 -0
  55. package/internal/markdown-components.js.map +1 -1
  56. package/internal/mermaid-loader.d.ts +26 -0
  57. package/internal/mermaid-loader.d.ts.map +1 -0
  58. package/internal/mermaid-loader.js +34 -0
  59. package/internal/mermaid-loader.js.map +1 -0
  60. package/internal/mermaid-theme-css.d.ts +41 -0
  61. package/internal/mermaid-theme-css.d.ts.map +1 -0
  62. package/internal/mermaid-theme-css.js +179 -0
  63. package/internal/mermaid-theme-css.js.map +1 -0
  64. package/internal/slug.d.ts +9 -5
  65. package/internal/slug.d.ts.map +1 -1
  66. package/internal/slug.js +10 -6
  67. package/internal/slug.js.map +1 -1
  68. package/package.json +5 -4
  69. package/session/SessionViewer.d.ts.map +1 -1
  70. package/session/SessionViewer.js +91 -18
  71. package/session/SessionViewer.js.map +1 -1
  72. package/session/artifact-document.d.ts +13 -0
  73. package/session/artifact-document.d.ts.map +1 -0
  74. package/session/artifact-document.js +22 -0
  75. package/session/artifact-document.js.map +1 -0
  76. package/session/facets/ArtifactsTab.d.ts +30 -4
  77. package/session/facets/ArtifactsTab.d.ts.map +1 -1
  78. package/session/facets/ArtifactsTab.js +32 -10
  79. package/session/facets/ArtifactsTab.js.map +1 -1
  80. package/session/index.d.ts +2 -1
  81. package/session/index.d.ts.map +1 -1
  82. package/session/index.js +4 -1
  83. package/session/index.js.map +1 -1
  84. package/session/useSessionArtifacts.d.ts +17 -0
  85. package/session/useSessionArtifacts.d.ts.map +1 -1
  86. package/session/useSessionArtifacts.js +16 -5
  87. package/session/useSessionArtifacts.js.map +1 -1
  88. package/session/useSessionConversation.d.ts +17 -1
  89. package/session/useSessionConversation.d.ts.map +1 -1
  90. package/session/useSessionConversation.js +32 -4
  91. package/session/useSessionConversation.js.map +1 -1
  92. package/session/useSessionPageFlow.d.ts.map +1 -1
  93. package/session/useSessionPageFlow.js +1 -0
  94. package/session/useSessionPageFlow.js.map +1 -1
  95. package/session/useSessionPanel.d.ts +20 -0
  96. package/session/useSessionPanel.d.ts.map +1 -1
  97. package/session/useSessionPanel.js +13 -0
  98. package/session/useSessionPanel.js.map +1 -1
  99. package/session/useSessionRailViews.d.ts +13 -1
  100. package/session/useSessionRailViews.d.ts.map +1 -1
  101. package/session/useSessionRailViews.js +5 -3
  102. package/session/useSessionRailViews.js.map +1 -1
  103. package/src/composer/SessionComposer.tsx +69 -1
  104. package/src/composer/__tests__/SessionComposer-editing.test.tsx +128 -0
  105. package/src/execution/ArtifactApplyButton.tsx +79 -0
  106. package/src/execution/ArtifactContentBody.tsx +255 -0
  107. package/src/execution/ArtifactDocument.tsx +344 -0
  108. package/src/execution/ArtifactPreviewModal.tsx +39 -405
  109. package/src/execution/ArtifactRow.tsx +165 -0
  110. package/src/execution/ArtifactsWidget.tsx +24 -33
  111. package/src/execution/__tests__/ArtifactContentBody.test.tsx +131 -0
  112. package/src/execution/__tests__/ArtifactDocument.test.tsx +100 -0
  113. package/src/execution/__tests__/ArtifactRow.test.tsx +139 -0
  114. package/src/execution/__tests__/ArtifactsWidget.test.tsx +78 -0
  115. package/src/execution/__tests__/message-entry.test.tsx +50 -2
  116. package/src/execution/__tests__/useArtifactInspection.test.tsx +151 -0
  117. package/src/execution/__tests__/useCreateAgentExecution.test.tsx +35 -0
  118. package/src/execution/index.ts +14 -2
  119. package/src/execution/useArtifactContent.ts +7 -0
  120. package/src/execution/useArtifactInspection.ts +252 -0
  121. package/src/execution/useCreateAgentExecution.ts +12 -0
  122. package/src/index.ts +11 -2
  123. package/src/internal/MermaidDiagram.tsx +164 -0
  124. package/src/internal/__tests__/a11y/mermaid-theme.a11y.test.tsx +122 -0
  125. package/src/internal/__tests__/markdown-components.test.tsx +93 -1
  126. package/src/internal/__tests__/mermaid-diagram.test.tsx +282 -0
  127. package/src/internal/markdown-components.tsx +36 -1
  128. package/src/internal/mermaid-loader.ts +44 -0
  129. package/src/internal/mermaid-theme-css.ts +178 -0
  130. package/src/internal/slug.ts +10 -6
  131. package/src/session/SessionViewer.tsx +177 -33
  132. package/src/session/__tests__/SessionViewer-artifactTabs.test.tsx +210 -0
  133. package/src/session/__tests__/SessionViewer-editResubmit.test.tsx +233 -0
  134. package/src/session/__tests__/useSessionArtifacts.test.ts +57 -0
  135. package/src/session/__tests__/useSessionConversation.test.tsx +172 -1
  136. package/src/session/__tests__/useSessionPanel.test.ts +70 -1
  137. package/src/session/artifact-document.ts +23 -0
  138. package/src/session/facets/ArtifactsTab.tsx +66 -18
  139. package/src/session/facets/__tests__/ArtifactsTab.test.tsx +111 -47
  140. package/src/session/index.ts +5 -1
  141. package/src/session/useSessionArtifacts.ts +16 -5
  142. package/src/session/useSessionConversation.ts +48 -6
  143. package/src/session/useSessionPageFlow.ts +1 -0
  144. package/src/session/useSessionPanel.ts +41 -0
  145. package/src/session/useSessionRailViews.tsx +21 -1
  146. package/styles.css +1 -1
  147. package/execution/ArtifactCard.d.ts +0 -81
  148. package/execution/ArtifactCard.d.ts.map +0 -1
  149. package/execution/ArtifactCard.js +0 -130
  150. package/execution/ArtifactCard.js.map +0 -1
  151. package/src/execution/ArtifactCard.tsx +0 -320
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
4
4
  import type { ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
5
+ import type { ExecutionArtifact } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/artifact_pb";
5
6
  import { isTerminalPhase } from "../execution/execution-phases.js";
6
7
  import type { SelectedThreadItem } from "../internal/store/selection-store.js";
7
8
  import {
@@ -10,6 +11,8 @@ import {
10
11
  type WorkspaceEditorsStore,
11
12
  } from "../internal/store/index.js";
12
13
  import { PLAN_DOCUMENT_ENTRY_ID, PLAN_DOCUMENT_PATH } from "./plan-document.js";
14
+ import { ARTIFACT_DOCUMENT_ENTRY_ID } from "./artifact-document.js";
15
+ import { artifactKey } from "./useSessionArtifacts.js";
13
16
 
14
17
  /** Options for {@link useSessionPanel}. */
15
18
  export interface UseSessionPanelOptions {
@@ -118,6 +121,25 @@ export interface SessionPanelController {
118
121
  * both when a plan STARTS STREAMING and when it publishes (see `planKey`).
119
122
  */
120
123
  readonly openPlanDocument: () => void;
124
+ /**
125
+ * Open (or focus) an artifact as an editor-pane document tab and expand the
126
+ * panel. Uses the PREVIEW slot — like files and content-search hits, casual
127
+ * artifact browsing reuses one tab (single-click), and double-clicking the
128
+ * tab pins it. Distinct from `openPlanDocument`, which pins its single tab: a
129
+ * plan is the turn's deliverable, artifacts are browsable outputs. The
130
+ * artifact's {@link artifactKey} is the tab identity, shared with the
131
+ * `SurfaceVirtualDocument` the viewer builds for the open tab.
132
+ */
133
+ readonly openArtifact: (artifact: ExecutionArtifact) => void;
134
+ /**
135
+ * Pin an artifact's tab (clear its preview state) — the double-click half of
136
+ * the open/activate split, the encapsulated sibling of {@link openArtifact}.
137
+ * Delegates to the editors store's generic `pin`, exactly as the file tree
138
+ * pins via `pinEditor`: the leading single-click of the double-click has
139
+ * already opened the preview tab, so this promotes it to a persistent tab. A
140
+ * no-op if the artifact is not open.
141
+ */
142
+ readonly pinArtifact: (artifact: ExecutionArtifact) => void;
121
143
  /**
122
144
  * Report the current thread-item selection. Called from an effect inside the
123
145
  * panel subtree (the level that subscribes to the selection store), keeping
@@ -224,6 +246,21 @@ export function useSessionPanel({
224
246
  [editorsStore],
225
247
  );
226
248
 
249
+ const openArtifact = useCallback(
250
+ (artifact: ExecutionArtifact) => {
251
+ editorsStore.openPreview(ARTIFACT_DOCUMENT_ENTRY_ID, artifactKey(artifact));
252
+ setIsOpen(true);
253
+ },
254
+ [editorsStore],
255
+ );
256
+
257
+ const pinArtifact = useCallback(
258
+ (artifact: ExecutionArtifact) => {
259
+ editorsStore.pin(ARTIFACT_DOCUMENT_ENTRY_ID, artifactKey(artifact));
260
+ },
261
+ [editorsStore],
262
+ );
263
+
227
264
  const activateEditor = useCallback(
228
265
  (entryId: string, path: string) => editorsStore.activate(entryId, path),
229
266
  [editorsStore],
@@ -268,6 +305,8 @@ export function useSessionPanel({
268
305
  pinEditor,
269
306
  closeEditor,
270
307
  openPlanDocument,
308
+ openArtifact,
309
+ pinArtifact,
271
310
  notifySelection,
272
311
  }),
273
312
  [
@@ -282,6 +321,8 @@ export function useSessionPanel({
282
321
  pinEditor,
283
322
  closeEditor,
284
323
  openPlanDocument,
324
+ openArtifact,
325
+ pinArtifact,
285
326
  notifySelection,
286
327
  ],
287
328
  );
@@ -6,7 +6,10 @@ import type { SurfaceRailView } from "../workspace/WorkspaceSurface.js";
6
6
  import type { SelectedThreadItem } from "../internal/store/selection-store.js";
7
7
  import type { ApplyResourceResult } from "../library/useApplyResource.js";
8
8
  import { useSessionWriteBacks } from "./useSessionWriteBacks.js";
9
- import { useSessionArtifacts } from "./useSessionArtifacts.js";
9
+ import {
10
+ useSessionArtifacts,
11
+ type SessionArtifactEntry,
12
+ } from "./useSessionArtifacts.js";
10
13
  import { SetupTab, type SetupTabProps } from "./facets/SetupTab.js";
11
14
  import { ChangesTab } from "./facets/ChangesTab.js";
12
15
  import { ArtifactsTab } from "./facets/ArtifactsTab.js";
@@ -33,6 +36,17 @@ export interface UseSessionRailViewsOptions {
33
36
  * of the preview modal.
34
37
  */
35
38
  readonly onOpenPlan?: (executionId: string) => void;
39
+ /**
40
+ * Open a (non-plan) artifact as an editor-pane document tab. Routed to the
41
+ * Artifacts facet so clicking an artifact opens it in the editor area (VS
42
+ * Code "each file is a tab") instead of the preview modal.
43
+ */
44
+ readonly onOpenArtifact?: (entry: SessionArtifactEntry) => void;
45
+ /**
46
+ * Pin a (non-plan) artifact's document tab — the double-click half of the
47
+ * Artifacts facet's open/activate split. Routed through to the facet's rows.
48
+ */
49
+ readonly onActivateArtifact?: (entry: SessionArtifactEntry) => void;
36
50
  /**
37
51
  * Whether to offer the execution-derived facets (Changes / Artifacts /
38
52
  * Usage). The launcher passes `false` — before a session exists there are no
@@ -60,6 +74,8 @@ export function useSessionRailViews({
60
74
  onApplied,
61
75
  onImplementPlan,
62
76
  onOpenPlan,
77
+ onOpenArtifact,
78
+ onActivateArtifact,
63
79
  includeExecutionFacets = true,
64
80
  }: UseSessionRailViewsOptions): readonly SurfaceRailView[] {
65
81
  const { hasWriteBacks, writeBackCount } = useSessionWriteBacks(allExecutions);
@@ -101,6 +117,8 @@ export function useSessionRailViews({
101
117
  onApplied={onApplied}
102
118
  onImplementPlan={onImplementPlan}
103
119
  onOpenPlan={onOpenPlan}
120
+ onOpenArtifact={onOpenArtifact}
121
+ onActivateArtifact={onActivateArtifact}
104
122
  />
105
123
  ),
106
124
  });
@@ -136,6 +154,8 @@ export function useSessionRailViews({
136
154
  onApplied,
137
155
  onImplementPlan,
138
156
  onOpenPlan,
157
+ onOpenArtifact,
158
+ onActivateArtifact,
139
159
  selectedItem,
140
160
  ]);
141
161
  }