effect-agent 0.1.0-beta.12 → 0.1.0-beta.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Agent-1DMSO_Fl.mjs +86 -0
- package/dist/Agent-1DMSO_Fl.mjs.map +1 -0
- package/dist/Agent-D9cXqfF3.d.mts +252 -0
- package/dist/AgentError-Bn1ytXRD.d.mts +117 -0
- package/dist/AgentPolicy-BqDoSXO6.d.mts +96 -0
- package/dist/AgentRuntime-BUxDdLpw.d.mts +346 -0
- package/dist/AgentRuntime-Cp1hAb-W.mjs +4739 -0
- package/dist/AgentRuntime-Cp1hAb-W.mjs.map +1 -0
- package/dist/AgentUpdates-DMJ-_xow.d.mts +53 -0
- package/dist/ContextCompactor-WwSIG_Z2.d.mts +161 -0
- package/dist/ContextWindow-DRQ5Mbm2.d.mts +58 -0
- package/dist/DurableAgentRuntime-B-9w7jDt.mjs +7061 -0
- package/dist/DurableAgentRuntime-B-9w7jDt.mjs.map +1 -0
- package/dist/DurableFailpoint-Cnr3wx1L.d.mts +41 -0
- package/dist/DurableStep-Cry_iol4.d.mts +103 -0
- package/dist/EventSource-CnlZ3Kma.d.mts +51 -0
- package/dist/FailureDiagnostic-BElLOoED.mjs +274 -0
- package/dist/FailureDiagnostic-BElLOoED.mjs.map +1 -0
- package/dist/FailureDiagnostic-CaAkzGHL.d.mts +223 -0
- package/dist/Identifiers-CN2s30fF.d.mts +40 -0
- package/dist/InMemory.d.mts +24 -0
- package/dist/InMemory.mjs +24 -0
- package/dist/InMemory.mjs.map +1 -0
- package/dist/MemoryNamespace-BbRW5p71.d.mts +36 -0
- package/dist/MemoryReference-B8Q3UJoJ.d.mts +79 -0
- package/dist/Messaging-Dkg87ebg.d.mts +221 -0
- package/dist/Messaging-JYYN3oYS.d.mts +1067 -0
- package/dist/MessagingHost-CqzpxbGz.d.mts +74 -0
- package/dist/MessagingHost-DfsbMPvq.mjs +110 -0
- package/dist/MessagingHost-DfsbMPvq.mjs.map +1 -0
- package/dist/OperationAuthorizer-TzcQtpX5.d.mts +61 -0
- package/dist/Output-V-6YL1_Z.d.mts +25 -0
- package/dist/PageCapture-Df8Xwskw.d.mts +583 -0
- package/dist/PageScreenshot-BpgZKAxl.d.mts +48 -0
- package/dist/PreparedInputAdmission-BQLGldl-.d.mts +42 -0
- package/dist/Receipt-BAHyigAF.d.mts +33 -0
- package/dist/Records-D88mgvyS.d.mts +4214 -0
- package/dist/RunEvent-DIrzkjLr.d.mts +460 -0
- package/dist/RunEventSink-D5aVhISG.d.mts +108 -0
- package/dist/RunJournal-BXrq0VIK.mjs +931 -0
- package/dist/RunJournal-BXrq0VIK.mjs.map +1 -0
- package/dist/RunOptions-CSBsSj0X.d.mts +935 -0
- package/dist/RunPolicyUsage-ClZxyR46.d.mts +21 -0
- package/dist/Sandbox-CEsDWBLq.d.mts +173 -0
- package/dist/Schedule-BIOHA6RR.d.mts +847 -0
- package/dist/Scheduling-DPb2QyAK.mjs +691 -0
- package/dist/Scheduling-DPb2QyAK.mjs.map +1 -0
- package/dist/Subagent-CNik9RiA.d.mts +1635 -0
- package/dist/Subagent-DCrB7an7.mjs +1498 -0
- package/dist/Subagent-DCrB7an7.mjs.map +1 -0
- package/dist/SubagentContract-DdT7Cqe6.d.mts +116 -0
- package/dist/SubagentHost-4WB8Hj0C.d.mts +164 -0
- package/dist/Subscription-CRteOKRf.d.mts +948 -0
- package/dist/SubscriptionInput-oNcwTPti.d.mts +41 -0
- package/dist/Thread-DOBQ0QUY.d.mts +96 -0
- package/dist/ThreadHistory-tS1KwxHR.d.mts +60 -0
- package/dist/ToolBroker-DWs4tZra.d.mts +133 -0
- package/dist/ToolExposure-9uF_Yo0T.mjs +10 -0
- package/dist/ToolExposure-9uF_Yo0T.mjs.map +1 -0
- package/dist/ToolExposure-C93U1sPu.mjs +30 -0
- package/dist/ToolExposure-C93U1sPu.mjs.map +1 -0
- package/dist/ToolExposure-UCN12eCd.d.mts +39 -0
- package/dist/ToolExposure-r2eOWk4F.d.mts +46 -0
- package/dist/ToolExposure.d.mts +8 -0
- package/dist/ToolExposure.mjs +21 -0
- package/dist/ToolExposure.mjs.map +1 -0
- package/dist/ToolReconciler-BmVRAHKs.d.mts +80 -0
- package/dist/ToolResult-BKdqWRff.d.mts +78 -0
- package/dist/Usage-Dx0aknfk.d.mts +121 -0
- package/dist/WakeScheduler-EjUF-GhC.d.mts +56 -0
- package/dist/Worker-CfwzMZEK.mjs +271 -0
- package/dist/Worker-CfwzMZEK.mjs.map +1 -0
- package/dist/Worker-fwWkBg12.d.mts +472 -0
- package/dist/agent-registration-CKNsrpwo.mjs +201 -0
- package/dist/agent-registration-CKNsrpwo.mjs.map +1 -0
- package/dist/capabilities/Approval.d.mts +114 -0
- package/dist/capabilities/Approval.mjs +226 -0
- package/dist/capabilities/Approval.mjs.map +1 -0
- package/dist/capabilities/Budget.d.mts +112 -0
- package/dist/capabilities/Budget.mjs +346 -0
- package/dist/capabilities/Budget.mjs.map +1 -0
- package/dist/capabilities/CodeMode.d.mts +157 -0
- package/dist/capabilities/CodeMode.mjs +522 -0
- package/dist/capabilities/CodeMode.mjs.map +1 -0
- package/dist/capabilities/Commands.d.mts +55 -0
- package/dist/capabilities/Commands.mjs +57 -0
- package/dist/capabilities/Commands.mjs.map +1 -0
- package/dist/capabilities/ContextTools.d.mts +321 -0
- package/dist/capabilities/ContextTools.mjs +126 -0
- package/dist/capabilities/ContextTools.mjs.map +1 -0
- package/dist/capabilities/Mcp.d.mts +108 -0
- package/dist/capabilities/Mcp.mjs +259 -0
- package/dist/capabilities/Mcp.mjs.map +1 -0
- package/dist/capabilities/McpClient.d.mts +115 -0
- package/dist/capabilities/McpClient.mjs +506 -0
- package/dist/capabilities/McpClient.mjs.map +1 -0
- package/dist/capabilities/MemoryNotes.d.mts +424 -0
- package/dist/capabilities/MemoryNotes.mjs +128 -0
- package/dist/capabilities/MemoryNotes.mjs.map +1 -0
- package/dist/capabilities/Messaging.d.mts +3 -0
- package/dist/capabilities/Messaging.mjs +152 -0
- package/dist/capabilities/Messaging.mjs.map +1 -0
- package/dist/capabilities/ModelContext.d.mts +89 -0
- package/dist/capabilities/ModelContext.mjs +168 -0
- package/dist/capabilities/ModelContext.mjs.map +1 -0
- package/dist/capabilities/Redaction.d.mts +37 -0
- package/dist/capabilities/Redaction.mjs +104 -0
- package/dist/capabilities/Redaction.mjs.map +1 -0
- package/dist/capabilities/Remembering.d.mts +434 -0
- package/dist/capabilities/Remembering.mjs +290 -0
- package/dist/capabilities/Remembering.mjs.map +1 -0
- package/dist/capabilities/RunHooks.d.mts +82 -0
- package/dist/capabilities/RunHooks.mjs +144 -0
- package/dist/capabilities/RunHooks.mjs.map +1 -0
- package/dist/capabilities/SemanticMemory.d.mts +431 -0
- package/dist/capabilities/SemanticMemory.mjs +315 -0
- package/dist/capabilities/SemanticMemory.mjs.map +1 -0
- package/dist/capabilities/Subagent.d.mts +4 -0
- package/dist/capabilities/Subagent.mjs +5 -0
- package/dist/capabilities/SubagentReservations.d.mts +186 -0
- package/dist/capabilities/SubagentReservations.mjs +479 -0
- package/dist/capabilities/SubagentReservations.mjs.map +1 -0
- package/dist/capabilities/ToolDiscovery.d.mts +124 -0
- package/dist/capabilities/ToolDiscovery.mjs +230 -0
- package/dist/capabilities/ToolDiscovery.mjs.map +1 -0
- package/dist/capabilities/WebCapture.d.mts +163 -0
- package/dist/capabilities/WebCapture.mjs +335 -0
- package/dist/capabilities/WebCapture.mjs.map +1 -0
- package/dist/capabilities/WebSearch.d.mts +71 -0
- package/dist/capabilities/WebSearch.mjs +115 -0
- package/dist/capabilities/WebSearch.mjs.map +1 -0
- package/dist/compaction-C2OTceKw.mjs +505 -0
- package/dist/compaction-C2OTceKw.mjs.map +1 -0
- package/dist/core/Agent.d.mts +2 -0
- package/dist/core/Agent.mjs +2 -0
- package/dist/core/AgentError.d.mts +2 -0
- package/dist/core/AgentError.mjs +134 -0
- package/dist/core/AgentError.mjs.map +1 -0
- package/dist/core/AgentPolicy.d.mts +2 -0
- package/dist/core/AgentPolicy.mjs +94 -0
- package/dist/core/AgentPolicy.mjs.map +1 -0
- package/dist/core/AgentUpdates.d.mts +2 -0
- package/dist/core/AgentUpdates.mjs +63 -0
- package/dist/core/AgentUpdates.mjs.map +1 -0
- package/dist/core/FailureDiagnostic.d.mts +2 -0
- package/dist/core/FailureDiagnostic.mjs +2 -0
- package/dist/core/IdGenerator.d.mts +26 -0
- package/dist/core/IdGenerator.mjs +27 -0
- package/dist/core/IdGenerator.mjs.map +1 -0
- package/dist/core/Identifiers.d.mts +2 -0
- package/dist/core/Identifiers.mjs +43 -0
- package/dist/core/Identifiers.mjs.map +1 -0
- package/dist/core/Memory.d.mts +57 -0
- package/dist/core/Memory.mjs +203 -0
- package/dist/core/Memory.mjs.map +1 -0
- package/dist/core/MemoryNamespace.d.mts +2 -0
- package/dist/core/MemoryNamespace.mjs +116 -0
- package/dist/core/MemoryNamespace.mjs.map +1 -0
- package/dist/core/MemoryReference.d.mts +2 -0
- package/dist/core/MemoryReference.mjs +109 -0
- package/dist/core/MemoryReference.mjs.map +1 -0
- package/dist/core/MemoryRevalidation.d.mts +65 -0
- package/dist/core/MemoryRevalidation.mjs +126 -0
- package/dist/core/MemoryRevalidation.mjs.map +1 -0
- package/dist/core/MemoryStore.d.mts +186 -0
- package/dist/core/MemoryStore.mjs +243 -0
- package/dist/core/MemoryStore.mjs.map +1 -0
- package/dist/core/Receipt.d.mts +2 -0
- package/dist/core/Receipt.mjs +36 -0
- package/dist/core/Receipt.mjs.map +1 -0
- package/dist/core/RememberingStore.d.mts +1562 -0
- package/dist/core/RememberingStore.mjs +190 -0
- package/dist/core/RememberingStore.mjs.map +1 -0
- package/dist/core/RunEvent.d.mts +2 -0
- package/dist/core/RunEvent.mjs +337 -0
- package/dist/core/RunEvent.mjs.map +1 -0
- package/dist/core/RunPolicyUsage.d.mts +2 -0
- package/dist/core/RunPolicyUsage.mjs +21 -0
- package/dist/core/RunPolicyUsage.mjs.map +1 -0
- package/dist/core/SemanticMemoryIndex.d.mts +826 -0
- package/dist/core/SemanticMemoryIndex.mjs +185 -0
- package/dist/core/SemanticMemoryIndex.mjs.map +1 -0
- package/dist/core/SemanticMemoryRevalidation.d.mts +45 -0
- package/dist/core/SemanticMemoryRevalidation.mjs +191 -0
- package/dist/core/SemanticMemoryRevalidation.mjs.map +1 -0
- package/dist/core/SubagentContract.d.mts +2 -0
- package/dist/core/SubagentContract.mjs +148 -0
- package/dist/core/SubagentContract.mjs.map +1 -0
- package/dist/core/Thread.d.mts +2 -0
- package/dist/core/Thread.mjs +250 -0
- package/dist/core/Thread.mjs.map +1 -0
- package/dist/core/ToolResult.d.mts +2 -0
- package/dist/core/ToolResult.mjs +156 -0
- package/dist/core/ToolResult.mjs.map +1 -0
- package/dist/core/Usage.d.mts +2 -0
- package/dist/core/Usage.mjs +319 -0
- package/dist/core/Usage.mjs.map +1 -0
- package/dist/core/Worker.d.mts +3 -0
- package/dist/core/Worker.mjs +3 -0
- package/dist/durable/ActivityStore.d.mts +116 -0
- package/dist/durable/ActivityStore.mjs +131 -0
- package/dist/durable/ActivityStore.mjs.map +1 -0
- package/dist/durable/Admin.d.mts +2 -0
- package/dist/durable/Admin.mjs +330 -0
- package/dist/durable/Admin.mjs.map +1 -0
- package/dist/durable/AgentRegistration.d.mts +2 -0
- package/dist/durable/AgentRegistration.mjs +14 -0
- package/dist/durable/AgentRegistration.mjs.map +1 -0
- package/dist/durable/Certification.d.mts +110 -0
- package/dist/durable/Certification.mjs +159 -0
- package/dist/durable/Certification.mjs.map +1 -0
- package/dist/durable/CommittedActivity.d.mts +62 -0
- package/dist/durable/CommittedActivity.mjs +159 -0
- package/dist/durable/CommittedActivity.mjs.map +1 -0
- package/dist/durable/Digest.d.mts +2 -0
- package/dist/durable/Digest.mjs +50 -0
- package/dist/durable/Digest.mjs.map +1 -0
- package/dist/durable/DurableAgentRuntime.d.mts +3 -0
- package/dist/durable/DurableAgentRuntime.mjs +3 -0
- package/dist/durable/DurableFailpoint.d.mts +2 -0
- package/dist/durable/DurableFailpoint.mjs +102 -0
- package/dist/durable/DurableFailpoint.mjs.map +1 -0
- package/dist/durable/DurableFailpointTestControl.d.mts +14 -0
- package/dist/durable/DurableFailpointTestControl.mjs +19 -0
- package/dist/durable/DurableFailpointTestControl.mjs.map +1 -0
- package/dist/durable/EventSource.d.mts +2 -0
- package/dist/durable/EventSource.mjs +65 -0
- package/dist/durable/EventSource.mjs.map +1 -0
- package/dist/durable/GitHubWorkflowSource.d.mts +185 -0
- package/dist/durable/GitHubWorkflowSource.mjs +209 -0
- package/dist/durable/GitHubWorkflowSource.mjs.map +1 -0
- package/dist/durable/MessageDelivery.d.mts +893 -0
- package/dist/durable/MessageDelivery.mjs +557 -0
- package/dist/durable/MessageDelivery.mjs.map +1 -0
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +378 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs +270 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs.map +1 -0
- package/dist/durable/OperationAuthorizer.d.mts +2 -0
- package/dist/durable/OperationAuthorizer.mjs +70 -0
- package/dist/durable/OperationAuthorizer.mjs.map +1 -0
- package/dist/durable/PersistentHistory.d.mts +16 -0
- package/dist/durable/PersistentHistory.mjs +125 -0
- package/dist/durable/PersistentHistory.mjs.map +1 -0
- package/dist/durable/PreparedInputAdmission.d.mts +2 -0
- package/dist/durable/PreparedInputAdmission.mjs +38 -0
- package/dist/durable/PreparedInputAdmission.mjs.map +1 -0
- package/dist/durable/Records.d.mts +2 -0
- package/dist/durable/Records.mjs +848 -0
- package/dist/durable/Records.mjs.map +1 -0
- package/dist/durable/Recovery.d.mts +2 -0
- package/dist/durable/Recovery.mjs +739 -0
- package/dist/durable/Recovery.mjs.map +1 -0
- package/dist/durable/RunJournal.d.mts +2 -0
- package/dist/durable/RunJournal.mjs +2 -0
- package/dist/durable/Schedule.d.mts +2 -0
- package/dist/durable/Schedule.mjs +391 -0
- package/dist/durable/Schedule.mjs.map +1 -0
- package/dist/durable/ScheduleStoreConformance.d.mts +17 -0
- package/dist/durable/ScheduleStoreConformance.mjs +420 -0
- package/dist/durable/ScheduleStoreConformance.mjs.map +1 -0
- package/dist/durable/ScheduleTransition.d.mts +24 -0
- package/dist/durable/ScheduleTransition.mjs +180 -0
- package/dist/durable/ScheduleTransition.mjs.map +1 -0
- package/dist/durable/Scheduling.d.mts +54 -0
- package/dist/durable/Scheduling.mjs +2 -0
- package/dist/durable/SqlMemoryStore.d.mts +29 -0
- package/dist/durable/SqlMemoryStore.mjs +436 -0
- package/dist/durable/SqlMemoryStore.mjs.map +1 -0
- package/dist/durable/SqlMessageDeliveryStore.d.mts +42 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs +179 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs.map +1 -0
- package/dist/durable/SqlStorageV2Upgrade.d.mts +21 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs +459 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs.map +1 -0
- package/dist/durable/SqlSubscriptionStore.d.mts +62 -0
- package/dist/durable/SqlSubscriptionStore.mjs +751 -0
- package/dist/durable/SqlSubscriptionStore.mjs.map +1 -0
- package/dist/durable/SqlThreadNativeReads.d.mts +53 -0
- package/dist/durable/SqlThreadNativeReads.mjs +159 -0
- package/dist/durable/SqlThreadNativeReads.mjs.map +1 -0
- package/dist/durable/SubmissionLedger.d.mts +3 -0
- package/dist/durable/SubmissionLedger.mjs +959 -0
- package/dist/durable/SubmissionLedger.mjs.map +1 -0
- package/dist/durable/SubmissionLedgerConformance.d.mts +29 -0
- package/dist/durable/SubmissionLedgerConformance.mjs +2187 -0
- package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -0
- package/dist/durable/SubmissionStatus.d.mts +2 -0
- package/dist/durable/SubmissionStatus.mjs +18 -0
- package/dist/durable/SubmissionStatus.mjs.map +1 -0
- package/dist/durable/Subscription.d.mts +2 -0
- package/dist/durable/Subscription.mjs +360 -0
- package/dist/durable/Subscription.mjs.map +1 -0
- package/dist/durable/SubscriptionInput.d.mts +2 -0
- package/dist/durable/SubscriptionInput.mjs +52 -0
- package/dist/durable/SubscriptionInput.mjs.map +1 -0
- package/dist/durable/SubscriptionStoreConformance.d.mts +16 -0
- package/dist/durable/SubscriptionStoreConformance.mjs +625 -0
- package/dist/durable/SubscriptionStoreConformance.mjs.map +1 -0
- package/dist/durable/SubscriptionTools.d.mts +273 -0
- package/dist/durable/SubscriptionTools.mjs +190 -0
- package/dist/durable/SubscriptionTools.mjs.map +1 -0
- package/dist/durable/SubscriptionTransition.d.mts +21 -0
- package/dist/durable/SubscriptionTransition.mjs +148 -0
- package/dist/durable/SubscriptionTransition.mjs.map +1 -0
- package/dist/durable/Subscriptions.d.mts +73 -0
- package/dist/durable/Subscriptions.mjs +627 -0
- package/dist/durable/Subscriptions.mjs.map +1 -0
- package/dist/durable/ThreadContextHistory.d.mts +32 -0
- package/dist/durable/ThreadContextHistory.mjs +152 -0
- package/dist/durable/ThreadContextHistory.mjs.map +1 -0
- package/dist/durable/ThreadContextHistoryProjection.d.mts +60 -0
- package/dist/durable/ThreadContextHistoryProjection.mjs +149 -0
- package/dist/durable/ThreadContextHistoryProjection.mjs.map +1 -0
- package/dist/durable/ThreadInvariants.d.mts +76 -0
- package/dist/durable/ThreadInvariants.mjs +246 -0
- package/dist/durable/ThreadInvariants.mjs.map +1 -0
- package/dist/durable/ThreadProjection.d.mts +78 -0
- package/dist/durable/ThreadProjection.mjs +158 -0
- package/dist/durable/ThreadProjection.mjs.map +1 -0
- package/dist/durable/ThreadProjectionMaintenance.d.mts +49 -0
- package/dist/durable/ThreadProjectionMaintenance.mjs +33 -0
- package/dist/durable/ThreadProjectionMaintenance.mjs.map +1 -0
- package/dist/durable/ThreadStore.d.mts +2 -0
- package/dist/durable/ThreadStore.mjs +355 -0
- package/dist/durable/ThreadStore.mjs.map +1 -0
- package/dist/durable/ThreadStoreConformance.d.mts +28 -0
- package/dist/durable/ThreadStoreConformance.mjs +503 -0
- package/dist/durable/ThreadStoreConformance.mjs.map +1 -0
- package/dist/durable/ToolReconciler.d.mts +2 -0
- package/dist/durable/ToolReconciler.mjs +85 -0
- package/dist/durable/ToolReconciler.mjs.map +1 -0
- package/dist/durable/WakeScheduler.d.mts +2 -0
- package/dist/durable/WakeScheduler.mjs +85 -0
- package/dist/durable/WakeScheduler.mjs.map +1 -0
- package/dist/durable/WorkerHost.d.mts +129 -0
- package/dist/durable/WorkerHost.mjs +77 -0
- package/dist/durable/WorkerHost.mjs.map +1 -0
- package/dist/engine/AgentRuntime.d.mts +2 -0
- package/dist/engine/AgentRuntime.mjs +2 -0
- package/dist/engine/Compaction.d.mts +7 -0
- package/dist/engine/Compaction.mjs +16 -0
- package/dist/engine/Compaction.mjs.map +1 -0
- package/dist/engine/ContextCompactor.d.mts +2 -0
- package/dist/engine/ContextCompactor.mjs +119 -0
- package/dist/engine/ContextCompactor.mjs.map +1 -0
- package/dist/engine/ContextHistory.d.mts +65 -0
- package/dist/engine/ContextHistory.mjs +76 -0
- package/dist/engine/ContextHistory.mjs.map +1 -0
- package/dist/engine/ContextWindow.d.mts +2 -0
- package/dist/engine/ContextWindow.mjs +59 -0
- package/dist/engine/ContextWindow.mjs.map +1 -0
- package/dist/engine/DurableStep.d.mts +2 -0
- package/dist/engine/DurableStep.mjs +62 -0
- package/dist/engine/DurableStep.mjs.map +1 -0
- package/dist/engine/MessagingHost.d.mts +2 -0
- package/dist/engine/MessagingHost.mjs +2 -0
- package/dist/engine/Output.d.mts +2 -0
- package/dist/engine/Output.mjs +8 -0
- package/dist/engine/Output.mjs.map +1 -0
- package/dist/engine/RunEventSink.d.mts +2 -0
- package/dist/engine/RunEventSink.mjs +22 -0
- package/dist/engine/RunEventSink.mjs.map +1 -0
- package/dist/engine/RunOptions.d.mts +2 -0
- package/dist/engine/RunOptions.mjs +124 -0
- package/dist/engine/RunOptions.mjs.map +1 -0
- package/dist/engine/SubagentHost.d.mts +2 -0
- package/dist/engine/SubagentHost.mjs +76 -0
- package/dist/engine/SubagentHost.mjs.map +1 -0
- package/dist/engine/ThreadHistory.d.mts +2 -0
- package/dist/engine/ThreadHistory.mjs +67 -0
- package/dist/engine/ThreadHistory.mjs.map +1 -0
- package/dist/engine/ToolBroker.d.mts +2 -0
- package/dist/engine/ToolBroker.mjs +42 -0
- package/dist/engine/ToolBroker.mjs.map +1 -0
- package/dist/foreign-diagnostic-DBQ1XHKh.mjs +37 -0
- package/dist/foreign-diagnostic-DBQ1XHKh.mjs.map +1 -0
- package/dist/index.d.mts +91 -6
- package/dist/index.mjs +100 -6
- package/dist/output-contract-BC7tjlGw.mjs +84 -0
- package/dist/output-contract-BC7tjlGw.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/sandbox/CodeExecutor.d.mts +194 -0
- package/dist/sandbox/CodeExecutor.mjs +278 -0
- package/dist/sandbox/CodeExecutor.mjs.map +1 -0
- package/dist/sandbox/InteractiveBrowser.d.mts +257 -0
- package/dist/sandbox/InteractiveBrowser.mjs +236 -0
- package/dist/sandbox/InteractiveBrowser.mjs.map +1 -0
- package/dist/sandbox/PageCapture.d.mts +2 -0
- package/dist/sandbox/PageCapture.mjs +450 -0
- package/dist/sandbox/PageCapture.mjs.map +1 -0
- package/dist/sandbox/PageCrawl.d.mts +88 -0
- package/dist/sandbox/PageCrawl.mjs +124 -0
- package/dist/sandbox/PageCrawl.mjs.map +1 -0
- package/dist/sandbox/PageScreenshot.d.mts +2 -0
- package/dist/sandbox/PageScreenshot.mjs +53 -0
- package/dist/sandbox/PageScreenshot.mjs.map +1 -0
- package/dist/sandbox/ProtectedBrowser.d.mts +283 -0
- package/dist/sandbox/ProtectedBrowser.mjs +298 -0
- package/dist/sandbox/ProtectedBrowser.mjs.map +1 -0
- package/dist/sandbox/Sandbox.d.mts +2 -0
- package/dist/sandbox/Sandbox.mjs +208 -0
- package/dist/sandbox/Sandbox.mjs.map +1 -0
- package/dist/utf8-BYfhEkcj.mjs +11 -0
- package/dist/utf8-BYfhEkcj.mjs.map +1 -0
- package/dist/utf8-DchGZRBd.mjs +23 -0
- package/dist/utf8-DchGZRBd.mjs.map +1 -0
- package/package.json +1 -40
- package/src/InMemory.ts +19 -0
- package/src/ToolExposure.ts +2 -0
- package/src/capabilities/Approval.ts +352 -0
- package/src/capabilities/Budget.ts +536 -0
- package/src/capabilities/CodeMode.ts +1090 -0
- package/src/capabilities/Commands.ts +86 -0
- package/src/capabilities/ContextTools.ts +184 -0
- package/src/capabilities/Mcp.ts +426 -0
- package/src/capabilities/McpClient.ts +967 -0
- package/src/capabilities/MemoryNotes.ts +174 -0
- package/src/capabilities/Messaging.ts +261 -0
- package/src/capabilities/ModelContext.ts +354 -0
- package/src/capabilities/Redaction.ts +157 -0
- package/src/capabilities/Remembering.ts +550 -0
- package/src/capabilities/RunHooks.ts +280 -0
- package/src/capabilities/SemanticMemory.ts +447 -0
- package/src/capabilities/Subagent.ts +2489 -0
- package/src/capabilities/SubagentReservations.ts +850 -0
- package/src/capabilities/ToolDiscovery.ts +369 -0
- package/src/capabilities/WebCapture.ts +722 -0
- package/src/capabilities/WebSearch.ts +190 -0
- package/src/capabilities/internal/subagent-background.ts +1273 -0
- package/src/capabilities/internal/subagent-contract.ts +146 -0
- package/src/capabilities/internal/subagent-policy.ts +235 -0
- package/src/capabilities/internal/subagent-reporting.ts +136 -0
- package/src/capabilities/internal/utf8.ts +10 -0
- package/src/core/Agent.ts +602 -0
- package/src/core/AgentError.ts +172 -0
- package/src/core/AgentPolicy.ts +153 -0
- package/src/core/AgentUpdates.ts +100 -0
- package/src/core/FailureDiagnostic.ts +343 -0
- package/src/core/IdGenerator.ts +39 -0
- package/src/core/Identifiers.ts +48 -0
- package/src/core/Memory.ts +290 -0
- package/src/core/MemoryNamespace.ts +196 -0
- package/src/core/MemoryReference.ts +121 -0
- package/src/core/MemoryRevalidation.ts +185 -0
- package/src/core/MemoryStore.ts +368 -0
- package/src/core/Messaging.ts +72 -0
- package/src/core/Receipt.ts +42 -0
- package/src/core/RememberingStore.ts +300 -0
- package/src/core/RunEvent.ts +366 -0
- package/src/core/RunPolicyUsage.ts +17 -0
- package/src/core/SemanticMemoryIndex.ts +250 -0
- package/src/core/SemanticMemoryRevalidation.ts +254 -0
- package/src/core/SubagentContract.ts +196 -0
- package/src/core/Thread.ts +371 -0
- package/src/core/ToolExposure.ts +74 -0
- package/src/core/ToolResult.ts +190 -0
- package/src/core/Usage.ts +529 -0
- package/src/core/Worker.ts +240 -0
- package/src/core/internal/agent-updates.ts +34 -0
- package/src/core/internal/message-status.ts +60 -0
- package/src/core/internal/strict-schema.ts +14 -0
- package/src/core/internal/utf8.ts +23 -0
- package/src/durable/ActivityStore.ts +160 -0
- package/src/durable/Admin.ts +505 -0
- package/src/durable/AgentRegistration.ts +14 -0
- package/src/durable/Certification.ts +210 -0
- package/src/durable/CommittedActivity.ts +296 -0
- package/src/durable/Digest.ts +87 -0
- package/src/durable/DurableAgentRuntime.ts +11275 -0
- package/src/durable/DurableFailpoint.ts +111 -0
- package/src/durable/DurableFailpointTestControl.ts +39 -0
- package/src/durable/EventSource.ts +172 -0
- package/src/durable/GitHubWorkflowSource.ts +447 -0
- package/src/durable/MessageDelivery.ts +832 -0
- package/src/durable/MessageDeliveryStoreConformance.ts +410 -0
- package/src/durable/OperationAuthorizer.ts +85 -0
- package/src/durable/PersistentHistory.ts +260 -0
- package/src/durable/PreparedInputAdmission.ts +57 -0
- package/src/durable/Records.ts +1075 -0
- package/src/durable/Recovery.ts +1018 -0
- package/src/durable/RunJournal.ts +1631 -0
- package/src/durable/Schedule.ts +513 -0
- package/src/durable/ScheduleStoreConformance.ts +638 -0
- package/src/durable/ScheduleTransition.ts +265 -0
- package/src/durable/Scheduling.ts +1077 -0
- package/src/durable/SqlMemoryStore.ts +778 -0
- package/src/durable/SqlMessageDeliveryStore.ts +335 -0
- package/src/durable/SqlStorageV2Upgrade.ts +500 -0
- package/src/durable/SqlSubscriptionStore.ts +1440 -0
- package/src/durable/SqlThreadNativeReads.ts +270 -0
- package/src/durable/SubmissionLedger.ts +1265 -0
- package/src/durable/SubmissionLedgerConformance.ts +4820 -0
- package/src/durable/SubmissionStatus.ts +14 -0
- package/src/durable/Subscription.ts +544 -0
- package/src/durable/SubscriptionInput.ts +144 -0
- package/src/durable/SubscriptionStoreConformance.ts +945 -0
- package/src/durable/SubscriptionTools.ts +327 -0
- package/src/durable/SubscriptionTransition.ts +302 -0
- package/src/durable/Subscriptions.ts +1210 -0
- package/src/durable/ThreadContextHistory.ts +227 -0
- package/src/durable/ThreadContextHistoryProjection.ts +216 -0
- package/src/durable/ThreadInvariants.ts +507 -0
- package/src/durable/ThreadProjection.ts +269 -0
- package/src/durable/ThreadProjectionMaintenance.ts +67 -0
- package/src/durable/ThreadStore.ts +573 -0
- package/src/durable/ThreadStoreConformance.ts +1156 -0
- package/src/durable/ToolReconciler.ts +109 -0
- package/src/durable/WakeScheduler.ts +134 -0
- package/src/durable/WorkerHost.ts +171 -0
- package/src/durable/internal/agent-registration.ts +587 -0
- package/src/durable/internal/agent-updates.ts +302 -0
- package/src/durable/internal/foreign-diagnostic.ts +47 -0
- package/src/durable/internal/journal-checkpoint.ts +104 -0
- package/src/durable/internal/journal-metadata.ts +117 -0
- package/src/durable/internal/message-status.ts +20 -0
- package/src/durable/internal/messaging-host.ts +637 -0
- package/src/durable/internal/schedule-time.ts +303 -0
- package/src/durable/internal/storage-v2-layout.ts +163 -0
- package/src/durable/internal/storage-v2.ts +73 -0
- package/src/durable/internal/worker-host.ts +2885 -0
- package/src/durable/internal/worker-runtime.ts +9 -0
- package/src/engine/AgentRuntime.ts +37 -0
- package/src/engine/Compaction.ts +11 -0
- package/src/engine/ContextCompactor.ts +277 -0
- package/src/engine/ContextHistory.ts +73 -0
- package/src/engine/ContextWindow.ts +72 -0
- package/src/engine/DurableStep.ts +132 -0
- package/src/engine/MessagingHost.ts +110 -0
- package/src/engine/Output.ts +2 -0
- package/src/engine/RunEventSink.ts +132 -0
- package/src/engine/RunOptions.ts +1101 -0
- package/src/engine/SubagentHost.ts +230 -0
- package/src/engine/ThreadHistory.ts +120 -0
- package/src/engine/ToolBroker.ts +157 -0
- package/src/engine/ToolExposure.ts +48 -0
- package/src/engine/internal/agent-runtime.ts +10500 -0
- package/src/engine/internal/bounded-value.ts +315 -0
- package/src/engine/internal/compaction.ts +678 -0
- package/src/engine/internal/error-diagnostic.ts +39 -0
- package/src/engine/internal/output-contract.ts +173 -0
- package/src/engine/internal/primitive-delta.ts +80 -0
- package/src/engine/internal/provider-result-staging.ts +211 -0
- package/src/engine/internal/tool-derivative.ts +106 -0
- package/src/engine/internal/tool-exposure.ts +224 -0
- package/src/engine/internal/tool-telemetry.ts +484 -0
- package/src/index.ts +99 -21
- package/src/sandbox/CodeExecutor.ts +352 -0
- package/src/sandbox/InteractiveBrowser.ts +339 -0
- package/src/sandbox/PageCapture.ts +691 -0
- package/src/sandbox/PageCrawl.ts +148 -0
- package/src/sandbox/PageScreenshot.ts +81 -0
- package/src/sandbox/ProtectedBrowser.ts +452 -0
- package/src/sandbox/Sandbox.ts +241 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
import * as FailureDiagnostic from "./FailureDiagnostic.ts";
|
|
4
|
+
import { ToolCallId } from "./Identifiers.ts";
|
|
5
|
+
|
|
6
|
+
/** Run input failed to decode through the agent definition's input Schema. */
|
|
7
|
+
export class AgentInputError extends Schema.TaggedError<AgentInputError>()("AgentInputError", {
|
|
8
|
+
message: Schema.String,
|
|
9
|
+
}) {}
|
|
10
|
+
|
|
11
|
+
/** Final model output failed to decode through the agent definition's output Schema. */
|
|
12
|
+
export class AgentOutputError extends Schema.TaggedError<AgentOutputError>()("AgentOutputError", {
|
|
13
|
+
message: Schema.String,
|
|
14
|
+
}) {}
|
|
15
|
+
|
|
16
|
+
/** An application-selected run disposition failed its definition-owned Schema boundary. */
|
|
17
|
+
export class AgentRunDispositionError extends Schema.TaggedError<AgentRunDispositionError>()(
|
|
18
|
+
"AgentRunDispositionError",
|
|
19
|
+
{
|
|
20
|
+
cause: Schema.Defect(),
|
|
21
|
+
message: Schema.String,
|
|
22
|
+
},
|
|
23
|
+
) {}
|
|
24
|
+
|
|
25
|
+
/** The finite policy dimension a run exhausted; shared with durable settlement metadata. */
|
|
26
|
+
export const PolicyLimit = Schema.Literals([
|
|
27
|
+
"turns",
|
|
28
|
+
"tool-calls",
|
|
29
|
+
"duration",
|
|
30
|
+
"usage",
|
|
31
|
+
"tokens",
|
|
32
|
+
"cost",
|
|
33
|
+
"repeated-failures",
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
export type PolicyLimit = typeof PolicyLimit.Type;
|
|
37
|
+
|
|
38
|
+
/** A run exhausted one of its finite policy limits. */
|
|
39
|
+
export class AgentPolicyError extends Schema.TaggedError<AgentPolicyError>()("AgentPolicyError", {
|
|
40
|
+
limit: PolicyLimit,
|
|
41
|
+
message: Schema.String,
|
|
42
|
+
}) {}
|
|
43
|
+
|
|
44
|
+
/** A native Effect AI Tool approval was explicitly denied before its Handler started. */
|
|
45
|
+
export class AgentApprovalDenied extends Schema.TaggedError<AgentApprovalDenied>()(
|
|
46
|
+
"AgentApprovalDenied",
|
|
47
|
+
{
|
|
48
|
+
toolCallId: ToolCallId,
|
|
49
|
+
toolName: Schema.NonEmptyString,
|
|
50
|
+
message: Schema.String,
|
|
51
|
+
},
|
|
52
|
+
) {
|
|
53
|
+
/** Decode the native Effect AI Tool Call ID at the core error boundary. */
|
|
54
|
+
static override make(input: {
|
|
55
|
+
readonly toolCallId: string;
|
|
56
|
+
readonly toolName: string;
|
|
57
|
+
readonly message: string;
|
|
58
|
+
}): AgentApprovalDenied {
|
|
59
|
+
return super.make({
|
|
60
|
+
...input,
|
|
61
|
+
toolCallId: Schema.decodeSync(ToolCallId)(input.toolCallId),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** A host denied current execution authority for a Tool Call before its Handler started. */
|
|
67
|
+
export class AgentToolAuthorizationDenied extends Schema.TaggedError<AgentToolAuthorizationDenied>()(
|
|
68
|
+
"AgentToolAuthorizationDenied",
|
|
69
|
+
{
|
|
70
|
+
toolCallId: ToolCallId,
|
|
71
|
+
toolName: Schema.NonEmptyString,
|
|
72
|
+
message: Schema.String,
|
|
73
|
+
/** Optional original policy evidence, excluded from model-facing ToolCallFailed data. */
|
|
74
|
+
cause: Schema.optionalKey(FailureDiagnostic.Cause),
|
|
75
|
+
stack: Schema.optionalKey(Schema.String),
|
|
76
|
+
},
|
|
77
|
+
) {}
|
|
78
|
+
|
|
79
|
+
/** The host could not complete its authority check; this is not a policy denial. */
|
|
80
|
+
export class AgentToolAuthorizationCheckError extends Schema.TaggedError<AgentToolAuthorizationCheckError>()(
|
|
81
|
+
"AgentToolAuthorizationCheckError",
|
|
82
|
+
{
|
|
83
|
+
toolCallId: ToolCallId,
|
|
84
|
+
toolName: Schema.NonEmptyString,
|
|
85
|
+
/** Safe summary. The original cause is private diagnostic evidence. */
|
|
86
|
+
message: Schema.String,
|
|
87
|
+
check: Schema.optionalKey(Schema.String),
|
|
88
|
+
callId: Schema.optionalKey(Schema.String),
|
|
89
|
+
cause: FailureDiagnostic.Cause,
|
|
90
|
+
stack: Schema.optionalKey(Schema.String),
|
|
91
|
+
},
|
|
92
|
+
) {}
|
|
93
|
+
|
|
94
|
+
/** A native Effect AI Tool approval has no decision and the ephemeral Run cannot proceed. */
|
|
95
|
+
export class AgentApprovalPending extends Schema.TaggedError<AgentApprovalPending>()(
|
|
96
|
+
"AgentApprovalPending",
|
|
97
|
+
{
|
|
98
|
+
approvalId: Schema.NonEmptyString,
|
|
99
|
+
toolCallId: ToolCallId,
|
|
100
|
+
toolName: Schema.NonEmptyString,
|
|
101
|
+
message: Schema.String,
|
|
102
|
+
},
|
|
103
|
+
) {
|
|
104
|
+
/** Decode the native Effect AI Tool Call ID at the core error boundary. */
|
|
105
|
+
static override make(input: {
|
|
106
|
+
readonly approvalId: string;
|
|
107
|
+
readonly toolCallId: string;
|
|
108
|
+
readonly toolName: string;
|
|
109
|
+
readonly message: string;
|
|
110
|
+
}): AgentApprovalPending {
|
|
111
|
+
return super.make({
|
|
112
|
+
...input,
|
|
113
|
+
toolCallId: Schema.decodeSync(ToolCallId)(input.toolCallId),
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** A model response sequence violated an agent-loop protocol invariant. */
|
|
119
|
+
export class ModelProtocolError extends Schema.TaggedError<ModelProtocolError>()(
|
|
120
|
+
"ModelProtocolError",
|
|
121
|
+
{
|
|
122
|
+
message: Schema.String,
|
|
123
|
+
},
|
|
124
|
+
) {}
|
|
125
|
+
|
|
126
|
+
/** A run was interrupted without manufacturing a successful result. */
|
|
127
|
+
export class AgentInterrupted extends Schema.TaggedError<AgentInterrupted>()("AgentInterrupted", {
|
|
128
|
+
message: Schema.String,
|
|
129
|
+
}) {}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The provider rejected a prompt that exceeds the model context window and
|
|
133
|
+
* compaction recovery is unavailable or was already attempted once. This is
|
|
134
|
+
* an expected failure: the engine classifies the provider error rather than
|
|
135
|
+
* surfacing an opaque transport failure.
|
|
136
|
+
*/
|
|
137
|
+
export class ContextOverflowError extends Schema.TaggedError<ContextOverflowError>()(
|
|
138
|
+
"ContextOverflowError",
|
|
139
|
+
{
|
|
140
|
+
message: Schema.String,
|
|
141
|
+
retried: Schema.Boolean,
|
|
142
|
+
},
|
|
143
|
+
) {}
|
|
144
|
+
|
|
145
|
+
/** Local context preparation could not fit a legal prompt inside its target before provider I/O. */
|
|
146
|
+
export class ContextBudgetError extends Schema.TaggedError<ContextBudgetError>()(
|
|
147
|
+
"ContextBudgetError",
|
|
148
|
+
{
|
|
149
|
+
message: Schema.String,
|
|
150
|
+
estimatedTokens: Schema.Natural,
|
|
151
|
+
targetTokens: Schema.Natural,
|
|
152
|
+
completionReserveTokens: Schema.Natural,
|
|
153
|
+
},
|
|
154
|
+
) {}
|
|
155
|
+
|
|
156
|
+
/** Schema for framework-owned agent errors; application and Effect AI failures remain separate. */
|
|
157
|
+
export const AgentError = Schema.Union([
|
|
158
|
+
AgentInputError,
|
|
159
|
+
AgentOutputError,
|
|
160
|
+
AgentRunDispositionError,
|
|
161
|
+
AgentPolicyError,
|
|
162
|
+
AgentApprovalDenied,
|
|
163
|
+
AgentToolAuthorizationDenied,
|
|
164
|
+
AgentToolAuthorizationCheckError,
|
|
165
|
+
AgentApprovalPending,
|
|
166
|
+
ModelProtocolError,
|
|
167
|
+
AgentInterrupted,
|
|
168
|
+
ContextOverflowError,
|
|
169
|
+
ContextBudgetError,
|
|
170
|
+
]);
|
|
171
|
+
|
|
172
|
+
export type AgentError = typeof AgentError.Type;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import * as Duration from "effect/Duration";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
|
|
4
|
+
import { ToolResultBounds } from "./ToolResult.ts";
|
|
5
|
+
|
|
6
|
+
const PositiveInt = Schema.Int.check(Schema.isGreaterThan(0));
|
|
7
|
+
const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
|
|
8
|
+
|
|
9
|
+
const CompactionMode = Schema.Literals(["prune", "summarize", "prune-then-summarize"]);
|
|
10
|
+
|
|
11
|
+
/** Inputs normalized and validated by `CompactionPolicy.make`. */
|
|
12
|
+
export type CompactionPolicyInput = Readonly<{
|
|
13
|
+
/** Estimated tokens of recent history preserved verbatim across a compaction; defaults to `20_000`. */
|
|
14
|
+
readonly keepRecentTokens?: number;
|
|
15
|
+
/** Compaction strategy order; defaults to `"prune-then-summarize"`. */
|
|
16
|
+
readonly mode?: typeof CompactionMode.Type;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
/** How the engine reduces model context when `contextTokenLimit` is crossed. */
|
|
20
|
+
export class CompactionPolicy extends Schema.Class<CompactionPolicy>("CompactionPolicy")({
|
|
21
|
+
keepRecentTokens: PositiveInt,
|
|
22
|
+
mode: CompactionMode,
|
|
23
|
+
}) {
|
|
24
|
+
/** Normalize and validate compaction bounds, filling documented defaults. */
|
|
25
|
+
static override make(input: CompactionPolicyInput = {}): CompactionPolicy {
|
|
26
|
+
return super.make({
|
|
27
|
+
keepRecentTokens: input.keepRecentTokens ?? 20_000,
|
|
28
|
+
mode: input.mode ?? "prune-then-summarize",
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const FinitePositiveDuration = Schema.Duration.pipe(
|
|
34
|
+
Schema.refine(
|
|
35
|
+
(duration): duration is Duration.Duration =>
|
|
36
|
+
Duration.isFinite(duration) && Duration.isPositive(duration),
|
|
37
|
+
{ expected: "a finite positive duration" },
|
|
38
|
+
),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Resolution when `maxTurns`, `maxToolCalls`, or `tokenBudget` is exhausted:
|
|
43
|
+
* `"final-answer"` gives the model one constrained opportunity to settle with
|
|
44
|
+
* output (the Run completes with `finishReason: "budget-exhausted"` and the
|
|
45
|
+
* exhausted-dimension marker), while `"fail"` fails the Run typed. Turn and
|
|
46
|
+
* Tool Call bounds resolve per RUN-018/RUN-019; the token dimension
|
|
47
|
+
* participates per RUN-025 with a one-shot bound (at most one grace call).
|
|
48
|
+
* Duration, cost, and repeated-failure bounds are hard rails regardless of
|
|
49
|
+
* this setting.
|
|
50
|
+
*/
|
|
51
|
+
const OnExhaustion = Schema.Literals(["final-answer", "fail"]);
|
|
52
|
+
|
|
53
|
+
const AgentPolicyFields = Schema.Struct({
|
|
54
|
+
maxTurns: PositiveInt,
|
|
55
|
+
maxToolCalls: PositiveInt,
|
|
56
|
+
maxDuration: FinitePositiveDuration,
|
|
57
|
+
toolConcurrency: PositiveInt,
|
|
58
|
+
repeatedFailureLimit: NonNegativeInt,
|
|
59
|
+
onExhaustion: OnExhaustion,
|
|
60
|
+
tokenBudget: Schema.optionalKey(PositiveInt),
|
|
61
|
+
/** Tokens withheld from research calls so one final delivery call remains admissible. */
|
|
62
|
+
completionReserveTokens: NonNegativeInt,
|
|
63
|
+
costBudgetMicrousd: Schema.optionalKey(NonNegativeInt),
|
|
64
|
+
/** Per-model-call live-context bound; crossing it triggers compaction rather than failure. */
|
|
65
|
+
contextTokenLimit: Schema.optionalKey(PositiveInt),
|
|
66
|
+
toolResultBounds: ToolResultBounds,
|
|
67
|
+
runStatus: Schema.Literals(["appended", "off"]),
|
|
68
|
+
compaction: CompactionPolicy,
|
|
69
|
+
}).check(
|
|
70
|
+
Schema.makeFilter((policy) =>
|
|
71
|
+
policy.tokenBudget !== undefined && policy.completionReserveTokens > policy.tokenBudget
|
|
72
|
+
? {
|
|
73
|
+
path: ["completionReserveTokens"],
|
|
74
|
+
issue: "completionReserveTokens cannot exceed tokenBudget",
|
|
75
|
+
}
|
|
76
|
+
: undefined,
|
|
77
|
+
),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
type AgentPolicyFields = typeof AgentPolicyFields.Type;
|
|
81
|
+
|
|
82
|
+
/** Inputs normalized and validated by `AgentPolicy.make`. */
|
|
83
|
+
export type AgentPolicyInput = Readonly<
|
|
84
|
+
Omit<
|
|
85
|
+
AgentPolicyFields,
|
|
86
|
+
| "maxDuration"
|
|
87
|
+
| "repeatedFailureLimit"
|
|
88
|
+
| "onExhaustion"
|
|
89
|
+
| "toolResultBounds"
|
|
90
|
+
| "runStatus"
|
|
91
|
+
| "compaction"
|
|
92
|
+
| "completionReserveTokens"
|
|
93
|
+
> & {
|
|
94
|
+
/** Finite, positive wall-clock duration accepted in any Effect Duration input form. */
|
|
95
|
+
readonly maxDuration: Duration.Input;
|
|
96
|
+
/** Non-negative repeated-failure bound; defaults to `3`. */
|
|
97
|
+
readonly repeatedFailureLimit?: number;
|
|
98
|
+
/** Turn/Tool-Call/token exhaustion resolution; defaults to `"final-answer"`. */
|
|
99
|
+
readonly onExhaustion?: typeof OnExhaustion.Type;
|
|
100
|
+
/** Byte bound for each encoded Tool result; defaults to `50 KiB`. */
|
|
101
|
+
readonly toolResultBounds?: ToolResultBounds;
|
|
102
|
+
/** Whether a derived run-status message is appended to each model call; defaults to `"off"` to preserve retained prompt cache boundaries. */
|
|
103
|
+
readonly runStatus?: AgentPolicyFields["runStatus"];
|
|
104
|
+
/** Tokens reserved for final delivery; defaults to 20% of tokenBudget, capped at 4,096. */
|
|
105
|
+
readonly completionReserveTokens?: number;
|
|
106
|
+
/** Compaction strategy applied when `contextTokenLimit` is crossed; defaults documented on `CompactionPolicy`. */
|
|
107
|
+
readonly compaction?: CompactionPolicy;
|
|
108
|
+
}
|
|
109
|
+
>;
|
|
110
|
+
|
|
111
|
+
/** Schema class for finite agent run limits. */
|
|
112
|
+
export class AgentPolicy extends Schema.Class<AgentPolicy>("AgentPolicy")(AgentPolicyFields) {
|
|
113
|
+
/** Resolve an optional declaration against finite standalone or parent defaults. */
|
|
114
|
+
static resolve(input: Partial<AgentPolicyInput> = {}, parent?: AgentPolicy): AgentPolicy {
|
|
115
|
+
return AgentPolicy.make({
|
|
116
|
+
maxTurns: 12,
|
|
117
|
+
maxToolCalls: 24,
|
|
118
|
+
maxDuration: "5 minutes",
|
|
119
|
+
toolConcurrency: 4,
|
|
120
|
+
...parent,
|
|
121
|
+
...input,
|
|
122
|
+
// A smaller token budget must not inherit a reserve larger than itself.
|
|
123
|
+
...(input.completionReserveTokens !== undefined || parent === undefined
|
|
124
|
+
? {}
|
|
125
|
+
: {
|
|
126
|
+
completionReserveTokens: Math.min(
|
|
127
|
+
parent.completionReserveTokens,
|
|
128
|
+
input.tokenBudget ?? parent.tokenBudget ?? parent.completionReserveTokens,
|
|
129
|
+
),
|
|
130
|
+
}),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Normalize and validate finite policy bounds, throwing on invalid input. */
|
|
135
|
+
static override make(input: AgentPolicyInput): AgentPolicy {
|
|
136
|
+
const completionReserveTokens =
|
|
137
|
+
input.completionReserveTokens ??
|
|
138
|
+
(input.tokenBudget === undefined
|
|
139
|
+
? 4_096
|
|
140
|
+
: Math.min(4_096, Math.floor(input.tokenBudget / 5)));
|
|
141
|
+
|
|
142
|
+
return super.make({
|
|
143
|
+
...input,
|
|
144
|
+
maxDuration: Duration.fromInputUnsafe(input.maxDuration),
|
|
145
|
+
repeatedFailureLimit: input.repeatedFailureLimit ?? 3,
|
|
146
|
+
onExhaustion: input.onExhaustion ?? "final-answer",
|
|
147
|
+
toolResultBounds: input.toolResultBounds ?? ToolResultBounds.make({ maxBytes: 50 * 1024 }),
|
|
148
|
+
runStatus: input.runStatus ?? "off",
|
|
149
|
+
completionReserveTokens,
|
|
150
|
+
compaction: input.compaction ?? CompactionPolicy.make(),
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Context, Effect, Option, Schema, Stream } from "effect";
|
|
2
|
+
|
|
3
|
+
import { AgentId, ThreadId, RunId } from "./Identifiers.ts";
|
|
4
|
+
import { IdempotencyKey } from "./Receipt.ts";
|
|
5
|
+
|
|
6
|
+
/** Canonical schema-encoded intermediate output, scoped to one logical Run. */
|
|
7
|
+
export class Update extends Schema.Class<Update>("@effect-agent/core/AgentUpdates/Update")({
|
|
8
|
+
schemaVersion: Schema.Literal(1),
|
|
9
|
+
agentId: AgentId,
|
|
10
|
+
threadId: ThreadId,
|
|
11
|
+
runId: RunId,
|
|
12
|
+
updateId: IdempotencyKey,
|
|
13
|
+
sequence: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
14
|
+
value: Schema.Json,
|
|
15
|
+
}) {}
|
|
16
|
+
|
|
17
|
+
/** Fail-closed update acceptance and decoding errors; payloads are never included. */
|
|
18
|
+
export class UpdateError extends Schema.TaggedError<UpdateError>()("AgentUpdateError", {
|
|
19
|
+
reason: Schema.Literals([
|
|
20
|
+
"validation",
|
|
21
|
+
"unavailable",
|
|
22
|
+
"conflict",
|
|
23
|
+
"capacity",
|
|
24
|
+
"storage",
|
|
25
|
+
"identity",
|
|
26
|
+
"denied",
|
|
27
|
+
]),
|
|
28
|
+
}) {}
|
|
29
|
+
|
|
30
|
+
/** Engine-owned invocation port. The Agent ID and exact update Schema must match the executing definition. */
|
|
31
|
+
export class Emitter extends Context.Service<
|
|
32
|
+
Emitter,
|
|
33
|
+
{
|
|
34
|
+
readonly emit: (request: {
|
|
35
|
+
readonly target: { readonly id: AgentId; readonly updates?: Schema.Top | undefined };
|
|
36
|
+
readonly updateId: IdempotencyKey;
|
|
37
|
+
readonly value: Schema.Json;
|
|
38
|
+
}) => Effect.Effect<Update, UpdateError>;
|
|
39
|
+
}
|
|
40
|
+
>()("@effect-agent/core/AgentUpdates/Emitter") {}
|
|
41
|
+
|
|
42
|
+
/** Structural schema boundary accepted by definitions and their model bindings. */
|
|
43
|
+
type Source<S extends Schema.Top> = {
|
|
44
|
+
readonly id: AgentId;
|
|
45
|
+
readonly updates?: S | undefined;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
type BoundSource<S extends Schema.Top> = Source<S> | { readonly definition: Source<S> };
|
|
49
|
+
|
|
50
|
+
/** Emit a decoded update under an explicit stable key. Retries cannot replace accepted values. */
|
|
51
|
+
export const emit = Effect.fn("AgentUpdates.emit")(function* <S extends Schema.Top>(
|
|
52
|
+
agent: BoundSource<S>,
|
|
53
|
+
value: NoInfer<S["Type"]>,
|
|
54
|
+
options: { readonly idempotencyKey: IdempotencyKey },
|
|
55
|
+
): Effect.fn.Return<Update, UpdateError, Emitter | S["EncodingServices"]> {
|
|
56
|
+
const target = "definition" in agent ? agent.definition : agent;
|
|
57
|
+
|
|
58
|
+
if (target.updates === undefined) return yield* new UpdateError({ reason: "unavailable" });
|
|
59
|
+
|
|
60
|
+
const updateId = yield* Schema.decodeEffect(IdempotencyKey)(options.idempotencyKey).pipe(
|
|
61
|
+
Effect.mapError(() => new UpdateError({ reason: "validation" })),
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const encoded = yield* Schema.encodeEffect(target.updates)(value).pipe(
|
|
65
|
+
Effect.flatMap(Schema.decodeUnknownEffect(Schema.Json)),
|
|
66
|
+
Effect.mapError(() => new UpdateError({ reason: "validation" })),
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const emitter = yield* Effect.serviceOption(Emitter);
|
|
70
|
+
|
|
71
|
+
if (Option.isNone(emitter)) return yield* new UpdateError({ reason: "unavailable" });
|
|
72
|
+
|
|
73
|
+
return yield* emitter.value.emit({ target, updateId, value: encoded });
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
/** Decode canonical update data through its declaring Agent Schema. */
|
|
77
|
+
export const decode = Effect.fn("AgentUpdates.decode")(function* <S extends Schema.Top>(
|
|
78
|
+
agent: BoundSource<S>,
|
|
79
|
+
update: Update,
|
|
80
|
+
): Effect.fn.Return<S["Type"], UpdateError, S["DecodingServices"]> {
|
|
81
|
+
const definition = "definition" in agent ? agent.definition : agent;
|
|
82
|
+
|
|
83
|
+
if (definition.updates === undefined) return yield* new UpdateError({ reason: "unavailable" });
|
|
84
|
+
|
|
85
|
+
const decoded = yield* Schema.decodeEffect(Update)(update).pipe(
|
|
86
|
+
Effect.mapError(() => new UpdateError({ reason: "validation" })),
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
if (decoded.agentId !== definition.id) return yield* new UpdateError({ reason: "identity" });
|
|
90
|
+
|
|
91
|
+
return yield* Schema.decodeEffect(definition.updates)(decoded.value).pipe(
|
|
92
|
+
Effect.mapError(() => new UpdateError({ reason: "validation" })),
|
|
93
|
+
);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
/** Decode an encoded update stream without hiding its failures or requirements. */
|
|
97
|
+
export const observe = <S extends Schema.Top, E, R>(
|
|
98
|
+
agent: BoundSource<S>,
|
|
99
|
+
updates: Stream.Stream<Update, E, R>,
|
|
100
|
+
) => updates.pipe(Stream.mapEffect((update) => decode(agent, update)));
|