@stigmer/react 3.0.9-dev.20260616060535 → 3.1.0
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/execution/ApprovalCard.d.ts +47 -3
- package/execution/ApprovalCard.d.ts.map +1 -1
- package/execution/ApprovalCard.js +138 -70
- package/execution/ApprovalCard.js.map +1 -1
- package/execution/ApprovalContext.d.ts +72 -0
- package/execution/ApprovalContext.d.ts.map +1 -0
- package/execution/ApprovalContext.js +41 -0
- package/execution/ApprovalContext.js.map +1 -0
- package/execution/ArtifactCard.d.ts.map +1 -1
- package/execution/ArtifactCard.js +3 -1
- package/execution/ArtifactCard.js.map +1 -1
- package/execution/ArtifactPreviewModal.d.ts.map +1 -1
- package/execution/ArtifactPreviewModal.js +5 -3
- package/execution/ArtifactPreviewModal.js.map +1 -1
- package/execution/EmptyChangeNotice.d.ts +38 -0
- package/execution/EmptyChangeNotice.d.ts.map +1 -0
- package/execution/EmptyChangeNotice.js +27 -0
- package/execution/EmptyChangeNotice.js.map +1 -0
- package/execution/FileChangesView.d.ts +81 -0
- package/execution/FileChangesView.d.ts.map +1 -0
- package/execution/FileChangesView.js +164 -0
- package/execution/FileChangesView.js.map +1 -0
- package/execution/FilePathLink.d.ts +24 -4
- package/execution/FilePathLink.d.ts.map +1 -1
- package/execution/FilePathLink.js +31 -9
- package/execution/FilePathLink.js.map +1 -1
- package/execution/FileReviewCard.d.ts +111 -0
- package/execution/FileReviewCard.d.ts.map +1 -0
- package/execution/FileReviewCard.js +558 -0
- package/execution/FileReviewCard.js.map +1 -0
- package/execution/FileReviewContext.d.ts +35 -0
- package/execution/FileReviewContext.d.ts.map +1 -0
- package/execution/FileReviewContext.js +23 -0
- package/execution/FileReviewContext.js.map +1 -0
- package/execution/FileReviewDock.d.ts +73 -0
- package/execution/FileReviewDock.d.ts.map +1 -0
- package/execution/FileReviewDock.js +65 -0
- package/execution/FileReviewDock.js.map +1 -0
- package/execution/McpToolDetail.d.ts.map +1 -1
- package/execution/McpToolDetail.js +38 -5
- package/execution/McpToolDetail.js.map +1 -1
- package/execution/MessageThread.d.ts +42 -3
- package/execution/MessageThread.d.ts.map +1 -1
- package/execution/MessageThread.js +263 -18
- package/execution/MessageThread.js.map +1 -1
- package/execution/PlanArtifactCard.d.ts.map +1 -1
- package/execution/PlanArtifactCard.js +3 -1
- package/execution/PlanArtifactCard.js.map +1 -1
- package/execution/PlanCompletionCard.d.ts +1 -1
- package/execution/PlanCompletionCard.js +1 -1
- package/execution/ResultView.d.ts +19 -1
- package/execution/ResultView.d.ts.map +1 -1
- package/execution/ResultView.js +141 -40
- package/execution/ResultView.js.map +1 -1
- package/execution/SubAgentSection.d.ts.map +1 -1
- package/execution/SubAgentSection.js +45 -6
- package/execution/SubAgentSection.js.map +1 -1
- package/execution/TerminalSession.d.ts +34 -0
- package/execution/TerminalSession.d.ts.map +1 -0
- package/execution/TerminalSession.js +34 -0
- package/execution/TerminalSession.js.map +1 -0
- package/execution/TodoCard.d.ts +53 -0
- package/execution/TodoCard.d.ts.map +1 -0
- package/execution/TodoCard.js +77 -0
- package/execution/TodoCard.js.map +1 -0
- package/execution/ToolArgsView.d.ts +7 -1
- package/execution/ToolArgsView.d.ts.map +1 -1
- package/execution/ToolArgsView.js +10 -9
- package/execution/ToolArgsView.js.map +1 -1
- package/execution/ToolCallDetail.d.ts +10 -1
- package/execution/ToolCallDetail.d.ts.map +1 -1
- package/execution/ToolCallDetail.js +66 -19
- package/execution/ToolCallDetail.js.map +1 -1
- package/execution/ToolCallGroup.d.ts +28 -18
- package/execution/ToolCallGroup.d.ts.map +1 -1
- package/execution/ToolCallGroup.js +39 -148
- package/execution/ToolCallGroup.js.map +1 -1
- package/execution/ToolCallItem.d.ts +36 -8
- package/execution/ToolCallItem.d.ts.map +1 -1
- package/execution/ToolCallItem.js +140 -21
- package/execution/ToolCallItem.js.map +1 -1
- package/execution/ToolRunGroup.d.ts +48 -0
- package/execution/ToolRunGroup.d.ts.map +1 -0
- package/execution/ToolRunGroup.js +168 -0
- package/execution/ToolRunGroup.js.map +1 -0
- package/execution/approval-provenance.d.ts +2 -0
- package/execution/approval-provenance.d.ts.map +1 -0
- package/execution/approval-provenance.js +6 -0
- package/execution/approval-provenance.js.map +1 -0
- package/execution/artifact-utils.d.ts +0 -10
- package/execution/artifact-utils.d.ts.map +1 -1
- package/execution/artifact-utils.js +0 -17
- package/execution/artifact-utils.js.map +1 -1
- package/execution/execution-phases.d.ts +1 -6
- package/execution/execution-phases.d.ts.map +1 -1
- package/execution/execution-phases.js +4 -14
- package/execution/execution-phases.js.map +1 -1
- package/execution/file-path-resolver.d.ts +28 -0
- package/execution/file-path-resolver.d.ts.map +1 -1
- package/execution/file-path-resolver.js +24 -0
- package/execution/file-path-resolver.js.map +1 -1
- package/execution/file-review-status.d.ts +127 -0
- package/execution/file-review-status.d.ts.map +1 -0
- package/execution/file-review-status.js +135 -0
- package/execution/file-review-status.js.map +1 -0
- package/execution/index.d.ts +39 -5
- package/execution/index.d.ts.map +1 -1
- package/execution/index.js +23 -3
- package/execution/index.js.map +1 -1
- package/execution/segment-tool-calls.d.ts +46 -0
- package/execution/segment-tool-calls.d.ts.map +1 -0
- package/execution/segment-tool-calls.js +71 -0
- package/execution/segment-tool-calls.js.map +1 -0
- package/execution/tool-categories.d.ts +62 -1
- package/execution/tool-categories.d.ts.map +1 -1
- package/execution/tool-categories.js +96 -2
- package/execution/tool-categories.js.map +1 -1
- package/execution/tool-presenter.d.ts +38 -2
- package/execution/tool-presenter.d.ts.map +1 -1
- package/execution/tool-presenter.js +23 -1
- package/execution/tool-presenter.js.map +1 -1
- package/execution/tool-rendering-primitives.d.ts.map +1 -1
- package/execution/tool-rendering-primitives.js +3 -2
- package/execution/tool-rendering-primitives.js.map +1 -1
- package/execution/useArtifactDownload.d.ts +44 -0
- package/execution/useArtifactDownload.d.ts.map +1 -0
- package/execution/useArtifactDownload.js +80 -0
- package/execution/useArtifactDownload.js.map +1 -0
- package/execution/useArtifactDownloadUrl.d.ts +67 -0
- package/execution/useArtifactDownloadUrl.d.ts.map +1 -0
- package/execution/useArtifactDownloadUrl.js +59 -0
- package/execution/useArtifactDownloadUrl.js.map +1 -0
- package/execution/useFileChangeContent.d.ts +61 -0
- package/execution/useFileChangeContent.d.ts.map +1 -0
- package/execution/useFileChangeContent.js +89 -0
- package/execution/useFileChangeContent.js.map +1 -0
- package/execution/useFileReview.d.ts +89 -0
- package/execution/useFileReview.d.ts.map +1 -0
- package/execution/useFileReview.js +106 -0
- package/execution/useFileReview.js.map +1 -0
- package/execution/useSubmitApproval.d.ts +17 -2
- package/execution/useSubmitApproval.d.ts.map +1 -1
- package/execution/useSubmitApproval.js +27 -23
- package/execution/useSubmitApproval.js.map +1 -1
- package/execution/useToolOutputContent.d.ts +44 -0
- package/execution/useToolOutputContent.d.ts.map +1 -0
- package/execution/useToolOutputContent.js +31 -0
- package/execution/useToolOutputContent.js.map +1 -0
- package/index.d.ts +6 -6
- package/index.d.ts.map +1 -1
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/internal/ApprovalPeekBar.d.ts +23 -0
- package/internal/ApprovalPeekBar.d.ts.map +1 -0
- package/internal/ApprovalPeekBar.js +25 -0
- package/internal/ApprovalPeekBar.js.map +1 -0
- package/internal/BoundedContent.d.ts +49 -0
- package/internal/BoundedContent.d.ts.map +1 -0
- package/internal/BoundedContent.js +50 -0
- package/internal/BoundedContent.js.map +1 -0
- package/internal/DecisionButton.d.ts +47 -0
- package/internal/DecisionButton.d.ts.map +1 -0
- package/internal/DecisionButton.js +42 -0
- package/internal/DecisionButton.js.map +1 -0
- package/internal/InCardDecisionError.d.ts +31 -0
- package/internal/InCardDecisionError.d.ts.map +1 -0
- package/internal/InCardDecisionError.js +23 -0
- package/internal/InCardDecisionError.js.map +1 -0
- package/internal/RevealToggle.d.ts +36 -0
- package/internal/RevealToggle.d.ts.map +1 -0
- package/internal/RevealToggle.js +32 -0
- package/internal/RevealToggle.js.map +1 -0
- package/internal/VirtualizedThread.d.ts +7 -1
- package/internal/VirtualizedThread.d.ts.map +1 -1
- package/internal/VirtualizedThread.js +7 -3
- package/internal/VirtualizedThread.js.map +1 -1
- package/internal/useAutoDisclosure.d.ts +34 -0
- package/internal/useAutoDisclosure.d.ts.map +1 -0
- package/internal/useAutoDisclosure.js +53 -0
- package/internal/useAutoDisclosure.js.map +1 -0
- package/internal/useElapsedSince.d.ts +30 -0
- package/internal/useElapsedSince.d.ts.map +1 -0
- package/internal/useElapsedSince.js +70 -0
- package/internal/useElapsedSince.js.map +1 -0
- package/internal/useIsOverflowing.d.ts +30 -0
- package/internal/useIsOverflowing.d.ts.map +1 -0
- package/internal/useIsOverflowing.js +47 -0
- package/internal/useIsOverflowing.js.map +1 -0
- package/internal/useIsTextTruncated.d.ts +24 -0
- package/internal/useIsTextTruncated.d.ts.map +1 -0
- package/internal/useIsTextTruncated.js +41 -0
- package/internal/useIsTextTruncated.js.map +1 -0
- package/internal/useKeyedSubmission.d.ts +49 -0
- package/internal/useKeyedSubmission.d.ts.map +1 -0
- package/internal/useKeyedSubmission.js +67 -0
- package/internal/useKeyedSubmission.js.map +1 -0
- package/package.json +4 -4
- package/session/SessionViewer.d.ts +2 -2
- package/session/SessionViewer.d.ts.map +1 -1
- package/session/SessionViewer.js +10 -4
- package/session/SessionViewer.js.map +1 -1
- package/session/index.d.ts +2 -0
- package/session/index.d.ts.map +1 -1
- package/session/index.js +1 -0
- package/session/index.js.map +1 -1
- package/session/inspector/ChangesTab.d.ts +8 -5
- package/session/inspector/ChangesTab.d.ts.map +1 -1
- package/session/inspector/ChangesTab.js +11 -8
- package/session/inspector/ChangesTab.js.map +1 -1
- package/session/inspector/SessionInspector.d.ts +4 -4
- package/session/inspector/SessionInspector.d.ts.map +1 -1
- package/session/inspector/SessionInspector.js +4 -4
- package/session/inspector/SessionInspector.js.map +1 -1
- package/session/inspector/index.d.ts +0 -2
- package/session/inspector/index.d.ts.map +1 -1
- package/session/inspector/index.js +0 -1
- package/session/inspector/index.js.map +1 -1
- package/session/inspector/useSessionInspector.d.ts +8 -4
- package/session/inspector/useSessionInspector.d.ts.map +1 -1
- package/session/inspector/useSessionInspector.js +27 -20
- package/session/inspector/useSessionInspector.js.map +1 -1
- package/session/useSessionConversation.d.ts +37 -3
- package/session/useSessionConversation.d.ts.map +1 -1
- package/session/useSessionConversation.js +18 -2
- package/session/useSessionConversation.js.map +1 -1
- package/session/useSessionFileChanges.d.ts +74 -0
- package/session/useSessionFileChanges.d.ts.map +1 -0
- package/session/useSessionFileChanges.js +178 -0
- package/session/useSessionFileChanges.js.map +1 -0
- package/src/__tests__/styles-border-layer-invariant.test.ts +105 -0
- package/src/execution/ApprovalCard.tsx +368 -230
- package/src/execution/ApprovalContext.ts +109 -0
- package/src/execution/ArtifactCard.tsx +10 -6
- package/src/execution/ArtifactPreviewModal.tsx +12 -6
- package/src/execution/EmptyChangeNotice.tsx +62 -0
- package/src/execution/FileChangesView.tsx +383 -0
- package/src/execution/FilePathLink.tsx +65 -12
- package/src/execution/FileReviewCard.tsx +1118 -0
- package/src/execution/FileReviewContext.ts +53 -0
- package/src/execution/FileReviewDock.tsx +157 -0
- package/src/execution/McpToolDetail.tsx +98 -32
- package/src/execution/MessageThread.tsx +374 -9
- package/src/execution/PlanArtifactCard.tsx +9 -6
- package/src/execution/PlanCompletionCard.tsx +1 -1
- package/src/execution/ResultView.tsx +333 -162
- package/src/execution/SubAgentSection.tsx +58 -11
- package/src/execution/TerminalSession.tsx +91 -0
- package/src/execution/TodoCard.tsx +186 -0
- package/src/execution/ToolArgsView.tsx +28 -17
- package/src/execution/ToolCallDetail.tsx +137 -26
- package/src/execution/ToolCallGroup.tsx +68 -296
- package/src/execution/ToolCallItem.tsx +265 -67
- package/src/execution/ToolRunGroup.tsx +302 -0
- package/src/execution/__tests__/ApprovalCard.test.tsx +395 -5
- package/src/execution/__tests__/ArtifactPreviewModal.test.tsx +0 -1
- package/src/execution/__tests__/EmptyChangeNotice.test.tsx +24 -0
- package/src/execution/__tests__/FileChangesView.test.tsx +296 -0
- package/src/execution/__tests__/FilePathLink.test.tsx +92 -0
- package/src/execution/__tests__/FileReviewCard.test.tsx +1044 -0
- package/src/execution/__tests__/FileReviewDock.test.tsx +134 -0
- package/src/execution/__tests__/McpToolDetail.test.tsx +79 -0
- package/src/execution/__tests__/MessageThread.test.tsx +324 -0
- package/src/execution/__tests__/PlanArtifactCard.test.tsx +37 -16
- package/src/execution/__tests__/ResultView.test.tsx +280 -2
- package/src/execution/__tests__/SubAgentSection.test.tsx +180 -0
- package/src/execution/__tests__/TerminalSession.test.tsx +72 -0
- package/src/execution/__tests__/TodoCard.test.tsx +102 -0
- package/src/execution/__tests__/ToolArgsView.test.tsx +48 -0
- package/src/execution/__tests__/ToolCallDetail.test.tsx +195 -0
- package/src/execution/__tests__/ToolCallGroup.test.tsx +132 -0
- package/src/execution/__tests__/ToolCallItem.test.tsx +521 -0
- package/src/execution/__tests__/ToolRunGroup.test.tsx +137 -0
- package/src/execution/__tests__/blanked-narration.test.tsx +149 -0
- package/src/execution/__tests__/buildThreadItems-approvals.test.ts +304 -0
- package/src/execution/__tests__/buildThreadItems-file-review.test.ts +331 -0
- package/src/execution/__tests__/file-path-resolver.test.ts +44 -0
- package/src/execution/__tests__/file-review-status.test.ts +343 -0
- package/src/execution/__tests__/segment-tool-calls.test.ts +124 -0
- package/src/execution/__tests__/subagent-file-review-badge.test.tsx +273 -0
- package/src/execution/__tests__/thread-keys.test.ts +195 -0
- package/src/execution/__tests__/tool-presenter.test.tsx +95 -0
- package/src/execution/__tests__/useArtifactDownload.test.tsx +67 -0
- package/src/execution/__tests__/useArtifactDownloadUrl.test.tsx +51 -0
- package/src/execution/__tests__/useFileChangeContent.test.tsx +240 -0
- package/src/execution/__tests__/useFileReview.test.tsx +236 -0
- package/src/execution/__tests__/useSubmitApproval.test.tsx +165 -0
- package/src/execution/__tests__/useToolOutputContent.test.tsx +82 -0
- package/src/execution/approval-provenance.ts +8 -0
- package/src/execution/artifact-utils.ts +0 -18
- package/src/execution/execution-phases.ts +4 -16
- package/src/execution/file-path-resolver.ts +38 -0
- package/src/execution/file-review-status.ts +219 -0
- package/src/execution/index.ts +84 -4
- package/src/execution/segment-tool-calls.ts +101 -0
- package/src/execution/tool-categories.ts +128 -1
- package/src/execution/tool-presenter.ts +58 -3
- package/src/execution/tool-rendering-primitives.tsx +11 -14
- package/src/execution/useArtifactDownload.ts +109 -0
- package/src/execution/useArtifactDownloadUrl.ts +116 -0
- package/src/execution/useFileChangeContent.ts +149 -0
- package/src/execution/useFileReview.ts +197 -0
- package/src/execution/useSubmitApproval.ts +49 -27
- package/src/execution/useToolOutputContent.ts +70 -0
- package/src/index.ts +60 -1
- package/src/internal/ApprovalPeekBar.tsx +73 -0
- package/src/internal/BoundedContent.tsx +97 -0
- package/src/internal/DecisionButton.tsx +127 -0
- package/src/internal/InCardDecisionError.tsx +47 -0
- package/src/internal/RevealToggle.tsx +91 -0
- package/src/internal/VirtualizedThread.tsx +28 -2
- package/src/internal/__tests__/ApprovalPeekBar.test.tsx +34 -0
- package/src/internal/__tests__/BoundedContent.test.tsx +92 -0
- package/src/internal/__tests__/DecisionButton.test.tsx +107 -0
- package/src/internal/__tests__/RevealToggle.test.tsx +61 -0
- package/src/internal/__tests__/useAutoDisclosure.test.ts +74 -0
- package/src/internal/__tests__/useElapsedSince.test.tsx +68 -0
- package/src/internal/__tests__/useIsOverflowing.test.ts +36 -0
- package/src/internal/__tests__/useKeyedSubmission.test.tsx +126 -0
- package/src/internal/useAutoDisclosure.ts +58 -0
- package/src/internal/useElapsedSince.ts +72 -0
- package/src/internal/useIsOverflowing.ts +61 -0
- package/src/internal/useIsTextTruncated.ts +55 -0
- package/src/internal/useKeyedSubmission.ts +101 -0
- package/src/session/SessionViewer.tsx +21 -4
- package/src/session/__tests__/SessionViewer-fileReviewDock.test.tsx +198 -0
- package/src/session/__tests__/audienceWiring.test.tsx +4 -0
- package/src/session/__tests__/useSessionFileChanges.test.ts +303 -0
- package/src/session/index.ts +3 -0
- package/src/session/inspector/ChangesTab.tsx +20 -17
- package/src/session/inspector/SessionInspector.tsx +12 -10
- package/src/session/inspector/__tests__/ArtifactsTab.test.tsx +0 -1
- package/src/session/inspector/__tests__/ChangesTab.test.tsx +38 -0
- package/src/session/inspector/__tests__/useSessionInspector.test.ts +46 -61
- package/src/session/inspector/index.ts +0 -3
- package/src/session/inspector/useSessionInspector.ts +27 -20
- package/src/session/useSessionConversation.ts +80 -3
- package/src/session/useSessionFileChanges.ts +207 -0
- package/src/styles.css +35 -10
- package/src/version-history/DiffViewer.tsx +10 -7
- package/src/version-history/UnifiedDiffView.tsx +66 -0
- package/src/version-history/__tests__/DiffViewer.test.tsx +57 -0
- package/src/version-history/__tests__/UnifiedDiffView.test.tsx +50 -0
- package/src/version-history/__tests__/computeDiff.test.ts +35 -0
- package/src/version-history/__tests__/parseUnifiedDiff.test.ts +82 -0
- package/src/version-history/computeDiff.ts +6 -37
- package/src/version-history/diff-hunks.ts +63 -0
- package/src/version-history/index.ts +1 -0
- package/src/version-history/parseUnifiedDiff.ts +34 -0
- package/src/workflow/WorkflowExecutionApprovalCard.tsx +49 -24
- package/src/workflow/WorkflowExecutionTimeline.tsx +15 -4
- package/src/workflow/WorkflowExecutionTimelineEvent.tsx +8 -3
- package/src/workflow/WorkflowExecutionViewer.tsx +72 -28
- package/src/workflow/WorkflowFileReviewList.tsx +152 -0
- package/src/workflow/WorkflowTaskApprovalCard.tsx +37 -85
- package/src/workflow/__tests__/ExecutionInspector.test.tsx +30 -2
- package/src/workflow/__tests__/WorkflowExecutionApprovalCard.test.tsx +129 -0
- package/src/workflow/__tests__/WorkflowFileReviewList.test.tsx +129 -0
- package/src/workflow/__tests__/WorkflowTaskApprovalCard.test.tsx +43 -11
- package/src/workflow/__tests__/useWorkflowExecutionActions.test.tsx +276 -0
- package/src/workflow/execution-inspector/ExecutionInspector.tsx +42 -18
- package/src/workflow/index.ts +5 -0
- package/src/workflow/useWorkflowExecutionActions.ts +177 -29
- package/styles.css +1 -1
- package/version-history/DiffViewer.d.ts.map +1 -1
- package/version-history/DiffViewer.js +9 -3
- package/version-history/DiffViewer.js.map +1 -1
- package/version-history/UnifiedDiffView.d.ts +29 -0
- package/version-history/UnifiedDiffView.d.ts.map +1 -0
- package/version-history/UnifiedDiffView.js +36 -0
- package/version-history/UnifiedDiffView.js.map +1 -0
- package/version-history/computeDiff.d.ts +3 -1
- package/version-history/computeDiff.d.ts.map +1 -1
- package/version-history/computeDiff.js +5 -35
- package/version-history/computeDiff.js.map +1 -1
- package/version-history/diff-hunks.d.ts +21 -0
- package/version-history/diff-hunks.d.ts.map +1 -0
- package/version-history/diff-hunks.js +58 -0
- package/version-history/diff-hunks.js.map +1 -0
- package/version-history/index.d.ts +1 -0
- package/version-history/index.d.ts.map +1 -1
- package/version-history/index.js +1 -0
- package/version-history/index.js.map +1 -1
- package/version-history/parseUnifiedDiff.d.ts +22 -0
- package/version-history/parseUnifiedDiff.d.ts.map +1 -0
- package/version-history/parseUnifiedDiff.js +34 -0
- package/version-history/parseUnifiedDiff.js.map +1 -0
- package/workflow/WorkflowExecutionApprovalCard.d.ts +8 -1
- package/workflow/WorkflowExecutionApprovalCard.d.ts.map +1 -1
- package/workflow/WorkflowExecutionApprovalCard.js +17 -3
- package/workflow/WorkflowExecutionApprovalCard.js.map +1 -1
- package/workflow/WorkflowExecutionTimeline.d.ts +11 -2
- package/workflow/WorkflowExecutionTimeline.d.ts.map +1 -1
- package/workflow/WorkflowExecutionTimeline.js +2 -2
- package/workflow/WorkflowExecutionTimeline.js.map +1 -1
- package/workflow/WorkflowExecutionTimelineEvent.d.ts +4 -1
- package/workflow/WorkflowExecutionTimelineEvent.d.ts.map +1 -1
- package/workflow/WorkflowExecutionTimelineEvent.js +2 -2
- package/workflow/WorkflowExecutionTimelineEvent.js.map +1 -1
- package/workflow/WorkflowExecutionViewer.d.ts.map +1 -1
- package/workflow/WorkflowExecutionViewer.js +18 -10
- package/workflow/WorkflowExecutionViewer.js.map +1 -1
- package/workflow/WorkflowFileReviewList.d.ts +46 -0
- package/workflow/WorkflowFileReviewList.d.ts.map +1 -0
- package/workflow/WorkflowFileReviewList.js +48 -0
- package/workflow/WorkflowFileReviewList.js.map +1 -0
- package/workflow/WorkflowTaskApprovalCard.d.ts +8 -1
- package/workflow/WorkflowTaskApprovalCard.d.ts.map +1 -1
- package/workflow/WorkflowTaskApprovalCard.js +12 -19
- package/workflow/WorkflowTaskApprovalCard.js.map +1 -1
- package/workflow/execution-inspector/ExecutionInspector.d.ts +21 -4
- package/workflow/execution-inspector/ExecutionInspector.d.ts.map +1 -1
- package/workflow/execution-inspector/ExecutionInspector.js +6 -3
- package/workflow/execution-inspector/ExecutionInspector.js.map +1 -1
- package/workflow/index.d.ts +1 -0
- package/workflow/index.d.ts.map +1 -1
- package/workflow/index.js +1 -0
- package/workflow/index.js.map +1 -1
- package/workflow/useWorkflowExecutionActions.d.ts +62 -4
- package/workflow/useWorkflowExecutionActions.d.ts.map +1 -1
- package/workflow/useWorkflowExecutionActions.js +94 -18
- package/workflow/useWorkflowExecutionActions.js.map +1 -1
- package/session/inspector/PlanTab.d.ts +0 -15
- package/session/inspector/PlanTab.d.ts.map +0 -1
- package/session/inspector/PlanTab.js +0 -19
- package/session/inspector/PlanTab.js.map +0 -1
- package/src/session/inspector/PlanTab.tsx +0 -31
|
@@ -10,6 +10,44 @@ import { ToolKind } from "@stigmer/sdk";
|
|
|
10
10
|
* MCP server, whose names are dynamic.
|
|
11
11
|
*/
|
|
12
12
|
export type ToolCategory = "shell" | "read" | "write" | "edit" | "delete" | "search" | "list" | "fetch" | "web-search" | "think" | "sub-agent" | "internal" | "mcp" | "unknown";
|
|
13
|
+
/**
|
|
14
|
+
* How much of a settled tool call to reveal inline by default in the thread.
|
|
15
|
+
*
|
|
16
|
+
* - `"summary"` — a compact one-line row. Used when the label + primary arg +
|
|
17
|
+
* result summary already tell the story (`Read foo.ts`, `Edit bar.ts +40 -0`,
|
|
18
|
+
* `Search … 2 matches`). The full detail is one click away.
|
|
19
|
+
* - `"preview"` — the row renders its result body **always** (no card chevron),
|
|
20
|
+
* because the one-liner cannot convey what happened so the content itself IS
|
|
21
|
+
* the information (a shell command's output, an MCP result such as a
|
|
22
|
+
* screenshot, a fetched page, a web-search answer, or an unrecognised tool's
|
|
23
|
+
* output). The body's own in-place reveal expands it beyond the height budget.
|
|
24
|
+
*
|
|
25
|
+
* This is the *disclosure* axis (how much of a result to show); it is
|
|
26
|
+
* orthogonal to {@link isRunGroupableCategory} (whether consecutive same-kind
|
|
27
|
+
* calls fold into one chip). A category can be result-rich but never folded
|
|
28
|
+
* (`shell`), or foldable but never previewed (`read`).
|
|
29
|
+
*/
|
|
30
|
+
export type ToolDisclosure = "summary" | "preview";
|
|
31
|
+
/**
|
|
32
|
+
* Returns the default inline {@link ToolDisclosure} for a presentation
|
|
33
|
+
* category. This is the headless policy behind the thread's "keep a live
|
|
34
|
+
* preview for shell/MCP/unknown, keep generic tools compact" behaviour;
|
|
35
|
+
* consumers can override per {@link ToolKind} via {@link registerToolPresenter}.
|
|
36
|
+
*/
|
|
37
|
+
export declare function defaultDisclosureForCategory(category: ToolCategory): ToolDisclosure;
|
|
38
|
+
/**
|
|
39
|
+
* Returns whether a presentation category participates in run-grouping — i.e.
|
|
40
|
+
* whether a maximal run of consecutive calls of this category folds into one
|
|
41
|
+
* collapsible chip. See {@link RUN_GROUPABLE_CATEGORIES} and `segmentToolCalls`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isRunGroupableCategory(category: ToolCategory): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Returns whether a category's primary argument is a file path — the file
|
|
46
|
+
* tools (read / write / edit / delete). These render their path filename-first
|
|
47
|
+
* via {@link FilePathLink} (full path on hover) in headers and previews, rather
|
|
48
|
+
* than as a raw, often-absolute string.
|
|
49
|
+
*/
|
|
50
|
+
export declare function isFileCategory(category: ToolCategory): boolean;
|
|
13
51
|
/** Resolved display metadata for a tool call, returned by {@link resolveToolCategory}. */
|
|
14
52
|
export interface ToolCategoryInfo {
|
|
15
53
|
/** Semantic category of the tool. */
|
|
@@ -26,6 +64,22 @@ export interface ToolCategoryInfo {
|
|
|
26
64
|
* appear in the message thread (todos are rendered through a dedicated surface).
|
|
27
65
|
*/
|
|
28
66
|
export declare function isInternalTool(toolName: string): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Returns true for a tool call the runner collapsed in place — a superseded
|
|
69
|
+
* same-turn duplicate of an approval gate.
|
|
70
|
+
*
|
|
71
|
+
* When the agent emits one resource twice in a turn and both attempts are denied,
|
|
72
|
+
* the runner overlays the FIRST as the WAITING_APPROVAL gate and blanks the
|
|
73
|
+
* redundant twin to a content-less SKIPPED row (it cannot drop it — the backend's
|
|
74
|
+
* append-only-at-identity guard forbids removing a committed tool-call id). This
|
|
75
|
+
* predicate recognizes that blanked twin so the thread renders one card, not two.
|
|
76
|
+
*
|
|
77
|
+
* The signature is precise: a SKIPPED row with no approval flag, no result, no
|
|
78
|
+
* error, and no args preview. A genuinely user-skipped tool always retains the
|
|
79
|
+
* preview/args the user reviewed before skipping, so it is never blank and is
|
|
80
|
+
* never hidden by this.
|
|
81
|
+
*/
|
|
82
|
+
export declare function isCollapsedToolCall(toolCall: ToolCall): boolean;
|
|
29
83
|
/** Maps a {@link ToolKind} to its presentation metadata. */
|
|
30
84
|
export declare function toolKindToCategoryInfo(kind: ToolKind, toolName: string): ToolCategoryInfo;
|
|
31
85
|
/**
|
|
@@ -70,8 +124,15 @@ export declare function extractPrimaryArg(toolCall: ToolCall): string | null;
|
|
|
70
124
|
* Extracts the primary argument value from a JSON string
|
|
71
125
|
* (typically `PendingApproval.argsPreview`). Returns `null` if
|
|
72
126
|
* parsing fails or the expected field is not found.
|
|
127
|
+
*
|
|
128
|
+
* When the caller has the denormalized wire `tool_kind` (as `PendingApproval`
|
|
129
|
+
* does), pass it so resolution honors the same kind that drives the label/icon —
|
|
130
|
+
* a file tool whose NAME the classifier doesn't recognize still resolves to its
|
|
131
|
+
* `path` field. This mirrors {@link extractPrimaryArg}, which uses the wire kind
|
|
132
|
+
* via `resolveToolCategoryFromCall`. Falls back to name-based resolution when
|
|
133
|
+
* the kind is unset (legacy executions).
|
|
73
134
|
*/
|
|
74
|
-
export declare function extractPrimaryArgFromPreview(toolName: string, argsPreview: string, mcpServerSlug?: string): string | null;
|
|
135
|
+
export declare function extractPrimaryArgFromPreview(toolName: string, argsPreview: string, mcpServerSlug?: string, toolKind?: ToolKind): string | null;
|
|
75
136
|
/**
|
|
76
137
|
* Extracts the file content body from a JSON `argsPreview` string
|
|
77
138
|
* for write/edit tool categories. Scans the same field names used
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-categories.d.ts","sourceRoot":"","sources":["../../src/execution/tool-categories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iEAAiE,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-categories.d.ts","sourceRoot":"","sources":["../../src/execution/tool-categories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iEAAiE,CAAC;AAGhG,OAAO,EAAE,QAAQ,EAA0C,MAAM,cAAc,CAAC;AAEhF;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GACpB,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,YAAY,GACZ,OAAO,GACP,WAAW,GACX,UAAU,GACV,KAAK,GACL,SAAS,CAAC;AAEd;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,CAAC;AAqCnD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,YAAY,GACrB,cAAc,CAEhB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAE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C1C,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,aAAa,CAAC,EAAE,MAAM,EACtB,QAAQ,CAAC,EAAE,QAAQ,GAClB,MAAM,GAAG,IAAI,CAmBf;AAWD;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,MAAM,GAClB,MAAM,GAAG,IAAI,CAef"}
|
|
@@ -1,4 +1,67 @@
|
|
|
1
|
+
import { ToolCallStatus } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
1
2
|
import { ToolKind, resolveToolKind, resolveToolKindByName } from "@stigmer/sdk";
|
|
3
|
+
/**
|
|
4
|
+
* Categories whose result is foregrounded as a persistent bounded preview by
|
|
5
|
+
* default — those for which the compact one-liner cannot convey what happened,
|
|
6
|
+
* so the output itself carries the meaning. All other categories default to
|
|
7
|
+
* `"summary"`.
|
|
8
|
+
*
|
|
9
|
+
* File edits and writes are previewed: a `+N -M` summary says how much changed
|
|
10
|
+
* but not *what* — and the change is the decision-relevant content. Surfacing a
|
|
11
|
+
* bounded diff inline (Cursor-style) is the point of a code agent. The body is
|
|
12
|
+
* height-clamped with a single in-place reveal for the rest, so density stays
|
|
13
|
+
* under control even in turns with many edits.
|
|
14
|
+
*/
|
|
15
|
+
const PREVIEW_CATEGORIES = new Set([
|
|
16
|
+
"shell",
|
|
17
|
+
"edit",
|
|
18
|
+
"write",
|
|
19
|
+
"mcp",
|
|
20
|
+
"web-search",
|
|
21
|
+
"fetch",
|
|
22
|
+
"unknown",
|
|
23
|
+
]);
|
|
24
|
+
/**
|
|
25
|
+
* Low-signal categories whose consecutive runs fold into a single collapsible
|
|
26
|
+
* "Read 5 files" chip in the thread. These are the read-only, repetitive
|
|
27
|
+
* operations whose individual rows are noise in bulk; everything else renders
|
|
28
|
+
* as a persistent row. This is the *run-grouping* axis, orthogonal to
|
|
29
|
+
* {@link ToolDisclosure} — see {@link isRunGroupableCategory}.
|
|
30
|
+
*/
|
|
31
|
+
const RUN_GROUPABLE_CATEGORIES = new Set([
|
|
32
|
+
"read",
|
|
33
|
+
"list",
|
|
34
|
+
"search",
|
|
35
|
+
]);
|
|
36
|
+
/**
|
|
37
|
+
* Returns the default inline {@link ToolDisclosure} for a presentation
|
|
38
|
+
* category. This is the headless policy behind the thread's "keep a live
|
|
39
|
+
* preview for shell/MCP/unknown, keep generic tools compact" behaviour;
|
|
40
|
+
* consumers can override per {@link ToolKind} via {@link registerToolPresenter}.
|
|
41
|
+
*/
|
|
42
|
+
export function defaultDisclosureForCategory(category) {
|
|
43
|
+
return PREVIEW_CATEGORIES.has(category) ? "preview" : "summary";
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Returns whether a presentation category participates in run-grouping — i.e.
|
|
47
|
+
* whether a maximal run of consecutive calls of this category folds into one
|
|
48
|
+
* collapsible chip. See {@link RUN_GROUPABLE_CATEGORIES} and `segmentToolCalls`.
|
|
49
|
+
*/
|
|
50
|
+
export function isRunGroupableCategory(category) {
|
|
51
|
+
return RUN_GROUPABLE_CATEGORIES.has(category);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns whether a category's primary argument is a file path — the file
|
|
55
|
+
* tools (read / write / edit / delete). These render their path filename-first
|
|
56
|
+
* via {@link FilePathLink} (full path on hover) in headers and previews, rather
|
|
57
|
+
* than as a raw, often-absolute string.
|
|
58
|
+
*/
|
|
59
|
+
export function isFileCategory(category) {
|
|
60
|
+
return (category === "read" ||
|
|
61
|
+
category === "write" ||
|
|
62
|
+
category === "edit" ||
|
|
63
|
+
category === "delete");
|
|
64
|
+
}
|
|
2
65
|
// Presentation metadata per ToolKind. Classification (name -> kind) is owned by
|
|
3
66
|
// @stigmer/sdk; this table only describes how each kind is shown. MCP and
|
|
4
67
|
// unknown are resolved dynamically (label derived from the tool name).
|
|
@@ -23,6 +86,28 @@ const KIND_DISPLAY = {
|
|
|
23
86
|
export function isInternalTool(toolName) {
|
|
24
87
|
return resolveToolKindByName(toolName) === ToolKind.TODO;
|
|
25
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Returns true for a tool call the runner collapsed in place — a superseded
|
|
91
|
+
* same-turn duplicate of an approval gate.
|
|
92
|
+
*
|
|
93
|
+
* When the agent emits one resource twice in a turn and both attempts are denied,
|
|
94
|
+
* the runner overlays the FIRST as the WAITING_APPROVAL gate and blanks the
|
|
95
|
+
* redundant twin to a content-less SKIPPED row (it cannot drop it — the backend's
|
|
96
|
+
* append-only-at-identity guard forbids removing a committed tool-call id). This
|
|
97
|
+
* predicate recognizes that blanked twin so the thread renders one card, not two.
|
|
98
|
+
*
|
|
99
|
+
* The signature is precise: a SKIPPED row with no approval flag, no result, no
|
|
100
|
+
* error, and no args preview. A genuinely user-skipped tool always retains the
|
|
101
|
+
* preview/args the user reviewed before skipping, so it is never blank and is
|
|
102
|
+
* never hidden by this.
|
|
103
|
+
*/
|
|
104
|
+
export function isCollapsedToolCall(toolCall) {
|
|
105
|
+
return (toolCall.status === ToolCallStatus.TOOL_CALL_SKIPPED &&
|
|
106
|
+
!toolCall.requiresApproval &&
|
|
107
|
+
!toolCall.result &&
|
|
108
|
+
!toolCall.error &&
|
|
109
|
+
!toolCall.argsPreview);
|
|
110
|
+
}
|
|
26
111
|
/** Maps a {@link ToolKind} to its presentation metadata. */
|
|
27
112
|
export function toolKindToCategoryInfo(kind, toolName) {
|
|
28
113
|
const entry = KIND_DISPLAY[kind];
|
|
@@ -145,15 +230,24 @@ export function extractPrimaryArg(toolCall) {
|
|
|
145
230
|
* Extracts the primary argument value from a JSON string
|
|
146
231
|
* (typically `PendingApproval.argsPreview`). Returns `null` if
|
|
147
232
|
* parsing fails or the expected field is not found.
|
|
233
|
+
*
|
|
234
|
+
* When the caller has the denormalized wire `tool_kind` (as `PendingApproval`
|
|
235
|
+
* does), pass it so resolution honors the same kind that drives the label/icon —
|
|
236
|
+
* a file tool whose NAME the classifier doesn't recognize still resolves to its
|
|
237
|
+
* `path` field. This mirrors {@link extractPrimaryArg}, which uses the wire kind
|
|
238
|
+
* via `resolveToolCategoryFromCall`. Falls back to name-based resolution when
|
|
239
|
+
* the kind is unset (legacy executions).
|
|
148
240
|
*/
|
|
149
|
-
export function extractPrimaryArgFromPreview(toolName, argsPreview, mcpServerSlug) {
|
|
241
|
+
export function extractPrimaryArgFromPreview(toolName, argsPreview, mcpServerSlug, toolKind) {
|
|
150
242
|
if (!argsPreview)
|
|
151
243
|
return null;
|
|
152
244
|
try {
|
|
153
245
|
const parsed = JSON.parse(argsPreview);
|
|
154
246
|
if (typeof parsed !== "object" || parsed === null)
|
|
155
247
|
return null;
|
|
156
|
-
const info =
|
|
248
|
+
const info = toolKind !== undefined
|
|
249
|
+
? resolveToolCategoryFromKind(toolKind, toolName, mcpServerSlug)
|
|
250
|
+
: resolveToolCategory(toolName, mcpServerSlug);
|
|
157
251
|
return extractArgValue(parsed, info.primaryArgField, info.fallbackArgFields);
|
|
158
252
|
}
|
|
159
253
|
catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-categories.js","sourceRoot":"","sources":["../../src/execution/tool-categories.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-categories.js","sourceRoot":"","sources":["../../src/execution/tool-categories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAE9F,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AA8ChF;;;;;;;;;;;GAWG;AACH,MAAM,kBAAkB,GAA8B,IAAI,GAAG,CAAe;IAC1E,OAAO;IACP,MAAM;IACN,OAAO;IACP,KAAK;IACL,YAAY;IACZ,OAAO;IACP,SAAS;CACV,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,wBAAwB,GAA8B,IAAI,GAAG,CAAe;IAChF,MAAM;IACN,MAAM;IACN,QAAQ;CACT,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,U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;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
import type { ToolCall } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
|
|
2
2
|
import { ToolKind } from "@stigmer/sdk";
|
|
3
3
|
import type { ToolResultView } from "@stigmer/sdk";
|
|
4
|
-
import type { ToolCategory } from "./tool-categories";
|
|
5
|
-
/** Optional per-kind overrides for label and
|
|
4
|
+
import type { ToolCategory, ToolDisclosure } from "./tool-categories";
|
|
5
|
+
/** Optional per-kind overrides for label, summary, disclosure, and run-grouping. */
|
|
6
6
|
export interface ToolPresenter {
|
|
7
7
|
/** Overrides the display label (e.g. "Shell" -> "Run command"). */
|
|
8
8
|
readonly label?: (toolCall: ToolCall) => string;
|
|
9
9
|
/** Overrides the one-line result summary suffix. */
|
|
10
10
|
readonly summary?: (toolCall: ToolCall, result: ToolResultView) => string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Overrides the default inline disclosure. Use to keep a noisy MCP tool
|
|
13
|
+
* compact (`() => "summary"`) or to foreground a custom tool's output
|
|
14
|
+
* (`() => "preview"`) without forking the components.
|
|
15
|
+
*/
|
|
16
|
+
readonly disclosure?: (toolCall: ToolCall, result: ToolResultView) => ToolDisclosure;
|
|
17
|
+
/**
|
|
18
|
+
* Overrides whether consecutive same-kind calls fold into one collapsible
|
|
19
|
+
* "Read 5 files" chip. Use to fold a chatty custom tool (`() => true`) or to
|
|
20
|
+
* keep a normally-folded category as standalone rows (`() => false`) without
|
|
21
|
+
* forking the thread layout. Defaults to {@link isRunGroupableCategory}.
|
|
22
|
+
*/
|
|
23
|
+
readonly runGroupable?: (toolCall: ToolCall) => boolean;
|
|
11
24
|
}
|
|
12
25
|
/**
|
|
13
26
|
* Registers a custom presenter for a {@link ToolKind}, overriding the default
|
|
@@ -34,6 +47,16 @@ export interface ToolPresenter {
|
|
|
34
47
|
export declare function registerToolPresenter(kind: ToolKind, presenter: ToolPresenter): () => void;
|
|
35
48
|
/** Returns the registered presenter for a kind, if any. */
|
|
36
49
|
export declare function getToolPresenter(kind: ToolKind): ToolPresenter | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Resolves whether a tool call participates in run-grouping, honouring a
|
|
52
|
+
* registered {@link ToolPresenter.runGroupable} override before the
|
|
53
|
+
* category default ({@link isRunGroupableCategory}).
|
|
54
|
+
*
|
|
55
|
+
* This is the non-hook twin of the `runGroupable` field in
|
|
56
|
+
* {@link useToolPresentation}, so the pure `segmentToolCalls` layout pass and
|
|
57
|
+
* the component layer share one source of truth (and honour the same override).
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveRunGroupable(toolCall: ToolCall): boolean;
|
|
37
60
|
/** The fully-resolved presentation for a tool call, returned by {@link useToolPresentation}. */
|
|
38
61
|
export interface ToolPresentation {
|
|
39
62
|
/** Harness-agnostic kind (wire field, with name fallback). */
|
|
@@ -48,6 +71,19 @@ export interface ToolPresentation {
|
|
|
48
71
|
readonly result: ToolResultView;
|
|
49
72
|
/** One-line result summary suffix for the collapsed row (e.g. "+40 -0"). */
|
|
50
73
|
readonly resultSummary: string | null;
|
|
74
|
+
/**
|
|
75
|
+
* Default inline disclosure for this tool — `"preview"` keeps a bounded,
|
|
76
|
+
* persistent preview of the result, `"summary"` keeps a compact row. The
|
|
77
|
+
* active/awaiting state can still force a row open; this is the *settled*
|
|
78
|
+
* default.
|
|
79
|
+
*/
|
|
80
|
+
readonly disclosure: ToolDisclosure;
|
|
81
|
+
/**
|
|
82
|
+
* Whether consecutive same-kind calls fold into one collapsible chip — the
|
|
83
|
+
* run-grouping axis, orthogonal to {@link disclosure}. See
|
|
84
|
+
* {@link isRunGroupableCategory}.
|
|
85
|
+
*/
|
|
86
|
+
readonly runGroupable: boolean;
|
|
51
87
|
}
|
|
52
88
|
/**
|
|
53
89
|
* Resolves the complete, render-ready presentation for a tool call.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-presenter.d.ts","sourceRoot":"","sources":["../../src/execution/tool-presenter.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iEAAiE,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAwC,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-presenter.d.ts","sourceRoot":"","sources":["../../src/execution/tool-presenter.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iEAAiE,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAwC,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAOnD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGtE,oFAAoF;AACpF,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,MAAM,CAAC;IAChD,oDAAoD;IACpD,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,KAAK,MAAM,GAAG,IAAI,CAAC;IACjF;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,KAAK,cAAc,CAAC;IACrF;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC;CACzD;AAID;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,aAAa,GACvB,MAAM,IAAI,CAUZ;AAED,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,aAAa,GAAG,SAAS,CAE1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAK/D;AAED,gGAAgG;AAChG,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,6CAA6C;IAC7C,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,4EAA4E;IAC5E,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,gBAAgB,CA4BxE"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// presentation seam.
|
|
13
13
|
import { useMemo } from "react";
|
|
14
14
|
import { resolveToolKind, normalizeToolResult } from "@stigmer/sdk";
|
|
15
|
-
import { resolveToolCategoryFromCall, extractPrimaryArg } from "./tool-categories";
|
|
15
|
+
import { resolveToolCategoryFromCall, extractPrimaryArg, defaultDisclosureForCategory, isRunGroupableCategory, } from "./tool-categories";
|
|
16
16
|
import { summarizeResultView } from "./ResultView";
|
|
17
17
|
const registry = new Map();
|
|
18
18
|
/**
|
|
@@ -53,6 +53,22 @@ export function registerToolPresenter(kind, presenter) {
|
|
|
53
53
|
export function getToolPresenter(kind) {
|
|
54
54
|
return registry.get(kind);
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Resolves whether a tool call participates in run-grouping, honouring a
|
|
58
|
+
* registered {@link ToolPresenter.runGroupable} override before the
|
|
59
|
+
* category default ({@link isRunGroupableCategory}).
|
|
60
|
+
*
|
|
61
|
+
* This is the non-hook twin of the `runGroupable` field in
|
|
62
|
+
* {@link useToolPresentation}, so the pure `segmentToolCalls` layout pass and
|
|
63
|
+
* the component layer share one source of truth (and honour the same override).
|
|
64
|
+
*/
|
|
65
|
+
export function resolveRunGroupable(toolCall) {
|
|
66
|
+
const kind = resolveToolKind(toolCall);
|
|
67
|
+
const override = registry.get(kind)?.runGroupable;
|
|
68
|
+
if (override)
|
|
69
|
+
return override(toolCall);
|
|
70
|
+
return isRunGroupableCategory(resolveToolCategoryFromCall(toolCall).category);
|
|
71
|
+
}
|
|
56
72
|
/**
|
|
57
73
|
* Resolves the complete, render-ready presentation for a tool call.
|
|
58
74
|
*
|
|
@@ -68,6 +84,10 @@ export function useToolPresentation(toolCall) {
|
|
|
68
84
|
const override = registry.get(kind);
|
|
69
85
|
const label = override?.label?.(toolCall) ?? categoryInfo.label;
|
|
70
86
|
const resultSummary = override?.summary?.(toolCall, result) ?? summarizeResultView(result);
|
|
87
|
+
const disclosure = override?.disclosure?.(toolCall, result) ??
|
|
88
|
+
defaultDisclosureForCategory(categoryInfo.category);
|
|
89
|
+
const runGroupable = override?.runGroupable?.(toolCall) ??
|
|
90
|
+
isRunGroupableCategory(categoryInfo.category);
|
|
71
91
|
return {
|
|
72
92
|
kind,
|
|
73
93
|
category: categoryInfo.category,
|
|
@@ -75,6 +95,8 @@ export function useToolPresentation(toolCall) {
|
|
|
75
95
|
primaryArg: extractPrimaryArg(toolCall),
|
|
76
96
|
result,
|
|
77
97
|
resultSummary,
|
|
98
|
+
disclosure,
|
|
99
|
+
runGroupable,
|
|
78
100
|
};
|
|
79
101
|
}, [toolCall]);
|
|
80
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-presenter.js","sourceRoot":"","sources":["../../src/execution/tool-presenter.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,2EAA2E;AAC3E,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,iFAAiF;AACjF,qBAAqB;AAErB,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAY,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,
|
|
1
|
+
{"version":3,"file":"tool-presenter.js","sourceRoot":"","sources":["../../src/execution/tool-presenter.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,2EAA2E;AAC3E,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,iFAAiF;AACjF,qBAAqB;AAErB,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAY,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAuBnD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA2B,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAAc,EACd,SAAwB;IAExB,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC9B,OAAO,GAAG,EAAE;QACV,IAAI,QAAQ,KAAK,S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,UAAU,GACd,QAAQ,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;YACxC,4BAA4B,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACtD,MAAM,YAAY,GAChB,QAAQ,EAAE,YAAY,EAAE,CAAC,QAAQ,CAAC;YAClC,sBAAsB,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEhD,OAAO;YACL,IAAI;YACJ,QAAQ,EAAE,YAAY,CAAC,QAAQ;YAC/B,KAAK;YACL,UAAU,EAAE,iBAAiB,CAAC,QAAQ,CAAC;YACvC,MAAM;YACN,aAAa;YACb,UAAU;YACV,YAAY;SACb,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-rendering-primitives.d.ts","sourceRoot":"","sources":["../../src/execution/tool-rendering-primitives.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-rendering-primitives.d.ts","sourceRoot":"","sources":["../../src/execution/tool-rendering-primitives.tsx"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAMxC,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,8BAA8B;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,oBAAoB,2CAyBlF;AAMD,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,mBAAmB,2CAwBzE;AAMD,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,yBAAyB,2CA2CjF;AAMD,0DAA0D;AAC1D,wBAAgB,YAAY,4CAkB3B;AAED,yCAAyC;AACzC,wBAAgB,aAAa,4CAqB5B;AAMD,iDAAiD;AACjD,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAM/C;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAOnD;AAED,sDAAsD;AACtD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO,CAG3E;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKlD"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { cn } from "@stigmer/theme";
|
|
5
|
+
import { RevealToggle } from "../internal/RevealToggle";
|
|
5
6
|
/**
|
|
6
7
|
* Shared truncation threshold for all collapsible tool rendering
|
|
7
8
|
* primitives. Applied consistently across detail views and approval
|
|
@@ -22,7 +23,7 @@ export function CollapsibleCode({ label, content, className }) {
|
|
|
22
23
|
const displayContent = needsTruncation && !isExpanded
|
|
23
24
|
? lines.slice(0, TRUNCATION_LINE_LIMIT).join("\n") + "\n\u2026"
|
|
24
25
|
: content;
|
|
25
|
-
return (_jsxs("div", { className: cn("space-y-1", className), children: [_jsx("span", { className: "font-medium text-muted-foreground", children: label }), _jsx("pre", { className: "max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-md border border-border bg-muted-subtle p-2 font-mono text-foreground", children: displayContent }), needsTruncation && (_jsx(
|
|
26
|
+
return (_jsxs("div", { className: cn("space-y-1", className), children: [_jsx("span", { className: "font-medium text-muted-foreground", children: label }), _jsx("pre", { className: "max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-md border border-border bg-muted-subtle p-2 font-mono text-foreground", children: displayContent }), needsTruncation && (_jsx(RevealToggle, { expanded: isExpanded, onToggle: () => setIsExpanded((v) => !v), moreLabel: `Show all ${lines.length} lines` }))] }));
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
29
|
* A bare `<pre>` element with line-based truncation. Unlike
|
|
@@ -40,7 +41,7 @@ export function CollapsiblePre({ content, className }) {
|
|
|
40
41
|
const displayContent = needsTruncation && !isExpanded
|
|
41
42
|
? lines.slice(0, TRUNCATION_LINE_LIMIT).join("\n") + "\n\u2026"
|
|
42
43
|
: content;
|
|
43
|
-
return (_jsxs(_Fragment, { children: [_jsx("pre", { className: cn("whitespace-pre-wrap break-words font-mono", className), children: displayContent }), needsTruncation && (_jsx(
|
|
44
|
+
return (_jsxs(_Fragment, { children: [_jsx("pre", { className: cn("whitespace-pre-wrap break-words font-mono", className), children: displayContent }), needsTruncation && (_jsx(RevealToggle, { expanded: isExpanded, onToggle: () => setIsExpanded((v) => !v), moreLabel: `Show all ${lines.length} lines` }))] }));
|
|
44
45
|
}
|
|
45
46
|
/**
|
|
46
47
|
* A collapsible JSON section with a chevron toggle. Initially
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-rendering-primitives.js","sourceRoot":"","sources":["../../src/execution/tool-rendering-primitives.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAE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,IAAI,CAAC,KAAK,SAAS,CAAC;AAC7D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,GAAG;SACP,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;SACnC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;SACtB,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** Return value of {@link useArtifactDownload}. */
|
|
2
|
+
export interface UseArtifactDownloadReturn {
|
|
3
|
+
/**
|
|
4
|
+
* Mint a fresh presigned URL for `storageKey` and trigger a browser
|
|
5
|
+
* download. No-op when the execution id is unknown or a download is already
|
|
6
|
+
* in flight. Resolves once the download has been initiated.
|
|
7
|
+
*
|
|
8
|
+
* @param storageKey - Storage key of the artifact to download.
|
|
9
|
+
* @param fileName - Optional suggested file name for the saved file.
|
|
10
|
+
*/
|
|
11
|
+
readonly download: (storageKey: string, fileName?: string) => Promise<void>;
|
|
12
|
+
/** `true` while a URL is being minted / the download is being initiated. */
|
|
13
|
+
readonly isDownloading: boolean;
|
|
14
|
+
/** Error from the last failed download attempt, or `null` when healthy. */
|
|
15
|
+
readonly error: Error | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Behavior hook that downloads an execution artifact on demand.
|
|
19
|
+
*
|
|
20
|
+
* Mirrors the click → mint fresh URL → browser download flow established by
|
|
21
|
+
* `WorkflowExecutionArtifactPanel`, generalized so every artifact "Download"
|
|
22
|
+
* affordance shares one implementation. The URL is minted at click time from
|
|
23
|
+
* the stable `storageKey` via `getArtifactDownloadUrl`, so it is always valid —
|
|
24
|
+
* unlike the previously persisted, short-lived URL that expired after an hour.
|
|
25
|
+
*
|
|
26
|
+
* Returns an imperative `download(storageKey, fileName?)` action rather than a
|
|
27
|
+
* URL, because a download is a user action, not render data. For rendering an
|
|
28
|
+
* image or showing a link, use {@link useArtifactDownloadUrl} instead.
|
|
29
|
+
*
|
|
30
|
+
* @param executionId - Execution that produced the artifacts, or `null` to
|
|
31
|
+
* disable (the action becomes a no-op).
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* const { download, isDownloading } = useArtifactDownload(executionId);
|
|
36
|
+
* <button onClick={() => download(artifact.storageKey, artifact.name)} disabled={isDownloading}>
|
|
37
|
+
* Download
|
|
38
|
+
* </button>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @see useArtifactDownloadUrl — declarative URL resolver (image src, links)
|
|
42
|
+
*/
|
|
43
|
+
export declare function useArtifactDownload(executionId: string | null): UseArtifactDownloadReturn;
|
|
44
|
+
//# sourceMappingURL=useArtifactDownload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useArtifactDownload.d.ts","sourceRoot":"","sources":["../../src/execution/useArtifactDownload.ts"],"names":[],"mappings":"AAQA,mDAAmD;AACnD,MAAM,WAAW,yBAAyB;IACxC;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5E,4EAA4E;IAC5E,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAEhC,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,GAAG,IAAI,GACzB,yBAAyB,CA8B3B"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { create } from "@bufbuild/protobuf";
|
|
4
|
+
import { GetArtifactDownloadUrlRequestSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/io_pb";
|
|
5
|
+
import { useStigmer } from "../hooks";
|
|
6
|
+
import { toError } from "../internal/toError";
|
|
7
|
+
/**
|
|
8
|
+
* Behavior hook that downloads an execution artifact on demand.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors the click → mint fresh URL → browser download flow established by
|
|
11
|
+
* `WorkflowExecutionArtifactPanel`, generalized so every artifact "Download"
|
|
12
|
+
* affordance shares one implementation. The URL is minted at click time from
|
|
13
|
+
* the stable `storageKey` via `getArtifactDownloadUrl`, so it is always valid —
|
|
14
|
+
* unlike the previously persisted, short-lived URL that expired after an hour.
|
|
15
|
+
*
|
|
16
|
+
* Returns an imperative `download(storageKey, fileName?)` action rather than a
|
|
17
|
+
* URL, because a download is a user action, not render data. For rendering an
|
|
18
|
+
* image or showing a link, use {@link useArtifactDownloadUrl} instead.
|
|
19
|
+
*
|
|
20
|
+
* @param executionId - Execution that produced the artifacts, or `null` to
|
|
21
|
+
* disable (the action becomes a no-op).
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const { download, isDownloading } = useArtifactDownload(executionId);
|
|
26
|
+
* <button onClick={() => download(artifact.storageKey, artifact.name)} disabled={isDownloading}>
|
|
27
|
+
* Download
|
|
28
|
+
* </button>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @see useArtifactDownloadUrl — declarative URL resolver (image src, links)
|
|
32
|
+
*/
|
|
33
|
+
export function useArtifactDownload(executionId) {
|
|
34
|
+
const stigmer = useStigmer();
|
|
35
|
+
const [isDownloading, setIsDownloading] = useState(false);
|
|
36
|
+
const [error, setError] = useState(null);
|
|
37
|
+
const download = useCallback(async (storageKey, fileName) => {
|
|
38
|
+
if (!executionId || !storageKey || isDownloading)
|
|
39
|
+
return;
|
|
40
|
+
setIsDownloading(true);
|
|
41
|
+
setError(null);
|
|
42
|
+
try {
|
|
43
|
+
const result = await stigmer.agentExecution.getArtifactDownloadUrl(create(GetArtifactDownloadUrlRequestSchema, { executionId, storageKey }));
|
|
44
|
+
if (result.downloadUrl) {
|
|
45
|
+
triggerBrowserDownload(result.downloadUrl, fileName);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
setError(toError(err));
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
setIsDownloading(false);
|
|
53
|
+
}
|
|
54
|
+
}, [executionId, stigmer, isDownloading]);
|
|
55
|
+
return useMemo(() => ({ download, isDownloading, error }), [download, isDownloading, error]);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Trigger a browser download for a URL via a transient anchor click. The
|
|
59
|
+
* `download` hint is best-effort: browsers ignore it for cross-origin URLs
|
|
60
|
+
* (e.g. R2), in which case the navigation still serves the file. Falls back to
|
|
61
|
+
* a new tab in non-DOM environments.
|
|
62
|
+
*/
|
|
63
|
+
function triggerBrowserDownload(url, fileName) {
|
|
64
|
+
if (typeof document === "undefined") {
|
|
65
|
+
if (typeof window !== "undefined") {
|
|
66
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const anchor = document.createElement("a");
|
|
71
|
+
anchor.href = url;
|
|
72
|
+
if (fileName)
|
|
73
|
+
anchor.download = fileName;
|
|
74
|
+
anchor.rel = "noopener noreferrer";
|
|
75
|
+
anchor.target = "_blank";
|
|
76
|
+
document.body.appendChild(anchor);
|
|
77
|
+
anchor.click();
|
|
78
|
+
document.body.removeChild(anchor);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=useArtifactDownload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useArtifactDownload.js","sourceRoot":"","sources":["../../src/execution/useArtifactDownload.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ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