effect-agent 0.1.0-beta.11 → 0.1.0-beta.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Agent-1DMSO_Fl.mjs +86 -0
- package/dist/Agent-1DMSO_Fl.mjs.map +1 -0
- package/dist/Agent-DriBcXBN.d.mts +245 -0
- package/dist/AgentError-Bn1ytXRD.d.mts +117 -0
- package/dist/AgentPolicy-BqDoSXO6.d.mts +96 -0
- package/dist/AgentRuntime-CWkHuzyt.d.mts +346 -0
- package/dist/AgentRuntime-DLwPoEVH.mjs +4735 -0
- package/dist/AgentRuntime-DLwPoEVH.mjs.map +1 -0
- package/dist/AgentUpdates-DMJ-_xow.d.mts +53 -0
- package/dist/ContextCompactor-WwSIG_Z2.d.mts +161 -0
- package/dist/ContextWindow-DRQ5Mbm2.d.mts +58 -0
- package/dist/DurableAgentRuntime-PyIgNYXF.mjs +6772 -0
- package/dist/DurableAgentRuntime-PyIgNYXF.mjs.map +1 -0
- package/dist/DurableFailpoint-mx3-nsxU.d.mts +41 -0
- package/dist/DurableStep-Cry_iol4.d.mts +103 -0
- package/dist/EventSource-BUYLmL77.d.mts +51 -0
- package/dist/FailureDiagnostic-BElLOoED.mjs +274 -0
- package/dist/FailureDiagnostic-BElLOoED.mjs.map +1 -0
- package/dist/FailureDiagnostic-CaAkzGHL.d.mts +223 -0
- package/dist/Identifiers-CN2s30fF.d.mts +40 -0
- package/dist/InMemory.d.mts +24 -0
- package/dist/InMemory.mjs +24 -0
- package/dist/InMemory.mjs.map +1 -0
- package/dist/MemoryNamespace-BbRW5p71.d.mts +36 -0
- package/dist/MemoryReference-B8Q3UJoJ.d.mts +79 -0
- package/dist/Messaging-DaZDlBqh.d.mts +1067 -0
- package/dist/Messaging-Dkg87ebg.d.mts +221 -0
- package/dist/MessagingHost-D89X7ma8.mjs +110 -0
- package/dist/MessagingHost-D89X7ma8.mjs.map +1 -0
- package/dist/MessagingHost-e1Sbzfao.d.mts +74 -0
- package/dist/OperationAuthorizer-TzcQtpX5.d.mts +61 -0
- package/dist/Output-CAFJTAbP.d.mts +25 -0
- package/dist/PageCapture-Df8Xwskw.d.mts +583 -0
- package/dist/PageScreenshot-BpgZKAxl.d.mts +48 -0
- package/dist/PreparedInputAdmission-J3YK6LAm.d.mts +42 -0
- package/dist/Receipt-BAHyigAF.d.mts +33 -0
- package/dist/Records-4qnRmniE.d.mts +4058 -0
- package/dist/RunEvent-DIrzkjLr.d.mts +460 -0
- package/dist/RunEventSink-D5aVhISG.d.mts +108 -0
- package/dist/RunJournal-BXrq0VIK.mjs +931 -0
- package/dist/RunJournal-BXrq0VIK.mjs.map +1 -0
- package/dist/RunOptions-BoESJrxw.d.mts +935 -0
- package/dist/RunPolicyUsage-ClZxyR46.d.mts +21 -0
- package/dist/Sandbox-CEsDWBLq.d.mts +173 -0
- package/dist/Schedule-C2lH2kxY.d.mts +847 -0
- package/dist/Scheduling-DPb2QyAK.mjs +691 -0
- package/dist/Scheduling-DPb2QyAK.mjs.map +1 -0
- package/dist/Subagent-D9eYdGTl.mjs +1537 -0
- package/dist/Subagent-D9eYdGTl.mjs.map +1 -0
- package/dist/Subagent-F72tuaxy.d.mts +1360 -0
- package/dist/SubagentContract-DdT7Cqe6.d.mts +116 -0
- package/dist/SubagentHost-CmiNTOBZ.d.mts +149 -0
- package/dist/Subscription-pQUv0QD6.d.mts +945 -0
- package/dist/SubscriptionInput-DdJOiNMY.d.mts +41 -0
- package/dist/Thread-DOBQ0QUY.d.mts +96 -0
- package/dist/ThreadHistory-tS1KwxHR.d.mts +60 -0
- package/dist/ToolBroker-DWs4tZra.d.mts +133 -0
- package/dist/ToolExposure-9uF_Yo0T.mjs +10 -0
- package/dist/ToolExposure-9uF_Yo0T.mjs.map +1 -0
- package/dist/ToolExposure-C93U1sPu.mjs +30 -0
- package/dist/ToolExposure-C93U1sPu.mjs.map +1 -0
- package/dist/ToolExposure-UCN12eCd.d.mts +39 -0
- package/dist/ToolExposure-r2eOWk4F.d.mts +46 -0
- package/dist/ToolExposure.d.mts +8 -0
- package/dist/ToolExposure.mjs +21 -0
- package/dist/ToolExposure.mjs.map +1 -0
- package/dist/ToolReconciler-BmVRAHKs.d.mts +80 -0
- package/dist/ToolResult-BKdqWRff.d.mts +78 -0
- package/dist/Usage-Dx0aknfk.d.mts +121 -0
- package/dist/WakeScheduler-EjUF-GhC.d.mts +56 -0
- package/dist/Worker-Du9dhVnp.d.mts +279 -0
- package/dist/Worker-T_3RbaKc.mjs +210 -0
- package/dist/Worker-T_3RbaKc.mjs.map +1 -0
- package/dist/agent-registration-B5CI-Ygk.mjs +201 -0
- package/dist/agent-registration-B5CI-Ygk.mjs.map +1 -0
- package/dist/capabilities/Approval.d.mts +114 -0
- package/dist/capabilities/Approval.mjs +226 -0
- package/dist/capabilities/Approval.mjs.map +1 -0
- package/dist/capabilities/Budget.d.mts +112 -0
- package/dist/capabilities/Budget.mjs +346 -0
- package/dist/capabilities/Budget.mjs.map +1 -0
- package/dist/capabilities/CodeMode.d.mts +157 -0
- package/dist/capabilities/CodeMode.mjs +522 -0
- package/dist/capabilities/CodeMode.mjs.map +1 -0
- package/dist/capabilities/Commands.d.mts +55 -0
- package/dist/capabilities/Commands.mjs +57 -0
- package/dist/capabilities/Commands.mjs.map +1 -0
- package/dist/capabilities/ContextTools.d.mts +321 -0
- package/dist/capabilities/ContextTools.mjs +126 -0
- package/dist/capabilities/ContextTools.mjs.map +1 -0
- package/dist/capabilities/Mcp.d.mts +108 -0
- package/dist/capabilities/Mcp.mjs +260 -0
- package/dist/capabilities/Mcp.mjs.map +1 -0
- package/dist/capabilities/McpClient.d.mts +115 -0
- package/dist/capabilities/McpClient.mjs +506 -0
- package/dist/capabilities/McpClient.mjs.map +1 -0
- package/dist/capabilities/MemoryNotes.d.mts +424 -0
- package/dist/capabilities/MemoryNotes.mjs +128 -0
- package/dist/capabilities/MemoryNotes.mjs.map +1 -0
- package/dist/capabilities/Messaging.d.mts +3 -0
- package/dist/capabilities/Messaging.mjs +152 -0
- package/dist/capabilities/Messaging.mjs.map +1 -0
- package/dist/capabilities/ModelContext.d.mts +89 -0
- package/dist/capabilities/ModelContext.mjs +168 -0
- package/dist/capabilities/ModelContext.mjs.map +1 -0
- package/dist/capabilities/Redaction.d.mts +37 -0
- package/dist/capabilities/Redaction.mjs +104 -0
- package/dist/capabilities/Redaction.mjs.map +1 -0
- package/dist/capabilities/Remembering.d.mts +434 -0
- package/dist/capabilities/Remembering.mjs +290 -0
- package/dist/capabilities/Remembering.mjs.map +1 -0
- package/dist/capabilities/RunHooks.d.mts +82 -0
- package/dist/capabilities/RunHooks.mjs +144 -0
- package/dist/capabilities/RunHooks.mjs.map +1 -0
- package/dist/capabilities/SemanticMemory.d.mts +431 -0
- package/dist/capabilities/SemanticMemory.mjs +315 -0
- package/dist/capabilities/SemanticMemory.mjs.map +1 -0
- package/dist/capabilities/Subagent.d.mts +4 -0
- package/dist/capabilities/Subagent.mjs +5 -0
- package/dist/capabilities/SubagentReservations.d.mts +186 -0
- package/dist/capabilities/SubagentReservations.mjs +479 -0
- package/dist/capabilities/SubagentReservations.mjs.map +1 -0
- package/dist/capabilities/ToolDiscovery.d.mts +124 -0
- package/dist/capabilities/ToolDiscovery.mjs +230 -0
- package/dist/capabilities/ToolDiscovery.mjs.map +1 -0
- package/dist/capabilities/WebCapture.d.mts +163 -0
- package/dist/capabilities/WebCapture.mjs +335 -0
- package/dist/capabilities/WebCapture.mjs.map +1 -0
- package/dist/capabilities/WebSearch.d.mts +71 -0
- package/dist/capabilities/WebSearch.mjs +115 -0
- package/dist/capabilities/WebSearch.mjs.map +1 -0
- package/dist/compaction-C2OTceKw.mjs +505 -0
- package/dist/compaction-C2OTceKw.mjs.map +1 -0
- package/dist/core/Agent.d.mts +2 -0
- package/dist/core/Agent.mjs +2 -0
- package/dist/core/AgentError.d.mts +2 -0
- package/dist/core/AgentError.mjs +134 -0
- package/dist/core/AgentError.mjs.map +1 -0
- package/dist/core/AgentPolicy.d.mts +2 -0
- package/dist/core/AgentPolicy.mjs +94 -0
- package/dist/core/AgentPolicy.mjs.map +1 -0
- package/dist/core/AgentUpdates.d.mts +2 -0
- package/dist/core/AgentUpdates.mjs +63 -0
- package/dist/core/AgentUpdates.mjs.map +1 -0
- package/dist/core/FailureDiagnostic.d.mts +2 -0
- package/dist/core/FailureDiagnostic.mjs +2 -0
- package/dist/core/IdGenerator.d.mts +26 -0
- package/dist/core/IdGenerator.mjs +27 -0
- package/dist/core/IdGenerator.mjs.map +1 -0
- package/dist/core/Identifiers.d.mts +2 -0
- package/dist/core/Identifiers.mjs +43 -0
- package/dist/core/Identifiers.mjs.map +1 -0
- package/dist/core/Memory.d.mts +57 -0
- package/dist/core/Memory.mjs +203 -0
- package/dist/core/Memory.mjs.map +1 -0
- package/dist/core/MemoryNamespace.d.mts +2 -0
- package/dist/core/MemoryNamespace.mjs +116 -0
- package/dist/core/MemoryNamespace.mjs.map +1 -0
- package/dist/core/MemoryReference.d.mts +2 -0
- package/dist/core/MemoryReference.mjs +109 -0
- package/dist/core/MemoryReference.mjs.map +1 -0
- package/dist/core/MemoryRevalidation.d.mts +65 -0
- package/dist/core/MemoryRevalidation.mjs +126 -0
- package/dist/core/MemoryRevalidation.mjs.map +1 -0
- package/dist/core/MemoryStore.d.mts +186 -0
- package/dist/core/MemoryStore.mjs +243 -0
- package/dist/core/MemoryStore.mjs.map +1 -0
- package/dist/core/Receipt.d.mts +2 -0
- package/dist/core/Receipt.mjs +36 -0
- package/dist/core/Receipt.mjs.map +1 -0
- package/dist/core/RememberingStore.d.mts +1562 -0
- package/dist/core/RememberingStore.mjs +190 -0
- package/dist/core/RememberingStore.mjs.map +1 -0
- package/dist/core/RunEvent.d.mts +2 -0
- package/dist/core/RunEvent.mjs +337 -0
- package/dist/core/RunEvent.mjs.map +1 -0
- package/dist/core/RunPolicyUsage.d.mts +2 -0
- package/dist/core/RunPolicyUsage.mjs +21 -0
- package/dist/core/RunPolicyUsage.mjs.map +1 -0
- package/dist/core/SemanticMemoryIndex.d.mts +826 -0
- package/dist/core/SemanticMemoryIndex.mjs +185 -0
- package/dist/core/SemanticMemoryIndex.mjs.map +1 -0
- package/dist/core/SemanticMemoryRevalidation.d.mts +45 -0
- package/dist/core/SemanticMemoryRevalidation.mjs +191 -0
- package/dist/core/SemanticMemoryRevalidation.mjs.map +1 -0
- package/dist/core/SubagentContract.d.mts +2 -0
- package/dist/core/SubagentContract.mjs +148 -0
- package/dist/core/SubagentContract.mjs.map +1 -0
- package/dist/core/Thread.d.mts +2 -0
- package/dist/core/Thread.mjs +250 -0
- package/dist/core/Thread.mjs.map +1 -0
- package/dist/core/ToolResult.d.mts +2 -0
- package/dist/core/ToolResult.mjs +156 -0
- package/dist/core/ToolResult.mjs.map +1 -0
- package/dist/core/Usage.d.mts +2 -0
- package/dist/core/Usage.mjs +319 -0
- package/dist/core/Usage.mjs.map +1 -0
- package/dist/core/Worker.d.mts +3 -0
- package/dist/core/Worker.mjs +3 -0
- package/dist/durable/ActivityStore.d.mts +116 -0
- package/dist/durable/ActivityStore.mjs +131 -0
- package/dist/durable/ActivityStore.mjs.map +1 -0
- package/dist/durable/Admin.d.mts +2 -0
- package/dist/durable/Admin.mjs +330 -0
- package/dist/durable/Admin.mjs.map +1 -0
- package/dist/durable/AgentRegistration.d.mts +2 -0
- package/dist/durable/AgentRegistration.mjs +14 -0
- package/dist/durable/AgentRegistration.mjs.map +1 -0
- package/dist/durable/Certification.d.mts +110 -0
- package/dist/durable/Certification.mjs +159 -0
- package/dist/durable/Certification.mjs.map +1 -0
- package/dist/durable/CommittedActivity.d.mts +62 -0
- package/dist/durable/CommittedActivity.mjs +159 -0
- package/dist/durable/CommittedActivity.mjs.map +1 -0
- package/dist/durable/Digest.d.mts +2 -0
- package/dist/durable/Digest.mjs +50 -0
- package/dist/durable/Digest.mjs.map +1 -0
- package/dist/durable/DurableAgentRuntime.d.mts +3 -0
- package/dist/durable/DurableAgentRuntime.mjs +3 -0
- package/dist/durable/DurableFailpoint.d.mts +2 -0
- package/dist/durable/DurableFailpoint.mjs +98 -0
- package/dist/durable/DurableFailpoint.mjs.map +1 -0
- package/dist/durable/DurableFailpointTestControl.d.mts +14 -0
- package/dist/durable/DurableFailpointTestControl.mjs +19 -0
- package/dist/durable/DurableFailpointTestControl.mjs.map +1 -0
- package/dist/durable/EventSource.d.mts +2 -0
- package/dist/durable/EventSource.mjs +65 -0
- package/dist/durable/EventSource.mjs.map +1 -0
- package/dist/durable/GitHubWorkflowSource.d.mts +185 -0
- package/dist/durable/GitHubWorkflowSource.mjs +209 -0
- package/dist/durable/GitHubWorkflowSource.mjs.map +1 -0
- package/dist/durable/MessageDelivery.d.mts +876 -0
- package/dist/durable/MessageDelivery.mjs +549 -0
- package/dist/durable/MessageDelivery.mjs.map +1 -0
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +376 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs +270 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs.map +1 -0
- package/dist/durable/OperationAuthorizer.d.mts +2 -0
- package/dist/durable/OperationAuthorizer.mjs +70 -0
- package/dist/durable/OperationAuthorizer.mjs.map +1 -0
- package/dist/durable/PersistentHistory.d.mts +16 -0
- package/dist/durable/PersistentHistory.mjs +125 -0
- package/dist/durable/PersistentHistory.mjs.map +1 -0
- package/dist/durable/PreparedInputAdmission.d.mts +2 -0
- package/dist/durable/PreparedInputAdmission.mjs +38 -0
- package/dist/durable/PreparedInputAdmission.mjs.map +1 -0
- package/dist/durable/Records.d.mts +2 -0
- package/dist/durable/Records.mjs +841 -0
- package/dist/durable/Records.mjs.map +1 -0
- package/dist/durable/Recovery.d.mts +2 -0
- package/dist/durable/Recovery.mjs +739 -0
- package/dist/durable/Recovery.mjs.map +1 -0
- package/dist/durable/RunJournal.d.mts +2 -0
- package/dist/durable/RunJournal.mjs +2 -0
- package/dist/durable/Schedule.d.mts +2 -0
- package/dist/durable/Schedule.mjs +391 -0
- package/dist/durable/Schedule.mjs.map +1 -0
- package/dist/durable/ScheduleStoreConformance.d.mts +17 -0
- package/dist/durable/ScheduleStoreConformance.mjs +420 -0
- package/dist/durable/ScheduleStoreConformance.mjs.map +1 -0
- package/dist/durable/ScheduleTransition.d.mts +24 -0
- package/dist/durable/ScheduleTransition.mjs +180 -0
- package/dist/durable/ScheduleTransition.mjs.map +1 -0
- package/dist/durable/Scheduling.d.mts +54 -0
- package/dist/durable/Scheduling.mjs +2 -0
- package/dist/durable/SqlMemoryStore.d.mts +29 -0
- package/dist/durable/SqlMemoryStore.mjs +436 -0
- package/dist/durable/SqlMemoryStore.mjs.map +1 -0
- package/dist/durable/SqlMessageDeliveryStore.d.mts +42 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs +173 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs.map +1 -0
- package/dist/durable/SqlStorageV2Upgrade.d.mts +21 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs +459 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs.map +1 -0
- package/dist/durable/SqlSubscriptionStore.d.mts +62 -0
- package/dist/durable/SqlSubscriptionStore.mjs +751 -0
- package/dist/durable/SqlSubscriptionStore.mjs.map +1 -0
- package/dist/durable/SqlThreadNativeReads.d.mts +49 -0
- package/dist/durable/SqlThreadNativeReads.mjs +153 -0
- package/dist/durable/SqlThreadNativeReads.mjs.map +1 -0
- package/dist/durable/SubmissionLedger.d.mts +3 -0
- package/dist/durable/SubmissionLedger.mjs +918 -0
- package/dist/durable/SubmissionLedger.mjs.map +1 -0
- package/dist/durable/SubmissionLedgerConformance.d.mts +29 -0
- package/dist/durable/SubmissionLedgerConformance.mjs +1993 -0
- package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -0
- package/dist/durable/SubmissionStatus.d.mts +2 -0
- package/dist/durable/SubmissionStatus.mjs +18 -0
- package/dist/durable/SubmissionStatus.mjs.map +1 -0
- package/dist/durable/Subscription.d.mts +2 -0
- package/dist/durable/Subscription.mjs +360 -0
- package/dist/durable/Subscription.mjs.map +1 -0
- package/dist/durable/SubscriptionInput.d.mts +2 -0
- package/dist/durable/SubscriptionInput.mjs +52 -0
- package/dist/durable/SubscriptionInput.mjs.map +1 -0
- package/dist/durable/SubscriptionStoreConformance.d.mts +16 -0
- package/dist/durable/SubscriptionStoreConformance.mjs +625 -0
- package/dist/durable/SubscriptionStoreConformance.mjs.map +1 -0
- package/dist/durable/SubscriptionTools.d.mts +273 -0
- package/dist/durable/SubscriptionTools.mjs +190 -0
- package/dist/durable/SubscriptionTools.mjs.map +1 -0
- package/dist/durable/SubscriptionTransition.d.mts +21 -0
- package/dist/durable/SubscriptionTransition.mjs +148 -0
- package/dist/durable/SubscriptionTransition.mjs.map +1 -0
- package/dist/durable/Subscriptions.d.mts +73 -0
- package/dist/durable/Subscriptions.mjs +627 -0
- package/dist/durable/Subscriptions.mjs.map +1 -0
- package/dist/durable/ThreadContextHistory.d.mts +32 -0
- package/dist/durable/ThreadContextHistory.mjs +152 -0
- package/dist/durable/ThreadContextHistory.mjs.map +1 -0
- package/dist/durable/ThreadContextHistoryProjection.d.mts +60 -0
- package/dist/durable/ThreadContextHistoryProjection.mjs +149 -0
- package/dist/durable/ThreadContextHistoryProjection.mjs.map +1 -0
- package/dist/durable/ThreadInvariants.d.mts +76 -0
- package/dist/durable/ThreadInvariants.mjs +246 -0
- package/dist/durable/ThreadInvariants.mjs.map +1 -0
- package/dist/durable/ThreadProjection.d.mts +78 -0
- package/dist/durable/ThreadProjection.mjs +158 -0
- package/dist/durable/ThreadProjection.mjs.map +1 -0
- package/dist/durable/ThreadProjectionMaintenance.d.mts +49 -0
- package/dist/durable/ThreadProjectionMaintenance.mjs +33 -0
- package/dist/durable/ThreadProjectionMaintenance.mjs.map +1 -0
- package/dist/durable/ThreadStore.d.mts +2 -0
- package/dist/durable/ThreadStore.mjs +336 -0
- package/dist/durable/ThreadStore.mjs.map +1 -0
- package/dist/durable/ThreadStoreConformance.d.mts +28 -0
- package/dist/durable/ThreadStoreConformance.mjs +503 -0
- package/dist/durable/ThreadStoreConformance.mjs.map +1 -0
- package/dist/durable/ToolReconciler.d.mts +2 -0
- package/dist/durable/ToolReconciler.mjs +85 -0
- package/dist/durable/ToolReconciler.mjs.map +1 -0
- package/dist/durable/WakeScheduler.d.mts +2 -0
- package/dist/durable/WakeScheduler.mjs +85 -0
- package/dist/durable/WakeScheduler.mjs.map +1 -0
- package/dist/durable/WorkerHost.d.mts +129 -0
- package/dist/durable/WorkerHost.mjs +77 -0
- package/dist/durable/WorkerHost.mjs.map +1 -0
- package/dist/engine/AgentRuntime.d.mts +2 -0
- package/dist/engine/AgentRuntime.mjs +2 -0
- package/dist/engine/Compaction.d.mts +7 -0
- package/dist/engine/Compaction.mjs +16 -0
- package/dist/engine/Compaction.mjs.map +1 -0
- package/dist/engine/ContextCompactor.d.mts +2 -0
- package/dist/engine/ContextCompactor.mjs +119 -0
- package/dist/engine/ContextCompactor.mjs.map +1 -0
- package/dist/engine/ContextHistory.d.mts +65 -0
- package/dist/engine/ContextHistory.mjs +76 -0
- package/dist/engine/ContextHistory.mjs.map +1 -0
- package/dist/engine/ContextWindow.d.mts +2 -0
- package/dist/engine/ContextWindow.mjs +59 -0
- package/dist/engine/ContextWindow.mjs.map +1 -0
- package/dist/engine/DurableStep.d.mts +2 -0
- package/dist/engine/DurableStep.mjs +62 -0
- package/dist/engine/DurableStep.mjs.map +1 -0
- package/dist/engine/MessagingHost.d.mts +2 -0
- package/dist/engine/MessagingHost.mjs +2 -0
- package/dist/engine/Output.d.mts +2 -0
- package/dist/engine/Output.mjs +8 -0
- package/dist/engine/Output.mjs.map +1 -0
- package/dist/engine/RunEventSink.d.mts +2 -0
- package/dist/engine/RunEventSink.mjs +22 -0
- package/dist/engine/RunEventSink.mjs.map +1 -0
- package/dist/engine/RunOptions.d.mts +2 -0
- package/dist/engine/RunOptions.mjs +124 -0
- package/dist/engine/RunOptions.mjs.map +1 -0
- package/dist/engine/SubagentHost.d.mts +2 -0
- package/dist/engine/SubagentHost.mjs +72 -0
- package/dist/engine/SubagentHost.mjs.map +1 -0
- package/dist/engine/ThreadHistory.d.mts +2 -0
- package/dist/engine/ThreadHistory.mjs +67 -0
- package/dist/engine/ThreadHistory.mjs.map +1 -0
- package/dist/engine/ToolBroker.d.mts +2 -0
- package/dist/engine/ToolBroker.mjs +42 -0
- package/dist/engine/ToolBroker.mjs.map +1 -0
- package/dist/foreign-diagnostic-DBQ1XHKh.mjs +37 -0
- package/dist/foreign-diagnostic-DBQ1XHKh.mjs.map +1 -0
- package/dist/index.d.mts +91 -6
- package/dist/index.mjs +100 -6
- package/dist/output-contract-BC7tjlGw.mjs +84 -0
- package/dist/output-contract-BC7tjlGw.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/sandbox/CodeExecutor.d.mts +194 -0
- package/dist/sandbox/CodeExecutor.mjs +278 -0
- package/dist/sandbox/CodeExecutor.mjs.map +1 -0
- package/dist/sandbox/InteractiveBrowser.d.mts +257 -0
- package/dist/sandbox/InteractiveBrowser.mjs +236 -0
- package/dist/sandbox/InteractiveBrowser.mjs.map +1 -0
- package/dist/sandbox/PageCapture.d.mts +2 -0
- package/dist/sandbox/PageCapture.mjs +450 -0
- package/dist/sandbox/PageCapture.mjs.map +1 -0
- package/dist/sandbox/PageCrawl.d.mts +88 -0
- package/dist/sandbox/PageCrawl.mjs +124 -0
- package/dist/sandbox/PageCrawl.mjs.map +1 -0
- package/dist/sandbox/PageScreenshot.d.mts +2 -0
- package/dist/sandbox/PageScreenshot.mjs +53 -0
- package/dist/sandbox/PageScreenshot.mjs.map +1 -0
- package/dist/sandbox/ProtectedBrowser.d.mts +273 -0
- package/dist/sandbox/ProtectedBrowser.mjs +287 -0
- package/dist/sandbox/ProtectedBrowser.mjs.map +1 -0
- package/dist/sandbox/Sandbox.d.mts +2 -0
- package/dist/sandbox/Sandbox.mjs +208 -0
- package/dist/sandbox/Sandbox.mjs.map +1 -0
- package/dist/utf8-BYfhEkcj.mjs +11 -0
- package/dist/utf8-BYfhEkcj.mjs.map +1 -0
- package/dist/utf8-DchGZRBd.mjs +23 -0
- package/dist/utf8-DchGZRBd.mjs.map +1 -0
- package/package.json +1 -40
- package/src/InMemory.ts +19 -0
- package/src/ToolExposure.ts +2 -0
- package/src/capabilities/Approval.ts +352 -0
- package/src/capabilities/Budget.ts +536 -0
- package/src/capabilities/CodeMode.ts +1090 -0
- package/src/capabilities/Commands.ts +86 -0
- package/src/capabilities/ContextTools.ts +184 -0
- package/src/capabilities/Mcp.ts +427 -0
- package/src/capabilities/McpClient.ts +967 -0
- package/src/capabilities/MemoryNotes.ts +174 -0
- package/src/capabilities/Messaging.ts +261 -0
- package/src/capabilities/ModelContext.ts +354 -0
- package/src/capabilities/Redaction.ts +157 -0
- package/src/capabilities/Remembering.ts +550 -0
- package/src/capabilities/RunHooks.ts +280 -0
- package/src/capabilities/SemanticMemory.ts +447 -0
- package/src/capabilities/Subagent.ts +2488 -0
- package/src/capabilities/SubagentReservations.ts +850 -0
- package/src/capabilities/ToolDiscovery.ts +369 -0
- package/src/capabilities/WebCapture.ts +722 -0
- package/src/capabilities/WebSearch.ts +190 -0
- package/src/capabilities/internal/subagent-background.ts +1246 -0
- package/src/capabilities/internal/subagent-contract.ts +146 -0
- package/src/capabilities/internal/subagent-policy.ts +235 -0
- package/src/capabilities/internal/subagent-reporting.ts +261 -0
- package/src/capabilities/internal/utf8.ts +10 -0
- package/src/core/Agent.ts +595 -0
- package/src/core/AgentError.ts +172 -0
- package/src/core/AgentPolicy.ts +153 -0
- package/src/core/AgentUpdates.ts +100 -0
- package/src/core/FailureDiagnostic.ts +343 -0
- package/src/core/IdGenerator.ts +39 -0
- package/src/core/Identifiers.ts +48 -0
- package/src/core/Memory.ts +290 -0
- package/src/core/MemoryNamespace.ts +196 -0
- package/src/core/MemoryReference.ts +121 -0
- package/src/core/MemoryRevalidation.ts +185 -0
- package/src/core/MemoryStore.ts +368 -0
- package/src/core/Messaging.ts +72 -0
- package/src/core/Receipt.ts +42 -0
- package/src/core/RememberingStore.ts +300 -0
- package/src/core/RunEvent.ts +366 -0
- package/src/core/RunPolicyUsage.ts +17 -0
- package/src/core/SemanticMemoryIndex.ts +250 -0
- package/src/core/SemanticMemoryRevalidation.ts +254 -0
- package/src/core/SubagentContract.ts +196 -0
- package/src/core/Thread.ts +371 -0
- package/src/core/ToolExposure.ts +74 -0
- package/src/core/ToolResult.ts +190 -0
- package/src/core/Usage.ts +529 -0
- package/src/core/Worker.ts +184 -0
- package/src/core/internal/agent-updates.ts +34 -0
- package/src/core/internal/message-status.ts +60 -0
- package/src/core/internal/strict-schema.ts +14 -0
- package/src/core/internal/utf8.ts +23 -0
- package/src/durable/ActivityStore.ts +160 -0
- package/src/durable/Admin.ts +505 -0
- package/src/durable/AgentRegistration.ts +14 -0
- package/src/durable/Certification.ts +210 -0
- package/src/durable/CommittedActivity.ts +296 -0
- package/src/durable/Digest.ts +87 -0
- package/src/durable/DurableAgentRuntime.ts +10950 -0
- package/src/durable/DurableFailpoint.ts +107 -0
- package/src/durable/DurableFailpointTestControl.ts +39 -0
- package/src/durable/EventSource.ts +172 -0
- package/src/durable/GitHubWorkflowSource.ts +447 -0
- package/src/durable/MessageDelivery.ts +817 -0
- package/src/durable/MessageDeliveryStoreConformance.ts +410 -0
- package/src/durable/OperationAuthorizer.ts +85 -0
- package/src/durable/PersistentHistory.ts +260 -0
- package/src/durable/PreparedInputAdmission.ts +57 -0
- package/src/durable/Records.ts +1065 -0
- package/src/durable/Recovery.ts +1018 -0
- package/src/durable/RunJournal.ts +1631 -0
- package/src/durable/Schedule.ts +513 -0
- package/src/durable/ScheduleStoreConformance.ts +638 -0
- package/src/durable/ScheduleTransition.ts +265 -0
- package/src/durable/Scheduling.ts +1077 -0
- package/src/durable/SqlMemoryStore.ts +778 -0
- package/src/durable/SqlMessageDeliveryStore.ts +321 -0
- package/src/durable/SqlStorageV2Upgrade.ts +500 -0
- package/src/durable/SqlSubscriptionStore.ts +1440 -0
- package/src/durable/SqlThreadNativeReads.ts +256 -0
- package/src/durable/SubmissionLedger.ts +1205 -0
- package/src/durable/SubmissionLedgerConformance.ts +4590 -0
- package/src/durable/SubmissionStatus.ts +14 -0
- package/src/durable/Subscription.ts +544 -0
- package/src/durable/SubscriptionInput.ts +144 -0
- package/src/durable/SubscriptionStoreConformance.ts +945 -0
- package/src/durable/SubscriptionTools.ts +327 -0
- package/src/durable/SubscriptionTransition.ts +302 -0
- package/src/durable/Subscriptions.ts +1210 -0
- package/src/durable/ThreadContextHistory.ts +227 -0
- package/src/durable/ThreadContextHistoryProjection.ts +216 -0
- package/src/durable/ThreadInvariants.ts +507 -0
- package/src/durable/ThreadProjection.ts +269 -0
- package/src/durable/ThreadProjectionMaintenance.ts +67 -0
- package/src/durable/ThreadStore.ts +552 -0
- package/src/durable/ThreadStoreConformance.ts +1156 -0
- package/src/durable/ToolReconciler.ts +109 -0
- package/src/durable/WakeScheduler.ts +134 -0
- package/src/durable/WorkerHost.ts +171 -0
- package/src/durable/internal/agent-registration.ts +621 -0
- package/src/durable/internal/agent-updates.ts +302 -0
- package/src/durable/internal/foreign-diagnostic.ts +47 -0
- package/src/durable/internal/journal-checkpoint.ts +104 -0
- package/src/durable/internal/journal-metadata.ts +117 -0
- package/src/durable/internal/message-status.ts +20 -0
- package/src/durable/internal/messaging-host.ts +637 -0
- package/src/durable/internal/schedule-time.ts +303 -0
- package/src/durable/internal/storage-v2-layout.ts +163 -0
- package/src/durable/internal/storage-v2.ts +73 -0
- package/src/durable/internal/worker-host.ts +2678 -0
- package/src/durable/internal/worker-runtime.ts +9 -0
- package/src/engine/AgentRuntime.ts +37 -0
- package/src/engine/Compaction.ts +11 -0
- package/src/engine/ContextCompactor.ts +277 -0
- package/src/engine/ContextHistory.ts +73 -0
- package/src/engine/ContextWindow.ts +72 -0
- package/src/engine/DurableStep.ts +132 -0
- package/src/engine/MessagingHost.ts +110 -0
- package/src/engine/Output.ts +2 -0
- package/src/engine/RunEventSink.ts +132 -0
- package/src/engine/RunOptions.ts +1101 -0
- package/src/engine/SubagentHost.ts +193 -0
- package/src/engine/ThreadHistory.ts +120 -0
- package/src/engine/ToolBroker.ts +157 -0
- package/src/engine/ToolExposure.ts +48 -0
- package/src/engine/internal/agent-runtime.ts +10485 -0
- package/src/engine/internal/bounded-value.ts +315 -0
- package/src/engine/internal/compaction.ts +678 -0
- package/src/engine/internal/error-diagnostic.ts +39 -0
- package/src/engine/internal/output-contract.ts +173 -0
- package/src/engine/internal/primitive-delta.ts +80 -0
- package/src/engine/internal/provider-result-staging.ts +211 -0
- package/src/engine/internal/tool-derivative.ts +106 -0
- package/src/engine/internal/tool-exposure.ts +224 -0
- package/src/engine/internal/tool-telemetry.ts +484 -0
- package/src/index.ts +99 -21
- package/src/sandbox/CodeExecutor.ts +352 -0
- package/src/sandbox/InteractiveBrowser.ts +339 -0
- package/src/sandbox/PageCapture.ts +691 -0
- package/src/sandbox/PageCrawl.ts +148 -0
- package/src/sandbox/PageScreenshot.ts +81 -0
- package/src/sandbox/ProtectedBrowser.ts +436 -0
- package/src/sandbox/Sandbox.ts +241 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { AgentId, DelegationId, RunId, SettlementId, ThreadId, ToolCallId } from "./core/Identifiers.mjs";
|
|
3
|
+
import { AgentPolicy } from "./core/AgentPolicy.mjs";
|
|
4
|
+
import { IdempotencyKey, Receipt } from "./core/Receipt.mjs";
|
|
5
|
+
import { Update } from "./core/AgentUpdates.mjs";
|
|
6
|
+
import { o as Value } from "./FailureDiagnostic-BElLOoED.mjs";
|
|
7
|
+
import { SubagentExecutionFailure, SubagentGrant, WorkerOperationTool } from "./core/SubagentContract.mjs";
|
|
8
|
+
import { Schema } from "effect";
|
|
9
|
+
//#region src/core/internal/message-status.ts
|
|
10
|
+
/** A retained outbound delivery identity, not a destination Receipt or access grant. */
|
|
11
|
+
const MessageRef = Schema.Struct({
|
|
12
|
+
ownerThreadId: ThreadId,
|
|
13
|
+
messageId: IdempotencyKey
|
|
14
|
+
});
|
|
15
|
+
const Reason = Schema.NonEmptyString.check(Schema.isMaxLength(256));
|
|
16
|
+
const identity = { message: MessageRef };
|
|
17
|
+
/**
|
|
18
|
+
* Source-owned delivery evidence. Pending confirms retention only; accepted supplies the
|
|
19
|
+
* destination Receipt, and processed supplies its canonical settlement. Neither retention nor
|
|
20
|
+
* acceptance proves execution. Refused is a definite rejection; parked stops automatic retry
|
|
21
|
+
* while retaining the same identity and any acceptance evidence. Inspect instead of resending.
|
|
22
|
+
*/
|
|
23
|
+
const MessageStatus = Schema.Union([
|
|
24
|
+
Schema.Struct({
|
|
25
|
+
...identity,
|
|
26
|
+
status: Schema.Literal("pending"),
|
|
27
|
+
receipt: Schema.Null,
|
|
28
|
+
settlement: Schema.Null,
|
|
29
|
+
reason: Schema.NullOr(Reason)
|
|
30
|
+
}),
|
|
31
|
+
Schema.Struct({
|
|
32
|
+
...identity,
|
|
33
|
+
status: Schema.Literal("accepted"),
|
|
34
|
+
receipt: Receipt,
|
|
35
|
+
settlement: Schema.Null,
|
|
36
|
+
reason: Schema.NullOr(Reason)
|
|
37
|
+
}),
|
|
38
|
+
Schema.Struct({
|
|
39
|
+
...identity,
|
|
40
|
+
status: Schema.Literal("processed"),
|
|
41
|
+
receipt: Receipt,
|
|
42
|
+
settlement: Schema.Struct({
|
|
43
|
+
settlementId: SettlementId,
|
|
44
|
+
outcome: Schema.Literals([
|
|
45
|
+
"completed",
|
|
46
|
+
"failed",
|
|
47
|
+
"aborted"
|
|
48
|
+
])
|
|
49
|
+
}),
|
|
50
|
+
reason: Schema.Null
|
|
51
|
+
}),
|
|
52
|
+
Schema.Struct({
|
|
53
|
+
...identity,
|
|
54
|
+
status: Schema.Literal("refused"),
|
|
55
|
+
receipt: Schema.Null,
|
|
56
|
+
settlement: Schema.Null,
|
|
57
|
+
reason: Reason
|
|
58
|
+
}),
|
|
59
|
+
Schema.Struct({
|
|
60
|
+
...identity,
|
|
61
|
+
status: Schema.Literal("parked"),
|
|
62
|
+
receipt: Schema.NullOr(Receipt),
|
|
63
|
+
settlement: Schema.Null,
|
|
64
|
+
reason: Reason
|
|
65
|
+
})
|
|
66
|
+
]);
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/core/Worker.ts
|
|
69
|
+
var Worker_exports = /* @__PURE__ */ __exportAll({
|
|
70
|
+
FrameworkMessage: () => FrameworkMessage,
|
|
71
|
+
WorkerBudgetScope: () => WorkerBudgetScope,
|
|
72
|
+
WorkerCompletion: () => WorkerCompletion,
|
|
73
|
+
WorkerContext: () => WorkerContext,
|
|
74
|
+
WorkerError: () => WorkerError,
|
|
75
|
+
WorkerHistoryEntry: () => WorkerHistoryEntry,
|
|
76
|
+
WorkerOperationTool: () => WorkerOperationTool,
|
|
77
|
+
WorkerPage: () => WorkerPage,
|
|
78
|
+
WorkerRef: () => WorkerRef,
|
|
79
|
+
WorkerReport: () => WorkerReport,
|
|
80
|
+
WorkerSource: () => WorkerSource,
|
|
81
|
+
WorkerStarted: () => WorkerStarted,
|
|
82
|
+
WorkerSummary: () => WorkerSummary,
|
|
83
|
+
WorkerUpdate: () => WorkerUpdate
|
|
84
|
+
});
|
|
85
|
+
/** A reusable child Thread, correlated with its declaration. This value grants no authority. */
|
|
86
|
+
const WorkerRef = Schema.Struct({
|
|
87
|
+
schemaVersion: Schema.Literal(1),
|
|
88
|
+
delegationId: DelegationId,
|
|
89
|
+
targetAgentId: AgentId,
|
|
90
|
+
threadId: ThreadId
|
|
91
|
+
});
|
|
92
|
+
/** A continuing worker identity and retained first delivery, never an execution handle. */
|
|
93
|
+
const WorkerStarted = Schema.Struct({
|
|
94
|
+
worker: WorkerRef,
|
|
95
|
+
delivery: MessageStatus
|
|
96
|
+
}).check(Schema.makeFilter(({ worker, delivery }) => delivery.receipt === null || worker.threadId === delivery.receipt.threadId));
|
|
97
|
+
/** A host-authorized Run allowance is independent of the immutable delegation lineage. */
|
|
98
|
+
const WorkerBudgetScope = Schema.Literals(["source-subtree", "worker-run"]);
|
|
99
|
+
/** Host-bound caller metadata. Programmatic calls never fabricate Run or Tool Call identities. */
|
|
100
|
+
const WorkerSource = Schema.Union([Schema.Struct({
|
|
101
|
+
_tag: Schema.Literal("tool"),
|
|
102
|
+
agentId: AgentId,
|
|
103
|
+
threadId: ThreadId,
|
|
104
|
+
runId: RunId,
|
|
105
|
+
toolCallId: ToolCallId
|
|
106
|
+
}), Schema.Struct({
|
|
107
|
+
_tag: Schema.Literal("programmatic"),
|
|
108
|
+
agentId: AgentId,
|
|
109
|
+
threadId: ThreadId
|
|
110
|
+
})]);
|
|
111
|
+
/** The caller's effective policy and root-relative depth, resolved by its host. */
|
|
112
|
+
const WorkerContext = Schema.Struct({
|
|
113
|
+
source: WorkerSource,
|
|
114
|
+
policy: AgentPolicy,
|
|
115
|
+
depth: Schema.Natural,
|
|
116
|
+
grant: Schema.optionalKey(SubagentGrant)
|
|
117
|
+
});
|
|
118
|
+
/** Bounded durable listing data; a latest Receipt never substitutes for a requested Receipt. */
|
|
119
|
+
const WorkerSummary = Schema.Struct({
|
|
120
|
+
worker: WorkerRef,
|
|
121
|
+
latestReceipt: Schema.NullOr(Receipt),
|
|
122
|
+
state: Schema.Literals([
|
|
123
|
+
"starting",
|
|
124
|
+
"active",
|
|
125
|
+
"idle"
|
|
126
|
+
])
|
|
127
|
+
});
|
|
128
|
+
const WorkerPage = Schema.Struct({
|
|
129
|
+
items: Schema.Array(WorkerSummary).check(Schema.isMaxLength(100)),
|
|
130
|
+
next: Schema.NullOr(ThreadId)
|
|
131
|
+
});
|
|
132
|
+
/** Authorized canonical history, encoded independently of storage-adapter representations. */
|
|
133
|
+
const WorkerHistoryEntry = Schema.Struct({
|
|
134
|
+
sequence: Schema.Natural.check(Schema.isGreaterThan(0)),
|
|
135
|
+
recordId: Schema.NonEmptyString.check(Schema.isMaxLength(1024)),
|
|
136
|
+
record: Schema.Json
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* Closed host-boundary failures. Original causes stay private and survive diagnostic transport.
|
|
140
|
+
* Retained delivery states are successful MessageStatus values, including pending and refused.
|
|
141
|
+
* After a storage failure, keep the same idempotency key and parameters when reconciling.
|
|
142
|
+
*/
|
|
143
|
+
var WorkerError = class extends Schema.TaggedError()("WorkerError", {
|
|
144
|
+
cause: Schema.optionalKey(Value),
|
|
145
|
+
stack: Schema.optionalKey(Schema.String),
|
|
146
|
+
/** Concurrency pressure may clear without changing the request. */
|
|
147
|
+
retryable: Schema.optionalKey(Schema.Literal(true)),
|
|
148
|
+
operation: Schema.Literals([
|
|
149
|
+
"context",
|
|
150
|
+
"start",
|
|
151
|
+
"followUp",
|
|
152
|
+
"inspect",
|
|
153
|
+
"observe",
|
|
154
|
+
"await",
|
|
155
|
+
"list",
|
|
156
|
+
"cancel"
|
|
157
|
+
]),
|
|
158
|
+
reason: Schema.Literals([
|
|
159
|
+
"denied",
|
|
160
|
+
"declaration-unavailable",
|
|
161
|
+
"worker-mismatch",
|
|
162
|
+
"receipt-mismatch",
|
|
163
|
+
"message-mismatch",
|
|
164
|
+
"idempotency-conflict",
|
|
165
|
+
"capacity",
|
|
166
|
+
"not-found",
|
|
167
|
+
"delivery-pending",
|
|
168
|
+
"storage",
|
|
169
|
+
"corrupt",
|
|
170
|
+
"unavailable"
|
|
171
|
+
])
|
|
172
|
+
}) {};
|
|
173
|
+
/** One projected canonical Run outcome. Joined receipts share this identity. */
|
|
174
|
+
const WorkerReport = (success) => {
|
|
175
|
+
const identity = {
|
|
176
|
+
_tag: Schema.Literal("Settled"),
|
|
177
|
+
worker: WorkerRef,
|
|
178
|
+
receipt: Receipt,
|
|
179
|
+
runId: RunId,
|
|
180
|
+
settlementId: SettlementId
|
|
181
|
+
};
|
|
182
|
+
return Schema.Union([Schema.Struct({
|
|
183
|
+
...identity,
|
|
184
|
+
outcome: Schema.Literal("completed"),
|
|
185
|
+
result: Schema.Union([success])
|
|
186
|
+
}), Schema.Struct({
|
|
187
|
+
...identity,
|
|
188
|
+
outcome: Schema.Literals(["failed", "aborted"]),
|
|
189
|
+
failure: SubagentExecutionFailure
|
|
190
|
+
})]);
|
|
191
|
+
};
|
|
192
|
+
/** Framework message stored separately from the parent's application input. */
|
|
193
|
+
const WorkerCompletion = Schema.Struct({
|
|
194
|
+
_tag: Schema.Literal("WorkerCompletion"),
|
|
195
|
+
budgetExhausted: Schema.Boolean,
|
|
196
|
+
schemaVersion: Schema.Literal(1),
|
|
197
|
+
report: WorkerReport(Schema.Json)
|
|
198
|
+
}).check(Schema.makeFilter(({ report }) => report.worker.threadId === report.receipt.threadId));
|
|
199
|
+
/** Source-worker intermediate output, kept separate from application input. */
|
|
200
|
+
const WorkerUpdate = Schema.Struct({
|
|
201
|
+
_tag: Schema.Literal("WorkerUpdate"),
|
|
202
|
+
schemaVersion: Schema.Literal(1),
|
|
203
|
+
worker: WorkerRef,
|
|
204
|
+
update: Update
|
|
205
|
+
}).check(Schema.makeFilter(({ worker, update }) => worker.threadId === update.threadId && worker.targetAgentId === update.agentId));
|
|
206
|
+
const FrameworkMessage = Schema.Union([WorkerCompletion, WorkerUpdate]);
|
|
207
|
+
//#endregion
|
|
208
|
+
export { WorkerError as a, WorkerRef as c, WorkerStarted as d, WorkerSummary as f, MessageStatus as g, MessageRef as h, WorkerContext as i, WorkerReport as l, Worker_exports as m, WorkerBudgetScope as n, WorkerHistoryEntry as o, WorkerUpdate as p, WorkerCompletion as r, WorkerPage as s, FrameworkMessage as t, WorkerSource as u };
|
|
209
|
+
|
|
210
|
+
//# sourceMappingURL=Worker-T_3RbaKc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Worker-T_3RbaKc.mjs","names":["FailureDiagnostic.Value"],"sources":["../src/core/internal/message-status.ts","../src/core/Worker.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport { SettlementId, ThreadId } from \"../Identifiers.ts\";\nimport { IdempotencyKey, Receipt } from \"../Receipt.ts\";\n\n/** A retained outbound delivery identity, not a destination Receipt or access grant. */\nexport const MessageRef = Schema.Struct({ ownerThreadId: ThreadId, messageId: IdempotencyKey });\nexport type MessageRef = typeof MessageRef.Type;\n\nconst Reason = Schema.NonEmptyString.check(Schema.isMaxLength(256));\nconst identity = { message: MessageRef };\n\n/**\n * Source-owned delivery evidence. Pending confirms retention only; accepted supplies the\n * destination Receipt, and processed supplies its canonical settlement. Neither retention nor\n * acceptance proves execution. Refused is a definite rejection; parked stops automatic retry\n * while retaining the same identity and any acceptance evidence. Inspect instead of resending.\n */\nexport const MessageStatus = Schema.Union([\n Schema.Struct({\n ...identity,\n status: Schema.Literal(\"pending\"),\n receipt: Schema.Null,\n settlement: Schema.Null,\n reason: Schema.NullOr(Reason),\n }),\n Schema.Struct({\n ...identity,\n status: Schema.Literal(\"accepted\"),\n receipt: Receipt,\n settlement: Schema.Null,\n reason: Schema.NullOr(Reason),\n }),\n Schema.Struct({\n ...identity,\n status: Schema.Literal(\"processed\"),\n receipt: Receipt,\n settlement: Schema.Struct({\n settlementId: SettlementId,\n outcome: Schema.Literals([\"completed\", \"failed\", \"aborted\"]),\n }),\n reason: Schema.Null,\n }),\n Schema.Struct({\n ...identity,\n status: Schema.Literal(\"refused\"),\n receipt: Schema.Null,\n settlement: Schema.Null,\n reason: Reason,\n }),\n Schema.Struct({\n ...identity,\n status: Schema.Literal(\"parked\"),\n receipt: Schema.NullOr(Receipt),\n settlement: Schema.Null,\n reason: Reason,\n }),\n]);\n\nexport type MessageStatus = typeof MessageStatus.Type;\n","import { Schema } from \"effect\";\n\nimport { AgentPolicy } from \"./AgentPolicy.ts\";\nimport { Update } from \"./AgentUpdates.ts\";\nimport * as FailureDiagnostic from \"./FailureDiagnostic.ts\";\nimport { AgentId, DelegationId, RunId, SettlementId, ThreadId, ToolCallId } from \"./Identifiers.ts\";\nimport { MessageStatus } from \"./internal/message-status.ts\";\nimport { Receipt } from \"./Receipt.ts\";\nimport { SubagentExecutionFailure, SubagentGrant } from \"./SubagentContract.ts\";\n\n/** A reusable child Thread, correlated with its declaration. This value grants no authority. */\nexport const WorkerRef = Schema.Struct({\n schemaVersion: Schema.Literal(1),\n delegationId: DelegationId,\n targetAgentId: AgentId,\n threadId: ThreadId,\n});\n\nexport type WorkerRef = typeof WorkerRef.Type;\n\n/** A continuing worker identity and retained first delivery, never an execution handle. */\nexport const WorkerStarted = Schema.Struct({\n worker: WorkerRef,\n delivery: MessageStatus,\n}).check(\n Schema.makeFilter(\n ({ worker, delivery }) =>\n delivery.receipt === null || worker.threadId === delivery.receipt.threadId,\n ),\n);\n\nexport type WorkerStarted = typeof WorkerStarted.Type;\n\n/** A host-authorized Run allowance is independent of the immutable delegation lineage. */\nexport const WorkerBudgetScope = Schema.Literals([\"source-subtree\", \"worker-run\"]);\nexport type WorkerBudgetScope = typeof WorkerBudgetScope.Type;\n\n/** Host-bound caller metadata. Programmatic calls never fabricate Run or Tool Call identities. */\nexport const WorkerSource = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"tool\"),\n agentId: AgentId,\n threadId: ThreadId,\n runId: RunId,\n toolCallId: ToolCallId,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"programmatic\"),\n agentId: AgentId,\n threadId: ThreadId,\n }),\n]);\n\nexport type WorkerSource = typeof WorkerSource.Type;\n\n/** The caller's effective policy and root-relative depth, resolved by its host. */\nexport const WorkerContext = Schema.Struct({\n source: WorkerSource,\n policy: AgentPolicy,\n depth: Schema.Natural,\n grant: Schema.optionalKey(SubagentGrant),\n});\n\nexport type WorkerContext = typeof WorkerContext.Type;\n\n/** Bounded durable listing data; a latest Receipt never substitutes for a requested Receipt. */\nexport const WorkerSummary = Schema.Struct({\n worker: WorkerRef,\n latestReceipt: Schema.NullOr(Receipt),\n state: Schema.Literals([\"starting\", \"active\", \"idle\"]),\n});\n\nexport type WorkerSummary = typeof WorkerSummary.Type;\n\nexport const WorkerPage = Schema.Struct({\n items: Schema.Array(WorkerSummary).check(Schema.isMaxLength(100)),\n next: Schema.NullOr(ThreadId),\n});\n\nexport type WorkerPage = typeof WorkerPage.Type;\n\n/** Authorized canonical history, encoded independently of storage-adapter representations. */\nexport const WorkerHistoryEntry = Schema.Struct({\n sequence: Schema.Natural.check(Schema.isGreaterThan(0)),\n recordId: Schema.NonEmptyString.check(Schema.isMaxLength(1_024)),\n record: Schema.Json,\n});\n\nexport type WorkerHistoryEntry = typeof WorkerHistoryEntry.Type;\n\n/**\n * Closed host-boundary failures. Original causes stay private and survive diagnostic transport.\n * Retained delivery states are successful MessageStatus values, including pending and refused.\n * After a storage failure, keep the same idempotency key and parameters when reconciling.\n */\nexport class WorkerError extends Schema.TaggedError<WorkerError>()(\"WorkerError\", {\n cause: Schema.optionalKey(FailureDiagnostic.Value),\n stack: Schema.optionalKey(Schema.String),\n /** Concurrency pressure may clear without changing the request. */\n retryable: Schema.optionalKey(Schema.Literal(true)),\n operation: Schema.Literals([\n \"context\",\n \"start\",\n \"followUp\",\n \"inspect\",\n \"observe\",\n \"await\",\n \"list\",\n \"cancel\",\n ]),\n reason: Schema.Literals([\n \"denied\",\n \"declaration-unavailable\",\n \"worker-mismatch\",\n \"receipt-mismatch\",\n \"message-mismatch\",\n \"idempotency-conflict\",\n \"capacity\",\n \"not-found\",\n // Decode earlier failures without emitting them for retained deliveries.\n \"delivery-pending\",\n \"storage\",\n \"corrupt\",\n \"unavailable\",\n ]),\n}) {}\n\nexport { WorkerOperationTool } from \"./SubagentContract.ts\";\n\n/** One projected canonical Run outcome. Joined receipts share this identity. */\nexport const WorkerReport = <Success extends Schema.Top>(success: Success) => {\n const identity = {\n _tag: Schema.Literal(\"Settled\"),\n worker: WorkerRef,\n receipt: Receipt,\n runId: RunId,\n settlementId: SettlementId,\n };\n\n return Schema.Union([\n // Union preserves the Success codec while making the result field required.\n Schema.Struct({\n ...identity,\n outcome: Schema.Literal(\"completed\"),\n result: Schema.Union([success]),\n }),\n Schema.Struct({\n ...identity,\n outcome: Schema.Literals([\"failed\", \"aborted\"]),\n failure: SubagentExecutionFailure,\n }),\n ]);\n};\n\nexport type WorkerReport<Success extends Schema.Top> = ReturnType<\n typeof WorkerReport<Success>\n>[\"Type\"];\n\n/** Framework message stored separately from the parent's application input. */\nexport const WorkerCompletion = Schema.Struct({\n _tag: Schema.Literal(\"WorkerCompletion\"),\n budgetExhausted: Schema.Boolean,\n schemaVersion: Schema.Literal(1),\n report: WorkerReport(Schema.Json),\n}).check(Schema.makeFilter(({ report }) => report.worker.threadId === report.receipt.threadId));\n\nexport type WorkerCompletion = typeof WorkerCompletion.Type;\n\n/** Source-worker intermediate output, kept separate from application input. */\nexport const WorkerUpdate = Schema.Struct({\n _tag: Schema.Literal(\"WorkerUpdate\"),\n schemaVersion: Schema.Literal(1),\n worker: WorkerRef,\n update: Update,\n}).check(\n Schema.makeFilter(\n ({ worker, update }) =>\n worker.threadId === update.threadId && worker.targetAgentId === update.agentId,\n ),\n);\n\nexport type WorkerUpdate = typeof WorkerUpdate.Type;\nexport const FrameworkMessage = Schema.Union([WorkerCompletion, WorkerUpdate]);\nexport type FrameworkMessage = typeof FrameworkMessage.Type;\n"],"mappings":";;;;;;;;;;AAMA,MAAa,aAAa,OAAO,OAAO;CAAE,eAAe;CAAU,WAAW;AAAe,CAAC;AAG9F,MAAM,SAAS,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC;AAClE,MAAM,WAAW,EAAE,SAAS,WAAW;;;;;;;AAQvC,MAAa,gBAAgB,OAAO,MAAM;CACxC,OAAO,OAAO;EACZ,GAAG;EACH,QAAQ,OAAO,QAAQ,SAAS;EAChC,SAAS,OAAO;EAChB,YAAY,OAAO;EACnB,QAAQ,OAAO,OAAO,MAAM;CAC9B,CAAC;CACD,OAAO,OAAO;EACZ,GAAG;EACH,QAAQ,OAAO,QAAQ,UAAU;EACjC,SAAS;EACT,YAAY,OAAO;EACnB,QAAQ,OAAO,OAAO,MAAM;CAC9B,CAAC;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AAO,QAAQ,kBAAkB;CACvC,iBAAiB,OAAO;CACxB,eAAe,OAAO,QAAQ,CAAC;CAC/B,QAAQ,aAAa,OAAO,IAAI;AAClC,CAAC,CAAC,CAAC,MAAM,OAAO,YAAY,EAAE,aAAa,OAAO,OAAO,aAAa,OAAO,QAAQ,QAAQ,CAAC;;AAK9F,MAAa,eAAe,OAAO,OAAO;CACxC,MAAM,OAAO,QAAQ,cAAc;CACnC,eAAe,OAAO,QAAQ,CAAC;CAC/B,QAAQ;CACR,QAAQ;AACV,CAAC,CAAC,CAAC,MACD,OAAO,YACJ,EAAE,QAAQ,aACT,OAAO,aAAa,OAAO,YAAY,OAAO,kBAAkB,OAAO,OAC3E,CACF;AAGA,MAAa,mBAAmB,OAAO,MAAM,CAAC,kBAAkB,YAAY,CAAC"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { AgentId } from "./core/Identifiers.mjs";
|
|
2
|
+
import { getToolExecutionKind } from "./core/SubagentContract.mjs";
|
|
3
|
+
import { a as PinnedTool, l as ToolNamespace, n as DiscoveryTool, r as IncludesCatalogDocumentation, t as AdditionalToolCatalog } from "./ToolExposure-C93U1sPu.mjs";
|
|
4
|
+
import { BackgroundReporting, WorkerReportPreparationFailure } from "./engine/SubagentHost.mjs";
|
|
5
|
+
import { ContextRolloverTool } from "./engine/ContextWindow.mjs";
|
|
6
|
+
import { getToolExecutionClass } from "./engine/DurableStep.mjs";
|
|
7
|
+
import { DefinitionDigests, ReplayContract } from "./durable/Records.mjs";
|
|
8
|
+
import { DigestError, digestDefinitions, digestJson } from "./durable/Digest.mjs";
|
|
9
|
+
import { Tool } from "effect/unstable/ai";
|
|
10
|
+
import { Context, Effect, Layer, References, Schema, Tracer } from "effect";
|
|
11
|
+
//#region src/durable/internal/agent-registration.ts
|
|
12
|
+
/** No unique current executable is registered for the stable Agent identity. */
|
|
13
|
+
var BindingUnavailable = class extends Schema.TaggedError()("BindingUnavailable", {
|
|
14
|
+
agentId: AgentId,
|
|
15
|
+
message: Schema.String
|
|
16
|
+
}) {};
|
|
17
|
+
/** Exact immutable admission, lineage and delivery evidence; never an executable-code gate. */
|
|
18
|
+
const definitionDigestsEqual = (left, right) => left.agent === right.agent && left.model === right.model && left.tools === right.tools && Schema.toEquivalence(Schema.UndefinedOr(ReplayContract))(left.replay, right.replay);
|
|
19
|
+
/** Hash current operation contracts; no historical definitions or schemas are retained. */
|
|
20
|
+
const toolReplayContracts = Effect.fn("AgentRegistration.toolReplayContracts")(function* (definition, versions, fallbackVersion = null) {
|
|
21
|
+
const declarations = yield* Effect.try({
|
|
22
|
+
try: () => {
|
|
23
|
+
const jsonSchema = (schema) => Schema.decodeUnknownSync(Schema.Json)(Tool.getJsonSchemaFromSchema(schema));
|
|
24
|
+
return Object.values(definition.toolkit.tools).map((tool) => {
|
|
25
|
+
const version = versions === void 0 ? fallbackVersion : versions.tools[tool.name];
|
|
26
|
+
if (version === void 0 || versions !== void 0 && !Object.hasOwn(versions.tools, tool.name)) throw new Error("Every Tool needs an explicit replay semantic version");
|
|
27
|
+
return {
|
|
28
|
+
name: tool.name,
|
|
29
|
+
contract: {
|
|
30
|
+
version,
|
|
31
|
+
parameters: jsonSchema(tool.parametersSchema),
|
|
32
|
+
success: jsonSchema(tool.successSchema),
|
|
33
|
+
failure: jsonSchema(tool.failureSchema),
|
|
34
|
+
failureMode: tool.failureMode,
|
|
35
|
+
needsApproval: typeof tool.needsApproval === "function" ? "dynamic" : tool.needsApproval ?? false,
|
|
36
|
+
executionClass: getToolExecutionClass(tool),
|
|
37
|
+
executionKind: getToolExecutionKind(tool.annotations),
|
|
38
|
+
contextRollover: Context.get(tool.annotations, ContextRolloverTool),
|
|
39
|
+
completion: definition.completion?.tool === tool.name,
|
|
40
|
+
completionFromTool: definition.completionFromTools?.some((declaration) => declaration.tool === tool.name) ?? false
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
catch: () => DigestError.make({ message: "Operation contracts require serializable codecs and a version for every Tool" })
|
|
46
|
+
});
|
|
47
|
+
return Object.fromEntries(yield* Effect.forEach(declarations, ({ name, contract }) => digestJson(contract).pipe(Effect.map((digest) => [name, digest]))));
|
|
48
|
+
});
|
|
49
|
+
/** Compile current metadata without acquiring executable services. */
|
|
50
|
+
const compileBindingContracts = Effect.fn("AgentRegistration.compileBindingContracts")(function* (definition, definitions, versions) {
|
|
51
|
+
const digests = yield* digestDefinitions(definitions);
|
|
52
|
+
const tools = yield* toolReplayContracts(definition, versions, definitions.tools);
|
|
53
|
+
return { digests: DefinitionDigests.make({
|
|
54
|
+
...digests,
|
|
55
|
+
replay: ReplayContract.make({
|
|
56
|
+
agent: digests.agent,
|
|
57
|
+
tools
|
|
58
|
+
})
|
|
59
|
+
}) };
|
|
60
|
+
});
|
|
61
|
+
const omitTraceContext = Context.omit(Tracer.ParentSpan, Tracer.Tracer, Tracer.MinimumTraceLevel, Tracer.CurrentTraceLevel, References.TracerEnabled, References.TracerTimingEnabled, References.TracerSpanAnnotations, References.TracerSpanLinks);
|
|
62
|
+
const withoutTraceContext = (context) => omitTraceContext(context);
|
|
63
|
+
const captureReporting = (reports) => Effect.map(Effect.context().pipe(Effect.map(withoutTraceContext)), (context) => reports.map((report) => ({
|
|
64
|
+
...report,
|
|
65
|
+
prepare: (value) => Effect.scoped(Effect.suspend(() => report.prepare(value))).pipe(Effect.provide(context), Effect.mapError((error) => Schema.is(WorkerReportPreparationFailure)(error) ? error : WorkerReportPreparationFailure.make({ stage: "preparation" })))
|
|
66
|
+
})));
|
|
67
|
+
const backgroundReports = (definition) => [...new Set(Object.values(definition.toolkit.tools).flatMap((tool) => {
|
|
68
|
+
const report = Context.get(tool.annotations, BackgroundReporting);
|
|
69
|
+
return report === void 0 ? [] : [report];
|
|
70
|
+
}))];
|
|
71
|
+
const capture = (agent, attemptLayer) => Effect.map(Effect.context().pipe(Effect.map(withoutTraceContext)), (context) => ({
|
|
72
|
+
agentId: agent.definition.id,
|
|
73
|
+
definition: agent.definition,
|
|
74
|
+
attempt: (driver, threadId, claim) => {
|
|
75
|
+
const execute = driver(agent, threadId, claim);
|
|
76
|
+
return (attemptLayer === void 0 ? execute : execute.pipe(Effect.provide(Layer.fresh(attemptLayer({
|
|
77
|
+
threadId,
|
|
78
|
+
submissionId: claim.submissionId,
|
|
79
|
+
attemptId: claim.attemptId
|
|
80
|
+
}))))).pipe(Effect.provide(context));
|
|
81
|
+
}
|
|
82
|
+
}));
|
|
83
|
+
/**
|
|
84
|
+
* Build one exact worker registration from an executable Agent Binding and
|
|
85
|
+
* its already-computed definition digests.
|
|
86
|
+
*
|
|
87
|
+
* `make(agent, digests)` captures the binding plus its worker-requirement
|
|
88
|
+
* Context at Layer/effect construction time. Hosts that start from application
|
|
89
|
+
* version declarations should use `compileRegistrations`; low-level fixtures
|
|
90
|
+
* may supply a previously computed digest triple directly.
|
|
91
|
+
*/
|
|
92
|
+
const DurableWorkerBinding = { make: (agent, digests, reporting) => Effect.gen(function* () {
|
|
93
|
+
const binding = yield* capture(agent);
|
|
94
|
+
const reports = yield* captureReporting([...reporting ?? [], ...backgroundReports(agent.definition)]);
|
|
95
|
+
return {
|
|
96
|
+
...binding,
|
|
97
|
+
digests,
|
|
98
|
+
reporting: reports
|
|
99
|
+
};
|
|
100
|
+
}) };
|
|
101
|
+
/** INTERNAL identity-only capture retained for the legacy direct worker path. */
|
|
102
|
+
const makeLegacyWorkerBinding = capture;
|
|
103
|
+
const resolveWorkerBinding = (bindings, agentId) => {
|
|
104
|
+
const registered = bindings.filter((binding) => binding.agentId === agentId);
|
|
105
|
+
const binding = registered[0];
|
|
106
|
+
return registered.length === 1 && binding !== void 0 ? Effect.succeed(binding) : Effect.fail(BindingUnavailable.make({
|
|
107
|
+
agentId,
|
|
108
|
+
message: `Exactly one current Agent Binding must be registered for ${agentId}`
|
|
109
|
+
}));
|
|
110
|
+
};
|
|
111
|
+
/** Resolve authoring-time admission through the one exact host registration, never by identity alone. */
|
|
112
|
+
const resolveDefinitionBinding = (bindings, definition) => {
|
|
113
|
+
const candidates = bindings.filter((binding) => binding.agentId === definition.id);
|
|
114
|
+
const binding = candidates[0];
|
|
115
|
+
if (candidates.length !== 1 || binding === void 0) return Effect.fail(BindingUnavailable.make({
|
|
116
|
+
agentId: definition.id,
|
|
117
|
+
message: "Registered admission requires exactly one binding for the Agent identity"
|
|
118
|
+
}));
|
|
119
|
+
if (!Object.is(binding.definition, definition)) return Effect.fail(BindingUnavailable.make({
|
|
120
|
+
agentId: definition.id,
|
|
121
|
+
message: "Registered admission requires the exact Agent Definition used in registration"
|
|
122
|
+
}));
|
|
123
|
+
return Effect.succeed(binding);
|
|
124
|
+
};
|
|
125
|
+
const registrationDefinitions = (entry) => {
|
|
126
|
+
const definition = entry.model === void 0 ? entry.agent.definition : entry.agent;
|
|
127
|
+
const automatic = backgroundReports(definition);
|
|
128
|
+
const declaredDefinitions = definition.updates === void 0 ? entry.definitions : {
|
|
129
|
+
...entry.definitions,
|
|
130
|
+
agent: {
|
|
131
|
+
declaration: entry.definitions.agent,
|
|
132
|
+
updates: Schema.decodeUnknownSync(Schema.Json)(Tool.getJsonSchemaFromSchema(definition.updates)),
|
|
133
|
+
updateProtocol: {
|
|
134
|
+
schemaVersion: 1,
|
|
135
|
+
tool: "emit_update"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const definitions = automatic.length === 0 ? declaredDefinitions : {
|
|
140
|
+
...declaredDefinitions,
|
|
141
|
+
agent: {
|
|
142
|
+
declaration: declaredDefinitions.agent,
|
|
143
|
+
backgroundReporting: automatic.map((report) => ({
|
|
144
|
+
delegationId: report.delegationId,
|
|
145
|
+
targetAgentId: report.target.id,
|
|
146
|
+
mode: report.mode ?? "custom",
|
|
147
|
+
destinationDelegationId: report.destination?.delegationId ?? null
|
|
148
|
+
}))
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const exposure = definition.toolExposure;
|
|
152
|
+
if (exposure === void 0 && !Object.values(definition.toolkit.tools).some((tool) => Context.get(tool.annotations, DiscoveryTool) || Context.get(tool.annotations, PinnedTool))) return definitions;
|
|
153
|
+
return {
|
|
154
|
+
...definitions,
|
|
155
|
+
agent: {
|
|
156
|
+
declaration: definitions.agent,
|
|
157
|
+
toolExposure: {
|
|
158
|
+
initialToolNames: exposure === void 0 ? null : [...exposure.initialToolNames ?? []],
|
|
159
|
+
maxTools: exposure?.maxTools ?? 64,
|
|
160
|
+
maxSchemaBytes: exposure?.maxSchemaBytes ?? 262144,
|
|
161
|
+
requiredCompletion: definition.completion?.required === true ? definition.completion.tool : null,
|
|
162
|
+
tools: Object.values(definition.toolkit.tools).map((tool) => ({
|
|
163
|
+
name: tool.name,
|
|
164
|
+
pinned: Context.get(tool.annotations, PinnedTool),
|
|
165
|
+
discovery: Context.get(tool.annotations, DiscoveryTool),
|
|
166
|
+
namespace: Context.get(tool.annotations, ToolNamespace) ?? null,
|
|
167
|
+
includesCatalogDocumentation: Context.get(tool.annotations, IncludesCatalogDocumentation),
|
|
168
|
+
additional: Context.get(tool.annotations, AdditionalToolCatalog).map((entry) => ({
|
|
169
|
+
name: entry.tool.name,
|
|
170
|
+
namespace: entry.namespace,
|
|
171
|
+
method: entry.method
|
|
172
|
+
}))
|
|
173
|
+
}))
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
const compileRegistration = (entry) => Effect.flatMap(Effect.try({
|
|
179
|
+
try: () => registrationDefinitions(entry),
|
|
180
|
+
catch: () => DigestError.make({ message: "Agent update schema has no serializable wire contract" })
|
|
181
|
+
}), (definitions) => Effect.gen(function* () {
|
|
182
|
+
const binding = yield* capture(entry.model === void 0 ? entry.agent : {
|
|
183
|
+
definition: entry.agent,
|
|
184
|
+
model: entry.model
|
|
185
|
+
}, entry.attemptLayer);
|
|
186
|
+
const reporting = yield* captureReporting([...entry.reporting ?? [], ...backgroundReports(binding.definition)]);
|
|
187
|
+
return {
|
|
188
|
+
...binding,
|
|
189
|
+
...yield* compileBindingContracts(binding.definition, definitions, entry.continuity?.versions),
|
|
190
|
+
reporting
|
|
191
|
+
};
|
|
192
|
+
}));
|
|
193
|
+
/** Compile heterogeneous Agent descriptors into exact, dependency-closed worker registrations. */
|
|
194
|
+
const compileRegistrations = (entries) => {
|
|
195
|
+
const compileEntry = compileRegistration;
|
|
196
|
+
return Effect.forEach(entries, compileEntry);
|
|
197
|
+
};
|
|
198
|
+
//#endregion
|
|
199
|
+
export { definitionDigestsEqual as a, resolveWorkerBinding as c, compileRegistrations as i, toolReplayContracts as l, DurableWorkerBinding as n, makeLegacyWorkerBinding as o, compileBindingContracts as r, resolveDefinitionBinding as s, BindingUnavailable as t };
|
|
200
|
+
|
|
201
|
+
//# sourceMappingURL=agent-registration-B5CI-Ygk.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-registration-B5CI-Ygk.mjs","names":["run"],"sources":["../src/durable/internal/agent-registration.ts"],"sourcesContent":["import {\n type Crypto,\n type Option,\n type Scope,\n Context,\n Effect,\n Layer,\n References,\n Schema,\n Tracer,\n} from \"effect\";\nimport { Tool } from \"effect/unstable/ai\";\n\nimport type * as Agent from \"../../core/Agent.ts\";\nimport {\n type InputPromptSource,\n type InstructionSource,\n type ModelServices,\n type RunDispositionDeclaration,\n} from \"../../core/Agent.ts\";\nimport { type ThreadId, AgentId } from \"../../core/Identifiers.ts\";\nimport { getToolExecutionKind } from \"../../core/SubagentContract.ts\";\nimport {\n AdditionalToolCatalog,\n DiscoveryTool,\n IncludesCatalogDocumentation,\n PinnedTool,\n ToolNamespace,\n} from \"../../core/ToolExposure.ts\";\nimport { type RuntimeBinding } from \"../../engine/AgentRuntime.ts\";\nimport { ContextRolloverTool } from \"../../engine/ContextWindow.ts\";\nimport { getToolExecutionClass } from \"../../engine/DurableStep.ts\";\nimport {\n BackgroundReporting,\n WorkerReportPreparationFailure,\n type WorkerReporting,\n} from \"../../engine/SubagentHost.ts\";\nimport { digestDefinitions, digestJson, DigestError } from \"../Digest.ts\";\nimport type { DurableWorkerFailure, DurableWorkerRequirements } from \"../DurableAgentRuntime.ts\";\nimport type { DefinitionDigestInput, PersistedJson } from \"../Records.ts\";\nimport { DefinitionDigests, ReplayContract } from \"../Records.ts\";\nimport type { Claim, Settlement } from \"../SubmissionLedger.ts\";\n\n/** No unique current executable is registered for the stable Agent identity. */\nexport class BindingUnavailable extends Schema.TaggedError<BindingUnavailable>()(\n \"BindingUnavailable\",\n { agentId: AgentId, message: Schema.String },\n) {}\n\nexport type DurableBindingFailure = BindingUnavailable;\n\n/** Exact immutable admission, lineage and delivery evidence; never an executable-code gate. */\nexport const definitionDigestsEqual = (\n left: DefinitionDigests,\n right: DefinitionDigests,\n): boolean =>\n left.agent === right.agent &&\n left.model === right.model &&\n left.tools === right.tools &&\n Schema.toEquivalence(Schema.UndefinedOr(ReplayContract))(left.replay, right.replay);\n\n/** Change an operation version when its meaning, durable Steps or idempotency keys change. */\nexport interface ReplayVersions {\n readonly tools: Readonly<Record<string, PersistedJson>>;\n}\n\n/** Hash current operation contracts; no historical definitions or schemas are retained. */\nexport const toolReplayContracts = Effect.fn(\"AgentRegistration.toolReplayContracts\")(function* (\n definition: Agent.AnyDefinition,\n versions?: ReplayVersions,\n fallbackVersion: PersistedJson = null,\n) {\n const declarations = yield* Effect.try({\n try: () => {\n const jsonSchema = (schema: Schema.Top) =>\n Schema.decodeUnknownSync(Schema.Json)(Tool.getJsonSchemaFromSchema(schema));\n\n return Object.values(definition.toolkit.tools).map((tool) => {\n const version = versions === undefined ? fallbackVersion : versions.tools[tool.name];\n\n if (\n version === undefined ||\n (versions !== undefined && !Object.hasOwn(versions.tools, tool.name))\n )\n throw new Error(\"Every Tool needs an explicit replay semantic version\");\n\n return {\n name: tool.name,\n contract: {\n version,\n parameters: jsonSchema(tool.parametersSchema),\n success: jsonSchema(tool.successSchema),\n failure: jsonSchema(tool.failureSchema),\n failureMode: tool.failureMode,\n needsApproval:\n typeof tool.needsApproval === \"function\" ? \"dynamic\" : (tool.needsApproval ?? false),\n executionClass: getToolExecutionClass(tool),\n executionKind: getToolExecutionKind(tool.annotations),\n contextRollover: Context.get(tool.annotations, ContextRolloverTool),\n completion: definition.completion?.tool === tool.name,\n completionFromTool:\n definition.completionFromTools?.some(\n (declaration) => declaration.tool === tool.name,\n ) ?? false,\n },\n };\n });\n },\n catch: () =>\n DigestError.make({\n message: \"Operation contracts require serializable codecs and a version for every Tool\",\n }),\n });\n\n return Object.fromEntries(\n yield* Effect.forEach(declarations, ({ name, contract }) =>\n digestJson(contract).pipe(Effect.map((digest) => [name, digest] as const)),\n ),\n );\n});\n\n/** Compile current metadata without acquiring executable services. */\nexport const compileBindingContracts = Effect.fn(\"AgentRegistration.compileBindingContracts\")(\n function* (\n definition: Agent.AnyDefinition,\n definitions: DefinitionDigestInput,\n versions?: ReplayVersions,\n ): Effect.fn.Return<Pick<ResolvedBinding, \"digests\">, DigestError, Crypto.Crypto> {\n const digests = yield* digestDefinitions(definitions);\n const tools = yield* toolReplayContracts(definition, versions, definitions.tools);\n\n return {\n digests: DefinitionDigests.make({\n ...digests,\n replay: ReplayContract.make({ agent: digests.agent, tools }),\n }),\n };\n },\n);\n\ntype ExecutableDefinition = Agent.AnyDefinition & {\n readonly instructions: InstructionSource<never, unknown, unknown>;\n readonly inputPrompt?: InputPromptSource<never, unknown, unknown> | undefined;\n};\n\n/** Executable model Binding accepted by durable registration descriptors. */\nexport type ExecutableAgentBinding = {\n readonly definition: ExecutableDefinition;\n readonly model: Layer.Layer<ModelServices, never, unknown>;\n};\n\n/**\n * Internal coordinator entry point for one fenced Attempt over an already-granted claim.\n * The generic signature matches `runAttempt` and is specialized for each captured Agent.\n */\ntype ResolvedAttemptDriver = <\n InputSchema extends Schema.Top,\n OutputSchema extends Schema.Top,\n Instructions,\n Tools extends Record<string, Tool.Any>,\n Provider,\n ModelProvides,\n ModelRequires,\n InstructionError,\n InstructionRequirements,\n RunDispositionValue extends\n | RunDispositionDeclaration<OutputSchema[\"Type\"], Schema.Top>\n | undefined,\n InputPromptValue extends InputPromptSource<InputSchema[\"Type\"], unknown, unknown> | undefined,\n UpdatesSchema extends Schema.Top | undefined,\n>(\n agent: RuntimeBinding<\n InputSchema,\n OutputSchema,\n Instructions,\n Tools,\n Provider,\n ModelProvides,\n ModelRequires,\n InstructionError,\n InstructionRequirements,\n RunDispositionValue,\n InputPromptValue,\n UpdatesSchema\n >,\n threadId: ThreadId,\n claim: Claim,\n) => Effect.Effect<\n Option.Option<Settlement>,\n DurableWorkerFailure,\n DurableWorkerRequirements<\n RuntimeBinding<\n InputSchema,\n OutputSchema,\n Instructions,\n Tools,\n Provider,\n ModelProvides,\n ModelRequires,\n InstructionError,\n InstructionRequirements,\n RunDispositionValue,\n InputPromptValue,\n UpdatesSchema\n >,\n InstructionRequirements\n >\n>;\n\ntype CapturedAttempt<A extends ExecutableAgentBinding> = (\n agent: A,\n threadId: ThreadId,\n claim: Claim,\n) => Effect.Effect<Option.Option<Settlement>, DurableWorkerFailure, DurableWorkerRequirements<A>>;\n\n/**\n * An Agent with its worker services captured, ready to drive a fenced Attempt.\n * Concrete Schema and model types stay inside this closure when registrations are collected.\n */\ninterface CapturedBinding {\n readonly agentId: AgentId;\n /** Exact immutable definition whose codecs and behavior the worker captured. */\n readonly definition: Agent.AnyDefinition;\n /** Captured independently from per-Attempt services: report preparation has no fenced Claim. */\n readonly reporting?: ReadonlyArray<WorkerReporting<WorkerReportPreparationFailure>>;\n readonly attempt: (\n driver: ResolvedAttemptDriver,\n threadId: ThreadId,\n claim: Claim,\n ) => Effect.Effect<Option.Option<Settlement>, DurableWorkerFailure>;\n}\n\ntype ReportRequirements<Reports> =\n Reports extends ReadonlyArray<WorkerReporting<unknown, unknown>>\n ? [Reports[number]] extends [never]\n ? never\n : Reports[number] extends WorkerReporting<unknown, infer R>\n ? Exclude<R, Scope.Scope>\n : never\n : never;\n\n// Registrations outlive their construction span. Dependencies remain captured,\n// while every attempt/report inherits the invoking fiber's tracing state.\nconst omitTraceContext = Context.omit(\n Tracer.ParentSpan,\n Tracer.Tracer,\n Tracer.MinimumTraceLevel,\n Tracer.CurrentTraceLevel,\n References.TracerEnabled,\n References.TracerTimingEnabled,\n References.TracerSpanAnnotations,\n References.TracerSpanLinks,\n);\n\n// R describes captured application services; ParentSpan is supplied by the\n// live invocation rather than stored as a registration dependency.\nconst withoutTraceContext = <R>(context: Context.Context<R>): Context.Context<R> =>\n omitTraceContext(context) as Context.Context<R>;\n\nconst captureReporting = <R>(reports: ReadonlyArray<WorkerReporting<unknown, R>>) =>\n Effect.map(\n Effect.context<Exclude<R, Scope.Scope>>().pipe(Effect.map(withoutTraceContext)),\n (context) =>\n reports.map((report): WorkerReporting<WorkerReportPreparationFailure> => ({\n ...report,\n prepare: (value) =>\n Effect.scoped(Effect.suspend(() => report.prepare(value))).pipe(\n Effect.provide(context),\n Effect.mapError((error) =>\n Schema.is(WorkerReportPreparationFailure)(error)\n ? error\n : WorkerReportPreparationFailure.make({ stage: \"preparation\" }),\n ),\n ),\n })),\n );\n\nconst backgroundReports = (definition: Agent.AnyDefinition) => [\n ...new Set(\n Object.values(definition.toolkit.tools).flatMap((tool) => {\n const report = Context.get(tool.annotations, BackgroundReporting);\n\n return report === undefined ? [] : [report];\n }),\n ),\n];\n\n/** One exact executable registration used by durable claim-time resolution. */\nexport interface ResolvedBinding extends CapturedBinding {\n readonly digests: DefinitionDigests;\n}\n\n/** Trusted claim identity for resolving per-Attempt application services. Not model input. */\nexport interface AgentAttemptContext {\n readonly threadId: ThreadId;\n readonly submissionId: Claim[\"submissionId\"];\n readonly attemptId: Claim[\"attemptId\"];\n}\n\nconst capture = <A extends ExecutableAgentBinding, Provides = never, Requires = never>(\n agent: A,\n attemptLayer?: (context: AgentAttemptContext) => Layer.Layer<Provides, never, Requires>,\n): Effect.Effect<\n CapturedBinding,\n never,\n Exclude<DurableWorkerRequirements<A>, Provides> | Requires\n> =>\n Effect.map(\n Effect.context<Exclude<DurableWorkerRequirements<A>, Provides> | Requires>().pipe(\n Effect.map(withoutTraceContext),\n ),\n (context): CapturedBinding => ({\n agentId: agent.definition.id,\n definition: agent.definition,\n attempt: (driver, threadId, claim) => {\n // Registration closes one concrete Binding before heterogeneous registrations are\n // collected. TypeScript cannot instantiate the higher-rank RuntimeBinding parameters\n // from the intentionally erased public shape, so specialize the driver back to A here.\n const run = driver as unknown as CapturedAttempt<A>;\n const execute = run(agent, threadId, claim);\n\n const scoped =\n attemptLayer === undefined\n ? execute\n : execute.pipe(\n Effect.provide(\n Layer.fresh(\n attemptLayer({\n threadId,\n submissionId: claim.submissionId,\n attemptId: claim.attemptId,\n }),\n ),\n ),\n );\n\n return scoped.pipe(Effect.provide(context)) as Effect.Effect<\n Option.Option<Settlement>,\n DurableWorkerFailure\n >;\n },\n }),\n );\n\n/**\n * Build one exact worker registration from an executable Agent Binding and\n * its already-computed definition digests.\n *\n * `make(agent, digests)` captures the binding plus its worker-requirement\n * Context at Layer/effect construction time. Hosts that start from application\n * version declarations should use `compileRegistrations`; low-level fixtures\n * may supply a previously computed digest triple directly.\n */\nexport const DurableWorkerBinding = {\n make: <\n A extends ExecutableAgentBinding,\n const Reports extends ReadonlyArray<WorkerReporting<unknown, unknown>> = readonly [],\n >(\n agent: A,\n digests: DefinitionDigests,\n reporting?: Reports,\n ): Effect.Effect<\n ResolvedBinding,\n never,\n DurableWorkerRequirements<A> | ReportRequirements<Reports>\n > =>\n Effect.gen(function* () {\n const binding = yield* capture(agent);\n\n const reports = yield* captureReporting([\n ...(reporting ?? []),\n ...backgroundReports(agent.definition),\n ]);\n\n return { ...binding, digests, reporting: reports };\n }) as Effect.Effect<\n ResolvedBinding,\n never,\n DurableWorkerRequirements<A> | ReportRequirements<Reports>\n >,\n} as const;\n\n/** INTERNAL identity-only capture retained for the legacy direct worker path. */\nexport const makeLegacyWorkerBinding = capture;\n\nexport const resolveWorkerBinding = (\n bindings: ReadonlyArray<ResolvedBinding>,\n agentId: AgentId,\n): Effect.Effect<ResolvedBinding, BindingUnavailable> => {\n const registered = bindings.filter((binding) => binding.agentId === agentId);\n const binding = registered[0];\n\n return registered.length === 1 && binding !== undefined\n ? Effect.succeed(binding)\n : Effect.fail(\n BindingUnavailable.make({\n agentId,\n message: `Exactly one current Agent Binding must be registered for ${agentId}`,\n }),\n );\n};\n\n/** Resolve authoring-time admission through the one exact host registration, never by identity alone. */\nexport const resolveDefinitionBinding = (\n bindings: ReadonlyArray<ResolvedBinding>,\n definition: Pick<Agent.AnyDefinition, \"id\">,\n): Effect.Effect<ResolvedBinding, BindingUnavailable> => {\n const candidates = bindings.filter((binding) => binding.agentId === definition.id);\n const binding = candidates[0];\n\n if (candidates.length !== 1 || binding === undefined) {\n return Effect.fail(\n BindingUnavailable.make({\n agentId: definition.id,\n message: \"Registered admission requires exactly one binding for the Agent identity\",\n }),\n );\n }\n\n if (!Object.is(binding.definition, definition)) {\n return Effect.fail(\n BindingUnavailable.make({\n agentId: definition.id,\n message: \"Registered admission requires the exact Agent Definition used in registration\",\n }),\n );\n }\n\n return Effect.succeed(binding);\n};\n\n/** Application versions and a model Layer, supplied directly or through an existing Binding. */\nexport type AgentRegistration<A extends ExecutableAgentBinding = ExecutableAgentBinding> = (\n | { readonly agent: A; readonly model?: never; readonly definitions: DefinitionDigestInput }\n | {\n readonly agent: A[\"definition\"];\n readonly model: A[\"model\"];\n readonly definitions: DefinitionDigestInput;\n }\n) & {\n /** Explicit operation versions let unchanged unfinished handlers survive toolbox changes. */\n readonly continuity?: {\n readonly versions: ReplayVersions;\n };\n /**\n * Source-owned reports capture services outside attemptLayer and open a fresh Scope per\n * preparation. Version changes with this registration. Missing exact code and preparation\n * failures become retained report refusals; durable delivery retries reuse the frozen input.\n */\n readonly reporting?: ReadonlyArray<WorkerReporting<unknown, unknown>>;\n /**\n * Build fresh services for exactly one fenced Attempt, across all its Tool/model turns.\n * Finalizes on completion, suspension, failure and interruption. Never reused after eviction.\n * Resolve invocation authority from the trusted claim identity, not captured caller state.\n * Keep fallible resource acquisition lazy in typed Tool operations; this Layer cannot fail.\n */\n readonly attemptLayer?: (context: AgentAttemptContext) => Layer.Layer<never, never, unknown>;\n};\n\ntype EntryWorkerRequirements<Entry> = Entry extends {\n readonly agent: infer A extends ExecutableAgentBinding;\n}\n ? DurableWorkerRequirements<A>\n : Entry extends {\n readonly agent: infer D extends ExecutableDefinition;\n readonly model: infer M extends ExecutableAgentBinding[\"model\"];\n }\n ? DurableWorkerRequirements<{ readonly definition: D; readonly model: M }>\n : never;\n\ntype AttemptLayerRequirements<Requirements, AttemptLayer> = AttemptLayer extends (\n context: AgentAttemptContext,\n) => Layer.Layer<infer Provides, never, infer Requires>\n ? Exclude<Requirements, Provides> | Requires\n : Requirements;\n\n// Conditional options retain every service they may consume. An absent attempt Layer\n// still needs the original worker services; only a definite Layer can remove them.\ntype EntryRequirements<Entry> = Entry extends unknown\n ?\n | AttemptLayerRequirements<\n EntryWorkerRequirements<Entry>,\n \"attemptLayer\" extends keyof Entry ? Entry[\"attemptLayer\"] : undefined\n >\n | (\"reporting\" extends keyof Entry ? ReportRequirements<Entry[\"reporting\"]> : never)\n : never;\n\ntype RegistrationRequirements<Entries extends ReadonlyArray<AgentRegistration>> = [\n Entries[number],\n] extends [never]\n ? never\n : EntryRequirements<Entries[number]>;\n\nconst registrationDefinitions = (entry: AgentRegistration): DefinitionDigestInput => {\n const definition = entry.model === undefined ? entry.agent.definition : entry.agent;\n const automatic = backgroundReports(definition);\n\n const declaredDefinitions =\n definition.updates === undefined\n ? entry.definitions\n : {\n ...entry.definitions,\n agent: {\n declaration: entry.definitions.agent,\n updates: Schema.decodeUnknownSync(Schema.Json)(\n Tool.getJsonSchemaFromSchema(definition.updates),\n ),\n updateProtocol: { schemaVersion: 1, tool: \"emit_update\" },\n },\n };\n\n const definitions =\n automatic.length === 0\n ? declaredDefinitions\n : {\n ...declaredDefinitions,\n agent: {\n declaration: declaredDefinitions.agent,\n backgroundReporting: automatic.map((report) => ({\n delegationId: report.delegationId,\n targetAgentId: report.target.id,\n mode: report.mode ?? \"custom\",\n destinationDelegationId: report.destination?.delegationId ?? null,\n })),\n },\n };\n\n const exposure = definition.toolExposure;\n\n if (\n exposure === undefined &&\n !Object.values(definition.toolkit.tools).some(\n (tool) =>\n Context.get(tool.annotations, DiscoveryTool) || Context.get(tool.annotations, PinnedTool),\n )\n )\n return definitions;\n\n return {\n ...definitions,\n agent: {\n declaration: definitions.agent,\n toolExposure: {\n initialToolNames: exposure === undefined ? null : [...(exposure.initialToolNames ?? [])],\n maxTools: exposure?.maxTools ?? 64,\n maxSchemaBytes: exposure?.maxSchemaBytes ?? 262_144,\n requiredCompletion:\n definition.completion?.required === true ? definition.completion.tool : null,\n tools: Object.values(definition.toolkit.tools).map((tool) => ({\n name: tool.name,\n pinned: Context.get(tool.annotations, PinnedTool),\n discovery: Context.get(tool.annotations, DiscoveryTool),\n namespace: Context.get(tool.annotations, ToolNamespace) ?? null,\n includesCatalogDocumentation: Context.get(tool.annotations, IncludesCatalogDocumentation),\n additional: Context.get(tool.annotations, AdditionalToolCatalog).map((entry) => ({\n name: entry.tool.name,\n namespace: entry.namespace,\n method: entry.method,\n })),\n })),\n },\n },\n };\n};\n\nconst compileRegistration = <Entry extends AgentRegistration>(\n entry: Entry,\n): Effect.Effect<ResolvedBinding, DigestError, Crypto.Crypto | EntryRequirements<Entry>> =>\n Effect.flatMap(\n Effect.try({\n try: () => registrationDefinitions(entry),\n catch: () =>\n DigestError.make({ message: \"Agent update schema has no serializable wire contract\" }),\n }),\n (definitions) =>\n Effect.gen(function* () {\n const binding = yield* capture(\n entry.model === undefined ? entry.agent : { definition: entry.agent, model: entry.model },\n entry.attemptLayer,\n );\n\n const reporting = yield* captureReporting([\n ...(entry.reporting ?? []),\n ...backgroundReports(binding.definition),\n ]);\n\n return {\n ...binding,\n ...(yield* compileBindingContracts(\n binding.definition,\n definitions,\n entry.continuity?.versions,\n )),\n reporting,\n };\n }),\n // The erased descriptor accepts arbitrary provided services. Restore the concrete entry's\n // Exclude<worker requirements, provided services> | layer requirements at this collection seam.\n ) as Effect.Effect<ResolvedBinding, DigestError, Crypto.Crypto | EntryRequirements<Entry>>;\n\n/** Compile heterogeneous Agent descriptors into exact, dependency-closed worker registrations. */\nexport const compileRegistrations = <const Entries extends ReadonlyArray<AgentRegistration>>(\n entries: Entries,\n): Effect.Effect<\n ReadonlyArray<ResolvedBinding>,\n DigestError,\n Crypto.Crypto | RegistrationRequirements<Entries>\n> => {\n // `Effect.forEach` instantiates a generic callback at its constraint. Specialize the callback to\n // this tuple's distributed requirement union before collection so empty and heterogeneous tuples\n // retain their exact service requirements.\n const compileEntry = compileRegistration as unknown as (\n entry: Entries[number],\n ) => Effect.Effect<\n ResolvedBinding,\n DigestError,\n Crypto.Crypto | RegistrationRequirements<Entries>\n >;\n\n return Effect.forEach(entries, compileEntry);\n};\n"],"mappings":";;;;;;;;;;;;AA4CA,IAAa,qBAAb,cAAwC,OAAO,YAAgC,CAAC,CAC9E,sBACA;CAAE,SAAS;CAAS,SAAS,OAAO;AAAO,CAC7C,CAAC,CAAC,CAAC;;AAKH,MAAa,0BACX,MACA,UAEA,KAAK,UAAU,MAAM,SACrB,KAAK,UAAU,MAAM,SACrB,KAAK,UAAU,MAAM,SACrB,OAAO,cAAc,OAAO,YAAY,cAAc,CAAC,CAAC,CAAC,KAAK,QAAQ,MAAM,MAAM;;AAQpF,MAAa,sBAAsB,OAAO,GAAG,uCAAuC,CAAC,CAAC,WACpF,YACA,UACA,kBAAiC,MACjC;CACA,MAAM,eAAe,OAAO,OAAO,IAAI;EACrC,WAAW;GACT,MAAM,cAAc,WAClB,OAAO,kBAAkB,OAAO,IAAI,CAAC,CAAC,KAAK,wBAAwB,MAAM,CAAC;GAE5E,OAAO,OAAO,OAAO,WAAW,QAAQ,KAAK,CAAC,CAAC,KAAK,SAAS;IAC3D,MAAM,UAAU,aAAa,KAAA,IAAY,kBAAkB,SAAS,MAAM,KAAK;IA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C,aACE,YAAY,KAAK,EAAE,SAAS,wDAAwD,CAAC;AACzF,CAAC,IACA,gBACC,OAAO,IAAI,aAAa;CACtB,MAAM,UAAU,OAAO,QACrB,MAAM,UAAU,KAAA,IAAY,MAAM,QAAQ;EAAE,YAAY,MAAM;EAAO,OAAO,MAAM;CAAM,GACxF,MAAM,YACR;CAEA,MAAM,YAAY,OAAO,iBAAiB,CACxC,GAAI,MAAM,aAAa,CAAC,GACxB,GAAG,kBAAkB,QAAQ,UAAU,CACzC,CAAC;CAED,OAAO;EACL,GAAG;EACH,GAAI,OAAO,wBACT,QAAQ,YACR,aACA,MAAM,YAAY,QACpB;EACA;CACF;AACF,CAAC,CAGL;;AAGF,MAAa,wBACX,YAKG;CAIH,MAAM,eAAe;CAQrB,OAAO,OAAO,QAAQ,SAAS,YAAY;AAC7C"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { RedactionError, Redactor } from "./Redaction.mjs";
|
|
2
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
|
+
declare namespace Approval_d_exports {
|
|
4
|
+
export { ApprovalApproved, ApprovalAudit, ApprovalAuditEvent, ApprovalAuditEvents, ApprovalAuditLimitExceeded, ApprovalAuditMemoryLive, ApprovalDecision, ApprovalDecisionMismatch, ApprovalDecisionRecorded, ApprovalDenied, ApprovalDenyAll, ApprovalRequest, ApprovalRequestDraft, ApprovalRequestRecorded, ApprovalResolver, ApprovalResolverError, ApprovalTimedOut, makeApprovalRequest, requestApproval };
|
|
5
|
+
}
|
|
6
|
+
declare const ApprovalRequestDraft_base: Schema.Class<ApprovalRequestDraft, Schema.Struct<{
|
|
7
|
+
readonly requestId: Schema.NonEmptyString;
|
|
8
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
|
|
9
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
10
|
+
readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
|
|
11
|
+
readonly toolName: Schema.NonEmptyString;
|
|
12
|
+
readonly actionSummary: Schema.String;
|
|
13
|
+
readonly resourceTargets: Schema.refine<readonly string[], Schema.$Array<Schema.String>>;
|
|
14
|
+
readonly risk: Schema.Literals<readonly ["low", "medium", "high", "critical"]>;
|
|
15
|
+
readonly expiresAt: Schema.DateTimeUtcFromString;
|
|
16
|
+
readonly denial: Schema.Literals<readonly ["terminal", "recoverable"]>;
|
|
17
|
+
}>, {}>;
|
|
18
|
+
/** Decoded approval metadata before the Redactor owns Tool input preview creation. */
|
|
19
|
+
export declare class ApprovalRequestDraft extends ApprovalRequestDraft_base {}
|
|
20
|
+
declare const ApprovalRequest_base: Schema.Class<ApprovalRequest, Schema.Struct<{
|
|
21
|
+
readonly requestId: Schema.NonEmptyString;
|
|
22
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
|
|
23
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
24
|
+
readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
|
|
25
|
+
readonly toolName: Schema.NonEmptyString;
|
|
26
|
+
readonly actionSummary: Schema.String;
|
|
27
|
+
readonly resourceTargets: Schema.refine<readonly string[], Schema.$Array<Schema.String>>;
|
|
28
|
+
readonly risk: Schema.Literals<readonly ["low", "medium", "high", "critical"]>;
|
|
29
|
+
readonly expiresAt: Schema.DateTimeUtcFromString;
|
|
30
|
+
readonly denial: Schema.Literals<readonly ["terminal", "recoverable"]>;
|
|
31
|
+
readonly redactedInputPreview: Schema.brand<Schema.refine<string, Schema.String>, "@effect-agent/capabilities/RedactedPreview">;
|
|
32
|
+
}>, {}>;
|
|
33
|
+
/** Fully decoded, structurally redacted approval input. */
|
|
34
|
+
export declare class ApprovalRequest extends ApprovalRequest_base {}
|
|
35
|
+
declare const ApprovalApproved_base: Schema.Class<ApprovalApproved, Schema.TaggedStruct<"ApprovalApproved", {
|
|
36
|
+
readonly requestId: Schema.NonEmptyString;
|
|
37
|
+
readonly decidedAt: Schema.DateTimeUtcFromString;
|
|
38
|
+
readonly resolver: Schema.NonEmptyString;
|
|
39
|
+
}>, {}>;
|
|
40
|
+
export declare class ApprovalApproved extends ApprovalApproved_base {}
|
|
41
|
+
declare const ApprovalDenied_base: Schema.Class<ApprovalDenied, Schema.TaggedStruct<"ApprovalDenied", {
|
|
42
|
+
readonly requestId: Schema.NonEmptyString;
|
|
43
|
+
readonly decidedAt: Schema.DateTimeUtcFromString;
|
|
44
|
+
readonly resolver: Schema.NonEmptyString;
|
|
45
|
+
readonly reason: Schema.String;
|
|
46
|
+
readonly timedOut: Schema.Boolean;
|
|
47
|
+
}>, {}>;
|
|
48
|
+
export declare class ApprovalDenied extends ApprovalDenied_base {}
|
|
49
|
+
export declare const ApprovalDecision: Schema.Union<readonly [typeof ApprovalApproved, typeof ApprovalDenied]>;
|
|
50
|
+
export type ApprovalDecision = typeof ApprovalDecision.Type;
|
|
51
|
+
declare const ApprovalResolverError_base: Schema.Class<ApprovalResolverError, Schema.TaggedStruct<"ApprovalResolverError", {
|
|
52
|
+
readonly message: Schema.String;
|
|
53
|
+
}>, import("effect/Cause").YieldableError>;
|
|
54
|
+
/** Resolver infrastructure failed before it could make a policy decision. */
|
|
55
|
+
export declare class ApprovalResolverError extends ApprovalResolverError_base {}
|
|
56
|
+
declare const ApprovalTimedOut_base: Schema.Class<ApprovalTimedOut, Schema.TaggedStruct<"ApprovalTimedOut", {
|
|
57
|
+
readonly requestId: Schema.NonEmptyString;
|
|
58
|
+
}>, import("effect/Cause").YieldableError>;
|
|
59
|
+
/** The resolver explicitly observed its request deadline; callers turn this into a denial. */
|
|
60
|
+
export declare class ApprovalTimedOut extends ApprovalTimedOut_base {}
|
|
61
|
+
declare const ApprovalResolver_base: Context.ServiceClass<ApprovalResolver, "@effect-agent/capabilities/ApprovalResolver", {
|
|
62
|
+
readonly request: (request: ApprovalRequest) => Effect.Effect<ApprovalDecision, ApprovalResolverError | ApprovalTimedOut>;
|
|
63
|
+
}>;
|
|
64
|
+
/** First-class approval authority. Interactive, policy, and remote adapters implement this service. */
|
|
65
|
+
export declare class ApprovalResolver extends ApprovalResolver_base {}
|
|
66
|
+
declare const ApprovalRequestRecorded_base: Schema.Class<ApprovalRequestRecorded, Schema.TaggedStruct<"ApprovalRequestRecorded", {
|
|
67
|
+
readonly sequence: Schema.Natural;
|
|
68
|
+
readonly recordedAt: Schema.DateTimeUtcFromString;
|
|
69
|
+
readonly request: typeof ApprovalRequest;
|
|
70
|
+
}>, {}>;
|
|
71
|
+
export declare class ApprovalRequestRecorded extends ApprovalRequestRecorded_base {}
|
|
72
|
+
declare const ApprovalDecisionRecorded_base: Schema.Class<ApprovalDecisionRecorded, Schema.TaggedStruct<"ApprovalDecisionRecorded", {
|
|
73
|
+
readonly sequence: Schema.Natural;
|
|
74
|
+
readonly recordedAt: Schema.DateTimeUtcFromString;
|
|
75
|
+
readonly decision: Schema.Union<readonly [typeof ApprovalApproved, typeof ApprovalDenied]>;
|
|
76
|
+
}>, {}>;
|
|
77
|
+
export declare class ApprovalDecisionRecorded extends ApprovalDecisionRecorded_base {}
|
|
78
|
+
export declare const ApprovalAuditEvent: Schema.Union<readonly [typeof ApprovalRequestRecorded, typeof ApprovalDecisionRecorded]>;
|
|
79
|
+
export type ApprovalAuditEvent = typeof ApprovalAuditEvent.Type;
|
|
80
|
+
export declare const ApprovalAuditEvents: Schema.$Array<Schema.Union<readonly [typeof ApprovalRequestRecorded, typeof ApprovalDecisionRecorded]>>;
|
|
81
|
+
declare const ApprovalAuditLimitExceeded_base: Schema.Class<ApprovalAuditLimitExceeded, Schema.TaggedStruct<"ApprovalAuditLimitExceeded", {
|
|
82
|
+
readonly limitValue: Schema.Natural;
|
|
83
|
+
readonly observedValue: Schema.Natural;
|
|
84
|
+
}>, import("effect/Cause").YieldableError>;
|
|
85
|
+
export declare class ApprovalAuditLimitExceeded extends ApprovalAuditLimitExceeded_base {}
|
|
86
|
+
declare const ApprovalDecisionMismatch_base: Schema.Class<ApprovalDecisionMismatch, Schema.TaggedStruct<"ApprovalDecisionMismatch", {
|
|
87
|
+
readonly expectedRequestId: Schema.NonEmptyString;
|
|
88
|
+
readonly observedRequestId: Schema.NonEmptyString;
|
|
89
|
+
}>, import("effect/Cause").YieldableError>;
|
|
90
|
+
/** A resolver or audit sink tried to associate a decision with another request. */
|
|
91
|
+
export declare class ApprovalDecisionMismatch extends ApprovalDecisionMismatch_base {}
|
|
92
|
+
declare const ApprovalAudit_base: Context.ServiceClass<ApprovalAudit, "@effect-agent/capabilities/ApprovalAudit", {
|
|
93
|
+
readonly recordRequest: (request: ApprovalRequest) => Effect.Effect<void, ApprovalAuditLimitExceeded>;
|
|
94
|
+
readonly recordDecision: (decision: ApprovalDecision) => Effect.Effect<void, ApprovalAuditLimitExceeded | ApprovalDecisionMismatch>;
|
|
95
|
+
readonly events: Effect.Effect<ReadonlyArray<ApprovalAuditEvent>>;
|
|
96
|
+
}>;
|
|
97
|
+
/** P2 semantic audit sink; durable runtimes replace this with canonical records. */
|
|
98
|
+
export declare class ApprovalAudit extends ApprovalAudit_base {}
|
|
99
|
+
/** Scoped in-memory audit projection with monotonic event order. */
|
|
100
|
+
export declare const ApprovalAuditMemoryLive: Layer.Layer<ApprovalAudit, never, never>;
|
|
101
|
+
/** Construct an ApprovalRequest only after decoded input passes the configured Redactor. */
|
|
102
|
+
export declare const makeApprovalRequest: (draft: ApprovalRequestDraft, decodedToolInput: unknown) => Effect.Effect<ApprovalRequest, RedactionError, Redactor>;
|
|
103
|
+
/**
|
|
104
|
+
* Resolve with fail-closed deadline semantics and record request/decision audit
|
|
105
|
+
* events around every successful, denied, timed-out, or resolver-failed
|
|
106
|
+
* resolution. A resolver infrastructure failure records a synthetic denial so
|
|
107
|
+
* the audit reservation is released before the typed error propagates.
|
|
108
|
+
*/
|
|
109
|
+
export declare const requestApproval: (request: ApprovalRequest) => Effect.Effect<ApprovalApproved | ApprovalDenied, ApprovalAuditLimitExceeded | ApprovalDecisionMismatch | ApprovalResolverError, ApprovalAudit | ApprovalResolver>;
|
|
110
|
+
/** Deterministic policy layer for tests and deny-by-default deployments. */
|
|
111
|
+
export declare const ApprovalDenyAll: Layer.Layer<ApprovalResolver, never, never>;
|
|
112
|
+
//#endregion
|
|
113
|
+
export { Approval_d_exports as t };
|
|
114
|
+
//# sourceMappingURL=Approval.d.mts.map
|