effect-agent 0.1.0-beta.11 → 0.1.0-beta.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Agent-1DMSO_Fl.mjs +86 -0
- package/dist/Agent-1DMSO_Fl.mjs.map +1 -0
- package/dist/Agent-DriBcXBN.d.mts +245 -0
- package/dist/AgentError-Bn1ytXRD.d.mts +117 -0
- package/dist/AgentPolicy-BqDoSXO6.d.mts +96 -0
- package/dist/AgentRuntime-CWkHuzyt.d.mts +346 -0
- package/dist/AgentRuntime-DLwPoEVH.mjs +4735 -0
- package/dist/AgentRuntime-DLwPoEVH.mjs.map +1 -0
- package/dist/AgentUpdates-DMJ-_xow.d.mts +53 -0
- package/dist/ContextCompactor-WwSIG_Z2.d.mts +161 -0
- package/dist/ContextWindow-DRQ5Mbm2.d.mts +58 -0
- package/dist/DurableAgentRuntime-PyIgNYXF.mjs +6772 -0
- package/dist/DurableAgentRuntime-PyIgNYXF.mjs.map +1 -0
- package/dist/DurableFailpoint-mx3-nsxU.d.mts +41 -0
- package/dist/DurableStep-Cry_iol4.d.mts +103 -0
- package/dist/EventSource-BUYLmL77.d.mts +51 -0
- package/dist/FailureDiagnostic-BElLOoED.mjs +274 -0
- package/dist/FailureDiagnostic-BElLOoED.mjs.map +1 -0
- package/dist/FailureDiagnostic-CaAkzGHL.d.mts +223 -0
- package/dist/Identifiers-CN2s30fF.d.mts +40 -0
- package/dist/InMemory.d.mts +24 -0
- package/dist/InMemory.mjs +24 -0
- package/dist/InMemory.mjs.map +1 -0
- package/dist/MemoryNamespace-BbRW5p71.d.mts +36 -0
- package/dist/MemoryReference-B8Q3UJoJ.d.mts +79 -0
- package/dist/Messaging-DaZDlBqh.d.mts +1067 -0
- package/dist/Messaging-Dkg87ebg.d.mts +221 -0
- package/dist/MessagingHost-D89X7ma8.mjs +110 -0
- package/dist/MessagingHost-D89X7ma8.mjs.map +1 -0
- package/dist/MessagingHost-e1Sbzfao.d.mts +74 -0
- package/dist/OperationAuthorizer-TzcQtpX5.d.mts +61 -0
- package/dist/Output-CAFJTAbP.d.mts +25 -0
- package/dist/PageCapture-Df8Xwskw.d.mts +583 -0
- package/dist/PageScreenshot-BpgZKAxl.d.mts +48 -0
- package/dist/PreparedInputAdmission-J3YK6LAm.d.mts +42 -0
- package/dist/Receipt-BAHyigAF.d.mts +33 -0
- package/dist/Records-4qnRmniE.d.mts +4058 -0
- package/dist/RunEvent-DIrzkjLr.d.mts +460 -0
- package/dist/RunEventSink-D5aVhISG.d.mts +108 -0
- package/dist/RunJournal-BXrq0VIK.mjs +931 -0
- package/dist/RunJournal-BXrq0VIK.mjs.map +1 -0
- package/dist/RunOptions-BoESJrxw.d.mts +935 -0
- package/dist/RunPolicyUsage-ClZxyR46.d.mts +21 -0
- package/dist/Sandbox-CEsDWBLq.d.mts +173 -0
- package/dist/Schedule-C2lH2kxY.d.mts +847 -0
- package/dist/Scheduling-DPb2QyAK.mjs +691 -0
- package/dist/Scheduling-DPb2QyAK.mjs.map +1 -0
- package/dist/Subagent-D9eYdGTl.mjs +1537 -0
- package/dist/Subagent-D9eYdGTl.mjs.map +1 -0
- package/dist/Subagent-F72tuaxy.d.mts +1360 -0
- package/dist/SubagentContract-DdT7Cqe6.d.mts +116 -0
- package/dist/SubagentHost-CmiNTOBZ.d.mts +149 -0
- package/dist/Subscription-pQUv0QD6.d.mts +945 -0
- package/dist/SubscriptionInput-DdJOiNMY.d.mts +41 -0
- package/dist/Thread-DOBQ0QUY.d.mts +96 -0
- package/dist/ThreadHistory-tS1KwxHR.d.mts +60 -0
- package/dist/ToolBroker-DWs4tZra.d.mts +133 -0
- package/dist/ToolExposure-9uF_Yo0T.mjs +10 -0
- package/dist/ToolExposure-9uF_Yo0T.mjs.map +1 -0
- package/dist/ToolExposure-C93U1sPu.mjs +30 -0
- package/dist/ToolExposure-C93U1sPu.mjs.map +1 -0
- package/dist/ToolExposure-UCN12eCd.d.mts +39 -0
- package/dist/ToolExposure-r2eOWk4F.d.mts +46 -0
- package/dist/ToolExposure.d.mts +8 -0
- package/dist/ToolExposure.mjs +21 -0
- package/dist/ToolExposure.mjs.map +1 -0
- package/dist/ToolReconciler-BmVRAHKs.d.mts +80 -0
- package/dist/ToolResult-BKdqWRff.d.mts +78 -0
- package/dist/Usage-Dx0aknfk.d.mts +121 -0
- package/dist/WakeScheduler-EjUF-GhC.d.mts +56 -0
- package/dist/Worker-Du9dhVnp.d.mts +279 -0
- package/dist/Worker-T_3RbaKc.mjs +210 -0
- package/dist/Worker-T_3RbaKc.mjs.map +1 -0
- package/dist/agent-registration-B5CI-Ygk.mjs +201 -0
- package/dist/agent-registration-B5CI-Ygk.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 +152 -0
- package/dist/capabilities/Messaging.mjs.map +1 -0
- package/dist/capabilities/ModelContext.d.mts +89 -0
- package/dist/capabilities/ModelContext.mjs +168 -0
- package/dist/capabilities/ModelContext.mjs.map +1 -0
- package/dist/capabilities/Redaction.d.mts +37 -0
- package/dist/capabilities/Redaction.mjs +104 -0
- package/dist/capabilities/Redaction.mjs.map +1 -0
- package/dist/capabilities/Remembering.d.mts +434 -0
- package/dist/capabilities/Remembering.mjs +290 -0
- package/dist/capabilities/Remembering.mjs.map +1 -0
- package/dist/capabilities/RunHooks.d.mts +82 -0
- package/dist/capabilities/RunHooks.mjs +144 -0
- package/dist/capabilities/RunHooks.mjs.map +1 -0
- package/dist/capabilities/SemanticMemory.d.mts +431 -0
- package/dist/capabilities/SemanticMemory.mjs +315 -0
- package/dist/capabilities/SemanticMemory.mjs.map +1 -0
- package/dist/capabilities/Subagent.d.mts +4 -0
- package/dist/capabilities/Subagent.mjs +5 -0
- package/dist/capabilities/SubagentReservations.d.mts +186 -0
- package/dist/capabilities/SubagentReservations.mjs +479 -0
- package/dist/capabilities/SubagentReservations.mjs.map +1 -0
- package/dist/capabilities/ToolDiscovery.d.mts +124 -0
- package/dist/capabilities/ToolDiscovery.mjs +230 -0
- package/dist/capabilities/ToolDiscovery.mjs.map +1 -0
- package/dist/capabilities/WebCapture.d.mts +163 -0
- package/dist/capabilities/WebCapture.mjs +335 -0
- package/dist/capabilities/WebCapture.mjs.map +1 -0
- package/dist/capabilities/WebSearch.d.mts +71 -0
- package/dist/capabilities/WebSearch.mjs +115 -0
- package/dist/capabilities/WebSearch.mjs.map +1 -0
- package/dist/compaction-C2OTceKw.mjs +505 -0
- package/dist/compaction-C2OTceKw.mjs.map +1 -0
- package/dist/core/Agent.d.mts +2 -0
- package/dist/core/Agent.mjs +2 -0
- package/dist/core/AgentError.d.mts +2 -0
- package/dist/core/AgentError.mjs +134 -0
- package/dist/core/AgentError.mjs.map +1 -0
- package/dist/core/AgentPolicy.d.mts +2 -0
- package/dist/core/AgentPolicy.mjs +94 -0
- package/dist/core/AgentPolicy.mjs.map +1 -0
- package/dist/core/AgentUpdates.d.mts +2 -0
- package/dist/core/AgentUpdates.mjs +63 -0
- package/dist/core/AgentUpdates.mjs.map +1 -0
- package/dist/core/FailureDiagnostic.d.mts +2 -0
- package/dist/core/FailureDiagnostic.mjs +2 -0
- package/dist/core/IdGenerator.d.mts +26 -0
- package/dist/core/IdGenerator.mjs +27 -0
- package/dist/core/IdGenerator.mjs.map +1 -0
- package/dist/core/Identifiers.d.mts +2 -0
- package/dist/core/Identifiers.mjs +43 -0
- package/dist/core/Identifiers.mjs.map +1 -0
- package/dist/core/Memory.d.mts +57 -0
- package/dist/core/Memory.mjs +203 -0
- package/dist/core/Memory.mjs.map +1 -0
- package/dist/core/MemoryNamespace.d.mts +2 -0
- package/dist/core/MemoryNamespace.mjs +116 -0
- package/dist/core/MemoryNamespace.mjs.map +1 -0
- package/dist/core/MemoryReference.d.mts +2 -0
- package/dist/core/MemoryReference.mjs +109 -0
- package/dist/core/MemoryReference.mjs.map +1 -0
- package/dist/core/MemoryRevalidation.d.mts +65 -0
- package/dist/core/MemoryRevalidation.mjs +126 -0
- package/dist/core/MemoryRevalidation.mjs.map +1 -0
- package/dist/core/MemoryStore.d.mts +186 -0
- package/dist/core/MemoryStore.mjs +243 -0
- package/dist/core/MemoryStore.mjs.map +1 -0
- package/dist/core/Receipt.d.mts +2 -0
- package/dist/core/Receipt.mjs +36 -0
- package/dist/core/Receipt.mjs.map +1 -0
- package/dist/core/RememberingStore.d.mts +1562 -0
- package/dist/core/RememberingStore.mjs +190 -0
- package/dist/core/RememberingStore.mjs.map +1 -0
- package/dist/core/RunEvent.d.mts +2 -0
- package/dist/core/RunEvent.mjs +337 -0
- package/dist/core/RunEvent.mjs.map +1 -0
- package/dist/core/RunPolicyUsage.d.mts +2 -0
- package/dist/core/RunPolicyUsage.mjs +21 -0
- package/dist/core/RunPolicyUsage.mjs.map +1 -0
- package/dist/core/SemanticMemoryIndex.d.mts +826 -0
- package/dist/core/SemanticMemoryIndex.mjs +185 -0
- package/dist/core/SemanticMemoryIndex.mjs.map +1 -0
- package/dist/core/SemanticMemoryRevalidation.d.mts +45 -0
- package/dist/core/SemanticMemoryRevalidation.mjs +191 -0
- package/dist/core/SemanticMemoryRevalidation.mjs.map +1 -0
- package/dist/core/SubagentContract.d.mts +2 -0
- package/dist/core/SubagentContract.mjs +148 -0
- package/dist/core/SubagentContract.mjs.map +1 -0
- package/dist/core/Thread.d.mts +2 -0
- package/dist/core/Thread.mjs +250 -0
- package/dist/core/Thread.mjs.map +1 -0
- package/dist/core/ToolResult.d.mts +2 -0
- package/dist/core/ToolResult.mjs +156 -0
- package/dist/core/ToolResult.mjs.map +1 -0
- package/dist/core/Usage.d.mts +2 -0
- package/dist/core/Usage.mjs +319 -0
- package/dist/core/Usage.mjs.map +1 -0
- package/dist/core/Worker.d.mts +3 -0
- package/dist/core/Worker.mjs +3 -0
- package/dist/durable/ActivityStore.d.mts +116 -0
- package/dist/durable/ActivityStore.mjs +131 -0
- package/dist/durable/ActivityStore.mjs.map +1 -0
- package/dist/durable/Admin.d.mts +2 -0
- package/dist/durable/Admin.mjs +330 -0
- package/dist/durable/Admin.mjs.map +1 -0
- package/dist/durable/AgentRegistration.d.mts +2 -0
- package/dist/durable/AgentRegistration.mjs +14 -0
- package/dist/durable/AgentRegistration.mjs.map +1 -0
- package/dist/durable/Certification.d.mts +110 -0
- package/dist/durable/Certification.mjs +159 -0
- package/dist/durable/Certification.mjs.map +1 -0
- package/dist/durable/CommittedActivity.d.mts +62 -0
- package/dist/durable/CommittedActivity.mjs +159 -0
- package/dist/durable/CommittedActivity.mjs.map +1 -0
- package/dist/durable/Digest.d.mts +2 -0
- package/dist/durable/Digest.mjs +50 -0
- package/dist/durable/Digest.mjs.map +1 -0
- package/dist/durable/DurableAgentRuntime.d.mts +3 -0
- package/dist/durable/DurableAgentRuntime.mjs +3 -0
- package/dist/durable/DurableFailpoint.d.mts +2 -0
- package/dist/durable/DurableFailpoint.mjs +98 -0
- package/dist/durable/DurableFailpoint.mjs.map +1 -0
- package/dist/durable/DurableFailpointTestControl.d.mts +14 -0
- package/dist/durable/DurableFailpointTestControl.mjs +19 -0
- package/dist/durable/DurableFailpointTestControl.mjs.map +1 -0
- package/dist/durable/EventSource.d.mts +2 -0
- package/dist/durable/EventSource.mjs +65 -0
- package/dist/durable/EventSource.mjs.map +1 -0
- package/dist/durable/GitHubWorkflowSource.d.mts +185 -0
- package/dist/durable/GitHubWorkflowSource.mjs +209 -0
- package/dist/durable/GitHubWorkflowSource.mjs.map +1 -0
- package/dist/durable/MessageDelivery.d.mts +876 -0
- package/dist/durable/MessageDelivery.mjs +549 -0
- package/dist/durable/MessageDelivery.mjs.map +1 -0
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +376 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs +270 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs.map +1 -0
- package/dist/durable/OperationAuthorizer.d.mts +2 -0
- package/dist/durable/OperationAuthorizer.mjs +70 -0
- package/dist/durable/OperationAuthorizer.mjs.map +1 -0
- package/dist/durable/PersistentHistory.d.mts +16 -0
- package/dist/durable/PersistentHistory.mjs +125 -0
- package/dist/durable/PersistentHistory.mjs.map +1 -0
- package/dist/durable/PreparedInputAdmission.d.mts +2 -0
- package/dist/durable/PreparedInputAdmission.mjs +38 -0
- package/dist/durable/PreparedInputAdmission.mjs.map +1 -0
- package/dist/durable/Records.d.mts +2 -0
- package/dist/durable/Records.mjs +841 -0
- package/dist/durable/Records.mjs.map +1 -0
- package/dist/durable/Recovery.d.mts +2 -0
- package/dist/durable/Recovery.mjs +739 -0
- package/dist/durable/Recovery.mjs.map +1 -0
- package/dist/durable/RunJournal.d.mts +2 -0
- package/dist/durable/RunJournal.mjs +2 -0
- package/dist/durable/Schedule.d.mts +2 -0
- package/dist/durable/Schedule.mjs +391 -0
- package/dist/durable/Schedule.mjs.map +1 -0
- package/dist/durable/ScheduleStoreConformance.d.mts +17 -0
- package/dist/durable/ScheduleStoreConformance.mjs +420 -0
- package/dist/durable/ScheduleStoreConformance.mjs.map +1 -0
- package/dist/durable/ScheduleTransition.d.mts +24 -0
- package/dist/durable/ScheduleTransition.mjs +180 -0
- package/dist/durable/ScheduleTransition.mjs.map +1 -0
- package/dist/durable/Scheduling.d.mts +54 -0
- package/dist/durable/Scheduling.mjs +2 -0
- package/dist/durable/SqlMemoryStore.d.mts +29 -0
- package/dist/durable/SqlMemoryStore.mjs +436 -0
- package/dist/durable/SqlMemoryStore.mjs.map +1 -0
- package/dist/durable/SqlMessageDeliveryStore.d.mts +42 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs +173 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs.map +1 -0
- package/dist/durable/SqlStorageV2Upgrade.d.mts +21 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs +459 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs.map +1 -0
- package/dist/durable/SqlSubscriptionStore.d.mts +62 -0
- package/dist/durable/SqlSubscriptionStore.mjs +751 -0
- package/dist/durable/SqlSubscriptionStore.mjs.map +1 -0
- package/dist/durable/SqlThreadNativeReads.d.mts +49 -0
- package/dist/durable/SqlThreadNativeReads.mjs +153 -0
- package/dist/durable/SqlThreadNativeReads.mjs.map +1 -0
- package/dist/durable/SubmissionLedger.d.mts +3 -0
- package/dist/durable/SubmissionLedger.mjs +918 -0
- package/dist/durable/SubmissionLedger.mjs.map +1 -0
- package/dist/durable/SubmissionLedgerConformance.d.mts +29 -0
- package/dist/durable/SubmissionLedgerConformance.mjs +1993 -0
- package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -0
- package/dist/durable/SubmissionStatus.d.mts +2 -0
- package/dist/durable/SubmissionStatus.mjs +18 -0
- package/dist/durable/SubmissionStatus.mjs.map +1 -0
- package/dist/durable/Subscription.d.mts +2 -0
- package/dist/durable/Subscription.mjs +360 -0
- package/dist/durable/Subscription.mjs.map +1 -0
- package/dist/durable/SubscriptionInput.d.mts +2 -0
- package/dist/durable/SubscriptionInput.mjs +52 -0
- package/dist/durable/SubscriptionInput.mjs.map +1 -0
- package/dist/durable/SubscriptionStoreConformance.d.mts +16 -0
- package/dist/durable/SubscriptionStoreConformance.mjs +625 -0
- package/dist/durable/SubscriptionStoreConformance.mjs.map +1 -0
- package/dist/durable/SubscriptionTools.d.mts +273 -0
- package/dist/durable/SubscriptionTools.mjs +190 -0
- package/dist/durable/SubscriptionTools.mjs.map +1 -0
- package/dist/durable/SubscriptionTransition.d.mts +21 -0
- package/dist/durable/SubscriptionTransition.mjs +148 -0
- package/dist/durable/SubscriptionTransition.mjs.map +1 -0
- package/dist/durable/Subscriptions.d.mts +73 -0
- package/dist/durable/Subscriptions.mjs +627 -0
- package/dist/durable/Subscriptions.mjs.map +1 -0
- package/dist/durable/ThreadContextHistory.d.mts +32 -0
- package/dist/durable/ThreadContextHistory.mjs +152 -0
- package/dist/durable/ThreadContextHistory.mjs.map +1 -0
- package/dist/durable/ThreadContextHistoryProjection.d.mts +60 -0
- package/dist/durable/ThreadContextHistoryProjection.mjs +149 -0
- package/dist/durable/ThreadContextHistoryProjection.mjs.map +1 -0
- package/dist/durable/ThreadInvariants.d.mts +76 -0
- package/dist/durable/ThreadInvariants.mjs +246 -0
- package/dist/durable/ThreadInvariants.mjs.map +1 -0
- package/dist/durable/ThreadProjection.d.mts +78 -0
- package/dist/durable/ThreadProjection.mjs +158 -0
- package/dist/durable/ThreadProjection.mjs.map +1 -0
- package/dist/durable/ThreadProjectionMaintenance.d.mts +49 -0
- package/dist/durable/ThreadProjectionMaintenance.mjs +33 -0
- package/dist/durable/ThreadProjectionMaintenance.mjs.map +1 -0
- package/dist/durable/ThreadStore.d.mts +2 -0
- package/dist/durable/ThreadStore.mjs +336 -0
- package/dist/durable/ThreadStore.mjs.map +1 -0
- package/dist/durable/ThreadStoreConformance.d.mts +28 -0
- package/dist/durable/ThreadStoreConformance.mjs +503 -0
- package/dist/durable/ThreadStoreConformance.mjs.map +1 -0
- package/dist/durable/ToolReconciler.d.mts +2 -0
- package/dist/durable/ToolReconciler.mjs +85 -0
- package/dist/durable/ToolReconciler.mjs.map +1 -0
- package/dist/durable/WakeScheduler.d.mts +2 -0
- package/dist/durable/WakeScheduler.mjs +85 -0
- package/dist/durable/WakeScheduler.mjs.map +1 -0
- package/dist/durable/WorkerHost.d.mts +129 -0
- package/dist/durable/WorkerHost.mjs +77 -0
- package/dist/durable/WorkerHost.mjs.map +1 -0
- package/dist/engine/AgentRuntime.d.mts +2 -0
- package/dist/engine/AgentRuntime.mjs +2 -0
- package/dist/engine/Compaction.d.mts +7 -0
- package/dist/engine/Compaction.mjs +16 -0
- package/dist/engine/Compaction.mjs.map +1 -0
- package/dist/engine/ContextCompactor.d.mts +2 -0
- package/dist/engine/ContextCompactor.mjs +119 -0
- package/dist/engine/ContextCompactor.mjs.map +1 -0
- package/dist/engine/ContextHistory.d.mts +65 -0
- package/dist/engine/ContextHistory.mjs +76 -0
- package/dist/engine/ContextHistory.mjs.map +1 -0
- package/dist/engine/ContextWindow.d.mts +2 -0
- package/dist/engine/ContextWindow.mjs +59 -0
- package/dist/engine/ContextWindow.mjs.map +1 -0
- package/dist/engine/DurableStep.d.mts +2 -0
- package/dist/engine/DurableStep.mjs +62 -0
- package/dist/engine/DurableStep.mjs.map +1 -0
- package/dist/engine/MessagingHost.d.mts +2 -0
- package/dist/engine/MessagingHost.mjs +2 -0
- package/dist/engine/Output.d.mts +2 -0
- package/dist/engine/Output.mjs +8 -0
- package/dist/engine/Output.mjs.map +1 -0
- package/dist/engine/RunEventSink.d.mts +2 -0
- package/dist/engine/RunEventSink.mjs +22 -0
- package/dist/engine/RunEventSink.mjs.map +1 -0
- package/dist/engine/RunOptions.d.mts +2 -0
- package/dist/engine/RunOptions.mjs +124 -0
- package/dist/engine/RunOptions.mjs.map +1 -0
- package/dist/engine/SubagentHost.d.mts +2 -0
- package/dist/engine/SubagentHost.mjs +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 +91 -6
- package/dist/index.mjs +100 -6
- package/dist/output-contract-BC7tjlGw.mjs +84 -0
- package/dist/output-contract-BC7tjlGw.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/sandbox/CodeExecutor.d.mts +194 -0
- package/dist/sandbox/CodeExecutor.mjs +278 -0
- package/dist/sandbox/CodeExecutor.mjs.map +1 -0
- package/dist/sandbox/InteractiveBrowser.d.mts +257 -0
- package/dist/sandbox/InteractiveBrowser.mjs +236 -0
- package/dist/sandbox/InteractiveBrowser.mjs.map +1 -0
- package/dist/sandbox/PageCapture.d.mts +2 -0
- package/dist/sandbox/PageCapture.mjs +450 -0
- package/dist/sandbox/PageCapture.mjs.map +1 -0
- package/dist/sandbox/PageCrawl.d.mts +88 -0
- package/dist/sandbox/PageCrawl.mjs +124 -0
- package/dist/sandbox/PageCrawl.mjs.map +1 -0
- package/dist/sandbox/PageScreenshot.d.mts +2 -0
- package/dist/sandbox/PageScreenshot.mjs +53 -0
- package/dist/sandbox/PageScreenshot.mjs.map +1 -0
- package/dist/sandbox/ProtectedBrowser.d.mts +273 -0
- package/dist/sandbox/ProtectedBrowser.mjs +287 -0
- package/dist/sandbox/ProtectedBrowser.mjs.map +1 -0
- package/dist/sandbox/Sandbox.d.mts +2 -0
- package/dist/sandbox/Sandbox.mjs +208 -0
- package/dist/sandbox/Sandbox.mjs.map +1 -0
- package/dist/utf8-BYfhEkcj.mjs +11 -0
- package/dist/utf8-BYfhEkcj.mjs.map +1 -0
- package/dist/utf8-DchGZRBd.mjs +23 -0
- package/dist/utf8-DchGZRBd.mjs.map +1 -0
- package/package.json +1 -40
- package/src/InMemory.ts +19 -0
- package/src/ToolExposure.ts +2 -0
- package/src/capabilities/Approval.ts +352 -0
- package/src/capabilities/Budget.ts +536 -0
- package/src/capabilities/CodeMode.ts +1090 -0
- package/src/capabilities/Commands.ts +86 -0
- package/src/capabilities/ContextTools.ts +184 -0
- package/src/capabilities/Mcp.ts +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 +2488 -0
- package/src/capabilities/SubagentReservations.ts +850 -0
- package/src/capabilities/ToolDiscovery.ts +369 -0
- package/src/capabilities/WebCapture.ts +722 -0
- package/src/capabilities/WebSearch.ts +190 -0
- package/src/capabilities/internal/subagent-background.ts +1246 -0
- package/src/capabilities/internal/subagent-contract.ts +146 -0
- package/src/capabilities/internal/subagent-policy.ts +235 -0
- package/src/capabilities/internal/subagent-reporting.ts +261 -0
- package/src/capabilities/internal/utf8.ts +10 -0
- package/src/core/Agent.ts +595 -0
- package/src/core/AgentError.ts +172 -0
- package/src/core/AgentPolicy.ts +153 -0
- package/src/core/AgentUpdates.ts +100 -0
- package/src/core/FailureDiagnostic.ts +343 -0
- package/src/core/IdGenerator.ts +39 -0
- package/src/core/Identifiers.ts +48 -0
- package/src/core/Memory.ts +290 -0
- package/src/core/MemoryNamespace.ts +196 -0
- package/src/core/MemoryReference.ts +121 -0
- package/src/core/MemoryRevalidation.ts +185 -0
- package/src/core/MemoryStore.ts +368 -0
- package/src/core/Messaging.ts +72 -0
- package/src/core/Receipt.ts +42 -0
- package/src/core/RememberingStore.ts +300 -0
- package/src/core/RunEvent.ts +366 -0
- package/src/core/RunPolicyUsage.ts +17 -0
- package/src/core/SemanticMemoryIndex.ts +250 -0
- package/src/core/SemanticMemoryRevalidation.ts +254 -0
- package/src/core/SubagentContract.ts +196 -0
- package/src/core/Thread.ts +371 -0
- package/src/core/ToolExposure.ts +74 -0
- package/src/core/ToolResult.ts +190 -0
- package/src/core/Usage.ts +529 -0
- package/src/core/Worker.ts +184 -0
- package/src/core/internal/agent-updates.ts +34 -0
- package/src/core/internal/message-status.ts +60 -0
- package/src/core/internal/strict-schema.ts +14 -0
- package/src/core/internal/utf8.ts +23 -0
- package/src/durable/ActivityStore.ts +160 -0
- package/src/durable/Admin.ts +505 -0
- package/src/durable/AgentRegistration.ts +14 -0
- package/src/durable/Certification.ts +210 -0
- package/src/durable/CommittedActivity.ts +296 -0
- package/src/durable/Digest.ts +87 -0
- package/src/durable/DurableAgentRuntime.ts +10950 -0
- package/src/durable/DurableFailpoint.ts +107 -0
- package/src/durable/DurableFailpointTestControl.ts +39 -0
- package/src/durable/EventSource.ts +172 -0
- package/src/durable/GitHubWorkflowSource.ts +447 -0
- package/src/durable/MessageDelivery.ts +817 -0
- package/src/durable/MessageDeliveryStoreConformance.ts +410 -0
- package/src/durable/OperationAuthorizer.ts +85 -0
- package/src/durable/PersistentHistory.ts +260 -0
- package/src/durable/PreparedInputAdmission.ts +57 -0
- package/src/durable/Records.ts +1065 -0
- package/src/durable/Recovery.ts +1018 -0
- package/src/durable/RunJournal.ts +1631 -0
- package/src/durable/Schedule.ts +513 -0
- package/src/durable/ScheduleStoreConformance.ts +638 -0
- package/src/durable/ScheduleTransition.ts +265 -0
- package/src/durable/Scheduling.ts +1077 -0
- package/src/durable/SqlMemoryStore.ts +778 -0
- package/src/durable/SqlMessageDeliveryStore.ts +321 -0
- package/src/durable/SqlStorageV2Upgrade.ts +500 -0
- package/src/durable/SqlSubscriptionStore.ts +1440 -0
- package/src/durable/SqlThreadNativeReads.ts +256 -0
- package/src/durable/SubmissionLedger.ts +1205 -0
- package/src/durable/SubmissionLedgerConformance.ts +4590 -0
- package/src/durable/SubmissionStatus.ts +14 -0
- package/src/durable/Subscription.ts +544 -0
- package/src/durable/SubscriptionInput.ts +144 -0
- package/src/durable/SubscriptionStoreConformance.ts +945 -0
- package/src/durable/SubscriptionTools.ts +327 -0
- package/src/durable/SubscriptionTransition.ts +302 -0
- package/src/durable/Subscriptions.ts +1210 -0
- package/src/durable/ThreadContextHistory.ts +227 -0
- package/src/durable/ThreadContextHistoryProjection.ts +216 -0
- package/src/durable/ThreadInvariants.ts +507 -0
- package/src/durable/ThreadProjection.ts +269 -0
- package/src/durable/ThreadProjectionMaintenance.ts +67 -0
- package/src/durable/ThreadStore.ts +552 -0
- package/src/durable/ThreadStoreConformance.ts +1156 -0
- package/src/durable/ToolReconciler.ts +109 -0
- package/src/durable/WakeScheduler.ts +134 -0
- package/src/durable/WorkerHost.ts +171 -0
- package/src/durable/internal/agent-registration.ts +621 -0
- package/src/durable/internal/agent-updates.ts +302 -0
- package/src/durable/internal/foreign-diagnostic.ts +47 -0
- package/src/durable/internal/journal-checkpoint.ts +104 -0
- package/src/durable/internal/journal-metadata.ts +117 -0
- package/src/durable/internal/message-status.ts +20 -0
- package/src/durable/internal/messaging-host.ts +637 -0
- package/src/durable/internal/schedule-time.ts +303 -0
- package/src/durable/internal/storage-v2-layout.ts +163 -0
- package/src/durable/internal/storage-v2.ts +73 -0
- package/src/durable/internal/worker-host.ts +2678 -0
- package/src/durable/internal/worker-runtime.ts +9 -0
- package/src/engine/AgentRuntime.ts +37 -0
- package/src/engine/Compaction.ts +11 -0
- package/src/engine/ContextCompactor.ts +277 -0
- package/src/engine/ContextHistory.ts +73 -0
- package/src/engine/ContextWindow.ts +72 -0
- package/src/engine/DurableStep.ts +132 -0
- package/src/engine/MessagingHost.ts +110 -0
- package/src/engine/Output.ts +2 -0
- package/src/engine/RunEventSink.ts +132 -0
- package/src/engine/RunOptions.ts +1101 -0
- package/src/engine/SubagentHost.ts +193 -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 +10485 -0
- package/src/engine/internal/bounded-value.ts +315 -0
- package/src/engine/internal/compaction.ts +678 -0
- package/src/engine/internal/error-diagnostic.ts +39 -0
- package/src/engine/internal/output-contract.ts +173 -0
- package/src/engine/internal/primitive-delta.ts +80 -0
- package/src/engine/internal/provider-result-staging.ts +211 -0
- package/src/engine/internal/tool-derivative.ts +106 -0
- package/src/engine/internal/tool-exposure.ts +224 -0
- package/src/engine/internal/tool-telemetry.ts +484 -0
- package/src/index.ts +99 -21
- package/src/sandbox/CodeExecutor.ts +352 -0
- package/src/sandbox/InteractiveBrowser.ts +339 -0
- package/src/sandbox/PageCapture.ts +691 -0
- package/src/sandbox/PageCrawl.ts +148 -0
- package/src/sandbox/PageScreenshot.ts +81 -0
- package/src/sandbox/ProtectedBrowser.ts +436 -0
- package/src/sandbox/Sandbox.ts +241 -0
|
@@ -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
|
+
});
|