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,300 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
import type * as MemoryNamespace from "./MemoryNamespace.ts";
|
|
4
|
+
import { MemorySourceReference } from "./MemoryReference.ts";
|
|
5
|
+
import { MemoryDocument, MemoryKey, MemoryWrite } from "./MemoryStore.ts";
|
|
6
|
+
|
|
7
|
+
const Identity = Schema.NonEmptyString.check(Schema.isMaxLength(256));
|
|
8
|
+
|
|
9
|
+
const Counter = Schema.Int.check(
|
|
10
|
+
Schema.isBetween({ minimum: 0, maximum: Number.MAX_SAFE_INTEGER }),
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
/** Host source-order lineage. Sequence is monotonic only within one authorityGeneration.
|
|
14
|
+
* Opaque revision strings and different authority generations are never ordered.
|
|
15
|
+
*/
|
|
16
|
+
export const SourcePosition = Schema.Struct({
|
|
17
|
+
authorityGeneration: Identity,
|
|
18
|
+
sequence: Counter,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type SourcePosition = typeof SourcePosition.Type;
|
|
22
|
+
|
|
23
|
+
export const comparePosition = (left: SourcePosition, right: SourcePosition): number | undefined =>
|
|
24
|
+
left.authorityGeneration === right.authorityGeneration
|
|
25
|
+
? Math.sign(left.sequence - right.sequence)
|
|
26
|
+
: undefined;
|
|
27
|
+
|
|
28
|
+
export const Source = Schema.Struct({
|
|
29
|
+
key: MemoryKey.Wire,
|
|
30
|
+
locator: MemorySourceReference.fields.locator,
|
|
31
|
+
revision: Schema.NonEmptyString.check(Schema.isMaxLength(1_024)),
|
|
32
|
+
position: SourcePosition,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export type Source = typeof Source.Type;
|
|
36
|
+
|
|
37
|
+
class IntentWire extends Schema.Class<IntentWire>("@effect-agent/remembering/Intent")({
|
|
38
|
+
version: Schema.Literal(1),
|
|
39
|
+
/** Stable host-selected idempotency identity, including processor/schema version. It must be
|
|
40
|
+
* unique across all source-owner Stores writing this target for the receipt retention window.
|
|
41
|
+
*/
|
|
42
|
+
id: Identity,
|
|
43
|
+
/** Trusted invocation identity, never taken from extracted/model values. */
|
|
44
|
+
invocationId: Identity,
|
|
45
|
+
source: Source,
|
|
46
|
+
target: MemoryKey.Wire,
|
|
47
|
+
}) {}
|
|
48
|
+
|
|
49
|
+
export type Intent<
|
|
50
|
+
S extends MemoryNamespace.Any = MemoryNamespace.Any,
|
|
51
|
+
T extends MemoryNamespace.Any = MemoryNamespace.Any,
|
|
52
|
+
> = Omit<IntentWire, "source" | "target"> & {
|
|
53
|
+
readonly source: Omit<Source, "key"> & { readonly key: MemoryKey<S> };
|
|
54
|
+
readonly target: MemoryKey<T>;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const Intent = {
|
|
58
|
+
Wire: IntentWire,
|
|
59
|
+
make: <S extends MemoryNamespace.Any, T extends MemoryNamespace.Any>(
|
|
60
|
+
fields: Intent<S, T>,
|
|
61
|
+
): Intent<S, T> =>
|
|
62
|
+
Object.assign(Schema.decodeUnknownSync(IntentWire)(fields), {
|
|
63
|
+
source: { ...fields.source, key: MemoryKey.make(fields.source.key) },
|
|
64
|
+
target: MemoryKey.make(fields.target),
|
|
65
|
+
}),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** Half-open UTF-8 byte range in the exact authoritative source revision. A quote proves
|
|
69
|
+
* provenance only. Applications decide whether it supports a fact and may be shared.
|
|
70
|
+
*/
|
|
71
|
+
export const Evidence = Schema.Struct({
|
|
72
|
+
source: Schema.Struct({ ...MemorySourceReference.fields, revision: Source.fields.revision }),
|
|
73
|
+
startByte: Counter,
|
|
74
|
+
endByte: Counter,
|
|
75
|
+
quote: Schema.NonEmptyString.check(Schema.isMaxLength(65_536)),
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export type Evidence = typeof Evidence.Type;
|
|
79
|
+
|
|
80
|
+
export const Proposal = Schema.Struct({
|
|
81
|
+
version: Schema.Literal(1),
|
|
82
|
+
value: Schema.Json,
|
|
83
|
+
evidence: Schema.Array(Evidence).check(Schema.isMinLength(1), Schema.isMaxLength(128)),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export type Proposal = typeof Proposal.Type;
|
|
87
|
+
|
|
88
|
+
export interface Extracted<Value> {
|
|
89
|
+
readonly value: Value;
|
|
90
|
+
readonly evidence: ReadonlyArray<Evidence>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export class Invalidation extends Schema.Class<Invalidation>(
|
|
94
|
+
"@effect-agent/remembering/Invalidation",
|
|
95
|
+
)({
|
|
96
|
+
version: Schema.Literal(1),
|
|
97
|
+
id: Identity,
|
|
98
|
+
source: MemoryKey.Wire,
|
|
99
|
+
position: SourcePosition,
|
|
100
|
+
reason: Schema.Literals(["source-edit", "source-deletion", "source-revocation", "forget"]),
|
|
101
|
+
}) {}
|
|
102
|
+
|
|
103
|
+
export type BoundInvalidation<S extends MemoryNamespace.Any> = Omit<Invalidation, "source"> & {
|
|
104
|
+
readonly source: MemoryKey<S>;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const PreparedFields: {
|
|
108
|
+
readonly proposal: typeof Proposal;
|
|
109
|
+
readonly attempt: typeof Counter;
|
|
110
|
+
readonly purpose: Schema.Literals<readonly ["remember", "cleanup"]>;
|
|
111
|
+
readonly applied: Schema.NullOr<typeof MemoryDocument.Wire>;
|
|
112
|
+
} = {
|
|
113
|
+
proposal: Proposal,
|
|
114
|
+
attempt: Counter,
|
|
115
|
+
purpose: Schema.Literals(["remember", "cleanup"]),
|
|
116
|
+
/** Original applied revision, retained for source-aware conditional cleanup. */
|
|
117
|
+
applied: Schema.NullOr(MemoryDocument.Wire),
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const CompletedFields: {
|
|
121
|
+
readonly proposal: Schema.NullOr<typeof Proposal>;
|
|
122
|
+
readonly attempt: typeof Counter;
|
|
123
|
+
readonly applied: Schema.NullOr<typeof MemoryDocument.Wire>;
|
|
124
|
+
readonly outcome: Schema.Literals<readonly ["applied", "no-change", "rejected", "suppressed"]>;
|
|
125
|
+
readonly cleaned: typeof Schema.Boolean;
|
|
126
|
+
} = {
|
|
127
|
+
proposal: Schema.NullOr(Proposal),
|
|
128
|
+
attempt: Counter,
|
|
129
|
+
applied: Schema.NullOr(MemoryDocument.Wire),
|
|
130
|
+
outcome: Schema.Literals(["applied", "no-change", "rejected", "suppressed"]),
|
|
131
|
+
cleaned: Schema.Boolean,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
interface ProgressSchema extends Schema.Union<
|
|
135
|
+
readonly [
|
|
136
|
+
Schema.TaggedStruct<"Pending", {}>,
|
|
137
|
+
Schema.TaggedStruct<"Proposed", typeof PreparedFields>,
|
|
138
|
+
Schema.TaggedStruct<
|
|
139
|
+
"Prepared",
|
|
140
|
+
typeof PreparedFields & { readonly command: typeof MemoryWrite.Wire }
|
|
141
|
+
>,
|
|
142
|
+
Schema.TaggedStruct<"Completed", typeof CompletedFields>,
|
|
143
|
+
]
|
|
144
|
+
> {}
|
|
145
|
+
|
|
146
|
+
export const Progress: ProgressSchema = Schema.Union([
|
|
147
|
+
Schema.TaggedStruct("Pending", {}),
|
|
148
|
+
Schema.TaggedStruct("Proposed", PreparedFields),
|
|
149
|
+
Schema.TaggedStruct("Prepared", { ...PreparedFields, command: MemoryWrite.Wire }),
|
|
150
|
+
Schema.TaggedStruct("Completed", CompletedFields),
|
|
151
|
+
]);
|
|
152
|
+
|
|
153
|
+
export type Progress<T extends MemoryNamespace.Any = MemoryNamespace.Any> =
|
|
154
|
+
| (typeof Progress.members)[0]["Type"]
|
|
155
|
+
| (Omit<(typeof Progress.members)[1]["Type"], "applied"> & {
|
|
156
|
+
readonly applied: MemoryDocument<T> | null;
|
|
157
|
+
})
|
|
158
|
+
| (Omit<(typeof Progress.members)[2]["Type"], "applied" | "command"> & {
|
|
159
|
+
readonly applied: MemoryDocument<T> | null;
|
|
160
|
+
readonly command: MemoryWrite<T>;
|
|
161
|
+
})
|
|
162
|
+
| (Omit<(typeof Progress.members)[3]["Type"], "applied"> & {
|
|
163
|
+
readonly applied: MemoryDocument<T> | null;
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
/** Retain this source-target reference after removing a job from the active queue. It contains
|
|
167
|
+
* the immutable proposal and original application receipt needed by later invalidation.
|
|
168
|
+
* Prepared commands must never be pruned or replaced while their outcome is uncertain.
|
|
169
|
+
*/
|
|
170
|
+
export class Checkpoint extends Schema.Class<Checkpoint>("@effect-agent/remembering/Checkpoint")({
|
|
171
|
+
version: Counter,
|
|
172
|
+
intent: Intent.Wire,
|
|
173
|
+
suppression: Schema.NullOr(Invalidation),
|
|
174
|
+
progress: Progress,
|
|
175
|
+
}) {}
|
|
176
|
+
|
|
177
|
+
/** A checked checkpoint bound to the caller's original namespace definitions. */
|
|
178
|
+
export type BoundCheckpoint<S extends MemoryNamespace.Any, T extends MemoryNamespace.Any> = Omit<
|
|
179
|
+
Checkpoint,
|
|
180
|
+
"intent" | "progress" | "suppression"
|
|
181
|
+
> & {
|
|
182
|
+
readonly intent: Intent<S, T>;
|
|
183
|
+
readonly progress: Progress<T>;
|
|
184
|
+
readonly suppression: BoundInvalidation<S> | null;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export class Admission extends Schema.Class<Admission>("@effect-agent/remembering/Admission")({
|
|
188
|
+
id: Identity,
|
|
189
|
+
status: Schema.Literals(["queued", "duplicate"]),
|
|
190
|
+
}) {}
|
|
191
|
+
|
|
192
|
+
export class InvalidationReceipt extends Schema.Class<InvalidationReceipt>(
|
|
193
|
+
"@effect-agent/remembering/InvalidationReceipt",
|
|
194
|
+
)({
|
|
195
|
+
id: Identity,
|
|
196
|
+
status: Schema.Literals(["accepted", "duplicate", "stale"]),
|
|
197
|
+
affected: Counter,
|
|
198
|
+
}) {}
|
|
199
|
+
|
|
200
|
+
export class AdmissionError extends Schema.TaggedError<AdmissionError>()(
|
|
201
|
+
"RememberingAdmissionError",
|
|
202
|
+
{
|
|
203
|
+
reason: Schema.Literals(["invalid-input", "conflict", "capacity", "suppressed", "disabled"]),
|
|
204
|
+
},
|
|
205
|
+
) {}
|
|
206
|
+
|
|
207
|
+
export class CheckpointError extends Schema.TaggedError<CheckpointError>()(
|
|
208
|
+
"RememberingCheckpointError",
|
|
209
|
+
{
|
|
210
|
+
reason: Schema.Literals(["fenced", "missing", "corrupt"]),
|
|
211
|
+
},
|
|
212
|
+
) {}
|
|
213
|
+
|
|
214
|
+
export class ProcessingError extends Schema.TaggedError<ProcessingError>()(
|
|
215
|
+
"RememberingProcessingError",
|
|
216
|
+
{
|
|
217
|
+
reason: Schema.Literals([
|
|
218
|
+
"invalid-input",
|
|
219
|
+
"invalid-evidence",
|
|
220
|
+
"source-changed",
|
|
221
|
+
"budget",
|
|
222
|
+
"timeout",
|
|
223
|
+
"disabled",
|
|
224
|
+
"cleanup-rejected",
|
|
225
|
+
]),
|
|
226
|
+
},
|
|
227
|
+
) {}
|
|
228
|
+
|
|
229
|
+
export const MutationPoint = Schema.Literals([
|
|
230
|
+
"admission:before",
|
|
231
|
+
"admission:after",
|
|
232
|
+
"proposal:before",
|
|
233
|
+
"proposal:after",
|
|
234
|
+
"command:before",
|
|
235
|
+
"command:after",
|
|
236
|
+
"rebase:before",
|
|
237
|
+
"rebase:after",
|
|
238
|
+
"completion:before",
|
|
239
|
+
"completion:after",
|
|
240
|
+
"suppression:before",
|
|
241
|
+
"suppression:after",
|
|
242
|
+
"cleanup:before",
|
|
243
|
+
"cleanup:after",
|
|
244
|
+
]);
|
|
245
|
+
|
|
246
|
+
export type MutationPoint = typeof MutationPoint.Type;
|
|
247
|
+
|
|
248
|
+
export class MutationFailure extends Schema.TaggedError<MutationFailure>()(
|
|
249
|
+
"RememberingMutationFailure",
|
|
250
|
+
{
|
|
251
|
+
point: MutationPoint,
|
|
252
|
+
},
|
|
253
|
+
) {}
|
|
254
|
+
|
|
255
|
+
/** Explicit transition failpoints. No-op unless a test installs a replacement. */
|
|
256
|
+
export class MutationFailpoint extends Context.Service<
|
|
257
|
+
MutationFailpoint,
|
|
258
|
+
{
|
|
259
|
+
readonly hit: (point: MutationPoint) => Effect.Effect<void, MutationFailure>;
|
|
260
|
+
}
|
|
261
|
+
>()("@effect-agent/remembering/MutationFailpoint") {
|
|
262
|
+
static readonly layer = Layer.succeed(this, { hit: () => Effect.void });
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** Host-owned durable admission/checkpoint port. It is not a scheduler or profile store.
|
|
266
|
+
* The explicit port binds an existing host job transaction; its Effects retain their E and R.
|
|
267
|
+
* Hosts may acquire it from their own Context service. The protocol never provides its requirements.
|
|
268
|
+
*
|
|
269
|
+
* admit atomically binds the complete intent, receipt, source authority, and ready obligation.
|
|
270
|
+
* Identical retries return duplicate; reusing an id with different intent fails conflict.
|
|
271
|
+
* read/save validate the complete intent. save atomically checks expectedVersion and advances
|
|
272
|
+
* its fence; invalidation advances the same fence. A failed CAS must never dispatch new work.
|
|
273
|
+
*
|
|
274
|
+
* invalidate durably records suppression before source acknowledgement and marks every retained
|
|
275
|
+
* source-target reference ready for reconciliation/cleanup. It MUST preserve Prepared commands.
|
|
276
|
+
* Older positions cannot undo newer authority; forget is terminal for that source identity.
|
|
277
|
+
* Bind the active authorityGeneration before admission. Unknown or mismatched lineages fail
|
|
278
|
+
* closed; an explicit host restore cutover installs a new lineage and fences all old workers.
|
|
279
|
+
* Source edits suppress contributions from earlier positions; deletion/forget include their own
|
|
280
|
+
* position. A duplicate invalidation cannot lose pending cleanup. New admissions against an old
|
|
281
|
+
* authority, withdrawn source, or terminal forget fail suppressed.
|
|
282
|
+
*
|
|
283
|
+
* Bound active jobs, proposals, references and receipts. Capacity failure rejects new admission;
|
|
284
|
+
* it never evicts an unresolved command, suppression, or cleanup obligation. Retain references,
|
|
285
|
+
* receipts and suppression for the entire supported delivery/replay/restore window. Expired or
|
|
286
|
+
* incompatible restores fail closed. The host owns alarms, outboxes, ordering, retries, leases,
|
|
287
|
+
* source authorization and whether extraction is enabled. Cleanup remains runnable when it is off.
|
|
288
|
+
*/
|
|
289
|
+
export interface Store<E = never, R = never> {
|
|
290
|
+
readonly admit: (intent: Intent) => Effect.Effect<Admission, E | AdmissionError, R>;
|
|
291
|
+
readonly read: (intent: Intent) => Effect.Effect<Checkpoint, E | CheckpointError, R>;
|
|
292
|
+
readonly save: (input: {
|
|
293
|
+
readonly intent: Intent;
|
|
294
|
+
readonly expectedVersion: number;
|
|
295
|
+
readonly progress: Progress;
|
|
296
|
+
}) => Effect.Effect<Checkpoint, E | CheckpointError, R>;
|
|
297
|
+
readonly invalidate: (
|
|
298
|
+
event: Invalidation,
|
|
299
|
+
) => Effect.Effect<InvalidationReceipt, E | AdmissionError, R>;
|
|
300
|
+
}
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
import { Update } from "./AgentUpdates.ts";
|
|
4
|
+
import { AgentId, ThreadId, DelegationId, RunId, ToolCallId, TurnId } from "./Identifiers.ts";
|
|
5
|
+
import { DelegationDepth } from "./SubagentContract.ts";
|
|
6
|
+
import { Selection } from "./ToolExposure.ts";
|
|
7
|
+
import { RunTotals } from "./Usage.ts";
|
|
8
|
+
|
|
9
|
+
const RunEventBase = {
|
|
10
|
+
eventVersion: Schema.Literal(1),
|
|
11
|
+
runId: RunId,
|
|
12
|
+
threadId: ThreadId,
|
|
13
|
+
agentId: AgentId,
|
|
14
|
+
sequence: Schema.Natural,
|
|
15
|
+
timestamp: Schema.DateTimeUtcFromString,
|
|
16
|
+
turnId: Schema.optionalKey(TurnId),
|
|
17
|
+
toolCallId: Schema.optionalKey(ToolCallId),
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** A schema-encoded Agent update accepted by the owning Run. */
|
|
21
|
+
export class AgentUpdateEmitted extends Schema.TaggedClass<AgentUpdateEmitted>()(
|
|
22
|
+
"AgentUpdateEmitted",
|
|
23
|
+
{ ...RunEventBase, update: Update },
|
|
24
|
+
) {}
|
|
25
|
+
|
|
26
|
+
/** Signals that the runtime has created a run and assigned its identities. */
|
|
27
|
+
export class RunStarted extends Schema.TaggedClass<RunStarted>()("RunStarted", RunEventBase) {}
|
|
28
|
+
|
|
29
|
+
/** Signals the start of a positive-numbered model turn. */
|
|
30
|
+
export class TurnStarted extends Schema.TaggedClass<TurnStarted>()("TurnStarted", {
|
|
31
|
+
...RunEventBase,
|
|
32
|
+
turn: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
33
|
+
}) {}
|
|
34
|
+
|
|
35
|
+
/** Signals that the model request for a turn is starting. */
|
|
36
|
+
export class ModelStarted extends Schema.TaggedClass<ModelStarted>()("ModelStarted", {
|
|
37
|
+
...RunEventBase,
|
|
38
|
+
turn: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
39
|
+
}) {}
|
|
40
|
+
|
|
41
|
+
/** Carries one live assistant text delta. */
|
|
42
|
+
export class TextDelta extends Schema.TaggedClass<TextDelta>()("TextDelta", {
|
|
43
|
+
...RunEventBase,
|
|
44
|
+
text: Schema.String,
|
|
45
|
+
}) {}
|
|
46
|
+
|
|
47
|
+
/** Carries reasoning content explicitly exposed by the provider. */
|
|
48
|
+
export class ReasoningDelta extends Schema.TaggedClass<ReasoningDelta>()("ReasoningDelta", {
|
|
49
|
+
...RunEventBase,
|
|
50
|
+
text: Schema.String,
|
|
51
|
+
}) {}
|
|
52
|
+
|
|
53
|
+
/** Reports a complete model-declared Tool Call and its execution boundary. */
|
|
54
|
+
export class ToolCallDeclared extends Schema.TaggedClass<ToolCallDeclared>()("ToolCallDeclared", {
|
|
55
|
+
...RunEventBase,
|
|
56
|
+
toolCallId: ToolCallId,
|
|
57
|
+
toolName: Schema.NonEmptyString,
|
|
58
|
+
parameters: Schema.Json,
|
|
59
|
+
providerExecuted: Schema.Boolean,
|
|
60
|
+
}) {}
|
|
61
|
+
|
|
62
|
+
/** Signals that a validated Tool Call handler has started. */
|
|
63
|
+
export class ToolCallStarted extends Schema.TaggedClass<ToolCallStarted>()("ToolCallStarted", {
|
|
64
|
+
...RunEventBase,
|
|
65
|
+
toolCallId: ToolCallId,
|
|
66
|
+
toolName: Schema.NonEmptyString,
|
|
67
|
+
}) {}
|
|
68
|
+
|
|
69
|
+
/** Carries a preliminary Tool result that is not the call's terminal outcome. */
|
|
70
|
+
export class ToolProgress extends Schema.TaggedClass<ToolProgress>()("ToolProgress", {
|
|
71
|
+
...RunEventBase,
|
|
72
|
+
toolCallId: ToolCallId,
|
|
73
|
+
toolName: Schema.NonEmptyString,
|
|
74
|
+
result: Schema.Json,
|
|
75
|
+
providerExecuted: Schema.Boolean,
|
|
76
|
+
}) {}
|
|
77
|
+
|
|
78
|
+
/** Records the successful terminal result of a Tool Call. */
|
|
79
|
+
export class ToolCallSucceeded extends Schema.TaggedClass<ToolCallSucceeded>()(
|
|
80
|
+
"ToolCallSucceeded",
|
|
81
|
+
{
|
|
82
|
+
...RunEventBase,
|
|
83
|
+
toolCallId: ToolCallId,
|
|
84
|
+
toolName: Schema.NonEmptyString,
|
|
85
|
+
toolSelection: Schema.optionalKey(Selection),
|
|
86
|
+
result: Schema.Json,
|
|
87
|
+
providerExecuted: Schema.Boolean,
|
|
88
|
+
},
|
|
89
|
+
) {}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* How this boundary handled a failed invocation, independently of its native failure mode.
|
|
93
|
+
* `returned-to-model` records the result path; delivery still requires the complete batch to
|
|
94
|
+
* commit and a later model call. A sibling, policy or later operation can still fail the Run.
|
|
95
|
+
* This classification never implies that side effects were rolled back.
|
|
96
|
+
*/
|
|
97
|
+
export const ToolFailureHandling = Schema.Literals([
|
|
98
|
+
"propagated",
|
|
99
|
+
"returned-to-model",
|
|
100
|
+
"returned-to-caller",
|
|
101
|
+
]);
|
|
102
|
+
|
|
103
|
+
export type ToolFailureHandling = typeof ToolFailureHandling.Type;
|
|
104
|
+
|
|
105
|
+
/** Records a terminal Tool Call failure using safe, serializable diagnostics. */
|
|
106
|
+
export class ToolCallFailed extends Schema.TaggedClass<ToolCallFailed>()("ToolCallFailed", {
|
|
107
|
+
...RunEventBase,
|
|
108
|
+
toolCallId: ToolCallId,
|
|
109
|
+
toolName: Schema.NonEmptyString,
|
|
110
|
+
errorTag: Schema.NonEmptyString,
|
|
111
|
+
message: Schema.String,
|
|
112
|
+
providerExecuted: Schema.Boolean,
|
|
113
|
+
/** Native configuration when a local Tool is known; absent on provider results and old events. */
|
|
114
|
+
failureMode: Schema.optionalKey(Schema.Literals(["error", "return"])),
|
|
115
|
+
/** Actual route at this boundary. Absence on older events means unknown, never recoverable. */
|
|
116
|
+
failureHandling: Schema.optionalKey(ToolFailureHandling),
|
|
117
|
+
/** Synthetic policy rejection; no handler ran and the failure streak is unchanged. */
|
|
118
|
+
budgetRejected: Schema.optionalKey(Schema.Literal(true)),
|
|
119
|
+
}) {}
|
|
120
|
+
|
|
121
|
+
/** Signals that a decoded Tool Call requires approval before execution. */
|
|
122
|
+
export class ApprovalRequested extends Schema.TaggedClass<ApprovalRequested>()(
|
|
123
|
+
"ApprovalRequested",
|
|
124
|
+
{
|
|
125
|
+
...RunEventBase,
|
|
126
|
+
toolCallId: ToolCallId,
|
|
127
|
+
toolName: Schema.NonEmptyString,
|
|
128
|
+
},
|
|
129
|
+
) {}
|
|
130
|
+
|
|
131
|
+
/** Records the normalized finish reason for a completed assistant turn. */
|
|
132
|
+
export class TurnCompleted extends Schema.TaggedClass<TurnCompleted>()("TurnCompleted", {
|
|
133
|
+
...RunEventBase,
|
|
134
|
+
turn: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
135
|
+
finishReason: Schema.Literals([
|
|
136
|
+
"stop",
|
|
137
|
+
"length",
|
|
138
|
+
"content-filter",
|
|
139
|
+
"tool-calls",
|
|
140
|
+
"error",
|
|
141
|
+
"pause",
|
|
142
|
+
"other",
|
|
143
|
+
"unknown",
|
|
144
|
+
]),
|
|
145
|
+
}) {}
|
|
146
|
+
|
|
147
|
+
/** Advisory that one policy limit crossed its warning fraction; emitted once per limit per run. */
|
|
148
|
+
export class BudgetWarning extends Schema.TaggedClass<BudgetWarning>()("BudgetWarning", {
|
|
149
|
+
...RunEventBase,
|
|
150
|
+
limit: Schema.Literals(["tokens", "tool-calls", "turns", "duration", "context"]),
|
|
151
|
+
consumed: Schema.Natural,
|
|
152
|
+
limitValue: Schema.Natural,
|
|
153
|
+
}) {}
|
|
154
|
+
|
|
155
|
+
/** Records that the engine reduced model context at a Turn seam without erasing source history. */
|
|
156
|
+
export class CompactionPerformed extends Schema.TaggedClass<CompactionPerformed>()(
|
|
157
|
+
"CompactionPerformed",
|
|
158
|
+
{
|
|
159
|
+
...RunEventBase,
|
|
160
|
+
turn: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
161
|
+
kind: Schema.Literals(["clear-tool-results", "summarize", "rollover"]),
|
|
162
|
+
tokensBeforeEstimate: Schema.Natural,
|
|
163
|
+
tokensAfterEstimate: Schema.Natural,
|
|
164
|
+
},
|
|
165
|
+
) {}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Dimension that bound when a Run settled through the final-answer resolution
|
|
169
|
+
* (RUN-018; the token dimension per RUN-025). This is the exhausted marker
|
|
170
|
+
* the re-delegation grant flow (RUN-021) consumes and the durable
|
|
171
|
+
* `SubmissionSettled` record persists (RUN-011).
|
|
172
|
+
*/
|
|
173
|
+
export const ExhaustedLimit = Schema.Literals(["tokens", "tool-calls", "turns"]);
|
|
174
|
+
export type ExhaustedLimit = typeof ExhaustedLimit.Type;
|
|
175
|
+
|
|
176
|
+
const CompletionFinishReason = Schema.Literals(["completed", "model-stop", "budget-exhausted"]);
|
|
177
|
+
|
|
178
|
+
type CompletionMetadata = Readonly<{
|
|
179
|
+
finishReason: typeof CompletionFinishReason.Type;
|
|
180
|
+
exhausted?: ExhaustedLimit | undefined;
|
|
181
|
+
}>;
|
|
182
|
+
|
|
183
|
+
const validateCompletionMetadata = ({
|
|
184
|
+
exhausted,
|
|
185
|
+
finishReason,
|
|
186
|
+
}: CompletionMetadata): string | undefined => {
|
|
187
|
+
const isBudgetExhausted = finishReason === "budget-exhausted";
|
|
188
|
+
|
|
189
|
+
return isBudgetExhausted === (exhausted !== undefined)
|
|
190
|
+
? undefined
|
|
191
|
+
: '`exhausted` must be present exactly when `finishReason` is "budget-exhausted"';
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const RunCompletedFields = Schema.Struct({
|
|
195
|
+
...RunEventBase,
|
|
196
|
+
output: Schema.Json,
|
|
197
|
+
/** Schema-encoded application disposition, present only for an ordinary completed Run. */
|
|
198
|
+
runDisposition: Schema.optionalKey(Schema.Json),
|
|
199
|
+
turns: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
200
|
+
finishReason: CompletionFinishReason,
|
|
201
|
+
exhausted: Schema.optionalKey(ExhaustedLimit),
|
|
202
|
+
/** Own Run usage, excluding attached descendants. Missing legacy reports are unknown. */
|
|
203
|
+
usage: Schema.optionalKey(RunTotals),
|
|
204
|
+
delegatedUsage: Schema.optionalKey(RunTotals),
|
|
205
|
+
}).check(
|
|
206
|
+
Schema.makeFilter((event) => validateCompletionMetadata(event)),
|
|
207
|
+
Schema.makeFilter((event) =>
|
|
208
|
+
event.finishReason === "budget-exhausted" && event.runDisposition !== undefined
|
|
209
|
+
? {
|
|
210
|
+
path: ["runDisposition"],
|
|
211
|
+
issue: '`runDisposition` is not allowed when `finishReason` is "budget-exhausted"',
|
|
212
|
+
}
|
|
213
|
+
: undefined,
|
|
214
|
+
),
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Successful terminal event carrying Schema-compatible output and the completed turn count.
|
|
219
|
+
* `"budget-exhausted"` marks a Run that settled through the policy's final-answer resolution
|
|
220
|
+
* after Turn, Tool Call, or token exhaustion — never a plain `"model-stop"` (RUN-011); its
|
|
221
|
+
* `turns` count may exceed `maxTurns` by the single grace Turn, and `exhausted` names the
|
|
222
|
+
* dimension that bound.
|
|
223
|
+
*
|
|
224
|
+
* Invariant: `exhausted` is present exactly when `finishReason` is
|
|
225
|
+
* `"budget-exhausted"`, and a budget-exhausted completion has no application
|
|
226
|
+
* run disposition. The checked Struct enforces both rules during construction,
|
|
227
|
+
* decoding, and encoding without replacing the class in `RunEvent`.
|
|
228
|
+
*/
|
|
229
|
+
export class RunCompleted extends Schema.TaggedClass<RunCompleted>()(
|
|
230
|
+
"RunCompleted",
|
|
231
|
+
RunCompletedFields,
|
|
232
|
+
) {}
|
|
233
|
+
|
|
234
|
+
/** Terminal event for a run that failed with an expected error. */
|
|
235
|
+
export class RunFailed extends Schema.TaggedClass<RunFailed>()("RunFailed", {
|
|
236
|
+
...RunEventBase,
|
|
237
|
+
usage: Schema.optionalKey(RunTotals),
|
|
238
|
+
delegatedUsage: Schema.optionalKey(RunTotals),
|
|
239
|
+
errorTag: Schema.NonEmptyString,
|
|
240
|
+
message: Schema.String,
|
|
241
|
+
}) {}
|
|
242
|
+
|
|
243
|
+
/** Terminal event for a run stopped by interruption. */
|
|
244
|
+
export class RunInterrupted extends Schema.TaggedClass<RunInterrupted>()("RunInterrupted", {
|
|
245
|
+
...RunEventBase,
|
|
246
|
+
message: Schema.String,
|
|
247
|
+
}) {}
|
|
248
|
+
|
|
249
|
+
/** Terminal event for a run awaiting resumable external input. */
|
|
250
|
+
export class RunSuspended extends Schema.TaggedClass<RunSuspended>()("RunSuspended", {
|
|
251
|
+
...RunEventBase,
|
|
252
|
+
usage: Schema.optionalKey(RunTotals),
|
|
253
|
+
delegatedUsage: Schema.optionalKey(RunTotals),
|
|
254
|
+
reason: Schema.String,
|
|
255
|
+
}) {}
|
|
256
|
+
|
|
257
|
+
const SubagentText = Schema.String.check(Schema.isMaxLength(4 * 1024));
|
|
258
|
+
|
|
259
|
+
const SubagentEventBase = {
|
|
260
|
+
...RunEventBase,
|
|
261
|
+
turnId: TurnId,
|
|
262
|
+
toolCallId: ToolCallId,
|
|
263
|
+
delegationId: DelegationId,
|
|
264
|
+
childThreadId: ThreadId,
|
|
265
|
+
childRunId: RunId,
|
|
266
|
+
targetAgentId: AgentId,
|
|
267
|
+
depth: DelegationDepth,
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
/** Signals that a delegation Tool Call passed preflight with preallocated child identity. */
|
|
271
|
+
export class SubagentRequested extends Schema.TaggedClass<SubagentRequested>()(
|
|
272
|
+
"SubagentRequested",
|
|
273
|
+
SubagentEventBase,
|
|
274
|
+
) {}
|
|
275
|
+
|
|
276
|
+
/** Signals that the child run has started inside its parent-owned scoped region. */
|
|
277
|
+
export class SubagentStarted extends Schema.TaggedClass<SubagentStarted>()(
|
|
278
|
+
"SubagentStarted",
|
|
279
|
+
SubagentEventBase,
|
|
280
|
+
) {}
|
|
281
|
+
|
|
282
|
+
/** Carries a bounded child progress summary without duplicating the child event stream. */
|
|
283
|
+
export class SubagentProgress extends Schema.TaggedClass<SubagentProgress>()("SubagentProgress", {
|
|
284
|
+
...SubagentEventBase,
|
|
285
|
+
summary: SubagentText,
|
|
286
|
+
}) {}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Records the child run's successful terminal outcome before the parent join.
|
|
290
|
+
* Same invariant as `RunCompleted`: `exhausted` is present exactly when
|
|
291
|
+
* `finishReason` is `"budget-exhausted"` (the pair travels verbatim from the
|
|
292
|
+
* child's terminal event); consumers treat a divergent pair fail-safe.
|
|
293
|
+
*/
|
|
294
|
+
export class SubagentCompleted extends Schema.TaggedClass<SubagentCompleted>()(
|
|
295
|
+
"SubagentCompleted",
|
|
296
|
+
Schema.Struct({
|
|
297
|
+
...SubagentEventBase,
|
|
298
|
+
turns: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
299
|
+
finishReason: CompletionFinishReason,
|
|
300
|
+
exhausted: Schema.optionalKey(ExhaustedLimit),
|
|
301
|
+
/**
|
|
302
|
+
* The child's own observed usage. Delegated usage covers its attached descendants separately.
|
|
303
|
+
*/
|
|
304
|
+
usage: Schema.optionalKey(RunTotals),
|
|
305
|
+
delegatedUsage: Schema.optionalKey(RunTotals),
|
|
306
|
+
}).check(Schema.makeFilter((event) => validateCompletionMetadata(event))),
|
|
307
|
+
) {}
|
|
308
|
+
|
|
309
|
+
/** Records the child run's expected terminal failure using safe, serializable diagnostics. */
|
|
310
|
+
export class SubagentFailed extends Schema.TaggedClass<SubagentFailed>()("SubagentFailed", {
|
|
311
|
+
...SubagentEventBase,
|
|
312
|
+
usage: Schema.optionalKey(RunTotals),
|
|
313
|
+
delegatedUsage: Schema.optionalKey(RunTotals),
|
|
314
|
+
errorTag: Schema.NonEmptyString,
|
|
315
|
+
message: SubagentText,
|
|
316
|
+
}) {}
|
|
317
|
+
|
|
318
|
+
/** Records that the child run was stopped by interruption before a terminal outcome. */
|
|
319
|
+
export class SubagentInterrupted extends Schema.TaggedClass<SubagentInterrupted>()(
|
|
320
|
+
"SubagentInterrupted",
|
|
321
|
+
{
|
|
322
|
+
...SubagentEventBase,
|
|
323
|
+
usage: Schema.optionalKey(RunTotals),
|
|
324
|
+
delegatedUsage: Schema.optionalKey(RunTotals),
|
|
325
|
+
reason: SubagentText,
|
|
326
|
+
},
|
|
327
|
+
) {}
|
|
328
|
+
|
|
329
|
+
/** Records that the child's terminal outcome was joined into its parent delegation Tool Call. */
|
|
330
|
+
export class SubagentJoined extends Schema.TaggedClass<SubagentJoined>()("SubagentJoined", {
|
|
331
|
+
...SubagentEventBase,
|
|
332
|
+
usage: Schema.optionalKey(RunTotals),
|
|
333
|
+
delegatedUsage: Schema.optionalKey(RunTotals),
|
|
334
|
+
}) {}
|
|
335
|
+
|
|
336
|
+
/** Versioned union of stable semantic run events, excluding raw provider chunks. */
|
|
337
|
+
export const RunEvent = Schema.Union([
|
|
338
|
+
AgentUpdateEmitted,
|
|
339
|
+
RunStarted,
|
|
340
|
+
TurnStarted,
|
|
341
|
+
ModelStarted,
|
|
342
|
+
TextDelta,
|
|
343
|
+
ReasoningDelta,
|
|
344
|
+
ToolCallDeclared,
|
|
345
|
+
ToolCallStarted,
|
|
346
|
+
ToolProgress,
|
|
347
|
+
ToolCallSucceeded,
|
|
348
|
+
ToolCallFailed,
|
|
349
|
+
ApprovalRequested,
|
|
350
|
+
TurnCompleted,
|
|
351
|
+
BudgetWarning,
|
|
352
|
+
CompactionPerformed,
|
|
353
|
+
RunCompleted,
|
|
354
|
+
RunFailed,
|
|
355
|
+
RunInterrupted,
|
|
356
|
+
RunSuspended,
|
|
357
|
+
SubagentRequested,
|
|
358
|
+
SubagentStarted,
|
|
359
|
+
SubagentProgress,
|
|
360
|
+
SubagentCompleted,
|
|
361
|
+
SubagentFailed,
|
|
362
|
+
SubagentInterrupted,
|
|
363
|
+
SubagentJoined,
|
|
364
|
+
]);
|
|
365
|
+
|
|
366
|
+
export type RunEvent = typeof RunEvent.Type;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cumulative policy accounting for one logical Run across replacement Attempts.
|
|
5
|
+
* Turns and model-declared calls include a pending batch. The failure streak excludes that
|
|
6
|
+
* entire batch until its declaration-ordered outcomes are folded once during continuation.
|
|
7
|
+
* Programmatic calls are reserved before execution; finalization is reserved before its model call.
|
|
8
|
+
*/
|
|
9
|
+
export const RunPolicyUsage = Schema.Struct({
|
|
10
|
+
committedTurns: Schema.Natural,
|
|
11
|
+
toolCalls: Schema.Natural,
|
|
12
|
+
programmaticToolCalls: Schema.Natural,
|
|
13
|
+
consecutiveToolFailures: Schema.Natural,
|
|
14
|
+
finalizationUsed: Schema.Boolean,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type RunPolicyUsage = typeof RunPolicyUsage.Type;
|