effect-agent 0.1.0-beta.13 → 0.1.0-beta.131

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 (550) hide show
  1. package/dist/Admin-C34cVKlT.d.mts +3181 -0
  2. package/dist/Agent-1DMSO_Fl.mjs +86 -0
  3. package/dist/Agent-1DMSO_Fl.mjs.map +1 -0
  4. package/dist/Agent-D9cXqfF3.d.mts +252 -0
  5. package/dist/AgentError-Bn1ytXRD.d.mts +117 -0
  6. package/dist/AgentPolicy-BqDoSXO6.d.mts +96 -0
  7. package/dist/AgentRuntime-Cp1hAb-W.mjs +4739 -0
  8. package/dist/AgentRuntime-Cp1hAb-W.mjs.map +1 -0
  9. package/dist/AgentRuntime-DEDvMkAR.d.mts +346 -0
  10. package/dist/AgentUpdates-DMJ-_xow.d.mts +53 -0
  11. package/dist/ContextCompactor-WwSIG_Z2.d.mts +161 -0
  12. package/dist/ContextWindow-DRQ5Mbm2.d.mts +58 -0
  13. package/dist/Digest-U69rDHuO.d.mts +22 -0
  14. package/dist/DurableAgentRuntime-BydyN_n-.mjs +7135 -0
  15. package/dist/DurableAgentRuntime-BydyN_n-.mjs.map +1 -0
  16. package/dist/DurableFailpoint-Cnr3wx1L.d.mts +41 -0
  17. package/dist/DurableStep-Cry_iol4.d.mts +103 -0
  18. package/dist/EventSource-Bac0SxKL.d.mts +51 -0
  19. package/dist/FailureDiagnostic-BElLOoED.mjs +274 -0
  20. package/dist/FailureDiagnostic-BElLOoED.mjs.map +1 -0
  21. package/dist/FailureDiagnostic-CaAkzGHL.d.mts +223 -0
  22. package/dist/Identifiers-CN2s30fF.d.mts +40 -0
  23. package/dist/InMemory.d.mts +24 -0
  24. package/dist/InMemory.mjs +24 -0
  25. package/dist/InMemory.mjs.map +1 -0
  26. package/dist/MemoryNamespace-BbRW5p71.d.mts +36 -0
  27. package/dist/MemoryReference-B8Q3UJoJ.d.mts +79 -0
  28. package/dist/Messaging-Dkg87ebg.d.mts +221 -0
  29. package/dist/Messaging-JYYN3oYS.d.mts +1067 -0
  30. package/dist/MessagingHost-CqzpxbGz.d.mts +74 -0
  31. package/dist/MessagingHost-DfsbMPvq.mjs +110 -0
  32. package/dist/MessagingHost-DfsbMPvq.mjs.map +1 -0
  33. package/dist/OperationAuthorizer-TzcQtpX5.d.mts +61 -0
  34. package/dist/Output-V-6YL1_Z.d.mts +25 -0
  35. package/dist/PageCapture-Df8Xwskw.d.mts +583 -0
  36. package/dist/PreparedInputAdmission-DcQGQ0Yp.d.mts +42 -0
  37. package/dist/Receipt-BAHyigAF.d.mts +33 -0
  38. package/dist/Records-B5GFWCpn.d.mts +1104 -0
  39. package/dist/RunEvent-DIrzkjLr.d.mts +460 -0
  40. package/dist/RunEventSink-D5aVhISG.d.mts +108 -0
  41. package/dist/RunJournal-BXrq0VIK.mjs +931 -0
  42. package/dist/RunJournal-BXrq0VIK.mjs.map +1 -0
  43. package/dist/RunOptions-CSBsSj0X.d.mts +935 -0
  44. package/dist/RunPolicyUsage-ClZxyR46.d.mts +21 -0
  45. package/dist/Sandbox-CEsDWBLq.d.mts +173 -0
  46. package/dist/Schedule-CtYREFnz.d.mts +847 -0
  47. package/dist/Scheduling-DPb2QyAK.mjs +691 -0
  48. package/dist/Scheduling-DPb2QyAK.mjs.map +1 -0
  49. package/dist/Subagent-DJeZDrbD.mjs +1502 -0
  50. package/dist/Subagent-DJeZDrbD.mjs.map +1 -0
  51. package/dist/Subagent-DRFyQxdb.d.mts +1652 -0
  52. package/dist/SubagentContract-DdT7Cqe6.d.mts +116 -0
  53. package/dist/SubagentHost-DQjHFGqH.d.mts +172 -0
  54. package/dist/Subscription-Bk2Smmqc.d.mts +979 -0
  55. package/dist/SubscriptionInput-ekbJz3pF.d.mts +41 -0
  56. package/dist/Thread-DOBQ0QUY.d.mts +96 -0
  57. package/dist/ThreadHistory-tS1KwxHR.d.mts +60 -0
  58. package/dist/ToolBroker-DWs4tZra.d.mts +133 -0
  59. package/dist/ToolExposure-9uF_Yo0T.mjs +10 -0
  60. package/dist/ToolExposure-9uF_Yo0T.mjs.map +1 -0
  61. package/dist/ToolExposure-C93U1sPu.mjs +30 -0
  62. package/dist/ToolExposure-C93U1sPu.mjs.map +1 -0
  63. package/dist/ToolExposure-UCN12eCd.d.mts +39 -0
  64. package/dist/ToolExposure-r2eOWk4F.d.mts +46 -0
  65. package/dist/ToolExposure.d.mts +8 -0
  66. package/dist/ToolExposure.mjs +21 -0
  67. package/dist/ToolExposure.mjs.map +1 -0
  68. package/dist/ToolReconciler-BmVRAHKs.d.mts +80 -0
  69. package/dist/ToolResult-BKdqWRff.d.mts +78 -0
  70. package/dist/Usage-Dx0aknfk.d.mts +121 -0
  71. package/dist/WakeScheduler-EjUF-GhC.d.mts +56 -0
  72. package/dist/Worker-CfwzMZEK.mjs +271 -0
  73. package/dist/Worker-CfwzMZEK.mjs.map +1 -0
  74. package/dist/Worker-fwWkBg12.d.mts +472 -0
  75. package/dist/agent-registration-CKNsrpwo.mjs +201 -0
  76. package/dist/agent-registration-CKNsrpwo.mjs.map +1 -0
  77. package/dist/capabilities/Approval.d.mts +114 -0
  78. package/dist/capabilities/Approval.mjs +226 -0
  79. package/dist/capabilities/Approval.mjs.map +1 -0
  80. package/dist/capabilities/Budget.d.mts +112 -0
  81. package/dist/capabilities/Budget.mjs +346 -0
  82. package/dist/capabilities/Budget.mjs.map +1 -0
  83. package/dist/capabilities/CodeMode.d.mts +157 -0
  84. package/dist/capabilities/CodeMode.mjs +523 -0
  85. package/dist/capabilities/CodeMode.mjs.map +1 -0
  86. package/dist/capabilities/Commands.d.mts +55 -0
  87. package/dist/capabilities/Commands.mjs +57 -0
  88. package/dist/capabilities/Commands.mjs.map +1 -0
  89. package/dist/capabilities/ContextTools.d.mts +321 -0
  90. package/dist/capabilities/ContextTools.mjs +126 -0
  91. package/dist/capabilities/ContextTools.mjs.map +1 -0
  92. package/dist/capabilities/Mcp.d.mts +108 -0
  93. package/dist/capabilities/Mcp.mjs +259 -0
  94. package/dist/capabilities/Mcp.mjs.map +1 -0
  95. package/dist/capabilities/McpClient.d.mts +115 -0
  96. package/dist/capabilities/McpClient.mjs +506 -0
  97. package/dist/capabilities/McpClient.mjs.map +1 -0
  98. package/dist/capabilities/MemoryNotes.d.mts +424 -0
  99. package/dist/capabilities/MemoryNotes.mjs +128 -0
  100. package/dist/capabilities/MemoryNotes.mjs.map +1 -0
  101. package/dist/capabilities/Messaging.d.mts +3 -0
  102. package/dist/capabilities/Messaging.mjs +152 -0
  103. package/dist/capabilities/Messaging.mjs.map +1 -0
  104. package/dist/capabilities/ModelContext.d.mts +89 -0
  105. package/dist/capabilities/ModelContext.mjs +168 -0
  106. package/dist/capabilities/ModelContext.mjs.map +1 -0
  107. package/dist/capabilities/Redaction.d.mts +37 -0
  108. package/dist/capabilities/Redaction.mjs +104 -0
  109. package/dist/capabilities/Redaction.mjs.map +1 -0
  110. package/dist/capabilities/Remembering.d.mts +434 -0
  111. package/dist/capabilities/Remembering.mjs +290 -0
  112. package/dist/capabilities/Remembering.mjs.map +1 -0
  113. package/dist/capabilities/RunHooks.d.mts +82 -0
  114. package/dist/capabilities/RunHooks.mjs +144 -0
  115. package/dist/capabilities/RunHooks.mjs.map +1 -0
  116. package/dist/capabilities/SemanticMemory.d.mts +431 -0
  117. package/dist/capabilities/SemanticMemory.mjs +315 -0
  118. package/dist/capabilities/SemanticMemory.mjs.map +1 -0
  119. package/dist/capabilities/Subagent.d.mts +4 -0
  120. package/dist/capabilities/Subagent.mjs +5 -0
  121. package/dist/capabilities/SubagentReservations.d.mts +186 -0
  122. package/dist/capabilities/SubagentReservations.mjs +479 -0
  123. package/dist/capabilities/SubagentReservations.mjs.map +1 -0
  124. package/dist/capabilities/ToolDiscovery.d.mts +124 -0
  125. package/dist/capabilities/ToolDiscovery.mjs +230 -0
  126. package/dist/capabilities/ToolDiscovery.mjs.map +1 -0
  127. package/dist/capabilities/WebCapture.d.mts +163 -0
  128. package/dist/capabilities/WebCapture.mjs +335 -0
  129. package/dist/capabilities/WebCapture.mjs.map +1 -0
  130. package/dist/capabilities/WebSearch.d.mts +71 -0
  131. package/dist/capabilities/WebSearch.mjs +115 -0
  132. package/dist/capabilities/WebSearch.mjs.map +1 -0
  133. package/dist/compaction-C2OTceKw.mjs +505 -0
  134. package/dist/compaction-C2OTceKw.mjs.map +1 -0
  135. package/dist/core/Agent.d.mts +2 -0
  136. package/dist/core/Agent.mjs +2 -0
  137. package/dist/core/AgentError.d.mts +2 -0
  138. package/dist/core/AgentError.mjs +134 -0
  139. package/dist/core/AgentError.mjs.map +1 -0
  140. package/dist/core/AgentPolicy.d.mts +2 -0
  141. package/dist/core/AgentPolicy.mjs +94 -0
  142. package/dist/core/AgentPolicy.mjs.map +1 -0
  143. package/dist/core/AgentUpdates.d.mts +2 -0
  144. package/dist/core/AgentUpdates.mjs +63 -0
  145. package/dist/core/AgentUpdates.mjs.map +1 -0
  146. package/dist/core/FailureDiagnostic.d.mts +2 -0
  147. package/dist/core/FailureDiagnostic.mjs +2 -0
  148. package/dist/core/IdGenerator.d.mts +26 -0
  149. package/dist/core/IdGenerator.mjs +27 -0
  150. package/dist/core/IdGenerator.mjs.map +1 -0
  151. package/dist/core/Identifiers.d.mts +2 -0
  152. package/dist/core/Identifiers.mjs +43 -0
  153. package/dist/core/Identifiers.mjs.map +1 -0
  154. package/dist/core/Memory.d.mts +57 -0
  155. package/dist/core/Memory.mjs +203 -0
  156. package/dist/core/Memory.mjs.map +1 -0
  157. package/dist/core/MemoryNamespace.d.mts +2 -0
  158. package/dist/core/MemoryNamespace.mjs +116 -0
  159. package/dist/core/MemoryNamespace.mjs.map +1 -0
  160. package/dist/core/MemoryReference.d.mts +2 -0
  161. package/dist/core/MemoryReference.mjs +109 -0
  162. package/dist/core/MemoryReference.mjs.map +1 -0
  163. package/dist/core/MemoryRevalidation.d.mts +65 -0
  164. package/dist/core/MemoryRevalidation.mjs +126 -0
  165. package/dist/core/MemoryRevalidation.mjs.map +1 -0
  166. package/dist/core/MemoryStore.d.mts +186 -0
  167. package/dist/core/MemoryStore.mjs +243 -0
  168. package/dist/core/MemoryStore.mjs.map +1 -0
  169. package/dist/core/Receipt.d.mts +2 -0
  170. package/dist/core/Receipt.mjs +36 -0
  171. package/dist/core/Receipt.mjs.map +1 -0
  172. package/dist/core/RememberingStore.d.mts +1562 -0
  173. package/dist/core/RememberingStore.mjs +190 -0
  174. package/dist/core/RememberingStore.mjs.map +1 -0
  175. package/dist/core/RunEvent.d.mts +2 -0
  176. package/dist/core/RunEvent.mjs +337 -0
  177. package/dist/core/RunEvent.mjs.map +1 -0
  178. package/dist/core/RunPolicyUsage.d.mts +2 -0
  179. package/dist/core/RunPolicyUsage.mjs +21 -0
  180. package/dist/core/RunPolicyUsage.mjs.map +1 -0
  181. package/dist/core/SemanticMemoryIndex.d.mts +826 -0
  182. package/dist/core/SemanticMemoryIndex.mjs +185 -0
  183. package/dist/core/SemanticMemoryIndex.mjs.map +1 -0
  184. package/dist/core/SemanticMemoryRevalidation.d.mts +45 -0
  185. package/dist/core/SemanticMemoryRevalidation.mjs +191 -0
  186. package/dist/core/SemanticMemoryRevalidation.mjs.map +1 -0
  187. package/dist/core/SubagentContract.d.mts +2 -0
  188. package/dist/core/SubagentContract.mjs +148 -0
  189. package/dist/core/SubagentContract.mjs.map +1 -0
  190. package/dist/core/Thread.d.mts +2 -0
  191. package/dist/core/Thread.mjs +250 -0
  192. package/dist/core/Thread.mjs.map +1 -0
  193. package/dist/core/ToolResult.d.mts +2 -0
  194. package/dist/core/ToolResult.mjs +156 -0
  195. package/dist/core/ToolResult.mjs.map +1 -0
  196. package/dist/core/Usage.d.mts +2 -0
  197. package/dist/core/Usage.mjs +319 -0
  198. package/dist/core/Usage.mjs.map +1 -0
  199. package/dist/core/Worker.d.mts +3 -0
  200. package/dist/core/Worker.mjs +3 -0
  201. package/dist/durable/ActivityStore.d.mts +116 -0
  202. package/dist/durable/ActivityStore.mjs +131 -0
  203. package/dist/durable/ActivityStore.mjs.map +1 -0
  204. package/dist/durable/Admin.d.mts +2 -0
  205. package/dist/durable/Admin.mjs +330 -0
  206. package/dist/durable/Admin.mjs.map +1 -0
  207. package/dist/durable/AgentRegistration.d.mts +2 -0
  208. package/dist/durable/AgentRegistration.mjs +14 -0
  209. package/dist/durable/AgentRegistration.mjs.map +1 -0
  210. package/dist/durable/Certification.d.mts +110 -0
  211. package/dist/durable/Certification.mjs +159 -0
  212. package/dist/durable/Certification.mjs.map +1 -0
  213. package/dist/durable/CommittedActivity.d.mts +64 -0
  214. package/dist/durable/CommittedActivity.mjs +159 -0
  215. package/dist/durable/CommittedActivity.mjs.map +1 -0
  216. package/dist/durable/Digest.d.mts +2 -0
  217. package/dist/durable/Digest.mjs +50 -0
  218. package/dist/durable/Digest.mjs.map +1 -0
  219. package/dist/durable/DurableAgentRuntime.d.mts +3 -0
  220. package/dist/durable/DurableAgentRuntime.mjs +3 -0
  221. package/dist/durable/DurableFailpoint.d.mts +2 -0
  222. package/dist/durable/DurableFailpoint.mjs +102 -0
  223. package/dist/durable/DurableFailpoint.mjs.map +1 -0
  224. package/dist/durable/DurableFailpointTestControl.d.mts +14 -0
  225. package/dist/durable/DurableFailpointTestControl.mjs +19 -0
  226. package/dist/durable/DurableFailpointTestControl.mjs.map +1 -0
  227. package/dist/durable/EventSource.d.mts +2 -0
  228. package/dist/durable/EventSource.mjs +65 -0
  229. package/dist/durable/EventSource.mjs.map +1 -0
  230. package/dist/durable/GitHubWorkflowSource.d.mts +185 -0
  231. package/dist/durable/GitHubWorkflowSource.mjs +209 -0
  232. package/dist/durable/GitHubWorkflowSource.mjs.map +1 -0
  233. package/dist/durable/MessageDelivery.d.mts +934 -0
  234. package/dist/durable/MessageDelivery.mjs +557 -0
  235. package/dist/durable/MessageDelivery.mjs.map +1 -0
  236. package/dist/durable/MessageDeliveryStoreConformance.d.mts +400 -0
  237. package/dist/durable/MessageDeliveryStoreConformance.mjs +270 -0
  238. package/dist/durable/MessageDeliveryStoreConformance.mjs.map +1 -0
  239. package/dist/durable/OperationAuthorizer.d.mts +2 -0
  240. package/dist/durable/OperationAuthorizer.mjs +70 -0
  241. package/dist/durable/OperationAuthorizer.mjs.map +1 -0
  242. package/dist/durable/PersistentHistory.d.mts +16 -0
  243. package/dist/durable/PersistentHistory.mjs +125 -0
  244. package/dist/durable/PersistentHistory.mjs.map +1 -0
  245. package/dist/durable/PreparedInputAdmission.d.mts +2 -0
  246. package/dist/durable/PreparedInputAdmission.mjs +38 -0
  247. package/dist/durable/PreparedInputAdmission.mjs.map +1 -0
  248. package/dist/durable/Records.d.mts +2 -0
  249. package/dist/durable/Records.mjs +858 -0
  250. package/dist/durable/Records.mjs.map +1 -0
  251. package/dist/durable/Recovery.d.mts +2 -0
  252. package/dist/durable/Recovery.mjs +739 -0
  253. package/dist/durable/Recovery.mjs.map +1 -0
  254. package/dist/durable/RunJournal.d.mts +2 -0
  255. package/dist/durable/RunJournal.mjs +2 -0
  256. package/dist/durable/Schedule.d.mts +2 -0
  257. package/dist/durable/Schedule.mjs +391 -0
  258. package/dist/durable/Schedule.mjs.map +1 -0
  259. package/dist/durable/ScheduleStoreConformance.d.mts +17 -0
  260. package/dist/durable/ScheduleStoreConformance.mjs +420 -0
  261. package/dist/durable/ScheduleStoreConformance.mjs.map +1 -0
  262. package/dist/durable/ScheduleTransition.d.mts +24 -0
  263. package/dist/durable/ScheduleTransition.mjs +180 -0
  264. package/dist/durable/ScheduleTransition.mjs.map +1 -0
  265. package/dist/durable/Scheduling.d.mts +55 -0
  266. package/dist/durable/Scheduling.mjs +2 -0
  267. package/dist/durable/SqlMemoryStore.d.mts +29 -0
  268. package/dist/durable/SqlMemoryStore.mjs +436 -0
  269. package/dist/durable/SqlMemoryStore.mjs.map +1 -0
  270. package/dist/durable/SqlMessageDeliveryStore.d.mts +42 -0
  271. package/dist/durable/SqlMessageDeliveryStore.mjs +179 -0
  272. package/dist/durable/SqlMessageDeliveryStore.mjs.map +1 -0
  273. package/dist/durable/SqlStorageV2Upgrade.d.mts +21 -0
  274. package/dist/durable/SqlStorageV2Upgrade.mjs +459 -0
  275. package/dist/durable/SqlStorageV2Upgrade.mjs.map +1 -0
  276. package/dist/durable/SqlSubscriptionStore.d.mts +62 -0
  277. package/dist/durable/SqlSubscriptionStore.mjs +751 -0
  278. package/dist/durable/SqlSubscriptionStore.mjs.map +1 -0
  279. package/dist/durable/SqlThreadNativeReads.d.mts +54 -0
  280. package/dist/durable/SqlThreadNativeReads.mjs +159 -0
  281. package/dist/durable/SqlThreadNativeReads.mjs.map +1 -0
  282. package/dist/durable/SubmissionLedger.d.mts +3 -0
  283. package/dist/durable/SubmissionLedger.mjs +959 -0
  284. package/dist/durable/SubmissionLedger.mjs.map +1 -0
  285. package/dist/durable/SubmissionLedgerConformance.d.mts +30 -0
  286. package/dist/durable/SubmissionLedgerConformance.mjs +2187 -0
  287. package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -0
  288. package/dist/durable/SubmissionStatus.d.mts +2 -0
  289. package/dist/durable/SubmissionStatus.mjs +18 -0
  290. package/dist/durable/SubmissionStatus.mjs.map +1 -0
  291. package/dist/durable/Subscription.d.mts +2 -0
  292. package/dist/durable/Subscription.mjs +360 -0
  293. package/dist/durable/Subscription.mjs.map +1 -0
  294. package/dist/durable/SubscriptionInput.d.mts +2 -0
  295. package/dist/durable/SubscriptionInput.mjs +52 -0
  296. package/dist/durable/SubscriptionInput.mjs.map +1 -0
  297. package/dist/durable/SubscriptionStoreConformance.d.mts +16 -0
  298. package/dist/durable/SubscriptionStoreConformance.mjs +625 -0
  299. package/dist/durable/SubscriptionStoreConformance.mjs.map +1 -0
  300. package/dist/durable/SubscriptionTools.d.mts +274 -0
  301. package/dist/durable/SubscriptionTools.mjs +190 -0
  302. package/dist/durable/SubscriptionTools.mjs.map +1 -0
  303. package/dist/durable/SubscriptionTransition.d.mts +21 -0
  304. package/dist/durable/SubscriptionTransition.mjs +148 -0
  305. package/dist/durable/SubscriptionTransition.mjs.map +1 -0
  306. package/dist/durable/Subscriptions.d.mts +74 -0
  307. package/dist/durable/Subscriptions.mjs +627 -0
  308. package/dist/durable/Subscriptions.mjs.map +1 -0
  309. package/dist/durable/ThreadContextHistory.d.mts +32 -0
  310. package/dist/durable/ThreadContextHistory.mjs +152 -0
  311. package/dist/durable/ThreadContextHistory.mjs.map +1 -0
  312. package/dist/durable/ThreadContextHistoryProjection.d.mts +60 -0
  313. package/dist/durable/ThreadContextHistoryProjection.mjs +149 -0
  314. package/dist/durable/ThreadContextHistoryProjection.mjs.map +1 -0
  315. package/dist/durable/ThreadInvariants.d.mts +77 -0
  316. package/dist/durable/ThreadInvariants.mjs +246 -0
  317. package/dist/durable/ThreadInvariants.mjs.map +1 -0
  318. package/dist/durable/ThreadProjection.d.mts +78 -0
  319. package/dist/durable/ThreadProjection.mjs +158 -0
  320. package/dist/durable/ThreadProjection.mjs.map +1 -0
  321. package/dist/durable/ThreadProjectionMaintenance.d.mts +49 -0
  322. package/dist/durable/ThreadProjectionMaintenance.mjs +33 -0
  323. package/dist/durable/ThreadProjectionMaintenance.mjs.map +1 -0
  324. package/dist/durable/ThreadStore.d.mts +2 -0
  325. package/dist/durable/ThreadStore.mjs +355 -0
  326. package/dist/durable/ThreadStore.mjs.map +1 -0
  327. package/dist/durable/ThreadStoreConformance.d.mts +28 -0
  328. package/dist/durable/ThreadStoreConformance.mjs +512 -0
  329. package/dist/durable/ThreadStoreConformance.mjs.map +1 -0
  330. package/dist/durable/ToolReconciler.d.mts +2 -0
  331. package/dist/durable/ToolReconciler.mjs +85 -0
  332. package/dist/durable/ToolReconciler.mjs.map +1 -0
  333. package/dist/durable/WakeScheduler.d.mts +2 -0
  334. package/dist/durable/WakeScheduler.mjs +85 -0
  335. package/dist/durable/WakeScheduler.mjs.map +1 -0
  336. package/dist/durable/WorkerHost.d.mts +136 -0
  337. package/dist/durable/WorkerHost.mjs +77 -0
  338. package/dist/durable/WorkerHost.mjs.map +1 -0
  339. package/dist/engine/AgentRuntime.d.mts +2 -0
  340. package/dist/engine/AgentRuntime.mjs +2 -0
  341. package/dist/engine/Compaction.d.mts +7 -0
  342. package/dist/engine/Compaction.mjs +16 -0
  343. package/dist/engine/Compaction.mjs.map +1 -0
  344. package/dist/engine/ContextCompactor.d.mts +2 -0
  345. package/dist/engine/ContextCompactor.mjs +119 -0
  346. package/dist/engine/ContextCompactor.mjs.map +1 -0
  347. package/dist/engine/ContextHistory.d.mts +65 -0
  348. package/dist/engine/ContextHistory.mjs +76 -0
  349. package/dist/engine/ContextHistory.mjs.map +1 -0
  350. package/dist/engine/ContextWindow.d.mts +2 -0
  351. package/dist/engine/ContextWindow.mjs +59 -0
  352. package/dist/engine/ContextWindow.mjs.map +1 -0
  353. package/dist/engine/DurableStep.d.mts +2 -0
  354. package/dist/engine/DurableStep.mjs +62 -0
  355. package/dist/engine/DurableStep.mjs.map +1 -0
  356. package/dist/engine/MessagingHost.d.mts +2 -0
  357. package/dist/engine/MessagingHost.mjs +2 -0
  358. package/dist/engine/Output.d.mts +2 -0
  359. package/dist/engine/Output.mjs +8 -0
  360. package/dist/engine/Output.mjs.map +1 -0
  361. package/dist/engine/RunEventSink.d.mts +2 -0
  362. package/dist/engine/RunEventSink.mjs +22 -0
  363. package/dist/engine/RunEventSink.mjs.map +1 -0
  364. package/dist/engine/RunOptions.d.mts +2 -0
  365. package/dist/engine/RunOptions.mjs +124 -0
  366. package/dist/engine/RunOptions.mjs.map +1 -0
  367. package/dist/engine/SubagentHost.d.mts +2 -0
  368. package/dist/engine/SubagentHost.mjs +76 -0
  369. package/dist/engine/SubagentHost.mjs.map +1 -0
  370. package/dist/engine/ThreadHistory.d.mts +2 -0
  371. package/dist/engine/ThreadHistory.mjs +67 -0
  372. package/dist/engine/ThreadHistory.mjs.map +1 -0
  373. package/dist/engine/ToolBroker.d.mts +2 -0
  374. package/dist/engine/ToolBroker.mjs +42 -0
  375. package/dist/engine/ToolBroker.mjs.map +1 -0
  376. package/dist/foreign-diagnostic-DBQ1XHKh.mjs +37 -0
  377. package/dist/foreign-diagnostic-DBQ1XHKh.mjs.map +1 -0
  378. package/dist/index.d.mts +92 -6
  379. package/dist/index.mjs +99 -6
  380. package/dist/output-contract-BC7tjlGw.mjs +84 -0
  381. package/dist/output-contract-BC7tjlGw.mjs.map +1 -0
  382. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  383. package/dist/sandbox/CodeExecutor.d.mts +194 -0
  384. package/dist/sandbox/CodeExecutor.mjs +278 -0
  385. package/dist/sandbox/CodeExecutor.mjs.map +1 -0
  386. package/dist/sandbox/InteractiveBrowser.d.mts +257 -0
  387. package/dist/sandbox/InteractiveBrowser.mjs +236 -0
  388. package/dist/sandbox/InteractiveBrowser.mjs.map +1 -0
  389. package/dist/sandbox/PageCapture.d.mts +2 -0
  390. package/dist/sandbox/PageCapture.mjs +450 -0
  391. package/dist/sandbox/PageCapture.mjs.map +1 -0
  392. package/dist/sandbox/PageCrawl.d.mts +88 -0
  393. package/dist/sandbox/PageCrawl.mjs +124 -0
  394. package/dist/sandbox/PageCrawl.mjs.map +1 -0
  395. package/dist/sandbox/PageScreenshot.d.mts +48 -0
  396. package/dist/sandbox/PageScreenshot.mjs +53 -0
  397. package/dist/sandbox/PageScreenshot.mjs.map +1 -0
  398. package/dist/sandbox/Sandbox.d.mts +2 -0
  399. package/dist/sandbox/Sandbox.mjs +208 -0
  400. package/dist/sandbox/Sandbox.mjs.map +1 -0
  401. package/dist/utf8-BYfhEkcj.mjs +11 -0
  402. package/dist/utf8-BYfhEkcj.mjs.map +1 -0
  403. package/dist/utf8-DchGZRBd.mjs +23 -0
  404. package/dist/utf8-DchGZRBd.mjs.map +1 -0
  405. package/package.json +1 -40
  406. package/src/InMemory.ts +19 -0
  407. package/src/ToolExposure.ts +2 -0
  408. package/src/capabilities/Approval.ts +352 -0
  409. package/src/capabilities/Budget.ts +536 -0
  410. package/src/capabilities/CodeMode.ts +1099 -0
  411. package/src/capabilities/Commands.ts +86 -0
  412. package/src/capabilities/ContextTools.ts +184 -0
  413. package/src/capabilities/Mcp.ts +426 -0
  414. package/src/capabilities/McpClient.ts +967 -0
  415. package/src/capabilities/MemoryNotes.ts +174 -0
  416. package/src/capabilities/Messaging.ts +261 -0
  417. package/src/capabilities/ModelContext.ts +354 -0
  418. package/src/capabilities/Redaction.ts +157 -0
  419. package/src/capabilities/Remembering.ts +550 -0
  420. package/src/capabilities/RunHooks.ts +280 -0
  421. package/src/capabilities/SemanticMemory.ts +447 -0
  422. package/src/capabilities/Subagent.ts +2489 -0
  423. package/src/capabilities/SubagentReservations.ts +850 -0
  424. package/src/capabilities/ToolDiscovery.ts +369 -0
  425. package/src/capabilities/WebCapture.ts +722 -0
  426. package/src/capabilities/WebSearch.ts +190 -0
  427. package/src/capabilities/internal/subagent-background.ts +1307 -0
  428. package/src/capabilities/internal/subagent-contract.ts +146 -0
  429. package/src/capabilities/internal/subagent-policy.ts +235 -0
  430. package/src/capabilities/internal/subagent-reporting.ts +136 -0
  431. package/src/capabilities/internal/utf8.ts +10 -0
  432. package/src/core/Agent.ts +602 -0
  433. package/src/core/AgentError.ts +172 -0
  434. package/src/core/AgentPolicy.ts +153 -0
  435. package/src/core/AgentUpdates.ts +100 -0
  436. package/src/core/FailureDiagnostic.ts +343 -0
  437. package/src/core/IdGenerator.ts +39 -0
  438. package/src/core/Identifiers.ts +48 -0
  439. package/src/core/Memory.ts +290 -0
  440. package/src/core/MemoryNamespace.ts +196 -0
  441. package/src/core/MemoryReference.ts +121 -0
  442. package/src/core/MemoryRevalidation.ts +185 -0
  443. package/src/core/MemoryStore.ts +368 -0
  444. package/src/core/Messaging.ts +72 -0
  445. package/src/core/Receipt.ts +42 -0
  446. package/src/core/RememberingStore.ts +300 -0
  447. package/src/core/RunEvent.ts +366 -0
  448. package/src/core/RunPolicyUsage.ts +17 -0
  449. package/src/core/SemanticMemoryIndex.ts +250 -0
  450. package/src/core/SemanticMemoryRevalidation.ts +254 -0
  451. package/src/core/SubagentContract.ts +196 -0
  452. package/src/core/Thread.ts +371 -0
  453. package/src/core/ToolExposure.ts +74 -0
  454. package/src/core/ToolResult.ts +190 -0
  455. package/src/core/Usage.ts +529 -0
  456. package/src/core/Worker.ts +240 -0
  457. package/src/core/internal/agent-updates.ts +34 -0
  458. package/src/core/internal/message-status.ts +60 -0
  459. package/src/core/internal/strict-schema.ts +14 -0
  460. package/src/core/internal/utf8.ts +23 -0
  461. package/src/durable/ActivityStore.ts +160 -0
  462. package/src/durable/Admin.ts +505 -0
  463. package/src/durable/AgentRegistration.ts +14 -0
  464. package/src/durable/Certification.ts +210 -0
  465. package/src/durable/CommittedActivity.ts +296 -0
  466. package/src/durable/Digest.ts +87 -0
  467. package/src/durable/DurableAgentRuntime.ts +11275 -0
  468. package/src/durable/DurableFailpoint.ts +111 -0
  469. package/src/durable/DurableFailpointTestControl.ts +39 -0
  470. package/src/durable/EventSource.ts +172 -0
  471. package/src/durable/GitHubWorkflowSource.ts +447 -0
  472. package/src/durable/MessageDelivery.ts +832 -0
  473. package/src/durable/MessageDeliveryStoreConformance.ts +410 -0
  474. package/src/durable/OperationAuthorizer.ts +85 -0
  475. package/src/durable/PersistentHistory.ts +260 -0
  476. package/src/durable/PreparedInputAdmission.ts +57 -0
  477. package/src/durable/Records.ts +1087 -0
  478. package/src/durable/Recovery.ts +1018 -0
  479. package/src/durable/RunJournal.ts +1631 -0
  480. package/src/durable/Schedule.ts +513 -0
  481. package/src/durable/ScheduleStoreConformance.ts +638 -0
  482. package/src/durable/ScheduleTransition.ts +265 -0
  483. package/src/durable/Scheduling.ts +1077 -0
  484. package/src/durable/SqlMemoryStore.ts +778 -0
  485. package/src/durable/SqlMessageDeliveryStore.ts +335 -0
  486. package/src/durable/SqlStorageV2Upgrade.ts +500 -0
  487. package/src/durable/SqlSubscriptionStore.ts +1440 -0
  488. package/src/durable/SqlThreadNativeReads.ts +270 -0
  489. package/src/durable/SubmissionLedger.ts +1265 -0
  490. package/src/durable/SubmissionLedgerConformance.ts +4820 -0
  491. package/src/durable/SubmissionStatus.ts +14 -0
  492. package/src/durable/Subscription.ts +544 -0
  493. package/src/durable/SubscriptionInput.ts +144 -0
  494. package/src/durable/SubscriptionStoreConformance.ts +945 -0
  495. package/src/durable/SubscriptionTools.ts +327 -0
  496. package/src/durable/SubscriptionTransition.ts +302 -0
  497. package/src/durable/Subscriptions.ts +1210 -0
  498. package/src/durable/ThreadContextHistory.ts +227 -0
  499. package/src/durable/ThreadContextHistoryProjection.ts +216 -0
  500. package/src/durable/ThreadInvariants.ts +507 -0
  501. package/src/durable/ThreadProjection.ts +269 -0
  502. package/src/durable/ThreadProjectionMaintenance.ts +67 -0
  503. package/src/durable/ThreadStore.ts +573 -0
  504. package/src/durable/ThreadStoreConformance.ts +1184 -0
  505. package/src/durable/ToolReconciler.ts +109 -0
  506. package/src/durable/WakeScheduler.ts +134 -0
  507. package/src/durable/WorkerHost.ts +183 -0
  508. package/src/durable/internal/agent-registration.ts +587 -0
  509. package/src/durable/internal/agent-updates.ts +302 -0
  510. package/src/durable/internal/foreign-diagnostic.ts +47 -0
  511. package/src/durable/internal/journal-checkpoint.ts +104 -0
  512. package/src/durable/internal/journal-metadata.ts +117 -0
  513. package/src/durable/internal/message-status.ts +20 -0
  514. package/src/durable/internal/messaging-host.ts +637 -0
  515. package/src/durable/internal/schedule-time.ts +303 -0
  516. package/src/durable/internal/storage-v2-layout.ts +163 -0
  517. package/src/durable/internal/storage-v2.ts +73 -0
  518. package/src/durable/internal/worker-host.ts +3160 -0
  519. package/src/durable/internal/worker-runtime.ts +9 -0
  520. package/src/engine/AgentRuntime.ts +37 -0
  521. package/src/engine/Compaction.ts +11 -0
  522. package/src/engine/ContextCompactor.ts +277 -0
  523. package/src/engine/ContextHistory.ts +73 -0
  524. package/src/engine/ContextWindow.ts +72 -0
  525. package/src/engine/DurableStep.ts +132 -0
  526. package/src/engine/MessagingHost.ts +110 -0
  527. package/src/engine/Output.ts +2 -0
  528. package/src/engine/RunEventSink.ts +132 -0
  529. package/src/engine/RunOptions.ts +1101 -0
  530. package/src/engine/SubagentHost.ts +239 -0
  531. package/src/engine/ThreadHistory.ts +120 -0
  532. package/src/engine/ToolBroker.ts +157 -0
  533. package/src/engine/ToolExposure.ts +48 -0
  534. package/src/engine/internal/agent-runtime.ts +10500 -0
  535. package/src/engine/internal/bounded-value.ts +315 -0
  536. package/src/engine/internal/compaction.ts +678 -0
  537. package/src/engine/internal/error-diagnostic.ts +39 -0
  538. package/src/engine/internal/output-contract.ts +173 -0
  539. package/src/engine/internal/primitive-delta.ts +80 -0
  540. package/src/engine/internal/provider-result-staging.ts +211 -0
  541. package/src/engine/internal/tool-derivative.ts +106 -0
  542. package/src/engine/internal/tool-exposure.ts +224 -0
  543. package/src/engine/internal/tool-telemetry.ts +484 -0
  544. package/src/index.ts +98 -21
  545. package/src/sandbox/CodeExecutor.ts +352 -0
  546. package/src/sandbox/InteractiveBrowser.ts +339 -0
  547. package/src/sandbox/PageCapture.ts +691 -0
  548. package/src/sandbox/PageCrawl.ts +148 -0
  549. package/src/sandbox/PageScreenshot.ts +81 -0
  550. package/src/sandbox/Sandbox.ts +241 -0
