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":"Admin.mjs","names":[],"sources":["../../src/durable/Admin.ts"],"sourcesContent":["import { DateTime, Schema } from \"effect\";\n\nimport { ThreadId, SubmissionId, ToolCallId } from \"../core/Identifiers.ts\";\nimport { CanonicalSequence, SettlementOutcome, ToolCallUnknown } from \"./Records.ts\";\nimport {\n OpenDelegationCallEvidence,\n OpenToolCallEvidence,\n PendingApprovalEvidence,\n RecoveryDecision,\n} from \"./Recovery.ts\";\nimport {\n AbortIntent,\n AbortCommand,\n ApprovalDecisionIntent,\n ChildAttachmentSnapshot,\n JoinSnapshot,\n ParentLinkage,\n QueueSequence,\n SubmissionState,\n SuspensionSnapshot,\n UnknownResolutionIntent,\n type RecoverySnapshot,\n} from \"./SubmissionLedger.ts\";\n\n/**\n * Pure report logic for the P7 administrative operations (plan §3): the Schema classes carried\n * by `DurableAgentRuntime.explain`/`verify`/`scanObligations`, the operator meaning table for\n * every recovery decision tag, and the text renderer. Everything here is pure — no port access,\n * no clocks, no writes — so hosts, CLIs, and wire envelopes share one report vocabulary.\n */\n\nconst BoundedDetail = Schema.String.check(Schema.isMaxLength(4_096));\n\n/** Non-negative whole seconds derived from the Effect Clock. */\nconst AgeSeconds = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));\n\n// ---------------------------------------------------------------------------\n// explain — RecoveryExplanation\n// ---------------------------------------------------------------------------\n\n/**\n * The disposition family of `RecoveryReport`, reused verbatim so an explanation predicts exactly\n * what `runRecovery`/`retry` would report for the same decision.\n */\nexport const RecoveryDisposition = Schema.Literals([\"repaired\", \"deferred\", \"none\", \"unknown\"]);\nexport type RecoveryDisposition = typeof RecoveryDisposition.Type;\n\n/** Submission identity, lane position, and Clock-derived ages (DUR-017 obligation visibility). */\nexport class ExplainedSubmission extends Schema.Class<ExplainedSubmission>(\n \"@effect-agent/thread/ExplainedSubmission\",\n)({\n submissionId: SubmissionId,\n threadId: ThreadId,\n state: SubmissionState,\n queueSequence: QueueSequence,\n createdAt: Schema.DateTimeUtcFromString,\n readyAt: Schema.optionalKey(Schema.DateTimeUtcFromString),\n /** Whole seconds since admission (`createdAt`). */\n ageSeconds: AgeSeconds,\n /** Whole seconds since readiness, present exactly when `readyAt` is recorded. */\n readyAgeSeconds: Schema.optionalKey(AgeSeconds),\n parentLinkage: Schema.optionalKey(ParentLinkage),\n}) {}\n\n/** One durable Unknown Outcome and whether a covering resolution intent exists (DUR-017). */\nexport class ExplainedUnknownCall extends Schema.Class<ExplainedUnknownCall>(\n \"@effect-agent/thread/ExplainedUnknownCall\",\n)({\n toolCallId: ToolCallId,\n toolName: ToolCallUnknown.fields.toolName,\n reason: ToolCallUnknown.fields.reason,\n recordedAt: Schema.DateTimeUtcFromString,\n /** A durable `resolveUnknown` intent covers this call. */\n resolved: Schema.Boolean,\n}) {}\n\n/**\n * The evidence summary of one explanation: the classifier's canonical-history inputs plus the\n * durable intents and subagent attachments the ledger snapshot carries. Everything is read-only\n * observation — assembling this value performs zero writes.\n */\nexport class ExplainedEvidence extends Schema.Class<ExplainedEvidence>(\n \"@effect-agent/thread/ExplainedEvidence\",\n)({\n threadMaterialized: Schema.Boolean,\n inputRecorded: Schema.Boolean,\n abortRecorded: Schema.Boolean,\n recordedSettlementOutcome: Schema.optionalKey(SettlementOutcome),\n /** Prepared ordinary Tool Calls without a canonical outcome (DUR-009). */\n openToolCalls: Schema.Array(OpenToolCallEvidence),\n /** Delegation Tool Calls with an open parent-side obligation. */\n openDelegationCalls: Schema.Array(OpenDelegationCallEvidence),\n /** Canonically requested approvals without a canonical decision. */\n approvalsPending: Schema.Array(PendingApprovalEvidence),\n /** Durable Unknown Outcomes with their resolution coverage (DUR-017). */\n unknownCalls: Schema.Array(ExplainedUnknownCall),\n /** Durable approval decisions recorded against this Submission. */\n approvalDecisions: Schema.Array(ApprovalDecisionIntent),\n /** Durable unknown-outcome resolutions recorded against this Submission. */\n unknownResolutions: Schema.Array(UnknownResolutionIntent),\n /** Parent-side child attachments. */\n childAttachments: Schema.Array(ChildAttachmentSnapshot),\n /** Host-side joined/joining members of this Submission's Run (DUR-016). */\n joins: Schema.Array(JoinSnapshot),\n /** Joined-side host identity, when this Submission is joined to a host Run. */\n hostSubmissionId: Schema.optionalKey(SubmissionId),\n suspension: Schema.optionalKey(SuspensionSnapshot),\n abortIntent: Schema.optionalKey(AbortIntent),\n}) {}\n\n/**\n * The read-only recovery explanation of one Submission (P7 exit gate \"operators can explain\n * recovery state without editing storage\"): the submission summary, the evidence the pure\n * classifier consumed, the exact `RecoveryDecision` it selected, that decision's operator\n * meaning, and the disposition the recovery pass would report for it.\n */\nexport class RecoveryExplanation extends Schema.Class<RecoveryExplanation>(\n \"@effect-agent/thread/RecoveryExplanation\",\n)({\n submission: ExplainedSubmission,\n evidence: ExplainedEvidence,\n decision: RecoveryDecision,\n /** Static operator meaning of `decision._tag` (see `RECOVERY_DECISION_MEANINGS`). */\n decisionMeaning: BoundedDetail,\n /**\n * The disposition `runRecovery` would report when this decision executes without claim\n * contention (see `predictRecoveryDisposition`): `repaired` = the recovery pass itself fixes\n * it; `deferred` = a claiming worker must finish it; `unknown` = durably blocked on the\n * authorized DUR-017 resolution path; `none` = settled, nothing owed.\n */\n disposition: RecoveryDisposition,\n explainedAt: Schema.DateTimeUtcFromString,\n}) {}\n\n/**\n * Operator meaning of every recovery decision tag, matching the classifier docstrings in\n * `recovery.ts` (the classifier remains the semantic authority; this table is its operator\n * rendering). Exhaustive over `RecoveryDecision` — adding a decision without a meaning is a\n * compile error here.\n */\nexport const RECOVERY_DECISION_MEANINGS: Readonly<Record<RecoveryDecision[\"_tag\"], string>> = {\n CompleteMaterialization:\n \"Ledger admission committed but the Thread is not durable: recovery finishes materialization, appends ThreadCreated, and marks readiness.\",\n RepairReadiness:\n \"The Thread is durable but the readiness marker is missing: recovery replays the idempotent markReady.\",\n ApplyInput:\n \"No canonical input record exists yet: recovery appends the deterministic UserInputRecorded record and marks it applied.\",\n RepairInputMarker:\n \"The canonical input record exists but the ledger marker was lost: recovery repairs the marker from history, never the reverse (DUR-015).\",\n ResumeFromTurnBoundary:\n \"Input is applied and no terminal work is reserved: a claiming worker resumes the Run from the last committed Turn boundary; the model may be re-invoked and any duplicate cost is observable (durability §9).\",\n AppendReservedSettlement:\n \"A settlement is reserved but not canonical: recovery appends the EXACT reserved record, then finalizes (DUR-011).\",\n FinalizeLedgerFromHistory:\n \"The canonical settlement record exists: recovery rebuilds/finalizes the ledger from history and never rewrites history from the cached ledger status (DUR-011, DUR-015).\",\n SettleAborted:\n \"A durable abort intent exists with no reserved outcome and no open attached-child obligation: recovery settles aborted, first recording ToolCallUnknown audits for open ordinary calls — abort never asserts external rollback (durability §13).\",\n MarkUnknown:\n \"Prepared ordinary Tool Calls have no canonical outcome: recovery reconciles each open call and marks the remainder Unknown — never an automatic replay (DUR-009/DUR-017).\",\n ResumePendingToolBatch:\n \"A committed tool-declaring response has zero prepared and zero settled records: a claiming worker resumes the declared batch without model re-invocation and without Unknown (durability §15).\",\n AwaitApprovalDecision:\n \"Canonically requested approvals lack decisions: the lane waits durably for the authorized resolveApproval path (recovery repairs a lost suspend transition from history).\",\n ResumeSuspended:\n \"Every pending approval has a durable decision: a claiming worker resumes the declared batch, appending the canonical ToolApprovalDecided records first.\",\n AwaitUnknownResolution:\n \"Unknown Outcomes lack covering resolutions: the lane stays blocked awaiting the authorized DUR-017 resolveUnknown path; the obligation stays visible, nothing replays.\",\n ApplyUnknownResolutions:\n \"Durable resolution intents cover every open call: recovery applies them canonically and reopens the lane.\",\n RevertJoining:\n \"The Submission is joining without a canonical input record: recovery reverts it to ready — the input was never consumed and will be delivered exactly once later (DUR-016).\",\n RepairJoinMarker:\n \"The canonical joined input exists but the joined marker was lost: recovery repairs the marker only; the input reattaches, never duplicates (DUR-015/DUR-016).\",\n SettleJoinedWithHost:\n \"The host Run settled canonically: recovery settles this joined Submission with the host outcome — each joined Submission is owed its own settlement (DUR-002).\",\n AwaitHostSettlement:\n \"The Submission is joined and its host Run is still live: nothing to repair — the input reattaches through the host's resume and the Submission settles with the host.\",\n CompleteChildAdmission:\n \"A canonical SubagentRequested exists and the authoritative lookup proved not-admitted: recovery idempotently admits the intended child from the canonical request payload alone.\",\n AwaitChildAdmissionResolution:\n \"The authoritative child-admission lookup answered indeterminate (or was not performed): recovery waits and retries the authoritative owner; a second admission never occurs (SUB-031).\",\n RepairSubagentStartLink:\n \"The child is admitted but the parent's SubagentStarted link (or reservation attachment) is missing: recovery resolves the SAME child by its deterministic key and appends the exact link (SUB-016/SUB-017).\",\n EnsureWaitingForChild:\n \"Children are established and at least one is nonterminal while the parent lane is not durably suspended: recovery restores the waitingForChild suspension; it reattaches the one existing child and never spawns a replacement (SUB-018/SUB-030).\",\n AwaitChildSettlement:\n \"The parent is durably suspended waitingForChild and a listed child is not yet provably settled: the lane stays dormant, consumes no worker permit, and the child's Settlement wakes it durably (SUB-021/SUB-030).\",\n ResumeWaitingParent:\n \"Every relevant child is provably settled but the parent has not joined: recovery replays the idempotent wake so a claiming worker resumes the declared batch and joins each child's canonical Settlement.\",\n ApplyJoinAccounting:\n \"The canonical SubagentJoined record exists but the reservation release is incomplete: recovery replays the accounting decision FROM the canonical record — budget stays unavailable until repair, never available twice (DUR-015).\",\n PropagateChildAbort:\n \"Parent abort is canonical while attached children are nonterminal: recovery idempotently issues each child's durable abort command and keeps the parent waiting for the joins — request-abort-and-join is the only close behavior.\",\n ReleaseOrphanChildReservation:\n \"A child budget reservation can no longer bind a child: recovery freezes the deterministic zero-consumed accounting decision and releases the unused allocation exactly once.\",\n AwaitParentEstablishment:\n \"The Submission is a parent-linked child whose Thread lacks the canonical lineage record: the child lane defers its own readiness repair — the parent's idempotent establishment completes it, so a child never runs a Turn before its lineage is canonical (P7 §7(a), SUB-016).\",\n NoAction: \"The Submission is settled; nothing is owed.\",\n};\n\n/** The operator meaning of one recovery decision tag. */\nexport const recoveryDecisionMeaning = (tag: RecoveryDecision[\"_tag\"]): string =>\n RECOVERY_DECISION_MEANINGS[tag];\n\n/**\n * The disposition the recovery executor reports for a decision when its repair executes without\n * claim contention (pure prediction; `executeRecoveryDecision` in the coordinator remains the\n * execution authority — a lane concurrently claimed by a worker can always defer instead).\n * `AwaitApprovalDecision` depends on the snapshot: an already-suspended lane waits (`deferred`),\n * while a claimable lane with a lost suspend transition is repaired.\n */\nexport const predictRecoveryDisposition = (\n decision: RecoveryDecision,\n snapshot: RecoverySnapshot,\n): RecoveryDisposition => {\n switch (decision._tag) {\n case \"NoAction\":\n return \"none\";\n case \"AwaitUnknownResolution\":\n case \"MarkUnknown\":\n return \"unknown\";\n case \"ResumeFromTurnBoundary\":\n case \"ResumePendingToolBatch\":\n case \"ResumeSuspended\":\n case \"AwaitHostSettlement\":\n case \"AwaitChildAdmissionResolution\":\n case \"AwaitChildSettlement\":\n case \"AwaitParentEstablishment\":\n return \"deferred\";\n case \"AwaitApprovalDecision\":\n return snapshot.submission.state === \"suspended\" ? \"deferred\" : \"repaired\";\n default:\n return \"repaired\";\n }\n};\n\nconst formatUtc = (value: DateTime.Utc): string => DateTime.formatIso(value);\n\n/** Pure operator text for one explanation (the CLI's `explain` output body). */\nexport const renderRecoveryExplanation = (explanation: RecoveryExplanation): string => {\n const submission = explanation.submission;\n const evidence = explanation.evidence;\n\n const lines: Array<string> = [\n `Submission ${submission.submissionId} (thread ${submission.threadId})`,\n ` state: ${submission.state} queue: ${submission.queueSequence} age: ${submission.ageSeconds}s`,\n ` admitted: ${formatUtc(submission.createdAt)}${\n submission.readyAt === undefined ? \"\" : ` ready: ${formatUtc(submission.readyAt)}`\n }`,\n ];\n\n if (submission.parentLinkage !== undefined) {\n lines.push(\n ` attached child of ${submission.parentLinkage.parentSubmissionId} (tool call ${submission.parentLinkage.parentToolCallId})`,\n );\n }\n lines.push(\n ` evidence: input=${evidence.inputRecorded ? \"recorded\" : \"missing\"}` +\n ` settlement=${evidence.recordedSettlementOutcome ?? \"none\"}` +\n ` abort=${evidence.abortRecorded ? \"recorded\" : \"none\"}` +\n ` materialized=${evidence.threadMaterialized ? \"yes\" : \"no\"}`,\n );\n if (evidence.openToolCalls.length > 0) {\n lines.push(\n ` open ordinary tool calls: ${evidence.openToolCalls\n .map((call) => `${call.toolName}#${call.toolCallId}`)\n .join(\", \")}`,\n );\n }\n if (evidence.openDelegationCalls.length > 0) {\n lines.push(\n ` open delegation calls: ${evidence.openDelegationCalls\n .map(\n (call) =>\n `${call.toolName}#${call.toolCallId}(requested=${call.requested} started=${call.started} joined=${call.joined})`,\n )\n .join(\", \")}`,\n );\n }\n if (evidence.approvalsPending.length > 0) {\n lines.push(\n ` approvals pending: ${evidence.approvalsPending\n .map((pending) => pending.toolCallId)\n .join(\", \")}`,\n );\n }\n for (const unknown of evidence.unknownCalls) {\n lines.push(\n ` unknown outcome: ${unknown.toolName}#${unknown.toolCallId} recorded ${formatUtc(unknown.recordedAt)} ${\n unknown.resolved ? \"(resolution intent recorded)\" : \"(awaiting resolveUnknown)\"\n }`,\n );\n }\n if (evidence.childAttachments.length > 0) {\n lines.push(\n ` attached children: ${evidence.childAttachments\n .map((child) => `${child.childSubmissionId}(${child.childState})`)\n .join(\", \")}`,\n );\n }\n if (evidence.joins.length > 0) {\n lines.push(\n ` joined members: ${evidence.joins\n .map((join) => `${join.submissionId}(${join.state})`)\n .join(\", \")}`,\n );\n }\n if (evidence.hostSubmissionId !== undefined) {\n lines.push(` joined to host: ${evidence.hostSubmissionId}`);\n }\n if (evidence.suspension !== undefined) {\n lines.push(\n ` suspended (${evidence.suspension.reason._tag}) since ${formatUtc(evidence.suspension.suspendedAt)}`,\n );\n }\n if (evidence.abortIntent !== undefined) {\n lines.push(\n ` abort intent by ${evidence.abortIntent.author} at ${formatUtc(evidence.abortIntent.requestedAt)}`,\n );\n }\n lines.push(\n ` decision: ${explanation.decision._tag} → disposition ${explanation.disposition}`,\n ` meaning: ${explanation.decisionMeaning}`,\n );\n\n return lines.join(\"\\n\");\n};\n\n// ---------------------------------------------------------------------------\n// verify — IntegrityReport\n// ---------------------------------------------------------------------------\n\n/** The named integrity checks `verifyThreadInvariants` performs. */\nexport const IntegrityCheckName = Schema.Literals([\n /** Every exported envelope round-trips its canonical Schema. */\n \"schema-round-trip\",\n /** No canonical record identity appears twice (DUR-007). */\n \"record-identity\",\n /** Canonical sequences are gap-free from 1 through the exported tail. */\n \"sequence-contiguity\",\n /** The tail digest chain recomputes from EMPTY_TAIL_DIGEST over every batch (DUR-006/DUR-007). */\n \"digest-chain\",\n /** Canonical `input:{sid}` records follow the admitted FIFO order (DUR-004). */\n \"fifo-input-order\",\n /** Canonical settlement records follow the admitted FIFO order (DUR-004); aborted\n * settlements of never-run work are exempt by design (P7 §7(c)). */\n \"fifo-settlement-order\",\n /** At most one canonical terminal record per Submission; exactly one per settled row (DUR-002). */\n \"terminal-uniqueness\",\n /** Ledger terminal state agrees with the canonical settlement record (DUR-015). */\n \"ledger-canonical-agreement\",\n /** The stored checkpoint binds to the recomputed digest chain at its sequence. */\n \"checkpoint-binding\",\n /** Convergence mode only: every known Submission is settled. */\n \"all-settled\",\n]);\n\nexport type IntegrityCheckName = typeof IntegrityCheckName.Type;\n\nexport const IntegrityCheckStatus = Schema.Literals([\"passed\", \"failed\", \"skipped\"]);\nexport type IntegrityCheckStatus = typeof IntegrityCheckStatus.Type;\n\n/** One typed check result; `detail` explains a failure or the honest reason for a skip. */\nexport class IntegrityCheck extends Schema.Class<IntegrityCheck>(\n \"@effect-agent/thread/IntegrityCheck\",\n)({\n name: IntegrityCheckName,\n status: IntegrityCheckStatus,\n detail: Schema.optionalKey(BoundedDetail),\n}) {}\n\n/**\n * The read-only integrity verdict for one Thread (plan §3 `verify`): typed per-check\n * results, never a repair. `ok` is true exactly when no check failed — skipped checks are\n * honest scope statements, not silent passes.\n */\nexport class IntegrityReport extends Schema.Class<IntegrityReport>(\n \"@effect-agent/thread/IntegrityReport\",\n)({\n threadId: ThreadId,\n tailSequence: CanonicalSequence,\n recordCount: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n submissionCount: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n checks: Schema.Array(IntegrityCheck),\n ok: Schema.Boolean,\n}) {}\n\n// ---------------------------------------------------------------------------\n// scanObligations — ObligationReport\n// ---------------------------------------------------------------------------\n\n/**\n * What one nonterminal Submission is visibly blocked on (DUR-017 operator surface; OPS-001).\n * `ready-aged`/`running-aged` are not blocks — they are accepted work whose settlement age is\n * measurable and alertable.\n */\nexport const ObligationBlockedOn = Schema.Literals([\n \"unknown\",\n \"approval\",\n \"waitingForChild\",\n \"ready-aged\",\n \"running-aged\",\n]);\n\nexport type ObligationBlockedOn = typeof ObligationBlockedOn.Type;\n\nexport const ObligationSeverity = Schema.Literals([\"ok\", \"aging\", \"overdue\"]);\nexport type ObligationSeverity = typeof ObligationSeverity.Type;\n\n/** Host-supplied age thresholds; the framework deliberately does not own the alert loop. */\nexport class ObligationThresholds extends Schema.Class<ObligationThresholds>(\n \"@effect-agent/thread/ObligationThresholds\",\n)({\n /** Age (whole seconds) at which an obligation is reported `aging`. */\n agingSeconds: AgeSeconds,\n /** Age (whole seconds) at which an obligation is reported `overdue`. */\n overdueSeconds: AgeSeconds,\n}) {}\n\n/** One nonterminal accepted-work obligation with its age and severity. */\nexport class ObligationEntry extends Schema.Class<ObligationEntry>(\n \"@effect-agent/thread/ObligationEntry\",\n)({\n submissionId: SubmissionId,\n threadId: ThreadId,\n state: SubmissionState,\n blockedOn: ObligationBlockedOn,\n ageSeconds: AgeSeconds,\n severity: ObligationSeverity,\n}) {}\n\n/**\n * The scan-based DUR-017/OPS-001 operator surface (plan §3): a fold of the ledger's nonterminal\n * scan into aged, severity-classified rows. Scan-based, never a daemon — hosts run it\n * periodically and export logs/metrics; ages need no storage-version bump because every source\n * timestamp already exists (`createdAt`/`readyAt`, `suspendedAt`, the canonical\n * `ToolCallUnknown` record's `createdAt`).\n */\nexport class ObligationReport extends Schema.Class<ObligationReport>(\n \"@effect-agent/thread/ObligationReport\",\n)({\n thresholds: ObligationThresholds,\n entries: Schema.Array(ObligationEntry),\n generatedAt: Schema.DateTimeUtcFromString,\n}) {}\n\n/** Severity of one obligation age under the supplied thresholds. */\nexport const obligationSeverityOf = (\n ageSeconds: number,\n thresholds: ObligationThresholds,\n): ObligationSeverity =>\n ageSeconds >= thresholds.overdueSeconds\n ? \"overdue\"\n : ageSeconds >= thresholds.agingSeconds\n ? \"aging\"\n : \"ok\";\n\n// ---------------------------------------------------------------------------\n// retry — typed command and refusals\n// ---------------------------------------------------------------------------\n\n/**\n * The mandatory-audit retry command (SEC-011): `author`/`reason` carry the same bounds as the\n * canonical abort command so every mutating administrative operation stays attributable. The\n * executed repair itself appends the deterministic `RepairAnnotated` audit record (DUR-013) —\n * retry adds no new canonical record type.\n */\nexport class RetryCommand extends Schema.Class<RetryCommand>(\"@effect-agent/thread/RetryCommand\")({\n submissionId: SubmissionId,\n author: AbortCommand.fields.author,\n reason: AbortCommand.fields.reason,\n}) {}\n\n/** Why a retry was refused without executing anything. */\nexport const RetryRefusalReason = Schema.Literals([\n /** The Submission is settled; terminal outcomes are never revisited (DUR-002). */\n \"settled\",\n /** The lane is durably blocked on Unknown Outcomes; use `resolveUnknown` (DUR-017). */\n \"await-unknown-resolution\",\n /** The lane is durably waiting for approval decisions; use `resolveApproval`. */\n \"await-approval-decision\",\n]);\n\nexport type RetryRefusalReason = typeof RetryRefusalReason.Type;\n\n/**\n * Typed refusal of `retry` (plan §3): lanes blocked on `AwaitUnknownResolution` or\n * `AwaitApprovalDecision` have their own authorized operations, and settled work is never\n * re-driven. The refusal names the classifier decision so the operator sees WHY.\n */\nexport class RetryRefused extends Schema.TaggedError<RetryRefused>()(\"RetryRefused\", {\n submissionId: SubmissionId,\n refusal: RetryRefusalReason,\n decisionTag: Schema.String.check(Schema.isMaxLength(256)),\n message: Schema.String.check(Schema.isMaxLength(4_096)),\n}) {}\n"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ import { Br as definitionDigestsEqual, Fr as DurableBindingFailure, Ir as DurableWorkerBinding, Lr as ExecutableAgentBinding, Mr as AgentRegistration, Nr as BindingDigestMismatch, Pr as BindingUnavailable, Rr as ResolvedBinding, jr as AgentAttemptContext, zr as compileRegistrations } from "../Records-BAGkekt8.mjs";
2
+ export { type AgentAttemptContext, type AgentRegistration, BindingDigestMismatch, BindingUnavailable, type DurableBindingFailure, DurableWorkerBinding, type ExecutableAgentBinding, type ResolvedBinding, compileRegistrations, definitionDigestsEqual };
@@ -0,0 +1,14 @@
1
+ import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
+ import { a as definitionDigestsEqual, i as compileRegistrations, n as BindingUnavailable, r as DurableWorkerBinding, t as BindingDigestMismatch } from "../agent-registration-CWDMOAZA.mjs";
3
+ //#region src/durable/AgentRegistration.ts
4
+ var AgentRegistration_exports = /* @__PURE__ */ __exportAll({
5
+ BindingDigestMismatch: () => BindingDigestMismatch,
6
+ BindingUnavailable: () => BindingUnavailable,
7
+ DurableWorkerBinding: () => DurableWorkerBinding,
8
+ compileRegistrations: () => compileRegistrations,
9
+ definitionDigestsEqual: () => definitionDigestsEqual
10
+ });
11
+ //#endregion
12
+ export { BindingDigestMismatch, BindingUnavailable, DurableWorkerBinding, compileRegistrations, definitionDigestsEqual, AgentRegistration_exports as t };
13
+
14
+ //# sourceMappingURL=AgentRegistration.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentRegistration.mjs","names":[],"sources":["../../src/durable/AgentRegistration.ts"],"sourcesContent":["/** Public AgentRegistration API. Implementation helpers remain private. */\nexport {\n BindingUnavailable,\n BindingDigestMismatch,\n DurableWorkerBinding,\n compileRegistrations,\n definitionDigestsEqual,\n type AgentRegistration,\n type AgentAttemptContext,\n type ExecutableAgentBinding,\n type DurableBindingFailure,\n type ResolvedBinding,\n} from \"./internal/agent-registration.ts\";\n"],"mappings":""}
@@ -0,0 +1,111 @@
1
+ import { Va as SubmissionLedger, nn as ThreadStore } from "../Records-BAGkekt8.mjs";
2
+ import { Crypto, Effect, Schema } from "effect";
3
+ //#region src/durable/Certification.d.ts
4
+ declare const CertifiedAdapterIdentity_base: Schema.Class<CertifiedAdapterIdentity, Schema.Struct<{
5
+ /** Workspace/package name of the adapter pair under certification. */
6
+ readonly name: Schema.NonEmptyString;
7
+ readonly version: Schema.optionalKey<Schema.String>;
8
+ readonly durability: Schema.Literals<readonly ["durable-node", "durable-cloudflare", "non-durable"]>;
9
+ }>, {}>;
10
+ /**
11
+ * Adapter self-description carried by a certificate. `durability` is read from the candidate
12
+ * ledger's `capabilities` — the adapter's honest claim (persistence.md), never inferred by the
13
+ * certification runner.
14
+ */
15
+ declare class CertifiedAdapterIdentity extends CertifiedAdapterIdentity_base {}
16
+ /** Which shared suite one Tier-1 (or lever-driven Tier-3) case belongs to. */
17
+ declare const CertificationSuite: Schema.Literals<readonly ["submission-ledger", "thread-store", "real-loss"]>;
18
+ type CertificationSuite = typeof CertificationSuite.Type;
19
+ declare const CertificationCaseResult_base: Schema.Class<CertificationCaseResult, Schema.Struct<{
20
+ readonly suite: Schema.Literals<readonly ["submission-ledger", "thread-store", "real-loss"]>;
21
+ readonly name: Schema.NonEmptyString;
22
+ readonly status: Schema.Literals<readonly ["passed", "failed"]>;
23
+ readonly detail: Schema.optionalKey<Schema.String>;
24
+ }>, {}>;
25
+ /** One executed certification case: a conformance contract case or a Tier-3 lever row. */
26
+ declare class CertificationCaseResult extends CertificationCaseResult_base {}
27
+ /**
28
+ * The six Tier-2 scenario shapes: each reached coordinator fault boundary is armed once
29
+ * per shape. Locations outside a shape's path share its verified clean run.
30
+ */
31
+ declare const CertificationScenario: Schema.Literals<readonly ["plain", "uncertain-tool", "durable-steps", "approval", "join", "delegation"]>;
32
+ type CertificationScenario = typeof CertificationScenario.Type;
33
+ /**
34
+ * Outcome of one Tier-2 sweep cell:
35
+ *
36
+ * - `converged` — the armed fault fired once, recovery classified the state, and the re-drive
37
+ * converged to verified invariants;
38
+ * - `not-triggered` — the location was not reached with that fault armed, or was absent from
39
+ * the scenario's verified clean path (shared across such locations). Never fault coverage;
40
+ * - `failed` — anything else.
41
+ */
42
+ declare const CertificationSweepStatus: Schema.Literals<readonly ["converged", "not-triggered", "failed"]>;
43
+ type CertificationSweepStatus = typeof CertificationSweepStatus.Type;
44
+ declare const CertificationSweepResult_base: Schema.Class<CertificationSweepResult, Schema.Struct<{
45
+ readonly scenario: Schema.Literals<readonly ["plain", "uncertain-tool", "durable-steps", "approval", "join", "delegation"]>;
46
+ readonly location: Schema.Literals<readonly ["submit:after-admit", "submit:after-materialize", "claim:after-claim", "input:after-canonical-append", "run:before-start-append", "run:after-start-append", "turn:after-canonical-append", "turn:after-response-append", "turn:after-results-append", "compaction:before-canonical-append", "compaction:after-canonical-append", "checkpoint:before-save", "checkpoint:after-save", "tools:after-prepared-append", "tools:before-prepared-append", "policy:before-reservation-append", "policy:after-reservation-append", "step:after-step-append", "approval:after-request-append", "approval:after-suspend", "join:after-claim", "join:after-canonical-append", "resolve:after-intent", "terminalize:after-reserve", "terminalize:after-canonical-append", "abort:after-intent", "subagent:after-reserve", "subagent:after-request-append", "subagent:after-admit", "subagent:after-child-ready", "subagent:after-start-append", "subagent:after-sibling-settle", "subagent:after-suspend", "subagent:after-child-abort-intent", "subagent:before-join-append", "subagent:after-join-append", "subagent:after-release-pending", "subagent:after-release", "worker:before-source-append", "worker:after-source-append", "worker:before-origin-append", "worker:after-origin-append", "worker:before-completion-append", "worker:after-completion-append", "worker:before-subtree-append", "worker:after-subtree-append", "worker:before-report-append", "worker:after-report-append", "worker:before-report-delivery", "worker:after-report-delivery", "update:before-canonical-append", "update:after-canonical-append", "update:before-delivery-insert", "update:after-delivery-insert"]>;
47
+ /** The armed fault actually fired (one-shot) somewhere in the cell's drive or re-drive. */
48
+ readonly failpointFired: Schema.Boolean;
49
+ readonly status: Schema.Literals<readonly ["converged", "not-triggered", "failed"]>;
50
+ /**
51
+ * Every lane's digest chain recomputed from `EMPTY_TAIL_DIGEST` and matched the exported
52
+ * tail — fully discharged here because the runner captures per-batch producer identity at
53
+ * append time (the port-only admin `verify` reports this check `skipped` instead).
54
+ * Unreached locations may share the scenario's clean-run verification.
55
+ */
56
+ readonly digestChainVerified: Schema.Boolean;
57
+ readonly detail: Schema.optionalKey<Schema.String>;
58
+ }>, {}>;
59
+ /** One Tier-2 scenario/location result, including locations outside the verified path. */
60
+ declare class CertificationSweepResult extends CertificationSweepResult_base {}
61
+ /**
62
+ * How the real-loss tier was discharged. Tier 3 is never silently claimed: an adapter either
63
+ * exercised a real loss lever in this run (`exercised`), cites committed real-loss evidence
64
+ * (`recorded-evidence`), honestly records that nothing exercised it (`not-exercised`), or is a
65
+ * non-durable reference adapter with no real loss to exercise (`not-applicable`).
66
+ */
67
+ declare const CertificationTierThreeStatus: Schema.Literals<readonly ["exercised", "recorded-evidence", "not-exercised", "not-applicable"]>;
68
+ type CertificationTierThreeStatus = typeof CertificationTierThreeStatus.Type;
69
+ declare const CertificationTierThreeReport_base: Schema.Class<CertificationTierThreeReport, Schema.Struct<{
70
+ readonly status: Schema.Literals<readonly ["exercised", "recorded-evidence", "not-exercised", "not-applicable"]>;
71
+ /** Cited real-loss suites. The runner does not execute or verify these references. */
72
+ readonly evidence: Schema.$Array<Schema.String>;
73
+ /** Rows executed by a supplied crash lever in THIS run (`suite: "real-loss"`). */
74
+ readonly cases: Schema.$Array<typeof CertificationCaseResult>;
75
+ readonly detail: Schema.optionalKey<Schema.String>;
76
+ }>, {}>;
77
+ /** The Tier-3 (real loss lever) section of a certificate. */
78
+ declare class CertificationTierThreeReport extends CertificationTierThreeReport_base {}
79
+ declare const CertificationReport_base: Schema.Class<CertificationReport, Schema.Struct<{
80
+ readonly format: Schema.Literal<"effect-agent/certification@2">;
81
+ readonly adapter: typeof CertifiedAdapterIdentity;
82
+ readonly generatedAt: Schema.DateTimeUtcFromString;
83
+ readonly tier1: Schema.$Array<typeof CertificationCaseResult>;
84
+ readonly tier2: Schema.$Array<typeof CertificationSweepResult>;
85
+ readonly tier3: typeof CertificationTierThreeReport;
86
+ readonly ok: Schema.Boolean;
87
+ readonly fullyCertified: Schema.Boolean;
88
+ }>, {}>;
89
+ /**
90
+ * The Schema-encoded certification report (plan §1): Tier 1 = the two shared port contract
91
+ * suites verbatim; Tier 2 = the coordinator failpoint convergence sweep; Tier 3 = the real
92
+ * loss lever record. `ok` is true exactly when every EXECUTED check passed — honest scope
93
+ * statements (`not-triggered`, `recorded-evidence`, `not-exercised`, `not-applicable`) never
94
+ * count as failures and never count as silent coverage. `fullyCertified` additionally requires
95
+ * a durable adapter and passing real-loss cases executed in this run. Citations alone do not
96
+ * certify recovery. A non-durable adapter can pass conformance but is never fully certified.
97
+ * The semantic assertions live in the runner tests.
98
+ */
99
+ declare class CertificationReport extends CertificationReport_base {}
100
+ /**
101
+ * Tier 1 — port contract (plan §1): run BOTH shared conformance case arrays verbatim against
102
+ * the provided candidate adapters and fold every case into a typed result. Case failures are
103
+ * captured per-case (never short-circuiting the sweep), so a certificate always reports the
104
+ * complete contract surface. Requires the candidate `SubmissionLedger` and `ThreadStore`
105
+ * plus `Crypto.Crypto`, and must run under a TestClock (the ledger cases drive lease expiry
106
+ * through virtual time).
107
+ */
108
+ declare const certifyPorts: () => Effect.Effect<readonly CertificationCaseResult[], never, Crypto.Crypto | SubmissionLedger | ThreadStore>;
109
+ //#endregion
110
+ export { CertificationCaseResult, CertificationReport, CertificationScenario, CertificationSuite, CertificationSweepResult, CertificationSweepStatus, CertificationTierThreeReport, CertificationTierThreeStatus, CertifiedAdapterIdentity, certifyPorts };
111
+ //# sourceMappingURL=Certification.d.mts.map
@@ -0,0 +1,159 @@
1
+ import { LedgerCapabilities } from "./SubmissionLedger.mjs";
2
+ import { DurableRuntimeFailpointLocation } from "./DurableFailpoint.mjs";
3
+ import { n as safeUnknownString, t as inspectForeignDiagnostic } from "../foreign-diagnostic-DBQ1XHKh.mjs";
4
+ import { submissionLedgerConformanceCases } from "./SubmissionLedgerConformance.mjs";
5
+ import { threadStoreConformanceCases } from "./ThreadStoreConformance.mjs";
6
+ import { Cause, Effect, Exit, Option, Schema } from "effect";
7
+ //#region src/durable/Certification.ts
8
+ const BoundedCertificationDetail = Schema.String.check(Schema.isMaxLength(4096));
9
+ /**
10
+ * Adapter self-description carried by a certificate. `durability` is read from the candidate
11
+ * ledger's `capabilities` — the adapter's honest claim (persistence.md), never inferred by the
12
+ * certification runner.
13
+ */
14
+ var CertifiedAdapterIdentity = class extends Schema.Class("@effect-agent/thread/CertifiedAdapterIdentity")({
15
+ /** Workspace/package name of the adapter pair under certification. */
16
+ name: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
17
+ version: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(256))),
18
+ durability: LedgerCapabilities.fields.durability
19
+ }) {};
20
+ /** Which shared suite one Tier-1 (or lever-driven Tier-3) case belongs to. */
21
+ const CertificationSuite = Schema.Literals([
22
+ "submission-ledger",
23
+ "thread-store",
24
+ "real-loss"
25
+ ]);
26
+ /** One executed certification case: a conformance contract case or a Tier-3 lever row. */
27
+ var CertificationCaseResult = class extends Schema.Class("@effect-agent/thread/CertificationCaseResult")({
28
+ suite: CertificationSuite,
29
+ name: Schema.NonEmptyString.check(Schema.isMaxLength(512)),
30
+ status: Schema.Literals(["passed", "failed"]),
31
+ detail: Schema.optionalKey(BoundedCertificationDetail)
32
+ }) {};
33
+ /**
34
+ * The six Tier-2 scenario shapes: each reached coordinator fault boundary is armed once
35
+ * per shape. Locations outside a shape's path share its verified clean run.
36
+ */
37
+ const CertificationScenario = Schema.Literals([
38
+ "plain",
39
+ "uncertain-tool",
40
+ "durable-steps",
41
+ "approval",
42
+ "join",
43
+ "delegation"
44
+ ]);
45
+ /**
46
+ * Outcome of one Tier-2 sweep cell:
47
+ *
48
+ * - `converged` — the armed fault fired once, recovery classified the state, and the re-drive
49
+ * converged to verified invariants;
50
+ * - `not-triggered` — the location was not reached with that fault armed, or was absent from
51
+ * the scenario's verified clean path (shared across such locations). Never fault coverage;
52
+ * - `failed` — anything else.
53
+ */
54
+ const CertificationSweepStatus = Schema.Literals([
55
+ "converged",
56
+ "not-triggered",
57
+ "failed"
58
+ ]);
59
+ /** One Tier-2 scenario/location result, including locations outside the verified path. */
60
+ var CertificationSweepResult = class extends Schema.Class("@effect-agent/thread/CertificationSweepResult")({
61
+ scenario: CertificationScenario,
62
+ location: DurableRuntimeFailpointLocation,
63
+ /** The armed fault actually fired (one-shot) somewhere in the cell's drive or re-drive. */
64
+ failpointFired: Schema.Boolean,
65
+ status: CertificationSweepStatus,
66
+ /**
67
+ * Every lane's digest chain recomputed from `EMPTY_TAIL_DIGEST` and matched the exported
68
+ * tail — fully discharged here because the runner captures per-batch producer identity at
69
+ * append time (the port-only admin `verify` reports this check `skipped` instead).
70
+ * Unreached locations may share the scenario's clean-run verification.
71
+ */
72
+ digestChainVerified: Schema.Boolean,
73
+ detail: Schema.optionalKey(BoundedCertificationDetail)
74
+ }) {};
75
+ /**
76
+ * How the real-loss tier was discharged. Tier 3 is never silently claimed: an adapter either
77
+ * exercised a real loss lever in this run (`exercised`), cites committed real-loss evidence
78
+ * (`recorded-evidence`), honestly records that nothing exercised it (`not-exercised`), or is a
79
+ * non-durable reference adapter with no real loss to exercise (`not-applicable`).
80
+ */
81
+ const CertificationTierThreeStatus = Schema.Literals([
82
+ "exercised",
83
+ "recorded-evidence",
84
+ "not-exercised",
85
+ "not-applicable"
86
+ ]);
87
+ /** The Tier-3 (real loss lever) section of a certificate. */
88
+ var CertificationTierThreeReport = class extends Schema.Class("@effect-agent/thread/CertificationTierThreeReport")({
89
+ status: CertificationTierThreeStatus,
90
+ /** Cited real-loss suites. The runner does not execute or verify these references. */
91
+ evidence: Schema.Array(BoundedCertificationDetail),
92
+ /** Rows executed by a supplied crash lever in THIS run (`suite: "real-loss"`). */
93
+ cases: Schema.Array(CertificationCaseResult),
94
+ detail: Schema.optionalKey(BoundedCertificationDetail)
95
+ }) {};
96
+ /**
97
+ * The Schema-encoded certification report (plan §1): Tier 1 = the two shared port contract
98
+ * suites verbatim; Tier 2 = the coordinator failpoint convergence sweep; Tier 3 = the real
99
+ * loss lever record. `ok` is true exactly when every EXECUTED check passed — honest scope
100
+ * statements (`not-triggered`, `recorded-evidence`, `not-exercised`, `not-applicable`) never
101
+ * count as failures and never count as silent coverage. `fullyCertified` additionally requires
102
+ * a durable adapter and passing real-loss cases executed in this run. Citations alone do not
103
+ * certify recovery. A non-durable adapter can pass conformance but is never fully certified.
104
+ * The semantic assertions live in the runner tests.
105
+ */
106
+ var CertificationReport = class extends Schema.Class("@effect-agent/thread/CertificationReport")({
107
+ format: Schema.Literal("effect-agent/certification@2"),
108
+ adapter: CertifiedAdapterIdentity,
109
+ generatedAt: Schema.DateTimeUtcFromString,
110
+ tier1: Schema.Array(CertificationCaseResult),
111
+ tier2: Schema.Array(CertificationSweepResult),
112
+ tier3: CertificationTierThreeReport,
113
+ ok: Schema.Boolean,
114
+ fullyCertified: Schema.Boolean
115
+ }) {};
116
+ /** Bounded operator-readable rendering of one failure Cause for a certification detail. */
117
+ const causeDetail = (cause) => {
118
+ const failure = Cause.findErrorOption(cause);
119
+ if (Option.isSome(failure)) {
120
+ const diagnostic = inspectForeignDiagnostic(failure.value);
121
+ if (diagnostic.tag !== void 0 || diagnostic.message !== void 0) return `${diagnostic.tag ?? "Error"}${diagnostic.message === void 0 ? "" : `: ${diagnostic.message}`}`.slice(0, 4096);
122
+ return safeUnknownString(failure.value, "Unknown foreign failure").slice(0, 4096);
123
+ }
124
+ return `defect: ${safeUnknownString(cause, "Unknown defect")}`.slice(0, 4096);
125
+ };
126
+ const caseResult = (suite, name, exit) => Exit.isSuccess(exit) ? CertificationCaseResult.make({
127
+ suite,
128
+ name,
129
+ status: "passed"
130
+ }) : CertificationCaseResult.make({
131
+ suite,
132
+ name,
133
+ status: "failed",
134
+ detail: causeDetail(exit.cause)
135
+ });
136
+ /**
137
+ * Tier 1 — port contract (plan §1): run BOTH shared conformance case arrays verbatim against
138
+ * the provided candidate adapters and fold every case into a typed result. Case failures are
139
+ * captured per-case (never short-circuiting the sweep), so a certificate always reports the
140
+ * complete contract surface. Requires the candidate `SubmissionLedger` and `ThreadStore`
141
+ * plus `Crypto.Crypto`, and must run under a TestClock (the ledger cases drive lease expiry
142
+ * through virtual time).
143
+ */
144
+ const certifyPorts = Effect.fn("Thread.certifyPorts")(function* () {
145
+ const results = [];
146
+ for (const contractCase of submissionLedgerConformanceCases) {
147
+ const exit = yield* Effect.exit(contractCase.run);
148
+ results.push(caseResult("submission-ledger", contractCase.name, exit));
149
+ }
150
+ for (const contractCase of threadStoreConformanceCases) {
151
+ const exit = yield* Effect.exit(contractCase.run);
152
+ results.push(caseResult("thread-store", contractCase.name, exit));
153
+ }
154
+ return results;
155
+ });
156
+ //#endregion
157
+ export { CertificationCaseResult, CertificationReport, CertificationScenario, CertificationSuite, CertificationSweepResult, CertificationSweepStatus, CertificationTierThreeReport, CertificationTierThreeStatus, CertifiedAdapterIdentity, certifyPorts };
158
+
159
+ //# sourceMappingURL=Certification.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Certification.mjs","names":[],"sources":["../../src/durable/Certification.ts"],"sourcesContent":["import type { Crypto } from \"effect\";\nimport { Cause, Effect, Exit, Option, Schema } from \"effect\";\n\nimport { DurableRuntimeFailpointLocation } from \"./DurableFailpoint.ts\";\nimport { inspectForeignDiagnostic, safeUnknownString } from \"./internal/foreign-diagnostic.ts\";\nimport type { SubmissionLedger } from \"./SubmissionLedger.ts\";\nimport { LedgerCapabilities } from \"./SubmissionLedger.ts\";\nimport { submissionLedgerConformanceCases } from \"./SubmissionLedgerConformance.ts\";\nimport type { ThreadStore } from \"./ThreadStore.ts\";\nimport { threadStoreConformanceCases } from \"./ThreadStoreConformance.ts\";\n\n// ---------------------------------------------------------------------------\n// Certification report vocabulary (WP2, plan §1)\n// ---------------------------------------------------------------------------\n\nconst BoundedCertificationDetail = Schema.String.check(Schema.isMaxLength(4_096));\n\n/**\n * Adapter self-description carried by a certificate. `durability` is read from the candidate\n * ledger's `capabilities` — the adapter's honest claim (persistence.md), never inferred by the\n * certification runner.\n */\nexport class CertifiedAdapterIdentity extends Schema.Class<CertifiedAdapterIdentity>(\n \"@effect-agent/thread/CertifiedAdapterIdentity\",\n)({\n /** Workspace/package name of the adapter pair under certification. */\n name: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n version: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(256))),\n durability: LedgerCapabilities.fields.durability,\n}) {}\n\n/** Which shared suite one Tier-1 (or lever-driven Tier-3) case belongs to. */\nexport const CertificationSuite = Schema.Literals([\n \"submission-ledger\",\n \"thread-store\",\n \"real-loss\",\n]);\n\nexport type CertificationSuite = typeof CertificationSuite.Type;\n\n/** One executed certification case: a conformance contract case or a Tier-3 lever row. */\nexport class CertificationCaseResult extends Schema.Class<CertificationCaseResult>(\n \"@effect-agent/thread/CertificationCaseResult\",\n)({\n suite: CertificationSuite,\n name: Schema.NonEmptyString.check(Schema.isMaxLength(512)),\n status: Schema.Literals([\"passed\", \"failed\"]),\n detail: Schema.optionalKey(BoundedCertificationDetail),\n}) {}\n\n/**\n * The six Tier-2 scenario shapes: each reached coordinator fault boundary is armed once\n * per shape. Locations outside a shape's path share its verified clean run.\n */\nexport const CertificationScenario = Schema.Literals([\n \"plain\",\n \"uncertain-tool\",\n \"durable-steps\",\n \"approval\",\n \"join\",\n \"delegation\",\n]);\n\nexport type CertificationScenario = typeof CertificationScenario.Type;\n\n/**\n * Outcome of one Tier-2 sweep cell:\n *\n * - `converged` — the armed fault fired once, recovery classified the state, and the re-drive\n * converged to verified invariants;\n * - `not-triggered` — the location was not reached with that fault armed, or was absent from\n * the scenario's verified clean path (shared across such locations). Never fault coverage;\n * - `failed` — anything else.\n */\nexport const CertificationSweepStatus = Schema.Literals([\"converged\", \"not-triggered\", \"failed\"]);\nexport type CertificationSweepStatus = typeof CertificationSweepStatus.Type;\n\n/** One Tier-2 scenario/location result, including locations outside the verified path. */\nexport class CertificationSweepResult extends Schema.Class<CertificationSweepResult>(\n \"@effect-agent/thread/CertificationSweepResult\",\n)({\n scenario: CertificationScenario,\n location: DurableRuntimeFailpointLocation,\n /** The armed fault actually fired (one-shot) somewhere in the cell's drive or re-drive. */\n failpointFired: Schema.Boolean,\n status: CertificationSweepStatus,\n /**\n * Every lane's digest chain recomputed from `EMPTY_TAIL_DIGEST` and matched the exported\n * tail — fully discharged here because the runner captures per-batch producer identity at\n * append time (the port-only admin `verify` reports this check `skipped` instead).\n * Unreached locations may share the scenario's clean-run verification.\n */\n digestChainVerified: Schema.Boolean,\n detail: Schema.optionalKey(BoundedCertificationDetail),\n}) {}\n\n/**\n * How the real-loss tier was discharged. Tier 3 is never silently claimed: an adapter either\n * exercised a real loss lever in this run (`exercised`), cites committed real-loss evidence\n * (`recorded-evidence`), honestly records that nothing exercised it (`not-exercised`), or is a\n * non-durable reference adapter with no real loss to exercise (`not-applicable`).\n */\nexport const CertificationTierThreeStatus = Schema.Literals([\n \"exercised\",\n \"recorded-evidence\",\n \"not-exercised\",\n \"not-applicable\",\n]);\n\nexport type CertificationTierThreeStatus = typeof CertificationTierThreeStatus.Type;\n\n/** The Tier-3 (real loss lever) section of a certificate. */\nexport class CertificationTierThreeReport extends Schema.Class<CertificationTierThreeReport>(\n \"@effect-agent/thread/CertificationTierThreeReport\",\n)({\n status: CertificationTierThreeStatus,\n /** Cited real-loss suites. The runner does not execute or verify these references. */\n evidence: Schema.Array(BoundedCertificationDetail),\n /** Rows executed by a supplied crash lever in THIS run (`suite: \"real-loss\"`). */\n cases: Schema.Array(CertificationCaseResult),\n detail: Schema.optionalKey(BoundedCertificationDetail),\n}) {}\n\n/**\n * The Schema-encoded certification report (plan §1): Tier 1 = the two shared port contract\n * suites verbatim; Tier 2 = the coordinator failpoint convergence sweep; Tier 3 = the real\n * loss lever record. `ok` is true exactly when every EXECUTED check passed — honest scope\n * statements (`not-triggered`, `recorded-evidence`, `not-exercised`, `not-applicable`) never\n * count as failures and never count as silent coverage. `fullyCertified` additionally requires\n * a durable adapter and passing real-loss cases executed in this run. Citations alone do not\n * certify recovery. A non-durable adapter can pass conformance but is never fully certified.\n * The semantic assertions live in the runner tests.\n */\nexport class CertificationReport extends Schema.Class<CertificationReport>(\n \"@effect-agent/thread/CertificationReport\",\n)({\n format: Schema.Literal(\"effect-agent/certification@2\"),\n adapter: CertifiedAdapterIdentity,\n generatedAt: Schema.DateTimeUtcFromString,\n tier1: Schema.Array(CertificationCaseResult),\n tier2: Schema.Array(CertificationSweepResult),\n tier3: CertificationTierThreeReport,\n ok: Schema.Boolean,\n fullyCertified: Schema.Boolean,\n}) {}\n\n/** Bounded operator-readable rendering of one failure Cause for a certification detail. */\nconst causeDetail = (cause: Cause.Cause<unknown>): string => {\n const failure = Cause.findErrorOption(cause);\n\n if (Option.isSome(failure)) {\n const diagnostic = inspectForeignDiagnostic(failure.value);\n\n if (diagnostic.tag !== undefined || diagnostic.message !== undefined) {\n const tag = diagnostic.tag ?? \"Error\";\n\n return `${tag}${diagnostic.message === undefined ? \"\" : `: ${diagnostic.message}`}`.slice(\n 0,\n 4_096,\n );\n }\n\n return safeUnknownString(failure.value, \"Unknown foreign failure\").slice(0, 4_096);\n }\n\n return `defect: ${safeUnknownString(cause, \"Unknown defect\")}`.slice(0, 4_096);\n};\n\nconst caseResult = <A, E>(\n suite: CertificationSuite,\n name: string,\n exit: Exit.Exit<A, E>,\n): CertificationCaseResult =>\n Exit.isSuccess(exit)\n ? CertificationCaseResult.make({ suite, name, status: \"passed\" })\n : CertificationCaseResult.make({\n suite,\n name,\n status: \"failed\",\n detail: causeDetail(exit.cause),\n });\n\n/**\n * Tier 1 — port contract (plan §1): run BOTH shared conformance case arrays verbatim against\n * the provided candidate adapters and fold every case into a typed result. Case failures are\n * captured per-case (never short-circuiting the sweep), so a certificate always reports the\n * complete contract surface. Requires the candidate `SubmissionLedger` and `ThreadStore`\n * plus `Crypto.Crypto`, and must run under a TestClock (the ledger cases drive lease expiry\n * through virtual time).\n */\nexport const certifyPorts = Effect.fn(\"Thread.certifyPorts\")(function* (): Effect.fn.Return<\n ReadonlyArray<CertificationCaseResult>,\n never,\n SubmissionLedger | ThreadStore | Crypto.Crypto\n> {\n const results: Array<CertificationCaseResult> = [];\n\n for (const contractCase of submissionLedgerConformanceCases) {\n const exit = yield* Effect.exit(contractCase.run);\n\n results.push(caseResult(\"submission-ledger\", contractCase.name, exit));\n }\n for (const contractCase of threadStoreConformanceCases) {\n const exit = yield* Effect.exit(contractCase.run);\n\n results.push(caseResult(\"thread-store\", contractCase.name, exit));\n }\n\n return results;\n});\n"],"mappings":"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"}
@@ -0,0 +1,62 @@
1
+ import { O as PersistedJson, Qt as ThreadNotMaterialized, Vr as DigestError, l as CanonicalRecordEnvelope, nn as ThreadStore, rn as ThreadStoreError } from "../Records-BAGkekt8.mjs";
2
+ import { ActivityProcessorKey, ActivityProcessorStore, ActivityStoreFailure, PreparedActivity } from "./ActivityStore.mjs";
3
+ import { Crypto, Effect, Schema, Scope } from "effect";
4
+ declare namespace CommittedActivity_d_exports {
5
+ export { ActivityPassLimits, ActivityPassResult, ActivityProcessingError, CommittedActivityProcessor, activityWorkId, processCommittedActivity };
6
+ }
7
+ declare const ActivityPassLimits_base: Schema.Class<ActivityPassLimits, Schema.Struct<{
8
+ readonly maxRecords: Schema.Int;
9
+ readonly pageSize: Schema.Int;
10
+ readonly timeoutMillis: Schema.Int;
11
+ readonly leaseMillis: Schema.Int;
12
+ }>, {}>;
13
+ declare class ActivityPassLimits extends ActivityPassLimits_base {}
14
+ declare const ActivityProcessingError_base: Schema.Class<ActivityProcessingError, Schema.TaggedStruct<"ActivityProcessingError", {
15
+ readonly reason: Schema.Literals<readonly ["invalid-input", "noncontiguous", "timeout"]>;
16
+ readonly message: Schema.String;
17
+ }>, import("effect/Cause").YieldableError>;
18
+ declare class ActivityProcessingError extends ActivityProcessingError_base {}
19
+ declare const ActivityPassResult_base: Schema.Class<ActivityPassResult, Schema.Struct<{
20
+ readonly key: typeof ActivityProcessorKey;
21
+ readonly capturedTail: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
22
+ readonly throughSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
23
+ readonly processed: Schema.Natural;
24
+ readonly pendingRecords: Schema.Natural;
25
+ readonly startedAt: Schema.Finite;
26
+ readonly finishedAt: Schema.Finite;
27
+ }>, {}>;
28
+ declare class ActivityPassResult extends ActivityPassResult_base {}
29
+ interface CommittedActivityProcessor<E = never, R = never, EApply = never, RApply = never> {
30
+ readonly key: ActivityProcessorKey;
31
+ /** Unique to this worker lifetime; it is not canonical Thread ownership. */
32
+ readonly owner: string;
33
+ readonly limits: ActivityPassLimits;
34
+ /** Select eligibility and encode an application Schema; null can represent no output. */
35
+ readonly extract: (record: CanonicalRecordEnvelope) => Effect.Effect<PersistedJson, E, R>;
36
+ /**
37
+ * Must durably reconcile workId before returning, using atomic idempotency and conditional
38
+ * writes. This may run again after any lost acknowledgement. A stale invocation can finish
39
+ * only the already pinned output; it must not overwrite a later correction or withdrawal.
40
+ * Retain reconciliation evidence for the lifetime of pending work, including any supported
41
+ * backup/restore window. Returning before durable application would permit skipped output.
42
+ */
43
+ readonly apply: (work: PreparedActivity) => Effect.Effect<void, EApply, RApply>;
44
+ }
45
+ /** Stable work identity independent of worker claims, retry count, extraction, and clocks. */
46
+ declare const activityWorkId: (key: ActivityProcessorKey, sequence: number & import("effect/Brand").Brand<"@effect-agent/thread/CanonicalSequence">) => Effect.Effect<string & import("effect/Brand").Brand<"@effect-agent/thread/Digest">, DigestError, Crypto.Crypto>;
47
+ /**
48
+ * Process one bounded committed prefix of one application-selected Thread. Nothing runs until
49
+ * invoked, and no daemon, global Thread directory, admission ledger, or engine checkpoint is
50
+ * involved. PersistentHistory makes a successful Run's batch visible together; durable Runs
51
+ * expose incremental committed records. The application decides what each record means.
52
+ *
53
+ * A durable pending output wins over a new extraction after restart. Apply finishes before
54
+ * progress advances, so separate output stores require durable idempotency. This does not
55
+ * promise exactly-once external side effects. Each callback owns a Scope; the finite pass has
56
+ * a timeout and a longer lease. Claim release has a separate 500ms deadline; failure leaves
57
+ * the bounded lease to expire.
58
+ */
59
+ declare const processCommittedActivity: <E = never, R = never, EApply = never, RApply = never>(processor: CommittedActivityProcessor<E, R, EApply, RApply>) => Effect.Effect<ActivityPassResult, E | EApply | ActivityProcessingError | DigestError | ThreadNotMaterialized | ThreadStoreError | ActivityStoreFailure, ActivityProcessorStore | Crypto.Crypto | ThreadStore | Exclude<R, Scope.Scope> | Exclude<RApply, Scope.Scope>>;
60
+ //#endregion
61
+ export { ActivityPassLimits, ActivityPassResult, ActivityProcessingError, CommittedActivityProcessor, activityWorkId, processCommittedActivity, CommittedActivity_d_exports as t };
62
+ //# sourceMappingURL=CommittedActivity.d.mts.map
@@ -0,0 +1,159 @@
1
+ import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
+ import { CanonicalRecordEnvelope, CanonicalSequence, PersistedJson, RecordEnvelope } from "./Records.mjs";
3
+ import { ActivityClaim, ActivityClaimRequest, ActivityProcessorKey, ActivityProcessorStore, PreparedActivity } from "./ActivityStore.mjs";
4
+ import { digestJson } from "./Digest.mjs";
5
+ import { ThreadRead, ThreadStore, ThreadTail, ThreadTailRequest } from "./ThreadStore.mjs";
6
+ import { Clock, Effect, Schema, Stream } from "effect";
7
+ //#region src/durable/CommittedActivity.ts
8
+ var CommittedActivity_exports = /* @__PURE__ */ __exportAll({
9
+ ActivityPassLimits: () => ActivityPassLimits,
10
+ ActivityPassResult: () => ActivityPassResult,
11
+ ActivityProcessingError: () => ActivityProcessingError,
12
+ activityWorkId: () => activityWorkId,
13
+ processCommittedActivity: () => processCommittedActivity
14
+ });
15
+ var ActivityPassLimits = class extends Schema.Class("@effect-agent/thread/ActivityPassLimits")({
16
+ maxRecords: Schema.Int.check(Schema.isBetween({
17
+ minimum: 1,
18
+ maximum: 4096
19
+ })),
20
+ pageSize: Schema.Int.check(Schema.isBetween({
21
+ minimum: 1,
22
+ maximum: 128
23
+ })),
24
+ timeoutMillis: Schema.Int.check(Schema.isBetween({
25
+ minimum: 1,
26
+ maximum: 3e5
27
+ })),
28
+ leaseMillis: ActivityClaimRequest.fields.leaseMillis
29
+ }) {};
30
+ var ActivityProcessingError = class extends Schema.TaggedError()("ActivityProcessingError", {
31
+ reason: Schema.Literals([
32
+ "invalid-input",
33
+ "noncontiguous",
34
+ "timeout"
35
+ ]),
36
+ message: Schema.String.check(Schema.isMaxLength(1024))
37
+ }) {};
38
+ var ActivityPassResult = class extends Schema.Class("@effect-agent/thread/ActivityPassResult")({
39
+ key: ActivityProcessorKey,
40
+ capturedTail: CanonicalSequence,
41
+ throughSequence: CanonicalSequence,
42
+ processed: Schema.Natural,
43
+ pendingRecords: Schema.Natural,
44
+ startedAt: Schema.Finite,
45
+ finishedAt: Schema.Finite
46
+ }) {};
47
+ const invalid = (message) => ActivityProcessingError.make({
48
+ reason: "invalid-input",
49
+ message
50
+ });
51
+ const contiguous = () => ActivityProcessingError.make({
52
+ reason: "noncontiguous",
53
+ message: "Committed activity does not match its captured Thread prefix or pinned record"
54
+ });
55
+ /** Stable work identity independent of worker claims, retry count, extraction, and clocks. */
56
+ const activityWorkId = Effect.fn("activityWorkId")(function* (key, sequence) {
57
+ return yield* digestJson([
58
+ "effect-agent/activity@1",
59
+ key.processorId,
60
+ key.processorVersion,
61
+ key.threadId,
62
+ sequence
63
+ ]);
64
+ });
65
+ /**
66
+ * Process one bounded committed prefix of one application-selected Thread. Nothing runs until
67
+ * invoked, and no daemon, global Thread directory, admission ledger, or engine checkpoint is
68
+ * involved. PersistentHistory makes a successful Run's batch visible together; durable Runs
69
+ * expose incremental committed records. The application decides what each record means.
70
+ *
71
+ * A durable pending output wins over a new extraction after restart. Apply finishes before
72
+ * progress advances, so separate output stores require durable idempotency. This does not
73
+ * promise exactly-once external side effects. Each callback owns a Scope; the finite pass has
74
+ * a timeout and a longer lease. Claim release has a separate 500ms deadline; failure leaves
75
+ * the bounded lease to expire.
76
+ */
77
+ const processCommittedActivity = Effect.fn("processCommittedActivity")(function* (processor) {
78
+ const key = yield* Schema.decodeEffect(ActivityProcessorKey)(processor.key).pipe(Effect.mapError(() => invalid("Invalid activity processor key")));
79
+ const limits = yield* Schema.decodeEffect(ActivityPassLimits)(processor.limits).pipe(Effect.mapError(() => invalid("Invalid activity pass limits")));
80
+ if (limits.leaseMillis < limits.timeoutMillis + 1e3) return yield* invalid("The activity lease must exceed the pass timeout by at least 1000ms");
81
+ const request = yield* ActivityClaimRequest.makeEffect({
82
+ key,
83
+ owner: processor.owner,
84
+ leaseMillis: limits.leaseMillis
85
+ }).pipe(Effect.mapError(() => invalid("Invalid activity worker identity")));
86
+ const progress = yield* ActivityProcessorStore;
87
+ const threads = yield* ThreadStore;
88
+ return yield* Effect.scoped(Effect.gen(function* () {
89
+ const acquired = yield* Effect.acquireRelease(progress.claim(request).pipe(Effect.interruptible), (claim) => progress.release(claim).pipe(Effect.interruptible, Effect.timeoutOption(500), Effect.ignore));
90
+ let claim = yield* Schema.decodeEffect(ActivityClaim)(acquired).pipe(Effect.mapError(() => invalid("Malformed activity claim")));
91
+ if (!Schema.toEquivalence(ActivityProcessorKey)(claim.key, key) || claim.owner !== request.owner) return yield* invalid("Activity claim identity does not match its request");
92
+ const startedAt = yield* Clock.currentTimeMillis;
93
+ const tail = yield* threads.inspectTail(ThreadTailRequest.make({ threadId: key.threadId })).pipe(Effect.flatMap((value) => Schema.decodeEffect(ThreadTail)(value).pipe(Effect.mapError(contiguous))));
94
+ if (tail.threadId !== key.threadId || tail.tailSequence < claim.throughSequence || claim.pending !== null && tail.tailSequence < claim.pending.sequence) return yield* contiguous();
95
+ const through = Math.min(tail.tailSequence, claim.throughSequence + limits.maxRecords);
96
+ let processed = 0;
97
+ while (claim.throughSequence < through) {
98
+ const limit = Math.min(limits.pageSize, through - claim.throughSequence);
99
+ const page = yield* threads.read(ThreadRead.make({
100
+ threadId: key.threadId,
101
+ afterSequence: claim.throughSequence,
102
+ limit
103
+ })).pipe(Stream.take(limit + 1), Stream.runCollect);
104
+ if (page.length !== limit) return yield* contiguous();
105
+ for (const rawRecord of page) {
106
+ const record = yield* Schema.decodeEffect(Schema.toType(CanonicalRecordEnvelope))(rawRecord).pipe(Effect.mapError(contiguous));
107
+ if (record.threadId !== key.threadId || record.sequence !== claim.throughSequence + 1) return yield* contiguous();
108
+ const workId = yield* activityWorkId(key, record.sequence);
109
+ const encodedRecord = yield* Schema.encodeEffect(RecordEnvelope)(record.record).pipe(Effect.mapError(contiguous));
110
+ const recordDigest = yield* digestJson(encodedRecord);
111
+ let work = claim.pending;
112
+ if (work === null) {
113
+ const output = yield* Effect.scoped(processor.extract(record)).pipe(Effect.flatMap((value) => Schema.decodeEffect(PersistedJson)(value).pipe(Effect.mapError(() => invalid("Malformed activity output")))));
114
+ work = yield* progress.prepare({
115
+ claim,
116
+ work: PreparedActivity.make({
117
+ version: 1,
118
+ key,
119
+ sequence: record.sequence,
120
+ workId,
121
+ recordId: record.record.recordId,
122
+ recordDigest,
123
+ output
124
+ })
125
+ });
126
+ }
127
+ const prepared = yield* Schema.decodeEffect(PreparedActivity)(work).pipe(Effect.mapError(() => invalid("Malformed prepared activity")));
128
+ if (!Schema.toEquivalence(ActivityProcessorKey)(prepared.key, key) || prepared.sequence !== record.sequence || prepared.workId !== workId || prepared.recordId !== record.record.recordId || prepared.recordDigest !== recordDigest) return yield* contiguous();
129
+ yield* Effect.scoped(processor.apply(prepared));
130
+ const next = yield* progress.advance({
131
+ claim,
132
+ workId
133
+ }).pipe(Effect.flatMap((value) => Schema.decodeEffect(ActivityClaim)(value).pipe(Effect.mapError(() => invalid("Malformed activity progress")))));
134
+ if (!Schema.toEquivalence(ActivityProcessorKey)(next.key, key) || next.owner !== claim.owner || next.epoch !== claim.epoch || next.throughSequence !== record.sequence || next.pending !== null) return yield* invalid("Activity progress advanced outside the claimed record");
135
+ claim = next;
136
+ processed += 1;
137
+ }
138
+ }
139
+ return ActivityPassResult.make({
140
+ key,
141
+ capturedTail: tail.tailSequence,
142
+ throughSequence: claim.throughSequence,
143
+ processed,
144
+ pendingRecords: tail.tailSequence - claim.throughSequence,
145
+ startedAt,
146
+ finishedAt: yield* Clock.currentTimeMillis
147
+ });
148
+ })).pipe(Effect.timeoutOrElse({
149
+ duration: limits.timeoutMillis,
150
+ orElse: () => Effect.fail(ActivityProcessingError.make({
151
+ reason: "timeout",
152
+ message: "Activity pass timed out"
153
+ }))
154
+ }));
155
+ });
156
+ //#endregion
157
+ export { ActivityPassLimits, ActivityPassResult, ActivityProcessingError, activityWorkId, processCommittedActivity, CommittedActivity_exports as t };
158
+
159
+ //# sourceMappingURL=CommittedActivity.mjs.map