effect-agent 0.1.0-beta.15 → 0.1.0-beta.151
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/Admin-CKIdJoP8.d.mts +4236 -0
- package/dist/Agent-1DMSO_Fl.mjs +86 -0
- package/dist/Agent-1DMSO_Fl.mjs.map +1 -0
- package/dist/Agent-Cjd_ZveM.d.mts +259 -0
- package/dist/AgentError-Bn1ytXRD.d.mts +117 -0
- package/dist/AgentPolicy-BqDoSXO6.d.mts +96 -0
- package/dist/AgentRuntime-D8U9gl9Q.mjs +4745 -0
- package/dist/AgentRuntime-D8U9gl9Q.mjs.map +1 -0
- package/dist/AgentRuntime-sXpKcyxu.d.mts +346 -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/Digest-U69rDHuO.d.mts +22 -0
- package/dist/DurableAgentRuntime-R2LUYnRl.mjs +7207 -0
- package/dist/DurableAgentRuntime-R2LUYnRl.mjs.map +1 -0
- package/dist/DurableFailpoint-Cnr3wx1L.d.mts +41 -0
- package/dist/DurableStep-Cry_iol4.d.mts +103 -0
- package/dist/EventSource-CMbXXmwe.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-ccQURKCf.d.mts +1067 -0
- package/dist/MessagingHost-D04wE-7W.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-CFD1CPfU.d.mts +25 -0
- package/dist/PageCapture-Df8Xwskw.d.mts +583 -0
- package/dist/PreparedInputAdmission-Bt6rgtVu.d.mts +42 -0
- package/dist/Receipt-BAHyigAF.d.mts +33 -0
- package/dist/Records-B5GFWCpn.d.mts +1104 -0
- package/dist/RunEvent-DIrzkjLr.d.mts +460 -0
- package/dist/RunEventSink-D5aVhISG.d.mts +108 -0
- package/dist/RunJournal-Gd83HYqG.mjs +954 -0
- package/dist/RunJournal-Gd83HYqG.mjs.map +1 -0
- package/dist/RunOptions-Bv9NpkPZ.d.mts +943 -0
- package/dist/RunPolicyUsage-ClZxyR46.d.mts +21 -0
- package/dist/Sandbox-CEsDWBLq.d.mts +173 -0
- package/dist/Schedule-CtYREFnz.d.mts +847 -0
- package/dist/Scheduling-DPb2QyAK.mjs +691 -0
- package/dist/Scheduling-DPb2QyAK.mjs.map +1 -0
- package/dist/Subagent-VHrANXFy.d.mts +1652 -0
- package/dist/Subagent-hG9lJ7tJ.mjs +1502 -0
- package/dist/Subagent-hG9lJ7tJ.mjs.map +1 -0
- package/dist/SubagentContract-DdT7Cqe6.d.mts +116 -0
- package/dist/SubagentHost-C-4A7tA2.d.mts +172 -0
- package/dist/Subscription-BJAzYNw1.d.mts +979 -0
- package/dist/SubscriptionInput-CkBJt0AS.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/WorkerAdmission-CJ_oWRuS.mjs +171 -0
- package/dist/WorkerAdmission-CJ_oWRuS.mjs.map +1 -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 +523 -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 +519 -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 +64 -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 +4 -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/LifecyclePublication.d.mts +2 -0
- package/dist/durable/LifecyclePublication.mjs +189 -0
- package/dist/durable/LifecyclePublication.mjs.map +1 -0
- package/dist/durable/MessageDelivery.d.mts +935 -0
- package/dist/durable/MessageDelivery.mjs +557 -0
- package/dist/durable/MessageDelivery.mjs.map +1 -0
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +400 -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 +858 -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 +55 -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/SubmissionLedger.d.mts +3 -0
- package/dist/durable/SubmissionLedger.mjs +986 -0
- package/dist/durable/SubmissionLedger.mjs.map +1 -0
- package/dist/durable/SubmissionLedgerConformance.d.mts +30 -0
- package/dist/durable/SubmissionLedgerConformance.mjs +2254 -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 +274 -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 +74 -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 +77 -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 +383 -0
- package/dist/durable/ThreadStore.mjs.map +1 -0
- package/dist/durable/ThreadStoreConformance.d.mts +28 -0
- package/dist/durable/ThreadStoreConformance.mjs +543 -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/WorkerAdmission.d.mts +172 -0
- package/dist/durable/WorkerAdmission.mjs +2 -0
- package/dist/durable/WorkerHost.d.mts +156 -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 +92 -6
- package/dist/index.mjs +100 -6
- package/dist/output-contract-DS-S8mTv.mjs +135 -0
- package/dist/output-contract-DS-S8mTv.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 +48 -0
- package/dist/sandbox/PageScreenshot.mjs +53 -0
- package/dist/sandbox/PageScreenshot.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 +1099 -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 +983 -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 +1307 -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 +609 -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 +11367 -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/LifecyclePublication.ts +298 -0
- package/src/durable/MessageDelivery.ts +834 -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 +1087 -0
- package/src/durable/Recovery.ts +1018 -0
- package/src/durable/RunJournal.ts +1695 -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/SubmissionLedger.ts +1297 -0
- package/src/durable/SubmissionLedgerConformance.ts +4940 -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 +637 -0
- package/src/durable/ThreadStoreConformance.ts +1296 -0
- package/src/durable/ToolReconciler.ts +109 -0
- package/src/durable/WakeScheduler.ts +134 -0
- package/src/durable/WorkerAdmission.ts +104 -0
- package/src/durable/WorkerHost.ts +205 -0
- package/src/durable/internal/agent-registration.ts +587 -0
- package/src/durable/internal/agent-updates.ts +306 -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 +124 -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/thread-initialization.ts +195 -0
- package/src/durable/internal/worker-host.ts +3309 -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 +1109 -0
- package/src/engine/SubagentHost.ts +239 -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 +10596 -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 +250 -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 -22
- 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/Sandbox.ts +241 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { l as SubmissionId, t as AgentId, u as ThreadId } from "../Identifiers-CN2s30fF.mjs";
|
|
2
|
+
import { i as SubagentBudgetReservation } from "../SubagentContract-DdT7Cqe6.mjs";
|
|
3
|
+
import { r as Principal } from "../Receipt-BAHyigAF.mjs";
|
|
4
|
+
import { t as AgentPolicy } from "../AgentPolicy-BqDoSXO6.mjs";
|
|
5
|
+
import { r as AnyDefinition, t as Agent_d_exports } from "../Agent-Cjd_ZveM.mjs";
|
|
6
|
+
import { c as WorkerError, f as WorkerRef, h as WorkerSource } from "../Worker-fwWkBg12.mjs";
|
|
7
|
+
import { O as PersistedJson, _ as Digest, d as CanonicalSequence, ft as WorkerOrigin, h as DefinitionDigests, lt as WorkerContinuation } from "../Records-B5GFWCpn.mjs";
|
|
8
|
+
import { Tn as SubmissionSnapshot } from "../Admin-CKIdJoP8.mjs";
|
|
9
|
+
import { Context, Effect, Option, Schema } from "effect";
|
|
10
|
+
declare namespace WorkerHost_d_exports {
|
|
11
|
+
export { WorkerBudgetAuthorizer, WorkerConcurrencyLimit, WorkerConcurrencyResolver, WorkerHostAuthorizationRequest, WorkerHostAuthorizer, WorkerHostConfig, WorkerHostLimits, WorkerPolicyResolver, WorkerPolicySource, WorkerPolicyTarget, WorkerStartAdmission };
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* One successful start authorization at an exact source tail. This host-created hint is
|
|
15
|
+
* available only during that start's preparation and synchronous admission; it is never
|
|
16
|
+
* persisted or transported. Hooks may reuse their admission decision, but must retain
|
|
17
|
+
* current access checks at commit boundaries. A retry or changed tail gets no old grant.
|
|
18
|
+
*/
|
|
19
|
+
export interface WorkerStartAdmission {
|
|
20
|
+
readonly sourceThreadId: ThreadId;
|
|
21
|
+
readonly sourceSubmissionId?: SubmissionId;
|
|
22
|
+
readonly requestedPrincipal: Principal;
|
|
23
|
+
readonly principal: Principal;
|
|
24
|
+
readonly targetAgentId: AgentId;
|
|
25
|
+
readonly continuationOf?: WorkerContinuation;
|
|
26
|
+
readonly access: "send";
|
|
27
|
+
readonly tailSequence: CanonicalSequence;
|
|
28
|
+
readonly tailDigest: Digest;
|
|
29
|
+
}
|
|
30
|
+
/** Host-verified source input; absence never means the latest input in the Thread. */
|
|
31
|
+
export interface WorkerPolicySource {
|
|
32
|
+
readonly threadId: ThreadId;
|
|
33
|
+
readonly definition: AnyDefinition;
|
|
34
|
+
readonly definitions: DefinitionDigests;
|
|
35
|
+
readonly submission?: SubmissionSnapshot;
|
|
36
|
+
}
|
|
37
|
+
/** Initial input is validated again at destination admission, including idempotent replay. */
|
|
38
|
+
export type WorkerPolicyTarget = {
|
|
39
|
+
readonly definition: AnyDefinition;
|
|
40
|
+
readonly definitions: DefinitionDigests;
|
|
41
|
+
readonly source: WorkerSource;
|
|
42
|
+
} & ({
|
|
43
|
+
readonly _tag: "InitialInput";
|
|
44
|
+
readonly admission?: WorkerStartAdmission;
|
|
45
|
+
readonly continuationOf?: WorkerContinuation;
|
|
46
|
+
readonly sourceSubmission?: SubmissionSnapshot;
|
|
47
|
+
readonly input: PersistedJson;
|
|
48
|
+
readonly inputDigest: Digest;
|
|
49
|
+
} | {
|
|
50
|
+
readonly _tag: "RetainedWorker";
|
|
51
|
+
/** Verified against canonical source history before this request reaches the resolver. */
|
|
52
|
+
readonly origin: WorkerOrigin;
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Opt-in host authority for policies captured in immutable application input. None preserves
|
|
56
|
+
* the registered Definition's existing policy/override semantics. Some is a complete policy,
|
|
57
|
+
* never merged with static overrides. Decode and authorize the exact captured revision; do not
|
|
58
|
+
* read mutable settings or substitute a current capture for missing historical authority.
|
|
59
|
+
* RetainedWorker may affirm only origin.policy, never replace a continuing worker's allowance.
|
|
60
|
+
* Return WorkerError(unavailable) for temporarily unavailable authority so delivery can retry.
|
|
61
|
+
* Implementations are acquired through Effect Layers; capture their dependencies in Layer R.
|
|
62
|
+
*/
|
|
63
|
+
export declare const WorkerPolicyResolver: Context.Reference<{
|
|
64
|
+
readonly resolveSource: (request: WorkerPolicySource) => Effect.Effect<Option.Option<AgentPolicy>, WorkerError>;
|
|
65
|
+
readonly resolveTarget: (request: WorkerPolicyTarget) => Effect.Effect<Option.Option<AgentPolicy>, WorkerError>;
|
|
66
|
+
}>;
|
|
67
|
+
/** A host-authorized ceiling on active background workers, not retained workers or Run usage. */
|
|
68
|
+
export declare const WorkerConcurrencyLimit: Schema.Struct<{
|
|
69
|
+
readonly maxActiveWorkersPerSource: Schema.Int;
|
|
70
|
+
}>;
|
|
71
|
+
export type WorkerConcurrencyLimit = typeof WorkerConcurrencyLimit.Type;
|
|
72
|
+
/**
|
|
73
|
+
* Optional source-aware operational authority. Resolution occurs inside every new source
|
|
74
|
+
* reservation attempt, against the same canonical history used for the append CAS. None
|
|
75
|
+
* preserves WorkerHostConfig; Some can only narrow it. The selected submission is exact,
|
|
76
|
+
* never the latest input. Implementations must authorize that immutable capture and retain
|
|
77
|
+
* construction dependencies in Layer R. Unavailable authority must return WorkerError(unavailable).
|
|
78
|
+
*
|
|
79
|
+
* One worker occupies a slot while any of its inputs remain unacknowledged. Steering an active
|
|
80
|
+
* worker does not acquire another slot. Decreases (including zero) do not cancel incumbents;
|
|
81
|
+
* an idle worker needs a slot again. Idempotent retained reservations do not reacquire slots.
|
|
82
|
+
*/
|
|
83
|
+
export declare const WorkerConcurrencyResolver: Context.Reference<{
|
|
84
|
+
readonly resolve: (request: {
|
|
85
|
+
readonly source: WorkerSource;
|
|
86
|
+
readonly sourceSubmission?: SubmissionSnapshot;
|
|
87
|
+
readonly worker: WorkerRef;
|
|
88
|
+
readonly continuationOf?: WorkerContinuation;
|
|
89
|
+
readonly principal: Principal;
|
|
90
|
+
}) => Effect.Effect<Option.Option<WorkerConcurrencyLimit>, WorkerError>;
|
|
91
|
+
}>;
|
|
92
|
+
/** Host ceilings apply across all declarations owned by one source Thread. */
|
|
93
|
+
export declare const WorkerHostLimits: Schema.Struct<{
|
|
94
|
+
readonly maxWorkersPerSource: Schema.Int;
|
|
95
|
+
/** Active background workers across declarations; omission retains source Tool concurrency. */
|
|
96
|
+
readonly maxActiveWorkersPerSource: Schema.optionalKey<Schema.Int>;
|
|
97
|
+
readonly maxInputsPerWorker: Schema.Int;
|
|
98
|
+
readonly maxPendingInputsPerWorker: Schema.Int;
|
|
99
|
+
readonly maxUpdateInputsPerWorker: Schema.optionalKey<Schema.Int>;
|
|
100
|
+
readonly maxPendingUpdateInputsPerWorker: Schema.optionalKey<Schema.Int>;
|
|
101
|
+
readonly lifetimeMillis: Schema.Int;
|
|
102
|
+
/** Preparation may repeat after loss before its decision commits; keep callbacks side-effect free. */
|
|
103
|
+
readonly reportPreparationTimeoutMillis: Schema.optionalKey<Schema.Int>;
|
|
104
|
+
}>;
|
|
105
|
+
export type WorkerHostLimits = typeof WorkerHostLimits.Type;
|
|
106
|
+
export declare const WorkerHostConfig: Context.Reference<{
|
|
107
|
+
readonly maxWorkersPerSource: number;
|
|
108
|
+
readonly maxActiveWorkersPerSource?: number | undefined;
|
|
109
|
+
readonly maxInputsPerWorker: number;
|
|
110
|
+
readonly maxPendingInputsPerWorker: number;
|
|
111
|
+
readonly maxUpdateInputsPerWorker?: number | undefined;
|
|
112
|
+
readonly maxPendingUpdateInputsPerWorker?: number | undefined;
|
|
113
|
+
readonly lifetimeMillis: number;
|
|
114
|
+
readonly reportPreparationTimeoutMillis?: number | undefined;
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* Authenticate every acquisition/operation and authorize its exact source Thread. A returned
|
|
118
|
+
* Principal is host-owned admission identity. Context access authenticates source metadata;
|
|
119
|
+
* read, send and control remain separate grants. WorkerRefs and caller-supplied Thread
|
|
120
|
+
* identifiers alone never confer any of them.
|
|
121
|
+
*/
|
|
122
|
+
export interface WorkerHostAuthorizationRequest {
|
|
123
|
+
readonly admission?: WorkerStartAdmission;
|
|
124
|
+
readonly sourceThreadId: ThreadId;
|
|
125
|
+
/** An explicitly selected owner input; authorize this locator as well as the Thread. */
|
|
126
|
+
readonly sourceSubmissionId?: SubmissionId;
|
|
127
|
+
readonly principal: Principal;
|
|
128
|
+
readonly operation: WorkerError["operation"];
|
|
129
|
+
/** Report access follows native frozen-message proof and preserves the destination principal. */
|
|
130
|
+
readonly access: "context" | "read" | "send" | "control" | "report";
|
|
131
|
+
readonly worker?: WorkerRef;
|
|
132
|
+
/** Native-verified successful predecessor, never a caller-supplied authorization grant. */
|
|
133
|
+
readonly continuationOf?: WorkerContinuation;
|
|
134
|
+
}
|
|
135
|
+
export declare const WorkerHostAuthorizer: Context.Reference<{
|
|
136
|
+
readonly authorize: (request: WorkerHostAuthorizationRequest) => Effect.Effect<Principal, WorkerError>;
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* Deployment-owned permission to fund a root's background worker independently. The decision
|
|
140
|
+
* covers the exact immutable origin and is checked again before each input admission. It never
|
|
141
|
+
* changes delegation depth or Tool authority. Omission denies independent funding.
|
|
142
|
+
*/
|
|
143
|
+
export declare const WorkerBudgetAuthorizer: Context.Reference<{
|
|
144
|
+
readonly authorize: (request: {
|
|
145
|
+
readonly source: WorkerSource;
|
|
146
|
+
readonly admission?: WorkerStartAdmission;
|
|
147
|
+
readonly principal: Principal;
|
|
148
|
+
readonly worker: WorkerRef;
|
|
149
|
+
readonly continuationOf?: WorkerContinuation;
|
|
150
|
+
readonly policy: AgentPolicy;
|
|
151
|
+
readonly budget: SubagentBudgetReservation;
|
|
152
|
+
}) => Effect.Effect<void, WorkerError>;
|
|
153
|
+
}>;
|
|
154
|
+
//#endregion
|
|
155
|
+
export { WorkerHost_d_exports as t };
|
|
156
|
+
//# sourceMappingURL=WorkerHost.d.mts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { c as WorkerError } from "../Worker-CfwzMZEK.mjs";
|
|
3
|
+
import { Context, Effect, Option, Schema } from "effect";
|
|
4
|
+
//#region src/durable/WorkerHost.ts
|
|
5
|
+
var WorkerHost_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
WorkerBudgetAuthorizer: () => WorkerBudgetAuthorizer,
|
|
7
|
+
WorkerConcurrencyLimit: () => WorkerConcurrencyLimit,
|
|
8
|
+
WorkerConcurrencyResolver: () => WorkerConcurrencyResolver,
|
|
9
|
+
WorkerHostAuthorizer: () => WorkerHostAuthorizer,
|
|
10
|
+
WorkerHostConfig: () => WorkerHostConfig,
|
|
11
|
+
WorkerHostLimits: () => WorkerHostLimits,
|
|
12
|
+
WorkerPolicyResolver: () => WorkerPolicyResolver
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Opt-in host authority for policies captured in immutable application input. None preserves
|
|
16
|
+
* the registered Definition's existing policy/override semantics. Some is a complete policy,
|
|
17
|
+
* never merged with static overrides. Decode and authorize the exact captured revision; do not
|
|
18
|
+
* read mutable settings or substitute a current capture for missing historical authority.
|
|
19
|
+
* RetainedWorker may affirm only origin.policy, never replace a continuing worker's allowance.
|
|
20
|
+
* Return WorkerError(unavailable) for temporarily unavailable authority so delivery can retry.
|
|
21
|
+
* Implementations are acquired through Effect Layers; capture their dependencies in Layer R.
|
|
22
|
+
*/
|
|
23
|
+
const WorkerPolicyResolver = Context.Reference("@effect-agent/thread/WorkerPolicyResolver", { defaultValue: () => ({
|
|
24
|
+
resolveSource: () => Effect.succeed(Option.none()),
|
|
25
|
+
resolveTarget: () => Effect.succeed(Option.none())
|
|
26
|
+
}) });
|
|
27
|
+
const Positive = Schema.Int.check(Schema.isGreaterThan(0));
|
|
28
|
+
/** A host-authorized ceiling on active background workers, not retained workers or Run usage. */
|
|
29
|
+
const WorkerConcurrencyLimit = Schema.Struct({ maxActiveWorkersPerSource: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)) });
|
|
30
|
+
/**
|
|
31
|
+
* Optional source-aware operational authority. Resolution occurs inside every new source
|
|
32
|
+
* reservation attempt, against the same canonical history used for the append CAS. None
|
|
33
|
+
* preserves WorkerHostConfig; Some can only narrow it. The selected submission is exact,
|
|
34
|
+
* never the latest input. Implementations must authorize that immutable capture and retain
|
|
35
|
+
* construction dependencies in Layer R. Unavailable authority must return WorkerError(unavailable).
|
|
36
|
+
*
|
|
37
|
+
* One worker occupies a slot while any of its inputs remain unacknowledged. Steering an active
|
|
38
|
+
* worker does not acquire another slot. Decreases (including zero) do not cancel incumbents;
|
|
39
|
+
* an idle worker needs a slot again. Idempotent retained reservations do not reacquire slots.
|
|
40
|
+
*/
|
|
41
|
+
const WorkerConcurrencyResolver = Context.Reference("@effect-agent/thread/WorkerConcurrencyResolver", { defaultValue: () => ({ resolve: () => Effect.succeed(Option.none()) }) });
|
|
42
|
+
/** Host ceilings apply across all declarations owned by one source Thread. */
|
|
43
|
+
const WorkerHostLimits = Schema.Struct({
|
|
44
|
+
maxWorkersPerSource: Positive.check(Schema.isLessThanOrEqualTo(100)),
|
|
45
|
+
/** Active background workers across declarations; omission retains source Tool concurrency. */
|
|
46
|
+
maxActiveWorkersPerSource: Schema.optionalKey(Positive.check(Schema.isLessThanOrEqualTo(100))),
|
|
47
|
+
maxInputsPerWorker: Positive.check(Schema.isLessThanOrEqualTo(1e3)),
|
|
48
|
+
maxPendingInputsPerWorker: Positive.check(Schema.isLessThanOrEqualTo(100)),
|
|
49
|
+
maxUpdateInputsPerWorker: Schema.optionalKey(Positive.check(Schema.isLessThanOrEqualTo(1e3))),
|
|
50
|
+
maxPendingUpdateInputsPerWorker: Schema.optionalKey(Positive.check(Schema.isLessThanOrEqualTo(100))),
|
|
51
|
+
lifetimeMillis: Positive.check(Schema.isLessThanOrEqualTo(6048e5)),
|
|
52
|
+
/** Preparation may repeat after loss before its decision commits; keep callbacks side-effect free. */
|
|
53
|
+
reportPreparationTimeoutMillis: Schema.optionalKey(Positive.check(Schema.isLessThanOrEqualTo(3e4)))
|
|
54
|
+
});
|
|
55
|
+
const WorkerHostConfig = Context.Reference("@effect-agent/thread/WorkerHostConfig", { defaultValue: () => ({
|
|
56
|
+
maxWorkersPerSource: 32,
|
|
57
|
+
maxInputsPerWorker: 64,
|
|
58
|
+
maxPendingInputsPerWorker: 8,
|
|
59
|
+
lifetimeMillis: 864e5
|
|
60
|
+
}) });
|
|
61
|
+
const WorkerHostAuthorizer = Context.Reference("@effect-agent/thread/WorkerHostAuthorizer", { defaultValue: () => ({ authorize: (request) => WorkerError.make({
|
|
62
|
+
operation: request.operation,
|
|
63
|
+
reason: "denied"
|
|
64
|
+
}) }) });
|
|
65
|
+
/**
|
|
66
|
+
* Deployment-owned permission to fund a root's background worker independently. The decision
|
|
67
|
+
* covers the exact immutable origin and is checked again before each input admission. It never
|
|
68
|
+
* changes delegation depth or Tool authority. Omission denies independent funding.
|
|
69
|
+
*/
|
|
70
|
+
const WorkerBudgetAuthorizer = Context.Reference("@effect-agent/thread/WorkerBudgetAuthorizer", { defaultValue: () => ({ authorize: () => WorkerError.make({
|
|
71
|
+
operation: "start",
|
|
72
|
+
reason: "denied"
|
|
73
|
+
}) }) });
|
|
74
|
+
//#endregion
|
|
75
|
+
export { WorkerBudgetAuthorizer, WorkerConcurrencyLimit, WorkerConcurrencyResolver, WorkerHostAuthorizer, WorkerHostConfig, WorkerHostLimits, WorkerPolicyResolver, WorkerHost_exports as t };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=WorkerHost.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerHost.mjs","names":[],"sources":["../../src/durable/WorkerHost.ts"],"sourcesContent":["import { Context, Effect, Option, Schema } from \"effect\";\n\nimport type * as Agent from \"../core/Agent.ts\";\nimport type { AgentPolicy } from \"../core/AgentPolicy.ts\";\nimport type { AgentId, SubmissionId, ThreadId } from \"../core/Identifiers.ts\";\nimport type { SubagentBudgetReservation } from \"../core/SubagentContract.ts\";\nimport { WorkerError, type WorkerRef, type WorkerSource } from \"../core/Worker.ts\";\nimport type {\n CanonicalSequence,\n DefinitionDigests,\n Digest,\n PersistedJson,\n WorkerOrigin,\n WorkerContinuation,\n} from \"./Records.ts\";\nimport type { Principal, SubmissionSnapshot } from \"./SubmissionLedger.ts\";\n\n/**\n * One successful start authorization at an exact source tail. This host-created hint is\n * available only during that start's preparation and synchronous admission; it is never\n * persisted or transported. Hooks may reuse their admission decision, but must retain\n * current access checks at commit boundaries. A retry or changed tail gets no old grant.\n */\nexport interface WorkerStartAdmission {\n readonly sourceThreadId: ThreadId;\n readonly sourceSubmissionId?: SubmissionId;\n readonly requestedPrincipal: Principal;\n readonly principal: Principal;\n readonly targetAgentId: AgentId;\n readonly continuationOf?: WorkerContinuation;\n readonly access: \"send\";\n readonly tailSequence: CanonicalSequence;\n readonly tailDigest: Digest;\n}\n\n/** Host-verified source input; absence never means the latest input in the Thread. */\nexport interface WorkerPolicySource {\n readonly threadId: ThreadId;\n readonly definition: Agent.AnyDefinition;\n readonly definitions: DefinitionDigests;\n readonly submission?: SubmissionSnapshot;\n}\n\n/** Initial input is validated again at destination admission, including idempotent replay. */\nexport type WorkerPolicyTarget = {\n readonly definition: Agent.AnyDefinition;\n readonly definitions: DefinitionDigests;\n readonly source: WorkerSource;\n} & (\n | {\n readonly _tag: \"InitialInput\";\n readonly admission?: WorkerStartAdmission;\n readonly continuationOf?: WorkerContinuation;\n readonly sourceSubmission?: SubmissionSnapshot;\n readonly input: PersistedJson;\n readonly inputDigest: Digest;\n }\n | {\n readonly _tag: \"RetainedWorker\";\n /** Verified against canonical source history before this request reaches the resolver. */\n readonly origin: WorkerOrigin;\n }\n);\n\n/**\n * Opt-in host authority for policies captured in immutable application input. None preserves\n * the registered Definition's existing policy/override semantics. Some is a complete policy,\n * never merged with static overrides. Decode and authorize the exact captured revision; do not\n * read mutable settings or substitute a current capture for missing historical authority.\n * RetainedWorker may affirm only origin.policy, never replace a continuing worker's allowance.\n * Return WorkerError(unavailable) for temporarily unavailable authority so delivery can retry.\n * Implementations are acquired through Effect Layers; capture their dependencies in Layer R.\n */\nexport const WorkerPolicyResolver = Context.Reference<{\n readonly resolveSource: (\n request: WorkerPolicySource,\n ) => Effect.Effect<Option.Option<AgentPolicy>, WorkerError>;\n readonly resolveTarget: (\n request: WorkerPolicyTarget,\n ) => Effect.Effect<Option.Option<AgentPolicy>, WorkerError>;\n}>(\"@effect-agent/thread/WorkerPolicyResolver\", {\n defaultValue: () => ({\n resolveSource: () => Effect.succeed(Option.none()),\n resolveTarget: () => Effect.succeed(Option.none()),\n }),\n});\n\nconst Positive = Schema.Int.check(Schema.isGreaterThan(0));\n\n/** A host-authorized ceiling on active background workers, not retained workers or Run usage. */\nexport const WorkerConcurrencyLimit = Schema.Struct({\n maxActiveWorkersPerSource: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n});\n\nexport type WorkerConcurrencyLimit = typeof WorkerConcurrencyLimit.Type;\n\n/**\n * Optional source-aware operational authority. Resolution occurs inside every new source\n * reservation attempt, against the same canonical history used for the append CAS. None\n * preserves WorkerHostConfig; Some can only narrow it. The selected submission is exact,\n * never the latest input. Implementations must authorize that immutable capture and retain\n * construction dependencies in Layer R. Unavailable authority must return WorkerError(unavailable).\n *\n * One worker occupies a slot while any of its inputs remain unacknowledged. Steering an active\n * worker does not acquire another slot. Decreases (including zero) do not cancel incumbents;\n * an idle worker needs a slot again. Idempotent retained reservations do not reacquire slots.\n */\nexport const WorkerConcurrencyResolver = Context.Reference<{\n readonly resolve: (request: {\n readonly source: WorkerSource;\n readonly sourceSubmission?: SubmissionSnapshot;\n readonly worker: WorkerRef;\n readonly continuationOf?: WorkerContinuation;\n readonly principal: Principal;\n }) => Effect.Effect<Option.Option<WorkerConcurrencyLimit>, WorkerError>;\n}>(\"@effect-agent/thread/WorkerConcurrencyResolver\", {\n defaultValue: () => ({ resolve: () => Effect.succeed(Option.none()) }),\n});\n\n/** Host ceilings apply across all declarations owned by one source Thread. */\nexport const WorkerHostLimits = Schema.Struct({\n maxWorkersPerSource: Positive.check(Schema.isLessThanOrEqualTo(100)),\n /** Active background workers across declarations; omission retains source Tool concurrency. */\n maxActiveWorkersPerSource: Schema.optionalKey(Positive.check(Schema.isLessThanOrEqualTo(100))),\n maxInputsPerWorker: Positive.check(Schema.isLessThanOrEqualTo(1_000)),\n maxPendingInputsPerWorker: Positive.check(Schema.isLessThanOrEqualTo(100)),\n maxUpdateInputsPerWorker: Schema.optionalKey(Positive.check(Schema.isLessThanOrEqualTo(1_000))),\n maxPendingUpdateInputsPerWorker: Schema.optionalKey(\n Positive.check(Schema.isLessThanOrEqualTo(100)),\n ),\n lifetimeMillis: Positive.check(Schema.isLessThanOrEqualTo(604_800_000)),\n /** Preparation may repeat after loss before its decision commits; keep callbacks side-effect free. */\n reportPreparationTimeoutMillis: Schema.optionalKey(\n Positive.check(Schema.isLessThanOrEqualTo(30_000)),\n ),\n});\n\nexport type WorkerHostLimits = typeof WorkerHostLimits.Type;\n\nexport const WorkerHostConfig = Context.Reference<WorkerHostLimits>(\n \"@effect-agent/thread/WorkerHostConfig\",\n {\n defaultValue: () => ({\n maxWorkersPerSource: 32,\n maxInputsPerWorker: 64,\n maxPendingInputsPerWorker: 8,\n lifetimeMillis: 86_400_000,\n }),\n },\n);\n\n/**\n * Authenticate every acquisition/operation and authorize its exact source Thread. A returned\n * Principal is host-owned admission identity. Context access authenticates source metadata;\n * read, send and control remain separate grants. WorkerRefs and caller-supplied Thread\n * identifiers alone never confer any of them.\n */\nexport interface WorkerHostAuthorizationRequest {\n readonly admission?: WorkerStartAdmission;\n readonly sourceThreadId: ThreadId;\n /** An explicitly selected owner input; authorize this locator as well as the Thread. */\n readonly sourceSubmissionId?: SubmissionId;\n readonly principal: Principal;\n readonly operation: WorkerError[\"operation\"];\n /** Report access follows native frozen-message proof and preserves the destination principal. */\n readonly access: \"context\" | \"read\" | \"send\" | \"control\" | \"report\";\n readonly worker?: WorkerRef;\n /** Native-verified successful predecessor, never a caller-supplied authorization grant. */\n readonly continuationOf?: WorkerContinuation;\n}\n\nexport const WorkerHostAuthorizer = Context.Reference<{\n readonly authorize: (\n request: WorkerHostAuthorizationRequest,\n ) => Effect.Effect<Principal, WorkerError>;\n}>(\"@effect-agent/thread/WorkerHostAuthorizer\", {\n defaultValue: () => ({\n authorize: (request) =>\n WorkerError.make({\n operation: request.operation,\n reason: \"denied\",\n }),\n }),\n});\n\n/**\n * Deployment-owned permission to fund a root's background worker independently. The decision\n * covers the exact immutable origin and is checked again before each input admission. It never\n * changes delegation depth or Tool authority. Omission denies independent funding.\n */\nexport const WorkerBudgetAuthorizer = Context.Reference<{\n readonly authorize: (request: {\n readonly source: WorkerSource;\n readonly admission?: WorkerStartAdmission;\n readonly principal: Principal;\n readonly worker: WorkerRef;\n readonly continuationOf?: WorkerContinuation;\n readonly policy: AgentPolicy;\n readonly budget: SubagentBudgetReservation;\n }) => Effect.Effect<void, WorkerError>;\n}>(\"@effect-agent/thread/WorkerBudgetAuthorizer\", {\n defaultValue: () => ({\n authorize: () => WorkerError.make({ operation: \"start\", reason: \"denied\" }),\n }),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyEA,MAAa,uBAAuB,QAAQ,UAOzC,6CAA6C,EAC9C,qBAAqB;CACnB,qBAAqB,OAAO,QAAQ,OAAO,KAAK,CAAC;CACjD,qBAAqB,OAAO,QAAQ,OAAO,KAAK,CAAC;AACnD,GACF,CAAC;AAED,MAAM,WAAW,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;;AAGzD,MAAa,yBAAyB,OAAO,OAAO,EAClD,2BAA2B,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC,EAC9E,CAAC;;;;;;;;;;;;AAeD,MAAa,4BAA4B,QAAQ,UAQ9C,kDAAkD,EACnD,qBAAqB,EAAE,eAAe,OAAO,QAAQ,OAAO,KAAK,CAAC,EAAE,GACtE,CAAC;;AAGD,MAAa,mBAAmB,OAAO,OAAO;CAC5C,qBAAqB,SAAS,MAAM,OAAO,oBAAoB,GAAG,CAAC;;CAEnE,2BAA2B,OAAO,YAAY,SAAS,MAAM,OAAO,oBAAoB,GAAG,CAAC,CAAC;CAC7F,oBAAoB,SAAS,MAAM,OAAO,oBAAoB,GAAK,CAAC;CACpE,2BAA2B,SAAS,MAAM,OAAO,oBAAoB,GAAG,CAAC;CACzE,0BAA0B,OAAO,YAAY,SAAS,MAAM,OAAO,oBAAoB,GAAK,CAAC,CAAC;CAC9F,iCAAiC,OAAO,YACtC,SAAS,MAAM,OAAO,oBAAoB,GAAG,CAAC,CAChD;CACA,gBAAgB,SAAS,MAAM,OAAO,oBAAoB,MAAW,CAAC;;CAEtE,gCAAgC,OAAO,YACrC,SAAS,MAAM,OAAO,oBAAoB,GAAM,CAAC,CACnD;AACF,CAAC;AAID,MAAa,mBAAmB,QAAQ,UACtC,yCACA,EACE,qBAAqB;CACnB,qBAAqB;CACrB,oBAAoB;CACpB,2BAA2B;CAC3B,gBAAgB;AAClB,GACF,CACF;AAsBA,MAAa,uBAAuB,QAAQ,UAIzC,6CAA6C,EAC9C,qBAAqB,EACnB,YAAY,YACV,YAAY,KAAK;CACf,WAAW,QAAQ;CACnB,QAAQ;AACV,CAAC,EACL,GACF,CAAC;;;;;;AAOD,MAAa,yBAAyB,QAAQ,UAU3C,+CAA+C,EAChD,qBAAqB,EACnB,iBAAiB,YAAY,KAAK;CAAE,WAAW;CAAS,QAAQ;AAAS,CAAC,EAC5E,GACF,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as start, C as decodeFinalOutput, D as renderInputPrompt, E as projectCompletionOutput, F as withTerminalDefectEvent, M as stream, N as streamUnknown, O as run, P as streamWithUsageAccountingUnknown, S as ToolCallWaiting, T as projectCompletionFromToolOutput, _ as SubagentDurability, a as AgentResultSchema, b as SubagentDurabilityError, c as AgentSpawner, d as DetachedRun, f as EngineProvidedToolServices, g as SpawnedChildRun, h as SpawnRunOptions, i as AgentResult, j as startUnknown, k as runUnknown, l as AgentSpawnerParent, m as SpawnDelegation, n as AgentChildPending, o as AgentRuntimeFailure, p as RuntimeBinding, r as AgentCompletionProjectionRequirements, s as AgentRuntimeRequirements, u as AgentSpawnerService, v as SubagentDurabilityDurable, w as encodeRunDisposition, x as SubagentDurabilityService, y as SubagentDurabilityEphemeral } from "../AgentRuntime-sXpKcyxu.mjs";
|
|
2
|
+
export { AgentChildPending, type AgentCompletionProjectionRequirements, type AgentResult, AgentResultSchema, type AgentRuntimeFailure, type AgentRuntimeRequirements, AgentSpawner, type AgentSpawnerParent, type AgentSpawnerService, type DetachedRun, type EngineProvidedToolServices, type RuntimeBinding, type SpawnDelegation, type SpawnRunOptions, type SpawnedChildRun, SubagentDurability, type SubagentDurabilityDurable, type SubagentDurabilityEphemeral, SubagentDurabilityError, type SubagentDurabilityService, ToolCallWaiting, decodeFinalOutput, encodeRunDisposition, projectCompletionFromToolOutput, projectCompletionOutput, renderInputPrompt, run, runUnknown, start, startUnknown, stream, streamUnknown, streamWithUsageAccountingUnknown, withTerminalDefectEvent };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as stream, a as SubagentDurability, b as withTerminalDefectEvent, c as decodeFinalOutput, d as projectCompletionOutput, f as renderInputPrompt, g as startUnknown, h as start, i as AgentSpawner, l as encodeRunDisposition, m as runUnknown, n as AgentChildPending, o as SubagentDurabilityError, p as run, r as AgentResultSchema, s as ToolCallWaiting, u as projectCompletionFromToolOutput, v as streamUnknown, y as streamWithUsageAccountingUnknown } from "../AgentRuntime-D8U9gl9Q.mjs";
|
|
2
|
+
export { AgentChildPending, AgentResultSchema, AgentSpawner, SubagentDurability, SubagentDurabilityError, ToolCallWaiting, decodeFinalOutput, encodeRunDisposition, projectCompletionFromToolOutput, projectCompletionOutput, renderInputPrompt, run, runUnknown, start, startUnknown, stream, streamUnknown, streamWithUsageAccountingUnknown, withTerminalDefectEvent };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { d as CONTEXT_ROLLOVER_PREFIX, f as ContextCompactionState, g as estimatePromptTokens, h as estimateMessageTokens, l as CLEARED_TOOL_RESULT, m as contextWindowMessage, p as contextWindowId, u as COMPACTION_SUMMARY_PREFIX } from "../ContextCompactor-WwSIG_Z2.mjs";
|
|
2
|
+
declare namespace Compaction_d_exports {
|
|
3
|
+
export { CLEARED_TOOL_RESULT, COMPACTION_SUMMARY_PREFIX, CONTEXT_ROLLOVER_PREFIX, ContextCompactionState, contextWindowId, contextWindowMessage, estimateMessageTokens, estimatePromptTokens };
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { CLEARED_TOOL_RESULT, COMPACTION_SUMMARY_PREFIX, CONTEXT_ROLLOVER_PREFIX, type ContextCompactionState, contextWindowId, contextWindowMessage, estimateMessageTokens, estimatePromptTokens, Compaction_d_exports as t };
|
|
7
|
+
//# sourceMappingURL=Compaction.d.mts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { f as contextWindowId, h as estimatePromptTokens, m as estimateMessageTokens, n as COMPACTION_SUMMARY_PREFIX, p as contextWindowMessage, r as CONTEXT_ROLLOVER_PREFIX, t as CLEARED_TOOL_RESULT } from "../compaction-C2OTceKw.mjs";
|
|
3
|
+
//#region src/engine/Compaction.ts
|
|
4
|
+
var Compaction_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
CLEARED_TOOL_RESULT: () => CLEARED_TOOL_RESULT,
|
|
6
|
+
COMPACTION_SUMMARY_PREFIX: () => COMPACTION_SUMMARY_PREFIX,
|
|
7
|
+
CONTEXT_ROLLOVER_PREFIX: () => CONTEXT_ROLLOVER_PREFIX,
|
|
8
|
+
contextWindowId: () => contextWindowId,
|
|
9
|
+
contextWindowMessage: () => contextWindowMessage,
|
|
10
|
+
estimateMessageTokens: () => estimateMessageTokens,
|
|
11
|
+
estimatePromptTokens: () => estimatePromptTokens
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { CLEARED_TOOL_RESULT, COMPACTION_SUMMARY_PREFIX, CONTEXT_ROLLOVER_PREFIX, contextWindowId, contextWindowMessage, estimateMessageTokens, estimatePromptTokens, Compaction_exports as t };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=Compaction.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Compaction.mjs","names":[],"sources":["../../src/engine/Compaction.ts"],"sourcesContent":["/** Public Compaction API. Implementation helpers remain private. */\nexport {\n CLEARED_TOOL_RESULT,\n COMPACTION_SUMMARY_PREFIX,\n CONTEXT_ROLLOVER_PREFIX,\n contextWindowId,\n contextWindowMessage,\n estimateMessageTokens,\n estimatePromptTokens,\n type ContextCompactionState,\n} from \"./internal/compaction.ts\";\n"],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ContextCompaction, c as ContextMessageTokenEstimator, i as CompactionRequest, n as CompactionError, o as ContextCompactor, r as CompactionModelLayer, t as CompactionDecision } from "../ContextCompactor-WwSIG_Z2.mjs";
|
|
2
|
+
export { CompactionDecision, CompactionError, CompactionModelLayer, CompactionRequest, ContextCompaction, ContextCompactor, ContextMessageTokenEstimator };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { a as SUMMARY_REQUEST_PREFIX, c as buildRolloverHandoff, d as collectCoveredMessages, g as evaluateMessageTokenEstimates, h as estimatePromptTokens, i as SUMMARY_MAX_LENGTH, l as choosePruneBound, o as SUMMARY_REQUEST_SUFFIX, s as buildCompactedView, u as chooseSummarizeCut, y as renderForSummary } from "../compaction-C2OTceKw.mjs";
|
|
3
|
+
import { ContextHandoff } from "./ContextWindow.mjs";
|
|
4
|
+
import { Prompt } from "effect/unstable/ai";
|
|
5
|
+
import { Context, Effect, Layer, Option, Schema, Stream } from "effect";
|
|
6
|
+
//#region src/engine/ContextCompactor.ts
|
|
7
|
+
var ContextCompactor_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
CompactionDecision: () => CompactionDecision,
|
|
9
|
+
CompactionError: () => CompactionError,
|
|
10
|
+
ContextCompactor: () => ContextCompactor
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* A proposed view change. Source indices are exclusive prefix bounds, never record sequences.
|
|
14
|
+
* Summaries contain at most 65,536 characters; the interpreter rejects oversized decisions
|
|
15
|
+
* before committing or changing coverage.
|
|
16
|
+
*/
|
|
17
|
+
const CompactionDecision = Schema.Union([
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
kind: Schema.Literal("rollover"),
|
|
20
|
+
through: Schema.Natural,
|
|
21
|
+
handoff: Schema.optionalKey(ContextHandoff)
|
|
22
|
+
}),
|
|
23
|
+
Schema.Struct({
|
|
24
|
+
kind: Schema.Literal("clear-tool-results"),
|
|
25
|
+
through: Schema.Natural
|
|
26
|
+
}),
|
|
27
|
+
Schema.Struct({
|
|
28
|
+
kind: Schema.Literal("summarize"),
|
|
29
|
+
through: Schema.Natural,
|
|
30
|
+
summary: Schema.NonEmptyString.check(Schema.isMaxLength(SUMMARY_MAX_LENGTH), Schema.isPattern(/\S/))
|
|
31
|
+
})
|
|
32
|
+
]);
|
|
33
|
+
/** Expected strategy or decision-validation failure. Causes stay in the live Effect only. */
|
|
34
|
+
var CompactionError = class extends Schema.TaggedError()("CompactionError", {
|
|
35
|
+
message: Schema.String.check(Schema.isMaxLength(4096)),
|
|
36
|
+
cause: Schema.optionalKey(Schema.Defect())
|
|
37
|
+
}) {};
|
|
38
|
+
const evaluateEstimates = (override, operation) => Effect.suspend(() => {
|
|
39
|
+
const result = evaluateMessageTokenEstimates(override, operation);
|
|
40
|
+
return Option.isSome(result) ? Effect.succeed(result.value) : CompactionError.make({ message: "Message token estimator returned an invalid token count" });
|
|
41
|
+
});
|
|
42
|
+
const defaultCompactor = (model) => ({
|
|
43
|
+
estimate: estimatePromptTokens,
|
|
44
|
+
compact: (request) => Stream.unwrap(Effect.gen(function* () {
|
|
45
|
+
const { source, policy, targetTokens, trigger, modelCallAllowed } = request;
|
|
46
|
+
if (request.requested !== void 0) return Stream.succeed({
|
|
47
|
+
kind: "rollover",
|
|
48
|
+
...request.requested
|
|
49
|
+
});
|
|
50
|
+
const forceSummarize = trigger === "overflow";
|
|
51
|
+
const state = { ...request.state };
|
|
52
|
+
const keepRecentTokens = targetTokens === void 0 ? policy.keepRecentTokens : Math.max(1, Math.min(policy.keepRecentTokens, targetTokens));
|
|
53
|
+
const decisions = [];
|
|
54
|
+
if (!forceSummarize && policy.mode !== "summarize") {
|
|
55
|
+
const through = yield* evaluateEstimates(request.estimateMessageTokens, (estimate) => choosePruneBound(source.content, state, keepRecentTokens, targetTokens, estimate));
|
|
56
|
+
if (through > state.clearedThrough) {
|
|
57
|
+
state.clearedThrough = through;
|
|
58
|
+
decisions.push({
|
|
59
|
+
kind: "clear-tool-results",
|
|
60
|
+
through
|
|
61
|
+
});
|
|
62
|
+
if (targetTokens !== void 0 && (yield* evaluateEstimates(request.estimateMessageTokens, (estimate) => estimatePromptTokens(buildCompactedView(source.content, state), estimate))) <= targetTokens) return Stream.fromIterable(decisions);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const prune = Stream.fromIterable(decisions);
|
|
66
|
+
if ((!modelCallAllowed || policy.mode === "prune") && !forceSummarize) return prune;
|
|
67
|
+
return prune.pipe(Stream.concat(Stream.unwrap(Effect.gen(function* () {
|
|
68
|
+
const through = yield* evaluateEstimates(request.estimateMessageTokens, (estimate) => chooseSummarizeCut(source.content, state, keepRecentTokens, estimate));
|
|
69
|
+
const covered = collectCoveredMessages(source.content, state, through);
|
|
70
|
+
if (covered.length === 0) return Stream.empty;
|
|
71
|
+
const transcript = renderForSummary(covered, state.replacement?.kind === "summarize" ? state.replacement.summary : state.replacement?.handoff);
|
|
72
|
+
if (transcript === void 0) return yield* CompactionError.make({ message: `Previous compaction summary exceeds ${SUMMARY_MAX_LENGTH} characters` });
|
|
73
|
+
const prompt = Prompt.fromMessages([Prompt.userMessage({ content: [Prompt.textPart({ text: `${SUMMARY_REQUEST_PREFIX}${transcript}${SUMMARY_REQUEST_SUFFIX}` })] })]);
|
|
74
|
+
const text = yield* request.summarize(prompt, model);
|
|
75
|
+
return Stream.succeed({
|
|
76
|
+
kind: "summarize",
|
|
77
|
+
through,
|
|
78
|
+
summary: text.trim()
|
|
79
|
+
});
|
|
80
|
+
}))));
|
|
81
|
+
}))
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* The sole interpreter compaction port. Runs without an installed service provide layer at their
|
|
85
|
+
* composition boundary. Decorators yield this service during construction and receive their
|
|
86
|
+
* underlying implementation through Layer.provide. Direct harnesses use the same Layer contract.
|
|
87
|
+
*/
|
|
88
|
+
var ContextCompactor = class ContextCompactor extends Context.Service()("@effect-agent/engine/ContextCompactor") {
|
|
89
|
+
static layer = Layer.succeed(ContextCompactor, defaultCompactor());
|
|
90
|
+
/**
|
|
91
|
+
* Start fresh windows without a summarizer call. The engine retains instructions/input and
|
|
92
|
+
* commits each boundary; a bounded emergency handoff preserves user inputs and unseen results.
|
|
93
|
+
* Applications provide notes/history tools alongside this strategy.
|
|
94
|
+
*/
|
|
95
|
+
static layerRollover = Layer.succeed(ContextCompactor, {
|
|
96
|
+
estimate: estimatePromptTokens,
|
|
97
|
+
compact: (request) => Stream.unwrap(Effect.gen(function* () {
|
|
98
|
+
if (request.requested !== void 0) return Stream.succeed({
|
|
99
|
+
kind: "rollover",
|
|
100
|
+
...request.requested
|
|
101
|
+
});
|
|
102
|
+
const through = request.source.content.findLastIndex((message) => message.role === "assistant" || message.role === "tool") + 1;
|
|
103
|
+
if (collectCoveredMessages(request.source.content, request.state, through).length === 0) return Stream.empty;
|
|
104
|
+
const handoff = yield* evaluateEstimates(request.estimateMessageTokens, (estimate) => buildRolloverHandoff(request.source.content, request.state, request.targetTokens, through, estimate));
|
|
105
|
+
if (handoff === void 0) return Stream.fail(CompactionError.make({ message: "Insufficient context capacity for an automatic rollover handoff" }));
|
|
106
|
+
return Stream.succeed({
|
|
107
|
+
kind: "rollover",
|
|
108
|
+
through,
|
|
109
|
+
handoff
|
|
110
|
+
});
|
|
111
|
+
}))
|
|
112
|
+
});
|
|
113
|
+
/** Use the bounded default algorithm with a separate upstream Effect AI Model. */
|
|
114
|
+
static layerWithModel = (model) => Layer.effect(ContextCompactor, Effect.map(model.captureRequirements, (captured) => defaultCompactor(captured)));
|
|
115
|
+
};
|
|
116
|
+
//#endregion
|
|
117
|
+
export { CompactionDecision, CompactionError, ContextCompactor, ContextCompactor_exports as t };
|
|
118
|
+
|
|
119
|
+
//# sourceMappingURL=ContextCompactor.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextCompactor.mjs","names":[],"sources":["../../src/engine/ContextCompactor.ts"],"sourcesContent":["import { Context, Effect, Layer, Option, Schema, Stream } from \"effect\";\nimport { type LanguageModel, type Model, Prompt } from \"effect/unstable/ai\";\n\nimport { type CompactionPolicy } from \"../core/AgentPolicy.ts\";\nimport { type RunId, type ThreadId } from \"../core/Identifiers.ts\";\nimport { ContextHandoff, type ContextRolloverRequest } from \"./ContextWindow.ts\";\nimport {\n buildCompactedView,\n buildRolloverHandoff,\n choosePruneBound,\n chooseSummarizeCut,\n collectCoveredMessages,\n estimatePromptTokens,\n evaluateMessageTokenEstimates,\n renderForSummary,\n SUMMARY_MAX_LENGTH,\n SUMMARY_REQUEST_PREFIX,\n SUMMARY_REQUEST_SUFFIX,\n type ContextCompactionState,\n} from \"./internal/compaction.ts\";\n\n/**\n * A proposed view change. Source indices are exclusive prefix bounds, never record sequences.\n * Summaries contain at most 65,536 characters; the interpreter rejects oversized decisions\n * before committing or changing coverage.\n */\nexport const CompactionDecision = Schema.Union([\n Schema.Struct({\n kind: Schema.Literal(\"rollover\"),\n through: Schema.Natural,\n handoff: Schema.optionalKey(ContextHandoff),\n }),\n Schema.Struct({ kind: Schema.Literal(\"clear-tool-results\"), through: Schema.Natural }),\n Schema.Struct({\n kind: Schema.Literal(\"summarize\"),\n through: Schema.Natural,\n summary: Schema.NonEmptyString.check(\n Schema.isMaxLength(SUMMARY_MAX_LENGTH),\n Schema.isPattern(/\\S/),\n ),\n }),\n]);\n\nexport type CompactionDecision = typeof CompactionDecision.Type;\n\n/** Expected strategy or decision-validation failure. Causes stay in the live Effect only. */\nexport class CompactionError extends Schema.TaggedError<CompactionError>()(\"CompactionError\", {\n message: Schema.String.check(Schema.isMaxLength(4_096)),\n cause: Schema.optionalKey(Schema.Defect()),\n}) {}\n\n/** Upstream Model.captureRequirements returns this closed Layer. */\nexport type CompactionModelLayer = Layer.Layer<\n LanguageModel.LanguageModel | Model.ProviderName | Model.ModelName\n>;\n\n/** A full message estimate, or undefined to use the native structural estimate. */\nexport type ContextMessageTokenEstimator = (message: Prompt.Message) => number | undefined;\n\n/**\n * One bounded pass over an immutable source snapshot. A harness owns state, metering, and\n * application of decisions. The interpreter permits at most one prune followed by one replacement\n * (summary or rollover), and one call to summarize per Turn, shared across every trigger.\n * All model work must use summarize so it is metered.\n * Callback failures and requirements pass through unchanged; strategy dependencies belong to\n * its construction Layer. Protected messages cannot be removed and Tool pairs cannot be split by a decision.\n */\nexport interface CompactionRequest<E, R> {\n readonly threadId: ThreadId;\n readonly runId: RunId;\n readonly turn: number;\n readonly source: Prompt.Prompt;\n readonly state: Readonly<ContextCompactionState>;\n readonly policy: CompactionPolicy;\n readonly targetTokens: number | undefined;\n readonly trigger: \"pressure\" | \"overflow\" | \"requested\";\n /** Budget admission may prohibit a separate model call while still allowing a rollover. */\n readonly modelCallAllowed: boolean;\n /** The current captured Model's message accounting, including native fallback. */\n readonly estimateMessageTokens?: ContextMessageTokenEstimator | undefined;\n /** Present for a successful, singleton context rollover Tool; through excludes later steering. */\n readonly requested?: (ContextRolloverRequest & { readonly through: number }) | undefined;\n readonly summarize: (\n prompt: Prompt.Prompt,\n model?: CompactionModelLayer,\n ) => Effect.Effect<string, E, R>;\n}\n\nexport interface ContextCompaction {\n /** Non-negative finite integer estimate, used for admission and derived prompt overhead too. */\n readonly estimate: (messages: ReadonlyArray<Prompt.Message>) => number;\n /** Emit decisions sequentially; the consumer commits each before pulling the next. */\n readonly compact: <E, R>(\n request: CompactionRequest<E, R>,\n ) => Stream.Stream<CompactionDecision, E | CompactionError, R>;\n}\n\nconst evaluateEstimates = <A>(\n override: ContextMessageTokenEstimator | undefined,\n operation: (estimate: (message: Prompt.Message) => number) => A,\n): Effect.Effect<A, CompactionError> =>\n Effect.suspend(() => {\n const result = evaluateMessageTokenEstimates(override, operation);\n\n return Option.isSome(result)\n ? Effect.succeed(result.value)\n : CompactionError.make({\n message: \"Message token estimator returned an invalid token count\",\n });\n });\n\nconst defaultCompactor = (model?: CompactionModelLayer): ContextCompaction => ({\n estimate: estimatePromptTokens,\n compact: <E, R>(request: CompactionRequest<E, R>) =>\n Stream.unwrap(\n Effect.gen(function* () {\n const { source, policy, targetTokens, trigger, modelCallAllowed } = request;\n\n if (request.requested !== undefined) {\n return Stream.succeed({ kind: \"rollover\", ...request.requested });\n }\n const forceSummarize = trigger === \"overflow\";\n const state = { ...request.state };\n\n const keepRecentTokens =\n targetTokens === undefined\n ? policy.keepRecentTokens\n : Math.max(1, Math.min(policy.keepRecentTokens, targetTokens));\n\n const decisions: Array<CompactionDecision> = [];\n\n if (!forceSummarize && policy.mode !== \"summarize\") {\n const through = yield* evaluateEstimates(request.estimateMessageTokens, (estimate) =>\n choosePruneBound(source.content, state, keepRecentTokens, targetTokens, estimate),\n );\n\n if (through > state.clearedThrough) {\n state.clearedThrough = through;\n decisions.push({ kind: \"clear-tool-results\", through });\n if (\n targetTokens !== undefined &&\n (yield* evaluateEstimates(request.estimateMessageTokens, (estimate) =>\n estimatePromptTokens(buildCompactedView(source.content, state), estimate),\n )) <= targetTokens\n ) {\n return Stream.fromIterable(decisions);\n }\n }\n }\n const prune = Stream.fromIterable(decisions);\n\n if ((!modelCallAllowed || policy.mode === \"prune\") && !forceSummarize) return prune;\n\n return prune.pipe(\n Stream.concat(\n Stream.unwrap(\n Effect.gen(function* () {\n const through = yield* evaluateEstimates(\n request.estimateMessageTokens,\n (estimate) =>\n chooseSummarizeCut(source.content, state, keepRecentTokens, estimate),\n );\n\n const covered = collectCoveredMessages(source.content, state, through);\n\n if (covered.length === 0) return Stream.empty;\n\n const transcript = renderForSummary(\n covered,\n state.replacement?.kind === \"summarize\"\n ? state.replacement.summary\n : state.replacement?.handoff,\n );\n\n if (transcript === undefined) {\n return yield* CompactionError.make({\n message: `Previous compaction summary exceeds ${SUMMARY_MAX_LENGTH} characters`,\n });\n }\n\n const prompt = Prompt.fromMessages([\n Prompt.userMessage({\n content: [\n Prompt.textPart({\n text: `${SUMMARY_REQUEST_PREFIX}${transcript}${SUMMARY_REQUEST_SUFFIX}`,\n }),\n ],\n }),\n ]);\n\n const text = yield* request.summarize(prompt, model);\n\n return Stream.succeed({\n kind: \"summarize\",\n through,\n summary: text.trim(),\n } satisfies CompactionDecision);\n }),\n ),\n ),\n );\n }),\n ),\n});\n\n/**\n * The sole interpreter compaction port. Runs without an installed service provide layer at their\n * composition boundary. Decorators yield this service during construction and receive their\n * underlying implementation through Layer.provide. Direct harnesses use the same Layer contract.\n */\nexport class ContextCompactor extends Context.Service<ContextCompactor, ContextCompaction>()(\n \"@effect-agent/engine/ContextCompactor\",\n) {\n static readonly layer = Layer.succeed(ContextCompactor, defaultCompactor());\n\n /**\n * Start fresh windows without a summarizer call. The engine retains instructions/input and\n * commits each boundary; a bounded emergency handoff preserves user inputs and unseen results.\n * Applications provide notes/history tools alongside this strategy.\n */\n static readonly layerRollover = Layer.succeed(ContextCompactor, {\n estimate: estimatePromptTokens,\n compact: <E, R>(request: CompactionRequest<E, R>) =>\n Stream.unwrap(\n Effect.gen(function* () {\n if (request.requested !== undefined) {\n return Stream.succeed({\n kind: \"rollover\",\n ...request.requested,\n } satisfies CompactionDecision);\n }\n\n // Trailing user steering may not be canonical until the next response. Keep it verbatim.\n const through =\n request.source.content.findLastIndex(\n (message) => message.role === \"assistant\" || message.role === \"tool\",\n ) + 1;\n\n if (collectCoveredMessages(request.source.content, request.state, through).length === 0) {\n return Stream.empty;\n }\n\n const handoff = yield* evaluateEstimates(request.estimateMessageTokens, (estimate) =>\n buildRolloverHandoff(\n request.source.content,\n request.state,\n request.targetTokens,\n through,\n estimate,\n ),\n );\n\n if (handoff === undefined)\n return Stream.fail(\n CompactionError.make({\n message: \"Insufficient context capacity for an automatic rollover handoff\",\n }),\n );\n\n return Stream.succeed({\n kind: \"rollover\",\n through,\n handoff,\n } satisfies CompactionDecision);\n }),\n ),\n });\n\n /** Use the bounded default algorithm with a separate upstream Effect AI Model. */\n static readonly layerWithModel = <Provider, Requirements>(\n model: Model.Model<Provider, LanguageModel.LanguageModel, Requirements>,\n ): Layer.Layer<ContextCompactor, never, Requirements> =>\n Layer.effect(\n ContextCompactor,\n Effect.map(model.captureRequirements, (captured) => defaultCompactor(captured)),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0BA,MAAa,qBAAqB,OAAO,MAAM;CAC7C,OAAO,OAAO;EACZ,MAAM,OAAO,QAAQ,UAAU;EAC/B,SAAS,OAAO;EAChB,SAAS,OAAO,YAAY,cAAc;CAC5C,CAAC;CACD,OAAO,OAAO;EAAE,MAAM,OAAO,QAAQ,oBAAoB;EAAG,SAAS,OAAO;CAAQ,CAAC;CACrF,OAAO,OAAO;EACZ,MAAM,OAAO,QAAQ,WAAW;EAChC,SAAS,OAAO;EAChB,SAAS,OAAO,eAAe,MAC7B,OAAO,YAAY,kBAAkB,GACrC,OAAO,UAAU,IAAI,CACvB;CACF,CAAC;AACH,CAAC;;AAKD,IAAa,kBAAb,cAAqC,OAAO,YAA6B,CAAC,CAAC,mBAAmB;CAC5F,SAAS,OAAO,OAAO,MAAM,OAAO,YAAY,IAAK,CAAC;CACtD,OAAO,OAAO,YAAY,OAAO,OAAO,CAAC;AAC3C,CAAC,CAAC,CAAC,CAAC;AAgDJ,MAAM,qBACJ,UACA,cAEA,OAAO,cAAc;CACnB,MAAM,SAAS,8BAA8B,UAAU,SAAS;CAEhE,OAAO,OAAO,OAAO,MAAM,IACvB,OAAO,QAAQ,OAAO,KAAK,IAC3B,gBAAgB,KAAK,EACnB,SAAS,0DACX,CAAC;AACP,CAAC;AAEH,MAAM,oBAAoB,WAAqD;CAC7E,UAAU;CACV,UAAgB,YACd,OAAO,OACL,OAAO,IAAI,aAAa;EACtB,MAAM,EAAE,QAAQ,QAAQ,cAAc,SAAS,qBAAqB;EAEpE,IAAI,QAAQ,cAAc,KAAA,GACxB,OAAO,OAAO,QAAQ;GAAE,MAAM;GAAY,GAAG,QAAQ;EAAU,CAAC;EAElE,MAAM,iBAAiB,YAAY;EACnC,MAAM,QAAQ,EAAE,GAAG,QAAQ,MAAM;EAEjC,MAAM,mBACJ,iBAAiB,KAAA,IACb,OAAO,mBACP,KAAK,IAAI,GAAG,KAAK,IAAI,OAAO,kBAAkB,YAAY,CAAC;EAEjE,MAAM,YAAuC,CAAC;EAE9C,IAAI,CAAC,kBAAkB,OAAO,SAAS,aAAa;GAClD,MAAM,UAAU,OAAO,kBAAkB,QAAQ,wBAAwB,aACvE,iBAAiB,OAAO,SAAS,OAAO,kBAAkB,cAAc,QAAQ,CAClF;GAEA,IAAI,UAAU,MAAM,gBAAgB;IAClC,MAAM,iBAAiB;IACvB,UAAU,KAAK;KAAE,MAAM;KAAsB;IAAQ,CAAC;IACtD,IACE,iBAAiB,KAAA,MAChB,OAAO,kBAAkB,QAAQ,wBAAwB,aACxD,qBAAqB,mBAAmB,OAAO,SAAS,KAAK,GAAG,QAAQ,CAC1E,MAAM,cAEN,OAAO,OAAO,aAAa,SAAS;GAExC;EACF;EACA,MAAM,QAAQ,OAAO,aAAa,SAAS;EAE3C,KAAK,CAAC,oBAAoB,OAAO,SAAS,YAAY,CAAC,gBAAgB,OAAO;EAE9E,OAAO,MAAM,KACX,OAAO,OACL,OAAO,OACL,OAAO,IAAI,aAAa;GACtB,MAAM,UAAU,OAAO,kBACrB,QAAQ,wBACP,aACC,mBAAmB,OAAO,SAAS,OAAO,kBAAkB,QAAQ,CACxE;GAEA,MAAM,UAAU,uBAAuB,OAAO,SAAS,OAAO,OAAO;GAErE,IAAI,QAAQ,WAAW,GAAG,OAAO,OAAO;GAExC,MAAM,aAAa,iBACjB,SACA,MAAM,aAAa,SAAS,cACxB,MAAM,YAAY,UAClB,MAAM,aAAa,OACzB;GAEA,IAAI,eAAe,KAAA,GACjB,OAAO,OAAO,gBAAgB,KAAK,EACjC,SAAS,uCAAuC,mBAAmB,aACrE,CAAC;GAGH,MAAM,SAAS,OAAO,aAAa,CACjC,OAAO,YAAY,EACjB,SAAS,CACP,OAAO,SAAS,EACd,MAAM,GAAG,yBAAyB,aAAa,yBACjD,CAAC,CACH,EACF,CAAC,CACH,CAAC;GAED,MAAM,OAAO,OAAO,QAAQ,UAAU,QAAQ,KAAK;GAEnD,OAAO,OAAO,QAAQ;IACpB,MAAM;IACN;IACA,SAAS,KAAK,KAAK;GACrB,CAA8B;EAChC,CAAC,CACH,CACF,CACF;CACF,CAAC,CACH;AACJ;;;;;;AAOA,IAAa,mBAAb,MAAa,yBAAyB,QAAQ,QAA6C,CAAC,CAC1F,uCACF,CAAC,CAAC;CACA,OAAgB,QAAQ,MAAM,QAAQ,kBAAkB,iBAAiB,CAAC;;;;;;CAO1E,OAAgB,gBAAgB,MAAM,QAAQ,kBAAkB;EAC9D,UAAU;EACV,UAAgB,YACd,OAAO,OACL,OAAO,IAAI,aAAa;GACtB,IAAI,QAAQ,cAAc,KAAA,GACxB,OAAO,OAAO,QAAQ;IACpB,MAAM;IACN,GAAG,QAAQ;GACb,CAA8B;GAIhC,MAAM,UACJ,QAAQ,OAAO,QAAQ,eACpB,YAAY,QAAQ,SAAS,eAAe,QAAQ,SAAS,MAChE,IAAI;GAEN,IAAI,uBAAuB,QAAQ,OAAO,SAAS,QAAQ,OAAO,OAAO,CAAC,CAAC,WAAW,GACpF,OAAO,OAAO;GAGhB,MAAM,UAAU,OAAO,kBAAkB,QAAQ,wBAAwB,aACvE,qBACE,QAAQ,OAAO,SACf,QAAQ,OACR,QAAQ,cACR,SACA,QACF,CACF;GAEA,IAAI,YAAY,KAAA,GACd,OAAO,OAAO,KACZ,gBAAgB,KAAK,EACnB,SAAS,kEACX,CAAC,CACH;GAEF,OAAO,OAAO,QAAQ;IACpB,MAAM;IACN;IACA;GACF,CAA8B;EAChC,CAAC,CACH;CACJ,CAAC;;CAGD,OAAgB,kBACd,UAEA,MAAM,OACJ,kBACA,OAAO,IAAI,MAAM,sBAAsB,aAAa,iBAAiB,QAAQ,CAAC,CAChF;AACJ"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Context, Effect, Schema } from "effect";
|
|
2
|
+
declare namespace ContextHistory_d_exports {
|
|
3
|
+
export { ContextHistory, ContextHistoryError, ContextHistoryHit, ContextHistoryPage, ContextHistoryRead, ContextHistorySearch };
|
|
4
|
+
}
|
|
5
|
+
declare const ContextHistoryError_base: Schema.Class<ContextHistoryError, Schema.TaggedStruct<"ContextHistoryError", {
|
|
6
|
+
readonly reason: Schema.Literals<readonly ["unavailable", "not-found", "invalid-input", "limit"]>;
|
|
7
|
+
readonly message: Schema.String;
|
|
8
|
+
}>, import("effect/Cause").YieldableError>;
|
|
9
|
+
/** Canonical transcript lookup failure. Access to a Thread remains a host authorization decision. */
|
|
10
|
+
export declare class ContextHistoryError extends ContextHistoryError_base {}
|
|
11
|
+
declare const ContextHistoryHit_base: Schema.Class<ContextHistoryHit, Schema.Struct<{
|
|
12
|
+
readonly recordId: Schema.NonEmptyString;
|
|
13
|
+
readonly windowId: Schema.NonEmptyString;
|
|
14
|
+
readonly text: Schema.String;
|
|
15
|
+
}>, {}>;
|
|
16
|
+
export declare class ContextHistoryHit extends ContextHistoryHit_base {}
|
|
17
|
+
declare const ContextHistorySearch_base: Schema.Class<ContextHistorySearch, Schema.Struct<{
|
|
18
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
19
|
+
readonly query: Schema.NonEmptyString;
|
|
20
|
+
readonly limit: Schema.Int;
|
|
21
|
+
readonly beforeRecordId: Schema.optionalKey<Schema.NonEmptyString>;
|
|
22
|
+
}>, {}>;
|
|
23
|
+
/**
|
|
24
|
+
* Newest-first literal substring search, trimmed and JavaScript case-folded (not FTS or regex).
|
|
25
|
+
* `beforeRecordId` excludes that record and every newer canonical position. Use the last hit
|
|
26
|
+
* from the previous page with the same query; fewer than `limit` hits (including zero) ends
|
|
27
|
+
* pagination. A full final page requires one more request to observe the empty page.
|
|
28
|
+
*
|
|
29
|
+
* The anchor must be eligible retained evidence in this authorized Thread, but need not match
|
|
30
|
+
* the query. Unknown, removed, foreign, and non-evidence anchors fail with `not-found`.
|
|
31
|
+
* IDs are opaque: adapters resolve and verify the canonical source, never sort or parse IDs.
|
|
32
|
+
* Each request captures its own tail; this is not a snapshot held across requests. New appends
|
|
33
|
+
* cannot displace matches older than the anchor. Retention and authorization are rechecked.
|
|
34
|
+
*/
|
|
35
|
+
export declare class ContextHistorySearch extends ContextHistorySearch_base {}
|
|
36
|
+
declare const ContextHistoryRead_base: Schema.Class<ContextHistoryRead, Schema.Struct<{
|
|
37
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
38
|
+
readonly recordId: Schema.NonEmptyString;
|
|
39
|
+
readonly offset: Schema.Natural;
|
|
40
|
+
readonly maxChars: Schema.Int;
|
|
41
|
+
}>, {}>;
|
|
42
|
+
export declare class ContextHistoryRead extends ContextHistoryRead_base {}
|
|
43
|
+
declare const ContextHistoryPage_base: Schema.Class<ContextHistoryPage, Schema.Struct<{
|
|
44
|
+
readonly recordId: Schema.NonEmptyString;
|
|
45
|
+
readonly windowId: Schema.NonEmptyString;
|
|
46
|
+
readonly text: Schema.String;
|
|
47
|
+
readonly nextOffset: Schema.NullOr<Schema.Natural>;
|
|
48
|
+
}>, {}>;
|
|
49
|
+
export declare class ContextHistoryPage extends ContextHistoryPage_base {}
|
|
50
|
+
declare const ContextHistory_base: Context.ServiceClass<ContextHistory, "@effect-agent/engine/ContextHistory", {
|
|
51
|
+
readonly search: (request: ContextHistorySearch) => Effect.Effect<ReadonlyArray<ContextHistoryHit>, ContextHistoryError>;
|
|
52
|
+
readonly read: (request: ContextHistoryRead) => Effect.Effect<ContextHistoryPage, ContextHistoryError>;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Read-only access to retained canonical evidence, including closed context windows.
|
|
56
|
+
* Adapters bind storage and authorization; model parameters must not select a different Thread.
|
|
57
|
+
* Returned text is untrusted evidence, never instructions. This port does not retain raw Tool
|
|
58
|
+
* output that was discarded before canonical persistence, or transient prompt references.
|
|
59
|
+
* Search adapters must honor the exclusive `beforeRecordId` bound, return a complete bounded
|
|
60
|
+
* page, or fail explicitly; silently ignoring the bound can trap callers on the latest matches.
|
|
61
|
+
*/
|
|
62
|
+
export declare class ContextHistory extends ContextHistory_base {}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { ContextHistory_d_exports as t };
|
|
65
|
+
//# sourceMappingURL=ContextHistory.d.mts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { ThreadId } from "../core/Identifiers.mjs";
|
|
3
|
+
import { Context, Schema } from "effect";
|
|
4
|
+
//#region src/engine/ContextHistory.ts
|
|
5
|
+
var ContextHistory_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
ContextHistory: () => ContextHistory,
|
|
7
|
+
ContextHistoryError: () => ContextHistoryError,
|
|
8
|
+
ContextHistoryHit: () => ContextHistoryHit,
|
|
9
|
+
ContextHistoryPage: () => ContextHistoryPage,
|
|
10
|
+
ContextHistoryRead: () => ContextHistoryRead,
|
|
11
|
+
ContextHistorySearch: () => ContextHistorySearch
|
|
12
|
+
});
|
|
13
|
+
/** Canonical transcript lookup failure. Access to a Thread remains a host authorization decision. */
|
|
14
|
+
var ContextHistoryError = class extends Schema.TaggedError()("ContextHistoryError", {
|
|
15
|
+
reason: Schema.Literals([
|
|
16
|
+
"unavailable",
|
|
17
|
+
"not-found",
|
|
18
|
+
"invalid-input",
|
|
19
|
+
"limit"
|
|
20
|
+
]),
|
|
21
|
+
message: Schema.String.check(Schema.isMaxLength(4096))
|
|
22
|
+
}) {};
|
|
23
|
+
var ContextHistoryHit = class extends Schema.Class("ContextHistoryHit")({
|
|
24
|
+
recordId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
|
|
25
|
+
windowId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
|
|
26
|
+
text: Schema.String.check(Schema.isMaxLength(2e3))
|
|
27
|
+
}) {};
|
|
28
|
+
/**
|
|
29
|
+
* Newest-first literal substring search, trimmed and JavaScript case-folded (not FTS or regex).
|
|
30
|
+
* `beforeRecordId` excludes that record and every newer canonical position. Use the last hit
|
|
31
|
+
* from the previous page with the same query; fewer than `limit` hits (including zero) ends
|
|
32
|
+
* pagination. A full final page requires one more request to observe the empty page.
|
|
33
|
+
*
|
|
34
|
+
* The anchor must be eligible retained evidence in this authorized Thread, but need not match
|
|
35
|
+
* the query. Unknown, removed, foreign, and non-evidence anchors fail with `not-found`.
|
|
36
|
+
* IDs are opaque: adapters resolve and verify the canonical source, never sort or parse IDs.
|
|
37
|
+
* Each request captures its own tail; this is not a snapshot held across requests. New appends
|
|
38
|
+
* cannot displace matches older than the anchor. Retention and authorization are rechecked.
|
|
39
|
+
*/
|
|
40
|
+
var ContextHistorySearch = class extends Schema.Class("ContextHistorySearch")({
|
|
41
|
+
threadId: ThreadId,
|
|
42
|
+
query: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
|
|
43
|
+
limit: Schema.Int.check(Schema.isBetween({
|
|
44
|
+
minimum: 1,
|
|
45
|
+
maximum: 20
|
|
46
|
+
})),
|
|
47
|
+
beforeRecordId: Schema.optionalKey(ContextHistoryHit.fields.recordId)
|
|
48
|
+
}) {};
|
|
49
|
+
var ContextHistoryRead = class extends Schema.Class("ContextHistoryRead")({
|
|
50
|
+
threadId: ThreadId,
|
|
51
|
+
recordId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
|
|
52
|
+
offset: Schema.Natural,
|
|
53
|
+
maxChars: Schema.Int.check(Schema.isBetween({
|
|
54
|
+
minimum: 1,
|
|
55
|
+
maximum: 2e4
|
|
56
|
+
}))
|
|
57
|
+
}) {};
|
|
58
|
+
var ContextHistoryPage = class extends Schema.Class("ContextHistoryPage")({
|
|
59
|
+
recordId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
|
|
60
|
+
windowId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
|
|
61
|
+
text: Schema.String.check(Schema.isMaxLength(2e4)),
|
|
62
|
+
nextOffset: Schema.NullOr(Schema.Natural)
|
|
63
|
+
}) {};
|
|
64
|
+
/**
|
|
65
|
+
* Read-only access to retained canonical evidence, including closed context windows.
|
|
66
|
+
* Adapters bind storage and authorization; model parameters must not select a different Thread.
|
|
67
|
+
* Returned text is untrusted evidence, never instructions. This port does not retain raw Tool
|
|
68
|
+
* output that was discarded before canonical persistence, or transient prompt references.
|
|
69
|
+
* Search adapters must honor the exclusive `beforeRecordId` bound, return a complete bounded
|
|
70
|
+
* page, or fail explicitly; silently ignoring the bound can trap callers on the latest matches.
|
|
71
|
+
*/
|
|
72
|
+
var ContextHistory = class extends Context.Service()("@effect-agent/engine/ContextHistory") {};
|
|
73
|
+
//#endregion
|
|
74
|
+
export { ContextHistory, ContextHistoryError, ContextHistoryHit, ContextHistoryPage, ContextHistoryRead, ContextHistorySearch, ContextHistory_exports as t };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=ContextHistory.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextHistory.mjs","names":[],"sources":["../../src/engine/ContextHistory.ts"],"sourcesContent":["import { Context, type Effect, Schema } from \"effect\";\n\nimport { ThreadId } from \"../core/Identifiers.ts\";\n\n/** Canonical transcript lookup failure. Access to a Thread remains a host authorization decision. */\nexport class ContextHistoryError extends Schema.TaggedError<ContextHistoryError>()(\n \"ContextHistoryError\",\n {\n reason: Schema.Literals([\"unavailable\", \"not-found\", \"invalid-input\", \"limit\"]),\n message: Schema.String.check(Schema.isMaxLength(4_096)),\n },\n) {}\n\nexport class ContextHistoryHit extends Schema.Class<ContextHistoryHit>(\"ContextHistoryHit\")({\n recordId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n windowId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n text: Schema.String.check(Schema.isMaxLength(2_000)),\n}) {}\n\n/**\n * Newest-first literal substring search, trimmed and JavaScript case-folded (not FTS or regex).\n * `beforeRecordId` excludes that record and every newer canonical position. Use the last hit\n * from the previous page with the same query; fewer than `limit` hits (including zero) ends\n * pagination. A full final page requires one more request to observe the empty page.\n *\n * The anchor must be eligible retained evidence in this authorized Thread, but need not match\n * the query. Unknown, removed, foreign, and non-evidence anchors fail with `not-found`.\n * IDs are opaque: adapters resolve and verify the canonical source, never sort or parse IDs.\n * Each request captures its own tail; this is not a snapshot held across requests. New appends\n * cannot displace matches older than the anchor. Retention and authorization are rechecked.\n */\nexport class ContextHistorySearch extends Schema.Class<ContextHistorySearch>(\n \"ContextHistorySearch\",\n)({\n threadId: ThreadId,\n query: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n limit: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 20 })),\n beforeRecordId: Schema.optionalKey(ContextHistoryHit.fields.recordId),\n}) {}\n\nexport class ContextHistoryRead extends Schema.Class<ContextHistoryRead>(\"ContextHistoryRead\")({\n threadId: ThreadId,\n recordId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n offset: Schema.Natural,\n maxChars: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 20_000 })),\n}) {}\n\nexport class ContextHistoryPage extends Schema.Class<ContextHistoryPage>(\"ContextHistoryPage\")({\n recordId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n windowId: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n text: Schema.String.check(Schema.isMaxLength(20_000)),\n nextOffset: Schema.NullOr(Schema.Natural),\n}) {}\n\n/**\n * Read-only access to retained canonical evidence, including closed context windows.\n * Adapters bind storage and authorization; model parameters must not select a different Thread.\n * Returned text is untrusted evidence, never instructions. This port does not retain raw Tool\n * output that was discarded before canonical persistence, or transient prompt references.\n * Search adapters must honor the exclusive `beforeRecordId` bound, return a complete bounded\n * page, or fail explicitly; silently ignoring the bound can trap callers on the latest matches.\n */\nexport class ContextHistory extends Context.Service<\n ContextHistory,\n {\n readonly search: (\n request: ContextHistorySearch,\n ) => Effect.Effect<ReadonlyArray<ContextHistoryHit>, ContextHistoryError>;\n readonly read: (\n request: ContextHistoryRead,\n ) => Effect.Effect<ContextHistoryPage, ContextHistoryError>;\n }\n>()(\"@effect-agent/engine/ContextHistory\") {}\n"],"mappings":";;;;;;;;;;;;;AAKA,IAAa,sBAAb,cAAyC,OAAO,YAAiC,CAAC,CAChF,uBACA;CACE,QAAQ,OAAO,SAAS;EAAC;EAAe;EAAa;EAAiB;CAAO,CAAC;CAC9E,SAAS,OAAO,OAAO,MAAM,OAAO,YAAY,IAAK,CAAC;AACxD,CACF,CAAC,CAAC,CAAC;AAEH,IAAa,oBAAb,cAAuC,OAAO,MAAyB,mBAAmB,CAAC,CAAC;CAC1F,UAAU,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC;CAC7D,UAAU,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC;CAC7D,MAAM,OAAO,OAAO,MAAM,OAAO,YAAY,GAAK,CAAC;AACrD,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;AAcJ,IAAa,uBAAb,cAA0C,OAAO,MAC/C,sBACF,CAAC,CAAC;CACA,UAAU;CACV,OAAO,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC;CAC1D,OAAO,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS;CAAG,CAAC,CAAC;CACrE,gBAAgB,OAAO,YAAY,kBAAkB,OAAO,QAAQ;AACtE,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,qBAAb,cAAwC,OAAO,MAA0B,oBAAoB,CAAC,CAAC;CAC7F,UAAU;CACV,UAAU,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC;CAC7D,QAAQ,OAAO;CACf,UAAU,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS;CAAO,CAAC,CAAC;AAC9E,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,qBAAb,cAAwC,OAAO,MAA0B,oBAAoB,CAAC,CAAC;CAC7F,UAAU,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC;CAC7D,UAAU,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC;CAC7D,MAAM,OAAO,OAAO,MAAM,OAAO,YAAY,GAAM,CAAC;CACpD,YAAY,OAAO,OAAO,OAAO,OAAO;AAC1C,CAAC,CAAC,CAAC,CAAC;;;;;;;;;AAUJ,IAAa,iBAAb,cAAoC,QAAQ,QAU1C,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ContextWindow, c as ModelCallContext, i as ContextRolloverTool, n as ContextRolloverRequest, o as ContextWindowStatus, r as ContextRolloverSelection, t as ContextHandoff } from "../ContextWindow-DRQ5Mbm2.mjs";
|
|
2
|
+
export { ContextHandoff, ContextRolloverRequest, ContextRolloverSelection, ContextRolloverTool, ContextWindow, ContextWindowStatus, ModelCallContext };
|