@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 -31
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { create } from "@bufbuild/protobuf";
|
|
4
|
+
import { FileChangeSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
|
|
5
|
+
import { FileChangeCaptureLevel, FileChangeType, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
6
|
+
import { displayFileChangeSets, toDisplayFileChange } from "@stigmer/sdk";
|
|
7
|
+
/**
|
|
8
|
+
* Pure derivation hook that aggregates an agent's file changes across every
|
|
9
|
+
* execution in a session into one net change per file. A headless building
|
|
10
|
+
* block for platform builders composing a consolidated session-changes surface
|
|
11
|
+
* (typically paired with {@link FileChangesView}); the Console itself renders
|
|
12
|
+
* file changes in the transcript (stamped edit rows + the per-turn decision
|
|
13
|
+
* bar) and does not consume this hook.
|
|
14
|
+
*
|
|
15
|
+
* **Source (ledger-first).** Under apply-then-review the changes live in the
|
|
16
|
+
* file-review ledger; {@link displayFileChangeSets} reads the server's live
|
|
17
|
+
* projection or folds the durable ledger for a terminal execution (whose
|
|
18
|
+
* projection is nil), and each captured change is projected onto the display
|
|
19
|
+
* {@link FileChange} via {@link toDisplayFileChange}. A pre-capture
|
|
20
|
+
* (legacy) execution has no ledger, so it falls back to the tool-call-coupled
|
|
21
|
+
* `ToolCall.file_changes` (#186; removed in a later slice with that field). The
|
|
22
|
+
* two sources are mutually exclusive per execution, so there is no double count.
|
|
23
|
+
*
|
|
24
|
+
* **Traversal.** The ledger is execution-scoped and already includes sub-agent
|
|
25
|
+
* captures (DD-19), so the primary path is one pass per execution. The legacy
|
|
26
|
+
* fallback walks the same surfaces the server-side approval recompute and
|
|
27
|
+
* `MessageThread` walk: `status.messages[].toolCalls` **and**
|
|
28
|
+
* `status.subAgentExecutions[].messages[].toolCalls`. Executions are visited in
|
|
29
|
+
* chronological order, so each path's change list is chronological.
|
|
30
|
+
*
|
|
31
|
+
* **Net-diff (not latest-wins).** `useSessionWriteBacks`/`useSessionArtifacts`
|
|
32
|
+
* dedup by "latest wins" because each entry is a *snapshot* (a PR; a file's
|
|
33
|
+
* final bytes). A {@link FileChange} is a *delta* — an agent often rewrites the
|
|
34
|
+
* same file several times in a turn, and showing only the last edit's diff
|
|
35
|
+
* would misrepresent what changed. So changes to the same path are reduced to a
|
|
36
|
+
* single net change: `before` from the first change, `after` from the last.
|
|
37
|
+
* Because a WHOLE_FILE `after` is a complete file snapshot, `first.before →
|
|
38
|
+
* last.after` is exactly the net change. A group with one change (the common
|
|
39
|
+
* case) is passed through untouched; multi-edit groups synthesize a net
|
|
40
|
+
* {@link FileChange} so every consumer speaks one proto type (DD-007).
|
|
41
|
+
*
|
|
42
|
+
* Counts and unified diffs for whole-file captures stay derivable by the
|
|
43
|
+
* presentation layer (the runner emits 0/"" sentinels), matching the contract
|
|
44
|
+
* the SDK `tool-view` established.
|
|
45
|
+
*
|
|
46
|
+
* @param executions - All executions for a session, in chronological order.
|
|
47
|
+
* Pass both completed and active-stream executions.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* const allExecutions = [
|
|
52
|
+
* ...conv.completedExecutions,
|
|
53
|
+
* ...(conv.activeStreamExecution ? [conv.activeStreamExecution] : []),
|
|
54
|
+
* ];
|
|
55
|
+
* const { fileChanges, hasFileChanges } = useSessionFileChanges(allExecutions);
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @see useSessionWriteBacks — git-mode (PR) counterpart, which does drive the
|
|
59
|
+
* inspector's Changes tab
|
|
60
|
+
* @see useFileChangeContent — resolves a change's before/after text for diffing
|
|
61
|
+
* @see FileChangesView — component that renders this data
|
|
62
|
+
*/
|
|
63
|
+
export function useSessionFileChanges(executions) {
|
|
64
|
+
return useMemo(() => {
|
|
65
|
+
// Path -> chronological list of raw changes to that path.
|
|
66
|
+
const groups = new Map();
|
|
67
|
+
// Preserve first-seen path order as a stable tiebreaker before sorting.
|
|
68
|
+
const collect = (change) => {
|
|
69
|
+
const key = change.path || change.absolutePath;
|
|
70
|
+
if (!key)
|
|
71
|
+
return;
|
|
72
|
+
const list = groups.get(key);
|
|
73
|
+
if (list)
|
|
74
|
+
list.push(change);
|
|
75
|
+
else
|
|
76
|
+
groups.set(key, [change]);
|
|
77
|
+
};
|
|
78
|
+
for (const execution of executions) {
|
|
79
|
+
// The file-review ledger is the single source under apply-then-review: the
|
|
80
|
+
// display seam reads the live projection or folds the durable ledger for a
|
|
81
|
+
// terminal execution, and the execution-scoped ledger already covers
|
|
82
|
+
// sub-agent captures (DD-19), so one pass suffices. Each CapturedFileChange
|
|
83
|
+
// is projected onto the display FileChange the net-collapse + renderer speak.
|
|
84
|
+
const capturedChanges = displayFileChangeSets(execution.status).flatMap((set) => set.changes);
|
|
85
|
+
for (const captured of capturedChanges)
|
|
86
|
+
collect(toDisplayFileChange(captured));
|
|
87
|
+
}
|
|
88
|
+
const fileChanges = Array.from(groups.values(), netChange);
|
|
89
|
+
fileChanges.sort(fileChangeComparator);
|
|
90
|
+
return {
|
|
91
|
+
fileChanges,
|
|
92
|
+
hasFileChanges: fileChanges.length > 0,
|
|
93
|
+
fileChangeCount: fileChanges.length,
|
|
94
|
+
};
|
|
95
|
+
}, [executions]);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Reduces a path's chronological change list to a single net change.
|
|
99
|
+
* A one-change group is returned as-is (the common path, no allocation);
|
|
100
|
+
* multi-edit groups synthesize a net {@link FileChange}.
|
|
101
|
+
*/
|
|
102
|
+
function netChange(changes) {
|
|
103
|
+
if (changes.length === 1)
|
|
104
|
+
return changes[0];
|
|
105
|
+
const first = changes[0];
|
|
106
|
+
const last = changes[changes.length - 1];
|
|
107
|
+
const changeType = netChangeType(first, last);
|
|
108
|
+
// Whole-file only when both chosen sides come from whole-file captures;
|
|
109
|
+
// otherwise fall back to the last change's hunk diff. A path edited by a
|
|
110
|
+
// single harness won't mix levels — this just stays honest if it ever does.
|
|
111
|
+
const wholeFile = first.captureLevel === FileChangeCaptureLevel.WHOLE_FILE &&
|
|
112
|
+
last.captureLevel === FileChangeCaptureLevel.WHOLE_FILE;
|
|
113
|
+
if (wholeFile) {
|
|
114
|
+
return create(FileChangeSchema, {
|
|
115
|
+
path: last.path,
|
|
116
|
+
absolutePath: last.absolutePath,
|
|
117
|
+
changeType,
|
|
118
|
+
captureLevel: FileChangeCaptureLevel.WHOLE_FILE,
|
|
119
|
+
before: first.before,
|
|
120
|
+
after: last.after,
|
|
121
|
+
renameFrom: changeType === FileChangeType.RENAME ? first.renameFrom : "",
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return create(FileChangeSchema, {
|
|
125
|
+
path: last.path,
|
|
126
|
+
absolutePath: last.absolutePath,
|
|
127
|
+
changeType,
|
|
128
|
+
captureLevel: FileChangeCaptureLevel.HUNK_ONLY,
|
|
129
|
+
unifiedDiff: last.unifiedDiff,
|
|
130
|
+
linesAdded: last.linesAdded,
|
|
131
|
+
linesRemoved: last.linesRemoved,
|
|
132
|
+
renameFrom: changeType === FileChangeType.RENAME ? first.renameFrom : "",
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Reconciles the net `change_type` of a path from its first and last change.
|
|
137
|
+
*
|
|
138
|
+
* Intent: the badge should describe the file's journey across the *whole*
|
|
139
|
+
* session, anchored on its two endpoints, in this precedence:
|
|
140
|
+
*
|
|
141
|
+
* 1. Ends deleted (`last` is DELETE) → DELETE. The file is gone, regardless of
|
|
142
|
+
* how it got there — this includes create-then-delete, which we deliberately
|
|
143
|
+
* surface as DELETE rather than hiding the path. (`before` then comes from
|
|
144
|
+
* the first change, which for a created-then-deleted file is empty, so the
|
|
145
|
+
* diff reads as the removal of whatever briefly existed.)
|
|
146
|
+
* 2. Started created (`first` is CREATE) and still exists → CREATE. A file born
|
|
147
|
+
* this session and later modified is, on net, a new file.
|
|
148
|
+
* 3. Started renamed (`first` is RENAME) and still exists → RENAME, carrying the
|
|
149
|
+
* original `rename_from` so the move is preserved across later edits.
|
|
150
|
+
* 4. Otherwise → MODIFY (the common multi-edit case).
|
|
151
|
+
*/
|
|
152
|
+
function netChangeType(first, last) {
|
|
153
|
+
if (last.changeType === FileChangeType.DELETE)
|
|
154
|
+
return FileChangeType.DELETE;
|
|
155
|
+
if (first.changeType === FileChangeType.CREATE)
|
|
156
|
+
return FileChangeType.CREATE;
|
|
157
|
+
if (first.changeType === FileChangeType.RENAME)
|
|
158
|
+
return FileChangeType.RENAME;
|
|
159
|
+
return FileChangeType.MODIFY;
|
|
160
|
+
}
|
|
161
|
+
// Most-actionable first (modified), then additions (create/rename), then
|
|
162
|
+
// deletions — mirroring GitHub's file-list convention — alphabetical within
|
|
163
|
+
// each group so the list is stable and scannable.
|
|
164
|
+
const CHANGE_TYPE_ORDER = {
|
|
165
|
+
[FileChangeType.MODIFY]: 0,
|
|
166
|
+
[FileChangeType.CREATE]: 1,
|
|
167
|
+
[FileChangeType.RENAME]: 1,
|
|
168
|
+
[FileChangeType.DELETE]: 2,
|
|
169
|
+
[FileChangeType.UNSPECIFIED]: 3,
|
|
170
|
+
};
|
|
171
|
+
function fileChangeComparator(a, b) {
|
|
172
|
+
const order = (CHANGE_TYPE_ORDER[a.changeType] ?? 3) -
|
|
173
|
+
(CHANGE_TYPE_ORDER[b.changeType] ?? 3);
|
|
174
|
+
if (order !== 0)
|
|
175
|
+
return order;
|
|
176
|
+
return a.path.localeCompare(b.path, undefined, { sensitivity: "base" });
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=useSessionFileChanges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSessionFileChanges.js","sourceRoot":"","sources":["../../src/session/useSessionFileChanges.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,oB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AAiB,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9B,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import postcss, {
|
|
5
|
+
type AtRule,
|
|
6
|
+
type Rule,
|
|
7
|
+
type Container,
|
|
8
|
+
type Document as PostcssDocument,
|
|
9
|
+
} from "postcss";
|
|
10
|
+
import tailwindcss from "@tailwindcss/postcss";
|
|
11
|
+
|
|
12
|
+
// The directory of `styles.css` — `@source` globs and relative `@import`s inside
|
|
13
|
+
// it resolve from here, exactly as they do when a host app compiles it.
|
|
14
|
+
const srcDir = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Compile the SDK stylesheet the way the client apps actually do: the host's
|
|
18
|
+
* Tailwind first (`@import "tailwindcss"`, which puts preflight in `base` and
|
|
19
|
+
* utilities in `utilities`), then the SDK's `styles.css` layered on top. This is
|
|
20
|
+
* the pipeline that broke every prior border fix — the standalone
|
|
21
|
+
* `tailwindcss -i styles.css` build (which the apps never consume) hid the bug
|
|
22
|
+
* because it lacks the competing host `utilities` layer.
|
|
23
|
+
*/
|
|
24
|
+
async function compileHostContext(): Promise<string> {
|
|
25
|
+
const input = `@import "tailwindcss";\n@import "./styles.css";`;
|
|
26
|
+
const result = await postcss([tailwindcss({ base: srcDir })]).process(input, {
|
|
27
|
+
// A virtual entry inside src/ so `@import "./styles.css"` resolves to the
|
|
28
|
+
// real SDK stylesheet under test.
|
|
29
|
+
from: resolve(srcDir, "__border-layer-probe__.css"),
|
|
30
|
+
});
|
|
31
|
+
return result.css;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The nearest enclosing `@layer <name>` of a node, or null if unlayered. */
|
|
35
|
+
function enclosingLayer(node: Rule | AtRule): string | null {
|
|
36
|
+
let parent: Container | PostcssDocument | undefined = node.parent;
|
|
37
|
+
while (parent) {
|
|
38
|
+
if (parent.type === "atrule") {
|
|
39
|
+
const at = parent as AtRule;
|
|
40
|
+
if (at.name === "layer" && at.params) return at.params.trim();
|
|
41
|
+
}
|
|
42
|
+
parent = parent.parent;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
describe("styles.css border-layer invariant (host-compiled)", () => {
|
|
48
|
+
// The class-name assertions in ToolCallItem/ApprovalCard tests prove the
|
|
49
|
+
// markup *requests* a border; they run in happy-dom, which cannot resolve
|
|
50
|
+
// `@layer` and so cannot prove the border actually *renders*. This compiles
|
|
51
|
+
// the real host-context cascade and asserts the architecture that makes it
|
|
52
|
+
// render: the scoped preflight reset must never outrank the border utilities.
|
|
53
|
+
it("emits the .stgm border reset in `base`, below the `utilities` layer", async () => {
|
|
54
|
+
const css = await compileHostContext();
|
|
55
|
+
const root = postcss.parse(css);
|
|
56
|
+
|
|
57
|
+
// 1) Scanning/generation works: the prominent border-color utility exists.
|
|
58
|
+
// (If this regresses, the border would silently fall back to the faint
|
|
59
|
+
// --stgm-border default — the dark-mode half of the original defect.)
|
|
60
|
+
let prominentRule: Rule | null = null;
|
|
61
|
+
root.walkRules((rule) => {
|
|
62
|
+
if (rule.selector.includes(".border-border-prominent")) prominentRule = rule;
|
|
63
|
+
});
|
|
64
|
+
expect(
|
|
65
|
+
prominentRule,
|
|
66
|
+
"`.border-border-prominent` was not generated — host did not scan the SDK source",
|
|
67
|
+
).not.toBeNull();
|
|
68
|
+
|
|
69
|
+
// 2) The reset (the rule that zeroes border-width on every .stgm descendant)
|
|
70
|
+
// must live in `base`, not in a layer declared after `utilities`.
|
|
71
|
+
let resetRule: Rule | null = null;
|
|
72
|
+
root.walkRules((rule) => {
|
|
73
|
+
if (!rule.selector.includes(".stgm")) return;
|
|
74
|
+
const zeroesBorder = rule.some(
|
|
75
|
+
(decl) =>
|
|
76
|
+
decl.type === "decl" &&
|
|
77
|
+
decl.prop === "border-width" &&
|
|
78
|
+
decl.value.trim() === "0",
|
|
79
|
+
);
|
|
80
|
+
if (zeroesBorder) resetRule = rule;
|
|
81
|
+
});
|
|
82
|
+
expect(resetRule, "the .stgm border-width:0 reset was not found").not.toBeNull();
|
|
83
|
+
expect(
|
|
84
|
+
enclosingLayer(resetRule!),
|
|
85
|
+
"the .stgm border reset must live in @layer base (it was placed in a layer above `utilities`, which silently zeroes every border inside .stgm)",
|
|
86
|
+
).toBe("base");
|
|
87
|
+
|
|
88
|
+
// 3) Belt and suspenders: `base` is declared before `utilities`, so a later
|
|
89
|
+
// `border`/`border-*` utility wins the cascade.
|
|
90
|
+
const layerOrder: string[] = [];
|
|
91
|
+
root.walkAtRules("layer", (at) => {
|
|
92
|
+
if (!at.nodes) return; // skip the bare `@layer a, b, c;` ordering statement
|
|
93
|
+
const name = at.params.trim();
|
|
94
|
+
if (name && !layerOrder.includes(name)) layerOrder.push(name);
|
|
95
|
+
});
|
|
96
|
+
const baseIdx = layerOrder.indexOf("base");
|
|
97
|
+
const utilitiesIdx = layerOrder.indexOf("utilities");
|
|
98
|
+
expect(baseIdx).toBeGreaterThanOrEqual(0);
|
|
99
|
+
expect(utilitiesIdx).toBeGreaterThanOrEqual(0);
|
|
100
|
+
expect(
|
|
101
|
+
baseIdx,
|
|
102
|
+
`expected @layer base (#${baseIdx}) to precede @layer utilities (#${utilitiesIdx}); order was [${layerOrder.join(", ")}]`,
|
|
103
|
+
).toBeLessThan(utilitiesIdx);
|
|
104
|
+
});
|
|
105
|
+
});
|