@systemfsoftware/agent 0.0.0-stage → 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 +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 +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,421 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Result from "effect/Result";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
import { l as SubmissionId, o as ReceiptId, t as AgentId, u as ThreadId } from "../Identifiers-LWd4837I.mjs";
|
|
5
|
+
import { a as Receipt, i as QueueSequence, r as Principal, t as IdempotencyKey } from "../Receipt-B-FlCaNH.mjs";
|
|
6
|
+
import { b as Digest, v as DefinitionDigests } from "../Records-C645aQks.mjs";
|
|
7
|
+
import { D as ScheduleStore, d as ScheduleId, r as ScheduleCapacityError } from "../Schedule-BY0lzbij.mjs";
|
|
8
|
+
// src/durable/ScheduleStoreConformance.ts
|
|
9
|
+
var ScheduleStoreConformanceViolation = class extends Schema.TaggedError()("ScheduleStoreConformanceViolation", {
|
|
10
|
+
caseName: Schema.String,
|
|
11
|
+
message: Schema.String
|
|
12
|
+
}) {};
|
|
13
|
+
const id = Schema.decodeSync(ScheduleId);
|
|
14
|
+
const principal = Schema.decodeSync(Principal)("schedule-conformance-principal");
|
|
15
|
+
const agentId = Schema.decodeSync(AgentId)("schedule-conformance-agent");
|
|
16
|
+
const threadId = Schema.decodeSync(ThreadId)("schedule-conformance-thread");
|
|
17
|
+
const digest = Schema.decodeSync(Digest)("d".repeat(64));
|
|
18
|
+
const definitions = DefinitionDigests.make({
|
|
19
|
+
agent: digest,
|
|
20
|
+
model: digest,
|
|
21
|
+
tools: digest
|
|
22
|
+
});
|
|
23
|
+
const key = (name, ownerId = "owner") => ({
|
|
24
|
+
owner: {
|
|
25
|
+
tenantId: "schedule-conformance-tenant",
|
|
26
|
+
ownerId
|
|
27
|
+
},
|
|
28
|
+
scheduleId: id(name)
|
|
29
|
+
});
|
|
30
|
+
const record = (name, input = { value: name }, ownerId = "owner") => ({
|
|
31
|
+
schemaVersion: 1,
|
|
32
|
+
...key(name, ownerId),
|
|
33
|
+
creationFingerprint: Schema.decodeSync(Digest)("a".repeat(64)),
|
|
34
|
+
createdBy: principal,
|
|
35
|
+
createdAtMillis: 1,
|
|
36
|
+
updatedAtMillis: 1,
|
|
37
|
+
configurationRevision: 1,
|
|
38
|
+
version: 1,
|
|
39
|
+
configuration: {
|
|
40
|
+
timing: {
|
|
41
|
+
_tag: "At",
|
|
42
|
+
atMillis: 100
|
|
43
|
+
},
|
|
44
|
+
destination: {
|
|
45
|
+
_tag: "ExistingThread",
|
|
46
|
+
threadId
|
|
47
|
+
},
|
|
48
|
+
deliveryPrincipal: principal,
|
|
49
|
+
agentId,
|
|
50
|
+
definitions,
|
|
51
|
+
input,
|
|
52
|
+
inputDigest: digest
|
|
53
|
+
},
|
|
54
|
+
state: "active",
|
|
55
|
+
nextAtMillis: 100,
|
|
56
|
+
pending: null,
|
|
57
|
+
lastReceipt: null,
|
|
58
|
+
lastRefusal: null,
|
|
59
|
+
lastSkippedRange: null
|
|
60
|
+
});
|
|
61
|
+
const pendingRecord = (name) => {
|
|
62
|
+
const base = record(name);
|
|
63
|
+
const occurrenceId = Schema.decodeSync(Digest)("e".repeat(64));
|
|
64
|
+
return {
|
|
65
|
+
...base,
|
|
66
|
+
nextAtMillis: null,
|
|
67
|
+
pending: {
|
|
68
|
+
envelope: {
|
|
69
|
+
schemaVersion: 1,
|
|
70
|
+
...key(name),
|
|
71
|
+
configurationRevision: 1,
|
|
72
|
+
intendedAtMillis: 100,
|
|
73
|
+
preparedAtMillis: 110,
|
|
74
|
+
occurrenceId,
|
|
75
|
+
threadId,
|
|
76
|
+
deliveryPrincipal: principal,
|
|
77
|
+
agentId,
|
|
78
|
+
definitions,
|
|
79
|
+
input: base.configuration.input,
|
|
80
|
+
inputDigest: digest,
|
|
81
|
+
admissionKey: Schema.decodeSync(IdempotencyKey)(`schedule:${name}`),
|
|
82
|
+
authorization: {
|
|
83
|
+
policyId: "policy",
|
|
84
|
+
decisionId: "decision"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
retry: {
|
|
88
|
+
generation: 0,
|
|
89
|
+
attempts: 0,
|
|
90
|
+
automaticAttempts: 0,
|
|
91
|
+
parked: false,
|
|
92
|
+
nextAttemptAtMillis: 120,
|
|
93
|
+
lastAttemptAtMillis: null,
|
|
94
|
+
lastFailure: null
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
const receipt = Receipt.make({
|
|
100
|
+
receiptId: Schema.decodeSync(ReceiptId)("schedule-conformance-receipt"),
|
|
101
|
+
submissionId: Schema.decodeSync(SubmissionId)("schedule-conformance-submission"),
|
|
102
|
+
threadId,
|
|
103
|
+
queueSequence: Schema.decodeSync(QueueSequence)(1)
|
|
104
|
+
});
|
|
105
|
+
const conformanceCase = (name, run) => ({
|
|
106
|
+
name,
|
|
107
|
+
run: run((condition, message) => condition ? Effect.void : Effect.fail(ScheduleStoreConformanceViolation.make({
|
|
108
|
+
caseName: name,
|
|
109
|
+
message
|
|
110
|
+
}))).pipe(Effect.withSpan(`ScheduleStoreConformance.${name}`))
|
|
111
|
+
});
|
|
112
|
+
/** Adapter-neutral contract cases. Each case uses disjoint owner and Schedule identities. */
|
|
113
|
+
const scheduleStoreConformanceCases = [
|
|
114
|
+
conformanceCase("returns the current record when creation replays after an edit", (ensure) => Effect.gen(function* () {
|
|
115
|
+
const store = yield* ScheduleStore;
|
|
116
|
+
const original = record("creation-replay");
|
|
117
|
+
yield* store.insert(original, 10);
|
|
118
|
+
const edited = yield* store.change(key("creation-replay"), {
|
|
119
|
+
_tag: "Update",
|
|
120
|
+
expectedRevision: 1,
|
|
121
|
+
configuration: {
|
|
122
|
+
...original.configuration,
|
|
123
|
+
input: { value: "edited" }
|
|
124
|
+
},
|
|
125
|
+
nextAtMillis: 200,
|
|
126
|
+
nowMillis: 10
|
|
127
|
+
});
|
|
128
|
+
const replayed = yield* store.insert(original, 10);
|
|
129
|
+
yield* ensure(replayed.version === edited.version, "creation replay returned stale state");
|
|
130
|
+
yield* ensure(replayed.configurationRevision === 2, "creation replay lost the edited configuration revision");
|
|
131
|
+
yield* ensure(JSON.stringify(replayed.configuration.input) === JSON.stringify({ value: "edited" }), "creation replay returned the original input");
|
|
132
|
+
})),
|
|
133
|
+
conformanceCase("makes stale completions and retry regressions full no-ops", (ensure) => Effect.gen(function* () {
|
|
134
|
+
const store = yield* ScheduleStore;
|
|
135
|
+
const original = pendingRecord("stale-completion");
|
|
136
|
+
yield* store.insert(original, 10);
|
|
137
|
+
const stale = yield* store.change(key("stale-completion"), {
|
|
138
|
+
_tag: "Complete",
|
|
139
|
+
occurrenceId: yield* Schema.decodeEffect(Digest)("f".repeat(64)).pipe(Effect.orDie),
|
|
140
|
+
receipt,
|
|
141
|
+
nowMillis: 130
|
|
142
|
+
});
|
|
143
|
+
yield* ensure(stale.version === original.version, "stale completion changed the version");
|
|
144
|
+
yield* ensure(stale.pending !== null, "stale completion cleared pending work");
|
|
145
|
+
yield* ensure(stale.lastReceipt === null, "stale completion changed bounded status");
|
|
146
|
+
const advanced = yield* store.change(key("stale-completion"), {
|
|
147
|
+
_tag: "Retry",
|
|
148
|
+
occurrenceId: original.pending?.envelope.occurrenceId ?? digest,
|
|
149
|
+
retry: {
|
|
150
|
+
generation: 0,
|
|
151
|
+
automaticAttempts: 0,
|
|
152
|
+
parked: false,
|
|
153
|
+
attempts: 2,
|
|
154
|
+
nextAttemptAtMillis: 500,
|
|
155
|
+
lastAttemptAtMillis: 200,
|
|
156
|
+
lastFailure: "transport"
|
|
157
|
+
},
|
|
158
|
+
nowMillis: 200
|
|
159
|
+
});
|
|
160
|
+
const regressed = yield* store.change(key("stale-completion"), {
|
|
161
|
+
_tag: "Retry",
|
|
162
|
+
occurrenceId: original.pending?.envelope.occurrenceId ?? digest,
|
|
163
|
+
retry: {
|
|
164
|
+
generation: 0,
|
|
165
|
+
automaticAttempts: 0,
|
|
166
|
+
parked: false,
|
|
167
|
+
attempts: 1,
|
|
168
|
+
nextAttemptAtMillis: 300,
|
|
169
|
+
lastAttemptAtMillis: 150,
|
|
170
|
+
lastFailure: "timeout"
|
|
171
|
+
},
|
|
172
|
+
nowMillis: 210
|
|
173
|
+
});
|
|
174
|
+
yield* ensure(regressed.version === advanced.version, "retry regression changed the version");
|
|
175
|
+
yield* ensure(regressed.pending?.retry.nextAttemptAtMillis === 500, "retry regression moved the deadline backward");
|
|
176
|
+
})),
|
|
177
|
+
conformanceCase("isolates owner pages, prioritizes pending deadlines, and clones writes", (ensure) => Effect.gen(function* () {
|
|
178
|
+
const store = yield* ScheduleStore;
|
|
179
|
+
const mutableInput = { value: "before" };
|
|
180
|
+
yield* store.insert(record("z-page", mutableInput), 10);
|
|
181
|
+
mutableInput.value = "after";
|
|
182
|
+
yield* store.insert(record("a-page"), 10);
|
|
183
|
+
yield* store.insert(pendingRecord("pending-first"), 10);
|
|
184
|
+
yield* store.insert(record("foreign", { value: "foreign" }, "other-owner"), 10);
|
|
185
|
+
const page = yield* store.list({
|
|
186
|
+
owner: key("ignored").owner,
|
|
187
|
+
limit: 2
|
|
188
|
+
});
|
|
189
|
+
yield* ensure(page.items.length === 2, "owner page returned the wrong item count");
|
|
190
|
+
yield* ensure(page.items[0]?.scheduleId === id("a-page"), "owner page order is unstable");
|
|
191
|
+
yield* ensure(page.next === id("pending-first"), "owner page cursor is not its last item");
|
|
192
|
+
yield* ensure(page.items.every((item) => item.owner.ownerId === "owner"), "owner page leaked a foreign owner");
|
|
193
|
+
const stored = yield* store.get(key("z-page"));
|
|
194
|
+
yield* ensure(JSON.stringify(stored?.configuration.input) === JSON.stringify({ value: "before" }), "caller mutation changed the authoritative stored input");
|
|
195
|
+
const due = yield* store.due(150, 10, key("ignored").owner);
|
|
196
|
+
yield* ensure(due[0]?.scheduleId === id("a-page") || due[0]?.scheduleId === id("z-page"), "due ordering did not use the earliest deadline");
|
|
197
|
+
yield* ensure(due.some((item) => item.scheduleId === id("pending-first")), "due query omitted pending recovery");
|
|
198
|
+
})),
|
|
199
|
+
conformanceCase("enforces owner capacity without affecting other owners", (ensure) => Effect.gen(function* () {
|
|
200
|
+
const store = yield* ScheduleStore;
|
|
201
|
+
yield* store.insert(record("capacity-one", { value: 1 }, "capacity-owner"), 1);
|
|
202
|
+
const attempted = yield* store.insert(record("capacity-two", { value: 2 }, "capacity-owner"), 1).pipe(Effect.result);
|
|
203
|
+
yield* ensure(Result.isFailure(attempted) && Schema.is(ScheduleCapacityError)(attempted.failure) && Object.prototype.isPrototypeOf.call(ScheduleCapacityError.prototype, attempted.failure), "owner capacity did not fail with ScheduleCapacityError");
|
|
204
|
+
yield* ensure((yield* store.insert(record("capacity-other", { value: 3 }, "capacity-other"), 1)).scheduleId === id("capacity-other"), "capacity leaked across owners");
|
|
205
|
+
})),
|
|
206
|
+
conformanceCase("releases terminal capacity without deleting replay evidence and fences reactivation", (ensure) => Effect.gen(function* () {
|
|
207
|
+
const store = yield* ScheduleStore;
|
|
208
|
+
const original = pendingRecord("capacity-retained");
|
|
209
|
+
yield* store.insert(original, 1);
|
|
210
|
+
const paused = yield* store.change(original, {
|
|
211
|
+
_tag: "Control",
|
|
212
|
+
expectedRevision: 1,
|
|
213
|
+
expectedVersion: original.version,
|
|
214
|
+
action: "pause",
|
|
215
|
+
nextAtMillis: null,
|
|
216
|
+
nowMillis: 120,
|
|
217
|
+
skippedRange: null
|
|
218
|
+
});
|
|
219
|
+
const cancelled = yield* store.change(original, {
|
|
220
|
+
_tag: "Control",
|
|
221
|
+
expectedRevision: 1,
|
|
222
|
+
expectedVersion: paused.version,
|
|
223
|
+
action: "cancel",
|
|
224
|
+
nextAtMillis: null,
|
|
225
|
+
nowMillis: 130,
|
|
226
|
+
skippedRange: null
|
|
227
|
+
});
|
|
228
|
+
const blocked = yield* store.insert(record("capacity-next"), 1).pipe(Effect.result);
|
|
229
|
+
yield* ensure(Result.isFailure(blocked) && blocked.failure._tag === "ScheduleCapacityError", "cancellation released unresolved pending capacity");
|
|
230
|
+
const parked = yield* store.change(original, {
|
|
231
|
+
_tag: "Retry",
|
|
232
|
+
occurrenceId: original.pending?.envelope.occurrenceId ?? digest,
|
|
233
|
+
retry: {
|
|
234
|
+
generation: 0,
|
|
235
|
+
attempts: 3,
|
|
236
|
+
automaticAttempts: 3,
|
|
237
|
+
parked: true,
|
|
238
|
+
nextAttemptAtMillis: 140,
|
|
239
|
+
lastAttemptAtMillis: 130,
|
|
240
|
+
lastFailure: "transport"
|
|
241
|
+
},
|
|
242
|
+
nowMillis: 130
|
|
243
|
+
});
|
|
244
|
+
yield* ensure((yield* store.due(140, 10, original.owner)).length === 0, "Parked work must not retry automatically");
|
|
245
|
+
const recovered = yield* store.change(original, {
|
|
246
|
+
_tag: "Recover",
|
|
247
|
+
expectedGeneration: 0,
|
|
248
|
+
expectedRevision: parked.configurationRevision,
|
|
249
|
+
occurrenceId: original.pending?.envelope.occurrenceId ?? digest,
|
|
250
|
+
nowMillis: 140
|
|
251
|
+
});
|
|
252
|
+
yield* ensure(recovered.state === "cancelled" && recovered.pending?.retry.automaticAttempts === 0 && recovered.pending.retry.attempts === 3 && recovered.pending.retry.parked === false && JSON.stringify(recovered.pending.envelope) === JSON.stringify(original.pending?.envelope), "Explicit recovery must preserve cancelled pending identity and total attempts");
|
|
253
|
+
const staleRetry = yield* store.change(original, {
|
|
254
|
+
_tag: "Retry",
|
|
255
|
+
occurrenceId: original.pending?.envelope.occurrenceId ?? digest,
|
|
256
|
+
retry: {
|
|
257
|
+
generation: 0,
|
|
258
|
+
attempts: 99,
|
|
259
|
+
automaticAttempts: 99,
|
|
260
|
+
parked: true,
|
|
261
|
+
nextAttemptAtMillis: 150,
|
|
262
|
+
lastAttemptAtMillis: 145,
|
|
263
|
+
lastFailure: "transport"
|
|
264
|
+
},
|
|
265
|
+
nowMillis: 145
|
|
266
|
+
});
|
|
267
|
+
yield* ensure(JSON.stringify(staleRetry) === JSON.stringify(recovered), "A pre-recovery retry consumed the new generation");
|
|
268
|
+
const repeatedRecovery = yield* store.change(original, {
|
|
269
|
+
_tag: "Recover",
|
|
270
|
+
expectedGeneration: 0,
|
|
271
|
+
expectedRevision: recovered.configurationRevision,
|
|
272
|
+
occurrenceId: original.pending?.envelope.occurrenceId ?? digest,
|
|
273
|
+
nowMillis: 146
|
|
274
|
+
});
|
|
275
|
+
yield* ensure(JSON.stringify(repeatedRecovery) === JSON.stringify(recovered), "A repeated recovery changed its original generation");
|
|
276
|
+
const completed = yield* store.change(original, {
|
|
277
|
+
_tag: "Complete",
|
|
278
|
+
occurrenceId: original.pending?.envelope.occurrenceId ?? digest,
|
|
279
|
+
receipt,
|
|
280
|
+
nowMillis: 140
|
|
281
|
+
});
|
|
282
|
+
yield* ensure(completed.pending === null && cancelled.pending !== null, "completion did not clear pending work");
|
|
283
|
+
yield* store.insert(record("capacity-next"), 1);
|
|
284
|
+
const replay = yield* store.insert(original, 1);
|
|
285
|
+
yield* ensure(replay.version === completed.version && replay.state === "cancelled", "terminal replay lost its creation evidence");
|
|
286
|
+
const second = record("capacity-next");
|
|
287
|
+
const pausedSecond = yield* store.change(second, {
|
|
288
|
+
_tag: "Control",
|
|
289
|
+
expectedRevision: 1,
|
|
290
|
+
expectedVersion: second.version,
|
|
291
|
+
action: "pause",
|
|
292
|
+
nextAtMillis: second.nextAtMillis,
|
|
293
|
+
nowMillis: 150,
|
|
294
|
+
skippedRange: null
|
|
295
|
+
});
|
|
296
|
+
const pausedCapacity = yield* store.insert(record("capacity-third"), 1).pipe(Effect.result);
|
|
297
|
+
yield* ensure(Result.isFailure(pausedCapacity) && pausedCapacity.failure._tag === "ScheduleCapacityError", "paused future work did not reserve capacity");
|
|
298
|
+
yield* store.change(second, {
|
|
299
|
+
_tag: "Control",
|
|
300
|
+
expectedRevision: 1,
|
|
301
|
+
expectedVersion: pausedSecond.version,
|
|
302
|
+
action: "cancel",
|
|
303
|
+
nextAtMillis: null,
|
|
304
|
+
nowMillis: 160,
|
|
305
|
+
skippedRange: null
|
|
306
|
+
});
|
|
307
|
+
const admitted = pendingRecord("capacity-completed");
|
|
308
|
+
yield* store.insert(admitted, 1);
|
|
309
|
+
const settled = yield* store.change(admitted, {
|
|
310
|
+
_tag: "Complete",
|
|
311
|
+
occurrenceId: admitted.pending?.envelope.occurrenceId ?? digest,
|
|
312
|
+
receipt,
|
|
313
|
+
nowMillis: 170
|
|
314
|
+
});
|
|
315
|
+
yield* store.insert(record("capacity-third"), 1);
|
|
316
|
+
const reactivated = yield* store.change(admitted, {
|
|
317
|
+
_tag: "Update",
|
|
318
|
+
expectedRevision: 1,
|
|
319
|
+
configuration: admitted.configuration,
|
|
320
|
+
nextAtMillis: 200,
|
|
321
|
+
nowMillis: 180
|
|
322
|
+
}, 1).pipe(Effect.result);
|
|
323
|
+
yield* ensure(Result.isFailure(reactivated) && reactivated.failure._tag === "ScheduleCapacityError", "reactivation exceeded operational capacity");
|
|
324
|
+
yield* ensure((yield* store.get(admitted))?.version === settled.version, "capacity failure mutated the completed record");
|
|
325
|
+
})),
|
|
326
|
+
conformanceCase("advances due pagination beyond unchanged rows with equal deadlines", (ensure) => Effect.gen(function* () {
|
|
327
|
+
const store = yield* ScheduleStore;
|
|
328
|
+
for (const name of [
|
|
329
|
+
"due-a",
|
|
330
|
+
"due-b",
|
|
331
|
+
"due-c"
|
|
332
|
+
]) yield* store.insert(record(name), 10);
|
|
333
|
+
const first = yield* store.due(100, 1);
|
|
334
|
+
const second = yield* store.due(100, 1, void 0, first[0]);
|
|
335
|
+
const third = yield* store.due(100, 1, void 0, second[0]);
|
|
336
|
+
yield* ensure(first[0]?.scheduleId === id("due-a") && second[0]?.scheduleId === id("due-b") && third[0]?.scheduleId === id("due-c"), "due pages repeated or skipped a key");
|
|
337
|
+
yield* ensure((yield* store.due(100, 1, void 0, third[0])).length === 0, "due cursor did not terminate");
|
|
338
|
+
})),
|
|
339
|
+
conformanceCase("fences stale preparation and control while preserving frozen pending work", (ensure) => Effect.gen(function* () {
|
|
340
|
+
const store = yield* ScheduleStore;
|
|
341
|
+
const prepareOriginal = record("stale-prepare");
|
|
342
|
+
yield* store.insert(prepareOriginal, 10);
|
|
343
|
+
const edited = yield* store.change(key("stale-prepare"), {
|
|
344
|
+
_tag: "Update",
|
|
345
|
+
expectedRevision: 1,
|
|
346
|
+
configuration: {
|
|
347
|
+
...prepareOriginal.configuration,
|
|
348
|
+
timing: {
|
|
349
|
+
_tag: "At",
|
|
350
|
+
atMillis: 200
|
|
351
|
+
},
|
|
352
|
+
input: { value: "edited-before-prepare" }
|
|
353
|
+
},
|
|
354
|
+
nextAtMillis: 200,
|
|
355
|
+
nowMillis: 10
|
|
356
|
+
});
|
|
357
|
+
const staleEnvelope = pendingRecord("stale-prepare").pending?.envelope;
|
|
358
|
+
if (staleEnvelope === void 0) return yield* ScheduleStoreConformanceViolation.make({
|
|
359
|
+
caseName: "fences stale preparation and control while preserving frozen pending work",
|
|
360
|
+
message: "fixture did not contain a pending envelope"
|
|
361
|
+
});
|
|
362
|
+
const stalePrepare = yield* store.change(key("stale-prepare"), {
|
|
363
|
+
_tag: "Prepare",
|
|
364
|
+
expectedRevision: 1,
|
|
365
|
+
expectedCursor: 100,
|
|
366
|
+
envelope: staleEnvelope,
|
|
367
|
+
nextAtMillis: null,
|
|
368
|
+
skippedRange: null,
|
|
369
|
+
nowMillis: 110
|
|
370
|
+
}).pipe(Effect.result);
|
|
371
|
+
yield* ensure(Result.isFailure(stalePrepare) && stalePrepare.failure._tag === "ScheduleConflict", "stale preparation did not conflict");
|
|
372
|
+
yield* ensure(JSON.stringify(yield* store.get(key("stale-prepare"))) === JSON.stringify(edited), "stale preparation changed the edited record");
|
|
373
|
+
const frozen = pendingRecord("pending-update");
|
|
374
|
+
yield* store.insert(frozen, 10);
|
|
375
|
+
const frozenEnvelope = JSON.stringify(frozen.pending?.envelope);
|
|
376
|
+
const updatedPending = yield* store.change(key("pending-update"), {
|
|
377
|
+
_tag: "Update",
|
|
378
|
+
expectedRevision: 1,
|
|
379
|
+
configuration: {
|
|
380
|
+
...frozen.configuration,
|
|
381
|
+
timing: {
|
|
382
|
+
_tag: "At",
|
|
383
|
+
atMillis: 300
|
|
384
|
+
},
|
|
385
|
+
input: { value: "new-configuration" }
|
|
386
|
+
},
|
|
387
|
+
nextAtMillis: 300,
|
|
388
|
+
nowMillis: 20
|
|
389
|
+
});
|
|
390
|
+
yield* ensure(JSON.stringify(updatedPending.pending?.envelope) === frozenEnvelope, "configuration update changed the frozen pending envelope");
|
|
391
|
+
const completedOriginal = pendingRecord("stale-control");
|
|
392
|
+
yield* store.insert(completedOriginal, 10);
|
|
393
|
+
const occurrenceId = completedOriginal.pending?.envelope.occurrenceId;
|
|
394
|
+
if (occurrenceId === void 0) return yield* ScheduleStoreConformanceViolation.make({
|
|
395
|
+
caseName: "fences stale preparation and control while preserving frozen pending work",
|
|
396
|
+
message: "fixture did not contain an occurrence identifier"
|
|
397
|
+
});
|
|
398
|
+
const completed = yield* store.change(key("stale-control"), {
|
|
399
|
+
_tag: "Complete",
|
|
400
|
+
occurrenceId,
|
|
401
|
+
receipt,
|
|
402
|
+
nowMillis: 130
|
|
403
|
+
});
|
|
404
|
+
const staleControl = yield* store.change(key("stale-control"), {
|
|
405
|
+
_tag: "Control",
|
|
406
|
+
expectedRevision: 1,
|
|
407
|
+
expectedVersion: 1,
|
|
408
|
+
action: "resume",
|
|
409
|
+
nextAtMillis: 100,
|
|
410
|
+
nowMillis: 140,
|
|
411
|
+
skippedRange: null
|
|
412
|
+
}).pipe(Effect.result);
|
|
413
|
+
yield* ensure(Result.isFailure(staleControl) && staleControl.failure._tag === "ScheduleConflict", "stale control did not conflict");
|
|
414
|
+
const afterControl = yield* store.get(key("stale-control"));
|
|
415
|
+
yield* ensure(afterControl?.nextAtMillis === null, "stale control revived a completed one-shot");
|
|
416
|
+
yield* ensure(afterControl?.version === completed.version && afterControl.lastReceipt !== null, "stale control changed completed state");
|
|
417
|
+
}))
|
|
418
|
+
];
|
|
419
|
+
export { ScheduleStoreConformanceViolation, scheduleStoreConformanceCases };
|
|
420
|
+
|
|
421
|
+
//# sourceMappingURL=ScheduleStoreConformance.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScheduleStoreConformance.mjs","names":[],"sources":["../../src/durable/ScheduleStoreConformance.ts"],"sourcesContent":["import * as Effect from 'effect/Effect'\nimport * as Result from 'effect/Result'\nimport * as Schema from 'effect/Schema'\n\nimport { AgentId, ReceiptId, SubmissionId, ThreadId } from '../core/Identifiers'\nimport { Receipt } from './DurableAgentRuntime'\nimport { DefinitionDigests, Digest, type PersistedJson } from './Records'\nimport {\n ScheduleCapacityError,\n ScheduleId,\n type ScheduleKey,\n type ScheduleRecord,\n ScheduleStore,\n type ScheduleStoreFailure,\n} from './Schedule'\nimport { IdempotencyKey, Principal, QueueSequence } from './SubmissionLedger'\n\nexport class ScheduleStoreConformanceViolation extends Schema.TaggedError<ScheduleStoreConformanceViolation>()(\n 'ScheduleStoreConformanceViolation',\n { caseName: Schema.String, message: Schema.String },\n) {}\n\nexport type ScheduleStoreConformanceFailure =\n | ScheduleStoreFailure\n | ScheduleStoreConformanceViolation\n\nexport interface ScheduleStoreConformanceCase {\n readonly name: string\n readonly run: Effect.Effect<void, ScheduleStoreConformanceFailure, ScheduleStore>\n}\n\nconst id = Schema.decodeSync(ScheduleId)\nconst principal = Schema.decodeSync(Principal)('schedule-conformance-principal')\nconst agentId = Schema.decodeSync(AgentId)('schedule-conformance-agent')\nconst threadId = Schema.decodeSync(ThreadId)('schedule-conformance-thread')\nconst digest = Schema.decodeSync(Digest)('d'.repeat(64))\nconst definitions = DefinitionDigests.make({ agent: digest, model: digest, tools: digest })\n\nconst key = (name: string, ownerId = 'owner'): ScheduleKey => ({\n owner: { tenantId: 'schedule-conformance-tenant', ownerId },\n scheduleId: id(name),\n})\n\nconst record = (\n name: string,\n input: PersistedJson = { value: name },\n ownerId = 'owner',\n): ScheduleRecord => ({\n schemaVersion: 1,\n ...key(name, ownerId),\n creationFingerprint: Schema.decodeSync(Digest)('a'.repeat(64)),\n createdBy: principal,\n createdAtMillis: 1,\n updatedAtMillis: 1,\n configurationRevision: 1,\n version: 1,\n configuration: {\n timing: { _tag: 'At', atMillis: 100 },\n destination: { _tag: 'ExistingThread', threadId },\n deliveryPrincipal: principal,\n agentId,\n definitions,\n input,\n inputDigest: digest,\n },\n state: 'active',\n nextAtMillis: 100,\n pending: null,\n lastReceipt: null,\n lastRefusal: null,\n lastSkippedRange: null,\n})\n\nconst pendingRecord = (name: string): ScheduleRecord => {\n const base = record(name)\n const occurrenceId = Schema.decodeSync(Digest)('e'.repeat(64))\n\n return {\n ...base,\n nextAtMillis: null,\n pending: {\n envelope: {\n schemaVersion: 1,\n ...key(name),\n configurationRevision: 1,\n intendedAtMillis: 100,\n preparedAtMillis: 110,\n occurrenceId,\n threadId,\n deliveryPrincipal: principal,\n agentId,\n definitions,\n input: base.configuration.input,\n inputDigest: digest,\n admissionKey: Schema.decodeSync(IdempotencyKey)(`schedule:${name}`),\n authorization: { policyId: 'policy', decisionId: 'decision' },\n },\n retry: {\n generation: 0,\n attempts: 0,\n automaticAttempts: 0,\n parked: false,\n nextAttemptAtMillis: 120,\n lastAttemptAtMillis: null,\n lastFailure: null,\n },\n },\n }\n}\n\nconst receipt = Receipt.make({\n receiptId: Schema.decodeSync(ReceiptId)('schedule-conformance-receipt'),\n submissionId: Schema.decodeSync(SubmissionId)('schedule-conformance-submission'),\n threadId,\n queueSequence: Schema.decodeSync(QueueSequence)(1),\n})\n\nconst conformanceCase = (\n name: string,\n run: (\n ensure: (\n condition: boolean,\n message: string,\n ) => Effect.Effect<void, ScheduleStoreConformanceViolation>,\n ) => Effect.Effect<void, ScheduleStoreConformanceFailure, ScheduleStore>,\n): ScheduleStoreConformanceCase => ({\n name,\n run: run((condition, message) =>\n condition\n ? Effect.void\n : Effect.fail(ScheduleStoreConformanceViolation.make({ caseName: name, message }))\n ).pipe(Effect.withSpan(`ScheduleStoreConformance.${name}`)),\n})\n\nconst creationReplay = conformanceCase(\n 'returns the current record when creation replays after an edit',\n (ensure) =>\n Effect.gen(function*() {\n const store = yield* ScheduleStore\n const original = record('creation-replay')\n\n yield* store.insert(original, 10)\n\n const edited = yield* store.change(key('creation-replay'), {\n _tag: 'Update',\n expectedRevision: 1,\n configuration: {\n ...original.configuration,\n input: { value: 'edited' },\n },\n nextAtMillis: 200,\n nowMillis: 10,\n })\n\n const replayed = yield* store.insert(original, 10)\n\n yield* ensure(replayed.version === edited.version, 'creation replay returned stale state')\n yield* ensure(\n replayed.configurationRevision === 2,\n 'creation replay lost the edited configuration revision',\n )\n yield* ensure(\n JSON.stringify(replayed.configuration.input) === JSON.stringify({ value: 'edited' }),\n 'creation replay returned the original input',\n )\n }),\n)\n\nconst staleCompletion = conformanceCase(\n 'makes stale completions and retry regressions full no-ops',\n (ensure) =>\n Effect.gen(function*() {\n const store = yield* ScheduleStore\n const original = pendingRecord('stale-completion')\n\n yield* store.insert(original, 10)\n\n const stale = yield* store.change(key('stale-completion'), {\n _tag: 'Complete',\n occurrenceId: yield* Schema.decodeEffect(Digest)('f'.repeat(64)).pipe(Effect.orDie),\n receipt,\n nowMillis: 130,\n })\n\n yield* ensure(stale.version === original.version, 'stale completion changed the version')\n yield* ensure(stale.pending !== null, 'stale completion cleared pending work')\n yield* ensure(stale.lastReceipt === null, 'stale completion changed bounded status')\n\n const advanced = yield* store.change(key('stale-completion'), {\n _tag: 'Retry',\n occurrenceId: original.pending?.envelope.occurrenceId ?? digest,\n retry: {\n generation: 0,\n automaticAttempts: 0,\n parked: false,\n attempts: 2,\n nextAttemptAtMillis: 500,\n lastAttemptAtMillis: 200,\n lastFailure: 'transport',\n },\n nowMillis: 200,\n })\n\n const regressed = yield* store.change(key('stale-completion'), {\n _tag: 'Retry',\n occurrenceId: original.pending?.envelope.occurrenceId ?? digest,\n retry: {\n generation: 0,\n automaticAttempts: 0,\n parked: false,\n attempts: 1,\n nextAttemptAtMillis: 300,\n lastAttemptAtMillis: 150,\n lastFailure: 'timeout',\n },\n nowMillis: 210,\n })\n\n yield* ensure(regressed.version === advanced.version, 'retry regression changed the version')\n yield* ensure(\n regressed.pending?.retry.nextAttemptAtMillis === 500,\n 'retry regression moved the deadline backward',\n )\n }),\n)\n\nconst isolationAndCloning = conformanceCase(\n 'isolates owner pages, prioritizes pending deadlines, and clones writes',\n (ensure) =>\n Effect.gen(function*() {\n const store = yield* ScheduleStore\n const mutableInput = { value: 'before' }\n\n yield* store.insert(record('z-page', mutableInput), 10)\n mutableInput.value = 'after'\n yield* store.insert(record('a-page'), 10)\n yield* store.insert(pendingRecord('pending-first'), 10)\n yield* store.insert(record('foreign', { value: 'foreign' }, 'other-owner'), 10)\n\n const page = yield* store.list({ owner: key('ignored').owner, limit: 2 })\n\n yield* ensure(page.items.length === 2, 'owner page returned the wrong item count')\n yield* ensure(page.items[0]?.scheduleId === id('a-page'), 'owner page order is unstable')\n yield* ensure(page.next === id('pending-first'), 'owner page cursor is not its last item')\n yield* ensure(\n page.items.every((item) => item.owner.ownerId === 'owner'),\n 'owner page leaked a foreign owner',\n )\n\n const stored = yield* store.get(key('z-page'))\n\n yield* ensure(\n JSON.stringify(stored?.configuration.input) === JSON.stringify({ value: 'before' }),\n 'caller mutation changed the authoritative stored input',\n )\n const due = yield* store.due(150, 10, key('ignored').owner)\n\n yield* ensure(\n due[0]?.scheduleId === id('a-page') || due[0]?.scheduleId === id('z-page'),\n 'due ordering did not use the earliest deadline',\n )\n yield* ensure(\n due.some((item) => item.scheduleId === id('pending-first')),\n 'due query omitted pending recovery',\n )\n }),\n)\n\nconst ownerCapacity = conformanceCase(\n 'enforces owner capacity without affecting other owners',\n (ensure) =>\n Effect.gen(function*() {\n const store = yield* ScheduleStore\n\n yield* store.insert(record('capacity-one', { value: 1 }, 'capacity-owner'), 1)\n\n const attempted = yield* store\n .insert(record('capacity-two', { value: 2 }, 'capacity-owner'), 1)\n .pipe(Effect.result)\n\n yield* ensure(\n Result.isFailure(attempted) &&\n Schema.is(ScheduleCapacityError)(attempted.failure) &&\n Object.prototype.isPrototypeOf.call(ScheduleCapacityError.prototype, attempted.failure),\n 'owner capacity did not fail with ScheduleCapacityError',\n )\n\n const other = yield* store.insert(\n record('capacity-other', { value: 3 }, 'capacity-other'),\n 1,\n )\n\n yield* ensure(other.scheduleId === id('capacity-other'), 'capacity leaked across owners')\n }),\n)\n\nconst retainedEvidence = conformanceCase(\n 'releases terminal capacity without deleting replay evidence and fences reactivation',\n (ensure) =>\n Effect.gen(function*() {\n const store = yield* ScheduleStore\n const original = pendingRecord('capacity-retained')\n\n yield* store.insert(original, 1)\n\n const paused = yield* store.change(original, {\n _tag: 'Control',\n expectedRevision: 1,\n expectedVersion: original.version,\n action: 'pause',\n nextAtMillis: null,\n nowMillis: 120,\n skippedRange: null,\n })\n\n const cancelled = yield* store.change(original, {\n _tag: 'Control',\n expectedRevision: 1,\n expectedVersion: paused.version,\n action: 'cancel',\n nextAtMillis: null,\n nowMillis: 130,\n skippedRange: null,\n })\n\n const blocked = yield* store.insert(record('capacity-next'), 1).pipe(Effect.result)\n\n yield* ensure(\n Result.isFailure(blocked) && blocked.failure._tag === 'ScheduleCapacityError',\n 'cancellation released unresolved pending capacity',\n )\n\n const parked = yield* store.change(original, {\n _tag: 'Retry',\n occurrenceId: original.pending?.envelope.occurrenceId ?? digest,\n retry: {\n generation: 0,\n attempts: 3,\n automaticAttempts: 3,\n parked: true,\n nextAttemptAtMillis: 140,\n lastAttemptAtMillis: 130,\n lastFailure: 'transport',\n },\n nowMillis: 130,\n })\n\n yield* ensure(\n (yield* store.due(140, 10, original.owner)).length === 0,\n 'Parked work must not retry automatically',\n )\n\n const recovered = yield* store.change(original, {\n _tag: 'Recover',\n expectedGeneration: 0,\n expectedRevision: parked.configurationRevision,\n occurrenceId: original.pending?.envelope.occurrenceId ?? digest,\n nowMillis: 140,\n })\n\n yield* ensure(\n recovered.state === 'cancelled' &&\n recovered.pending?.retry.automaticAttempts === 0 &&\n recovered.pending.retry.attempts === 3 &&\n recovered.pending.retry.parked === false &&\n JSON.stringify(recovered.pending.envelope) === JSON.stringify(original.pending?.envelope),\n 'Explicit recovery must preserve cancelled pending identity and total attempts',\n )\n\n const staleRetry = yield* store.change(original, {\n _tag: 'Retry',\n occurrenceId: original.pending?.envelope.occurrenceId ?? digest,\n retry: {\n generation: 0,\n attempts: 99,\n automaticAttempts: 99,\n parked: true,\n nextAttemptAtMillis: 150,\n lastAttemptAtMillis: 145,\n lastFailure: 'transport',\n },\n nowMillis: 145,\n })\n\n yield* ensure(\n JSON.stringify(staleRetry) === JSON.stringify(recovered),\n 'A pre-recovery retry consumed the new generation',\n )\n\n const repeatedRecovery = yield* store.change(original, {\n _tag: 'Recover',\n expectedGeneration: 0,\n expectedRevision: recovered.configurationRevision,\n occurrenceId: original.pending?.envelope.occurrenceId ?? digest,\n nowMillis: 146,\n })\n\n yield* ensure(\n JSON.stringify(repeatedRecovery) === JSON.stringify(recovered),\n 'A repeated recovery changed its original generation',\n )\n\n const completed = yield* store.change(original, {\n _tag: 'Complete',\n occurrenceId: original.pending?.envelope.occurrenceId ?? digest,\n receipt,\n nowMillis: 140,\n })\n\n yield* ensure(\n completed.pending === null && cancelled.pending !== null,\n 'completion did not clear pending work',\n )\n yield* store.insert(record('capacity-next'), 1)\n const replay = yield* store.insert(original, 1)\n\n yield* ensure(\n replay.version === completed.version && replay.state === 'cancelled',\n 'terminal replay lost its creation evidence',\n )\n\n const second = record('capacity-next')\n\n const pausedSecond = yield* store.change(second, {\n _tag: 'Control',\n expectedRevision: 1,\n expectedVersion: second.version,\n action: 'pause',\n nextAtMillis: second.nextAtMillis,\n nowMillis: 150,\n skippedRange: null,\n })\n\n const pausedCapacity = yield* store.insert(record('capacity-third'), 1).pipe(Effect.result)\n\n yield* ensure(\n Result.isFailure(pausedCapacity) && pausedCapacity.failure._tag === 'ScheduleCapacityError',\n 'paused future work did not reserve capacity',\n )\n yield* store.change(second, {\n _tag: 'Control',\n expectedRevision: 1,\n expectedVersion: pausedSecond.version,\n action: 'cancel',\n nextAtMillis: null,\n nowMillis: 160,\n skippedRange: null,\n })\n const admitted = pendingRecord('capacity-completed')\n\n yield* store.insert(admitted, 1)\n\n const settled = yield* store.change(admitted, {\n _tag: 'Complete',\n occurrenceId: admitted.pending?.envelope.occurrenceId ?? digest,\n receipt,\n nowMillis: 170,\n })\n\n yield* store.insert(record('capacity-third'), 1)\n\n const reactivated = yield* store\n .change(\n admitted,\n {\n _tag: 'Update',\n expectedRevision: 1,\n configuration: admitted.configuration,\n nextAtMillis: 200,\n nowMillis: 180,\n },\n 1,\n )\n .pipe(Effect.result)\n\n yield* ensure(\n Result.isFailure(reactivated) && reactivated.failure._tag === 'ScheduleCapacityError',\n 'reactivation exceeded operational capacity',\n )\n yield* ensure(\n (yield* store.get(admitted))?.version === settled.version,\n 'capacity failure mutated the completed record',\n )\n }),\n)\n\nconst duePagination = conformanceCase(\n 'advances due pagination beyond unchanged rows with equal deadlines',\n (ensure) =>\n Effect.gen(function*() {\n const store = yield* ScheduleStore\n\n for (const name of ['due-a', 'due-b', 'due-c']) yield* store.insert(record(name), 10)\n const first = yield* store.due(100, 1)\n const second = yield* store.due(100, 1, undefined, first[0])\n const third = yield* store.due(100, 1, undefined, second[0])\n\n yield* ensure(\n first[0]?.scheduleId === id('due-a') &&\n second[0]?.scheduleId === id('due-b') &&\n third[0]?.scheduleId === id('due-c'),\n 'due pages repeated or skipped a key',\n )\n yield* ensure(\n (yield* store.due(100, 1, undefined, third[0])).length === 0,\n 'due cursor did not terminate',\n )\n }),\n)\n\nconst transitionFencing = conformanceCase(\n 'fences stale preparation and control while preserving frozen pending work',\n (ensure) =>\n Effect.gen(function*() {\n const store = yield* ScheduleStore\n\n const prepareOriginal = record('stale-prepare')\n\n yield* store.insert(prepareOriginal, 10)\n\n const edited = yield* store.change(key('stale-prepare'), {\n _tag: 'Update',\n expectedRevision: 1,\n configuration: {\n ...prepareOriginal.configuration,\n timing: { _tag: 'At', atMillis: 200 },\n input: { value: 'edited-before-prepare' },\n },\n nextAtMillis: 200,\n nowMillis: 10,\n })\n\n const staleEnvelope = pendingRecord('stale-prepare').pending?.envelope\n\n if (staleEnvelope === undefined) {\n return yield* ScheduleStoreConformanceViolation.make({\n caseName: 'fences stale preparation and control while preserving frozen pending work',\n message: 'fixture did not contain a pending envelope',\n })\n }\n\n const stalePrepare = yield* store\n .change(key('stale-prepare'), {\n _tag: 'Prepare',\n expectedRevision: 1,\n expectedCursor: 100,\n envelope: staleEnvelope,\n nextAtMillis: null,\n skippedRange: null,\n nowMillis: 110,\n })\n .pipe(Effect.result)\n\n yield* ensure(\n Result.isFailure(stalePrepare) && stalePrepare.failure._tag === 'ScheduleConflict',\n 'stale preparation did not conflict',\n )\n yield* ensure(\n JSON.stringify(yield* store.get(key('stale-prepare'))) === JSON.stringify(edited),\n 'stale preparation changed the edited record',\n )\n\n const frozen = pendingRecord('pending-update')\n\n yield* store.insert(frozen, 10)\n const frozenEnvelope = JSON.stringify(frozen.pending?.envelope)\n\n const updatedPending = yield* store.change(key('pending-update'), {\n _tag: 'Update',\n expectedRevision: 1,\n configuration: {\n ...frozen.configuration,\n timing: { _tag: 'At', atMillis: 300 },\n input: { value: 'new-configuration' },\n },\n nextAtMillis: 300,\n nowMillis: 20,\n })\n\n yield* ensure(\n JSON.stringify(updatedPending.pending?.envelope) === frozenEnvelope,\n 'configuration update changed the frozen pending envelope',\n )\n\n const completedOriginal = pendingRecord('stale-control')\n\n yield* store.insert(completedOriginal, 10)\n const occurrenceId = completedOriginal.pending?.envelope.occurrenceId\n\n if (occurrenceId === undefined) {\n return yield* ScheduleStoreConformanceViolation.make({\n caseName: 'fences stale preparation and control while preserving frozen pending work',\n message: 'fixture did not contain an occurrence identifier',\n })\n }\n\n const completed = yield* store.change(key('stale-control'), {\n _tag: 'Complete',\n occurrenceId,\n receipt,\n nowMillis: 130,\n })\n\n const staleControl = yield* store\n .change(key('stale-control'), {\n _tag: 'Control',\n expectedRevision: 1,\n expectedVersion: 1,\n action: 'resume',\n nextAtMillis: 100,\n nowMillis: 140,\n skippedRange: null,\n })\n .pipe(Effect.result)\n\n yield* ensure(\n Result.isFailure(staleControl) && staleControl.failure._tag === 'ScheduleConflict',\n 'stale control did not conflict',\n )\n const afterControl = yield* store.get(key('stale-control'))\n\n yield* ensure(\n afterControl?.nextAtMillis === null,\n 'stale control revived a completed one-shot',\n )\n yield* ensure(\n afterControl?.version === completed.version && afterControl.lastReceipt !== null,\n 'stale control changed completed state',\n )\n }),\n)\n\n/** Adapter-neutral contract cases. Each case uses disjoint owner and Schedule identities. */\nexport const scheduleStoreConformanceCases: ReadonlyArray<ScheduleStoreConformanceCase> = [\n creationReplay,\n staleCompletion,\n isolationAndCloning,\n ownerCapacity,\n retainedEvidence,\n duePagination,\n transitionFencing,\n]\n"],"mappings":";;;;;;;;AAiBA,IAAa,oCAAb,cAAuD,OAAO,YAA+C,CAAC,CAC5G,qCACA;CAAE,UAAU,OAAO;CAAQ,SAAS,OAAO;AAAO,CACpD,CAAC,CAAC,CAAC;AAWH,MAAM,KAAK,OAAO,WAAW,UAAU;AACvC,MAAM,YAAY,OAAO,WAAW,SAAS,CAAC,CAAC,gCAAgC;AAC/E,MAAM,UAAU,OAAO,WAAW,OAAO,CAAC,CAAC,4BAA4B;AACvE,MAAM,WAAW,OAAO,WAAW,QAAQ,CAAC,CAAC,6BAA6B;AAC1E,MAAM,SAAS,OAAO,WAAW,MAAM,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC;AACvD,MAAM,cAAc,kBAAkB,KAAK;CAAE,OAAO;CAAQ,OAAO;CAAQ,OAAO;AAAO,CAAC;AAE1F,MAAM,OAAO,MAAc,UAAU,aAA0B;CAC7D,OAAO;EAAE,UAAU;EAA+B;CAAQ;CAC1D,YAAY,GAAG,IAAI;AACrB;AAEA,MAAM,UACJ,MACA,QAAuB,EAAE,OAAO,KAAK,GACrC,UAAU,aACU;CACpB,eAAe;CACf,GAAG,IAAI,MAAM,OAAO;CACpB,qBAAqB,OAAO,WAAW,MAAM,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC;CAC7D,WAAW;CACX,iBAAiB;CACjB,iBAAiB;CACjB,uBAAuB;CACvB,SAAS;CACT,eAAe;EACb,QAAQ;GAAE,MAAM;GAAM,UA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CAAC;EAGH,MAAM,YAAY,OAAO,MAAM,OAAO,IAAI,eAAe,GAAG;GAC1D,MAAM;GACN;GACA;GACA,WAAW;EACb,CAAC;EAED,MAAM,eAAe,OAAO,MACzB,OAAO,IAAI,eAAe,GAAG;GAC5B,MAAM;GACN,kBAAkB;GAClB,iBAAiB;GACjB,QAAQ;GACR,cAAc;GACd,WAAW;GACX,cAAc;EAChB,CAAC,CAAC,CACD,KAAK,OAAO,MAAM;EAErB,OAAO,OACL,OAAO,UAAU,YAAY,KAAK,aAAa,QAAQ,SAAS,oBAChE,gCACF;EACA,MAAM,eAAe,OAAO,MAAM,IAAI,IAAI,eAAe,CAAC;EAE1D,OAAO,OACL,cAAc,iBAAiB,MAC/B,4CACF;EACA,OAAO,OACL,cAAc,YAAY,UAAU,WAAW,aAAa,gBAAgB,MAC5E,uCACF;CACF,CAAC,CAWH;AACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as scheduleDeadline, c as scheduleOwnerKey, i as compareScheduleNames, l as scheduleUsesCapacity, n as applyScheduleChange, o as scheduleKeyOf, r as compareScheduleKeys, s as scheduleKeyString } from "../ScheduleTransition-CjVP48I8.mjs";
|
|
2
|
+
export { applyScheduleChange, compareScheduleKeys, compareScheduleNames, scheduleDeadline, scheduleKeyOf, scheduleKeyString, scheduleOwnerKey, scheduleUsesCapacity };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as applyScheduleChange, r as compareScheduleKeys, i as compareScheduleNames, a as scheduleDeadline, o as scheduleKeyOf, s as scheduleKeyString, c as scheduleOwnerKey, l as scheduleUsesCapacity } from "../ScheduleTransition-DtNzlN9k.mjs";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ScheduleProcessFailure, c as Scheduling, i as ScheduleManagementFailure, n as ScheduleDriver, o as ScheduleUpdateOptions, r as ScheduleListOptions, s as ScheduleWakeNoop, t as ScheduleCreateOptions } from "../Scheduling-DYTM29s9.mjs";
|
|
2
|
+
export { ScheduleCreateOptions, ScheduleDriver, ScheduleListOptions, ScheduleManagementFailure, ScheduleProcessFailure, ScheduleUpdateOptions, ScheduleWakeNoop, Scheduling };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as ScheduleDriver, n as ScheduleWakeNoop, r as Scheduling } from "../Scheduling-BpJN9E1j.mjs";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Br as SettlementPublication, Gr as validateCanonicalSettlement, Hr as SettlementPublicationFailure, Kr as validateJoinedSettlement, Ur as SettlementPublicationResult, Vr as SettlementPublicationAuthority, Wr as SettlementPublisher, qr as validatePublication } from "../Admin-BfolLkHj.mjs";
|
|
2
|
+
export { SettlementPublication, SettlementPublicationAuthority, SettlementPublicationFailure, SettlementPublicationResult, SettlementPublisher, validateCanonicalSettlement, validateJoinedSettlement, validatePublication };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
import { l as SubmissionId } from "../Identifiers-LWd4837I.mjs";
|
|
5
|
+
import { X as RecordEnvelope, f as CanonicalSequence, gt as SubmissionSettled } from "../Records-C645aQks.mjs";
|
|
6
|
+
import { S as runIdForSubmission } from "../RunJournal-C_1eqQdr.mjs";
|
|
7
|
+
import { Mt as submissionSettlementBatchId, Nt as submissionSettlementId, Pt as submissionSettlementRecordId, R as LedgerError } from "../SubmissionLedger-WG0beEyt.mjs";
|
|
8
|
+
import { m as PreparedAppend, n as AppendRequest } from "../ThreadStore-BMUAp5Ta.mjs";
|
|
9
|
+
// src/durable/SettlementPublisher.ts
|
|
10
|
+
/** Authority rechecked atomically on every publication attempt, including canonical replay. */
|
|
11
|
+
const SettlementPublicationAuthority = Schema.Union([
|
|
12
|
+
Schema.TaggedStruct("Owned", {}),
|
|
13
|
+
Schema.TaggedStruct("Joined", { hostSubmissionId: SubmissionId }),
|
|
14
|
+
Schema.TaggedStruct("QueuedAbort", {})
|
|
15
|
+
]);
|
|
16
|
+
/** The deterministic settlement fact followed by its atomically published Run progress. */
|
|
17
|
+
var SettlementPublication = class extends Schema.Class("@effect-agent/thread/SettlementPublication")({
|
|
18
|
+
submissionId: SubmissionId,
|
|
19
|
+
authority: SettlementPublicationAuthority,
|
|
20
|
+
append: AppendRequest
|
|
21
|
+
}) {};
|
|
22
|
+
/** The actual immutable winner and CURRENT tail, including a replay of an earlier publication. */
|
|
23
|
+
var SettlementPublicationResult = class extends Schema.Class("@effect-agent/thread/SettlementPublicationResult")({
|
|
24
|
+
record: RecordEnvelope,
|
|
25
|
+
tailSequence: CanonicalSequence,
|
|
26
|
+
replayed: Schema.Boolean
|
|
27
|
+
}) {};
|
|
28
|
+
/**
|
|
29
|
+
* One storage owner validates publication authority and appends the terminal fact atomically.
|
|
30
|
+
* Wire preparation precedes the writer; no application callback runs inside its transaction.
|
|
31
|
+
* Existing canonical intent wins an authorized replay. A Run session checks its captured local
|
|
32
|
+
* capability before this trusted root mutation, including replay. Finalization recovers an
|
|
33
|
+
* already settled publication from canonical proof. Joined and queued-abort replay retain their recorded authority.
|
|
34
|
+
* Adapters may finalize in this transaction when no recoverable delivery remains; external
|
|
35
|
+
* notification runs outside the transaction.
|
|
36
|
+
*/
|
|
37
|
+
var SettlementPublisher = class extends Context.Service()("@effect-agent/thread/SettlementPublisher") {};
|
|
38
|
+
const PublicationHeader = SettlementPublication.mapFields((fields) => ({
|
|
39
|
+
submissionId: fields.submissionId,
|
|
40
|
+
authority: fields.authority
|
|
41
|
+
}));
|
|
42
|
+
const decodePublicationHeader = Schema.decodeEffect(PublicationHeader);
|
|
43
|
+
/** Own the bounded request before hashing, callbacks, or mutation authority can suspend it. */
|
|
44
|
+
const validatePublication = Effect.fnUntraced(function* (input) {
|
|
45
|
+
const invalid = (cause) => LedgerError.make({
|
|
46
|
+
operation: "publish settlement",
|
|
47
|
+
message: cause.message,
|
|
48
|
+
cause
|
|
49
|
+
});
|
|
50
|
+
const header = yield* decodePublicationHeader(input).pipe(Effect.mapError(invalid));
|
|
51
|
+
const append = yield* PreparedAppend.capture(input.append).pipe(Effect.mapError(invalid));
|
|
52
|
+
const request = Object.freeze(SettlementPublication.make({
|
|
53
|
+
...header,
|
|
54
|
+
authority: Object.freeze(header.authority),
|
|
55
|
+
append
|
|
56
|
+
}));
|
|
57
|
+
const record = request.append.batch.records[0];
|
|
58
|
+
if (request.append.batch.records.slice(1).some((progress) => progress.payload._tag !== "RunContinuation" || progress.payload.lastFact.recordId !== record.recordId || progress.payload.runId !== runIdForSubmission(request.submissionId) && (record.payload._tag !== "SubmissionSettled" || progress.payload.runId !== record.payload.runId)) || record === void 0 || record.payload._tag !== "SubmissionSettled" || record.payload.submissionId !== request.submissionId || record.payload.settlementId !== submissionSettlementId(request.submissionId) || record.recordId !== submissionSettlementRecordId(request.submissionId) || request.append.batch.batchId !== submissionSettlementBatchId(request.submissionId)) return yield* LedgerError.make({
|
|
59
|
+
operation: "publish settlement",
|
|
60
|
+
message: "Publication must contain the deterministic settlement and only its owning Run progress"
|
|
61
|
+
});
|
|
62
|
+
return {
|
|
63
|
+
request,
|
|
64
|
+
record,
|
|
65
|
+
settlement: record.payload
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
/** The caller selects the canonical row from the expected Thread before invoking this check. */
|
|
69
|
+
const validateCanonicalSettlement = Effect.fnUntraced(function* (input, expected) {
|
|
70
|
+
const record = yield* Schema.decodeEffect(Schema.toType(RecordEnvelope))(input).pipe(Effect.mapError((cause) => LedgerError.make({
|
|
71
|
+
operation: "read canonical settlement",
|
|
72
|
+
message: cause.message,
|
|
73
|
+
cause
|
|
74
|
+
})));
|
|
75
|
+
const settlement = record.payload;
|
|
76
|
+
if (settlement._tag !== "SubmissionSettled" || settlement.submissionId !== expected.submissionId || settlement.receiptId !== expected.receiptId || settlement.settlementId !== submissionSettlementId(expected.submissionId) || record.recordId !== submissionSettlementRecordId(expected.submissionId) || "runId" in expected && settlement.runId !== expected.runId) return yield* LedgerError.make({
|
|
77
|
+
operation: "read canonical settlement",
|
|
78
|
+
message: "Canonical settlement disagrees with the admitted Submission identity"
|
|
79
|
+
});
|
|
80
|
+
return settlement;
|
|
81
|
+
});
|
|
82
|
+
/** Joined receipts inherit the host outcome and failed diagnostic, with the host Run identity. */
|
|
83
|
+
const validateJoinedSettlement = Effect.fnUntraced(function* (settlement, host) {
|
|
84
|
+
const expected = SubmissionSettled.make({
|
|
85
|
+
submissionId: settlement.submissionId,
|
|
86
|
+
settlementId: settlement.settlementId,
|
|
87
|
+
receiptId: settlement.receiptId,
|
|
88
|
+
outcome: host.outcome,
|
|
89
|
+
runId: runIdForSubmission(host.submissionId),
|
|
90
|
+
...host.outcome === "failed" ? { result: host.result } : {}
|
|
91
|
+
});
|
|
92
|
+
if (!Schema.toEquivalence(SubmissionSettled)(settlement, expected)) return yield* LedgerError.make({
|
|
93
|
+
operation: "publish joined settlement",
|
|
94
|
+
message: "Joined settlement disagrees with its canonical host outcome"
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
export { SettlementPublication, SettlementPublicationAuthority, SettlementPublicationResult, SettlementPublisher, validateCanonicalSettlement, validateJoinedSettlement, validatePublication };
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=SettlementPublisher.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettlementPublisher.mjs","names":[],"sources":["../../src/durable/SettlementPublisher.ts"],"sourcesContent":["import * as Context from 'effect/Context'\nimport * as Effect from 'effect/Effect'\nimport * as Schema from 'effect/Schema'\n\nimport { type ReceiptId, type RunId, SubmissionId } from '../core/Identifiers'\nimport { CanonicalSequence, RecordEnvelope, SubmissionSettled, type SubmissionSettledRecord } from './Records'\nimport { runIdForSubmission } from './RunJournal'\nimport {\n LedgerError,\n type OwnershipLost,\n type SettlementConflict,\n submissionSettlementBatchId,\n submissionSettlementId,\n submissionSettlementRecordId,\n} from './SubmissionLedger'\nimport { AppendRequest, PreparedAppend, type ThreadStoreFailure } from './ThreadStore'\n\n/** Authority rechecked atomically on every publication attempt, including canonical replay. */\nexport const SettlementPublicationAuthority = Schema.Union([\n Schema.TaggedStruct('Owned', {}),\n Schema.TaggedStruct('Joined', { hostSubmissionId: SubmissionId }),\n Schema.TaggedStruct('QueuedAbort', {}),\n])\n\nexport type SettlementPublicationAuthority = typeof SettlementPublicationAuthority.Type\n\n/** The deterministic settlement fact followed by its atomically published Run progress. */\nexport class SettlementPublication extends Schema.Class<SettlementPublication>(\n '@effect-agent/thread/SettlementPublication',\n)({\n submissionId: SubmissionId,\n authority: SettlementPublicationAuthority,\n append: AppendRequest,\n}) {}\n\n/** The actual immutable winner and CURRENT tail, including a replay of an earlier publication. */\nexport class SettlementPublicationResult extends Schema.Class<SettlementPublicationResult>(\n '@effect-agent/thread/SettlementPublicationResult',\n)({\n record: RecordEnvelope,\n tailSequence: CanonicalSequence,\n\n replayed: Schema.Boolean,\n}) {}\n\nexport type SettlementPublicationFailure =\n | LedgerError\n | OwnershipLost\n | SettlementConflict\n | ThreadStoreFailure\n\n/**\n * One storage owner validates publication authority and appends the terminal fact atomically.\n * Wire preparation precedes the writer; no application callback runs inside its transaction.\n * Existing canonical intent wins an authorized replay. A Run session checks its captured local\n * capability before this trusted root mutation, including replay. Finalization recovers an\n * already settled publication from canonical proof. Joined and queued-abort replay retain their recorded authority.\n * Adapters may finalize in this transaction when no recoverable delivery remains; external\n * notification runs outside the transaction.\n */\nexport class SettlementPublisher extends Context.Service<\n SettlementPublisher,\n {\n readonly publish: (\n request: SettlementPublication,\n ) => Effect.Effect<SettlementPublicationResult, SettlementPublicationFailure>\n }\n>()('@effect-agent/thread/SettlementPublisher') {}\n\nconst PublicationHeader = SettlementPublication.mapFields((fields) => ({\n submissionId: fields.submissionId,\n authority: fields.authority,\n}))\n\nconst decodePublicationHeader = Schema.decodeEffect(PublicationHeader)\n\n/** Own the bounded request before hashing, callbacks, or mutation authority can suspend it. */\nexport const validatePublication = Effect.fnUntraced(function*(input: SettlementPublication) {\n const invalid = (cause: { readonly message: string }) =>\n LedgerError.make({ operation: 'publish settlement', message: cause.message, cause })\n\n const header = yield* decodePublicationHeader(input).pipe(Effect.mapError(invalid))\n const append = yield* PreparedAppend.capture(input.append).pipe(Effect.mapError(invalid))\n\n const request = Object.freeze(\n SettlementPublication.make({ ...header, authority: Object.freeze(header.authority), append }),\n )\n\n const record = request.append.batch.records[0]\n\n if (\n request.append.batch.records\n .slice(1)\n .some(\n (progress) =>\n progress.payload._tag !== 'RunContinuation' ||\n progress.payload.lastFact.recordId !== record.recordId ||\n (progress.payload.runId !== runIdForSubmission(request.submissionId) &&\n (record.payload._tag !== 'SubmissionSettled' ||\n progress.payload.runId !== record.payload.runId)),\n ) ||\n record === undefined ||\n record.payload._tag !== 'SubmissionSettled' ||\n record.payload.submissionId !== request.submissionId ||\n record.payload.settlementId !== submissionSettlementId(request.submissionId) ||\n record.recordId !== submissionSettlementRecordId(request.submissionId) ||\n request.append.batch.batchId !== submissionSettlementBatchId(request.submissionId)\n ) {\n return yield* LedgerError.make({\n operation: 'publish settlement',\n message: 'Publication must contain the deterministic settlement and only its owning Run progress',\n })\n }\n\n return { request, record, settlement: record.payload }\n})\n\n/** The caller selects the canonical row from the expected Thread before invoking this check. */\nexport const validateCanonicalSettlement = Effect.fnUntraced(function*(\n input: RecordEnvelope,\n expected: {\n readonly submissionId: SubmissionId\n readonly receiptId: ReceiptId\n readonly runId?: RunId | undefined\n },\n): Effect.fn.Return<SubmissionSettledRecord, LedgerError> {\n const record = yield* Schema.decodeEffect(Schema.toType(RecordEnvelope))(input).pipe(\n Effect.mapError((cause) =>\n LedgerError.make({ operation: 'read canonical settlement', message: cause.message, cause })\n ),\n )\n\n const settlement = record.payload\n\n if (\n settlement._tag !== 'SubmissionSettled' ||\n settlement.submissionId !== expected.submissionId ||\n settlement.receiptId !== expected.receiptId ||\n settlement.settlementId !== submissionSettlementId(expected.submissionId) ||\n record.recordId !== submissionSettlementRecordId(expected.submissionId) ||\n ('runId' in expected && settlement.runId !== expected.runId)\n ) {\n return yield* LedgerError.make({\n operation: 'read canonical settlement',\n message: 'Canonical settlement disagrees with the admitted Submission identity',\n })\n }\n\n return settlement\n})\n\n/** Joined receipts inherit the host outcome and failed diagnostic, with the host Run identity. */\nexport const validateJoinedSettlement = Effect.fnUntraced(function*(\n settlement: SubmissionSettledRecord,\n host: SubmissionSettledRecord,\n): Effect.fn.Return<void, LedgerError> {\n const expected = SubmissionSettled.make({\n submissionId: settlement.submissionId,\n settlementId: settlement.settlementId,\n receiptId: settlement.receiptId,\n outcome: host.outcome,\n runId: runIdForSubmission(host.submissionId),\n ...(host.outcome === 'failed' ? { result: host.result } : {}),\n })\n\n if (!Schema.toEquivalence(SubmissionSettled)(settlement, expected)) {\n return yield* LedgerError.make({\n operation: 'publish joined settlement',\n message: 'Joined settlement disagrees with its canonical host outcome',\n })\n }\n})\n"],"mappings":";;;;;;;;;;AAkBA,MAAa,iCAAiC,OAAO,MAAM;CACzD,OAAO,aAAa,SAAS,CAAC,CAAC;CAC/B,OAAO,aAAa,UAAU,EAAE,kBAAkB,aAAa,CAAC;CAChE,OAAO,aAAa,eAAe,CAAC,CAAC;AACvC,CAAC;;AAKD,IAAa,wBAAb,cAA2C,OAAO,MAChD,4CACF,CAAC,CAAC;CACA,cAAc;CACd,WAAW;CACX,QAAQ;AACV,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,8BAAb,cAAiD,OAAO,MACtD,kDACF,CAAC,CAAC;CACA,QAAQ;CACR,cAAc;CAEd,UAAU,OAAO;AACnB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;AAiBJ,IAAa,sBAAb,cAAyC,QAAQ,QAO/C,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC;AAEjD,MAAM,oBAAoB,sBAAsB,WAAW,YAAY;CACrE,cAAc,OAAO;CACrB,WAAW,OAAO;AACpB,EAAE;AAEF,MAAM,0BAA0B,OAAO,aAAa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