@smthrs/harness 0.0.0-stage → 1.0.0-rc.3
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 +987 -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 +1143 -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 @@
|
|
|
1
|
+
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../src/Cell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAS,MAAM,EAAU,MAAM,EAAE,MAAM,EAAE,MAAM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ACH,qBAAa,UAAW,SAAQ,eAiB/B;gBACa,KAAK,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,WAAW;CAMnE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;;;;EAKtB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;;;;EAKtB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;IAA2C,CAAA;AAEzE;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAoB7D;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,UAxB4D,OAAO;;;;;;;;;;uBAwBhB,CAAA;AAEhF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,UAhC+D,OAAO,oEAgCjC,CAAA;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,UAxC4D,OAAO,mEAwCxB,CAAA;AAExE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,UAAU,KAAG,MAAM,CAAC,IAUvD,CAAA;AAWD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAqCvE,CAAA"}
|
package/dist/cjs/Cell.js
ADDED
|
@@ -0,0 +1,431 @@
|
|
|
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 Cell_exports = {};
|
|
30
|
+
__export(Cell_exports, {
|
|
31
|
+
Call: () => Call,
|
|
32
|
+
CallFailure: () => CallFailure,
|
|
33
|
+
CallFailureCode: () => CallFailureCode,
|
|
34
|
+
CallIdentity: () => CallIdentity,
|
|
35
|
+
CallResult: () => CallResult,
|
|
36
|
+
CallResultVariant: () => CallResultVariant,
|
|
37
|
+
CallSuccess: () => CallSuccess,
|
|
38
|
+
Complete: () => Complete,
|
|
39
|
+
Continue: () => Continue,
|
|
40
|
+
FlowProjection: () => FlowProjection,
|
|
41
|
+
Language: () => Language,
|
|
42
|
+
Outcome: () => Outcome,
|
|
43
|
+
Park: () => Park,
|
|
44
|
+
Raised: () => Raised,
|
|
45
|
+
Rejected: () => Rejected,
|
|
46
|
+
RejectionCode: () => RejectionCode,
|
|
47
|
+
Settled: () => Settled,
|
|
48
|
+
Source: () => Source,
|
|
49
|
+
Transition: () => Transition,
|
|
50
|
+
TreeEpoch: () => TreeEpoch,
|
|
51
|
+
baseCheckpoint: () => baseCheckpoint,
|
|
52
|
+
callFailure: () => callFailure,
|
|
53
|
+
callFailureHint: () => callFailureHint,
|
|
54
|
+
callOf: () => callOf,
|
|
55
|
+
checkpoint: () => checkpoint,
|
|
56
|
+
checkpointOf: () => checkpointOf,
|
|
57
|
+
declarationDigest: () => declarationDigest,
|
|
58
|
+
decodeCallResult: () => decodeCallResult,
|
|
59
|
+
decodeOutcome: () => decodeOutcome,
|
|
60
|
+
decodeTransition: () => decodeTransition,
|
|
61
|
+
defaultCallFailureCode: () => defaultCallFailureCode,
|
|
62
|
+
digestOf: () => digestOf,
|
|
63
|
+
displayDescriptor: () => displayDescriptor,
|
|
64
|
+
extract: () => extract,
|
|
65
|
+
project: () => project,
|
|
66
|
+
renderText: () => renderText,
|
|
67
|
+
source: () => source
|
|
68
|
+
});
|
|
69
|
+
module.exports = __toCommonJS(Cell_exports);
|
|
70
|
+
var Digest = __toESM(require("@smthrs/core/Digest"), 1);
|
|
71
|
+
var CanonicalJson = __toESM(require("@smthrs/model/CanonicalJson"), 1);
|
|
72
|
+
var Descriptor = __toESM(require("@smthrs/registry/Descriptor"), 1);
|
|
73
|
+
var import_effect = require("effect");
|
|
74
|
+
var import_HarnessError = require("./HarnessError.js");
|
|
75
|
+
var import_nonNegativeSafeInt = require("./internal/nonNegativeSafeInt.js");
|
|
76
|
+
const Language = import_effect.Schema.Literals(["javascript", "typescript"]);
|
|
77
|
+
class Source extends import_effect.Schema.Class("flows/harness/Cell/Source")({
|
|
78
|
+
language: Language,
|
|
79
|
+
text: import_effect.Schema.String,
|
|
80
|
+
digest: import_effect.Schema.String
|
|
81
|
+
}) {
|
|
82
|
+
}
|
|
83
|
+
const digestOf = (language, text) => Digest.digest(CanonicalJson.stringify({ kind: "flows/harness/Cell/Source", language, text }));
|
|
84
|
+
const source = (text, language = "javascript") => new Source({ language, text, digest: digestOf(language, text) });
|
|
85
|
+
class Continue extends import_effect.Schema.TaggedClass("flows/harness/Cell/Continue")("continue", {
|
|
86
|
+
/**
|
|
87
|
+
* Why this frame changed nothing, when the controller demanded that it
|
|
88
|
+
* either mutate or say why not.
|
|
89
|
+
*
|
|
90
|
+
* The field exists because prose in the prompt did not stop a run from
|
|
91
|
+
* reading for its whole budget: a benchmark instance spent 100 frames and
|
|
92
|
+
* 132 calls without one edit attempt and then claimed the fix was
|
|
93
|
+
* implemented. A justification is the typed way out of the read-only cap —
|
|
94
|
+
* it is recorded, it buys a bounded grace, and it does not reset the
|
|
95
|
+
* counter that eventually stops the run. A cell writes one by calling
|
|
96
|
+
* `ctx.justify`.
|
|
97
|
+
*/
|
|
98
|
+
justification: import_effect.Schema.optional(import_effect.Schema.String)
|
|
99
|
+
}) {
|
|
100
|
+
}
|
|
101
|
+
class Complete extends import_effect.Schema.TaggedClass("flows/harness/Cell/Complete")("complete", {
|
|
102
|
+
output: import_effect.Schema.String,
|
|
103
|
+
value: import_effect.Schema.optional(import_effect.Schema.Json)
|
|
104
|
+
}) {
|
|
105
|
+
}
|
|
106
|
+
class Park extends import_effect.Schema.TaggedClass("flows/harness/Cell/Park")("park", {
|
|
107
|
+
reason: import_effect.Schema.Literals(["waiting-input", "waiting-event", "waiting-quota"]),
|
|
108
|
+
message: import_effect.Schema.String
|
|
109
|
+
}) {
|
|
110
|
+
}
|
|
111
|
+
const Transition = import_effect.Schema.Union([Continue, Complete, Park]).pipe(import_effect.Schema.toTaggedUnion("_tag"));
|
|
112
|
+
const renderText = (value) => typeof value === "string" ? value : CanonicalJson.stringify(value);
|
|
113
|
+
const RejectionCode = import_effect.Schema.Literals([
|
|
114
|
+
"no_cell",
|
|
115
|
+
"output_truncated",
|
|
116
|
+
"imports_forbidden",
|
|
117
|
+
"compile_failed",
|
|
118
|
+
"invalid_transition",
|
|
119
|
+
"unsupported_language",
|
|
120
|
+
"limit_exceeded",
|
|
121
|
+
"stalled"
|
|
122
|
+
]);
|
|
123
|
+
class Settled extends import_effect.Schema.TaggedClass("flows/harness/Cell/Settled")("settled", {
|
|
124
|
+
transition: Transition
|
|
125
|
+
}) {
|
|
126
|
+
}
|
|
127
|
+
class Raised extends import_effect.Schema.TaggedClass("flows/harness/Cell/Raised")("raised", {
|
|
128
|
+
name: import_effect.Schema.String,
|
|
129
|
+
message: import_effect.Schema.String
|
|
130
|
+
}) {
|
|
131
|
+
}
|
|
132
|
+
class Rejected extends import_effect.Schema.TaggedClass("flows/harness/Cell/Rejected")("rejected", {
|
|
133
|
+
code: RejectionCode,
|
|
134
|
+
message: import_effect.Schema.String,
|
|
135
|
+
/** The spent resource when `code` is `limit_exceeded`. */
|
|
136
|
+
reason: import_effect.Schema.optional(import_effect.Schema.Literals(["heap"]))
|
|
137
|
+
}) {
|
|
138
|
+
}
|
|
139
|
+
const Outcome = import_effect.Schema.Union([Settled, Raised, Rejected]).pipe(import_effect.Schema.toTaggedUnion("_tag"));
|
|
140
|
+
class FlowProjection extends import_effect.Schema.Class("flows/harness/Cell/FlowProjection")({
|
|
141
|
+
name: import_effect.Schema.String,
|
|
142
|
+
description: import_effect.Schema.String,
|
|
143
|
+
capabilities: import_effect.Schema.Array(import_effect.Schema.String),
|
|
144
|
+
tier: Descriptor.EffectTier,
|
|
145
|
+
placement: import_effect.Schema.Option(Descriptor.Placement),
|
|
146
|
+
/**
|
|
147
|
+
* The call's input schema, as a JSON Schema document, when the descriptor
|
|
148
|
+
* carries one by value.
|
|
149
|
+
*
|
|
150
|
+
* Without it a cell can only guess an input shape from prose, and every
|
|
151
|
+
* guess costs a whole frame: a rejected call is one model turn, so learning
|
|
152
|
+
* `bash` takes `{ command, mode, reads, writes }` cost four turns of pure
|
|
153
|
+
* trial and error before any work began.
|
|
154
|
+
*/
|
|
155
|
+
input: import_effect.Schema.Option(import_effect.Schema.Json).pipe(
|
|
156
|
+
import_effect.Schema.withConstructorDefault(import_effect.Effect.succeed(import_effect.Option.none())),
|
|
157
|
+
import_effect.Schema.withDecodingDefaultKey(import_effect.Effect.succeed(import_effect.Option.none()))
|
|
158
|
+
)
|
|
159
|
+
}) {
|
|
160
|
+
}
|
|
161
|
+
const project = (descriptor) => new FlowProjection({
|
|
162
|
+
name: descriptor.name,
|
|
163
|
+
description: descriptor.description,
|
|
164
|
+
capabilities: descriptor.capabilities,
|
|
165
|
+
tier: descriptor.effects.tier,
|
|
166
|
+
placement: descriptor.placement,
|
|
167
|
+
input: descriptor.input._tag === "Inline" ? import_effect.Option.some(descriptor.input.document) : import_effect.Option.none()
|
|
168
|
+
});
|
|
169
|
+
const CallFailureCode = import_effect.Schema.Literals([
|
|
170
|
+
"unknown_flow",
|
|
171
|
+
"capability_refused",
|
|
172
|
+
"truncated_write",
|
|
173
|
+
"declaration_changed",
|
|
174
|
+
"invalid_input",
|
|
175
|
+
"unimplemented",
|
|
176
|
+
"timeout",
|
|
177
|
+
"run_completed",
|
|
178
|
+
"checkpoint_unavailable",
|
|
179
|
+
"checkpoint_exhausted",
|
|
180
|
+
"checkpoint_readonly",
|
|
181
|
+
"checkpoint_unsupported",
|
|
182
|
+
"flow_failed",
|
|
183
|
+
"flow_withheld"
|
|
184
|
+
]);
|
|
185
|
+
const defaultCallFailureCode = "flow_failed";
|
|
186
|
+
const callFailureHint = Object.freeze({
|
|
187
|
+
unknown_flow: "Read ctx.flows and call one of the names it lists.",
|
|
188
|
+
capability_refused: "This run cannot reach that flow. Do the work with a flow ctx.flows lists.",
|
|
189
|
+
truncated_write: "The bytes you passed were a fragment. Restore from source control instead of writing captured output.",
|
|
190
|
+
declaration_changed: "Read ctx.flows again and reissue the call with the shape it now declares.",
|
|
191
|
+
invalid_input: "Fix the input against the flow's declared schema in ctx.flows and call it again in this cell.",
|
|
192
|
+
unimplemented: "This host cannot run that flow. Choose another one from ctx.flows.",
|
|
193
|
+
timeout: "Narrow the call \u2014 a smaller root, a tighter pattern, a shorter command \u2014 and issue it again in this cell.",
|
|
194
|
+
checkpoint_unavailable: "This host pins no checkpoint you can run against. Drop at; for a baseline, run the check before your edit, then again after it.",
|
|
195
|
+
checkpoint_exhausted: "Reuse a checkpoint you already hold, or ctx.base, instead of minting another one.",
|
|
196
|
+
checkpoint_readonly: "A checkpoint is a read-only view of a tree that has already been. Drop at and make the change on the live tree.",
|
|
197
|
+
checkpoint_unsupported: "This flow names what it touches rather than where it runs, so it cannot be pointed at a checkpoint. Drop at, or run the same work through a shell flow, which takes a working directory.",
|
|
198
|
+
run_completed: "The run is over, so nothing after this line runs. If that was early, guard the ctx.done or ctx.park on the check that decides it.",
|
|
199
|
+
flow_failed: "Read error.message: the flow itself says what went wrong, and it is usually fixable in this same cell.",
|
|
200
|
+
flow_withheld: "End this cell and reissue the call in the next one; ctx.flows lists the flow there."
|
|
201
|
+
});
|
|
202
|
+
const TreeEpoch = import_effect.Schema.Struct({
|
|
203
|
+
/** Earlier frames of this run that changed the workspace. */
|
|
204
|
+
frames: import_nonNegativeSafeInt.NonNegativeSafeInt,
|
|
205
|
+
/** Calls of this frame that may write, issued before this one. */
|
|
206
|
+
calls: import_nonNegativeSafeInt.NonNegativeSafeInt,
|
|
207
|
+
/** Digest of those calls, chained in issue order: which writes, not only how many. */
|
|
208
|
+
writes: import_effect.Schema.optional(import_effect.Schema.String),
|
|
209
|
+
/** Digest of the whole-tree measurement the frame opened on. */
|
|
210
|
+
tree: import_effect.Schema.optional(import_effect.Schema.String),
|
|
211
|
+
/** The run, when no whole-tree measurement exists: the reading is reused only inside it. */
|
|
212
|
+
session: import_effect.Schema.optional(import_effect.Schema.String),
|
|
213
|
+
/** The frame, beside `session`: an unmeasured tree may change during a model wait. */
|
|
214
|
+
frame: import_effect.Schema.optional(import_nonNegativeSafeInt.NonNegativeSafeInt)
|
|
215
|
+
});
|
|
216
|
+
class CallIdentity extends import_effect.Schema.Class("flows/harness/Cell/CallIdentity")({
|
|
217
|
+
/** The durable session/lineage the frame belongs to. */
|
|
218
|
+
session: import_effect.Schema.String,
|
|
219
|
+
/** The controller frame that produced the cell. */
|
|
220
|
+
frame: import_nonNegativeSafeInt.NonNegativeSafeInt,
|
|
221
|
+
/** The digest of the cell source being executed. */
|
|
222
|
+
cell: import_effect.Schema.String,
|
|
223
|
+
/** The zero-based execution ordinal of this call within the cell. */
|
|
224
|
+
ordinal: import_nonNegativeSafeInt.NonNegativeSafeInt,
|
|
225
|
+
/** The digest of the resolved flow declaration being invoked. */
|
|
226
|
+
declaration: import_effect.Schema.String,
|
|
227
|
+
/** The resolved layer set in effect at the boundary. */
|
|
228
|
+
layers: import_effect.Schema.Array(import_effect.Schema.String)
|
|
229
|
+
}) {
|
|
230
|
+
}
|
|
231
|
+
const declarationDigest = Descriptor.declarationDigest;
|
|
232
|
+
class Call extends import_effect.Schema.Class("flows/harness/Cell/Call")({
|
|
233
|
+
flowName: import_effect.Schema.String,
|
|
234
|
+
input: import_effect.Schema.Json,
|
|
235
|
+
capabilities: import_effect.Schema.Array(import_effect.Schema.String),
|
|
236
|
+
effects: Descriptor.EffectDeclaration,
|
|
237
|
+
placement: import_effect.Schema.Option(Descriptor.Placement),
|
|
238
|
+
identity: CallIdentity,
|
|
239
|
+
/**
|
|
240
|
+
* The checkpoint this call runs against, when the cell named one.
|
|
241
|
+
*
|
|
242
|
+
* Absent is the ordinary case and means the live workspace. Present names a
|
|
243
|
+
* tree the run already pinned, and the host materializes that tree somewhere
|
|
244
|
+
* of its own choosing and runs the call there. It is journaled on the call
|
|
245
|
+
* because it is the difference between a reading of the tree as it is and a
|
|
246
|
+
* reading of the tree as it was, and a grader that cannot tell those apart
|
|
247
|
+
* cannot grade a fails-before proof at all.
|
|
248
|
+
*/
|
|
249
|
+
at: import_effect.Schema.optional(import_effect.Schema.String),
|
|
250
|
+
/**
|
|
251
|
+
* Which version of the live tree a sealed reading is taken against.
|
|
252
|
+
*
|
|
253
|
+
* A sealed call is content-addressed on what it asked, and "the same path
|
|
254
|
+
* against the tree as it stands" is the same question only until something
|
|
255
|
+
* has written to the tree. Without this, the second of two identical reads
|
|
256
|
+
* around a write replays the first's answer and a run reports the pre-edit
|
|
257
|
+
* text after its own edit. `frames` is the run's frame clock — the count of
|
|
258
|
+
* earlier frames that changed the workspace, measured where the host can
|
|
259
|
+
* measure — and `calls` is how many calls of this frame that may write
|
|
260
|
+
* were issued before this one, with `writes` chaining what they asked, so
|
|
261
|
+
* two runs that wrote differently read different questions. All are derived
|
|
262
|
+
* from the journaled call
|
|
263
|
+
* sequence, so a replayed frame derives the same epoch and replays.
|
|
264
|
+
*
|
|
265
|
+
* The counters restart with every run, so they cannot tell a later run's
|
|
266
|
+
* read from an earlier run's across an edit made between them. `tree` is
|
|
267
|
+
* the digest of a journaled measurement taken after the model wait, which
|
|
268
|
+
* can; without a whole measurement, `session` and `frame` keep the reading
|
|
269
|
+
* to the frame that took it.
|
|
270
|
+
*
|
|
271
|
+
* Absent on every call that is not a sealed reading of the live tree: a
|
|
272
|
+
* checkpoint is immutable, and a non-sealed call already keys on its ordinal.
|
|
273
|
+
*/
|
|
274
|
+
epoch: import_effect.Schema.optional(TreeEpoch),
|
|
275
|
+
/**
|
|
276
|
+
* What the resolved declaration says a call to this flow does.
|
|
277
|
+
*
|
|
278
|
+
* Carried on the call rather than looked up later, because the reader of a
|
|
279
|
+
* run is not the host that resolved it: a card reading a journal months
|
|
280
|
+
* afterwards holds the record and nothing else, and a flow name is not a
|
|
281
|
+
* meaning. Absent is unknown, and unknown stays unknown.
|
|
282
|
+
*/
|
|
283
|
+
activity: import_effect.Schema.optional(Descriptor.FlowActivity),
|
|
284
|
+
/**
|
|
285
|
+
* How the resolved declaration says one recorded call to this flow reads.
|
|
286
|
+
*
|
|
287
|
+
* Display authority only. Neither this field nor `activity` enters a key:
|
|
288
|
+
* {@link callMaterial} and the durable call key name the fields they hash,
|
|
289
|
+
* and both digests in `@smthrs/registry` exclude these two, so enriching a
|
|
290
|
+
* declaration with them can neither replay nor re-approve anything.
|
|
291
|
+
*/
|
|
292
|
+
presentation: import_effect.Schema.optional(Descriptor.CallPresentation)
|
|
293
|
+
}) {
|
|
294
|
+
}
|
|
295
|
+
const callOf = (descriptor, options) => new Call({
|
|
296
|
+
flowName: descriptor.name,
|
|
297
|
+
input: options.input,
|
|
298
|
+
capabilities: descriptor.capabilities,
|
|
299
|
+
effects: descriptor.effects,
|
|
300
|
+
placement: descriptor.placement,
|
|
301
|
+
identity: options.identity,
|
|
302
|
+
...options.at === void 0 ? {} : { at: options.at },
|
|
303
|
+
...options.epoch === void 0 ? {} : { epoch: options.epoch },
|
|
304
|
+
...descriptor.activity === void 0 ? {} : { activity: descriptor.activity },
|
|
305
|
+
...descriptor.presentation === void 0 ? {} : { presentation: descriptor.presentation }
|
|
306
|
+
});
|
|
307
|
+
const displayDescriptor = (call) => call.activity === void 0 && call.presentation === void 0 ? void 0 : {
|
|
308
|
+
name: call.flowName,
|
|
309
|
+
...call.activity === void 0 ? {} : { activity: call.activity },
|
|
310
|
+
...call.presentation === void 0 ? {} : {
|
|
311
|
+
presentation: {
|
|
312
|
+
verb: { ...call.presentation.verb },
|
|
313
|
+
subject: call.presentation.subject,
|
|
314
|
+
result: call.presentation.result
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
const baseCheckpoint = "base";
|
|
319
|
+
const Handle = import_effect.Schema.Struct({ checkpoint: import_effect.Schema.NonEmptyString });
|
|
320
|
+
const checkpoint = (id) => ({ checkpoint: id });
|
|
321
|
+
const checkpointOf = (value) => {
|
|
322
|
+
const decoded = import_effect.Schema.decodeUnknownResult(Handle)(value);
|
|
323
|
+
return decoded._tag === "Success" ? decoded.success.checkpoint : void 0;
|
|
324
|
+
};
|
|
325
|
+
class CallResult extends import_effect.Schema.Class("flows/harness/Cell/CallResult")(
|
|
326
|
+
import_effect.Schema.Struct({
|
|
327
|
+
outcome: import_effect.Schema.Literals(["success", "failure"]),
|
|
328
|
+
value: import_effect.Schema.Json,
|
|
329
|
+
message: import_effect.Schema.optional(import_effect.Schema.String),
|
|
330
|
+
/**
|
|
331
|
+
* Why a failed call failed, from the closed set the cell may branch on.
|
|
332
|
+
*
|
|
333
|
+
* Prose is what a boundary says; a code is what a program reads. Without one
|
|
334
|
+
* the only way for a cell to tell "that flow does not exist" from "that
|
|
335
|
+
* command timed out" was to match the message, so cells did not tell them
|
|
336
|
+
* apart at all. Absent means {@link defaultCallFailureCode}, which is what a
|
|
337
|
+
* flow's own failure gets: the flow said why in `message` and the harness
|
|
338
|
+
* does not classify it.
|
|
339
|
+
*/
|
|
340
|
+
code: import_effect.Schema.optional(CallFailureCode)
|
|
341
|
+
})
|
|
342
|
+
) {
|
|
343
|
+
constructor(props, options) {
|
|
344
|
+
super(CallResultVariant.make(props), options);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
const CallSuccess = import_effect.Schema.Struct({
|
|
348
|
+
outcome: import_effect.Schema.Literal("success"),
|
|
349
|
+
value: import_effect.Schema.Json,
|
|
350
|
+
message: import_effect.Schema.optional(import_effect.Schema.String),
|
|
351
|
+
code: import_effect.Schema.optionalKey(import_effect.Schema.Never)
|
|
352
|
+
});
|
|
353
|
+
const CallFailure = import_effect.Schema.Struct({
|
|
354
|
+
outcome: import_effect.Schema.Literal("failure"),
|
|
355
|
+
value: import_effect.Schema.Json,
|
|
356
|
+
message: import_effect.Schema.optional(import_effect.Schema.String),
|
|
357
|
+
code: import_effect.Schema.optional(CallFailureCode)
|
|
358
|
+
});
|
|
359
|
+
const CallResultVariant = import_effect.Schema.Union([CallSuccess, CallFailure]);
|
|
360
|
+
const decodeBoundary = (schema, name) => (value) => import_effect.Effect.suspend(
|
|
361
|
+
() => import_effect.Effect.gen(function* () {
|
|
362
|
+
const encoded = yield* import_effect.Schema.decodeUnknownEffect(import_effect.Schema.toEncoded(schema), { onExcessProperty: "error" })(value);
|
|
363
|
+
return yield* import_effect.Schema.decodeUnknownEffect(schema, { onExcessProperty: "error" })(encoded);
|
|
364
|
+
})
|
|
365
|
+
).pipe(
|
|
366
|
+
import_effect.Effect.catchCause(
|
|
367
|
+
(cause) => import_effect.Effect.fail(
|
|
368
|
+
new import_HarnessError.HarnessError({
|
|
369
|
+
code: "engine_failed",
|
|
370
|
+
message: `Invalid recorded cell ${name}`,
|
|
371
|
+
cause: import_effect.Cause.squash(cause)
|
|
372
|
+
})
|
|
373
|
+
)
|
|
374
|
+
)
|
|
375
|
+
);
|
|
376
|
+
const decodeCallResult = decodeBoundary(CallResultVariant, "call result");
|
|
377
|
+
const decodeOutcome = decodeBoundary(Outcome, "outcome");
|
|
378
|
+
const decodeTransition = decodeBoundary(Transition, "transition");
|
|
379
|
+
const callFailure = (result) => {
|
|
380
|
+
const code = result.code ?? defaultCallFailureCode;
|
|
381
|
+
return {
|
|
382
|
+
ok: false,
|
|
383
|
+
error: {
|
|
384
|
+
code,
|
|
385
|
+
message: result.message ?? "The flow call failed",
|
|
386
|
+
hint: callFailureHint[code]
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
const fenced = /^```(?<info>[^\n`]*)\r?\n(?<body>[\s\S]*?)(?:\n?(?<close>^```[ \t]*(?=\r?$))|(?![\s\S]))/gm;
|
|
391
|
+
const languageOf = (info) => {
|
|
392
|
+
const tokens = new Set(info.trim().toLowerCase().split(/\s+/).filter((token) => token.length > 0));
|
|
393
|
+
if (tokens.has("ts") || tokens.has("typescript")) return "typescript";
|
|
394
|
+
if (tokens.has("cell") || tokens.has("js") || tokens.has("javascript")) return "javascript";
|
|
395
|
+
return void 0;
|
|
396
|
+
};
|
|
397
|
+
const extract = (text) => {
|
|
398
|
+
const bodies = [];
|
|
399
|
+
const distinct = /* @__PURE__ */ new Set();
|
|
400
|
+
let typed = false;
|
|
401
|
+
fenced.lastIndex = 0;
|
|
402
|
+
for (const match of text.matchAll(fenced)) {
|
|
403
|
+
const candidate = languageOf(match.groups?.info ?? "");
|
|
404
|
+
if (candidate === void 0) continue;
|
|
405
|
+
if (match.groups?.close === void 0) {
|
|
406
|
+
return import_effect.Result.fail(
|
|
407
|
+
new Rejected({
|
|
408
|
+
code: "output_truncated",
|
|
409
|
+
message: "The response contains an unterminated cell fence. No blocks ran. Emit the complete program with every fence closed."
|
|
410
|
+
})
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
if (candidate === "typescript") typed = true;
|
|
414
|
+
const body = match.groups?.body ?? "";
|
|
415
|
+
bodies.push(body);
|
|
416
|
+
distinct.add(body);
|
|
417
|
+
}
|
|
418
|
+
if (bodies.length === 0) {
|
|
419
|
+
return import_effect.Result.fail(
|
|
420
|
+
new Rejected({
|
|
421
|
+
code: "no_cell",
|
|
422
|
+
message: "No cell was found in the response. Emit a fenced ```cell block containing the JavaScript for this transition."
|
|
423
|
+
})
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
return import_effect.Result.succeed({
|
|
427
|
+
source: source([...distinct].join("\n"), typed ? "typescript" : "javascript"),
|
|
428
|
+
blocks: bodies.length
|
|
429
|
+
});
|
|
430
|
+
};
|
|
431
|
+
//# sourceMappingURL=Cell.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Cell.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The cell contract.\n *\n * A Smithers frame is `model -> generated cell -> realm evaluation ->\n * individually durable flow calls -> next transition`. This module owns the\n * serializable half of that sentence: the cell source the model emits, the\n * transition the cell settled, the typed outcomes a cell may settle with, and\n * the identity carried by every flow call made inside one.\n *\n * Nothing here executes anything. Execution is `Sandbox`; durability is\n * `EngineLike.call`; the loop is `CellTurn`.\n *\n * A cell does not *return* its transition. The realm is a REPL that outlives\n * the cell, so a cell states its intent by calling `ctx.done` or `ctx.park` and\n * `Sandbox.replTransition` builds the value; there is no returned object to\n * decode.\n *\n * Governing design: `../docs/concepts.md#durable-cell-loop`,\n * `../docs/concepts.md#repl-realm` and\n * `../docs/concepts.md#agent-cell-context`.\n *\n * @since 0.1.0\n */\n\nimport * as Digest from \"@smthrs/core/Digest\"\nimport * as CanonicalJson from \"@smthrs/model/CanonicalJson\"\nimport * as Descriptor from \"@smthrs/registry/Descriptor\"\nimport { Cause, Effect, Option, Result, Schema } from \"effect\"\nimport { HarnessError } from \"./HarnessError.ts\"\nimport { NonNegativeSafeInt } from \"./internal/nonNegativeSafeInt.ts\"\n\n/**\n * The source language a cell is written in.\n *\n * Both shipped bindings run a `typescript` cell by erasing its type-only\n * syntax \u2014 never by emitting new runtime behaviour, so a construct that needs\n * JavaScript emit is a `compile_failed` rejection rather than a silent\n * transform. A binding that cannot compile at all rejects with\n * `unsupported_language`; neither shipped binding needs to.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport const Language = Schema.Literals([\"javascript\", \"typescript\"])\n\n/**\n * The source language a cell is written in.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport type Language = typeof Language.Type\n\n/**\n * One unit of agent-authored source and its stable content digest.\n *\n * The digest is part of every call identity produced inside the cell, so\n * editing one character of the source re-keys every boundary within it.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport class Source extends Schema.Class<Source>(\"flows/harness/Cell/Source\")({\n language: Language,\n text: Schema.String,\n digest: Schema.String\n}) {}\n\n/**\n * Computes the stable digest of cell source.\n *\n * @category constructors\n * @since 0.1.0\n * @slop\n */\nexport const digestOf = (language: Language, text: string): string =>\n Digest.digest(CanonicalJson.stringify({ kind: \"flows/harness/Cell/Source\", language, text }))\n\n/**\n * Constructs cell source with its computed digest.\n *\n * @category constructors\n * @since 0.1.0\n * @slop\n */\nexport const source = (text: string, language: Language = \"javascript\"): Source =>\n new Source({ language, text, digest: digestOf(language, text) })\n\n/**\n * The cell's turn ended without settling the run.\n *\n * A REPL cell that calls neither `ctx.done` nor `ctx.park` gets another frame,\n * and this is what that frame is journaled as. The only thing it carries is a\n * justification; all other bookkeeping belongs to the realm.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport class Continue extends Schema.TaggedClass<Continue>(\"flows/harness/Cell/Continue\")(\"continue\", {\n /**\n * Why this frame changed nothing, when the controller demanded that it\n * either mutate or say why not.\n *\n * The field exists because prose in the prompt did not stop a run from\n * reading for its whole budget: a benchmark instance spent 100 frames and\n * 132 calls without one edit attempt and then claimed the fix was\n * implemented. A justification is the typed way out of the read-only cap \u2014\n * it is recorded, it buys a bounded grace, and it does not reset the\n * counter that eventually stops the run. A cell writes one by calling\n * `ctx.justify`.\n */\n justification: Schema.optional(Schema.String)\n}) {}\n\n/**\n * The cell declares the task finished and supplies its final output.\n *\n * A completion carries no self-reported proof. The run's evidence is the calls\n * it actually made \u2014 every one journaled as `cell-call-settled` with its real\n * input and result \u2014 and a field in which the model restates which of them\n * proved the work would be a claim about a check rather than the check.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport class Complete extends Schema.TaggedClass<Complete>(\"flows/harness/Cell/Complete\")(\"complete\", {\n output: Schema.String,\n value: Schema.optional(Schema.Json)\n}) {}\n\n/**\n * The cell asks the controller to park the run durably.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport class Park extends Schema.TaggedClass<Park>(\"flows/harness/Cell/Park\")(\"park\", {\n reason: Schema.Literals([\"waiting-input\", \"waiting-event\", \"waiting-quota\"]),\n message: Schema.String\n}) {}\n\n/**\n * The serializable decision one cell returns.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport const Transition = Schema.Union([Continue, Complete, Park]).pipe(Schema.toTaggedUnion(\"_tag\"))\n\n/**\n * The serializable decision one cell returns.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport type Transition = typeof Transition.Type\n\n/**\n * Renders a projected value as the text one context entry carries.\n *\n * A string is itself. Everything else is canonical JSON, which is the whole of\n * the \"render structs as JSON, always\" rule: a structured value reaches the\n * next model turn as the value it is.\n *\n * @category conversions\n * @since 0.1.0\n * @slop\n */\nexport const renderText = (value: Schema.Json): string =>\n typeof value === \"string\" ? value : CanonicalJson.stringify(value)\n\n/**\n * Stable reasons a cell failed to produce a transition.\n *\n * Every one of these is a durable observation the model may correct on a later\n * frame; none of them is a harness crash.\n *\n * `imports_forbidden` names module syntax the cell itself uses, which\n * `Sandbox.compile` finds by parsing. A quoted mention of an import is data:\n * cells routinely carry a `bash` command whose heredoc imports a Python module,\n * and those cells run.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport const RejectionCode = Schema.Literals([\n \"no_cell\",\n \"output_truncated\",\n \"imports_forbidden\",\n \"compile_failed\",\n \"invalid_transition\",\n \"unsupported_language\",\n \"limit_exceeded\",\n \"stalled\"\n])\n\n/**\n * Stable reasons a cell failed to produce a transition.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport type RejectionCode = typeof RejectionCode.Type\n\n/**\n * The cell ran and returned a well-formed transition.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport class Settled extends Schema.TaggedClass<Settled>(\"flows/harness/Cell/Settled\")(\"settled\", {\n transition: Transition\n}) {}\n\n/**\n * The cell ran and threw. The thrown value is projected into stable text so it\n * survives the journal and the next frame's context.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport class Raised extends Schema.TaggedClass<Raised>(\"flows/harness/Cell/Raised\")(\"raised\", {\n name: Schema.String,\n message: Schema.String\n}) {}\n\n/**\n * The cell never ran, or ran and returned something that is not a transition.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport class Rejected extends Schema.TaggedClass<Rejected>(\"flows/harness/Cell/Rejected\")(\"rejected\", {\n code: RejectionCode,\n message: Schema.String,\n /** The spent resource when `code` is `limit_exceeded`. */\n reason: Schema.optional(Schema.Literals([\"heap\"]))\n}) {}\n\n/**\n * Everything one cell evaluation may settle with.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport const Outcome = Schema.Union([Settled, Raised, Rejected]).pipe(Schema.toTaggedUnion(\"_tag\"))\n\n/**\n * Everything one cell evaluation may settle with.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport type Outcome = typeof Outcome.Type\n\n/**\n * The read-only projection of one callable flow handed to a cell.\n *\n * This is exactly what `ctx.flows` exposes: enough for the model to choose a\n * call and for the cell to reason about it, and nothing that carries authority.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport class FlowProjection extends Schema.Class<FlowProjection>(\"flows/harness/Cell/FlowProjection\")({\n name: Schema.String,\n description: Schema.String,\n capabilities: Schema.Array(Schema.String),\n tier: Descriptor.EffectTier,\n placement: Schema.Option(Descriptor.Placement),\n /**\n * The call's input schema, as a JSON Schema document, when the descriptor\n * carries one by value.\n *\n * Without it a cell can only guess an input shape from prose, and every\n * guess costs a whole frame: a rejected call is one model turn, so learning\n * `bash` takes `{ command, mode, reads, writes }` cost four turns of pure\n * trial and error before any work began.\n */\n input: Schema.Option(Schema.Json).pipe(\n Schema.withConstructorDefault(Effect.succeed(Option.none())),\n Schema.withDecodingDefaultKey(Effect.succeed(Option.none()))\n )\n}) {}\n\n/**\n * Projects a discovered descriptor into the cell-visible catalog entry.\n *\n * @category conversions\n * @since 0.1.0\n * @slop\n */\nexport const project = (descriptor: Descriptor.FlowDescriptor): FlowProjection =>\n new FlowProjection({\n name: descriptor.name,\n description: descriptor.description,\n capabilities: descriptor.capabilities,\n tier: descriptor.effects.tier,\n placement: descriptor.placement,\n input: descriptor.input._tag === \"Inline\" ? Option.some(descriptor.input.document) : Option.none()\n })\n\n/**\n * Why one flow call failed, as a closed set a cell may branch on.\n *\n * Every member is a refusal or a budget the harness itself owns, plus one for\n * everything a flow reports about its own work. Add a member; never repurpose\n * one \u2014 a cell reads these, and so does a grader counting failure classes in a\n * journal.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport const CallFailureCode = Schema.Literals([\n \"unknown_flow\",\n \"capability_refused\",\n \"truncated_write\",\n \"declaration_changed\",\n \"invalid_input\",\n \"unimplemented\",\n \"timeout\",\n \"run_completed\",\n \"checkpoint_unavailable\",\n \"checkpoint_exhausted\",\n \"checkpoint_readonly\",\n \"checkpoint_unsupported\",\n \"flow_failed\",\n \"flow_withheld\"\n])\n\n/**\n * Why one flow call failed.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport type CallFailureCode = typeof CallFailureCode.Type\n\n/**\n * The code a failure carries when nothing classified it.\n *\n * @category constants\n * @since 0.1.0\n * @slop\n */\nexport const defaultCallFailureCode: CallFailureCode = \"flow_failed\"\n\n/**\n * The one action that recovers each failure class, stated to the cell.\n *\n * A code says what happened; the hint says what to do next, in the same frame.\n * They are here rather than at each raising site so the same class always reads\n * the same way whichever boundary refused.\n *\n * @category constants\n * @since 0.1.0\n * @slop\n */\nexport const callFailureHint: Readonly<Record<CallFailureCode, string>> = Object.freeze({\n unknown_flow: \"Read ctx.flows and call one of the names it lists.\",\n capability_refused: \"This run cannot reach that flow. Do the work with a flow ctx.flows lists.\",\n truncated_write:\n \"The bytes you passed were a fragment. Restore from source control instead of writing captured output.\",\n declaration_changed: \"Read ctx.flows again and reissue the call with the shape it now declares.\",\n invalid_input: \"Fix the input against the flow's declared schema in ctx.flows and call it again in this cell.\",\n unimplemented: \"This host cannot run that flow. Choose another one from ctx.flows.\",\n timeout: \"Narrow the call \u2014 a smaller root, a tighter pattern, a shorter command \u2014 and issue it again in this cell.\",\n checkpoint_unavailable:\n \"This host pins no checkpoint you can run against. Drop at; for a baseline, run the check before your edit, then again after it.\",\n checkpoint_exhausted: \"Reuse a checkpoint you already hold, or ctx.base, instead of minting another one.\",\n checkpoint_readonly:\n \"A checkpoint is a read-only view of a tree that has already been. Drop at and make the change on the live tree.\",\n checkpoint_unsupported:\n \"This flow names what it touches rather than where it runs, so it cannot be pointed at a checkpoint. Drop at, or run the same work through a shell flow, which takes a working directory.\",\n run_completed:\n \"The run is over, so nothing after this line runs. If that was early, guard the ctx.done or ctx.park on the check that decides it.\",\n flow_failed: \"Read error.message: the flow itself says what went wrong, and it is usually fixable in this same cell.\",\n flow_withheld: \"End this cell and reissue the call in the next one; ctx.flows lists the flow there.\"\n})\n\n/**\n * Which version of the live tree a sealed call reads; see `Call.epoch`.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport const TreeEpoch = Schema.Struct({\n /** Earlier frames of this run that changed the workspace. */\n frames: NonNegativeSafeInt,\n /** Calls of this frame that may write, issued before this one. */\n calls: NonNegativeSafeInt,\n /** Digest of those calls, chained in issue order: which writes, not only how many. */\n writes: Schema.optional(Schema.String),\n /** Digest of the whole-tree measurement the frame opened on. */\n tree: Schema.optional(Schema.String),\n /** The run, when no whole-tree measurement exists: the reading is reused only inside it. */\n session: Schema.optional(Schema.String),\n /** The frame, beside `session`: an unmeasured tree may change during a model wait. */\n frame: Schema.optional(NonNegativeSafeInt)\n})\n\n/**\n * Which version of the live tree a sealed call reads; see `Call.epoch`.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport type TreeEpoch = typeof TreeEpoch.Type\n\n/**\n * The tree a frame's sealed readings stand on: a measured digest, or the run and frame.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport type LiveTree = { readonly tree: string } | { readonly session: string; readonly frame: number }\n\n/**\n * The complete identity of one flow call made inside one cell.\n *\n * Identity is what makes a mid-cell crash replayable. Re-executing the cell\n * source reaches the same lexical call in the same order with the same\n * declaration, so the boundary keys identically and replays; anything that\n * differs \u2014 a new frame, an edited cell, a different resolved layer set \u2014 keys\n * differently and executes.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport class CallIdentity extends Schema.Class<CallIdentity>(\"flows/harness/Cell/CallIdentity\")({\n /** The durable session/lineage the frame belongs to. */\n session: Schema.String,\n /** The controller frame that produced the cell. */\n frame: NonNegativeSafeInt,\n /** The digest of the cell source being executed. */\n cell: Schema.String,\n /** The zero-based execution ordinal of this call within the cell. */\n ordinal: NonNegativeSafeInt,\n /** The digest of the resolved flow declaration being invoked. */\n declaration: Schema.String,\n /** The resolved layer set in effect at the boundary. */\n layers: Schema.Array(Schema.String)\n}) {}\n\n/**\n * Computes the declaration digest folded into a call identity.\n *\n * Re-exported from `@smthrs/registry`, which owns `FlowDescriptor` and\n * therefore owns what one declaration hashes to. It is the same number\n * `@smthrs/chain` keys its catalog entries with, so a declaration has one\n * identity across the boundary rather than one per package.\n *\n * @category constructors\n * @since 0.1.0\n * @slop\n */\nexport const declarationDigest: (descriptor: Descriptor.FlowDescriptor) => string = Descriptor.declarationDigest\n\n/**\n * One flow call requested from inside a cell.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport class Call extends Schema.Class<Call>(\"flows/harness/Cell/Call\")({\n flowName: Schema.String,\n input: Schema.Json,\n capabilities: Schema.Array(Schema.String),\n effects: Descriptor.EffectDeclaration,\n placement: Schema.Option(Descriptor.Placement),\n identity: CallIdentity,\n /**\n * The checkpoint this call runs against, when the cell named one.\n *\n * Absent is the ordinary case and means the live workspace. Present names a\n * tree the run already pinned, and the host materializes that tree somewhere\n * of its own choosing and runs the call there. It is journaled on the call\n * because it is the difference between a reading of the tree as it is and a\n * reading of the tree as it was, and a grader that cannot tell those apart\n * cannot grade a fails-before proof at all.\n */\n at: Schema.optional(Schema.String),\n /**\n * Which version of the live tree a sealed reading is taken against.\n *\n * A sealed call is content-addressed on what it asked, and \"the same path\n * against the tree as it stands\" is the same question only until something\n * has written to the tree. Without this, the second of two identical reads\n * around a write replays the first's answer and a run reports the pre-edit\n * text after its own edit. `frames` is the run's frame clock \u2014 the count of\n * earlier frames that changed the workspace, measured where the host can\n * measure \u2014 and `calls` is how many calls of this frame that may write\n * were issued before this one, with `writes` chaining what they asked, so\n * two runs that wrote differently read different questions. All are derived\n * from the journaled call\n * sequence, so a replayed frame derives the same epoch and replays.\n *\n * The counters restart with every run, so they cannot tell a later run's\n * read from an earlier run's across an edit made between them. `tree` is\n * the digest of a journaled measurement taken after the model wait, which\n * can; without a whole measurement, `session` and `frame` keep the reading\n * to the frame that took it.\n *\n * Absent on every call that is not a sealed reading of the live tree: a\n * checkpoint is immutable, and a non-sealed call already keys on its ordinal.\n */\n epoch: Schema.optional(TreeEpoch),\n /**\n * What the resolved declaration says a call to this flow does.\n *\n * Carried on the call rather than looked up later, because the reader of a\n * run is not the host that resolved it: a card reading a journal months\n * afterwards holds the record and nothing else, and a flow name is not a\n * meaning. Absent is unknown, and unknown stays unknown.\n */\n activity: Schema.optional(Descriptor.FlowActivity),\n /**\n * How the resolved declaration says one recorded call to this flow reads.\n *\n * Display authority only. Neither this field nor `activity` enters a key:\n * {@link callMaterial} and the durable call key name the fields they hash,\n * and both digests in `@smthrs/registry` exclude these two, so enriching a\n * declaration with them can neither replay nor re-approve anything.\n */\n presentation: Schema.optional(Descriptor.CallPresentation)\n}) {}\n\n/**\n * Builds the call one resolved declaration and one cell invocation make.\n *\n * A constructor rather than an object literal at the boundary: what a call\n * carries about its declaration is a contract two producers project into a\n * journal (`AgentSession.trace` and the native `CallFact`), and a reader can\n * only be as complete as this. A field copied from a descriptor onto a call\n * belongs here, where the copy is stated once.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const callOf = (\n descriptor: Descriptor.FlowDescriptor,\n options: {\n readonly input: Schema.Json\n readonly identity: CallIdentity\n /** The checkpoint the cell named, when it named one. */\n readonly at?: string | undefined\n /** The live tree's version, for a sealed reading taken after a write. */\n readonly epoch?: TreeEpoch | undefined\n }\n): Call =>\n new Call({\n flowName: descriptor.name,\n input: options.input,\n capabilities: descriptor.capabilities,\n effects: descriptor.effects,\n placement: descriptor.placement,\n identity: options.identity,\n ...(options.at === undefined ? {} : { at: options.at }),\n ...(options.epoch === undefined ? {} : { epoch: options.epoch }),\n ...(descriptor.activity === undefined ? {} : { activity: descriptor.activity }),\n ...(descriptor.presentation === undefined ? {} : { presentation: descriptor.presentation })\n })\n\n/**\n * The display projection one recorded call carries for whoever reads it back.\n *\n * `undefined` when the declaration claimed neither field, so the record stays\n * byte-identical to the one an undeclared flow produces and a reader's\n * compatibility table still applies to it. The name travels with the fields so\n * a reader can refuse metadata that belongs to a different flow.\n *\n * @category projections\n * @since 1.0.0-rc.0\n */\nexport const displayDescriptor = (call: Call): Schema.Json | undefined =>\n call.activity === undefined && call.presentation === undefined ? undefined : {\n name: call.flowName,\n ...(call.activity === undefined ? {} : { activity: call.activity }),\n ...(call.presentation === undefined ? {} : {\n presentation: {\n verb: { ...call.presentation.verb },\n subject: call.presentation.subject,\n result: call.presentation.result\n }\n })\n }\n\n/**\n * The id naming the tree a run opened on, pinned for free and always present.\n *\n * The dominant use of a checkpoint is a fails-before proof, and the frame that\n * wants one is almost never the frame that could have foreseen it: by the time\n * a run knows which command reproduces the bug it has usually already edited.\n * So this id exists without anybody minting it. A host resolves it to whatever\n * it recorded as the run's opening tree \u2014 for the SWE-bench rig, the\n * `refs/flows/capture-base` commit its own setup wrote \u2014 and a host with no\n * such record answers `checkpoint_unavailable` like any other.\n *\n * @category constants\n * @since 0.1.0\n */\nexport const baseCheckpoint = \"base\"\n\n/**\n * The wire shape of the value `ctx.checkpoint()` resolves with.\n *\n * A handle is an opaque record rather than a bare string so a cell cannot pass\n * an arbitrary string as `at` by accident, and so a future host can carry more\n * beside the id without changing what a cell writes.\n */\nconst Handle = Schema.Struct({ checkpoint: Schema.NonEmptyString })\n\n/**\n * Builds the handle a cell holds for one checkpoint.\n *\n * @category constructors\n * @since 0.1.0\n */\nexport const checkpoint = (id: string): Schema.Json => ({ checkpoint: id })\n\n/**\n * Reads the checkpoint id out of whatever a cell passed as `at`.\n *\n * `undefined` means \"that was not a checkpoint\", which the boundary answers as\n * an ordinary `invalid_input` failure rather than by guessing. It is\n * deliberately strict: a handle is the only thing that names a tree, and a\n * string that happens to look like an id would let a cell address a snapshot\n * the run never took.\n *\n * @category conversions\n * @since 0.1.0\n */\nexport const checkpointOf = (value: Schema.Json): string | undefined => {\n const decoded = Schema.decodeUnknownResult(Handle)(value)\n return decoded._tag === \"Success\" ? decoded.success.checkpoint : undefined\n}\n\n/**\n * The settled outcome of one flow call.\n *\n * A `failure` resolves in the cell as a `{ ok: false, error }` envelope that\n * it may inspect and recover from; it does not throw and is never a harness\n * failure. Anything the cell cannot see, such as a permission park or an abort,\n * travels in the effect's error channel instead.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport class CallResult extends Schema.Class<CallResult>(\"flows/harness/Cell/CallResult\")(\n Schema.Struct({\n outcome: Schema.Literals([\"success\", \"failure\"]),\n value: Schema.Json,\n message: Schema.optional(Schema.String),\n /**\n * Why a failed call failed, from the closed set the cell may branch on.\n *\n * Prose is what a boundary says; a code is what a program reads. Without one\n * the only way for a cell to tell \"that flow does not exist\" from \"that\n * command timed out\" was to match the message, so cells did not tell them\n * apart at all. Absent means {@link defaultCallFailureCode}, which is what a\n * flow's own failure gets: the flow said why in `message` and the harness\n * does not classify it.\n */\n code: Schema.optional(CallFailureCode)\n })\n) {\n constructor(props: CallResultVariant, options?: Schema.MakeOptions) {\n // The encoded schema is the durable wire contract used in sealed keys.\n // Refining its AST would re-key valid recorded results. Admission checks\n // belong here and in decodeCallResult, which also revalidates instances.\n super(CallResultVariant.make(props), options)\n }\n}\n\n/**\n * A successful call cannot carry a failure code. The wire field names remain\n * the same as current CallResult records.\n *\n * @category schemas\n * @since 1.0.0-rc.0\n */\nexport const CallSuccess = Schema.Struct({\n outcome: Schema.Literal(\"success\"),\n value: Schema.Json,\n message: Schema.optional(Schema.String),\n code: Schema.optionalKey(Schema.Never)\n})\n\n/**\n * A failed call, with the existing absent-code meaning of flow_failed.\n *\n * @category schemas\n * @since 1.0.0-rc.0\n */\nexport const CallFailure = Schema.Struct({\n outcome: Schema.Literal(\"failure\"),\n value: Schema.Json,\n message: Schema.optional(Schema.String),\n code: Schema.optional(CallFailureCode)\n})\n\n/**\n * Discriminated result at a decoded persistence or host boundary.\n *\n * @category schemas\n * @since 1.0.0-rc.0\n */\nexport const CallResultVariant = Schema.Union([CallSuccess, CallFailure])\n\n/**\n * Discriminated result at a decoded persistence or host boundary.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type CallResultVariant = typeof CallResultVariant.Type\n\nconst decodeBoundary = <S extends Schema.Constraint>(schema: S, name: string) => (value: unknown) =>\n Effect.suspend(() =>\n Effect.gen(function*() {\n const encoded = yield* Schema.decodeUnknownEffect(Schema.toEncoded(schema), { onExcessProperty: \"error\" })(value)\n return yield* Schema.decodeUnknownEffect(schema, { onExcessProperty: \"error\" })(encoded)\n })\n ).pipe(\n Effect.catchCause((cause) =>\n Effect.fail(\n new HarnessError({\n code: \"engine_failed\",\n message: `Invalid recorded cell ${name}`,\n cause: Cause.squash(cause)\n })\n )\n )\n )\n\n/**\n * Decode a host or persisted result before the cell can observe it.\n *\n * @category decoders\n * @since 1.0.0-rc.0\n */\nexport const decodeCallResult = decodeBoundary(CallResultVariant, \"call result\")\n\n/**\n * Refuse contradictory or incomplete recorded evaluation outcomes.\n *\n * @category decoders\n * @since 1.0.0-rc.0\n */\nexport const decodeOutcome = decodeBoundary(Outcome, \"outcome\")\n\n/**\n * Refuse contradictory or incomplete recorded transitions.\n *\n * @category decoders\n * @since 1.0.0-rc.0\n */\nexport const decodeTransition = decodeBoundary(Transition, \"transition\")\n\n/**\n * The failure envelope a cell observes when a flow call does not succeed.\n *\n * A failed call **resolves** with this value; it does not throw. That is the\n * whole of change 8: an unrecoverable rejection turned every failed call into a\n * lost frame, because the recovery branch the model had already written sat\n * behind the throw and never ran, and every sibling call the cell had already\n * paid for went with it. `psf__requests-2317` lost two settled greps and a\n * probe to one call against a directory that did not exist; `django-14351`\n * spent ~$0.46 on the same class across five frames.\n *\n * The shape is fixed and small \u2014 `{ ok: false, error: { code, message, hint } }`\n * \u2014 because a cell branches on `.ok` and reads `.error.code`. A successful call\n * still resolves with the flow's own value, unwrapped, so the ordinary\n * `result.stdout` shape a cell is trained on is unchanged.\n *\n * @category conversions\n * @since 0.1.0\n * @slop\n */\nexport const callFailure = (result: CallResult): Schema.Json => {\n const code = result.code ?? defaultCallFailureCode\n return {\n ok: false,\n error: {\n code,\n message: result.message ?? \"The flow call failed\",\n hint: callFailureHint[code]\n }\n }\n}\n\nconst fenced = /^```(?<info>[^\\n`]*)\\r?\\n(?<body>[\\s\\S]*?)(?:\\n?(?<close>^```[ \\t]*(?=\\r?$))|(?![\\s\\S]))/gm\n\nconst languageOf = (info: string): Language | undefined => {\n const tokens = new Set(info.trim().toLowerCase().split(/\\s+/).filter((token) => token.length > 0))\n if (tokens.has(\"ts\") || tokens.has(\"typescript\")) return \"typescript\"\n if (tokens.has(\"cell\") || tokens.has(\"js\") || tokens.has(\"javascript\")) return \"javascript\"\n return undefined\n}\n\n/**\n * One reply's cell program, and how many fenced blocks it was written in.\n *\n * `blocks` is journaled rather than derived later because it is the only\n * record of how the model chose to lay its frame out, and a reply written as\n * several blocks is exactly the reply the old extraction discarded.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport interface Extracted {\n readonly source: Source\n /** How many fenced cell blocks the reply carried, repeats included. */\n readonly blocks: number\n}\n\n/**\n * Extracts the cell program one model settlement emitted.\n *\n * Every fenced block tagged as a cell is kept, in reply order, and the blocks\n * are joined with newlines into one global async script in the persistent\n * realm. Top-level `await` is supported; top-level `return` is invalid. Blocks\n * execute in order. The first `ctx.done` or `ctx.park` that records an intent\n * seals the frame; later `ctx.done` and `ctx.park` calls do nothing. Ordinary\n * JavaScript in later blocks continues running, but later `ctx.call` and\n * `ctx.checkpoint` calls resolve with a `run_completed` failure envelope\n * without dispatching host work.\n *\n * Keeping only the *last* block is what this replaces, and the cost of that\n * rule was measured: on one graded instance the model wrote a near-par program\n * as seven blocks in a single reply \u2014 recon, probe, edit-plus-diagnostics,\n * suite, rehydrate, guarded replay, completion \u2014 and the harness executed block\n * seven, the imagined completion, against a tree where blocks one through six\n * had never run. Empty patch, run over in two frames. Multi-block replies were\n * 2 of 91 replies in that wave: rare, and instance-deciding when they land.\n *\n * A byte-identical repeat of a block is dropped rather than concatenated. Both\n * multi-block replies in that wave are in the journals, and the second one is a\n * model that emitted the same block twice: joining the duplicate would declare\n * its names twice and turn a frame that runs today into a `compile_failed`. A\n * repeat is the model restating one program, never a second step \u2014 a second\n * step that genuinely re-runs the same code would still have to differ\n * somewhere, if only in what it does with the result.\n *\n * Distinct blocks are joined as they were written, so a value bound in one is\n * bound for the ones after it. One program therefore means one set of\n * declarations, and two blocks that both declare the same name are a\n * `SyntaxError` the compiler reports \u2014 a durable observation the next frame can\n * fix, unlike silently running one block of seven, which is not observable at\n * all. The contract states the rule so a model that batches writes blocks that\n * compose, and `CellTurn` names the block count when such a program fails to\n * compile.\n *\n * The program is `typescript` when any block declared a typed fence, because\n * both bindings run TypeScript by erasing type-only syntax and erasure is\n * harmless to a plain-JavaScript block.\n *\n * Extraction reads text and never judges syntax. Whether the source uses module\n * syntax is a question about JavaScript, and it is answered by parsing the cell\n * in `Sandbox.compile`, which is also where an `imports_forbidden` rejection is\n * raised.\n *\n * @category conversions\n * @since 0.1.0\n * @slop\n */\nexport const extract = (text: string): Result.Result<Extracted, Rejected> => {\n const bodies: Array<string> = []\n const distinct = new Set<string>()\n let typed = false\n fenced.lastIndex = 0\n for (const match of text.matchAll(fenced)) {\n /* v8 ignore next -- `info` is a mandatory group of `fenced`, outside any alternation or quantifier, so it participates in every match; the default only discharges the optional type TypeScript gives `RegExpMatchArray.groups` */\n const candidate = languageOf(match.groups?.info ?? \"\")\n if (candidate === undefined) continue\n if (match.groups?.close === undefined) {\n return Result.fail(\n new Rejected({\n code: \"output_truncated\",\n message:\n \"The response contains an unterminated cell fence. No blocks ran. Emit the complete program with every fence closed.\"\n })\n )\n }\n if (candidate === \"typescript\") typed = true\n /* v8 ignore next -- `body` is likewise mandatory in `fenced`; a match that reached here already produced `info`, so `groups` is present and carries both */\n const body = match.groups?.body ?? \"\"\n bodies.push(body)\n distinct.add(body)\n }\n if (bodies.length === 0) {\n return Result.fail(\n new Rejected({\n code: \"no_cell\",\n message:\n \"No cell was found in the response. Emit a fenced ```cell block containing the JavaScript for this transition.\"\n })\n )\n }\n return Result.succeed({\n source: source([...distinct].join(\"\\n\"), typed ? \"typescript\" : \"javascript\"),\n blocks: bodies.length\n })\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,aAAwB;AACxB,oBAA+B;AAC/B,iBAA4B;AAC5B,oBAAsD;AACtD,0BAA6B;AAC7B,gCAAmC;AAe5B,MAAM,WAAW,qBAAO,SAAS,CAAC,cAAc,YAAY,CAAC;AAqB7D,MAAM,eAAe,qBAAO,MAAc,2BAA2B,EAAE;AAAA,EAC5E,UAAU;AAAA,EACV,MAAM,qBAAO;AAAA,EACb,QAAQ,qBAAO;AACjB,CAAC,EAAE;AAAC;AASG,MAAM,WAAW,CAAC,UAAoB,SAC3C,OAAO,OAAO,cAAc,UAAU,EAAE,MAAM,6BAA6B,UAAU,KAAK,CAAC,CAAC;AASvF,MAAM,SAAS,CAAC,MAAc,WAAqB,iBACxD,IAAI,OAAO,EAAE,UAAU,MAAM,QAAQ,SAAS,UAAU,IAAI,EAAE,CAAC;AAa1D,MAAM,iBAAiB,qBAAO,YAAsB,6BAA6B,EAAE,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAapG,eAAe,qBAAO,SAAS,qBAAO,MAAM;AAC9C,CAAC,EAAE;AAAC;AAcG,MAAM,iBAAiB,qBAAO,YAAsB,6BAA6B,EAAE,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AAK,IAAI;AAChB,aAAS,IAAI,IAAI;AAAA,EACnB;AACA,MAAI,OAAO,WAAW,GAAG;AACvB,WAAO,qBAAO;AAAA,MACZ,IAAI,SAAS;AAAA,QACX,MAAM;AAAA,QACN,SACE;AAAA,MACJ,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO,qBAAO,QAAQ;AAAA,IACpB,QAAQ,OAAO,CAAC,GAAG,QAAQ,EAAE,KAAK,IAAI,GAAG,QAAQ,eAAe,YAAY;AAAA,IAC5E,QAAQ,OAAO;AAAA,EACjB,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry-backed resolution for the flow calls a cell makes.
|
|
3
|
+
*
|
|
4
|
+
* A cell's only authority is `ctx.call(flow, input)`, so every effect an agent
|
|
5
|
+
* can reach is a registered flow. This module is where a call name becomes a
|
|
6
|
+
* flow: it resolves the name against `@smthrs/registry` — the same registry
|
|
7
|
+
* that discovered `flow.ts`, `flow.mdx`, and `SKILL.md` under the documented
|
|
8
|
+
* precedence — and dispatches to the body the descriptor declares.
|
|
9
|
+
*
|
|
10
|
+
* It is deliberately not a second registry. Discovery, precedence, first-found
|
|
11
|
+
* collision handling, and progressive disclosure all stay in
|
|
12
|
+
* `@smthrs/registry`; this module only decides which body runs and turns
|
|
13
|
+
* every resolution problem into a {@link Cell.CallResult} the cell can inspect.
|
|
14
|
+
*
|
|
15
|
+
* The split between a failed result and a failed effect is the contract
|
|
16
|
+
* `EngineLike.call` declares. A refusal the agent could plausibly correct — an
|
|
17
|
+
* unknown flow, a badly shaped input, a flow this host does not implement — is
|
|
18
|
+
* a `failure` result, so the cell observes a resolved `{ ok: false, error }`
|
|
19
|
+
* envelope and may recover by branching on `.ok === false` and `.error.code`.
|
|
20
|
+
* Ordinary call failures do not throw. Anything the cell must never swallow,
|
|
21
|
+
* such as a permission park or an abort, stays in the error channel of the
|
|
22
|
+
* implementation that raised it.
|
|
23
|
+
*
|
|
24
|
+
* The resolver's shape is exactly `FlowEngineLike.CallRunner["run"]`, so a
|
|
25
|
+
* durable host wires it in without this browser-safe package depending on the
|
|
26
|
+
* engine binding.
|
|
27
|
+
*
|
|
28
|
+
* Governing design: `../docs/concepts.md#durable-cell-loop` and
|
|
29
|
+
* `../docs/concepts.md#flow-registry`.
|
|
30
|
+
*
|
|
31
|
+
* @since 0.1.0
|
|
32
|
+
*/
|
|
33
|
+
import type * as Registry from "@smthrs/registry/Registry";
|
|
34
|
+
import { Effect } from "effect";
|
|
35
|
+
import * as Cell from "./Cell.ts";
|
|
36
|
+
import type * as FlowBinding from "./FlowBinding.ts";
|
|
37
|
+
import { HarnessError } from "./HarnessError.ts";
|
|
38
|
+
/**
|
|
39
|
+
* One module-backed flow, implemented by the host that discovered it.
|
|
40
|
+
*
|
|
41
|
+
* Discovery reads a module's metadata without evaluating it, so a descriptor
|
|
42
|
+
* never carries a callable body. The host binds the implementation it loaded
|
|
43
|
+
* for the flow, which keeps module evaluation out of both discovery and this
|
|
44
|
+
* package.
|
|
45
|
+
*
|
|
46
|
+
* @category models
|
|
47
|
+
* @since 0.1.0
|
|
48
|
+
* @slop
|
|
49
|
+
*/
|
|
50
|
+
export type Implementation = (call: Cell.Call) => Effect.Effect<Cell.CallResult, HarnessError>;
|
|
51
|
+
/**
|
|
52
|
+
* One discovered markdown flow, rendered against the call's arguments.
|
|
53
|
+
*
|
|
54
|
+
* @category models
|
|
55
|
+
* @since 0.1.0
|
|
56
|
+
* @slop
|
|
57
|
+
*/
|
|
58
|
+
export interface Prompt {
|
|
59
|
+
readonly call: Cell.Call;
|
|
60
|
+
readonly text: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Runs a rendered markdown flow.
|
|
64
|
+
*
|
|
65
|
+
* A markdown flow is a prompt, so running one is a nested agent run rather than
|
|
66
|
+
* a function call. The host supplies that runner; this module only resolves and
|
|
67
|
+
* renders. A runner whose child declares the `auto` model routes that child
|
|
68
|
+
* through `SeatRouter.durable` from `@smthrs/agent`, keyed by the child run.
|
|
69
|
+
*
|
|
70
|
+
* @category models
|
|
71
|
+
* @since 0.1.0
|
|
72
|
+
* @slop
|
|
73
|
+
*/
|
|
74
|
+
export type PromptRunner = (prompt: Prompt) => Effect.Effect<Cell.CallResult, HarnessError>;
|
|
75
|
+
/**
|
|
76
|
+
* The collaborators registry-backed resolution needs.
|
|
77
|
+
*
|
|
78
|
+
* @category models
|
|
79
|
+
* @since 0.1.0
|
|
80
|
+
* @slop
|
|
81
|
+
*/
|
|
82
|
+
export interface Options {
|
|
83
|
+
readonly registry: Registry.Registry;
|
|
84
|
+
/**
|
|
85
|
+
* The composed executable bindings this host resolved.
|
|
86
|
+
*
|
|
87
|
+
* Standard capabilities, plugin-contributed flows, incoming MCP tools, and
|
|
88
|
+
* durable children all arrive here, and all of them resolve through the one
|
|
89
|
+
* snapshot the registry disclosed.
|
|
90
|
+
*/
|
|
91
|
+
readonly catalog?: FlowBinding.Catalog | undefined;
|
|
92
|
+
/** Host implementations for module-backed flows, keyed by flow name. */
|
|
93
|
+
readonly implementations?: ReadonlyMap<string, Implementation> | undefined;
|
|
94
|
+
/** Runs a rendered markdown flow. A host with none answers with a resolved failure envelope. */
|
|
95
|
+
readonly prompt?: PromptRunner | undefined;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Resolves one cell call to the registered flow that answers it.
|
|
99
|
+
*
|
|
100
|
+
* @category models
|
|
101
|
+
* @since 0.1.0
|
|
102
|
+
* @slop
|
|
103
|
+
*/
|
|
104
|
+
export interface Resolver {
|
|
105
|
+
readonly run: (call: Cell.Call) => Effect.Effect<Cell.CallResult, HarnessError>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Constructs registry-backed call resolution.
|
|
109
|
+
*
|
|
110
|
+
* @category constructors
|
|
111
|
+
* @since 0.1.0
|
|
112
|
+
* @slop
|
|
113
|
+
*/
|
|
114
|
+
export declare const make: (options: Options) => Resolver;
|
|
115
|
+
//# sourceMappingURL=CellCalls.d.ts.map
|