effect-agent 0.1.0-beta.85 → 0.1.0-beta.87

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.
Files changed (751) hide show
  1. package/dist/Agent-CN0EWRsR.d.mts +226 -0
  2. package/dist/Agent-RklVROrm.mjs +83 -0
  3. package/dist/Agent-RklVROrm.mjs.map +1 -0
  4. package/dist/AgentError-CggcAQ7V.d.mts +101 -0
  5. package/dist/AgentPolicy-CetmQrf3.d.mts +96 -0
  6. package/dist/AgentRuntime-BLyETCPo.mjs +4562 -0
  7. package/dist/AgentRuntime-BLyETCPo.mjs.map +1 -0
  8. package/dist/AgentRuntime-uxR_a4VM.d.mts +346 -0
  9. package/dist/AgentUpdates-DMJ-_xow.d.mts +53 -0
  10. package/dist/ContextCompactor-Dxu5zhOL.d.mts +161 -0
  11. package/dist/ContextWindow-DRQ5Mbm2.d.mts +58 -0
  12. package/dist/DurableAgentRuntime-uggeJpv3.mjs +6368 -0
  13. package/dist/DurableAgentRuntime-uggeJpv3.mjs.map +1 -0
  14. package/dist/DurableFailpoint-Oinuuedm.d.mts +41 -0
  15. package/dist/DurableStep-Cry_iol4.d.mts +103 -0
  16. package/dist/Ephemeral.d.mts +22 -0
  17. package/dist/Ephemeral.mjs +22 -0
  18. package/dist/Ephemeral.mjs.map +1 -0
  19. package/dist/EventSource-OqS_P9ug.d.mts +51 -0
  20. package/dist/Identifiers-CN2s30fF.d.mts +40 -0
  21. package/dist/MemoryNamespace-BbRW5p71.d.mts +36 -0
  22. package/dist/MemoryReference-B8Q3UJoJ.d.mts +79 -0
  23. package/dist/Messaging-CkcIdt4I.d.mts +490 -0
  24. package/dist/MessagingHost-CRk0kXzT.d.mts +246 -0
  25. package/dist/MessagingHost-CWi_PP3g.mjs +137 -0
  26. package/dist/MessagingHost-CWi_PP3g.mjs.map +1 -0
  27. package/dist/OperationAuthorizer-TzcQtpX5.d.mts +61 -0
  28. package/dist/Output-D6SkedVx.d.mts +25 -0
  29. package/dist/PageCapture-Df8Xwskw.d.mts +583 -0
  30. package/dist/PageScreenshot-BpgZKAxl.d.mts +48 -0
  31. package/dist/PreparedInputAdmission-C4HbjHgl.d.mts +38 -0
  32. package/dist/Receipt-BAHyigAF.d.mts +33 -0
  33. package/dist/Records-BAGkekt8.d.mts +3570 -0
  34. package/dist/RunEvent-DIrzkjLr.d.mts +460 -0
  35. package/dist/RunEventSink-D5aVhISG.d.mts +108 -0
  36. package/dist/RunJournal-Cgg1kNvc.mjs +825 -0
  37. package/dist/RunJournal-Cgg1kNvc.mjs.map +1 -0
  38. package/dist/RunOptions-g1aigcKI.d.mts +915 -0
  39. package/dist/RunPolicyUsage-ClZxyR46.d.mts +21 -0
  40. package/dist/Sandbox-CEsDWBLq.d.mts +173 -0
  41. package/dist/Schedule-H3SEYX9g.d.mts +842 -0
  42. package/dist/Scheduling-C9aIP8zT.mjs +691 -0
  43. package/dist/Scheduling-C9aIP8zT.mjs.map +1 -0
  44. package/dist/Subagent-Cy_hU1tv.mjs +1469 -0
  45. package/dist/Subagent-Cy_hU1tv.mjs.map +1 -0
  46. package/dist/Subagent-DyfzHNdv.d.mts +826 -0
  47. package/dist/SubagentContract-DdT7Cqe6.d.mts +116 -0
  48. package/dist/SubagentHost-CJUBQlcc.d.mts +140 -0
  49. package/dist/Subscription-BEP8oQO5.d.mts +921 -0
  50. package/dist/SubscriptionInput-vAAOBrK7.d.mts +41 -0
  51. package/dist/Thread-DOBQ0QUY.d.mts +96 -0
  52. package/dist/ThreadHistory-tS1KwxHR.d.mts +60 -0
  53. package/dist/ToolBroker-DWs4tZra.d.mts +133 -0
  54. package/dist/ToolExposure-9uF_Yo0T.mjs +10 -0
  55. package/dist/ToolExposure-9uF_Yo0T.mjs.map +1 -0
  56. package/dist/ToolExposure-C93U1sPu.mjs +30 -0
  57. package/dist/ToolExposure-C93U1sPu.mjs.map +1 -0
  58. package/dist/ToolExposure-UCN12eCd.d.mts +39 -0
  59. package/dist/ToolExposure-r2eOWk4F.d.mts +46 -0
  60. package/dist/ToolExposure.d.mts +6 -5
  61. package/dist/ToolExposure.mjs +17 -9
  62. package/dist/ToolExposure.mjs.map +1 -1
  63. package/dist/ToolReconciler-DQVaJfpE.d.mts +76 -0
  64. package/dist/ToolResult-DmmgoChv.d.mts +61 -0
  65. package/dist/Usage-Dx0aknfk.d.mts +121 -0
  66. package/dist/WakeScheduler-EjUF-GhC.d.mts +56 -0
  67. package/dist/Worker-CaPYykpe.d.mts +228 -0
  68. package/dist/agent-registration-CWDMOAZA.mjs +172 -0
  69. package/dist/agent-registration-CWDMOAZA.mjs.map +1 -0
  70. package/dist/capabilities/Approval.d.mts +114 -0
  71. package/dist/capabilities/Approval.mjs +226 -0
  72. package/dist/capabilities/Approval.mjs.map +1 -0
  73. package/dist/capabilities/Budget.d.mts +112 -0
  74. package/dist/capabilities/Budget.mjs +346 -0
  75. package/dist/capabilities/Budget.mjs.map +1 -0
  76. package/dist/capabilities/CodeMode.d.mts +157 -0
  77. package/dist/capabilities/CodeMode.mjs +522 -0
  78. package/dist/capabilities/CodeMode.mjs.map +1 -0
  79. package/dist/capabilities/Commands.d.mts +55 -0
  80. package/dist/capabilities/Commands.mjs +57 -0
  81. package/dist/capabilities/Commands.mjs.map +1 -0
  82. package/dist/capabilities/ContextTools.d.mts +321 -0
  83. package/dist/capabilities/ContextTools.mjs +126 -0
  84. package/dist/capabilities/ContextTools.mjs.map +1 -0
  85. package/dist/capabilities/Mcp.d.mts +108 -0
  86. package/dist/capabilities/Mcp.mjs +260 -0
  87. package/dist/capabilities/Mcp.mjs.map +1 -0
  88. package/dist/capabilities/McpClient.d.mts +115 -0
  89. package/dist/capabilities/McpClient.mjs +506 -0
  90. package/dist/capabilities/McpClient.mjs.map +1 -0
  91. package/dist/capabilities/MemoryNotes.d.mts +424 -0
  92. package/dist/capabilities/MemoryNotes.mjs +128 -0
  93. package/dist/capabilities/MemoryNotes.mjs.map +1 -0
  94. package/dist/capabilities/Messaging.d.mts +3 -0
  95. package/dist/capabilities/Messaging.mjs +151 -0
  96. package/dist/capabilities/Messaging.mjs.map +1 -0
  97. package/dist/capabilities/ModelContext.d.mts +89 -0
  98. package/dist/capabilities/ModelContext.mjs +168 -0
  99. package/dist/capabilities/ModelContext.mjs.map +1 -0
  100. package/dist/capabilities/Redaction.d.mts +37 -0
  101. package/dist/capabilities/Redaction.mjs +104 -0
  102. package/dist/capabilities/Redaction.mjs.map +1 -0
  103. package/dist/capabilities/Remembering.d.mts +434 -0
  104. package/dist/capabilities/Remembering.mjs +290 -0
  105. package/dist/capabilities/Remembering.mjs.map +1 -0
  106. package/dist/capabilities/RunHooks.d.mts +82 -0
  107. package/dist/capabilities/RunHooks.mjs +144 -0
  108. package/dist/capabilities/RunHooks.mjs.map +1 -0
  109. package/dist/capabilities/SemanticMemory.d.mts +431 -0
  110. package/dist/capabilities/SemanticMemory.mjs +315 -0
  111. package/dist/capabilities/SemanticMemory.mjs.map +1 -0
  112. package/dist/capabilities/Subagent.d.mts +4 -0
  113. package/dist/capabilities/Subagent.mjs +5 -0
  114. package/dist/capabilities/SubagentReservations.d.mts +186 -0
  115. package/dist/capabilities/SubagentReservations.mjs +479 -0
  116. package/dist/capabilities/SubagentReservations.mjs.map +1 -0
  117. package/dist/capabilities/ToolDiscovery.d.mts +109 -0
  118. package/dist/capabilities/ToolDiscovery.mjs +211 -0
  119. package/dist/capabilities/ToolDiscovery.mjs.map +1 -0
  120. package/dist/capabilities/WebCapture.d.mts +163 -0
  121. package/dist/capabilities/WebCapture.mjs +335 -0
  122. package/dist/capabilities/WebCapture.mjs.map +1 -0
  123. package/dist/capabilities/WebSearch.d.mts +71 -0
  124. package/dist/capabilities/WebSearch.mjs +112 -0
  125. package/dist/capabilities/WebSearch.mjs.map +1 -0
  126. package/dist/compaction-C2OTceKw.mjs +505 -0
  127. package/dist/compaction-C2OTceKw.mjs.map +1 -0
  128. package/dist/core/Agent.d.mts +2 -0
  129. package/dist/core/Agent.mjs +2 -0
  130. package/dist/core/AgentError.d.mts +2 -0
  131. package/dist/core/AgentError.mjs +117 -0
  132. package/dist/core/AgentError.mjs.map +1 -0
  133. package/dist/core/AgentPolicy.d.mts +2 -0
  134. package/dist/core/AgentPolicy.mjs +94 -0
  135. package/dist/core/AgentPolicy.mjs.map +1 -0
  136. package/dist/core/AgentUpdates.d.mts +2 -0
  137. package/dist/core/AgentUpdates.mjs +63 -0
  138. package/dist/core/AgentUpdates.mjs.map +1 -0
  139. package/dist/core/IdGenerator.d.mts +26 -0
  140. package/dist/core/IdGenerator.mjs +27 -0
  141. package/dist/core/IdGenerator.mjs.map +1 -0
  142. package/dist/core/Identifiers.d.mts +2 -0
  143. package/dist/core/Identifiers.mjs +43 -0
  144. package/dist/core/Identifiers.mjs.map +1 -0
  145. package/dist/core/Memory.d.mts +57 -0
  146. package/dist/core/Memory.mjs +203 -0
  147. package/dist/core/Memory.mjs.map +1 -0
  148. package/dist/core/MemoryNamespace.d.mts +2 -0
  149. package/dist/core/MemoryNamespace.mjs +116 -0
  150. package/dist/core/MemoryNamespace.mjs.map +1 -0
  151. package/dist/core/MemoryReference.d.mts +2 -0
  152. package/dist/core/MemoryReference.mjs +109 -0
  153. package/dist/core/MemoryReference.mjs.map +1 -0
  154. package/dist/core/MemoryRevalidation.d.mts +65 -0
  155. package/dist/core/MemoryRevalidation.mjs +126 -0
  156. package/dist/core/MemoryRevalidation.mjs.map +1 -0
  157. package/dist/core/MemoryStore.d.mts +186 -0
  158. package/dist/core/MemoryStore.mjs +243 -0
  159. package/dist/core/MemoryStore.mjs.map +1 -0
  160. package/dist/core/Receipt.d.mts +2 -0
  161. package/dist/core/Receipt.mjs +36 -0
  162. package/dist/core/Receipt.mjs.map +1 -0
  163. package/dist/core/RememberingStore.d.mts +1562 -0
  164. package/dist/core/RememberingStore.mjs +190 -0
  165. package/dist/core/RememberingStore.mjs.map +1 -0
  166. package/dist/core/RunEvent.d.mts +2 -0
  167. package/dist/core/RunEvent.mjs +337 -0
  168. package/dist/core/RunEvent.mjs.map +1 -0
  169. package/dist/core/RunPolicyUsage.d.mts +2 -0
  170. package/dist/core/RunPolicyUsage.mjs +21 -0
  171. package/dist/core/RunPolicyUsage.mjs.map +1 -0
  172. package/dist/core/SemanticMemoryIndex.d.mts +826 -0
  173. package/dist/core/SemanticMemoryIndex.mjs +185 -0
  174. package/dist/core/SemanticMemoryIndex.mjs.map +1 -0
  175. package/dist/core/SemanticMemoryRevalidation.d.mts +45 -0
  176. package/dist/core/SemanticMemoryRevalidation.mjs +191 -0
  177. package/dist/core/SemanticMemoryRevalidation.mjs.map +1 -0
  178. package/dist/core/SubagentContract.d.mts +2 -0
  179. package/dist/core/SubagentContract.mjs +148 -0
  180. package/dist/core/SubagentContract.mjs.map +1 -0
  181. package/dist/core/Thread.d.mts +2 -0
  182. package/dist/core/Thread.mjs +250 -0
  183. package/dist/core/Thread.mjs.map +1 -0
  184. package/dist/core/ToolResult.d.mts +2 -0
  185. package/dist/core/ToolResult.mjs +140 -0
  186. package/dist/core/ToolResult.mjs.map +1 -0
  187. package/dist/core/Usage.d.mts +2 -0
  188. package/dist/core/Usage.mjs +319 -0
  189. package/dist/core/Usage.mjs.map +1 -0
  190. package/dist/core/Worker.d.mts +3 -0
  191. package/dist/core/Worker.mjs +147 -0
  192. package/dist/core/Worker.mjs.map +1 -0
  193. package/dist/durable/ActivityStore.d.mts +116 -0
  194. package/dist/durable/ActivityStore.mjs +131 -0
  195. package/dist/durable/ActivityStore.mjs.map +1 -0
  196. package/dist/durable/Admin.d.mts +2 -0
  197. package/dist/durable/Admin.mjs +328 -0
  198. package/dist/durable/Admin.mjs.map +1 -0
  199. package/dist/durable/AgentRegistration.d.mts +2 -0
  200. package/dist/durable/AgentRegistration.mjs +14 -0
  201. package/dist/durable/AgentRegistration.mjs.map +1 -0
  202. package/dist/durable/Certification.d.mts +111 -0
  203. package/dist/durable/Certification.mjs +159 -0
  204. package/dist/durable/Certification.mjs.map +1 -0
  205. package/dist/durable/CommittedActivity.d.mts +62 -0
  206. package/dist/durable/CommittedActivity.mjs +159 -0
  207. package/dist/durable/CommittedActivity.mjs.map +1 -0
  208. package/dist/durable/Digest.d.mts +2 -0
  209. package/dist/durable/Digest.mjs +50 -0
  210. package/dist/durable/Digest.mjs.map +1 -0
  211. package/dist/durable/DurableAgentRuntime.d.mts +3 -0
  212. package/dist/durable/DurableAgentRuntime.mjs +3 -0
  213. package/dist/durable/DurableFailpoint.d.mts +2 -0
  214. package/dist/durable/DurableFailpoint.mjs +94 -0
  215. package/dist/durable/DurableFailpoint.mjs.map +1 -0
  216. package/dist/durable/DurableFailpointTestControl.d.mts +15 -0
  217. package/dist/durable/DurableFailpointTestControl.mjs +19 -0
  218. package/dist/durable/DurableFailpointTestControl.mjs.map +1 -0
  219. package/dist/durable/EventSource.d.mts +2 -0
  220. package/dist/durable/EventSource.mjs +65 -0
  221. package/dist/durable/EventSource.mjs.map +1 -0
  222. package/dist/durable/GitHubWorkflowSource.d.mts +144 -0
  223. package/dist/durable/GitHubWorkflowSource.mjs +209 -0
  224. package/dist/durable/GitHubWorkflowSource.mjs.map +1 -0
  225. package/dist/durable/MessageDelivery.d.mts +492 -0
  226. package/dist/durable/MessageDelivery.mjs +495 -0
  227. package/dist/durable/MessageDelivery.mjs.map +1 -0
  228. package/dist/durable/MessageDeliveryStoreConformance.d.mts +358 -0
  229. package/dist/durable/MessageDeliveryStoreConformance.mjs +243 -0
  230. package/dist/durable/MessageDeliveryStoreConformance.mjs.map +1 -0
  231. package/dist/durable/OperationAuthorizer.d.mts +2 -0
  232. package/dist/durable/OperationAuthorizer.mjs +70 -0
  233. package/dist/durable/OperationAuthorizer.mjs.map +1 -0
  234. package/dist/durable/PersistentHistory.d.mts +16 -0
  235. package/dist/durable/PersistentHistory.mjs +125 -0
  236. package/dist/durable/PersistentHistory.mjs.map +1 -0
  237. package/dist/durable/PreparedInputAdmission.d.mts +2 -0
  238. package/dist/durable/PreparedInputAdmission.mjs +34 -0
  239. package/dist/durable/PreparedInputAdmission.mjs.map +1 -0
  240. package/dist/durable/Records.d.mts +2 -0
  241. package/dist/durable/Records.mjs +795 -0
  242. package/dist/durable/Records.mjs.map +1 -0
  243. package/dist/durable/Recovery.d.mts +2 -0
  244. package/dist/durable/Recovery.mjs +739 -0
  245. package/dist/durable/Recovery.mjs.map +1 -0
  246. package/dist/durable/RunJournal.d.mts +2 -0
  247. package/dist/durable/RunJournal.mjs +2 -0
  248. package/dist/durable/Schedule.d.mts +2 -0
  249. package/dist/durable/Schedule.mjs +382 -0
  250. package/dist/durable/Schedule.mjs.map +1 -0
  251. package/dist/durable/ScheduleStoreConformance.d.mts +18 -0
  252. package/dist/durable/ScheduleStoreConformance.mjs +420 -0
  253. package/dist/durable/ScheduleStoreConformance.mjs.map +1 -0
  254. package/dist/durable/ScheduleTransition.d.mts +24 -0
  255. package/dist/durable/ScheduleTransition.mjs +180 -0
  256. package/dist/durable/ScheduleTransition.mjs.map +1 -0
  257. package/dist/durable/Scheduling.d.mts +54 -0
  258. package/dist/durable/Scheduling.mjs +2 -0
  259. package/dist/durable/SqlMemoryStore.d.mts +30 -0
  260. package/dist/durable/SqlMemoryStore.mjs +435 -0
  261. package/dist/durable/SqlMemoryStore.mjs.map +1 -0
  262. package/dist/durable/SqlMessageDeliveryStore.d.mts +40 -0
  263. package/dist/durable/SqlMessageDeliveryStore.mjs +167 -0
  264. package/dist/durable/SqlMessageDeliveryStore.mjs.map +1 -0
  265. package/dist/durable/SqlStorageV2Upgrade.d.mts +22 -0
  266. package/dist/durable/SqlStorageV2Upgrade.mjs +459 -0
  267. package/dist/durable/SqlStorageV2Upgrade.mjs.map +1 -0
  268. package/dist/durable/SqlSubscriptionStore.d.mts +63 -0
  269. package/dist/durable/SqlSubscriptionStore.mjs +751 -0
  270. package/dist/durable/SqlSubscriptionStore.mjs.map +1 -0
  271. package/dist/durable/SubmissionLedger.d.mts +3 -0
  272. package/dist/durable/SubmissionLedger.mjs +914 -0
  273. package/dist/durable/SubmissionLedger.mjs.map +1 -0
  274. package/dist/durable/SubmissionLedgerConformance.d.mts +30 -0
  275. package/dist/durable/SubmissionLedgerConformance.mjs +1986 -0
  276. package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -0
  277. package/dist/durable/SubmissionStatus.d.mts +2 -0
  278. package/dist/durable/SubmissionStatus.mjs +18 -0
  279. package/dist/durable/SubmissionStatus.mjs.map +1 -0
  280. package/dist/durable/Subscription.d.mts +2 -0
  281. package/dist/durable/Subscription.mjs +360 -0
  282. package/dist/durable/Subscription.mjs.map +1 -0
  283. package/dist/durable/SubscriptionInput.d.mts +2 -0
  284. package/dist/durable/SubscriptionInput.mjs +52 -0
  285. package/dist/durable/SubscriptionInput.mjs.map +1 -0
  286. package/dist/durable/SubscriptionStoreConformance.d.mts +17 -0
  287. package/dist/durable/SubscriptionStoreConformance.mjs +625 -0
  288. package/dist/durable/SubscriptionStoreConformance.mjs.map +1 -0
  289. package/dist/durable/SubscriptionTools.d.mts +273 -0
  290. package/dist/durable/SubscriptionTools.mjs +190 -0
  291. package/dist/durable/SubscriptionTools.mjs.map +1 -0
  292. package/dist/durable/SubscriptionTransition.d.mts +21 -0
  293. package/dist/durable/SubscriptionTransition.mjs +148 -0
  294. package/dist/durable/SubscriptionTransition.mjs.map +1 -0
  295. package/dist/durable/Subscriptions.d.mts +73 -0
  296. package/dist/durable/Subscriptions.mjs +627 -0
  297. package/dist/durable/Subscriptions.mjs.map +1 -0
  298. package/dist/durable/ThreadContextHistory.d.mts +32 -0
  299. package/dist/durable/ThreadContextHistory.mjs +152 -0
  300. package/dist/durable/ThreadContextHistory.mjs.map +1 -0
  301. package/dist/durable/ThreadContextHistoryProjection.d.mts +60 -0
  302. package/dist/durable/ThreadContextHistoryProjection.mjs +149 -0
  303. package/dist/durable/ThreadContextHistoryProjection.mjs.map +1 -0
  304. package/dist/durable/ThreadInvariants.d.mts +74 -0
  305. package/dist/durable/ThreadInvariants.mjs +200 -0
  306. package/dist/durable/ThreadInvariants.mjs.map +1 -0
  307. package/dist/durable/ThreadProjection.d.mts +78 -0
  308. package/dist/durable/ThreadProjection.mjs +158 -0
  309. package/dist/durable/ThreadProjection.mjs.map +1 -0
  310. package/dist/durable/ThreadProjectionMaintenance.d.mts +49 -0
  311. package/dist/durable/ThreadProjectionMaintenance.mjs +33 -0
  312. package/dist/durable/ThreadProjectionMaintenance.mjs.map +1 -0
  313. package/dist/durable/ThreadStore.d.mts +2 -0
  314. package/dist/durable/ThreadStore.mjs +147 -0
  315. package/dist/durable/ThreadStore.mjs.map +1 -0
  316. package/dist/durable/ThreadStoreConformance.d.mts +29 -0
  317. package/dist/durable/ThreadStoreConformance.mjs +248 -0
  318. package/dist/durable/ThreadStoreConformance.mjs.map +1 -0
  319. package/dist/durable/ToolReconciler.d.mts +2 -0
  320. package/dist/durable/ToolReconciler.mjs +81 -0
  321. package/dist/durable/ToolReconciler.mjs.map +1 -0
  322. package/dist/durable/WakeScheduler.d.mts +2 -0
  323. package/dist/durable/WakeScheduler.mjs +85 -0
  324. package/dist/durable/WakeScheduler.mjs.map +1 -0
  325. package/dist/durable/WorkerHost.d.mts +129 -0
  326. package/dist/durable/WorkerHost.mjs +77 -0
  327. package/dist/durable/WorkerHost.mjs.map +1 -0
  328. package/dist/engine/AgentRuntime.d.mts +2 -0
  329. package/dist/engine/AgentRuntime.mjs +2 -0
  330. package/dist/engine/Compaction.d.mts +7 -0
  331. package/dist/engine/Compaction.mjs +16 -0
  332. package/dist/engine/Compaction.mjs.map +1 -0
  333. package/dist/engine/ContextCompactor.d.mts +2 -0
  334. package/dist/engine/ContextCompactor.mjs +119 -0
  335. package/dist/engine/ContextCompactor.mjs.map +1 -0
  336. package/dist/engine/ContextHistory.d.mts +65 -0
  337. package/dist/engine/ContextHistory.mjs +76 -0
  338. package/dist/engine/ContextHistory.mjs.map +1 -0
  339. package/dist/engine/ContextWindow.d.mts +2 -0
  340. package/dist/engine/ContextWindow.mjs +59 -0
  341. package/dist/engine/ContextWindow.mjs.map +1 -0
  342. package/dist/engine/DurableStep.d.mts +2 -0
  343. package/dist/engine/DurableStep.mjs +62 -0
  344. package/dist/engine/DurableStep.mjs.map +1 -0
  345. package/dist/engine/MessagingHost.d.mts +2 -0
  346. package/dist/engine/MessagingHost.mjs +2 -0
  347. package/dist/engine/Output.d.mts +2 -0
  348. package/dist/engine/Output.mjs +8 -0
  349. package/dist/engine/Output.mjs.map +1 -0
  350. package/dist/engine/RunEventSink.d.mts +2 -0
  351. package/dist/engine/RunEventSink.mjs +22 -0
  352. package/dist/engine/RunEventSink.mjs.map +1 -0
  353. package/dist/engine/RunOptions.d.mts +2 -0
  354. package/dist/engine/RunOptions.mjs +122 -0
  355. package/dist/engine/RunOptions.mjs.map +1 -0
  356. package/dist/engine/SubagentHost.d.mts +2 -0
  357. package/dist/engine/SubagentHost.mjs +72 -0
  358. package/dist/engine/SubagentHost.mjs.map +1 -0
  359. package/dist/engine/ThreadHistory.d.mts +2 -0
  360. package/dist/engine/ThreadHistory.mjs +67 -0
  361. package/dist/engine/ThreadHistory.mjs.map +1 -0
  362. package/dist/engine/ToolBroker.d.mts +2 -0
  363. package/dist/engine/ToolBroker.mjs +42 -0
  364. package/dist/engine/ToolBroker.mjs.map +1 -0
  365. package/dist/foreign-diagnostic-DBQ1XHKh.mjs +37 -0
  366. package/dist/foreign-diagnostic-DBQ1XHKh.mjs.map +1 -0
  367. package/dist/index.d.mts +88 -54
  368. package/dist/index.mjs +97 -54
  369. package/dist/output-contract-BC7tjlGw.mjs +84 -0
  370. package/dist/output-contract-BC7tjlGw.mjs.map +1 -0
  371. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  372. package/dist/sandbox/CodeExecutor.d.mts +194 -0
  373. package/dist/sandbox/CodeExecutor.mjs +278 -0
  374. package/dist/sandbox/CodeExecutor.mjs.map +1 -0
  375. package/dist/sandbox/InteractiveBrowser.d.mts +142 -0
  376. package/dist/sandbox/InteractiveBrowser.mjs +165 -0
  377. package/dist/sandbox/InteractiveBrowser.mjs.map +1 -0
  378. package/dist/sandbox/PageCapture.d.mts +2 -0
  379. package/dist/sandbox/PageCapture.mjs +450 -0
  380. package/dist/sandbox/PageCapture.mjs.map +1 -0
  381. package/dist/sandbox/PageCrawl.d.mts +88 -0
  382. package/dist/sandbox/PageCrawl.mjs +124 -0
  383. package/dist/sandbox/PageCrawl.mjs.map +1 -0
  384. package/dist/sandbox/PageScreenshot.d.mts +2 -0
  385. package/dist/sandbox/PageScreenshot.mjs +53 -0
  386. package/dist/sandbox/PageScreenshot.mjs.map +1 -0
  387. package/dist/sandbox/ProtectedBrowser.d.mts +252 -0
  388. package/dist/sandbox/ProtectedBrowser.mjs +270 -0
  389. package/dist/sandbox/ProtectedBrowser.mjs.map +1 -0
  390. package/dist/sandbox/Sandbox.d.mts +2 -0
  391. package/dist/sandbox/Sandbox.mjs +208 -0
  392. package/dist/sandbox/Sandbox.mjs.map +1 -0
  393. package/dist/utf8-BYfhEkcj.mjs +11 -0
  394. package/dist/utf8-BYfhEkcj.mjs.map +1 -0
  395. package/dist/utf8-DchGZRBd.mjs +23 -0
  396. package/dist/utf8-DchGZRBd.mjs.map +1 -0
  397. package/package.json +1 -1
  398. package/src/Ephemeral.ts +17 -0
  399. package/src/ToolExposure.ts +2 -2
  400. package/src/capabilities/Approval.ts +352 -0
  401. package/src/capabilities/Budget.ts +536 -0
  402. package/src/capabilities/CodeMode.ts +1090 -0
  403. package/src/capabilities/Commands.ts +86 -0
  404. package/src/capabilities/ContextTools.ts +184 -0
  405. package/src/capabilities/Mcp.ts +427 -0
  406. package/src/capabilities/McpClient.ts +967 -0
  407. package/src/capabilities/MemoryNotes.ts +174 -0
  408. package/src/capabilities/Messaging.ts +261 -0
  409. package/src/capabilities/ModelContext.ts +354 -0
  410. package/src/capabilities/Redaction.ts +157 -0
  411. package/src/capabilities/Remembering.ts +550 -0
  412. package/src/capabilities/RunHooks.ts +280 -0
  413. package/src/capabilities/SemanticMemory.ts +447 -0
  414. package/src/capabilities/Subagent.ts +2277 -0
  415. package/src/capabilities/SubagentReservations.ts +850 -0
  416. package/src/capabilities/ToolDiscovery.ts +339 -0
  417. package/src/capabilities/WebCapture.ts +722 -0
  418. package/src/capabilities/WebSearch.ts +184 -0
  419. package/src/capabilities/internal/subagent-background.ts +1106 -0
  420. package/src/capabilities/internal/subagent-contract.ts +142 -0
  421. package/src/capabilities/internal/subagent-policy.ts +235 -0
  422. package/src/capabilities/internal/subagent-reporting.ts +261 -0
  423. package/src/capabilities/internal/utf8.ts +10 -0
  424. package/src/core/Agent.ts +575 -0
  425. package/src/core/AgentError.ts +152 -0
  426. package/src/core/AgentPolicy.ts +153 -0
  427. package/src/core/AgentUpdates.ts +100 -0
  428. package/src/core/IdGenerator.ts +39 -0
  429. package/src/core/Identifiers.ts +48 -0
  430. package/src/core/Memory.ts +290 -0
  431. package/src/core/MemoryNamespace.ts +196 -0
  432. package/src/core/MemoryReference.ts +121 -0
  433. package/src/core/MemoryRevalidation.ts +185 -0
  434. package/src/core/MemoryStore.ts +368 -0
  435. package/src/core/Messaging.ts +90 -0
  436. package/src/core/Receipt.ts +42 -0
  437. package/src/core/RememberingStore.ts +300 -0
  438. package/src/core/RunEvent.ts +366 -0
  439. package/src/core/RunPolicyUsage.ts +17 -0
  440. package/src/core/SemanticMemoryIndex.ts +250 -0
  441. package/src/core/SemanticMemoryRevalidation.ts +254 -0
  442. package/src/core/SubagentContract.ts +196 -0
  443. package/src/core/Thread.ts +371 -0
  444. package/src/core/ToolExposure.ts +74 -0
  445. package/src/core/ToolResult.ts +170 -0
  446. package/src/core/Usage.ts +529 -0
  447. package/src/core/Worker.ts +173 -0
  448. package/src/core/internal/agent-updates.ts +32 -0
  449. package/src/core/internal/utf8.ts +23 -0
  450. package/src/durable/ActivityStore.ts +160 -0
  451. package/src/durable/Admin.ts +496 -0
  452. package/src/durable/AgentRegistration.ts +13 -0
  453. package/src/durable/Certification.ts +210 -0
  454. package/src/durable/CommittedActivity.ts +296 -0
  455. package/src/durable/Digest.ts +93 -0
  456. package/src/durable/DurableAgentRuntime.ts +10340 -0
  457. package/src/durable/DurableFailpoint.ts +103 -0
  458. package/src/durable/DurableFailpointTestControl.ts +39 -0
  459. package/src/durable/EventSource.ts +172 -0
  460. package/src/durable/GitHubWorkflowSource.ts +453 -0
  461. package/src/durable/MessageDelivery.ts +708 -0
  462. package/src/durable/MessageDeliveryStoreConformance.ts +363 -0
  463. package/src/durable/OperationAuthorizer.ts +85 -0
  464. package/src/durable/PersistentHistory.ts +260 -0
  465. package/src/durable/PreparedInputAdmission.ts +44 -0
  466. package/src/durable/Records.ts +1010 -0
  467. package/src/durable/Recovery.ts +1018 -0
  468. package/src/durable/RunJournal.ts +1479 -0
  469. package/src/durable/Schedule.ts +504 -0
  470. package/src/durable/ScheduleStoreConformance.ts +638 -0
  471. package/src/durable/ScheduleTransition.ts +265 -0
  472. package/src/durable/Scheduling.ts +1077 -0
  473. package/src/durable/SqlMemoryStore.ts +774 -0
  474. package/src/durable/SqlMessageDeliveryStore.ts +302 -0
  475. package/src/durable/SqlStorageV2Upgrade.ts +500 -0
  476. package/src/durable/SqlSubscriptionStore.ts +1440 -0
  477. package/src/durable/SubmissionLedger.ts +1201 -0
  478. package/src/durable/SubmissionLedgerConformance.ts +4579 -0
  479. package/src/durable/SubmissionStatus.ts +14 -0
  480. package/src/durable/Subscription.ts +544 -0
  481. package/src/durable/SubscriptionInput.ts +144 -0
  482. package/src/durable/SubscriptionStoreConformance.ts +945 -0
  483. package/src/durable/SubscriptionTools.ts +327 -0
  484. package/src/durable/SubscriptionTransition.ts +302 -0
  485. package/src/durable/Subscriptions.ts +1210 -0
  486. package/src/durable/ThreadContextHistory.ts +227 -0
  487. package/src/durable/ThreadContextHistoryProjection.ts +216 -0
  488. package/src/durable/ThreadInvariants.ts +442 -0
  489. package/src/durable/ThreadProjection.ts +269 -0
  490. package/src/durable/ThreadProjectionMaintenance.ts +67 -0
  491. package/src/durable/ThreadStore.ts +242 -0
  492. package/src/durable/ThreadStoreConformance.ts +710 -0
  493. package/src/durable/ToolReconciler.ts +105 -0
  494. package/src/durable/WakeScheduler.ts +134 -0
  495. package/src/durable/WorkerHost.ts +171 -0
  496. package/src/durable/internal/agent-registration.ts +525 -0
  497. package/src/durable/internal/agent-updates.ts +302 -0
  498. package/src/durable/internal/foreign-diagnostic.ts +47 -0
  499. package/src/durable/internal/journal-checkpoint.ts +104 -0
  500. package/src/durable/internal/journal-metadata.ts +107 -0
  501. package/src/durable/internal/messaging-host.ts +608 -0
  502. package/src/durable/internal/schedule-time.ts +303 -0
  503. package/src/durable/internal/storage-v2-layout.ts +163 -0
  504. package/src/durable/internal/storage-v2.ts +73 -0
  505. package/src/durable/internal/worker-host.ts +2467 -0
  506. package/src/durable/internal/worker-runtime.ts +9 -0
  507. package/src/engine/AgentRuntime.ts +37 -0
  508. package/src/engine/Compaction.ts +11 -0
  509. package/src/engine/ContextCompactor.ts +277 -0
  510. package/src/engine/ContextHistory.ts +73 -0
  511. package/src/engine/ContextWindow.ts +72 -0
  512. package/src/engine/DurableStep.ts +132 -0
  513. package/src/engine/MessagingHost.ts +110 -0
  514. package/src/engine/Output.ts +2 -0
  515. package/src/engine/RunEventSink.ts +132 -0
  516. package/src/engine/RunOptions.ts +1077 -0
  517. package/src/engine/SubagentHost.ts +181 -0
  518. package/src/engine/ThreadHistory.ts +120 -0
  519. package/src/engine/ToolBroker.ts +157 -0
  520. package/src/engine/ToolExposure.ts +48 -0
  521. package/src/engine/internal/agent-runtime.ts +10117 -0
  522. package/src/engine/internal/bounded-value.ts +315 -0
  523. package/src/engine/internal/compaction.ts +678 -0
  524. package/src/engine/internal/error-diagnostic.ts +39 -0
  525. package/src/engine/internal/output-contract.ts +173 -0
  526. package/src/engine/internal/primitive-delta.ts +80 -0
  527. package/src/engine/internal/provider-result-staging.ts +211 -0
  528. package/src/engine/internal/tool-derivative.ts +106 -0
  529. package/src/engine/internal/tool-exposure.ts +224 -0
  530. package/src/engine/internal/tool-telemetry.ts +484 -0
  531. package/src/index.ts +96 -53
  532. package/src/sandbox/CodeExecutor.ts +352 -0
  533. package/src/sandbox/InteractiveBrowser.ts +257 -0
  534. package/src/sandbox/PageCapture.ts +692 -0
  535. package/src/sandbox/PageCrawl.ts +148 -0
  536. package/src/sandbox/PageScreenshot.ts +81 -0
  537. package/src/sandbox/ProtectedBrowser.ts +413 -0
  538. package/src/sandbox/Sandbox.ts +241 -0
  539. package/dist/Agent.d.mts +0 -5
  540. package/dist/Agent.mjs +0 -10
  541. package/dist/Agent.mjs.map +0 -1
  542. package/dist/AgentError.d.mts +0 -5
  543. package/dist/AgentError.mjs +0 -10
  544. package/dist/AgentError.mjs.map +0 -1
  545. package/dist/AgentPolicy.d.mts +0 -5
  546. package/dist/AgentPolicy.mjs +0 -10
  547. package/dist/AgentPolicy.mjs.map +0 -1
  548. package/dist/AgentRuntime.d.mts +0 -5
  549. package/dist/AgentRuntime.mjs +0 -10
  550. package/dist/AgentRuntime.mjs.map +0 -1
  551. package/dist/AgentUpdates.d.mts +0 -5
  552. package/dist/AgentUpdates.mjs +0 -10
  553. package/dist/AgentUpdates.mjs.map +0 -1
  554. package/dist/Approval.d.mts +0 -5
  555. package/dist/Approval.mjs +0 -10
  556. package/dist/Approval.mjs.map +0 -1
  557. package/dist/Budget.d.mts +0 -5
  558. package/dist/Budget.mjs +0 -10
  559. package/dist/Budget.mjs.map +0 -1
  560. package/dist/CodeMode.d.mts +0 -5
  561. package/dist/CodeMode.mjs +0 -10
  562. package/dist/CodeMode.mjs.map +0 -1
  563. package/dist/Commands.d.mts +0 -5
  564. package/dist/Commands.mjs +0 -10
  565. package/dist/Commands.mjs.map +0 -1
  566. package/dist/Compaction.d.mts +0 -5
  567. package/dist/Compaction.mjs +0 -10
  568. package/dist/Compaction.mjs.map +0 -1
  569. package/dist/ContextCompactor.d.mts +0 -5
  570. package/dist/ContextCompactor.mjs +0 -10
  571. package/dist/ContextCompactor.mjs.map +0 -1
  572. package/dist/ContextHistory.d.mts +0 -5
  573. package/dist/ContextHistory.mjs +0 -10
  574. package/dist/ContextHistory.mjs.map +0 -1
  575. package/dist/ContextTools.d.mts +0 -5
  576. package/dist/ContextTools.mjs +0 -10
  577. package/dist/ContextTools.mjs.map +0 -1
  578. package/dist/ContextWindow.d.mts +0 -5
  579. package/dist/ContextWindow.mjs +0 -10
  580. package/dist/ContextWindow.mjs.map +0 -1
  581. package/dist/DurableStep.d.mts +0 -5
  582. package/dist/DurableStep.mjs +0 -10
  583. package/dist/DurableStep.mjs.map +0 -1
  584. package/dist/EphemeralThreads.d.mts +0 -5
  585. package/dist/EphemeralThreads.mjs +0 -10
  586. package/dist/EphemeralThreads.mjs.map +0 -1
  587. package/dist/IdGenerator.d.mts +0 -5
  588. package/dist/IdGenerator.mjs +0 -10
  589. package/dist/IdGenerator.mjs.map +0 -1
  590. package/dist/Identifiers.d.mts +0 -5
  591. package/dist/Identifiers.mjs +0 -10
  592. package/dist/Identifiers.mjs.map +0 -1
  593. package/dist/Mcp.d.mts +0 -5
  594. package/dist/Mcp.mjs +0 -10
  595. package/dist/Mcp.mjs.map +0 -1
  596. package/dist/McpClient.d.mts +0 -5
  597. package/dist/McpClient.mjs +0 -10
  598. package/dist/McpClient.mjs.map +0 -1
  599. package/dist/Memory.d.mts +0 -5
  600. package/dist/Memory.mjs +0 -10
  601. package/dist/Memory.mjs.map +0 -1
  602. package/dist/MemoryNamespace.d.mts +0 -5
  603. package/dist/MemoryNamespace.mjs +0 -10
  604. package/dist/MemoryNamespace.mjs.map +0 -1
  605. package/dist/MemoryNotes.d.mts +0 -5
  606. package/dist/MemoryNotes.mjs +0 -10
  607. package/dist/MemoryNotes.mjs.map +0 -1
  608. package/dist/MemoryReference.d.mts +0 -5
  609. package/dist/MemoryReference.mjs +0 -10
  610. package/dist/MemoryReference.mjs.map +0 -1
  611. package/dist/MemoryRevalidation.d.mts +0 -5
  612. package/dist/MemoryRevalidation.mjs +0 -10
  613. package/dist/MemoryRevalidation.mjs.map +0 -1
  614. package/dist/MemoryStore.d.mts +0 -5
  615. package/dist/MemoryStore.mjs +0 -10
  616. package/dist/MemoryStore.mjs.map +0 -1
  617. package/dist/Messaging.d.mts +0 -5
  618. package/dist/Messaging.mjs +0 -10
  619. package/dist/Messaging.mjs.map +0 -1
  620. package/dist/MessagingHost.d.mts +0 -5
  621. package/dist/MessagingHost.mjs +0 -10
  622. package/dist/MessagingHost.mjs.map +0 -1
  623. package/dist/ModelContext.d.mts +0 -5
  624. package/dist/ModelContext.mjs +0 -10
  625. package/dist/ModelContext.mjs.map +0 -1
  626. package/dist/Receipt.d.mts +0 -5
  627. package/dist/Receipt.mjs +0 -10
  628. package/dist/Receipt.mjs.map +0 -1
  629. package/dist/Redaction.d.mts +0 -5
  630. package/dist/Redaction.mjs +0 -10
  631. package/dist/Redaction.mjs.map +0 -1
  632. package/dist/Remembering.d.mts +0 -5
  633. package/dist/Remembering.mjs +0 -10
  634. package/dist/Remembering.mjs.map +0 -1
  635. package/dist/RememberingStore.d.mts +0 -5
  636. package/dist/RememberingStore.mjs +0 -10
  637. package/dist/RememberingStore.mjs.map +0 -1
  638. package/dist/RunEvent.d.mts +0 -5
  639. package/dist/RunEvent.mjs +0 -10
  640. package/dist/RunEvent.mjs.map +0 -1
  641. package/dist/RunEventSink.d.mts +0 -5
  642. package/dist/RunEventSink.mjs +0 -10
  643. package/dist/RunEventSink.mjs.map +0 -1
  644. package/dist/RunHooks.d.mts +0 -5
  645. package/dist/RunHooks.mjs +0 -10
  646. package/dist/RunHooks.mjs.map +0 -1
  647. package/dist/RunOptions.d.mts +0 -5
  648. package/dist/RunOptions.mjs +0 -10
  649. package/dist/RunOptions.mjs.map +0 -1
  650. package/dist/RunPolicyUsage.d.mts +0 -5
  651. package/dist/RunPolicyUsage.mjs +0 -10
  652. package/dist/RunPolicyUsage.mjs.map +0 -1
  653. package/dist/SemanticMemory.d.mts +0 -5
  654. package/dist/SemanticMemory.mjs +0 -10
  655. package/dist/SemanticMemory.mjs.map +0 -1
  656. package/dist/SemanticMemoryIndex.d.mts +0 -5
  657. package/dist/SemanticMemoryIndex.mjs +0 -10
  658. package/dist/SemanticMemoryIndex.mjs.map +0 -1
  659. package/dist/SemanticMemoryRevalidation.d.mts +0 -5
  660. package/dist/SemanticMemoryRevalidation.mjs +0 -10
  661. package/dist/SemanticMemoryRevalidation.mjs.map +0 -1
  662. package/dist/Subagent.d.mts +0 -5
  663. package/dist/Subagent.mjs +0 -10
  664. package/dist/Subagent.mjs.map +0 -1
  665. package/dist/SubagentContract.d.mts +0 -5
  666. package/dist/SubagentContract.mjs +0 -10
  667. package/dist/SubagentContract.mjs.map +0 -1
  668. package/dist/SubagentHost.d.mts +0 -5
  669. package/dist/SubagentHost.mjs +0 -10
  670. package/dist/SubagentHost.mjs.map +0 -1
  671. package/dist/SubagentReservations.d.mts +0 -5
  672. package/dist/SubagentReservations.mjs +0 -10
  673. package/dist/SubagentReservations.mjs.map +0 -1
  674. package/dist/ThreadHistory.d.mts +0 -5
  675. package/dist/ThreadHistory.mjs +0 -10
  676. package/dist/ThreadHistory.mjs.map +0 -1
  677. package/dist/ToolBroker.d.mts +0 -5
  678. package/dist/ToolBroker.mjs +0 -10
  679. package/dist/ToolBroker.mjs.map +0 -1
  680. package/dist/ToolDiscovery.d.mts +0 -5
  681. package/dist/ToolDiscovery.mjs +0 -10
  682. package/dist/ToolDiscovery.mjs.map +0 -1
  683. package/dist/ToolResult.d.mts +0 -5
  684. package/dist/ToolResult.mjs +0 -10
  685. package/dist/ToolResult.mjs.map +0 -1
  686. package/dist/Usage.d.mts +0 -5
  687. package/dist/Usage.mjs +0 -10
  688. package/dist/Usage.mjs.map +0 -1
  689. package/dist/WebCapture.d.mts +0 -5
  690. package/dist/WebCapture.mjs +0 -10
  691. package/dist/WebCapture.mjs.map +0 -1
  692. package/dist/WebSearch.d.mts +0 -5
  693. package/dist/WebSearch.mjs +0 -10
  694. package/dist/WebSearch.mjs.map +0 -1
  695. package/dist/Worker.d.mts +0 -5
  696. package/dist/Worker.mjs +0 -10
  697. package/dist/Worker.mjs.map +0 -1
  698. package/dist/rolldown-runtime-BBjsoOtd.mjs +0 -27
  699. package/src/Agent.ts +0 -1
  700. package/src/AgentError.ts +0 -1
  701. package/src/AgentPolicy.ts +0 -1
  702. package/src/AgentRuntime.ts +0 -1
  703. package/src/AgentUpdates.ts +0 -1
  704. package/src/Approval.ts +0 -1
  705. package/src/Budget.ts +0 -1
  706. package/src/CodeMode.ts +0 -1
  707. package/src/Commands.ts +0 -1
  708. package/src/Compaction.ts +0 -1
  709. package/src/ContextCompactor.ts +0 -1
  710. package/src/ContextHistory.ts +0 -1
  711. package/src/ContextTools.ts +0 -1
  712. package/src/ContextWindow.ts +0 -1
  713. package/src/DurableStep.ts +0 -1
  714. package/src/EphemeralThreads.ts +0 -1
  715. package/src/IdGenerator.ts +0 -1
  716. package/src/Identifiers.ts +0 -1
  717. package/src/Mcp.ts +0 -1
  718. package/src/McpClient.ts +0 -1
  719. package/src/Memory.ts +0 -1
  720. package/src/MemoryNamespace.ts +0 -1
  721. package/src/MemoryNotes.ts +0 -1
  722. package/src/MemoryReference.ts +0 -1
  723. package/src/MemoryRevalidation.ts +0 -1
  724. package/src/MemoryStore.ts +0 -1
  725. package/src/Messaging.ts +0 -1
  726. package/src/MessagingHost.ts +0 -1
  727. package/src/ModelContext.ts +0 -1
  728. package/src/Receipt.ts +0 -1
  729. package/src/Redaction.ts +0 -1
  730. package/src/Remembering.ts +0 -1
  731. package/src/RememberingStore.ts +0 -1
  732. package/src/RunEvent.ts +0 -1
  733. package/src/RunEventSink.ts +0 -1
  734. package/src/RunHooks.ts +0 -1
  735. package/src/RunOptions.ts +0 -1
  736. package/src/RunPolicyUsage.ts +0 -1
  737. package/src/SemanticMemory.ts +0 -1
  738. package/src/SemanticMemoryIndex.ts +0 -1
  739. package/src/SemanticMemoryRevalidation.ts +0 -1
  740. package/src/Subagent.ts +0 -1
  741. package/src/SubagentContract.ts +0 -1
  742. package/src/SubagentHost.ts +0 -1
  743. package/src/SubagentReservations.ts +0 -1
  744. package/src/ThreadHistory.ts +0 -1
  745. package/src/ToolBroker.ts +0 -1
  746. package/src/ToolDiscovery.ts +0 -1
  747. package/src/ToolResult.ts +0 -1
  748. package/src/Usage.ts +0 -1
  749. package/src/WebCapture.ts +0 -1
  750. package/src/WebSearch.ts +0 -1
  751. package/src/Worker.ts +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubscriptionStoreConformance.mjs","names":[],"sources":["../../src/durable/SubscriptionStoreConformance.ts"],"sourcesContent":["import { Clock, Effect, Result, Schema } from \"effect\";\nimport { TestClock } from \"effect/testing\";\n\nimport { AgentId, ThreadId, ReceiptId, SubmissionId } from \"../core/Identifiers.ts\";\nimport { Receipt } from \"./DurableAgentRuntime.ts\";\nimport { DefinitionDigests, Digest } from \"./Records.ts\";\nimport { IdempotencyKey, Principal, QueueSequence } from \"./SubmissionLedger.ts\";\nimport {\n type AcceptedEvent,\n defaultSubscriptionLimits,\n type SourcePartition,\n type SubscriptionDelivery,\n type SubscriptionRecord,\n SubscriptionStore,\n type SubscriptionStoreFailure,\n} from \"./Subscription.ts\";\n\nexport class SubscriptionStoreConformanceViolation extends Schema.TaggedError<SubscriptionStoreConformanceViolation>()(\n \"SubscriptionStoreConformanceViolation\",\n { caseName: Schema.String, message: Schema.String },\n) {}\n\nexport interface SubscriptionStoreConformanceCase {\n readonly name: string;\n readonly run: Effect.Effect<\n void,\n SubscriptionStoreFailure | SubscriptionStoreConformanceViolation,\n SubscriptionStore\n >;\n}\n\nexport const subscriptionConformancePartition: SourcePartition = {\n tenantId: \"subscription-conformance\",\n address: \"source-address\",\n};\n\nconst principal = Schema.decodeSync(Principal)(\"subscription-conformance-principal\");\nconst agentId = Schema.decodeSync(AgentId)(\"subscription-conformance-agent\");\nconst threadId = Schema.decodeSync(ThreadId)(\"subscription-conformance-thread\");\nconst digest = (character: string) => Schema.decodeSync(Digest)(character.repeat(64));\n\nconst definitions = DefinitionDigests.make({\n agent: digest(\"a\"),\n model: digest(\"b\"),\n tools: digest(\"c\"),\n});\n\nconst record = (\n name: string,\n mode: \"once\" | \"continuous\" = \"once\",\n ownerId = \"owner\",\n): SubscriptionRecord => ({\n schemaVersion: 1,\n key: { partition: subscriptionConformancePartition, ownerId, subscriptionId: name },\n creationFingerprint: digest(name.charCodeAt(0) % 2 === 0 ? \"d\" : \"e\"),\n createdBy: principal,\n createdAtMillis: 1,\n ordinal: 0,\n configurationRevision: 1,\n configurationFingerprint: digest(name.charCodeAt(0) % 2 === 0 ? \"d\" : \"e\"),\n creationConfiguration: {\n source: { name: \"trusted\", version: \"1\" },\n matchingKey: \"match\",\n parameters: { name },\n context: { name },\n mode,\n expiresAtMillis: 100_000,\n destination: { _tag: \"ExistingThread\", threadId },\n deliveryPrincipal: principal,\n agentId,\n definitions,\n },\n configuration: {\n source: { name: \"trusted\", version: \"1\" },\n matchingKey: \"match\",\n parameters: { name },\n context: { name },\n mode,\n expiresAtMillis: 100_000,\n destination: { _tag: \"ExistingThread\", threadId },\n deliveryPrincipal: principal,\n agentId,\n definitions,\n },\n state: \"active\",\n recovery: null,\n});\n\nconst event = (name: string, payloadDigest = digest(\"f\")): AcceptedEvent => ({\n schemaVersion: 1,\n partition: subscriptionConformancePartition,\n eventId: name,\n source: { name: \"trusted\", version: \"1\" },\n matchingKey: \"match\",\n payload: { name },\n payloadDigest,\n acceptedAtMillis: 10,\n cutoff: 0,\n cursor: 0,\n routingComplete: false,\n routingFailure: null,\n nextAttemptAtMillis: 10,\n});\n\nconst delivery = (\n subscription: SubscriptionRecord,\n accepted: AcceptedEvent,\n suffix = \"0\",\n): SubscriptionDelivery => {\n const deliveryId = digest(suffix === \"0\" ? \"1\" : \"2\");\n\n return {\n schemaVersion: 1,\n key: { subscription: subscription.key, eventId: accepted.eventId },\n deliveryId,\n source: accepted.source,\n subscriptionFingerprint: subscription.configurationFingerprint,\n configurationRevision: subscription.configurationRevision,\n configuration: subscription.configuration,\n eventDigest: accepted.payloadDigest,\n threadId,\n admissionKey: Schema.decodeSync(IdempotencyKey)(`subscription:${deliveryId}`),\n selectedAtMillis: suffix === \"0\" ? 20 : 21,\n state: \"selected\",\n envelope: null,\n envelopeDigest: null,\n retry: {\n generation: 0,\n attempts: 0,\n automaticAttempts: 0,\n parked: false,\n nextAttemptAtMillis: 20,\n lastAttemptAtMillis: null,\n lastFailure: null,\n },\n receipt: null,\n refusal: null,\n };\n};\n\nconst preparedInput = (selected: SubscriptionDelivery) => ({\n schemaVersion: 1 as const,\n threadId: selected.threadId,\n deliveryPrincipal: principal,\n agentId,\n definitions,\n input: { event: selected.key.eventId },\n inputDigest: digest(\"3\"),\n admissionKey: selected.admissionKey,\n authorization: { policyId: \"policy\", decisionId: \"decision\" },\n});\n\nconst receipt = Receipt.make({\n receiptId: Schema.decodeSync(ReceiptId)(\"subscription-conformance-receipt\"),\n submissionId: Schema.decodeSync(SubmissionId)(\"subscription-conformance-submission\"),\n threadId,\n queueSequence: Schema.decodeSync(QueueSequence)(1),\n});\n\nconst conformanceCase = (\n name: string,\n body: (\n ensure: (\n condition: boolean,\n message: string,\n ) => Effect.Effect<void, SubscriptionStoreConformanceViolation>,\n ) => Effect.Effect<\n void,\n SubscriptionStoreFailure | SubscriptionStoreConformanceViolation,\n SubscriptionStore\n >,\n): SubscriptionStoreConformanceCase => ({\n name,\n run: body((condition, message) =>\n condition\n ? Effect.void\n : Effect.fail(SubscriptionStoreConformanceViolation.make({ caseName: name, message })),\n ),\n});\n\nconst historicalOccurrenceReplay = conformanceCase(\n \"preserves unknown occurrence time on replay and fences known times\",\n (ensure) =>\n Effect.gen(function* () {\n const store = yield* SubscriptionStore;\n const original = yield* store.accept(event(\"legacy-occurrence\"), defaultSubscriptionLimits);\n\n const replay = yield* store.accept(\n { ...original, occurredAtMillis: 1 },\n defaultSubscriptionLimits,\n );\n\n yield* ensure(\n replay.occurredAtMillis === undefined &&\n replay.acceptedAtMillis === original.acceptedAtMillis &&\n replay.cutoff === original.cutoff,\n \"replay invented historical occurrence or moved acceptance\",\n );\n\n const known = yield* store.accept(\n { ...event(\"known-occurrence\"), occurredAtMillis: 1 },\n defaultSubscriptionLimits,\n );\n\n const changed = yield* store\n .accept({ ...known, occurredAtMillis: 2 }, defaultSubscriptionLimits)\n .pipe(Effect.result);\n\n yield* ensure(Result.isFailure(changed), \"known occurrence time changed on replay\");\n\n const omitted = yield* store\n .accept(event(\"known-occurrence\"), defaultSubscriptionLimits)\n .pipe(Effect.result);\n\n yield* ensure(Result.isFailure(omitted), \"known occurrence time was erased on replay\");\n }),\n);\n\nconst cutoffAndIntake = conformanceCase(\n \"orders eligibility cutoffs and preserves duplicate intake\",\n (ensure) =>\n Effect.gen(function* () {\n const store = yield* SubscriptionStore;\n const before = yield* store.register(record(\"before\"), defaultSubscriptionLimits);\n const accepted = yield* store.accept(event(\"cutoff\"), defaultSubscriptionLimits);\n const after = yield* store.register(record(\"after\"), defaultSubscriptionLimits);\n\n yield* ensure(\n before.ordinal < accepted.cutoff && after.ordinal > accepted.cutoff,\n \"sequence did not order registration and intake\",\n );\n const candidates = yield* store.candidates(accepted, 10);\n\n yield* ensure(\n candidates.length === 1 && candidates[0].key.subscriptionId === \"before\",\n \"cutoff admitted a later registration\",\n );\n\n const replayed = yield* store.accept(\n { ...event(\"cutoff\"), acceptedAtMillis: 99 },\n defaultSubscriptionLimits,\n );\n\n yield* ensure(\n replayed.cutoff === accepted.cutoff &&\n replayed.acceptedAtMillis === accepted.acceptedAtMillis,\n \"duplicate intake did not return retained progress\",\n );\n\n const conflict = yield* Effect.result(\n store.accept(event(\"cutoff\", digest(\"9\")), defaultSubscriptionLimits),\n );\n\n yield* ensure(\n Result.isFailure(conflict) &&\n conflict.failure._tag === \"SubscriptionError\" &&\n conflict.failure.reason === \"conflict\",\n \"conflicting event identity was accepted\",\n );\n }),\n);\n\nconst onceAndCapacity = conformanceCase(\n \"consumes once atomically and rejects capacity before progress\",\n (ensure) =>\n Effect.gen(function* () {\n const store = yield* SubscriptionStore;\n const once = yield* store.register(record(\"once\"), defaultSubscriptionLimits);\n const first = yield* store.accept(event(\"first\"), defaultSubscriptionLimits);\n const second = yield* store.accept(event(\"second\"), defaultSubscriptionLimits);\n\n yield* store.select(\n first,\n [delivery(once, first)],\n once.ordinal,\n true,\n 20,\n defaultSubscriptionLimits,\n );\n yield* store.select(\n second,\n [delivery(once, second)],\n once.ordinal,\n true,\n 20,\n defaultSubscriptionLimits,\n );\n yield* ensure(\n (yield* store.get(once.key))?.state === \"consumed\",\n \"once registration remained active\",\n );\n yield* ensure(\n (yield* store.delivery({ subscription: once.key, eventId: first.eventId })) !== null,\n \"winning delivery was lost\",\n );\n yield* ensure(\n (yield* store.delivery({ subscription: once.key, eventId: second.eventId })) === null,\n \"second event consumed once registration again\",\n );\n\n const left = yield* store.register(\n record(\"left\", \"continuous\", \"capacity\"),\n defaultSubscriptionLimits,\n );\n\n const right = yield* store.register(\n record(\"right\", \"continuous\", \"capacity\"),\n defaultSubscriptionLimits,\n );\n\n const bounded = yield* store.accept(event(\"bounded\"), defaultSubscriptionLimits);\n const limits = { ...defaultSubscriptionLimits, maxDeliveries: 2, maxDeliveriesPerOwner: 1 };\n\n const failure = yield* Effect.result(\n store.select(\n bounded,\n [delivery(left, bounded), delivery(right, bounded, \"1\")],\n right.ordinal,\n true,\n 20,\n limits,\n ),\n );\n\n yield* ensure(\n Result.isFailure(failure) &&\n failure.failure._tag === \"SubscriptionError\" &&\n failure.failure.reason === \"capacity\",\n \"delivery quota did not reject batch\",\n );\n yield* ensure(\n (yield* store.event(bounded.eventId))?.cursor === 0,\n \"capacity failure advanced event cursor\",\n );\n }),\n);\n\nconst preparationLifecycle = conformanceCase(\n \"refuses cancelled selection and preserves prepared work\",\n (ensure) =>\n Effect.gen(function* () {\n const store = yield* SubscriptionStore;\n const cancelled = yield* store.register(record(\"cancelled\"), defaultSubscriptionLimits);\n\n const cancelledEvent = yield* store.accept(\n event(\"cancelled-event\"),\n defaultSubscriptionLimits,\n );\n\n const cancelledDelivery = delivery(cancelled, cancelledEvent);\n\n yield* store.select(\n cancelledEvent,\n [cancelledDelivery],\n cancelled.ordinal,\n true,\n 20,\n defaultSubscriptionLimits,\n );\n yield* store.cancel(cancelled.key);\n\n const refused = yield* store.changeDelivery(\n cancelledDelivery.key,\n cancelledDelivery.deliveryId,\n {\n _tag: \"Prepare\",\n envelope: preparedInput(cancelledDelivery),\n envelopeDigest: digest(\"4\"),\n nowMillis: 30,\n },\n );\n\n yield* ensure(\n refused.state === \"refused\" && refused.refusal?.code === \"cancelled\",\n \"cancelled selection prepared\",\n );\n\n const durable = yield* store.register(record(\"durable\"), defaultSubscriptionLimits);\n const durableEvent = yield* store.accept(event(\"durable-event\"), defaultSubscriptionLimits);\n const selected = delivery(durable, durableEvent);\n\n yield* store.select(\n durableEvent,\n [selected],\n durable.ordinal,\n true,\n 20,\n defaultSubscriptionLimits,\n );\n\n const prepared = yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"Prepare\",\n envelope: preparedInput(selected),\n envelopeDigest: digest(\"5\"),\n nowMillis: 30,\n });\n\n const retry = {\n generation: 0,\n automaticAttempts: 0,\n parked: false,\n attempts: 2,\n nextAttemptAtMillis: 60,\n lastAttemptAtMillis: 35,\n lastFailure: \"transport\" as const,\n };\n\n yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"Retry\",\n retry,\n nowMillis: 35,\n });\n for (const staleRetry of [\n { ...retry, attempts: 1, nextAttemptAtMillis: 70 },\n { ...retry, nextAttemptAtMillis: 70 },\n { ...retry, attempts: 3, nextAttemptAtMillis: 50 },\n ]) {\n const retained = yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"Retry\",\n retry: staleRetry,\n nowMillis: 36,\n });\n\n yield* ensure(\n retained.retry.attempts === 2 && retained.retry.nextAttemptAtMillis === 60,\n \"stale retry overwrote newer retry state\",\n );\n }\n yield* store.cancel(durable.key);\n\n const completed = yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"Complete\",\n receipt,\n nowMillis: 40,\n });\n\n yield* ensure(\n prepared.state === \"prepared\" && completed.state === \"delivered\",\n \"prepared work did not survive cancellation\",\n );\n\n const stale = yield* Effect.result(\n store.changeDelivery(selected.key, digest(\"8\"), {\n _tag: \"Complete\",\n receipt,\n nowMillis: 41,\n }),\n );\n\n yield* ensure(\n Result.isFailure(stale) &&\n stale.failure._tag === \"SubscriptionError\" &&\n stale.failure.code === \"stale-delivery\",\n \"stale outcome was not fenced\",\n );\n }),\n);\n\nconst catchUpAndCursors = conformanceCase(\n \"limits catch-up to one watch and persists recovery cursors\",\n (ensure) =>\n Effect.gen(function* () {\n const store = yield* SubscriptionStore;\n const accepted = yield* store.accept(event(\"observed\"), defaultSubscriptionLimits);\n const watch = yield* store.register(record(\"watch\"), defaultSubscriptionLimits);\n const selected = delivery(watch, accepted);\n\n yield* store.catchUp(accepted, selected, 20, defaultSubscriptionLimits);\n yield* store.catchUp(\n accepted,\n { ...selected, selectedAtMillis: 999, retry: { ...selected.retry, attempts: 2 } },\n 30,\n defaultSubscriptionLimits,\n );\n yield* ensure(\n (yield* store.get(watch.key))?.state === \"consumed\",\n \"catch-up did not consume watch\",\n );\n yield* store.advanceScanCursors({ events: \"e\", deliveries: \"d\", recovery: 7 });\n const cursors = yield* store.readScanCursors;\n\n yield* ensure(\n cursors.events === \"e\" && cursors.deliveries === \"d\" && cursors.recovery === 7,\n \"scan cursors were not durable\",\n );\n yield* ensure(\n (yield* store.nextDeadline) === 0,\n \"nonzero scan cursor did not keep recovery armed\",\n );\n }),\n);\n\nconst replayUnderTighterLimits = conformanceCase(\n \"preserves retained identities when limits tighten\",\n (ensure) =>\n Effect.gen(function* () {\n const store = yield* SubscriptionStore;\n const created = yield* store.register(record(\"retained\"), defaultSubscriptionLimits);\n const accepted = yield* store.accept(event(\"retained\"), defaultSubscriptionLimits);\n\n const limits = {\n ...defaultSubscriptionLimits,\n maxRegistrations: 1,\n maxEvents: 1,\n maxPayloadBytes: 1,\n maxContextBytes: 1,\n maxLifetimeMillis: 1,\n };\n\n const replayed = yield* store.register(record(\"retained\"), limits);\n const repeated = yield* store.accept(event(\"retained\"), limits);\n\n yield* ensure(replayed.ordinal === created.ordinal, \"registration replay lost identity\");\n yield* ensure(repeated.cutoff === accepted.cutoff, \"intake replay lost cutoff\");\n const newRegistration = yield* Effect.result(store.register(record(\"new\"), limits));\n const newEvent = yield* Effect.result(store.accept(event(\"new\"), limits));\n\n yield* ensure(Result.isFailure(newRegistration), \"new registration ignored tightened limits\");\n yield* ensure(Result.isFailure(newEvent), \"new intake ignored tightened limits\");\n }),\n);\n\nconst revisionsAndRetention = conformanceCase(\n \"preserves historical selection, CAS revisions, and unsettled evidence during retention\",\n (ensure) =>\n Effect.gen(function* () {\n const store = yield* SubscriptionStore;\n const now = yield* Clock.currentTimeMillis;\n const policy = { replayHorizonMillis: 10_000, completedRetentionMillis: 0, maxTombstones: 8 };\n const limits = { ...defaultSubscriptionLimits, retention: policy };\n const indefinite = record(\"revision\", \"continuous\");\n\n const original = yield* store.register(\n {\n ...indefinite,\n configuration: { ...indefinite.configuration, expiresAtMillis: null },\n },\n limits,\n );\n\n yield* ensure(\n original.configuration.expiresAtMillis === null,\n \"UntilCancelled must remain explicit\",\n );\n yield* ensure(\n (yield* store.nextDeadline) === null,\n \"UntilCancelled cannot create an expiry wake\",\n );\n\n const accepted = yield* store.accept(\n { ...event(\"retained\"), occurredAtMillis: now, acceptedAtMillis: now },\n limits,\n );\n\n const selected = {\n ...delivery(original, accepted),\n configuration: original.configuration,\n configurationRevision: 1,\n };\n\n yield* store.select(\n accepted,\n [selected],\n original.ordinal,\n true,\n now + limits.maxLifetimeMillis + 1,\n limits,\n );\n yield* ensure(\n (yield* store.delivery(selected.key)) !== null,\n \"UntilCancelled cannot expire at the ordinary maximum lifetime\",\n );\n\n const updated = yield* store.change(original.key, 1, {\n _tag: \"Update\",\n configuration: { ...original.configuration, context: { edited: true } },\n configurationFingerprint: digest(\"9\"),\n recovery: null,\n });\n\n yield* ensure(\n updated.configurationRevision === 2 && updated.creationConfiguration !== undefined,\n \"Update must preserve creation evidence and advance revision\",\n );\n const stale = yield* store.change(original.key, 1, { _tag: \"Pause\" }).pipe(Effect.result);\n\n yield* ensure(Result.isFailure(stale), \"Stale management must conflict\");\n yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"Prepare\",\n envelope: preparedInput(selected),\n envelopeDigest: digest(\"4\"),\n nowMillis: now,\n });\n yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"Complete\",\n receipt,\n nowMillis: now,\n });\n yield* store.compact(now, policy, 8);\n yield* ensure(\n (yield* store.delivery(selected.key)) !== null,\n \"Admission is not settlement; delivery evidence must remain\",\n );\n yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"ObserveSettlement\",\n receipt,\n settled: true,\n nowMillis: now,\n nextAttemptAtMillis: now,\n });\n const recovering = yield* store.register(record(\"recovering-retention\", \"once\"), limits);\n\n yield* store.deferRecovery(recovering.key, recovering.configurationRevision, {\n attempts: 1,\n nextAttemptAtMillis: null,\n lastFailure: \"source-unavailable\",\n });\n yield* store.compact(now, policy, 8);\n yield* ensure(\n (yield* store.delivery(selected.key)) !== null,\n \"Permanent recovery evidence must protect retained source facts\",\n );\n yield* store.deferRecovery(recovering.key, recovering.configurationRevision, null);\n yield* store.compact(now, policy, 8);\n yield* ensure(\n (yield* store.delivery(selected.key)) === null,\n \"Settled delivery must release retained capacity\",\n );\n yield* ensure(\n (yield* store.event(accepted.eventId))?.tombstone === true,\n \"Deduplication tombstone must outlive completed payload\",\n );\n const replay = yield* store.accept(accepted, limits);\n\n yield* ensure(\n Result.isFailure(\n yield* store\n .accept({ ...accepted, occurredAtMillis: now + 1 }, limits)\n .pipe(Effect.result),\n ),\n \"An event identity cannot replace its retained source timestamp\",\n );\n\n yield* ensure(\n Result.isFailure(\n yield* store.compact(now, { ...policy, replayHorizonMillis: 1 }, 8).pipe(Effect.result),\n ),\n \"Compaction cannot change the persisted replay horizon\",\n );\n yield* ensure(\n Result.isFailure(\n yield* store\n .accept(event(\"without-policy\"), defaultSubscriptionLimits)\n .pipe(Effect.result),\n ),\n \"Fresh intake cannot disable established retention\",\n );\n yield* ensure(\n replay.cutoff === accepted.cutoff && replay.tombstone === true,\n \"Duplicate intake cannot reopen routing after compaction\",\n );\n }),\n);\n\nconst sustainedRetention = conformanceCase(\n \"reuses event, delivery and tombstone quotas across replay horizons\",\n (ensure) =>\n Effect.gen(function* () {\n const store = yield* SubscriptionStore;\n const policy = { replayHorizonMillis: 100, completedRetentionMillis: 0, maxTombstones: 8 };\n\n const limits = {\n ...defaultSubscriptionLimits,\n maxEvents: 4,\n maxDeliveries: 4,\n maxDeliveriesPerOwner: 4,\n retention: policy,\n };\n\n const registration = yield* store.register(record(\"sustained\", \"continuous\"), limits);\n\n // 32 events reuse four live slots and eight tombstone slots across six replay\n // horizons, including the lexical 9→10 boundary. The full driver's >1,000-event\n // regression remains in storage-memory/test/subscriptions.test.ts; bounded cursor\n // traversal is exercised separately by retentionFairness on every adapter.\n for (let index = 0; index < 32; index++) {\n const now = yield* Clock.currentTimeMillis;\n\n const accepted = yield* store.accept(\n { ...event(`retained-${index}`), occurredAtMillis: now, acceptedAtMillis: now },\n limits,\n );\n\n const deliveryId = Schema.decodeSync(Digest)(index.toString(16).padStart(64, \"0\"));\n\n const selected = {\n ...delivery(registration, accepted),\n deliveryId,\n admissionKey: Schema.decodeSync(IdempotencyKey)(`subscription:${deliveryId}`),\n };\n\n yield* store.select(accepted, [selected], registration.ordinal, true, now, limits);\n yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"Prepare\",\n envelope: preparedInput(selected),\n envelopeDigest: digest(\"4\"),\n nowMillis: now,\n });\n yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"Complete\",\n receipt,\n nowMillis: now,\n });\n yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"ObserveSettlement\",\n receipt,\n settled: true,\n nowMillis: now,\n nextAttemptAtMillis: now,\n });\n yield* store.compact(now, policy, 8);\n yield* ensure(\n (yield* store.delivery(selected.key)) === null,\n \"Settled delivery must release its quota on every cycle\",\n );\n yield* ensure(\n (yield* store.accept(accepted, limits)).tombstone === true,\n \"Duplicate acknowledgement must preserve its tombstone\",\n );\n yield* TestClock.adjust(20);\n }\n yield* ensure(\n (yield* store.event(\"retained-0\")) === null,\n \"Expired identity must be reclaimed\",\n );\n\n const expired = yield* store\n .accept({ ...event(\"retained-0\"), occurredAtMillis: 0 }, limits)\n .pipe(Effect.result);\n\n yield* ensure(\n Result.isFailure(expired) &&\n expired.failure._tag === \"SubscriptionError\" &&\n expired.failure.code === \"event-replay-horizon\",\n \"Reclaimed identity must not be admitted after its replay horizon\",\n );\n }),\n);\n\nconst recoveryRevisionFence = conformanceCase(\n \"fences source recovery across pause, resume and configuration replacement\",\n (ensure) =>\n Effect.gen(function* () {\n const store = yield* SubscriptionStore;\n\n const initial = yield* store.register(\n {\n ...record(\"recovery-revisions\"),\n recovery: { attempts: 0, nextAttemptAtMillis: 10, lastFailure: null },\n },\n defaultSubscriptionLimits,\n );\n\n const paused = yield* store.change(initial.key, 1, { _tag: \"Pause\" });\n\n yield* store.deferRecovery(initial.key, 1, null);\n yield* ensure(\n (yield* store.get(initial.key))?.recovery?.nextAttemptAtMillis === 10,\n \"late provider completion erased paused recovery\",\n );\n\n const resumed = yield* store.change(initial.key, paused.configurationRevision, {\n _tag: \"Resume\",\n });\n\n yield* ensure(\n resumed.recovery?.nextAttemptAtMillis === 10,\n \"resume lost the recovery obligation\",\n );\n\n const updated = yield* store.change(initial.key, resumed.configurationRevision, {\n _tag: \"Update\",\n configuration: { ...initial.configuration, source: { name: \"replacement\", version: \"2\" } },\n configurationFingerprint: digest(\"9\"),\n recovery: { attempts: 0, nextAttemptAtMillis: 50, lastFailure: null },\n });\n\n yield* store.deferRecovery(initial.key, resumed.configurationRevision, {\n attempts: 9,\n nextAttemptAtMillis: null,\n lastFailure: \"obsolete-source\",\n });\n const retained = yield* store.get(initial.key);\n\n yield* ensure(\n retained?.recovery?.nextAttemptAtMillis === 50 &&\n retained.configurationRevision === updated.configurationRevision,\n \"obsolete provider completion overwrote replacement recovery\",\n );\n yield* ensure(\n retained?.creationFingerprint === initial.creationFingerprint &&\n retained.creationConfiguration.source.name === initial.configuration.source.name,\n \"revision rewrote creation identity\",\n );\n }),\n);\n\nconst retryGenerationFence = conformanceCase(\n \"rearms only one delivery generation and retains late receipt authority\",\n (ensure) =>\n Effect.gen(function* () {\n const store = yield* SubscriptionStore;\n\n const subscription = yield* store.register(\n record(\"retry-generation\", \"continuous\"),\n defaultSubscriptionLimits,\n );\n\n const accepted = yield* store.accept(event(\"retry-generation\"), defaultSubscriptionLimits);\n const selected = { ...delivery(subscription, accepted), observeSettlement: true };\n\n yield* store.select(\n accepted,\n [selected],\n subscription.ordinal,\n true,\n 20,\n defaultSubscriptionLimits,\n );\n yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"Prepare\",\n envelope: preparedInput(selected),\n envelopeDigest: digest(\"4\"),\n nowMillis: 30,\n });\n\n const parked = yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"Retry\",\n nowMillis: 40,\n retry: {\n ...selected.retry,\n attempts: 8,\n automaticAttempts: 8,\n parked: true,\n nextAttemptAtMillis: 50,\n lastAttemptAtMillis: 40,\n lastFailure: \"ambiguous\",\n },\n });\n\n yield* ensure(\n (yield* store.pendingDeliveries(100, \"\", 10)).length === 0,\n \"parked admission remained due for settlement observation\",\n );\n yield* ensure(\n (yield* store.nextDeadline) === null,\n \"parked admission retained a busy-loop deadline\",\n );\n\n const recovered = yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"Recover\",\n expectedGeneration: parked.retry.generation,\n nowMillis: 50,\n });\n\n const stale = yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"Retry\",\n nowMillis: 60,\n retry: { ...parked.retry, attempts: 9, nextAttemptAtMillis: 70 },\n });\n\n yield* ensure(\n !stale.retry.parked && stale.retry.generation === recovered.retry.generation,\n \"stale retry undid recovery\",\n );\n\n const completed = yield* store.changeDelivery(selected.key, selected.deliveryId, {\n _tag: \"Complete\",\n receipt,\n nowMillis: 70,\n });\n\n yield* ensure(\n completed.receipt?.receiptId === receipt.receiptId &&\n completed.envelopeDigest === digest(\"4\"),\n \"late receipt or immutable envelope was lost\",\n );\n }),\n);\n\nconst retentionFairness = conformanceCase(\n \"advances bounded maintenance beyond protected oldest events\",\n (ensure) =>\n Effect.gen(function* () {\n const store = yield* SubscriptionStore;\n const policy = { replayHorizonMillis: 1_000, completedRetentionMillis: 0, maxTombstones: 8 };\n const limits = { ...defaultSubscriptionLimits, retention: policy };\n\n for (let index = 0; index < 6; index++) {\n const accepted = yield* store.accept(\n { ...event(`protected-${index}`), occurredAtMillis: 0, acceptedAtMillis: 0 },\n limits,\n );\n\n if (index === 5) yield* store.select(accepted, [], 0, true, 0, limits);\n }\n yield* TestClock.setTime(10);\n for (let pass = 0; pass < 8; pass++) yield* store.compact(10, policy, 1);\n yield* ensure(\n (yield* store.event(\"protected-5\"))?.tombstone === true,\n \"protected first pages starved a reclaimable event\",\n );\n yield* ensure(\n (yield* store.event(\"protected-0\"))?.tombstone !== true,\n \"unfinished event was reclaimed\",\n );\n yield* TestClock.setTime(1_001);\n for (let pass = 0; pass < 8; pass++) yield* store.compact(1_001, policy, 1);\n yield* ensure(\n (yield* store.event(\"protected-5\")) === null,\n \"idle maintenance did not expire tombstone\",\n );\n\n const rejected = yield* store\n .accept({ ...event(\"protected-5\"), occurredAtMillis: 0 }, limits)\n .pipe(Effect.result);\n\n // The caller cannot manufacture a recent occurrence to resurrect a pruned identity.\n yield* ensure(Result.isFailure(rejected), \"retention state became inconsistent\");\n }),\n);\n\nexport const subscriptionStoreConformanceCases: ReadonlyArray<SubscriptionStoreConformanceCase> = [\n historicalOccurrenceReplay,\n recoveryRevisionFence,\n retryGenerationFence,\n retentionFairness,\n sustainedRetention,\n revisionsAndRetention,\n cutoffAndIntake,\n onceAndCapacity,\n preparationLifecycle,\n catchUpAndCursors,\n replayUnderTighterLimits,\n];\n"],"mappings":";;;;;;;AAiBA,IAAa,wCAAb,cAA2D,OAAO,YAAmD,CAAC,CACpH,yCACA;CAAE,UAAU,OAAO;CAAQ,SAAS,OAAO;AAAO,CACpD,CAAC,CAAC,CAAC;AAWH,MAAa,mCAAoD;CAC/D,UAAU;CACV,SAAS;AACX;AAEA,MAAM,YAAY,OAAO,WAAW,SAAS,CAAC,CAAC,oCAAoC;AACnF,MAAM,UAAU,OAAO,WAAW,OAAO,CAAC,CAAC,gCAAgC;AAC3E,MAAM,WAAW,OAAO,WAAW,QAAQ,CAAC,CAAC,iCAAiC;AAC9E,MAAM,UAAU,cAAsB,OAAO,WAAW,MAAM,CAAC,CAAC,UAAU,OAAO,EAAE,CAAC;AAEpF,MAAM,cAAc,kBAAkB,KAAK;CACzC,OAAO,OAAO,GAAG;CACjB,OAAO,OAAO,GAAG;CACjB,OAAO,OAAO,GAAG;AACnB,CAAC;AAED,MAAM,UACJ,MACA,OAA8B,QAC9B,UAAU,aACc;CACxB,eAAe;CACf,KAAK;EAAE,WAAW;EAAkC;EAAS,gBAAgB;CAAK;CAClF,qBAAqB,OAAO,KAAK,WAAW,CAAC,IAAI,MAAM,IAAI,MAAM,GAAG;CACpE,WAAW;CACX,iBAAiB;CACjB,SAAS;CACT,uBAAuB;CACvB,0BAA0B,OAAO,KAAK,WAAW,CAAC,IAAI,MAAM,IAAI,MAAM,GAAG;CACzE,uBAAuB;EACrB,QAAQ;GAAE,MAAM;GAAW,SAAS;EAAI;EACxC,aAAa;EACb,YAAY,EAAE,KAAK;EACnB,SAAS,EAAE,KAAK;EAChB;EACA,iBAAiB;EACjB,aAAa;GAAE,MAAM;GAAkB;EAAS;EAChD,mBAAmB;EACnB;EACA;CACF;CACA,eAAe;EACb,QAAQ;GAAE,MAAM;GAAW,SAAS;EAA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AM,CAAC,CAChE,KAAK,OAAO,MAAM;EAGrB,OAAO,OAAO,OAAO,UAAU,QAAQ,GAAG,qCAAqC;CACjF,CAAC,CAOH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
