@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,454 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a compaction does with each old frame: keep it, squash it into the
|
|
3
|
+
* summary, or remove it.
|
|
4
|
+
*
|
|
5
|
+
* {@link pins} fixes what must survive whatever Jev says: a summary is always
|
|
6
|
+
* squashed, so a later summary extends it; steering and the person's messages
|
|
7
|
+
* are kept, and so is the newest frame that ran each check still failing; a
|
|
8
|
+
* frame that changed files is never removed; and the two halves of a tool
|
|
9
|
+
* call and its result share one mark. {@link read} asks Jev two questions
|
|
10
|
+
* about each segment, and {@link resolve} turns the answers into marks,
|
|
11
|
+
* demoting the least-needed keeps until the kept frames fit the window.
|
|
12
|
+
*
|
|
13
|
+
* Marking is not compacting. The supervisor asks about each settled segment
|
|
14
|
+
* off the loop's hot path, and the run stores each {@link Answer} in the
|
|
15
|
+
* segment's {@link Facts}; nothing the model is sent changes. Only when the
|
|
16
|
+
* budget forces a compaction are the pins taken and the stored answers
|
|
17
|
+
* resolved, and a segment still unmarked then is asked about in that one
|
|
18
|
+
* reading.
|
|
19
|
+
*
|
|
20
|
+
* Nothing here journals or compacts; the caller records the reading, and
|
|
21
|
+
* journals `decision-unjudged` and squashes every frame when it fails.
|
|
22
|
+
*
|
|
23
|
+
* @since 1.0.0-rc.0
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import * as Classifier from "@smthrs/model/Classifier"
|
|
28
|
+
import * as Effect from "effect/Effect"
|
|
29
|
+
import * as Result from "effect/Result"
|
|
30
|
+
import * as Schema from "effect/Schema"
|
|
31
|
+
import { InvalidStep } from "../Compaction.ts"
|
|
32
|
+
import * as ContextWindow from "../ContextWindow.ts"
|
|
33
|
+
import * as Judgement from "../Judgement.ts"
|
|
34
|
+
import * as bytes from "./bytes.ts"
|
|
35
|
+
import { pairBoundaries } from "./compactable.ts"
|
|
36
|
+
import * as elide from "./elide.ts"
|
|
37
|
+
import { NonNegativeSafeInt } from "./nonNegativeSafeInt.ts"
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* One frame as Jev reads it: its size, the cell it ran, what the model said
|
|
41
|
+
* beside it, and what it observed.
|
|
42
|
+
*
|
|
43
|
+
* @since 1.0.0-rc.0
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
export const Item = Schema.Struct({
|
|
47
|
+
tokens: NonNegativeSafeInt,
|
|
48
|
+
cell: Schema.String,
|
|
49
|
+
prose: Schema.String,
|
|
50
|
+
observed: Schema.String
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The decoded form of {@link Item}.
|
|
55
|
+
*
|
|
56
|
+
* @since 1.0.0-rc.0
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
export type Item = typeof Item.Type
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* What every reading is told beside its items: the task and the labels of
|
|
63
|
+
* the checks still failing.
|
|
64
|
+
*
|
|
65
|
+
* @since 1.0.0-rc.0
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
export const Context = Schema.Struct({ task: Schema.String, failing: Schema.Array(Schema.String) })
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The decoded form of {@link Context}.
|
|
72
|
+
*
|
|
73
|
+
* @since 1.0.0-rc.0
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
export type Context = typeof Context.Type
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Jev's answer about one item: the probabilities that it can be removed and
|
|
80
|
+
* that its exact text must be kept.
|
|
81
|
+
*
|
|
82
|
+
* @since 1.0.0-rc.0
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
export const Answer = Schema.Struct({ remove: Schema.Number, keep: Schema.Number })
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The decoded form of {@link Answer}.
|
|
89
|
+
*
|
|
90
|
+
* @since 1.0.0-rc.0
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
export type Answer = typeof Answer.Type
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Jev's {@link Answer} about one transcript segment, named by the segment's
|
|
97
|
+
* digest: what a supervisor reading marks and the next boundary stores.
|
|
98
|
+
*
|
|
99
|
+
* @since 1.0.0-rc.0
|
|
100
|
+
* @private
|
|
101
|
+
*/
|
|
102
|
+
export const Marking = Schema.Struct({ digest: Schema.String, ...Answer.fields })
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The decoded form of {@link Marking}.
|
|
106
|
+
*
|
|
107
|
+
* @since 1.0.0-rc.0
|
|
108
|
+
* @private
|
|
109
|
+
*/
|
|
110
|
+
export type Marking = typeof Marking.Type
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* What the run knows of one transcript segment: the frame that wrote it,
|
|
114
|
+
* whether it carries the person's messages, whether it changed files, the
|
|
115
|
+
* labels of the checks it ran, and Jev's answer about it once a reading has
|
|
116
|
+
* marked it.
|
|
117
|
+
*
|
|
118
|
+
* @since 1.0.0-rc.0
|
|
119
|
+
* @private
|
|
120
|
+
*/
|
|
121
|
+
export const Facts = Schema.Struct({
|
|
122
|
+
frame: NonNegativeSafeInt,
|
|
123
|
+
person: Schema.Boolean,
|
|
124
|
+
mutated: Schema.Boolean,
|
|
125
|
+
checks: Schema.Array(Schema.String),
|
|
126
|
+
answer: Schema.optionalKey(Answer)
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The decoded form of {@link Facts}.
|
|
131
|
+
*
|
|
132
|
+
* @since 1.0.0-rc.0
|
|
133
|
+
* @private
|
|
134
|
+
*/
|
|
135
|
+
export type Facts = typeof Facts.Type
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Why a mark was not Jev's own.
|
|
139
|
+
*
|
|
140
|
+
* @since 1.0.0-rc.0
|
|
141
|
+
* @private
|
|
142
|
+
*/
|
|
143
|
+
export const Pinned = Schema.Literals(["summary", "steering", "person", "failing", "mutated", "pair", "budget"])
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The decoded form of {@link Pinned}.
|
|
147
|
+
*
|
|
148
|
+
* @since 1.0.0-rc.0
|
|
149
|
+
* @private
|
|
150
|
+
*/
|
|
151
|
+
export type Pinned = typeof Pinned.Type
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* One segment's resolved mark, and why it was fixed when Jev did not choose
|
|
155
|
+
* it.
|
|
156
|
+
*
|
|
157
|
+
* @since 1.0.0-rc.0
|
|
158
|
+
* @private
|
|
159
|
+
*/
|
|
160
|
+
export const Marked = Schema.Struct({ mark: ContextWindow.Mark, pinned: Schema.optionalKey(Pinned) })
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The decoded form of {@link Marked}.
|
|
164
|
+
*
|
|
165
|
+
* @since 1.0.0-rc.0
|
|
166
|
+
* @private
|
|
167
|
+
*/
|
|
168
|
+
export type Marked = typeof Marked.Type
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* What {@link pins} fixes for one segment. `mark` is fixed and not asked;
|
|
172
|
+
* `floor` is the weakest mark allowed; `pair` is the index of the first
|
|
173
|
+
* segment of the tool-call span the segment shares a mark with.
|
|
174
|
+
*
|
|
175
|
+
* @since 1.0.0-rc.0
|
|
176
|
+
* @private
|
|
177
|
+
*/
|
|
178
|
+
export interface Pin {
|
|
179
|
+
readonly pin: Exclude<Pinned, "budget">
|
|
180
|
+
readonly mark?: ContextWindow.Mark | undefined
|
|
181
|
+
readonly floor?: ContextWindow.Mark | undefined
|
|
182
|
+
readonly pair?: number | undefined
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const rank: Readonly<Record<ContextWindow.Mark, number>> = { remove: 0, squash: 1, keep: 2 }
|
|
186
|
+
|
|
187
|
+
const stronger = (a: ContextWindow.Mark, b: ContextWindow.Mark): ContextWindow.Mark => rank[a] >= rank[b] ? a : b
|
|
188
|
+
|
|
189
|
+
/** Each prefix index's span: the index of the first segment of its tool-call span. */
|
|
190
|
+
const spans = (prefix: ReadonlyArray<ContextWindow.Segment>): ReadonlyArray<number> => {
|
|
191
|
+
const unsafe = pairBoundaries(prefix)
|
|
192
|
+
const starts: Array<number> = []
|
|
193
|
+
for (let index = 0; index < prefix.length; index++) {
|
|
194
|
+
starts.push(unsafe.has(index) ? starts[index - 1]! : index)
|
|
195
|
+
}
|
|
196
|
+
return starts
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const own = (
|
|
200
|
+
segment: ContextWindow.Segment,
|
|
201
|
+
facts: Facts | undefined,
|
|
202
|
+
newest: boolean
|
|
203
|
+
): Pin | undefined => {
|
|
204
|
+
if (segment.kind === "summary") return { mark: "squash", pin: "summary" }
|
|
205
|
+
if (segment.kind === "steering") return { mark: "keep", pin: "steering" }
|
|
206
|
+
if (facts === undefined) return undefined
|
|
207
|
+
if (facts.person) return { mark: "keep", pin: "person" }
|
|
208
|
+
if (newest) return { mark: "keep", pin: "failing" }
|
|
209
|
+
if (facts.mutated) return { floor: "squash", pin: "mutated" }
|
|
210
|
+
return undefined
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* What must survive of the first `prefixLength` of `segments`, the window's
|
|
215
|
+
* compactable segments in order. `facts[i]` describes `segments[i]`, and is
|
|
216
|
+
* absent for a segment no frame recorded; it is aligned by position, not by
|
|
217
|
+
* digest, because two frames can be byte-identical.
|
|
218
|
+
*
|
|
219
|
+
* Of the segments that ran a check still failing, only the newest is kept: a
|
|
220
|
+
* check that fails frame after frame would otherwise pin every run of it, and
|
|
221
|
+
* no compaction could shrink the window. When that newest run is past the
|
|
222
|
+
* prefix, no prefix segment is kept for it.
|
|
223
|
+
*
|
|
224
|
+
* A tool call and its result in different segments share the strongest
|
|
225
|
+
* retention either holds: kept together when one is pinned keep, and never
|
|
226
|
+
* below the other's floor.
|
|
227
|
+
*
|
|
228
|
+
* @since 1.0.0-rc.0
|
|
229
|
+
* @private
|
|
230
|
+
*/
|
|
231
|
+
export const pins = (
|
|
232
|
+
segments: ReadonlyArray<ContextWindow.Segment>,
|
|
233
|
+
prefixLength: number,
|
|
234
|
+
facts: ReadonlyArray<Facts | undefined>,
|
|
235
|
+
failing: ReadonlyArray<string>
|
|
236
|
+
): ReadonlyArray<Pin | undefined> => {
|
|
237
|
+
const prefix = segments.slice(0, prefixLength)
|
|
238
|
+
const newest = new Set(
|
|
239
|
+
failing.map((label) =>
|
|
240
|
+
facts.reduce((last, entry, index) => entry?.checks.includes(label) === true ? index : last, -1)
|
|
241
|
+
)
|
|
242
|
+
)
|
|
243
|
+
const owned = prefix.map((segment, index) => own(segment, facts[index], newest.has(index)))
|
|
244
|
+
const starts = spans(prefix)
|
|
245
|
+
return owned.map((pin, index) => {
|
|
246
|
+
const start = starts[index]!
|
|
247
|
+
const members = owned.filter((_, other) => starts[other] === start)
|
|
248
|
+
if (members.length === 1) return pin
|
|
249
|
+
if (members.some((member) => member?.mark === "keep")) {
|
|
250
|
+
return { mark: "keep", pin: pin?.mark === "keep" ? pin.pin : "pair", pair: start }
|
|
251
|
+
}
|
|
252
|
+
if (pin?.mark !== undefined) return { ...pin, pair: start }
|
|
253
|
+
const floors = members.flatMap((member) => member?.floor ?? member?.mark ?? [])
|
|
254
|
+
if (floors.length === 0) return { pin: "pair", pair: start }
|
|
255
|
+
const floor = floors.reduce(stronger)
|
|
256
|
+
return { floor, pin: pin?.floor === floor ? pin.pin : "pair", pair: start }
|
|
257
|
+
})
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* The prefix indexes whose mark Jev is asked: those no pin fixes, in order.
|
|
262
|
+
*
|
|
263
|
+
* @since 1.0.0-rc.0
|
|
264
|
+
* @private
|
|
265
|
+
*/
|
|
266
|
+
export const unpinned = (pinned: ReadonlyArray<Pin | undefined>): ReadonlyArray<number> =>
|
|
267
|
+
pinned.flatMap((pin, index) => pin?.mark === undefined ? [index] : [])
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* The most of an item's cell and prose a reading carries, head kept, and of
|
|
271
|
+
* what it observed, tail kept; in UTF-8 bytes.
|
|
272
|
+
*
|
|
273
|
+
* @since 1.0.0-rc.0
|
|
274
|
+
* @private
|
|
275
|
+
*/
|
|
276
|
+
export const fieldBytes = 1024
|
|
277
|
+
|
|
278
|
+
const recall = "the run record has the whole frame"
|
|
279
|
+
|
|
280
|
+
const headKept = (text: string): string => {
|
|
281
|
+
const whole = bytes.size(text)
|
|
282
|
+
if (whole <= fieldBytes) return text
|
|
283
|
+
return elide.head(text, fieldBytes - bytes.size(`… [+${whole}b, ${recall}]`), recall)
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const tailKept = (text: string): string => {
|
|
287
|
+
const whole = bytes.size(text)
|
|
288
|
+
if (whole <= fieldBytes) return text
|
|
289
|
+
const kept = elide.tailSlice(text, fieldBytes - bytes.size(`[+${whole}b, ${recall}] …`))
|
|
290
|
+
return `[+${whole - bytes.size(kept)}b, ${recall}] …${kept}`
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* The reading: `remove_${i}` and `keep_${i}` per item, in as many requests as
|
|
295
|
+
* the items need, asked together.
|
|
296
|
+
*
|
|
297
|
+
* Two booleans rather than one choice: a boolean always carries its
|
|
298
|
+
* probability, and a choice without a distribution reads one-hot, so a floor
|
|
299
|
+
* on it would guard nothing.
|
|
300
|
+
*
|
|
301
|
+
* @since 1.0.0-rc.0
|
|
302
|
+
* @private
|
|
303
|
+
*/
|
|
304
|
+
export const reader = Judgement.perItem({
|
|
305
|
+
id: "compaction/marks",
|
|
306
|
+
description: "Decide which old frames of an agent run to keep, squash into a summary, or remove",
|
|
307
|
+
context: Context,
|
|
308
|
+
item: Item,
|
|
309
|
+
questions: {
|
|
310
|
+
remove: (i) =>
|
|
311
|
+
Classifier.boolean({
|
|
312
|
+
instructions:
|
|
313
|
+
`Is items[${i}], an old frame of this run, no longer needed at all now that the context must shrink? The task, the person's messages and the latest frames stay regardless.`,
|
|
314
|
+
criteria: {
|
|
315
|
+
true:
|
|
316
|
+
"it contributed nothing still needed: a superseded read, a repeated command, a dead end later frames abandoned",
|
|
317
|
+
false: "something it established may still matter"
|
|
318
|
+
}
|
|
319
|
+
}),
|
|
320
|
+
keep: (i) =>
|
|
321
|
+
Classifier.boolean({
|
|
322
|
+
instructions: `Will the exact text of items[${i}] be needed again?`,
|
|
323
|
+
criteria: {
|
|
324
|
+
true:
|
|
325
|
+
"a file's current content, an exact error still unresolved, a decision or constraint the run still acts on",
|
|
326
|
+
false: "a summary sentence is enough"
|
|
327
|
+
}
|
|
328
|
+
})
|
|
329
|
+
}
|
|
330
|
+
})
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Asks Jev about `items`, in order. Cell and prose are sent head-kept and what was observed tail-kept,
|
|
334
|
+
* each to {@link fieldBytes}. A reading is whole or it fails.
|
|
335
|
+
*
|
|
336
|
+
* @since 1.0.0-rc.0
|
|
337
|
+
* @private
|
|
338
|
+
*/
|
|
339
|
+
export const read = (
|
|
340
|
+
context: Context,
|
|
341
|
+
items: ReadonlyArray<Item>
|
|
342
|
+
): Effect.Effect<
|
|
343
|
+
{ readonly answers: ReadonlyArray<Answer>; readonly asked: ReadonlyArray<Judgement.Asked> },
|
|
344
|
+
Judgement.Unjudged
|
|
345
|
+
> =>
|
|
346
|
+
reader.read(
|
|
347
|
+
context,
|
|
348
|
+
items.map((item) => ({
|
|
349
|
+
tokens: item.tokens,
|
|
350
|
+
cell: headKept(item.cell),
|
|
351
|
+
prose: headKept(item.prose),
|
|
352
|
+
observed: tailKept(item.observed)
|
|
353
|
+
}))
|
|
354
|
+
).pipe(Effect.map((reading) => ({
|
|
355
|
+
answers: reading.answers.map((answer) => ({
|
|
356
|
+
remove: answer.remove.probability,
|
|
357
|
+
keep: answer.keep.probability
|
|
358
|
+
})),
|
|
359
|
+
asked: reading.asked
|
|
360
|
+
})))
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* The window a compaction must leave room in. Kept prefix tokens, `suffix`
|
|
364
|
+
* and a summary allowance must fit under
|
|
365
|
+
* `contextWindow - reserve - keepRecent / 2`. `tokens[i]` is prefix segment
|
|
366
|
+
* `i`'s size.
|
|
367
|
+
*
|
|
368
|
+
* @since 1.0.0-rc.0
|
|
369
|
+
* @private
|
|
370
|
+
*/
|
|
371
|
+
export interface Budget {
|
|
372
|
+
readonly contextWindow: number
|
|
373
|
+
readonly reserve: number
|
|
374
|
+
readonly keepRecent: number
|
|
375
|
+
readonly suffix: number
|
|
376
|
+
readonly tokens: ReadonlyArray<number>
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/** Room left for the summary a squash produces. */
|
|
380
|
+
const summaryAllowance = 4000
|
|
381
|
+
|
|
382
|
+
/** Jev removes a frame at or above this probability, when it would not keep it. */
|
|
383
|
+
const removeAt = 0.8
|
|
384
|
+
|
|
385
|
+
/** Jev keeps a frame's exact text at or above this probability. */
|
|
386
|
+
const keepAt = 0.5
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* The mark of every prefix segment. `answers` are {@link read}'s, for the
|
|
390
|
+
* indexes {@link unpinned} names.
|
|
391
|
+
*
|
|
392
|
+
* A segment is removed only when Jev is sure it is not needed and would not
|
|
393
|
+
* keep it, kept when Jev would keep it, and squashed otherwise; pins and
|
|
394
|
+
* floors override Jev, and a tool-call span takes its strongest mark. Then,
|
|
395
|
+
* while the kept segments do not fit the {@link Budget}, the unpinned keep
|
|
396
|
+
* Jev was least sure of, the older on a tie, is squashed. Pins alone may
|
|
397
|
+
* exceed the budget; the next frame's trigger compacts again.
|
|
398
|
+
*
|
|
399
|
+
* @since 1.0.0-rc.0
|
|
400
|
+
* @private
|
|
401
|
+
*/
|
|
402
|
+
export const resolve = (
|
|
403
|
+
answers: ReadonlyArray<Answer>,
|
|
404
|
+
pinned: ReadonlyArray<Pin | undefined>,
|
|
405
|
+
budget: Budget
|
|
406
|
+
): Result.Result<ReadonlyArray<Marked>, InvalidStep> => {
|
|
407
|
+
const asked = unpinned(pinned)
|
|
408
|
+
if (answers.length !== asked.length || budget.tokens.length !== pinned.length) {
|
|
409
|
+
return Result.fail(
|
|
410
|
+
new InvalidStep({ message: "The compaction answers and budget must describe every unpinned prefix segment" })
|
|
411
|
+
)
|
|
412
|
+
}
|
|
413
|
+
const answered = new Map(asked.map((index, at) => [index, answers[at]!]))
|
|
414
|
+
const marks: Array<Marked> = pinned.map((pin, index) => {
|
|
415
|
+
if (pin?.mark !== undefined) return { mark: pin.mark, pinned: pin.pin }
|
|
416
|
+
const { keep, remove } = answered.get(index)!
|
|
417
|
+
const mark = keep >= keepAt ? "keep" : remove >= removeAt ? "remove" : "squash"
|
|
418
|
+
return pin?.floor !== undefined && rank[pin.floor] > rank[mark]
|
|
419
|
+
? { mark: pin.floor, pinned: pin.pin }
|
|
420
|
+
: { mark }
|
|
421
|
+
})
|
|
422
|
+
const unit = (index: number): number => pinned[index]?.pair ?? index
|
|
423
|
+
for (const [index, marked] of marks.entries()) {
|
|
424
|
+
const strongest = marks.filter((_, other) => unit(other) === unit(index)).map((other) => other.mark).reduce(
|
|
425
|
+
stronger
|
|
426
|
+
)
|
|
427
|
+
if (pinned[index]?.mark === undefined && rank[strongest] > rank[marked.mark]) {
|
|
428
|
+
marks[index] = { mark: strongest, pinned: "pair" }
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
const limit = budget.contextWindow - budget.reserve - budget.keepRecent / 2
|
|
432
|
+
let kept = marks.reduce((sum, marked, index) => marked.mark === "keep" ? sum + budget.tokens[index]! : sum, 0)
|
|
433
|
+
const units = [...new Set(marks.map((_, index) => unit(index)))]
|
|
434
|
+
.map((start) => ({ start, members: marks.flatMap((_, index) => unit(index) === start ? [index] : []) }))
|
|
435
|
+
.filter(({ members }) =>
|
|
436
|
+
members.some((index) => marks[index]!.mark === "keep") &&
|
|
437
|
+
members.every((index) => pinned[index]?.mark === undefined)
|
|
438
|
+
)
|
|
439
|
+
.map(({ members, start }) => ({
|
|
440
|
+
start,
|
|
441
|
+
members,
|
|
442
|
+
p: Math.max(...members.map((index) => answered.get(index)!.keep))
|
|
443
|
+
}))
|
|
444
|
+
.sort((a, b) => a.p - b.p || a.start - b.start)
|
|
445
|
+
for (const { members } of units) {
|
|
446
|
+
if (kept + budget.suffix + summaryAllowance <= limit) break
|
|
447
|
+
// A span takes its strongest mark, so every member of a demotable one is kept.
|
|
448
|
+
for (const index of members) {
|
|
449
|
+
marks[index] = { mark: "squash", pinned: "budget" }
|
|
450
|
+
kept -= budget.tokens[index]!
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
return Result.succeed(marks)
|
|
454
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical renderings of controller interventions recorded in the journal.
|
|
3
|
+
*
|
|
4
|
+
* `CellTurn` uses these strings when it builds the live model window and
|
|
5
|
+
* `Transcript` uses the same functions when it rebuilds that window. Keeping
|
|
6
|
+
* the rendering here makes an intervention event sufficient to reproduce the
|
|
7
|
+
* exact user message it represented.
|
|
8
|
+
*
|
|
9
|
+
* @since 1.0.0-rc.0
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Renders the read-only-discipline intervention.
|
|
15
|
+
*
|
|
16
|
+
* It asks for a decision rather than a token write. An answerable request can
|
|
17
|
+
* complete without inventing work. An unfinished workspace change still needs
|
|
18
|
+
* evidence or a justification for more observation, and destructive
|
|
19
|
+
* writes made only to satisfy the notice are explicitly refused. A
|
|
20
|
+
* justification must name how later frames differ from the quiet ones so the
|
|
21
|
+
* run cannot buy a repeat by restating its plan.
|
|
22
|
+
*
|
|
23
|
+
* @category conversions
|
|
24
|
+
* @since 1.0.0-rc.0
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
export const readOnly = (cap: number, frames: number): string =>
|
|
28
|
+
`Read-only discipline — ${frames} consecutive frames have made no call that declares a write, and this run's read-only budget is ${cap}. If the current request is already answered, call ctx.done(answer) now. A conversational or read-only answer needs no invented edit or command. If a workspace change is still required, land an edit you can already name the evidence for — the file, the change, and the check you have watched fail that will now pass. If more evidence is needed, call ctx.justify("<the evidence you are still missing, the exact call that will get it, and what that makes the next frames do differently from these ${frames}>"). Do not write something merely to answer this notice. A restore, a revert, an overwrite from captured output, or any edit whose evidence you cannot name is worse than another read-only frame, because it destroys work this run has already done. A justification is recorded and buys ${cap} quiet frames; it does not reset this counter, and one that names the same next step the last quiet frame named has bought a repeat of that frame. At ${
|
|
29
|
+
cap * 2
|
|
30
|
+
} consecutive read-only frames the run stops as a failure, so ${
|
|
31
|
+
cap * 2 - frames
|
|
32
|
+
} frames remain to answer the request or make the required change.`
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Renders the repeated-observation intervention.
|
|
36
|
+
*
|
|
37
|
+
* This is separate from the read-only demand because a repeating run has
|
|
38
|
+
* often already edited. It redirects the run from re-reading that edit toward
|
|
39
|
+
* mechanism evidence: the failing check, symbol history, or another caller.
|
|
40
|
+
*
|
|
41
|
+
* @category conversions
|
|
42
|
+
* @since 1.0.0-rc.0
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
export const repeat = (frames: number, cap: number): string =>
|
|
46
|
+
`Repeated observation — the last ${frames} frames issued only calls this run had already issued, byte for byte, and none of them changed the workspace. You are re-confirming what you already know: a call repeated over an unchanged tree returns what it returned the first time. If you have already made a change, it is real and it is recorded, and looking at it again cannot tell you whether it is the right change — what is left to establish is the mechanism, not the presence.
|
|
47
|
+
|
|
48
|
+
Spend the next frame on evidence you do not have. Three places hold some, and none of them is the diff:
|
|
49
|
+
- the failing check itself — what it asserts, the values it asserts about, and the setup that produces them;
|
|
50
|
+
- the history of the symbol you changed — \`git log -L <start>,<end>:<file>\` over its line range, or \`git blame\` on the line — which says why it is written the way it is and what it was written to handle;
|
|
51
|
+
- a different site — the callers of the symbol rather than its definition, which is where a wrong mechanism shows first.
|
|
52
|
+
|
|
53
|
+
If no call you can name would tell you something you do not already know, say which mechanism you now believe is wrong and change that instead. This notice returns after another ${cap} repeated frames.`
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Renders the unchanged-workspace completion intervention.
|
|
57
|
+
*
|
|
58
|
+
* @category conversions
|
|
59
|
+
* @since 1.0.0-rc.0
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
export const unmoved = (opened: string, closed: string): string =>
|
|
63
|
+
`Unmoved workspace — the tree you are completing on is the tree this run was handed.
|
|
64
|
+
|
|
65
|
+
- digest the run opened on: ${opened}
|
|
66
|
+
- digest this frame closed on: ${closed}
|
|
67
|
+
|
|
68
|
+
Nothing in this workspace differs from the tree this run opened on, so there is no change behind the completion you wrote. Make the change, or complete again stating that no change is needed and naming what you ran to conclude it — the calls you made, what they printed, and why that shows the behaviour asked for is already the behaviour this tree has. Both answers are accepted exactly as you write them and nothing re-checks either one; "no change is needed" with its working shown is a finished answer, and the same words with nothing behind them are the completion you just had handed back. Nothing makes the change for you, and what you return next is the answer that stands.`
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Renders the unresolved-failure completion intervention.
|
|
72
|
+
*
|
|
73
|
+
* @category conversions
|
|
74
|
+
* @since 1.0.0-rc.0
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
export const unresolved = (flow: string, failed: string, instead: string): string =>
|
|
78
|
+
`Unanswered failure — a check you ran over this exact tree reported a failing exit status, and you went back to what it covered with a different command instead of running it again.
|
|
79
|
+
|
|
80
|
+
- the check that failed, over the tree you are completing on: ${flow} ${failed}
|
|
81
|
+
- the reading you took instead: ${flow} ${instead}
|
|
82
|
+
|
|
83
|
+
The second names the same subject as the first, so the run itself treated that subject as still open; the first was never run again, and its result is the one this completion is standing on. Fix what it reported and run it again, byte for byte, and complete once you have seen what it prints; or complete and state in your output why the failures it reported are expected and not yours. Nothing re-runs it for you, and what you return next is the answer that stands.`
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Renders the narrowed-check completion intervention.
|
|
87
|
+
*
|
|
88
|
+
* @category conversions
|
|
89
|
+
* @since 1.0.0-rc.0
|
|
90
|
+
* @private
|
|
91
|
+
*/
|
|
92
|
+
export const narrowed = (flow: string, broader: string, narrower: string): string =>
|
|
93
|
+
`Narrowed verification — your last verification is narrower than a check this run has already run in full, and the workspace has changed since that broader check last ran.
|
|
94
|
+
|
|
95
|
+
- the broader check, last run before your latest change: ${flow} ${broader}
|
|
96
|
+
- the check this frame ran instead: ${flow} ${narrower}
|
|
97
|
+
|
|
98
|
+
The second repeats every term of the first and adds conditions to it, so it reports on a part of what the first covered and says nothing about the rest — and the rest is exactly where a change breaks something that was passing. Re-run ${flow} with that earlier input, byte for byte, and complete once you have seen what it prints; or complete and state in your output why that check no longer applies to the change you made. Nothing re-runs it for you, and what you return next is the answer that stands.`
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Renders the only-reading completion intervention.
|
|
102
|
+
*
|
|
103
|
+
* @category conversions
|
|
104
|
+
* @since 1.0.0-rc.0
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
export const narrowOnly = (flow: string, check: string, targets: ReadonlyArray<string>): string =>
|
|
108
|
+
`Only reading — the check you are completing on is the only reading this run has of what it names.
|
|
109
|
+
|
|
110
|
+
- the check: ${flow} ${check}
|
|
111
|
+
- what it names: ${targets.join(", ")}
|
|
112
|
+
|
|
113
|
+
Every one of those this run has looked at somewhere else, but no other call it made covers them all, so nothing in this run says what they report on their own. Any term this check carries beyond them — a filter, a selector, a subset of cases, a flag that stops early — is a condition you have never taken off, and what a condition hides is exactly where a change breaks something that was passing. Run ${flow} over the same subjects with those conditions removed and complete once you have seen what it prints; or complete and state in your output that it carries no condition and the reading is already whole. Nothing re-runs it for you, and what you return next is the answer that stands.`
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Renders the completion-review intervention.
|
|
117
|
+
*
|
|
118
|
+
* Any of the three completion questions can ask for another frame. A low
|
|
119
|
+
* completeness reading does not establish that the run invented work, so the
|
|
120
|
+
* notice asks for a direct answer and makes evidence conditional on the
|
|
121
|
+
* actions or results that answer actually claims. A conversational answer
|
|
122
|
+
* needs no work report and must retain the person's requested format.
|
|
123
|
+
*
|
|
124
|
+
* The task is not quoted back. It is in the run's prefix on every frame, so a
|
|
125
|
+
* quote would buy nothing and cost the window the run has to answer in, and
|
|
126
|
+
* leaving it out is also what lets this text be rebuilt from the event alone.
|
|
127
|
+
* No probability is quoted either: a number is journal material for a grader,
|
|
128
|
+
* and in front of a model it is a score to negotiate.
|
|
129
|
+
*
|
|
130
|
+
* The text still warns about the narrower refusal: repeated claims of work
|
|
131
|
+
* the record does not carry can end the run. Honest reports of work left
|
|
132
|
+
* undone remain valid answers when that is what the run can report.
|
|
133
|
+
*
|
|
134
|
+
* @category conversions
|
|
135
|
+
* @since 1.0.0-rc.0
|
|
136
|
+
* @private
|
|
137
|
+
*/
|
|
138
|
+
export const claim = (): string =>
|
|
139
|
+
`Completion review — reconsider whether your completion answers the current request and whether any claimed actions or results are supported by this run's record.
|
|
140
|
+
|
|
141
|
+
Answer the current request directly, keeping its requested format. A purely conversational answer needs no file edit, command, or verification. Do not add a work report when the person asked only for an answer.
|
|
142
|
+
|
|
143
|
+
If you claim a command or result, use recorded evidence: make an allowed call needed to obtain it, or remove the unsupported claim and say plainly what remains unchecked when relevant. A completion that reports work honestly left undone is not refused for that alone.
|
|
144
|
+
|
|
145
|
+
The next completion is judged again. A repeated claim of work this run never recorded can end the run with no answer.`
|