@systemfsoftware/agent 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/dist/ActivityStore-CEy3oY41.mjs +90 -0
- package/dist/ActivityStore-CEy3oY41.mjs.map +1 -0
- package/dist/ActivityStore-CPXWRHGz.d.mts +91 -0
- package/dist/Admin-26pelcl9.d.mts +5678 -0
- package/dist/Admin-BcQDrWKY.mjs +329 -0
- package/dist/Admin-BcQDrWKY.mjs.map +1 -0
- package/dist/Agent-BH_R6LOI.d.mts +219 -0
- package/dist/Agent-Bn3zMhDH.mjs +60 -0
- package/dist/Agent-Bn3zMhDH.mjs.map +1 -0
- package/dist/AgentError-RkUaetX8.d.mts +128 -0
- package/dist/AgentError-yFdnS9bl.mjs +141 -0
- package/dist/AgentError-yFdnS9bl.mjs.map +1 -0
- package/dist/AgentPolicy-CI7LRBQa.mjs +116 -0
- package/dist/AgentPolicy-CI7LRBQa.mjs.map +1 -0
- package/dist/AgentPolicy-D-GmZQex.d.mts +128 -0
- package/dist/AgentRegistration-h07X1mZM.mjs +14 -0
- package/dist/AgentRegistration-h07X1mZM.mjs.map +1 -0
- package/dist/AgentRuntime-C3GQPdrv.d.mts +751 -0
- package/dist/AgentRuntime-CrYYV9RF.mjs +5224 -0
- package/dist/AgentRuntime-CrYYV9RF.mjs.map +1 -0
- package/dist/AgentUpdates-7xT0It_R.d.mts +54 -0
- package/dist/AgentUpdates-BS_6gR5K.mjs +66 -0
- package/dist/AgentUpdates-BS_6gR5K.mjs.map +1 -0
- package/dist/BrowserUse-DgCEbTwW.d.mts +196 -0
- package/dist/BrowserUse-DjEyFDLZ.mjs +156 -0
- package/dist/BrowserUse-DjEyFDLZ.mjs.map +1 -0
- package/dist/Budget-CXh_ChFJ.d.mts +112 -0
- package/dist/Budget-j1UkthgY.mjs +351 -0
- package/dist/Budget-j1UkthgY.mjs.map +1 -0
- package/dist/CodeExecutor-B_Vt1Ghy.mjs +281 -0
- package/dist/CodeExecutor-B_Vt1Ghy.mjs.map +1 -0
- package/dist/CodeExecutor-D5-Rda75.d.mts +198 -0
- package/dist/CodeMode-B7JvfKAD.d.mts +159 -0
- package/dist/CodeMode-BI7WhUkr.mjs +555 -0
- package/dist/CodeMode-BI7WhUkr.mjs.map +1 -0
- package/dist/CommittedActivity-DMfj2beT.d.mts +62 -0
- package/dist/CommittedActivity-DXyCKCtX.mjs +146 -0
- package/dist/CommittedActivity-DXyCKCtX.mjs.map +1 -0
- package/dist/Compaction-C0hWAmOG.mjs +15 -0
- package/dist/Compaction-C0hWAmOG.mjs.map +1 -0
- package/dist/Compaction-e5cNeFmY.d.mts +5 -0
- package/dist/ContextCompactor-Chm9BLrD.d.mts +165 -0
- package/dist/ContextCompactor-DV4NOQvg.mjs +134 -0
- package/dist/ContextCompactor-DV4NOQvg.mjs.map +1 -0
- package/dist/ContextHistory-C80rW5M7.mjs +76 -0
- package/dist/ContextHistory-C80rW5M7.mjs.map +1 -0
- package/dist/ContextHistory-akQ1Td7a.d.mts +65 -0
- package/dist/ContextTools-D5jrWNNH.d.mts +186 -0
- package/dist/ContextTools-p8JDPo-W.mjs +88 -0
- package/dist/ContextTools-p8JDPo-W.mjs.map +1 -0
- package/dist/ContextWindow-BJZI4MMt.d.mts +61 -0
- package/dist/ContextWindow-kbFcs1IF.mjs +63 -0
- package/dist/ContextWindow-kbFcs1IF.mjs.map +1 -0
- package/dist/Digest-BDToAbaX.d.mts +25 -0
- package/dist/Digest-CU6IWj-2.mjs +106 -0
- package/dist/Digest-CU6IWj-2.mjs.map +1 -0
- package/dist/DurableAgentRuntime-D3UTrNQg.mjs +8432 -0
- package/dist/DurableAgentRuntime-D3UTrNQg.mjs.map +1 -0
- package/dist/DurableFailpoint-BD5nowNl.mjs +98 -0
- package/dist/DurableFailpoint-BD5nowNl.mjs.map +1 -0
- package/dist/DurableFailpoint-Cqi5tyof.d.mts +42 -0
- package/dist/DurableStep-CzVIho7y.mjs +54 -0
- package/dist/DurableStep-CzVIho7y.mjs.map +1 -0
- package/dist/DurableStep-cI_Ho_rU.d.mts +109 -0
- package/dist/EventSource-BWY08cyT.d.mts +52 -0
- package/dist/EventSource-BwZVkEQi.mjs +66 -0
- package/dist/EventSource-BwZVkEQi.mjs.map +1 -0
- package/dist/FailureDiagnostic-DdHV2eFs.mjs +304 -0
- package/dist/FailureDiagnostic-DdHV2eFs.mjs.map +1 -0
- package/dist/FailureDiagnostic-DpzYNI8f.d.mts +232 -0
- package/dist/IdGenerator-BCzwV0ZI.mjs +29 -0
- package/dist/IdGenerator-BCzwV0ZI.mjs.map +1 -0
- package/dist/IdGenerator-BY8NH74o.d.mts +26 -0
- package/dist/Identifiers-LWd4837I.mjs +41 -0
- package/dist/Identifiers-LWd4837I.mjs.map +1 -0
- package/dist/Identifiers-qafW4EP0.d.mts +38 -0
- package/dist/InMemory-BrTm6XEO.mjs +57 -0
- package/dist/InMemory-BrTm6XEO.mjs.map +1 -0
- package/dist/InMemory-C3qXFT5k.d.mts +46 -0
- package/dist/InMemory.d.mts +2 -0
- package/dist/InMemory.mjs +1 -0
- package/dist/InteractiveBrowser-B-hlNJy5.mjs +237 -0
- package/dist/InteractiveBrowser-B-hlNJy5.mjs.map +1 -0
- package/dist/InteractiveBrowser-nnML0r7w.d.mts +258 -0
- package/dist/LifecyclePublication-BDc_ug5v.mjs +204 -0
- package/dist/LifecyclePublication-BDc_ug5v.mjs.map +1 -0
- package/dist/Memory-CT5bDZqi.d.mts +57 -0
- package/dist/Memory-Dl9ecPpm.mjs +204 -0
- package/dist/Memory-Dl9ecPpm.mjs.map +1 -0
- package/dist/MemoryNamespace-BtnlH_E6.d.mts +35 -0
- package/dist/MemoryNamespace-DZSpjLj9.mjs +116 -0
- package/dist/MemoryNamespace-DZSpjLj9.mjs.map +1 -0
- package/dist/MemoryNotes-CPvcb5OX.d.mts +425 -0
- package/dist/MemoryNotes-i41TsH11.mjs +132 -0
- package/dist/MemoryNotes-i41TsH11.mjs.map +1 -0
- package/dist/MemoryReference-Dd3KSMa7.d.mts +77 -0
- package/dist/MemoryReference-RFU0HQJG.mjs +108 -0
- package/dist/MemoryReference-RFU0HQJG.mjs.map +1 -0
- package/dist/MemoryRevalidation--aAh_Pfq.mjs +136 -0
- package/dist/MemoryRevalidation--aAh_Pfq.mjs.map +1 -0
- package/dist/MemoryRevalidation-FsJ8E61W.d.mts +64 -0
- package/dist/MemoryStore-Bg5RunTk.d.mts +187 -0
- package/dist/MemoryStore-E0J99hb2.mjs +245 -0
- package/dist/MemoryStore-E0J99hb2.mjs.map +1 -0
- package/dist/MessageDelivery-BE2Yf3FC.mjs +615 -0
- package/dist/MessageDelivery-BE2Yf3FC.mjs.map +1 -0
- package/dist/MessageDelivery-C0S-Cakt.d.mts +1129 -0
- package/dist/Messaging-BqWHYf93.d.mts +216 -0
- package/dist/Messaging-DgSiv4f4.mjs +154 -0
- package/dist/Messaging-DgSiv4f4.mjs.map +1 -0
- package/dist/Messaging-DnnpWe-H.d.mts +1074 -0
- package/dist/MessagingHost-Bm5e-kAX.mjs +117 -0
- package/dist/MessagingHost-Bm5e-kAX.mjs.map +1 -0
- package/dist/MessagingHost-DPPHTLdT.d.mts +80 -0
- package/dist/OperationAuthorizer-VSiHCC2S.mjs +72 -0
- package/dist/OperationAuthorizer-VSiHCC2S.mjs.map +1 -0
- package/dist/OperationAuthorizer-y-F-Ox_Q.d.mts +62 -0
- package/dist/Output-CafxF31F.d.mts +22 -0
- package/dist/Output-DQ8mWcgf.mjs +7 -0
- package/dist/Output-DQ8mWcgf.mjs.map +1 -0
- package/dist/PageCapture-BfRURUOA.mjs +275 -0
- package/dist/PageCapture-BfRURUOA.mjs.map +1 -0
- package/dist/PageCapture-C_mE72Sd.d.mts +216 -0
- package/dist/PageScreenshot-BJTASs4o.mjs +53 -0
- package/dist/PageScreenshot-BJTASs4o.mjs.map +1 -0
- package/dist/PageScreenshot-CaoaH7mc.d.mts +48 -0
- package/dist/PersistentHistory-CTAVhHKH.mjs +147 -0
- package/dist/PersistentHistory-CTAVhHKH.mjs.map +1 -0
- package/dist/PersistentHistory-h-C7avqL.d.mts +14 -0
- package/dist/PreparedInputAdmission-DYugcCHR.d.mts +973 -0
- package/dist/PreparedInputAdmission-adqVJJa6.mjs +95 -0
- package/dist/PreparedInputAdmission-adqVJJa6.mjs.map +1 -0
- package/dist/ProvisionalText-BcKpPYKQ.d.mts +70 -0
- package/dist/ProvisionalText-DXddTK4c.mjs +47 -0
- package/dist/ProvisionalText-DXddTK4c.mjs.map +1 -0
- package/dist/Receipt-B-FlCaNH.mjs +35 -0
- package/dist/Receipt-B-FlCaNH.mjs.map +1 -0
- package/dist/Receipt-B4feBxMY.d.mts +31 -0
- package/dist/RecordFormat-DoNh-AFe.mjs +79 -0
- package/dist/RecordFormat-DoNh-AFe.mjs.map +1 -0
- package/dist/RecordFormat-ZMus8Dx8.d.mts +52 -0
- package/dist/Records-C645aQks.mjs +1145 -0
- package/dist/Records-C645aQks.mjs.map +1 -0
- package/dist/Records-C9I1nCL9.d.mts +1423 -0
- package/dist/Recovery-zWy_kmZq.mjs +736 -0
- package/dist/Recovery-zWy_kmZq.mjs.map +1 -0
- package/dist/Redaction-C0zLBAn6.d.mts +28 -0
- package/dist/Redaction-CtyCBMEj.mjs +116 -0
- package/dist/Redaction-CtyCBMEj.mjs.map +1 -0
- package/dist/RememberingStore-BO-OnCgP.mjs +23 -0
- package/dist/RememberingStore-BO-OnCgP.mjs.map +1 -0
- package/dist/RememberingStore-DgqXmILx.d.mts +14 -0
- package/dist/RunContinuation-Bpfp087i.mjs +1060 -0
- package/dist/RunContinuation-Bpfp087i.mjs.map +1 -0
- package/dist/RunContinuation-Cy2W8ASl.d.mts +127 -0
- package/dist/RunEvent-CwgDzXcH.d.mts +465 -0
- package/dist/RunEvent-DJxENnJi.mjs +345 -0
- package/dist/RunEvent-DJxENnJi.mjs.map +1 -0
- package/dist/RunEventSink-B8uM8bw2.mjs +22 -0
- package/dist/RunEventSink-B8uM8bw2.mjs.map +1 -0
- package/dist/RunEventSink-f-T4jbNB.d.mts +105 -0
- package/dist/RunHooks-Bob22Bcj.d.mts +40 -0
- package/dist/RunHooks-DWuLBVdU.mjs +60 -0
- package/dist/RunHooks-DWuLBVdU.mjs.map +1 -0
- package/dist/RunJournal-C_1eqQdr.mjs +1107 -0
- package/dist/RunJournal-C_1eqQdr.mjs.map +1 -0
- package/dist/RunOptions-BVSa3BO2.d.mts +560 -0
- package/dist/RunOptions-COEUCrx4.mjs +61 -0
- package/dist/RunOptions-COEUCrx4.mjs.map +1 -0
- package/dist/RunPolicyUsage-B-JXRZYO.mjs +25 -0
- package/dist/RunPolicyUsage-B-JXRZYO.mjs.map +1 -0
- package/dist/RunPolicyUsage-jvJo0vJp.d.mts +21 -0
- package/dist/RunStorage-CsQQ0Y5u.mjs +304 -0
- package/dist/RunStorage-CsQQ0Y5u.mjs.map +1 -0
- package/dist/Sandbox-37vXP0BV.d.mts +24 -0
- package/dist/Sandbox-Bze6pHYc.mjs +30 -0
- package/dist/Sandbox-Bze6pHYc.mjs.map +1 -0
- package/dist/Schedule-BY0lzbij.mjs +336 -0
- package/dist/Schedule-BY0lzbij.mjs.map +1 -0
- package/dist/ScheduleTransition-DcqokgFt.d.mts +22 -0
- package/dist/ScheduleTransition-DtNzlN9k.mjs +180 -0
- package/dist/ScheduleTransition-DtNzlN9k.mjs.map +1 -0
- package/dist/Scheduling-BaJXJIVt.d.mts +57 -0
- package/dist/Scheduling-BpJN9E1j.mjs +699 -0
- package/dist/Scheduling-BpJN9E1j.mjs.map +1 -0
- package/dist/SemanticMemory-BRV0cuWg.mjs +300 -0
- package/dist/SemanticMemory-BRV0cuWg.mjs.map +1 -0
- package/dist/SemanticMemory-rgWlhW87.d.mts +431 -0
- package/dist/SemanticMemoryIndex-D7yNEWpt.d.mts +826 -0
- package/dist/SemanticMemoryIndex-godQDjNx.mjs +186 -0
- package/dist/SemanticMemoryIndex-godQDjNx.mjs.map +1 -0
- package/dist/SemanticMemoryRevalidation-Bm3_pfsI.d.mts +44 -0
- package/dist/SemanticMemoryRevalidation-D8VV-eU6.mjs +179 -0
- package/dist/SemanticMemoryRevalidation-D8VV-eU6.mjs.map +1 -0
- package/dist/Subagent-BJJN6n0E.mjs +1315 -0
- package/dist/Subagent-BJJN6n0E.mjs.map +1 -0
- package/dist/Subagent-GXU32fQt.d.mts +2368 -0
- package/dist/SubagentContract-B7vQPueI.d.mts +176 -0
- package/dist/SubagentContract-C-7AxTm_.mjs +187 -0
- package/dist/SubagentContract-C-7AxTm_.mjs.map +1 -0
- package/dist/SubagentHost-BC9B9dNT.d.mts +167 -0
- package/dist/SubagentHost-BEnICu7g.mjs +70 -0
- package/dist/SubagentHost-BEnICu7g.mjs.map +1 -0
- package/dist/SubagentReservations-BYNAHPpm.mjs +465 -0
- package/dist/SubagentReservations-BYNAHPpm.mjs.map +1 -0
- package/dist/SubagentReservations-WrmIVzO5.d.mts +185 -0
- package/dist/SubmissionLedger-WG0beEyt.mjs +921 -0
- package/dist/SubmissionLedger-WG0beEyt.mjs.map +1 -0
- package/dist/SubmissionStatus-CPZsOM5a.mjs +17 -0
- package/dist/SubmissionStatus-CPZsOM5a.mjs.map +1 -0
- package/dist/Subscription-BJ0TtZwM.d.mts +815 -0
- package/dist/Subscription-BhQbmUD-.mjs +340 -0
- package/dist/Subscription-BhQbmUD-.mjs.map +1 -0
- package/dist/SubscriptionInput-BbV69oX_.mjs +53 -0
- package/dist/SubscriptionInput-BbV69oX_.mjs.map +1 -0
- package/dist/SubscriptionInput-D6Okd6-z.d.mts +42 -0
- package/dist/SubscriptionTransition-Da9DmAr_.d.mts +23 -0
- package/dist/SubscriptionTransition-lrf733c8.mjs +154 -0
- package/dist/SubscriptionTransition-lrf733c8.mjs.map +1 -0
- package/dist/Subscriptions-BS3AXmQ0.mjs +638 -0
- package/dist/Subscriptions-BS3AXmQ0.mjs.map +1 -0
- package/dist/Subscriptions-DgjahL6V.d.mts +75 -0
- package/dist/Thread-B8JApGHa.mjs +283 -0
- package/dist/Thread-B8JApGHa.mjs.map +1 -0
- package/dist/Thread-BnAtkJl4.d.mts +116 -0
- package/dist/ThreadArchiveRange-1PMdjpdJ.mjs +64 -0
- package/dist/ThreadArchiveRange-1PMdjpdJ.mjs.map +1 -0
- package/dist/ThreadContextHistory-BSStMOLX.mjs +211 -0
- package/dist/ThreadContextHistory-BSStMOLX.mjs.map +1 -0
- package/dist/ThreadContextHistory-BVTD96Pe.d.mts +33 -0
- package/dist/ThreadContextHistoryProjection-Cp7_RR6V.d.mts +59 -0
- package/dist/ThreadContextHistoryProjection-_8uNz-h1.mjs +149 -0
- package/dist/ThreadContextHistoryProjection-_8uNz-h1.mjs.map +1 -0
- package/dist/ThreadHistory-BkyGfv5E.d.mts +76 -0
- package/dist/ThreadHistory-Blt_W31N.mjs +69 -0
- package/dist/ThreadHistory-Blt_W31N.mjs.map +1 -0
- package/dist/ThreadImport-BQDW9E_Y.d.mts +843 -0
- package/dist/ThreadImport-C8Tqiezd.mjs +491 -0
- package/dist/ThreadImport-C8Tqiezd.mjs.map +1 -0
- package/dist/ThreadInvariants-fniroLRY.mjs +154 -0
- package/dist/ThreadInvariants-fniroLRY.mjs.map +1 -0
- package/dist/ThreadInvariants-w53c67YS.d.mts +23 -0
- package/dist/ThreadProjectionMaintenance-4ccU1auU.d.mts +51 -0
- package/dist/ThreadProjectionMaintenance-D6fBjr1q.mjs +37 -0
- package/dist/ThreadProjectionMaintenance-D6fBjr1q.mjs.map +1 -0
- package/dist/ThreadStore-BMUAp5Ta.mjs +937 -0
- package/dist/ThreadStore-BMUAp5Ta.mjs.map +1 -0
- package/dist/ThreadTransfer-B3NkyO_y.mjs +154 -0
- package/dist/ThreadTransfer-B3NkyO_y.mjs.map +1 -0
- package/dist/ThreadTransfer-D0KsqkSR.d.mts +63 -0
- package/dist/ThreadWork-C-xa2Boi.mjs +484 -0
- package/dist/ThreadWork-C-xa2Boi.mjs.map +1 -0
- package/dist/ToolBroker-DkoVyx6T.mjs +42 -0
- package/dist/ToolBroker-DkoVyx6T.mjs.map +1 -0
- package/dist/ToolBroker-Dy2xM6ht.d.mts +134 -0
- package/dist/ToolDiscovery-DHySvLQd.mjs +211 -0
- package/dist/ToolDiscovery-DHySvLQd.mjs.map +1 -0
- package/dist/ToolDiscovery-DvcfbTBk.d.mts +119 -0
- package/dist/ToolExposure-Cn7xETn5.d.mts +6 -0
- package/dist/ToolExposure-D7id9Gt5.d.mts +37 -0
- package/dist/ToolExposure-DCvQWFIa.mjs +9 -0
- package/dist/ToolExposure-DCvQWFIa.mjs.map +1 -0
- package/dist/ToolExposure-DNME8BkG.d.mts +44 -0
- package/dist/ToolExposure-DPnq8Won.mjs +30 -0
- package/dist/ToolExposure-DPnq8Won.mjs.map +1 -0
- package/dist/ToolExposure-DaGaF5tj.mjs +20 -0
- package/dist/ToolExposure-DaGaF5tj.mjs.map +1 -0
- package/dist/ToolExposure.d.mts +4 -0
- package/dist/ToolExposure.mjs +4 -0
- package/dist/ToolReconciler-6bb7xlip.d.mts +81 -0
- package/dist/ToolReconciler-DJQd3SZA.mjs +87 -0
- package/dist/ToolReconciler-DJQd3SZA.mjs.map +1 -0
- package/dist/ToolResult-By5KAje4.d.mts +79 -0
- package/dist/ToolResult-DwZxjlHw.mjs +160 -0
- package/dist/ToolResult-DwZxjlHw.mjs.map +1 -0
- package/dist/ToolResultStorage-BmoRewhh.mjs +46 -0
- package/dist/ToolResultStorage-BmoRewhh.mjs.map +1 -0
- package/dist/ToolResultStorage-Bp5fm0do.d.mts +49 -0
- package/dist/ToolResults-NUk_x837.d.mts +33 -0
- package/dist/ToolResults-nCgBlTp2.mjs +45 -0
- package/dist/ToolResults-nCgBlTp2.mjs.map +1 -0
- package/dist/Usage-B0xgME5f.mjs +340 -0
- package/dist/Usage-B0xgME5f.mjs.map +1 -0
- package/dist/Usage-Bc-jXe_9.d.mts +128 -0
- package/dist/WakeScheduler-DVYj66C-.mjs +74 -0
- package/dist/WakeScheduler-DVYj66C-.mjs.map +1 -0
- package/dist/WakeScheduler-SFqj67Sk.d.mts +74 -0
- package/dist/WebCapture-CA4ZarW2.mjs +64 -0
- package/dist/WebCapture-CA4ZarW2.mjs.map +1 -0
- package/dist/WebCapture-pzIeUJ5W.d.mts +49 -0
- package/dist/WebSearch-DnbOzRL_.mjs +30 -0
- package/dist/WebSearch-DnbOzRL_.mjs.map +1 -0
- package/dist/WebSearch-RBUUOfT8.d.mts +18 -0
- package/dist/Worker-CQu8Qp1j.mjs +267 -0
- package/dist/Worker-CQu8Qp1j.mjs.map +1 -0
- package/dist/Worker-xxucY_0b.d.mts +468 -0
- package/dist/WorkerAdmission-CubQgpsl.d.mts +171 -0
- package/dist/WorkerAdmission-D8tw_OmT.mjs +162 -0
- package/dist/WorkerAdmission-D8tw_OmT.mjs.map +1 -0
- package/dist/WorkerHost-BciHCzHq.d.mts +150 -0
- package/dist/WorkerHost-DuQug9Bq.mjs +73 -0
- package/dist/WorkerHost-DuQug9Bq.mjs.map +1 -0
- package/dist/agent-registration-D9ofkoBa.mjs +262 -0
- package/dist/agent-registration-D9ofkoBa.mjs.map +1 -0
- package/dist/capabilities/BrowserUse.d.mts +2 -0
- package/dist/capabilities/BrowserUse.mjs +1 -0
- package/dist/capabilities/Budget.d.mts +2 -0
- package/dist/capabilities/Budget.mjs +1 -0
- package/dist/capabilities/CodeMode.d.mts +2 -0
- package/dist/capabilities/CodeMode.mjs +1 -0
- package/dist/capabilities/ContextTools.d.mts +2 -0
- package/dist/capabilities/ContextTools.mjs +1 -0
- package/dist/capabilities/MemoryNotes.d.mts +2 -0
- package/dist/capabilities/MemoryNotes.mjs +1 -0
- package/dist/capabilities/Messaging.d.mts +3 -0
- package/dist/capabilities/Messaging.mjs +4 -0
- package/dist/capabilities/Redaction.d.mts +2 -0
- package/dist/capabilities/Redaction.mjs +1 -0
- package/dist/capabilities/RunHooks.d.mts +2 -0
- package/dist/capabilities/RunHooks.mjs +1 -0
- package/dist/capabilities/SemanticMemory.d.mts +2 -0
- package/dist/capabilities/SemanticMemory.mjs +1 -0
- package/dist/capabilities/Subagent.d.mts +4 -0
- package/dist/capabilities/Subagent.mjs +6 -0
- package/dist/capabilities/SubagentReservations.d.mts +2 -0
- package/dist/capabilities/SubagentReservations.mjs +1 -0
- package/dist/capabilities/ToolDiscovery.d.mts +2 -0
- package/dist/capabilities/ToolDiscovery.mjs +1 -0
- package/dist/capabilities/ToolResults.d.mts +2 -0
- package/dist/capabilities/ToolResults.mjs +1 -0
- package/dist/capabilities/WebCapture.d.mts +2 -0
- package/dist/capabilities/WebCapture.mjs +1 -0
- package/dist/capabilities/WebSearch.d.mts +2 -0
- package/dist/capabilities/WebSearch.mjs +1 -0
- package/dist/compaction-C3hXuO4Z.mjs +539 -0
- package/dist/compaction-C3hXuO4Z.mjs.map +1 -0
- package/dist/completion-B_WDnSg-.d.mts +11 -0
- package/dist/core/Agent.d.mts +2 -0
- package/dist/core/Agent.mjs +1 -0
- package/dist/core/AgentError.d.mts +2 -0
- package/dist/core/AgentError.mjs +1 -0
- package/dist/core/AgentPolicy.d.mts +2 -0
- package/dist/core/AgentPolicy.mjs +1 -0
- package/dist/core/AgentUpdates.d.mts +2 -0
- package/dist/core/AgentUpdates.mjs +1 -0
- package/dist/core/FailureDiagnostic.d.mts +2 -0
- package/dist/core/FailureDiagnostic.mjs +1 -0
- package/dist/core/IdGenerator.d.mts +2 -0
- package/dist/core/IdGenerator.mjs +1 -0
- package/dist/core/Identifiers.d.mts +2 -0
- package/dist/core/Identifiers.mjs +1 -0
- package/dist/core/Memory.d.mts +2 -0
- package/dist/core/Memory.mjs +1 -0
- package/dist/core/MemoryNamespace.d.mts +2 -0
- package/dist/core/MemoryNamespace.mjs +1 -0
- package/dist/core/MemoryReference.d.mts +2 -0
- package/dist/core/MemoryReference.mjs +1 -0
- package/dist/core/MemoryRevalidation.d.mts +2 -0
- package/dist/core/MemoryRevalidation.mjs +1 -0
- package/dist/core/MemoryStore.d.mts +2 -0
- package/dist/core/MemoryStore.mjs +1 -0
- package/dist/core/ProvisionalText.d.mts +2 -0
- package/dist/core/ProvisionalText.mjs +1 -0
- package/dist/core/Receipt.d.mts +2 -0
- package/dist/core/Receipt.mjs +1 -0
- package/dist/core/RememberingStore.d.mts +2 -0
- package/dist/core/RememberingStore.mjs +1 -0
- package/dist/core/RunEvent.d.mts +3 -0
- package/dist/core/RunEvent.mjs +1 -0
- package/dist/core/RunPolicyUsage.d.mts +2 -0
- package/dist/core/RunPolicyUsage.mjs +1 -0
- package/dist/core/SemanticMemoryIndex.d.mts +2 -0
- package/dist/core/SemanticMemoryIndex.mjs +1 -0
- package/dist/core/SemanticMemoryRevalidation.d.mts +2 -0
- package/dist/core/SemanticMemoryRevalidation.mjs +1 -0
- package/dist/core/SubagentContract.d.mts +2 -0
- package/dist/core/SubagentContract.mjs +1 -0
- package/dist/core/Thread.d.mts +2 -0
- package/dist/core/Thread.mjs +1 -0
- package/dist/core/ToolResult.d.mts +2 -0
- package/dist/core/ToolResult.mjs +1 -0
- package/dist/core/ToolResultStorage.d.mts +2 -0
- package/dist/core/ToolResultStorage.mjs +1 -0
- package/dist/core/Usage.d.mts +2 -0
- package/dist/core/Usage.mjs +1 -0
- package/dist/core/Worker.d.mts +3 -0
- package/dist/core/Worker.mjs +3 -0
- package/dist/durable/ActivityStore.d.mts +2 -0
- package/dist/durable/ActivityStore.mjs +1 -0
- package/dist/durable/Admin.d.mts +2 -0
- package/dist/durable/Admin.mjs +1 -0
- package/dist/durable/AgentRegistration.d.mts +3 -0
- package/dist/durable/AgentRegistration.mjs +2 -0
- package/dist/durable/CommittedActivity.d.mts +2 -0
- package/dist/durable/CommittedActivity.mjs +1 -0
- package/dist/durable/Digest.d.mts +2 -0
- package/dist/durable/Digest.mjs +3 -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 +1 -0
- package/dist/durable/DurableFailpointTestControl.d.mts +14 -0
- package/dist/durable/DurableFailpointTestControl.mjs +21 -0
- package/dist/durable/DurableFailpointTestControl.mjs.map +1 -0
- package/dist/durable/EventSource.d.mts +2 -0
- package/dist/durable/EventSource.mjs +1 -0
- package/dist/durable/LifecyclePublication.d.mts +2 -0
- package/dist/durable/LifecyclePublication.mjs +1 -0
- package/dist/durable/MessageDelivery.d.mts +2 -0
- package/dist/durable/MessageDelivery.mjs +1 -0
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +401 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs +273 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs.map +1 -0
- package/dist/durable/OperationAuthorizer.d.mts +2 -0
- package/dist/durable/OperationAuthorizer.mjs +1 -0
- package/dist/durable/PersistentHistory.d.mts +2 -0
- package/dist/durable/PersistentHistory.mjs +1 -0
- package/dist/durable/PreparedInputAdmission.d.mts +2 -0
- package/dist/durable/PreparedInputAdmission.mjs +1 -0
- package/dist/durable/RecordFormat.d.mts +2 -0
- package/dist/durable/RecordFormat.mjs +1 -0
- package/dist/durable/Records.d.mts +2 -0
- package/dist/durable/Records.mjs +1 -0
- package/dist/durable/Recovery.d.mts +2 -0
- package/dist/durable/Recovery.mjs +1 -0
- package/dist/durable/RunContinuation.d.mts +4 -0
- package/dist/durable/RunContinuation.mjs +4 -0
- package/dist/durable/RunJournal.d.mts +2 -0
- package/dist/durable/RunJournal.mjs +1 -0
- package/dist/durable/RunStorage.d.mts +2 -0
- package/dist/durable/RunStorage.mjs +1 -0
- package/dist/durable/Schedule.d.mts +2 -0
- package/dist/durable/Schedule.mjs +1 -0
- package/dist/durable/ScheduleStoreConformance.d.mts +16 -0
- package/dist/durable/ScheduleStoreConformance.mjs +421 -0
- package/dist/durable/ScheduleStoreConformance.mjs.map +1 -0
- package/dist/durable/ScheduleTransition.d.mts +2 -0
- package/dist/durable/ScheduleTransition.mjs +1 -0
- package/dist/durable/Scheduling.d.mts +2 -0
- package/dist/durable/Scheduling.mjs +1 -0
- package/dist/durable/SettlementPublisher.d.mts +2 -0
- package/dist/durable/SettlementPublisher.mjs +99 -0
- package/dist/durable/SettlementPublisher.mjs.map +1 -0
- package/dist/durable/SqlMemoryStore.d.mts +729 -0
- package/dist/durable/SqlMemoryStore.mjs +626 -0
- package/dist/durable/SqlMemoryStore.mjs.map +1 -0
- package/dist/durable/SqlStorageOwner.d.mts +18 -0
- package/dist/durable/SqlStorageOwner.mjs +6 -0
- package/dist/durable/SqlStorageOwner.mjs.map +1 -0
- package/dist/durable/SubmissionLedger.d.mts +3 -0
- package/dist/durable/SubmissionLedger.mjs +3 -0
- package/dist/durable/SubmissionLedgerConformance.d.mts +31 -0
- package/dist/durable/SubmissionLedgerConformance.mjs +2090 -0
- package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -0
- package/dist/durable/SubmissionStatus.d.mts +2 -0
- package/dist/durable/SubmissionStatus.mjs +1 -0
- package/dist/durable/Subscription.d.mts +2 -0
- package/dist/durable/Subscription.mjs +1 -0
- package/dist/durable/SubscriptionInput.d.mts +2 -0
- package/dist/durable/SubscriptionInput.mjs +1 -0
- package/dist/durable/SubscriptionStoreConformance.d.mts +15 -0
- package/dist/durable/SubscriptionStoreConformance.mjs +816 -0
- package/dist/durable/SubscriptionStoreConformance.mjs.map +1 -0
- package/dist/durable/SubscriptionTransition.d.mts +2 -0
- package/dist/durable/SubscriptionTransition.mjs +1 -0
- package/dist/durable/Subscriptions.d.mts +2 -0
- package/dist/durable/Subscriptions.mjs +1 -0
- package/dist/durable/ThreadArchiveRange.d.mts +2 -0
- package/dist/durable/ThreadArchiveRange.mjs +1 -0
- package/dist/durable/ThreadContextHistory.d.mts +2 -0
- package/dist/durable/ThreadContextHistory.mjs +1 -0
- package/dist/durable/ThreadContextHistoryProjection.d.mts +2 -0
- package/dist/durable/ThreadContextHistoryProjection.mjs +1 -0
- package/dist/durable/ThreadImport.d.mts +2 -0
- package/dist/durable/ThreadImport.mjs +1 -0
- package/dist/durable/ThreadInvariants.d.mts +2 -0
- package/dist/durable/ThreadInvariants.mjs +1 -0
- package/dist/durable/ThreadProjectionMaintenance.d.mts +2 -0
- package/dist/durable/ThreadProjectionMaintenance.mjs +1 -0
- package/dist/durable/ThreadReader.d.mts +2 -0
- package/dist/durable/ThreadReader.mjs +1 -0
- package/dist/durable/ThreadStore.d.mts +3 -0
- package/dist/durable/ThreadStore.mjs +3 -0
- package/dist/durable/ThreadStoreConformance.d.mts +53 -0
- package/dist/durable/ThreadStoreConformance.mjs +402 -0
- package/dist/durable/ThreadStoreConformance.mjs.map +1 -0
- package/dist/durable/ThreadTransfer.d.mts +2 -0
- package/dist/durable/ThreadTransfer.mjs +1 -0
- package/dist/durable/ThreadWork.d.mts +2 -0
- package/dist/durable/ThreadWork.mjs +1 -0
- package/dist/durable/ToolReconciler.d.mts +2 -0
- package/dist/durable/ToolReconciler.mjs +1 -0
- package/dist/durable/WakeScheduler.d.mts +2 -0
- package/dist/durable/WakeScheduler.mjs +1 -0
- package/dist/durable/WorkerAdmission.d.mts +2 -0
- package/dist/durable/WorkerAdmission.mjs +1 -0
- package/dist/durable/WorkerHost.d.mts +2 -0
- package/dist/durable/WorkerHost.mjs +1 -0
- package/dist/engine/AgentRuntime.d.mts +2 -0
- package/dist/engine/AgentRuntime.mjs +1 -0
- package/dist/engine/Compaction.d.mts +4 -0
- package/dist/engine/Compaction.mjs +2 -0
- package/dist/engine/ContextCompactor.d.mts +2 -0
- package/dist/engine/ContextCompactor.mjs +1 -0
- package/dist/engine/ContextHistory.d.mts +2 -0
- package/dist/engine/ContextHistory.mjs +1 -0
- package/dist/engine/ContextWindow.d.mts +2 -0
- package/dist/engine/ContextWindow.mjs +1 -0
- package/dist/engine/DurableStep.d.mts +2 -0
- package/dist/engine/DurableStep.mjs +3 -0
- package/dist/engine/MessagingHost.d.mts +2 -0
- package/dist/engine/MessagingHost.mjs +1 -0
- package/dist/engine/Output.d.mts +3 -0
- package/dist/engine/Output.mjs +2 -0
- package/dist/engine/RunEventSink.d.mts +2 -0
- package/dist/engine/RunEventSink.mjs +1 -0
- package/dist/engine/RunOptions.d.mts +2 -0
- package/dist/engine/RunOptions.mjs +1 -0
- package/dist/engine/SubagentHost.d.mts +2 -0
- package/dist/engine/SubagentHost.mjs +1 -0
- package/dist/engine/ThreadHistory.d.mts +2 -0
- package/dist/engine/ThreadHistory.mjs +1 -0
- package/dist/engine/ToolBroker.d.mts +2 -0
- package/dist/engine/ToolBroker.mjs +1 -0
- package/dist/index.d.mts +90 -0
- package/dist/index.mjs +101 -0
- package/dist/output-contract-CYA4oBhe.mjs +128 -0
- package/dist/output-contract-CYA4oBhe.mjs.map +1 -0
- package/dist/rolldown-runtime-D3KUYPsf.mjs +12 -0
- package/dist/run-context-reader-D1Tx1G6V.d.mts +17 -0
- package/dist/sandbox/CodeExecutor.d.mts +2 -0
- package/dist/sandbox/CodeExecutor.mjs +1 -0
- package/dist/sandbox/InteractiveBrowser.d.mts +2 -0
- package/dist/sandbox/InteractiveBrowser.mjs +1 -0
- package/dist/sandbox/PageCapture.d.mts +2 -0
- package/dist/sandbox/PageCapture.mjs +1 -0
- package/dist/sandbox/PageScreenshot.d.mts +2 -0
- package/dist/sandbox/PageScreenshot.mjs +1 -0
- package/dist/sandbox/Sandbox.d.mts +2 -0
- package/dist/sandbox/Sandbox.mjs +1 -0
- package/dist/subagent-policy-xRJhrc0a.mjs +133 -0
- package/dist/subagent-policy-xRJhrc0a.mjs.map +1 -0
- package/dist/tool-execution-Cl7v8fXU.mjs +16 -0
- package/dist/tool-execution-Cl7v8fXU.mjs.map +1 -0
- package/dist/tool-operations-CauPonM8.mjs +84 -0
- package/dist/tool-operations-CauPonM8.mjs.map +1 -0
- package/dist/utf8-Bl0ZhhGe.mjs +27 -0
- package/dist/utf8-Bl0ZhhGe.mjs.map +1 -0
- package/package.json +491 -3
- package/src/InMemory.ts +79 -0
- package/src/ToolExposure.ts +2 -0
- package/src/capabilities/BrowserUse.ts +212 -0
- package/src/capabilities/Budget.ts +544 -0
- package/src/capabilities/CodeMode.ts +1129 -0
- package/src/capabilities/ContextTools.ts +131 -0
- package/src/capabilities/MemoryNotes.ts +177 -0
- package/src/capabilities/Messaging.ts +260 -0
- package/src/capabilities/Redaction.ts +163 -0
- package/src/capabilities/RunHooks.ts +116 -0
- package/src/capabilities/SemanticMemory.ts +402 -0
- package/src/capabilities/Subagent.ts +2343 -0
- package/src/capabilities/SubagentReservations.ts +807 -0
- package/src/capabilities/ToolDiscovery.ts +291 -0
- package/src/capabilities/ToolResults.ts +50 -0
- package/src/capabilities/WebCapture.ts +64 -0
- package/src/capabilities/WebSearch.ts +45 -0
- package/src/capabilities/internal/subagent-background.ts +1137 -0
- package/src/capabilities/internal/subagent-contract.ts +92 -0
- package/src/capabilities/internal/subagent-policy.ts +205 -0
- package/src/capabilities/internal/subagent-reporting.ts +152 -0
- package/src/core/Agent.ts +528 -0
- package/src/core/AgentError.ts +189 -0
- package/src/core/AgentPolicy.ts +194 -0
- package/src/core/AgentUpdates.ts +104 -0
- package/src/core/FailureDiagnostic.ts +392 -0
- package/src/core/IdGenerator.ts +42 -0
- package/src/core/Identifiers.ts +64 -0
- package/src/core/Memory.ts +283 -0
- package/src/core/MemoryNamespace.ts +202 -0
- package/src/core/MemoryReference.ts +120 -0
- package/src/core/MemoryRevalidation.ts +151 -0
- package/src/core/MemoryStore.ts +371 -0
- package/src/core/Messaging.ts +72 -0
- package/src/core/ProvisionalText.ts +53 -0
- package/src/core/Receipt.ts +42 -0
- package/src/core/RememberingStore.ts +22 -0
- package/src/core/RunEvent.ts +345 -0
- package/src/core/RunPolicyUsage.ts +19 -0
- package/src/core/SemanticMemoryIndex.ts +259 -0
- package/src/core/SemanticMemoryRevalidation.ts +220 -0
- package/src/core/SubagentContract.ts +263 -0
- package/src/core/Thread.ts +447 -0
- package/src/core/ToolExposure.ts +75 -0
- package/src/core/ToolResult.ts +204 -0
- package/src/core/ToolResultStorage.ts +56 -0
- package/src/core/Usage.ts +562 -0
- package/src/core/Worker.ts +236 -0
- package/src/core/internal/agent-updates.ts +42 -0
- package/src/core/internal/completion.ts +33 -0
- package/src/core/internal/json.ts +17 -0
- package/src/core/internal/memory-document.ts +39 -0
- package/src/core/internal/message-status.ts +60 -0
- package/src/core/internal/strict-schema.ts +14 -0
- package/src/core/internal/tool-execution.ts +33 -0
- package/src/core/internal/utf8.ts +32 -0
- package/src/durable/ActivityStore.ts +131 -0
- package/src/durable/Admin.ts +504 -0
- package/src/durable/AgentRegistration.ts +16 -0
- package/src/durable/CommittedActivity.ts +262 -0
- package/src/durable/Digest.ts +57 -0
- package/src/durable/DurableAgentRuntime.ts +12758 -0
- package/src/durable/DurableFailpoint.ts +108 -0
- package/src/durable/DurableFailpointTestControl.ts +39 -0
- package/src/durable/EventSource.ts +179 -0
- package/src/durable/LifecyclePublication.ts +343 -0
- package/src/durable/MessageDelivery.ts +949 -0
- package/src/durable/MessageDeliveryStoreConformance.ts +407 -0
- package/src/durable/OperationAuthorizer.ts +89 -0
- package/src/durable/PersistentHistory.ts +322 -0
- package/src/durable/PreparedInputAdmission.ts +128 -0
- package/src/durable/RecordFormat.ts +113 -0
- package/src/durable/Records.ts +1396 -0
- package/src/durable/Recovery.ts +1022 -0
- package/src/durable/RunContinuation.ts +1946 -0
- package/src/durable/RunJournal.ts +1926 -0
- package/src/durable/RunStorage.ts +533 -0
- package/src/durable/Schedule.ts +445 -0
- package/src/durable/ScheduleStoreConformance.ts +642 -0
- package/src/durable/ScheduleTransition.ts +267 -0
- package/src/durable/Scheduling.ts +1031 -0
- package/src/durable/SettlementPublisher.ts +172 -0
- package/src/durable/SqlMemoryStore.ts +1042 -0
- package/src/durable/SqlStorageOwner.ts +25 -0
- package/src/durable/SubmissionLedger.ts +1247 -0
- package/src/durable/SubmissionLedgerConformance.ts +4695 -0
- package/src/durable/SubmissionStatus.ts +14 -0
- package/src/durable/Subscription.ts +527 -0
- package/src/durable/SubscriptionInput.ts +145 -0
- package/src/durable/SubscriptionStoreConformance.ts +1275 -0
- package/src/durable/SubscriptionTransition.ts +330 -0
- package/src/durable/Subscriptions.ts +1245 -0
- package/src/durable/ThreadArchiveRange.ts +91 -0
- package/src/durable/ThreadContextHistory.ts +338 -0
- package/src/durable/ThreadContextHistoryProjection.ts +219 -0
- package/src/durable/ThreadImport.ts +1199 -0
- package/src/durable/ThreadInvariants.ts +312 -0
- package/src/durable/ThreadProjectionMaintenance.ts +72 -0
- package/src/durable/ThreadReader.ts +21 -0
- package/src/durable/ThreadStore.ts +1258 -0
- package/src/durable/ThreadStoreConformance.ts +877 -0
- package/src/durable/ThreadTransfer.ts +263 -0
- package/src/durable/ThreadWork.ts +713 -0
- package/src/durable/ToolReconciler.ts +112 -0
- package/src/durable/WakeScheduler.ts +125 -0
- package/src/durable/WorkerAdmission.ts +98 -0
- package/src/durable/WorkerHost.ts +204 -0
- package/src/durable/internal/StorageOwner.ts +181 -0
- package/src/durable/internal/agent-registration.ts +713 -0
- package/src/durable/internal/agent-updates.ts +338 -0
- package/src/durable/internal/canonical-json.ts +110 -0
- package/src/durable/internal/evidence.ts +29 -0
- package/src/durable/internal/foreign-diagnostic.ts +48 -0
- package/src/durable/internal/history-prompt.ts +87 -0
- package/src/durable/internal/initial-context.ts +215 -0
- package/src/durable/internal/journal-metadata.ts +188 -0
- package/src/durable/internal/message-status.ts +18 -0
- package/src/durable/internal/messaging-host.ts +615 -0
- package/src/durable/internal/prompt-footprint.ts +47 -0
- package/src/durable/internal/prompt-history-cache.ts +604 -0
- package/src/durable/internal/record-encoding.ts +258 -0
- package/src/durable/internal/record-ownership.ts +68 -0
- package/src/durable/internal/run-context-reader.ts +51 -0
- package/src/durable/internal/run-context.ts +211 -0
- package/src/durable/internal/schedule-time.ts +304 -0
- package/src/durable/internal/thread-import-reader.ts +85 -0
- package/src/durable/internal/thread-initialization.ts +181 -0
- package/src/durable/internal/thread-transfer-source.ts +7 -0
- package/src/durable/internal/tool-operations.ts +138 -0
- package/src/durable/internal/transfer-dependencies.ts +40 -0
- package/src/durable/internal/usage-totals.ts +36 -0
- package/src/durable/internal/worker-host.ts +4041 -0
- package/src/durable/internal/worker-runtime.ts +10 -0
- package/src/engine/AgentRuntime.ts +100 -0
- package/src/engine/Compaction.ts +11 -0
- package/src/engine/ContextCompactor.ts +302 -0
- package/src/engine/ContextHistory.ts +75 -0
- package/src/engine/ContextWindow.ts +81 -0
- package/src/engine/DurableStep.ts +115 -0
- package/src/engine/MessagingHost.ts +118 -0
- package/src/engine/Output.ts +2 -0
- package/src/engine/RunEventSink.ts +124 -0
- package/src/engine/RunOptions.ts +664 -0
- package/src/engine/SubagentHost.ts +231 -0
- package/src/engine/ThreadHistory.ts +125 -0
- package/src/engine/ToolBroker.ts +159 -0
- package/src/engine/ToolExposure.ts +49 -0
- package/src/engine/internal/agent-runtime.ts +11083 -0
- package/src/engine/internal/bounded-value.ts +312 -0
- package/src/engine/internal/compaction.ts +673 -0
- package/src/engine/internal/error-diagnostic.ts +39 -0
- package/src/engine/internal/image-tokens.ts +61 -0
- package/src/engine/internal/interpreter-options.ts +569 -0
- package/src/engine/internal/output-contract.ts +226 -0
- package/src/engine/internal/primitive-delta.ts +103 -0
- package/src/engine/internal/provider-result-staging.ts +211 -0
- package/src/engine/internal/provisional-text.ts +107 -0
- package/src/engine/internal/tool-derivative.ts +47 -0
- package/src/engine/internal/tool-exposure.ts +228 -0
- package/src/engine/internal/tool-telemetry.ts +488 -0
- package/src/index.ts +100 -0
- package/src/sandbox/CodeExecutor.ts +352 -0
- package/src/sandbox/InteractiveBrowser.ts +343 -0
- package/src/sandbox/PageCapture.ts +391 -0
- package/src/sandbox/PageScreenshot.ts +83 -0
- package/src/sandbox/Sandbox.ts +29 -0
- package/README.md +0 -3
|
@@ -0,0 +1,937 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D3KUYPsf.mjs";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Layer from "effect/Layer";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import * as Result from "effect/Result";
|
|
7
|
+
import * as Schema from "effect/Schema";
|
|
8
|
+
import * as Stream from "effect/Stream";
|
|
9
|
+
import * as Struct from "effect/Struct";
|
|
10
|
+
import { d as ToolCallId, l as SubmissionId, o as ReceiptId, s as RunId, u as ThreadId } from "./Identifiers-LWd4837I.mjs";
|
|
11
|
+
import { n as utf8ByteLength } from "./utf8-Bl0ZhhGe.mjs";
|
|
12
|
+
import { i as QueueSequence } from "./Receipt-B-FlCaNH.mjs";
|
|
13
|
+
import { n as AssignmentTerminal } from "./Worker-CQu8Qp1j.mjs";
|
|
14
|
+
import * as DateTime from "effect/DateTime";
|
|
15
|
+
import * as Predicate from "effect/Predicate";
|
|
16
|
+
import { n as ExportRecord, r as ExportedRecord } from "./RecordFormat-DoNh-AFe.mjs";
|
|
17
|
+
import { B as ObservationOffset, C as MAX_CANONICAL_RECORD_BYTES, D as MAX_PERSISTED_JSON_NODES, P as MAX_RUN_TOOL_CALL_IDENTITIES, T as MAX_PERSISTED_JSON_COLLECTION_LENGTH, V as PROMPT_EVIDENCE_TAGS, W as ProducerId, X as RecordEnvelope, Z as RecordId, b as Digest, f as CanonicalSequence, i as BatchId, o as CURRENT_RECORD_FORMAT, u as CanonicalRecordEnvelope } from "./Records-C645aQks.mjs";
|
|
18
|
+
import { c as boundedCanonicalJson, l as canonicalJson } from "./Digest-CU6IWj-2.mjs";
|
|
19
|
+
import { O as subagentLineageRecordId, S as runIdForSubmission, X as workerOriginRecordId } from "./RunJournal-C_1eqQdr.mjs";
|
|
20
|
+
import { a as MessageDeliveryError, f as MessageDeliveryRecord } from "./MessageDelivery-BE2Yf3FC.mjs";
|
|
21
|
+
import { f as ScheduleInstant } from "./Schedule-BY0lzbij.mjs";
|
|
22
|
+
import { bt as UnknownResolutionIntent, d as AdmissionRequest, g as ApprovalDecisionIntent, n as AbortIntent } from "./SubmissionLedger-WG0beEyt.mjs";
|
|
23
|
+
import { i as MAX_CANONICAL_BATCH_BYTES } from "./ThreadArchiveRange-1PMdjpdJ.mjs";
|
|
24
|
+
// src/durable/internal/record-ownership.ts
|
|
25
|
+
/** Index membership comes from canonical owner fields, never parsing opaque identities. */
|
|
26
|
+
const canonicalRunIds = ({ payload }) => {
|
|
27
|
+
const ids = /* @__PURE__ */ new Set();
|
|
28
|
+
if ("runId" in payload && payload.runId !== void 0) ids.add(payload.runId);
|
|
29
|
+
if (payload._tag === "AbortRequested" || payload._tag === "SubmissionSettled") ids.add(runIdForSubmission(payload.submissionId));
|
|
30
|
+
if (payload._tag === "AgentUpdateEmitted") ids.add(payload.update.runId);
|
|
31
|
+
if (payload._tag === "WorkerInputRequested" && payload.admission.executionRunId !== null) ids.add(payload.admission.executionRunId);
|
|
32
|
+
if (payload._tag === "SubtreeBudgetReserved" && payload.executionRunId !== null) ids.add(payload.executionRunId);
|
|
33
|
+
if (payload._tag === "PeerMessagePrepared" && payload.source._tag === "tool") ids.add(payload.source.runId);
|
|
34
|
+
return [...ids];
|
|
35
|
+
};
|
|
36
|
+
/** A joined Receipt's closure is discoverable from its host, but owns no host execution charge. */
|
|
37
|
+
const executionRunIds = (record) => record.payload._tag === "SubmissionSettled" ? [runIdForSubmission(record.payload.submissionId)] : canonicalRunIds(record);
|
|
38
|
+
/**
|
|
39
|
+
* These immutable preparations are durable handoff intents before a destination row exists.
|
|
40
|
+
* Their canonical tag/identity index is published with the preparation and survives Run
|
|
41
|
+
* settlement. WorkerInputCompleted closes capacity only with factual effectsResolved evidence;
|
|
42
|
+
* ToolCallSettled/Resolved close operations, and destination delivery state owns transport closure.
|
|
43
|
+
*/
|
|
44
|
+
const isWorkHandoff = ({ payload }) => payload._tag === "WorkerInputRequested" || payload._tag === "WorkerReportPrepared" || payload._tag === "PeerMessagePrepared" || payload._tag === "WorkerStopRequested" || payload._tag === "SubtreeBudgetReserved" || payload._tag === "SubagentRequested" || payload._tag === "AgentUpdateEmitted" && payload.delivery !== void 0;
|
|
45
|
+
/** A host can prepare independent work before the source admission ever starts a Run. */
|
|
46
|
+
const isPreContinuationFact = (record) => isWorkHandoff(record) && record.payload._tag !== "SubagentRequested" && record.payload._tag !== "AgentUpdateEmitted" || record.payload._tag === "UserInputRecorded" && record.payload.kind === "user" || record.payload._tag === "AbortRequested" || record.payload._tag === "SubmissionSettled";
|
|
47
|
+
/** Grouped usage is no larger than its original identities/components plus bounded counters. */
|
|
48
|
+
const terminalUsageCharge = (calls) => calls.reduce((bytes, call) => bytes + utf8ByteLength(JSON.stringify(call)) + 512, 0);
|
|
49
|
+
/** These facts end accepted work or durably request its termination. */
|
|
50
|
+
const isTerminalBudgetFact = ({ payload }) => payload._tag === "AbortRequested" || payload._tag === "RunFailed" || payload._tag === "RunCompleted" || payload._tag === "SubmissionSettled";
|
|
51
|
+
// src/durable/internal/record-encoding.ts
|
|
52
|
+
const encodeRecord = Schema.encodeSync(RecordEnvelope);
|
|
53
|
+
const recordLimits = {
|
|
54
|
+
depth: 68,
|
|
55
|
+
nodes: MAX_PERSISTED_JSON_NODES * 4,
|
|
56
|
+
collectionLength: MAX_PERSISTED_JSON_COLLECTION_LENGTH,
|
|
57
|
+
textUnits: MAX_CANONICAL_RECORD_BYTES
|
|
58
|
+
};
|
|
59
|
+
var RecordEncodingError = class extends Schema.TaggedError()("RecordEncodingError", {
|
|
60
|
+
message: Schema.String,
|
|
61
|
+
cause: Schema.optionalKey(Schema.Defect())
|
|
62
|
+
}) {};
|
|
63
|
+
const progressRecord = (record, bytes) => {
|
|
64
|
+
const payload = record.payload;
|
|
65
|
+
return Object.freeze({
|
|
66
|
+
recordId: record.recordId,
|
|
67
|
+
runIds: Object.freeze(executionRunIds(record)),
|
|
68
|
+
recordBytes: bytes,
|
|
69
|
+
preContinuation: isPreContinuationFact(record),
|
|
70
|
+
terminal: isTerminalBudgetFact(record),
|
|
71
|
+
terminalUsageBytes: payload._tag === "ModelResponseRecorded" || payload._tag === "ModelCallAborted" ? terminalUsageCharge(payload.modelUsage ?? []) : 0,
|
|
72
|
+
...payload._tag === "RunContinuation" ? { continuation: payload } : {}
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
const captured = /* @__PURE__ */ new WeakMap();
|
|
76
|
+
const setOwn = (target, key, value) => {
|
|
77
|
+
Object.defineProperty(target, key, {
|
|
78
|
+
value,
|
|
79
|
+
writable: true,
|
|
80
|
+
enumerable: true,
|
|
81
|
+
configurable: true
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
/** JSON arrays use indexed values, even when inherited or non-enumerable. */
|
|
85
|
+
const copyOwn = (value) => {
|
|
86
|
+
if (!Array.isArray(value)) {
|
|
87
|
+
const copy = { ...value };
|
|
88
|
+
Object.setPrototypeOf(copy, Object.getPrototypeOf(value));
|
|
89
|
+
return copy;
|
|
90
|
+
}
|
|
91
|
+
const copy = [];
|
|
92
|
+
for (let index = 0; index < value.length; index++) setOwn(copy, index, value[index]);
|
|
93
|
+
for (const key of Reflect.ownKeys(value)) if (!Object.hasOwn(copy, key) && Object.getOwnPropertyDescriptor(value, key)?.enumerable === true) setOwn(copy, key, Reflect.get(value, key));
|
|
94
|
+
return copy;
|
|
95
|
+
};
|
|
96
|
+
/** Own every fact before suspension; encoded JSON fields can share these private frozen values. */
|
|
97
|
+
const capturePayload = (payload) => {
|
|
98
|
+
const copy = { ...payload };
|
|
99
|
+
Object.setPrototypeOf(copy, Object.getPrototypeOf(payload));
|
|
100
|
+
const copies = new WeakMap([[payload, copy]]);
|
|
101
|
+
const owned = [copy];
|
|
102
|
+
for (let index = 0; index < owned.length; index++) {
|
|
103
|
+
const next = owned[index];
|
|
104
|
+
for (const key of Object.keys(next)) {
|
|
105
|
+
const value = Reflect.get(next, key);
|
|
106
|
+
if (!Predicate.isObjectOrArray(value)) continue;
|
|
107
|
+
let child = copies.get(value);
|
|
108
|
+
if (child === void 0) {
|
|
109
|
+
const created = copyOwn(value);
|
|
110
|
+
copies.set(value, created);
|
|
111
|
+
owned.push(created);
|
|
112
|
+
child = created;
|
|
113
|
+
}
|
|
114
|
+
setOwn(next, key, child);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
for (const value of owned) Object.freeze(value);
|
|
118
|
+
return {
|
|
119
|
+
payload: Object.freeze(copy),
|
|
120
|
+
copies
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
/** Schema-created structures are private; detach JSON pass-throughs using the same owned copy. */
|
|
124
|
+
const ownWire = (wire, copies) => {
|
|
125
|
+
const pending = Predicate.isObjectOrArray(wire) ? [wire] : [];
|
|
126
|
+
while (pending.length > 0) {
|
|
127
|
+
const next = pending.pop();
|
|
128
|
+
for (const key of Object.keys(next)) {
|
|
129
|
+
const value = Reflect.get(next, key);
|
|
130
|
+
if (!Predicate.isObjectOrArray(value)) continue;
|
|
131
|
+
const copy = copies.get(value);
|
|
132
|
+
if (copy !== void 0) setOwn(next, key, copy);
|
|
133
|
+
else pending.push(value);
|
|
134
|
+
}
|
|
135
|
+
Object.freeze(next);
|
|
136
|
+
}
|
|
137
|
+
return wire;
|
|
138
|
+
};
|
|
139
|
+
/** Capture at the Schema boundary; only the privately owned result can reuse its encoding. */
|
|
140
|
+
const captureRecord = (input) => {
|
|
141
|
+
try {
|
|
142
|
+
const existing = captured.get(input);
|
|
143
|
+
if (existing !== void 0) return Result.succeed(existing);
|
|
144
|
+
const encoded = encodeRecord(input);
|
|
145
|
+
const owned = capturePayload(input.payload);
|
|
146
|
+
const wire = ownWire(encoded, owned.copies);
|
|
147
|
+
const serialized = boundedCanonicalJson(wire, recordLimits);
|
|
148
|
+
if (Result.isFailure(serialized)) return Result.fail(RecordEncodingError.make({ message: serialized.failure.message }));
|
|
149
|
+
const json = serialized.success;
|
|
150
|
+
const bytes = utf8ByteLength(json);
|
|
151
|
+
if (bytes > 4194304) return Result.fail(RecordEncodingError.make({ message: "Canonical JSON exceeds its byte bound" }));
|
|
152
|
+
const createdAt = DateTime.makeUnsafe(DateTime.toEpochMillis(input.createdAt));
|
|
153
|
+
Object.freeze(DateTime.toPartsUtc(createdAt));
|
|
154
|
+
Object.freeze(createdAt);
|
|
155
|
+
const canonical = Object.freeze(RecordEnvelope.make({
|
|
156
|
+
...input,
|
|
157
|
+
createdAt,
|
|
158
|
+
payload: owned.payload
|
|
159
|
+
}, { disableChecks: true }));
|
|
160
|
+
const encoding = Object.freeze({
|
|
161
|
+
canonical,
|
|
162
|
+
wire,
|
|
163
|
+
json,
|
|
164
|
+
bytes,
|
|
165
|
+
progress: progressRecord(canonical, bytes)
|
|
166
|
+
});
|
|
167
|
+
captured.set(canonical, encoding);
|
|
168
|
+
return Result.succeed(encoding);
|
|
169
|
+
} catch (cause) {
|
|
170
|
+
return Result.fail(RecordEncodingError.make({
|
|
171
|
+
message: "Canonical record capture failed",
|
|
172
|
+
cause
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
/** Read evidence retains its original wire; fresh writes use the captured Schema encoding. */
|
|
177
|
+
const recordEncoding = (record) => {
|
|
178
|
+
const existing = captured.get(record);
|
|
179
|
+
if (existing !== void 0) return Result.succeed(existing);
|
|
180
|
+
try {
|
|
181
|
+
if (!(Schema.is(ExportedRecord)(record) && Object.prototype.isPrototypeOf.call(ExportedRecord.prototype, record))) return captureRecord(record);
|
|
182
|
+
const json = canonicalJson(record.wire);
|
|
183
|
+
const bytes = utf8ByteLength(json);
|
|
184
|
+
return Result.succeed({
|
|
185
|
+
canonical: record,
|
|
186
|
+
wire: record.wire,
|
|
187
|
+
json,
|
|
188
|
+
bytes,
|
|
189
|
+
progress: progressRecord(record, bytes)
|
|
190
|
+
});
|
|
191
|
+
} catch (cause) {
|
|
192
|
+
return Result.fail(RecordEncodingError.make({
|
|
193
|
+
message: "Canonical record encoding failed",
|
|
194
|
+
cause
|
|
195
|
+
}));
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
// src/durable/internal/transfer-dependencies.ts
|
|
199
|
+
/** Exact references outside one complete canonical batch. */
|
|
200
|
+
const transferRecordDependencies = (records) => {
|
|
201
|
+
const local = new Set(records.map((record) => record.recordId));
|
|
202
|
+
const dependencies = /* @__PURE__ */ new Set();
|
|
203
|
+
for (const { payload } of records) {
|
|
204
|
+
if (payload._tag === "WorkerInputRefused") {
|
|
205
|
+
for (const ref of [payload.reservation, payload.stop]) if (!local.has(ref.recordId)) dependencies.add(ref.recordId);
|
|
206
|
+
}
|
|
207
|
+
if (payload._tag === "WorkHandoffCompleted" && !local.has(payload.preparationId)) dependencies.add(payload.preparationId);
|
|
208
|
+
if (payload._tag === "RunContextRecorded") {
|
|
209
|
+
for (const ref of payload.retained) if (!local.has(ref.recordId)) dependencies.add(ref.recordId);
|
|
210
|
+
}
|
|
211
|
+
if (payload._tag === "RunContinuation") {
|
|
212
|
+
for (const ref of [
|
|
213
|
+
payload.originalInput,
|
|
214
|
+
payload.savedContext,
|
|
215
|
+
payload.latestResponse,
|
|
216
|
+
payload.terminal,
|
|
217
|
+
payload.lastFact
|
|
218
|
+
]) if (ref !== void 0 && !local.has(ref.recordId)) dependencies.add(ref.recordId);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return [...dependencies].sort();
|
|
222
|
+
};
|
|
223
|
+
// src/durable/ThreadStore.ts
|
|
224
|
+
var ThreadStore_exports = /* @__PURE__ */ __exportAll({
|
|
225
|
+
AppendConflict: () => AppendConflict,
|
|
226
|
+
AppendRequest: () => AppendRequest,
|
|
227
|
+
AppendResult: () => AppendResult,
|
|
228
|
+
CommitBatch: () => CommitBatch,
|
|
229
|
+
ExecutionCheckpoint: () => ExecutionCheckpoint,
|
|
230
|
+
ExecutionRead: () => ExecutionRead,
|
|
231
|
+
ExecutionUpdate: () => ExecutionUpdate,
|
|
232
|
+
FreshRunRead: () => FreshRunRead,
|
|
233
|
+
MAX_PROMPT_CHECKPOINT_BYTES: () => MAX_PROMPT_CHECKPOINT_BYTES,
|
|
234
|
+
MAX_PROMPT_CHECKPOINT_RUNS: () => 16,
|
|
235
|
+
MAX_THREAD_EXPORT_CURSOR_CHARS: () => MAX_THREAD_EXPORT_CURSOR_CHARS,
|
|
236
|
+
MAX_THREAD_EXPORT_PAGE_BYTES: () => MAX_THREAD_EXPORT_PAGE_BYTES,
|
|
237
|
+
MAX_THREAD_EXPORT_PAGE_RECORDS: () => 256,
|
|
238
|
+
PROMPT_EVIDENCE_TAGS: () => PROMPT_EVIDENCE_TAGS,
|
|
239
|
+
PreparedAppend: () => PreparedAppend,
|
|
240
|
+
PromptCheckpoint: () => PromptCheckpoint,
|
|
241
|
+
PromptCheckpointHead: () => PromptCheckpointHead,
|
|
242
|
+
PromptCheckpointRead: () => PromptCheckpointRead,
|
|
243
|
+
SelectedThreadRead: () => SelectedThreadRead,
|
|
244
|
+
ThreadAbortFact: () => ThreadAbortFact,
|
|
245
|
+
ThreadAdmission: () => ThreadAdmission,
|
|
246
|
+
ThreadApprovalFact: () => ThreadApprovalFact,
|
|
247
|
+
ThreadCommands: () => ThreadCommands,
|
|
248
|
+
ThreadExport: () => ThreadExport,
|
|
249
|
+
ThreadExportBatch: () => ThreadExportBatch,
|
|
250
|
+
ThreadExportCursor: () => ThreadExportCursor,
|
|
251
|
+
ThreadExportRecord: () => ThreadExportRecord,
|
|
252
|
+
ThreadExportRejected: () => ThreadExportRejected,
|
|
253
|
+
ThreadExportRequest: () => ThreadExportRequest,
|
|
254
|
+
ThreadExportSnapshot: () => ThreadExportSnapshot,
|
|
255
|
+
ThreadExportSource: () => ThreadExportSource,
|
|
256
|
+
ThreadIdentity: () => ThreadIdentity,
|
|
257
|
+
ThreadIdentityRequest: () => ThreadIdentityRequest,
|
|
258
|
+
ThreadMaterialization: () => ThreadMaterialization,
|
|
259
|
+
ThreadNotMaterialized: () => ThreadNotMaterialized,
|
|
260
|
+
ThreadObservation: () => ThreadObservation,
|
|
261
|
+
ThreadPeerCountRequest: () => ThreadPeerCountRequest,
|
|
262
|
+
ThreadPromptRead: () => ThreadPromptRead,
|
|
263
|
+
ThreadRead: () => ThreadRead,
|
|
264
|
+
ThreadReadRequest: () => ThreadReadRequest,
|
|
265
|
+
ThreadReader: () => ThreadReader,
|
|
266
|
+
ThreadRecordRequest: () => ThreadRecordRequest,
|
|
267
|
+
ThreadResolutionFact: () => ThreadResolutionFact,
|
|
268
|
+
ThreadRunInputRequest: () => ThreadRunInputRequest,
|
|
269
|
+
ThreadSelection: () => ThreadSelection,
|
|
270
|
+
ThreadStore: () => ThreadStore,
|
|
271
|
+
ThreadStoreDiagnostic: () => ThreadStoreDiagnostic,
|
|
272
|
+
ThreadStoreError: () => ThreadStoreError,
|
|
273
|
+
ThreadTail: () => ThreadTail,
|
|
274
|
+
ThreadTailRequest: () => ThreadTailRequest,
|
|
275
|
+
ThreadVerificationRequest: () => ThreadVerificationRequest,
|
|
276
|
+
ThreadWorkerCapacity: () => ThreadWorkerCapacity,
|
|
277
|
+
ThreadWorkerCapacityRequest: () => ThreadWorkerCapacityRequest,
|
|
278
|
+
ThreadWorkerSeal: () => ThreadWorkerSeal,
|
|
279
|
+
ThreadWorkerStateRequest: () => ThreadWorkerStateRequest,
|
|
280
|
+
canonicalBatchFitsTransfer: () => canonicalBatchFitsTransfer,
|
|
281
|
+
getRecord: () => getRecord,
|
|
282
|
+
getRunInput: () => getRunInput,
|
|
283
|
+
makeTransferFactCheck: () => makeTransferFactCheck,
|
|
284
|
+
readWorkerState: () => readWorkerState,
|
|
285
|
+
streamExport: () => streamExport,
|
|
286
|
+
transferPageFits: () => transferPageFits
|
|
287
|
+
});
|
|
288
|
+
const MAX_THREAD_EXPORT_PAGE_RECORDS = 256;
|
|
289
|
+
const MAX_THREAD_EXPORT_PAGE_BYTES = 33554432;
|
|
290
|
+
const MAX_THREAD_EXPORT_CURSOR_CHARS = 16384;
|
|
291
|
+
/** Includes a maximally JSON-escaped cursor, snapshot, seal, digests and page structure. */
|
|
292
|
+
const THREAD_EXPORT_METADATA_BYTES = 131072;
|
|
293
|
+
/** Reserve the manifest identity even when no canonical record or admission exists yet. */
|
|
294
|
+
const transferPageFits = (threadId, factBytes = 0) => utf8ByteLength(JSON.stringify(threadId)) + factBytes + THREAD_EXPORT_METADATA_BYTES <= MAX_THREAD_EXPORT_PAGE_BYTES;
|
|
295
|
+
/** Check a complete retained fact before fresh acceptance; existing replays keep their identity. */
|
|
296
|
+
const makeTransferFactCheck = (schema) => {
|
|
297
|
+
const encode = Schema.encodeResult(Schema.fromJsonString(schema));
|
|
298
|
+
return (threadId, fact) => {
|
|
299
|
+
const encoded = encode(fact);
|
|
300
|
+
return Result.isSuccess(encoded) && transferPageFits(threadId, utf8ByteLength(encoded.success));
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
/** Counts of closed owner facts, computed only when an idle export begins. */
|
|
304
|
+
const ThreadExportSnapshot = Schema.Struct({
|
|
305
|
+
admissions: Schema.Natural,
|
|
306
|
+
aborts: Schema.Natural,
|
|
307
|
+
approvals: Schema.Natural,
|
|
308
|
+
resolutions: Schema.Natural,
|
|
309
|
+
deliveries: Schema.Natural
|
|
310
|
+
});
|
|
311
|
+
/** Irreversible Thread-local admission restriction, independent of claims and worker completion. */
|
|
312
|
+
const ThreadWorkerSeal = Schema.Struct({ terminal: Schema.optionalKey(AssignmentTerminal) });
|
|
313
|
+
/** Opaque, snapshot-bound transfer position. Only the exporting adapter constructs it. */
|
|
314
|
+
const ThreadExportCursor = Schema.NonEmptyString.check(Schema.isMaxLength(MAX_THREAD_EXPORT_CURSOR_CHARS));
|
|
315
|
+
/** Exact canonical identity; absence is not proof that an admission was never accepted. */
|
|
316
|
+
const ThreadRecordRequest = Schema.Struct({
|
|
317
|
+
threadId: ThreadId,
|
|
318
|
+
recordId: RecordId
|
|
319
|
+
});
|
|
320
|
+
/** The original user input for a Run, excluding later joined inputs. */
|
|
321
|
+
const ThreadRunInputRequest = Schema.Struct({
|
|
322
|
+
threadId: ThreadId,
|
|
323
|
+
runId: RunId
|
|
324
|
+
});
|
|
325
|
+
/** Native accounting for one funding Run; settled Thread history is never included. */
|
|
326
|
+
const ThreadWorkerStateRequest = Schema.Struct({
|
|
327
|
+
threadId: ThreadId,
|
|
328
|
+
sourceSubmissionId: Schema.optionalKey(SubmissionId),
|
|
329
|
+
limit: Schema.Int.check(Schema.isGreaterThan(0), Schema.isLessThanOrEqualTo(16384))
|
|
330
|
+
});
|
|
331
|
+
/** Saturating count of outstanding peer deliveries and terminal rows inside their retention window. */
|
|
332
|
+
const ThreadPeerCountRequest = Schema.Struct({
|
|
333
|
+
threadId: ThreadId,
|
|
334
|
+
nowMillis: ScheduleInstant,
|
|
335
|
+
limit: Schema.Int.check(Schema.isGreaterThan(0), Schema.isLessThanOrEqualTo(1e3))
|
|
336
|
+
});
|
|
337
|
+
/** Capacity is derived from unresolved canonical obligations at this exact tail. */
|
|
338
|
+
const ThreadWorkerCapacityRequest = Schema.Struct({
|
|
339
|
+
threadId: ThreadId,
|
|
340
|
+
workerThreadId: ThreadId,
|
|
341
|
+
expectedTailSequence: CanonicalSequence,
|
|
342
|
+
update: Schema.Boolean,
|
|
343
|
+
activeLimit: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(100)),
|
|
344
|
+
pendingLimit: Schema.Int.check(Schema.isGreaterThan(0), Schema.isLessThanOrEqualTo(100))
|
|
345
|
+
});
|
|
346
|
+
const ThreadWorkerCapacity = Schema.Struct({
|
|
347
|
+
threadId: ThreadId,
|
|
348
|
+
tailSequence: CanonicalSequence,
|
|
349
|
+
/** min(actual distinct workers, activeLimit + 1); equality remains distinguishable. */
|
|
350
|
+
activeWorkers: Schema.Natural.check(Schema.isLessThanOrEqualTo(101)),
|
|
351
|
+
workerActive: Schema.Boolean,
|
|
352
|
+
/** min(actual inputs in the requested partition, pendingLimit + 1). */
|
|
353
|
+
pendingInputs: Schema.Natural.check(Schema.isLessThanOrEqualTo(101))
|
|
354
|
+
});
|
|
355
|
+
/** Explicit maintenance may traverse all pages while retaining only one bounded page or Run. */
|
|
356
|
+
const ThreadVerificationRequest = Schema.Struct({
|
|
357
|
+
threadId: ThreadId,
|
|
358
|
+
requireAllSettled: Schema.optionalKey(Schema.Boolean)
|
|
359
|
+
});
|
|
360
|
+
const incomplete = (operation) => ThreadStoreError.make({
|
|
361
|
+
operation,
|
|
362
|
+
message: "Native canonical read is incomplete or corrupt"
|
|
363
|
+
});
|
|
364
|
+
/** Collect a complete bounded selection, using canonical sequence as a sparse cursor. */
|
|
365
|
+
const selectedRecords = Effect.fnUntraced(function* (threadId, selection, limit) {
|
|
366
|
+
const store = yield* ThreadReader;
|
|
367
|
+
const records = [];
|
|
368
|
+
let bytes = 0;
|
|
369
|
+
let afterSequence;
|
|
370
|
+
while (true) {
|
|
371
|
+
const pageLimit = Math.min(8, limit + 1 - records.length);
|
|
372
|
+
const page = yield* Stream.runCollect(store.read({
|
|
373
|
+
threadId,
|
|
374
|
+
selection,
|
|
375
|
+
page: {
|
|
376
|
+
limit: pageLimit,
|
|
377
|
+
...afterSequence === void 0 ? {} : { afterSequence }
|
|
378
|
+
}
|
|
379
|
+
}));
|
|
380
|
+
for (const entry of page) {
|
|
381
|
+
if (entry.threadId !== threadId || entry.sequence <= (afterSequence ?? 0) || "expectedTailSequence" in selection && entry.sequence > selection.expectedTailSequence) return yield* incomplete("read selection identity");
|
|
382
|
+
afterSequence = entry.sequence;
|
|
383
|
+
bytes += yield* Effect.fromResult(recordEncoding(entry.record)).pipe(Effect.map((record) => record.bytes), Effect.mapError(() => incomplete("read selection bytes")));
|
|
384
|
+
if (bytes > 33554432) return yield* incomplete("read selection byte limit");
|
|
385
|
+
records.push(entry);
|
|
386
|
+
}
|
|
387
|
+
if (page.length > pageLimit || records.length > limit) return yield* incomplete("read selection limit");
|
|
388
|
+
if (page.length < pageLimit) return records;
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
/** Host-owned read: authenticate the Thread and exact locator before calling. */
|
|
392
|
+
const getRecord = Effect.fnUntraced(function* (request) {
|
|
393
|
+
yield* Schema.decodeEffect(ThreadRecordRequest)(request).pipe(Effect.mapError(() => incomplete("getRecord request")));
|
|
394
|
+
const records = yield* selectedRecords(request.threadId, {
|
|
395
|
+
_tag: "RecordId",
|
|
396
|
+
recordId: request.recordId
|
|
397
|
+
}, 1);
|
|
398
|
+
if (records.some((entry) => entry.record.recordId !== request.recordId)) return yield* incomplete("getRecord identity");
|
|
399
|
+
return Option.fromUndefinedOr(records[0]);
|
|
400
|
+
});
|
|
401
|
+
const getRunInput = Effect.fnUntraced(function* (request) {
|
|
402
|
+
yield* Schema.decodeEffect(ThreadRunInputRequest)(request).pipe(Effect.mapError(() => incomplete("getRunInput request")));
|
|
403
|
+
const records = yield* selectedRecords(request.threadId, {
|
|
404
|
+
_tag: "RunInput",
|
|
405
|
+
runId: request.runId
|
|
406
|
+
}, 1);
|
|
407
|
+
if (records.some(({ record: { payload } }) => payload._tag !== "UserInputRecorded" || payload.kind !== "user" || payload.runId !== request.runId)) return yield* incomplete("getRunInput identity");
|
|
408
|
+
return Option.fromUndefinedOr(records[0]);
|
|
409
|
+
});
|
|
410
|
+
/** A bounded snapshot of source identity and the selected funding Run's accounting. */
|
|
411
|
+
const readWorkerState = Effect.fnUntraced(function* (request) {
|
|
412
|
+
yield* Schema.decodeEffect(ThreadWorkerStateRequest)(request).pipe(Effect.mapError(() => incomplete("readWorkerState request")));
|
|
413
|
+
const tail = yield* (yield* ThreadReader).inspectTail(ThreadTailRequest.make({ threadId: request.threadId }));
|
|
414
|
+
const records = yield* selectedRecords(request.threadId, {
|
|
415
|
+
_tag: "WorkerState",
|
|
416
|
+
expectedTailSequence: tail.tailSequence,
|
|
417
|
+
...request.sourceSubmissionId === void 0 ? {} : { sourceSubmissionId: request.sourceSubmissionId }
|
|
418
|
+
}, request.limit);
|
|
419
|
+
return {
|
|
420
|
+
threadId: request.threadId,
|
|
421
|
+
tailSequence: tail.tailSequence,
|
|
422
|
+
records
|
|
423
|
+
};
|
|
424
|
+
});
|
|
425
|
+
var ThreadMaterialization = class extends Schema.Class("@effect-agent/thread/ThreadMaterialization")({ threadId: ThreadId }) {};
|
|
426
|
+
const isExecutionProgressRecord = (record) => record.payload._tag === "RunContinuation";
|
|
427
|
+
const ExecutionProgressRecord = RecordEnvelope.pipe(Schema.refine(isExecutionProgressRecord, { message: "Expected a Run continuation record" }));
|
|
428
|
+
/** Current interpreter state. Wire version 2 retains one copy of its continuation. */
|
|
429
|
+
var ExecutionCheckpoint = class extends Schema.Class("@effect-agent/thread/ExecutionCheckpoint")({
|
|
430
|
+
version: Schema.Literal(2),
|
|
431
|
+
/** Logical progress encoding is charged while active; previous revisions are discarded. */
|
|
432
|
+
progressRecord: ExecutionProgressRecord,
|
|
433
|
+
/** Original start, evaluated context and validated completion intent while the Run is active. */
|
|
434
|
+
operational: Schema.Array(RecordEnvelope).check(Schema.isMaxLength(8)),
|
|
435
|
+
canonicalRecords: Schema.Natural,
|
|
436
|
+
/** Stable admitted-input position also supplies a bounded transfer cursor. */
|
|
437
|
+
originalSequence: CanonicalSequence.check(Schema.isGreaterThan(0)),
|
|
438
|
+
throughSequence: CanonicalSequence,
|
|
439
|
+
batchId: BatchId
|
|
440
|
+
}) {
|
|
441
|
+
/** View of the retained payload, not a second encoded field. */
|
|
442
|
+
get progress() {
|
|
443
|
+
return this.progressRecord.payload;
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
/** A revision-checked transition committed by the same owner as the retained history facts. */
|
|
447
|
+
var ExecutionUpdate = class extends Schema.Class("@effect-agent/thread/ExecutionUpdate")({
|
|
448
|
+
previousRevision: Schema.Natural,
|
|
449
|
+
checkpoint: ExecutionCheckpoint,
|
|
450
|
+
/** Newly durable operational facts; capture and validate these before entering the writer. */
|
|
451
|
+
facts: Schema.Array(RecordEnvelope).check(Schema.isMaxLength(8)),
|
|
452
|
+
/** Delete current Run state in the same transaction as its authorized terminal publication. */
|
|
453
|
+
retire: Schema.Boolean
|
|
454
|
+
}) {};
|
|
455
|
+
/** A progress-only commit has no canonical records and does not advance the history tail. */
|
|
456
|
+
var CommitBatch = class extends Schema.Class("@effect-agent/thread/CommitBatch")({
|
|
457
|
+
batchId: BatchId,
|
|
458
|
+
producerId: ProducerId,
|
|
459
|
+
records: Schema.Array(RecordEnvelope).check(Schema.isMaxLength(256))
|
|
460
|
+
}) {};
|
|
461
|
+
var ExecutionRead = class extends Schema.Class("@effect-agent/thread/ExecutionRead")({
|
|
462
|
+
threadId: ThreadId,
|
|
463
|
+
runId: RunId
|
|
464
|
+
}) {};
|
|
465
|
+
var AppendRequest = class extends Schema.Class("@effect-agent/thread/AppendRequest")({
|
|
466
|
+
threadId: ThreadId,
|
|
467
|
+
batch: CommitBatch,
|
|
468
|
+
executions: Schema.optionalKey(Schema.Array(ExecutionUpdate).check(Schema.isMaxLength(256))),
|
|
469
|
+
expectedTailSequence: CanonicalSequence
|
|
470
|
+
}) {};
|
|
471
|
+
const RecordCount = Schema.Array(Schema.Unknown).check(Schema.isMaxLength(256));
|
|
472
|
+
const ExecutionRecordCount = Schema.Array(Schema.Unknown).check(Schema.isMaxLength(8));
|
|
473
|
+
const AppendHeader = Schema.Struct({
|
|
474
|
+
threadId: ThreadId,
|
|
475
|
+
expectedTailSequence: CanonicalSequence,
|
|
476
|
+
batchId: BatchId,
|
|
477
|
+
producerId: ProducerId,
|
|
478
|
+
records: RecordCount,
|
|
479
|
+
executions: RecordCount
|
|
480
|
+
});
|
|
481
|
+
const validateHeader = Schema.decodeUnknownSync(AppendHeader);
|
|
482
|
+
const validateExecutionHeader = Schema.decodeUnknownSync(Schema.Struct({
|
|
483
|
+
previousRevision: ExecutionUpdate.fields.previousRevision,
|
|
484
|
+
retire: ExecutionUpdate.fields.retire,
|
|
485
|
+
checkpoint: Schema.Struct({
|
|
486
|
+
version: ExecutionCheckpoint.fields.version,
|
|
487
|
+
canonicalRecords: ExecutionCheckpoint.fields.canonicalRecords,
|
|
488
|
+
originalSequence: ExecutionCheckpoint.fields.originalSequence,
|
|
489
|
+
throughSequence: ExecutionCheckpoint.fields.throughSequence,
|
|
490
|
+
batchId: ExecutionCheckpoint.fields.batchId,
|
|
491
|
+
operational: ExecutionRecordCount
|
|
492
|
+
}),
|
|
493
|
+
facts: ExecutionRecordCount
|
|
494
|
+
}));
|
|
495
|
+
/** Capture records once; wrapper fields retain their owning Schema's constraints. */
|
|
496
|
+
const captureExecution = (input) => {
|
|
497
|
+
const checkpointInput = input.checkpoint;
|
|
498
|
+
const operationalInput = checkpointInput.operational;
|
|
499
|
+
const factsInput = input.facts;
|
|
500
|
+
const header = validateExecutionHeader({
|
|
501
|
+
previousRevision: input.previousRevision,
|
|
502
|
+
retire: input.retire,
|
|
503
|
+
checkpoint: {
|
|
504
|
+
version: checkpointInput.version,
|
|
505
|
+
canonicalRecords: checkpointInput.canonicalRecords,
|
|
506
|
+
originalSequence: checkpointInput.originalSequence,
|
|
507
|
+
throughSequence: checkpointInput.throughSequence,
|
|
508
|
+
batchId: checkpointInput.batchId,
|
|
509
|
+
operational: operationalInput
|
|
510
|
+
},
|
|
511
|
+
facts: factsInput
|
|
512
|
+
});
|
|
513
|
+
const operationalLength = header.checkpoint.operational.length;
|
|
514
|
+
const factsLength = header.facts.length;
|
|
515
|
+
const progress = captureRecord(checkpointInput.progressRecord);
|
|
516
|
+
if (Result.isFailure(progress)) return Result.fail(progress.failure);
|
|
517
|
+
const progressRecord = progress.success.canonical;
|
|
518
|
+
if (!isExecutionProgressRecord(progressRecord)) return Result.fail(ThreadStoreError.make({
|
|
519
|
+
operation: "prepare durable commit",
|
|
520
|
+
message: "Expected a Run continuation record"
|
|
521
|
+
}));
|
|
522
|
+
const operational = [];
|
|
523
|
+
for (let index = 0; index < operationalLength; index++) {
|
|
524
|
+
const record = captureRecord(operationalInput[index]);
|
|
525
|
+
if (Result.isFailure(record)) return Result.fail(record.failure);
|
|
526
|
+
operational.push(record.success);
|
|
527
|
+
}
|
|
528
|
+
const facts = [];
|
|
529
|
+
for (let index = 0; index < factsLength; index++) {
|
|
530
|
+
const record = captureRecord(factsInput[index]);
|
|
531
|
+
if (Result.isFailure(record)) return Result.fail(record.failure);
|
|
532
|
+
facts.push(record.success);
|
|
533
|
+
}
|
|
534
|
+
const checkpoint = Object.freeze(ExecutionCheckpoint.make({
|
|
535
|
+
...header.checkpoint,
|
|
536
|
+
progressRecord,
|
|
537
|
+
operational: Object.freeze(operational.map(({ canonical }) => canonical))
|
|
538
|
+
}, { disableChecks: true }));
|
|
539
|
+
const update = Object.freeze(ExecutionUpdate.make({
|
|
540
|
+
previousRevision: header.previousRevision,
|
|
541
|
+
retire: header.retire,
|
|
542
|
+
checkpoint,
|
|
543
|
+
facts: Object.freeze(facts.map(({ canonical }) => canonical))
|
|
544
|
+
}, { disableChecks: true }));
|
|
545
|
+
const checkpointJson = `{"version":${checkpoint.version},"progressRecord":${progress.success.json},"operational":[${operational.map(({ json }) => json).join(",")}],"canonicalRecords":${checkpoint.canonicalRecords},"originalSequence":${checkpoint.originalSequence},"throughSequence":${checkpoint.throughSequence},"batchId":${JSON.stringify(checkpoint.batchId)}}`;
|
|
546
|
+
const json = `{"previousRevision":${update.previousRevision},"checkpoint":${checkpointJson},"facts":[${facts.map(({ json }) => json).join(",")}],"retire":${update.retire}}`;
|
|
547
|
+
return Result.succeed(Object.freeze({
|
|
548
|
+
update,
|
|
549
|
+
json,
|
|
550
|
+
checkpointJson,
|
|
551
|
+
factsJson: JSON.stringify(facts.map(({ wire }) => wire)),
|
|
552
|
+
bytes: utf8ByteLength(json)
|
|
553
|
+
}));
|
|
554
|
+
};
|
|
555
|
+
const capturedAppends = /* @__PURE__ */ new WeakMap();
|
|
556
|
+
/**
|
|
557
|
+
* Admission reserves one complete batch's envelope, references, snapshot and continuation cursor.
|
|
558
|
+
* Adapters supply their native offset byte bound. Dependency literals already occur in record
|
|
559
|
+
* wire, so ordinary batches need only arithmetic; near the page limit, charge the exact references.
|
|
560
|
+
*/
|
|
561
|
+
const canonicalBatchFitsTransfer = (threadId, batch, batchBytes, maxOffsetBytes) => {
|
|
562
|
+
const threadJson = JSON.stringify(threadId);
|
|
563
|
+
const threadBytes = utf8ByteLength(threadJson);
|
|
564
|
+
const batchIdBytes = utf8ByteLength(JSON.stringify(batch.batchId));
|
|
565
|
+
const overhead = batch.records.length * (batchIdBytes + threadBytes + maxOffsetBytes + 128) + threadBytes + THREAD_EXPORT_METADATA_BYTES;
|
|
566
|
+
if (2 * batchBytes + overhead + 2 <= 33554432) return true;
|
|
567
|
+
const dependencyBytes = utf8ByteLength(JSON.stringify(transferRecordDependencies(batch.records)));
|
|
568
|
+
return batchBytes + overhead + dependencyBytes <= MAX_THREAD_EXPORT_PAGE_BYTES;
|
|
569
|
+
};
|
|
570
|
+
const PreparedAppend = { capture: (input) => Effect.suspend(() => {
|
|
571
|
+
const existing = capturedAppends.get(input);
|
|
572
|
+
if (existing !== void 0) return Effect.succeed(existing);
|
|
573
|
+
return Effect.try({
|
|
574
|
+
try: () => Result.gen(function* () {
|
|
575
|
+
const executions = input.executions ?? [];
|
|
576
|
+
const recordInputs = input.batch.records;
|
|
577
|
+
const header = validateHeader({
|
|
578
|
+
...input,
|
|
579
|
+
batchId: input.batch.batchId,
|
|
580
|
+
producerId: input.batch.producerId,
|
|
581
|
+
records: recordInputs,
|
|
582
|
+
executions
|
|
583
|
+
});
|
|
584
|
+
const recordLength = header.records.length;
|
|
585
|
+
const executionLength = header.executions.length;
|
|
586
|
+
const executionWrites = [];
|
|
587
|
+
for (let index = 0; index < executionLength; index++) executionWrites.push(yield* captureExecution(executions[index]));
|
|
588
|
+
Object.freeze(executionWrites);
|
|
589
|
+
if (recordLength === 0 && executionWrites.length === 0) return yield* Result.fail(ThreadStoreError.make({
|
|
590
|
+
operation: "prepare durable commit",
|
|
591
|
+
message: "A commit must contain history facts or an active execution transition"
|
|
592
|
+
}));
|
|
593
|
+
if (executionWrites.some(({ bytes }) => !transferPageFits(header.threadId, bytes))) return yield* Result.fail(ThreadStoreError.make({
|
|
594
|
+
operation: "prepare durable commit",
|
|
595
|
+
message: "Active state exceeds its bounded transfer representation"
|
|
596
|
+
}));
|
|
597
|
+
const encodings = [];
|
|
598
|
+
for (let index = 0; index < recordLength; index++) encodings.push(yield* captureRecord(recordInputs[index]));
|
|
599
|
+
const prefix = `{"batchId":${JSON.stringify(header.batchId)},"producerId":${JSON.stringify(header.producerId)},"records":[`;
|
|
600
|
+
const batchJson = `${prefix}${encodings.map(({ json }) => json).join(",")}]}`;
|
|
601
|
+
const batchBytes = encodings.reduce((total, record) => total + record.bytes, utf8ByteLength(prefix) + (encodings.length === 0 ? 2 : encodings.length + 1));
|
|
602
|
+
if (batchBytes > 16777216) return yield* Result.fail(ThreadStoreError.make({
|
|
603
|
+
operation: "prepare canonical append",
|
|
604
|
+
message: `Canonical batch exceeds ${MAX_CANONICAL_BATCH_BYTES} bytes`
|
|
605
|
+
}));
|
|
606
|
+
const batch = Object.freeze(CommitBatch.make({
|
|
607
|
+
batchId: header.batchId,
|
|
608
|
+
producerId: header.producerId,
|
|
609
|
+
records: Object.freeze(encodings.map(({ canonical }) => canonical))
|
|
610
|
+
}, { disableChecks: true }));
|
|
611
|
+
const request = AppendRequest.make({
|
|
612
|
+
threadId: header.threadId,
|
|
613
|
+
expectedTailSequence: header.expectedTailSequence,
|
|
614
|
+
batch,
|
|
615
|
+
...executionWrites.length === 0 ? {} : { executions: Object.freeze(executionWrites.map(({ update }) => update)) }
|
|
616
|
+
}, { disableChecks: true });
|
|
617
|
+
const records = Object.freeze(encodings.map(({ canonical, json, wire, bytes }) => Object.freeze({
|
|
618
|
+
recordId: canonical.recordId,
|
|
619
|
+
recordJson: json,
|
|
620
|
+
recordBytes: bytes,
|
|
621
|
+
wire,
|
|
622
|
+
canonical
|
|
623
|
+
})));
|
|
624
|
+
const progress = Object.freeze(encodings.map(({ progress }) => progress));
|
|
625
|
+
const captured = Object.freeze(Object.assign(request, {
|
|
626
|
+
batchJson,
|
|
627
|
+
batchBytes,
|
|
628
|
+
records,
|
|
629
|
+
progress,
|
|
630
|
+
executionWrites
|
|
631
|
+
}));
|
|
632
|
+
capturedAppends.set(captured, captured);
|
|
633
|
+
return captured;
|
|
634
|
+
}),
|
|
635
|
+
catch: (cause) => Schema.is(ThreadStoreError)(cause) ? cause : ThreadStoreError.make({
|
|
636
|
+
operation: "prepare canonical append",
|
|
637
|
+
message: Schema.isSchemaError(cause) ? cause.message : "Canonical append capture failed",
|
|
638
|
+
cause
|
|
639
|
+
})
|
|
640
|
+
}).pipe(Effect.flatMap(Effect.fromResult), Effect.mapError((cause) => Schema.is(ThreadStoreError)(cause) ? cause : ThreadStoreError.make({
|
|
641
|
+
operation: "prepare canonical append",
|
|
642
|
+
message: cause.message,
|
|
643
|
+
cause
|
|
644
|
+
})));
|
|
645
|
+
}) };
|
|
646
|
+
var AppendResult = class extends Schema.Class("@effect-agent/thread/AppendResult")({
|
|
647
|
+
firstSequence: CanonicalSequence,
|
|
648
|
+
lastSequence: CanonicalSequence,
|
|
649
|
+
replayed: Schema.Boolean
|
|
650
|
+
}) {};
|
|
651
|
+
var ThreadRead = class extends Schema.Class("@effect-agent/thread/ThreadRead")({
|
|
652
|
+
threadId: ThreadId,
|
|
653
|
+
afterSequence: Schema.optionalKey(CanonicalSequence),
|
|
654
|
+
limit: Schema.Natural.check(Schema.isGreaterThan(0), Schema.isLessThanOrEqualTo(1024))
|
|
655
|
+
}) {};
|
|
656
|
+
/** Sparse ordered history page at a fixed tail; no record-count limit on the whole range. */
|
|
657
|
+
const ThreadPromptRead = Schema.Struct({
|
|
658
|
+
...ThreadRead.fields,
|
|
659
|
+
throughSequence: CanonicalSequence
|
|
660
|
+
});
|
|
661
|
+
/** Closed native selections; mutable metadata is read at this exact canonical tail. */
|
|
662
|
+
const ThreadSelection = Schema.Union([
|
|
663
|
+
Schema.TaggedStruct("RecordId", { recordId: RecordId }),
|
|
664
|
+
Schema.TaggedStruct("RunInput", { runId: RunId }),
|
|
665
|
+
Schema.TaggedStruct("ToolDeclaration", {
|
|
666
|
+
settlementRecordId: RecordId,
|
|
667
|
+
throughSequence: CanonicalSequence
|
|
668
|
+
}),
|
|
669
|
+
Schema.TaggedStruct("RunEvidence", {
|
|
670
|
+
runId: RunId,
|
|
671
|
+
submissionId: SubmissionId,
|
|
672
|
+
throughSequence: CanonicalSequence
|
|
673
|
+
}),
|
|
674
|
+
Schema.TaggedStruct("OperationEvidence", {
|
|
675
|
+
runId: RunId,
|
|
676
|
+
toolCallId: ToolCallId,
|
|
677
|
+
originRecordId: RecordId,
|
|
678
|
+
approvalToolCallIds: Schema.Array(ToolCallId).check(Schema.isMinLength(1), Schema.isMaxLength(MAX_RUN_TOOL_CALL_IDENTITIES), Schema.makeFilter((ids) => new Set(ids).size === ids.length)),
|
|
679
|
+
throughSequence: CanonicalSequence
|
|
680
|
+
}).check(Schema.makeFilter((selection) => selection.approvalToolCallIds.includes(selection.toolCallId))),
|
|
681
|
+
Schema.TaggedStruct("LastAgentUpdate", { throughSequence: CanonicalSequence }),
|
|
682
|
+
Schema.TaggedStruct("PromptEvidence", { throughSequence: CanonicalSequence }),
|
|
683
|
+
Schema.TaggedStruct("LatestModelCompleted", { throughSequence: CanonicalSequence }),
|
|
684
|
+
Schema.TaggedStruct("LatestApplicationInput", { throughSequence: CanonicalSequence }),
|
|
685
|
+
Schema.TaggedStruct("DurableHistoryOwner", { throughSequence: CanonicalSequence }),
|
|
686
|
+
Schema.TaggedStruct("ContextWindowBoundary", {
|
|
687
|
+
atSequence: CanonicalSequence,
|
|
688
|
+
throughSequence: CanonicalSequence
|
|
689
|
+
}),
|
|
690
|
+
Schema.TaggedStruct("DeliveryPredecessor", { throughSequence: CanonicalSequence }),
|
|
691
|
+
Schema.TaggedStruct("WorkHandoffs", { throughSequence: CanonicalSequence }),
|
|
692
|
+
Schema.TaggedStruct("LiveWorkerInputs", {
|
|
693
|
+
throughSequence: CanonicalSequence,
|
|
694
|
+
workerThreadId: Schema.optionalKey(ThreadId)
|
|
695
|
+
}),
|
|
696
|
+
Schema.TaggedStruct("WorkerStop", {
|
|
697
|
+
workerThreadId: ThreadId,
|
|
698
|
+
throughSequence: CanonicalSequence
|
|
699
|
+
}),
|
|
700
|
+
Schema.TaggedStruct("WorkerExecution", { expectedTailSequence: CanonicalSequence }),
|
|
701
|
+
Schema.TaggedStruct("WorkerState", {
|
|
702
|
+
expectedTailSequence: CanonicalSequence,
|
|
703
|
+
sourceSubmissionId: Schema.optionalKey(SubmissionId)
|
|
704
|
+
})
|
|
705
|
+
]);
|
|
706
|
+
/** Nested page makes an old ThreadRead decoder reject, never strip a selection into history. */
|
|
707
|
+
const SelectedThreadRead = Schema.Struct({
|
|
708
|
+
threadId: ThreadId,
|
|
709
|
+
selection: ThreadSelection,
|
|
710
|
+
page: Schema.Struct({
|
|
711
|
+
afterSequence: Schema.optionalKey(CanonicalSequence),
|
|
712
|
+
limit: ThreadRead.fields.limit
|
|
713
|
+
})
|
|
714
|
+
});
|
|
715
|
+
const ThreadReadRequest = Schema.Union([SelectedThreadRead, ThreadRead]);
|
|
716
|
+
var ThreadObservation = class extends Schema.Class("@effect-agent/thread/ThreadObservation")({
|
|
717
|
+
threadId: ThreadId,
|
|
718
|
+
afterOffset: Schema.optionalKey(ObservationOffset)
|
|
719
|
+
}) {};
|
|
720
|
+
var ThreadExportRequest = class extends Schema.Class("@effect-agent/thread/ThreadExportRequest")({
|
|
721
|
+
threadId: ThreadId,
|
|
722
|
+
cursor: Schema.optionalKey(ThreadExportCursor)
|
|
723
|
+
}) {};
|
|
724
|
+
var ThreadTailRequest = class extends Schema.Class("@effect-agent/thread/ThreadTailRequest")({ threadId: ThreadId }) {};
|
|
725
|
+
/**
|
|
726
|
+
* The committed tail of one Thread Log. A resuming producer composes its next
|
|
727
|
+
* AppendRequest from this value instead of exporting the whole log.
|
|
728
|
+
*/
|
|
729
|
+
var ThreadTail = class extends Schema.Class("@effect-agent/thread/ThreadTail")({
|
|
730
|
+
threadId: ThreadId,
|
|
731
|
+
tailSequence: CanonicalSequence
|
|
732
|
+
}) {};
|
|
733
|
+
var ThreadIdentityRequest = class extends Schema.Class("@effect-agent/thread/ThreadIdentityRequest")({ threadId: ThreadId }) {};
|
|
734
|
+
var FreshRunRead = class extends Schema.Class("@effect-agent/thread/FreshRunRead")({
|
|
735
|
+
threadId: ThreadId,
|
|
736
|
+
submissionId: SubmissionId
|
|
737
|
+
}) {};
|
|
738
|
+
/**
|
|
739
|
+
* One consistent snapshot: Thread ID, canonical tail, admission presence, first record,
|
|
740
|
+
* exact worker origin, then exact subagent lineage. A row selected twice appears only
|
|
741
|
+
* once. Missing identity records remain absent; the snapshot grants no execution authority.
|
|
742
|
+
*/
|
|
743
|
+
var ThreadIdentity = class extends Schema.Class("@effect-agent/thread/ThreadIdentity")(Schema.Struct({
|
|
744
|
+
...ThreadTail.fields,
|
|
745
|
+
/** Whether any admission is retained, including settled inputs and inputs not yet canonical. */
|
|
746
|
+
hasAdmissions: Schema.Boolean,
|
|
747
|
+
records: Schema.Array(CanonicalRecordEnvelope).check(Schema.isMaxLength(3))
|
|
748
|
+
}).check(Schema.makeFilter((snapshot) => {
|
|
749
|
+
if (snapshot.tailSequence === 0) return snapshot.records.length === 0;
|
|
750
|
+
if (snapshot.records[0]?.sequence !== 1) return false;
|
|
751
|
+
const origin = workerOriginRecordId(snapshot.threadId);
|
|
752
|
+
const lineage = subagentLineageRecordId(snapshot.threadId);
|
|
753
|
+
const ids = /* @__PURE__ */ new Set();
|
|
754
|
+
const sequences = /* @__PURE__ */ new Set();
|
|
755
|
+
let previous = -1;
|
|
756
|
+
for (const entry of snapshot.records) {
|
|
757
|
+
const rank = entry.sequence === 1 ? 0 : entry.record.recordId === origin ? 1 : entry.record.recordId === lineage ? 2 : -1;
|
|
758
|
+
if (entry.threadId !== snapshot.threadId || entry.sequence < 1 || entry.sequence > snapshot.tailSequence || rank <= previous || ids.has(entry.record.recordId) || sequences.has(entry.sequence)) return false;
|
|
759
|
+
ids.add(entry.record.recordId);
|
|
760
|
+
sequences.add(entry.sequence);
|
|
761
|
+
previous = rank;
|
|
762
|
+
}
|
|
763
|
+
return true;
|
|
764
|
+
}))) {};
|
|
765
|
+
/** Immutable accepted input, distinct from all regenerable ledger execution state. */
|
|
766
|
+
var ThreadAdmission = class extends Schema.Class("@effect-agent/thread/ThreadAdmission")({
|
|
767
|
+
...AdmissionRequest.fields,
|
|
768
|
+
submissionId: SubmissionId,
|
|
769
|
+
receiptId: ReceiptId,
|
|
770
|
+
queueSequence: QueueSequence,
|
|
771
|
+
createdAt: Schema.DateTimeUtcFromString,
|
|
772
|
+
/** Stable closed Receipt timestamp; required for idle transfer, absent on active verification facts. */
|
|
773
|
+
settledAt: Schema.optionalKey(Schema.DateTimeUtcFromString)
|
|
774
|
+
}) {};
|
|
775
|
+
/** Accepted operator commands are facts; their application markers are deliberately omitted. */
|
|
776
|
+
const ThreadAbortFact = AbortIntent.mapFields(Struct.omit(["canonicalRecordId"]));
|
|
777
|
+
const ThreadApprovalFact = ApprovalDecisionIntent.mapFields(Struct.omit(["canonicalRecordId"]));
|
|
778
|
+
const ThreadResolutionFact = UnknownResolutionIntent.mapFields(Struct.omit(["canonicalRecordId"]));
|
|
779
|
+
const ThreadCommands = Schema.Struct({
|
|
780
|
+
aborts: Schema.Array(ThreadAbortFact).check(Schema.isMaxLength(256)),
|
|
781
|
+
approvals: Schema.Array(ThreadApprovalFact).check(Schema.isMaxLength(256)),
|
|
782
|
+
resolutions: Schema.Array(ThreadResolutionFact).check(Schema.isMaxLength(256))
|
|
783
|
+
});
|
|
784
|
+
const ThreadExportBatch = Schema.Struct({
|
|
785
|
+
batchId: BatchId,
|
|
786
|
+
producerId: ProducerId
|
|
787
|
+
});
|
|
788
|
+
/** The wire is part of the export type: ordinary read envelopes are not lossless archives. */
|
|
789
|
+
var ThreadExportRecord = class extends CanonicalRecordEnvelope.extend("@effect-agent/thread/ThreadExportRecord")({ record: ExportRecord }) {};
|
|
790
|
+
/** One bounded, batch-aligned page. An absent cursor alone marks a complete transfer. */
|
|
791
|
+
var ThreadExport = class extends Schema.Class("@effect-agent/thread/ThreadExport")({
|
|
792
|
+
transferFormat: Schema.Literal("effect-agent/thread-transfer@4"),
|
|
793
|
+
format: Schema.NonEmptyString,
|
|
794
|
+
threadId: ThreadId,
|
|
795
|
+
tailSequence: CanonicalSequence,
|
|
796
|
+
snapshot: ThreadExportSnapshot,
|
|
797
|
+
/** Presence seals the restored inbox; a terminal reason also requires exact settled worker evidence. */
|
|
798
|
+
workerSeal: Schema.optionalKey(ThreadWorkerSeal),
|
|
799
|
+
/** Inclusive first canonical position, even on a page containing only other owner facts. */
|
|
800
|
+
fromSequence: CanonicalSequence.check(Schema.isGreaterThan(0)),
|
|
801
|
+
records: Schema.Array(ThreadExportRecord).check(Schema.isMaxLength(256)),
|
|
802
|
+
batches: Schema.Array(ThreadExportBatch).check(Schema.isMaxLength(256)),
|
|
803
|
+
admissions: Schema.Array(ThreadAdmission).check(Schema.isMaxLength(256)),
|
|
804
|
+
commands: ThreadCommands,
|
|
805
|
+
/** Frozen delivery facts and outcomes; claims and leases are never transfer authority. */
|
|
806
|
+
deliveries: Schema.Array(MessageDeliveryRecord).check(Schema.isMaxLength(256)),
|
|
807
|
+
cursor: Schema.optionalKey(ThreadExportCursor),
|
|
808
|
+
/** Exact reference-bearing records identify cross-range recovery dependencies. */
|
|
809
|
+
dependencies: Schema.Array(RecordId).check(Schema.isMaxLength(1048576))
|
|
810
|
+
}) {};
|
|
811
|
+
/** Idle export authority. Applications quiesce external producers for the complete export. */
|
|
812
|
+
var ThreadExportSource = class ThreadExportSource extends Context.Service()("@effect-agent/thread/ThreadExportSource") {
|
|
813
|
+
static layer() {
|
|
814
|
+
return Layer.effect(ThreadExportSource, Effect.map(ThreadStore, (store) => ThreadExportSource.of({ export: store.export })));
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
/** Pull bounded idle pages. The caller keeps this Thread quiescent until the stream ends. */
|
|
818
|
+
const streamExport = (request) => Stream.unwrap(Effect.gen(function* () {
|
|
819
|
+
const source = yield* ThreadExportSource;
|
|
820
|
+
let previous;
|
|
821
|
+
return Stream.paginate(request, (current) => source.export(current).pipe(Effect.flatMap((page) => {
|
|
822
|
+
if (page.threadId !== request.threadId || previous !== void 0 && (!Schema.toEquivalence(ThreadExportSnapshot)(page.snapshot, previous.snapshot) || !Schema.toEquivalence(Schema.UndefinedOr(ThreadWorkerSeal))(page.workerSeal, previous.workerSeal) || page.tailSequence !== previous.tailSequence || page.fromSequence !== (previous.records.at(-1)?.sequence ?? previous.fromSequence - 1) + 1 || page.cursor !== void 0 && page.cursor === current.cursor)) return Effect.fail(ThreadStoreError.make({
|
|
823
|
+
operation: "stream Thread export",
|
|
824
|
+
message: "Transfer snapshot or cursor is inconsistent"
|
|
825
|
+
}));
|
|
826
|
+
previous = page;
|
|
827
|
+
return Effect.succeed([[page], page.cursor === void 0 ? Option.none() : Option.some(ThreadExportRequest.make({
|
|
828
|
+
threadId: request.threadId,
|
|
829
|
+
cursor: page.cursor
|
|
830
|
+
}))]);
|
|
831
|
+
})));
|
|
832
|
+
}));
|
|
833
|
+
/** A bounded, disposable prior Prompt, checked against its captured historyDigest. */
|
|
834
|
+
const MAX_PROMPT_CHECKPOINT_BYTES = 16777216;
|
|
835
|
+
/** Maximum ordinary Runs between full prompt replacements and in a cold catch-up suffix. */
|
|
836
|
+
const MAX_PROMPT_CHECKPOINT_RUNS = 16;
|
|
837
|
+
const PromptCheckpointHead = Schema.Struct({
|
|
838
|
+
version: Schema.Literal(2),
|
|
839
|
+
recordFormat: Schema.Literal(CURRENT_RECORD_FORMAT),
|
|
840
|
+
threadId: ThreadId,
|
|
841
|
+
runId: RunId,
|
|
842
|
+
throughSequence: CanonicalSequence,
|
|
843
|
+
historyThrough: CanonicalSequence,
|
|
844
|
+
priorHistoryLength: Schema.Int.check(Schema.isBetween({
|
|
845
|
+
minimum: 0,
|
|
846
|
+
maximum: 16384
|
|
847
|
+
})),
|
|
848
|
+
historyDigest: Digest
|
|
849
|
+
});
|
|
850
|
+
const PromptCheckpoint = Schema.Struct({
|
|
851
|
+
...PromptCheckpointHead.fields,
|
|
852
|
+
/** Canonical JSON from Effect's Prompt codec; integrity is checked before decoding it. */
|
|
853
|
+
promptJson: Schema.String.check(Schema.isMaxLength(MAX_PROMPT_CHECKPOINT_BYTES))
|
|
854
|
+
});
|
|
855
|
+
const PromptCheckpointRead = Schema.Struct({
|
|
856
|
+
threadId: ThreadId,
|
|
857
|
+
throughSequence: CanonicalSequence
|
|
858
|
+
});
|
|
859
|
+
/**
|
|
860
|
+
* Content-free storage provenance constructed by adapters from source-authored labels.
|
|
861
|
+
* Raw foreign lookalikes are not trusted diagnostics. Never include rejected values, SQL,
|
|
862
|
+
* or schema messages.
|
|
863
|
+
*/
|
|
864
|
+
var ThreadStoreDiagnostic = class extends Schema.Class("@effect-agent/thread/ThreadStoreDiagnostic")({
|
|
865
|
+
causeTag: Schema.String.check(Schema.isMaxLength(128)),
|
|
866
|
+
operation: Schema.String.check(Schema.isMaxLength(256)),
|
|
867
|
+
decoder: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(128))),
|
|
868
|
+
issueTag: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(128))),
|
|
869
|
+
sequence: Schema.optionalKey(CanonicalSequence)
|
|
870
|
+
}) {};
|
|
871
|
+
var ThreadStoreError = class extends Schema.TaggedError()("ThreadStoreError", {
|
|
872
|
+
operation: Schema.String,
|
|
873
|
+
message: Schema.String,
|
|
874
|
+
cause: Schema.optionalKey(Schema.Defect()),
|
|
875
|
+
diagnostic: Schema.optionalKey(ThreadStoreDiagnostic),
|
|
876
|
+
/** Atomic outbox rejection; unlike diagnostic causes, this survives routed storage codecs. */
|
|
877
|
+
deliveryReason: Schema.optionalKey(MessageDeliveryError.fields.reason)
|
|
878
|
+
}) {};
|
|
879
|
+
var ThreadNotMaterialized = class extends Schema.TaggedError()("ThreadNotMaterialized", { threadId: ThreadId }) {};
|
|
880
|
+
/** Export is Thread-local: external schedules, subscriptions and ingress are application-owned. */
|
|
881
|
+
var ThreadExportRejected = class extends Schema.TaggedError()("ThreadExportRejected", {
|
|
882
|
+
threadId: ThreadId,
|
|
883
|
+
reason: Schema.Literals([
|
|
884
|
+
"non-idle",
|
|
885
|
+
"source-changed",
|
|
886
|
+
"live-import-source"
|
|
887
|
+
])
|
|
888
|
+
}) {
|
|
889
|
+
get message() {
|
|
890
|
+
switch (this.reason) {
|
|
891
|
+
case "non-idle": return `Thread ${this.threadId} is not idle; close its active owner and finish pending work before export.`;
|
|
892
|
+
case "source-changed": return `Thread ${this.threadId} changed during export; keep the source quiescent and restart from the first page.`;
|
|
893
|
+
case "live-import-source": return `Import requires a detached archive; finish exporting Thread ${this.threadId} before opening the destination transaction.`;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
/**
|
|
898
|
+
* A canonical append that cannot commit: `batch-content` replays a batch ID with different
|
|
899
|
+
* content, `record-identity` reuses a canonical record ID, and `tail` declares a stale expected
|
|
900
|
+
* tail. `stale-command` rejects a superseded operational request and must not be reprepared.
|
|
901
|
+
* Tail conflicts carry the actual committed tail as a diagnostic resume hint.
|
|
902
|
+
*/
|
|
903
|
+
var AppendConflict = class extends Schema.TaggedError()("AppendConflict", {
|
|
904
|
+
threadId: ThreadId,
|
|
905
|
+
batchId: BatchId,
|
|
906
|
+
reason: Schema.Literals([
|
|
907
|
+
"batch-content",
|
|
908
|
+
"record-identity",
|
|
909
|
+
"tail",
|
|
910
|
+
"stale-command"
|
|
911
|
+
]),
|
|
912
|
+
actualTailSequence: Schema.optionalKey(CanonicalSequence)
|
|
913
|
+
}) {};
|
|
914
|
+
var ThreadStore = class extends Context.Service()("@effect-agent/thread/ThreadStore") {};
|
|
915
|
+
/** Canonical observation without append or materialization authority. */
|
|
916
|
+
var ThreadReader = class ThreadReader extends Context.Service()("@effect-agent/thread/ThreadReader") {
|
|
917
|
+
static fromStore(store) {
|
|
918
|
+
return {
|
|
919
|
+
read: store.read,
|
|
920
|
+
readExecution: store.readExecution,
|
|
921
|
+
readPrompt: store.readPrompt,
|
|
922
|
+
observe: store.observe,
|
|
923
|
+
export: store.export,
|
|
924
|
+
inspectTail: store.inspectTail,
|
|
925
|
+
readIdentity: store.readIdentity,
|
|
926
|
+
...store.readWorkerCapacity === void 0 ? {} : { readWorkerCapacity: store.readWorkerCapacity },
|
|
927
|
+
...store.countPeerMessages === void 0 ? {} : { countPeerMessages: store.countPeerMessages }
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
/** Capture this assembly's store, independently of other local or routed stores. */
|
|
931
|
+
static layer() {
|
|
932
|
+
return Layer.effect(ThreadReader, Effect.map(ThreadStore, ThreadReader.fromStore));
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
export { ThreadWorkerCapacityRequest as $, ThreadExportSource as A, ThreadReader as B, ThreadExport as C, ThreadExportRejected as D, ThreadExportRecord as E, ThreadObservation as F, ThreadStore as G, ThreadResolutionFact as H, ThreadPeerCountRequest as I, ThreadStore_exports as J, ThreadStoreDiagnostic as K, ThreadPromptRead as L, ThreadIdentityRequest as M, ThreadMaterialization as N, ThreadExportRequest as O, ThreadNotMaterialized as P, ThreadWorkerCapacity as Q, ThreadRead as R, ThreadCommands as S, ThreadExportCursor as T, ThreadRunInputRequest as U, ThreadRecordRequest as V, ThreadSelection as W, ThreadTailRequest as X, ThreadTail as Y, ThreadVerificationRequest as Z, PromptCheckpointRead as _, terminalUsageCharge as _t, ExecutionCheckpoint as a, makeTransferFactCheck as at, ThreadAdmission as b, FreshRunRead as c, transferPageFits as ct, MAX_THREAD_EXPORT_CURSOR_CHARS as d, recordEncoding as dt, ThreadWorkerSeal as et, MAX_THREAD_EXPORT_PAGE_BYTES as f, canonicalRunIds as ft, PromptCheckpointHead as g, isWorkHandoff as gt, PromptCheckpoint as h, isTerminalBudgetFact as ht, CommitBatch as i, getRunInput as it, ThreadIdentity as j, ThreadExportSnapshot as k, MAX_PROMPT_CHECKPOINT_BYTES as l, transferRecordDependencies as lt, PreparedAppend as m, isPreContinuationFact as mt, AppendRequest as n, canonicalBatchFitsTransfer as nt, ExecutionRead as o, readWorkerState as ot, MAX_THREAD_EXPORT_PAGE_RECORDS as p, executionRunIds as pt, ThreadStoreError as q, AppendResult as r, getRecord as rt, ExecutionUpdate as s, streamExport as st, AppendConflict as t, ThreadWorkerStateRequest as tt, MAX_PROMPT_CHECKPOINT_RUNS as u, captureRecord as ut, SelectedThreadRead as v, ThreadExportBatch as w, ThreadApprovalFact as x, ThreadAbortFact as y, ThreadReadRequest as z };
|
|
936
|
+
|
|
937
|
+
//# sourceMappingURL=ThreadStore-BMUAp5Ta.mjs.map
|