effect-agent 0.1.0-beta.85 → 0.1.0-beta.87
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-CN0EWRsR.d.mts +226 -0
- package/dist/Agent-RklVROrm.mjs +83 -0
- package/dist/Agent-RklVROrm.mjs.map +1 -0
- package/dist/AgentError-CggcAQ7V.d.mts +101 -0
- package/dist/AgentPolicy-CetmQrf3.d.mts +96 -0
- package/dist/AgentRuntime-BLyETCPo.mjs +4562 -0
- package/dist/AgentRuntime-BLyETCPo.mjs.map +1 -0
- package/dist/AgentRuntime-uxR_a4VM.d.mts +346 -0
- package/dist/AgentUpdates-DMJ-_xow.d.mts +53 -0
- package/dist/ContextCompactor-Dxu5zhOL.d.mts +161 -0
- package/dist/ContextWindow-DRQ5Mbm2.d.mts +58 -0
- package/dist/DurableAgentRuntime-uggeJpv3.mjs +6368 -0
- package/dist/DurableAgentRuntime-uggeJpv3.mjs.map +1 -0
- package/dist/DurableFailpoint-Oinuuedm.d.mts +41 -0
- package/dist/DurableStep-Cry_iol4.d.mts +103 -0
- package/dist/Ephemeral.d.mts +22 -0
- package/dist/Ephemeral.mjs +22 -0
- package/dist/Ephemeral.mjs.map +1 -0
- package/dist/EventSource-OqS_P9ug.d.mts +51 -0
- package/dist/Identifiers-CN2s30fF.d.mts +40 -0
- package/dist/MemoryNamespace-BbRW5p71.d.mts +36 -0
- package/dist/MemoryReference-B8Q3UJoJ.d.mts +79 -0
- package/dist/Messaging-CkcIdt4I.d.mts +490 -0
- package/dist/MessagingHost-CRk0kXzT.d.mts +246 -0
- package/dist/MessagingHost-CWi_PP3g.mjs +137 -0
- package/dist/MessagingHost-CWi_PP3g.mjs.map +1 -0
- package/dist/OperationAuthorizer-TzcQtpX5.d.mts +61 -0
- package/dist/Output-D6SkedVx.d.mts +25 -0
- package/dist/PageCapture-Df8Xwskw.d.mts +583 -0
- package/dist/PageScreenshot-BpgZKAxl.d.mts +48 -0
- package/dist/PreparedInputAdmission-C4HbjHgl.d.mts +38 -0
- package/dist/Receipt-BAHyigAF.d.mts +33 -0
- package/dist/Records-BAGkekt8.d.mts +3570 -0
- package/dist/RunEvent-DIrzkjLr.d.mts +460 -0
- package/dist/RunEventSink-D5aVhISG.d.mts +108 -0
- package/dist/RunJournal-Cgg1kNvc.mjs +825 -0
- package/dist/RunJournal-Cgg1kNvc.mjs.map +1 -0
- package/dist/RunOptions-g1aigcKI.d.mts +915 -0
- package/dist/RunPolicyUsage-ClZxyR46.d.mts +21 -0
- package/dist/Sandbox-CEsDWBLq.d.mts +173 -0
- package/dist/Schedule-H3SEYX9g.d.mts +842 -0
- package/dist/Scheduling-C9aIP8zT.mjs +691 -0
- package/dist/Scheduling-C9aIP8zT.mjs.map +1 -0
- package/dist/Subagent-Cy_hU1tv.mjs +1469 -0
- package/dist/Subagent-Cy_hU1tv.mjs.map +1 -0
- package/dist/Subagent-DyfzHNdv.d.mts +826 -0
- package/dist/SubagentContract-DdT7Cqe6.d.mts +116 -0
- package/dist/SubagentHost-CJUBQlcc.d.mts +140 -0
- package/dist/Subscription-BEP8oQO5.d.mts +921 -0
- package/dist/SubscriptionInput-vAAOBrK7.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 +6 -5
- package/dist/ToolExposure.mjs +17 -9
- package/dist/ToolExposure.mjs.map +1 -1
- package/dist/ToolReconciler-DQVaJfpE.d.mts +76 -0
- package/dist/ToolResult-DmmgoChv.d.mts +61 -0
- package/dist/Usage-Dx0aknfk.d.mts +121 -0
- package/dist/WakeScheduler-EjUF-GhC.d.mts +56 -0
- package/dist/Worker-CaPYykpe.d.mts +228 -0
- package/dist/agent-registration-CWDMOAZA.mjs +172 -0
- package/dist/agent-registration-CWDMOAZA.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 +260 -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 +151 -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 +109 -0
- package/dist/capabilities/ToolDiscovery.mjs +211 -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 +112 -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 +117 -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/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 +140 -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 +147 -0
- package/dist/core/Worker.mjs.map +1 -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 +328 -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 +111 -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 +94 -0
- package/dist/durable/DurableFailpoint.mjs.map +1 -0
- package/dist/durable/DurableFailpointTestControl.d.mts +15 -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 +144 -0
- package/dist/durable/GitHubWorkflowSource.mjs +209 -0
- package/dist/durable/GitHubWorkflowSource.mjs.map +1 -0
- package/dist/durable/MessageDelivery.d.mts +492 -0
- package/dist/durable/MessageDelivery.mjs +495 -0
- package/dist/durable/MessageDelivery.mjs.map +1 -0
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +358 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs +243 -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 +34 -0
- package/dist/durable/PreparedInputAdmission.mjs.map +1 -0
- package/dist/durable/Records.d.mts +2 -0
- package/dist/durable/Records.mjs +795 -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 +382 -0
- package/dist/durable/Schedule.mjs.map +1 -0
- package/dist/durable/ScheduleStoreConformance.d.mts +18 -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 +30 -0
- package/dist/durable/SqlMemoryStore.mjs +435 -0
- package/dist/durable/SqlMemoryStore.mjs.map +1 -0
- package/dist/durable/SqlMessageDeliveryStore.d.mts +40 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs +167 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs.map +1 -0
- package/dist/durable/SqlStorageV2Upgrade.d.mts +22 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs +459 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs.map +1 -0
- package/dist/durable/SqlSubscriptionStore.d.mts +63 -0
- package/dist/durable/SqlSubscriptionStore.mjs +751 -0
- package/dist/durable/SqlSubscriptionStore.mjs.map +1 -0
- package/dist/durable/SubmissionLedger.d.mts +3 -0
- package/dist/durable/SubmissionLedger.mjs +914 -0
- package/dist/durable/SubmissionLedger.mjs.map +1 -0
- package/dist/durable/SubmissionLedgerConformance.d.mts +30 -0
- package/dist/durable/SubmissionLedgerConformance.mjs +1986 -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 +17 -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 +74 -0
- package/dist/durable/ThreadInvariants.mjs +200 -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 +147 -0
- package/dist/durable/ThreadStore.mjs.map +1 -0
- package/dist/durable/ThreadStoreConformance.d.mts +29 -0
- package/dist/durable/ThreadStoreConformance.mjs +248 -0
- package/dist/durable/ThreadStoreConformance.mjs.map +1 -0
- package/dist/durable/ToolReconciler.d.mts +2 -0
- package/dist/durable/ToolReconciler.mjs +81 -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 +122 -0
- package/dist/engine/RunOptions.mjs.map +1 -0
- package/dist/engine/SubagentHost.d.mts +2 -0
- package/dist/engine/SubagentHost.mjs +72 -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 +88 -54
- package/dist/index.mjs +97 -54
- 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 +142 -0
- package/dist/sandbox/InteractiveBrowser.mjs +165 -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 +252 -0
- package/dist/sandbox/ProtectedBrowser.mjs +270 -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 -1
- package/src/Ephemeral.ts +17 -0
- package/src/ToolExposure.ts +2 -2
- 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 +427 -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 +2277 -0
- package/src/capabilities/SubagentReservations.ts +850 -0
- package/src/capabilities/ToolDiscovery.ts +339 -0
- package/src/capabilities/WebCapture.ts +722 -0
- package/src/capabilities/WebSearch.ts +184 -0
- package/src/capabilities/internal/subagent-background.ts +1106 -0
- package/src/capabilities/internal/subagent-contract.ts +142 -0
- package/src/capabilities/internal/subagent-policy.ts +235 -0
- package/src/capabilities/internal/subagent-reporting.ts +261 -0
- package/src/capabilities/internal/utf8.ts +10 -0
- package/src/core/Agent.ts +575 -0
- package/src/core/AgentError.ts +152 -0
- package/src/core/AgentPolicy.ts +153 -0
- package/src/core/AgentUpdates.ts +100 -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 +90 -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 +170 -0
- package/src/core/Usage.ts +529 -0
- package/src/core/Worker.ts +173 -0
- package/src/core/internal/agent-updates.ts +32 -0
- package/src/core/internal/utf8.ts +23 -0
- package/src/durable/ActivityStore.ts +160 -0
- package/src/durable/Admin.ts +496 -0
- package/src/durable/AgentRegistration.ts +13 -0
- package/src/durable/Certification.ts +210 -0
- package/src/durable/CommittedActivity.ts +296 -0
- package/src/durable/Digest.ts +93 -0
- package/src/durable/DurableAgentRuntime.ts +10340 -0
- package/src/durable/DurableFailpoint.ts +103 -0
- package/src/durable/DurableFailpointTestControl.ts +39 -0
- package/src/durable/EventSource.ts +172 -0
- package/src/durable/GitHubWorkflowSource.ts +453 -0
- package/src/durable/MessageDelivery.ts +708 -0
- package/src/durable/MessageDeliveryStoreConformance.ts +363 -0
- package/src/durable/OperationAuthorizer.ts +85 -0
- package/src/durable/PersistentHistory.ts +260 -0
- package/src/durable/PreparedInputAdmission.ts +44 -0
- package/src/durable/Records.ts +1010 -0
- package/src/durable/Recovery.ts +1018 -0
- package/src/durable/RunJournal.ts +1479 -0
- package/src/durable/Schedule.ts +504 -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 +774 -0
- package/src/durable/SqlMessageDeliveryStore.ts +302 -0
- package/src/durable/SqlStorageV2Upgrade.ts +500 -0
- package/src/durable/SqlSubscriptionStore.ts +1440 -0
- package/src/durable/SubmissionLedger.ts +1201 -0
- package/src/durable/SubmissionLedgerConformance.ts +4579 -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 +442 -0
- package/src/durable/ThreadProjection.ts +269 -0
- package/src/durable/ThreadProjectionMaintenance.ts +67 -0
- package/src/durable/ThreadStore.ts +242 -0
- package/src/durable/ThreadStoreConformance.ts +710 -0
- package/src/durable/ToolReconciler.ts +105 -0
- package/src/durable/WakeScheduler.ts +134 -0
- package/src/durable/WorkerHost.ts +171 -0
- package/src/durable/internal/agent-registration.ts +525 -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 +107 -0
- package/src/durable/internal/messaging-host.ts +608 -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 +2467 -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 +1077 -0
- package/src/engine/SubagentHost.ts +181 -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 +10117 -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 +96 -53
- package/src/sandbox/CodeExecutor.ts +352 -0
- package/src/sandbox/InteractiveBrowser.ts +257 -0
- package/src/sandbox/PageCapture.ts +692 -0
- package/src/sandbox/PageCrawl.ts +148 -0
- package/src/sandbox/PageScreenshot.ts +81 -0
- package/src/sandbox/ProtectedBrowser.ts +413 -0
- package/src/sandbox/Sandbox.ts +241 -0
- package/dist/Agent.d.mts +0 -5
- package/dist/Agent.mjs +0 -10
- package/dist/Agent.mjs.map +0 -1
- package/dist/AgentError.d.mts +0 -5
- package/dist/AgentError.mjs +0 -10
- package/dist/AgentError.mjs.map +0 -1
- package/dist/AgentPolicy.d.mts +0 -5
- package/dist/AgentPolicy.mjs +0 -10
- package/dist/AgentPolicy.mjs.map +0 -1
- package/dist/AgentRuntime.d.mts +0 -5
- package/dist/AgentRuntime.mjs +0 -10
- package/dist/AgentRuntime.mjs.map +0 -1
- package/dist/AgentUpdates.d.mts +0 -5
- package/dist/AgentUpdates.mjs +0 -10
- package/dist/AgentUpdates.mjs.map +0 -1
- package/dist/Approval.d.mts +0 -5
- package/dist/Approval.mjs +0 -10
- package/dist/Approval.mjs.map +0 -1
- package/dist/Budget.d.mts +0 -5
- package/dist/Budget.mjs +0 -10
- package/dist/Budget.mjs.map +0 -1
- package/dist/CodeMode.d.mts +0 -5
- package/dist/CodeMode.mjs +0 -10
- package/dist/CodeMode.mjs.map +0 -1
- package/dist/Commands.d.mts +0 -5
- package/dist/Commands.mjs +0 -10
- package/dist/Commands.mjs.map +0 -1
- package/dist/Compaction.d.mts +0 -5
- package/dist/Compaction.mjs +0 -10
- package/dist/Compaction.mjs.map +0 -1
- package/dist/ContextCompactor.d.mts +0 -5
- package/dist/ContextCompactor.mjs +0 -10
- package/dist/ContextCompactor.mjs.map +0 -1
- package/dist/ContextHistory.d.mts +0 -5
- package/dist/ContextHistory.mjs +0 -10
- package/dist/ContextHistory.mjs.map +0 -1
- package/dist/ContextTools.d.mts +0 -5
- package/dist/ContextTools.mjs +0 -10
- package/dist/ContextTools.mjs.map +0 -1
- package/dist/ContextWindow.d.mts +0 -5
- package/dist/ContextWindow.mjs +0 -10
- package/dist/ContextWindow.mjs.map +0 -1
- package/dist/DurableStep.d.mts +0 -5
- package/dist/DurableStep.mjs +0 -10
- package/dist/DurableStep.mjs.map +0 -1
- package/dist/EphemeralThreads.d.mts +0 -5
- package/dist/EphemeralThreads.mjs +0 -10
- package/dist/EphemeralThreads.mjs.map +0 -1
- package/dist/IdGenerator.d.mts +0 -5
- package/dist/IdGenerator.mjs +0 -10
- package/dist/IdGenerator.mjs.map +0 -1
- package/dist/Identifiers.d.mts +0 -5
- package/dist/Identifiers.mjs +0 -10
- package/dist/Identifiers.mjs.map +0 -1
- package/dist/Mcp.d.mts +0 -5
- package/dist/Mcp.mjs +0 -10
- package/dist/Mcp.mjs.map +0 -1
- package/dist/McpClient.d.mts +0 -5
- package/dist/McpClient.mjs +0 -10
- package/dist/McpClient.mjs.map +0 -1
- package/dist/Memory.d.mts +0 -5
- package/dist/Memory.mjs +0 -10
- package/dist/Memory.mjs.map +0 -1
- package/dist/MemoryNamespace.d.mts +0 -5
- package/dist/MemoryNamespace.mjs +0 -10
- package/dist/MemoryNamespace.mjs.map +0 -1
- package/dist/MemoryNotes.d.mts +0 -5
- package/dist/MemoryNotes.mjs +0 -10
- package/dist/MemoryNotes.mjs.map +0 -1
- package/dist/MemoryReference.d.mts +0 -5
- package/dist/MemoryReference.mjs +0 -10
- package/dist/MemoryReference.mjs.map +0 -1
- package/dist/MemoryRevalidation.d.mts +0 -5
- package/dist/MemoryRevalidation.mjs +0 -10
- package/dist/MemoryRevalidation.mjs.map +0 -1
- package/dist/MemoryStore.d.mts +0 -5
- package/dist/MemoryStore.mjs +0 -10
- package/dist/MemoryStore.mjs.map +0 -1
- package/dist/Messaging.d.mts +0 -5
- package/dist/Messaging.mjs +0 -10
- package/dist/Messaging.mjs.map +0 -1
- package/dist/MessagingHost.d.mts +0 -5
- package/dist/MessagingHost.mjs +0 -10
- package/dist/MessagingHost.mjs.map +0 -1
- package/dist/ModelContext.d.mts +0 -5
- package/dist/ModelContext.mjs +0 -10
- package/dist/ModelContext.mjs.map +0 -1
- package/dist/Receipt.d.mts +0 -5
- package/dist/Receipt.mjs +0 -10
- package/dist/Receipt.mjs.map +0 -1
- package/dist/Redaction.d.mts +0 -5
- package/dist/Redaction.mjs +0 -10
- package/dist/Redaction.mjs.map +0 -1
- package/dist/Remembering.d.mts +0 -5
- package/dist/Remembering.mjs +0 -10
- package/dist/Remembering.mjs.map +0 -1
- package/dist/RememberingStore.d.mts +0 -5
- package/dist/RememberingStore.mjs +0 -10
- package/dist/RememberingStore.mjs.map +0 -1
- package/dist/RunEvent.d.mts +0 -5
- package/dist/RunEvent.mjs +0 -10
- package/dist/RunEvent.mjs.map +0 -1
- package/dist/RunEventSink.d.mts +0 -5
- package/dist/RunEventSink.mjs +0 -10
- package/dist/RunEventSink.mjs.map +0 -1
- package/dist/RunHooks.d.mts +0 -5
- package/dist/RunHooks.mjs +0 -10
- package/dist/RunHooks.mjs.map +0 -1
- package/dist/RunOptions.d.mts +0 -5
- package/dist/RunOptions.mjs +0 -10
- package/dist/RunOptions.mjs.map +0 -1
- package/dist/RunPolicyUsage.d.mts +0 -5
- package/dist/RunPolicyUsage.mjs +0 -10
- package/dist/RunPolicyUsage.mjs.map +0 -1
- package/dist/SemanticMemory.d.mts +0 -5
- package/dist/SemanticMemory.mjs +0 -10
- package/dist/SemanticMemory.mjs.map +0 -1
- package/dist/SemanticMemoryIndex.d.mts +0 -5
- package/dist/SemanticMemoryIndex.mjs +0 -10
- package/dist/SemanticMemoryIndex.mjs.map +0 -1
- package/dist/SemanticMemoryRevalidation.d.mts +0 -5
- package/dist/SemanticMemoryRevalidation.mjs +0 -10
- package/dist/SemanticMemoryRevalidation.mjs.map +0 -1
- package/dist/Subagent.d.mts +0 -5
- package/dist/Subagent.mjs +0 -10
- package/dist/Subagent.mjs.map +0 -1
- package/dist/SubagentContract.d.mts +0 -5
- package/dist/SubagentContract.mjs +0 -10
- package/dist/SubagentContract.mjs.map +0 -1
- package/dist/SubagentHost.d.mts +0 -5
- package/dist/SubagentHost.mjs +0 -10
- package/dist/SubagentHost.mjs.map +0 -1
- package/dist/SubagentReservations.d.mts +0 -5
- package/dist/SubagentReservations.mjs +0 -10
- package/dist/SubagentReservations.mjs.map +0 -1
- package/dist/ThreadHistory.d.mts +0 -5
- package/dist/ThreadHistory.mjs +0 -10
- package/dist/ThreadHistory.mjs.map +0 -1
- package/dist/ToolBroker.d.mts +0 -5
- package/dist/ToolBroker.mjs +0 -10
- package/dist/ToolBroker.mjs.map +0 -1
- package/dist/ToolDiscovery.d.mts +0 -5
- package/dist/ToolDiscovery.mjs +0 -10
- package/dist/ToolDiscovery.mjs.map +0 -1
- package/dist/ToolResult.d.mts +0 -5
- package/dist/ToolResult.mjs +0 -10
- package/dist/ToolResult.mjs.map +0 -1
- package/dist/Usage.d.mts +0 -5
- package/dist/Usage.mjs +0 -10
- package/dist/Usage.mjs.map +0 -1
- package/dist/WebCapture.d.mts +0 -5
- package/dist/WebCapture.mjs +0 -10
- package/dist/WebCapture.mjs.map +0 -1
- package/dist/WebSearch.d.mts +0 -5
- package/dist/WebSearch.mjs +0 -10
- package/dist/WebSearch.mjs.map +0 -1
- package/dist/Worker.d.mts +0 -5
- package/dist/Worker.mjs +0 -10
- package/dist/Worker.mjs.map +0 -1
- package/dist/rolldown-runtime-BBjsoOtd.mjs +0 -27
- package/src/Agent.ts +0 -1
- package/src/AgentError.ts +0 -1
- package/src/AgentPolicy.ts +0 -1
- package/src/AgentRuntime.ts +0 -1
- package/src/AgentUpdates.ts +0 -1
- package/src/Approval.ts +0 -1
- package/src/Budget.ts +0 -1
- package/src/CodeMode.ts +0 -1
- package/src/Commands.ts +0 -1
- package/src/Compaction.ts +0 -1
- package/src/ContextCompactor.ts +0 -1
- package/src/ContextHistory.ts +0 -1
- package/src/ContextTools.ts +0 -1
- package/src/ContextWindow.ts +0 -1
- package/src/DurableStep.ts +0 -1
- package/src/EphemeralThreads.ts +0 -1
- package/src/IdGenerator.ts +0 -1
- package/src/Identifiers.ts +0 -1
- package/src/Mcp.ts +0 -1
- package/src/McpClient.ts +0 -1
- package/src/Memory.ts +0 -1
- package/src/MemoryNamespace.ts +0 -1
- package/src/MemoryNotes.ts +0 -1
- package/src/MemoryReference.ts +0 -1
- package/src/MemoryRevalidation.ts +0 -1
- package/src/MemoryStore.ts +0 -1
- package/src/Messaging.ts +0 -1
- package/src/MessagingHost.ts +0 -1
- package/src/ModelContext.ts +0 -1
- package/src/Receipt.ts +0 -1
- package/src/Redaction.ts +0 -1
- package/src/Remembering.ts +0 -1
- package/src/RememberingStore.ts +0 -1
- package/src/RunEvent.ts +0 -1
- package/src/RunEventSink.ts +0 -1
- package/src/RunHooks.ts +0 -1
- package/src/RunOptions.ts +0 -1
- package/src/RunPolicyUsage.ts +0 -1
- package/src/SemanticMemory.ts +0 -1
- package/src/SemanticMemoryIndex.ts +0 -1
- package/src/SemanticMemoryRevalidation.ts +0 -1
- package/src/Subagent.ts +0 -1
- package/src/SubagentContract.ts +0 -1
- package/src/SubagentHost.ts +0 -1
- package/src/SubagentReservations.ts +0 -1
- package/src/ThreadHistory.ts +0 -1
- package/src/ToolBroker.ts +0 -1
- package/src/ToolDiscovery.ts +0 -1
- package/src/ToolResult.ts +0 -1
- package/src/Usage.ts +0 -1
- package/src/WebCapture.ts +0 -1
- package/src/WebSearch.ts +0 -1
- package/src/Worker.ts +0 -1
|
@@ -0,0 +1,625 @@
|
|
|
1
|
+
import { AgentId, ReceiptId, SubmissionId, ThreadId } from "../core/Identifiers.mjs";
|
|
2
|
+
import { IdempotencyKey, Principal, QueueSequence, Receipt } from "../core/Receipt.mjs";
|
|
3
|
+
import { DefinitionDigests, Digest } from "./Records.mjs";
|
|
4
|
+
import { SubscriptionStore, defaultSubscriptionLimits } from "./Subscription.mjs";
|
|
5
|
+
import { Clock, Effect, Result, Schema } from "effect";
|
|
6
|
+
import { TestClock } from "effect/testing";
|
|
7
|
+
//#region src/durable/SubscriptionStoreConformance.ts
|
|
8
|
+
var SubscriptionStoreConformanceViolation = class extends Schema.TaggedError()("SubscriptionStoreConformanceViolation", {
|
|
9
|
+
caseName: Schema.String,
|
|
10
|
+
message: Schema.String
|
|
11
|
+
}) {};
|
|
12
|
+
const subscriptionConformancePartition = {
|
|
13
|
+
tenantId: "subscription-conformance",
|
|
14
|
+
address: "source-address"
|
|
15
|
+
};
|
|
16
|
+
const principal = Schema.decodeSync(Principal)("subscription-conformance-principal");
|
|
17
|
+
const agentId = Schema.decodeSync(AgentId)("subscription-conformance-agent");
|
|
18
|
+
const threadId = Schema.decodeSync(ThreadId)("subscription-conformance-thread");
|
|
19
|
+
const digest = (character) => Schema.decodeSync(Digest)(character.repeat(64));
|
|
20
|
+
const definitions = DefinitionDigests.make({
|
|
21
|
+
agent: digest("a"),
|
|
22
|
+
model: digest("b"),
|
|
23
|
+
tools: digest("c")
|
|
24
|
+
});
|
|
25
|
+
const record = (name, mode = "once", ownerId = "owner") => ({
|
|
26
|
+
schemaVersion: 1,
|
|
27
|
+
key: {
|
|
28
|
+
partition: subscriptionConformancePartition,
|
|
29
|
+
ownerId,
|
|
30
|
+
subscriptionId: name
|
|
31
|
+
},
|
|
32
|
+
creationFingerprint: digest(name.charCodeAt(0) % 2 === 0 ? "d" : "e"),
|
|
33
|
+
createdBy: principal,
|
|
34
|
+
createdAtMillis: 1,
|
|
35
|
+
ordinal: 0,
|
|
36
|
+
configurationRevision: 1,
|
|
37
|
+
configurationFingerprint: digest(name.charCodeAt(0) % 2 === 0 ? "d" : "e"),
|
|
38
|
+
creationConfiguration: {
|
|
39
|
+
source: {
|
|
40
|
+
name: "trusted",
|
|
41
|
+
version: "1"
|
|
42
|
+
},
|
|
43
|
+
matchingKey: "match",
|
|
44
|
+
parameters: { name },
|
|
45
|
+
context: { name },
|
|
46
|
+
mode,
|
|
47
|
+
expiresAtMillis: 1e5,
|
|
48
|
+
destination: {
|
|
49
|
+
_tag: "ExistingThread",
|
|
50
|
+
threadId
|
|
51
|
+
},
|
|
52
|
+
deliveryPrincipal: principal,
|
|
53
|
+
agentId,
|
|
54
|
+
definitions
|
|
55
|
+
},
|
|
56
|
+
configuration: {
|
|
57
|
+
source: {
|
|
58
|
+
name: "trusted",
|
|
59
|
+
version: "1"
|
|
60
|
+
},
|
|
61
|
+
matchingKey: "match",
|
|
62
|
+
parameters: { name },
|
|
63
|
+
context: { name },
|
|
64
|
+
mode,
|
|
65
|
+
expiresAtMillis: 1e5,
|
|
66
|
+
destination: {
|
|
67
|
+
_tag: "ExistingThread",
|
|
68
|
+
threadId
|
|
69
|
+
},
|
|
70
|
+
deliveryPrincipal: principal,
|
|
71
|
+
agentId,
|
|
72
|
+
definitions
|
|
73
|
+
},
|
|
74
|
+
state: "active",
|
|
75
|
+
recovery: null
|
|
76
|
+
});
|
|
77
|
+
const event = (name, payloadDigest = digest("f")) => ({
|
|
78
|
+
schemaVersion: 1,
|
|
79
|
+
partition: subscriptionConformancePartition,
|
|
80
|
+
eventId: name,
|
|
81
|
+
source: {
|
|
82
|
+
name: "trusted",
|
|
83
|
+
version: "1"
|
|
84
|
+
},
|
|
85
|
+
matchingKey: "match",
|
|
86
|
+
payload: { name },
|
|
87
|
+
payloadDigest,
|
|
88
|
+
acceptedAtMillis: 10,
|
|
89
|
+
cutoff: 0,
|
|
90
|
+
cursor: 0,
|
|
91
|
+
routingComplete: false,
|
|
92
|
+
routingFailure: null,
|
|
93
|
+
nextAttemptAtMillis: 10
|
|
94
|
+
});
|
|
95
|
+
const delivery = (subscription, accepted, suffix = "0") => {
|
|
96
|
+
const deliveryId = digest(suffix === "0" ? "1" : "2");
|
|
97
|
+
return {
|
|
98
|
+
schemaVersion: 1,
|
|
99
|
+
key: {
|
|
100
|
+
subscription: subscription.key,
|
|
101
|
+
eventId: accepted.eventId
|
|
102
|
+
},
|
|
103
|
+
deliveryId,
|
|
104
|
+
source: accepted.source,
|
|
105
|
+
subscriptionFingerprint: subscription.configurationFingerprint,
|
|
106
|
+
configurationRevision: subscription.configurationRevision,
|
|
107
|
+
configuration: subscription.configuration,
|
|
108
|
+
eventDigest: accepted.payloadDigest,
|
|
109
|
+
threadId,
|
|
110
|
+
admissionKey: Schema.decodeSync(IdempotencyKey)(`subscription:${deliveryId}`),
|
|
111
|
+
selectedAtMillis: suffix === "0" ? 20 : 21,
|
|
112
|
+
state: "selected",
|
|
113
|
+
envelope: null,
|
|
114
|
+
envelopeDigest: null,
|
|
115
|
+
retry: {
|
|
116
|
+
generation: 0,
|
|
117
|
+
attempts: 0,
|
|
118
|
+
automaticAttempts: 0,
|
|
119
|
+
parked: false,
|
|
120
|
+
nextAttemptAtMillis: 20,
|
|
121
|
+
lastAttemptAtMillis: null,
|
|
122
|
+
lastFailure: null
|
|
123
|
+
},
|
|
124
|
+
receipt: null,
|
|
125
|
+
refusal: null
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const preparedInput = (selected) => ({
|
|
129
|
+
schemaVersion: 1,
|
|
130
|
+
threadId: selected.threadId,
|
|
131
|
+
deliveryPrincipal: principal,
|
|
132
|
+
agentId,
|
|
133
|
+
definitions,
|
|
134
|
+
input: { event: selected.key.eventId },
|
|
135
|
+
inputDigest: digest("3"),
|
|
136
|
+
admissionKey: selected.admissionKey,
|
|
137
|
+
authorization: {
|
|
138
|
+
policyId: "policy",
|
|
139
|
+
decisionId: "decision"
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
const receipt = Receipt.make({
|
|
143
|
+
receiptId: Schema.decodeSync(ReceiptId)("subscription-conformance-receipt"),
|
|
144
|
+
submissionId: Schema.decodeSync(SubmissionId)("subscription-conformance-submission"),
|
|
145
|
+
threadId,
|
|
146
|
+
queueSequence: Schema.decodeSync(QueueSequence)(1)
|
|
147
|
+
});
|
|
148
|
+
const conformanceCase = (name, body) => ({
|
|
149
|
+
name,
|
|
150
|
+
run: body((condition, message) => condition ? Effect.void : Effect.fail(SubscriptionStoreConformanceViolation.make({
|
|
151
|
+
caseName: name,
|
|
152
|
+
message
|
|
153
|
+
})))
|
|
154
|
+
});
|
|
155
|
+
const historicalOccurrenceReplay = conformanceCase("preserves unknown occurrence time on replay and fences known times", (ensure) => Effect.gen(function* () {
|
|
156
|
+
const store = yield* SubscriptionStore;
|
|
157
|
+
const original = yield* store.accept(event("legacy-occurrence"), defaultSubscriptionLimits);
|
|
158
|
+
const replay = yield* store.accept({
|
|
159
|
+
...original,
|
|
160
|
+
occurredAtMillis: 1
|
|
161
|
+
}, defaultSubscriptionLimits);
|
|
162
|
+
yield* ensure(replay.occurredAtMillis === void 0 && replay.acceptedAtMillis === original.acceptedAtMillis && replay.cutoff === original.cutoff, "replay invented historical occurrence or moved acceptance");
|
|
163
|
+
const known = yield* store.accept({
|
|
164
|
+
...event("known-occurrence"),
|
|
165
|
+
occurredAtMillis: 1
|
|
166
|
+
}, defaultSubscriptionLimits);
|
|
167
|
+
const changed = yield* store.accept({
|
|
168
|
+
...known,
|
|
169
|
+
occurredAtMillis: 2
|
|
170
|
+
}, defaultSubscriptionLimits).pipe(Effect.result);
|
|
171
|
+
yield* ensure(Result.isFailure(changed), "known occurrence time changed on replay");
|
|
172
|
+
const omitted = yield* store.accept(event("known-occurrence"), defaultSubscriptionLimits).pipe(Effect.result);
|
|
173
|
+
yield* ensure(Result.isFailure(omitted), "known occurrence time was erased on replay");
|
|
174
|
+
}));
|
|
175
|
+
const cutoffAndIntake = conformanceCase("orders eligibility cutoffs and preserves duplicate intake", (ensure) => Effect.gen(function* () {
|
|
176
|
+
const store = yield* SubscriptionStore;
|
|
177
|
+
const before = yield* store.register(record("before"), defaultSubscriptionLimits);
|
|
178
|
+
const accepted = yield* store.accept(event("cutoff"), defaultSubscriptionLimits);
|
|
179
|
+
const after = yield* store.register(record("after"), defaultSubscriptionLimits);
|
|
180
|
+
yield* ensure(before.ordinal < accepted.cutoff && after.ordinal > accepted.cutoff, "sequence did not order registration and intake");
|
|
181
|
+
const candidates = yield* store.candidates(accepted, 10);
|
|
182
|
+
yield* ensure(candidates.length === 1 && candidates[0].key.subscriptionId === "before", "cutoff admitted a later registration");
|
|
183
|
+
const replayed = yield* store.accept({
|
|
184
|
+
...event("cutoff"),
|
|
185
|
+
acceptedAtMillis: 99
|
|
186
|
+
}, defaultSubscriptionLimits);
|
|
187
|
+
yield* ensure(replayed.cutoff === accepted.cutoff && replayed.acceptedAtMillis === accepted.acceptedAtMillis, "duplicate intake did not return retained progress");
|
|
188
|
+
const conflict = yield* Effect.result(store.accept(event("cutoff", digest("9")), defaultSubscriptionLimits));
|
|
189
|
+
yield* ensure(Result.isFailure(conflict) && conflict.failure._tag === "SubscriptionError" && conflict.failure.reason === "conflict", "conflicting event identity was accepted");
|
|
190
|
+
}));
|
|
191
|
+
const onceAndCapacity = conformanceCase("consumes once atomically and rejects capacity before progress", (ensure) => Effect.gen(function* () {
|
|
192
|
+
const store = yield* SubscriptionStore;
|
|
193
|
+
const once = yield* store.register(record("once"), defaultSubscriptionLimits);
|
|
194
|
+
const first = yield* store.accept(event("first"), defaultSubscriptionLimits);
|
|
195
|
+
const second = yield* store.accept(event("second"), defaultSubscriptionLimits);
|
|
196
|
+
yield* store.select(first, [delivery(once, first)], once.ordinal, true, 20, defaultSubscriptionLimits);
|
|
197
|
+
yield* store.select(second, [delivery(once, second)], once.ordinal, true, 20, defaultSubscriptionLimits);
|
|
198
|
+
yield* ensure((yield* store.get(once.key))?.state === "consumed", "once registration remained active");
|
|
199
|
+
yield* ensure((yield* store.delivery({
|
|
200
|
+
subscription: once.key,
|
|
201
|
+
eventId: first.eventId
|
|
202
|
+
})) !== null, "winning delivery was lost");
|
|
203
|
+
yield* ensure((yield* store.delivery({
|
|
204
|
+
subscription: once.key,
|
|
205
|
+
eventId: second.eventId
|
|
206
|
+
})) === null, "second event consumed once registration again");
|
|
207
|
+
const left = yield* store.register(record("left", "continuous", "capacity"), defaultSubscriptionLimits);
|
|
208
|
+
const right = yield* store.register(record("right", "continuous", "capacity"), defaultSubscriptionLimits);
|
|
209
|
+
const bounded = yield* store.accept(event("bounded"), defaultSubscriptionLimits);
|
|
210
|
+
const limits = {
|
|
211
|
+
...defaultSubscriptionLimits,
|
|
212
|
+
maxDeliveries: 2,
|
|
213
|
+
maxDeliveriesPerOwner: 1
|
|
214
|
+
};
|
|
215
|
+
const failure = yield* Effect.result(store.select(bounded, [delivery(left, bounded), delivery(right, bounded, "1")], right.ordinal, true, 20, limits));
|
|
216
|
+
yield* ensure(Result.isFailure(failure) && failure.failure._tag === "SubscriptionError" && failure.failure.reason === "capacity", "delivery quota did not reject batch");
|
|
217
|
+
yield* ensure((yield* store.event(bounded.eventId))?.cursor === 0, "capacity failure advanced event cursor");
|
|
218
|
+
}));
|
|
219
|
+
const preparationLifecycle = conformanceCase("refuses cancelled selection and preserves prepared work", (ensure) => Effect.gen(function* () {
|
|
220
|
+
const store = yield* SubscriptionStore;
|
|
221
|
+
const cancelled = yield* store.register(record("cancelled"), defaultSubscriptionLimits);
|
|
222
|
+
const cancelledEvent = yield* store.accept(event("cancelled-event"), defaultSubscriptionLimits);
|
|
223
|
+
const cancelledDelivery = delivery(cancelled, cancelledEvent);
|
|
224
|
+
yield* store.select(cancelledEvent, [cancelledDelivery], cancelled.ordinal, true, 20, defaultSubscriptionLimits);
|
|
225
|
+
yield* store.cancel(cancelled.key);
|
|
226
|
+
const refused = yield* store.changeDelivery(cancelledDelivery.key, cancelledDelivery.deliveryId, {
|
|
227
|
+
_tag: "Prepare",
|
|
228
|
+
envelope: preparedInput(cancelledDelivery),
|
|
229
|
+
envelopeDigest: digest("4"),
|
|
230
|
+
nowMillis: 30
|
|
231
|
+
});
|
|
232
|
+
yield* ensure(refused.state === "refused" && refused.refusal?.code === "cancelled", "cancelled selection prepared");
|
|
233
|
+
const durable = yield* store.register(record("durable"), defaultSubscriptionLimits);
|
|
234
|
+
const durableEvent = yield* store.accept(event("durable-event"), defaultSubscriptionLimits);
|
|
235
|
+
const selected = delivery(durable, durableEvent);
|
|
236
|
+
yield* store.select(durableEvent, [selected], durable.ordinal, true, 20, defaultSubscriptionLimits);
|
|
237
|
+
const prepared = yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
238
|
+
_tag: "Prepare",
|
|
239
|
+
envelope: preparedInput(selected),
|
|
240
|
+
envelopeDigest: digest("5"),
|
|
241
|
+
nowMillis: 30
|
|
242
|
+
});
|
|
243
|
+
const retry = {
|
|
244
|
+
generation: 0,
|
|
245
|
+
automaticAttempts: 0,
|
|
246
|
+
parked: false,
|
|
247
|
+
attempts: 2,
|
|
248
|
+
nextAttemptAtMillis: 60,
|
|
249
|
+
lastAttemptAtMillis: 35,
|
|
250
|
+
lastFailure: "transport"
|
|
251
|
+
};
|
|
252
|
+
yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
253
|
+
_tag: "Retry",
|
|
254
|
+
retry,
|
|
255
|
+
nowMillis: 35
|
|
256
|
+
});
|
|
257
|
+
for (const staleRetry of [
|
|
258
|
+
{
|
|
259
|
+
...retry,
|
|
260
|
+
attempts: 1,
|
|
261
|
+
nextAttemptAtMillis: 70
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
...retry,
|
|
265
|
+
nextAttemptAtMillis: 70
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
...retry,
|
|
269
|
+
attempts: 3,
|
|
270
|
+
nextAttemptAtMillis: 50
|
|
271
|
+
}
|
|
272
|
+
]) {
|
|
273
|
+
const retained = yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
274
|
+
_tag: "Retry",
|
|
275
|
+
retry: staleRetry,
|
|
276
|
+
nowMillis: 36
|
|
277
|
+
});
|
|
278
|
+
yield* ensure(retained.retry.attempts === 2 && retained.retry.nextAttemptAtMillis === 60, "stale retry overwrote newer retry state");
|
|
279
|
+
}
|
|
280
|
+
yield* store.cancel(durable.key);
|
|
281
|
+
const completed = yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
282
|
+
_tag: "Complete",
|
|
283
|
+
receipt,
|
|
284
|
+
nowMillis: 40
|
|
285
|
+
});
|
|
286
|
+
yield* ensure(prepared.state === "prepared" && completed.state === "delivered", "prepared work did not survive cancellation");
|
|
287
|
+
const stale = yield* Effect.result(store.changeDelivery(selected.key, digest("8"), {
|
|
288
|
+
_tag: "Complete",
|
|
289
|
+
receipt,
|
|
290
|
+
nowMillis: 41
|
|
291
|
+
}));
|
|
292
|
+
yield* ensure(Result.isFailure(stale) && stale.failure._tag === "SubscriptionError" && stale.failure.code === "stale-delivery", "stale outcome was not fenced");
|
|
293
|
+
}));
|
|
294
|
+
const catchUpAndCursors = conformanceCase("limits catch-up to one watch and persists recovery cursors", (ensure) => Effect.gen(function* () {
|
|
295
|
+
const store = yield* SubscriptionStore;
|
|
296
|
+
const accepted = yield* store.accept(event("observed"), defaultSubscriptionLimits);
|
|
297
|
+
const watch = yield* store.register(record("watch"), defaultSubscriptionLimits);
|
|
298
|
+
const selected = delivery(watch, accepted);
|
|
299
|
+
yield* store.catchUp(accepted, selected, 20, defaultSubscriptionLimits);
|
|
300
|
+
yield* store.catchUp(accepted, {
|
|
301
|
+
...selected,
|
|
302
|
+
selectedAtMillis: 999,
|
|
303
|
+
retry: {
|
|
304
|
+
...selected.retry,
|
|
305
|
+
attempts: 2
|
|
306
|
+
}
|
|
307
|
+
}, 30, defaultSubscriptionLimits);
|
|
308
|
+
yield* ensure((yield* store.get(watch.key))?.state === "consumed", "catch-up did not consume watch");
|
|
309
|
+
yield* store.advanceScanCursors({
|
|
310
|
+
events: "e",
|
|
311
|
+
deliveries: "d",
|
|
312
|
+
recovery: 7
|
|
313
|
+
});
|
|
314
|
+
const cursors = yield* store.readScanCursors;
|
|
315
|
+
yield* ensure(cursors.events === "e" && cursors.deliveries === "d" && cursors.recovery === 7, "scan cursors were not durable");
|
|
316
|
+
yield* ensure((yield* store.nextDeadline) === 0, "nonzero scan cursor did not keep recovery armed");
|
|
317
|
+
}));
|
|
318
|
+
const replayUnderTighterLimits = conformanceCase("preserves retained identities when limits tighten", (ensure) => Effect.gen(function* () {
|
|
319
|
+
const store = yield* SubscriptionStore;
|
|
320
|
+
const created = yield* store.register(record("retained"), defaultSubscriptionLimits);
|
|
321
|
+
const accepted = yield* store.accept(event("retained"), defaultSubscriptionLimits);
|
|
322
|
+
const limits = {
|
|
323
|
+
...defaultSubscriptionLimits,
|
|
324
|
+
maxRegistrations: 1,
|
|
325
|
+
maxEvents: 1,
|
|
326
|
+
maxPayloadBytes: 1,
|
|
327
|
+
maxContextBytes: 1,
|
|
328
|
+
maxLifetimeMillis: 1
|
|
329
|
+
};
|
|
330
|
+
const replayed = yield* store.register(record("retained"), limits);
|
|
331
|
+
const repeated = yield* store.accept(event("retained"), limits);
|
|
332
|
+
yield* ensure(replayed.ordinal === created.ordinal, "registration replay lost identity");
|
|
333
|
+
yield* ensure(repeated.cutoff === accepted.cutoff, "intake replay lost cutoff");
|
|
334
|
+
const newRegistration = yield* Effect.result(store.register(record("new"), limits));
|
|
335
|
+
const newEvent = yield* Effect.result(store.accept(event("new"), limits));
|
|
336
|
+
yield* ensure(Result.isFailure(newRegistration), "new registration ignored tightened limits");
|
|
337
|
+
yield* ensure(Result.isFailure(newEvent), "new intake ignored tightened limits");
|
|
338
|
+
}));
|
|
339
|
+
const revisionsAndRetention = conformanceCase("preserves historical selection, CAS revisions, and unsettled evidence during retention", (ensure) => Effect.gen(function* () {
|
|
340
|
+
const store = yield* SubscriptionStore;
|
|
341
|
+
const now = yield* Clock.currentTimeMillis;
|
|
342
|
+
const policy = {
|
|
343
|
+
replayHorizonMillis: 1e4,
|
|
344
|
+
completedRetentionMillis: 0,
|
|
345
|
+
maxTombstones: 8
|
|
346
|
+
};
|
|
347
|
+
const limits = {
|
|
348
|
+
...defaultSubscriptionLimits,
|
|
349
|
+
retention: policy
|
|
350
|
+
};
|
|
351
|
+
const indefinite = record("revision", "continuous");
|
|
352
|
+
const original = yield* store.register({
|
|
353
|
+
...indefinite,
|
|
354
|
+
configuration: {
|
|
355
|
+
...indefinite.configuration,
|
|
356
|
+
expiresAtMillis: null
|
|
357
|
+
}
|
|
358
|
+
}, limits);
|
|
359
|
+
yield* ensure(original.configuration.expiresAtMillis === null, "UntilCancelled must remain explicit");
|
|
360
|
+
yield* ensure((yield* store.nextDeadline) === null, "UntilCancelled cannot create an expiry wake");
|
|
361
|
+
const accepted = yield* store.accept({
|
|
362
|
+
...event("retained"),
|
|
363
|
+
occurredAtMillis: now,
|
|
364
|
+
acceptedAtMillis: now
|
|
365
|
+
}, limits);
|
|
366
|
+
const selected = {
|
|
367
|
+
...delivery(original, accepted),
|
|
368
|
+
configuration: original.configuration,
|
|
369
|
+
configurationRevision: 1
|
|
370
|
+
};
|
|
371
|
+
yield* store.select(accepted, [selected], original.ordinal, true, now + limits.maxLifetimeMillis + 1, limits);
|
|
372
|
+
yield* ensure((yield* store.delivery(selected.key)) !== null, "UntilCancelled cannot expire at the ordinary maximum lifetime");
|
|
373
|
+
const updated = yield* store.change(original.key, 1, {
|
|
374
|
+
_tag: "Update",
|
|
375
|
+
configuration: {
|
|
376
|
+
...original.configuration,
|
|
377
|
+
context: { edited: true }
|
|
378
|
+
},
|
|
379
|
+
configurationFingerprint: digest("9"),
|
|
380
|
+
recovery: null
|
|
381
|
+
});
|
|
382
|
+
yield* ensure(updated.configurationRevision === 2 && updated.creationConfiguration !== void 0, "Update must preserve creation evidence and advance revision");
|
|
383
|
+
const stale = yield* store.change(original.key, 1, { _tag: "Pause" }).pipe(Effect.result);
|
|
384
|
+
yield* ensure(Result.isFailure(stale), "Stale management must conflict");
|
|
385
|
+
yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
386
|
+
_tag: "Prepare",
|
|
387
|
+
envelope: preparedInput(selected),
|
|
388
|
+
envelopeDigest: digest("4"),
|
|
389
|
+
nowMillis: now
|
|
390
|
+
});
|
|
391
|
+
yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
392
|
+
_tag: "Complete",
|
|
393
|
+
receipt,
|
|
394
|
+
nowMillis: now
|
|
395
|
+
});
|
|
396
|
+
yield* store.compact(now, policy, 8);
|
|
397
|
+
yield* ensure((yield* store.delivery(selected.key)) !== null, "Admission is not settlement; delivery evidence must remain");
|
|
398
|
+
yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
399
|
+
_tag: "ObserveSettlement",
|
|
400
|
+
receipt,
|
|
401
|
+
settled: true,
|
|
402
|
+
nowMillis: now,
|
|
403
|
+
nextAttemptAtMillis: now
|
|
404
|
+
});
|
|
405
|
+
const recovering = yield* store.register(record("recovering-retention", "once"), limits);
|
|
406
|
+
yield* store.deferRecovery(recovering.key, recovering.configurationRevision, {
|
|
407
|
+
attempts: 1,
|
|
408
|
+
nextAttemptAtMillis: null,
|
|
409
|
+
lastFailure: "source-unavailable"
|
|
410
|
+
});
|
|
411
|
+
yield* store.compact(now, policy, 8);
|
|
412
|
+
yield* ensure((yield* store.delivery(selected.key)) !== null, "Permanent recovery evidence must protect retained source facts");
|
|
413
|
+
yield* store.deferRecovery(recovering.key, recovering.configurationRevision, null);
|
|
414
|
+
yield* store.compact(now, policy, 8);
|
|
415
|
+
yield* ensure((yield* store.delivery(selected.key)) === null, "Settled delivery must release retained capacity");
|
|
416
|
+
yield* ensure((yield* store.event(accepted.eventId))?.tombstone === true, "Deduplication tombstone must outlive completed payload");
|
|
417
|
+
const replay = yield* store.accept(accepted, limits);
|
|
418
|
+
yield* ensure(Result.isFailure(yield* store.accept({
|
|
419
|
+
...accepted,
|
|
420
|
+
occurredAtMillis: now + 1
|
|
421
|
+
}, limits).pipe(Effect.result)), "An event identity cannot replace its retained source timestamp");
|
|
422
|
+
yield* ensure(Result.isFailure(yield* store.compact(now, {
|
|
423
|
+
...policy,
|
|
424
|
+
replayHorizonMillis: 1
|
|
425
|
+
}, 8).pipe(Effect.result)), "Compaction cannot change the persisted replay horizon");
|
|
426
|
+
yield* ensure(Result.isFailure(yield* store.accept(event("without-policy"), defaultSubscriptionLimits).pipe(Effect.result)), "Fresh intake cannot disable established retention");
|
|
427
|
+
yield* ensure(replay.cutoff === accepted.cutoff && replay.tombstone === true, "Duplicate intake cannot reopen routing after compaction");
|
|
428
|
+
}));
|
|
429
|
+
const sustainedRetention = conformanceCase("reuses event, delivery and tombstone quotas across replay horizons", (ensure) => Effect.gen(function* () {
|
|
430
|
+
const store = yield* SubscriptionStore;
|
|
431
|
+
const policy = {
|
|
432
|
+
replayHorizonMillis: 100,
|
|
433
|
+
completedRetentionMillis: 0,
|
|
434
|
+
maxTombstones: 8
|
|
435
|
+
};
|
|
436
|
+
const limits = {
|
|
437
|
+
...defaultSubscriptionLimits,
|
|
438
|
+
maxEvents: 4,
|
|
439
|
+
maxDeliveries: 4,
|
|
440
|
+
maxDeliveriesPerOwner: 4,
|
|
441
|
+
retention: policy
|
|
442
|
+
};
|
|
443
|
+
const registration = yield* store.register(record("sustained", "continuous"), limits);
|
|
444
|
+
for (let index = 0; index < 32; index++) {
|
|
445
|
+
const now = yield* Clock.currentTimeMillis;
|
|
446
|
+
const accepted = yield* store.accept({
|
|
447
|
+
...event(`retained-${index}`),
|
|
448
|
+
occurredAtMillis: now,
|
|
449
|
+
acceptedAtMillis: now
|
|
450
|
+
}, limits);
|
|
451
|
+
const deliveryId = Schema.decodeSync(Digest)(index.toString(16).padStart(64, "0"));
|
|
452
|
+
const selected = {
|
|
453
|
+
...delivery(registration, accepted),
|
|
454
|
+
deliveryId,
|
|
455
|
+
admissionKey: Schema.decodeSync(IdempotencyKey)(`subscription:${deliveryId}`)
|
|
456
|
+
};
|
|
457
|
+
yield* store.select(accepted, [selected], registration.ordinal, true, now, limits);
|
|
458
|
+
yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
459
|
+
_tag: "Prepare",
|
|
460
|
+
envelope: preparedInput(selected),
|
|
461
|
+
envelopeDigest: digest("4"),
|
|
462
|
+
nowMillis: now
|
|
463
|
+
});
|
|
464
|
+
yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
465
|
+
_tag: "Complete",
|
|
466
|
+
receipt,
|
|
467
|
+
nowMillis: now
|
|
468
|
+
});
|
|
469
|
+
yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
470
|
+
_tag: "ObserveSettlement",
|
|
471
|
+
receipt,
|
|
472
|
+
settled: true,
|
|
473
|
+
nowMillis: now,
|
|
474
|
+
nextAttemptAtMillis: now
|
|
475
|
+
});
|
|
476
|
+
yield* store.compact(now, policy, 8);
|
|
477
|
+
yield* ensure((yield* store.delivery(selected.key)) === null, "Settled delivery must release its quota on every cycle");
|
|
478
|
+
yield* ensure((yield* store.accept(accepted, limits)).tombstone === true, "Duplicate acknowledgement must preserve its tombstone");
|
|
479
|
+
yield* TestClock.adjust(20);
|
|
480
|
+
}
|
|
481
|
+
yield* ensure((yield* store.event("retained-0")) === null, "Expired identity must be reclaimed");
|
|
482
|
+
const expired = yield* store.accept({
|
|
483
|
+
...event("retained-0"),
|
|
484
|
+
occurredAtMillis: 0
|
|
485
|
+
}, limits).pipe(Effect.result);
|
|
486
|
+
yield* ensure(Result.isFailure(expired) && expired.failure._tag === "SubscriptionError" && expired.failure.code === "event-replay-horizon", "Reclaimed identity must not be admitted after its replay horizon");
|
|
487
|
+
}));
|
|
488
|
+
const subscriptionStoreConformanceCases = [
|
|
489
|
+
historicalOccurrenceReplay,
|
|
490
|
+
conformanceCase("fences source recovery across pause, resume and configuration replacement", (ensure) => Effect.gen(function* () {
|
|
491
|
+
const store = yield* SubscriptionStore;
|
|
492
|
+
const initial = yield* store.register({
|
|
493
|
+
...record("recovery-revisions"),
|
|
494
|
+
recovery: {
|
|
495
|
+
attempts: 0,
|
|
496
|
+
nextAttemptAtMillis: 10,
|
|
497
|
+
lastFailure: null
|
|
498
|
+
}
|
|
499
|
+
}, defaultSubscriptionLimits);
|
|
500
|
+
const paused = yield* store.change(initial.key, 1, { _tag: "Pause" });
|
|
501
|
+
yield* store.deferRecovery(initial.key, 1, null);
|
|
502
|
+
yield* ensure((yield* store.get(initial.key))?.recovery?.nextAttemptAtMillis === 10, "late provider completion erased paused recovery");
|
|
503
|
+
const resumed = yield* store.change(initial.key, paused.configurationRevision, { _tag: "Resume" });
|
|
504
|
+
yield* ensure(resumed.recovery?.nextAttemptAtMillis === 10, "resume lost the recovery obligation");
|
|
505
|
+
const updated = yield* store.change(initial.key, resumed.configurationRevision, {
|
|
506
|
+
_tag: "Update",
|
|
507
|
+
configuration: {
|
|
508
|
+
...initial.configuration,
|
|
509
|
+
source: {
|
|
510
|
+
name: "replacement",
|
|
511
|
+
version: "2"
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
configurationFingerprint: digest("9"),
|
|
515
|
+
recovery: {
|
|
516
|
+
attempts: 0,
|
|
517
|
+
nextAttemptAtMillis: 50,
|
|
518
|
+
lastFailure: null
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
yield* store.deferRecovery(initial.key, resumed.configurationRevision, {
|
|
522
|
+
attempts: 9,
|
|
523
|
+
nextAttemptAtMillis: null,
|
|
524
|
+
lastFailure: "obsolete-source"
|
|
525
|
+
});
|
|
526
|
+
const retained = yield* store.get(initial.key);
|
|
527
|
+
yield* ensure(retained?.recovery?.nextAttemptAtMillis === 50 && retained.configurationRevision === updated.configurationRevision, "obsolete provider completion overwrote replacement recovery");
|
|
528
|
+
yield* ensure(retained?.creationFingerprint === initial.creationFingerprint && retained.creationConfiguration.source.name === initial.configuration.source.name, "revision rewrote creation identity");
|
|
529
|
+
})),
|
|
530
|
+
conformanceCase("rearms only one delivery generation and retains late receipt authority", (ensure) => Effect.gen(function* () {
|
|
531
|
+
const store = yield* SubscriptionStore;
|
|
532
|
+
const subscription = yield* store.register(record("retry-generation", "continuous"), defaultSubscriptionLimits);
|
|
533
|
+
const accepted = yield* store.accept(event("retry-generation"), defaultSubscriptionLimits);
|
|
534
|
+
const selected = {
|
|
535
|
+
...delivery(subscription, accepted),
|
|
536
|
+
observeSettlement: true
|
|
537
|
+
};
|
|
538
|
+
yield* store.select(accepted, [selected], subscription.ordinal, true, 20, defaultSubscriptionLimits);
|
|
539
|
+
yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
540
|
+
_tag: "Prepare",
|
|
541
|
+
envelope: preparedInput(selected),
|
|
542
|
+
envelopeDigest: digest("4"),
|
|
543
|
+
nowMillis: 30
|
|
544
|
+
});
|
|
545
|
+
const parked = yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
546
|
+
_tag: "Retry",
|
|
547
|
+
nowMillis: 40,
|
|
548
|
+
retry: {
|
|
549
|
+
...selected.retry,
|
|
550
|
+
attempts: 8,
|
|
551
|
+
automaticAttempts: 8,
|
|
552
|
+
parked: true,
|
|
553
|
+
nextAttemptAtMillis: 50,
|
|
554
|
+
lastAttemptAtMillis: 40,
|
|
555
|
+
lastFailure: "ambiguous"
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
yield* ensure((yield* store.pendingDeliveries(100, "", 10)).length === 0, "parked admission remained due for settlement observation");
|
|
559
|
+
yield* ensure((yield* store.nextDeadline) === null, "parked admission retained a busy-loop deadline");
|
|
560
|
+
const recovered = yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
561
|
+
_tag: "Recover",
|
|
562
|
+
expectedGeneration: parked.retry.generation,
|
|
563
|
+
nowMillis: 50
|
|
564
|
+
});
|
|
565
|
+
const stale = yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
566
|
+
_tag: "Retry",
|
|
567
|
+
nowMillis: 60,
|
|
568
|
+
retry: {
|
|
569
|
+
...parked.retry,
|
|
570
|
+
attempts: 9,
|
|
571
|
+
nextAttemptAtMillis: 70
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
yield* ensure(!stale.retry.parked && stale.retry.generation === recovered.retry.generation, "stale retry undid recovery");
|
|
575
|
+
const completed = yield* store.changeDelivery(selected.key, selected.deliveryId, {
|
|
576
|
+
_tag: "Complete",
|
|
577
|
+
receipt,
|
|
578
|
+
nowMillis: 70
|
|
579
|
+
});
|
|
580
|
+
yield* ensure(completed.receipt?.receiptId === receipt.receiptId && completed.envelopeDigest === digest("4"), "late receipt or immutable envelope was lost");
|
|
581
|
+
})),
|
|
582
|
+
conformanceCase("advances bounded maintenance beyond protected oldest events", (ensure) => Effect.gen(function* () {
|
|
583
|
+
const store = yield* SubscriptionStore;
|
|
584
|
+
const policy = {
|
|
585
|
+
replayHorizonMillis: 1e3,
|
|
586
|
+
completedRetentionMillis: 0,
|
|
587
|
+
maxTombstones: 8
|
|
588
|
+
};
|
|
589
|
+
const limits = {
|
|
590
|
+
...defaultSubscriptionLimits,
|
|
591
|
+
retention: policy
|
|
592
|
+
};
|
|
593
|
+
for (let index = 0; index < 6; index++) {
|
|
594
|
+
const accepted = yield* store.accept({
|
|
595
|
+
...event(`protected-${index}`),
|
|
596
|
+
occurredAtMillis: 0,
|
|
597
|
+
acceptedAtMillis: 0
|
|
598
|
+
}, limits);
|
|
599
|
+
if (index === 5) yield* store.select(accepted, [], 0, true, 0, limits);
|
|
600
|
+
}
|
|
601
|
+
yield* TestClock.setTime(10);
|
|
602
|
+
for (let pass = 0; pass < 8; pass++) yield* store.compact(10, policy, 1);
|
|
603
|
+
yield* ensure((yield* store.event("protected-5"))?.tombstone === true, "protected first pages starved a reclaimable event");
|
|
604
|
+
yield* ensure((yield* store.event("protected-0"))?.tombstone !== true, "unfinished event was reclaimed");
|
|
605
|
+
yield* TestClock.setTime(1001);
|
|
606
|
+
for (let pass = 0; pass < 8; pass++) yield* store.compact(1001, policy, 1);
|
|
607
|
+
yield* ensure((yield* store.event("protected-5")) === null, "idle maintenance did not expire tombstone");
|
|
608
|
+
const rejected = yield* store.accept({
|
|
609
|
+
...event("protected-5"),
|
|
610
|
+
occurredAtMillis: 0
|
|
611
|
+
}, limits).pipe(Effect.result);
|
|
612
|
+
yield* ensure(Result.isFailure(rejected), "retention state became inconsistent");
|
|
613
|
+
})),
|
|
614
|
+
sustainedRetention,
|
|
615
|
+
revisionsAndRetention,
|
|
616
|
+
cutoffAndIntake,
|
|
617
|
+
onceAndCapacity,
|
|
618
|
+
preparationLifecycle,
|
|
619
|
+
catchUpAndCursors,
|
|
620
|
+
replayUnderTighterLimits
|
|
621
|
+
];
|
|
622
|
+
//#endregion
|
|
623
|
+
export { SubscriptionStoreConformanceViolation, subscriptionConformancePartition, subscriptionStoreConformanceCases };
|
|
624
|
+
|
|
625
|
+
//# sourceMappingURL=SubscriptionStoreConformance.mjs.map
|