@@ -0,0 +1,3181 @@
1
+ import { c as SettlementId, d as ToolCallId, f as TurnId, l as SubmissionId, s as RunId, t as AgentId, u as ThreadId } from "./Identifiers-CN2s30fF.mjs";
2
+ import { d as SubagentReservationAmounts, l as SubagentGrant, o as SubagentDelegationCaps, s as SubagentExecutionFailure } from "./SubagentContract-DdT7Cqe6.mjs";
3
+ import { a as Receipt, i as QueueSequence, n as JoinedToHost, r as Principal, t as IdempotencyKey } from "./Receipt-BAHyigAF.mjs";
4
+ import { r as Update } from "./AgentUpdates-DMJ-_xow.mjs";
5
+ import { c as Selection, l as Snapshot } from "./ToolExposure-r2eOWk4F.mjs";
6
+ import { l as RunUsageSummary, r as ModelCallUsage } from "./Usage-Dx0aknfk.mjs";
7
+ import { a as ExhaustedLimit } from "./RunEvent-DIrzkjLr.mjs";
8
+ import { t as ThreadHistory } from "./ThreadHistory-tS1KwxHR.mjs";
9
+ import { a as FailureDiagnostic_d_exports, r as Diagnostic } from "./FailureDiagnostic-CaAkzGHL.mjs";
10
+ import { a as AgentInputError } from "./AgentError-Bn1ytXRD.mjs";
11
+ import { t as ToolParameterRejection } from "./ToolResult-BKdqWRff.mjs";
12
+ import { t as AgentPolicy } from "./AgentPolicy-BqDoSXO6.mjs";
13
+ import { E as RunDispositionDeclaration, _ as InstructionSource, c as Definition, m as InputPromptSource, n as Any, r as AnyDefinition, t as Agent_d_exports, y as ModelServices } from "./Agent-D9cXqfF3.mjs";
14
+ import { t as RunPolicyUsage } from "./RunPolicyUsage-ClZxyR46.mjs";
15
+ import { c as WorkerError, f as WorkerRef, n as AssignmentTerminal } from "./Worker-fwWkBg12.mjs";
16
+ import { G as RunToolAuthorization, O as RunCostEstimator, h as RunApprovalHook, x as RunContextPreparation } from "./RunOptions-CSBsSj0X.mjs";
17
+ import { o as MessagingError, r as InputMessage } from "./Messaging-Dkg87ebg.mjs";
18
+ import { t as MessagingHost } from "./MessagingHost-CqzpxbGz.mjs";
19
+ import "./Messaging-JYYN3oYS.mjs";
20
+ import { d as WorkerReportPreparationFailure, f as WorkerReporting, o as SubagentHost } from "./SubagentHost-DQjHFGqH.mjs";
21
+ import { p as RuntimeBinding, r as AgentCompletionProjectionRequirements, s as AgentRuntimeRequirements } from "./AgentRuntime-DEDvMkAR.mjs";
22
+ import { $ as ToolCallPrepared, A as ProducerId, I as RunCompleted, J as SubmissionSettledRecord, M as RecordId, O as PersistedJson, T as ModelResponseRecorded, V as SettlementFailureDiagnostic, a as BatchId, ct as WorkerAdmission, d as CanonicalSequence, dt as WorkerInputRequested, f as CompactionCreated, g as DeploymentId, h as DefinitionDigests, j as RecordEnvelope, l as CanonicalRecordEnvelope, m as DefinitionDigestInput, nt as ToolCallSettled, s as CanonicalBatch } from "./Records-B5GFWCpn.mjs";
23
+ import { t as DigestError } from "./Digest-U69rDHuO.mjs";
24
+ import { n as DurableRuntimeFailpoint, r as DurableRuntimeFailpointError } from "./DurableFailpoint-Cnr3wx1L.mjs";
25
+ import { o as OperationDenied } from "./OperationAuthorizer-TzcQtpX5.mjs";
26
+ import { s as ToolReconciler } from "./ToolReconciler-BmVRAHKs.mjs";
27
+ import { t as WakeScheduler } from "./WakeScheduler-EjUF-GhC.mjs";
28
+ import { Prompt, Tool } from "effect/unstable/ai";
29
+ import { Cause, Context, Crypto, DateTime, Duration, Effect, Layer, Option, Result, Schema, Scope, Stream } from "effect";
30
+ //#region src/durable/internal/agent-registration.d.ts
31
+ declare const BindingUnavailable_base: Schema.Class<BindingUnavailable, Schema.TaggedStruct<"BindingUnavailable", {
32
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
33
+ readonly message: Schema.String;
34
+ }>, import("effect/Cause").YieldableError>;
35
+ /** No unique current executable is registered for the stable Agent identity. */
36
+ declare class BindingUnavailable extends BindingUnavailable_base {}
37
+ type DurableBindingFailure = BindingUnavailable;
38
+ /** Exact immutable admission, lineage and delivery evidence; never an executable-code gate. */
39
+ declare const definitionDigestsEqual: (left: DefinitionDigests, right: DefinitionDigests) => boolean;
40
+ /** Change an operation version when its meaning, durable Steps or idempotency keys change. */
41
+ interface ReplayVersions {
42
+ readonly tools: Readonly<Record<string, PersistedJson>>;
43
+ }
44
+ /** Compile current metadata without acquiring executable services. */
45
+ declare const compileBindingContracts: (definition: Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined>, definitions: DefinitionDigestInput, versions?: ReplayVersions | undefined) => Effect.Effect<Pick<ResolvedBinding, "digests">, DigestError, Crypto.Crypto>;
46
+ type ExecutableDefinition = AnyDefinition & {
47
+ readonly instructions: InstructionSource<never, unknown, unknown>;
48
+ readonly inputPrompt?: InputPromptSource<never, unknown, unknown> | undefined;
49
+ };
50
+ /** Executable model Binding accepted by durable registration descriptors. */
51
+ type ExecutableAgentBinding = {
52
+ readonly definition: ExecutableDefinition;
53
+ readonly model: Layer.Layer<ModelServices, never, unknown>;
54
+ };
55
+ /**
56
+ * Internal coordinator entry point for one fenced Attempt over an already-granted claim.
57
+ * The generic signature matches `runAttempt` and is specialized for each captured Agent.
58
+ */
59
+ type ResolvedAttemptDriver = <InputSchema extends Schema.Top, OutputSchema extends Schema.Top, Instructions, Tools extends Record<string, Tool.Any>, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue extends RunDispositionDeclaration<OutputSchema["Type"], Schema.Top> | undefined, InputPromptValue extends InputPromptSource<InputSchema["Type"], unknown, unknown> | undefined, UpdatesSchema extends Schema.Top | undefined>(agent: RuntimeBinding<InputSchema, OutputSchema, Instructions, Tools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema>, threadId: ThreadId, claim: Claim) => Effect.Effect<Option.Option<Settlement>, DurableWorkerFailure, DurableWorkerRequirements<RuntimeBinding<InputSchema, OutputSchema, Instructions, Tools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema>, InstructionRequirements>>;
60
+ /**
61
+ * An Agent with its worker services captured, ready to drive a fenced Attempt.
62
+ * Concrete Schema and model types stay inside this closure when registrations are collected.
63
+ */
64
+ interface CapturedBinding {
65
+ readonly agentId: AgentId;
66
+ /** Exact immutable definition whose codecs and behavior the worker captured. */
67
+ readonly definition: AnyDefinition;
68
+ /** Captured independently from per-Attempt services: report preparation has no fenced Claim. */
69
+ readonly reporting?: ReadonlyArray<WorkerReporting<WorkerReportPreparationFailure>>;
70
+ readonly attempt: (driver: ResolvedAttemptDriver, threadId: ThreadId, claim: Claim) => Effect.Effect<Option.Option<Settlement>, DurableWorkerFailure>;
71
+ }
72
+ /** One exact executable registration used by durable claim-time resolution. */
73
+ interface ResolvedBinding extends CapturedBinding {
74
+ readonly digests: DefinitionDigests;
75
+ }
76
+ /** Trusted claim identity for resolving per-Attempt application services. Not model input. */
77
+ interface AgentAttemptContext {
78
+ readonly threadId: ThreadId;
79
+ readonly submissionId: Claim["submissionId"];
80
+ readonly attemptId: Claim["attemptId"];
81
+ }
82
+ /**
83
+ * Build one exact worker registration from an executable Agent Binding and
84
+ * its already-computed definition digests.
85
+ *
86
+ * `make(agent, digests)` captures the binding plus its worker-requirement
87
+ * Context at Layer/effect construction time. Hosts that start from application
88
+ * version declarations should use `compileRegistrations`; low-level fixtures
89
+ * may supply a previously computed digest triple directly.
90
+ */
91
+ declare const DurableWorkerBinding: {
92
+ readonly make: <A extends ExecutableAgentBinding>(agent: A, digests: DefinitionDigests) => Effect.Effect<ResolvedBinding, never, DurableWorkerRequirements<A>>;
93
+ };
94
+ /** Application versions and a model Layer, supplied directly or through an existing Binding. */
95
+ type AgentRegistration<A extends ExecutableAgentBinding = ExecutableAgentBinding> = ({
96
+ readonly agent: A;
97
+ readonly model?: never;
98
+ readonly definitions: DefinitionDigestInput;
99
+ } | {
100
+ readonly agent: A["definition"];
101
+ readonly model: A["model"];
102
+ readonly definitions: DefinitionDigestInput;
103
+ }) & {
104
+ /** Explicit operation versions let unchanged unfinished handlers survive toolbox changes. */
105
+ readonly continuity?: {
106
+ readonly versions: ReplayVersions;
107
+ };
108
+ /**
109
+ * Build fresh services for exactly one fenced Attempt, across all its Tool/model turns.
110
+ * Finalizes on completion, suspension, failure and interruption. Never reused after eviction.
111
+ * Resolve invocation authority from the trusted claim identity, not captured caller state.
112
+ * Keep fallible resource acquisition lazy in typed Tool operations; this Layer cannot fail.
113
+ * Provide DurableApprovalSuspension here when resources need retention before approval waits.
114
+ */
115
+ readonly attemptLayer?: (context: AgentAttemptContext) => Layer.Layer<never, never, unknown>;
116
+ };
117
+ type EntryWorkerRequirements<Entry> = Entry extends {
118
+ readonly agent: infer A extends ExecutableAgentBinding;
119
+ } ? DurableWorkerRequirements<A> : Entry extends {
120
+ readonly agent: infer D extends ExecutableDefinition;
121
+ readonly model: infer M extends ExecutableAgentBinding["model"];
122
+ } ? DurableWorkerRequirements<{
123
+ readonly definition: D;
124
+ readonly model: M;
125
+ }> : never;
126
+ type AttemptLayerRequirements<Requirements, AttemptLayer> = AttemptLayer extends ((context: AgentAttemptContext) => Layer.Layer<infer Provides, never, infer Requires>) ? Exclude<Requirements, Provides> | Requires : Requirements;
127
+ type EntryRequirements<Entry> = Entry extends unknown ? AttemptLayerRequirements<EntryWorkerRequirements<Entry>, "attemptLayer" extends keyof Entry ? Entry["attemptLayer"] : undefined> : never;
128
+ type RegistrationRequirements<Entries extends ReadonlyArray<AgentRegistration>> = [Entries[number]] extends [never] ? never : EntryRequirements<Entries[number]>;
129
+ /** Compile heterogeneous Agent descriptors into exact, dependency-closed worker registrations. */
130
+ declare const compileRegistrations: <const Entries extends ReadonlyArray<AgentRegistration>>(entries: Entries) => Effect.Effect<ReadonlyArray<ResolvedBinding>, DigestError, Crypto.Crypto | RegistrationRequirements<Entries>>;
131
+ declare namespace AgentRegistration_d_exports {
132
+ export { AgentAttemptContext, AgentRegistration, BindingUnavailable, DurableBindingFailure, DurableWorkerBinding, ExecutableAgentBinding, ReplayVersions, ResolvedBinding, compileBindingContracts, compileRegistrations, definitionDigestsEqual };
133
+ }
134
+ //#endregion
135
+ //#region src/durable/internal/journal-checkpoint.d.ts
136
+ declare const JournalCheckpointSeed_base: Schema.Class<JournalCheckpointSeed, Schema.Struct<{
137
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
138
+ readonly throughSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
139
+ readonly firstSequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">>;
140
+ readonly toolSelection: Schema.optionalKey<typeof Selection>;
141
+ readonly committedTurns: Schema.Natural;
142
+ readonly policyUsage: Schema.Struct<{
143
+ readonly committedTurns: Schema.Natural;
144
+ readonly toolCalls: Schema.Natural;
145
+ readonly programmaticToolCalls: Schema.Natural;
146
+ readonly consecutiveToolFailures: Schema.Natural;
147
+ readonly finalizationUsed: Schema.Boolean;
148
+ }>;
149
+ readonly modelCalls: Schema.Natural;
150
+ readonly unobservedModelCalls: Schema.Natural;
151
+ readonly inputTokens: Schema.Natural;
152
+ readonly outputTokens: Schema.Natural;
153
+ readonly lastInputTokens: Schema.Natural;
154
+ readonly lastOutputTokens: Schema.Natural;
155
+ readonly costMicrousd: Schema.Natural;
156
+ readonly summarizedModelUsage: typeof RunUsageSummary;
157
+ readonly protectedContext: Schema.optionalKey<Schema.declare<Schema.Json, Schema.Json>>;
158
+ readonly contextWindowId: Schema.optionalKey<Schema.String>;
159
+ readonly frontier: Schema.optionalKey<Schema.Struct<{
160
+ readonly sequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
161
+ readonly tag: Schema.Literals<readonly ["ModelResponseRecorded", "ToolCallSettled"]>;
162
+ }>>;
163
+ /** Canonical replacement whose covered batches were validated before retirement. */
164
+ readonly compaction: typeof CanonicalRecordEnvelope;
165
+ }>, {}>;
166
+ /** Retired accounting is additive; the latest Tool batch always remains replayable verbatim. */
167
+ declare class JournalCheckpointSeed extends JournalCheckpointSeed_base {}
168
+ //#endregion
169
+ //#region src/durable/internal/journal-metadata.d.ts
170
+ /** Metadata for one exact canonical prefix, including the same optional checkpoint seed. */
171
+ interface JournalMetadata {
172
+ readonly ownerRunId: RunId | undefined;
173
+ readonly seed: JournalCheckpointSeed | undefined;
174
+ readonly firstSequenceByRun: ReadonlyMap<string, number>;
175
+ readonly lastResponseSequenceByRun: ReadonlyMap<string, number>;
176
+ readonly terminalSequenceByRun: ReadonlyMap<string, number>;
177
+ readonly settledSpans: ReadonlyArray<{
178
+ readonly from: number;
179
+ readonly to: number;
180
+ }>;
181
+ readonly toolExecutionEvidence: ReadonlySet<string>;
182
+ readonly settledToolCallRecordIds: ReadonlySet<string>;
183
+ readonly settledById: ReadonlyMap<string, Pick<ToolCallSettled, "isFailure" | "budgetRejected" | "toolSelection">>;
184
+ readonly compactions: ReadonlyArray<{
185
+ readonly payload: CompactionCreated;
186
+ readonly sequence: number;
187
+ }>;
188
+ }
189
+ declare namespace RunJournal_d_exports {
190
+ export { JournalBoundary, RunJournalError, RunJournalProjection, RunJournalUsage, TurnCommitInput, agentUpdateRecordId, approvalDecisionBatchId, childIdempotencyKeyFor, childThreadIdFor, compactionBatchId, compactionRecordId, firstWorkerInputRecordId, markUnknownBatchId, modelResponseInterruptedBatchId, modelResponseInterruptedRecordId, modelResponseRecordId, peerMessageRecordId, projectRunJournal, projectRunJournalStream, promptFromCanonicalRecords, runCompletedRecordId, runCompletionDigest, runDurationBatchId, runDurationRecordId, runIdForSubmission, runStartedBatchId, runStartedRecordId, subagentJoinBatchId, subagentJoinedRecordId, subagentLineageBatchId, subagentLineageRecordId, subagentRequestedBatchId, subagentRequestedRecordId, subagentStartedBatchId, subagentStartedRecordId, toolApprovalDecisionRecordId, toolApprovalRequestRecordId, toolCallPreparedRecordId, toolCallResolutionBatchId, toolCallResolvedRecordId, toolCallResultBatchId, toolCallSettledRecordId, toolCallUnknownRecordId, toolStepSettledBatchId, toolStepSettledRecordId, turnApprovalsBatchId, turnBatchId, turnCanonicalBatch, turnIdForRun, turnPreparedBatchId, turnResponseBatch, turnResponseBatchId, turnResultsBatch, turnResultsBatchId, workerInputRecordId, workerOriginRecordId, workerReportRecordId };
191
+ }
192
+ declare const RunJournalError_base: Schema.Class<RunJournalError, Schema.TaggedStruct<"RunJournalError", {
193
+ readonly message: Schema.String;
194
+ readonly cause: Schema.optionalKey<Schema.Defect>;
195
+ }>, import("effect/Cause").YieldableError>;
196
+ /** A canonical record could not be projected into Run/Prompt state. */
197
+ declare class RunJournalError extends RunJournalError_base {}
198
+ /**
199
+ * Deterministic Run identity pinned per Submission (plan §Coordinator flow). Every Attempt of one
200
+ * Submission shares this Run identity, so canonical per-Turn records from different Attempts
201
+ * belong to one logical Run.
202
+ */
203
+ declare const runIdForSubmission: (submissionId: SubmissionId) => RunId;
204
+ /** Stable canonical clock identity shared by every Attempt of one Run. */
205
+ declare const runStartedRecordId: (runId: RunId) => RecordId;
206
+ declare const runStartedBatchId: (runId: RunId) => BatchId;
207
+ declare const runDurationRecordId: (runId: RunId) => RecordId;
208
+ declare const runDurationBatchId: (runId: RunId) => BatchId;
209
+ /** Deterministic Turn identity: Attempt-independent for one (Run, canonical turn) pair. */
210
+ declare const turnIdForRun: (runId: RunId, turn: number) => TurnId;
211
+ /** Deterministic batch identity of one committed canonical no-tool Turn (P4 single-batch shape). */
212
+ declare const turnBatchId: (runId: RunId, turn: number) => BatchId;
213
+ /**
214
+ * Deterministic batch identity of a tool-declaring Turn's RESPONSE commit (plan §2.1 commit 1):
215
+ * the assistant response plus pending steering becomes canonical BEFORE approval preflight and
216
+ * tool preparation, creating the durability §15 "resume tool scheduling" window.
217
+ */
218
+ declare const turnResponseBatchId: (runId: RunId, turn: number) => BatchId;
219
+ /**
220
+ * Deterministic batch identity of a tool-declaring Turn's RESULTS commit (plan §2.1 commit 5):
221
+ * every `ToolCallSettled` record of the Turn, in declaration order, model-visible atomically.
222
+ */
223
+ declare const turnResultsBatchId: (runId: RunId, turn: number) => BatchId;
224
+ /**
225
+ * Deterministic per-call late-settle batch identity used by the resolution path when one
226
+ * recovered/resolved call settles outside its Turn's results batch. Record identity
227
+ * (`tool-settled:{runId}:{turn}:{toolCallId}`) dedupes double-settles across both paths.
228
+ */
229
+ declare const toolCallResultBatchId: (runId: RunId, turn: number, toolCallId: ToolCallId) => BatchId;
230
+ /** Deterministic batch identity of one Turn's `ToolCallPrepared` commit (plan §2.1 commit 3). */
231
+ declare const turnPreparedBatchId: (runId: RunId, turn: number) => BatchId;
232
+ /**
233
+ * Deterministic identity of one pre-Turn compaction record (RUN-026,
234
+ * RUN-026). Keyed by Run, Turn, and kind — the engine performs at most one
235
+ * threshold compaction per Turn plus at most one overflow-forced summarize,
236
+ * so a superseding Attempt that re-decides the same compaction replays the
237
+ * batch identity instead of duplicating the record.
238
+ */
239
+ declare const compactionRecordId: (runId: RunId, turn: number, kind: "clear-tool-results" | "summarize" | "rollover") => RecordId;
240
+ /** Deterministic batch identity of one compaction append (same string as its record id). */
241
+ declare const compactionBatchId: (runId: RunId, turn: number, kind: "clear-tool-results" | "summarize" | "rollover") => BatchId;
242
+ /** Deterministic canonical record identity of one Turn's `ModelResponseRecorded` record. */
243
+ declare const modelResponseRecordId: (runId: RunId, turn: number) => RecordId;
244
+ /** Terminal Tool completion marker committed atomically with its settled Tool result. */
245
+ declare const runCompletedRecordId: (runId: RunId) => RecordId;
246
+ /** Native source reservation locator, including the first admission of a continuing worker. */
247
+ declare const workerInputRecordId: (messageId: IdempotencyKey) => RecordId;
248
+ /** Source-owned first reservation; native worker identity is minted from its first message. */
249
+ declare const firstWorkerInputRecordId: (worker: WorkerRef) => RecordId;
250
+ declare const workerOriginRecordId: (threadId: ThreadId) => RecordId;
251
+ declare const workerReportRecordId: (messageId: IdempotencyKey) => RecordId;
252
+ declare const peerMessageRecordId: (messageId: IdempotencyKey) => RecordId;
253
+ /** Same immutable tuple used by native update admission; callers never parse its hash. */
254
+ declare const agentUpdateRecordId: (threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">, runId: string & import("effect/Brand").Brand<"@effect-agent/core/RunId">, updateId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">) => Effect.Effect<string & import("effect/Brand").Brand<"@effect-agent/thread/RecordId">, DigestError, Crypto.Crypto>;
255
+ /** Deterministic canonical record identity of one Turn's `ToolCallSettled` record. */
256
+ declare const toolCallSettledRecordId: (runId: RunId, turn: number, toolCallId: ToolCallId) => RecordId;
257
+ /** Deterministic canonical record identity of one Tool Call's `ToolCallPrepared` record. */
258
+ declare const toolCallPreparedRecordId: (runId: RunId, turn: number, toolCallId: ToolCallId) => RecordId;
259
+ /** Deterministic batch identity of one Turn's `ToolCallUnknown` marking append. */
260
+ declare const markUnknownBatchId: (submissionId: SubmissionId, turn: number) => BatchId;
261
+ /** Deterministic canonical record identity of one Tool Call's `ToolCallUnknown` record. */
262
+ declare const toolCallUnknownRecordId: (runId: RunId, turn: number, toolCallId: ToolCallId) => RecordId;
263
+ /** Deterministic batch identity of one Tool Call's resolution append (DUR-017). */
264
+ declare const toolCallResolutionBatchId: (submissionId: SubmissionId, toolCallId: ToolCallId) => BatchId;
265
+ /** Deterministic canonical record identity of one Tool Call's `ToolCallResolved` record. */
266
+ declare const toolCallResolvedRecordId: (runId: RunId, turn: number, toolCallId: ToolCallId) => RecordId;
267
+ /**
268
+ * Deterministic identity of one accepted Durable Step result. The one-record batch reuses the
269
+ * SAME string, so batch idempotency plus the epoch fence realize the durability §11
270
+ * racing-writers rule: only the fenced winner's record commits; the loser replays it.
271
+ * A versioned JSON tuple keeps separator characters in each identity component distinct.
272
+ * Replay derives this key from the structured payload, including records with legacy IDs.
273
+ */
274
+ declare const toolStepSettledRecordId: (runId: RunId, toolCallId: ToolCallId, stepName: string) => RecordId;
275
+ /** Deterministic batch identity of one Durable Step commit (same string as its record id). */
276
+ declare const toolStepSettledBatchId: (runId: RunId, toolCallId: ToolCallId, stepName: string) => BatchId;
277
+ /** Deterministic batch identity of one Turn's canonical approval-request append (plan §2.6). */
278
+ declare const turnApprovalsBatchId: (runId: RunId, turn: number) => BatchId;
279
+ /** Deterministic canonical record identity of one Tool Call's `ToolApprovalRequested` record. */
280
+ declare const toolApprovalRequestRecordId: (runId: RunId, turn: number, toolCallId: ToolCallId) => RecordId;
281
+ /** Deterministic batch identity of one Tool Call's canonical approval-decision append. */
282
+ declare const approvalDecisionBatchId: (submissionId: SubmissionId, toolCallId: ToolCallId) => BatchId;
283
+ /** Deterministic canonical record identity of one Tool Call's `ToolApprovalDecided` record. */
284
+ declare const toolApprovalDecisionRecordId: (runId: RunId, turn: number, toolCallId: ToolCallId) => RecordId;
285
+ /**
286
+ * Deterministic identity of one superseded Attempt's `ModelResponseInterrupted` audit record
287
+ * (durability §9). Keyed by the superseded epoch, so each interrupted ownership period is
288
+ * recorded at most once; the one-record batch reuses the same string.
289
+ */
290
+ declare const modelResponseInterruptedRecordId: (runId: RunId, supersededEpoch: number) => RecordId;
291
+ /** Deterministic batch identity of one `ModelResponseInterrupted` append (same string). */
292
+ declare const modelResponseInterruptedBatchId: (runId: RunId, supersededEpoch: number) => BatchId;
293
+ /**
294
+ * Deterministic canonical record identity of one parent Tool Call's `SubagentRequested` record.
295
+ * The one-record batch reuses the same string, so batch
296
+ * idempotency plus the parent epoch fence make the request append exactly-once-canonical.
297
+ */
298
+ declare const subagentRequestedRecordId: (runId: RunId, toolCallId: ToolCallId) => RecordId;
299
+ /** Deterministic batch identity of one `SubagentRequested` append (same string). */
300
+ declare const subagentRequestedBatchId: (runId: RunId, toolCallId: ToolCallId) => BatchId;
301
+ /**
302
+ * Deterministic canonical record identity of one parent Tool Call's `SubagentStarted` record.
303
+ * Recovery's start-link repair appends the EXACT same record
304
+ * under this identity, so a raced repair replays instead of duplicating (SUB-016/SUB-017).
305
+ */
306
+ declare const subagentStartedRecordId: (runId: RunId, toolCallId: ToolCallId) => RecordId;
307
+ /** Deterministic batch identity of one `SubagentStarted` append (same string). */
308
+ declare const subagentStartedBatchId: (runId: RunId, toolCallId: ToolCallId) => BatchId;
309
+ /**
310
+ * Deterministic batch identity of one parent Tool Call's atomic settlement join: the
311
+ * `SubagentJoined` record plus the parent's `ToolCallSettled` record (its existing
312
+ * `tool-settled:{runId}:{turn}:{toolCallId}` identity) commit as ONE canonical batch (SUB-019).
313
+ */
314
+ declare const subagentJoinBatchId: (runId: RunId, toolCallId: ToolCallId) => BatchId;
315
+ /** Deterministic canonical record identity of one parent Tool Call's `SubagentJoined` record. */
316
+ declare const subagentJoinedRecordId: (runId: RunId, toolCallId: ToolCallId) => RecordId;
317
+ /**
318
+ * Deterministic identity of one child Thread's `SubagentLineageRecorded` record.
319
+ * Its own single-record batch reuses the same string so the generic
320
+ * `thread-created:{cid}` batch identity is never contradicted.
321
+ */
322
+ declare const subagentLineageRecordId: (threadId: ThreadId) => RecordId;
323
+ /** Deterministic batch identity of one `SubagentLineageRecorded` append (same string). */
324
+ declare const subagentLineageBatchId: (threadId: ThreadId) => BatchId;
325
+ /**
326
+ * Deterministic intended child Thread identity: the
327
+ * parent Submission and Tool Call pair addresses exactly one child Thread, so a replayed
328
+ * establishment converges on the one existing child (SUB-016).
329
+ */
330
+ declare const childThreadIdFor: (parentSubmissionId: SubmissionId, toolCallId: ToolCallId) => ThreadId;
331
+ /**
332
+ * Deterministic child admission idempotency key: scoped to
333
+ * the parent Run and Tool Call identity, so duplicate admission attempts resolve through the
334
+ * ledger's idempotency contract to one child Receipt (SUB-016, SUB-031). The ledger key is
335
+ * bounded (256); coordinator-minted Run and Tool Call identities stay far below that bound.
336
+ */
337
+ declare const childIdempotencyKeyFor: (parentRunId: RunId, toolCallId: ToolCallId) => IdempotencyKey;
338
+ /**
339
+ * Pure canonical projection of one Run's durable execution state.
340
+ *
341
+ * Prompt reconstruction contract (D8):
342
+ *
343
+ * - `ModelResponseRecorded.messages` carries the Schema-encoded Prompt messages the Turn appended
344
+ * to the model-visible prompt — for the Run's FIRST committed Turn that includes the evaluated
345
+ * instruction and user-input messages, for later Turns only the assistant response messages.
346
+ * Tool messages are excluded from `messages`.
347
+ * - `ToolCallSettled` records (committed in the same per-Turn batch, in declaration order)
348
+ * deterministically rebuild the Turn's single Tool message.
349
+ * - `UserInputRecorded` records input, with a Submission identity only for durable admission. Its
350
+ * Prompt-visible form (instructions + user message) becomes canonical inside the owning Run's
351
+ * first `ModelResponseRecorded`. The projection consumes it only for Run correlation.
352
+ * - Immediate retained history uses `ModelCompleted.messages` for the successful Run's exact
353
+ * native Prompt suffix, including any input examples. It has no resumable Turn state.
354
+ */
355
+ /** Cumulative committed usage of the projected Run (RUN-023 resume re-seed). */
356
+ interface RunJournalUsage {
357
+ readonly modelCalls: number;
358
+ /** Known accounting gaps retained across Attempts without changing numeric usage totals. */
359
+ readonly unobservedModelCalls?: number | undefined;
360
+ readonly inputTokens: number;
361
+ readonly outputTokens: number;
362
+ readonly lastInputTokens: number;
363
+ readonly lastOutputTokens: number;
364
+ /** Cumulative persisted spend of the projected Run's committed calls (RUN-023). */
365
+ readonly costMicrousd: number;
366
+ /** Canonical per-call detail used for settlement aggregation and recovery. */
367
+ readonly modelUsage: ReadonlyArray<ModelCallUsage>;
368
+ /** Detailed usage of retired records, grouped without retaining per-call payloads. */
369
+ readonly summarizedModelUsage?: RunUsageSummary | undefined;
370
+ }
371
+ interface RunJournalProjection {
372
+ readonly toolSelection?: Selection | undefined;
373
+ readonly policyUsage: RunPolicyUsage;
374
+ /** Canonical projection for the requested Run; may end at its resumable Tool declaration. */
375
+ readonly prompt: Prompt.Prompt;
376
+ /** Prior-Run history with model-only unknown results closing incomplete application calls. */
377
+ readonly historyBefore: Prompt.Prompt;
378
+ /** Number of canonical Turns already committed for the projected Run. */
379
+ readonly committedTurns: number;
380
+ /** Summed per-call usage of the projected Run's committed responses; zeros for records predating usage capture. */
381
+ readonly usage: RunJournalUsage;
382
+ /** Latest committed context window identity, retained across ownership changes. */
383
+ readonly contextWindowId?: string | undefined;
384
+ /** Canonical evaluated instructions and initial input for this Run, independent of the view. */
385
+ readonly protectedContext?: Prompt.Prompt | undefined;
386
+ /** Last successful singleton Tool awaiting possible context-control interpretation by the engine. */
387
+ readonly pendingContextToolCallId?: string | undefined;
388
+ }
389
+ /**
390
+ * Pure projection: rebuild one Run's resume state from canonical records (DUR-015). Canonical
391
+ * order is authoritative; the fold projects each `ModelResponseRecorded` Turn and the
392
+ * owning Run's resumable incomplete Tool Turn. It flushes each contiguous group of valid `ToolCallSettled` records into one Tool message,
393
+ * exactly mirroring the per-Turn commit shape produced by `turnCanonicalBatch` (no-tool Turns) and
394
+ * by the
395
+ * `turnResponseBatch`/`turnResultsBatch` split (tool-declaring Turns). The Phase 5 audit tags
396
+ * are skipped transparently, so split-batch commits replay to the same prompt as P4 single-batch
397
+ * commits.
398
+ *
399
+ * An incomplete application Tool turn remains visible while projecting its owning Run so active
400
+ * recovery can resume the declared batch. It is not a valid model-visible Turn boundary for a
401
+ * later Run until model-only unknown results close its missing calls. Those explanatory results
402
+ * are never canonical settlements or evidence for compaction, recovery or accounting. Real
403
+ * results replace them at the original declaration, including results appended after another Run.
404
+ * Prior user intent and assistant text remain visible; prior system instructions do not.
405
+ */
406
+ /** @internal Lightweight canonical boundaries collected without retaining record payloads. */
407
+ interface JournalBoundary {
408
+ readonly sequence: CanonicalSequence;
409
+ readonly tag: "ModelResponseRecorded" | "ToolCallSettled";
410
+ readonly promptLength: number;
411
+ /** A declaration without all settled results requires terminal-prior-Run proof for coverage. */
412
+ readonly incomplete?: true | undefined;
413
+ /** The Run terminated after its last response and differs from the projection's owner. */
414
+ readonly terminalPriorRun?: true | undefined;
415
+ }
416
+ /**
417
+ * Reconstruct a fixed canonical prefix from a re-readable stream. The caller must keep the same
418
+ * records visible on every traversal. The first collects compaction and settlement metadata;
419
+ * rollovers additionally validate covered Tool batches before rebuilding Prompt and usage. Metadata and the
420
+ * live Prompt remain resident; covered historical message/tool payloads do not. An uncompacted Prompt still grows
421
+ * with its conversation, so hosts must configure an appropriate context compaction policy.
422
+ * Prepared metadata must describe exactly this stream and seed through the same fixed tail;
423
+ * it skips only the metadata scan, never covered-Tool validation or the canonical fold.
424
+ * @internal
425
+ */
426
+ declare const projectRunJournalStream: <E, R>(records: Stream.Stream<CanonicalRecordEnvelope, E, R>, ownerRunId: (string & import("effect/Brand").Brand<"@effect-agent/core/RunId">) | undefined, onBoundary?: ((boundary: JournalBoundary) => void) | undefined, seed?: JournalCheckpointSeed | undefined, preparedMetadata?: JournalMetadata | undefined) => Effect.Effect<RunJournalProjection, E | RunJournalError, R>;
427
+ /** Pure projection of one Run's durable recovery state from canonical records. */
428
+ declare const projectRunJournal: (records: readonly CanonicalRecordEnvelope[], runId: string & import("effect/Brand").Brand<"@effect-agent/core/RunId">) => Effect.Effect<RunJournalProjection, RunJournalError, never>;
429
+ /**
430
+ * Pure valid-prompt projection from canonical records: `UserInputRecorded` +
431
+ * `ModelResponseRecorded` + complete `ToolCallSettled` batches → the deterministic model-visible
432
+ * Prompt (plan §Coordinator flow step 3).
433
+ */
434
+ declare const promptFromCanonicalRecords: (records: readonly CanonicalRecordEnvelope[]) => Effect.Effect<Prompt.Prompt, RunJournalError, never>;
435
+ interface TurnCommitInput {
436
+ readonly toolOperations?: ModelResponseRecorded["toolOperations"] | undefined;
437
+ readonly toolParameterRejections?: ReadonlyArray<ToolParameterRejection> | undefined;
438
+ readonly toolExposure?: Snapshot | undefined;
439
+ readonly toolSelections?: ReadonlyMap<string, Selection> | undefined;
440
+ readonly budgetRejectedCalls?: ReadonlySet<string>;
441
+ readonly runId: RunId;
442
+ /** Canonical (Run-relative, Attempt-independent) Turn number; must be positive. */
443
+ readonly turn: number;
444
+ readonly turnId: TurnId;
445
+ /**
446
+ * The Prompt messages this Turn appended to official history, in order, including the Turn's
447
+ * Tool message when application Tools ran. Tool messages become `ToolCallSettled` records; the
448
+ * remaining messages become the Turn's `ModelResponseRecorded.messages`.
449
+ */
450
+ readonly appended: ReadonlyArray<Prompt.Message>;
451
+ readonly producerId: ProducerId;
452
+ readonly deploymentId: DeploymentId;
453
+ readonly createdAt: DateTime.Utc;
454
+ /** Leading instruction/wake messages that stay canonical but are hidden from later Runs. */
455
+ readonly runScopedPrefixLength?: number | undefined;
456
+ /** Terminal output committed atomically with this Turn's final canonical batch. */
457
+ readonly runCompletion?: {
458
+ readonly output: PersistedJson;
459
+ readonly runDisposition?: PersistedJson | undefined;
460
+ readonly finishReason?: "budget-exhausted" | undefined;
461
+ readonly exhausted?: ExhaustedLimit | undefined;
462
+ } | undefined;
463
+ /** Known missing-accounting invocations staged before this canonical response. */
464
+ readonly unobservedModelCalls?: number | undefined;
465
+ /** Per-call provider usage staged by the engine's `noteTurnUsage` (RUN-023). */
466
+ readonly usage?: {
467
+ readonly inputTokens: number;
468
+ readonly outputTokens: number;
469
+ readonly costMicrousd?: number | undefined;
470
+ readonly modelUsage?: ReadonlyArray<ModelCallUsage> | undefined;
471
+ } | undefined;
472
+ }
473
+ /** Integrity of the original validated terminal values; never a current-code projection. */
474
+ declare const runCompletionDigest: (completion: Pick<RunCompleted, "runId" | "output" | "runDisposition" | "finishReason" | "exhausted">) => Effect.Effect<string & import("effect/Brand").Brand<"@effect-agent/thread/Digest">, DigestError, Crypto.Crypto>;
475
+ /**
476
+ * Pure per-Turn canonical batch builder (TurnCompleted seam fold, D6/D8): one
477
+ * `ModelResponseRecorded` record plus one `ToolCallSettled` record per terminal Tool result, all
478
+ * under the WP0-style deterministic identities, committed as ONE atomic batch. The same input
479
+ * always yields byte-identical content, so an in-Attempt append retry is an honest batch replay.
480
+ *
481
+ * Phase 5 keeps this shape for Turns that declare no application Tool calls; their terminal
482
+ * `RunCompleted` marker joins the response in this same atomic batch. Tool-declaring Turns split
483
+ * into `turnResponseBatch` + `turnResultsBatch`.
484
+ */
485
+ declare const turnCanonicalBatch: (input: TurnCommitInput) => Effect.Effect<CanonicalBatch, DigestError | RunJournalError, Crypto.Crypto>;
486
+ /**
487
+ * Commit 1 of a tool-declaring Turn: the Turn's `ModelResponseRecorded` record, including
488
+ * provider results retained in assistant content before application Tools execute.
489
+ * — pending steering plus the assistant response with its declared tool calls — under batch
490
+ * identity `turn-response:{runId}:{turn}`. Committing the response before preparation creates
491
+ * the provably-safe durability §15 window ("after model item commit, before tool preparation →
492
+ * resume tool scheduling"): a crash there resumes the declared batch with no model re-invocation
493
+ * and no Unknown. Tool messages in `appended` are ignored; the record identity is the same
494
+ * `model-response:{runId}:{turn}` as the single-batch shape, so record-id assertions and the
495
+ * prompt projection are unchanged.
496
+ */
497
+ declare const turnResponseBatch: (input: TurnCommitInput) => Effect.Effect<CanonicalBatch, DigestError | RunJournalError, Crypto.Crypto>;
498
+ /**
499
+ * Commit 5 of a tool-declaring Turn (plan §2.1): the Turn's `ToolCallSettled` records in
500
+ * declaration order under batch identity `turn-results:{runId}:{turn}` — the batch becomes
501
+ * model-visible atomically. Non-tool messages in `appended` are ignored; a Turn without any
502
+ * terminal Tool result has no results batch and fails typed.
503
+ */
504
+ declare const turnResultsBatch: (input: TurnCommitInput) => Effect.Effect<CanonicalBatch, DigestError | RunJournalError, Crypto.Crypto>;
505
+ declare namespace SubmissionStatus_d_exports {
506
+ export { PendingSubmission, SettledSubmission, SubmissionStatus };
507
+ }
508
+ declare const PendingSubmission_base: Schema.Class<PendingSubmission, Schema.TaggedStruct<"pending", {}>, {}>;
509
+ /** A Submission still owes its canonical Settlement, including while suspended. */
510
+ declare class PendingSubmission extends PendingSubmission_base {}
511
+ declare const SettledSubmission_base: Schema.Class<SettledSubmission, Schema.TaggedStruct<"settled", {
512
+ readonly settlement: typeof Settlement;
513
+ }>, {}>;
514
+ /** The existing durable Settlement is the only authority for completion. */
515
+ declare class SettledSubmission extends SettledSubmission_base {}
516
+ declare const SubmissionStatus: Schema.Union<readonly [typeof PendingSubmission, typeof SettledSubmission]>;
517
+ type SubmissionStatus = typeof SubmissionStatus.Type;
518
+ declare namespace ThreadStore_d_exports {
519
+ export { AppendConflict, AppendResult, CheckpointRejected, FenceRejected, FencedAppendRequest, LoadCheckpointRequest, MAX_THREAD_EXPORT_RECORDS, SaveCheckpointRequest, SaveRecoveryCheckpointRequest, SelectedThreadRead, ThreadCheckpoint, ThreadCheckpoints, ThreadExport, ThreadExportRequest, ThreadMaterialization, ThreadNotMaterialized, ThreadObservation, ThreadOutstanding, ThreadOutstandingRequest, ThreadPeerCountRequest, ThreadRead, ThreadReadRequest, ThreadRecordRequest, ThreadRecoveryCheckpoints, ThreadRunInputRequest, ThreadSelection, ThreadStore, ThreadStoreDiagnostic, ThreadStoreError, ThreadStoreFailure, ThreadTail, ThreadTailRequest, ThreadWorkerStateRequest, getRecord, getRunInput, readOutstanding, readWorkerState };
520
+ }
521
+ declare const MAX_THREAD_EXPORT_RECORDS = 131072;
522
+ /** Exact canonical identity; absence is not proof that an admission was never accepted. */
523
+ declare const ThreadRecordRequest: Schema.Struct<{
524
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
525
+ readonly recordId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/RecordId">;
526
+ }>;
527
+ type ThreadRecordRequest = typeof ThreadRecordRequest.Type;
528
+ /** The original user input for a Run, excluding later joined inputs. */
529
+ declare const ThreadRunInputRequest: Schema.Struct<{
530
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
531
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
532
+ }>;
533
+ type ThreadRunInputRequest = typeof ThreadRunInputRequest.Type;
534
+ declare const ThreadOutstandingRequest: Schema.Struct<{
535
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
536
+ /** Exceeding this bound fails; a truncated inventory never grants authority. */
537
+ readonly limit: Schema.Int;
538
+ }>;
539
+ type ThreadOutstandingRequest = typeof ThreadOutstandingRequest.Type;
540
+ interface ThreadOutstanding {
541
+ readonly threadId: ThreadId;
542
+ readonly throughSequence: CanonicalSequence;
543
+ readonly complete: true;
544
+ readonly operations: ReadonlyArray<{
545
+ readonly submissionId: SubmissionId;
546
+ readonly prepared: ToolCallPrepared;
547
+ /** Prepared is not an unknown outcome or a grant to execute. */
548
+ readonly state: "prepared" | "unknown";
549
+ }>;
550
+ /** Source reservations without proof that external effects are resolved. */
551
+ readonly workerInputs: ReadonlyArray<WorkerInputRequested>;
552
+ }
553
+ /** Native worker reservation/accounting snapshot at a captured canonical tail. */
554
+ declare const ThreadWorkerStateRequest: Schema.Struct<{
555
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
556
+ readonly sourceSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
557
+ readonly limit: Schema.Int;
558
+ }>;
559
+ type ThreadWorkerStateRequest = typeof ThreadWorkerStateRequest.Type;
560
+ /** Saturating lifetime peer-message count: the result is at most the requested cap. */
561
+ declare const ThreadPeerCountRequest: Schema.Struct<{
562
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
563
+ readonly limit: Schema.Int;
564
+ }>;
565
+ type ThreadPeerCountRequest = typeof ThreadPeerCountRequest.Type;
566
+ /** Host-owned read: authenticate the Thread and exact locator before calling. */
567
+ declare const getRecord: (request: {
568
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
569
+ readonly recordId: string & import("effect/Brand").Brand<"@effect-agent/thread/RecordId">;
570
+ }) => Effect.Effect<Option.Option<CanonicalRecordEnvelope>, ThreadNotMaterialized | ThreadStoreError, ThreadStore>;
571
+ declare const getRunInput: (request: {
572
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
573
+ readonly runId: string & import("effect/Brand").Brand<"@effect-agent/core/RunId">;
574
+ }) => Effect.Effect<Option.Option<CanonicalRecordEnvelope>, ThreadNotMaterialized | ThreadStoreError, ThreadStore>;
575
+ /** A bounded snapshot of native lifetime and source-submission worker accounting. */
576
+ declare const readWorkerState: (request: {
577
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
578
+ readonly sourceSubmissionId?: (string & import("effect/Brand").Brand<"@effect-agent/core/SubmissionId">) | undefined;
579
+ readonly limit: number;
580
+ }) => Effect.Effect<{
581
+ threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
582
+ tailSequence: number & import("effect/Brand").Brand<"@effect-agent/thread/CanonicalSequence">;
583
+ tailDigest: string & import("effect/Brand").Brand<"@effect-agent/thread/Digest">;
584
+ records: CanonicalRecordEnvelope[];
585
+ }, ThreadNotMaterialized | ThreadStoreError, ThreadStore>;
586
+ /**
587
+ * Work is proportional to outstanding records, independent of completed history. Unknown
588
+ * effects survive abort and resolution intent; only canonical closure removes them. A
589
+ * preparation from another Run still requires native recovery before it can be treated as
590
+ * safe. This snapshot grants no execution authority and does not freeze other owners.
591
+ */
592
+ declare const readOutstanding: (request: {
593
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
594
+ readonly limit: number;
595
+ }) => Effect.Effect<{
596
+ threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
597
+ throughSequence: number & import("effect/Brand").Brand<"@effect-agent/thread/CanonicalSequence">;
598
+ complete: true;
599
+ operations: {
600
+ readonly submissionId: SubmissionId;
601
+ readonly prepared: ToolCallPrepared;
602
+ /** Prepared is not an unknown outcome or a grant to execute. */
603
+ readonly state: "prepared" | "unknown";
604
+ }[];
605
+ workerInputs: WorkerInputRequested[];
606
+ }, LedgerError | ThreadNotMaterialized | ThreadStoreError, SubmissionLedger | ThreadStore>;
607
+ declare const ThreadMaterialization_base: Schema.Class<ThreadMaterialization, Schema.Struct<{
608
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
609
+ readonly producerEpoch: Schema.brand<Schema.Natural, "@effect-agent/thread/ProducerEpoch">;
610
+ }>, {}>;
611
+ declare class ThreadMaterialization extends ThreadMaterialization_base {}
612
+ declare const FencedAppendRequest_base: Schema.Class<FencedAppendRequest, Schema.Struct<{
613
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
614
+ readonly batch: typeof CanonicalBatch;
615
+ readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
616
+ readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
617
+ readonly producerEpoch: Schema.brand<Schema.Natural, "@effect-agent/thread/ProducerEpoch">;
618
+ }>, {}>;
619
+ declare class FencedAppendRequest extends FencedAppendRequest_base {}
620
+ declare const AppendResult_base: Schema.Class<AppendResult, Schema.Struct<{
621
+ readonly firstSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
622
+ readonly lastSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
623
+ readonly tailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
624
+ readonly replayed: Schema.Boolean;
625
+ }>, {}>;
626
+ declare class AppendResult extends AppendResult_base {}
627
+ declare const ThreadRead_base: Schema.Class<ThreadRead, Schema.Struct<{
628
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
629
+ readonly afterSequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">>;
630
+ readonly limit: Schema.Natural;
631
+ }>, {}>;
632
+ declare class ThreadRead extends ThreadRead_base {}
633
+ /** Closed native selections; mutable metadata is read at this exact canonical tail. */
634
+ declare const ThreadSelection: Schema.Union<readonly [Schema.Struct<{
635
+ readonly _tag: Schema.Literal<"RecordId">;
636
+ readonly recordId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/RecordId">;
637
+ }>, Schema.Struct<{
638
+ readonly _tag: Schema.Literal<"RunInput">;
639
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
640
+ }>, Schema.Struct<{
641
+ readonly _tag: Schema.Literal<"Outstanding">;
642
+ readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
643
+ readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
644
+ }>, Schema.Struct<{
645
+ readonly _tag: Schema.Literal<"WorkerExecution">;
646
+ readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
647
+ readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
648
+ }>, Schema.Struct<{
649
+ readonly _tag: Schema.Literal<"WorkerState">;
650
+ readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
651
+ readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
652
+ readonly sourceSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
653
+ }>]>;
654
+ type ThreadSelection = typeof ThreadSelection.Type;
655
+ /** Nested page makes an old ThreadRead decoder reject, never strip a selection into history. */
656
+ declare const SelectedThreadRead: Schema.Struct<{
657
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
658
+ readonly selection: Schema.Union<readonly [Schema.Struct<{
659
+ readonly _tag: Schema.Literal<"RecordId">;
660
+ readonly recordId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/RecordId">;
661
+ }>, Schema.Struct<{
662
+ readonly _tag: Schema.Literal<"RunInput">;
663
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
664
+ }>, Schema.Struct<{
665
+ readonly _tag: Schema.Literal<"Outstanding">;
666
+ readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
667
+ readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
668
+ }>, Schema.Struct<{
669
+ readonly _tag: Schema.Literal<"WorkerExecution">;
670
+ readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
671
+ readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
672
+ }>, Schema.Struct<{
673
+ readonly _tag: Schema.Literal<"WorkerState">;
674
+ readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
675
+ readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
676
+ readonly sourceSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
677
+ }>]>;
678
+ readonly page: Schema.Struct<{
679
+ readonly afterSequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">>;
680
+ readonly limit: Schema.Natural;
681
+ }>;
682
+ }>;
683
+ type SelectedThreadRead = typeof SelectedThreadRead.Type;
684
+ declare const ThreadReadRequest: Schema.Union<readonly [Schema.Struct<{
685
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
686
+ readonly selection: Schema.Union<readonly [Schema.Struct<{
687
+ readonly _tag: Schema.Literal<"RecordId">;
688
+ readonly recordId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/RecordId">;
689
+ }>, Schema.Struct<{
690
+ readonly _tag: Schema.Literal<"RunInput">;
691
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
692
+ }>, Schema.Struct<{
693
+ readonly _tag: Schema.Literal<"Outstanding">;
694
+ readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
695
+ readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
696
+ }>, Schema.Struct<{
697
+ readonly _tag: Schema.Literal<"WorkerExecution">;
698
+ readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
699
+ readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
700
+ }>, Schema.Struct<{
701
+ readonly _tag: Schema.Literal<"WorkerState">;
702
+ readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
703
+ readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
704
+ readonly sourceSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
705
+ }>]>;
706
+ readonly page: Schema.Struct<{
707
+ readonly afterSequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">>;
708
+ readonly limit: Schema.Natural;
709
+ }>;
710
+ }>, typeof ThreadRead]>;
711
+ type ThreadReadRequest = typeof ThreadReadRequest.Type;
712
+ declare const ThreadObservation_base: Schema.Class<ThreadObservation, Schema.Struct<{
713
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
714
+ readonly afterOffset: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ObservationOffset">>;
715
+ }>, {}>;
716
+ declare class ThreadObservation extends ThreadObservation_base {}
717
+ declare const ThreadExportRequest_base: Schema.Class<ThreadExportRequest, Schema.Struct<{
718
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
719
+ }>, {}>;
720
+ declare class ThreadExportRequest extends ThreadExportRequest_base {}
721
+ declare const ThreadTailRequest_base: Schema.Class<ThreadTailRequest, Schema.Struct<{
722
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
723
+ }>, {}>;
724
+ declare class ThreadTailRequest extends ThreadTailRequest_base {}
725
+ declare const ThreadTail_base: Schema.Class<ThreadTail, Schema.Struct<{
726
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
727
+ readonly tailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
728
+ readonly tailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
729
+ readonly producerEpoch: Schema.brand<Schema.Natural, "@effect-agent/thread/ProducerEpoch">;
730
+ }>, {}>;
731
+ /**
732
+ * The committed tail of one Thread Log. A resuming producer composes its next
733
+ * FencedAppendRequest from this value instead of exporting the whole log.
734
+ */
735
+ declare class ThreadTail extends ThreadTail_base {}
736
+ declare const ThreadExport_base: Schema.Class<ThreadExport, Schema.Struct<{
737
+ readonly format: Schema.Literal<"effect-agent/thread@1">;
738
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
739
+ readonly tailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
740
+ readonly tailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
741
+ readonly records: Schema.$Array<typeof CanonicalRecordEnvelope>;
742
+ }>, {}>;
743
+ /** Maximum canonical records represented by one Thread export. */
744
+ declare class ThreadExport extends ThreadExport_base {}
745
+ declare const ThreadCheckpoint_base: Schema.Class<ThreadCheckpoint, Schema.Struct<{
746
+ readonly schemaVersion: Schema.Literal<1>;
747
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
748
+ readonly throughSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
749
+ readonly tailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
750
+ /** @deprecated For application projections; retained for existing data and runtime recovery. */
751
+ readonly engineVersion: Schema.optionalKey<Schema.NonEmptyString>;
752
+ /** @deprecated For application projections; retained for existing data and runtime recovery. */
753
+ readonly agentDefinitionDigest: Schema.optionalKey<Schema.brand<Schema.String, "@effect-agent/thread/Digest">>;
754
+ /** @deprecated For application projections; retained for existing data and runtime recovery. */
755
+ readonly modelDigest: Schema.optionalKey<Schema.brand<Schema.String, "@effect-agent/thread/Digest">>;
756
+ /** @deprecated For application projections; retained for existing data and runtime recovery. */
757
+ readonly toolDigest: Schema.optionalKey<Schema.brand<Schema.String, "@effect-agent/thread/Digest">>;
758
+ readonly state: Schema.declare<Schema.Json, Schema.Json>;
759
+ readonly createdAt: Schema.DateTimeUtcFromString;
760
+ }>, {}>;
761
+ /**
762
+ * A disposable projection snapshot. Adapters bind its sequence and digest to the canonical
763
+ * log; consumers decode `state` and decide projection compatibility before suffix replay.
764
+ * Legacy metadata is optional for application projections and preserved when supplied.
765
+ * Runtime-owned recovery checkpoints populate and compare it before using cached state.
766
+ */
767
+ declare class ThreadCheckpoint extends ThreadCheckpoint_base {}
768
+ declare const SaveCheckpointRequest_base: Schema.Class<SaveCheckpointRequest, Schema.Struct<{
769
+ readonly checkpoint: typeof ThreadCheckpoint;
770
+ }>, {}>;
771
+ declare class SaveCheckpointRequest extends SaveCheckpointRequest_base {}
772
+ declare const SaveRecoveryCheckpointRequest_base: Schema.Class<SaveRecoveryCheckpointRequest, Schema.Struct<{
773
+ readonly checkpoint: typeof ThreadCheckpoint;
774
+ readonly producerEpoch: Schema.brand<Schema.Natural, "@effect-agent/thread/ProducerEpoch">;
775
+ }>, {}>;
776
+ /** Replace the disposable recovery view only under the current canonical producer fence. */
777
+ declare class SaveRecoveryCheckpointRequest extends SaveRecoveryCheckpointRequest_base {}
778
+ declare const LoadCheckpointRequest_base: Schema.Class<LoadCheckpointRequest, Schema.Struct<{
779
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
780
+ readonly atOrBeforeSequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">>;
781
+ }>, {}>;
782
+ declare class LoadCheckpointRequest extends LoadCheckpointRequest_base {}
783
+ declare const ThreadStoreDiagnostic_base: Schema.Class<ThreadStoreDiagnostic, Schema.Struct<{
784
+ readonly causeTag: Schema.String;
785
+ readonly operation: Schema.String;
786
+ readonly decoder: Schema.optionalKey<Schema.String>;
787
+ readonly issueTag: Schema.optionalKey<Schema.String>;
788
+ readonly sequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">>;
789
+ }>, {}>;
790
+ /**
791
+ * Content-free storage provenance constructed by adapters from source-authored labels.
792
+ * Raw foreign lookalikes are not trusted diagnostics. Never include rejected values, SQL,
793
+ * or schema messages.
794
+ */
795
+ declare class ThreadStoreDiagnostic extends ThreadStoreDiagnostic_base {}
796
+ declare const ThreadStoreError_base: Schema.Class<ThreadStoreError, Schema.TaggedStruct<"ThreadStoreError", {
797
+ readonly operation: Schema.String;
798
+ readonly message: Schema.String;
799
+ readonly cause: Schema.optionalKey<Schema.Defect>;
800
+ readonly diagnostic: Schema.optionalKey<typeof ThreadStoreDiagnostic>;
801
+ }>, import("effect/Cause").YieldableError>;
802
+ declare class ThreadStoreError extends ThreadStoreError_base {}
803
+ declare const ThreadNotMaterialized_base: Schema.Class<ThreadNotMaterialized, Schema.TaggedStruct<"ThreadNotMaterialized", {
804
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
805
+ }>, import("effect/Cause").YieldableError>;
806
+ declare class ThreadNotMaterialized extends ThreadNotMaterialized_base {}
807
+ declare const AppendConflict_base: Schema.Class<AppendConflict, Schema.TaggedStruct<"AppendConflict", {
808
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
809
+ readonly batchId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/BatchId">;
810
+ readonly reason: Schema.Literals<readonly ["batch-digest", "record-identity", "tail"]>;
811
+ readonly actualTailSequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">>;
812
+ readonly actualTailDigest: Schema.optionalKey<Schema.brand<Schema.String, "@effect-agent/thread/Digest">>;
813
+ }>, import("effect/Cause").YieldableError>;
814
+ /**
815
+ * A canonical append that cannot commit: `batch-digest` replays a batch ID with different
816
+ * content, `record-identity` reuses a canonical record ID, and `tail` declares a stale expected
817
+ * tail. Tail conflicts carry the actual committed tail as a diagnostic resume hint.
818
+ */
819
+ declare class AppendConflict extends AppendConflict_base {}
820
+ declare const FenceRejected_base: Schema.Class<FenceRejected, Schema.TaggedStruct<"FenceRejected", {
821
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
822
+ readonly actualEpoch: Schema.brand<Schema.Natural, "@effect-agent/thread/ProducerEpoch">;
823
+ readonly attemptedEpoch: Schema.brand<Schema.Natural, "@effect-agent/thread/ProducerEpoch">;
824
+ }>, import("effect/Cause").YieldableError>;
825
+ declare class FenceRejected extends FenceRejected_base {}
826
+ declare const CheckpointRejected_base: Schema.Class<CheckpointRejected, Schema.TaggedStruct<"CheckpointRejected", {
827
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
828
+ readonly reason: Schema.Literals<readonly ["ahead-of-tail", "digest-mismatch", "unsupported-version", "corrupt"]>;
829
+ }>, import("effect/Cause").YieldableError>;
830
+ declare class CheckpointRejected extends CheckpointRejected_base {}
831
+ type ThreadStoreFailure = ThreadStoreError | ThreadNotMaterialized | AppendConflict | FenceRejected;
832
+ /**
833
+ * Optional, disposable projection storage. Neither history execution nor durable recovery
834
+ * requires it. Adapters that offer it must bind every checkpoint to a canonical batch tail.
835
+ * Application consumers own projection compatibility; this port does not interpret metadata.
836
+ */
837
+ interface ThreadCheckpoints {
838
+ readonly save: (request: SaveCheckpointRequest) => Effect.Effect<void, ThreadStoreError | ThreadNotMaterialized | CheckpointRejected>;
839
+ readonly load: (request: LoadCheckpointRequest) => Effect.Effect<Option.Option<ThreadCheckpoint>, ThreadStoreError | ThreadNotMaterialized | CheckpointRejected>;
840
+ }
841
+ /**
842
+ * Optional latest-only recovery cache, independent of application projection checkpoints.
843
+ * Saves atomically validate the producer epoch and canonical batch tail. An older snapshot
844
+ * cannot replace a newer one; equal-tail replacement repairs disposable state. Invalid cached
845
+ * data fails with CheckpointRejected, while infrastructure failures remain ThreadStoreError.
846
+ * Loading at an earlier tail or outside the adapter's cache locality may return none so callers
847
+ * can replay canonical records. Canonical records and the ledger remain authority.
848
+ */
849
+ interface ThreadRecoveryCheckpoints {
850
+ readonly save: (request: SaveRecoveryCheckpointRequest) => Effect.Effect<void, ThreadStoreError | ThreadNotMaterialized | CheckpointRejected | FenceRejected>;
851
+ readonly load: ThreadCheckpoints["load"];
852
+ }
853
+ declare const ThreadStore_base: Context.ServiceClass<ThreadStore, "@effect-agent/thread/ThreadStore", {
854
+ readonly materialize: (request: ThreadMaterialization) => Effect.Effect<void, ThreadStoreError | FenceRejected>;
855
+ readonly append: (request: FencedAppendRequest) => Effect.Effect<AppendResult, ThreadStoreError | ThreadNotMaterialized | AppendConflict | FenceRejected>;
856
+ readonly read: (request: ThreadReadRequest) => Stream.Stream<CanonicalRecordEnvelope, ThreadStoreError | ThreadNotMaterialized>;
857
+ readonly observe: (request: ThreadObservation) => Stream.Stream<CanonicalRecordEnvelope, ThreadStoreError | ThreadNotMaterialized>;
858
+ readonly export: (request: ThreadExportRequest) => Effect.Effect<ThreadExport, ThreadStoreError | ThreadNotMaterialized>;
859
+ readonly inspectTail: (request: ThreadTailRequest) => Effect.Effect<ThreadTail, ThreadStoreError | ThreadNotMaterialized>;
860
+ /** Absent when this adapter does not support disposable checkpoints. */
861
+ readonly checkpoints?: ThreadCheckpoints | undefined;
862
+ readonly recoveryCheckpoints?: ThreadRecoveryCheckpoints | undefined;
863
+ /** Indexed scalar count; unsupported adapters fail closed at the caller. */
864
+ readonly countPeerMessages?: ((request: ThreadPeerCountRequest) => Effect.Effect<number, ThreadStoreError | ThreadNotMaterialized>) | undefined;
865
+ }>;
866
+ declare class ThreadStore extends ThreadStore_base {}
867
+ declare namespace DurableAgentRuntime_d_exports {
868
+ export { ApprovalSuspensionError, DurableAbortFailure, DurableAgentRuntime, DurableApprovalFailure, DurableApprovalResolver, DurableApprovalSuspension, DurableAwaitFailure, DurableExplainFailure, DurableObligationFailure, DurableObserveOptions, DurableProgressFailure, DurableResolveFailure, DurableRetryFailure, DurableRuntimeConfig, DurableRuntimeConfigOptions, DurableSubmitAgent, DurableSubmitFailure, DurableSubmitOptions, DurableVerifyFailure, DurableWorkerFailure, DurableWorkerRequirements, Receipt, RecoveryBlocked, RecoveryFailure, RecoveryReport, RecoverySweepOptions, RecoverySweepResult, childReservationIdFor, isolateRecovery, recoveryRepairBatchId, recoveryRepairRecordId, threadCreatedBatchId, threadCreatedRecordId };
869
+ }
870
+ /**
871
+ * Instruction failure/requirement derivation mirroring the engine's `RuntimeBinding` defaults:
872
+ * declaring them as generic DEFAULTS (instead of independent inference sites) keeps a plain
873
+ * string-returning instruction function from widening both parameters to `unknown`.
874
+ */
875
+ type InstructionResultOf<Instructions, Input> = Instructions extends ((input: Input) => infer Result) ? Result : Instructions;
876
+ type InstructionErrorOf<Instructions, Input> = InstructionResultOf<Instructions, Input> extends Effect.Effect<infer _Success, infer Error, infer _Requirements> ? Error : never;
877
+ type InstructionRequirementsOf<Instructions, Input> = InstructionResultOf<Instructions, Input> extends Effect.Effect<infer _Success, infer _Error, infer Requirements> ? Requirements : never;
878
+ /**
879
+ * Deterministic parent-owned child budget reservation identity (spec
880
+ * §12 step 2, D4): one reservation per (parent Run, parent Tool Call) pair,
881
+ * so a replayed establishment converges on the one existing row (SUB-016).
882
+ */
883
+ declare const childReservationIdFor: (runId: RunId, toolCallId: ToolCallId) => ChildReservationId;
884
+ /** Deterministic batch identity of one Thread's initial `ThreadCreated` append. */
885
+ declare const threadCreatedBatchId: (threadId: ThreadId) => BatchId;
886
+ /** Deterministic record identity of one Thread's `ThreadCreated` record. */
887
+ declare const threadCreatedRecordId: (threadId: ThreadId) => RecordId;
888
+ /** Deterministic batch identity of one executed recovery decision's audit append (DUR-013). */
889
+ declare const recoveryRepairBatchId: (submissionId: SubmissionId, decisionTag: string) => BatchId;
890
+ /** Deterministic record identity of one executed recovery decision's `RepairAnnotated` record. */
891
+ declare const recoveryRepairRecordId: (submissionId: SubmissionId, decisionTag: string) => RecordId;
892
+ declare const RecoveryFailure_base: Schema.Class<RecoveryFailure, Schema.Struct<{
893
+ readonly phase: Schema.Literals<readonly ["history", "recovery"]>;
894
+ readonly reason: Schema.Literals<readonly ["failure", "defect", "timeout"]>;
895
+ readonly errorTag: Schema.String;
896
+ /** Static operation names only; error messages and payloads are deliberately excluded. */
897
+ readonly operation: Schema.String;
898
+ /** Ordered, bounded classifications. Foreign labels, operations and prose stay private. */
899
+ readonly causes: Schema.$Array<Schema.Struct<{
900
+ readonly errorTag: Schema.Literals<readonly ["AdmissionPolicyError", "DigestError", "LedgerError", "OwnershipLost", "SettlementConflict", "ThreadStoreError", "ThreadNotMaterialized", "AppendConflict", "FenceRejected", "RunJournalError", "DurableRuntimeFailpointError", "SchemaError", "Error", "TypeError", "RangeError", "ReferenceError", "SyntaxError", "URIError", "EvalError", "AggregateError", "ForeignError", "NonErrorCause"]>;
901
+ }>>;
902
+ readonly causesTruncated: Schema.optionalKey<Schema.Literal<true>>;
903
+ readonly diagnostic: Schema.optionalKey<typeof ThreadStoreDiagnostic>;
904
+ }>, {}>;
905
+ /** Recovery could not establish execution authority. This is never a Settlement or replay grant. */
906
+ declare class RecoveryFailure extends RecoveryFailure_base {}
907
+ /** @internal One bounded failure boundary for execution history and host recovery control reads. */
908
+ declare const isolateRecovery: <A, E extends DurableWorkerFailure, R>(body: Effect.Effect<A, E, R>, options: {
909
+ readonly timeout: Duration.Duration;
910
+ readonly phase: () => RecoveryFailure["phase"];
911
+ readonly operation?: string;
912
+ }) => Effect.Effect<Result.Result<A, RecoveryFailure>, E, Exclude<R, Scope.Scope>>;
913
+ declare const RecoveryBlocked_base: Schema.Class<RecoveryBlocked, Schema.TaggedStruct<"RecoveryBlocked", {
914
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
915
+ readonly failure: typeof RecoveryFailure;
916
+ }>, Cause.YieldableError>;
917
+ /** One failed Thread remains pending; the host must not claim it before recovery succeeds. */
918
+ declare class RecoveryBlocked extends RecoveryBlocked_base {}
919
+ declare const RecoveryReport_base: Schema.Class<RecoveryReport, Schema.Struct<{
920
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
921
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
922
+ readonly decision: Schema.Union<readonly [typeof CompleteMaterialization, typeof RepairReadiness, typeof ApplyInput, typeof RepairInputMarker, typeof ResumeFromTurnBoundary, typeof AppendReservedSettlement, typeof FinalizeLedgerFromHistory, typeof SettleAborted, typeof MarkUnknown, typeof ResumePendingToolBatch, typeof AwaitApprovalDecision, typeof ResumeSuspended, typeof AwaitUnknownResolution, typeof ApplyUnknownResolutions, typeof RevertJoining, typeof RepairJoinMarker, typeof SettleJoinedWithHost, typeof AwaitHostSettlement, typeof CompleteChildAdmission, typeof AwaitChildAdmissionResolution, typeof RepairSubagentStartLink, typeof EnsureWaitingForChild, typeof AwaitChildSettlement, typeof ResumeWaitingParent, typeof ApplyJoinAccounting, typeof PropagateChildAbort, typeof ReleaseOrphanChildReservation, typeof AwaitParentEstablishment, typeof NoAction]>;
923
+ /**
924
+ * `repaired` = executed; `deferred` = a claiming worker must finish it; `none` = settled;
925
+ * `unknown` = this Submission is parked on an Unknown Outcome awaiting the authorized
926
+ * DUR-017 resolution path — the settlement obligation stays visible while no worker permit
927
+ * is consumed (durability §16).
928
+ */
929
+ readonly disposition: Schema.Literals<readonly ["repaired", "deferred", "none", "unknown"]>;
930
+ }>, {}>;
931
+ /** One executed (or deliberately deferred) recovery decision (durability §14, DUR-013). */
932
+ declare class RecoveryReport extends RecoveryReport_base {}
933
+ declare const RecoverySweepResult_base: Schema.Class<RecoverySweepResult, Schema.Struct<{
934
+ readonly reports: Schema.$Array<typeof RecoveryReport>;
935
+ /** Exactly one fault per failed Thread, regardless of its queued Submission count. */
936
+ readonly blocked: Schema.$Array<typeof RecoveryBlocked>;
937
+ }>, {}>;
938
+ /** Submission decisions and operational faults have different ownership and settlement semantics. */
939
+ declare class RecoverySweepResult extends RecoverySweepResult_base {}
940
+ /** Select one Thread before reading history, or omit to recover every pending Thread. */
941
+ interface RecoverySweepOptions {
942
+ readonly threadId?: ThreadId;
943
+ }
944
+ /** Per-submission options accepted by `DurableAgentRuntime.submit` (D2). */
945
+ interface DurableSubmitOptions {
946
+ readonly threadId: ThreadId;
947
+ readonly principal: Principal;
948
+ readonly idempotencyKey: IdempotencyKey;
949
+ readonly admissionGroup?: string;
950
+ readonly admissionFence?: AdmissionFence;
951
+ /** Host-prepared worker input; immutable origin and per-input projection parameters. */
952
+ readonly workerAdmission?: WorkerAdmission;
953
+ /** Peer provenance or a worker completion, verified against frozen canonical delivery proof. */
954
+ readonly messageAdmission?: InputMessage;
955
+ /** Application-computed digests of the Agent/Model/Toolkit definitions (see `digestDefinitions`). */
956
+ readonly definitions: DefinitionDigests;
957
+ }
958
+ interface DurableObserveOptions {
959
+ /** Resume the observation after an adapter-owned offset previously returned by `observe`. */
960
+ readonly after?: CanonicalRecordEnvelope["offset"] | undefined;
961
+ }
962
+ /** The structural slice of an Agent Binding that `submit` needs. */
963
+ interface DurableSubmitAgent<InputSchema extends Schema.Top> {
964
+ readonly definition: {
965
+ readonly id: AgentId;
966
+ readonly input: InputSchema;
967
+ };
968
+ }
969
+ type DurableSubmitFailure = AgentInputError | DigestError | AdmissionConflict | AdmissionPolicyError | LedgerError | ThreadStoreError | ThreadNotMaterialized | AppendConflict | FenceRejected | DurableRuntimeFailpointError;
970
+ declare const ApprovalSuspensionError_base: Schema.Class<ApprovalSuspensionError, Schema.TaggedStruct<"ApprovalSuspensionError", {
971
+ readonly cause: Schema.Defect;
972
+ }>, Cause.YieldableError>;
973
+ /** Attempt resources could not be retained before deliberate approval suspension. */
974
+ declare class ApprovalSuspensionError extends ApprovalSuspensionError_base {}
975
+ type DurableWorkerFailure = AdmissionPolicyError | ApprovalSuspensionError | DigestError | LedgerError | OwnershipLost | SettlementConflict | ThreadStoreError | ThreadNotMaterialized | AppendConflict | FenceRejected | RunJournalError | DurableRuntimeFailpointError;
976
+ type DurableAwaitFailure = LedgerError | SettlementConflict | OperationDenied;
977
+ /** Typed failures from the public canonical progress boundary. */
978
+ type DurableProgressFailure = ThreadStoreError | ThreadNotMaterialized | OperationDenied;
979
+ type DurableAbortFailure = OperationDenied | LedgerError | SettlementConflict | JoinedToHost | DurableRuntimeFailpointError;
980
+ /**
981
+ * Failure family of `resolveUnknown` (DUR-017, abort-shaped): the durable intent may conflict
982
+ * with a divergent prior resolution, the Submission may already be settled, an `AbortSubmission`
983
+ * resolution routes through the abort path (whose `JoinedToHost` conflict stays visible), and the
984
+ * failpoint after the intent write is armable like every other durable mutation.
985
+ */
986
+ type DurableResolveFailure = LedgerError | SettlementConflict | UnknownResolutionConflict | JoinedToHost | DurableRuntimeFailpointError;
987
+ /**
988
+ * Failure family of `resolveApproval` (plan §2.6, abort-shaped): the durable intent may conflict
989
+ * with a divergent prior decision, and the Submission may already be settled. The ledger adapter
990
+ * owns the crash boundaries of the intent write (`ledger:approval-decision:{before,after}`).
991
+ */
992
+ type DurableApprovalFailure = LedgerError | SettlementConflict | ApprovalConflict;
993
+ /**
994
+ * Failure family of the read-only `explain`/`explainThread` operations (P7 WP1): pure
995
+ * observation over the two ports plus the evidence assembler's typed failures, and the
996
+ * fail-closed `OperationDenied` when a host-supplied authorizer refuses.
997
+ */
998
+ type DurableExplainFailure = LedgerError | ThreadStoreError | RunJournalError | OperationDenied;
999
+ /**
1000
+ * Failure family of the read-only `verify` operation (P7 WP1). `ThreadNotMaterialized`
1001
+ * stays visible: verifying a Thread that does not exist is a caller error, not an empty
1002
+ * report.
1003
+ */
1004
+ type DurableVerifyFailure = LedgerError | ThreadStoreError | ThreadNotMaterialized | OperationDenied;
1005
+ /**
1006
+ * Failure family of `retry` (P7 WP1): the scoped recovery execution carries the worker failure
1007
+ * family, refusals are typed (`RetryRefused` — settled work and lanes owned by the
1008
+ * resolveUnknown/resolveApproval paths), and denial is fail-closed.
1009
+ */
1010
+ type DurableRetryFailure = DurableWorkerFailure | RetryRefused | OperationDenied;
1011
+ /** Failure family of `scanObligations` (P7 WP1): ledger scan + canonical unknown-age reads. */
1012
+ type DurableObligationFailure = LedgerError | ThreadStoreError | OperationDenied;
1013
+ /**
1014
+ * Optional policy-auto approval delegate consulted by the durable approval hook (plan §2.6 step
1015
+ * 2) AFTER the recorded-decision lookup misses. An immediate `approved`/`denied` answer becomes
1016
+ * canonical (`ToolApprovalRequested` + `ToolApprovalDecided`, one atomic batch) before it is
1017
+ * honored; `unresolved` falls through to the durable suspension path. The default (`undefined`)
1018
+ * suspends every undecided approval durably until `resolveApproval` decides it — the fail-closed
1019
+ * posture. Adapt the P2 `ApprovalResolver` capability stack through
1020
+ * `@effect-agent/capabilities`' `toDurableRunApprovalHook`.
1021
+ */
1022
+ declare const DurableApprovalResolver: Context.Reference<RunApprovalHook<never, never> | undefined>;
1023
+ /**
1024
+ * Optional attempt-local retention before an unresolved approval releases ownership. Supply
1025
+ * this from the Attempt's Layer, capturing its live resources. The canonical approval request
1026
+ * already exists; claim renewal and abort observation remain active while this operation runs.
1027
+ * Return only after retention is confirmed. Failure leaves the accepted work owed and preserves
1028
+ * its cause; interruption keeps normal resource cleanup. No approval-gated Tool runs here.
1029
+ *
1030
+ * A decision racing with successful retention resumes the pending batch in a fresh Attempt,
1031
+ * after the old services and claim finalize. The default leaves existing suspension unchanged.
1032
+ */
1033
+ declare const DurableApprovalSuspension: Context.Reference<Effect.Effect<void, ApprovalSuspensionError> | undefined>;
1034
+ /**
1035
+ * Services a durable worker needs beyond the runtime's own Layer: the Agent Binding's inferred
1036
+ * requirements minus its supplied identity and history services. The coordinator provides
1037
+ * deterministic Run/Turn identity and journal-owned history because its coordinator owns all
1038
+ * durable reads and commits across Attempts.
1039
+ */
1040
+ type DurableWorkerRequirements<AgentValue extends Any, InstructionRequirements = never> = Exclude<AgentRuntimeRequirements<AgentValue, never, InstructionRequirements>, ThreadHistory | RunContextPreparation> | AgentCompletionProjectionRequirements<AgentValue>;
1041
+ interface DurableRuntimeConfigOptions {
1042
+ /**
1043
+ * Deployment identity and the conservative operation version for direct execution without
1044
+ * a registered binding. Reuse asserts unchanged handler, Step, and idempotency semantics.
1045
+ */
1046
+ readonly deploymentId: DeploymentId;
1047
+ readonly producerId: ProducerId;
1048
+ /** `awaitSettlement` ledger re-check cadence when no wake arrives (default 500ms). */
1049
+ readonly settlementPollInterval?: Duration.Duration | undefined;
1050
+ /** Worker ownership-lease renewal cadence (default 10s; D5 lease default is 30s). */
1051
+ readonly leaseRenewalInterval?: Duration.Duration | undefined;
1052
+ /** Active-Run abort-intent poll cadence (default 500ms). */
1053
+ readonly abortPollInterval?: Duration.Duration | undefined;
1054
+ /** Cooperative bound for one Thread's recovery, including child reads (default 30s). */
1055
+ readonly recoveryTimeout?: Duration.Duration | undefined;
1056
+ /** Deployment-owned model pricing authority, captured for every recoverable Run. */
1057
+ readonly estimateCostMicrousd?: RunCostEstimator | undefined;
1058
+ }
1059
+ declare const DurableRuntimeConfig_base: Context.ServiceClass<DurableRuntimeConfig, "@effect-agent/thread/DurableRuntimeConfig", {
1060
+ readonly deploymentId: DeploymentId;
1061
+ readonly producerId: ProducerId;
1062
+ readonly settlementPollInterval: Duration.Duration;
1063
+ readonly leaseRenewalInterval: Duration.Duration;
1064
+ readonly abortPollInterval: Duration.Duration;
1065
+ readonly recoveryTimeout: Duration.Duration;
1066
+ readonly estimateCostMicrousd?: RunCostEstimator | undefined;
1067
+ }>;
1068
+ /** Deployment-scoped identity and liveness cadences for the durable coordinator. */
1069
+ declare class DurableRuntimeConfig extends DurableRuntimeConfig_base {
1070
+ static make(options: DurableRuntimeConfigOptions): (typeof DurableRuntimeConfig)["Service"];
1071
+ static layer(options: DurableRuntimeConfigOptions): Layer.Layer<DurableRuntimeConfig>;
1072
+ }
1073
+ declare const DurableAgentRuntime_base: Context.ServiceClass<DurableAgentRuntime, "@effect-agent/thread/DurableAgentRuntime", {
1074
+ /** Acquire an authenticated source Thread facet; its References confer no authority. */
1075
+ readonly workerHost: (request: {
1076
+ readonly sourceThreadId: ThreadId;
1077
+ readonly principal: Principal;
1078
+ /** Exact retained owner input for captured source policy; never selects the latest input. */
1079
+ readonly sourceSubmissionId?: SubmissionId;
1080
+ }) => Effect.Effect<SubagentHost["Service"], WorkerError>;
1081
+ readonly messagingHost: (request: {
1082
+ readonly sourceThreadId: ThreadId;
1083
+ readonly principal: Principal;
1084
+ }) => Effect.Effect<MessagingHost["Service"], MessagingError>;
1085
+ /** Admit the exact registered Definition instance; reject missing, ambiguous, or different definitions. */
1086
+ readonly submitRegistered: <InputSchema extends Schema.Top>(agent: DurableSubmitAgent<InputSchema>, input: InputSchema["Type"], options: Omit<DurableSubmitOptions, "definitions">) => Effect.Effect<Receipt, DurableSubmitFailure | BindingUnavailable, InputSchema["EncodingServices"]>;
1087
+ /** Authorized exact canonical terminal record, including the encoded output. Reject pending work. */
1088
+ readonly settlementRecord: (receipt: Receipt) => Effect.Effect<SubmissionSettledRecord, DurableAwaitFailure>;
1089
+ readonly submit: <InputSchema extends Schema.Top>(agent: DurableSubmitAgent<InputSchema>, input: InputSchema["Type"], options: DurableSubmitOptions) => Effect.Effect<Receipt, DurableSubmitFailure, InputSchema["EncodingServices"]>;
1090
+ readonly awaitSettlement: (receipt: Receipt) => Effect.Effect<Settlement, DurableAwaitFailure>;
1091
+ /** Authorized, nonblocking read. Only the durable Settlement marks work complete. */
1092
+ readonly submissionStatus: (receipt: Receipt) => Effect.Effect<SubmissionStatus, DurableAwaitFailure>;
1093
+ /**
1094
+ * Trusted worker inspection under the same runtime authority as processThread/recoverSubmission.
1095
+ * Caller-facing observations must use submissionStatus or awaitSettlement for authorization.
1096
+ */
1097
+ readonly inspectSubmissionStatus: (receipt: Receipt) => Effect.Effect<SubmissionStatus, DurableAwaitFailure>;
1098
+ /**
1099
+ * Wait for an already-committed record or one incarnation-local progress hint after
1100
+ * `afterSequence`. Canonical records remain authoritative: callers re-read after return.
1101
+ */
1102
+ readonly awaitProgress: (threadId: ThreadId, afterSequence: CanonicalSequence) => Effect.Effect<void, DurableProgressFailure>;
1103
+ readonly observe: (receipt: Receipt, options?: DurableObserveOptions) => Stream.Stream<CanonicalRecordEnvelope, ThreadStoreError | ThreadNotMaterialized | OperationDenied>;
1104
+ readonly abort: (command: AbortCommand) => Effect.Effect<AbortIntent, DurableAbortFailure>;
1105
+ readonly resolveUnknown: (command: UnknownResolutionCommand) => Effect.Effect<UnknownResolutionIntent, DurableResolveFailure | OperationDenied>;
1106
+ readonly resolveApproval: (command: ApprovalDecisionCommand) => Effect.Effect<ApprovalDecisionIntent, DurableApprovalFailure | OperationDenied>;
1107
+ /**
1108
+ * Read-only recovery explanation of one Submission (P7 plan §3): snapshot + tolerant
1109
+ * canonical read + the pure classifier, packaged with the decision's operator meaning and
1110
+ * predicted disposition. Performs ZERO writes — the canonical log and every ledger row are
1111
+ * byte-identical before and after.
1112
+ */
1113
+ readonly explain: (submissionId: SubmissionId) => Effect.Effect<RecoveryExplanation, DurableExplainFailure>;
1114
+ /** `explain` for every nonterminal lane member of one Thread, in queue order. */
1115
+ readonly explainThread: (threadId: ThreadId) => Effect.Effect<ReadonlyArray<RecoveryExplanation>, DurableExplainFailure>;
1116
+ /**
1117
+ * Read-only integrity verification of one Thread (P7 plan §3): Schema round-trips,
1118
+ * record-identity uniqueness, sequence contiguity, FIFO input/settlement order,
1119
+ * ledger-terminal vs canonical-settlement agreement (DUR-015), and checkpoint binding —
1120
+ * typed per-check results, never a repair. The digest-chain check reports `skipped` with
1121
+ * the honest reason: full chain recomputation needs per-batch producer identity, which the
1122
+ * ThreadStore port deliberately does not export (supply it to
1123
+ * `verifyThreadInvariants` directly; adapter-level `verifyOnOpen` is the
1124
+ * storage-side audit).
1125
+ */
1126
+ readonly verify: (threadId: ThreadId) => Effect.Effect<IntegrityReport, DurableVerifyFailure>;
1127
+ /**
1128
+ * Safe re-drive of one Submission's recovery decision with mandatory author/reason audit
1129
+ * (SEC-011): executes exactly the repair the classifier names; owned repair attempts
1130
+ * append a best-effort `RepairAnnotated` with their actual claim epoch (DUR-013). Typed `RetryRefused`
1131
+ * for settled work and for lanes owned by the resolveUnknown/resolveApproval paths.
1132
+ */
1133
+ readonly retry: (command: RetryCommand) => Effect.Effect<RecoveryReport, DurableRetryFailure>;
1134
+ /** The documented operator liveness nudge: a droppable wake hint for one lane. */
1135
+ readonly wake: (threadId: ThreadId) => Effect.Effect<void, OperationDenied>;
1136
+ /**
1137
+ * Scan-based DUR-017/OPS-001 obligation report: every nonterminal Submission with what it
1138
+ * is visibly blocked on, its age, and a threshold-classified severity. Never a daemon —
1139
+ * hosts run it periodically and own the alert loop (OPS-002).
1140
+ */
1141
+ readonly scanObligations: (thresholds: ObligationThresholds) => Effect.Effect<ObligationReport, DurableObligationFailure>;
1142
+ readonly processThread: <InputSchema extends Schema.Top, OutputSchema extends Schema.Top, Instructions, Tools extends Record<string, Tool.Any>, Provider, ModelProvides, ModelRequires, InstructionError = InstructionErrorOf<Instructions, InputSchema["Type"]>, InstructionRequirements = InstructionRequirementsOf<Instructions, InputSchema["Type"]>, RunDispositionValue extends RunDispositionDeclaration<OutputSchema["Type"], Schema.Top> | undefined = undefined, InputPromptValue extends InputPromptSource<InputSchema["Type"], unknown, unknown> | undefined = undefined, UpdatesSchema extends Schema.Top | undefined = undefined>(agent: RuntimeBinding<InputSchema, OutputSchema, Instructions, Tools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema>, threadId: ThreadId) => Effect.Effect<ReadonlyArray<Settlement>, DurableWorkerFailure | DurableBindingFailure, DurableWorkerRequirements<RuntimeBinding<InputSchema, OutputSchema, Instructions, Tools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema>, InstructionRequirements>>;
1143
+ readonly processThreadResolved: (threadId: ThreadId) => Effect.Effect<ReadonlyArray<Settlement>, DurableWorkerFailure | DurableBindingFailure>;
1144
+ /**
1145
+ * Advance the FIFO head, closing its Attempt resources before returning. A vacant,
1146
+ * owned, unknown, or suspended head returns None and leaves accepted work pending.
1147
+ * Ready input may join this Run through the existing Turn seams and settle with its head.
1148
+ * Interruption ends only this Attempt; ownership cleanup uses its latest renewed token.
1149
+ * A trusted host may supply `yieldAfter` to return None before the next Turn's context
1150
+ * preparation, committing any completed Turn first. This releases ownership without settling or resetting the durable
1151
+ * Run deadline. It is a cooperative scheduling deadline, not a hard interruption timeout.
1152
+ */
1153
+ readonly processThreadHead: (threadId: ThreadId, options?: {
1154
+ readonly yieldAfter?: DateTime.Utc;
1155
+ }) => Effect.Effect<Option.Option<Settlement>, DurableWorkerFailure | DurableBindingFailure>;
1156
+ readonly runWorker: <InputSchema extends Schema.Top, OutputSchema extends Schema.Top, Instructions, Tools extends Record<string, Tool.Any>, Provider, ModelProvides, ModelRequires, InstructionError = InstructionErrorOf<Instructions, InputSchema["Type"]>, InstructionRequirements = InstructionRequirementsOf<Instructions, InputSchema["Type"]>, RunDispositionValue extends RunDispositionDeclaration<OutputSchema["Type"], Schema.Top> | undefined = undefined, InputPromptValue extends InputPromptSource<InputSchema["Type"], unknown, unknown> | undefined = undefined, UpdatesSchema extends Schema.Top | undefined = undefined>(agent: RuntimeBinding<InputSchema, OutputSchema, Instructions, Tools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema>) => Effect.Effect<void, DurableWorkerFailure | DurableBindingFailure, DurableWorkerRequirements<RuntimeBinding<InputSchema, OutputSchema, Instructions, Tools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema>, InstructionRequirements>>;
1157
+ readonly runResolvedWorker: Effect.Effect<void, DurableWorkerFailure | DurableBindingFailure>;
1158
+ /**
1159
+ * Recover each pending Thread independently. History/child failures, defects and the
1160
+ * configured timeout return one RecoveryBlocked per Thread; hosts must retain visibility
1161
+ * outside execution history and exclude those Threads from claims. Ledger scan failures,
1162
+ * owner interruption and injected crash boundaries still fail the whole sweep.
1163
+ * Optional Thread selection lets a host recover its selected dispatch lane independently
1164
+ * of old cleanup. Unselected Threads are neither read nor reported by this call.
1165
+ */
1166
+ readonly runRecovery: (options?: RecoverySweepOptions) => Effect.Effect<RecoverySweepResult, DurableWorkerFailure>;
1167
+ /** Apply one recovery decision; untouched ready input is deferred to its worker claim. */
1168
+ readonly recoverSubmission: (submissionId: SubmissionId) => Effect.Effect<RecoveryReport, DurableWorkerFailure>;
1169
+ }>;
1170
+ /**
1171
+ * Durable Agent Runtime coordinator (deployment class DN; D1/D2). It coordinates the
1172
+ * SubmissionLedger, ThreadStore, and WakeScheduler ports so that once `submit` returns a
1173
+ * Receipt, the Submission settles exactly once (DUR-001/DUR-002) while every external effect
1174
+ * remains at-least-once (DUR-003) — this runtime never claims exactly-once side effects.
1175
+ *
1176
+ * - `submit(agent, input, options)` — durable admission → Thread materialization →
1177
+ * `ThreadCreated` → readiness → Receipt, with failpoints between the steps; a retry with
1178
+ * the same (thread, principal, idempotencyKey) resumes and returns the same Receipt.
1179
+ * - `awaitSettlement(receipt)` — authorized once before the first ledger read, for the lifetime
1180
+ * of this wait; interrupting it detaches the caller only and never cancels accepted work.
1181
+ * - `observe(receipt, {after})` — canonical record observation from a stored offset.
1182
+ * - `abort(command)` — authorized before ledger access; durable idempotent abort intent; inactive work settles aborted through
1183
+ * recovery, an active worker makes the command canonical before interrupting its Run (§13),
1184
+ * settled work fails with `SettlementConflict` (DUR-012). A `joined` Submission fails with a
1185
+ * typed `JoinedToHost` conflict carrying the host identity — it settles with its host, so the
1186
+ * abort target is the host; aborting a `joining` Submission records the intent, honored only
1187
+ * if the host has not consumed the input (revert-then-abort, plan §2.5).
1188
+ * - `resolveUnknown(command)` — the authorized DUR-017 resolution path for Unknown Outcomes:
1189
+ * the durable intent is idempotent per (submission, tool call) and conflicts typed on
1190
+ * divergence; the canonical resolution records are applied by recovery or the next Attempt,
1191
+ * and the lane wakes once every marked call is covered.
1192
+ * - `resolveApproval(command)` — the durable approval decision path (plan §2.6): the intent is
1193
+ * idempotent per (submission, tool call) with a typed `ApprovalConflict` on divergence; once
1194
+ * every pending call of the suspension reason is decided the lane wakes
1195
+ * (`suspended → input-applied`) and the next Attempt resumes the declared batch without model
1196
+ * re-invocation, appending the canonical `ToolApprovalDecided` before honoring the decision.
1197
+ * - `processThread(agent, threadId)` — drain one lane: fenced FIFO-head claims,
1198
+ * canonical input apply, split response/prepared/results Turn commits (plan §2.1),
1199
+ * reconcile-then-mark for open ordinary Tool Calls (DUR-009, never an automatic replay),
1200
+ * declared-batch resume without model re-invocation (§15), and terminalization. An active
1201
+ * host Run claims the contiguous ready prefix of later queued Submissions at every safe Turn
1202
+ * seam (Joining/Joined, plan §2.5): the queued input becomes canonical (`input:{sid}`) before
1203
+ * the next model request, reattaches through the prompt-coverage rule after a crash, and the
1204
+ * joined Submissions settle with the host outcome (DUR-002/DUR-016).
1205
+ * - `runWorker(agent)` — scan-seeded, wake-driven worker loop over every lane (WP4's host driver),
1206
+ * over a singleton current Binding: a claimed head belonging to a different Agent never
1207
+ * runs against this binding. Missing bindings leave accepted roots and children owed.
1208
+ * - `processThreadResolved(threadId)` / `runResolvedWorker` — the
1209
+ * equivalents over registrations owned by the runtime Layer: each stable `agentId` selects
1210
+ * one current Binding. Unfinished operation contracts gate handler execution independently
1211
+ * of immutable admission evidence; missing bindings release the claim with a typed refusal.
1212
+ * - `runRecovery()` — classify every nonterminal Submission with the pure `classifyRecovery` and
1213
+ * execute repair decisions, annotating owned repair attempts with their granted epochs
1214
+ * (DUR-013). Untouched ready input and model-resuming work are reported `deferred` for a
1215
+ * worker claim; Submissions parked on
1216
+ * Unknown Outcomes are reported `unknown`. The S2 binding-free Subagent executors (admission
1217
+ * completion, start-link repair, waiting restoration, wake replay, canonical join accounting,
1218
+ * abort propagation, orphan reservation release) run here; the settlement join itself is
1219
+ * deferred to a claiming worker because it needs the parent Binding's result projection.
1220
+ * - `explain`/`explainThread`, `verify`, `retry`, `wake`, `scanObligations` — the P7
1221
+ * administrative operations (plan §3) over the same two ports, identical on DN and DC.
1222
+ * `explain` and `verify` are strictly read-only; `retry` re-drives exactly one classified
1223
+ * repair with mandatory author/reason audit and typed refusals; `scanObligations` is the
1224
+ * scan-based DUR-017/OPS-001 obligation surface. Every one of them (plus `observe`,
1225
+ * `resolveUnknown`, `resolveApproval`) consults the `OperationAuthorizer` reference
1226
+ * fail-closed — the default Layer preserves the service-possession behavior, and a
1227
+ * host-supplied authorizer turns denials into the typed `OperationDenied`.
1228
+ */
1229
+ declare class DurableAgentRuntime extends DurableAgentRuntime_base {
1230
+ /**
1231
+ * Resolve typed registrations and capture their services once in the runtime's Layer Scope.
1232
+ * Every claimed head must match an exact registered identity and digest triple. Worker calls
1233
+ * cannot replace these registrations or their captured services. Tool authorization is required.
1234
+ */
1235
+ static layerRegistered<const Entries extends ReadonlyArray<AgentRegistration>>(registrations: Entries): Layer.Layer<DurableAgentRuntime, DigestError, Crypto.Crypto | DurableRuntimeConfig | DurableRuntimeFailpoint | RunToolAuthorization | SubmissionLedger | ThreadStore | ToolReconciler | WakeScheduler | Exclude<[Entries[number]] extends [never] ? never : Entries[number] extends (infer T) ? T extends Entries[number] ? T extends unknown ? ("attemptLayer" extends keyof T ? T[keyof T & "attemptLayer"] : undefined) extends (infer T_1) ? T_1 extends ("attemptLayer" extends keyof T ? T[keyof T & "attemptLayer"] : undefined) ? T_1 extends ((context: AgentAttemptContext) => Layer.Layer<infer Provides, never, infer Requires>) ? Requires | Exclude<T extends {
1236
+ readonly agent: infer A extends ExecutableAgentBinding;
1237
+ } ? DurableWorkerRequirements<A> : T extends {
1238
+ readonly agent: infer D extends Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined> & {
1239
+ readonly instructions: InstructionSource<never, unknown, unknown>;
1240
+ readonly inputPrompt?: InputPromptSource<never, unknown, unknown> | undefined;
1241
+ };
1242
+ readonly model: infer M extends ExecutableAgentBinding["model"];
1243
+ } ? DurableWorkerRequirements<{
1244
+ readonly definition: D;
1245
+ readonly model: M;
1246
+ }> : never, Provides> : T extends {
1247
+ readonly agent: infer A extends ExecutableAgentBinding;
1248
+ } ? DurableWorkerRequirements<A> : T extends {
1249
+ readonly agent: infer D extends Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined> & {
1250
+ readonly instructions: InstructionSource<never, unknown, unknown>;
1251
+ readonly inputPrompt?: InputPromptSource<never, unknown, unknown> | undefined;
1252
+ };
1253
+ readonly model: infer M extends ExecutableAgentBinding["model"];
1254
+ } ? DurableWorkerRequirements<{
1255
+ readonly definition: D;
1256
+ readonly model: M;
1257
+ }> : never : never : never : never : never : never, Scope.Scope>>;
1258
+ /** Construct from precompiled registrations whose captured resources belong to the caller's Scope. */
1259
+ static layerWithBindings(bindings: ReadonlyArray<ResolvedBinding>): Layer.Layer<DurableAgentRuntime, never, Crypto.Crypto | DurableRuntimeConfig | DurableRuntimeFailpoint | RunToolAuthorization | SubmissionLedger | ThreadStore | ToolReconciler | WakeScheduler>;
1260
+ /** Captures optional context preparation; Tool authorization remains required in `R`. */
1261
+ static readonly layerWithServices: Layer.Layer<DurableAgentRuntime, never, SubmissionLedger | ThreadStore | WakeScheduler | DurableRuntimeFailpoint | DurableRuntimeConfig | ToolReconciler | RunToolAuthorization | Crypto.Crypto>;
1262
+ /** Compatible defaults: no host prompt transformation and allow-all Tool authorization. */
1263
+ static readonly layer: Layer.Layer<DurableAgentRuntime, never, SubmissionLedger | ThreadStore | WakeScheduler | DurableRuntimeFailpoint | DurableRuntimeConfig | ToolReconciler | Crypto.Crypto>;
1264
+ }
1265
+ declare namespace SubmissionLedger_d_exports {
1266
+ export { AbortCommand, AbortIntent, AbortIntentRequest, AdmissionAdmitted, AdmissionConflict, AdmissionFence, AdmissionGroup, AdmissionIndeterminate, AdmissionNotAdmitted, AdmissionPolicyError, AdmissionRequest, AdmissionResolution, AdmissionResult, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, ApprovalPendingSuspension, AttachChildToReservationRequest, BeginChildBudgetReleaseRequest, ChildAttachmentSnapshot, ChildBudgetReservationRequest, ChildBudgetReservationSnapshot, ChildReservationConflict, ChildReservationId, ChildReservationStatus, ChildSettledNotification, ChildSettledOutcome, Claim, ClaimJoiningRequest, ClaimRequest, DEFAULT_OWNERSHIP_LEASE_DURATION, IdempotencyKey, InputAppliedMarker, JoinSnapshot, JoinedToHost, JoiningClaim, LedgerCapabilities, LedgerError, MarkInputAppliedRequest, MarkJoinedRequest, MarkReadyRequest, MarkUnknownRequest, OwnershipLost, OwnershipRenewal, OwnershipSnapshot, OwnershipToken, ParentLinkage, Principal, QueueSequence, RecoverySnapshot, RecoverySnapshotRequest, ReleaseChildBudgetRequest, ReleaseOwnershipRequest, RenewOwnershipRequest, ReservedChildBudget, ReservedSettlement, ResolutionAbortSubmission, ResolutionCompletedWithResult, ResolutionNeverHappened, ResolutionSafeToRetry, RevertJoiningRequest, Settlement, SettlementConflict, SettlementFinalization, SettlementReservation, SettlementReservationSnapshot, SubmissionAdmissionFence, SubmissionLedger, SubmissionLedgerFailure, SubmissionLookup, SubmissionLookupById, SubmissionLookupByKey, SubmissionSnapshot, SubmissionState, SubmissionWorkItem, SuspendRequest, SuspensionOutcome, SuspensionReason, SuspensionSnapshot, UnknownResolution, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent, WaitingChild, WaitingForChildSuspension, WorkerLedgerState, WorkerStopCommand, settlementFailureFromRecord, submissionAbortBatchId, submissionAbortRecordId, submissionInputBatchId, submissionInputRecordId, submissionSettlementBatchId, submissionSettlementId, submissionSettlementRecordId, workerTerminalFromRecord };
1267
+ }
1268
+ /**
1269
+ * Opaque proof that one Attempt currently owns a Submission's lane. It authorizes ledger
1270
+ * mutations only; canonical-log fencing authority remains the producer epoch (DUR-006).
1271
+ */
1272
+ declare const OwnershipToken: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/OwnershipToken">;
1273
+ type OwnershipToken = typeof OwnershipToken.Type;
1274
+ /**
1275
+ * Ledger lifecycle states for one Submission. `settled` is the only terminal state; every other
1276
+ * state carries an outstanding accepted-work obligation (Accepted-work Contract, DUR-002).
1277
+ *
1278
+ * Phase 5 states:
1279
+ *
1280
+ * - `joining` — a queued Submission claimed by an active host Run, before its canonical
1281
+ * `UserInputRecorded` append; recovery reverts it to `ready` (DUR-016).
1282
+ * - `joined` — the input is canonical and linked to its host; the Submission settles WITH the
1283
+ * host Run's outcome.
1284
+ * - `suspended` — durably waiting for explicit approval decisions; the ownership period has
1285
+ * ended and the lane consumes no worker permit while the obligation stays owed.
1286
+ * - `unknown` — at least one Tool Call has a durable Unknown Outcome; this Submission is
1287
+ * parked until an authorized resolution covers every open call or a durable abort intent
1288
+ * authorizes cleanup without Tool replay. Later eligible input may run (DUR-012/DUR-017).
1289
+ *
1290
+ * `claim` never grants or bypasses a `joining`, `joined`, or `suspended` head. It skips unknown
1291
+ * work without an abort intent. Any live ownership in the Thread prevents another claim.
1292
+ */
1293
+ declare const SubmissionState: Schema.Literals<readonly ["admitted", "ready", "joining", "joined", "running", "input-applied", "suspended", "unknown", "terminalizing", "settled"]>;
1294
+ type SubmissionState = typeof SubmissionState.Type;
1295
+ /**
1296
+ * Default ownership lease duration (D5). The lease is a liveness hint that makes an abandoned
1297
+ * claim reclaimable; correctness never depends on it because every canonical append is fenced by
1298
+ * producer epoch. Adapters expose this as configuration and use this value when unconfigured.
1299
+ */
1300
+ declare const DEFAULT_OWNERSHIP_LEASE_DURATION: Duration.Duration;
1301
+ declare const LedgerCapabilities_base: Schema.Class<LedgerCapabilities, Schema.Struct<{
1302
+ readonly durability: Schema.Literals<readonly ["durable-node", "durable-cloudflare", "non-durable"]>;
1303
+ }>, {}>;
1304
+ /**
1305
+ * What a SubmissionLedger adapter claims about itself. `durable-node` asserts single-node
1306
+ * process-crash durability (fsync-backed storage); `durable-cloudflare` asserts the same
1307
+ * single-serialized-owner crash durability through Durable Object storage output gates;
1308
+ * `non-durable` marks reference adapters whose state does not survive the process (in-memory
1309
+ * conformance/test adapters). The label is an honest self-description for reports and
1310
+ * evidence — no runtime behavior branches on it.
1311
+ */
1312
+ declare class LedgerCapabilities extends LedgerCapabilities_base {}
1313
+ declare const ParentLinkage_base: Schema.Class<ParentLinkage, Schema.Struct<{
1314
+ readonly parentSubmissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1315
+ readonly parentToolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
1316
+ }>, {}>;
1317
+ /**
1318
+ * Immutable lineage from a child Submission to the exact parent Tool Call that established it
1319
+ * (spec §12 step 5, SUB-004). Recorded once at admission and never rewritten; it is an
1320
+ * identifier, not an authorization capability (D10) — the join path verifies the canonical
1321
+ * Parent Link records, never this marker alone.
1322
+ */
1323
+ declare class ParentLinkage extends ParentLinkage_base {}
1324
+ /** Host-owned policy coordinates, interpreted only by the destination transaction owner. */
1325
+ declare const AdmissionFence: Schema.Struct<{
1326
+ readonly policyId: Schema.NonEmptyString;
1327
+ readonly key: Schema.NonEmptyString;
1328
+ readonly revision: Schema.NonEmptyString;
1329
+ }>;
1330
+ type AdmissionFence = typeof AdmissionFence.Type;
1331
+ declare const AdmissionGroup: Schema.NonEmptyString;
1332
+ declare const AdmissionPolicyError_base: Schema.Class<AdmissionPolicyError, Schema.TaggedStruct<"AdmissionPolicyError", {
1333
+ readonly reason: Schema.Literals<readonly ["refused", "unavailable", "occupied"]>;
1334
+ readonly code: Schema.NonEmptyString;
1335
+ readonly cause: Schema.optionalKey<Schema.decodeTo<Schema.Unknown, Schema.Codec<Diagnostic, Diagnostic, never, never>, never, never>>;
1336
+ readonly stack: Schema.optionalKey<Schema.String>;
1337
+ }>, import("effect/Cause").YieldableError>;
1338
+ /** Fresh admission alone may be refused; unavailability never proves non-admission. */
1339
+ declare class AdmissionPolicyError extends AdmissionPolicyError_base {}
1340
+ declare const AdmissionRequest_base: Schema.Class<AdmissionRequest, Schema.Struct<{
1341
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1342
+ readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
1343
+ readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1344
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1345
+ readonly agentDigests: typeof DefinitionDigests;
1346
+ readonly deploymentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/DeploymentId">;
1347
+ readonly inputPayload: Schema.declare<Schema.Json, Schema.Json>;
1348
+ readonly inputDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
1349
+ readonly parentLinkage: Schema.optionalKey<typeof ParentLinkage>;
1350
+ readonly workerAdmission: Schema.optionalKey<Schema.Struct<{
1351
+ readonly origin: Schema.Struct<{
1352
+ readonly worker: Schema.Struct<{
1353
+ readonly schemaVersion: Schema.Literal<1>;
1354
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1355
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1356
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1357
+ }>;
1358
+ readonly source: Schema.Union<readonly [Schema.Struct<{
1359
+ readonly _tag: Schema.Literal<"tool">;
1360
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1361
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1362
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1363
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
1364
+ }>, Schema.Struct<{
1365
+ readonly _tag: Schema.Literal<"programmatic">;
1366
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1367
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1368
+ }>]>;
1369
+ readonly continuationOf: Schema.optionalKey<Schema.Struct<{
1370
+ readonly worker: Schema.Struct<{
1371
+ readonly schemaVersion: Schema.Literal<1>;
1372
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1373
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1374
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1375
+ }>;
1376
+ readonly receipt: typeof Receipt;
1377
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1378
+ }>>;
1379
+ readonly budgetScope: Schema.optionalKey<Schema.Literals<readonly ["source-subtree", "worker-run"]>>;
1380
+ readonly lifecycle: Schema.optionalKey<Schema.Literal<"assignment">>;
1381
+ readonly targetDigests: typeof DefinitionDigests;
1382
+ readonly policy: Schema.toCodecJson<typeof AgentPolicy>;
1383
+ readonly budget: Schema.Struct<{
1384
+ readonly caps: typeof SubagentDelegationCaps;
1385
+ readonly allocation: typeof SubagentReservationAmounts;
1386
+ readonly descendantInvocations: Schema.optionalKey<Schema.Natural>;
1387
+ }>;
1388
+ readonly grant: typeof SubagentGrant;
1389
+ readonly depth: Schema.Int;
1390
+ readonly toolCallAllowance: Schema.optionalKey<Schema.Int>;
1391
+ readonly firstMessageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1392
+ readonly createdAtMillis: Schema.Natural;
1393
+ readonly expiresAtMillis: Schema.Natural;
1394
+ readonly reporting: Schema.optionalKey<Schema.Struct<{
1395
+ readonly mode: Schema.optionalKey<Schema.Literal<"standard">>;
1396
+ readonly sourceDigests: typeof DefinitionDigests;
1397
+ readonly destinationDelegationId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">>;
1398
+ readonly returnAddress: Schema.optionalKey<Schema.Struct<{
1399
+ readonly input: Schema.declare<Schema.Json, Schema.Json>;
1400
+ readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
1401
+ readonly policy: Schema.toCodecJson<typeof AgentPolicy>;
1402
+ readonly depth: Schema.Natural;
1403
+ readonly grant: Schema.optionalKey<typeof SubagentGrant>;
1404
+ readonly workerAdmission: Schema.optionalKey<Schema.declare<Schema.Json, Schema.Json>>;
1405
+ }>>;
1406
+ }>>;
1407
+ }>;
1408
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1409
+ readonly parameters: Schema.declare<Schema.Json, Schema.Json>;
1410
+ readonly createdAtMillis: Schema.Natural;
1411
+ readonly sourceSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
1412
+ readonly deliveryPrincipal: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">>;
1413
+ readonly reportKind: Schema.optionalKey<Schema.Literal<"update">>;
1414
+ }>>;
1415
+ readonly messageAdmission: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
1416
+ readonly schemaVersion: Schema.Literal<1>;
1417
+ readonly message: Schema.Struct<{
1418
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1419
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1420
+ }>;
1421
+ readonly peerName: Schema.NonEmptyString;
1422
+ readonly sender: Schema.Struct<{
1423
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1424
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1425
+ }>;
1426
+ readonly returnAddress: Schema.Struct<{
1427
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1428
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1429
+ }>;
1430
+ readonly inReplyTo: Schema.optionalKey<Schema.Struct<{
1431
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1432
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1433
+ }>>;
1434
+ }>, Schema.Union<readonly [Schema.Struct<{
1435
+ readonly _tag: Schema.Literal<"WorkerCompletion">;
1436
+ readonly budgetExhausted: Schema.Boolean;
1437
+ readonly schemaVersion: Schema.Literal<1>;
1438
+ readonly report: Schema.Union<readonly [Schema.Struct<{
1439
+ readonly _tag: Schema.Literal<"Settled">;
1440
+ readonly worker: Schema.Struct<{
1441
+ readonly schemaVersion: Schema.Literal<1>;
1442
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1443
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1444
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1445
+ }>;
1446
+ readonly receipt: typeof Receipt;
1447
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1448
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1449
+ readonly outcome: Schema.Literal<"completed">;
1450
+ readonly result: Schema.Union<readonly [Schema.Codec<Schema.Json, Schema.Json, never, never>]>;
1451
+ }>, Schema.Struct<{
1452
+ readonly _tag: Schema.Literal<"Settled">;
1453
+ readonly worker: Schema.Struct<{
1454
+ readonly schemaVersion: Schema.Literal<1>;
1455
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1456
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1457
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1458
+ }>;
1459
+ readonly receipt: typeof Receipt;
1460
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1461
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1462
+ readonly outcome: Schema.Literals<readonly ["failed", "aborted"]>;
1463
+ readonly failure: typeof SubagentExecutionFailure;
1464
+ }>]>;
1465
+ }>, Schema.Struct<{
1466
+ readonly _tag: Schema.Literal<"WorkerUpdate">;
1467
+ readonly schemaVersion: Schema.Literal<1>;
1468
+ readonly worker: Schema.Struct<{
1469
+ readonly schemaVersion: Schema.Literal<1>;
1470
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1471
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1472
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1473
+ }>;
1474
+ readonly update: typeof Update;
1475
+ }>]>]>>;
1476
+ readonly admissionGroup: Schema.optionalKey<Schema.NonEmptyString>;
1477
+ readonly admissionFence: Schema.optionalKey<Schema.Struct<{
1478
+ readonly policyId: Schema.NonEmptyString;
1479
+ readonly key: Schema.NonEmptyString;
1480
+ readonly revision: Schema.NonEmptyString;
1481
+ }>>;
1482
+ }>, {}>;
1483
+ /**
1484
+ * Durable admission input. `inputDigest` must be the digest of the canonical JSON encoding of
1485
+ * `inputPayload` (see `digestJson`); admission idempotency compares digests, never re-encodes.
1486
+ * `agentId`/`agentDigests`/`deploymentId` are persisted so recovery can complete Thread
1487
+ * materialization without the submitting client. `parentLinkage` is present exactly when the
1488
+ * Submission is a durable attached child (spec §12); an admission replay must repeat the same
1489
+ * linkage (or its absence) or fail with `AdmissionConflict`.
1490
+ */
1491
+ declare class AdmissionRequest extends AdmissionRequest_base {}
1492
+ declare const AdmissionResult_base: Schema.Class<AdmissionResult, Schema.Struct<{
1493
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1494
+ readonly receiptId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ReceiptId">;
1495
+ readonly queueSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/QueueSequence">;
1496
+ readonly state: Schema.Literals<readonly ["admitted", "ready", "joining", "joined", "running", "input-applied", "suspended", "unknown", "terminalizing", "settled"]>;
1497
+ readonly replayed: Schema.Boolean;
1498
+ }>, {}>;
1499
+ /**
1500
+ * The committed admission row. `replayed` is true when an identical (thread, principal,
1501
+ * idempotencyKey, inputDigest) admission already existed; the original identities are returned
1502
+ * unchanged so a client retry resumes rather than duplicates (DUR-001).
1503
+ */
1504
+ declare class AdmissionResult extends AdmissionResult_base {}
1505
+ declare const MarkReadyRequest_base: Schema.Class<MarkReadyRequest, Schema.Struct<{
1506
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1507
+ }>, {}>;
1508
+ declare class MarkReadyRequest extends MarkReadyRequest_base {}
1509
+ declare const SubmissionLookupById_base: Schema.Class<SubmissionLookupById, Schema.TaggedStruct<"SubmissionLookupById", {
1510
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1511
+ }>, {}>;
1512
+ declare class SubmissionLookupById extends SubmissionLookupById_base {}
1513
+ declare const SubmissionLookupByKey_base: Schema.Class<SubmissionLookupByKey, Schema.TaggedStruct<"SubmissionLookupByKey", {
1514
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1515
+ readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
1516
+ readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1517
+ }>, {}>;
1518
+ declare class SubmissionLookupByKey extends SubmissionLookupByKey_base {}
1519
+ /** Lookup by Submission identity or by the scoped client idempotency key. */
1520
+ declare const SubmissionLookup: Schema.Union<readonly [typeof SubmissionLookupById, typeof SubmissionLookupByKey]>;
1521
+ type SubmissionLookup = typeof SubmissionLookup.Type;
1522
+ declare const SubmissionWorkItem_base: Schema.Class<SubmissionWorkItem, Schema.Struct<{
1523
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1524
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1525
+ readonly queueSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/QueueSequence">;
1526
+ readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
1527
+ readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1528
+ readonly deploymentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/DeploymentId">;
1529
+ readonly receiptId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ReceiptId">;
1530
+ readonly state: Schema.Literals<readonly ["admitted", "ready", "joining", "joined", "running", "input-applied", "suspended", "unknown", "terminalizing", "settled"]>;
1531
+ }>, {}>;
1532
+ /**
1533
+ * Control-only worklist entry. Discovery validates identities, ordering and state without
1534
+ * decoding retained execution payloads. Hydrate only the selected Thread through `lookup`
1535
+ * or `loadRecoverySnapshot`, inside its recovery failure boundary.
1536
+ */
1537
+ declare class SubmissionWorkItem extends SubmissionWorkItem_base {}
1538
+ declare const SubmissionSnapshot_base: Schema.Class<SubmissionSnapshot, Schema.Struct<{
1539
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1540
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1541
+ readonly queueSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/QueueSequence">;
1542
+ readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
1543
+ readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1544
+ readonly deploymentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/DeploymentId">;
1545
+ readonly receiptId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ReceiptId">;
1546
+ readonly state: Schema.Literals<readonly ["admitted", "ready", "joining", "joined", "running", "input-applied", "suspended", "unknown", "terminalizing", "settled"]>;
1547
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1548
+ readonly agentDigests: typeof DefinitionDigests;
1549
+ readonly inputPayload: Schema.declare<Schema.Json, Schema.Json>;
1550
+ readonly inputDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
1551
+ readonly settledOutcome: Schema.optionalKey<Schema.Literals<readonly ["completed", "failed", "aborted"]>>;
1552
+ readonly createdAt: Schema.DateTimeUtcFromString;
1553
+ readonly readyAt: Schema.optionalKey<Schema.DateTimeUtcFromString>;
1554
+ readonly admissionGroup: Schema.optionalKey<Schema.NonEmptyString>;
1555
+ readonly admissionFence: Schema.optionalKey<Schema.Struct<{
1556
+ readonly policyId: Schema.NonEmptyString;
1557
+ readonly key: Schema.NonEmptyString;
1558
+ readonly revision: Schema.NonEmptyString;
1559
+ }>>;
1560
+ readonly parentLinkage: Schema.optionalKey<typeof ParentLinkage>;
1561
+ readonly workerAdmission: Schema.optionalKey<Schema.Struct<{
1562
+ readonly origin: Schema.Struct<{
1563
+ readonly worker: Schema.Struct<{
1564
+ readonly schemaVersion: Schema.Literal<1>;
1565
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1566
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1567
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1568
+ }>;
1569
+ readonly source: Schema.Union<readonly [Schema.Struct<{
1570
+ readonly _tag: Schema.Literal<"tool">;
1571
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1572
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1573
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1574
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
1575
+ }>, Schema.Struct<{
1576
+ readonly _tag: Schema.Literal<"programmatic">;
1577
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1578
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1579
+ }>]>;
1580
+ readonly continuationOf: Schema.optionalKey<Schema.Struct<{
1581
+ readonly worker: Schema.Struct<{
1582
+ readonly schemaVersion: Schema.Literal<1>;
1583
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1584
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1585
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1586
+ }>;
1587
+ readonly receipt: typeof Receipt;
1588
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1589
+ }>>;
1590
+ readonly budgetScope: Schema.optionalKey<Schema.Literals<readonly ["source-subtree", "worker-run"]>>;
1591
+ readonly lifecycle: Schema.optionalKey<Schema.Literal<"assignment">>;
1592
+ readonly targetDigests: typeof DefinitionDigests;
1593
+ readonly policy: Schema.toCodecJson<typeof AgentPolicy>;
1594
+ readonly budget: Schema.Struct<{
1595
+ readonly caps: typeof SubagentDelegationCaps;
1596
+ readonly allocation: typeof SubagentReservationAmounts;
1597
+ readonly descendantInvocations: Schema.optionalKey<Schema.Natural>;
1598
+ }>;
1599
+ readonly grant: typeof SubagentGrant;
1600
+ readonly depth: Schema.Int;
1601
+ readonly toolCallAllowance: Schema.optionalKey<Schema.Int>;
1602
+ readonly firstMessageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1603
+ readonly createdAtMillis: Schema.Natural;
1604
+ readonly expiresAtMillis: Schema.Natural;
1605
+ readonly reporting: Schema.optionalKey<Schema.Struct<{
1606
+ readonly mode: Schema.optionalKey<Schema.Literal<"standard">>;
1607
+ readonly sourceDigests: typeof DefinitionDigests;
1608
+ readonly destinationDelegationId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">>;
1609
+ readonly returnAddress: Schema.optionalKey<Schema.Struct<{
1610
+ readonly input: Schema.declare<Schema.Json, Schema.Json>;
1611
+ readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
1612
+ readonly policy: Schema.toCodecJson<typeof AgentPolicy>;
1613
+ readonly depth: Schema.Natural;
1614
+ readonly grant: Schema.optionalKey<typeof SubagentGrant>;
1615
+ readonly workerAdmission: Schema.optionalKey<Schema.declare<Schema.Json, Schema.Json>>;
1616
+ }>>;
1617
+ }>>;
1618
+ }>;
1619
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1620
+ readonly parameters: Schema.declare<Schema.Json, Schema.Json>;
1621
+ readonly createdAtMillis: Schema.Natural;
1622
+ readonly sourceSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
1623
+ readonly deliveryPrincipal: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">>;
1624
+ readonly reportKind: Schema.optionalKey<Schema.Literal<"update">>;
1625
+ }>>;
1626
+ readonly messageAdmission: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
1627
+ readonly schemaVersion: Schema.Literal<1>;
1628
+ readonly message: Schema.Struct<{
1629
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1630
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1631
+ }>;
1632
+ readonly peerName: Schema.NonEmptyString;
1633
+ readonly sender: Schema.Struct<{
1634
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1635
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1636
+ }>;
1637
+ readonly returnAddress: Schema.Struct<{
1638
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1639
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1640
+ }>;
1641
+ readonly inReplyTo: Schema.optionalKey<Schema.Struct<{
1642
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1643
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1644
+ }>>;
1645
+ }>, Schema.Union<readonly [Schema.Struct<{
1646
+ readonly _tag: Schema.Literal<"WorkerCompletion">;
1647
+ readonly budgetExhausted: Schema.Boolean;
1648
+ readonly schemaVersion: Schema.Literal<1>;
1649
+ readonly report: Schema.Union<readonly [Schema.Struct<{
1650
+ readonly _tag: Schema.Literal<"Settled">;
1651
+ readonly worker: Schema.Struct<{
1652
+ readonly schemaVersion: Schema.Literal<1>;
1653
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1654
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1655
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1656
+ }>;
1657
+ readonly receipt: typeof Receipt;
1658
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1659
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1660
+ readonly outcome: Schema.Literal<"completed">;
1661
+ readonly result: Schema.Union<readonly [Schema.Codec<Schema.Json, Schema.Json, never, never>]>;
1662
+ }>, Schema.Struct<{
1663
+ readonly _tag: Schema.Literal<"Settled">;
1664
+ readonly worker: Schema.Struct<{
1665
+ readonly schemaVersion: Schema.Literal<1>;
1666
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1667
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1668
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1669
+ }>;
1670
+ readonly receipt: typeof Receipt;
1671
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1672
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1673
+ readonly outcome: Schema.Literals<readonly ["failed", "aborted"]>;
1674
+ readonly failure: typeof SubagentExecutionFailure;
1675
+ }>]>;
1676
+ }>, Schema.Struct<{
1677
+ readonly _tag: Schema.Literal<"WorkerUpdate">;
1678
+ readonly schemaVersion: Schema.Literal<1>;
1679
+ readonly worker: Schema.Struct<{
1680
+ readonly schemaVersion: Schema.Literal<1>;
1681
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1682
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1683
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1684
+ }>;
1685
+ readonly update: typeof Update;
1686
+ }>]>]>>;
1687
+ }>, {}>;
1688
+ /** The full durable ledger view of one Submission. */
1689
+ declare class SubmissionSnapshot extends SubmissionSnapshot_base {}
1690
+ /** Bounded native control facts. Canonical input/Run records remain ThreadStore-owned. */
1691
+ declare const WorkerLedgerState: Schema.Struct<{
1692
+ readonly latest: Schema.NullOr<typeof SubmissionSnapshot>;
1693
+ readonly active: Schema.NullOr<typeof SubmissionSnapshot>;
1694
+ readonly stopped: Schema.Boolean;
1695
+ readonly terminal: Schema.optionalKey<Schema.Literals<readonly ["completed", "failed", "cancelled"]>>;
1696
+ }>;
1697
+ type WorkerLedgerState = typeof WorkerLedgerState.Type;
1698
+ declare const AdmissionNotAdmitted_base: Schema.Class<AdmissionNotAdmitted, Schema.TaggedStruct<"NotAdmitted", {}>, {}>;
1699
+ /** The authoritative store proves the scoped idempotency key was never admitted (SUB-031). */
1700
+ declare class AdmissionNotAdmitted extends AdmissionNotAdmitted_base {}
1701
+ declare const AdmissionAdmitted_base: Schema.Class<AdmissionAdmitted, Schema.TaggedStruct<"Admitted", {
1702
+ readonly submission: typeof SubmissionSnapshot;
1703
+ }>, {}>;
1704
+ /** The scoped idempotency key was admitted; the full Submission snapshot is authoritative. */
1705
+ declare class AdmissionAdmitted extends AdmissionAdmitted_base {}
1706
+ declare const AdmissionIndeterminate_base: Schema.Class<AdmissionIndeterminate, Schema.TaggedStruct<"Indeterminate", {
1707
+ readonly reason: Schema.String;
1708
+ }>, {}>;
1709
+ /**
1710
+ * The adapter cannot currently prove admission or its absence (e.g. the authoritative child
1711
+ * owner is unreachable on a partitioned platform). Callers wait and retry; an indeterminate
1712
+ * answer NEVER permits a second admission attempt (SUB-031).
1713
+ */
1714
+ declare class AdmissionIndeterminate extends AdmissionIndeterminate_base {}
1715
+ /**
1716
+ * The tri-state answer of `resolveAdmission` (spec §12: "absence from an eventually consistent
1717
+ * projection is never proof"). Single strongly consistent stores derive `NotAdmitted`/`Admitted`
1718
+ * from a direct lookup; only adapters that can genuinely fail to reach the authoritative owner
1719
+ * answer `Indeterminate`.
1720
+ */
1721
+ declare const AdmissionResolution: Schema.Union<readonly [typeof AdmissionNotAdmitted, typeof AdmissionAdmitted, typeof AdmissionIndeterminate]>;
1722
+ type AdmissionResolution = typeof AdmissionResolution.Type;
1723
+ declare const ClaimRequest_base: Schema.Class<ClaimRequest, Schema.Struct<{
1724
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1725
+ readonly producerId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ProducerId">;
1726
+ }>, {}>;
1727
+ declare class ClaimRequest extends ClaimRequest_base {}
1728
+ declare const Claim_base: Schema.Class<Claim, Schema.Struct<{
1729
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1730
+ readonly attemptId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AttemptId">;
1731
+ readonly ownershipToken: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/OwnershipToken">;
1732
+ readonly producerEpoch: Schema.brand<Schema.Natural, "@effect-agent/thread/ProducerEpoch">;
1733
+ readonly leaseExpiresAt: Schema.DateTimeUtcFromString;
1734
+ readonly inputPayload: Schema.declare<Schema.Json, Schema.Json>;
1735
+ }>, {}>;
1736
+ /**
1737
+ * One granted ownership period. `producerEpoch` is the fencing token for every canonical append
1738
+ * this Attempt performs; `leaseExpiresAt` is when the claim becomes reclaimable unless renewed.
1739
+ */
1740
+ declare class Claim extends Claim_base {}
1741
+ declare const RenewOwnershipRequest_base: Schema.Class<RenewOwnershipRequest, Schema.Struct<{
1742
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1743
+ readonly ownershipToken: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/OwnershipToken">;
1744
+ }>, {}>;
1745
+ declare class RenewOwnershipRequest extends RenewOwnershipRequest_base {}
1746
+ declare const OwnershipRenewal_base: Schema.Class<OwnershipRenewal, Schema.Struct<{
1747
+ readonly ownershipToken: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/OwnershipToken">;
1748
+ readonly leaseExpiresAt: Schema.DateTimeUtcFromString;
1749
+ }>, {}>;
1750
+ /**
1751
+ * A renewed lease. Adapters MAY rotate the token; callers must use the returned token for every
1752
+ * later ledger mutation.
1753
+ */
1754
+ declare class OwnershipRenewal extends OwnershipRenewal_base {}
1755
+ declare const ReleaseOwnershipRequest_base: Schema.Class<ReleaseOwnershipRequest, Schema.Struct<{
1756
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1757
+ readonly ownershipToken: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/OwnershipToken">;
1758
+ }>, {}>;
1759
+ declare class ReleaseOwnershipRequest extends ReleaseOwnershipRequest_base {}
1760
+ declare const MarkInputAppliedRequest_base: Schema.Class<MarkInputAppliedRequest, Schema.Struct<{
1761
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1762
+ readonly ownershipToken: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/OwnershipToken">;
1763
+ readonly recordId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/RecordId">;
1764
+ readonly sequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
1765
+ }>, {}>;
1766
+ /**
1767
+ * The canonical position of the applied `UserInputRecorded` record for one Submission.
1768
+ */
1769
+ declare class MarkInputAppliedRequest extends MarkInputAppliedRequest_base {}
1770
+ declare const InputAppliedMarker_base: Schema.Class<InputAppliedMarker, Schema.Struct<{
1771
+ readonly recordId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/RecordId">;
1772
+ readonly sequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
1773
+ }>, {}>;
1774
+ declare class InputAppliedMarker extends InputAppliedMarker_base {}
1775
+ declare const SettlementReservation_base: Schema.Class<SettlementReservation, Schema.Struct<{
1776
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1777
+ readonly ownershipToken: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/OwnershipToken">;
1778
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1779
+ readonly outcome: Schema.Literals<readonly ["completed", "failed", "aborted"]>;
1780
+ readonly record: typeof RecordEnvelope;
1781
+ readonly recordDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
1782
+ }>, {}>;
1783
+ /**
1784
+ * Reservation of the single exact settlement record for one Submission (DUR-011). `record` is
1785
+ * the complete canonical envelope that will be appended — including `createdAt` — so a recovering
1786
+ * Attempt can re-append byte-identical content without a batch-digest conflict. `recordDigest`
1787
+ * must be the digest of the canonical JSON encoding of the Schema-encoded envelope.
1788
+ */
1789
+ declare class SettlementReservation extends SettlementReservation_base {}
1790
+ declare const ReservedSettlement_base: Schema.Class<ReservedSettlement, Schema.Struct<{
1791
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1792
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1793
+ readonly outcome: Schema.Literals<readonly ["completed", "failed", "aborted"]>;
1794
+ readonly record: typeof RecordEnvelope;
1795
+ readonly recordDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
1796
+ readonly replayed: Schema.Boolean;
1797
+ }>, {}>;
1798
+ /**
1799
+ * The committed reservation. `replayed` is true when an identical reservation already existed;
1800
+ * the stored exact record is returned so recovery appends precisely what was reserved.
1801
+ */
1802
+ declare class ReservedSettlement extends ReservedSettlement_base {}
1803
+ declare const SettlementFinalization_base: Schema.Class<SettlementFinalization, Schema.Struct<{
1804
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1805
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1806
+ }>, {}>;
1807
+ declare class SettlementFinalization extends SettlementFinalization_base {}
1808
+ declare const Settlement_base: Schema.Class<Settlement, Schema.Struct<{
1809
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1810
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1811
+ readonly receiptId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ReceiptId">;
1812
+ readonly outcome: Schema.Literals<readonly ["completed", "failed", "aborted"]>;
1813
+ /** Schema-encoded application disposition materialized from the exact canonical reservation. */
1814
+ readonly runDisposition: Schema.optionalKey<Schema.declare<Schema.Json, Schema.Json>>;
1815
+ /** Canonical aggregate of model usage and estimated spend for this Run. */
1816
+ readonly usageSummary: Schema.optionalKey<typeof RunUsageSummary>;
1817
+ /** Present exactly for `failed`; its Schema rejects excess keys before canonical projection. */
1818
+ readonly failure: Schema.optionalKey<Schema.declareConstructor<{
1819
+ readonly errorTag: string;
1820
+ readonly message: string;
1821
+ readonly diagnostic?: Diagnostic | undefined;
1822
+ readonly context?: {
1823
+ readonly agentId?: string | undefined;
1824
+ readonly threadId?: string | undefined;
1825
+ readonly runId?: string | undefined;
1826
+ readonly submissionId?: string | undefined;
1827
+ readonly attemptId?: string | undefined;
1828
+ readonly turnId?: string | undefined;
1829
+ readonly toolCallId?: string | undefined;
1830
+ readonly toolName?: string | undefined;
1831
+ readonly callId?: string | undefined;
1832
+ readonly check?: string | undefined;
1833
+ readonly operation?: string | undefined;
1834
+ } | undefined;
1835
+ }, {
1836
+ readonly errorTag: string;
1837
+ readonly message: string;
1838
+ readonly diagnostic?: Diagnostic | undefined;
1839
+ readonly context?: {
1840
+ readonly agentId?: string | undefined;
1841
+ readonly threadId?: string | undefined;
1842
+ readonly runId?: string | undefined;
1843
+ readonly submissionId?: string | undefined;
1844
+ readonly attemptId?: string | undefined;
1845
+ readonly turnId?: string | undefined;
1846
+ readonly toolCallId?: string | undefined;
1847
+ readonly toolName?: string | undefined;
1848
+ readonly callId?: string | undefined;
1849
+ readonly check?: string | undefined;
1850
+ readonly operation?: string | undefined;
1851
+ } | undefined;
1852
+ }, readonly [Schema.Struct<{
1853
+ readonly errorTag: Schema.NonEmptyString;
1854
+ readonly message: Schema.String;
1855
+ readonly diagnostic: Schema.optionalKey<Schema.Codec<Diagnostic, Diagnostic, never, never>>;
1856
+ readonly context: Schema.optionalKey<Schema.declareConstructor<{
1857
+ readonly agentId?: string | undefined;
1858
+ readonly threadId?: string | undefined;
1859
+ readonly runId?: string | undefined;
1860
+ readonly submissionId?: string | undefined;
1861
+ readonly attemptId?: string | undefined;
1862
+ readonly turnId?: string | undefined;
1863
+ readonly toolCallId?: string | undefined;
1864
+ readonly toolName?: string | undefined;
1865
+ readonly callId?: string | undefined;
1866
+ readonly check?: string | undefined;
1867
+ readonly operation?: string | undefined;
1868
+ }, {
1869
+ readonly agentId?: string | undefined;
1870
+ readonly threadId?: string | undefined;
1871
+ readonly runId?: string | undefined;
1872
+ readonly submissionId?: string | undefined;
1873
+ readonly attemptId?: string | undefined;
1874
+ readonly turnId?: string | undefined;
1875
+ readonly toolCallId?: string | undefined;
1876
+ readonly toolName?: string | undefined;
1877
+ readonly callId?: string | undefined;
1878
+ readonly check?: string | undefined;
1879
+ readonly operation?: string | undefined;
1880
+ }, readonly [Schema.Struct<{
1881
+ readonly agentId: Schema.optionalKey<Schema.String>;
1882
+ readonly threadId: Schema.optionalKey<Schema.String>;
1883
+ readonly runId: Schema.optionalKey<Schema.String>;
1884
+ readonly submissionId: Schema.optionalKey<Schema.String>;
1885
+ readonly attemptId: Schema.optionalKey<Schema.String>;
1886
+ readonly turnId: Schema.optionalKey<Schema.String>;
1887
+ readonly toolCallId: Schema.optionalKey<Schema.String>;
1888
+ readonly toolName: Schema.optionalKey<Schema.String>;
1889
+ readonly callId: Schema.optionalKey<Schema.String>;
1890
+ readonly check: Schema.optionalKey<Schema.String>;
1891
+ readonly operation: Schema.optionalKey<Schema.String>;
1892
+ }>], {
1893
+ readonly agentId?: string | undefined;
1894
+ readonly threadId?: string | undefined;
1895
+ readonly runId?: string | undefined;
1896
+ readonly submissionId?: string | undefined;
1897
+ readonly attemptId?: string | undefined;
1898
+ readonly turnId?: string | undefined;
1899
+ readonly toolCallId?: string | undefined;
1900
+ readonly toolName?: string | undefined;
1901
+ readonly callId?: string | undefined;
1902
+ readonly check?: string | undefined;
1903
+ readonly operation?: string | undefined;
1904
+ }>>;
1905
+ }>], {
1906
+ readonly errorTag: string;
1907
+ readonly message: string;
1908
+ readonly diagnostic?: Diagnostic | undefined;
1909
+ readonly context?: {
1910
+ readonly agentId?: string | undefined;
1911
+ readonly threadId?: string | undefined;
1912
+ readonly runId?: string | undefined;
1913
+ readonly submissionId?: string | undefined;
1914
+ readonly attemptId?: string | undefined;
1915
+ readonly turnId?: string | undefined;
1916
+ readonly toolCallId?: string | undefined;
1917
+ readonly toolName?: string | undefined;
1918
+ readonly callId?: string | undefined;
1919
+ readonly check?: string | undefined;
1920
+ readonly operation?: string | undefined;
1921
+ } | undefined;
1922
+ }>>;
1923
+ readonly settledAt: Schema.DateTimeUtcFromString;
1924
+ }>, {}>;
1925
+ /** The single durable terminal outcome recorded for one accepted Submission (DUR-002). */
1926
+ declare class Settlement extends Settlement_base {}
1927
+ /**
1928
+ * Project the bounded failed-settlement diagnostic from an already Schema-validated exact
1929
+ * reservation. Storage adapters use this when materializing their operational Settlement value;
1930
+ * the canonical record remains the authority.
1931
+ */
1932
+ declare const settlementFailureFromRecord: (record: RecordEnvelope) => SettlementFailureDiagnostic | undefined;
1933
+ /**
1934
+ * Assignment intent derived only from frozen admission and exact settlement evidence.
1935
+ * Joined receipts and cancellation before a Run starts do not finish an assignment.
1936
+ * Adapters suppress completed intent when newer accepted input remains unapplied, then
1937
+ * install the first seal and outstanding abort intents atomically before releasing the lane.
1938
+ */
1939
+ declare const workerTerminalFromRecord: (submission: SubmissionSnapshot, record: RecordEnvelope) => AssignmentTerminal | undefined;
1940
+ /** Destination-owned permanent inbox seal; recorded atomically with all outstanding abort intents. */
1941
+ declare const WorkerStopCommand: Schema.Struct<{
1942
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1943
+ readonly author: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
1944
+ }>;
1945
+ type WorkerStopCommand = typeof WorkerStopCommand.Type;
1946
+ declare const AbortCommand_base: Schema.Class<AbortCommand, Schema.Struct<{
1947
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1948
+ readonly author: Schema.NonEmptyString;
1949
+ readonly reason: Schema.String;
1950
+ }>, {}>;
1951
+ /**
1952
+ * A durable abort command (durability §13). Field bounds are exactly those of the canonical
1953
+ * `AbortRequested` payload so the intent can become canonical without re-validation.
1954
+ */
1955
+ declare class AbortCommand extends AbortCommand_base {}
1956
+ declare const AbortIntent_base: Schema.Class<AbortIntent, Schema.Struct<{
1957
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1958
+ readonly author: Schema.NonEmptyString;
1959
+ readonly reason: Schema.String;
1960
+ readonly requestedAt: Schema.DateTimeUtcFromString;
1961
+ readonly canonicalRecordId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/RecordId">>;
1962
+ }>, {}>;
1963
+ /**
1964
+ * The recorded abort intent. `canonicalRecordId` is present once the corresponding canonical
1965
+ * `AbortRequested` record has been appended (its identity is deterministic; see
1966
+ * `submissionAbortRecordId`).
1967
+ */
1968
+ declare class AbortIntent extends AbortIntent_base {}
1969
+ declare const AbortIntentRequest_base: Schema.Class<AbortIntentRequest, Schema.Struct<{
1970
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1971
+ }>, {}>;
1972
+ /** Address one lane-local abort intent without loading unrelated recovery state. */
1973
+ declare class AbortIntentRequest extends AbortIntentRequest_base {}
1974
+ declare const ClaimJoiningRequest_base: Schema.Class<ClaimJoiningRequest, Schema.Struct<{
1975
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1976
+ readonly hostSubmissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1977
+ readonly ownershipToken: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/OwnershipToken">;
1978
+ readonly maxCount: Schema.Int;
1979
+ }>, {}>;
1980
+ /**
1981
+ * Atomic claim of the contiguous ready prefix of strictly-later queued Submissions for joining
1982
+ * into the active host Run (plan §2.5). Fenced by the host Attempt's ownership token — no epoch
1983
+ * bump, the host already owns the lane. An `admitted`-but-not-`ready` row breaks the prefix;
1984
+ * an aborted-settled row is a closed obligation and is skipped as a non-gap (P7 §7(c)).
1985
+ */
1986
+ declare class ClaimJoiningRequest extends ClaimJoiningRequest_base {}
1987
+ declare const JoiningClaim_base: Schema.Class<JoiningClaim, Schema.Struct<{
1988
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1989
+ readonly queueSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/QueueSequence">;
1990
+ readonly inputPayload: Schema.declare<Schema.Json, Schema.Json>;
1991
+ }>, {}>;
1992
+ /** One queued Submission transitioned to `joining` under the host's ownership. */
1993
+ declare class JoiningClaim extends JoiningClaim_base {}
1994
+ declare const MarkJoinedRequest_base: Schema.Class<MarkJoinedRequest, Schema.Struct<{
1995
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
1996
+ readonly ownershipToken: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/OwnershipToken">;
1997
+ readonly recordId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/RecordId">;
1998
+ readonly sequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
1999
+ }>, {}>;
2000
+ /**
2001
+ * The canonical position of one joined Submission's `UserInputRecorded` record (`input:{sid}`).
2002
+ * Marking transitions `joining → joined` and records the host linkage established at claim time.
2003
+ */
2004
+ declare class MarkJoinedRequest extends MarkJoinedRequest_base {}
2005
+ declare const RevertJoiningRequest_base: Schema.Class<RevertJoiningRequest, Schema.Struct<{
2006
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2007
+ }>, {}>;
2008
+ /**
2009
+ * Recovery-only revert of a `joining` Submission whose canonical input append never committed
2010
+ * (DUR-016): `joining → ready`, idempotent, a no-op when the Submission already joined.
2011
+ */
2012
+ declare class RevertJoiningRequest extends RevertJoiningRequest_base {}
2013
+ declare const ApprovalPendingSuspension_base: Schema.Class<ApprovalPendingSuspension, Schema.TaggedStruct<"ApprovalPending", {
2014
+ readonly toolCallIds: Schema.NonEmptyArray<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">>;
2015
+ }>, {}>;
2016
+ /**
2017
+ * Why one Submission is durably suspended. Approval was the only Phase 5 reason; S2 adds
2018
+ * `WaitingForChild` (spec §12 step 10) and the union keeps later suspension families (e.g.
2019
+ * operator quarantine) additive.
2020
+ */
2021
+ declare class ApprovalPendingSuspension extends ApprovalPendingSuspension_base {}
2022
+ declare const WaitingChild_base: Schema.Class<WaitingChild, Schema.Struct<{
2023
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2024
+ readonly childSubmissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2025
+ }>, {}>;
2026
+ /** One attached child a `waitingForChild` parent is durably waiting on (spec §12 step 10). */
2027
+ declare class WaitingChild extends WaitingChild_base {}
2028
+ declare const WaitingForChildSuspension_base: Schema.Class<WaitingForChildSuspension, Schema.TaggedStruct<"WaitingForChild", {
2029
+ readonly children: Schema.NonEmptyArray<typeof WaitingChild>;
2030
+ }>, {}>;
2031
+ /**
2032
+ * The parent Attempt ended without settling because attached durable children must settle and
2033
+ * join first (spec §12 step 10, SUB-030). The suspended lane holds no worker permit; each listed
2034
+ * child settles on its own Thread lane and `recordChildSettled` wakes the parent once
2035
+ * every listed child is settled.
2036
+ */
2037
+ declare class WaitingForChildSuspension extends WaitingForChildSuspension_base {}
2038
+ declare const SuspensionReason: Schema.Union<readonly [typeof ApprovalPendingSuspension, typeof WaitingForChildSuspension]>;
2039
+ type SuspensionReason = typeof SuspensionReason.Type;
2040
+ declare const SuspendRequest_base: Schema.Class<SuspendRequest, Schema.Struct<{
2041
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2042
+ readonly ownershipToken: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/OwnershipToken">;
2043
+ readonly reason: Schema.Union<readonly [typeof ApprovalPendingSuspension, typeof WaitingForChildSuspension]>;
2044
+ }>, {}>;
2045
+ /**
2046
+ * Durable suspension of owned work (plan §2.6): `input-applied`/`running` → `suspended`, the
2047
+ * ownership period ends, NO settlement occurs — the accepted-work obligation stays owed while
2048
+ * the lane consumes no worker permit.
2049
+ */
2050
+ declare class SuspendRequest extends SuspendRequest_base {}
2051
+ /**
2052
+ * `suspended` when the lane is now durably waiting; `resume-immediately` when the suspension
2053
+ * reason is already fully covered (a covering decision or child settlement raced ahead of the
2054
+ * suspend transaction), so the caller resumes without releasing the lane.
2055
+ */
2056
+ declare const SuspensionOutcome: Schema.Literals<readonly ["suspended", "resume-immediately"]>;
2057
+ type SuspensionOutcome = typeof SuspensionOutcome.Type;
2058
+ declare const ChildSettledNotification_base: Schema.Class<ChildSettledNotification, Schema.Struct<{
2059
+ readonly parentSubmissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2060
+ readonly childSubmissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2061
+ }>, {}>;
2062
+ /**
2063
+ * A durable child-settlement notification for one waitingForChild parent (spec §12 step 10).
2064
+ * The child's canonical Settlement is the authority; this command only drives the parent lane's
2065
+ * wake transition.
2066
+ */
2067
+ declare class ChildSettledNotification extends ChildSettledNotification_base {}
2068
+ /**
2069
+ * `woken` when this notification completed the waiting set and the parent transitioned
2070
+ * `suspended(WaitingForChild) → input-applied`; `still-waiting` while other listed children are
2071
+ * unsettled; `not-waiting` when the parent is not (or no longer) suspended waiting on this
2072
+ * child — including replays after a wake, so the operation is idempotent.
2073
+ */
2074
+ declare const ChildSettledOutcome: Schema.Literals<readonly ["woken", "still-waiting", "not-waiting"]>;
2075
+ type ChildSettledOutcome = typeof ChildSettledOutcome.Type;
2076
+ /** Parent-owned child budget reservation identity, deterministically derived by the
2077
+ * coordinator from the parent Run and Tool Call identity (spec §12 step 2). */
2078
+ declare const ChildReservationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ChildReservationId">;
2079
+ type ChildReservationId = typeof ChildReservationId.Type;
2080
+ /**
2081
+ * The reservation state machine (spec §12 steps 2 and 6): `reserved` while the child may still
2082
+ * consume the allocation, `releasePending` once the final accounting decision is frozen, and
2083
+ * `released` after the unused allocation returned exactly once.
2084
+ */
2085
+ declare const ChildReservationStatus: Schema.Literals<readonly ["reserved", "releasePending", "released"]>;
2086
+ type ChildReservationStatus = typeof ChildReservationStatus.Type;
2087
+ declare const ChildBudgetReservationRequest_base: Schema.Class<ChildBudgetReservationRequest, Schema.Struct<{
2088
+ readonly reservationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ChildReservationId">;
2089
+ readonly parentSubmissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2090
+ readonly parentToolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2091
+ readonly ownershipToken: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/OwnershipToken">;
2092
+ readonly allocation: Schema.declare<Schema.Json, Schema.Json>;
2093
+ readonly allocationDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
2094
+ }>, {}>;
2095
+ /**
2096
+ * Creation input for one parent-owned child budget reservation. The allocation is an opaque
2097
+ * Schema-encoded budget document (D8: adapters implement transitions only and never interpret
2098
+ * budget dimensions); `allocationDigest` must be the digest of its canonical JSON encoding.
2099
+ */
2100
+ declare class ChildBudgetReservationRequest extends ChildBudgetReservationRequest_base {}
2101
+ declare const ChildBudgetReservationSnapshot_base: Schema.Class<ChildBudgetReservationSnapshot, Schema.Struct<{
2102
+ readonly reservationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ChildReservationId">;
2103
+ readonly parentSubmissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2104
+ readonly parentToolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2105
+ readonly childSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
2106
+ readonly status: Schema.Literals<readonly ["reserved", "releasePending", "released"]>;
2107
+ readonly allocation: Schema.declare<Schema.Json, Schema.Json>;
2108
+ readonly allocationDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
2109
+ readonly accounting: Schema.optionalKey<Schema.declare<Schema.Json, Schema.Json>>;
2110
+ readonly reservedAt: Schema.DateTimeUtcFromString;
2111
+ readonly releaseBeganAt: Schema.optionalKey<Schema.DateTimeUtcFromString>;
2112
+ readonly releasedAt: Schema.optionalKey<Schema.DateTimeUtcFromString>;
2113
+ }>, {}>;
2114
+ /** One child budget reservation row as the port exposes it. */
2115
+ declare class ChildBudgetReservationSnapshot extends ChildBudgetReservationSnapshot_base {}
2116
+ declare const ReservedChildBudget_base: Schema.Class<ReservedChildBudget, Schema.Struct<{
2117
+ readonly reservation: typeof ChildBudgetReservationSnapshot;
2118
+ readonly replayed: Schema.Boolean;
2119
+ }>, {}>;
2120
+ /**
2121
+ * The committed reservation. `replayed` is true when an identical reservation already existed;
2122
+ * the stored row is returned unchanged so a recovering caller resumes rather than duplicates
2123
+ * (SUB-016).
2124
+ */
2125
+ declare class ReservedChildBudget extends ReservedChildBudget_base {}
2126
+ declare const AttachChildToReservationRequest_base: Schema.Class<AttachChildToReservationRequest, Schema.Struct<{
2127
+ readonly reservationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ChildReservationId">;
2128
+ readonly ownershipToken: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/OwnershipToken">;
2129
+ readonly childSubmissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2130
+ }>, {}>;
2131
+ /** Records the admitted child on its reservation row (repairable from `SubagentStarted`). */
2132
+ declare class AttachChildToReservationRequest extends AttachChildToReservationRequest_base {}
2133
+ declare const BeginChildBudgetReleaseRequest_base: Schema.Class<BeginChildBudgetReleaseRequest, Schema.Struct<{
2134
+ readonly reservationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ChildReservationId">;
2135
+ readonly accounting: Schema.declare<Schema.Json, Schema.Json>;
2136
+ }>, {}>;
2137
+ /**
2138
+ * Freezes the final consumed/released accounting decision (spec §12 join step 6). The
2139
+ * accounting is an opaque Schema-encoded document replayed from the canonical `SubagentJoined`
2140
+ * record (or the deterministic zero-consumed decision for an orphaned reservation), so the
2141
+ * decision itself authorizes the transition — no ownership token is consulted (DUR-015).
2142
+ */
2143
+ declare class BeginChildBudgetReleaseRequest extends BeginChildBudgetReleaseRequest_base {}
2144
+ declare const ReleaseChildBudgetRequest_base: Schema.Class<ReleaseChildBudgetRequest, Schema.Struct<{
2145
+ readonly reservationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ChildReservationId">;
2146
+ }>, {}>;
2147
+ /** Applies the frozen accounting decision: `releasePending → released`, exactly once. */
2148
+ declare class ReleaseChildBudgetRequest extends ReleaseChildBudgetRequest_base {}
2149
+ declare const ApprovalDecisionCommand_base: Schema.Class<ApprovalDecisionCommand, Schema.Struct<{
2150
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2151
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2152
+ readonly decision: Schema.Literals<readonly ["approved", "denied"]>;
2153
+ readonly resolver: Schema.NonEmptyString;
2154
+ readonly reason: Schema.String;
2155
+ }>, {}>;
2156
+ /**
2157
+ * A durable approval decision command (plan §2.6, `abort`-shaped). Field bounds are exactly those
2158
+ * of the canonical `ToolApprovalDecided` payload so the intent can become canonical without
2159
+ * re-validation.
2160
+ */
2161
+ declare class ApprovalDecisionCommand extends ApprovalDecisionCommand_base {}
2162
+ declare const ApprovalDecisionIntent_base: Schema.Class<ApprovalDecisionIntent, Schema.Struct<{
2163
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2164
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2165
+ readonly decision: Schema.Literals<readonly ["approved", "denied"]>;
2166
+ readonly resolver: Schema.NonEmptyString;
2167
+ readonly reason: Schema.String;
2168
+ readonly decidedAt: Schema.DateTimeUtcFromString;
2169
+ readonly canonicalRecordId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/RecordId">>;
2170
+ }>, {}>;
2171
+ /**
2172
+ * The recorded approval-decision intent, idempotent per `(submissionId, toolCallId)`.
2173
+ * `canonicalRecordId` is present once the corresponding canonical `ToolApprovalDecided` record
2174
+ * has been appended (see `toolApprovalDecisionRecordId`).
2175
+ */
2176
+ declare class ApprovalDecisionIntent extends ApprovalDecisionIntent_base {}
2177
+ declare const MarkUnknownRequest_base: Schema.Class<MarkUnknownRequest, Schema.Struct<{
2178
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2179
+ readonly toolCallIds: Schema.NonEmptyArray<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">>;
2180
+ readonly reason: Schema.String;
2181
+ }>, {}>;
2182
+ /**
2183
+ * Durable Unknown marking for one Submission's open ordinary Tool Calls (DUR-009): state →
2184
+ * `unknown`, parking that Submission without changing ownership or the Thread epoch. Idempotent.
2185
+ */
2186
+ declare class MarkUnknownRequest extends MarkUnknownRequest_base {}
2187
+ declare const ResolutionCompletedWithResult_base: Schema.Class<ResolutionCompletedWithResult, Schema.TaggedStruct<"CompletedWithResult", {
2188
+ readonly result: Schema.declare<Schema.Json, Schema.Json>;
2189
+ readonly isFailure: Schema.Boolean;
2190
+ }>, {}>;
2191
+ /** The recovered supplier truth: the external effect completed with this exact result. */
2192
+ declare class ResolutionCompletedWithResult extends ResolutionCompletedWithResult_base {}
2193
+ declare const ResolutionNeverHappened_base: Schema.Class<ResolutionNeverHappened, Schema.TaggedStruct<"NeverHappened", {}>, {}>;
2194
+ /** The external effect provably never happened; the call may re-execute on resume. */
2195
+ declare class ResolutionNeverHappened extends ResolutionNeverHappened_base {}
2196
+ declare const ResolutionSafeToRetry_base: Schema.Class<ResolutionSafeToRetry, Schema.TaggedStruct<"SafeToRetry", {}>, {}>;
2197
+ /** The call is safe to repeat under the external system's idempotency contract. */
2198
+ declare class ResolutionSafeToRetry extends ResolutionSafeToRetry_base {}
2199
+ declare const ResolutionAbortSubmission_base: Schema.Class<ResolutionAbortSubmission, Schema.TaggedStruct<"AbortSubmission", {}>, {}>;
2200
+ /** Give up on the Submission: route into the abort path (unknown calls stay recorded; abort
2201
+ * never claims external rollback, durability §13). */
2202
+ declare class ResolutionAbortSubmission extends ResolutionAbortSubmission_base {}
2203
+ /** How an authorized resolver closed one Unknown Outcome (DUR-017). */
2204
+ declare const UnknownResolution: Schema.Union<readonly [typeof ResolutionCompletedWithResult, typeof ResolutionNeverHappened, typeof ResolutionSafeToRetry, typeof ResolutionAbortSubmission]>;
2205
+ type UnknownResolution = typeof UnknownResolution.Type;
2206
+ declare const UnknownResolutionCommand_base: Schema.Class<UnknownResolutionCommand, Schema.Struct<{
2207
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2208
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2209
+ readonly author: Schema.NonEmptyString;
2210
+ readonly reason: Schema.String;
2211
+ readonly resolution: Schema.Union<readonly [typeof ResolutionCompletedWithResult, typeof ResolutionNeverHappened, typeof ResolutionSafeToRetry, typeof ResolutionAbortSubmission]>;
2212
+ }>, {}>;
2213
+ /**
2214
+ * A durable Unknown-Outcome resolution command (DUR-017, `abort`-shaped). Possession of the
2215
+ * runtime service plus the mandatory `author`/`reason` audit fields is the Phase 5 authorization
2216
+ * boundary — identical to `abort`; the authenticated operator surface is a P7 deliverable.
2217
+ * Field bounds are exactly those of the canonical `ToolCallResolved` payload.
2218
+ */
2219
+ declare class UnknownResolutionCommand extends UnknownResolutionCommand_base {}
2220
+ declare const UnknownResolutionIntent_base: Schema.Class<UnknownResolutionIntent, Schema.Struct<{
2221
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2222
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2223
+ readonly author: Schema.NonEmptyString;
2224
+ readonly reason: Schema.String;
2225
+ readonly resolution: Schema.Union<readonly [typeof ResolutionCompletedWithResult, typeof ResolutionNeverHappened, typeof ResolutionSafeToRetry, typeof ResolutionAbortSubmission]>;
2226
+ readonly resolvedAt: Schema.DateTimeUtcFromString;
2227
+ readonly canonicalRecordId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/RecordId">>;
2228
+ }>, {}>;
2229
+ /**
2230
+ * The recorded resolution intent, idempotent per `(submissionId, toolCallId)`. The canonical
2231
+ * `ToolCallResolved` (+ `ToolCallSettled` for `CompletedWithResult`) is appended by the recovery
2232
+ * pass or the next owning Attempt; `canonicalRecordId` is present once it is.
2233
+ */
2234
+ declare class UnknownResolutionIntent extends UnknownResolutionIntent_base {}
2235
+ declare const OwnershipSnapshot_base: Schema.Class<OwnershipSnapshot, Schema.Struct<{
2236
+ readonly attemptId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AttemptId">;
2237
+ readonly ownerProducerId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ProducerId">;
2238
+ readonly producerEpoch: Schema.brand<Schema.Natural, "@effect-agent/thread/ProducerEpoch">;
2239
+ readonly leaseExpiresAt: Schema.DateTimeUtcFromString;
2240
+ }>, {}>;
2241
+ /** Current ownership as recovery sees it. The live owner's token is never exposed here. */
2242
+ declare class OwnershipSnapshot extends OwnershipSnapshot_base {}
2243
+ declare const SettlementReservationSnapshot_base: Schema.Class<SettlementReservationSnapshot, Schema.Struct<{
2244
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
2245
+ readonly outcome: Schema.Literals<readonly ["completed", "failed", "aborted"]>;
2246
+ readonly record: typeof RecordEnvelope;
2247
+ readonly recordDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
2248
+ readonly finalized: Schema.Boolean;
2249
+ }>, {}>;
2250
+ /** A settlement reservation as recovery sees it. */
2251
+ declare class SettlementReservationSnapshot extends SettlementReservationSnapshot_base {}
2252
+ declare const RecoverySnapshotRequest_base: Schema.Class<RecoverySnapshotRequest, Schema.Struct<{
2253
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2254
+ }>, {}>;
2255
+ declare class RecoverySnapshotRequest extends RecoverySnapshotRequest_base {}
2256
+ declare const JoinSnapshot_base: Schema.Class<JoinSnapshot, Schema.Struct<{
2257
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2258
+ readonly state: Schema.Literals<readonly ["admitted", "ready", "joining", "joined", "running", "input-applied", "suspended", "unknown", "terminalizing", "settled"]>;
2259
+ readonly hostSubmissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2260
+ }>, {}>;
2261
+ /** One joined/joining Submission of a host Run, as the host's recovery sees it. */
2262
+ declare class JoinSnapshot extends JoinSnapshot_base {}
2263
+ declare const SuspensionSnapshot_base: Schema.Class<SuspensionSnapshot, Schema.Struct<{
2264
+ readonly reason: Schema.Union<readonly [typeof ApprovalPendingSuspension, typeof WaitingForChildSuspension]>;
2265
+ readonly suspendedAt: Schema.DateTimeUtcFromString;
2266
+ }>, {}>;
2267
+ /** A durable suspension as recovery sees it. */
2268
+ declare class SuspensionSnapshot extends SuspensionSnapshot_base {}
2269
+ declare const ChildAttachmentSnapshot_base: Schema.Class<ChildAttachmentSnapshot, Schema.Struct<{
2270
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2271
+ readonly childSubmissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2272
+ readonly childState: Schema.Literals<readonly ["admitted", "ready", "joining", "joined", "running", "input-applied", "suspended", "unknown", "terminalizing", "settled"]>;
2273
+ readonly childOutcome: Schema.optionalKey<Schema.Literals<readonly ["completed", "failed", "aborted"]>>;
2274
+ }>, {}>;
2275
+ /**
2276
+ * One attached child of this parent as its recovery sees it: the reservation's recorded child
2277
+ * plus that child's current lane state. A disposable derived view — the canonical
2278
+ * `SubagentRequested`/`SubagentStarted` records and the child's own canonical Settlement remain
2279
+ * the recovery truth (DUR-015).
2280
+ */
2281
+ declare class ChildAttachmentSnapshot extends ChildAttachmentSnapshot_base {}
2282
+ declare const RecoverySnapshot_base: Schema.Class<RecoverySnapshot, Schema.Struct<{
2283
+ readonly submission: typeof SubmissionSnapshot;
2284
+ readonly ownership: Schema.optionalKey<typeof OwnershipSnapshot>;
2285
+ readonly inputApplied: Schema.optionalKey<typeof InputAppliedMarker>;
2286
+ readonly reservation: Schema.optionalKey<typeof SettlementReservationSnapshot>;
2287
+ readonly abortIntent: Schema.optionalKey<typeof AbortIntent>;
2288
+ readonly joins: Schema.$Array<typeof JoinSnapshot>;
2289
+ readonly hostSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
2290
+ readonly suspension: Schema.optionalKey<typeof SuspensionSnapshot>;
2291
+ readonly approvalDecisions: Schema.$Array<typeof ApprovalDecisionIntent>;
2292
+ readonly unknownResolutions: Schema.$Array<typeof UnknownResolutionIntent>;
2293
+ readonly childReservations: Schema.withConstructorDefault<Schema.$Array<typeof ChildBudgetReservationSnapshot>>;
2294
+ readonly childAttachments: Schema.withConstructorDefault<Schema.$Array<typeof ChildAttachmentSnapshot>>;
2295
+ readonly parentLinkage: Schema.optionalKey<typeof ParentLinkage>;
2296
+ }>, {}>;
2297
+ /**
2298
+ * Everything the pure recovery classifier needs about one Submission, read strongly consistently
2299
+ * (STORE-003). Canonical history still wins over every marker in this snapshot (DUR-015).
2300
+ *
2301
+ * Phase 5 fields: `joins` is the host-side view (every Submission `joining`/`joined` to this
2302
+ * one); `hostSubmissionId` is the joined-side view; `suspension` mirrors the `suspended` state;
2303
+ * `approvalDecisions` and `unknownResolutions` are the durable intents recorded against this
2304
+ * Submission (empty when none exist).
2305
+ *
2306
+ * S2 fields: `childReservations`/`childAttachments` are the parent-side subagent view (ordered
2307
+ * by parent Tool Call id) and `parentLinkage` is the child-side view. They default to
2308
+ * empty/absent at construction so pre-S2 call sites stay valid; adapters always populate them.
2309
+ */
2310
+ declare class RecoverySnapshot extends RecoverySnapshot_base {}
2311
+ declare const AdmissionConflict_base: Schema.Class<AdmissionConflict, Schema.TaggedStruct<"AdmissionConflict", {
2312
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
2313
+ readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
2314
+ readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
2315
+ readonly existingInputDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
2316
+ readonly attemptedInputDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
2317
+ }>, import("effect/Cause").YieldableError>;
2318
+ /** The same idempotency key was admitted with different canonical input content. */
2319
+ declare class AdmissionConflict extends AdmissionConflict_base {}
2320
+ declare const OwnershipLost_base: Schema.Class<OwnershipLost, Schema.TaggedStruct<"OwnershipLost", {
2321
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2322
+ readonly actualEpoch: Schema.brand<Schema.Natural, "@effect-agent/thread/ProducerEpoch">;
2323
+ }>, import("effect/Cause").YieldableError>;
2324
+ /**
2325
+ * The presented ownership token no longer owns the Submission's lane. `actualEpoch` is the
2326
+ * thread's current producer epoch so a stale Attempt can prove to itself it was superseded.
2327
+ */
2328
+ declare class OwnershipLost extends OwnershipLost_base {}
2329
+ declare const SettlementConflict_base: Schema.Class<SettlementConflict, Schema.TaggedStruct<"SettlementConflict", {
2330
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2331
+ readonly existingOutcome: Schema.Literals<readonly ["completed", "failed", "aborted"]>;
2332
+ }>, import("effect/Cause").YieldableError>;
2333
+ /** A conflicting terminal outcome was already reserved or finalized (DUR-002, DUR-012). */
2334
+ declare class SettlementConflict extends SettlementConflict_base {}
2335
+ declare const ApprovalConflict_base: Schema.Class<ApprovalConflict, Schema.TaggedStruct<"ApprovalConflict", {
2336
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2337
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2338
+ readonly existingDecision: Schema.Literals<readonly ["approved", "denied"]>;
2339
+ }>, import("effect/Cause").YieldableError>;
2340
+ /**
2341
+ * A divergent approval re-decision for an already-decided `(submissionId, toolCallId)` pair.
2342
+ * Repeating the SAME decision replays the recorded intent instead (idempotency).
2343
+ */
2344
+ declare class ApprovalConflict extends ApprovalConflict_base {}
2345
+ declare const UnknownResolutionConflict_base: Schema.Class<UnknownResolutionConflict, Schema.TaggedStruct<"UnknownResolutionConflict", {
2346
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2347
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2348
+ }>, import("effect/Cause").YieldableError>;
2349
+ /**
2350
+ * A divergent unknown-outcome re-resolution for an already-resolved `(submissionId, toolCallId)`
2351
+ * pair (DUR-017). Repeating the SAME resolution replays the recorded intent instead.
2352
+ */
2353
+ declare class UnknownResolutionConflict extends UnknownResolutionConflict_base {}
2354
+ declare const ChildReservationConflict_base: Schema.Class<ChildReservationConflict, Schema.TaggedStruct<"ChildReservationConflict", {
2355
+ readonly reservationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ChildReservationId">;
2356
+ readonly status: Schema.Literals<readonly ["reserved", "releasePending", "released"]>;
2357
+ readonly message: Schema.String;
2358
+ }>, import("effect/Cause").YieldableError>;
2359
+ /**
2360
+ * A child budget reservation request contradicts recorded reservation state: a divergent
2361
+ * allocation for the same reservation id, a second reservation id for the same parent Tool
2362
+ * Call, a divergent child attachment, a divergent accounting freeze, or an out-of-order state
2363
+ * transition. `status` reports the existing row's status. Identical replays never conflict.
2364
+ */
2365
+ declare class ChildReservationConflict extends ChildReservationConflict_base {}
2366
+ declare const LedgerError_base: Schema.Class<LedgerError, Schema.TaggedStruct<"LedgerError", {
2367
+ readonly operation: Schema.String;
2368
+ readonly message: Schema.String;
2369
+ readonly cause: Schema.optionalKey<Schema.decodeTo<Schema.Unknown, Schema.Codec<Diagnostic, Diagnostic, never, never>, never, never>>;
2370
+ }>, import("effect/Cause").YieldableError>;
2371
+ /** Adapter-level ledger failure (storage unavailable, unknown submission, corrupt row, ...). */
2372
+ declare class LedgerError extends LedgerError_base {}
2373
+ type SubmissionLedgerFailure = AdmissionConflict | OwnershipLost | SettlementConflict | ApprovalConflict | UnknownResolutionConflict | JoinedToHost | ChildReservationConflict | LedgerError | AdmissionPolicyError;
2374
+ declare const SubmissionLedger_base: Context.ServiceClass<SubmissionLedger, "@effect-agent/thread/SubmissionLedger", {
2375
+ readonly capabilities: Effect.Effect<LedgerCapabilities>;
2376
+ readonly admit: (request: AdmissionRequest) => Effect.Effect<AdmissionResult, AdmissionConflict | AdmissionPolicyError | LedgerError>;
2377
+ readonly markReady: (request: MarkReadyRequest) => Effect.Effect<void, LedgerError>;
2378
+ readonly lookup: (request: SubmissionLookup) => Effect.Effect<Option.Option<SubmissionSnapshot>, LedgerError>;
2379
+ readonly resolveAdmission: (request: SubmissionLookupByKey) => Effect.Effect<AdmissionResolution, LedgerError>;
2380
+ readonly claim: (request: ClaimRequest) => Effect.Effect<Option.Option<Claim>, LedgerError>;
2381
+ readonly renewOwnership: (request: RenewOwnershipRequest) => Effect.Effect<OwnershipRenewal, OwnershipLost | LedgerError>;
2382
+ readonly releaseOwnership: (request: ReleaseOwnershipRequest) => Effect.Effect<void, OwnershipLost | LedgerError>;
2383
+ readonly markInputApplied: (request: MarkInputAppliedRequest) => Effect.Effect<void, OwnershipLost | LedgerError>;
2384
+ readonly reserveSettlement: (request: SettlementReservation) => Effect.Effect<ReservedSettlement, SettlementConflict | OwnershipLost | LedgerError>;
2385
+ readonly finalizeSettlement: (request: SettlementFinalization) => Effect.Effect<Settlement, SettlementConflict | LedgerError>;
2386
+ /** Optional for third-party adapters. Remaining ownership must reach zero before stop acknowledgement. */
2387
+ readonly inspectWorker?: (threadId: ThreadId) => Effect.Effect<WorkerLedgerState, LedgerError>;
2388
+ readonly stopWorker?: (request: WorkerStopCommand) => Effect.Effect<number, LedgerError>;
2389
+ readonly requestAbort: (request: AbortCommand) => Effect.Effect<AbortIntent, SettlementConflict | JoinedToHost | LedgerError>;
2390
+ /**
2391
+ * Strongly consistent lane-local read. Unknown Submissions fail with LedgerError. Canonical
2392
+ * proof has the same meaning as in RecoverySnapshot; this read grants no execution authority.
2393
+ */
2394
+ readonly readAbortIntent: (request: AbortIntentRequest) => Effect.Effect<AbortIntent | undefined, LedgerError>;
2395
+ readonly claimJoining: (request: ClaimJoiningRequest) => Effect.Effect<ReadonlyArray<JoiningClaim>, OwnershipLost | LedgerError>;
2396
+ readonly markJoined: (request: MarkJoinedRequest) => Effect.Effect<void, OwnershipLost | LedgerError>;
2397
+ readonly revertJoining: (request: RevertJoiningRequest) => Effect.Effect<void, LedgerError>;
2398
+ readonly suspend: (request: SuspendRequest) => Effect.Effect<SuspensionOutcome, OwnershipLost | SettlementConflict | LedgerError>;
2399
+ readonly recordApprovalDecision: (command: ApprovalDecisionCommand) => Effect.Effect<ApprovalDecisionIntent, ApprovalConflict | SettlementConflict | LedgerError>;
2400
+ readonly markUnknown: (request: MarkUnknownRequest) => Effect.Effect<void, SettlementConflict | LedgerError>;
2401
+ readonly recordUnknownResolution: (command: UnknownResolutionCommand) => Effect.Effect<UnknownResolutionIntent, UnknownResolutionConflict | SettlementConflict | LedgerError>;
2402
+ readonly recordChildSettled: (request: ChildSettledNotification) => Effect.Effect<ChildSettledOutcome, LedgerError>;
2403
+ readonly reserveChildBudget: (request: ChildBudgetReservationRequest) => Effect.Effect<ReservedChildBudget, ChildReservationConflict | OwnershipLost | LedgerError>;
2404
+ readonly attachChildToReservation: (request: AttachChildToReservationRequest) => Effect.Effect<ChildBudgetReservationSnapshot, ChildReservationConflict | OwnershipLost | LedgerError>;
2405
+ readonly beginChildBudgetRelease: (request: BeginChildBudgetReleaseRequest) => Effect.Effect<ChildBudgetReservationSnapshot, ChildReservationConflict | LedgerError>;
2406
+ readonly releaseChildBudget: (request: ReleaseChildBudgetRequest) => Effect.Effect<ChildBudgetReservationSnapshot, ChildReservationConflict | LedgerError>;
2407
+ readonly scanNonterminal: Stream.Stream<SubmissionWorkItem, LedgerError>;
2408
+ readonly loadRecoverySnapshot: (request: RecoverySnapshotRequest) => Effect.Effect<RecoverySnapshot, LedgerError>;
2409
+ }>;
2410
+ /**
2411
+ * Operational durable state for accepted work: admission, FIFO readiness, ownership, leases,
2412
+ * abort intent, and settlement obligations (STORE-001). The Thread Log remains the
2413
+ * authority for applied input and terminal outcomes; every marker in this ledger can be rebuilt
2414
+ * from canonical history (DUR-015).
2415
+ *
2416
+ * Operation contracts:
2417
+ *
2418
+ * - `admit` — atomic and idempotent by (threadId, principal, idempotencyKey). A replay
2419
+ * with the same `inputDigest` returns the original `AdmissionResult` with `replayed` set; a
2420
+ * replay with a different digest fails with `AdmissionConflict`. Admission allocates the
2421
+ * Submission's `queueSequence` (FIFO position, DUR-004) and mints `submissionId`/`receiptId`.
2422
+ * An optional `parentLinkage` is recorded immutably at first admission (SUB-016); a replay
2423
+ * whose linkage diverges (present vs. absent, or different identities) fails with
2424
+ * `AdmissionConflict` even when the input digest matches.
2425
+ * - `resolveAdmission` — authoritative tri-state admission lookup by scoped idempotency key
2426
+ * (SUB-031): `NotAdmitted` proves absence, `Admitted` carries the full snapshot, and
2427
+ * `Indeterminate` states that the adapter cannot currently prove either. Only `NotAdmitted`
2428
+ * permits an admission attempt. Single strongly consistent stores derive the answer from a
2429
+ * direct lookup and never answer `Indeterminate`.
2430
+ * - `markReady` — idempotent transition admitted → ready after Thread materialization.
2431
+ * Marking an already-ready (or later-state) Submission is a no-op.
2432
+ * - `lookup` — read one Submission by identity or scoped idempotency key; strongly consistent
2433
+ * with prior ledger writes.
2434
+ * - `claim` — claims the lowest unsettled `queueSequence` after skipping only unknown rows
2435
+ * without abort intent. Approval, joining and child-wait barriers remain ordered. Returns
2436
+ * `Option.none` when no eligible work exists or ANY lease in the Thread is live, including
2437
+ * a lease belonging to the same producer. A successful claim atomically bumps the Thread's producer
2438
+ * epoch — fencing every stale Attempt out of canonical appends (DUR-006) — mints a fresh
2439
+ * `attemptId` and `ownershipToken`, and starts the ownership lease (D5: adapters default to
2440
+ * `DEFAULT_OWNERSHIP_LEASE_DURATION`, configurable). An expired lease makes the head
2441
+ * claimable; expiry alone never revokes correctness, only permission to assume liveness.
2442
+ * - `renewOwnership` — extends the lease while the token still owns the lane; fails with
2443
+ * `OwnershipLost` once superseded. Renewal after lease expiry succeeds if no other claim has
2444
+ * taken the lane in between.
2445
+ * - `releaseOwnership` — graceful drain: ends the ownership period without settling, returning
2446
+ * a nonterminal head to claimable state. Fails with `OwnershipLost` once superseded.
2447
+ * - `markInputApplied` — idempotent marker that the deterministic `UserInputRecorded` record is
2448
+ * canonical (state → input-applied). Recovery repairs this marker from history when the append
2449
+ * committed but the marker write was lost.
2450
+ * - `reserveSettlement` — reserves the Submission's single exact settlement record
2451
+ * (state → terminalizing). Idempotent: an identical reservation replays with `replayed` set; a
2452
+ * different outcome or content fails with `SettlementConflict{existingOutcome}` (DUR-011).
2453
+ * For a `joined` Submission the reservation is authorized by its recorded host linkage — a
2454
+ * joined lane is never worker-claimable, so no ownership token can exist for it and the
2455
+ * presented token is not consulted (plan §2.5: joined Submissions settle with the host).
2456
+ * Likewise, an ABORTED reservation for a `ready`/`terminalizing` Submission that carries a
2457
+ * durable abort intent and holds no live ownership is authorized by that intent (P7 §7(c)):
2458
+ * recovery settles aborted never-claimed queued work immediately, without waiting for it to
2459
+ * head the lane. Both exceptions are outcome- and state-narrow; everything else stays fenced.
2460
+ * - `finalizeSettlement` — idempotent terminal transition (state → settled) after the reserved
2461
+ * record is canonical. Native adapters seal opted-in worker assignments atomically before
2462
+ * releasing the lane. Otherwise the next `queueSequence` becomes claimable. It
2463
+ * requires no ownership token: canonical history authorizes finalization (DUR-015). A
2464
+ * finalization that disagrees with the recorded outcome fails with `SettlementConflict`.
2465
+ * - `requestAbort` — durable, idempotent by `submissionId`: repeating returns the recorded
2466
+ * intent unchanged (DUR-012). Fails with `SettlementConflict` once the Submission is settled;
2467
+ * abort never rewrites a terminal outcome. Fails with `JoinedToHost` for a `joined` Submission
2468
+ * — it settles with its host, so the abort target is the host (plan §2.5). Abort of a
2469
+ * `joining` Submission records the intent; it is honored only if the host has not consumed the
2470
+ * input (revert-then-abort).
2471
+ * - `claimJoining` — atomic: transitions the contiguous `ready` prefix of strictly-later
2472
+ * `queueSequence`s (up to `maxCount`) to `joining` under the host's ownership token, recording
2473
+ * the host linkage; no epoch bump (the host Attempt already owns the lane). An
2474
+ * `admitted`-not-`ready` row breaks the prefix; an aborted-settled row is a closed obligation
2475
+ * and is skipped as a non-gap (P7 §7(c)). Fails with `OwnershipLost` once superseded.
2476
+ * - `markJoined` — idempotent `joining → joined` with the canonical input record position;
2477
+ * repairable from history when the append committed but the marker write was lost (DUR-016).
2478
+ * - `revertJoining` — recovery-only, idempotent `joining → ready`; a no-op when already joined.
2479
+ * - `suspend` — `input-applied`/`running` → `suspended`; ends the ownership period WITHOUT
2480
+ * settling (the obligation stays owed, the lane consumes no worker permit). Returns
2481
+ * `resume-immediately` when the reason is already fully covered: for `ApprovalPending`,
2482
+ * recorded decisions cover every pending call; for `WaitingForChild`, every listed child is
2483
+ * already provably settled. Adapters must guarantee that a child settlement reported before
2484
+ * the suspend transaction commits is observed by that suspend (single-store adapters derive
2485
+ * this from the child's own row; cross-store adapters record a durable notification marker).
2486
+ * Fails with `SettlementConflict` once settled.
2487
+ * - `recordApprovalDecision` — durable, idempotent per `(submissionId, toolCallId)`: repeating
2488
+ * the same decision replays the intent; a divergent re-decision fails with `ApprovalConflict`.
2489
+ * Transitions `suspended(ApprovalPending) → input-applied` once every pending call of the
2490
+ * suspension reason is decided, waking the lane. Fails with `SettlementConflict` once settled.
2491
+ * - `recordChildSettled` — idempotent cross-lane wake (spec §12 step 10): transitions
2492
+ * `suspended(WaitingForChild) → input-applied` exactly when EVERY listed child is settled,
2493
+ * answering `woken`; `still-waiting` while any listed child is unsettled; `not-waiting` when
2494
+ * the parent is not suspended waiting on this child (including replays after the wake). The
2495
+ * child's canonical Settlement is the authority. The runtime reports it after the exact
2496
+ * reserved record is appended and before ledger finalization, so same-store adapters accept
2497
+ * `terminalizing` only when its exact reservation exists; an earlier child is an
2498
+ * adapter-checked caller error. It never settles the parent and requires no ownership token:
2499
+ * the canonically recorded child settlement authorizes the wake.
2500
+ * - `reserveChildBudget` — idempotent get-or-create of the parent-owned child budget
2501
+ * reservation (spec §12 step 2), fenced by the parent lane's live `OwnershipToken`. An
2502
+ * identical replay returns the stored row with `replayed` set (unfenced, mirroring
2503
+ * `reserveSettlement`); a divergent allocation for the same id, or a second id for the same
2504
+ * `(parentSubmissionId, parentToolCallId)`, fails with `ChildReservationConflict`.
2505
+ * - `attachChildToReservation` — idempotent: records the admitted child on the reservation row
2506
+ * (repairable from the canonical `SubagentStarted` record). A replay with the recorded child
2507
+ * is a no-op; the first attach is fenced by the parent token and requires status `reserved`;
2508
+ * a divergent child fails with `ChildReservationConflict`.
2509
+ * - `beginChildBudgetRelease` — `reserved → releasePending`: freezes the final accounting
2510
+ * decision exactly once. Replaying the identical accounting (at `releasePending` or
2511
+ * `released`) is a no-op; a divergent accounting fails with `ChildReservationConflict`.
2512
+ * Requires no ownership token: the accounting is replayed from the canonical `SubagentJoined`
2513
+ * record (or is the deterministic zero-consumed decision for an orphaned reservation), so
2514
+ * canonical history authorizes the transition (DUR-015) and the freeze comparison — not a
2515
+ * fence — guarantees one decision.
2516
+ * - `releaseChildBudget` — `releasePending → released`, applied exactly once; replaying returns
2517
+ * the released row unchanged. Releasing a still-`reserved` row (no frozen accounting) fails
2518
+ * with `ChildReservationConflict`. "A crash before release leaves budget unavailable until
2519
+ * repair, never available twice" (spec §12).
2520
+ * - `markUnknown` — idempotent, ownership-free (canonical evidence authorizes it): state →
2521
+ * `unknown`, parking the Submission while its accepted settlement obligation stays visible.
2522
+ * Existing ownership must release or expire before another claim (DUR-009/DUR-017).
2523
+ * Fails with `SettlementConflict` once settled.
2524
+ * - `recordUnknownResolution` — durable, idempotent per `(submissionId, toolCallId)`; a
2525
+ * divergent re-resolution fails with `UnknownResolutionConflict`. Transitions
2526
+ * `unknown → input-applied` once no open call remains, waking the lane. Fails with
2527
+ * `SettlementConflict` once settled.
2528
+ * - `scanNonterminal` — streams control-only entries for every Submission whose state is not
2529
+ * `settled`, ordered by (threadId, queueSequence); recovery's admission-independent worklist
2530
+ * (DUR-014). It must not decode execution payloads. SQL or control-identity corruption fails
2531
+ * the scan; selected-Thread payload hydration belongs inside the caller's isolation boundary.
2532
+ * - `loadRecoverySnapshot` — strongly consistent full snapshot for the pure recovery classifier.
2533
+ *
2534
+ * No operation claims exactly-once external side effects; the ledger records decisions
2535
+ * exactly once (DUR-003).
2536
+ */
2537
+ declare class SubmissionLedger extends SubmissionLedger_base {}
2538
+ /**
2539
+ * Deterministic identity rules shared by every adapter and the durable coordinator. The batch
2540
+ * carrying one Submission's canonical `UserInputRecorded` record is `submission-input:{sid}` and
2541
+ * the record is `input:{sid}`, so batch idempotency (DUR-007) makes the input append
2542
+ * exactly-once-canonical across Attempts.
2543
+ */
2544
+ declare const submissionInputBatchId: (submissionId: SubmissionId) => BatchId;
2545
+ /** Deterministic canonical record identity of one Submission's `UserInputRecorded` record. */
2546
+ declare const submissionInputRecordId: (submissionId: SubmissionId) => RecordId;
2547
+ /** Deterministic `SettlementId` for one Submission: `settlement:{sid}`. */
2548
+ declare const submissionSettlementId: (submissionId: SubmissionId) => SettlementId;
2549
+ /** Deterministic batch identity of one Submission's canonical `SubmissionSettled` append. */
2550
+ declare const submissionSettlementBatchId: (submissionId: SubmissionId) => BatchId;
2551
+ /** Deterministic canonical record identity of one Submission's `SubmissionSettled` record. */
2552
+ declare const submissionSettlementRecordId: (submissionId: SubmissionId) => RecordId;
2553
+ /** Deterministic batch identity of one Submission's canonical `AbortRequested` append. */
2554
+ declare const submissionAbortBatchId: (submissionId: SubmissionId) => BatchId;
2555
+ /** Deterministic canonical record identity of one Submission's `AbortRequested` record. */
2556
+ declare const submissionAbortRecordId: (submissionId: SubmissionId) => RecordId;
2557
+ /** Destination policy, captured when the ledger is acquired. It runs inside fresh admission's
2558
+ * serialization after replay lookup. The host must keep it bounded and must not reenter admit.
2559
+ * The callback must read authoritative policy in this SAME local transaction, through the
2560
+ * acquired SqlClient. Memory evaluates the callback synchronously inside its atomic mutation;
2561
+ * an async callback fails with `unavailable/synchronous-memory-policy-required`. Remote reads do not fence remote changes.
2562
+ * All policy writers must use that transaction owner. Do not fork, reenter admission, or retain
2563
+ * transaction resources. Failure/defect/interruption commits no fresh admission.
2564
+ * Current policy never invalidates an exact retained receipt. A supplied fence fails closed
2565
+ * unless the destination installed an interpreter for it. */
2566
+ declare const SubmissionAdmissionFence: Context.Reference<{
2567
+ readonly check: (request: AdmissionRequest) => Effect.Effect<void, AdmissionPolicyError>;
2568
+ }>;
2569
+ declare namespace Recovery_d_exports {
2570
+ export { AppendReservedSettlement, ApplyInput, ApplyJoinAccounting, ApplyUnknownResolutions, AwaitApprovalDecision, AwaitChildAdmissionResolution, AwaitChildSettlement, AwaitHostSettlement, AwaitParentEstablishment, AwaitUnknownResolution, CompleteChildAdmission, CompleteMaterialization, DeclaredPendingBatchEvidence, DelegationAdmissionEvidence, EnsureWaitingForChild, FinalizeLedgerFromHistory, MarkUnknown, NoAction, OpenDelegationCallEvidence, OpenToolCallEvidence, PendingApprovalEvidence, PropagateChildAbort, RecoveryDecision, RecoveryEvidence, ReleaseOrphanChildReservation, RepairInputMarker, RepairJoinMarker, RepairReadiness, RepairSubagentStartLink, ResumeFromTurnBoundary, ResumePendingToolBatch, ResumeSuspended, ResumeWaitingParent, RevertJoining, SettleAborted, SettleJoinedWithHost, classifyRecovery };
2571
+ }
2572
+ declare const OpenToolCallEvidence_base: Schema.Class<OpenToolCallEvidence, Schema.Struct<{
2573
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2574
+ readonly toolName: Schema.NonEmptyString;
2575
+ readonly turn: Schema.Int;
2576
+ }>, {}>;
2577
+ /** One canonical `ToolCallPrepared` without a settling or resolving canonical record (DUR-009). */
2578
+ declare class OpenToolCallEvidence extends OpenToolCallEvidence_base {}
2579
+ declare const DeclaredPendingBatchEvidence_base: Schema.Class<DeclaredPendingBatchEvidence, Schema.Struct<{
2580
+ readonly turn: Schema.Int;
2581
+ readonly callCount: Schema.Int;
2582
+ }>, {}>;
2583
+ /**
2584
+ * A committed tool-declaring response with ZERO prepared and ZERO settled records for its Turn:
2585
+ * the durability §15 batch-resume window. Mutation preparation has not committed; readonly
2586
+ * handlers may already have run. The worker checks each unfinished operation before execution.
2587
+ */
2588
+ declare class DeclaredPendingBatchEvidence extends DeclaredPendingBatchEvidence_base {}
2589
+ declare const PendingApprovalEvidence_base: Schema.Class<PendingApprovalEvidence, Schema.Struct<{
2590
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2591
+ readonly turn: Schema.Int;
2592
+ }>, {}>;
2593
+ /** One canonical `ToolApprovalRequested` without a canonical `ToolApprovalDecided`. */
2594
+ declare class PendingApprovalEvidence extends PendingApprovalEvidence_base {}
2595
+ /**
2596
+ * The authoritative tri-state admission answer recorded as pure classifier evidence (SUB-031):
2597
+ * the recovery pass queries `resolveAdmission` with the deterministic child idempotency key for
2598
+ * a requested-but-unstarted delegation call and records the result here. Absence of this field
2599
+ * means the lookup was not performed — the classifier treats that exactly like `indeterminate`
2600
+ * (fail-closed: only a proven `not-admitted` ever permits an admission attempt).
2601
+ */
2602
+ declare const DelegationAdmissionEvidence: Schema.Literals<readonly ["not-admitted", "admitted", "indeterminate"]>;
2603
+ type DelegationAdmissionEvidence = typeof DelegationAdmissionEvidence.Type;
2604
+ declare const OpenDelegationCallEvidence_base: Schema.Class<OpenDelegationCallEvidence, Schema.Struct<{
2605
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2606
+ readonly toolName: Schema.NonEmptyString;
2607
+ readonly turn: Schema.Int;
2608
+ /** The canonical `SubagentRequested` record exists for this call. */
2609
+ readonly requested: Schema.Boolean;
2610
+ /** The canonical `SubagentStarted` record exists for this call. */
2611
+ readonly started: Schema.Boolean;
2612
+ /** The canonical `SubagentJoined` record exists for this call. */
2613
+ readonly joined: Schema.Boolean;
2614
+ readonly childThreadId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">>;
2615
+ readonly childSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
2616
+ readonly admission: Schema.optionalKey<Schema.Literals<readonly ["not-admitted", "admitted", "indeterminate"]>>;
2617
+ }>, {}>;
2618
+ /**
2619
+ * One prepared-without-outcome parent Tool Call that IS a delegation (plan §4.1), separated from
2620
+ * `openToolCalls` because its establishment protocol is idempotent by construction and must
2621
+ * NEVER be marked Unknown (spec §13 vs. DUR-009). Delegation detection is durable and
2622
+ * fail-closed: canonical preparation records carry the definition-owned execution kind;
2623
+ * child reservations and request records must agree with that classification. Names never
2624
+ * authorize replay, including in the pre-reservation window. The
2625
+ * `requested`/`started`/`joined` flags come from the parent-log canonical records; the child
2626
+ * identity fields are present exactly when those records (or the reservation attachment) carry
2627
+ * them.
2628
+ */
2629
+ declare class OpenDelegationCallEvidence extends OpenDelegationCallEvidence_base {}
2630
+ declare const RecoveryEvidence_base: Schema.Class<RecoveryEvidence, Schema.Struct<{
2631
+ /** The Thread exists in the ThreadStore. */
2632
+ readonly threadMaterialized: Schema.Boolean;
2633
+ /** The deterministic canonical `UserInputRecorded` record (`input:{sid}`) is committed. */
2634
+ readonly inputRecorded: Schema.Boolean;
2635
+ /**
2636
+ * The committed canonical `SubmissionSettled` outcome (`settlement:{sid}`). Present exactly
2637
+ * when the canonical settlement record exists, so the flag and the outcome cannot diverge.
2638
+ */
2639
+ readonly recordedSettlementOutcome: Schema.optionalKey<Schema.Literals<readonly ["completed", "failed", "aborted"]>>;
2640
+ /** The deterministic canonical `AbortRequested` record (`abort:{sid}`) is committed. */
2641
+ readonly abortRecorded: Schema.Boolean;
2642
+ /** Prepared ordinary Tool Calls without a canonical settled/resolved outcome (DUR-009). */
2643
+ readonly openToolCalls: Schema.$Array<typeof OpenToolCallEvidence>;
2644
+ /**
2645
+ * Delegation Tool Calls with an open parent-side obligation (plan §4.1), removed from
2646
+ * `openToolCalls`. Wire-required; construction alone defaults it so pre-S2 evidence
2647
+ * assemblers stay valid while the classifier's fail-closed detection still protects them.
2648
+ */
2649
+ readonly openDelegationCalls: Schema.withConstructorDefault<Schema.$Array<typeof OpenDelegationCallEvidence>>;
2650
+ /** Only persisted orchestration classification authorizes idempotent host-operation replay. */
2651
+ readonly openWorkerCalls: Schema.optionalKey<Schema.$Array<typeof OpenToolCallEvidence>>;
2652
+ /** A declared-but-unprepared tool batch: response canonical, zero prepared, zero settled. */
2653
+ readonly declaredPendingBatch: Schema.optionalKey<typeof DeclaredPendingBatchEvidence>;
2654
+ /** Canonically requested approvals without a canonical decision. */
2655
+ readonly approvalsPending: Schema.$Array<typeof PendingApprovalEvidence>;
2656
+ /** Joined-side prompt coverage (plan §2.5); `true` whenever the Submission is not joined. */
2657
+ readonly joinedInputCovered: Schema.Boolean;
2658
+ /** Joined-side view of the host's canonical settlement record, when it exists. */
2659
+ readonly hostSettlementOutcome: Schema.optionalKey<Schema.Literals<readonly ["completed", "failed", "aborted"]>>;
2660
+ /**
2661
+ * The Thread carries its canonical `SubagentLineageRecorded` record. Only
2662
+ * consulted for a parent-linked Submission: a child whose lineage is not yet canonical defers
2663
+ * its own materialization/readiness repair to the parent's idempotent establishment
2664
+ * (`AwaitParentEstablishment`). Defaults to `false` so an assembler that does not compute it
2665
+ * stays fail-closed: deferring is safe because the parent's establishment completes the child;
2666
+ * running a Turn before lineage is recorded would violate the child establishment ordering.
2667
+ */
2668
+ readonly subagentLineageRecorded: Schema.withConstructorDefault<Schema.Boolean>;
2669
+ }>, {}>;
2670
+ /**
2671
+ * Canonical-log facts about one Submission, read strongly consistently alongside the ledger
2672
+ * `RecoverySnapshot` (STORE-003). Canonical history wins over every ledger marker (DUR-015), so
2673
+ * the classifier consults these facts before trusting ledger state — with one deliberate Phase 5
2674
+ * inversion: a RECORDED terminal outcome now beats open tool calls, because a canonical
2675
+ * settlement is never revisited (DUR-002/DUR-015); the P4 rule that unknown-beats-settlement is
2676
+ * gone.
2677
+ *
2678
+ * `openToolCalls` is the DUR-009 seam: every `ToolCallPrepared` without a matching
2679
+ * `ToolCallSettled` or `ToolCallResolved`. S2 separates `openDelegationCalls` from it (plan
2680
+ * §4.1): a delegation's prepared-without-outcome state is provably replay-safe, so those calls
2681
+ * route through the Subagent recovery rows and never through `MarkUnknown`. Names and
2682
+ * operational reservation rows cannot upgrade ordinary classification. `joinedInputCovered`
2683
+ * implements the plan §2.5 prompt-coverage rule for the joined side: a joined input is covered
2684
+ * iff a later `ModelResponseRecorded` of the host Run exists after the `input:{sid}` record.
2685
+ * `hostSettlementOutcome` is the joined-side view of the host's canonical `SubmissionSettled`
2686
+ * record, present exactly when that record exists.
2687
+ */
2688
+ declare class RecoveryEvidence extends RecoveryEvidence_base {}
2689
+ declare const CompleteMaterialization_base: Schema.Class<CompleteMaterialization, Schema.TaggedStruct<"CompleteMaterialization", {
2690
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2691
+ }>, {}>;
2692
+ /** Ledger admission committed but the Thread is not durable: finish materialization,
2693
+ * append `ThreadCreated`, and mark readiness (crash between admit and materialize). */
2694
+ declare class CompleteMaterialization extends CompleteMaterialization_base {}
2695
+ declare const RepairReadiness_base: Schema.Class<RepairReadiness, Schema.TaggedStruct<"RepairReadiness", {
2696
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2697
+ }>, {}>;
2698
+ /** Thread durable but the readiness marker is missing: idempotent `markReady`. */
2699
+ declare class RepairReadiness extends RepairReadiness_base {}
2700
+ declare const ApplyInput_base: Schema.Class<ApplyInput, Schema.TaggedStruct<"ApplyInput", {
2701
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2702
+ }>, {}>;
2703
+ /** No canonical input yet: append the deterministic `UserInputRecorded` record and mark it. */
2704
+ declare class ApplyInput extends ApplyInput_base {}
2705
+ declare const RepairInputMarker_base: Schema.Class<RepairInputMarker, Schema.TaggedStruct<"RepairInputMarker", {
2706
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2707
+ }>, {}>;
2708
+ /** Canonical input exists but the ledger marker was lost: repair the marker only (DUR-015). */
2709
+ declare class RepairInputMarker extends RepairInputMarker_base {}
2710
+ declare const ResumeFromTurnBoundary_base: Schema.Class<ResumeFromTurnBoundary, Schema.TaggedStruct<"ResumeFromTurnBoundary", {
2711
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2712
+ }>, {}>;
2713
+ /** Input applied and no terminal work reserved: a worker resumes the Run from the last committed
2714
+ * Turn boundary (D6; the model may be re-invoked, duplicate cost is observable — the resuming
2715
+ * worker appends `ModelResponseInterrupted` when superseding a prior owner, durability §9). */
2716
+ declare class ResumeFromTurnBoundary extends ResumeFromTurnBoundary_base {}
2717
+ declare const AppendReservedSettlement_base: Schema.Class<AppendReservedSettlement, Schema.TaggedStruct<"AppendReservedSettlement", {
2718
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2719
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
2720
+ readonly outcome: Schema.Literals<readonly ["completed", "failed", "aborted"]>;
2721
+ }>, {}>;
2722
+ /** A settlement is reserved but not canonical: append the EXACT reserved record, then finalize. */
2723
+ declare class AppendReservedSettlement extends AppendReservedSettlement_base {}
2724
+ declare const FinalizeLedgerFromHistory_base: Schema.Class<FinalizeLedgerFromHistory, Schema.TaggedStruct<"FinalizeLedgerFromHistory", {
2725
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2726
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
2727
+ readonly outcome: Schema.Literals<readonly ["completed", "failed", "aborted"]>;
2728
+ }>, {}>;
2729
+ /** The canonical settlement record exists: rebuild/finalize the ledger from history and never
2730
+ * rewrite history from the cached ledger status (DUR-011, DUR-015). */
2731
+ declare class FinalizeLedgerFromHistory extends FinalizeLedgerFromHistory_base {}
2732
+ declare const SettleAborted_base: Schema.Class<SettleAborted, Schema.TaggedStruct<"SettleAborted", {
2733
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2734
+ }>, {}>;
2735
+ /** A durable abort intent exists, no terminal outcome is reserved, and no attached-child
2736
+ * obligation remains open: settle aborted (DUR-012). The executor first appends
2737
+ * `ToolCallUnknown` audit records for any open ordinary calls — abort settles the obligation but
2738
+ * never asserts external rollback (durability §13). */
2739
+ declare class SettleAborted extends SettleAborted_base {}
2740
+ declare const MarkUnknown_base: Schema.Class<MarkUnknown, Schema.TaggedStruct<"MarkUnknown", {
2741
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2742
+ readonly reason: Schema.String;
2743
+ readonly openToolCallIds: Schema.$Array<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">>;
2744
+ }>, {}>;
2745
+ /** Prepared ordinary Tool Calls have no canonical outcome: the executor reconciles each open
2746
+ * call (recovered result / never-started / safe-retry) and marks the remainder Unknown — never
2747
+ * an automatic replay (DUR-009/DUR-017). Delegation calls are excluded: their establishment is
2748
+ * idempotent by construction and routes through the Subagent rows instead (plan §4.3). */
2749
+ declare class MarkUnknown extends MarkUnknown_base {}
2750
+ declare const ResumePendingToolBatch_base: Schema.Class<ResumePendingToolBatch, Schema.TaggedStruct<"ResumePendingToolBatch", {
2751
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2752
+ readonly turn: Schema.Int;
2753
+ }>, {}>;
2754
+ /** A committed tool-declaring response has zero prepared and zero settled records: a worker
2755
+ * checks unfinished contracts and resumes the declared batch without model re-invocation. S2 also
2756
+ * routes an open delegation call WITHOUT establishment evidence here (spec §13 row 1): the
2757
+ * declared batch re-executes and the idempotent establishment converges on one child. */
2758
+ declare class ResumePendingToolBatch extends ResumePendingToolBatch_base {}
2759
+ declare const AwaitApprovalDecision_base: Schema.Class<AwaitApprovalDecision, Schema.TaggedStruct<"AwaitApprovalDecision", {
2760
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2761
+ }>, {}>;
2762
+ /** Canonically requested approvals lack decisions: the lane waits durably (the executor repairs
2763
+ * the ledger suspension from history when the suspend transition itself was lost). */
2764
+ declare class AwaitApprovalDecision extends AwaitApprovalDecision_base {}
2765
+ declare const ResumeSuspended_base: Schema.Class<ResumeSuspended, Schema.TaggedStruct<"ResumeSuspended", {
2766
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2767
+ }>, {}>;
2768
+ /** Every pending approval has a durable decision: a worker resumes the declared batch via the
2769
+ * batch-resume seam, appending the canonical `ToolApprovalDecided` records first. */
2770
+ declare class ResumeSuspended extends ResumeSuspended_base {}
2771
+ declare const AwaitUnknownResolution_base: Schema.Class<AwaitUnknownResolution, Schema.TaggedStruct<"AwaitUnknownResolution", {
2772
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2773
+ }>, {}>;
2774
+ /** Unknown Outcomes lack covering resolutions: this Submission stays parked awaiting the authorized
2775
+ * DUR-017 resolution path; the obligation stays visible, nothing replays. */
2776
+ declare class AwaitUnknownResolution extends AwaitUnknownResolution_base {}
2777
+ declare const ApplyUnknownResolutions_base: Schema.Class<ApplyUnknownResolutions, Schema.TaggedStruct<"ApplyUnknownResolutions", {
2778
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2779
+ }>, {}>;
2780
+ /** Durable resolution intents cover every open call: wake the original Submission when its
2781
+ * required retry contract is supported. Canonical outcomes are applied by the next claim. */
2782
+ declare class ApplyUnknownResolutions extends ApplyUnknownResolutions_base {}
2783
+ declare const RevertJoining_base: Schema.Class<RevertJoining, Schema.TaggedStruct<"RevertJoining", {
2784
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2785
+ }>, {}>;
2786
+ /** `joining` without a canonical `input:{sid}` record: revert to `ready` — the input was never
2787
+ * consumed and will be delivered exactly once later (DUR-016). */
2788
+ declare class RevertJoining extends RevertJoining_base {}
2789
+ declare const RepairJoinMarker_base: Schema.Class<RepairJoinMarker, Schema.TaggedStruct<"RepairJoinMarker", {
2790
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2791
+ }>, {}>;
2792
+ /** The canonical input exists but the `joined` marker was lost: repair the marker only, exactly
2793
+ * like `RepairInputMarker` (DUR-015/DUR-016); the input reattaches, never duplicates. */
2794
+ declare class RepairJoinMarker extends RepairJoinMarker_base {}
2795
+ declare const SettleJoinedWithHost_base: Schema.Class<SettleJoinedWithHost, Schema.TaggedStruct<"SettleJoinedWithHost", {
2796
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2797
+ readonly outcome: Schema.Literals<readonly ["completed", "failed", "aborted"]>;
2798
+ }>, {}>;
2799
+ /** The host Run settled canonically: settle this joined Submission with the host outcome
2800
+ * (each joined Submission is owed its own settlement, DUR-002). */
2801
+ declare class SettleJoinedWithHost extends SettleJoinedWithHost_base {}
2802
+ declare const AwaitHostSettlement_base: Schema.Class<AwaitHostSettlement, Schema.TaggedStruct<"AwaitHostSettlement", {
2803
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2804
+ readonly hostSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
2805
+ }>, {}>;
2806
+ /** The Submission is `joined` and its host Run is still live: nothing to repair — the input
2807
+ * reattaches through the host's resume and the Submission settles with the host. */
2808
+ declare class AwaitHostSettlement extends AwaitHostSettlement_base {}
2809
+ declare const CompleteChildAdmission_base: Schema.Class<CompleteChildAdmission, Schema.TaggedStruct<"CompleteChildAdmission", {
2810
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2811
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2812
+ }>, {}>;
2813
+ /** A canonical `SubagentRequested` exists and the authoritative admission lookup proved
2814
+ * `notAdmitted`: idempotently admit the intended child from the canonical request payload — it
2815
+ * carries the encoded child input (D3), the intended child identity, and every digest — then
2816
+ * materialize the child Thread, append its immutable lineage, and mark it ready. No live
2817
+ * delegation handler is required (spec §13, SUB-016/SUB-031). */
2818
+ declare class CompleteChildAdmission extends CompleteChildAdmission_base {}
2819
+ declare const AwaitChildAdmissionResolution_base: Schema.Class<AwaitChildAdmissionResolution, Schema.TaggedStruct<"AwaitChildAdmissionResolution", {
2820
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2821
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2822
+ }>, {}>;
2823
+ /** A canonical `SubagentRequested` exists but the authoritative admission lookup answered
2824
+ * `indeterminate` — or was not (yet) performed: wait and retry the authoritative owner directly.
2825
+ * Absence from a projection is never proof of absence and a second admission NEVER occurs
2826
+ * (spec §12, SUB-031). */
2827
+ declare class AwaitChildAdmissionResolution extends AwaitChildAdmissionResolution_base {}
2828
+ declare const RepairSubagentStartLink_base: Schema.Class<RepairSubagentStartLink, Schema.TaggedStruct<"RepairSubagentStartLink", {
2829
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2830
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2831
+ }>, {}>;
2832
+ /** The child Submission is admitted but the parent's `SubagentStarted` link is missing (or its
2833
+ * reservation attachment was lost): resolve the SAME child by its deterministic idempotency key
2834
+ * and append the exact deterministic start record, then attach the child to its reservation —
2835
+ * the same Receipt on every replay (spec §13, SUB-016/SUB-017). */
2836
+ declare class RepairSubagentStartLink extends RepairSubagentStartLink_base {}
2837
+ declare const EnsureWaitingForChild_base: Schema.Class<EnsureWaitingForChild, Schema.TaggedStruct<"EnsureWaitingForChild", {
2838
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2839
+ readonly children: Schema.NonEmptyArray<typeof WaitingChild>;
2840
+ }>, {}>;
2841
+ /** Children are established and at least one is nonterminal while the parent lane is NOT
2842
+ * durably suspended: restore the `waitingForChild` suspension so the lane holds no worker
2843
+ * permit while each child runs on its own lane. Recovery reattaches the one existing child and
2844
+ * NEVER spawns a replacement (spec §13, SUB-018/SUB-030). */
2845
+ declare class EnsureWaitingForChild extends EnsureWaitingForChild_base {}
2846
+ declare const AwaitChildSettlement_base: Schema.Class<AwaitChildSettlement, Schema.TaggedStruct<"AwaitChildSettlement", {
2847
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2848
+ }>, {}>;
2849
+ /** The parent is durably suspended `WaitingForChild` and at least one listed child is not yet
2850
+ * provably settled: the lane stays dormant and consumes no permit; the child's Settlement wakes
2851
+ * it durably (spec §12 step 10). An unresolved ordinary Tool inside a child keeps the parent
2852
+ * here honestly — the obligation stays visible and aged, nothing is fabricated (SUB-021). */
2853
+ declare class AwaitChildSettlement extends AwaitChildSettlement_base {}
2854
+ declare const ResumeWaitingParent_base: Schema.Class<ResumeWaitingParent, Schema.TaggedStruct<"ResumeWaitingParent", {
2855
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2856
+ readonly children: Schema.NonEmptyArray<typeof WaitingChild>;
2857
+ }>, {}>;
2858
+ /** Every relevant child is provably settled but the parent has not joined (legacy data, or a
2859
+ * canonical settlement whose idempotent wake still needs replay): record/replay the durable wake
2860
+ * so a claiming worker resumes the declared batch and joins each child's canonical Settlement —
2861
+ * the join itself needs the parent Binding and is deferred to that worker (spec §13). */
2862
+ declare class ResumeWaitingParent extends ResumeWaitingParent_base {}
2863
+ declare const ApplyJoinAccounting_base: Schema.Class<ApplyJoinAccounting, Schema.TaggedStruct<"ApplyJoinAccounting", {
2864
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2865
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2866
+ readonly reservationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ChildReservationId">;
2867
+ }>, {}>;
2868
+ /** The canonical `SubagentJoined` record exists but the reservation release is incomplete:
2869
+ * replay `beginChildBudgetRelease` with the accounting decision FROM the canonical record, then
2870
+ * apply `releaseChildBudget` — budget stays unavailable until repair, never available twice
2871
+ * (spec §12 join step 6, DUR-015). */
2872
+ declare class ApplyJoinAccounting extends ApplyJoinAccounting_base {}
2873
+ declare const PropagateChildAbort_base: Schema.Class<PropagateChildAbort, Schema.TaggedStruct<"PropagateChildAbort", {
2874
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2875
+ readonly children: Schema.NonEmptyArray<typeof WaitingChild>;
2876
+ }>, {}>;
2877
+ /** Parent abort is canonical while attached children are nonterminal: idempotently issue each
2878
+ * child's durable abort command and keep the parent waiting for the joins —
2879
+ * request-abort-and-join is the ONLY close behavior; the replayed command returns the recorded
2880
+ * child intent unchanged, so the intent row IS the propagation marker (spec §13.1, SUB-022,
2881
+ * DUR-012). */
2882
+ declare class PropagateChildAbort extends PropagateChildAbort_base {}
2883
+ declare const ReleaseOrphanChildReservation_base: Schema.Class<ReleaseOrphanChildReservation, Schema.TaggedStruct<"ReleaseOrphanChildReservation", {
2884
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2885
+ readonly reservationIds: Schema.NonEmptyArray<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ChildReservationId">>;
2886
+ }>, {}>;
2887
+ /** A child budget reservation can no longer bind a child — its request is absent with no
2888
+ * resumable batch, or the parent is aborting and the child provably never admitted: freeze the
2889
+ * deterministic zero-consumed accounting decision and release the unused allocation exactly
2890
+ * once (spec §13/§14: "releases the reservation exactly once"). */
2891
+ declare class ReleaseOrphanChildReservation extends ReleaseOrphanChildReservation_base {}
2892
+ declare const AwaitParentEstablishment_base: Schema.Class<AwaitParentEstablishment, Schema.TaggedStruct<"AwaitParentEstablishment", {
2893
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2894
+ readonly parentSubmissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2895
+ readonly parentToolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
2896
+ }>, {}>;
2897
+ /**
2898
+ * A parent-linked `admitted` Submission whose Thread lacks the canonical
2899
+ * `SubagentLineageRecorded` record: the child lane DEFERS its own materialization/readiness
2900
+ * repair — the parent's idempotent establishment (admit → materialize → lineage → ready)
2901
+ * completes it, so a child never runs a Turn before its lineage record is canonical.
2902
+ * This preserves the child establishment ordering. It is ordering/liveness hygiene, not a
2903
+ * safety repair — the join already fails closed without lineage (SUB-019).
2904
+ */
2905
+ declare class AwaitParentEstablishment extends AwaitParentEstablishment_base {}
2906
+ declare const NoAction_base: Schema.Class<NoAction, Schema.TaggedStruct<"NoAction", {
2907
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2908
+ }>, {}>;
2909
+ /** The Submission is settled; nothing is owed. */
2910
+ declare class NoAction extends NoAction_base {}
2911
+ /** The executable recovery decision table's output alphabet (plan §Recovery classifier). */
2912
+ declare const RecoveryDecision: Schema.Union<readonly [typeof CompleteMaterialization, typeof RepairReadiness, typeof ApplyInput, typeof RepairInputMarker, typeof ResumeFromTurnBoundary, typeof AppendReservedSettlement, typeof FinalizeLedgerFromHistory, typeof SettleAborted, typeof MarkUnknown, typeof ResumePendingToolBatch, typeof AwaitApprovalDecision, typeof ResumeSuspended, typeof AwaitUnknownResolution, typeof ApplyUnknownResolutions, typeof RevertJoining, typeof RepairJoinMarker, typeof SettleJoinedWithHost, typeof AwaitHostSettlement, typeof CompleteChildAdmission, typeof AwaitChildAdmissionResolution, typeof RepairSubagentStartLink, typeof EnsureWaitingForChild, typeof AwaitChildSettlement, typeof ResumeWaitingParent, typeof ApplyJoinAccounting, typeof PropagateChildAbort, typeof ReleaseOrphanChildReservation, typeof AwaitParentEstablishment, typeof NoAction]>;
2913
+ type RecoveryDecision = typeof RecoveryDecision.Type;
2914
+ /**
2915
+ * Pure recovery classifier (durability §14, DUR-013): a finite persisted snapshot plus canonical
2916
+ * evidence deterministically selects exactly one decision. Precedence, most-settled first
2917
+ * (plan §4.2/§4.3 — note the deliberate P5 reorder: canonical settlement and reservation beat
2918
+ * open tool calls, because a recorded terminal outcome is never revisited, DUR-002/DUR-015; and
2919
+ * the three S2 edits: the abort row propagates to nonterminal attached children, delegation
2920
+ * calls never mark Unknown, and the suspended row branches on the suspension reason):
2921
+ *
2922
+ * 1. `settled` → NoAction — terminal outcomes are never revisited (DUR-002).
2923
+ * 2. canonical settlement record → FinalizeLedgerFromHistory — history beats every ledger
2924
+ * marker (DUR-015), including a missing or divergent reservation AND open tool calls.
2925
+ * 3. reservation → FinalizeLedgerFromHistory when finalized, else AppendReservedSettlement —
2926
+ * the reserved record is the single exact outcome owed (DUR-011); it also beats a pending
2927
+ * abort intent (DUR-012).
2928
+ * 4. joined-side states (DUR-016): `joining` without canonical input → RevertJoining; `joining`
2929
+ * with canonical input → RepairJoinMarker (marker lost); `joined` + host settled →
2930
+ * SettleJoinedWithHost; `joined` + host live → AwaitHostSettlement (deferred).
2931
+ * 5. abort intent → the S2 abort rows (spec §13.1 request-abort-and-join): an unproven child
2932
+ * admission waits, an admitted-but-unlinked child repairs its start link, a nonterminal
2933
+ * attached child gets PropagateChildAbort — the parent does NOT settle — terminal children
2934
+ * are joined, incomplete releases applied, provably childless reservations released; ONLY a
2935
+ * parent with no open child obligation reaches SettleAborted, where open ordinary calls
2936
+ * become `ToolCallUnknown` audit records, never a rollback claim (§13). SettleAborted is
2937
+ * position-blind by design (P7 §7(c)): an aborted, never-claimed `ready` Submission earns it
2938
+ * ANYWHERE in the queue — the executor settles it immediately without waiting for it to head
2939
+ * the lane, because settlement order of never-run work is not execution order (DUR-004
2940
+ * bounds execution order; DUR-012 permits settling inactive accepted work without an
2941
+ * Attempt).
2942
+ * 6. ordinary open tool calls (state not yet `unknown`) → MarkUnknown — reconcile-then-mark,
2943
+ * never an automatic replay (DUR-009). Delegation calls are EXCLUDED (plan §4.3's most
2944
+ * important edit): their prepared-without-outcome state is provably replay-safe and routes
2945
+ * through rows 5/8/9 instead. A lane already `unknown` is in the DUR-017 resolution regime
2946
+ * (row 7) and is not re-marked.
2947
+ * 7. state `unknown` → ApplyUnknownResolutions when durable intents cover every open ordinary
2948
+ * call, else AwaitUnknownResolution.
2949
+ * 8. state `suspended` branches on the stored reason: `WaitingForChild` → ResumeWaitingParent
2950
+ * when every listed child is provably settled (replay the idempotent wake), else
2951
+ * AwaitChildSettlement (SUB-030); `ApprovalPending` keeps the P5 behavior — undecided
2952
+ * canonical approval requests → AwaitApprovalDecision (repairing a lost suspend transition
2953
+ * from history), every request decided → ResumeSuspended.
2954
+ * 9. the S2 establishment/join rows for a live parent (spec §13, most-repairing first):
2955
+ * ApplyJoinAccounting → CompleteChildAdmission → RepairSubagentStartLink →
2956
+ * AwaitChildAdmissionResolution → ResumePendingToolBatch (idempotent handler re-entry) →
2957
+ * EnsureWaitingForChild → ResumeWaitingParent → ReleaseOrphanChildReservation.
2958
+ * 10. declared-but-unprepared tool batch → ResumePendingToolBatch — the worker checks original
2959
+ * operation contracts; missing preparation proves no mutation dispatch, not readonly nonexecution (§15).
2960
+ * 11. `admitted` → a parent-linked Submission whose Thread lacks the canonical lineage
2961
+ * record defers (AwaitParentEstablishment: the parent's idempotent establishment
2962
+ * completes it); otherwise
2963
+ * CompleteMaterialization / RepairReadiness by Thread durability.
2964
+ * 12. otherwise → ApplyInput / RepairInputMarker / ResumeFromTurnBoundary by canonical input
2965
+ * evidence, with the ledger marker repaired from history, never the reverse.
2966
+ *
2967
+ * A CHILD Submission (one whose snapshot carries `parentLinkage`) classifies through exactly
2968
+ * the same rows as any Submission — child recovery proceeds under its own ownership token and
2969
+ * epoch (spec §13, SUB-020); nothing here consults the parent's lane.
2970
+ *
2971
+ * Ownership leases are deliberately ignored here: the executor's fenced claim is the only
2972
+ * authority over liveness, and a stale Attempt is fenced by producer epoch regardless (DUR-006).
2973
+ */
2974
+ declare const classifyRecovery: (snapshot: RecoverySnapshot, evidence: RecoveryEvidence) => RecoveryDecision;
2975
+ declare namespace Admin_d_exports {
2976
+ export { ExplainedEvidence, ExplainedSubmission, ExplainedUnknownCall, IntegrityCheck, IntegrityCheckName, IntegrityCheckStatus, IntegrityReport, ObligationBlockedOn, ObligationEntry, ObligationReport, ObligationSeverity, ObligationThresholds, RECOVERY_DECISION_MEANINGS, RecoveryDisposition, RecoveryExplanation, RetryCommand, RetryRefusalReason, RetryRefused, obligationSeverityOf, predictRecoveryDisposition, recoveryDecisionMeaning, renderRecoveryExplanation };
2977
+ }
2978
+ /**
2979
+ * The disposition family of `RecoveryReport`, reused verbatim so an explanation predicts exactly
2980
+ * what `runRecovery`/`retry` would report for the same decision.
2981
+ */
2982
+ declare const RecoveryDisposition: Schema.Literals<readonly ["repaired", "deferred", "none", "unknown"]>;
2983
+ type RecoveryDisposition = typeof RecoveryDisposition.Type;
2984
+ declare const ExplainedSubmission_base: Schema.Class<ExplainedSubmission, Schema.Struct<{
2985
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
2986
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
2987
+ readonly state: Schema.Literals<readonly ["admitted", "ready", "joining", "joined", "running", "input-applied", "suspended", "unknown", "terminalizing", "settled"]>;
2988
+ readonly queueSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/QueueSequence">;
2989
+ readonly createdAt: Schema.DateTimeUtcFromString;
2990
+ readonly readyAt: Schema.optionalKey<Schema.DateTimeUtcFromString>;
2991
+ /** Whole seconds since admission (`createdAt`). */
2992
+ readonly ageSeconds: Schema.Int;
2993
+ /** Whole seconds since readiness, present exactly when `readyAt` is recorded. */
2994
+ readonly readyAgeSeconds: Schema.optionalKey<Schema.Int>;
2995
+ readonly parentLinkage: Schema.optionalKey<typeof ParentLinkage>;
2996
+ }>, {}>;
2997
+ /** Submission identity, lane position, and Clock-derived ages (DUR-017 obligation visibility). */
2998
+ declare class ExplainedSubmission extends ExplainedSubmission_base {}
2999
+ declare const ExplainedUnknownCall_base: Schema.Class<ExplainedUnknownCall, Schema.Struct<{
3000
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
3001
+ readonly toolName: Schema.NonEmptyString;
3002
+ readonly reason: Schema.String;
3003
+ readonly recordedAt: Schema.DateTimeUtcFromString;
3004
+ /** A real canonical ToolCallSettled closes this call; an intent alone is not an outcome. */
3005
+ readonly resolved: Schema.Boolean;
3006
+ }>, {}>;
3007
+ /** One durable Unknown Outcome and whether its result is canonical (DUR-017). */
3008
+ declare class ExplainedUnknownCall extends ExplainedUnknownCall_base {}
3009
+ declare const ExplainedEvidence_base: Schema.Class<ExplainedEvidence, Schema.Struct<{
3010
+ readonly threadMaterialized: Schema.Boolean;
3011
+ readonly inputRecorded: Schema.Boolean;
3012
+ readonly abortRecorded: Schema.Boolean;
3013
+ readonly recordedSettlementOutcome: Schema.optionalKey<Schema.Literals<readonly ["completed", "failed", "aborted"]>>;
3014
+ /** Prepared ordinary Tool Calls without a canonical outcome (DUR-009). */
3015
+ readonly openToolCalls: Schema.$Array<typeof OpenToolCallEvidence>;
3016
+ /** Original prepared operation identities, arguments and recovery contracts; settled calls are excluded. */
3017
+ readonly pendingOperations: Schema.withConstructorDefault<Schema.$Array<typeof ToolCallPrepared>>;
3018
+ /** Delegation Tool Calls with an open parent-side obligation. */
3019
+ readonly openDelegationCalls: Schema.$Array<typeof OpenDelegationCallEvidence>;
3020
+ /** Canonically requested approvals without a canonical decision. */
3021
+ readonly approvalsPending: Schema.$Array<typeof PendingApprovalEvidence>;
3022
+ /** Durable Unknown Outcomes with their resolution coverage (DUR-017). */
3023
+ readonly unknownCalls: Schema.$Array<typeof ExplainedUnknownCall>;
3024
+ /** Durable approval decisions recorded against this Submission. */
3025
+ readonly approvalDecisions: Schema.$Array<typeof ApprovalDecisionIntent>;
3026
+ /** Durable unknown-outcome resolutions recorded against this Submission. */
3027
+ readonly unknownResolutions: Schema.$Array<typeof UnknownResolutionIntent>;
3028
+ /** Parent-side child attachments. */
3029
+ readonly childAttachments: Schema.$Array<typeof ChildAttachmentSnapshot>;
3030
+ /** Host-side joined/joining members of this Submission's Run (DUR-016). */
3031
+ readonly joins: Schema.$Array<typeof JoinSnapshot>;
3032
+ /** Joined-side host identity, when this Submission is joined to a host Run. */
3033
+ readonly hostSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
3034
+ readonly suspension: Schema.optionalKey<typeof SuspensionSnapshot>;
3035
+ readonly abortIntent: Schema.optionalKey<typeof AbortIntent>;
3036
+ }>, {}>;
3037
+ /**
3038
+ * The evidence summary of one explanation: the classifier's canonical-history inputs plus the
3039
+ * durable intents and subagent attachments the ledger snapshot carries. Everything is read-only
3040
+ * observation — assembling this value performs zero writes.
3041
+ */
3042
+ declare class ExplainedEvidence extends ExplainedEvidence_base {}
3043
+ declare const RecoveryExplanation_base: Schema.Class<RecoveryExplanation, Schema.Struct<{
3044
+ readonly submission: typeof ExplainedSubmission;
3045
+ readonly evidence: typeof ExplainedEvidence;
3046
+ readonly decision: Schema.Union<readonly [typeof CompleteMaterialization, typeof RepairReadiness, typeof ApplyInput, typeof RepairInputMarker, typeof ResumeFromTurnBoundary, typeof AppendReservedSettlement, typeof FinalizeLedgerFromHistory, typeof SettleAborted, typeof MarkUnknown, typeof ResumePendingToolBatch, typeof AwaitApprovalDecision, typeof ResumeSuspended, typeof AwaitUnknownResolution, typeof ApplyUnknownResolutions, typeof RevertJoining, typeof RepairJoinMarker, typeof SettleJoinedWithHost, typeof AwaitHostSettlement, typeof CompleteChildAdmission, typeof AwaitChildAdmissionResolution, typeof RepairSubagentStartLink, typeof EnsureWaitingForChild, typeof AwaitChildSettlement, typeof ResumeWaitingParent, typeof ApplyJoinAccounting, typeof PropagateChildAbort, typeof ReleaseOrphanChildReservation, typeof AwaitParentEstablishment, typeof NoAction]>;
3047
+ /** Static operator meaning of `decision._tag` (see `RECOVERY_DECISION_MEANINGS`). */
3048
+ readonly decisionMeaning: Schema.String;
3049
+ /**
3050
+ * The disposition `runRecovery` would report when this decision executes without claim
3051
+ * contention (see `predictRecoveryDisposition`): `repaired` = the recovery pass itself fixes
3052
+ * it; `deferred` = a claiming worker must finish it; `unknown` = durably blocked on the
3053
+ * authorized DUR-017 resolution path; `none` = settled, nothing owed.
3054
+ */
3055
+ readonly disposition: Schema.Literals<readonly ["repaired", "deferred", "none", "unknown"]>;
3056
+ readonly explainedAt: Schema.DateTimeUtcFromString;
3057
+ }>, {}>;
3058
+ /**
3059
+ * The read-only recovery explanation of one Submission (P7 exit gate "operators can explain
3060
+ * recovery state without editing storage"): the submission summary, the evidence the pure
3061
+ * classifier consumed, the exact `RecoveryDecision` it selected, that decision's operator
3062
+ * meaning, and the disposition the recovery pass would report for it.
3063
+ */
3064
+ declare class RecoveryExplanation extends RecoveryExplanation_base {}
3065
+ /**
3066
+ * Operator meaning of every recovery decision tag, matching the classifier docstrings in
3067
+ * `recovery.ts` (the classifier remains the semantic authority; this table is its operator
3068
+ * rendering). Exhaustive over `RecoveryDecision` — adding a decision without a meaning is a
3069
+ * compile error here.
3070
+ */
3071
+ declare const RECOVERY_DECISION_MEANINGS: Readonly<Record<RecoveryDecision["_tag"], string>>;
3072
+ /** The operator meaning of one recovery decision tag. */
3073
+ declare const recoveryDecisionMeaning: (tag: RecoveryDecision["_tag"]) => string;
3074
+ /**
3075
+ * The disposition the recovery executor reports for a decision when its repair executes without
3076
+ * claim contention (pure prediction; `executeRecoveryDecision` in the coordinator remains the
3077
+ * execution authority — a lane concurrently claimed by a worker can always defer instead).
3078
+ * `AwaitApprovalDecision` depends on the snapshot: an already-suspended lane waits (`deferred`),
3079
+ * while a claimable lane with a lost suspend transition is repaired.
3080
+ */
3081
+ declare const predictRecoveryDisposition: (decision: RecoveryDecision, snapshot: RecoverySnapshot) => RecoveryDisposition;
3082
+ /** Pure operator text for one explanation (the CLI's `explain` output body). */
3083
+ declare const renderRecoveryExplanation: (explanation: RecoveryExplanation) => string;
3084
+ /** The named integrity checks `verifyThreadInvariants` performs. */
3085
+ declare const IntegrityCheckName: Schema.Literals<readonly ["schema-round-trip", "record-identity", "sequence-contiguity", "digest-chain", "fifo-input-order", "fifo-settlement-order", "terminal-uniqueness", "ledger-canonical-agreement", "checkpoint-binding", "all-settled"]>;
3086
+ type IntegrityCheckName = typeof IntegrityCheckName.Type;
3087
+ declare const IntegrityCheckStatus: Schema.Literals<readonly ["passed", "failed", "skipped"]>;
3088
+ type IntegrityCheckStatus = typeof IntegrityCheckStatus.Type;
3089
+ declare const IntegrityCheck_base: Schema.Class<IntegrityCheck, Schema.Struct<{
3090
+ readonly name: Schema.Literals<readonly ["schema-round-trip", "record-identity", "sequence-contiguity", "digest-chain", "fifo-input-order", "fifo-settlement-order", "terminal-uniqueness", "ledger-canonical-agreement", "checkpoint-binding", "all-settled"]>;
3091
+ readonly status: Schema.Literals<readonly ["passed", "failed", "skipped"]>;
3092
+ readonly detail: Schema.optionalKey<Schema.String>;
3093
+ }>, {}>;
3094
+ /** One typed check result; `detail` explains a failure or the honest reason for a skip. */
3095
+ declare class IntegrityCheck extends IntegrityCheck_base {}
3096
+ declare const IntegrityReport_base: Schema.Class<IntegrityReport, Schema.Struct<{
3097
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
3098
+ readonly tailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
3099
+ readonly recordCount: Schema.Int;
3100
+ readonly submissionCount: Schema.Int;
3101
+ readonly checks: Schema.$Array<typeof IntegrityCheck>;
3102
+ readonly ok: Schema.Boolean;
3103
+ }>, {}>;
3104
+ /**
3105
+ * The read-only integrity verdict for one Thread (plan §3 `verify`): typed per-check
3106
+ * results, never a repair. `ok` is true exactly when no check failed — skipped checks are
3107
+ * honest scope statements, not silent passes.
3108
+ */
3109
+ declare class IntegrityReport extends IntegrityReport_base {}
3110
+ /**
3111
+ * What one nonterminal Submission is visibly blocked on (DUR-017 operator surface; OPS-001).
3112
+ * `ready-aged`/`running-aged` are not blocks — they are accepted work whose settlement age is
3113
+ * measurable and alertable.
3114
+ */
3115
+ declare const ObligationBlockedOn: Schema.Literals<readonly ["unknown", "approval", "waitingForChild", "ready-aged", "running-aged"]>;
3116
+ type ObligationBlockedOn = typeof ObligationBlockedOn.Type;
3117
+ declare const ObligationSeverity: Schema.Literals<readonly ["ok", "aging", "overdue"]>;
3118
+ type ObligationSeverity = typeof ObligationSeverity.Type;
3119
+ declare const ObligationThresholds_base: Schema.Class<ObligationThresholds, Schema.Struct<{
3120
+ /** Age (whole seconds) at which an obligation is reported `aging`. */
3121
+ readonly agingSeconds: Schema.Int;
3122
+ /** Age (whole seconds) at which an obligation is reported `overdue`. */
3123
+ readonly overdueSeconds: Schema.Int;
3124
+ }>, {}>;
3125
+ /** Host-supplied age thresholds; the framework deliberately does not own the alert loop. */
3126
+ declare class ObligationThresholds extends ObligationThresholds_base {}
3127
+ declare const ObligationEntry_base: Schema.Class<ObligationEntry, Schema.Struct<{
3128
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
3129
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
3130
+ readonly state: Schema.Literals<readonly ["admitted", "ready", "joining", "joined", "running", "input-applied", "suspended", "unknown", "terminalizing", "settled"]>;
3131
+ readonly blockedOn: Schema.Literals<readonly ["unknown", "approval", "waitingForChild", "ready-aged", "running-aged"]>;
3132
+ readonly ageSeconds: Schema.Int;
3133
+ readonly severity: Schema.Literals<readonly ["ok", "aging", "overdue"]>;
3134
+ }>, {}>;
3135
+ /** One nonterminal accepted-work obligation with its age and severity. */
3136
+ declare class ObligationEntry extends ObligationEntry_base {}
3137
+ declare const ObligationReport_base: Schema.Class<ObligationReport, Schema.Struct<{
3138
+ readonly thresholds: typeof ObligationThresholds;
3139
+ readonly entries: Schema.$Array<typeof ObligationEntry>;
3140
+ readonly generatedAt: Schema.DateTimeUtcFromString;
3141
+ }>, {}>;
3142
+ /**
3143
+ * The scan-based DUR-017/OPS-001 operator surface (plan §3): a fold of the ledger's nonterminal
3144
+ * scan into aged, severity-classified rows. Scan-based, never a daemon — hosts run it
3145
+ * periodically and export logs/metrics; ages need no storage-version bump because every source
3146
+ * timestamp already exists (`createdAt`/`readyAt`, `suspendedAt`, the canonical
3147
+ * `ToolCallUnknown` record's `createdAt`).
3148
+ */
3149
+ declare class ObligationReport extends ObligationReport_base {}
3150
+ /** Severity of one obligation age under the supplied thresholds. */
3151
+ declare const obligationSeverityOf: (ageSeconds: number, thresholds: ObligationThresholds) => ObligationSeverity;
3152
+ declare const RetryCommand_base: Schema.Class<RetryCommand, Schema.Struct<{
3153
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
3154
+ readonly author: Schema.NonEmptyString;
3155
+ readonly reason: Schema.String;
3156
+ }>, {}>;
3157
+ /**
3158
+ * The mandatory-audit retry command (SEC-011): `author`/`reason` carry the same bounds as the
3159
+ * canonical abort command so every mutating administrative operation stays attributable. The
3160
+ * operator and decision are logged. A repair with a claim also appends a best-effort
3161
+ * `RepairAnnotated` attempt using that claim's epoch; state-only repairs do not append audits.
3162
+ */
3163
+ declare class RetryCommand extends RetryCommand_base {}
3164
+ /** Why a retry was refused without executing anything. */
3165
+ declare const RetryRefusalReason: Schema.Literals<readonly ["settled", "await-unknown-resolution", "await-approval-decision"]>;
3166
+ type RetryRefusalReason = typeof RetryRefusalReason.Type;
3167
+ declare const RetryRefused_base: Schema.Class<RetryRefused, Schema.TaggedStruct<"RetryRefused", {
3168
+ readonly submissionId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">;
3169
+ readonly refusal: Schema.Literals<readonly ["settled", "await-unknown-resolution", "await-approval-decision"]>;
3170
+ readonly decisionTag: Schema.String;
3171
+ readonly message: Schema.String;
3172
+ }>, import("effect/Cause").YieldableError>;
3173
+ /**
3174
+ * Typed refusal of `retry` (plan §3): Submissions waiting on `AwaitUnknownResolution` or
3175
+ * `AwaitApprovalDecision` have their own authorized operations, and settled work is never
3176
+ * re-driven. The refusal names the classifier decision so the operator sees WHY.
3177
+ */
3178
+ declare class RetryRefused extends RetryRefused_base {}
3179
+ //#endregion
3180
+ export { RepairSubagentStartLink as $, toolCallResolutionBatchId as $i, DurableApprovalSuspension as $n, ThreadStoreDiagnostic as $r, RecoverySnapshot as $t, AwaitChildSettlement as A, modelResponseRecordId as Ai, UnknownResolution as An, FencedAppendRequest as Ar, ChildReservationConflict as At, MarkUnknown as B, runStartedBatchId as Bi, submissionAbortRecordId as Bn, ThreadMaterialization as Br, JoinSnapshot as Bt, renderRecoveryExplanation as C, DurableWorkerBinding as Ca, childThreadIdFor as Ci, SubmissionSnapshot as Cn, recoveryRepairRecordId as Cr, ApprovalDecisionIntent as Ct, ApplyUnknownResolutions as D, compileBindingContracts as Da, markUnknownBatchId as Di, SuspensionOutcome as Dn, AppendResult as Dr, ChildAttachmentSnapshot as Dt, ApplyJoinAccounting as E, ResolvedBinding as Ea, firstWorkerInputRecordId as Ei, SuspendRequest as En, AppendConflict as Er, BeginChildBudgetReleaseRequest as Et, CompleteMaterialization as F, runCompletedRecordId as Fi, WaitingForChildSuspension as Fn, SelectedThreadRead as Fr, Claim as Ft, PropagateChildAbort as G, subagentLineageRecordId as Gi, submissionSettlementRecordId as Gn, ThreadPeerCountRequest as Gr, MarkJoinedRequest as Gt, OpenDelegationCallEvidence as H, subagentJoinBatchId as Hi, submissionInputRecordId as Hn, ThreadObservation as Hr, LedgerCapabilities as Ht, DeclaredPendingBatchEvidence as I, runCompletionDigest as Ii, WorkerLedgerState as In, ThreadCheckpoint as Ir, ClaimJoiningRequest as It, Recovery_d_exports as J, subagentStartedBatchId as Ji, DurableAbortFailure as Jn, ThreadRecordRequest as Jr, OwnershipLost as Jt, RecoveryDecision as K, subagentRequestedBatchId as Ki, workerTerminalFromRecord as Kn, ThreadRead as Kr, MarkReadyRequest as Kt, DelegationAdmissionEvidence as L, runDurationBatchId as Li, WorkerStopCommand as Ln, ThreadCheckpoints as Lr, ClaimRequest as Lt, AwaitParentEstablishment as M, projectRunJournal as Mi, UnknownResolutionConflict as Mn, MAX_THREAD_EXPORT_RECORDS as Mr, ChildReservationStatus as Mt, AwaitUnknownResolution as N, projectRunJournalStream as Ni, UnknownResolutionIntent as Nn, SaveCheckpointRequest as Nr, ChildSettledNotification as Nt, AwaitApprovalDecision as O, compileRegistrations as Oa, modelResponseInterruptedBatchId as Oi, SuspensionReason as On, CheckpointRejected as Or, ChildBudgetReservationRequest as Ot, CompleteChildAdmission as P, promptFromCanonicalRecords as Pi, WaitingChild as Pn, SaveRecoveryCheckpointRequest as Pr, ChildSettledOutcome as Pt, RepairReadiness as Q, toolCallPreparedRecordId as Qi, DurableApprovalResolver as Qn, ThreadStore as Qr, ParentLinkage as Qt, EnsureWaitingForChild as R, runDurationRecordId as Ri, settlementFailureFromRecord as Rn, ThreadExport as Rr, DEFAULT_OWNERSHIP_LEASE_DURATION as Rt, recoveryDecisionMeaning as S, DurableBindingFailure as Sa, childIdempotencyKeyFor as Si, SubmissionLookupByKey as Sn, recoveryRepairBatchId as Sr, ApprovalDecisionCommand as St, ApplyInput as T, ReplayVersions as Ta, compactionRecordId as Ti, SubmissionWorkItem as Tn, threadCreatedRecordId as Tr, AttachChildToReservationRequest as Tt, OpenToolCallEvidence as U, subagentJoinedRecordId as Ui, submissionSettlementBatchId as Un, ThreadOutstanding as Ur, LedgerError as Ut, NoAction as V, runStartedRecordId as Vi, submissionInputBatchId as Vn, ThreadNotMaterialized as Vr, JoiningClaim as Vt, PendingApprovalEvidence as W, subagentLineageBatchId as Wi, submissionSettlementId as Wn, ThreadOutstandingRequest as Wr, MarkInputAppliedRequest as Wt, RepairInputMarker as X, toolApprovalDecisionRecordId as Xi, DurableAgentRuntime_d_exports as Xn, ThreadRunInputRequest as Xr, OwnershipSnapshot as Xt, ReleaseOrphanChildReservation as Y, subagentStartedRecordId as Yi, DurableAgentRuntime as Yn, ThreadRecoveryCheckpoints as Yr, OwnershipRenewal as Yt, RepairJoinMarker as Z, toolApprovalRequestRecordId as Zi, DurableApprovalFailure as Zn, ThreadSelection as Zr, OwnershipToken as Zt, RetryCommand as _, workerReportRecordId as _a, RunJournalUsage as _i, SubmissionLedger as _n, RecoveryReport as _r, AdmissionPolicyError as _t, IntegrityCheck as a, toolStepSettledRecordId as aa, ThreadWorkerStateRequest as ai, ReservedSettlement as an, DurableResolveFailure as ar, SettleAborted as at, obligationSeverityOf as b, AgentRegistration as ba, agentUpdateRecordId as bi, SubmissionLookup as bn, childReservationIdFor as br, AdmissionResult as bt, IntegrityReport as c, turnCanonicalBatch as ca, readOutstanding as ci, ResolutionNeverHappened as cn, DurableRuntimeConfigOptions as cr, AbortCommand as ct, ObligationReport as d, turnResponseBatch as da, SettledSubmission as di, Settlement as dn, DurableSubmitOptions as dr, AdmissionAdmitted as dt, toolCallResolvedRecordId as ea, ThreadStoreError as ei, RecoverySnapshotRequest as en, DurableAwaitFailure as er, ResumeFromTurnBoundary as et, ObligationSeverity as f, turnResponseBatchId as fa, SubmissionStatus as fi, SettlementConflict as fn, DurableVerifyFailure as fr, AdmissionConflict as ft, RecoveryExplanation as g, workerOriginRecordId as ga, RunJournalProjection as gi, SubmissionAdmissionFence as gn, RecoveryFailure as gr, AdmissionNotAdmitted as gt, RecoveryDisposition as h, workerInputRecordId as ha, RunJournalError as hi, SettlementReservationSnapshot as hn, RecoveryBlocked as hr, AdmissionIndeterminate as ht, ExplainedUnknownCall as i, toolStepSettledBatchId as ia, ThreadTailRequest as ii, ReservedChildBudget as in, DurableProgressFailure as ir, RevertJoining as it, AwaitHostSettlement as j, peerMessageRecordId as ji, UnknownResolutionCommand as jn, LoadCheckpointRequest as jr, ChildReservationId as jt, AwaitChildAdmissionResolution as k, definitionDigestsEqual as ka, modelResponseInterruptedRecordId as ki, SuspensionSnapshot as kn, FenceRejected as kr, ChildBudgetReservationSnapshot as kt, ObligationBlockedOn as l, turnIdForRun as la, readWorkerState as li, ResolutionSafeToRetry as ln, DurableSubmitAgent as lr, AbortIntent as lt, RECOVERY_DECISION_MEANINGS as m, turnResultsBatchId as ma, JournalBoundary as mi, SettlementReservation as mn, DurableWorkerRequirements as mr, AdmissionGroup as mt, ExplainedEvidence as n, toolCallSettledRecordId as na, ThreadStore_d_exports as ni, ReleaseOwnershipRequest as nn, DurableObligationFailure as nr, ResumeSuspended as nt, IntegrityCheckName as o, turnApprovalsBatchId as oa, getRecord as oi, ResolutionAbortSubmission as on, DurableRetryFailure as or, SettleJoinedWithHost as ot, ObligationThresholds as p, turnResultsBatch as pa, SubmissionStatus_d_exports as pi, SettlementFinalization as pn, DurableWorkerFailure as pr, AdmissionFence as pt, RecoveryEvidence as q, subagentRequestedRecordId as qi, ApprovalSuspensionError as qn, ThreadReadRequest as qr, MarkUnknownRequest as qt, ExplainedSubmission as r, toolCallUnknownRecordId as ra, ThreadTail as ri, RenewOwnershipRequest as rn, DurableObserveOptions as rr, ResumeWaitingParent as rt, IntegrityCheckStatus as s, turnBatchId as sa, getRunInput as si, ResolutionCompletedWithResult as sn, DurableRuntimeConfig as sr, classifyRecovery as st, Admin_d_exports as t, toolCallResultBatchId as ta, ThreadStoreFailure as ti, ReleaseChildBudgetRequest as tn, DurableExplainFailure as tr, ResumePendingToolBatch as tt, ObligationEntry as u, turnPreparedBatchId as ua, PendingSubmission as ui, RevertJoiningRequest as un, DurableSubmitFailure as ur, AbortIntentRequest as ut, RetryRefusalReason as v, AgentRegistration_d_exports as va, RunJournal_d_exports as vi, SubmissionLedgerFailure as vn, RecoverySweepOptions as vr, AdmissionRequest as vt, AppendReservedSettlement as w, ExecutableAgentBinding as wa, compactionBatchId as wi, SubmissionState as wn, threadCreatedBatchId as wr, ApprovalPendingSuspension as wt, predictRecoveryDisposition as x, BindingUnavailable as xa, approvalDecisionBatchId as xi, SubmissionLookupById as xn, isolateRecovery as xr, ApprovalConflict as xt, RetryRefused as y, AgentAttemptContext as ya, TurnCommitInput as yi, SubmissionLedger_d_exports as yn, RecoverySweepResult as yr, AdmissionResolution as yt, FinalizeLedgerFromHistory as z, runIdForSubmission as zi, submissionAbortBatchId as zn, ThreadExportRequest as zr, InputAppliedMarker as zt };
3181
+ //# sourceMappingURL=Admin-C34cVKlT.d.mts.map