@stigmer/react 3.0.9-dev.20260615153829 → 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/code-highlight.d.ts +24 -0
- package/internal/code-highlight.d.ts.map +1 -0
- package/internal/code-highlight.js +115 -0
- package/internal/code-highlight.js.map +1 -0
- package/internal/markdown-components.d.ts.map +1 -1
- package/internal/markdown-components.js +13 -2
- package/internal/markdown-components.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 +7 -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__/ArtifactContentRenderer.test.tsx +15 -0
- 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__/message-entry.test.tsx +16 -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__/code-highlight.test.tsx +59 -0
- package/src/internal/__tests__/markdown-components.test.tsx +68 -2
- 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/code-highlight.tsx +120 -0
- package/src/internal/markdown-components.tsx +20 -3
- 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 +123 -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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AClB,OAAO,CACL,cACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,SAAS,EAAC,cAAc,iBACZ,MAAM,YAElB,eAAM,CAAC,EAAC,4BAA4B,EAAC,aAAa,EAAC,OAAO,GAAG,GACzD,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Props for {@link InCardDecisionError}. */
|
|
2
|
+
export interface InCardDecisionErrorProps {
|
|
3
|
+
/** The failure to surface. Its `message` is shown verbatim (the actionable part). */
|
|
4
|
+
readonly error: Error;
|
|
5
|
+
/**
|
|
6
|
+
* The verb phrase completing "Couldn't ___" — e.g. `"submit decision"` or
|
|
7
|
+
* `"save"`. Kept short; the server `message` carries the detail.
|
|
8
|
+
*/
|
|
9
|
+
readonly leadIn: string;
|
|
10
|
+
/** Stable hook for e2e/visual targeting (`data-cursor-target`). */
|
|
11
|
+
readonly cursorTarget: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The shared in-card failure notice for a decision that did not take — used by
|
|
15
|
+
* every decision surface that surfaces errors beside the control that failed:
|
|
16
|
+
* the agent tool gate ({@link ApprovalCard}/{@link ApprovalCardBody}) and the
|
|
17
|
+
* file-review card ({@link FileReviewCard}, whole-set and per-file).
|
|
18
|
+
*
|
|
19
|
+
* One source of truth so those surfaces can never drift in tone, copy shape, or
|
|
20
|
+
* accessibility. `role="alert"` (matching the thread's other inline failures)
|
|
21
|
+
* announces it the moment it appears, since it is a dynamic reaction to the
|
|
22
|
+
* reviewer's action — by the time it renders the optimistic verdict has already
|
|
23
|
+
* reverted, and this explains why. The server `message` is shown verbatim
|
|
24
|
+
* because it is the actionable part (e.g. a digest mismatch means the captured
|
|
25
|
+
* content moved on); the lead-in stays short. Every visual property flows
|
|
26
|
+
* through `--stgm-*` tokens.
|
|
27
|
+
*
|
|
28
|
+
* @internal Not part of the public API.
|
|
29
|
+
*/
|
|
30
|
+
export declare function InCardDecisionError({ error, leadIn, cursorTarget, }: InCardDecisionErrorProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
//# sourceMappingURL=InCardDecisionError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InCardDecisionError.d.ts","sourceRoot":"","sources":["../../src/internal/InCardDecisionError.tsx"],"names":[],"mappings":"AAEA,6CAA6C;AAC7C,MAAM,WAAW,wBAAwB;IACvC,qFAAqF;IACrF,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,MAAM,EACN,YAAY,GACb,EAAE,wBAAwB,2CAU1B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* The shared in-card failure notice for a decision that did not take — used by
|
|
5
|
+
* every decision surface that surfaces errors beside the control that failed:
|
|
6
|
+
* the agent tool gate ({@link ApprovalCard}/{@link ApprovalCardBody}) and the
|
|
7
|
+
* file-review card ({@link FileReviewCard}, whole-set and per-file).
|
|
8
|
+
*
|
|
9
|
+
* One source of truth so those surfaces can never drift in tone, copy shape, or
|
|
10
|
+
* accessibility. `role="alert"` (matching the thread's other inline failures)
|
|
11
|
+
* announces it the moment it appears, since it is a dynamic reaction to the
|
|
12
|
+
* reviewer's action — by the time it renders the optimistic verdict has already
|
|
13
|
+
* reverted, and this explains why. The server `message` is shown verbatim
|
|
14
|
+
* because it is the actionable part (e.g. a digest mismatch means the captured
|
|
15
|
+
* content moved on); the lead-in stays short. Every visual property flows
|
|
16
|
+
* through `--stgm-*` tokens.
|
|
17
|
+
*
|
|
18
|
+
* @internal Not part of the public API.
|
|
19
|
+
*/
|
|
20
|
+
export function InCardDecisionError({ error, leadIn, cursorTarget, }) {
|
|
21
|
+
return (_jsxs("p", { role: "alert", className: "text-[11px] text-destructive", "data-cursor-target": cursorTarget, children: ["Couldn\u2019t ", leadIn, " \u2014 ", error.message] }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=InCardDecisionError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InCardDecisionError.js","sourceRoot":"","sources":["../../src/internal/InCardDecisionError.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAeb;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,KAAK,EACL,MAAM,EACN,YAAY,GACa;IACzB,OAAO,CACL,aACE,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,8BAA8B,wBACpB,YAAY,+BAEhB,MAAM,cAAK,KAAK,CAAC,OAAO,IACtC,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Props for {@link RevealToggle}. */
|
|
2
|
+
export interface RevealToggleProps {
|
|
3
|
+
/** Whether the governed content is currently fully revealed. */
|
|
4
|
+
readonly expanded: boolean;
|
|
5
|
+
/** Flips the reveal state. */
|
|
6
|
+
readonly onToggle: () => void;
|
|
7
|
+
/** Label shown while collapsed. Defaults to `"Show more"`. */
|
|
8
|
+
readonly moreLabel?: string;
|
|
9
|
+
/** Label shown while expanded. Defaults to `"Show less"`. */
|
|
10
|
+
readonly lessLabel?: string;
|
|
11
|
+
/** Stable hook for e2e/visual targeting (`data-cursor-target`). */
|
|
12
|
+
readonly cursorTarget?: string;
|
|
13
|
+
/** Additional CSS class names for the control. */
|
|
14
|
+
readonly className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The single "reveal more / less" control for every bounded block on the
|
|
18
|
+
* execution surface — the diff/gate clamp ({@link BoundedContent}) and the
|
|
19
|
+
* line-count text/terminal blocks ({@link CollapsiblePre} / {@link
|
|
20
|
+
* CollapsibleCode}).
|
|
21
|
+
*
|
|
22
|
+
* It is the Cursor-style affordance the design calls for: a light, centered
|
|
23
|
+
* chevron at the bottom-middle (down to reveal, up to collapse) with a quiet
|
|
24
|
+
* label. Extracting it is what guarantees one disclosure *language* across two
|
|
25
|
+
* truncation *mechanisms* (pixel clamp for visual blocks, line count for text)
|
|
26
|
+
* — the surfaces can never visually drift because they render the same control.
|
|
27
|
+
*
|
|
28
|
+
* Presentational only: it owns no state. The caller holds the reveal state and
|
|
29
|
+
* passes `expanded` + `onToggle`. It carries `aria-expanded` for the block it
|
|
30
|
+
* governs; the owning tool-call row's header chevron (when present) carries the
|
|
31
|
+
* row-level disclosure, so the two axes never collide.
|
|
32
|
+
*
|
|
33
|
+
* @internal Not part of the public API.
|
|
34
|
+
*/
|
|
35
|
+
export declare function RevealToggle({ expanded, onToggle, moreLabel, lessLabel, cursorTarget, className, }: RevealToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
//# sourceMappingURL=RevealToggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RevealToggle.d.ts","sourceRoot":"","sources":["../../src/internal/RevealToggle.tsx"],"names":[],"mappings":"AAIA,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,8BAA8B;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,kDAAkD;IAClD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,QAAQ,EACR,SAAuB,EACvB,SAAuB,EACvB,YAAY,EACZ,SAAS,GACV,EAAE,iBAAiB,2CAkBnB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@stigmer/theme";
|
|
4
|
+
/**
|
|
5
|
+
* The single "reveal more / less" control for every bounded block on the
|
|
6
|
+
* execution surface — the diff/gate clamp ({@link BoundedContent}) and the
|
|
7
|
+
* line-count text/terminal blocks ({@link CollapsiblePre} / {@link
|
|
8
|
+
* CollapsibleCode}).
|
|
9
|
+
*
|
|
10
|
+
* It is the Cursor-style affordance the design calls for: a light, centered
|
|
11
|
+
* chevron at the bottom-middle (down to reveal, up to collapse) with a quiet
|
|
12
|
+
* label. Extracting it is what guarantees one disclosure *language* across two
|
|
13
|
+
* truncation *mechanisms* (pixel clamp for visual blocks, line count for text)
|
|
14
|
+
* — the surfaces can never visually drift because they render the same control.
|
|
15
|
+
*
|
|
16
|
+
* Presentational only: it owns no state. The caller holds the reveal state and
|
|
17
|
+
* passes `expanded` + `onToggle`. It carries `aria-expanded` for the block it
|
|
18
|
+
* governs; the owning tool-call row's header chevron (when present) carries the
|
|
19
|
+
* row-level disclosure, so the two axes never collide.
|
|
20
|
+
*
|
|
21
|
+
* @internal Not part of the public API.
|
|
22
|
+
*/
|
|
23
|
+
export function RevealToggle({ expanded, onToggle, moreLabel = "Show more", lessLabel = "Show less", cursorTarget, className, }) {
|
|
24
|
+
return (_jsxs("button", { type: "button", onClick: onToggle, "aria-expanded": expanded, "data-cursor-target": cursorTarget, className: cn("mt-1 flex w-full items-center justify-center gap-1 rounded py-0.5", "text-xs font-medium text-muted-foreground transition-colors hover:text-foreground", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className), children: [_jsx("span", { children: expanded ? lessLabel : moreLabel }), _jsx(ChevronIcon, { expanded: expanded })] }));
|
|
25
|
+
}
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
// Inline SVG icon
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
function ChevronIcon({ expanded }) {
|
|
30
|
+
return (_jsx("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", className: cn("shrink-0 transition-transform duration-150", expanded && "rotate-180"), "aria-hidden": "true", children: _jsx("path", { d: "M2.5 3.5L5 6.5L7.5 3.5" }) }));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=RevealToggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RevealToggle.js","sourceRoot":"","sources":["../../src/internal/RevealToggle.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAkBpC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,QAAQ,EACR,QAAQ,EACR,SAAS,GAAG,WAAW,EACvB,SAAS,GAAG,WAAW,EACvB,YAAY,EACZ,SAAS,GACS;IAClB,OAAO,CACL,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,QAAQ,mBACF,QAAQ,wBACH,YAAY,EAChC,SAAS,EAAE,EAAE,CACX,mEAAmE,EACnE,mFAAmF,EACnF,yEAAyE,EACzE,SAAS,CACV,aAED,yBAAO,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,GAAQ,EAC/C,KAAC,WAAW,IAAC,QAAQ,EAAE,QAAQ,GAAI,IAC5B,CACV,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E,SAAS,WAAW,CAAC,EAAE,QAAQ,EAAyB;IACtD,OAAO,CACL,cACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,SAAS,EAAE,EAAE,CACX,4CAA4C,EAC5C,QAAQ,IAAI,YAAY,CACzB,iBACW,MAAM,YAElB,eAAM,CAAC,EAAC,wBAAwB,GAAG,GAC/B,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -3,13 +3,19 @@ import { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecutio
|
|
|
3
3
|
import { type ThreadItem } from "../execution/MessageThread";
|
|
4
4
|
import { type FilePathContextValue } from "../execution/FilePathContext";
|
|
5
5
|
import { type SandboxContextValue } from "../execution/SandboxContext";
|
|
6
|
+
import { type ApprovalContextValue } from "../execution/ApprovalContext";
|
|
7
|
+
import { type FileReviewContextValue } from "../execution/FileReviewContext";
|
|
6
8
|
export interface VirtualizedThreadProps {
|
|
7
9
|
readonly items: readonly ThreadItem[];
|
|
8
10
|
readonly formatToolCallSummary?: (toolCalls: readonly ToolCall[]) => string;
|
|
9
11
|
readonly onApprovalSubmit?: (toolCallId: string, action: ApprovalAction, comment?: string) => void;
|
|
10
12
|
readonly submittingApprovalIds?: ReadonlySet<string>;
|
|
13
|
+
readonly approvalErrors?: ReadonlyMap<string, Error>;
|
|
11
14
|
readonly filePathCtx: FilePathContextValue;
|
|
12
15
|
readonly sandboxCtx: SandboxContextValue;
|
|
16
|
+
readonly approvalCtx: ApprovalContextValue;
|
|
17
|
+
readonly fileReviewCtx: FileReviewContextValue;
|
|
18
|
+
readonly unresolvedApprovalCount: number;
|
|
13
19
|
readonly onBuildFromPlan?: () => void;
|
|
14
20
|
readonly org?: string;
|
|
15
21
|
readonly planActionsDisabled?: boolean;
|
|
@@ -28,5 +34,5 @@ export interface VirtualizedThreadProps {
|
|
|
28
34
|
*
|
|
29
35
|
* @internal
|
|
30
36
|
*/
|
|
31
|
-
export declare function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, filePathCtx, sandboxCtx, onBuildFromPlan, org, planActionsDisabled, centerContent, onRetrySend, onRetryExecution, onEditMessage, }: VirtualizedThreadProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, approvalErrors, filePathCtx, sandboxCtx, approvalCtx, fileReviewCtx, unresolvedApprovalCount, onBuildFromPlan, org, planActionsDisabled, centerContent, onRetrySend, onRetryExecution, onEditMessage, }: VirtualizedThreadProps): import("react/jsx-runtime").JSX.Element;
|
|
32
38
|
//# sourceMappingURL=VirtualizedThread.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedThread.d.ts","sourceRoot":"","sources":["../../src/internal/VirtualizedThread.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iEAAiE,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAC9F,OAAO,EAEL,KAAK,UAAU,EAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"VirtualizedThread.d.ts","sourceRoot":"","sources":["../../src/internal/VirtualizedThread.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iEAAiE,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAC9F,OAAO,EAEL,KAAK,UAAU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,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAuCD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,GAAG,EACH,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,aAAa,GACd,EAAE,sBAAsB,2CAuFxB"}
|
|
@@ -6,8 +6,11 @@ import { cn } from "@stigmer/theme";
|
|
|
6
6
|
import { ThreadItemRenderer, } from "../execution/MessageThread";
|
|
7
7
|
import { FilePathContext } from "../execution/FilePathContext";
|
|
8
8
|
import { SandboxContext } from "../execution/SandboxContext";
|
|
9
|
+
import { ApprovalContext } from "../execution/ApprovalContext";
|
|
10
|
+
import { FileReviewContext } from "../execution/FileReviewContext";
|
|
9
11
|
import { DevProfiler, useDomNodeCount } from "./dev";
|
|
10
12
|
import { JumpToLatestButton } from "./JumpToLatestButton";
|
|
13
|
+
import { ApprovalPeekBar } from "./ApprovalPeekBar";
|
|
11
14
|
import { ThreadItemWrapper } from "./ThreadItemWrapper";
|
|
12
15
|
// ---------------------------------------------------------------------------
|
|
13
16
|
// Scrollbar classes shared with the non-virtualized path
|
|
@@ -33,7 +36,7 @@ const NEAR_BOTTOM_THRESHOLD_PX = 80;
|
|
|
33
36
|
*
|
|
34
37
|
* @internal
|
|
35
38
|
*/
|
|
36
|
-
export function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, filePathCtx, sandboxCtx, onBuildFromPlan, org, planActionsDisabled, centerContent, onRetrySend, onRetryExecution, onEditMessage, }) {
|
|
39
|
+
export function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, approvalErrors, filePathCtx, sandboxCtx, approvalCtx, fileReviewCtx, unresolvedApprovalCount, onBuildFromPlan, org, planActionsDisabled, centerContent, onRetrySend, onRetryExecution, onEditMessage, }) {
|
|
37
40
|
const virtuosoRef = useRef(null);
|
|
38
41
|
const scrollerRef = useRef(null);
|
|
39
42
|
const [isAtBottom, setIsAtBottom] = useState(true);
|
|
@@ -52,13 +55,14 @@ export function VirtualizedThread({ items, formatToolCallSummary, onApprovalSubm
|
|
|
52
55
|
formatToolCallSummary,
|
|
53
56
|
onApprovalSubmit,
|
|
54
57
|
submittingApprovalIds,
|
|
58
|
+
approvalErrors,
|
|
55
59
|
onBuildFromPlan,
|
|
56
60
|
org,
|
|
57
61
|
planActionsDisabled,
|
|
58
62
|
onRetrySend,
|
|
59
63
|
onRetryExecution,
|
|
60
64
|
onEditMessage,
|
|
61
|
-
}), [formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, onBuildFromPlan, org, planActionsDisabled, onRetrySend, onRetryExecution, onEditMessage]);
|
|
62
|
-
return (_jsxs(_Fragment, { children: [_jsx(SandboxContext.Provider, { value: sandboxCtx, children: _jsx(FilePathContext.Provider, { value: filePathCtx, children: _jsx(DevProfiler, { id: "MessageThread:virtualized", children: _jsx(Virtuoso, { ref: virtuosoRef, data: items, alignToBottom: true, followOutput: handleFollowOutput, atBottomStateChange: setIsAtBottom, atBottomThreshold: NEAR_BOTTOM_THRESHOLD_PX, computeItemKey: (_index, item) => item.key, increaseViewportBy: { top: 200, bottom: 200 }, scrollerRef: handleScrollerRef, className: "h-full", components: { Scroller: ScrollerWithA11y }, itemContent: (index, item) => (_jsx("div", { className: cn("pb-4 pt-0 first:pt-6", centerContent && "mx-auto w-full max-w-3xl px-4"), children: _jsx(ThreadItemWrapper, { animate: index >= items.length - 2, children: _jsx(ThreadItemRenderer, { item: item, ...renderProps }) }) })) }) }) }) }), _jsx(JumpToLatestButton, { onClick: jumpToLatest, visible: !isAtBottom })] }));
|
|
65
|
+
}), [formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, approvalErrors, onBuildFromPlan, org, planActionsDisabled, onRetrySend, onRetryExecution, onEditMessage]);
|
|
66
|
+
return (_jsxs(_Fragment, { children: [_jsx(SandboxContext.Provider, { value: sandboxCtx, children: _jsx(FilePathContext.Provider, { value: filePathCtx, children: _jsx(ApprovalContext.Provider, { value: approvalCtx, children: _jsx(FileReviewContext.Provider, { value: fileReviewCtx, children: _jsx(DevProfiler, { id: "MessageThread:virtualized", children: _jsx(Virtuoso, { ref: virtuosoRef, data: items, alignToBottom: true, followOutput: handleFollowOutput, atBottomStateChange: setIsAtBottom, atBottomThreshold: NEAR_BOTTOM_THRESHOLD_PX, computeItemKey: (_index, item) => item.key, increaseViewportBy: { top: 200, bottom: 200 }, scrollerRef: handleScrollerRef, className: "h-full", components: { Scroller: ScrollerWithA11y }, itemContent: (index, item) => (_jsx("div", { className: cn("pb-4 pt-0 first:pt-6", centerContent && "mx-auto w-full max-w-3xl px-4"), children: _jsx(ThreadItemWrapper, { animate: index >= items.length - 2, children: _jsx(ThreadItemRenderer, { item: item, ...renderProps }) }) })) }) }) }) }) }) }), _jsx(JumpToLatestButton, { onClick: jumpToLatest, visible: !isAtBottom && unresolvedApprovalCount === 0 }), _jsx(ApprovalPeekBar, { visible: !isAtBottom && unresolvedApprovalCount > 0, count: unresolvedApprovalCount, onClick: jumpToLatest })] }));
|
|
63
67
|
}
|
|
64
68
|
//# sourceMappingURL=VirtualizedThread.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedThread.js","sourceRoot":"","sources":["../../src/internal/VirtualizedThread.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,QAAQ,EAAuB,MAAM,gBAAgB,CAAC;AAC/D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,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,EAC7C,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAC,QAAQ,EAClB,UAAU,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE,EAC1C,WAAW,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAC5B,cAAK,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,aAAa,IAAI,+BAA+B,CAAC,YAC1F,KAAC,iBAAiB,IAAC,OAAO,EAAE,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,YACnD,KAAC,kBAAkB,IACjB,IAAI,EAAE,IAAI,KACN,WAAW,GACf,GACgB,GAChB,CACP,GACD,GACU,GACe,GACF,GACA,GACD,EAG1B,KAAC,kBAAkB,IACjB,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,CAAC,UAAU,IAAI,uBAAuB,KAAK,CAAC,GACrD,EACF,KAAC,eAAe,IACd,OAAO,EAAE,CAAC,UAAU,IAAI,uBAAuB,GAAG,CAAC,EACnD,KAAK,EAAE,uBAAuB,EAC9B,OAAO,EAAE,YAAY,GACrB,IACD,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves a fence info-string to a registered highlight.js language name, or
|
|
4
|
+
* `null` when no grammar is registered for it (the caller then renders the code
|
|
5
|
+
* flat). Case-insensitive and whitespace-tolerant; never guesses.
|
|
6
|
+
*
|
|
7
|
+
* @param language - The raw language from a `language-*` class (e.g. `"go"`).
|
|
8
|
+
* @returns The normalized, registered language name, or `null`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveLanguage(language: string | undefined): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Highlights `code` for the given fence `language` and returns themed React
|
|
13
|
+
* nodes — token `<span>`s carrying `hljs-*` classes that `styles.css` maps to
|
|
14
|
+
* `--stgm-syntax-*`.
|
|
15
|
+
*
|
|
16
|
+
* Returns `null` (so the caller can fall back to flat rendering) when the
|
|
17
|
+
* language has no registered grammar or tokenization throws. Highlighting is
|
|
18
|
+
* synchronous: there is no loading state to handle.
|
|
19
|
+
*
|
|
20
|
+
* @param code - The raw source text of the fenced block.
|
|
21
|
+
* @param language - The fence language (e.g. `"ts"`); unknown → `null`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function highlightToReact(code: string, language: string | undefined): ReactNode | null;
|
|
24
|
+
//# sourceMappingURL=code-highlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-highlight.d.ts","sourceRoot":"","sources":["../../src/internal/code-highlight.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAkFjD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAI3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,SAAS,GAAG,IAAI,CAQlB"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Fragment } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createLowlight } from "lowlight";
|
|
4
|
+
import { toJsxRuntime } from "hast-util-to-jsx-runtime";
|
|
5
|
+
// Dependency licensing (DD-012): `lowlight` and `hast-util-to-jsx-runtime` are
|
|
6
|
+
// MIT; `highlight.js` is BSD-3-Clause. BSD-3-Clause is a permissive, OSI-approved
|
|
7
|
+
// license, compatible with MIT/Apache-2.0, that imposes no obligations on SDK
|
|
8
|
+
// consumers beyond attribution — so it satisfies DD-012's "MIT or Apache-2.0
|
|
9
|
+
// compatible" rule. Recorded here so the choice is auditable at the point of use.
|
|
10
|
+
import bash from "highlight.js/lib/languages/bash";
|
|
11
|
+
import css from "highlight.js/lib/languages/css";
|
|
12
|
+
import dockerfile from "highlight.js/lib/languages/dockerfile";
|
|
13
|
+
import go from "highlight.js/lib/languages/go";
|
|
14
|
+
import java from "highlight.js/lib/languages/java";
|
|
15
|
+
import javascript from "highlight.js/lib/languages/javascript";
|
|
16
|
+
import json from "highlight.js/lib/languages/json";
|
|
17
|
+
import markdown from "highlight.js/lib/languages/markdown";
|
|
18
|
+
import python from "highlight.js/lib/languages/python";
|
|
19
|
+
import rust from "highlight.js/lib/languages/rust";
|
|
20
|
+
import sql from "highlight.js/lib/languages/sql";
|
|
21
|
+
import typescript from "highlight.js/lib/languages/typescript";
|
|
22
|
+
import xml from "highlight.js/lib/languages/xml";
|
|
23
|
+
import yaml from "highlight.js/lib/languages/yaml";
|
|
24
|
+
/**
|
|
25
|
+
* Syntax highlighter for fenced code blocks in SDK markdown surfaces.
|
|
26
|
+
*
|
|
27
|
+
* This is the single highlighting engine behind the shared `code` override in
|
|
28
|
+
* {@link file://./markdown-components.tsx} — so chat (Streamdown) and the
|
|
29
|
+
* artifact/skill viewers (react-markdown) colorize code identically.
|
|
30
|
+
*
|
|
31
|
+
* The engine emits highlight.js token classes (`hljs-keyword`, `hljs-string`,
|
|
32
|
+
* …) which `styles.css` maps onto the `--stgm-syntax-*` theme tokens. Colors
|
|
33
|
+
* are therefore 100% token-driven: they track the host's preset and color-mode
|
|
34
|
+
* with no hardcoded values, exactly like the CodeMirror YAML editor.
|
|
35
|
+
*
|
|
36
|
+
* **Eager, not lazy.** Highlighting is on the core path (almost every
|
|
37
|
+
* `SessionViewer` consumer renders agent messages containing code), so DD-013's
|
|
38
|
+
* lazy pattern (for rarely-used heavy deps) does not apply. The grammars are
|
|
39
|
+
* imported eagerly; because this module is only reachable through the markdown
|
|
40
|
+
* components, normal tree-shaking still keeps it out of bundles that never
|
|
41
|
+
* render markdown.
|
|
42
|
+
*
|
|
43
|
+
* **Curated grammar set.** Only the languages agents commonly emit are
|
|
44
|
+
* registered, to keep the payload small. Anything else falls back to flat
|
|
45
|
+
* rendering (see {@link resolveLanguage}) — a deterministic choice, never
|
|
46
|
+
* highlight.js auto-detection, consistent with this codebase's avoidance of
|
|
47
|
+
* fuzzy heuristics.
|
|
48
|
+
*/
|
|
49
|
+
const lowlight = createLowlight({
|
|
50
|
+
bash,
|
|
51
|
+
css,
|
|
52
|
+
dockerfile,
|
|
53
|
+
go,
|
|
54
|
+
java,
|
|
55
|
+
javascript,
|
|
56
|
+
json,
|
|
57
|
+
markdown,
|
|
58
|
+
python,
|
|
59
|
+
rust,
|
|
60
|
+
sql,
|
|
61
|
+
typescript,
|
|
62
|
+
xml,
|
|
63
|
+
yaml,
|
|
64
|
+
});
|
|
65
|
+
// Fence info-strings agents use that aren't already registered as grammar
|
|
66
|
+
// aliases by highlight.js. `xml` is highlight.js's grammar for HTML markup.
|
|
67
|
+
lowlight.registerAlias({
|
|
68
|
+
bash: ["sh", "shell", "zsh", "console"],
|
|
69
|
+
dockerfile: ["docker"],
|
|
70
|
+
javascript: ["js", "jsx", "mjs", "cjs"],
|
|
71
|
+
markdown: ["md"],
|
|
72
|
+
python: ["py"],
|
|
73
|
+
typescript: ["ts", "tsx"],
|
|
74
|
+
xml: ["html"],
|
|
75
|
+
yaml: ["yml"],
|
|
76
|
+
});
|
|
77
|
+
const jsxRuntime = { Fragment, jsx, jsxs };
|
|
78
|
+
/**
|
|
79
|
+
* Resolves a fence info-string to a registered highlight.js language name, or
|
|
80
|
+
* `null` when no grammar is registered for it (the caller then renders the code
|
|
81
|
+
* flat). Case-insensitive and whitespace-tolerant; never guesses.
|
|
82
|
+
*
|
|
83
|
+
* @param language - The raw language from a `language-*` class (e.g. `"go"`).
|
|
84
|
+
* @returns The normalized, registered language name, or `null`.
|
|
85
|
+
*/
|
|
86
|
+
export function resolveLanguage(language) {
|
|
87
|
+
if (!language)
|
|
88
|
+
return null;
|
|
89
|
+
const name = language.trim().toLowerCase();
|
|
90
|
+
return name && lowlight.registered(name) ? name : null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Highlights `code` for the given fence `language` and returns themed React
|
|
94
|
+
* nodes — token `<span>`s carrying `hljs-*` classes that `styles.css` maps to
|
|
95
|
+
* `--stgm-syntax-*`.
|
|
96
|
+
*
|
|
97
|
+
* Returns `null` (so the caller can fall back to flat rendering) when the
|
|
98
|
+
* language has no registered grammar or tokenization throws. Highlighting is
|
|
99
|
+
* synchronous: there is no loading state to handle.
|
|
100
|
+
*
|
|
101
|
+
* @param code - The raw source text of the fenced block.
|
|
102
|
+
* @param language - The fence language (e.g. `"ts"`); unknown → `null`.
|
|
103
|
+
*/
|
|
104
|
+
export function highlightToReact(code, language) {
|
|
105
|
+
const resolved = resolveLanguage(language);
|
|
106
|
+
if (resolved === null)
|
|
107
|
+
return null;
|
|
108
|
+
try {
|
|
109
|
+
return toJsxRuntime(lowlight.highlight(resolved, code), jsxRuntime);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=code-highlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-highlight.js","sourceRoot":"","sources":["../../src/internal/code-highlight.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,+EAA+E;AAC/E,kFAAkF;AAClF,8EAA8E;AAC9E,6EAA6E;AAC7E,kFAAkF;AAClF,OAAO,IAAI,MAAM,iCAAiC,CAAC;AACnD,OAAO,GAAG,MAAM,gCAAgC,CAAC;AACjD,OAAO,UAAU,MAAM,uCAAuC,CA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OG;AACH,MAAM,UAAU,eAAe,CAAC,QAA4B;IAC1D,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,OAAO,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,QAA4B;IAE5B,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;IACtE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-components.d.ts","sourceRoot":"","sources":["../../src/internal/markdown-components.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,SAAS,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"markdown-components.d.ts","sourceRoot":"","sources":["../../src/internal/markdown-components.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,SAAS,MAAM,YAAY,CAAC;AAQnC;;;GAGG;AACH,eAAO,MAAM,cAAc,sBAAc,CAAC;AAI1C;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAgBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGpE;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,UA4LjC,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import remarkGfm from "remark-gfm";
|
|
3
3
|
import { cn } from "@stigmer/theme";
|
|
4
|
+
import { highlightToReact } from "./code-highlight";
|
|
5
|
+
const LANGUAGE_CLASS_PREFIX = "language-";
|
|
4
6
|
/**
|
|
5
7
|
* Remark plugins applied to all SDK markdown surfaces.
|
|
6
8
|
* Includes GFM (tables, strikethrough, autolinks, task lists).
|
|
@@ -93,9 +95,18 @@ export const MARKDOWN_COMPONENTS = {
|
|
|
93
95
|
return (_jsx("pre", { className: "mb-3 last:mb-0 overflow-x-auto rounded-md bg-muted p-3", ...props, children: children }));
|
|
94
96
|
},
|
|
95
97
|
code({ children, className: codeClassName, ...props }) {
|
|
96
|
-
const isBlock = typeof codeClassName === "string" &&
|
|
98
|
+
const isBlock = typeof codeClassName === "string" &&
|
|
99
|
+
codeClassName.startsWith(LANGUAGE_CLASS_PREFIX);
|
|
97
100
|
if (isBlock) {
|
|
98
|
-
|
|
101
|
+
// Tokenize here, in the one component both renderers (Streamdown for
|
|
102
|
+
// chat, react-markdown for artifacts/skills) share, so highlighting is
|
|
103
|
+
// identical everywhere. Highlight only plain-string children — anything
|
|
104
|
+
// else (e.g. a streaming caret node) falls back to flat rendering.
|
|
105
|
+
const language = codeClassName.slice(LANGUAGE_CLASS_PREFIX.length);
|
|
106
|
+
const highlighted = typeof children === "string"
|
|
107
|
+
? highlightToReact(children, language)
|
|
108
|
+
: null;
|
|
109
|
+
return (_jsx("code", { className: cn("hljs font-mono text-xs text-foreground", codeClassName), ...props, children: highlighted ?? children }));
|
|
99
110
|
}
|
|
100
111
|
return (_jsx("code", { className: "font-mono text-xs bg-muted px-1 py-0.5 rounded text-foreground", ...props, children: children }));
|
|
101
112
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-components.js","sourceRoot":"","sources":["../../src/internal/markdown-components.tsx"],"names":[],"mappings":";AAEA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"markdown-components.js","sourceRoot":"","sources":["../../src/internal/markdown-components.tsx"],"names":[],"mappings":";AAEA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAI1C;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,CAAC,CAAC;AAE1C,MAAM,cAAc,GAAG,iCAAiC,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,2BAA2B,GAC/B,mEAAmE,CAAC;AAEtE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,4BAA4B,CAAC,OAAe;IAC1D,MAAM,KAAK,GAAG,2BAA2B,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/D,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAe;IAC7C,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAgB;QACpC,OAAO,CACL,YAAG,SAAS,EAAC,wDAAwD,KAAK,KAAK,YA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gBAAO,SAAS,EAAC,gCAAgC,KAAK,KAAK,YACxD,QAAQ,GACH,GACJ,CACP,CAAC;IACJ,CAAC;IAED,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiB;QACtC,OAAO,CACL,aACE,SAAS,EAAC,wFAAwF,KAC9F,KAAK,YAER,QAAQ,GACN,CACN,CAAC;IACJ,CAAC;IAED,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiB;QACtC,OAAO,CACL,aAAI,SAAS,EAAC,kDAAkD,KAAK,KAAK,YACvE,QAAQ,GACN,CACN,CAAC;IACJ,CAAC;IAED,EAAE,CAAC,KAAoB;QACrB,OAAO,aAAI,SAAS,EAAC,oBAAoB,KAAK,KAAK,GAAI,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAqB;QAC9C,OAAO,CACL,iBAAQ,SAAS,EAAC,+BAA+B,KAAK,KAAK,YACxD,QAAQ,GACF,CACV,CAAC;IACJ,CAAC;IAED,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiB;QACtC,OAAO,CACL,aAAI,SAAS,EAAC,QAAQ,KAAK,KAAK,YAC7B,QAAQ,GACN,CACN,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disclosure state machine for progressively-revealed thread sections
|
|
3
|
+
* (tool-call groups, individual tool rows, sub-agent cards).
|
|
4
|
+
*
|
|
5
|
+
* The challenge it solves: a section should open and close *on its own* as
|
|
6
|
+
* the agent works (open while a tool runs, settle closed when it finishes),
|
|
7
|
+
* yet a user's explicit click must win and never be stomped by the next
|
|
8
|
+
* stream frame. Three components hand-rolled this same "auto unless the user
|
|
9
|
+
* intervened" logic; this hook is the single source of that shape.
|
|
10
|
+
*
|
|
11
|
+
* `autoOpen` is the component's live opinion of whether the section *should*
|
|
12
|
+
* be open right now (e.g. `isRunning || hasPendingApproval`). While the user
|
|
13
|
+
* has not toggled, `open` tracks `autoOpen`. Once the user toggles, their
|
|
14
|
+
* choice sticks for the lifetime of the component — the auto signal is
|
|
15
|
+
* ignored from then on, so the section never reopens or recollapses under
|
|
16
|
+
* them mid-stream.
|
|
17
|
+
*
|
|
18
|
+
* @param autoOpen Whether the section should auto-open given current state.
|
|
19
|
+
* @param options.initialOpen First-render open state. Defaults to `autoOpen`.
|
|
20
|
+
* Use it to honour a caller-provided `defaultExpanded` before the first
|
|
21
|
+
* effect runs.
|
|
22
|
+
* @returns A `[open, toggle]` tuple. `toggle` flips the state and marks it
|
|
23
|
+
* user-controlled.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const [open, toggle] = useAutoDisclosure(isRunning || hasPendingApproval);
|
|
28
|
+
* <button aria-expanded={open} onClick={toggle}>…</button>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useAutoDisclosure(autoOpen: boolean, options?: {
|
|
32
|
+
readonly initialOpen?: boolean;
|
|
33
|
+
}): readonly [open: boolean, toggle: () => void];
|
|
34
|
+
//# sourceMappingURL=useAutoDisclosure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoDisclosure.d.ts","sourceRoot":"","sources":["../../src/internal/useAutoDisclosure.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,EACjB,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3C,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,CAoB9C"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Disclosure state machine for progressively-revealed thread sections
|
|
5
|
+
* (tool-call groups, individual tool rows, sub-agent cards).
|
|
6
|
+
*
|
|
7
|
+
* The challenge it solves: a section should open and close *on its own* as
|
|
8
|
+
* the agent works (open while a tool runs, settle closed when it finishes),
|
|
9
|
+
* yet a user's explicit click must win and never be stomped by the next
|
|
10
|
+
* stream frame. Three components hand-rolled this same "auto unless the user
|
|
11
|
+
* intervened" logic; this hook is the single source of that shape.
|
|
12
|
+
*
|
|
13
|
+
* `autoOpen` is the component's live opinion of whether the section *should*
|
|
14
|
+
* be open right now (e.g. `isRunning || hasPendingApproval`). While the user
|
|
15
|
+
* has not toggled, `open` tracks `autoOpen`. Once the user toggles, their
|
|
16
|
+
* choice sticks for the lifetime of the component — the auto signal is
|
|
17
|
+
* ignored from then on, so the section never reopens or recollapses under
|
|
18
|
+
* them mid-stream.
|
|
19
|
+
*
|
|
20
|
+
* @param autoOpen Whether the section should auto-open given current state.
|
|
21
|
+
* @param options.initialOpen First-render open state. Defaults to `autoOpen`.
|
|
22
|
+
* Use it to honour a caller-provided `defaultExpanded` before the first
|
|
23
|
+
* effect runs.
|
|
24
|
+
* @returns A `[open, toggle]` tuple. `toggle` flips the state and marks it
|
|
25
|
+
* user-controlled.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* const [open, toggle] = useAutoDisclosure(isRunning || hasPendingApproval);
|
|
30
|
+
* <button aria-expanded={open} onClick={toggle}>…</button>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function useAutoDisclosure(autoOpen, options) {
|
|
34
|
+
const [open, setOpen] = useState(options?.initialOpen ?? autoOpen);
|
|
35
|
+
const userToggledRef = useRef(false);
|
|
36
|
+
const prevAutoOpenRef = useRef(autoOpen);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
// Sync only on a genuine transition of the auto signal — never on mount,
|
|
39
|
+
// so `initialOpen` is honoured, and never against the user's choice.
|
|
40
|
+
if (prevAutoOpenRef.current === autoOpen)
|
|
41
|
+
return;
|
|
42
|
+
prevAutoOpenRef.current = autoOpen;
|
|
43
|
+
if (userToggledRef.current)
|
|
44
|
+
return;
|
|
45
|
+
setOpen(autoOpen);
|
|
46
|
+
}, [autoOpen]);
|
|
47
|
+
const toggle = useRef(() => {
|
|
48
|
+
userToggledRef.current = true;
|
|
49
|
+
setOpen((v) => !v);
|
|
50
|
+
}).current;
|
|
51
|
+
return [open, toggle];
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=useAutoDisclosure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoDisclosure.js","sourceRoot":"","sources":["../../src/internal/useAutoDisclosure.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAiB,EACjB,OAA4C;IAE5C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,WAAW,IAAI,QAAQ,CAAC,CAAC;IACnE,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEzC,SAAS,CAAC,GAAG,EAAE;QACb,yEAAyE;QACzE,qEAAqE;QACrE,IAAI,eAAe,CAAC,OAAO,KAAK,QAAQ;YAAE,OAAO;QACjD,eAAe,CAAC,OAAO,GAAG,QAAQ,CAAC;QACnC,IAAI,cAAc,CAAC,OAAO;YAAE,OAAO;QACnC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpB,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,EAAE;QACzB,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC;QAC9B,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC,OAAO,CAAC;IAEX,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live elapsed time since an ISO 8601 timestamp, re-rendering once per second.
|
|
3
|
+
*
|
|
4
|
+
* The shape behind every "how long has this been going" affordance in the
|
|
5
|
+
* thread: an approval gate waiting on a human, a sub-agent card whose nested
|
|
6
|
+
* activity cannot be streamed (the Cursor SDK returns sub-agent internals only
|
|
7
|
+
* at completion), a long-running tool. A ticking duration is the honest signal
|
|
8
|
+
* that work is progressing when there is nothing else to show — as opposed to
|
|
9
|
+
* fabricating intermediate state.
|
|
10
|
+
*
|
|
11
|
+
* Returns elapsed milliseconds (clamped to >= 0 against client/server clock
|
|
12
|
+
* skew), or `null` when the timestamp is absent or unparseable — callers
|
|
13
|
+
* render nothing rather than a bogus "0s". The interval is scoped to the
|
|
14
|
+
* component instance and torn down on unmount, so a thread full of settled
|
|
15
|
+
* cards costs zero timers.
|
|
16
|
+
*
|
|
17
|
+
* @param startedAt ISO 8601 timestamp the clock counts from (e.g.
|
|
18
|
+
* `ToolCall.approval_requested_at`, `SubAgentExecution.started_at`).
|
|
19
|
+
*/
|
|
20
|
+
export declare function useElapsedSince(startedAt: string): number | null;
|
|
21
|
+
/**
|
|
22
|
+
* Format an elapsed duration for the live tickers driven by
|
|
23
|
+
* {@link useElapsedSince}: `just now`, `42s`, `3m 12s`, `1h 5m`.
|
|
24
|
+
*
|
|
25
|
+
* Second-granularity (unlike ToolCallDetail's `formatDuration`, which keeps
|
|
26
|
+
* millisecond precision for completed calls) because a live counter that
|
|
27
|
+
* flickers sub-second digits reads as noise, not progress.
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatElapsed(ms: number): string;
|
|
30
|
+
//# sourceMappingURL=useElapsedSince.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useElapsedSince.d.ts","sourceRoot":"","sources":["../../src/internal/useElapsedSince.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsBhE;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAgBhD"}
|