@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,343 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { create } from "@bufbuild/protobuf";
|
|
3
|
+
import {
|
|
4
|
+
FileContentSchema,
|
|
5
|
+
ToolCallOutputRefSchema,
|
|
6
|
+
} from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
|
|
7
|
+
import type { FileContent } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
|
|
8
|
+
import {
|
|
9
|
+
CapturedFileChangeSchema,
|
|
10
|
+
FileChangeSetSchema,
|
|
11
|
+
FileDecisionSchema,
|
|
12
|
+
type FileDecision,
|
|
13
|
+
} from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/filereview_pb";
|
|
14
|
+
import {
|
|
15
|
+
DiffCompleteness,
|
|
16
|
+
FileChangeKind,
|
|
17
|
+
FileChangeSetStatus,
|
|
18
|
+
FileDecisionAction,
|
|
19
|
+
FileDecisionScope,
|
|
20
|
+
FileReviewBlockReason,
|
|
21
|
+
} from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
22
|
+
import {
|
|
23
|
+
changeForRowPath,
|
|
24
|
+
changeSetReviewability,
|
|
25
|
+
deriveEffectiveVerdicts,
|
|
26
|
+
fileReviewability,
|
|
27
|
+
fileReviewRowState,
|
|
28
|
+
} from "../file-review-status";
|
|
29
|
+
|
|
30
|
+
/** Inline text side (the git substrate's shape). */
|
|
31
|
+
function inline(value: string, isBinary = false): FileContent {
|
|
32
|
+
return create(FileContentSchema, { body: { case: "inline", value }, isBinary });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Offloaded blob-ref side (large/CAS bodies), carrying its own is_binary. */
|
|
36
|
+
function ref(isBinary: boolean): FileContent {
|
|
37
|
+
return create(FileContentSchema, {
|
|
38
|
+
body: {
|
|
39
|
+
case: "ref",
|
|
40
|
+
value: create(ToolCallOutputRefSchema, {
|
|
41
|
+
storageKey: "artifacts/x/filereview/c.after.txt",
|
|
42
|
+
sizeBytes: 1_048_576n,
|
|
43
|
+
contentHash: "sha256:deadbeef",
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
isBinary,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function change(opts: {
|
|
51
|
+
kind?: FileChangeKind;
|
|
52
|
+
diffComplete: boolean;
|
|
53
|
+
before?: FileContent;
|
|
54
|
+
after?: FileContent;
|
|
55
|
+
blockedReason?: FileReviewBlockReason;
|
|
56
|
+
}) {
|
|
57
|
+
const fc = create(CapturedFileChangeSchema, {
|
|
58
|
+
id: "cs:0:p",
|
|
59
|
+
pathBefore: "p",
|
|
60
|
+
pathAfter: "p",
|
|
61
|
+
kind: opts.kind ?? FileChangeKind.MODIFY,
|
|
62
|
+
diffComplete: opts.diffComplete,
|
|
63
|
+
blockedReason: opts.blockedReason ?? FileReviewBlockReason.UNSPECIFIED,
|
|
64
|
+
});
|
|
65
|
+
if (opts.before) fc.before = opts.before;
|
|
66
|
+
if (opts.after) fc.after = opts.after;
|
|
67
|
+
return fc;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
describe("fileReviewability", () => {
|
|
71
|
+
it("classifies a complete text diff as reviewable", () => {
|
|
72
|
+
expect(
|
|
73
|
+
fileReviewability(
|
|
74
|
+
change({ diffComplete: true, before: inline("old\n"), after: inline("new\n") }),
|
|
75
|
+
),
|
|
76
|
+
).toEqual({ kind: "reviewable" });
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("stays reviewable when complete even if a side is (incongruously) flagged binary — diff_complete wins", () => {
|
|
80
|
+
// diff_complete is the authoritative signal; a complete change is reviewable.
|
|
81
|
+
expect(
|
|
82
|
+
fileReviewability(
|
|
83
|
+
change({ diffComplete: true, before: inline("a", true), after: inline("b", true) }),
|
|
84
|
+
),
|
|
85
|
+
).toEqual({ kind: "reviewable" });
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("classifies an incomplete change with a binary before side as binary", () => {
|
|
89
|
+
expect(
|
|
90
|
+
fileReviewability(
|
|
91
|
+
change({ diffComplete: false, before: inline("\u0000\u0001", true), after: inline("\u0000", true) }),
|
|
92
|
+
),
|
|
93
|
+
).toEqual({ kind: "binary" });
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("classifies an incomplete change with only an after binary side as binary", () => {
|
|
97
|
+
expect(
|
|
98
|
+
fileReviewability(change({ diffComplete: false, after: inline("\u0000", true) })),
|
|
99
|
+
).toEqual({ kind: "binary" });
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("classifies a binary side that was offloaded to a ref as binary (offload preserves is_binary)", () => {
|
|
103
|
+
expect(
|
|
104
|
+
fileReviewability(change({ diffComplete: false, after: ref(true) })),
|
|
105
|
+
).toEqual({ kind: "binary" });
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("prefers binary over a stray blocked_reason (is_binary is the authoritative binary signal)", () => {
|
|
109
|
+
// Defensive: even if a reason were somehow set on a binary change, the wire
|
|
110
|
+
// proves binary via is_binary, which the classifier resolves first.
|
|
111
|
+
expect(
|
|
112
|
+
fileReviewability(
|
|
113
|
+
change({
|
|
114
|
+
diffComplete: false,
|
|
115
|
+
after: inline("\u0000", true),
|
|
116
|
+
blockedReason: FileReviewBlockReason.SIZE_ELIDED,
|
|
117
|
+
}),
|
|
118
|
+
),
|
|
119
|
+
).toEqual({ kind: "binary" });
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("classifies a secret-withheld change as unavailable with reason 'secret' (doc 15)", () => {
|
|
123
|
+
// The secret gate authors the change content-less, diff_complete=false, and
|
|
124
|
+
// records SECRET_WITHHELD so the UI can say *why*.
|
|
125
|
+
expect(
|
|
126
|
+
fileReviewability(
|
|
127
|
+
change({ diffComplete: false, blockedReason: FileReviewBlockReason.SECRET_WITHHELD }),
|
|
128
|
+
),
|
|
129
|
+
).toEqual({ kind: "unavailable", reason: "secret" });
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it("classifies a size-elided change as unavailable with reason 'size' — distinct from secret (doc 15)", () => {
|
|
133
|
+
// The size backstop drops the inline bodies, sets diff_complete=false, and
|
|
134
|
+
// records SIZE_ELIDED. Once byte-identical to the secret case; now honestly
|
|
135
|
+
// distinguished by the recorded reason.
|
|
136
|
+
expect(
|
|
137
|
+
fileReviewability(
|
|
138
|
+
change({ diffComplete: false, blockedReason: FileReviewBlockReason.SIZE_ELIDED }),
|
|
139
|
+
),
|
|
140
|
+
).toEqual({ kind: "unavailable", reason: "size" });
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it("classifies a content-less change with no recorded reason as unavailable/'unknown'", () => {
|
|
144
|
+
// Historical rows (pre doc 15) and any future/unmapped cause fall back to the
|
|
145
|
+
// defensive generic bucket rather than fabricating a specific cause.
|
|
146
|
+
expect(fileReviewability(change({ diffComplete: false }))).toEqual({
|
|
147
|
+
kind: "unavailable",
|
|
148
|
+
reason: "unknown",
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it("maps the generic UNREVIEWABLE reason to 'unknown'", () => {
|
|
153
|
+
expect(
|
|
154
|
+
fileReviewability(
|
|
155
|
+
change({ diffComplete: false, blockedReason: FileReviewBlockReason.UNREVIEWABLE }),
|
|
156
|
+
),
|
|
157
|
+
).toEqual({ kind: "unavailable", reason: "unknown" });
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it("does not misread a one-sided binary ADD as unavailable", () => {
|
|
161
|
+
expect(
|
|
162
|
+
fileReviewability(
|
|
163
|
+
change({ kind: FileChangeKind.ADD, diffComplete: false, after: inline("\u0000", true) }),
|
|
164
|
+
),
|
|
165
|
+
).toEqual({ kind: "binary" });
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it("does not misread a one-sided binary DELETE as unavailable", () => {
|
|
169
|
+
expect(
|
|
170
|
+
fileReviewability(
|
|
171
|
+
change({ kind: FileChangeKind.DELETE, diffComplete: false, before: inline("\u0000", true) }),
|
|
172
|
+
),
|
|
173
|
+
).toEqual({ kind: "binary" });
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
describe("changeSetReviewability", () => {
|
|
178
|
+
function set(completeness: DiffCompleteness) {
|
|
179
|
+
return create(FileChangeSetSchema, { id: "cs", diffCompleteness: completeness });
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
it("maps the server rollup to the set-level verdict", () => {
|
|
183
|
+
expect(changeSetReviewability(set(DiffCompleteness.COMPLETE))).toBe("complete");
|
|
184
|
+
expect(changeSetReviewability(set(DiffCompleteness.BINARY_SUMMARY_ONLY))).toBe("binary-only");
|
|
185
|
+
expect(changeSetReviewability(set(DiffCompleteness.PARTIAL_BLOCKED))).toBe("blocked");
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it("treats UNSPECIFIED as blocked (fail-closed)", () => {
|
|
189
|
+
expect(changeSetReviewability(set(DiffCompleteness.UNSPECIFIED))).toBe("blocked");
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// ---------------------------------------------------------------------------
|
|
194
|
+
// Effective verdicts + the stamped row's badge state
|
|
195
|
+
// ---------------------------------------------------------------------------
|
|
196
|
+
|
|
197
|
+
function fileChange(id: string, path: string) {
|
|
198
|
+
return create(CapturedFileChangeSchema, {
|
|
199
|
+
id,
|
|
200
|
+
pathBefore: path,
|
|
201
|
+
pathAfter: path,
|
|
202
|
+
kind: FileChangeKind.MODIFY,
|
|
203
|
+
diffComplete: true,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function decision(opts: {
|
|
208
|
+
scope: FileDecisionScope;
|
|
209
|
+
action: FileDecisionAction;
|
|
210
|
+
fileChangeId?: string;
|
|
211
|
+
}): FileDecision {
|
|
212
|
+
return create(FileDecisionSchema, {
|
|
213
|
+
changeSetId: "cs:0",
|
|
214
|
+
scope: opts.scope,
|
|
215
|
+
action: opts.action,
|
|
216
|
+
fileChangeId: opts.fileChangeId ?? "",
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function reviewSet(opts: {
|
|
221
|
+
status: FileChangeSetStatus;
|
|
222
|
+
changes?: ReturnType<typeof fileChange>[];
|
|
223
|
+
decisions?: FileDecision[];
|
|
224
|
+
}) {
|
|
225
|
+
return create(FileChangeSetSchema, {
|
|
226
|
+
id: "cs:0",
|
|
227
|
+
status: opts.status,
|
|
228
|
+
changes: opts.changes ?? [fileChange("cs:0:a.ts", "a.ts")],
|
|
229
|
+
decisions: opts.decisions ?? [],
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
describe("deriveEffectiveVerdicts", () => {
|
|
234
|
+
it("applies a CHANGE_SET decision to every file (a settled 'Keep all')", () => {
|
|
235
|
+
const set = reviewSet({
|
|
236
|
+
status: FileChangeSetStatus.RECONCILED,
|
|
237
|
+
changes: [fileChange("f1", "a.ts"), fileChange("f2", "b.ts")],
|
|
238
|
+
decisions: [decision({ scope: FileDecisionScope.CHANGE_SET, action: FileDecisionAction.APPROVE })],
|
|
239
|
+
});
|
|
240
|
+
const verdicts = deriveEffectiveVerdicts(set);
|
|
241
|
+
expect(verdicts.get("f1")).toBe(FileDecisionAction.APPROVE);
|
|
242
|
+
expect(verdicts.get("f2")).toBe(FileDecisionAction.APPROVE);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it("lets a FILE decision override the CHANGE_SET baseline (most-specific-wins)", () => {
|
|
246
|
+
const set = reviewSet({
|
|
247
|
+
status: FileChangeSetStatus.RECONCILED,
|
|
248
|
+
changes: [fileChange("f1", "a.ts"), fileChange("f2", "b.ts")],
|
|
249
|
+
decisions: [
|
|
250
|
+
decision({ scope: FileDecisionScope.FILE, action: FileDecisionAction.REJECT, fileChangeId: "f2" }),
|
|
251
|
+
decision({ scope: FileDecisionScope.CHANGE_SET, action: FileDecisionAction.APPROVE }),
|
|
252
|
+
],
|
|
253
|
+
});
|
|
254
|
+
const verdicts = deriveEffectiveVerdicts(set);
|
|
255
|
+
expect(verdicts.get("f1")).toBe(FileDecisionAction.APPROVE);
|
|
256
|
+
// FILE beats CHANGE_SET regardless of ledger order.
|
|
257
|
+
expect(verdicts.get("f2")).toBe(FileDecisionAction.REJECT);
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
it("leaves an undecided file absent (a set terminated mid-review)", () => {
|
|
261
|
+
const set = reviewSet({
|
|
262
|
+
status: FileChangeSetStatus.DECIDED,
|
|
263
|
+
changes: [fileChange("f1", "a.ts"), fileChange("f2", "b.ts")],
|
|
264
|
+
decisions: [decision({ scope: FileDecisionScope.FILE, action: FileDecisionAction.APPROVE, fileChangeId: "f1" })],
|
|
265
|
+
});
|
|
266
|
+
const verdicts = deriveEffectiveVerdicts(set);
|
|
267
|
+
expect(verdicts.get("f1")).toBe(FileDecisionAction.APPROVE);
|
|
268
|
+
expect(verdicts.has("f2")).toBe(false);
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
describe("changeForRowPath", () => {
|
|
273
|
+
const set = reviewSet({
|
|
274
|
+
status: FileChangeSetStatus.AWAITING_REVIEW,
|
|
275
|
+
changes: [fileChange("f1", "src/a.ts")],
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it("matches an exact workspace-relative path", () => {
|
|
279
|
+
expect(changeForRowPath(set, "src/a.ts")?.id).toBe("f1");
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
it("matches an absolute row path by /-boundary suffix", () => {
|
|
283
|
+
expect(changeForRowPath(set, "/home/user/ws/src/a.ts")?.id).toBe("f1");
|
|
284
|
+
// A partial-segment overlap is NOT a match.
|
|
285
|
+
expect(changeForRowPath(set, "othersrc/a.ts")).toBeNull();
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
it("returns null for an unknown or empty path", () => {
|
|
289
|
+
expect(changeForRowPath(set, "src/b.ts")).toBeNull();
|
|
290
|
+
expect(changeForRowPath(set, "")).toBeNull();
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
describe("fileReviewRowState", () => {
|
|
295
|
+
it("returns null with no set (not yet projected / unknown id)", () => {
|
|
296
|
+
expect(fileReviewRowState(undefined, "a.ts")).toBeNull();
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
it("reads AWAITING_REVIEW as pending regardless of path", () => {
|
|
300
|
+
const set = reviewSet({ status: FileChangeSetStatus.AWAITING_REVIEW });
|
|
301
|
+
expect(fileReviewRowState(set, "a.ts")).toBe("pending");
|
|
302
|
+
expect(fileReviewRowState(set, null)).toBe("pending");
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it("reads FAILED as failed", () => {
|
|
306
|
+
expect(
|
|
307
|
+
fileReviewRowState(reviewSet({ status: FileChangeSetStatus.FAILED }), "a.ts"),
|
|
308
|
+
).toBe("failed");
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
it("resolves a decided file's verdict by row path (kept / discarded)", () => {
|
|
312
|
+
const set = reviewSet({
|
|
313
|
+
status: FileChangeSetStatus.RECONCILED,
|
|
314
|
+
changes: [fileChange("f1", "a.ts"), fileChange("f2", "b.ts")],
|
|
315
|
+
decisions: [
|
|
316
|
+
decision({ scope: FileDecisionScope.FILE, action: FileDecisionAction.APPROVE, fileChangeId: "f1" }),
|
|
317
|
+
decision({ scope: FileDecisionScope.FILE, action: FileDecisionAction.REJECT, fileChangeId: "f2" }),
|
|
318
|
+
],
|
|
319
|
+
});
|
|
320
|
+
expect(fileReviewRowState(set, "a.ts")).toBe("kept");
|
|
321
|
+
expect(fileReviewRowState(set, "/abs/ws/b.ts")).toBe("discarded");
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
it("degrades to null — never a wrong badge — for a file absent from the set or with no verdict", () => {
|
|
325
|
+
const set = reviewSet({
|
|
326
|
+
status: FileChangeSetStatus.DECIDED,
|
|
327
|
+
changes: [fileChange("f1", "a.ts")],
|
|
328
|
+
decisions: [],
|
|
329
|
+
});
|
|
330
|
+
// Superseded/reverted within the turn: the row's file is not in the set.
|
|
331
|
+
expect(fileReviewRowState(set, "gone.ts")).toBeNull();
|
|
332
|
+
// In the set but never decided (terminated mid-review).
|
|
333
|
+
expect(fileReviewRowState(set, "a.ts")).toBeNull();
|
|
334
|
+
// No usable path on the row.
|
|
335
|
+
expect(fileReviewRowState(set, null)).toBeNull();
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
it("returns null for a CAPTURING set (no reviewable state yet)", () => {
|
|
339
|
+
expect(
|
|
340
|
+
fileReviewRowState(reviewSet({ status: FileChangeSetStatus.CAPTURING }), "a.ts"),
|
|
341
|
+
).toBeNull();
|
|
342
|
+
});
|
|
343
|
+
});
|
|
@@ -153,6 +153,22 @@ describe("MessageEntry — AI messages (Streamdown)", () => {
|
|
|
153
153
|
const article = queryArticle(container, "AI response");
|
|
154
154
|
expect(article!.querySelector("pre")).not.toBeNull();
|
|
155
155
|
});
|
|
156
|
+
|
|
157
|
+
it("syntax-highlights fenced code in the chat stream (Streamdown path)", () => {
|
|
158
|
+
const msg = makeMessage(
|
|
159
|
+
MessageType.MESSAGE_AI,
|
|
160
|
+
"```go\nfunc main() {}\n```",
|
|
161
|
+
);
|
|
162
|
+
const { container } = render(<MessageEntry message={msg} />);
|
|
163
|
+
|
|
164
|
+
const article = queryArticle(container, "AI response");
|
|
165
|
+
// Streamdown routes fenced code through the shared MARKDOWN_COMPONENTS.code
|
|
166
|
+
// override, so chat highlights identically to the artifact viewer.
|
|
167
|
+
expect(article!.querySelector("code.hljs")).not.toBeNull();
|
|
168
|
+
expect(
|
|
169
|
+
article!.querySelectorAll('span[class*="hljs-"]').length,
|
|
170
|
+
).toBeGreaterThan(0);
|
|
171
|
+
});
|
|
156
172
|
});
|
|
157
173
|
|
|
158
174
|
// ---------------------------------------------------------------------------
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { create, type JsonObject } from "@bufbuild/protobuf";
|
|
3
|
+
import {
|
|
4
|
+
ToolCallSchema,
|
|
5
|
+
type ToolCall,
|
|
6
|
+
} from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
|
|
7
|
+
import { segmentToolCalls } from "../segment-tool-calls";
|
|
8
|
+
import { registerToolPresenter } from "../tool-presenter";
|
|
9
|
+
import { ToolKind } from "@stigmer/sdk";
|
|
10
|
+
|
|
11
|
+
function tc(name: string, id: string, args?: Record<string, unknown>): ToolCall {
|
|
12
|
+
return create(ToolCallSchema, {
|
|
13
|
+
id,
|
|
14
|
+
name,
|
|
15
|
+
args: (args ?? { path: `/x/${id}`, pattern: "p", command: "ls" }) as JsonObject,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
describe("segmentToolCalls", () => {
|
|
20
|
+
it("folds a run of >= 2 consecutive same-category groupable calls", () => {
|
|
21
|
+
const calls = [tc("Read", "r1"), tc("Read", "r2"), tc("Read", "r3")];
|
|
22
|
+
const segments = segmentToolCalls(calls);
|
|
23
|
+
|
|
24
|
+
expect(segments).toHaveLength(1);
|
|
25
|
+
const [seg] = segments;
|
|
26
|
+
expect(seg.kind).toBe("run");
|
|
27
|
+
if (seg.kind === "run") {
|
|
28
|
+
expect(seg.category).toBe("read");
|
|
29
|
+
expect(seg.toolCalls).toHaveLength(3);
|
|
30
|
+
// Slice preserves the original references (structural-sharing friendly).
|
|
31
|
+
expect(seg.toolCalls[0]).toBe(calls[0]);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("leaves a lone groupable call as a row (no one-item chip)", () => {
|
|
36
|
+
const calls = [tc("Read", "r1")];
|
|
37
|
+
const segments = segmentToolCalls(calls);
|
|
38
|
+
|
|
39
|
+
expect(segments).toHaveLength(1);
|
|
40
|
+
expect(segments[0].kind).toBe("row");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("never folds high-signal categories (shell, edit)", () => {
|
|
44
|
+
const calls = [
|
|
45
|
+
tc("Shell", "s1", { command: "echo a" }),
|
|
46
|
+
tc("Shell", "s2", { command: "echo b" }),
|
|
47
|
+
tc("StrReplace", "e1", { path: "/a.ts", old_string: "a", new_string: "b" }),
|
|
48
|
+
];
|
|
49
|
+
const segments = segmentToolCalls(calls);
|
|
50
|
+
|
|
51
|
+
expect(segments).toHaveLength(3);
|
|
52
|
+
expect(segments.every((s) => s.kind === "row")).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("preserves chronology — interleaved categories stay separate rows", () => {
|
|
56
|
+
// read, search, read: three runs of length 1, so three rows in order.
|
|
57
|
+
const calls = [tc("Read", "r1"), tc("Grep", "g1"), tc("Read", "r2")];
|
|
58
|
+
const segments = segmentToolCalls(calls);
|
|
59
|
+
|
|
60
|
+
expect(segments.map((s) => s.kind)).toEqual(["row", "row", "row"]);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("splits adjacent runs of different groupable categories", () => {
|
|
64
|
+
// read, read, search, search -> two chips, in order.
|
|
65
|
+
const calls = [
|
|
66
|
+
tc("Read", "r1"),
|
|
67
|
+
tc("Read", "r2"),
|
|
68
|
+
tc("Grep", "g1"),
|
|
69
|
+
tc("Grep", "g2"),
|
|
70
|
+
];
|
|
71
|
+
const segments = segmentToolCalls(calls);
|
|
72
|
+
|
|
73
|
+
expect(segments).toHaveLength(2);
|
|
74
|
+
expect(segments[0].kind).toBe("run");
|
|
75
|
+
expect(segments[1].kind).toBe("run");
|
|
76
|
+
if (segments[0].kind === "run") expect(segments[0].category).toBe("read");
|
|
77
|
+
if (segments[1].kind === "run") expect(segments[1].category).toBe("search");
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("folds a run that is bounded by high-signal rows on both sides", () => {
|
|
81
|
+
const calls = [
|
|
82
|
+
tc("Shell", "s1", { command: "echo a" }),
|
|
83
|
+
tc("Read", "r1"),
|
|
84
|
+
tc("Read", "r2"),
|
|
85
|
+
tc("Shell", "s2", { command: "echo b" }),
|
|
86
|
+
];
|
|
87
|
+
const segments = segmentToolCalls(calls);
|
|
88
|
+
|
|
89
|
+
expect(segments.map((s) => s.kind)).toEqual(["row", "run", "row"]);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("emits stable, distinct keys per segment", () => {
|
|
93
|
+
const calls = [tc("Read", "r1"), tc("Read", "r2"), tc("Shell", "s1")];
|
|
94
|
+
const segments = segmentToolCalls(calls);
|
|
95
|
+
const keys = segments.map((s) => s.key);
|
|
96
|
+
|
|
97
|
+
expect(new Set(keys).size).toBe(keys.length);
|
|
98
|
+
// Run key is derived from its category + first call id; stable across runs.
|
|
99
|
+
expect(segmentToolCalls(calls).map((s) => s.key)).toEqual(keys);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("returns an empty list for no tool calls", () => {
|
|
103
|
+
expect(segmentToolCalls([])).toEqual([]);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("honours a registry runGroupable override", () => {
|
|
107
|
+
// Force shell to fold; two adjacent shells then become one run chip.
|
|
108
|
+
const dispose = registerToolPresenter(ToolKind.SHELL, {
|
|
109
|
+
runGroupable: () => true,
|
|
110
|
+
});
|
|
111
|
+
try {
|
|
112
|
+
const calls = [
|
|
113
|
+
tc("Shell", "s1", { command: "echo a" }),
|
|
114
|
+
tc("Shell", "s2", { command: "echo b" }),
|
|
115
|
+
];
|
|
116
|
+
const segments = segmentToolCalls(calls);
|
|
117
|
+
expect(segments).toHaveLength(1);
|
|
118
|
+
expect(segments[0].kind).toBe("run");
|
|
119
|
+
if (segments[0].kind === "run") expect(segments[0].category).toBe("shell");
|
|
120
|
+
} finally {
|
|
121
|
+
dispose();
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
});
|