@systemfsoftware/agent 0.0.0-bootstrap.0 → 0.1.0-beta.192
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-BcQDrWKY.mjs +329 -0
- package/dist/Admin-BcQDrWKY.mjs.map +1 -0
- package/dist/Admin-BfolLkHj.d.mts +5678 -0
- package/dist/Agent-Bn3zMhDH.mjs +60 -0
- package/dist/Agent-Bn3zMhDH.mjs.map +1 -0
- package/dist/Agent-DSVEpq4e.d.mts +219 -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-Dg53p6du.mjs +14 -0
- package/dist/AgentRegistration-Dg53p6du.mjs.map +1 -0
- package/dist/AgentRuntime-CoGy_5dm.d.mts +751 -0
- package/dist/AgentRuntime-CzP4I4RB.mjs +5249 -0
- package/dist/AgentRuntime-CzP4I4RB.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-C9vict2M.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-DXyCKCtX.mjs +146 -0
- package/dist/CommittedActivity-DXyCKCtX.mjs.map +1 -0
- package/dist/CommittedActivity-LWOKXqdi.d.mts +62 -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-917r7gpv.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-BHXo8GPJ.mjs +8432 -0
- package/dist/DurableAgentRuntime-BHXo8GPJ.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-BwZVkEQi.mjs +66 -0
- package/dist/EventSource-BwZVkEQi.mjs.map +1 -0
- package/dist/EventSource-C0TCBeIf.d.mts +52 -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-4CRzkPBD.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-Dh6GZBt_.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-DhM-APnP.d.mts +1074 -0
- package/dist/MessagingHost-Bm5e-kAX.mjs +117 -0
- package/dist/MessagingHost-Bm5e-kAX.mjs.map +1 -0
- package/dist/MessagingHost-CubWeYKN.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-DQ8mWcgf.mjs +7 -0
- package/dist/Output-DQ8mWcgf.mjs.map +1 -0
- package/dist/Output-SbOdlBFL.d.mts +22 -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-BrtZ0g2j.d.mts +14 -0
- package/dist/PersistentHistory-CTAVhHKH.mjs +147 -0
- package/dist/PersistentHistory-CTAVhHKH.mjs.map +1 -0
- package/dist/PreparedInputAdmission-Ci18uY4s.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-BVAHoYlN.d.mts +127 -0
- package/dist/RunContinuation-Bpfp087i.mjs +1060 -0
- package/dist/RunContinuation-Bpfp087i.mjs.map +1 -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-CjVP48I8.d.mts +22 -0
- package/dist/ScheduleTransition-DtNzlN9k.mjs +180 -0
- package/dist/ScheduleTransition-DtNzlN9k.mjs.map +1 -0
- package/dist/Scheduling-BpJN9E1j.mjs +699 -0
- package/dist/Scheduling-BpJN9E1j.mjs.map +1 -0
- package/dist/Scheduling-DYTM29s9.d.mts +57 -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-CSIRUgUo.mjs +1315 -0
- package/dist/Subagent-CSIRUgUo.mjs.map +1 -0
- package/dist/Subagent-CXEI5YZ8.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-BEnICu7g.mjs +70 -0
- package/dist/SubagentHost-BEnICu7g.mjs.map +1 -0
- package/dist/SubagentHost-CKhz1vbH.d.mts +167 -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-BhQbmUD-.mjs +340 -0
- package/dist/Subscription-BhQbmUD-.mjs.map +1 -0
- package/dist/Subscription-CC--_OnU.d.mts +815 -0
- package/dist/SubscriptionInput-BEeB0Cj8.d.mts +42 -0
- package/dist/SubscriptionInput-Xcd4JjEs.mjs +53 -0
- package/dist/SubscriptionInput-Xcd4JjEs.mjs.map +1 -0
- package/dist/SubscriptionTransition-CWt9UVH0.d.mts +23 -0
- package/dist/SubscriptionTransition-lrf733c8.mjs +154 -0
- package/dist/SubscriptionTransition-lrf733c8.mjs.map +1 -0
- package/dist/Subscriptions-4K_qu_2f.mjs +638 -0
- package/dist/Subscriptions-4K_qu_2f.mjs.map +1 -0
- package/dist/Subscriptions-BF3aSf8X.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-lTZ8Ftq1.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-C8Tqiezd.mjs +491 -0
- package/dist/ThreadImport-C8Tqiezd.mjs.map +1 -0
- package/dist/ThreadImport-DaSmrlRi.d.mts +843 -0
- package/dist/ThreadInvariants-DyPhMeo-.d.mts +23 -0
- package/dist/ThreadInvariants-fniroLRY.mjs +154 -0
- package/dist/ThreadInvariants-fniroLRY.mjs.map +1 -0
- package/dist/ThreadProjectionMaintenance-D6fBjr1q.mjs +37 -0
- package/dist/ThreadProjectionMaintenance-D6fBjr1q.mjs.map +1 -0
- package/dist/ThreadProjectionMaintenance-DjUy7kCa.d.mts +51 -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-BM02cbOo.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-VjamzX3q.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-C4-HsMCp.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-CD0V--qh.d.mts +18 -0
- package/dist/WebSearch-DnbOzRL_.mjs +30 -0
- package/dist/WebSearch-DnbOzRL_.mjs.map +1 -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-BhFjx86s.mjs +162 -0
- package/dist/WorkerAdmission-BhFjx86s.mjs.map +1 -0
- package/dist/WorkerAdmission-BnRuXLWF.d.mts +171 -0
- package/dist/WorkerHost-DtYzi54D.d.mts +150 -0
- package/dist/WorkerHost-DuQug9Bq.mjs +73 -0
- package/dist/WorkerHost-DuQug9Bq.mjs.map +1 -0
- package/dist/agent-registration-CNs2twrr.mjs +262 -0
- package/dist/agent-registration-CNs2twrr.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-CHox63hg.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 +489 -5
- 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 +11137 -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,713 @@
|
|
|
1
|
+
import * as Context from 'effect/Context'
|
|
2
|
+
import * as Effect from 'effect/Effect'
|
|
3
|
+
import * as Layer from 'effect/Layer'
|
|
4
|
+
import * as Option from 'effect/Option'
|
|
5
|
+
import * as Schema from 'effect/Schema'
|
|
6
|
+
import * as Stream from 'effect/Stream'
|
|
7
|
+
|
|
8
|
+
import { ReceiptId, RunId, SubmissionId, ThreadId, ToolCallId } from '../core/Identifiers'
|
|
9
|
+
import { utf8ByteLength } from '../core/internal/utf8'
|
|
10
|
+
import { IdempotencyKey, QueueSequence } from '../core/Receipt'
|
|
11
|
+
import { digestJson } from './Digest'
|
|
12
|
+
import {
|
|
13
|
+
type CanonicalRecordEnvelope,
|
|
14
|
+
CanonicalSequence,
|
|
15
|
+
Digest,
|
|
16
|
+
MAX_RUN_EVIDENCE_BYTES,
|
|
17
|
+
MAX_RUN_EVIDENCE_RECORDS,
|
|
18
|
+
type ModelResponseRecorded,
|
|
19
|
+
RecordId,
|
|
20
|
+
} from './Records'
|
|
21
|
+
import { canonicalRecordBytes, resolveEvidence } from './RunContinuation'
|
|
22
|
+
import { runIdForSubmission } from './RunJournal'
|
|
23
|
+
import type { SubmissionWorkItem } from './SubmissionLedger'
|
|
24
|
+
import { ThreadReader, ThreadStore, ThreadStoreError } from './ThreadStore'
|
|
25
|
+
|
|
26
|
+
export const WORK_INDEX_VERSION = 4
|
|
27
|
+
export const MAX_WORK_PAGE_ENTRIES = 128
|
|
28
|
+
export const MAX_WORK_ENTRY_BYTES = 8 * 1024
|
|
29
|
+
export const MAX_WORK_PAGE_BYTES = MAX_WORK_PAGE_ENTRIES * MAX_WORK_ENTRY_BYTES
|
|
30
|
+
export const MAX_WORK_REBUILD_RECORDS = 256
|
|
31
|
+
export const MAX_WORK_REBUILD_BYTES = 32 * 1024 * 1024
|
|
32
|
+
export const MAX_RECOVERY_WORK_ITEMS = 32
|
|
33
|
+
export const MAX_RECOVERY_PAGES = 8
|
|
34
|
+
export const MAX_WORK_CURSOR_CHARS = 32 * 1024
|
|
35
|
+
|
|
36
|
+
const Cursor = Schema.NonEmptyString.check(Schema.isMaxLength(MAX_WORK_CURSOR_CHARS))
|
|
37
|
+
const WorkId = Schema.NonEmptyString.check(Schema.isMaxLength(4096))
|
|
38
|
+
|
|
39
|
+
/** Stable logical owners. Finding an owner does not acquire its lease, grant, or authority. */
|
|
40
|
+
export const WorkOwner = Schema.Union([
|
|
41
|
+
Schema.TaggedStruct('Admission', { submissionId: SubmissionId }),
|
|
42
|
+
Schema.TaggedStruct('Operation', { runId: RunId, toolCallId: ToolCallId }),
|
|
43
|
+
Schema.TaggedStruct('Child', {
|
|
44
|
+
runId: RunId,
|
|
45
|
+
toolCallId: ToolCallId,
|
|
46
|
+
childThreadId: ThreadId,
|
|
47
|
+
}),
|
|
48
|
+
Schema.TaggedStruct('WorkerInput', {
|
|
49
|
+
messageId: IdempotencyKey,
|
|
50
|
+
workerThreadId: ThreadId,
|
|
51
|
+
update: Schema.Boolean,
|
|
52
|
+
}),
|
|
53
|
+
Schema.TaggedStruct('Report', { runId: RunId }),
|
|
54
|
+
Schema.TaggedStruct('WorkerEffects', { submissionId: SubmissionId }),
|
|
55
|
+
Schema.TaggedStruct('Delivery', { messageId: IdempotencyKey }),
|
|
56
|
+
Schema.TaggedStruct('Handoff', {
|
|
57
|
+
recordId: RecordId,
|
|
58
|
+
kind: Schema.Literals(['worker-stop', 'reservation', 'child-accounting']),
|
|
59
|
+
childThreadId: Schema.optionalKey(ThreadId),
|
|
60
|
+
}),
|
|
61
|
+
])
|
|
62
|
+
|
|
63
|
+
export type WorkOwner = typeof WorkOwner.Type
|
|
64
|
+
|
|
65
|
+
export const WorkStateReference = Schema.Union([
|
|
66
|
+
Schema.TaggedStruct('Submission', { submissionId: SubmissionId }),
|
|
67
|
+
Schema.TaggedStruct('Canonical', { recordId: RecordId }),
|
|
68
|
+
Schema.TaggedStruct('Delivery', {
|
|
69
|
+
messageId: IdempotencyKey,
|
|
70
|
+
version: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
71
|
+
}),
|
|
72
|
+
])
|
|
73
|
+
|
|
74
|
+
/** Content-free scheduling metadata; resolve the selected owner through its storage port. */
|
|
75
|
+
export const ThreadWorkEntry = Schema.Struct({
|
|
76
|
+
id: WorkId,
|
|
77
|
+
owner: WorkOwner,
|
|
78
|
+
stateReference: WorkStateReference,
|
|
79
|
+
state: Schema.Literals(['ready', 'waiting', 'unknown', 'handoff']),
|
|
80
|
+
wait: Schema.optionalKey(
|
|
81
|
+
Schema.Literals([
|
|
82
|
+
'admission',
|
|
83
|
+
'ownership',
|
|
84
|
+
'approval',
|
|
85
|
+
'input',
|
|
86
|
+
'child',
|
|
87
|
+
'worker',
|
|
88
|
+
'effect-resolution',
|
|
89
|
+
'destination',
|
|
90
|
+
'parked',
|
|
91
|
+
'capacity',
|
|
92
|
+
]),
|
|
93
|
+
),
|
|
94
|
+
notBeforeMillis: Schema.optionalKey(Schema.Natural),
|
|
95
|
+
receiptId: Schema.optionalKey(ReceiptId),
|
|
96
|
+
queueSequence: Schema.optionalKey(QueueSequence),
|
|
97
|
+
originRecordId: Schema.optionalKey(RecordId),
|
|
98
|
+
/** Separate accepted-update capacity from ordinary message/worker transport. */
|
|
99
|
+
partition: Schema.optionalKey(Schema.Literals(['ordinary', 'update'])),
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
export type ThreadWorkEntry = typeof ThreadWorkEntry.Type
|
|
103
|
+
|
|
104
|
+
/** The initial declaration remains addressable while later facts change an operation's state. */
|
|
105
|
+
export const CanonicalWorkEntry = Schema.Struct({
|
|
106
|
+
...ThreadWorkEntry.fields,
|
|
107
|
+
createdSequence: CanonicalSequence,
|
|
108
|
+
updatedSequence: CanonicalSequence,
|
|
109
|
+
originRecordId: RecordId,
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
export type CanonicalWorkEntry = typeof CanonicalWorkEntry.Type
|
|
113
|
+
|
|
114
|
+
export const ThreadWorkRequest = Schema.Struct({
|
|
115
|
+
threadId: ThreadId,
|
|
116
|
+
cursor: Schema.optionalKey(Cursor),
|
|
117
|
+
limit: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: MAX_WORK_PAGE_ENTRIES })),
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
export type ThreadWorkRequest = typeof ThreadWorkRequest.Type
|
|
121
|
+
|
|
122
|
+
export const ThreadWorkPage = Schema.Struct({
|
|
123
|
+
entries: Schema.Array(ThreadWorkEntry).check(Schema.isMaxLength(MAX_WORK_PAGE_ENTRIES)),
|
|
124
|
+
/** An empty page with a cursor is progress, not a complete empty inventory. */
|
|
125
|
+
cursor: Schema.optionalKey(Cursor),
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
export type ThreadWorkPage = typeof ThreadWorkPage.Type
|
|
129
|
+
|
|
130
|
+
export const ThreadWorkCursor = Schema.Struct({
|
|
131
|
+
version: Schema.Literal(WORK_INDEX_VERSION),
|
|
132
|
+
/** Bind the exact admitted identity without copying it into every continuation. */
|
|
133
|
+
threadDigest: Digest,
|
|
134
|
+
source: Schema.Literals(['admissions', 'canonical', 'deliveries']),
|
|
135
|
+
after: Schema.optionalKey(WorkId),
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
export type ThreadWorkCursor = typeof ThreadWorkCursor.Type
|
|
139
|
+
|
|
140
|
+
/** Local snapshot request; it grants no claim or dispatch authority. */
|
|
141
|
+
export const FreshAdmissionWork = Schema.Struct({ threadId: ThreadId, submissionId: SubmissionId })
|
|
142
|
+
export type FreshAdmissionWork = typeof FreshAdmissionWork.Type
|
|
143
|
+
|
|
144
|
+
export const WorkThreadsRequest = Schema.Struct({
|
|
145
|
+
afterThreadId: Schema.optionalKey(ThreadId),
|
|
146
|
+
limit: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 32 })),
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
export type WorkThreadsRequest = typeof WorkThreadsRequest.Type
|
|
150
|
+
|
|
151
|
+
export const WorkThreadsPage = Schema.Struct({
|
|
152
|
+
threadIds: Schema.Array(ThreadId).check(Schema.isMaxLength(32)),
|
|
153
|
+
afterThreadId: Schema.optionalKey(ThreadId),
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
export type WorkThreadsPage = typeof WorkThreadsPage.Type
|
|
157
|
+
|
|
158
|
+
export const WorkIndexRebuildRequest = Schema.Struct({
|
|
159
|
+
threadId: ThreadId,
|
|
160
|
+
/** Explicitly discard a damaged derivative; canonical facts and owner state are untouched. */
|
|
161
|
+
restart: Schema.optionalKey(Schema.Boolean),
|
|
162
|
+
/** At most 256 records per pass by default; the 32 MiB byte cap may stop a pass sooner. */
|
|
163
|
+
limit: Schema.optionalKey(
|
|
164
|
+
Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: MAX_WORK_REBUILD_RECORDS })),
|
|
165
|
+
),
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
export type WorkIndexRebuildRequest = typeof WorkIndexRebuildRequest.Type
|
|
169
|
+
|
|
170
|
+
export const WorkIndexProgress = Schema.Struct({
|
|
171
|
+
version: Schema.Literal(WORK_INDEX_VERSION),
|
|
172
|
+
threadId: ThreadId,
|
|
173
|
+
state: Schema.Literals(['ready', 'rebuilding']),
|
|
174
|
+
throughSequence: CanonicalSequence,
|
|
175
|
+
tailSequence: CanonicalSequence,
|
|
176
|
+
processedRecords: Schema.Natural.check(Schema.isLessThanOrEqualTo(MAX_WORK_REBUILD_RECORDS)),
|
|
177
|
+
processedBytes: Schema.Natural.check(Schema.isLessThanOrEqualTo(MAX_WORK_REBUILD_BYTES)),
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
export type WorkIndexProgress = typeof WorkIndexProgress.Type
|
|
181
|
+
|
|
182
|
+
export class WorkDiscoveryUnavailable extends Schema.TaggedError<WorkDiscoveryUnavailable>()(
|
|
183
|
+
'WorkDiscoveryUnavailable',
|
|
184
|
+
{
|
|
185
|
+
threadId: ThreadId,
|
|
186
|
+
reason: Schema.Literals(['missing-index', 'incomplete-rebuild', 'unsupported']),
|
|
187
|
+
},
|
|
188
|
+
) {}
|
|
189
|
+
|
|
190
|
+
/** Native owner pages and canonical-index maintenance, implemented at the storage owner. */
|
|
191
|
+
export interface ThreadWorkStorage {
|
|
192
|
+
/** Native proof that this untouched root admission has no other recovery obligations.
|
|
193
|
+
* A caller must still claim and validate current controls before dispatch. */
|
|
194
|
+
readonly isOnlyFreshAdmission?: (
|
|
195
|
+
request: FreshAdmissionWork,
|
|
196
|
+
) => Effect.Effect<boolean, ThreadStoreError>
|
|
197
|
+
|
|
198
|
+
readonly threads: (
|
|
199
|
+
request: WorkThreadsRequest,
|
|
200
|
+
) => Effect.Effect<WorkThreadsPage, ThreadStoreError>
|
|
201
|
+
readonly page: (
|
|
202
|
+
request: ThreadWorkRequest,
|
|
203
|
+
) => Effect.Effect<ThreadWorkPage, WorkDiscoveryUnavailable | ThreadStoreError>
|
|
204
|
+
/** One bounded pass. Append transactions and the completion check serialize with this pass. */
|
|
205
|
+
readonly rebuild: (
|
|
206
|
+
request: WorkIndexRebuildRequest,
|
|
207
|
+
) => Effect.Effect<WorkIndexProgress, WorkDiscoveryUnavailable | ThreadStoreError>
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Inventories combine current admission/delivery owners with canonical operations and handoffs.
|
|
212
|
+
* Cursors are Thread-bound, forward-only live scans. Revalidate selected candidates; creations
|
|
213
|
+
* before an already consumed cursor appear in the next scan. Missing or damaged indexes need
|
|
214
|
+
* explicit repair. A validated adapter layout migration may continue in bounded page calls.
|
|
215
|
+
* Layer construction requires the adapter's native work-discovery port.
|
|
216
|
+
*/
|
|
217
|
+
export class ThreadWorkDiscovery extends Context.Service<ThreadWorkDiscovery, ThreadWorkStorage>()(
|
|
218
|
+
'@effect-agent/thread/ThreadWorkDiscovery',
|
|
219
|
+
) {
|
|
220
|
+
static readonly layer = Layer.effect(
|
|
221
|
+
ThreadWorkDiscovery,
|
|
222
|
+
Effect.gen(function*() {
|
|
223
|
+
const { work } = yield* ThreadStore
|
|
224
|
+
|
|
225
|
+
if (work === undefined) {
|
|
226
|
+
return yield* ThreadStoreError.make({
|
|
227
|
+
operation: 'construct work discovery',
|
|
228
|
+
message: 'The storage adapter has no work-discovery port',
|
|
229
|
+
})
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return work
|
|
233
|
+
}),
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** Opaque tuple identity; never split or reinterpret an application identifier. */
|
|
238
|
+
export const workId = (kind: string, ...ids: ReadonlyArray<string>): string => JSON.stringify([kind, ...ids])
|
|
239
|
+
|
|
240
|
+
export const admissionWork = (row: SubmissionWorkItem): ThreadWorkEntry => ({
|
|
241
|
+
id: workId('admission', row.submissionId),
|
|
242
|
+
owner: { _tag: 'Admission', submissionId: row.submissionId },
|
|
243
|
+
stateReference: { _tag: 'Submission', submissionId: row.submissionId },
|
|
244
|
+
receiptId: row.receiptId,
|
|
245
|
+
queueSequence: row.queueSequence,
|
|
246
|
+
state: row.state === 'unknown'
|
|
247
|
+
? 'unknown'
|
|
248
|
+
: row.state === 'suspended' || row.state === 'joining' || row.state === 'joined'
|
|
249
|
+
? 'waiting'
|
|
250
|
+
: 'ready',
|
|
251
|
+
...(row.state === 'unknown'
|
|
252
|
+
? { wait: 'effect-resolution' as const }
|
|
253
|
+
: row.state === 'suspended'
|
|
254
|
+
? { wait: 'input' as const }
|
|
255
|
+
: row.state === 'admitted'
|
|
256
|
+
? { wait: 'admission' as const }
|
|
257
|
+
: {}),
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
export const decodeWorkCursor = Effect.fnUntraced(function*(request: ThreadWorkRequest) {
|
|
261
|
+
const threadDigest = yield* digestJson({ threadId: request.threadId }).pipe(
|
|
262
|
+
Effect.mapError((cause) =>
|
|
263
|
+
ThreadStoreError.make({
|
|
264
|
+
operation: 'work cursor',
|
|
265
|
+
message: 'Cannot bind work-discovery cursor to its Thread',
|
|
266
|
+
cause,
|
|
267
|
+
})
|
|
268
|
+
),
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
if (request.cursor === undefined) {
|
|
272
|
+
return ThreadWorkCursor.make({
|
|
273
|
+
version: WORK_INDEX_VERSION,
|
|
274
|
+
threadDigest,
|
|
275
|
+
source: 'admissions',
|
|
276
|
+
})
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const cursor = yield* Schema.decodeEffect(Schema.fromJsonString(ThreadWorkCursor))(
|
|
280
|
+
request.cursor,
|
|
281
|
+
).pipe(
|
|
282
|
+
Effect.mapError((cause) =>
|
|
283
|
+
ThreadStoreError.make({
|
|
284
|
+
operation: 'work cursor',
|
|
285
|
+
message: 'Invalid work-discovery cursor',
|
|
286
|
+
cause,
|
|
287
|
+
})
|
|
288
|
+
),
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
if (cursor.threadDigest !== threadDigest) {
|
|
292
|
+
return yield* ThreadStoreError.make({
|
|
293
|
+
operation: 'work cursor',
|
|
294
|
+
message: 'Work cursor belongs to another Thread',
|
|
295
|
+
})
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
return cursor
|
|
299
|
+
})
|
|
300
|
+
|
|
301
|
+
export const encodeWorkCursor = Schema.encodeSync(Schema.fromJsonString(ThreadWorkCursor))
|
|
302
|
+
|
|
303
|
+
/** Validate metadata before returning a page, including a resident encoded-byte ceiling. */
|
|
304
|
+
export const validateWorkPage = Effect.fnUntraced(function*(page: ThreadWorkPage, limit: number) {
|
|
305
|
+
yield* Schema.decodeEffect(ThreadWorkPage)(page).pipe(
|
|
306
|
+
Effect.mapError((cause) =>
|
|
307
|
+
ThreadStoreError.make({
|
|
308
|
+
operation: 'work page',
|
|
309
|
+
message: 'Invalid work-discovery metadata',
|
|
310
|
+
cause,
|
|
311
|
+
})
|
|
312
|
+
),
|
|
313
|
+
)
|
|
314
|
+
if (
|
|
315
|
+
page.entries.length > limit ||
|
|
316
|
+
new Set(page.entries.map((entry) => entry.id)).size !== page.entries.length ||
|
|
317
|
+
page.entries.some((entry) => utf8ByteLength(JSON.stringify(entry)) > MAX_WORK_ENTRY_BYTES) ||
|
|
318
|
+
utf8ByteLength(JSON.stringify(page)) > MAX_WORK_PAGE_BYTES
|
|
319
|
+
) {
|
|
320
|
+
return yield* ThreadStoreError.make({
|
|
321
|
+
operation: 'work page',
|
|
322
|
+
message: 'Work-discovery metadata exceeds its page bound',
|
|
323
|
+
})
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return page
|
|
327
|
+
})
|
|
328
|
+
|
|
329
|
+
/** Exact current canonical owner state, checked against the inventory's immutable fingerprint. */
|
|
330
|
+
export const resolveWorkEvidence = Effect.fnUntraced(function*(
|
|
331
|
+
threadId: ThreadId,
|
|
332
|
+
entry: ThreadWorkEntry,
|
|
333
|
+
) {
|
|
334
|
+
if (entry.stateReference._tag !== 'Canonical') {
|
|
335
|
+
return yield* ThreadStoreError.make({
|
|
336
|
+
operation: 'resolve work',
|
|
337
|
+
message: 'Work is owned by another storage port',
|
|
338
|
+
})
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return yield* resolveEvidence(threadId, entry.stateReference)
|
|
342
|
+
})
|
|
343
|
+
|
|
344
|
+
/** Own-call facts plus the original batch's shared approval proof, without another Run's history. */
|
|
345
|
+
export const operationEvidence = (
|
|
346
|
+
threadId: ThreadId,
|
|
347
|
+
owner: Extract<WorkOwner, { _tag: 'Operation' }>,
|
|
348
|
+
originRecordId: RecordId,
|
|
349
|
+
throughSequence: CanonicalSequence,
|
|
350
|
+
declaration: ModelResponseRecorded,
|
|
351
|
+
): Stream.Stream<CanonicalRecordEnvelope, ThreadStoreError, ThreadReader> =>
|
|
352
|
+
Stream.unwrap(
|
|
353
|
+
Effect.map(ThreadReader, (reader) =>
|
|
354
|
+
Stream.suspend(() => {
|
|
355
|
+
const approvalToolCallIds = declaration.toolOperations.map((call) => call.toolCallId)
|
|
356
|
+
const approvalIds = new Set(approvalToolCallIds)
|
|
357
|
+
let afterSequence = CanonicalSequence.make(0)
|
|
358
|
+
let records = 0
|
|
359
|
+
let bytes = 0
|
|
360
|
+
|
|
361
|
+
return Stream.paginate(
|
|
362
|
+
undefined,
|
|
363
|
+
Effect.fnUntraced(function*() {
|
|
364
|
+
const page = yield* Stream.runCollect(
|
|
365
|
+
reader.read({
|
|
366
|
+
threadId,
|
|
367
|
+
selection: {
|
|
368
|
+
_tag: 'OperationEvidence',
|
|
369
|
+
runId: owner.runId,
|
|
370
|
+
toolCallId: owner.toolCallId,
|
|
371
|
+
originRecordId,
|
|
372
|
+
approvalToolCallIds,
|
|
373
|
+
throughSequence,
|
|
374
|
+
},
|
|
375
|
+
page: { limit: 8, afterSequence },
|
|
376
|
+
}),
|
|
377
|
+
).pipe(
|
|
378
|
+
Effect.mapError((cause) =>
|
|
379
|
+
cause._tag === 'ThreadStoreError'
|
|
380
|
+
? cause
|
|
381
|
+
: ThreadStoreError.make({
|
|
382
|
+
operation: 'operation evidence',
|
|
383
|
+
message: 'Selected operation is unavailable',
|
|
384
|
+
cause,
|
|
385
|
+
})
|
|
386
|
+
),
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
if (page.length > 8) {
|
|
390
|
+
return yield* ThreadStoreError.make({
|
|
391
|
+
operation: 'operation evidence',
|
|
392
|
+
message: 'Selected operation page exceeds its bound',
|
|
393
|
+
})
|
|
394
|
+
}
|
|
395
|
+
for (const entry of page) {
|
|
396
|
+
const payload = entry.record.payload
|
|
397
|
+
|
|
398
|
+
if (
|
|
399
|
+
entry.threadId !== threadId ||
|
|
400
|
+
entry.sequence <= afterSequence ||
|
|
401
|
+
entry.sequence > throughSequence ||
|
|
402
|
+
(entry.record.recordId === originRecordId
|
|
403
|
+
? payload._tag !== 'ModelResponseRecorded' ||
|
|
404
|
+
payload.runId !== owner.runId ||
|
|
405
|
+
payload.turn !== declaration.turn ||
|
|
406
|
+
payload.toolOperations.length !== approvalIds.size ||
|
|
407
|
+
payload.toolOperations.some((call) => !approvalIds.has(call.toolCallId)) ||
|
|
408
|
+
!payload.toolOperations.some((call) => call.toolCallId === owner.toolCallId)
|
|
409
|
+
: !('runId' in payload) ||
|
|
410
|
+
payload.runId !== owner.runId ||
|
|
411
|
+
!('toolCallId' in payload) ||
|
|
412
|
+
(payload._tag === 'ToolApprovalRequested' ||
|
|
413
|
+
payload._tag === 'ToolApprovalDecided'
|
|
414
|
+
? payload.turn !== declaration.turn || !approvalIds.has(payload.toolCallId)
|
|
415
|
+
: payload.toolCallId !== owner.toolCallId))
|
|
416
|
+
) {
|
|
417
|
+
return yield* ThreadStoreError.make({
|
|
418
|
+
operation: 'operation evidence',
|
|
419
|
+
message: 'Selected operation has invalid evidence identity',
|
|
420
|
+
})
|
|
421
|
+
}
|
|
422
|
+
afterSequence = entry.sequence
|
|
423
|
+
records++
|
|
424
|
+
bytes += canonicalRecordBytes(entry.record)
|
|
425
|
+
if (records > MAX_RUN_EVIDENCE_RECORDS || bytes > MAX_RUN_EVIDENCE_BYTES) {
|
|
426
|
+
return yield* ThreadStoreError.make({
|
|
427
|
+
operation: 'operation evidence',
|
|
428
|
+
message: 'Selected operation exceeds its recovery bound',
|
|
429
|
+
})
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
return [page, page.length < 8 ? Option.none() : Option.some(undefined)] as const
|
|
434
|
+
}),
|
|
435
|
+
)
|
|
436
|
+
})),
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
/** The last frozen report/update, independent of completed deliveries and unrelated history. */
|
|
440
|
+
export const deliveryPredecessor = Effect.fnUntraced(function*(
|
|
441
|
+
threadId: ThreadId,
|
|
442
|
+
throughSequence: CanonicalSequence,
|
|
443
|
+
) {
|
|
444
|
+
const reader = yield* ThreadReader
|
|
445
|
+
|
|
446
|
+
const records = yield* Stream.runCollect(
|
|
447
|
+
reader.read({
|
|
448
|
+
threadId,
|
|
449
|
+
selection: { _tag: 'DeliveryPredecessor', throughSequence },
|
|
450
|
+
page: { limit: 1 },
|
|
451
|
+
}),
|
|
452
|
+
)
|
|
453
|
+
|
|
454
|
+
if (records.length > 1) {
|
|
455
|
+
return yield* ThreadStoreError.make({
|
|
456
|
+
operation: 'delivery predecessor',
|
|
457
|
+
message: 'Ambiguous delivery predecessor',
|
|
458
|
+
})
|
|
459
|
+
}
|
|
460
|
+
const found = records[0]
|
|
461
|
+
|
|
462
|
+
if (found === undefined) return undefined
|
|
463
|
+
if (found.threadId !== threadId || found.sequence > throughSequence) {
|
|
464
|
+
return yield* ThreadStoreError.make({
|
|
465
|
+
operation: 'delivery predecessor',
|
|
466
|
+
message: 'Invalid delivery predecessor identity',
|
|
467
|
+
})
|
|
468
|
+
}
|
|
469
|
+
const payload = found.record.payload
|
|
470
|
+
|
|
471
|
+
if (payload._tag === 'WorkerReportPrepared') return payload.messageId
|
|
472
|
+
if (payload._tag === 'AgentUpdateEmitted' && payload.delivery !== undefined) {
|
|
473
|
+
return payload.delivery.messageId
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
return yield* ThreadStoreError.make({
|
|
477
|
+
operation: 'delivery predecessor',
|
|
478
|
+
message: 'Invalid delivery predecessor evidence',
|
|
479
|
+
})
|
|
480
|
+
})
|
|
481
|
+
|
|
482
|
+
/** Origin reporting mode retained by the disposable fold, including private worker inputs. */
|
|
483
|
+
export type WorkerReportingMode = 'none' | 'private' | 'standard'
|
|
484
|
+
|
|
485
|
+
export type WorkIndexChange =
|
|
486
|
+
| { readonly _tag: 'Put'; readonly entry: CanonicalWorkEntry }
|
|
487
|
+
| { readonly _tag: 'Remove'; readonly id: string; readonly stateRecordId?: RecordId }
|
|
488
|
+
| { readonly _tag: 'WorkerMode'; readonly mode: Exclude<WorkerReportingMode, 'none'> }
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Fold only canonical creation, factual closure, and durable handoff evidence. Storage commits
|
|
492
|
+
* these changes with the source batch. Peer/report/update delivery work belongs directly to
|
|
493
|
+
* the outbox rows published in that transaction.
|
|
494
|
+
*/
|
|
495
|
+
export const workIndexChanges = Effect.fnUntraced(function*(
|
|
496
|
+
envelope: CanonicalRecordEnvelope,
|
|
497
|
+
reporting: WorkerReportingMode,
|
|
498
|
+
): Effect.fn.Return<ReadonlyArray<WorkIndexChange>, ThreadStoreError> {
|
|
499
|
+
const { record, sequence } = envelope
|
|
500
|
+
const payload = record.payload
|
|
501
|
+
|
|
502
|
+
if (
|
|
503
|
+
!new Set([
|
|
504
|
+
'ModelResponseRecorded',
|
|
505
|
+
'ToolCallUnknown',
|
|
506
|
+
'ToolApprovalRequested',
|
|
507
|
+
'ToolApprovalDecided',
|
|
508
|
+
'ToolCallSettled',
|
|
509
|
+
'ToolCallResolved',
|
|
510
|
+
'SubagentRequested',
|
|
511
|
+
'SubagentJoined',
|
|
512
|
+
'WorkerInputRequested',
|
|
513
|
+
'WorkerInputCompleted',
|
|
514
|
+
'WorkerInputRefused',
|
|
515
|
+
'WorkerOriginRecorded',
|
|
516
|
+
'SubmissionSettled',
|
|
517
|
+
'WorkerReportPrepared',
|
|
518
|
+
'WorkerReportRefused',
|
|
519
|
+
'WorkerStopRequested',
|
|
520
|
+
'SubtreeBudgetReserved',
|
|
521
|
+
'WorkHandoffCompleted',
|
|
522
|
+
]).has(payload._tag)
|
|
523
|
+
) {
|
|
524
|
+
return [] as ReadonlyArray<WorkIndexChange>
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
const remove = (kind: string, ...ids: ReadonlyArray<string>): WorkIndexChange => ({
|
|
528
|
+
_tag: 'Remove',
|
|
529
|
+
id: workId(kind, ...ids),
|
|
530
|
+
})
|
|
531
|
+
|
|
532
|
+
const put = (
|
|
533
|
+
id: string,
|
|
534
|
+
owner: WorkOwner,
|
|
535
|
+
state: ThreadWorkEntry['state'],
|
|
536
|
+
wait?: ThreadWorkEntry['wait'],
|
|
537
|
+
): WorkIndexChange => ({
|
|
538
|
+
_tag: 'Put',
|
|
539
|
+
entry: {
|
|
540
|
+
id,
|
|
541
|
+
owner,
|
|
542
|
+
stateReference: { _tag: 'Canonical', recordId: record.recordId },
|
|
543
|
+
state,
|
|
544
|
+
...(wait === undefined ? {} : { wait }),
|
|
545
|
+
createdSequence: sequence,
|
|
546
|
+
updatedSequence: sequence,
|
|
547
|
+
originRecordId: record.recordId,
|
|
548
|
+
},
|
|
549
|
+
})
|
|
550
|
+
|
|
551
|
+
const operation = (
|
|
552
|
+
runId: RunId,
|
|
553
|
+
toolCallId: ToolCallId,
|
|
554
|
+
state: ThreadWorkEntry['state'],
|
|
555
|
+
wait?: ThreadWorkEntry['wait'],
|
|
556
|
+
) =>
|
|
557
|
+
put(
|
|
558
|
+
workId('operation', runId, toolCallId),
|
|
559
|
+
{ _tag: 'Operation', runId, toolCallId },
|
|
560
|
+
state,
|
|
561
|
+
wait,
|
|
562
|
+
)
|
|
563
|
+
|
|
564
|
+
const handoff = (
|
|
565
|
+
kind: Extract<WorkOwner, { _tag: 'Handoff' }>['kind'],
|
|
566
|
+
childThreadId?: ThreadId,
|
|
567
|
+
) =>
|
|
568
|
+
put(
|
|
569
|
+
workId('handoff', record.recordId),
|
|
570
|
+
{
|
|
571
|
+
_tag: 'Handoff',
|
|
572
|
+
recordId: record.recordId,
|
|
573
|
+
kind,
|
|
574
|
+
...(childThreadId === undefined ? {} : { childThreadId }),
|
|
575
|
+
},
|
|
576
|
+
'handoff',
|
|
577
|
+
'destination',
|
|
578
|
+
)
|
|
579
|
+
|
|
580
|
+
switch (payload._tag) {
|
|
581
|
+
case 'ModelResponseRecorded':
|
|
582
|
+
return payload.toolOperations.map((call) => operation(payload.runId, call.toolCallId, 'ready'))
|
|
583
|
+
case 'ToolCallUnknown':
|
|
584
|
+
return [operation(payload.runId, payload.toolCallId, 'unknown', 'effect-resolution')]
|
|
585
|
+
case 'ToolApprovalRequested':
|
|
586
|
+
return [operation(payload.runId, payload.toolCallId, 'waiting', 'approval')]
|
|
587
|
+
case 'ToolApprovalDecided':
|
|
588
|
+
return [operation(payload.runId, payload.toolCallId, 'ready')]
|
|
589
|
+
case 'ToolCallSettled':
|
|
590
|
+
return [remove('operation', payload.runId, payload.toolCallId)]
|
|
591
|
+
case 'ToolCallResolved':
|
|
592
|
+
return payload.resolution === 'safe-retry'
|
|
593
|
+
? [operation(payload.runId, payload.toolCallId, 'unknown', 'effect-resolution')]
|
|
594
|
+
: [remove('operation', payload.runId, payload.toolCallId)]
|
|
595
|
+
case 'SubagentRequested':
|
|
596
|
+
return [
|
|
597
|
+
remove('reservation', payload.reservationId),
|
|
598
|
+
put(
|
|
599
|
+
workId('child', payload.runId, payload.toolCallId),
|
|
600
|
+
{
|
|
601
|
+
_tag: 'Child',
|
|
602
|
+
runId: payload.runId,
|
|
603
|
+
toolCallId: payload.toolCallId,
|
|
604
|
+
childThreadId: payload.childThreadId,
|
|
605
|
+
},
|
|
606
|
+
'waiting',
|
|
607
|
+
'child',
|
|
608
|
+
),
|
|
609
|
+
]
|
|
610
|
+
case 'SubagentJoined':
|
|
611
|
+
return [remove('child', payload.runId, payload.toolCallId), handoff('child-accounting')]
|
|
612
|
+
case 'WorkerInputRequested':
|
|
613
|
+
return [
|
|
614
|
+
remove('reservation', payload.admission.messageId),
|
|
615
|
+
put(
|
|
616
|
+
workId('worker-input', payload.admission.messageId),
|
|
617
|
+
{
|
|
618
|
+
_tag: 'WorkerInput',
|
|
619
|
+
messageId: payload.admission.messageId,
|
|
620
|
+
workerThreadId: payload.admission.origin.worker.threadId,
|
|
621
|
+
update: payload.admission.reportKind === 'update',
|
|
622
|
+
},
|
|
623
|
+
'waiting',
|
|
624
|
+
'worker',
|
|
625
|
+
),
|
|
626
|
+
]
|
|
627
|
+
case 'WorkerInputCompleted':
|
|
628
|
+
return payload.effectsResolved === true
|
|
629
|
+
? [
|
|
630
|
+
remove('worker-input', payload.messageId),
|
|
631
|
+
remove('worker-effects', payload.submissionId),
|
|
632
|
+
]
|
|
633
|
+
: []
|
|
634
|
+
case 'WorkerInputRefused':
|
|
635
|
+
return [
|
|
636
|
+
{
|
|
637
|
+
_tag: 'Remove',
|
|
638
|
+
id: workId('worker-input', payload.messageId),
|
|
639
|
+
stateRecordId: payload.reservation.recordId,
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
_tag: 'Remove',
|
|
643
|
+
id: workId('reservation', payload.messageId),
|
|
644
|
+
stateRecordId: payload.reservation.recordId,
|
|
645
|
+
},
|
|
646
|
+
]
|
|
647
|
+
case 'WorkerOriginRecorded':
|
|
648
|
+
return [
|
|
649
|
+
{
|
|
650
|
+
_tag: 'WorkerMode',
|
|
651
|
+
mode: payload.origin.reporting?.mode === 'standard' ? 'standard' : 'private',
|
|
652
|
+
},
|
|
653
|
+
]
|
|
654
|
+
case 'SubmissionSettled':
|
|
655
|
+
return reporting === 'none'
|
|
656
|
+
? []
|
|
657
|
+
: [
|
|
658
|
+
put(
|
|
659
|
+
workId('worker-effects', payload.submissionId),
|
|
660
|
+
{ _tag: 'WorkerEffects', submissionId: payload.submissionId },
|
|
661
|
+
'waiting',
|
|
662
|
+
'effect-resolution',
|
|
663
|
+
),
|
|
664
|
+
...(reporting === 'standard' &&
|
|
665
|
+
payload.runId === runIdForSubmission(payload.submissionId)
|
|
666
|
+
? [
|
|
667
|
+
put(
|
|
668
|
+
workId('report', payload.runId),
|
|
669
|
+
{ _tag: 'Report', runId: payload.runId },
|
|
670
|
+
'ready',
|
|
671
|
+
),
|
|
672
|
+
]
|
|
673
|
+
: []),
|
|
674
|
+
]
|
|
675
|
+
case 'WorkerReportPrepared':
|
|
676
|
+
return [remove('report', payload.runId)]
|
|
677
|
+
case 'WorkerReportRefused':
|
|
678
|
+
return [remove('report', payload.runId)]
|
|
679
|
+
case 'WorkerStopRequested':
|
|
680
|
+
return [handoff('worker-stop', payload.command.worker.threadId)]
|
|
681
|
+
case 'SubtreeBudgetReserved':
|
|
682
|
+
return [
|
|
683
|
+
put(
|
|
684
|
+
workId('reservation', payload.reservationId),
|
|
685
|
+
{
|
|
686
|
+
_tag: 'Handoff',
|
|
687
|
+
recordId: record.recordId,
|
|
688
|
+
kind: 'reservation',
|
|
689
|
+
childThreadId: payload.childThreadId,
|
|
690
|
+
},
|
|
691
|
+
'waiting',
|
|
692
|
+
'capacity',
|
|
693
|
+
),
|
|
694
|
+
]
|
|
695
|
+
case 'WorkHandoffCompleted':
|
|
696
|
+
return [{ _tag: 'Remove', id: payload.ownerId }]
|
|
697
|
+
default:
|
|
698
|
+
return []
|
|
699
|
+
}
|
|
700
|
+
})
|
|
701
|
+
|
|
702
|
+
/** Backfill is chronological. A state's creation identity never changes on later updates. */
|
|
703
|
+
export const advanceWorkEntry = (
|
|
704
|
+
previous: CanonicalWorkEntry | undefined,
|
|
705
|
+
next: CanonicalWorkEntry,
|
|
706
|
+
): CanonicalWorkEntry =>
|
|
707
|
+
previous === undefined
|
|
708
|
+
? next
|
|
709
|
+
: {
|
|
710
|
+
...next,
|
|
711
|
+
createdSequence: previous.createdSequence,
|
|
712
|
+
originRecordId: previous.originRecordId,
|
|
713
|
+
}
|