@smthrs/harness 0.0.0-stage → 1.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +387 -0
- package/LICENSE +21 -0
- package/README.md +138 -2
- package/dist/cjs/AgentEvent.d.ts +3092 -0
- package/dist/cjs/AgentEvent.d.ts.map +1 -0
- package/dist/cjs/AgentEvent.js +1116 -0
- package/dist/cjs/AgentEvent.js.map +7 -0
- package/dist/cjs/CallLedger.d.ts +378 -0
- package/dist/cjs/CallLedger.d.ts.map +1 -0
- package/dist/cjs/CallLedger.js +240 -0
- package/dist/cjs/CallLedger.js.map +7 -0
- package/dist/cjs/Cell.d.ts +774 -0
- package/dist/cjs/Cell.d.ts.map +1 -0
- package/dist/cjs/Cell.js +431 -0
- package/dist/cjs/Cell.js.map +7 -0
- package/dist/cjs/CellCalls.d.ts +115 -0
- package/dist/cjs/CellCalls.d.ts.map +1 -0
- package/dist/cjs/CellCalls.js +98 -0
- package/dist/cjs/CellCalls.js.map +7 -0
- package/dist/cjs/CellHistory.d.ts +102 -0
- package/dist/cjs/CellHistory.d.ts.map +1 -0
- package/dist/cjs/CellHistory.js +54 -0
- package/dist/cjs/CellHistory.js.map +7 -0
- package/dist/cjs/CellTurn.d.ts +1071 -0
- package/dist/cjs/CellTurn.d.ts.map +1 -0
- package/dist/cjs/CellTurn.js +2618 -0
- package/dist/cjs/CellTurn.js.map +7 -0
- package/dist/cjs/CellValidation.d.ts +94 -0
- package/dist/cjs/CellValidation.d.ts.map +1 -0
- package/dist/cjs/CellValidation.js +218 -0
- package/dist/cjs/CellValidation.js.map +7 -0
- package/dist/cjs/Compaction.d.ts +158 -0
- package/dist/cjs/Compaction.d.ts.map +1 -0
- package/dist/cjs/Compaction.js +189 -0
- package/dist/cjs/Compaction.js.map +7 -0
- package/dist/cjs/CompletionClaim.d.ts +801 -0
- package/dist/cjs/CompletionClaim.d.ts.map +1 -0
- package/dist/cjs/CompletionClaim.js +303 -0
- package/dist/cjs/CompletionClaim.js.map +7 -0
- package/dist/cjs/ContextWindow.d.ts +435 -0
- package/dist/cjs/ContextWindow.d.ts.map +1 -0
- package/dist/cjs/ContextWindow.js +319 -0
- package/dist/cjs/ContextWindow.js.map +7 -0
- package/dist/cjs/EngineLike.d.ts +546 -0
- package/dist/cjs/EngineLike.d.ts.map +1 -0
- package/dist/cjs/EngineLike.js +114 -0
- package/dist/cjs/EngineLike.js.map +7 -0
- package/dist/cjs/ExternalTranscript.d.ts +349 -0
- package/dist/cjs/ExternalTranscript.d.ts.map +1 -0
- package/dist/cjs/ExternalTranscript.js +826 -0
- package/dist/cjs/ExternalTranscript.js.map +7 -0
- package/dist/cjs/FailedCall.d.ts +132 -0
- package/dist/cjs/FailedCall.d.ts.map +1 -0
- package/dist/cjs/FailedCall.js +53 -0
- package/dist/cjs/FailedCall.js.map +7 -0
- package/dist/cjs/FlowBinding.d.ts +289 -0
- package/dist/cjs/FlowBinding.d.ts.map +1 -0
- package/dist/cjs/FlowBinding.js +251 -0
- package/dist/cjs/FlowBinding.js.map +7 -0
- package/dist/cjs/HarnessError.d.ts +57 -0
- package/dist/cjs/HarnessError.d.ts.map +1 -0
- package/dist/cjs/HarnessError.js +75 -0
- package/dist/cjs/HarnessError.js.map +7 -0
- package/dist/cjs/Judgement.d.ts +289 -0
- package/dist/cjs/Judgement.d.ts.map +1 -0
- package/dist/cjs/Judgement.js +240 -0
- package/dist/cjs/Judgement.js.map +7 -0
- package/dist/cjs/Monitor.d.ts +374 -0
- package/dist/cjs/Monitor.d.ts.map +1 -0
- package/dist/cjs/Monitor.js +233 -0
- package/dist/cjs/Monitor.js.map +7 -0
- package/dist/cjs/NarrowedCheck.d.ts +523 -0
- package/dist/cjs/NarrowedCheck.d.ts.map +1 -0
- package/dist/cjs/NarrowedCheck.js +263 -0
- package/dist/cjs/NarrowedCheck.js.map +7 -0
- package/dist/cjs/Notifications.d.ts +42 -0
- package/dist/cjs/Notifications.d.ts.map +1 -0
- package/dist/cjs/Notifications.js +177 -0
- package/dist/cjs/Notifications.js.map +7 -0
- package/dist/cjs/Plan.d.ts +127 -0
- package/dist/cjs/Plan.d.ts.map +1 -0
- package/dist/cjs/Plan.js +77 -0
- package/dist/cjs/Plan.js.map +7 -0
- package/dist/cjs/QuickJSSandbox.d.ts +151 -0
- package/dist/cjs/QuickJSSandbox.d.ts.map +1 -0
- package/dist/cjs/QuickJSSandbox.js +987 -0
- package/dist/cjs/QuickJSSandbox.js.map +7 -0
- package/dist/cjs/Relevance.d.ts +213 -0
- package/dist/cjs/Relevance.d.ts.map +1 -0
- package/dist/cjs/Relevance.js +183 -0
- package/dist/cjs/Relevance.js.map +7 -0
- package/dist/cjs/Sandbox.d.ts +637 -0
- package/dist/cjs/Sandbox.d.ts.map +1 -0
- package/dist/cjs/Sandbox.js +260 -0
- package/dist/cjs/Sandbox.js.map +7 -0
- package/dist/cjs/Steering.d.ts +464 -0
- package/dist/cjs/Steering.d.ts.map +1 -0
- package/dist/cjs/Steering.js +153 -0
- package/dist/cjs/Steering.js.map +7 -0
- package/dist/cjs/StructuredOutput.d.ts +252 -0
- package/dist/cjs/StructuredOutput.d.ts.map +1 -0
- package/dist/cjs/StructuredOutput.js +266 -0
- package/dist/cjs/StructuredOutput.js.map +7 -0
- package/dist/cjs/Sufficiency.d.ts +195 -0
- package/dist/cjs/Sufficiency.d.ts.map +1 -0
- package/dist/cjs/Sufficiency.js +110 -0
- package/dist/cjs/Sufficiency.js.map +7 -0
- package/dist/cjs/Supervisor.d.ts +719 -0
- package/dist/cjs/Supervisor.d.ts.map +1 -0
- package/dist/cjs/Supervisor.js +313 -0
- package/dist/cjs/Supervisor.js.map +7 -0
- package/dist/cjs/Tokens.d.ts +86 -0
- package/dist/cjs/Tokens.d.ts.map +1 -0
- package/dist/cjs/Tokens.js +72 -0
- package/dist/cjs/Tokens.js.map +7 -0
- package/dist/cjs/Transcript.d.ts +171 -0
- package/dist/cjs/Transcript.d.ts.map +1 -0
- package/dist/cjs/Transcript.js +342 -0
- package/dist/cjs/Transcript.js.map +7 -0
- package/dist/cjs/TruncatedOutput.d.ts +186 -0
- package/dist/cjs/TruncatedOutput.d.ts.map +1 -0
- package/dist/cjs/TruncatedOutput.js +143 -0
- package/dist/cjs/TruncatedOutput.js.map +7 -0
- package/dist/cjs/UnmovedTree.d.ts +113 -0
- package/dist/cjs/UnmovedTree.d.ts.map +1 -0
- package/dist/cjs/UnmovedTree.js +38 -0
- package/dist/cjs/UnmovedTree.js.map +7 -0
- package/dist/cjs/UnresolvedFailure.d.ts +196 -0
- package/dist/cjs/UnresolvedFailure.d.ts.map +1 -0
- package/dist/cjs/UnresolvedFailure.js +77 -0
- package/dist/cjs/UnresolvedFailure.js.map +7 -0
- package/dist/cjs/VacuousVerification.d.ts +237 -0
- package/dist/cjs/VacuousVerification.d.ts.map +1 -0
- package/dist/cjs/VacuousVerification.js +91 -0
- package/dist/cjs/VacuousVerification.js.map +7 -0
- package/dist/cjs/VariablesPanel.d.ts +117 -0
- package/dist/cjs/VariablesPanel.d.ts.map +1 -0
- package/dist/cjs/VariablesPanel.js +108 -0
- package/dist/cjs/VariablesPanel.js.map +7 -0
- package/dist/cjs/index.d.ts +172 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +99 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/bytes.d.ts +36 -0
- package/dist/cjs/internal/bytes.d.ts.map +1 -0
- package/dist/cjs/internal/bytes.js +57 -0
- package/dist/cjs/internal/bytes.js.map +7 -0
- package/dist/cjs/internal/cellPrompt.d.ts +122 -0
- package/dist/cjs/internal/cellPrompt.d.ts.map +1 -0
- package/dist/cjs/internal/cellPrompt.js +146 -0
- package/dist/cjs/internal/cellPrompt.js.map +7 -0
- package/dist/cjs/internal/compactable.d.ts +44 -0
- package/dist/cjs/internal/compactable.d.ts.map +1 -0
- package/dist/cjs/internal/compactable.js +56 -0
- package/dist/cjs/internal/compactable.js.map +7 -0
- package/dist/cjs/internal/compactionMarks.d.ts +278 -0
- package/dist/cjs/internal/compactionMarks.d.ts.map +1 -0
- package/dist/cjs/internal/compactionMarks.js +212 -0
- package/dist/cjs/internal/compactionMarks.js.map +7 -0
- package/dist/cjs/internal/demandText.d.ts +95 -0
- package/dist/cjs/internal/demandText.d.ts.map +1 -0
- package/dist/cjs/internal/demandText.js +70 -0
- package/dist/cjs/internal/demandText.js.map +7 -0
- package/dist/cjs/internal/elide.d.ts +109 -0
- package/dist/cjs/internal/elide.d.ts.map +1 -0
- package/dist/cjs/internal/elide.js +59 -0
- package/dist/cjs/internal/elide.js.map +7 -0
- package/dist/cjs/internal/frame.d.ts +463 -0
- package/dist/cjs/internal/frame.d.ts.map +1 -0
- package/dist/cjs/internal/frame.js +514 -0
- package/dist/cjs/internal/frame.js.map +7 -0
- package/dist/cjs/internal/nonNegativeSafeInt.d.ts +20 -0
- package/dist/cjs/internal/nonNegativeSafeInt.d.ts.map +1 -0
- package/dist/cjs/internal/nonNegativeSafeInt.js +29 -0
- package/dist/cjs/internal/nonNegativeSafeInt.js.map +7 -0
- package/dist/cjs/internal/paidUsage.d.ts +52 -0
- package/dist/cjs/internal/paidUsage.d.ts.map +1 -0
- package/dist/cjs/internal/paidUsage.js +70 -0
- package/dist/cjs/internal/paidUsage.js.map +7 -0
- package/dist/cjs/internal/printChannel.d.ts +233 -0
- package/dist/cjs/internal/printChannel.d.ts.map +1 -0
- package/dist/cjs/internal/printChannel.js +165 -0
- package/dist/cjs/internal/printChannel.js.map +7 -0
- package/dist/cjs/internal/printsObservation.d.ts +26 -0
- package/dist/cjs/internal/printsObservation.d.ts.map +1 -0
- package/dist/cjs/internal/printsObservation.js +27 -0
- package/dist/cjs/internal/printsObservation.js.map +7 -0
- package/dist/cjs/internal/refusal.d.ts +40 -0
- package/dist/cjs/internal/refusal.d.ts.map +1 -0
- package/dist/cjs/internal/refusal.js +45 -0
- package/dist/cjs/internal/refusal.js.map +7 -0
- package/dist/cjs/internal/supervision.d.ts +174 -0
- package/dist/cjs/internal/supervision.d.ts.map +1 -0
- package/dist/cjs/internal/supervision.js +402 -0
- package/dist/cjs/internal/supervision.js.map +7 -0
- package/dist/cjs/internal/unfinishedWork.d.ts +99 -0
- package/dist/cjs/internal/unfinishedWork.d.ts.map +1 -0
- package/dist/cjs/internal/unfinishedWork.js +80 -0
- package/dist/cjs/internal/unfinishedWork.js.map +7 -0
- package/dist/cjs/internal/unobservedCall.d.ts +112 -0
- package/dist/cjs/internal/unobservedCall.d.ts.map +1 -0
- package/dist/cjs/internal/unobservedCall.js +345 -0
- package/dist/cjs/internal/unobservedCall.js.map +7 -0
- package/dist/cjs/internal/untrustedData.d.ts +14 -0
- package/dist/cjs/internal/untrustedData.d.ts.map +1 -0
- package/dist/cjs/internal/untrustedData.js +30 -0
- package/dist/cjs/internal/untrustedData.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/AgentEvent.d.ts +3092 -0
- package/dist/esm/AgentEvent.d.ts.map +1 -0
- package/dist/esm/AgentEvent.js +1610 -0
- package/dist/esm/AgentEvent.js.map +1 -0
- package/dist/esm/CallLedger.d.ts +378 -0
- package/dist/esm/CallLedger.d.ts.map +1 -0
- package/dist/esm/CallLedger.js +506 -0
- package/dist/esm/CallLedger.js.map +1 -0
- package/dist/esm/Cell.d.ts +774 -0
- package/dist/esm/Cell.d.ts.map +1 -0
- package/dist/esm/Cell.js +772 -0
- package/dist/esm/Cell.js.map +1 -0
- package/dist/esm/CellCalls.d.ts +115 -0
- package/dist/esm/CellCalls.d.ts.map +1 -0
- package/dist/esm/CellCalls.js +97 -0
- package/dist/esm/CellCalls.js.map +1 -0
- package/dist/esm/CellHistory.d.ts +102 -0
- package/dist/esm/CellHistory.d.ts.map +1 -0
- package/dist/esm/CellHistory.js +91 -0
- package/dist/esm/CellHistory.js.map +1 -0
- package/dist/esm/CellTurn.d.ts +1071 -0
- package/dist/esm/CellTurn.d.ts.map +1 -0
- package/dist/esm/CellTurn.js +3410 -0
- package/dist/esm/CellTurn.js.map +1 -0
- package/dist/esm/CellValidation.d.ts +94 -0
- package/dist/esm/CellValidation.d.ts.map +1 -0
- package/dist/esm/CellValidation.js +335 -0
- package/dist/esm/CellValidation.js.map +1 -0
- package/dist/esm/Compaction.d.ts +158 -0
- package/dist/esm/Compaction.d.ts.map +1 -0
- package/dist/esm/Compaction.js +216 -0
- package/dist/esm/Compaction.js.map +1 -0
- package/dist/esm/CompletionClaim.d.ts +801 -0
- package/dist/esm/CompletionClaim.d.ts.map +1 -0
- package/dist/esm/CompletionClaim.js +833 -0
- package/dist/esm/CompletionClaim.js.map +1 -0
- package/dist/esm/ContextWindow.d.ts +435 -0
- package/dist/esm/ContextWindow.d.ts.map +1 -0
- package/dist/esm/ContextWindow.js +427 -0
- package/dist/esm/ContextWindow.js.map +1 -0
- package/dist/esm/EngineLike.d.ts +546 -0
- package/dist/esm/EngineLike.d.ts.map +1 -0
- package/dist/esm/EngineLike.js +218 -0
- package/dist/esm/EngineLike.js.map +1 -0
- package/dist/esm/ExternalTranscript.d.ts +349 -0
- package/dist/esm/ExternalTranscript.d.ts.map +1 -0
- package/dist/esm/ExternalTranscript.js +985 -0
- package/dist/esm/ExternalTranscript.js.map +1 -0
- package/dist/esm/FailedCall.d.ts +132 -0
- package/dist/esm/FailedCall.d.ts.map +1 -0
- package/dist/esm/FailedCall.js +131 -0
- package/dist/esm/FailedCall.js.map +1 -0
- package/dist/esm/FlowBinding.d.ts +289 -0
- package/dist/esm/FlowBinding.d.ts.map +1 -0
- package/dist/esm/FlowBinding.js +376 -0
- package/dist/esm/FlowBinding.js.map +1 -0
- package/dist/esm/HarnessError.d.ts +57 -0
- package/dist/esm/HarnessError.d.ts.map +1 -0
- package/dist/esm/HarnessError.js +85 -0
- package/dist/esm/HarnessError.js.map +1 -0
- package/dist/esm/Judgement.d.ts +289 -0
- package/dist/esm/Judgement.d.ts.map +1 -0
- package/dist/esm/Judgement.js +305 -0
- package/dist/esm/Judgement.js.map +1 -0
- package/dist/esm/Monitor.d.ts +374 -0
- package/dist/esm/Monitor.d.ts.map +1 -0
- package/dist/esm/Monitor.js +370 -0
- package/dist/esm/Monitor.js.map +1 -0
- package/dist/esm/NarrowedCheck.d.ts +523 -0
- package/dist/esm/NarrowedCheck.d.ts.map +1 -0
- package/dist/esm/NarrowedCheck.js +612 -0
- package/dist/esm/NarrowedCheck.js.map +1 -0
- package/dist/esm/Notifications.d.ts +42 -0
- package/dist/esm/Notifications.d.ts.map +1 -0
- package/dist/esm/Notifications.js +215 -0
- package/dist/esm/Notifications.js.map +1 -0
- package/dist/esm/Plan.d.ts +127 -0
- package/dist/esm/Plan.d.ts.map +1 -0
- package/dist/esm/Plan.js +97 -0
- package/dist/esm/Plan.js.map +1 -0
- package/dist/esm/QuickJSSandbox.d.ts +151 -0
- package/dist/esm/QuickJSSandbox.d.ts.map +1 -0
- package/dist/esm/QuickJSSandbox.js +1364 -0
- package/dist/esm/QuickJSSandbox.js.map +1 -0
- package/dist/esm/Relevance.d.ts +213 -0
- package/dist/esm/Relevance.d.ts.map +1 -0
- package/dist/esm/Relevance.js +254 -0
- package/dist/esm/Relevance.js.map +1 -0
- package/dist/esm/Sandbox.d.ts +637 -0
- package/dist/esm/Sandbox.d.ts.map +1 -0
- package/dist/esm/Sandbox.js +464 -0
- package/dist/esm/Sandbox.js.map +1 -0
- package/dist/esm/Steering.d.ts +464 -0
- package/dist/esm/Steering.d.ts.map +1 -0
- package/dist/esm/Steering.js +193 -0
- package/dist/esm/Steering.js.map +1 -0
- package/dist/esm/StructuredOutput.d.ts +252 -0
- package/dist/esm/StructuredOutput.d.ts.map +1 -0
- package/dist/esm/StructuredOutput.js +430 -0
- package/dist/esm/StructuredOutput.js.map +1 -0
- package/dist/esm/Sufficiency.d.ts +195 -0
- package/dist/esm/Sufficiency.d.ts.map +1 -0
- package/dist/esm/Sufficiency.js +207 -0
- package/dist/esm/Sufficiency.js.map +1 -0
- package/dist/esm/Supervisor.d.ts +719 -0
- package/dist/esm/Supervisor.d.ts.map +1 -0
- package/dist/esm/Supervisor.js +575 -0
- package/dist/esm/Supervisor.js.map +1 -0
- package/dist/esm/Tokens.d.ts +86 -0
- package/dist/esm/Tokens.d.ts.map +1 -0
- package/dist/esm/Tokens.js +92 -0
- package/dist/esm/Tokens.js.map +1 -0
- package/dist/esm/Transcript.d.ts +171 -0
- package/dist/esm/Transcript.d.ts.map +1 -0
- package/dist/esm/Transcript.js +424 -0
- package/dist/esm/Transcript.js.map +1 -0
- package/dist/esm/TruncatedOutput.d.ts +186 -0
- package/dist/esm/TruncatedOutput.d.ts.map +1 -0
- package/dist/esm/TruncatedOutput.js +257 -0
- package/dist/esm/TruncatedOutput.js.map +1 -0
- package/dist/esm/UnmovedTree.d.ts +113 -0
- package/dist/esm/UnmovedTree.d.ts.map +1 -0
- package/dist/esm/UnmovedTree.js +90 -0
- package/dist/esm/UnmovedTree.js.map +1 -0
- package/dist/esm/UnresolvedFailure.d.ts +196 -0
- package/dist/esm/UnresolvedFailure.d.ts.map +1 -0
- package/dist/esm/UnresolvedFailure.js +218 -0
- package/dist/esm/UnresolvedFailure.js.map +1 -0
- package/dist/esm/VacuousVerification.d.ts +237 -0
- package/dist/esm/VacuousVerification.d.ts.map +1 -0
- package/dist/esm/VacuousVerification.js +245 -0
- package/dist/esm/VacuousVerification.js.map +1 -0
- package/dist/esm/VariablesPanel.d.ts +117 -0
- package/dist/esm/VariablesPanel.d.ts.map +1 -0
- package/dist/esm/VariablesPanel.js +142 -0
- package/dist/esm/VariablesPanel.js.map +1 -0
- package/dist/esm/index.d.ts +172 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +172 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/bytes.d.ts +36 -0
- package/dist/esm/internal/bytes.d.ts.map +1 -0
- package/dist/esm/internal/bytes.js +70 -0
- package/dist/esm/internal/bytes.js.map +1 -0
- package/dist/esm/internal/cellPrompt.d.ts +122 -0
- package/dist/esm/internal/cellPrompt.d.ts.map +1 -0
- package/dist/esm/internal/cellPrompt.js +276 -0
- package/dist/esm/internal/cellPrompt.js.map +1 -0
- package/dist/esm/internal/compactable.d.ts +44 -0
- package/dist/esm/internal/compactable.d.ts.map +1 -0
- package/dist/esm/internal/compactable.js +71 -0
- package/dist/esm/internal/compactable.js.map +1 -0
- package/dist/esm/internal/compactionMarks.d.ts +278 -0
- package/dist/esm/internal/compactionMarks.d.ts.map +1 -0
- package/dist/esm/internal/compactionMarks.js +317 -0
- package/dist/esm/internal/compactionMarks.js.map +1 -0
- package/dist/esm/internal/demandText.d.ts +95 -0
- package/dist/esm/internal/demandText.d.ts.map +1 -0
- package/dist/esm/internal/demandText.js +128 -0
- package/dist/esm/internal/demandText.js.map +1 -0
- package/dist/esm/internal/elide.d.ts +109 -0
- package/dist/esm/internal/elide.d.ts.map +1 -0
- package/dist/esm/internal/elide.js +123 -0
- package/dist/esm/internal/elide.js.map +1 -0
- package/dist/esm/internal/frame.d.ts +463 -0
- package/dist/esm/internal/frame.d.ts.map +1 -0
- package/dist/esm/internal/frame.js +861 -0
- package/dist/esm/internal/frame.js.map +1 -0
- package/dist/esm/internal/nonNegativeSafeInt.d.ts +20 -0
- package/dist/esm/internal/nonNegativeSafeInt.d.ts.map +1 -0
- package/dist/esm/internal/nonNegativeSafeInt.js +20 -0
- package/dist/esm/internal/nonNegativeSafeInt.js.map +1 -0
- package/dist/esm/internal/paidUsage.d.ts +52 -0
- package/dist/esm/internal/paidUsage.d.ts.map +1 -0
- package/dist/esm/internal/paidUsage.js +72 -0
- package/dist/esm/internal/paidUsage.js.map +1 -0
- package/dist/esm/internal/printChannel.d.ts +233 -0
- package/dist/esm/internal/printChannel.d.ts.map +1 -0
- package/dist/esm/internal/printChannel.js +376 -0
- package/dist/esm/internal/printChannel.js.map +1 -0
- package/dist/esm/internal/printsObservation.d.ts +26 -0
- package/dist/esm/internal/printsObservation.d.ts.map +1 -0
- package/dist/esm/internal/printsObservation.js +29 -0
- package/dist/esm/internal/printsObservation.js.map +1 -0
- package/dist/esm/internal/refusal.d.ts +40 -0
- package/dist/esm/internal/refusal.d.ts.map +1 -0
- package/dist/esm/internal/refusal.js +47 -0
- package/dist/esm/internal/refusal.js.map +1 -0
- package/dist/esm/internal/supervision.d.ts +174 -0
- package/dist/esm/internal/supervision.d.ts.map +1 -0
- package/dist/esm/internal/supervision.js +485 -0
- package/dist/esm/internal/supervision.js.map +1 -0
- package/dist/esm/internal/unfinishedWork.d.ts +99 -0
- package/dist/esm/internal/unfinishedWork.d.ts.map +1 -0
- package/dist/esm/internal/unfinishedWork.js +85 -0
- package/dist/esm/internal/unfinishedWork.js.map +1 -0
- package/dist/esm/internal/unobservedCall.d.ts +112 -0
- package/dist/esm/internal/unobservedCall.d.ts.map +1 -0
- package/dist/esm/internal/unobservedCall.js +501 -0
- package/dist/esm/internal/unobservedCall.js.map +1 -0
- package/dist/esm/internal/untrustedData.d.ts +14 -0
- package/dist/esm/internal/untrustedData.d.ts.map +1 -0
- package/dist/esm/internal/untrustedData.js +15 -0
- package/dist/esm/internal/untrustedData.js.map +1 -0
- package/docs/README.md +129 -0
- package/docs/api.md +1869 -0
- package/docs/concepts.md +238 -0
- package/docs/external-transcripts.md +245 -0
- package/docs/guides/bind-flows.md +167 -0
- package/docs/guides/drive-the-loop.md +265 -0
- package/docs/guides/run-cells.md +262 -0
- package/docs/guides/workerd.md +144 -0
- package/docs/installation.md +69 -0
- package/docs/quickstart.md +121 -0
- package/docs/reference.md +954 -0
- package/docs/troubleshooting.md +177 -0
- package/package.json +463 -3
- package/src/AgentEvent.ts +1772 -0
- package/src/CallLedger.ts +560 -0
- package/src/Cell.ts +926 -0
- package/src/CellCalls.ts +198 -0
- package/src/CellHistory.ts +128 -0
- package/src/CellTurn.ts +4450 -0
- package/src/CellValidation.ts +382 -0
- package/src/Compaction.ts +330 -0
- package/src/CompletionClaim.ts +1013 -0
- package/src/ContextWindow.ts +669 -0
- package/src/EngineLike.ts +614 -0
- package/src/ExternalTranscript.ts +1142 -0
- package/src/FailedCall.ts +163 -0
- package/src/FlowBinding.ts +603 -0
- package/src/HarnessError.ts +98 -0
- package/src/Judgement.ts +526 -0
- package/src/Monitor.ts +579 -0
- package/src/NarrowedCheck.ts +694 -0
- package/src/Notifications.ts +262 -0
- package/src/Plan.ts +113 -0
- package/src/QuickJSSandbox.ts +1557 -0
- package/src/Relevance.ts +352 -0
- package/src/Sandbox.ts +908 -0
- package/src/Steering.ts +405 -0
- package/src/StructuredOutput.ts +484 -0
- package/src/Sufficiency.ts +247 -0
- package/src/Supervisor.ts +798 -0
- package/src/Tokens.ts +108 -0
- package/src/Transcript.ts +513 -0
- package/src/TruncatedOutput.ts +297 -0
- package/src/UnmovedTree.ts +121 -0
- package/src/UnresolvedFailure.ts +240 -0
- package/src/VacuousVerification.ts +280 -0
- package/src/VariablesPanel.ts +165 -0
- package/src/index.ts +204 -0
- package/src/internal/bytes.ts +70 -0
- package/src/internal/cellPrompt.ts +337 -0
- package/src/internal/compactable.ts +76 -0
- package/src/internal/compactionMarks.ts +454 -0
- package/src/internal/demandText.ts +145 -0
- package/src/internal/elide.ts +130 -0
- package/src/internal/frame.ts +1178 -0
- package/src/internal/nonNegativeSafeInt.ts +24 -0
- package/src/internal/paidUsage.ts +90 -0
- package/src/internal/printChannel.ts +434 -0
- package/src/internal/printsObservation.ts +31 -0
- package/src/internal/refusal.ts +53 -0
- package/src/internal/supervision.ts +652 -0
- package/src/internal/unfinishedWork.ts +123 -0
- package/src/internal/unobservedCall.ts +536 -0
- package/src/internal/untrustedData.ts +19 -0
|
@@ -0,0 +1,826 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var ExternalTranscript_exports = {};
|
|
30
|
+
__export(ExternalTranscript_exports, {
|
|
31
|
+
AgentKind: () => AgentKind,
|
|
32
|
+
EditedFile: () => EditedFile,
|
|
33
|
+
Entry: () => Entry,
|
|
34
|
+
ExternalTranscriptError: () => ExternalTranscriptError,
|
|
35
|
+
ExternalTranscriptErrorCode: () => ExternalTranscriptErrorCode,
|
|
36
|
+
Part: () => Part,
|
|
37
|
+
claudeReleases: () => claudeReleases,
|
|
38
|
+
claudeStart: () => claudeStart,
|
|
39
|
+
codexReleases: () => codexReleases,
|
|
40
|
+
codexStart: () => codexStart,
|
|
41
|
+
decodeClaude: () => decodeClaude,
|
|
42
|
+
decodeCodex: () => decodeCodex
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(ExternalTranscript_exports);
|
|
45
|
+
var Fault = __toESM(require("@smthrs/flow/Fault"), 1);
|
|
46
|
+
var import_effect = require("effect");
|
|
47
|
+
const AgentKind = import_effect.Schema.Literals(["codex", "claude-code"]);
|
|
48
|
+
const EditedFile = import_effect.Schema.Struct({
|
|
49
|
+
path: import_effect.Schema.String,
|
|
50
|
+
change: import_effect.Schema.Literals(["added", "modified", "deleted", "renamed"]),
|
|
51
|
+
renamed_to: import_effect.Schema.optional(import_effect.Schema.String),
|
|
52
|
+
diff: import_effect.Schema.String
|
|
53
|
+
});
|
|
54
|
+
const Part = import_effect.Schema.Union([
|
|
55
|
+
import_effect.Schema.Struct({ type: import_effect.Schema.Literal("prompt"), text: import_effect.Schema.String }),
|
|
56
|
+
import_effect.Schema.Struct({ type: import_effect.Schema.Literal("goal"), objective: import_effect.Schema.String, status: import_effect.Schema.String }),
|
|
57
|
+
import_effect.Schema.Struct({ type: import_effect.Schema.Literal("text"), text: import_effect.Schema.String, final: import_effect.Schema.Boolean }),
|
|
58
|
+
import_effect.Schema.Struct({ type: import_effect.Schema.Literal("reasoning"), text: import_effect.Schema.String }),
|
|
59
|
+
import_effect.Schema.Struct({ type: import_effect.Schema.Literal("encrypted") }),
|
|
60
|
+
import_effect.Schema.Struct({
|
|
61
|
+
type: import_effect.Schema.Literal("tool"),
|
|
62
|
+
call_id: import_effect.Schema.String,
|
|
63
|
+
command: import_effect.Schema.String,
|
|
64
|
+
/** Set when every part of the command only reads, searches or lists: "Read mvp.md". */
|
|
65
|
+
reads: import_effect.Schema.Array(import_effect.Schema.String),
|
|
66
|
+
status: import_effect.Schema.Literals(["ok", "error", "running"]),
|
|
67
|
+
exit_code: import_effect.Schema.optional(import_effect.Schema.Number),
|
|
68
|
+
output: import_effect.Schema.String,
|
|
69
|
+
duration_ms: import_effect.Schema.Number
|
|
70
|
+
}),
|
|
71
|
+
import_effect.Schema.Struct({
|
|
72
|
+
type: import_effect.Schema.Literal("edit"),
|
|
73
|
+
call_id: import_effect.Schema.String,
|
|
74
|
+
files: import_effect.Schema.Array(EditedFile),
|
|
75
|
+
outcome: import_effect.Schema.Literals(["applied", "failed"])
|
|
76
|
+
}),
|
|
77
|
+
import_effect.Schema.Struct({ type: import_effect.Schema.Literal("search"), call_id: import_effect.Schema.String, query: import_effect.Schema.String }),
|
|
78
|
+
import_effect.Schema.Struct({
|
|
79
|
+
type: import_effect.Schema.Literal("helper"),
|
|
80
|
+
call_id: import_effect.Schema.String,
|
|
81
|
+
agent: import_effect.Schema.String,
|
|
82
|
+
activity: import_effect.Schema.String
|
|
83
|
+
}),
|
|
84
|
+
import_effect.Schema.Struct({ type: import_effect.Schema.Literal("compaction") }),
|
|
85
|
+
import_effect.Schema.Struct({ type: import_effect.Schema.Literal("error"), message: import_effect.Schema.String })
|
|
86
|
+
]);
|
|
87
|
+
const Entry = import_effect.Schema.Struct({
|
|
88
|
+
origin: import_effect.Schema.Literal("external"),
|
|
89
|
+
agent_kind: AgentKind,
|
|
90
|
+
format_version: import_effect.Schema.String,
|
|
91
|
+
session_id: import_effect.Schema.String,
|
|
92
|
+
/**
|
|
93
|
+
* The record this entry came from: `<session>:<line>`. A record that yields several entries numbers the later
|
|
94
|
+
* ones `<session>:<line>#<n>`.
|
|
95
|
+
*/
|
|
96
|
+
source_id: import_effect.Schema.String,
|
|
97
|
+
read_only: import_effect.Schema.Literal(true),
|
|
98
|
+
seq: import_effect.Schema.Number,
|
|
99
|
+
/** Milliseconds since the epoch, from the record. */
|
|
100
|
+
at: import_effect.Schema.Number,
|
|
101
|
+
turn_id: import_effect.Schema.optional(import_effect.Schema.String),
|
|
102
|
+
/** `user` entries are the owner's; `assistant` entries are the agent's. */
|
|
103
|
+
role: import_effect.Schema.Literals(["user", "assistant"]),
|
|
104
|
+
part: Part
|
|
105
|
+
});
|
|
106
|
+
const ExternalTranscriptErrorCode = import_effect.Schema.Literals([
|
|
107
|
+
"missing_version",
|
|
108
|
+
"unsupported_version",
|
|
109
|
+
"unsupported_record",
|
|
110
|
+
"malformed_record"
|
|
111
|
+
]);
|
|
112
|
+
class ExternalTranscriptError extends import_effect.Schema.TaggedError()("harness/ExternalTranscriptError", {
|
|
113
|
+
code: ExternalTranscriptErrorCode,
|
|
114
|
+
message: import_effect.Schema.String,
|
|
115
|
+
line: import_effect.Schema.Number
|
|
116
|
+
}) {
|
|
117
|
+
}
|
|
118
|
+
Fault.register(
|
|
119
|
+
"harness/ExternalTranscriptError",
|
|
120
|
+
{
|
|
121
|
+
// The agent wrote a transcript this release cannot read: a format change outside Smithers.
|
|
122
|
+
missing_version: "dependency",
|
|
123
|
+
unsupported_version: "dependency",
|
|
124
|
+
unsupported_record: "dependency",
|
|
125
|
+
malformed_record: "dependency"
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
const codexReleases = ["0.159", "0.160"];
|
|
129
|
+
const codexStart = { pending: "", line: 0, seq: 0 };
|
|
130
|
+
const record = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
131
|
+
const text = (value) => typeof value === "string" ? value : "";
|
|
132
|
+
const list = (value) => Array.isArray(value) ? value : [];
|
|
133
|
+
const basename = (path) => path.split("/").filter(Boolean).at(-1) ?? path;
|
|
134
|
+
const parseRow = (raw) => {
|
|
135
|
+
try {
|
|
136
|
+
const parsed = JSON.parse(raw);
|
|
137
|
+
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : void 0;
|
|
138
|
+
} catch {
|
|
139
|
+
return void 0;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const helperName = (path) => basename(text(path)) || "helper";
|
|
143
|
+
const reads = (parsed) => {
|
|
144
|
+
const parts = list(parsed).map(record);
|
|
145
|
+
if (parts.length === 0 || parts.some((part) => !["read", "search", "list_files"].includes(text(part["type"])))) {
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
return parts.map(
|
|
149
|
+
(part) => part["type"] === "read" ? `Read ${text(part["name"]) || basename(text(part["path"]))}` : part["type"] === "search" ? `Searched ${JSON.stringify(text(part["query"]))}${part["path"] ? ` in ${basename(text(part["path"]))}` : ""}` : `Listed ${basename(text(part["path"])) || "files"}`
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
const linesOf = (value) => value === "" ? [] : value.replace(/\n$/, "").split("\n");
|
|
153
|
+
const wholeFile = (content, op) => {
|
|
154
|
+
const lines = linesOf(content);
|
|
155
|
+
if (lines.length === 0) return "";
|
|
156
|
+
return `@@ ${op === "+" ? `-0,0 +1,${lines.length}` : `-1,${lines.length} +0,0`} @@
|
|
157
|
+
${lines.map((line) => `${op}${line}`).join("\n")}
|
|
158
|
+
`;
|
|
159
|
+
};
|
|
160
|
+
const changeOf = (change) => typeof change["move_path"] === "string" ? "renamed" : change["type"] === "add" ? "added" : change["type"] === "delete" ? "deleted" : "modified";
|
|
161
|
+
const codexSkippedRows = [
|
|
162
|
+
"turn_context",
|
|
163
|
+
"world_state",
|
|
164
|
+
"token_usage_record",
|
|
165
|
+
"compacted",
|
|
166
|
+
"inter_agent_communication_metadata"
|
|
167
|
+
];
|
|
168
|
+
const codexResponseItems = [
|
|
169
|
+
"message",
|
|
170
|
+
"reasoning",
|
|
171
|
+
"custom_tool_call",
|
|
172
|
+
"custom_tool_call_output",
|
|
173
|
+
"function_call",
|
|
174
|
+
"function_call_output",
|
|
175
|
+
"agent_message"
|
|
176
|
+
];
|
|
177
|
+
const codexSkippedEvents = ["task_started", "token_count", "thread_settings_applied"];
|
|
178
|
+
const codexItems = [
|
|
179
|
+
"UserMessage",
|
|
180
|
+
"AgentMessage",
|
|
181
|
+
"Reasoning",
|
|
182
|
+
"CommandExecution",
|
|
183
|
+
"FileChange",
|
|
184
|
+
"ContextCompaction",
|
|
185
|
+
"SubAgentActivity",
|
|
186
|
+
"CollabAgentToolCall",
|
|
187
|
+
"Extension",
|
|
188
|
+
"McpToolCall",
|
|
189
|
+
"FunctionCallOutput",
|
|
190
|
+
"ImageView"
|
|
191
|
+
];
|
|
192
|
+
const partsText = (value) => typeof value === "string" ? value : list(value).map((each) => text(record(each)["text"])).filter(Boolean).join("\n");
|
|
193
|
+
const itemPart = (item, took) => {
|
|
194
|
+
switch (item["type"]) {
|
|
195
|
+
case "UserMessage":
|
|
196
|
+
return {
|
|
197
|
+
role: "user",
|
|
198
|
+
part: { type: "prompt", text: list(item["content"]).map((each) => text(record(each)["text"])).join("\n") }
|
|
199
|
+
};
|
|
200
|
+
case "AgentMessage": {
|
|
201
|
+
const content = list(item["content"]).map(record);
|
|
202
|
+
const said = content.map((each) => text(each["text"])).filter(Boolean).join("\n");
|
|
203
|
+
if (content.some((each) => each["type"] === "encrypted_content")) {
|
|
204
|
+
return { role: "assistant", part: { type: "encrypted" } };
|
|
205
|
+
}
|
|
206
|
+
return { role: "assistant", part: { type: "text", text: said, final: item["phase"] === "final_answer" } };
|
|
207
|
+
}
|
|
208
|
+
case "Reasoning": {
|
|
209
|
+
const summary = list(item["summary_text"]).map(text).filter(Boolean).join("\n");
|
|
210
|
+
return summary === "" ? item["encrypted_content"] ? { role: "assistant", part: { type: "encrypted" } } : void 0 : { role: "assistant", part: { type: "reasoning", text: summary } };
|
|
211
|
+
}
|
|
212
|
+
case "CommandExecution": {
|
|
213
|
+
const exit = typeof item["exit_code"] === "number" ? item["exit_code"] : void 0;
|
|
214
|
+
const status = item["status"] === "in_progress" ? "running" : item["status"] === "completed" && (exit ?? 0) === 0 ? "ok" : "error";
|
|
215
|
+
return {
|
|
216
|
+
role: "assistant",
|
|
217
|
+
part: {
|
|
218
|
+
type: "tool",
|
|
219
|
+
call_id: text(item["id"]),
|
|
220
|
+
command: list(item["command"]).map(text).at(-1) ?? "",
|
|
221
|
+
reads: reads(item["parsed_cmd"]),
|
|
222
|
+
status,
|
|
223
|
+
...exit === void 0 ? {} : { exit_code: exit },
|
|
224
|
+
output: text(item["aggregated_output"]) || text(item["formatted_output"]),
|
|
225
|
+
duration_ms: took
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
case "FileChange":
|
|
230
|
+
return {
|
|
231
|
+
role: "assistant",
|
|
232
|
+
part: {
|
|
233
|
+
type: "edit",
|
|
234
|
+
call_id: text(item["id"]),
|
|
235
|
+
outcome: item["status"] === "completed" ? "applied" : "failed",
|
|
236
|
+
files: Object.entries(record(item["changes"])).map(([path, value]) => {
|
|
237
|
+
const change = record(value);
|
|
238
|
+
return {
|
|
239
|
+
path,
|
|
240
|
+
change: changeOf(change),
|
|
241
|
+
...typeof change["move_path"] === "string" ? { renamed_to: change["move_path"] } : {},
|
|
242
|
+
diff: text(change["unified_diff"]) || wholeFile(text(change["content"]), change["type"] === "delete" ? "-" : "+")
|
|
243
|
+
};
|
|
244
|
+
})
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
case "ContextCompaction":
|
|
248
|
+
return { role: "assistant", part: { type: "compaction" } };
|
|
249
|
+
case "SubAgentActivity":
|
|
250
|
+
return {
|
|
251
|
+
role: "assistant",
|
|
252
|
+
part: {
|
|
253
|
+
type: "helper",
|
|
254
|
+
call_id: text(item["id"]),
|
|
255
|
+
agent: helperName(item["agent_path"]),
|
|
256
|
+
activity: text(item["kind"])
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
case "CollabAgentToolCall": {
|
|
260
|
+
const agents = list(item["receiver_agents"]).map((each) => helperName(record(each)["agent_path"] ?? each));
|
|
261
|
+
return {
|
|
262
|
+
role: "assistant",
|
|
263
|
+
part: {
|
|
264
|
+
type: "helper",
|
|
265
|
+
call_id: text(item["id"]),
|
|
266
|
+
agent: agents.join(", ") || "helpers",
|
|
267
|
+
activity: text(item["tool"])
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
case "Extension": {
|
|
272
|
+
const action = record(item["action"]);
|
|
273
|
+
const query = text(item["query"]) || text(action["query"]) || text(action["pattern"]) || text(action["url"]);
|
|
274
|
+
return { role: "assistant", part: { type: "search", call_id: text(item["id"]), query } };
|
|
275
|
+
}
|
|
276
|
+
case "McpToolCall": {
|
|
277
|
+
const result = record(item["result"]);
|
|
278
|
+
const args = record(item["arguments"]);
|
|
279
|
+
const name = [text(item["server"]), text(item["tool"])].filter(Boolean).join(".");
|
|
280
|
+
const failed = item["status"] !== "completed" || result["isError"] === true;
|
|
281
|
+
return {
|
|
282
|
+
role: "assistant",
|
|
283
|
+
part: {
|
|
284
|
+
type: "tool",
|
|
285
|
+
call_id: text(item["id"]),
|
|
286
|
+
command: Object.keys(args).length === 0 ? name : `${name} ${JSON.stringify(args)}`,
|
|
287
|
+
reads: [],
|
|
288
|
+
status: item["status"] === "in_progress" ? "running" : failed ? "error" : "ok",
|
|
289
|
+
output: partsText(result["content"]) || text(record(item["error"])["message"]),
|
|
290
|
+
duration_ms: took
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
case "FunctionCallOutput":
|
|
295
|
+
return {
|
|
296
|
+
role: "assistant",
|
|
297
|
+
part: {
|
|
298
|
+
type: "tool",
|
|
299
|
+
call_id: text(item["id"]),
|
|
300
|
+
command: [text(item["namespace"]), text(item["name"])].filter(Boolean).join("."),
|
|
301
|
+
reads: [],
|
|
302
|
+
status: "ok",
|
|
303
|
+
output: partsText(item["output"]),
|
|
304
|
+
duration_ms: took
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
default:
|
|
308
|
+
return {
|
|
309
|
+
role: "assistant",
|
|
310
|
+
part: {
|
|
311
|
+
type: "tool",
|
|
312
|
+
call_id: text(item["id"]),
|
|
313
|
+
command: `view_image ${text(item["path"])}`,
|
|
314
|
+
reads: [`Read ${basename(text(item["path"]))}`],
|
|
315
|
+
status: "ok",
|
|
316
|
+
output: "",
|
|
317
|
+
duration_ms: took
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
const scriptFailed = (output) => !/^Script (?:completed|running)\b/.test(output);
|
|
323
|
+
const failedPatchPath = (output) => /apply_patch verification failed: Failed to find expected lines in ([^\n]+):\n/.exec(output)?.[1];
|
|
324
|
+
const profileOf = (profile, releases, release) => {
|
|
325
|
+
const minor = /^(\d+\.\d+)\./.exec(release)?.[1];
|
|
326
|
+
return minor !== void 0 && releases.includes(minor) ? `${profile}/${minor}` : void 0;
|
|
327
|
+
};
|
|
328
|
+
const decodeCodex = (state, chunk) => {
|
|
329
|
+
const lines = (state.pending + chunk).split("\n");
|
|
330
|
+
const pending = lines.pop();
|
|
331
|
+
let { line, seq, session, goal } = state;
|
|
332
|
+
const calls = new Map(Object.entries(state.calls ?? {}));
|
|
333
|
+
const entries = [];
|
|
334
|
+
const fail = (code, message) => import_effect.Result.fail(new ExternalTranscriptError({ code, message, line }));
|
|
335
|
+
const unread = (what, type) => typeof type === "string" && type !== "" ? fail("unsupported_record", `Codex wrote ${what} this release does not read: ${type}`) : fail("malformed_record", `Codex rollout line ${line} names no ${what.replace(/^an? /, "")} type.`);
|
|
336
|
+
for (const raw of lines) {
|
|
337
|
+
line++;
|
|
338
|
+
if (raw.trim() === "") continue;
|
|
339
|
+
const row = parseRow(raw);
|
|
340
|
+
if (row === void 0) return fail("malformed_record", `Codex rollout line ${line} is not a JSON record.`);
|
|
341
|
+
const payload = record(row["payload"]);
|
|
342
|
+
if (row["type"] === "session_meta") {
|
|
343
|
+
const release = text(payload["cli_version"]);
|
|
344
|
+
const format_version2 = profileOf("codex-rollout", codexReleases, release);
|
|
345
|
+
if (format_version2 === void 0) {
|
|
346
|
+
return fail(
|
|
347
|
+
"unsupported_version",
|
|
348
|
+
`Codex ${release || "(no release)"} wrote this rollout; supported: ${codexReleases.join(", ")}.`
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
session = { id: text(payload["id"]) || text(payload["session_id"]), format_version: format_version2, cwd: text(payload["cwd"]) };
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
if (session === void 0) {
|
|
355
|
+
return fail("missing_version", `Codex rollout line ${line} comes before its session record.`);
|
|
356
|
+
}
|
|
357
|
+
const found = [];
|
|
358
|
+
if (row["type"] === "response_item") {
|
|
359
|
+
if (!codexResponseItems.includes(text(payload["type"]))) return unread("a response item", payload["type"]);
|
|
360
|
+
switch (payload["type"]) {
|
|
361
|
+
case "custom_tool_call": {
|
|
362
|
+
const id = payload["call_id"], name = payload["name"], input = payload["input"];
|
|
363
|
+
if (typeof id !== "string" || id === "" || typeof name !== "string" || typeof input !== "string") {
|
|
364
|
+
return fail("malformed_record", `Codex tool request on line ${line} names no call, tool or input.`);
|
|
365
|
+
}
|
|
366
|
+
calls.set(id, { name, input });
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
case "custom_tool_call_output": {
|
|
370
|
+
const id = text(payload["call_id"]);
|
|
371
|
+
const call = calls.get(id);
|
|
372
|
+
calls.delete(id);
|
|
373
|
+
const output = partsText(payload["output"]);
|
|
374
|
+
if (!scriptFailed(output)) break;
|
|
375
|
+
found.push({
|
|
376
|
+
role: "assistant",
|
|
377
|
+
part: {
|
|
378
|
+
type: "tool",
|
|
379
|
+
call_id: id,
|
|
380
|
+
command: call?.input ?? "",
|
|
381
|
+
reads: [],
|
|
382
|
+
status: "error",
|
|
383
|
+
output,
|
|
384
|
+
duration_ms: 0
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
const path = failedPatchPath(output);
|
|
388
|
+
if (path !== void 0) {
|
|
389
|
+
found.push({
|
|
390
|
+
role: "assistant",
|
|
391
|
+
part: { type: "edit", call_id: id, files: [{ path, change: "modified", diff: "" }], outcome: "failed" }
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
case "agent_message": {
|
|
397
|
+
const content = payload["content"];
|
|
398
|
+
if (!Array.isArray(content)) {
|
|
399
|
+
return fail("malformed_record", `Codex agent message on line ${line} has no content list.`);
|
|
400
|
+
}
|
|
401
|
+
let encrypted = false;
|
|
402
|
+
const said = [];
|
|
403
|
+
for (const each of content) {
|
|
404
|
+
const block = record(each);
|
|
405
|
+
if (block["type"] === "encrypted_content") {
|
|
406
|
+
if (typeof block["encrypted_content"] !== "string" || block["encrypted_content"] === "") {
|
|
407
|
+
return fail("malformed_record", `Codex encrypted body on line ${line} is empty.`);
|
|
408
|
+
}
|
|
409
|
+
encrypted = true;
|
|
410
|
+
} else if (block["type"] === "input_text" || block["type"] === "output_text") {
|
|
411
|
+
if (typeof block["text"] !== "string") {
|
|
412
|
+
return fail("malformed_record", `Codex agent message on line ${line} has a text part without text.`);
|
|
413
|
+
}
|
|
414
|
+
said.push(block["text"]);
|
|
415
|
+
} else {
|
|
416
|
+
return unread("a message part", block["type"]);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
const turn = text(record(payload["internal_chat_message_metadata_passthrough"])["turn_id"]);
|
|
420
|
+
if (encrypted) found.push({ role: "assistant", part: { type: "encrypted" }, turn });
|
|
421
|
+
else if (said.join("\n") !== "") {
|
|
422
|
+
found.push({ role: "assistant", part: { type: "text", text: said.join("\n"), final: false }, turn });
|
|
423
|
+
}
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
} else if (row["type"] === "event_msg") {
|
|
428
|
+
switch (payload["type"]) {
|
|
429
|
+
case "item_completed": {
|
|
430
|
+
const started = payload["started_at_ms"], completed = payload["completed_at_ms"];
|
|
431
|
+
const took = typeof started === "number" && typeof completed === "number" ? completed - started : 0;
|
|
432
|
+
const item = record(payload["item"]);
|
|
433
|
+
if (!codexItems.includes(text(item["type"]))) return unread("an item", item["type"]);
|
|
434
|
+
if (item["type"] === "UserMessage" || item["type"] === "AgentMessage") {
|
|
435
|
+
const content = item["content"];
|
|
436
|
+
if (!Array.isArray(content)) {
|
|
437
|
+
return fail("malformed_record", `Codex message on line ${line} has no content list.`);
|
|
438
|
+
}
|
|
439
|
+
if (!content.some((each) => record(each)["type"] === "encrypted_content")) {
|
|
440
|
+
for (const each of content) {
|
|
441
|
+
const block = record(each);
|
|
442
|
+
if (block["type"] !== (item["type"] === "UserMessage" ? "text" : "Text")) {
|
|
443
|
+
return unread("a message part", block["type"]);
|
|
444
|
+
}
|
|
445
|
+
if (typeof block["text"] !== "string") {
|
|
446
|
+
return fail("malformed_record", `Codex message on line ${line} has a text part without text.`);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
const part = itemPart(item, Number.isFinite(took) && took > 0 ? took : 0);
|
|
452
|
+
if (part !== void 0) found.push({ ...part, turn: text(payload["turn_id"]) });
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
case "thread_goal_updated": {
|
|
456
|
+
const update = record(payload["goal"]);
|
|
457
|
+
const key = `${text(update["status"])}:${text(update["objective"])}`;
|
|
458
|
+
if (key !== goal) {
|
|
459
|
+
found.push({
|
|
460
|
+
role: "user",
|
|
461
|
+
part: { type: "goal", objective: text(update["objective"]), status: text(update["status"]) }
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
goal = key;
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
case "task_complete": {
|
|
468
|
+
if (payload["error"] === void 0 || payload["error"] === null) break;
|
|
469
|
+
const message = text(record(payload["error"])["message"]);
|
|
470
|
+
if (message === "") return fail("malformed_record", `Codex failure on line ${line} gives no message.`);
|
|
471
|
+
found.push({ role: "assistant", part: { type: "error", message }, turn: text(payload["turn_id"]) });
|
|
472
|
+
break;
|
|
473
|
+
}
|
|
474
|
+
case "error":
|
|
475
|
+
case "turn_aborted": {
|
|
476
|
+
const message = text(payload["message"]) || text(payload["reason"]);
|
|
477
|
+
if (message === "") {
|
|
478
|
+
return fail("malformed_record", `Codex failure on line ${line} gives no message or reason.`);
|
|
479
|
+
}
|
|
480
|
+
found.push({ role: "assistant", part: { type: "error", message }, turn: text(payload["turn_id"]) });
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
default:
|
|
484
|
+
if (!codexSkippedEvents.includes(text(payload["type"]))) return unread("an event", payload["type"]);
|
|
485
|
+
}
|
|
486
|
+
} else if (!codexSkippedRows.includes(text(row["type"]))) {
|
|
487
|
+
return unread("a record", row["type"]);
|
|
488
|
+
}
|
|
489
|
+
const at = Date.parse(text(row["timestamp"])) || 0;
|
|
490
|
+
const sessionId = session.id, format_version = session.format_version;
|
|
491
|
+
found.forEach(({ part, role, turn }, index) => {
|
|
492
|
+
entries.push({
|
|
493
|
+
origin: "external",
|
|
494
|
+
agent_kind: "codex",
|
|
495
|
+
format_version,
|
|
496
|
+
session_id: sessionId,
|
|
497
|
+
source_id: index === 0 ? `${sessionId}:${line}` : `${sessionId}:${line}#${index}`,
|
|
498
|
+
read_only: true,
|
|
499
|
+
seq: seq++,
|
|
500
|
+
at,
|
|
501
|
+
...turn ? { turn_id: turn } : {},
|
|
502
|
+
role,
|
|
503
|
+
part
|
|
504
|
+
});
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
return import_effect.Result.succeed({
|
|
508
|
+
state: { pending, line, seq, session, goal, ...calls.size === 0 ? {} : { calls: Object.fromEntries(calls) } },
|
|
509
|
+
entries
|
|
510
|
+
});
|
|
511
|
+
};
|
|
512
|
+
const claudeReleases = ["2.1"];
|
|
513
|
+
const claudeStart = { pending: "", line: 0, seq: 0, calls: {} };
|
|
514
|
+
const blocksOf = (content) => typeof content === "string" ? [{ type: "text", text: content }] : list(content).map(record);
|
|
515
|
+
const textOf = (blocks) => blocks.filter((block) => block["type"] === "text").map((block) => text(block["text"])).join("\n");
|
|
516
|
+
const byOwner = (origin) => origin === void 0 || origin === null || record(origin)["kind"] === "human";
|
|
517
|
+
const replacement = (before, after) => {
|
|
518
|
+
const removed = linesOf(before), added = linesOf(after);
|
|
519
|
+
if (removed.length + added.length === 0) return "";
|
|
520
|
+
return `@@ -1,${removed.length} +1,${added.length} @@
|
|
521
|
+
${[...removed.map((line) => `-${line}`), ...added.map((line) => `+${line}`)].join("\n")}
|
|
522
|
+
`;
|
|
523
|
+
};
|
|
524
|
+
const count = (value) => typeof value === "number" ? value : 0;
|
|
525
|
+
const reportedPatch = (patch) => list(patch).map(record).map(
|
|
526
|
+
(hunk) => `@@ -${count(hunk["oldStart"])},${count(hunk["oldLines"])} +${count(hunk["newStart"])},${count(hunk["newLines"])} @@
|
|
527
|
+
${list(hunk["lines"]).map(text).join("\n")}
|
|
528
|
+
`
|
|
529
|
+
).join("");
|
|
530
|
+
const requestedPatch = (name, input) => {
|
|
531
|
+
switch (name) {
|
|
532
|
+
case "Write":
|
|
533
|
+
return wholeFile(text(input["content"]), "+");
|
|
534
|
+
case "NotebookEdit":
|
|
535
|
+
return wholeFile(text(input["new_source"]), "+");
|
|
536
|
+
case "MultiEdit":
|
|
537
|
+
return list(input["edits"]).map(record).map(
|
|
538
|
+
(edit) => replacement(text(edit["old_string"]), text(edit["new_string"]))
|
|
539
|
+
).join("");
|
|
540
|
+
default:
|
|
541
|
+
return replacement(text(input["old_string"]), text(input["new_string"]));
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
const claudeReads = (name, input) => {
|
|
545
|
+
const path = text(input["path"]);
|
|
546
|
+
switch (name) {
|
|
547
|
+
case "Read":
|
|
548
|
+
return [`Read ${basename(text(input["file_path"]))}`];
|
|
549
|
+
case "Grep":
|
|
550
|
+
case "Glob":
|
|
551
|
+
return [`Searched ${JSON.stringify(text(input["pattern"]))}${path ? ` in ${basename(path)}` : ""}`];
|
|
552
|
+
case "LS":
|
|
553
|
+
return [`Listed ${basename(path) || "files"}`];
|
|
554
|
+
default:
|
|
555
|
+
return [];
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
const claudeToolPart = (id, call, result) => {
|
|
559
|
+
const name = call?.name ?? "";
|
|
560
|
+
const input = record(call?.input);
|
|
561
|
+
switch (name) {
|
|
562
|
+
case "Edit":
|
|
563
|
+
case "Write":
|
|
564
|
+
case "MultiEdit":
|
|
565
|
+
case "NotebookEdit":
|
|
566
|
+
return {
|
|
567
|
+
type: "edit",
|
|
568
|
+
call_id: id,
|
|
569
|
+
files: [{
|
|
570
|
+
path: text(input["file_path"]) || text(input["notebook_path"]),
|
|
571
|
+
change: name === "Write" && result.report["type"] === "create" ? "added" : "modified",
|
|
572
|
+
diff: reportedPatch(result.report["structuredPatch"]) || requestedPatch(name, input)
|
|
573
|
+
}],
|
|
574
|
+
outcome: result.failed ? "failed" : "applied"
|
|
575
|
+
};
|
|
576
|
+
case "WebSearch":
|
|
577
|
+
return { type: "search", call_id: id, query: text(input["query"]) };
|
|
578
|
+
case "WebFetch":
|
|
579
|
+
return { type: "search", call_id: id, query: text(input["url"]) };
|
|
580
|
+
case "Task":
|
|
581
|
+
case "Agent":
|
|
582
|
+
return {
|
|
583
|
+
type: "helper",
|
|
584
|
+
call_id: id,
|
|
585
|
+
agent: text(input["subagent_type"]) || "general-purpose",
|
|
586
|
+
activity: text(input["description"])
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
const exit = result.failed ? /^Exit code (\d+)/.exec(result.output)?.[1] : void 0;
|
|
590
|
+
return {
|
|
591
|
+
type: "tool",
|
|
592
|
+
call_id: id,
|
|
593
|
+
command: name === "Bash" ? text(input["command"]) : Object.keys(input).length === 0 ? name : `${name} ${JSON.stringify(input)}`,
|
|
594
|
+
reads: claudeReads(name, input),
|
|
595
|
+
status: result.failed ? "error" : "ok",
|
|
596
|
+
...exit === void 0 ? {} : { exit_code: Number(exit) },
|
|
597
|
+
output: result.output,
|
|
598
|
+
duration_ms: result.took
|
|
599
|
+
};
|
|
600
|
+
};
|
|
601
|
+
const claudeSkippedRows = [
|
|
602
|
+
"mode",
|
|
603
|
+
"permission-mode",
|
|
604
|
+
"atis-latch",
|
|
605
|
+
"last-prompt",
|
|
606
|
+
"ai-title",
|
|
607
|
+
"custom-title",
|
|
608
|
+
"agent-name",
|
|
609
|
+
"queue-operation",
|
|
610
|
+
"file-history-snapshot",
|
|
611
|
+
"file-history-delta",
|
|
612
|
+
"cost-state",
|
|
613
|
+
"pr-link",
|
|
614
|
+
"bridge-session"
|
|
615
|
+
];
|
|
616
|
+
const claudeSkippedStatus = [
|
|
617
|
+
"turn_duration",
|
|
618
|
+
"informational",
|
|
619
|
+
"stop_hook_summary",
|
|
620
|
+
"away_summary",
|
|
621
|
+
"api_error",
|
|
622
|
+
"local_command",
|
|
623
|
+
"scheduled_task_fire",
|
|
624
|
+
"agents_killed",
|
|
625
|
+
"model_refusal_fallback"
|
|
626
|
+
];
|
|
627
|
+
const claudeSkippedAttachments = [
|
|
628
|
+
"agent_listing_delta",
|
|
629
|
+
"auto_mode",
|
|
630
|
+
"bash_output_audience_note",
|
|
631
|
+
"batching_reminder_sent",
|
|
632
|
+
"budget_usd",
|
|
633
|
+
"command_permissions",
|
|
634
|
+
"compact_file_reference",
|
|
635
|
+
"credential_org",
|
|
636
|
+
"date",
|
|
637
|
+
"deferred_tools_delta",
|
|
638
|
+
"deferred_tools_record",
|
|
639
|
+
"diagnostics",
|
|
640
|
+
"directory",
|
|
641
|
+
"edited_text_file",
|
|
642
|
+
"environment",
|
|
643
|
+
"file",
|
|
644
|
+
"goal_status",
|
|
645
|
+
"hook_additional_context",
|
|
646
|
+
"hook_cancelled",
|
|
647
|
+
"hook_non_blocking_error",
|
|
648
|
+
"hook_system_message",
|
|
649
|
+
"instructions",
|
|
650
|
+
"invoked_skills",
|
|
651
|
+
"max_turns_reached",
|
|
652
|
+
"mcp_instructions_delta",
|
|
653
|
+
"model",
|
|
654
|
+
"nested_memory",
|
|
655
|
+
"plan_mode",
|
|
656
|
+
"prompt_snapshot",
|
|
657
|
+
"read_truncation_notice",
|
|
658
|
+
"remote_session_change",
|
|
659
|
+
"sandbox_instructions",
|
|
660
|
+
"session_context",
|
|
661
|
+
"silent_turn_reminder",
|
|
662
|
+
"skill_listing",
|
|
663
|
+
"skill_mention",
|
|
664
|
+
"task_reminder",
|
|
665
|
+
"task_status",
|
|
666
|
+
"thinking_drop",
|
|
667
|
+
"thinking_stripped",
|
|
668
|
+
"total_tokens_reminder",
|
|
669
|
+
"ultra_effort_enter",
|
|
670
|
+
"ultra_effort_exit",
|
|
671
|
+
"workflow_keyword_request"
|
|
672
|
+
];
|
|
673
|
+
const ownerText = (said) => {
|
|
674
|
+
if (/^\[Request interrupted by user[^\]]*\]$/.test(said)) return { type: "error", message: said };
|
|
675
|
+
if (/^<(?:local-command-std(?:out|err)|bash-std(?:out|err))>/.test(said)) return void 0;
|
|
676
|
+
const command = /^<command-(?:name|message)>/.test(said) ? /<command-name>([^<]*)<\/command-name>/.exec(said)?.[1] : void 0;
|
|
677
|
+
if (command !== void 0) {
|
|
678
|
+
const args = /<command-args>([\s\S]*?)<\/command-args>/.exec(said)?.[1]?.trim();
|
|
679
|
+
return { type: "prompt", text: args ? `${command} ${args}` : command };
|
|
680
|
+
}
|
|
681
|
+
const shell = /^<bash-input>([\s\S]*)<\/bash-input>$/.exec(said)?.[1];
|
|
682
|
+
return { type: "prompt", text: shell === void 0 ? said : `!${shell.trim()}` };
|
|
683
|
+
};
|
|
684
|
+
const decodeClaude = (state, chunk) => {
|
|
685
|
+
const lines = (state.pending + chunk).split("\n");
|
|
686
|
+
const pending = lines.pop();
|
|
687
|
+
let { line, seq, session, turn } = state;
|
|
688
|
+
const calls = new Map(Object.entries(state.calls));
|
|
689
|
+
const entries = [];
|
|
690
|
+
const fail = (code, message) => import_effect.Result.fail(new ExternalTranscriptError({ code, message, line }));
|
|
691
|
+
const unread = (what, type) => typeof type === "string" && type !== "" ? fail("unsupported_record", `Claude Code wrote ${what} this release does not read: ${type}`) : fail("malformed_record", `Claude Code transcript line ${line} names no ${what.replace(/^an? /, "")} type.`);
|
|
692
|
+
for (const raw of lines) {
|
|
693
|
+
line++;
|
|
694
|
+
if (raw.trim() === "") continue;
|
|
695
|
+
const row = parseRow(raw);
|
|
696
|
+
if (row === void 0) return fail("malformed_record", `Claude Code transcript line ${line} is not a JSON record.`);
|
|
697
|
+
if (claudeSkippedRows.includes(text(row["type"]))) continue;
|
|
698
|
+
if (!["user", "assistant", "system", "attachment"].includes(text(row["type"]))) {
|
|
699
|
+
return unread("a record", row["type"]);
|
|
700
|
+
}
|
|
701
|
+
if (typeof row["uuid"] !== "string") {
|
|
702
|
+
return fail("malformed_record", `Claude Code transcript line ${line} is a conversation record without a uuid.`);
|
|
703
|
+
}
|
|
704
|
+
const release = text(row["version"]);
|
|
705
|
+
if (release === "") return fail("missing_version", `Claude Code transcript line ${line} names no release.`);
|
|
706
|
+
const format_version = profileOf("claude-code", claudeReleases, release);
|
|
707
|
+
if (format_version === void 0) {
|
|
708
|
+
return fail(
|
|
709
|
+
"unsupported_version",
|
|
710
|
+
`Claude Code ${release} wrote this transcript; supported: ${claudeReleases.join(", ")}.`
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
session ??= text(row["sessionId"]) || void 0;
|
|
714
|
+
if (session === void 0) {
|
|
715
|
+
return fail("malformed_record", `Claude Code transcript line ${line} names no session.`);
|
|
716
|
+
}
|
|
717
|
+
const sessionId = session;
|
|
718
|
+
if (row["isSidechain"] === true) continue;
|
|
719
|
+
const at = Date.parse(text(row["timestamp"])) || 0;
|
|
720
|
+
if (row["type"] === "user" && typeof row["promptId"] === "string" && row["promptId"] !== "") {
|
|
721
|
+
turn = row["promptId"];
|
|
722
|
+
}
|
|
723
|
+
const found = [];
|
|
724
|
+
const said = (part) => found.push({ role: "assistant", part });
|
|
725
|
+
const message = record(row["message"]);
|
|
726
|
+
if ((row["type"] === "user" || row["type"] === "assistant") && typeof message["content"] !== "string" && !Array.isArray(message["content"])) {
|
|
727
|
+
return fail("malformed_record", `Claude Code transcript line ${line} has no message content.`);
|
|
728
|
+
}
|
|
729
|
+
switch (row["type"]) {
|
|
730
|
+
case "user": {
|
|
731
|
+
const blocks = blocksOf(message["content"]);
|
|
732
|
+
for (const block of blocks) {
|
|
733
|
+
if (block["type"] === "tool_result") {
|
|
734
|
+
const callId = text(block["tool_use_id"]);
|
|
735
|
+
const call = calls.get(callId);
|
|
736
|
+
calls.delete(callId);
|
|
737
|
+
const content = block["content"];
|
|
738
|
+
said(claudeToolPart(callId, call, {
|
|
739
|
+
failed: block["is_error"] === true,
|
|
740
|
+
output: typeof content === "string" ? content : textOf(list(content).map(record)),
|
|
741
|
+
report: record(row["toolUseResult"]),
|
|
742
|
+
took: call !== void 0 && call.at > 0 && at > call.at ? at - call.at : 0
|
|
743
|
+
}));
|
|
744
|
+
} else if (block["type"] !== "text" && block["type"] !== "image") {
|
|
745
|
+
return unread("a content block", block["type"]);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
const words = textOf(blocks);
|
|
749
|
+
if (words === "" || row["isMeta"] === true || row["isCompactSummary"] === true || !byOwner(row["origin"])) break;
|
|
750
|
+
const part = ownerText(words);
|
|
751
|
+
if (part !== void 0) found.push({ role: part.type === "prompt" ? "user" : "assistant", part });
|
|
752
|
+
break;
|
|
753
|
+
}
|
|
754
|
+
case "assistant": {
|
|
755
|
+
const blocks = blocksOf(message["content"]);
|
|
756
|
+
if (row["isApiErrorMessage"] === true) {
|
|
757
|
+
said({ type: "error", message: textOf(blocks) || text(row["error"]) });
|
|
758
|
+
break;
|
|
759
|
+
}
|
|
760
|
+
for (const block of blocks) {
|
|
761
|
+
switch (block["type"]) {
|
|
762
|
+
case "text":
|
|
763
|
+
if (text(block["text"]) !== "") {
|
|
764
|
+
said({ type: "text", text: text(block["text"]), final: message["stop_reason"] === "end_turn" });
|
|
765
|
+
}
|
|
766
|
+
break;
|
|
767
|
+
case "thinking":
|
|
768
|
+
if (text(block["thinking"]) !== "") said({ type: "reasoning", text: text(block["thinking"]) });
|
|
769
|
+
break;
|
|
770
|
+
case "redacted_thinking":
|
|
771
|
+
break;
|
|
772
|
+
case "fallback":
|
|
773
|
+
break;
|
|
774
|
+
case "tool_use":
|
|
775
|
+
if (typeof block["id"] !== "string" || block["id"] === "") {
|
|
776
|
+
return fail("malformed_record", `Claude Code tool request on line ${line} names no call.`);
|
|
777
|
+
}
|
|
778
|
+
calls.set(block["id"], { name: text(block["name"]), input: block["input"] ?? {}, at });
|
|
779
|
+
break;
|
|
780
|
+
default:
|
|
781
|
+
return unread("a content block", block["type"]);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
break;
|
|
785
|
+
}
|
|
786
|
+
case "system":
|
|
787
|
+
if (row["subtype"] === "compact_boundary") said({ type: "compaction" });
|
|
788
|
+
else if (!claudeSkippedStatus.includes(text(row["subtype"]))) return unread("a status record", row["subtype"]);
|
|
789
|
+
break;
|
|
790
|
+
case "attachment": {
|
|
791
|
+
const attachment = record(row["attachment"]);
|
|
792
|
+
if (attachment["type"] !== "queued_command") {
|
|
793
|
+
if (!claudeSkippedAttachments.includes(text(attachment["type"]))) {
|
|
794
|
+
return unread("an attachment", attachment["type"]);
|
|
795
|
+
}
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
if (attachment["commandMode"] === "prompt" && attachment["isMeta"] !== true && byOwner(attachment["origin"])) {
|
|
799
|
+
const words = textOf(blocksOf(attachment["prompt"]));
|
|
800
|
+
if (words !== "") found.push({ role: "user", part: { type: "prompt", text: words } });
|
|
801
|
+
}
|
|
802
|
+
break;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
found.forEach(({ part, role }, index) => {
|
|
806
|
+
entries.push({
|
|
807
|
+
origin: "external",
|
|
808
|
+
agent_kind: "claude-code",
|
|
809
|
+
format_version,
|
|
810
|
+
session_id: sessionId,
|
|
811
|
+
source_id: index === 0 ? `${sessionId}:${line}` : `${sessionId}:${line}#${index}`,
|
|
812
|
+
read_only: true,
|
|
813
|
+
seq: seq++,
|
|
814
|
+
at,
|
|
815
|
+
...turn === void 0 ? {} : { turn_id: turn },
|
|
816
|
+
role,
|
|
817
|
+
part
|
|
818
|
+
});
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
return import_effect.Result.succeed({
|
|
822
|
+
state: { pending, line, seq, session, turn, calls: Object.fromEntries(calls) },
|
|
823
|
+
entries
|
|
824
|
+
});
|
|
825
|
+
};
|
|
826
|
+
//# sourceMappingURL=ExternalTranscript.js.map
|