effect-agent 0.1.0-beta.11 → 0.1.0-beta.111

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