effect-agent 0.1.0-beta.12 → 0.1.0-beta.121
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/dist/Agent-1DMSO_Fl.mjs +86 -0
- package/dist/Agent-1DMSO_Fl.mjs.map +1 -0
- package/dist/Agent-D9cXqfF3.d.mts +252 -0
- package/dist/AgentError-Bn1ytXRD.d.mts +117 -0
- package/dist/AgentPolicy-BqDoSXO6.d.mts +96 -0
- package/dist/AgentRuntime-BUxDdLpw.d.mts +346 -0
- package/dist/AgentRuntime-Cp1hAb-W.mjs +4739 -0
- package/dist/AgentRuntime-Cp1hAb-W.mjs.map +1 -0
- package/dist/AgentUpdates-DMJ-_xow.d.mts +53 -0
- package/dist/ContextCompactor-WwSIG_Z2.d.mts +161 -0
- package/dist/ContextWindow-DRQ5Mbm2.d.mts +58 -0
- package/dist/DurableAgentRuntime-B-9w7jDt.mjs +7061 -0
- package/dist/DurableAgentRuntime-B-9w7jDt.mjs.map +1 -0
- package/dist/DurableFailpoint-Cnr3wx1L.d.mts +41 -0
- package/dist/DurableStep-Cry_iol4.d.mts +103 -0
- package/dist/EventSource-CnlZ3Kma.d.mts +51 -0
- package/dist/FailureDiagnostic-BElLOoED.mjs +274 -0
- package/dist/FailureDiagnostic-BElLOoED.mjs.map +1 -0
- package/dist/FailureDiagnostic-CaAkzGHL.d.mts +223 -0
- package/dist/Identifiers-CN2s30fF.d.mts +40 -0
- package/dist/InMemory.d.mts +24 -0
- package/dist/InMemory.mjs +24 -0
- package/dist/InMemory.mjs.map +1 -0
- package/dist/MemoryNamespace-BbRW5p71.d.mts +36 -0
- package/dist/MemoryReference-B8Q3UJoJ.d.mts +79 -0
- package/dist/Messaging-Dkg87ebg.d.mts +221 -0
- package/dist/Messaging-JYYN3oYS.d.mts +1067 -0
- package/dist/MessagingHost-CqzpxbGz.d.mts +74 -0
- package/dist/MessagingHost-DfsbMPvq.mjs +110 -0
- package/dist/MessagingHost-DfsbMPvq.mjs.map +1 -0
- package/dist/OperationAuthorizer-TzcQtpX5.d.mts +61 -0
- package/dist/Output-V-6YL1_Z.d.mts +25 -0
- package/dist/PageCapture-Df8Xwskw.d.mts +583 -0
- package/dist/PageScreenshot-BpgZKAxl.d.mts +48 -0
- package/dist/PreparedInputAdmission-BQLGldl-.d.mts +42 -0
- package/dist/Receipt-BAHyigAF.d.mts +33 -0
- package/dist/Records-D88mgvyS.d.mts +4214 -0
- package/dist/RunEvent-DIrzkjLr.d.mts +460 -0
- package/dist/RunEventSink-D5aVhISG.d.mts +108 -0
- package/dist/RunJournal-BXrq0VIK.mjs +931 -0
- package/dist/RunJournal-BXrq0VIK.mjs.map +1 -0
- package/dist/RunOptions-CSBsSj0X.d.mts +935 -0
- package/dist/RunPolicyUsage-ClZxyR46.d.mts +21 -0
- package/dist/Sandbox-CEsDWBLq.d.mts +173 -0
- package/dist/Schedule-BIOHA6RR.d.mts +847 -0
- package/dist/Scheduling-DPb2QyAK.mjs +691 -0
- package/dist/Scheduling-DPb2QyAK.mjs.map +1 -0
- package/dist/Subagent-CNik9RiA.d.mts +1635 -0
- package/dist/Subagent-DCrB7an7.mjs +1498 -0
- package/dist/Subagent-DCrB7an7.mjs.map +1 -0
- package/dist/SubagentContract-DdT7Cqe6.d.mts +116 -0
- package/dist/SubagentHost-4WB8Hj0C.d.mts +164 -0
- package/dist/Subscription-CRteOKRf.d.mts +948 -0
- package/dist/SubscriptionInput-oNcwTPti.d.mts +41 -0
- package/dist/Thread-DOBQ0QUY.d.mts +96 -0
- package/dist/ThreadHistory-tS1KwxHR.d.mts +60 -0
- package/dist/ToolBroker-DWs4tZra.d.mts +133 -0
- package/dist/ToolExposure-9uF_Yo0T.mjs +10 -0
- package/dist/ToolExposure-9uF_Yo0T.mjs.map +1 -0
- package/dist/ToolExposure-C93U1sPu.mjs +30 -0
- package/dist/ToolExposure-C93U1sPu.mjs.map +1 -0
- package/dist/ToolExposure-UCN12eCd.d.mts +39 -0
- package/dist/ToolExposure-r2eOWk4F.d.mts +46 -0
- package/dist/ToolExposure.d.mts +8 -0
- package/dist/ToolExposure.mjs +21 -0
- package/dist/ToolExposure.mjs.map +1 -0
- package/dist/ToolReconciler-BmVRAHKs.d.mts +80 -0
- package/dist/ToolResult-BKdqWRff.d.mts +78 -0
- package/dist/Usage-Dx0aknfk.d.mts +121 -0
- package/dist/WakeScheduler-EjUF-GhC.d.mts +56 -0
- package/dist/Worker-CfwzMZEK.mjs +271 -0
- package/dist/Worker-CfwzMZEK.mjs.map +1 -0
- package/dist/Worker-fwWkBg12.d.mts +472 -0
- package/dist/agent-registration-CKNsrpwo.mjs +201 -0
- package/dist/agent-registration-CKNsrpwo.mjs.map +1 -0
- package/dist/capabilities/Approval.d.mts +114 -0
- package/dist/capabilities/Approval.mjs +226 -0
- package/dist/capabilities/Approval.mjs.map +1 -0
- package/dist/capabilities/Budget.d.mts +112 -0
- package/dist/capabilities/Budget.mjs +346 -0
- package/dist/capabilities/Budget.mjs.map +1 -0
- package/dist/capabilities/CodeMode.d.mts +157 -0
- package/dist/capabilities/CodeMode.mjs +522 -0
- package/dist/capabilities/CodeMode.mjs.map +1 -0
- package/dist/capabilities/Commands.d.mts +55 -0
- package/dist/capabilities/Commands.mjs +57 -0
- package/dist/capabilities/Commands.mjs.map +1 -0
- package/dist/capabilities/ContextTools.d.mts +321 -0
- package/dist/capabilities/ContextTools.mjs +126 -0
- package/dist/capabilities/ContextTools.mjs.map +1 -0
- package/dist/capabilities/Mcp.d.mts +108 -0
- package/dist/capabilities/Mcp.mjs +259 -0
- package/dist/capabilities/Mcp.mjs.map +1 -0
- package/dist/capabilities/McpClient.d.mts +115 -0
- package/dist/capabilities/McpClient.mjs +506 -0
- package/dist/capabilities/McpClient.mjs.map +1 -0
- package/dist/capabilities/MemoryNotes.d.mts +424 -0
- package/dist/capabilities/MemoryNotes.mjs +128 -0
- package/dist/capabilities/MemoryNotes.mjs.map +1 -0
- package/dist/capabilities/Messaging.d.mts +3 -0
- package/dist/capabilities/Messaging.mjs +152 -0
- package/dist/capabilities/Messaging.mjs.map +1 -0
- package/dist/capabilities/ModelContext.d.mts +89 -0
- package/dist/capabilities/ModelContext.mjs +168 -0
- package/dist/capabilities/ModelContext.mjs.map +1 -0
- package/dist/capabilities/Redaction.d.mts +37 -0
- package/dist/capabilities/Redaction.mjs +104 -0
- package/dist/capabilities/Redaction.mjs.map +1 -0
- package/dist/capabilities/Remembering.d.mts +434 -0
- package/dist/capabilities/Remembering.mjs +290 -0
- package/dist/capabilities/Remembering.mjs.map +1 -0
- package/dist/capabilities/RunHooks.d.mts +82 -0
- package/dist/capabilities/RunHooks.mjs +144 -0
- package/dist/capabilities/RunHooks.mjs.map +1 -0
- package/dist/capabilities/SemanticMemory.d.mts +431 -0
- package/dist/capabilities/SemanticMemory.mjs +315 -0
- package/dist/capabilities/SemanticMemory.mjs.map +1 -0
- package/dist/capabilities/Subagent.d.mts +4 -0
- package/dist/capabilities/Subagent.mjs +5 -0
- package/dist/capabilities/SubagentReservations.d.mts +186 -0
- package/dist/capabilities/SubagentReservations.mjs +479 -0
- package/dist/capabilities/SubagentReservations.mjs.map +1 -0
- package/dist/capabilities/ToolDiscovery.d.mts +124 -0
- package/dist/capabilities/ToolDiscovery.mjs +230 -0
- package/dist/capabilities/ToolDiscovery.mjs.map +1 -0
- package/dist/capabilities/WebCapture.d.mts +163 -0
- package/dist/capabilities/WebCapture.mjs +335 -0
- package/dist/capabilities/WebCapture.mjs.map +1 -0
- package/dist/capabilities/WebSearch.d.mts +71 -0
- package/dist/capabilities/WebSearch.mjs +115 -0
- package/dist/capabilities/WebSearch.mjs.map +1 -0
- package/dist/compaction-C2OTceKw.mjs +505 -0
- package/dist/compaction-C2OTceKw.mjs.map +1 -0
- package/dist/core/Agent.d.mts +2 -0
- package/dist/core/Agent.mjs +2 -0
- package/dist/core/AgentError.d.mts +2 -0
- package/dist/core/AgentError.mjs +134 -0
- package/dist/core/AgentError.mjs.map +1 -0
- package/dist/core/AgentPolicy.d.mts +2 -0
- package/dist/core/AgentPolicy.mjs +94 -0
- package/dist/core/AgentPolicy.mjs.map +1 -0
- package/dist/core/AgentUpdates.d.mts +2 -0
- package/dist/core/AgentUpdates.mjs +63 -0
- package/dist/core/AgentUpdates.mjs.map +1 -0
- package/dist/core/FailureDiagnostic.d.mts +2 -0
- package/dist/core/FailureDiagnostic.mjs +2 -0
- package/dist/core/IdGenerator.d.mts +26 -0
- package/dist/core/IdGenerator.mjs +27 -0
- package/dist/core/IdGenerator.mjs.map +1 -0
- package/dist/core/Identifiers.d.mts +2 -0
- package/dist/core/Identifiers.mjs +43 -0
- package/dist/core/Identifiers.mjs.map +1 -0
- package/dist/core/Memory.d.mts +57 -0
- package/dist/core/Memory.mjs +203 -0
- package/dist/core/Memory.mjs.map +1 -0
- package/dist/core/MemoryNamespace.d.mts +2 -0
- package/dist/core/MemoryNamespace.mjs +116 -0
- package/dist/core/MemoryNamespace.mjs.map +1 -0
- package/dist/core/MemoryReference.d.mts +2 -0
- package/dist/core/MemoryReference.mjs +109 -0
- package/dist/core/MemoryReference.mjs.map +1 -0
- package/dist/core/MemoryRevalidation.d.mts +65 -0
- package/dist/core/MemoryRevalidation.mjs +126 -0
- package/dist/core/MemoryRevalidation.mjs.map +1 -0
- package/dist/core/MemoryStore.d.mts +186 -0
- package/dist/core/MemoryStore.mjs +243 -0
- package/dist/core/MemoryStore.mjs.map +1 -0
- package/dist/core/Receipt.d.mts +2 -0
- package/dist/core/Receipt.mjs +36 -0
- package/dist/core/Receipt.mjs.map +1 -0
- package/dist/core/RememberingStore.d.mts +1562 -0
- package/dist/core/RememberingStore.mjs +190 -0
- package/dist/core/RememberingStore.mjs.map +1 -0
- package/dist/core/RunEvent.d.mts +2 -0
- package/dist/core/RunEvent.mjs +337 -0
- package/dist/core/RunEvent.mjs.map +1 -0
- package/dist/core/RunPolicyUsage.d.mts +2 -0
- package/dist/core/RunPolicyUsage.mjs +21 -0
- package/dist/core/RunPolicyUsage.mjs.map +1 -0
- package/dist/core/SemanticMemoryIndex.d.mts +826 -0
- package/dist/core/SemanticMemoryIndex.mjs +185 -0
- package/dist/core/SemanticMemoryIndex.mjs.map +1 -0
- package/dist/core/SemanticMemoryRevalidation.d.mts +45 -0
- package/dist/core/SemanticMemoryRevalidation.mjs +191 -0
- package/dist/core/SemanticMemoryRevalidation.mjs.map +1 -0
- package/dist/core/SubagentContract.d.mts +2 -0
- package/dist/core/SubagentContract.mjs +148 -0
- package/dist/core/SubagentContract.mjs.map +1 -0
- package/dist/core/Thread.d.mts +2 -0
- package/dist/core/Thread.mjs +250 -0
- package/dist/core/Thread.mjs.map +1 -0
- package/dist/core/ToolResult.d.mts +2 -0
- package/dist/core/ToolResult.mjs +156 -0
- package/dist/core/ToolResult.mjs.map +1 -0
- package/dist/core/Usage.d.mts +2 -0
- package/dist/core/Usage.mjs +319 -0
- package/dist/core/Usage.mjs.map +1 -0
- package/dist/core/Worker.d.mts +3 -0
- package/dist/core/Worker.mjs +3 -0
- package/dist/durable/ActivityStore.d.mts +116 -0
- package/dist/durable/ActivityStore.mjs +131 -0
- package/dist/durable/ActivityStore.mjs.map +1 -0
- package/dist/durable/Admin.d.mts +2 -0
- package/dist/durable/Admin.mjs +330 -0
- package/dist/durable/Admin.mjs.map +1 -0
- package/dist/durable/AgentRegistration.d.mts +2 -0
- package/dist/durable/AgentRegistration.mjs +14 -0
- package/dist/durable/AgentRegistration.mjs.map +1 -0
- package/dist/durable/Certification.d.mts +110 -0
- package/dist/durable/Certification.mjs +159 -0
- package/dist/durable/Certification.mjs.map +1 -0
- package/dist/durable/CommittedActivity.d.mts +62 -0
- package/dist/durable/CommittedActivity.mjs +159 -0
- package/dist/durable/CommittedActivity.mjs.map +1 -0
- package/dist/durable/Digest.d.mts +2 -0
- package/dist/durable/Digest.mjs +50 -0
- package/dist/durable/Digest.mjs.map +1 -0
- package/dist/durable/DurableAgentRuntime.d.mts +3 -0
- package/dist/durable/DurableAgentRuntime.mjs +3 -0
- package/dist/durable/DurableFailpoint.d.mts +2 -0
- package/dist/durable/DurableFailpoint.mjs +102 -0
- package/dist/durable/DurableFailpoint.mjs.map +1 -0
- package/dist/durable/DurableFailpointTestControl.d.mts +14 -0
- package/dist/durable/DurableFailpointTestControl.mjs +19 -0
- package/dist/durable/DurableFailpointTestControl.mjs.map +1 -0
- package/dist/durable/EventSource.d.mts +2 -0
- package/dist/durable/EventSource.mjs +65 -0
- package/dist/durable/EventSource.mjs.map +1 -0
- package/dist/durable/GitHubWorkflowSource.d.mts +185 -0
- package/dist/durable/GitHubWorkflowSource.mjs +209 -0
- package/dist/durable/GitHubWorkflowSource.mjs.map +1 -0
- package/dist/durable/MessageDelivery.d.mts +893 -0
- package/dist/durable/MessageDelivery.mjs +557 -0
- package/dist/durable/MessageDelivery.mjs.map +1 -0
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +378 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs +270 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs.map +1 -0
- package/dist/durable/OperationAuthorizer.d.mts +2 -0
- package/dist/durable/OperationAuthorizer.mjs +70 -0
- package/dist/durable/OperationAuthorizer.mjs.map +1 -0
- package/dist/durable/PersistentHistory.d.mts +16 -0
- package/dist/durable/PersistentHistory.mjs +125 -0
- package/dist/durable/PersistentHistory.mjs.map +1 -0
- package/dist/durable/PreparedInputAdmission.d.mts +2 -0
- package/dist/durable/PreparedInputAdmission.mjs +38 -0
- package/dist/durable/PreparedInputAdmission.mjs.map +1 -0
- package/dist/durable/Records.d.mts +2 -0
- package/dist/durable/Records.mjs +848 -0
- package/dist/durable/Records.mjs.map +1 -0
- package/dist/durable/Recovery.d.mts +2 -0
- package/dist/durable/Recovery.mjs +739 -0
- package/dist/durable/Recovery.mjs.map +1 -0
- package/dist/durable/RunJournal.d.mts +2 -0
- package/dist/durable/RunJournal.mjs +2 -0
- package/dist/durable/Schedule.d.mts +2 -0
- package/dist/durable/Schedule.mjs +391 -0
- package/dist/durable/Schedule.mjs.map +1 -0
- package/dist/durable/ScheduleStoreConformance.d.mts +17 -0
- package/dist/durable/ScheduleStoreConformance.mjs +420 -0
- package/dist/durable/ScheduleStoreConformance.mjs.map +1 -0
- package/dist/durable/ScheduleTransition.d.mts +24 -0
- package/dist/durable/ScheduleTransition.mjs +180 -0
- package/dist/durable/ScheduleTransition.mjs.map +1 -0
- package/dist/durable/Scheduling.d.mts +54 -0
- package/dist/durable/Scheduling.mjs +2 -0
- package/dist/durable/SqlMemoryStore.d.mts +29 -0
- package/dist/durable/SqlMemoryStore.mjs +436 -0
- package/dist/durable/SqlMemoryStore.mjs.map +1 -0
- package/dist/durable/SqlMessageDeliveryStore.d.mts +42 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs +179 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs.map +1 -0
- package/dist/durable/SqlStorageV2Upgrade.d.mts +21 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs +459 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs.map +1 -0
- package/dist/durable/SqlSubscriptionStore.d.mts +62 -0
- package/dist/durable/SqlSubscriptionStore.mjs +751 -0
- package/dist/durable/SqlSubscriptionStore.mjs.map +1 -0
- package/dist/durable/SqlThreadNativeReads.d.mts +53 -0
- package/dist/durable/SqlThreadNativeReads.mjs +159 -0
- package/dist/durable/SqlThreadNativeReads.mjs.map +1 -0
- package/dist/durable/SubmissionLedger.d.mts +3 -0
- package/dist/durable/SubmissionLedger.mjs +959 -0
- package/dist/durable/SubmissionLedger.mjs.map +1 -0
- package/dist/durable/SubmissionLedgerConformance.d.mts +29 -0
- package/dist/durable/SubmissionLedgerConformance.mjs +2187 -0
- package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -0
- package/dist/durable/SubmissionStatus.d.mts +2 -0
- package/dist/durable/SubmissionStatus.mjs +18 -0
- package/dist/durable/SubmissionStatus.mjs.map +1 -0
- package/dist/durable/Subscription.d.mts +2 -0
- package/dist/durable/Subscription.mjs +360 -0
- package/dist/durable/Subscription.mjs.map +1 -0
- package/dist/durable/SubscriptionInput.d.mts +2 -0
- package/dist/durable/SubscriptionInput.mjs +52 -0
- package/dist/durable/SubscriptionInput.mjs.map +1 -0
- package/dist/durable/SubscriptionStoreConformance.d.mts +16 -0
- package/dist/durable/SubscriptionStoreConformance.mjs +625 -0
- package/dist/durable/SubscriptionStoreConformance.mjs.map +1 -0
- package/dist/durable/SubscriptionTools.d.mts +273 -0
- package/dist/durable/SubscriptionTools.mjs +190 -0
- package/dist/durable/SubscriptionTools.mjs.map +1 -0
- package/dist/durable/SubscriptionTransition.d.mts +21 -0
- package/dist/durable/SubscriptionTransition.mjs +148 -0
- package/dist/durable/SubscriptionTransition.mjs.map +1 -0
- package/dist/durable/Subscriptions.d.mts +73 -0
- package/dist/durable/Subscriptions.mjs +627 -0
- package/dist/durable/Subscriptions.mjs.map +1 -0
- package/dist/durable/ThreadContextHistory.d.mts +32 -0
- package/dist/durable/ThreadContextHistory.mjs +152 -0
- package/dist/durable/ThreadContextHistory.mjs.map +1 -0
- package/dist/durable/ThreadContextHistoryProjection.d.mts +60 -0
- package/dist/durable/ThreadContextHistoryProjection.mjs +149 -0
- package/dist/durable/ThreadContextHistoryProjection.mjs.map +1 -0
- package/dist/durable/ThreadInvariants.d.mts +76 -0
- package/dist/durable/ThreadInvariants.mjs +246 -0
- package/dist/durable/ThreadInvariants.mjs.map +1 -0
- package/dist/durable/ThreadProjection.d.mts +78 -0
- package/dist/durable/ThreadProjection.mjs +158 -0
- package/dist/durable/ThreadProjection.mjs.map +1 -0
- package/dist/durable/ThreadProjectionMaintenance.d.mts +49 -0
- package/dist/durable/ThreadProjectionMaintenance.mjs +33 -0
- package/dist/durable/ThreadProjectionMaintenance.mjs.map +1 -0
- package/dist/durable/ThreadStore.d.mts +2 -0
- package/dist/durable/ThreadStore.mjs +355 -0
- package/dist/durable/ThreadStore.mjs.map +1 -0
- package/dist/durable/ThreadStoreConformance.d.mts +28 -0
- package/dist/durable/ThreadStoreConformance.mjs +503 -0
- package/dist/durable/ThreadStoreConformance.mjs.map +1 -0
- package/dist/durable/ToolReconciler.d.mts +2 -0
- package/dist/durable/ToolReconciler.mjs +85 -0
- package/dist/durable/ToolReconciler.mjs.map +1 -0
- package/dist/durable/WakeScheduler.d.mts +2 -0
- package/dist/durable/WakeScheduler.mjs +85 -0
- package/dist/durable/WakeScheduler.mjs.map +1 -0
- package/dist/durable/WorkerHost.d.mts +129 -0
- package/dist/durable/WorkerHost.mjs +77 -0
- package/dist/durable/WorkerHost.mjs.map +1 -0
- package/dist/engine/AgentRuntime.d.mts +2 -0
- package/dist/engine/AgentRuntime.mjs +2 -0
- package/dist/engine/Compaction.d.mts +7 -0
- package/dist/engine/Compaction.mjs +16 -0
- package/dist/engine/Compaction.mjs.map +1 -0
- package/dist/engine/ContextCompactor.d.mts +2 -0
- package/dist/engine/ContextCompactor.mjs +119 -0
- package/dist/engine/ContextCompactor.mjs.map +1 -0
- package/dist/engine/ContextHistory.d.mts +65 -0
- package/dist/engine/ContextHistory.mjs +76 -0
- package/dist/engine/ContextHistory.mjs.map +1 -0
- package/dist/engine/ContextWindow.d.mts +2 -0
- package/dist/engine/ContextWindow.mjs +59 -0
- package/dist/engine/ContextWindow.mjs.map +1 -0
- package/dist/engine/DurableStep.d.mts +2 -0
- package/dist/engine/DurableStep.mjs +62 -0
- package/dist/engine/DurableStep.mjs.map +1 -0
- package/dist/engine/MessagingHost.d.mts +2 -0
- package/dist/engine/MessagingHost.mjs +2 -0
- package/dist/engine/Output.d.mts +2 -0
- package/dist/engine/Output.mjs +8 -0
- package/dist/engine/Output.mjs.map +1 -0
- package/dist/engine/RunEventSink.d.mts +2 -0
- package/dist/engine/RunEventSink.mjs +22 -0
- package/dist/engine/RunEventSink.mjs.map +1 -0
- package/dist/engine/RunOptions.d.mts +2 -0
- package/dist/engine/RunOptions.mjs +124 -0
- package/dist/engine/RunOptions.mjs.map +1 -0
- package/dist/engine/SubagentHost.d.mts +2 -0
- package/dist/engine/SubagentHost.mjs +76 -0
- package/dist/engine/SubagentHost.mjs.map +1 -0
- package/dist/engine/ThreadHistory.d.mts +2 -0
- package/dist/engine/ThreadHistory.mjs +67 -0
- package/dist/engine/ThreadHistory.mjs.map +1 -0
- package/dist/engine/ToolBroker.d.mts +2 -0
- package/dist/engine/ToolBroker.mjs +42 -0
- package/dist/engine/ToolBroker.mjs.map +1 -0
- package/dist/foreign-diagnostic-DBQ1XHKh.mjs +37 -0
- package/dist/foreign-diagnostic-DBQ1XHKh.mjs.map +1 -0
- package/dist/index.d.mts +91 -6
- package/dist/index.mjs +100 -6
- package/dist/output-contract-BC7tjlGw.mjs +84 -0
- package/dist/output-contract-BC7tjlGw.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/sandbox/CodeExecutor.d.mts +194 -0
- package/dist/sandbox/CodeExecutor.mjs +278 -0
- package/dist/sandbox/CodeExecutor.mjs.map +1 -0
- package/dist/sandbox/InteractiveBrowser.d.mts +257 -0
- package/dist/sandbox/InteractiveBrowser.mjs +236 -0
- package/dist/sandbox/InteractiveBrowser.mjs.map +1 -0
- package/dist/sandbox/PageCapture.d.mts +2 -0
- package/dist/sandbox/PageCapture.mjs +450 -0
- package/dist/sandbox/PageCapture.mjs.map +1 -0
- package/dist/sandbox/PageCrawl.d.mts +88 -0
- package/dist/sandbox/PageCrawl.mjs +124 -0
- package/dist/sandbox/PageCrawl.mjs.map +1 -0
- package/dist/sandbox/PageScreenshot.d.mts +2 -0
- package/dist/sandbox/PageScreenshot.mjs +53 -0
- package/dist/sandbox/PageScreenshot.mjs.map +1 -0
- package/dist/sandbox/ProtectedBrowser.d.mts +283 -0
- package/dist/sandbox/ProtectedBrowser.mjs +298 -0
- package/dist/sandbox/ProtectedBrowser.mjs.map +1 -0
- package/dist/sandbox/Sandbox.d.mts +2 -0
- package/dist/sandbox/Sandbox.mjs +208 -0
- package/dist/sandbox/Sandbox.mjs.map +1 -0
- package/dist/utf8-BYfhEkcj.mjs +11 -0
- package/dist/utf8-BYfhEkcj.mjs.map +1 -0
- package/dist/utf8-DchGZRBd.mjs +23 -0
- package/dist/utf8-DchGZRBd.mjs.map +1 -0
- package/package.json +1 -40
- package/src/InMemory.ts +19 -0
- package/src/ToolExposure.ts +2 -0
- package/src/capabilities/Approval.ts +352 -0
- package/src/capabilities/Budget.ts +536 -0
- package/src/capabilities/CodeMode.ts +1090 -0
- package/src/capabilities/Commands.ts +86 -0
- package/src/capabilities/ContextTools.ts +184 -0
- package/src/capabilities/Mcp.ts +426 -0
- package/src/capabilities/McpClient.ts +967 -0
- package/src/capabilities/MemoryNotes.ts +174 -0
- package/src/capabilities/Messaging.ts +261 -0
- package/src/capabilities/ModelContext.ts +354 -0
- package/src/capabilities/Redaction.ts +157 -0
- package/src/capabilities/Remembering.ts +550 -0
- package/src/capabilities/RunHooks.ts +280 -0
- package/src/capabilities/SemanticMemory.ts +447 -0
- package/src/capabilities/Subagent.ts +2489 -0
- package/src/capabilities/SubagentReservations.ts +850 -0
- package/src/capabilities/ToolDiscovery.ts +369 -0
- package/src/capabilities/WebCapture.ts +722 -0
- package/src/capabilities/WebSearch.ts +190 -0
- package/src/capabilities/internal/subagent-background.ts +1273 -0
- package/src/capabilities/internal/subagent-contract.ts +146 -0
- package/src/capabilities/internal/subagent-policy.ts +235 -0
- package/src/capabilities/internal/subagent-reporting.ts +136 -0
- package/src/capabilities/internal/utf8.ts +10 -0
- package/src/core/Agent.ts +602 -0
- package/src/core/AgentError.ts +172 -0
- package/src/core/AgentPolicy.ts +153 -0
- package/src/core/AgentUpdates.ts +100 -0
- package/src/core/FailureDiagnostic.ts +343 -0
- package/src/core/IdGenerator.ts +39 -0
- package/src/core/Identifiers.ts +48 -0
- package/src/core/Memory.ts +290 -0
- package/src/core/MemoryNamespace.ts +196 -0
- package/src/core/MemoryReference.ts +121 -0
- package/src/core/MemoryRevalidation.ts +185 -0
- package/src/core/MemoryStore.ts +368 -0
- package/src/core/Messaging.ts +72 -0
- package/src/core/Receipt.ts +42 -0
- package/src/core/RememberingStore.ts +300 -0
- package/src/core/RunEvent.ts +366 -0
- package/src/core/RunPolicyUsage.ts +17 -0
- package/src/core/SemanticMemoryIndex.ts +250 -0
- package/src/core/SemanticMemoryRevalidation.ts +254 -0
- package/src/core/SubagentContract.ts +196 -0
- package/src/core/Thread.ts +371 -0
- package/src/core/ToolExposure.ts +74 -0
- package/src/core/ToolResult.ts +190 -0
- package/src/core/Usage.ts +529 -0
- package/src/core/Worker.ts +240 -0
- package/src/core/internal/agent-updates.ts +34 -0
- package/src/core/internal/message-status.ts +60 -0
- package/src/core/internal/strict-schema.ts +14 -0
- package/src/core/internal/utf8.ts +23 -0
- package/src/durable/ActivityStore.ts +160 -0
- package/src/durable/Admin.ts +505 -0
- package/src/durable/AgentRegistration.ts +14 -0
- package/src/durable/Certification.ts +210 -0
- package/src/durable/CommittedActivity.ts +296 -0
- package/src/durable/Digest.ts +87 -0
- package/src/durable/DurableAgentRuntime.ts +11275 -0
- package/src/durable/DurableFailpoint.ts +111 -0
- package/src/durable/DurableFailpointTestControl.ts +39 -0
- package/src/durable/EventSource.ts +172 -0
- package/src/durable/GitHubWorkflowSource.ts +447 -0
- package/src/durable/MessageDelivery.ts +832 -0
- package/src/durable/MessageDeliveryStoreConformance.ts +410 -0
- package/src/durable/OperationAuthorizer.ts +85 -0
- package/src/durable/PersistentHistory.ts +260 -0
- package/src/durable/PreparedInputAdmission.ts +57 -0
- package/src/durable/Records.ts +1075 -0
- package/src/durable/Recovery.ts +1018 -0
- package/src/durable/RunJournal.ts +1631 -0
- package/src/durable/Schedule.ts +513 -0
- package/src/durable/ScheduleStoreConformance.ts +638 -0
- package/src/durable/ScheduleTransition.ts +265 -0
- package/src/durable/Scheduling.ts +1077 -0
- package/src/durable/SqlMemoryStore.ts +778 -0
- package/src/durable/SqlMessageDeliveryStore.ts +335 -0
- package/src/durable/SqlStorageV2Upgrade.ts +500 -0
- package/src/durable/SqlSubscriptionStore.ts +1440 -0
- package/src/durable/SqlThreadNativeReads.ts +270 -0
- package/src/durable/SubmissionLedger.ts +1265 -0
- package/src/durable/SubmissionLedgerConformance.ts +4820 -0
- package/src/durable/SubmissionStatus.ts +14 -0
- package/src/durable/Subscription.ts +544 -0
- package/src/durable/SubscriptionInput.ts +144 -0
- package/src/durable/SubscriptionStoreConformance.ts +945 -0
- package/src/durable/SubscriptionTools.ts +327 -0
- package/src/durable/SubscriptionTransition.ts +302 -0
- package/src/durable/Subscriptions.ts +1210 -0
- package/src/durable/ThreadContextHistory.ts +227 -0
- package/src/durable/ThreadContextHistoryProjection.ts +216 -0
- package/src/durable/ThreadInvariants.ts +507 -0
- package/src/durable/ThreadProjection.ts +269 -0
- package/src/durable/ThreadProjectionMaintenance.ts +67 -0
- package/src/durable/ThreadStore.ts +573 -0
- package/src/durable/ThreadStoreConformance.ts +1156 -0
- package/src/durable/ToolReconciler.ts +109 -0
- package/src/durable/WakeScheduler.ts +134 -0
- package/src/durable/WorkerHost.ts +171 -0
- package/src/durable/internal/agent-registration.ts +587 -0
- package/src/durable/internal/agent-updates.ts +302 -0
- package/src/durable/internal/foreign-diagnostic.ts +47 -0
- package/src/durable/internal/journal-checkpoint.ts +104 -0
- package/src/durable/internal/journal-metadata.ts +117 -0
- package/src/durable/internal/message-status.ts +20 -0
- package/src/durable/internal/messaging-host.ts +637 -0
- package/src/durable/internal/schedule-time.ts +303 -0
- package/src/durable/internal/storage-v2-layout.ts +163 -0
- package/src/durable/internal/storage-v2.ts +73 -0
- package/src/durable/internal/worker-host.ts +2885 -0
- package/src/durable/internal/worker-runtime.ts +9 -0
- package/src/engine/AgentRuntime.ts +37 -0
- package/src/engine/Compaction.ts +11 -0
- package/src/engine/ContextCompactor.ts +277 -0
- package/src/engine/ContextHistory.ts +73 -0
- package/src/engine/ContextWindow.ts +72 -0
- package/src/engine/DurableStep.ts +132 -0
- package/src/engine/MessagingHost.ts +110 -0
- package/src/engine/Output.ts +2 -0
- package/src/engine/RunEventSink.ts +132 -0
- package/src/engine/RunOptions.ts +1101 -0
- package/src/engine/SubagentHost.ts +230 -0
- package/src/engine/ThreadHistory.ts +120 -0
- package/src/engine/ToolBroker.ts +157 -0
- package/src/engine/ToolExposure.ts +48 -0
- package/src/engine/internal/agent-runtime.ts +10500 -0
- package/src/engine/internal/bounded-value.ts +315 -0
- package/src/engine/internal/compaction.ts +678 -0
- package/src/engine/internal/error-diagnostic.ts +39 -0
- package/src/engine/internal/output-contract.ts +173 -0
- package/src/engine/internal/primitive-delta.ts +80 -0
- package/src/engine/internal/provider-result-staging.ts +211 -0
- package/src/engine/internal/tool-derivative.ts +106 -0
- package/src/engine/internal/tool-exposure.ts +224 -0
- package/src/engine/internal/tool-telemetry.ts +484 -0
- package/src/index.ts +99 -21
- package/src/sandbox/CodeExecutor.ts +352 -0
- package/src/sandbox/InteractiveBrowser.ts +339 -0
- package/src/sandbox/PageCapture.ts +691 -0
- package/src/sandbox/PageCrawl.ts +148 -0
- package/src/sandbox/PageScreenshot.ts +81 -0
- package/src/sandbox/ProtectedBrowser.ts +452 -0
- package/src/sandbox/Sandbox.ts +241 -0
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
import type { Crypto } from "effect";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
import { IntegrityCheck, IntegrityReport, type IntegrityCheckName } from "./Admin.ts";
|
|
5
|
+
import { digestCanonicalBatch, EMPTY_TAIL_DIGEST } from "./Digest.ts";
|
|
6
|
+
import {
|
|
7
|
+
CanonicalBatch,
|
|
8
|
+
CanonicalRecordEnvelope,
|
|
9
|
+
type BatchId,
|
|
10
|
+
type ProducerId,
|
|
11
|
+
type RecordEnvelope,
|
|
12
|
+
} from "./Records.ts";
|
|
13
|
+
import { runIdForSubmission } from "./RunJournal.ts";
|
|
14
|
+
import {
|
|
15
|
+
submissionInputRecordId,
|
|
16
|
+
submissionSettlementRecordId,
|
|
17
|
+
type SubmissionSnapshot,
|
|
18
|
+
} from "./SubmissionLedger.ts";
|
|
19
|
+
import type { ThreadCheckpoint, ThreadExport } from "./ThreadStore.ts";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The production thread invariant checker, shared by the durable coordinator, admin
|
|
23
|
+
* verification, and development harnesses. Keeping it independent of certification and
|
|
24
|
+
* conformance modules prevents ordinary runtime imports from loading test-only dependencies.
|
|
25
|
+
*
|
|
26
|
+
* `verifyThreadInvariants` — hoisted from the DC eviction harness's `assertConvergence`
|
|
27
|
+
* so the admin `verify` operation, the adapter certification tiers (WP2), and the chaos/soak
|
|
28
|
+
* properties (WP4) all assert one set of claims.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Input of one invariant verification, assembled entirely from port reads (or from a captured
|
|
33
|
+
* copy under test):
|
|
34
|
+
*
|
|
35
|
+
* - `export` — the Thread's canonical export (`ThreadStore.export`).
|
|
36
|
+
* - `submissions` — every known Submission row of the lane (ledger scan + lookups). Order is
|
|
37
|
+
* irrelevant; the checker sorts by `queueSequence`.
|
|
38
|
+
* - `batchProducers` — OPTIONAL per-batch producer identity directory. The digest chain hashes
|
|
39
|
+
* each batch's Schema-encoded `CanonicalBatch` — including its `producerId`, which the
|
|
40
|
+
* `ThreadStore` port deliberately does not export — so full chain recomputation needs
|
|
41
|
+
* this directory (capture it at append time, or from adapter-private storage). Without it the
|
|
42
|
+
* `digest-chain` and `checkpoint-binding` checks report `skipped` with the honest reason;
|
|
43
|
+
* adapter-level `verifyOnOpen` remains the storage-side full audit.
|
|
44
|
+
* - `checkpoint` — the stored checkpoint to bind against the recomputed chain, when one exists.
|
|
45
|
+
* - `checkpointsSupported` — whether the caller inspected a supporting adapter. Without this
|
|
46
|
+
* evidence or a supplied checkpoint, checkpoint verification is skipped.
|
|
47
|
+
* - `requireAllSettled` — convergence mode (certification Tier 2, chaos, soak): additionally
|
|
48
|
+
* require every known Submission to be settled.
|
|
49
|
+
*/
|
|
50
|
+
export interface ThreadInvariantInput {
|
|
51
|
+
readonly export: ThreadExport;
|
|
52
|
+
readonly submissions: ReadonlyArray<SubmissionSnapshot>;
|
|
53
|
+
readonly batchProducers?: ReadonlyMap<BatchId, ProducerId> | undefined;
|
|
54
|
+
readonly checkpoint?: ThreadCheckpoint | undefined;
|
|
55
|
+
/** Set only after checking the adapter's optional checkpoint capability. */
|
|
56
|
+
readonly checkpointsSupported?: boolean | undefined;
|
|
57
|
+
readonly requireAllSettled?: boolean | undefined;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const encodeEnvelope = Schema.encodeEffect(CanonicalRecordEnvelope);
|
|
61
|
+
const decodeEnvelope = Schema.decodeUnknownEffect(CanonicalRecordEnvelope);
|
|
62
|
+
|
|
63
|
+
const check = (
|
|
64
|
+
name: IntegrityCheckName,
|
|
65
|
+
status: "passed" | "failed" | "skipped",
|
|
66
|
+
detail?: string,
|
|
67
|
+
): IntegrityCheck =>
|
|
68
|
+
IntegrityCheck.make({
|
|
69
|
+
name,
|
|
70
|
+
status,
|
|
71
|
+
...(detail === undefined ? {} : { detail: detail.slice(0, 4_096) }),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
interface BatchRun {
|
|
75
|
+
readonly batchId: BatchId;
|
|
76
|
+
readonly records: Array<RecordEnvelope>;
|
|
77
|
+
readonly lastSequence: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Group the export's records into their atomic append runs (batches append contiguously). */
|
|
81
|
+
const batchRunsOf = (records: ReadonlyArray<CanonicalRecordEnvelope>): Array<BatchRun> => {
|
|
82
|
+
const runs: Array<BatchRun> = [];
|
|
83
|
+
|
|
84
|
+
for (const envelope of records) {
|
|
85
|
+
const current = runs.at(-1);
|
|
86
|
+
|
|
87
|
+
if (current !== undefined && current.batchId === envelope.batchId) {
|
|
88
|
+
current.records.push(envelope.record);
|
|
89
|
+
runs[runs.length - 1] = { ...current, lastSequence: envelope.sequence };
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
runs.push({
|
|
93
|
+
batchId: envelope.batchId,
|
|
94
|
+
records: [envelope.record],
|
|
95
|
+
lastSequence: envelope.sequence,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return runs;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The shared thread invariant checker (plan §1/§3): the DC harness `assertConvergence`
|
|
104
|
+
* claims, verbatim, as typed per-check results over a canonical export plus the lane's ledger
|
|
105
|
+
* rows — read-only, never a repair:
|
|
106
|
+
*
|
|
107
|
+
* 1. `schema-round-trip` — every envelope re-encodes and re-decodes through its canonical
|
|
108
|
+
* Schema (a corrupted copy fails typed instead of decoding incorrectly).
|
|
109
|
+
* 2. `record-identity` — no canonical record identity appears twice (DUR-007 dedupe held).
|
|
110
|
+
* 3. `sequence-contiguity` — gap-free sequences from 1 through the exported tail.
|
|
111
|
+
* 4. `digest-chain` — the tail digest recomputes from `EMPTY_TAIL_DIGEST` through every batch
|
|
112
|
+
* (requires the per-batch producer directory; skipped honestly otherwise).
|
|
113
|
+
* 5. `fifo-input-order` / `fifo-settlement-order` — canonical input and settlement records
|
|
114
|
+
* follow the admitted queue order (DUR-004), except a later input may settle before a Run
|
|
115
|
+
* with canonically unresolved unknown calls when that input became active. Resolving those
|
|
116
|
+
* calls later does not revoke the later Run's ownership. Aborted settlements of never-run work (no
|
|
117
|
+
* canonical `input:{sid}` record) are exempt from the settlement comparison: P7 §7(c)
|
|
118
|
+
* settles them immediately without waiting for the head, and DUR-004 bounds execution
|
|
119
|
+
* order, which never-run work has none of.
|
|
120
|
+
* 6. `terminal-uniqueness` — at most one canonical terminal record per Submission, exactly one
|
|
121
|
+
* for every settled ledger row (DUR-002).
|
|
122
|
+
* 7. `ledger-canonical-agreement` — a settled ledger row has a canonical settlement record and
|
|
123
|
+
* the outcomes agree; canonical history remains the authority (DUR-015).
|
|
124
|
+
* 8. `checkpoint-binding` — a stored checkpoint's digest matches the recomputed chain at its
|
|
125
|
+
* sequence (needs the chain; bounds are checked regardless).
|
|
126
|
+
* 9. `all-settled` — convergence mode only: every known Submission settled.
|
|
127
|
+
*
|
|
128
|
+
* Requires only `Crypto.Crypto` (digest recomputation); it performs no port access, so the
|
|
129
|
+
* admin operation, certification runners, and chaos properties feed it whatever copies they
|
|
130
|
+
* hold.
|
|
131
|
+
*/
|
|
132
|
+
export const verifyThreadInvariants = Effect.fn("Thread.verifyThreadInvariants")(function* (
|
|
133
|
+
input: ThreadInvariantInput,
|
|
134
|
+
): Effect.fn.Return<IntegrityReport, never, Crypto.Crypto> {
|
|
135
|
+
const exported = input.export;
|
|
136
|
+
const records = exported.records;
|
|
137
|
+
const checks: Array<IntegrityCheck> = [];
|
|
138
|
+
|
|
139
|
+
// 1. schema-round-trip
|
|
140
|
+
{
|
|
141
|
+
let failure: string | undefined;
|
|
142
|
+
|
|
143
|
+
for (const envelope of records) {
|
|
144
|
+
const roundTrip = yield* encodeEnvelope(envelope).pipe(
|
|
145
|
+
Effect.flatMap(decodeEnvelope),
|
|
146
|
+
Effect.exit,
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
if (roundTrip._tag === "Failure") {
|
|
150
|
+
failure = `record ${envelope.record.recordId} does not round-trip its Schema`;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
checks.push(
|
|
155
|
+
failure === undefined
|
|
156
|
+
? check("schema-round-trip", "passed")
|
|
157
|
+
: check("schema-round-trip", "failed", failure),
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// 2. record-identity
|
|
162
|
+
{
|
|
163
|
+
const seen = new Set<string>();
|
|
164
|
+
const duplicates = new Set<string>();
|
|
165
|
+
|
|
166
|
+
for (const envelope of records) {
|
|
167
|
+
if (seen.has(envelope.record.recordId)) duplicates.add(envelope.record.recordId);
|
|
168
|
+
seen.add(envelope.record.recordId);
|
|
169
|
+
}
|
|
170
|
+
checks.push(
|
|
171
|
+
duplicates.size === 0
|
|
172
|
+
? check("record-identity", "passed")
|
|
173
|
+
: check(
|
|
174
|
+
"record-identity",
|
|
175
|
+
"failed",
|
|
176
|
+
`duplicated canonical record identities: ${[...duplicates].join(", ")}`,
|
|
177
|
+
),
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// 3. sequence-contiguity
|
|
182
|
+
{
|
|
183
|
+
let contiguityFailure: string | undefined;
|
|
184
|
+
|
|
185
|
+
for (const [index, envelope] of records.entries()) {
|
|
186
|
+
if (envelope.sequence !== index + 1) {
|
|
187
|
+
contiguityFailure = `sequence ${envelope.sequence} at position ${index} (expected ${index + 1})`;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (contiguityFailure === undefined && records.length !== exported.tailSequence) {
|
|
192
|
+
contiguityFailure = `exported tail sequence ${exported.tailSequence} disagrees with ${records.length} records`;
|
|
193
|
+
}
|
|
194
|
+
checks.push(
|
|
195
|
+
contiguityFailure === undefined
|
|
196
|
+
? check("sequence-contiguity", "passed")
|
|
197
|
+
: check("sequence-contiguity", "failed", contiguityFailure),
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// 4. digest-chain (+ collect per-sequence chain digests for checkpoint binding)
|
|
202
|
+
const chainDigestAtSequence = new Map<number, string>();
|
|
203
|
+
|
|
204
|
+
if (input.batchProducers === undefined) {
|
|
205
|
+
checks.push(
|
|
206
|
+
check(
|
|
207
|
+
"digest-chain",
|
|
208
|
+
"skipped",
|
|
209
|
+
"the ThreadStore port does not export per-batch producer identity; supply batchProducers (captured at append time) to recompute the chain — adapter-level verifyOnOpen performs the storage-side audit",
|
|
210
|
+
),
|
|
211
|
+
);
|
|
212
|
+
} else {
|
|
213
|
+
let chain = EMPTY_TAIL_DIGEST;
|
|
214
|
+
let chainFailure: string | undefined;
|
|
215
|
+
|
|
216
|
+
for (const run of batchRunsOf(records)) {
|
|
217
|
+
const producerId = input.batchProducers.get(run.batchId);
|
|
218
|
+
|
|
219
|
+
if (producerId === undefined) {
|
|
220
|
+
chainFailure = `no producer identity supplied for batch ${run.batchId}`;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
const [first, ...rest] = run.records;
|
|
224
|
+
|
|
225
|
+
if (first === undefined) {
|
|
226
|
+
chainFailure = `batch ${run.batchId} grouped zero records`;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const digest = yield* digestCanonicalBatch(
|
|
231
|
+
chain,
|
|
232
|
+
CanonicalBatch.make({ batchId: run.batchId, producerId, records: [first, ...rest] }),
|
|
233
|
+
).pipe(Effect.exit);
|
|
234
|
+
|
|
235
|
+
if (digest._tag === "Failure") {
|
|
236
|
+
chainFailure = `batch ${run.batchId} could not be re-digested`;
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
chain = digest.value;
|
|
240
|
+
chainDigestAtSequence.set(run.lastSequence, chain);
|
|
241
|
+
}
|
|
242
|
+
if (chainFailure === undefined && chain !== exported.tailDigest) {
|
|
243
|
+
chainFailure = `recomputed tail digest ${chain} disagrees with exported tail digest ${exported.tailDigest}`;
|
|
244
|
+
}
|
|
245
|
+
checks.push(
|
|
246
|
+
chainFailure === undefined
|
|
247
|
+
? check("digest-chain", "passed")
|
|
248
|
+
: check("digest-chain", "failed", chainFailure),
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Shared FIFO/terminal machinery
|
|
253
|
+
const ordered = [...input.submissions].sort(
|
|
254
|
+
(left, right) => left.queueSequence - right.queueSequence,
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
const recordIds = records.map((envelope) => envelope.record.recordId);
|
|
258
|
+
|
|
259
|
+
// 5a. fifo-input-order
|
|
260
|
+
{
|
|
261
|
+
const expectedInputs = ordered.map((row) => submissionInputRecordId(row.submissionId));
|
|
262
|
+
const expectedSet = new Set<string>(expectedInputs);
|
|
263
|
+
const inputOrder = recordIds.filter((recordId) => expectedSet.has(recordId));
|
|
264
|
+
const presentInputs = new Set(inputOrder);
|
|
265
|
+
const expectedPresent = expectedInputs.filter((expected) => presentInputs.has(expected));
|
|
266
|
+
|
|
267
|
+
const matches =
|
|
268
|
+
inputOrder.length === expectedPresent.length &&
|
|
269
|
+
inputOrder.every((recordId, index) => recordId === expectedPresent[index]);
|
|
270
|
+
|
|
271
|
+
checks.push(
|
|
272
|
+
matches
|
|
273
|
+
? check("fifo-input-order", "passed")
|
|
274
|
+
: check(
|
|
275
|
+
"fifo-input-order",
|
|
276
|
+
"failed",
|
|
277
|
+
`canonical input order [${inputOrder.join(", ")}] violates queue order`,
|
|
278
|
+
),
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// 5b. fifo-settlement-order — P7 §7(c) exemption: an ABORTED settlement for never-run work
|
|
283
|
+
// (no canonical `input:{sid}` record) settles immediately by design, without waiting to
|
|
284
|
+
// head the lane, so it is excluded from the FIFO comparison. DUR-004 bounds EXECUTION
|
|
285
|
+
// order; the exempted rows provably never executed. Unknown work can also be bypassed,
|
|
286
|
+
// but only the inputs that became active while it was parked may settle ahead of it.
|
|
287
|
+
{
|
|
288
|
+
const recordIdSet = new Set<string>(recordIds);
|
|
289
|
+
const abortedNeverRun = new Set<string>();
|
|
290
|
+
|
|
291
|
+
const settlementByRun = new Map<string, string>(
|
|
292
|
+
ordered.map((row) => [
|
|
293
|
+
runIdForSubmission(row.submissionId),
|
|
294
|
+
submissionSettlementRecordId(row.submissionId),
|
|
295
|
+
]),
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
const inputSettlements = new Map(
|
|
299
|
+
ordered.map((row) => [
|
|
300
|
+
submissionInputRecordId(row.submissionId),
|
|
301
|
+
submissionSettlementRecordId(row.submissionId),
|
|
302
|
+
]),
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
const unknownCalls = new Map<string, Set<string>>();
|
|
306
|
+
const abortsOrTerminals = new Set<string>();
|
|
307
|
+
const bypassedSettlements = new Map<string, Set<string>>();
|
|
308
|
+
|
|
309
|
+
for (const envelope of records) {
|
|
310
|
+
const payload = envelope.record.payload;
|
|
311
|
+
|
|
312
|
+
if (payload._tag === "ToolCallUnknown" && !abortsOrTerminals.has(payload.runId)) {
|
|
313
|
+
const calls = unknownCalls.get(payload.runId) ?? new Set<string>();
|
|
314
|
+
|
|
315
|
+
calls.add(payload.toolCallId);
|
|
316
|
+
unknownCalls.set(payload.runId, calls);
|
|
317
|
+
} else if (payload._tag === "ToolCallResolved" || payload._tag === "ToolCallSettled") {
|
|
318
|
+
const calls = unknownCalls.get(payload.runId);
|
|
319
|
+
|
|
320
|
+
calls?.delete(payload.toolCallId);
|
|
321
|
+
if (calls?.size === 0) unknownCalls.delete(payload.runId);
|
|
322
|
+
} else if (payload._tag === "AbortRequested" || payload._tag === "SubmissionSettled") {
|
|
323
|
+
const runId = runIdForSubmission(payload.submissionId);
|
|
324
|
+
|
|
325
|
+
abortsOrTerminals.add(runId);
|
|
326
|
+
unknownCalls.delete(runId);
|
|
327
|
+
} else if (payload._tag === "RunCompleted" || payload._tag === "RunFailed") {
|
|
328
|
+
abortsOrTerminals.add(payload.runId);
|
|
329
|
+
unknownCalls.delete(payload.runId);
|
|
330
|
+
} else if (payload._tag === "UserInputRecorded") {
|
|
331
|
+
const settlementId = inputSettlements.get(envelope.record.recordId);
|
|
332
|
+
|
|
333
|
+
if (settlementId !== undefined) {
|
|
334
|
+
const bypassed = new Set<string>();
|
|
335
|
+
|
|
336
|
+
for (const runId of unknownCalls.keys()) {
|
|
337
|
+
const earlier = settlementByRun.get(runId);
|
|
338
|
+
|
|
339
|
+
if (earlier !== undefined) bypassed.add(earlier);
|
|
340
|
+
}
|
|
341
|
+
bypassedSettlements.set(settlementId, bypassed);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (
|
|
345
|
+
payload._tag === "SubmissionSettled" &&
|
|
346
|
+
payload.outcome === "aborted" &&
|
|
347
|
+
!recordIdSet.has(submissionInputRecordId(payload.submissionId))
|
|
348
|
+
) {
|
|
349
|
+
abortedNeverRun.add(payload.submissionId);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const expectedSettlements = ordered
|
|
354
|
+
.filter((row) => !abortedNeverRun.has(row.submissionId))
|
|
355
|
+
.map((row) => submissionSettlementRecordId(row.submissionId));
|
|
356
|
+
|
|
357
|
+
const expectedSet = new Set<string>(expectedSettlements);
|
|
358
|
+
const settlementOrder = recordIds.filter((recordId) => expectedSet.has(recordId));
|
|
359
|
+
|
|
360
|
+
const presentSettlements = new Set(settlementOrder);
|
|
361
|
+
|
|
362
|
+
const expectedPresent = expectedSettlements.filter((expected) =>
|
|
363
|
+
presentSettlements.has(expected),
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
const remaining = new Set(expectedPresent);
|
|
367
|
+
let matches = settlementOrder.length === expectedPresent.length;
|
|
368
|
+
|
|
369
|
+
for (const recordId of settlementOrder) {
|
|
370
|
+
for (const earlier of remaining) {
|
|
371
|
+
if (earlier === recordId) break;
|
|
372
|
+
if (!bypassedSettlements.get(recordId)?.has(earlier)) {
|
|
373
|
+
matches = false;
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
if (!matches) break;
|
|
378
|
+
remaining.delete(recordId);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
checks.push(
|
|
382
|
+
matches
|
|
383
|
+
? check("fifo-settlement-order", "passed")
|
|
384
|
+
: check(
|
|
385
|
+
"fifo-settlement-order",
|
|
386
|
+
"failed",
|
|
387
|
+
`canonical settlement order [${settlementOrder.join(", ")}] violates queue order`,
|
|
388
|
+
),
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// 6 + 7. terminal-uniqueness and ledger-canonical-agreement
|
|
393
|
+
{
|
|
394
|
+
const settlementsBySubmission = new Map<string, Array<CanonicalRecordEnvelope>>();
|
|
395
|
+
|
|
396
|
+
for (const envelope of records) {
|
|
397
|
+
if (envelope.record.payload._tag !== "SubmissionSettled") continue;
|
|
398
|
+
const submissionId = envelope.record.payload.submissionId;
|
|
399
|
+
const existing = settlementsBySubmission.get(submissionId) ?? [];
|
|
400
|
+
|
|
401
|
+
existing.push(envelope);
|
|
402
|
+
settlementsBySubmission.set(submissionId, existing);
|
|
403
|
+
}
|
|
404
|
+
let uniquenessFailure: string | undefined;
|
|
405
|
+
let agreementFailure: string | undefined;
|
|
406
|
+
|
|
407
|
+
for (const [submissionId, settlements] of settlementsBySubmission) {
|
|
408
|
+
if (settlements.length > 1) {
|
|
409
|
+
uniquenessFailure = `submission ${submissionId} has ${settlements.length} canonical terminal records`;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
for (const row of ordered) {
|
|
413
|
+
const settlements = settlementsBySubmission.get(row.submissionId) ?? [];
|
|
414
|
+
const canonical = settlements[0]?.record.payload;
|
|
415
|
+
|
|
416
|
+
if (row.state === "settled") {
|
|
417
|
+
if (settlements.length !== 1) {
|
|
418
|
+
uniquenessFailure ??= `settled submission ${row.submissionId} has ${settlements.length} canonical terminal records (expected exactly 1)`;
|
|
419
|
+
}
|
|
420
|
+
if (
|
|
421
|
+
canonical !== undefined &&
|
|
422
|
+
canonical._tag === "SubmissionSettled" &&
|
|
423
|
+
row.settledOutcome !== undefined &&
|
|
424
|
+
canonical.outcome !== row.settledOutcome
|
|
425
|
+
) {
|
|
426
|
+
agreementFailure = `submission ${row.submissionId}: ledger outcome ${row.settledOutcome} disagrees with canonical outcome ${canonical.outcome}`;
|
|
427
|
+
}
|
|
428
|
+
if (settlements.length === 0) {
|
|
429
|
+
agreementFailure ??= `settled submission ${row.submissionId} has no canonical settlement record (DUR-015: history is the authority)`;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
checks.push(
|
|
434
|
+
uniquenessFailure === undefined
|
|
435
|
+
? check("terminal-uniqueness", "passed")
|
|
436
|
+
: check("terminal-uniqueness", "failed", uniquenessFailure),
|
|
437
|
+
);
|
|
438
|
+
checks.push(
|
|
439
|
+
agreementFailure === undefined
|
|
440
|
+
? check("ledger-canonical-agreement", "passed")
|
|
441
|
+
: check("ledger-canonical-agreement", "failed", agreementFailure),
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// 8. checkpoint-binding
|
|
446
|
+
if (input.checkpoint === undefined && input.checkpointsSupported !== true) {
|
|
447
|
+
checks.push(check("checkpoint-binding", "skipped", "checkpoint support was not supplied"));
|
|
448
|
+
} else if (input.checkpoint === undefined) {
|
|
449
|
+
checks.push(check("checkpoint-binding", "passed", "no stored checkpoint"));
|
|
450
|
+
} else if (input.checkpoint.throughSequence > exported.tailSequence) {
|
|
451
|
+
checks.push(
|
|
452
|
+
check(
|
|
453
|
+
"checkpoint-binding",
|
|
454
|
+
"failed",
|
|
455
|
+
`checkpoint through-sequence ${input.checkpoint.throughSequence} is ahead of the tail ${exported.tailSequence}`,
|
|
456
|
+
),
|
|
457
|
+
);
|
|
458
|
+
} else if (input.batchProducers === undefined) {
|
|
459
|
+
checks.push(
|
|
460
|
+
check(
|
|
461
|
+
"checkpoint-binding",
|
|
462
|
+
"skipped",
|
|
463
|
+
"digest binding needs the recomputed chain; supply batchProducers (the adapter rejects mismatched checkpoints on save/load regardless)",
|
|
464
|
+
),
|
|
465
|
+
);
|
|
466
|
+
} else {
|
|
467
|
+
const bound = chainDigestAtSequence.get(input.checkpoint.throughSequence);
|
|
468
|
+
|
|
469
|
+
checks.push(
|
|
470
|
+
bound === input.checkpoint.tailDigest
|
|
471
|
+
? check("checkpoint-binding", "passed")
|
|
472
|
+
: check(
|
|
473
|
+
"checkpoint-binding",
|
|
474
|
+
"failed",
|
|
475
|
+
`checkpoint digest ${input.checkpoint.tailDigest} does not match the recomputed chain at sequence ${input.checkpoint.throughSequence}`,
|
|
476
|
+
),
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// 9. all-settled (convergence mode)
|
|
481
|
+
if (input.requireAllSettled === true) {
|
|
482
|
+
const nonterminal = ordered.filter((row) => row.state !== "settled");
|
|
483
|
+
|
|
484
|
+
checks.push(
|
|
485
|
+
nonterminal.length === 0 && ordered.length > 0
|
|
486
|
+
? check("all-settled", "passed")
|
|
487
|
+
: check(
|
|
488
|
+
"all-settled",
|
|
489
|
+
"failed",
|
|
490
|
+
ordered.length === 0
|
|
491
|
+
? "no Submissions are known to the lane"
|
|
492
|
+
: `nonterminal submissions: ${nonterminal
|
|
493
|
+
.map((row) => `${row.submissionId}(${row.state})`)
|
|
494
|
+
.join(", ")}`,
|
|
495
|
+
),
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
return IntegrityReport.make({
|
|
500
|
+
threadId: exported.threadId,
|
|
501
|
+
tailSequence: exported.tailSequence,
|
|
502
|
+
recordCount: records.length,
|
|
503
|
+
submissionCount: ordered.length,
|
|
504
|
+
checks,
|
|
505
|
+
ok: checks.every((result) => result.status !== "failed"),
|
|
506
|
+
});
|
|
507
|
+
});
|