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,269 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
import { ThreadId, RunId, ToolCallId } from "../core/Identifiers.ts";
|
|
4
|
+
import { EMPTY_TAIL_DIGEST } from "./Digest.ts";
|
|
5
|
+
import type { CanonicalRecordEnvelope } from "./Records.ts";
|
|
6
|
+
import {
|
|
7
|
+
AbortRequested,
|
|
8
|
+
CanonicalSequence,
|
|
9
|
+
Digest,
|
|
10
|
+
PersistedJson,
|
|
11
|
+
SubagentJoined,
|
|
12
|
+
SubagentLineageRecorded,
|
|
13
|
+
SubagentRequested,
|
|
14
|
+
SubagentStarted,
|
|
15
|
+
SubmissionSettledRecord,
|
|
16
|
+
ToolApprovalDecided,
|
|
17
|
+
ToolApprovalRequested,
|
|
18
|
+
ToolCallPrepared,
|
|
19
|
+
ToolCallUnknown,
|
|
20
|
+
} from "./Records.ts";
|
|
21
|
+
|
|
22
|
+
/** One prepared ordinary Tool Call still awaiting a canonical settled/resolved outcome. */
|
|
23
|
+
export class OpenToolCallState extends Schema.Class<OpenToolCallState>(
|
|
24
|
+
"@effect-agent/thread/OpenToolCallState",
|
|
25
|
+
)({
|
|
26
|
+
toolCallId: ToolCallId,
|
|
27
|
+
toolName: ToolCallPrepared.fields.toolName,
|
|
28
|
+
turn: ToolCallPrepared.fields.turn,
|
|
29
|
+
runId: RunId,
|
|
30
|
+
}) {}
|
|
31
|
+
|
|
32
|
+
/** The canonical approval trail: requests and decisions in canonical order. */
|
|
33
|
+
export const ApprovalRecord = Schema.Union([ToolApprovalRequested, ToolApprovalDecided]);
|
|
34
|
+
export type ApprovalRecord = typeof ApprovalRecord.Type;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Parent-side view of one Subagent Invocation, keyed by the parent Run and Tool Call: the canonical
|
|
38
|
+
* `SubagentRequested`/`SubagentStarted`/`SubagentJoined` payloads as they become canonical
|
|
39
|
+
* in history. A disposable derived view — the canonical records and the child's
|
|
40
|
+
* own Settlement remain the recovery truth (DUR-015).
|
|
41
|
+
*/
|
|
42
|
+
export class SubagentInvocationState extends Schema.Class<SubagentInvocationState>(
|
|
43
|
+
"@effect-agent/thread/SubagentInvocationState",
|
|
44
|
+
)({
|
|
45
|
+
runId: RunId,
|
|
46
|
+
toolCallId: ToolCallId,
|
|
47
|
+
requested: Schema.optionalKey(SubagentRequested),
|
|
48
|
+
started: Schema.optionalKey(SubagentStarted),
|
|
49
|
+
joined: Schema.optionalKey(SubagentJoined),
|
|
50
|
+
}) {}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Rebuildable canonical projection. It contains only canonical values and can be discarded and
|
|
54
|
+
* reconstructed from the record stream at any time.
|
|
55
|
+
*
|
|
56
|
+
* Phase 4 added `settlements` and `abortRequests`; Phase 5 added `openToolCalls` (the
|
|
57
|
+
* prepared-minus-settled/resolved fold), `unknownToolCalls`, and `approvals`; S2 adds
|
|
58
|
+
* `subagentInvocations` (the parent-side requested/started/joined fold) and `parentLink` (the
|
|
59
|
+
* child-side immutable lineage). A checkpoint whose persisted state lacks these fields fails to
|
|
60
|
+
* decode against this schema; callers must reject the checkpoint and rebuild the projection from
|
|
61
|
+
* canonical records (documented disposable-checkpoint behavior, STORE-007/STORE-008).
|
|
62
|
+
* Version 2 scopes Tool identities by Run. Earlier projections must rebuild, including empty
|
|
63
|
+
* invocation views that may have already lost an earlier Run's unresolved Tool evidence.
|
|
64
|
+
* `ModelResponseRecorded` advances `throughSequence` without dedicated projection state: Prompt
|
|
65
|
+
* reconstruction reads canonical records directly.
|
|
66
|
+
*/
|
|
67
|
+
export class ThreadProjection extends Schema.Class<ThreadProjection>(
|
|
68
|
+
"@effect-agent/thread/ThreadProjection",
|
|
69
|
+
)({
|
|
70
|
+
schemaVersion: Schema.Literal(2),
|
|
71
|
+
threadId: ThreadId,
|
|
72
|
+
throughSequence: CanonicalSequence,
|
|
73
|
+
tailDigest: Digest,
|
|
74
|
+
inputs: Schema.Array(PersistedJson),
|
|
75
|
+
modelOutputs: Schema.Array(PersistedJson),
|
|
76
|
+
completedRuns: Schema.Array(RunId),
|
|
77
|
+
failedRuns: Schema.Array(RunId),
|
|
78
|
+
settlements: Schema.Array(SubmissionSettledRecord),
|
|
79
|
+
abortRequests: Schema.Array(AbortRequested),
|
|
80
|
+
openToolCalls: Schema.Array(OpenToolCallState),
|
|
81
|
+
unknownToolCalls: Schema.Array(ToolCallUnknown),
|
|
82
|
+
approvals: Schema.Array(ApprovalRecord),
|
|
83
|
+
subagentInvocations: Schema.Array(SubagentInvocationState),
|
|
84
|
+
parentLink: Schema.optionalKey(SubagentLineageRecorded),
|
|
85
|
+
}) {}
|
|
86
|
+
|
|
87
|
+
export const initialThreadProjection = (threadId: ThreadId): ThreadProjection =>
|
|
88
|
+
ThreadProjection.make({
|
|
89
|
+
schemaVersion: 2,
|
|
90
|
+
threadId,
|
|
91
|
+
throughSequence: Schema.decodeSync(CanonicalSequence)(0),
|
|
92
|
+
tailDigest: EMPTY_TAIL_DIGEST,
|
|
93
|
+
inputs: [],
|
|
94
|
+
modelOutputs: [],
|
|
95
|
+
completedRuns: [],
|
|
96
|
+
failedRuns: [],
|
|
97
|
+
settlements: [],
|
|
98
|
+
abortRequests: [],
|
|
99
|
+
openToolCalls: [],
|
|
100
|
+
unknownToolCalls: [],
|
|
101
|
+
approvals: [],
|
|
102
|
+
subagentInvocations: [],
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Idempotent per-Run-and-Tool-Call upsert of the parent-side Subagent fold. Deterministic record
|
|
107
|
+
* identities make duplicates impossible in one canonical stream; the first canonical payload of
|
|
108
|
+
* each stage wins so a replayed reduce is a no-op.
|
|
109
|
+
*/
|
|
110
|
+
const upsertSubagentInvocation = (
|
|
111
|
+
invocations: ReadonlyArray<SubagentInvocationState>,
|
|
112
|
+
payload: SubagentRequested | SubagentStarted | SubagentJoined,
|
|
113
|
+
): ReadonlyArray<SubagentInvocationState> => {
|
|
114
|
+
const existing = invocations.find(
|
|
115
|
+
(invocation) =>
|
|
116
|
+
invocation.runId === payload.runId && invocation.toolCallId === payload.toolCallId,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const requested =
|
|
120
|
+
existing?.requested ?? (payload._tag === "SubagentRequested" ? payload : undefined);
|
|
121
|
+
|
|
122
|
+
const started = existing?.started ?? (payload._tag === "SubagentStarted" ? payload : undefined);
|
|
123
|
+
const joined = existing?.joined ?? (payload._tag === "SubagentJoined" ? payload : undefined);
|
|
124
|
+
|
|
125
|
+
const next = SubagentInvocationState.make({
|
|
126
|
+
runId: payload.runId,
|
|
127
|
+
toolCallId: payload.toolCallId,
|
|
128
|
+
...(requested === undefined ? {} : { requested }),
|
|
129
|
+
...(started === undefined ? {} : { started }),
|
|
130
|
+
...(joined === undefined ? {} : { joined }),
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
return existing === undefined
|
|
134
|
+
? [...invocations, next]
|
|
135
|
+
: invocations.map((invocation) =>
|
|
136
|
+
invocation.runId === payload.runId && invocation.toolCallId === payload.toolCallId
|
|
137
|
+
? next
|
|
138
|
+
: invocation,
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/** Pure one-record Thread transition. */
|
|
143
|
+
export const reduceThreadRecord = (
|
|
144
|
+
projection: ThreadProjection,
|
|
145
|
+
envelope: CanonicalRecordEnvelope,
|
|
146
|
+
tailDigest: Digest = projection.tailDigest,
|
|
147
|
+
): ThreadProjection => {
|
|
148
|
+
const payload = envelope.record.payload;
|
|
149
|
+
|
|
150
|
+
const inputs =
|
|
151
|
+
payload._tag === "UserInputRecorded"
|
|
152
|
+
? [...projection.inputs, payload.input]
|
|
153
|
+
: projection.inputs;
|
|
154
|
+
|
|
155
|
+
const modelOutputs =
|
|
156
|
+
payload._tag === "ModelCompleted"
|
|
157
|
+
? [...projection.modelOutputs, payload.output]
|
|
158
|
+
: projection.modelOutputs;
|
|
159
|
+
|
|
160
|
+
const completedRuns =
|
|
161
|
+
payload._tag === "RunCompleted"
|
|
162
|
+
? [...projection.completedRuns, payload.runId]
|
|
163
|
+
: projection.completedRuns;
|
|
164
|
+
|
|
165
|
+
const failedRuns =
|
|
166
|
+
payload._tag === "RunFailed"
|
|
167
|
+
? [...projection.failedRuns, payload.runId]
|
|
168
|
+
: projection.failedRuns;
|
|
169
|
+
|
|
170
|
+
const settlements =
|
|
171
|
+
payload._tag === "SubmissionSettled"
|
|
172
|
+
? [...projection.settlements, payload]
|
|
173
|
+
: projection.settlements;
|
|
174
|
+
|
|
175
|
+
const abortRequests =
|
|
176
|
+
payload._tag === "AbortRequested"
|
|
177
|
+
? [...projection.abortRequests, payload]
|
|
178
|
+
: projection.abortRequests;
|
|
179
|
+
|
|
180
|
+
// `ToolCallPrepared` opens a call; `ToolCallSettled` (results batch or late settle) and
|
|
181
|
+
// `ToolCallResolved` (DUR-017) close it. `ToolCallUnknown` does NOT close it: the call stays
|
|
182
|
+
// open until an authorized resolution or a recovered result arrives.
|
|
183
|
+
const openToolCalls =
|
|
184
|
+
payload._tag === "ToolCallPrepared"
|
|
185
|
+
? projection.openToolCalls.some(
|
|
186
|
+
(call) => call.runId === payload.runId && call.toolCallId === payload.toolCallId,
|
|
187
|
+
)
|
|
188
|
+
? projection.openToolCalls
|
|
189
|
+
: [
|
|
190
|
+
...projection.openToolCalls,
|
|
191
|
+
OpenToolCallState.make({
|
|
192
|
+
toolCallId: payload.toolCallId,
|
|
193
|
+
toolName: payload.toolName,
|
|
194
|
+
turn: payload.turn,
|
|
195
|
+
runId: payload.runId,
|
|
196
|
+
}),
|
|
197
|
+
]
|
|
198
|
+
: payload._tag === "ToolCallSettled" || payload._tag === "ToolCallResolved"
|
|
199
|
+
? projection.openToolCalls.filter(
|
|
200
|
+
(call) => call.runId !== payload.runId || call.toolCallId !== payload.toolCallId,
|
|
201
|
+
)
|
|
202
|
+
: projection.openToolCalls;
|
|
203
|
+
|
|
204
|
+
const unknownToolCalls =
|
|
205
|
+
payload._tag === "ToolCallUnknown"
|
|
206
|
+
? [...projection.unknownToolCalls, payload]
|
|
207
|
+
: projection.unknownToolCalls;
|
|
208
|
+
|
|
209
|
+
const approvals =
|
|
210
|
+
payload._tag === "ToolApprovalRequested" || payload._tag === "ToolApprovalDecided"
|
|
211
|
+
? [...projection.approvals, payload]
|
|
212
|
+
: projection.approvals;
|
|
213
|
+
|
|
214
|
+
const subagentInvocations =
|
|
215
|
+
payload._tag === "SubagentRequested" ||
|
|
216
|
+
payload._tag === "SubagentStarted" ||
|
|
217
|
+
payload._tag === "SubagentJoined"
|
|
218
|
+
? upsertSubagentInvocation(projection.subagentInvocations, payload)
|
|
219
|
+
: projection.subagentInvocations;
|
|
220
|
+
|
|
221
|
+
// The child-side lineage is immutable (SUB-004): the first canonical record wins forever.
|
|
222
|
+
const parentLink =
|
|
223
|
+
projection.parentLink ?? (payload._tag === "SubagentLineageRecorded" ? payload : undefined);
|
|
224
|
+
|
|
225
|
+
return ThreadProjection.make({
|
|
226
|
+
schemaVersion: 2,
|
|
227
|
+
threadId: projection.threadId,
|
|
228
|
+
throughSequence: envelope.sequence,
|
|
229
|
+
tailDigest,
|
|
230
|
+
inputs,
|
|
231
|
+
modelOutputs,
|
|
232
|
+
completedRuns,
|
|
233
|
+
failedRuns,
|
|
234
|
+
settlements,
|
|
235
|
+
abortRequests,
|
|
236
|
+
openToolCalls,
|
|
237
|
+
unknownToolCalls,
|
|
238
|
+
approvals,
|
|
239
|
+
subagentInvocations,
|
|
240
|
+
...(parentLink === undefined ? {} : { parentLink }),
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
/** Pure full replay from the canonical beginning. */
|
|
245
|
+
export const replayThread = (
|
|
246
|
+
threadId: ThreadId,
|
|
247
|
+
records: ReadonlyArray<CanonicalRecordEnvelope>,
|
|
248
|
+
tailDigest: Digest = EMPTY_TAIL_DIGEST,
|
|
249
|
+
): ThreadProjection =>
|
|
250
|
+
replayThreadFromCheckpoint(initialThreadProjection(threadId), records, tailDigest);
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Pure checkpoint replay. A validated checkpoint projection and its canonical tail produce the
|
|
254
|
+
* same reducer path as full replay for every later record.
|
|
255
|
+
* Decode persisted state with `ThreadProjection` first; an incompatible state requires full replay.
|
|
256
|
+
*/
|
|
257
|
+
export const replayThreadFromCheckpoint = (
|
|
258
|
+
checkpoint: ThreadProjection,
|
|
259
|
+
records: ReadonlyArray<CanonicalRecordEnvelope>,
|
|
260
|
+
tailDigest: Digest = checkpoint.tailDigest,
|
|
261
|
+
): ThreadProjection => {
|
|
262
|
+
let projection = checkpoint;
|
|
263
|
+
|
|
264
|
+
for (const record of records) {
|
|
265
|
+
projection = reduceThreadRecord(projection, record, tailDigest);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return projection;
|
|
269
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Clock, Context, Effect, Layer, Option, Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
import type { AppendResult, FencedAppendRequest } from "./ThreadStore.ts";
|
|
4
|
+
|
|
5
|
+
/** A derived projection failed; the canonical source remains authoritative. */
|
|
6
|
+
export class ThreadProjectionError extends Schema.TaggedError<ThreadProjectionError>()(
|
|
7
|
+
"ThreadProjectionError",
|
|
8
|
+
{
|
|
9
|
+
operation: Schema.String,
|
|
10
|
+
message: Schema.String,
|
|
11
|
+
cause: Schema.optionalKey(Schema.Defect()),
|
|
12
|
+
},
|
|
13
|
+
) {}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Host-owned, disposable indexes over a canonical Thread. Hooks receive raw local source
|
|
17
|
+
* ports at construction and must not mutate them or acquire source producer ownership.
|
|
18
|
+
* Rows and their contiguous watermark commit atomically; an empty projection still consumes
|
|
19
|
+
* its record. Concurrent work must compare the starting watermark before committing.
|
|
20
|
+
*
|
|
21
|
+
* No method owns a scheduler. The platform owns wakeups, durable scheduling metadata and
|
|
22
|
+
* source-producer fencing. Per-call resources belong to Scope; interruption remains interruption.
|
|
23
|
+
*/
|
|
24
|
+
export interface ThreadProjectionMaintenanceService {
|
|
25
|
+
/**
|
|
26
|
+
* Runs after a successful source commit and before dependent Tools can execute. An index
|
|
27
|
+
* caught up through firstSequence - 1 must process the entire committed range, including
|
|
28
|
+
* empty records, before returning. Canonical batches contain at most 256 records: chunk
|
|
29
|
+
* within local byte limits and stop at result.lastSequence, never chase a changing tail.
|
|
30
|
+
* An earlier gap defers to drain. Replayed or superseded ranges are idempotent no-ops.
|
|
31
|
+
* Failure must leave the unprocessed prefix visible to pendingDeadline.
|
|
32
|
+
*/
|
|
33
|
+
readonly applyCommitted: (
|
|
34
|
+
request: FencedAppendRequest,
|
|
35
|
+
result: AppendResult,
|
|
36
|
+
) => Effect.Effect<void, ThreadProjectionError>;
|
|
37
|
+
/** One bounded, restartable backfill batch. Never drain until caught up in a loop. */
|
|
38
|
+
readonly drain: Effect.Effect<void, ThreadProjectionError>;
|
|
39
|
+
/**
|
|
40
|
+
* Bounded local inspection. None means caught up; a pending epoch-millisecond deadline
|
|
41
|
+
* survives reconstruction and repeated reads must not postpone it. Projection backlog
|
|
42
|
+
* does not gate canonical execution or host approval publication.
|
|
43
|
+
*/
|
|
44
|
+
readonly pendingDeadline: Effect.Effect<Option.Option<number>, ThreadProjectionError>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export class ThreadProjectionMaintenance extends Context.Service<
|
|
48
|
+
ThreadProjectionMaintenance,
|
|
49
|
+
ThreadProjectionMaintenanceService
|
|
50
|
+
>()("@effect-agent/thread/ThreadProjectionMaintenance") {
|
|
51
|
+
static readonly layer = Layer.succeed(this)({
|
|
52
|
+
applyCommitted: () => Effect.void,
|
|
53
|
+
drain: Effect.void,
|
|
54
|
+
pendingDeadline: Effect.succeed(Option.none()),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Run at most one due backfill batch, preserving typed failures, defects and interruption. */
|
|
59
|
+
export const drainDue = Effect.gen(function* () {
|
|
60
|
+
const projection = yield* ThreadProjectionMaintenance;
|
|
61
|
+
const deadline = yield* projection.pendingDeadline;
|
|
62
|
+
|
|
63
|
+
if (Option.isNone(deadline) || deadline.value > (yield* Clock.currentTimeMillis)) return false;
|
|
64
|
+
yield* projection.drain;
|
|
65
|
+
|
|
66
|
+
return true;
|
|
67
|
+
});
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import type { Effect, Option, Stream } from "effect";
|
|
2
|
+
import { Context, Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
import { ThreadId } from "../core/Identifiers.ts";
|
|
5
|
+
import {
|
|
6
|
+
BatchId,
|
|
7
|
+
CanonicalBatch,
|
|
8
|
+
CanonicalRecordEnvelope,
|
|
9
|
+
CanonicalSequence,
|
|
10
|
+
Digest,
|
|
11
|
+
ObservationOffset,
|
|
12
|
+
PersistedJson,
|
|
13
|
+
ProducerEpoch,
|
|
14
|
+
} from "./Records.ts";
|
|
15
|
+
|
|
16
|
+
export class ThreadMaterialization extends Schema.Class<ThreadMaterialization>(
|
|
17
|
+
"@effect-agent/thread/ThreadMaterialization",
|
|
18
|
+
)({
|
|
19
|
+
threadId: ThreadId,
|
|
20
|
+
producerEpoch: ProducerEpoch,
|
|
21
|
+
}) {}
|
|
22
|
+
|
|
23
|
+
export class FencedAppendRequest extends Schema.Class<FencedAppendRequest>(
|
|
24
|
+
"@effect-agent/thread/FencedAppendRequest",
|
|
25
|
+
)({
|
|
26
|
+
threadId: ThreadId,
|
|
27
|
+
batch: CanonicalBatch,
|
|
28
|
+
expectedTailSequence: CanonicalSequence,
|
|
29
|
+
expectedTailDigest: Digest,
|
|
30
|
+
producerEpoch: ProducerEpoch,
|
|
31
|
+
}) {}
|
|
32
|
+
|
|
33
|
+
export class AppendResult extends Schema.Class<AppendResult>("@effect-agent/thread/AppendResult")({
|
|
34
|
+
firstSequence: CanonicalSequence,
|
|
35
|
+
lastSequence: CanonicalSequence,
|
|
36
|
+
tailDigest: Digest,
|
|
37
|
+
replayed: Schema.Boolean,
|
|
38
|
+
}) {}
|
|
39
|
+
|
|
40
|
+
export class ThreadRead extends Schema.Class<ThreadRead>("@effect-agent/thread/ThreadRead")({
|
|
41
|
+
threadId: ThreadId,
|
|
42
|
+
afterSequence: Schema.optionalKey(CanonicalSequence),
|
|
43
|
+
limit: Schema.Natural.check(Schema.isGreaterThan(0), Schema.isLessThanOrEqualTo(1_024)),
|
|
44
|
+
}) {}
|
|
45
|
+
|
|
46
|
+
export class ThreadObservation extends Schema.Class<ThreadObservation>(
|
|
47
|
+
"@effect-agent/thread/ThreadObservation",
|
|
48
|
+
)({
|
|
49
|
+
threadId: ThreadId,
|
|
50
|
+
afterOffset: Schema.optionalKey(ObservationOffset),
|
|
51
|
+
}) {}
|
|
52
|
+
|
|
53
|
+
export class ThreadExportRequest extends Schema.Class<ThreadExportRequest>(
|
|
54
|
+
"@effect-agent/thread/ThreadExportRequest",
|
|
55
|
+
)({
|
|
56
|
+
threadId: ThreadId,
|
|
57
|
+
}) {}
|
|
58
|
+
|
|
59
|
+
export class ThreadTailRequest extends Schema.Class<ThreadTailRequest>(
|
|
60
|
+
"@effect-agent/thread/ThreadTailRequest",
|
|
61
|
+
)({
|
|
62
|
+
threadId: ThreadId,
|
|
63
|
+
}) {}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The committed tail of one Thread Log. A resuming producer composes its next
|
|
67
|
+
* FencedAppendRequest from this value instead of exporting the whole log.
|
|
68
|
+
*/
|
|
69
|
+
export class ThreadTail extends Schema.Class<ThreadTail>("@effect-agent/thread/ThreadTail")({
|
|
70
|
+
threadId: ThreadId,
|
|
71
|
+
tailSequence: CanonicalSequence,
|
|
72
|
+
tailDigest: Digest,
|
|
73
|
+
producerEpoch: ProducerEpoch,
|
|
74
|
+
}) {}
|
|
75
|
+
|
|
76
|
+
/** Maximum canonical records represented by one Thread export. */
|
|
77
|
+
export const MAX_THREAD_EXPORT_RECORDS = 131_072;
|
|
78
|
+
|
|
79
|
+
export class ThreadExport extends Schema.Class<ThreadExport>("@effect-agent/thread/ThreadExport")({
|
|
80
|
+
format: Schema.Literal("effect-agent/thread@1"),
|
|
81
|
+
threadId: ThreadId,
|
|
82
|
+
tailSequence: CanonicalSequence,
|
|
83
|
+
tailDigest: Digest,
|
|
84
|
+
records: Schema.Array(CanonicalRecordEnvelope).check(
|
|
85
|
+
Schema.isMaxLength(MAX_THREAD_EXPORT_RECORDS),
|
|
86
|
+
),
|
|
87
|
+
}) {}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* A disposable projection snapshot. Adapters bind its sequence and digest to the canonical
|
|
91
|
+
* log; consumers decode `state` and decide projection compatibility before suffix replay.
|
|
92
|
+
* Legacy metadata is optional for application projections and preserved when supplied.
|
|
93
|
+
* Runtime-owned recovery checkpoints populate and compare it before using cached state.
|
|
94
|
+
*/
|
|
95
|
+
export class ThreadCheckpoint extends Schema.Class<ThreadCheckpoint>(
|
|
96
|
+
"@effect-agent/thread/ThreadCheckpoint",
|
|
97
|
+
)({
|
|
98
|
+
schemaVersion: Schema.Literal(1),
|
|
99
|
+
threadId: ThreadId,
|
|
100
|
+
throughSequence: CanonicalSequence,
|
|
101
|
+
tailDigest: Digest,
|
|
102
|
+
/** @deprecated For application projections; retained for existing data and runtime recovery. */
|
|
103
|
+
engineVersion: Schema.optionalKey(Schema.NonEmptyString),
|
|
104
|
+
/** @deprecated For application projections; retained for existing data and runtime recovery. */
|
|
105
|
+
agentDefinitionDigest: Schema.optionalKey(Digest),
|
|
106
|
+
/** @deprecated For application projections; retained for existing data and runtime recovery. */
|
|
107
|
+
modelDigest: Schema.optionalKey(Digest),
|
|
108
|
+
/** @deprecated For application projections; retained for existing data and runtime recovery. */
|
|
109
|
+
toolDigest: Schema.optionalKey(Digest),
|
|
110
|
+
state: PersistedJson,
|
|
111
|
+
createdAt: Schema.DateTimeUtcFromString,
|
|
112
|
+
}) {}
|
|
113
|
+
|
|
114
|
+
export class SaveCheckpointRequest extends Schema.Class<SaveCheckpointRequest>(
|
|
115
|
+
"@effect-agent/thread/SaveCheckpointRequest",
|
|
116
|
+
)({
|
|
117
|
+
checkpoint: ThreadCheckpoint,
|
|
118
|
+
}) {}
|
|
119
|
+
|
|
120
|
+
/** Replace the disposable recovery view only under the current canonical producer fence. */
|
|
121
|
+
export class SaveRecoveryCheckpointRequest extends Schema.Class<SaveRecoveryCheckpointRequest>(
|
|
122
|
+
"@effect-agent/thread/SaveRecoveryCheckpointRequest",
|
|
123
|
+
)({
|
|
124
|
+
checkpoint: ThreadCheckpoint,
|
|
125
|
+
producerEpoch: ProducerEpoch,
|
|
126
|
+
}) {}
|
|
127
|
+
|
|
128
|
+
export class LoadCheckpointRequest extends Schema.Class<LoadCheckpointRequest>(
|
|
129
|
+
"@effect-agent/thread/LoadCheckpointRequest",
|
|
130
|
+
)({
|
|
131
|
+
threadId: ThreadId,
|
|
132
|
+
atOrBeforeSequence: Schema.optionalKey(CanonicalSequence),
|
|
133
|
+
}) {}
|
|
134
|
+
|
|
135
|
+
export class ThreadStoreError extends Schema.TaggedError<ThreadStoreError>()("ThreadStoreError", {
|
|
136
|
+
operation: Schema.String,
|
|
137
|
+
message: Schema.String,
|
|
138
|
+
cause: Schema.optionalKey(Schema.Defect()),
|
|
139
|
+
}) {}
|
|
140
|
+
|
|
141
|
+
export class ThreadNotMaterialized extends Schema.TaggedError<ThreadNotMaterialized>()(
|
|
142
|
+
"ThreadNotMaterialized",
|
|
143
|
+
{ threadId: ThreadId },
|
|
144
|
+
) {}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* A canonical append that cannot commit: `batch-digest` replays a batch ID with different
|
|
148
|
+
* content, `record-identity` reuses a canonical record ID, and `tail` declares a stale expected
|
|
149
|
+
* tail. Tail conflicts carry the actual committed tail as a diagnostic resume hint.
|
|
150
|
+
*/
|
|
151
|
+
export class AppendConflict extends Schema.TaggedError<AppendConflict>()("AppendConflict", {
|
|
152
|
+
threadId: ThreadId,
|
|
153
|
+
batchId: BatchId,
|
|
154
|
+
reason: Schema.Literals(["batch-digest", "record-identity", "tail"]),
|
|
155
|
+
actualTailSequence: Schema.optionalKey(CanonicalSequence),
|
|
156
|
+
actualTailDigest: Schema.optionalKey(Digest),
|
|
157
|
+
}) {}
|
|
158
|
+
|
|
159
|
+
export class FenceRejected extends Schema.TaggedError<FenceRejected>()("FenceRejected", {
|
|
160
|
+
threadId: ThreadId,
|
|
161
|
+
actualEpoch: ProducerEpoch,
|
|
162
|
+
attemptedEpoch: ProducerEpoch,
|
|
163
|
+
}) {}
|
|
164
|
+
|
|
165
|
+
export class CheckpointRejected extends Schema.TaggedError<CheckpointRejected>()(
|
|
166
|
+
"CheckpointRejected",
|
|
167
|
+
{
|
|
168
|
+
threadId: ThreadId,
|
|
169
|
+
reason: Schema.Literals(["ahead-of-tail", "digest-mismatch", "unsupported-version", "corrupt"]),
|
|
170
|
+
},
|
|
171
|
+
) {}
|
|
172
|
+
|
|
173
|
+
export type ThreadStoreFailure =
|
|
174
|
+
| ThreadStoreError
|
|
175
|
+
| ThreadNotMaterialized
|
|
176
|
+
| AppendConflict
|
|
177
|
+
| FenceRejected;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Optional, disposable projection storage. Neither history execution nor durable recovery
|
|
181
|
+
* requires it. Adapters that offer it must bind every checkpoint to a canonical batch tail.
|
|
182
|
+
* Application consumers own projection compatibility; this port does not interpret metadata.
|
|
183
|
+
*/
|
|
184
|
+
export interface ThreadCheckpoints {
|
|
185
|
+
readonly save: (
|
|
186
|
+
request: SaveCheckpointRequest,
|
|
187
|
+
) => Effect.Effect<void, ThreadStoreError | ThreadNotMaterialized | CheckpointRejected>;
|
|
188
|
+
readonly load: (
|
|
189
|
+
request: LoadCheckpointRequest,
|
|
190
|
+
) => Effect.Effect<
|
|
191
|
+
Option.Option<ThreadCheckpoint>,
|
|
192
|
+
ThreadStoreError | ThreadNotMaterialized | CheckpointRejected
|
|
193
|
+
>;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Optional latest-only recovery cache, independent of application projection checkpoints.
|
|
198
|
+
* Saves atomically validate the producer epoch and canonical batch tail. An older snapshot
|
|
199
|
+
* cannot replace a newer one; equal-tail replacement repairs disposable state. Invalid cached
|
|
200
|
+
* data fails with CheckpointRejected, while infrastructure failures remain ThreadStoreError.
|
|
201
|
+
* Loading at an earlier tail or outside the adapter's cache locality may return none so callers
|
|
202
|
+
* can replay canonical records. Canonical records and the ledger remain authority.
|
|
203
|
+
*/
|
|
204
|
+
export interface ThreadRecoveryCheckpoints {
|
|
205
|
+
readonly save: (
|
|
206
|
+
request: SaveRecoveryCheckpointRequest,
|
|
207
|
+
) => Effect.Effect<
|
|
208
|
+
void,
|
|
209
|
+
ThreadStoreError | ThreadNotMaterialized | CheckpointRejected | FenceRejected
|
|
210
|
+
>;
|
|
211
|
+
readonly load: ThreadCheckpoints["load"];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export class ThreadStore extends Context.Service<
|
|
215
|
+
ThreadStore,
|
|
216
|
+
{
|
|
217
|
+
readonly materialize: (
|
|
218
|
+
request: ThreadMaterialization,
|
|
219
|
+
) => Effect.Effect<void, ThreadStoreError | FenceRejected>;
|
|
220
|
+
readonly append: (
|
|
221
|
+
request: FencedAppendRequest,
|
|
222
|
+
) => Effect.Effect<
|
|
223
|
+
AppendResult,
|
|
224
|
+
ThreadStoreError | ThreadNotMaterialized | AppendConflict | FenceRejected
|
|
225
|
+
>;
|
|
226
|
+
readonly read: (
|
|
227
|
+
request: ThreadRead,
|
|
228
|
+
) => Stream.Stream<CanonicalRecordEnvelope, ThreadStoreError | ThreadNotMaterialized>;
|
|
229
|
+
readonly observe: (
|
|
230
|
+
request: ThreadObservation,
|
|
231
|
+
) => Stream.Stream<CanonicalRecordEnvelope, ThreadStoreError | ThreadNotMaterialized>;
|
|
232
|
+
readonly export: (
|
|
233
|
+
request: ThreadExportRequest,
|
|
234
|
+
) => Effect.Effect<ThreadExport, ThreadStoreError | ThreadNotMaterialized>;
|
|
235
|
+
readonly inspectTail: (
|
|
236
|
+
request: ThreadTailRequest,
|
|
237
|
+
) => Effect.Effect<ThreadTail, ThreadStoreError | ThreadNotMaterialized>;
|
|
238
|
+
/** Absent when this adapter does not support disposable checkpoints. */
|
|
239
|
+
readonly checkpoints?: ThreadCheckpoints | undefined;
|
|
240
|
+
readonly recoveryCheckpoints?: ThreadRecoveryCheckpoints | undefined;
|
|
241
|
+
}
|
|
242
|
+
>()("@effect-agent/thread/ThreadStore") {}
|