@@ -0,0 +1,273 @@
1
+ import { t as AgentId, u as ThreadId } from "../Identifiers-CN2s30fF.mjs";
2
+ import { r as Principal } from "../Receipt-BAHyigAF.mjs";
3
+ import { t as DurableStep } from "../DurableStep-Cry_iol4.mjs";
4
+ import { h as DefinitionDigests } from "../Records-BAGkekt8.mjs";
5
+ import { c as ScheduleDestination } from "../Schedule-H3SEYX9g.mjs";
6
+ import { E as SubscriptionSourceError, g as SubscriptionFailpointError, i as EventSourceVersion, m as SubscriptionError, w as SubscriptionScope } from "../Subscription-BEP8oQO5.mjs";
7
+ import { Subscriptions } from "./Subscriptions.mjs";
8
+ import { Tool, Toolkit } from "effect/unstable/ai";
9
+ import { Crypto, Layer, Schema } from "effect";
10
+ declare namespace SubscriptionTools_d_exports {
11
+ export { CancelEventSubscription, CancelEventSubscriptionParameters, ListEventSources, ListEventSubscriptions, ListEventSubscriptionsParameters, PermittedSubscriptionToolSource, SubscribeToEvent, SubscribeToEventParameters, SubscriptionToolRegistration, SubscriptionToolSourceCatalogEntry, SubscriptionTools, SubscriptionToolsOptions, subscriptionToolsLayer };
12
+ }
13
+ declare const SubscriptionToolRegistration: Schema.Struct<{
14
+ readonly subscriptionId: Schema.NonEmptyString;
15
+ readonly source: Schema.Struct<{
16
+ readonly name: Schema.NonEmptyString;
17
+ readonly version: Schema.NonEmptyString;
18
+ }>;
19
+ readonly mode: Schema.Literals<readonly ["once", "continuous"]>;
20
+ readonly state: Schema.Literals<readonly ["active", "paused", "consumed", "cancelled", "expired"]>;
21
+ readonly createdAtMillis: Schema.Int;
22
+ readonly expiresAtMillis: Schema.NullOr<Schema.Int>;
23
+ readonly recovery: Schema.NullOr<Schema.Struct<{
24
+ readonly attempts: Schema.Natural;
25
+ readonly nextAttemptAtMillis: Schema.NullOr<Schema.Int>;
26
+ readonly lastFailure: Schema.NullOr<Schema.NonEmptyString>;
27
+ }>>;
28
+ }>;
29
+ type SubscriptionToolRegistration = typeof SubscriptionToolRegistration.Type;
30
+ declare const SubscribeToEventParameters: Schema.Struct<{
31
+ readonly source: Schema.Struct<{
32
+ readonly name: Schema.NonEmptyString;
33
+ readonly version: Schema.NonEmptyString;
34
+ }>;
35
+ readonly parameters: Schema.Codec<Schema.Json, Schema.Json, never, never>;
36
+ readonly mode: Schema.Literals<readonly ["once", "continuous"]>;
37
+ readonly expiresAtMillis: Schema.NullOr<Schema.Int>;
38
+ readonly context: Schema.Codec<Schema.Json, Schema.Json, never, never>;
39
+ }>;
40
+ declare const ListEventSubscriptionsParameters: Schema.Struct<{
41
+ readonly after: Schema.optionalKey<Schema.Natural>;
42
+ readonly limit: Schema.optionalKey<Schema.Int>;
43
+ }>;
44
+ declare const CancelEventSubscriptionParameters: Schema.Struct<{
45
+ readonly subscriptionId: Schema.NonEmptyString;
46
+ }>;
47
+ declare const SubscriptionToolSourceCatalogEntry: Schema.Struct<{
48
+ readonly source: Schema.Struct<{
49
+ readonly name: Schema.NonEmptyString;
50
+ readonly version: Schema.NonEmptyString;
51
+ }>;
52
+ readonly description: Schema.NonEmptyString;
53
+ readonly parametersJsonSchema: Schema.Codec<Schema.Json, Schema.Json, never, never>;
54
+ readonly contextJsonSchema: Schema.Codec<Schema.Json, Schema.Json, never, never>;
55
+ }>;
56
+ type SubscriptionToolSourceCatalogEntry = typeof SubscriptionToolSourceCatalogEntry.Type;
57
+ declare const ListEventSources: Tool.Tool<"list_event_sources", {
58
+ readonly parameters: Schema.Struct<{}>;
59
+ readonly success: Schema.$Array<Schema.Struct<{
60
+ readonly source: Schema.Struct<{
61
+ readonly name: Schema.NonEmptyString;
62
+ readonly version: Schema.NonEmptyString;
63
+ }>;
64
+ readonly description: Schema.NonEmptyString;
65
+ readonly parametersJsonSchema: Schema.Codec<Schema.Json, Schema.Json, never, never>;
66
+ readonly contextJsonSchema: Schema.Codec<Schema.Json, Schema.Json, never, never>;
67
+ }>>;
68
+ readonly failure: typeof SubscriptionError;
69
+ readonly failureMode: "return";
70
+ }, never>;
71
+ declare const SubscribeToEvent: Tool.Tool<"subscribe_to_event", {
72
+ readonly parameters: Schema.Struct<{
73
+ readonly source: Schema.Struct<{
74
+ readonly name: Schema.NonEmptyString;
75
+ readonly version: Schema.NonEmptyString;
76
+ }>;
77
+ readonly parameters: Schema.Codec<Schema.Json, Schema.Json, never, never>;
78
+ readonly mode: Schema.Literals<readonly ["once", "continuous"]>;
79
+ readonly expiresAtMillis: Schema.NullOr<Schema.Int>;
80
+ readonly context: Schema.Codec<Schema.Json, Schema.Json, never, never>;
81
+ }>;
82
+ readonly success: Schema.Struct<{
83
+ readonly subscriptionId: Schema.NonEmptyString;
84
+ readonly source: Schema.Struct<{
85
+ readonly name: Schema.NonEmptyString;
86
+ readonly version: Schema.NonEmptyString;
87
+ }>;
88
+ readonly mode: Schema.Literals<readonly ["once", "continuous"]>;
89
+ readonly state: Schema.Literals<readonly ["active", "paused", "consumed", "cancelled", "expired"]>;
90
+ readonly createdAtMillis: Schema.Int;
91
+ readonly expiresAtMillis: Schema.NullOr<Schema.Int>;
92
+ readonly recovery: Schema.NullOr<Schema.Struct<{
93
+ readonly attempts: Schema.Natural;
94
+ readonly nextAttemptAtMillis: Schema.NullOr<Schema.Int>;
95
+ readonly lastFailure: Schema.NullOr<Schema.NonEmptyString>;
96
+ }>>;
97
+ }>;
98
+ readonly failure: Schema.Union<readonly [typeof SubscriptionError, typeof SubscriptionSourceError, typeof SubscriptionFailpointError]>;
99
+ readonly failureMode: "return";
100
+ }, DurableStep>;
101
+ declare const ListEventSubscriptions: Tool.Tool<"list_event_subscriptions", {
102
+ readonly parameters: Schema.Struct<{
103
+ readonly after: Schema.optionalKey<Schema.Natural>;
104
+ readonly limit: Schema.optionalKey<Schema.Int>;
105
+ }>;
106
+ readonly success: Schema.Struct<{
107
+ readonly items: Schema.$Array<Schema.Struct<{
108
+ readonly subscriptionId: Schema.NonEmptyString;
109
+ readonly source: Schema.Struct<{
110
+ readonly name: Schema.NonEmptyString;
111
+ readonly version: Schema.NonEmptyString;
112
+ }>;
113
+ readonly mode: Schema.Literals<readonly ["once", "continuous"]>;
114
+ readonly state: Schema.Literals<readonly ["active", "paused", "consumed", "cancelled", "expired"]>;
115
+ readonly createdAtMillis: Schema.Int;
116
+ readonly expiresAtMillis: Schema.NullOr<Schema.Int>;
117
+ readonly recovery: Schema.NullOr<Schema.Struct<{
118
+ readonly attempts: Schema.Natural;
119
+ readonly nextAttemptAtMillis: Schema.NullOr<Schema.Int>;
120
+ readonly lastFailure: Schema.NullOr<Schema.NonEmptyString>;
121
+ }>>;
122
+ }>>;
123
+ readonly next: Schema.NullOr<Schema.Natural>;
124
+ }>;
125
+ readonly failure: typeof SubscriptionError;
126
+ readonly failureMode: "return";
127
+ }, never>;
128
+ declare const CancelEventSubscription: Tool.Tool<"cancel_event_subscription", {
129
+ readonly parameters: Schema.Struct<{
130
+ readonly subscriptionId: Schema.NonEmptyString;
131
+ }>;
132
+ readonly success: Schema.Struct<{
133
+ readonly subscriptionId: Schema.NonEmptyString;
134
+ readonly source: Schema.Struct<{
135
+ readonly name: Schema.NonEmptyString;
136
+ readonly version: Schema.NonEmptyString;
137
+ }>;
138
+ readonly mode: Schema.Literals<readonly ["once", "continuous"]>;
139
+ readonly state: Schema.Literals<readonly ["active", "paused", "consumed", "cancelled", "expired"]>;
140
+ readonly createdAtMillis: Schema.Int;
141
+ readonly expiresAtMillis: Schema.NullOr<Schema.Int>;
142
+ readonly recovery: Schema.NullOr<Schema.Struct<{
143
+ readonly attempts: Schema.Natural;
144
+ readonly nextAttemptAtMillis: Schema.NullOr<Schema.Int>;
145
+ readonly lastFailure: Schema.NullOr<Schema.NonEmptyString>;
146
+ }>>;
147
+ }>;
148
+ readonly failure: Schema.Union<readonly [typeof SubscriptionError, typeof SubscriptionFailpointError]>;
149
+ readonly failureMode: "return";
150
+ }, DurableStep>;
151
+ declare const SubscriptionTools: Toolkit.Toolkit<{
152
+ readonly cancel_event_subscription: Tool.Tool<"cancel_event_subscription", {
153
+ readonly parameters: Schema.Struct<{
154
+ readonly subscriptionId: Schema.NonEmptyString;
155
+ }>;
156
+ readonly success: Schema.Struct<{
157
+ readonly subscriptionId: Schema.NonEmptyString;
158
+ readonly source: Schema.Struct<{
159
+ readonly name: Schema.NonEmptyString;
160
+ readonly version: Schema.NonEmptyString;
161
+ }>;
162
+ readonly mode: Schema.Literals<readonly ["once", "continuous"]>;
163
+ readonly state: Schema.Literals<readonly ["active", "paused", "consumed", "cancelled", "expired"]>;
164
+ readonly createdAtMillis: Schema.Int;
165
+ readonly expiresAtMillis: Schema.NullOr<Schema.Int>;
166
+ readonly recovery: Schema.NullOr<Schema.Struct<{
167
+ readonly attempts: Schema.Natural;
168
+ readonly nextAttemptAtMillis: Schema.NullOr<Schema.Int>;
169
+ readonly lastFailure: Schema.NullOr<Schema.NonEmptyString>;
170
+ }>>;
171
+ }>;
172
+ readonly failure: Schema.Union<readonly [typeof SubscriptionError, typeof SubscriptionFailpointError]>;
173
+ readonly failureMode: "return";
174
+ }, DurableStep>;
175
+ readonly list_event_sources: Tool.Tool<"list_event_sources", {
176
+ readonly parameters: Schema.Struct<{}>;
177
+ readonly success: Schema.$Array<Schema.Struct<{
178
+ readonly source: Schema.Struct<{
179
+ readonly name: Schema.NonEmptyString;
180
+ readonly version: Schema.NonEmptyString;
181
+ }>;
182
+ readonly description: Schema.NonEmptyString;
183
+ readonly parametersJsonSchema: Schema.Codec<Schema.Json, Schema.Json, never, never>;
184
+ readonly contextJsonSchema: Schema.Codec<Schema.Json, Schema.Json, never, never>;
185
+ }>>;
186
+ readonly failure: typeof SubscriptionError;
187
+ readonly failureMode: "return";
188
+ }, never>;
189
+ readonly list_event_subscriptions: Tool.Tool<"list_event_subscriptions", {
190
+ readonly parameters: Schema.Struct<{
191
+ readonly after: Schema.optionalKey<Schema.Natural>;
192
+ readonly limit: Schema.optionalKey<Schema.Int>;
193
+ }>;
194
+ readonly success: Schema.Struct<{
195
+ readonly items: Schema.$Array<Schema.Struct<{
196
+ readonly subscriptionId: Schema.NonEmptyString;
197
+ readonly source: Schema.Struct<{
198
+ readonly name: Schema.NonEmptyString;
199
+ readonly version: Schema.NonEmptyString;
200
+ }>;
201
+ readonly mode: Schema.Literals<readonly ["once", "continuous"]>;
202
+ readonly state: Schema.Literals<readonly ["active", "paused", "consumed", "cancelled", "expired"]>;
203
+ readonly createdAtMillis: Schema.Int;
204
+ readonly expiresAtMillis: Schema.NullOr<Schema.Int>;
205
+ readonly recovery: Schema.NullOr<Schema.Struct<{
206
+ readonly attempts: Schema.Natural;
207
+ readonly nextAttemptAtMillis: Schema.NullOr<Schema.Int>;
208
+ readonly lastFailure: Schema.NullOr<Schema.NonEmptyString>;
209
+ }>>;
210
+ }>>;
211
+ readonly next: Schema.NullOr<Schema.Natural>;
212
+ }>;
213
+ readonly failure: typeof SubscriptionError;
214
+ readonly failureMode: "return";
215
+ }, never>;
216
+ readonly subscribe_to_event: Tool.Tool<"subscribe_to_event", {
217
+ readonly parameters: Schema.Struct<{
218
+ readonly source: Schema.Struct<{
219
+ readonly name: Schema.NonEmptyString;
220
+ readonly version: Schema.NonEmptyString;
221
+ }>;
222
+ readonly parameters: Schema.Codec<Schema.Json, Schema.Json, never, never>;
223
+ readonly mode: Schema.Literals<readonly ["once", "continuous"]>;
224
+ readonly expiresAtMillis: Schema.NullOr<Schema.Int>;
225
+ readonly context: Schema.Codec<Schema.Json, Schema.Json, never, never>;
226
+ }>;
227
+ readonly success: Schema.Struct<{
228
+ readonly subscriptionId: Schema.NonEmptyString;
229
+ readonly source: Schema.Struct<{
230
+ readonly name: Schema.NonEmptyString;
231
+ readonly version: Schema.NonEmptyString;
232
+ }>;
233
+ readonly mode: Schema.Literals<readonly ["once", "continuous"]>;
234
+ readonly state: Schema.Literals<readonly ["active", "paused", "consumed", "cancelled", "expired"]>;
235
+ readonly createdAtMillis: Schema.Int;
236
+ readonly expiresAtMillis: Schema.NullOr<Schema.Int>;
237
+ readonly recovery: Schema.NullOr<Schema.Struct<{
238
+ readonly attempts: Schema.Natural;
239
+ readonly nextAttemptAtMillis: Schema.NullOr<Schema.Int>;
240
+ readonly lastFailure: Schema.NullOr<Schema.NonEmptyString>;
241
+ }>>;
242
+ }>;
243
+ readonly failure: Schema.Union<readonly [typeof SubscriptionError, typeof SubscriptionSourceError, typeof SubscriptionFailpointError]>;
244
+ readonly failureMode: "return";
245
+ }, DurableStep>;
246
+ }>;
247
+ interface PermittedSubscriptionToolSource {
248
+ readonly source: EventSourceVersion;
249
+ /** The source's input Schema must be the input Schema of this exact host Agent identity. */
250
+ readonly agentId: AgentId;
251
+ readonly description: string;
252
+ readonly parameters: Schema.Top;
253
+ readonly context: Schema.Top;
254
+ }
255
+ interface SubscriptionToolsOptions {
256
+ readonly scope: SubscriptionScope;
257
+ readonly currentThreadId: ThreadId;
258
+ readonly deliveryPrincipal: Principal;
259
+ readonly agentId: AgentId;
260
+ readonly definitions: DefinitionDigests;
261
+ readonly permittedSources: ReadonlyArray<PermittedSubscriptionToolSource>;
262
+ /** Defaults to the current Thread; a host may instead bind deterministic fresh delivery. */
263
+ readonly destination?: ScheduleDestination | undefined;
264
+ }
265
+ /**
266
+ * Bind management authority before exposing Tools to a model. The model can select only an exact
267
+ * source/version and source-defined parameters; it cannot choose another tenant, owner,
268
+ * Thread, Agent, definition digest, principal, destination policy, or credential.
269
+ */
270
+ declare const subscriptionToolsLayer: (options: SubscriptionToolsOptions) => Layer.Layer<Tool.HandlersFor<Toolkit.Tools<typeof SubscriptionTools>>, SubscriptionError, Subscriptions | Crypto.Crypto>;
271
+ //#endregion
272
+ export { CancelEventSubscription, CancelEventSubscriptionParameters, ListEventSources, ListEventSubscriptions, ListEventSubscriptionsParameters, PermittedSubscriptionToolSource, SubscribeToEvent, SubscribeToEventParameters, SubscriptionToolRegistration, SubscriptionToolSourceCatalogEntry, SubscriptionTools, SubscriptionToolsOptions, subscriptionToolsLayer, SubscriptionTools_d_exports as t };
273
+ //# sourceMappingURL=SubscriptionTools.d.mts.map
@@ -0,0 +1,190 @@
1
+ import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
+ import { DurableStep, ToolExecutionClass } from "../engine/DurableStep.mjs";
3
+ import { SubscriptionError, SubscriptionFailpointError, SubscriptionName, SubscriptionSnapshot, SubscriptionSourceError } from "./Subscription.mjs";
4
+ import { Subscriptions } from "./Subscriptions.mjs";
5
+ import { Tool, Toolkit } from "effect/unstable/ai";
6
+ import { Crypto, Effect, Schema } from "effect";
7
+ //#region src/durable/SubscriptionTools.ts
8
+ var SubscriptionTools_exports = /* @__PURE__ */ __exportAll({
9
+ CancelEventSubscription: () => CancelEventSubscription,
10
+ CancelEventSubscriptionParameters: () => CancelEventSubscriptionParameters,
11
+ ListEventSources: () => ListEventSources,
12
+ ListEventSubscriptions: () => ListEventSubscriptions,
13
+ ListEventSubscriptionsParameters: () => ListEventSubscriptionsParameters,
14
+ SubscribeToEvent: () => SubscribeToEvent,
15
+ SubscribeToEventParameters: () => SubscribeToEventParameters,
16
+ SubscriptionToolRegistration: () => SubscriptionToolRegistration,
17
+ SubscriptionToolSourceCatalogEntry: () => SubscriptionToolSourceCatalogEntry,
18
+ SubscriptionTools: () => SubscriptionTools,
19
+ subscriptionToolsLayer: () => subscriptionToolsLayer
20
+ });
21
+ const SubscriptionToolRegistration = Schema.Struct({
22
+ subscriptionId: SubscriptionName,
23
+ source: Schema.Struct({
24
+ name: SubscriptionName,
25
+ version: SubscriptionName
26
+ }),
27
+ mode: Schema.Literals(["once", "continuous"]),
28
+ state: Schema.Literals([
29
+ "active",
30
+ "paused",
31
+ "consumed",
32
+ "cancelled",
33
+ "expired"
34
+ ]),
35
+ createdAtMillis: Schema.Int,
36
+ expiresAtMillis: Schema.NullOr(Schema.Int),
37
+ recovery: SubscriptionSnapshot.fields.recovery
38
+ });
39
+ const SubscribeToEventParameters = Schema.Struct({
40
+ source: Schema.Struct({
41
+ name: SubscriptionName,
42
+ version: SubscriptionName
43
+ }),
44
+ parameters: Schema.Json,
45
+ mode: Schema.Literals(["once", "continuous"]),
46
+ expiresAtMillis: Schema.NullOr(Schema.Int).annotate({ description: "Absolute Unix epoch milliseconds, or null to remain active until cancelled; retain the same value on retries" }),
47
+ context: Schema.Json
48
+ });
49
+ const ListEventSubscriptionsParameters = Schema.Struct({
50
+ after: Schema.optionalKey(Schema.Natural),
51
+ limit: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0), Schema.isLessThanOrEqualTo(100)))
52
+ });
53
+ const CancelEventSubscriptionParameters = Schema.Struct({ subscriptionId: SubscriptionName });
54
+ const SubscriptionToolSourceCatalogEntry = Schema.Struct({
55
+ source: Schema.Struct({
56
+ name: SubscriptionName,
57
+ version: SubscriptionName
58
+ }),
59
+ description: Schema.NonEmptyString.check(Schema.isMaxLength(2048)),
60
+ parametersJsonSchema: Schema.Json,
61
+ contextJsonSchema: Schema.Json
62
+ });
63
+ const SubscriptionToolFailure = Schema.Union([
64
+ SubscriptionError,
65
+ SubscriptionSourceError,
66
+ SubscriptionFailpointError
67
+ ]);
68
+ const ListEventSources = Tool.make("list_event_sources", {
69
+ description: "List the exact event source versions this host permits, with their parameter and continuation-context JSON Schemas. Inspect this catalog before subscribing.",
70
+ parameters: Schema.Struct({}),
71
+ success: Schema.Array(SubscriptionToolSourceCatalogEntry),
72
+ failure: SubscriptionError,
73
+ failureMode: "return"
74
+ }).annotate(Tool.Readonly, true).annotate(ToolExecutionClass, "readonly");
75
+ const SubscribeToEvent = Tool.make("subscribe_to_event", {
76
+ description: "Register a durable event subscription from the host-permitted source catalog. The destination, Agent, authority, and delivery principal are fixed by the host.",
77
+ parameters: SubscribeToEventParameters,
78
+ success: SubscriptionToolRegistration,
79
+ failure: SubscriptionToolFailure,
80
+ failureMode: "return",
81
+ dependencies: [DurableStep]
82
+ }).annotate(Tool.Readonly, false).annotate(ToolExecutionClass, "idempotent");
83
+ const ListEventSubscriptions = Tool.make("list_event_subscriptions", {
84
+ description: "List redacted durable event subscriptions in the current host-bound owner scope.",
85
+ parameters: ListEventSubscriptionsParameters,
86
+ success: Schema.Struct({
87
+ items: Schema.Array(SubscriptionToolRegistration),
88
+ next: Schema.NullOr(Schema.Natural)
89
+ }),
90
+ failure: SubscriptionError,
91
+ failureMode: "return"
92
+ }).annotate(Tool.Readonly, true).annotate(ToolExecutionClass, "readonly");
93
+ const CancelEventSubscription = Tool.make("cancel_event_subscription", {
94
+ description: "Cancel one durable event subscription in the current host-bound owner scope.",
95
+ parameters: CancelEventSubscriptionParameters,
96
+ success: SubscriptionToolRegistration,
97
+ failure: Schema.Union([SubscriptionError, SubscriptionFailpointError]),
98
+ failureMode: "return",
99
+ dependencies: [DurableStep]
100
+ }).annotate(Tool.Readonly, false).annotate(ToolExecutionClass, "idempotent");
101
+ const SubscriptionTools = Toolkit.make(ListEventSources, SubscribeToEvent, ListEventSubscriptions, CancelEventSubscription);
102
+ const sameSource = (left, right) => left.name === right.name && left.version === right.version;
103
+ const registration = (snapshot) => ({
104
+ subscriptionId: snapshot.key.subscriptionId,
105
+ source: snapshot.source,
106
+ mode: snapshot.mode,
107
+ state: snapshot.state,
108
+ createdAtMillis: snapshot.createdAtMillis,
109
+ expiresAtMillis: snapshot.expiresAtMillis,
110
+ recovery: snapshot.recovery
111
+ });
112
+ const toolFailure = (reason, code) => SubscriptionError.make({
113
+ reason,
114
+ code
115
+ });
116
+ /**
117
+ * Bind management authority before exposing Tools to a model. The model can select only an exact
118
+ * source/version and source-defined parameters; it cannot choose another tenant, owner,
119
+ * Thread, Agent, definition digest, principal, destination policy, or credential.
120
+ */
121
+ const subscriptionToolsLayer = (options) => {
122
+ const destination = options.destination ?? {
123
+ _tag: "ExistingThread",
124
+ threadId: options.currentThreadId
125
+ };
126
+ const build = Effect.gen(function* () {
127
+ if (options.permittedSources.find((candidate, index, all) => all.findIndex((item) => sameSource(item.source, candidate.source)) !== index) !== void 0) return yield* toolFailure("validation", "duplicate-source-catalog-entry");
128
+ if (options.permittedSources.find((candidate) => candidate.agentId !== options.agentId) !== void 0) return yield* toolFailure("validation", "source-agent-mismatch");
129
+ const catalog = yield* Effect.forEach(options.permittedSources, (candidate) => Effect.gen(function* () {
130
+ const description = yield* Schema.decodeEffect(SubscriptionToolSourceCatalogEntry.fields.description)(candidate.description).pipe(Effect.mapError(() => toolFailure("validation", "source-catalog-description")));
131
+ return SubscriptionToolSourceCatalogEntry.make({
132
+ source: candidate.source,
133
+ description,
134
+ parametersJsonSchema: yield* Effect.try({
135
+ try: () => Tool.getJsonSchemaFromSchema(candidate.parameters),
136
+ catch: () => toolFailure("validation", "source-parameters-schema")
137
+ }),
138
+ contextJsonSchema: yield* Effect.try({
139
+ try: () => Tool.getJsonSchemaFromSchema(candidate.context),
140
+ catch: () => toolFailure("validation", "source-context-schema")
141
+ })
142
+ });
143
+ }));
144
+ const subscriptions = yield* Subscriptions;
145
+ const crypto = yield* Crypto.Crypto;
146
+ const permitted = (source) => options.permittedSources.some((candidate) => sameSource(candidate.source, source));
147
+ const subscribe = Effect.fn("SubscriptionTools.subscribe")(function* (parameters) {
148
+ if (!permitted(parameters.source)) return yield* toolFailure("unauthorized", "source-catalog");
149
+ const step = yield* DurableStep;
150
+ const subscriptionId = yield* step.do("subscription-identity", SubscriptionName, crypto.randomUUIDv7.pipe(Effect.map((id) => `tool:${id}`), Effect.mapError(() => toolFailure("storage", "creation-identity")))).pipe(Effect.catchTag("DurableStepError", (error) => Effect.fail(toolFailure("storage", `durable-step-${error.reason}`))));
151
+ return yield* step.do("register-subscription", SubscriptionToolRegistration, subscriptions.subscribe(options.scope, {
152
+ subscriptionId,
153
+ source: parameters.source,
154
+ parameters: parameters.parameters,
155
+ context: parameters.context,
156
+ mode: parameters.mode,
157
+ expiresAtMillis: parameters.expiresAtMillis,
158
+ destination,
159
+ deliveryPrincipal: options.deliveryPrincipal,
160
+ agentId: options.agentId,
161
+ definitions: options.definitions
162
+ }).pipe(Effect.map(registration))).pipe(Effect.catchTag("DurableStepError", (error) => Effect.fail(toolFailure("storage", `durable-step-${error.reason}`))));
163
+ });
164
+ const list = Effect.fn("SubscriptionTools.list")(function* (parameters) {
165
+ const page = yield* subscriptions.listSubscriptions(options.scope, parameters.after, parameters.limit);
166
+ return {
167
+ items: page.items.map(registration),
168
+ next: page.next
169
+ };
170
+ });
171
+ const cancel = Effect.fn("SubscriptionTools.cancel")(function* (parameters) {
172
+ return yield* (yield* DurableStep).do("cancel-subscription", SubscriptionToolRegistration, subscriptions.cancelSubscription(options.scope, {
173
+ partition: options.scope.partition,
174
+ ownerId: options.scope.ownerId,
175
+ subscriptionId: parameters.subscriptionId
176
+ }).pipe(Effect.map(registration))).pipe(Effect.catchTag("DurableStepError", (error) => Effect.fail(toolFailure("storage", `durable-step-${error.reason}`))));
177
+ });
178
+ return SubscriptionTools.of({
179
+ list_event_sources: () => Effect.succeed(catalog),
180
+ subscribe_to_event: subscribe,
181
+ list_event_subscriptions: list,
182
+ cancel_event_subscription: cancel
183
+ });
184
+ });
185
+ return SubscriptionTools.toLayer(build);
186
+ };
187
+ //#endregion
188
+ export { CancelEventSubscription, CancelEventSubscriptionParameters, ListEventSources, ListEventSubscriptions, ListEventSubscriptionsParameters, SubscribeToEvent, SubscribeToEventParameters, SubscriptionToolRegistration, SubscriptionToolSourceCatalogEntry, SubscriptionTools, subscriptionToolsLayer, SubscriptionTools_exports as t };
189
+
190
+ //# sourceMappingURL=SubscriptionTools.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubscriptionTools.mjs","names":[],"sources":["../../src/durable/SubscriptionTools.ts"],"sourcesContent":["import type { Layer } from \"effect\";\nimport { Crypto, Effect, Schema } from \"effect\";\nimport { Tool, Toolkit } from \"effect/unstable/ai\";\n\nimport { type AgentId, type ThreadId } from \"../core/Identifiers.ts\";\nimport { DurableStep, ToolExecutionClass } from \"../engine/DurableStep.ts\";\nimport type { DefinitionDigests, PersistedJson } from \"./Records.ts\";\nimport type { ScheduleDestination } from \"./Schedule.ts\";\nimport type { Principal } from \"./SubmissionLedger.ts\";\nimport {\n type EventSourceVersion,\n SubscriptionError,\n SubscriptionFailpointError,\n SubscriptionName,\n SubscriptionSnapshot,\n SubscriptionSourceError,\n type SubscriptionScope,\n} from \"./Subscription.ts\";\nimport { Subscriptions } from \"./Subscriptions.ts\";\n\nexport const SubscriptionToolRegistration = Schema.Struct({\n subscriptionId: SubscriptionName,\n source: Schema.Struct({ name: SubscriptionName, version: SubscriptionName }),\n mode: Schema.Literals([\"once\", \"continuous\"]),\n state: Schema.Literals([\"active\", \"paused\", \"consumed\", \"cancelled\", \"expired\"]),\n createdAtMillis: Schema.Int,\n expiresAtMillis: Schema.NullOr(Schema.Int),\n recovery: SubscriptionSnapshot.fields.recovery,\n});\n\nexport type SubscriptionToolRegistration = typeof SubscriptionToolRegistration.Type;\n\nexport const SubscribeToEventParameters = Schema.Struct({\n source: Schema.Struct({ name: SubscriptionName, version: SubscriptionName }),\n parameters: Schema.Json,\n mode: Schema.Literals([\"once\", \"continuous\"]),\n expiresAtMillis: Schema.NullOr(Schema.Int).annotate({\n description:\n \"Absolute Unix epoch milliseconds, or null to remain active until cancelled; retain the same value on retries\",\n }),\n context: Schema.Json,\n});\n\nexport const ListEventSubscriptionsParameters = Schema.Struct({\n after: Schema.optionalKey(Schema.Natural),\n limit: Schema.optionalKey(\n Schema.Int.check(Schema.isGreaterThan(0), Schema.isLessThanOrEqualTo(100)),\n ),\n});\n\nexport const CancelEventSubscriptionParameters = Schema.Struct({\n subscriptionId: SubscriptionName,\n});\n\nexport const SubscriptionToolSourceCatalogEntry = Schema.Struct({\n source: Schema.Struct({ name: SubscriptionName, version: SubscriptionName }),\n description: Schema.NonEmptyString.check(Schema.isMaxLength(2_048)),\n parametersJsonSchema: Schema.Json,\n contextJsonSchema: Schema.Json,\n});\n\nexport type SubscriptionToolSourceCatalogEntry = typeof SubscriptionToolSourceCatalogEntry.Type;\n\nconst SubscriptionToolFailure = Schema.Union([\n SubscriptionError,\n SubscriptionSourceError,\n SubscriptionFailpointError,\n]);\n\nexport const ListEventSources = Tool.make(\"list_event_sources\", {\n description:\n \"List the exact event source versions this host permits, with their parameter and continuation-context JSON Schemas. Inspect this catalog before subscribing.\",\n parameters: Schema.Struct({}),\n success: Schema.Array(SubscriptionToolSourceCatalogEntry),\n failure: SubscriptionError,\n failureMode: \"return\",\n})\n .annotate(Tool.Readonly, true)\n .annotate(ToolExecutionClass, \"readonly\");\n\nexport const SubscribeToEvent = Tool.make(\"subscribe_to_event\", {\n description:\n \"Register a durable event subscription from the host-permitted source catalog. The destination, Agent, authority, and delivery principal are fixed by the host.\",\n parameters: SubscribeToEventParameters,\n success: SubscriptionToolRegistration,\n failure: SubscriptionToolFailure,\n failureMode: \"return\",\n dependencies: [DurableStep],\n})\n .annotate(Tool.Readonly, false)\n .annotate(ToolExecutionClass, \"idempotent\");\n\nexport const ListEventSubscriptions = Tool.make(\"list_event_subscriptions\", {\n description: \"List redacted durable event subscriptions in the current host-bound owner scope.\",\n parameters: ListEventSubscriptionsParameters,\n success: Schema.Struct({\n items: Schema.Array(SubscriptionToolRegistration),\n next: Schema.NullOr(Schema.Natural),\n }),\n failure: SubscriptionError,\n failureMode: \"return\",\n})\n .annotate(Tool.Readonly, true)\n .annotate(ToolExecutionClass, \"readonly\");\n\nexport const CancelEventSubscription = Tool.make(\"cancel_event_subscription\", {\n description: \"Cancel one durable event subscription in the current host-bound owner scope.\",\n parameters: CancelEventSubscriptionParameters,\n success: SubscriptionToolRegistration,\n failure: Schema.Union([SubscriptionError, SubscriptionFailpointError]),\n failureMode: \"return\",\n dependencies: [DurableStep],\n})\n .annotate(Tool.Readonly, false)\n .annotate(ToolExecutionClass, \"idempotent\");\n\nexport const SubscriptionTools = Toolkit.make(\n ListEventSources,\n SubscribeToEvent,\n ListEventSubscriptions,\n CancelEventSubscription,\n);\n\nexport interface PermittedSubscriptionToolSource {\n readonly source: EventSourceVersion;\n /** The source's input Schema must be the input Schema of this exact host Agent identity. */\n readonly agentId: AgentId;\n readonly description: string;\n readonly parameters: Schema.Top;\n readonly context: Schema.Top;\n}\n\nexport interface SubscriptionToolsOptions {\n readonly scope: SubscriptionScope;\n readonly currentThreadId: ThreadId;\n readonly deliveryPrincipal: Principal;\n readonly agentId: AgentId;\n readonly definitions: DefinitionDigests;\n readonly permittedSources: ReadonlyArray<PermittedSubscriptionToolSource>;\n /** Defaults to the current Thread; a host may instead bind deterministic fresh delivery. */\n readonly destination?: ScheduleDestination | undefined;\n}\n\nconst sameSource = (left: EventSourceVersion, right: EventSourceVersion): boolean =>\n left.name === right.name && left.version === right.version;\n\nconst registration = (\n snapshot: typeof SubscriptionSnapshot.Type,\n): SubscriptionToolRegistration => ({\n subscriptionId: snapshot.key.subscriptionId,\n source: snapshot.source,\n mode: snapshot.mode,\n state: snapshot.state,\n createdAtMillis: snapshot.createdAtMillis,\n expiresAtMillis: snapshot.expiresAtMillis,\n recovery: snapshot.recovery,\n});\n\nconst toolFailure = (reason: SubscriptionError[\"reason\"], code: string): SubscriptionError =>\n SubscriptionError.make({ reason, code });\n\n/**\n * Bind management authority before exposing Tools to a model. The model can select only an exact\n * source/version and source-defined parameters; it cannot choose another tenant, owner,\n * Thread, Agent, definition digest, principal, destination policy, or credential.\n */\nexport const subscriptionToolsLayer = (\n options: SubscriptionToolsOptions,\n): Layer.Layer<\n Tool.HandlersFor<Toolkit.Tools<typeof SubscriptionTools>>,\n SubscriptionError,\n Subscriptions | Crypto.Crypto\n> => {\n const destination: ScheduleDestination = options.destination ?? {\n _tag: \"ExistingThread\",\n threadId: options.currentThreadId,\n };\n\n const build = Effect.gen(function* () {\n const duplicate = options.permittedSources.find(\n (candidate, index, all) =>\n all.findIndex((item) => sameSource(item.source, candidate.source)) !== index,\n );\n\n if (duplicate !== undefined) {\n return yield* toolFailure(\"validation\", \"duplicate-source-catalog-entry\");\n }\n\n const mismatched = options.permittedSources.find(\n (candidate) => candidate.agentId !== options.agentId,\n );\n\n if (mismatched !== undefined) {\n return yield* toolFailure(\"validation\", \"source-agent-mismatch\");\n }\n\n const catalog = yield* Effect.forEach(options.permittedSources, (candidate) =>\n Effect.gen(function* () {\n const description = yield* Schema.decodeEffect(\n SubscriptionToolSourceCatalogEntry.fields.description,\n )(candidate.description).pipe(\n Effect.mapError(() => toolFailure(\"validation\", \"source-catalog-description\")),\n );\n\n return SubscriptionToolSourceCatalogEntry.make({\n source: candidate.source,\n description,\n parametersJsonSchema: yield* Effect.try({\n try: () => Tool.getJsonSchemaFromSchema(candidate.parameters),\n catch: () => toolFailure(\"validation\", \"source-parameters-schema\"),\n }),\n contextJsonSchema: yield* Effect.try({\n try: () => Tool.getJsonSchemaFromSchema(candidate.context),\n catch: () => toolFailure(\"validation\", \"source-context-schema\"),\n }),\n });\n }),\n );\n\n const subscriptions = yield* Subscriptions;\n const crypto = yield* Crypto.Crypto;\n\n const permitted = (source: EventSourceVersion) =>\n options.permittedSources.some((candidate) => sameSource(candidate.source, source));\n\n const subscribe = Effect.fn(\"SubscriptionTools.subscribe\")(function* (parameters: {\n readonly source: EventSourceVersion;\n readonly parameters: PersistedJson;\n readonly mode: \"once\" | \"continuous\";\n readonly expiresAtMillis: number | null;\n readonly context: PersistedJson;\n }) {\n if (!permitted(parameters.source)) {\n return yield* toolFailure(\"unauthorized\", \"source-catalog\");\n }\n const step = yield* DurableStep;\n\n // The first committed Step creates one identity per Tool Call. Re-entry observes the same\n // value, while a separate identical call receives a distinct identity.\n const subscriptionId = yield* step\n .do(\n \"subscription-identity\",\n SubscriptionName,\n crypto.randomUUIDv7.pipe(\n Effect.map((id) => `tool:${id}`),\n Effect.mapError(() => toolFailure(\"storage\", \"creation-identity\")),\n ),\n )\n .pipe(\n Effect.catchTag(\"DurableStepError\", (error) =>\n Effect.fail(toolFailure(\"storage\", `durable-step-${error.reason}`)),\n ),\n );\n\n return yield* step\n .do(\n \"register-subscription\",\n SubscriptionToolRegistration,\n subscriptions\n .subscribe(options.scope, {\n subscriptionId,\n source: parameters.source,\n parameters: parameters.parameters,\n context: parameters.context,\n mode: parameters.mode,\n expiresAtMillis: parameters.expiresAtMillis,\n destination,\n deliveryPrincipal: options.deliveryPrincipal,\n agentId: options.agentId,\n definitions: options.definitions,\n })\n .pipe(Effect.map(registration)),\n )\n .pipe(\n Effect.catchTag(\"DurableStepError\", (error) =>\n Effect.fail(toolFailure(\"storage\", `durable-step-${error.reason}`)),\n ),\n );\n });\n\n const list = Effect.fn(\"SubscriptionTools.list\")(function* (parameters: {\n readonly after?: number | undefined;\n readonly limit?: number | undefined;\n }) {\n const page = yield* subscriptions.listSubscriptions(\n options.scope,\n parameters.after,\n parameters.limit,\n );\n\n return { items: page.items.map(registration), next: page.next };\n });\n\n const cancel = Effect.fn(\"SubscriptionTools.cancel\")(function* (parameters: {\n readonly subscriptionId: string;\n }) {\n const step = yield* DurableStep;\n\n return yield* step\n .do(\n \"cancel-subscription\",\n SubscriptionToolRegistration,\n subscriptions\n .cancelSubscription(options.scope, {\n partition: options.scope.partition,\n ownerId: options.scope.ownerId,\n subscriptionId: parameters.subscriptionId,\n })\n .pipe(Effect.map(registration)),\n )\n .pipe(\n Effect.catchTag(\"DurableStepError\", (error) =>\n Effect.fail(toolFailure(\"storage\", `durable-step-${error.reason}`)),\n ),\n );\n });\n\n return SubscriptionTools.of({\n list_event_sources: () => Effect.succeed(catalog),\n subscribe_to_event: subscribe,\n list_event_subscriptions: list,\n cancel_event_subscription: cancel,\n });\n });\n\n return SubscriptionTools.toLayer(build);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,+BAA+B,OAAO,OAAO;CACxD,gBAAgB;CAChB,QAAQ,OAAO,OAAO;EAAE,MAAM;EAAkB,SAAS;CAAiB,CAAC;CAC3E,MAAM,OAAO,SAAS,CAAC,QAAQ,YAAY,CAAC;CAC5C,OAAO,OAAO,SAAS;EAAC;EAAU;E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QAAQ,KAAK;AACxC"}
@@ -0,0 +1,21 @@
1
+ import { b as SubscriptionRecord, d as SubscriptionDelivery, l as SubscriptionChange, m as SubscriptionError, n as DeliveryChange, o as SourcePartition, t as AcceptedEvent, v as SubscriptionLimits } from "../Subscription-BEP8oQO5.mjs";
2
+ import { Result } from "effect";
3
+ declare namespace SubscriptionTransition_d_exports {
4
+ export { applySubscriptionChange, applySubscriptionDeliveryChange, sameAcceptedEventIdentity, sameSourcePartition, sameSubscriptionDelivery, subscriptionCanSelect, subscriptionDeliveryCanSelect, subscriptionMatchesEvent, validateEventRetention };
5
+ }
6
+ declare const sameSourcePartition: (left: SourcePartition, right: SourcePartition) => boolean;
7
+ /** The retained event is authoritative. An absent historical occurrence stays unknown on replay. */
8
+ declare const sameAcceptedEventIdentity: (left: AcceptedEvent, right: AcceptedEvent) => boolean;
9
+ declare const subscriptionMatchesEvent: (subscription: SubscriptionRecord, event: AcceptedEvent) => boolean;
10
+ declare const subscriptionCanSelect: (subscription: SubscriptionRecord, event: AcceptedEvent, nowMillis: number, bypassCutoff: boolean) => boolean;
11
+ declare const subscriptionDeliveryCanSelect: (delivery: SubscriptionDelivery, subscription: SubscriptionRecord, event: AcceptedEvent) => boolean;
12
+ declare const sameSubscriptionDelivery: (left: SubscriptionDelivery, right: SubscriptionDelivery) => boolean;
13
+ /** Pure lifecycle transition used inside each adapter's local atomic mutation. */
14
+ declare const applySubscriptionDeliveryChange: (existing: SubscriptionDelivery, subscription: SubscriptionRecord, deliveryId: string, change: DeliveryChange) => Result.Result<SubscriptionDelivery, SubscriptionError>;
15
+ /** CAS management never mutates a selected or prepared delivery. */
16
+ declare const applySubscriptionChange: (existing: SubscriptionRecord, expectedRevision: number, change: SubscriptionChange) => Result.Result<SubscriptionRecord, SubscriptionError>;
17
+ /** Called only after retained identity lookup: unfinished work remains replayable past the horizon. */
18
+ declare const validateEventRetention: (event: AcceptedEvent, limits: SubscriptionLimits, nowMillis: number) => Result.Result<void, SubscriptionError>;
19
+ //#endregion
20
+ export { applySubscriptionChange, applySubscriptionDeliveryChange, sameAcceptedEventIdentity, sameSourcePartition, sameSubscriptionDelivery, subscriptionCanSelect, subscriptionDeliveryCanSelect, subscriptionMatchesEvent, SubscriptionTransition_d_exports as t, validateEventRetention };
21
+ //# sourceMappingURL=SubscriptionTransition.d.mts.map