@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.
- package/composer/SessionComposer.d.ts +31 -0
- package/composer/SessionComposer.d.ts.map +1 -1
- package/composer/SessionComposer.js +12 -4
- package/composer/SessionComposer.js.map +1 -1
- package/execution/ArtifactApplyButton.d.ts +25 -0
- package/execution/ArtifactApplyButton.d.ts.map +1 -0
- package/execution/ArtifactApplyButton.js +21 -0
- package/execution/ArtifactApplyButton.js.map +1 -0
- package/execution/ArtifactContentBody.d.ts +36 -0
- package/execution/ArtifactContentBody.d.ts.map +1 -0
- package/execution/ArtifactContentBody.js +62 -0
- package/execution/ArtifactContentBody.js.map +1 -0
- package/execution/ArtifactDocument.d.ts +48 -0
- package/execution/ArtifactDocument.d.ts.map +1 -0
- package/execution/ArtifactDocument.js +89 -0
- package/execution/ArtifactDocument.js.map +1 -0
- package/execution/ArtifactPreviewModal.d.ts +4 -4
- package/execution/ArtifactPreviewModal.d.ts.map +1 -1
- package/execution/ArtifactPreviewModal.js +15 -142
- package/execution/ArtifactPreviewModal.js.map +1 -1
- package/execution/ArtifactRow.d.ts +49 -0
- package/execution/ArtifactRow.d.ts.map +1 -0
- package/execution/ArtifactRow.js +56 -0
- package/execution/ArtifactRow.js.map +1 -0
- package/execution/ArtifactsWidget.d.ts +6 -9
- package/execution/ArtifactsWidget.d.ts.map +1 -1
- package/execution/ArtifactsWidget.js +15 -19
- package/execution/ArtifactsWidget.js.map +1 -1
- package/execution/index.d.ts +8 -2
- package/execution/index.d.ts.map +1 -1
- package/execution/index.js +4 -1
- package/execution/index.js.map +1 -1
- package/execution/useArtifactContent.d.ts +6 -1
- package/execution/useArtifactContent.d.ts.map +1 -1
- package/execution/useArtifactContent.js +7 -2
- package/execution/useArtifactContent.js.map +1 -1
- package/execution/useArtifactInspection.d.ts +85 -0
- package/execution/useArtifactInspection.d.ts.map +1 -0
- package/execution/useArtifactInspection.js +143 -0
- package/execution/useArtifactInspection.js.map +1 -0
- package/execution/useCreateAgentExecution.d.ts +11 -0
- package/execution/useCreateAgentExecution.d.ts.map +1 -1
- package/execution/useCreateAgentExecution.js +1 -0
- package/execution/useCreateAgentExecution.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.d.ts.map +1 -1
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/internal/MermaidDiagram.d.ts +47 -0
- package/internal/MermaidDiagram.d.ts.map +1 -0
- package/internal/MermaidDiagram.js +118 -0
- package/internal/MermaidDiagram.js.map +1 -0
- package/internal/markdown-components.d.ts.map +1 -1
- package/internal/markdown-components.js +34 -0
- package/internal/markdown-components.js.map +1 -1
- package/internal/mermaid-loader.d.ts +26 -0
- package/internal/mermaid-loader.d.ts.map +1 -0
- package/internal/mermaid-loader.js +34 -0
- package/internal/mermaid-loader.js.map +1 -0
- package/internal/mermaid-theme-css.d.ts +41 -0
- package/internal/mermaid-theme-css.d.ts.map +1 -0
- package/internal/mermaid-theme-css.js +179 -0
- package/internal/mermaid-theme-css.js.map +1 -0
- package/internal/slug.d.ts +9 -5
- package/internal/slug.d.ts.map +1 -1
- package/internal/slug.js +10 -6
- package/internal/slug.js.map +1 -1
- package/package.json +5 -4
- package/session/SessionViewer.d.ts.map +1 -1
- package/session/SessionViewer.js +91 -18
- package/session/SessionViewer.js.map +1 -1
- package/session/artifact-document.d.ts +13 -0
- package/session/artifact-document.d.ts.map +1 -0
- package/session/artifact-document.js +22 -0
- package/session/artifact-document.js.map +1 -0
- package/session/facets/ArtifactsTab.d.ts +30 -4
- package/session/facets/ArtifactsTab.d.ts.map +1 -1
- package/session/facets/ArtifactsTab.js +32 -10
- package/session/facets/ArtifactsTab.js.map +1 -1
- package/session/index.d.ts +2 -1
- package/session/index.d.ts.map +1 -1
- package/session/index.js +4 -1
- package/session/index.js.map +1 -1
- package/session/useSessionArtifacts.d.ts +17 -0
- package/session/useSessionArtifacts.d.ts.map +1 -1
- package/session/useSessionArtifacts.js +16 -5
- package/session/useSessionArtifacts.js.map +1 -1
- package/session/useSessionConversation.d.ts +17 -1
- package/session/useSessionConversation.d.ts.map +1 -1
- package/session/useSessionConversation.js +32 -4
- package/session/useSessionConversation.js.map +1 -1
- package/session/useSessionPageFlow.d.ts.map +1 -1
- package/session/useSessionPageFlow.js +1 -0
- package/session/useSessionPageFlow.js.map +1 -1
- package/session/useSessionPanel.d.ts +20 -0
- package/session/useSessionPanel.d.ts.map +1 -1
- package/session/useSessionPanel.js +13 -0
- package/session/useSessionPanel.js.map +1 -1
- package/session/useSessionRailViews.d.ts +13 -1
- package/session/useSessionRailViews.d.ts.map +1 -1
- package/session/useSessionRailViews.js +5 -3
- package/session/useSessionRailViews.js.map +1 -1
- package/src/composer/SessionComposer.tsx +69 -1
- package/src/composer/__tests__/SessionComposer-editing.test.tsx +128 -0
- package/src/execution/ArtifactApplyButton.tsx +79 -0
- package/src/execution/ArtifactContentBody.tsx +255 -0
- package/src/execution/ArtifactDocument.tsx +344 -0
- package/src/execution/ArtifactPreviewModal.tsx +39 -405
- package/src/execution/ArtifactRow.tsx +165 -0
- package/src/execution/ArtifactsWidget.tsx +24 -33
- package/src/execution/__tests__/ArtifactContentBody.test.tsx +131 -0
- package/src/execution/__tests__/ArtifactDocument.test.tsx +100 -0
- package/src/execution/__tests__/ArtifactRow.test.tsx +139 -0
- package/src/execution/__tests__/ArtifactsWidget.test.tsx +78 -0
- package/src/execution/__tests__/message-entry.test.tsx +50 -2
- package/src/execution/__tests__/useArtifactInspection.test.tsx +151 -0
- package/src/execution/__tests__/useCreateAgentExecution.test.tsx +35 -0
- package/src/execution/index.ts +14 -2
- package/src/execution/useArtifactContent.ts +7 -0
- package/src/execution/useArtifactInspection.ts +252 -0
- package/src/execution/useCreateAgentExecution.ts +12 -0
- package/src/index.ts +11 -2
- package/src/internal/MermaidDiagram.tsx +164 -0
- package/src/internal/__tests__/a11y/mermaid-theme.a11y.test.tsx +122 -0
- package/src/internal/__tests__/markdown-components.test.tsx +93 -1
- package/src/internal/__tests__/mermaid-diagram.test.tsx +282 -0
- package/src/internal/markdown-components.tsx +36 -1
- package/src/internal/mermaid-loader.ts +44 -0
- package/src/internal/mermaid-theme-css.ts +178 -0
- package/src/internal/slug.ts +10 -6
- package/src/session/SessionViewer.tsx +177 -33
- package/src/session/__tests__/SessionViewer-artifactTabs.test.tsx +210 -0
- package/src/session/__tests__/SessionViewer-editResubmit.test.tsx +233 -0
- package/src/session/__tests__/useSessionArtifacts.test.ts +57 -0
- package/src/session/__tests__/useSessionConversation.test.tsx +172 -1
- package/src/session/__tests__/useSessionPanel.test.ts +70 -1
- package/src/session/artifact-document.ts +23 -0
- package/src/session/facets/ArtifactsTab.tsx +66 -18
- package/src/session/facets/__tests__/ArtifactsTab.test.tsx +111 -47
- package/src/session/index.ts +5 -1
- package/src/session/useSessionArtifacts.ts +16 -5
- package/src/session/useSessionConversation.ts +48 -6
- package/src/session/useSessionPageFlow.ts +1 -0
- package/src/session/useSessionPanel.ts +41 -0
- package/src/session/useSessionRailViews.tsx +21 -1
- package/styles.css +1 -1
- package/execution/ArtifactCard.d.ts +0 -81
- package/execution/ArtifactCard.d.ts.map +0 -1
- package/execution/ArtifactCard.js +0 -130
- package/execution/ArtifactCard.js.map +0 -1
- 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 {
|
|
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
|
}
|