effect-agent 0.1.0-beta.12 → 0.1.0-beta.121

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-D9cXqfF3.d.mts +252 -0
  4. package/dist/AgentError-Bn1ytXRD.d.mts +117 -0
  5. package/dist/AgentPolicy-BqDoSXO6.d.mts +96 -0
  6. package/dist/AgentRuntime-BUxDdLpw.d.mts +346 -0
  7. package/dist/AgentRuntime-Cp1hAb-W.mjs +4739 -0
  8. package/dist/AgentRuntime-Cp1hAb-W.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-B-9w7jDt.mjs +7061 -0
  13. package/dist/DurableAgentRuntime-B-9w7jDt.mjs.map +1 -0
  14. package/dist/DurableFailpoint-Cnr3wx1L.d.mts +41 -0
  15. package/dist/DurableStep-Cry_iol4.d.mts +103 -0
  16. package/dist/EventSource-CnlZ3Kma.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-Dkg87ebg.d.mts +221 -0
  27. package/dist/Messaging-JYYN3oYS.d.mts +1067 -0
  28. package/dist/MessagingHost-CqzpxbGz.d.mts +74 -0
  29. package/dist/MessagingHost-DfsbMPvq.mjs +110 -0
  30. package/dist/MessagingHost-DfsbMPvq.mjs.map +1 -0
  31. package/dist/OperationAuthorizer-TzcQtpX5.d.mts +61 -0
  32. package/dist/Output-V-6YL1_Z.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-BQLGldl-.d.mts +42 -0
  36. package/dist/Receipt-BAHyigAF.d.mts +33 -0
  37. package/dist/Records-D88mgvyS.d.mts +4214 -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-CSBsSj0X.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-BIOHA6RR.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-CNik9RiA.d.mts +1635 -0
  49. package/dist/Subagent-DCrB7an7.mjs +1498 -0
  50. package/dist/Subagent-DCrB7an7.mjs.map +1 -0
  51. package/dist/SubagentContract-DdT7Cqe6.d.mts +116 -0
  52. package/dist/SubagentHost-4WB8Hj0C.d.mts +164 -0
  53. package/dist/Subscription-CRteOKRf.d.mts +948 -0
  54. package/dist/SubscriptionInput-oNcwTPti.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-CfwzMZEK.mjs +271 -0
  72. package/dist/Worker-CfwzMZEK.mjs.map +1 -0
  73. package/dist/Worker-fwWkBg12.d.mts +472 -0
  74. package/dist/agent-registration-CKNsrpwo.mjs +201 -0
  75. package/dist/agent-registration-CKNsrpwo.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 +259 -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 +102 -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 +893 -0
  233. package/dist/durable/MessageDelivery.mjs +557 -0
  234. package/dist/durable/MessageDelivery.mjs.map +1 -0
  235. package/dist/durable/MessageDeliveryStoreConformance.d.mts +378 -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 +848 -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 +179 -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 +53 -0
  279. package/dist/durable/SqlThreadNativeReads.mjs +159 -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 +959 -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 +2187 -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 +355 -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 +76 -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 +283 -0
  398. package/dist/sandbox/ProtectedBrowser.mjs +298 -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 +426 -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 +2489 -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 +1273 -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 +136 -0
  433. package/src/capabilities/internal/utf8.ts +10 -0
  434. package/src/core/Agent.ts +602 -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 +240 -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 +11275 -0
  470. package/src/durable/DurableFailpoint.ts +111 -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 +832 -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 +1075 -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 +335 -0
  488. package/src/durable/SqlStorageV2Upgrade.ts +500 -0
  489. package/src/durable/SqlSubscriptionStore.ts +1440 -0
  490. package/src/durable/SqlThreadNativeReads.ts +270 -0
  491. package/src/durable/SubmissionLedger.ts +1265 -0
  492. package/src/durable/SubmissionLedgerConformance.ts +4820 -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 +573 -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 +587 -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 +2885 -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 +230 -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 +10500 -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 +452 -0
  553. package/src/sandbox/Sandbox.ts +241 -0
@@ -0,0 +1,1635 @@
1
+ import { d as ToolCallId, r as DelegationId, t as AgentId, u as ThreadId } from "./Identifiers-CN2s30fF.mjs";
2
+ import { c as SubagentExecutionFailureClassification, d as SubagentReservationAmounts, l as SubagentGrant, o as SubagentDelegationCaps, s as SubagentExecutionFailure } from "./SubagentContract-DdT7Cqe6.mjs";
3
+ import { SubagentBudgetExhausted, SubagentReservations } from "./capabilities/SubagentReservations.mjs";
4
+ import { a as Receipt, n as JoinedToHost, t as IdempotencyKey } from "./Receipt-BAHyigAF.mjs";
5
+ import { s as RunTotals } from "./Usage-Dx0aknfk.mjs";
6
+ import { t as ThreadHistory } from "./ThreadHistory-tS1KwxHR.mjs";
7
+ import { a as FailureDiagnostic_d_exports, r as Diagnostic } from "./FailureDiagnostic-CaAkzGHL.mjs";
8
+ import { E as RunDispositionDeclaration, _ as InstructionSource, c as Definition, m as InputPromptSource, r as AnyDefinition, y as ModelServices } from "./Agent-D9cXqfF3.mjs";
9
+ import { a as WorkerBudgetScope, c as WorkerError, f as WorkerRef, o as WorkerCompletion, p as WorkerReport } from "./Worker-fwWkBg12.mjs";
10
+ import { V as RunSubagentDigests, x as RunContextPreparation } from "./RunOptions-CSBsSj0X.mjs";
11
+ import { c as MessageRef, l as MessageStatus } from "./Messaging-Dkg87ebg.mjs";
12
+ import { o as SubagentHost } from "./SubagentHost-4WB8Hj0C.mjs";
13
+ import { S as ToolCallWaiting, _ as SubagentDurability, b as SubagentDurabilityError, c as AgentSpawner, h as SpawnRunOptions, l as AgentSpawnerParent, o as AgentRuntimeFailure, p as RuntimeBinding, s as AgentRuntimeRequirements } from "./AgentRuntime-BUxDdLpw.mjs";
14
+ import { t as RunEventSink } from "./RunEventSink-D5aVhISG.mjs";
15
+ import { Tool, Toolkit } from "effect/unstable/ai";
16
+ import { Crypto, Duration, Effect, Layer, Schema, Scope, Stream } from "effect";
17
+ //#region src/capabilities/internal/subagent-contract.d.ts
18
+ declare const SubagentPolicyFields: Schema.Struct<{
19
+ /** Total invocation slots, including reserved descendants, available through this delegation budget. */
20
+ readonly maxChildren: Schema.Int;
21
+ /** Concurrently executing children per parent Run. */
22
+ readonly maxConcurrency: Schema.Int;
23
+ /** Invocation slots held for the entire descendant subtree; omitted reserves zero. */
24
+ readonly descendantInvocations: Schema.optionalKey<Schema.Natural>;
25
+ /** Model turns reserved for each child invocation. */
26
+ readonly maxTurns: Schema.Int;
27
+ /** Tool Calls reserved for each child invocation. */
28
+ readonly maxToolCalls: Schema.Int;
29
+ /** Wall-clock duration reserved for each child invocation. */
30
+ readonly maxDuration: Schema.refine<Duration.Duration, Schema.Duration>;
31
+ readonly maxInputTokens: Schema.optionalKey<Schema.Int>;
32
+ readonly maxOutputTokens: Schema.optionalKey<Schema.Int>;
33
+ readonly maxCostMicrousd: Schema.optionalKey<Schema.Natural>;
34
+ readonly maxResultBytes: Schema.optionalKey<Schema.Int>;
35
+ }>;
36
+ type SubagentPolicyFields = typeof SubagentPolicyFields.Type;
37
+ /** Inputs normalized and validated by `SubagentPolicy.make`. */
38
+ type SubagentPolicyInput = Readonly<Omit<SubagentPolicyFields, "maxDuration"> & {
39
+ /** Finite, positive wall-clock duration accepted in any Effect Duration input form. */
40
+ readonly maxDuration: Duration.Input;
41
+ }>;
42
+ declare const SubagentPolicy_base: Schema.Class<SubagentPolicy, Schema.Struct<{
43
+ /** Total invocation slots, including reserved descendants, available through this delegation budget. */
44
+ readonly maxChildren: Schema.Int;
45
+ /** Concurrently executing children per parent Run. */
46
+ readonly maxConcurrency: Schema.Int;
47
+ /** Invocation slots held for the entire descendant subtree; omitted reserves zero. */
48
+ readonly descendantInvocations: Schema.optionalKey<Schema.Natural>;
49
+ /** Model turns reserved for each child invocation. */
50
+ readonly maxTurns: Schema.Int;
51
+ /** Tool Calls reserved for each child invocation. */
52
+ readonly maxToolCalls: Schema.Int;
53
+ /** Wall-clock duration reserved for each child invocation. */
54
+ readonly maxDuration: Schema.refine<Duration.Duration, Schema.Duration>;
55
+ readonly maxInputTokens: Schema.optionalKey<Schema.Int>;
56
+ readonly maxOutputTokens: Schema.optionalKey<Schema.Int>;
57
+ readonly maxCostMicrousd: Schema.optionalKey<Schema.Natural>;
58
+ readonly maxResultBytes: Schema.optionalKey<Schema.Int>;
59
+ }>, {}>;
60
+ /**
61
+ * Finite delegation bounds declared by one Subagent capability.
62
+ * Structural limits are hard limits; token
63
+ * and cost caps are optional and enforced only as honestly as provider
64
+ * reporting allows.
65
+ */
66
+ declare class SubagentPolicy extends SubagentPolicy_base {
67
+ /** Normalize and validate finite delegation bounds, throwing on invalid input. */
68
+ static make(input: SubagentPolicyInput): SubagentPolicy;
69
+ }
70
+ declare const SubagentPrestartDenied_base: Schema.Class<SubagentPrestartDenied, Schema.TaggedStruct<"SubagentPrestartDenied", {
71
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
72
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
73
+ readonly reason: Schema.Literals<readonly ["nested-delegation", "grant-violation", "budget-conflict"]>;
74
+ readonly message: Schema.String;
75
+ }>, import("effect/Cause").YieldableError>;
76
+ /**
77
+ * Delegation preflight denied before any child started.
78
+ * No reservation, identity, or event exists for the
79
+ * denied invocation; retry requires a new authorized parent Tool Call.
80
+ */
81
+ declare class SubagentPrestartDenied extends SubagentPrestartDenied_base {}
82
+ declare const SubagentProjectionFailure_base: Schema.Class<SubagentProjectionFailure, Schema.TaggedStruct<"SubagentProjectionFailure", {
83
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
84
+ readonly stage: Schema.Literals<readonly ["input", "result"]>;
85
+ readonly message: Schema.String;
86
+ /** Original validation error; detailed diagnostics are never part of the safe message. */
87
+ readonly cause: Schema.optionalKey<Schema.decodeTo<Schema.Unknown, Schema.Codec<Diagnostic, Diagnostic, never, never>, never, never>>;
88
+ readonly stack: Schema.optionalKey<Schema.String>;
89
+ }>, import("effect/Cause").YieldableError>;
90
+ /**
91
+ * Input or result projection failed its Schema or bounds.
92
+ * Fail closed: the message is a fixed description and
93
+ * never carries the raw child value.
94
+ */
95
+ declare class SubagentProjectionFailure extends SubagentProjectionFailure_base {}
96
+ /**
97
+ * Derive the parent-Run delegation caps registered with
98
+ * `SubagentReservations` from one delegation policy: the per-invocation
99
+ * bounds scaled by `maxChildren` plus the invocation and concurrency limits.
100
+ */
101
+ declare const delegationCapsFromPolicy: (policy: SubagentPolicy) => SubagentDelegationCaps;
102
+ /** Derive the all-or-nothing per-invocation reservation from one delegation policy. */
103
+ declare const delegationAllocationFromPolicy: (policy: SubagentPolicy) => SubagentReservationAmounts;
104
+ //#endregion
105
+ //#region src/capabilities/internal/subagent-background.d.ts
106
+ type Declaration<Name extends string, Input extends Schema.Top, Output extends Schema.Top, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project> = Pick<SubagentDefineOptions<Input, Output, unknown, Record<string, Tool.Any>, Parameters, Success, Failure, Prepare, Project>, "parameters" | "success" | "failure" | "prepareInput" | "projectResult" | "policy" | "toolCallAllowance" | "needsApproval"> & {
107
+ readonly name: Name;
108
+ readonly delegationId: WorkerRef["delegationId"];
109
+ readonly target: AnyDefinition & {
110
+ readonly input: Input;
111
+ readonly output: Output;
112
+ };
113
+ readonly grant: SubagentGrant;
114
+ };
115
+ type WorkerDeclaration<Name extends string> = {
116
+ readonly name: Name;
117
+ readonly delegationId: WorkerRef["delegationId"];
118
+ readonly target: Pick<AnyDefinition, "id">;
119
+ };
120
+ /** Portable identity checked against this declaration; possession grants no authority. */
121
+ declare const Worker: <const Name extends string>(declaration: WorkerDeclaration<Name>) => Schema.brand<Schema.Struct<{
122
+ readonly schemaVersion: Schema.Literal<1>;
123
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
124
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
125
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
126
+ }>, `@effect-agent/Worker/${Name}`>;
127
+ type Worker<Name extends string> = ReturnType<typeof Worker<Name>>["Type"];
128
+ /** One exact Receipt, including private canonical failure evidence for programmatic callers. */
129
+ declare const WorkerObservation: <Success extends Schema.Top>(success: Success) => Schema.Union<readonly [Schema.Struct<{
130
+ readonly _tag: Schema.Literal<"Pending">;
131
+ readonly receipt: typeof Receipt;
132
+ }>, Schema.Struct<{
133
+ readonly _tag: Schema.Literal<"Settled">;
134
+ readonly receipt: typeof Receipt;
135
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
136
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
137
+ readonly outcome: Schema.Literal<"completed">;
138
+ readonly result: Success;
139
+ }>, Schema.Struct<{
140
+ readonly _tag: Schema.Literal<"Settled">;
141
+ readonly receipt: typeof Receipt;
142
+ readonly runId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">>;
143
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
144
+ readonly outcome: Schema.Literals<readonly ["failed", "aborted"]>;
145
+ readonly failure: typeof SubagentExecutionFailure;
146
+ readonly diagnostic: Schema.optionalKey<Schema.declareConstructor<{
147
+ readonly errorTag: string;
148
+ readonly message: string;
149
+ readonly diagnostic?: Diagnostic | undefined;
150
+ readonly context?: {
151
+ readonly agentId?: string | undefined;
152
+ readonly threadId?: string | undefined;
153
+ readonly runId?: string | undefined;
154
+ readonly submissionId?: string | undefined;
155
+ readonly attemptId?: string | undefined;
156
+ readonly turnId?: string | undefined;
157
+ readonly toolCallId?: string | undefined;
158
+ readonly toolName?: string | undefined;
159
+ readonly callId?: string | undefined;
160
+ readonly check?: string | undefined;
161
+ readonly operation?: string | undefined;
162
+ } | undefined;
163
+ }, {
164
+ readonly errorTag: string;
165
+ readonly message: string;
166
+ readonly diagnostic?: Diagnostic | undefined;
167
+ readonly context?: {
168
+ readonly agentId?: string | undefined;
169
+ readonly threadId?: string | undefined;
170
+ readonly runId?: string | undefined;
171
+ readonly submissionId?: string | undefined;
172
+ readonly attemptId?: string | undefined;
173
+ readonly turnId?: string | undefined;
174
+ readonly toolCallId?: string | undefined;
175
+ readonly toolName?: string | undefined;
176
+ readonly callId?: string | undefined;
177
+ readonly check?: string | undefined;
178
+ readonly operation?: string | undefined;
179
+ } | undefined;
180
+ }, readonly [Schema.Struct<{
181
+ readonly errorTag: Schema.NonEmptyString;
182
+ readonly message: Schema.String;
183
+ readonly diagnostic: Schema.optionalKey<Schema.Codec<Diagnostic, Diagnostic, never, never>>;
184
+ readonly context: Schema.optionalKey<Schema.declareConstructor<{
185
+ readonly agentId?: string | undefined;
186
+ readonly threadId?: string | undefined;
187
+ readonly runId?: string | undefined;
188
+ readonly submissionId?: string | undefined;
189
+ readonly attemptId?: string | undefined;
190
+ readonly turnId?: string | undefined;
191
+ readonly toolCallId?: string | undefined;
192
+ readonly toolName?: string | undefined;
193
+ readonly callId?: string | undefined;
194
+ readonly check?: string | undefined;
195
+ readonly operation?: string | undefined;
196
+ }, {
197
+ readonly agentId?: string | undefined;
198
+ readonly threadId?: string | undefined;
199
+ readonly runId?: string | undefined;
200
+ readonly submissionId?: string | undefined;
201
+ readonly attemptId?: string | undefined;
202
+ readonly turnId?: string | undefined;
203
+ readonly toolCallId?: string | undefined;
204
+ readonly toolName?: string | undefined;
205
+ readonly callId?: string | undefined;
206
+ readonly check?: string | undefined;
207
+ readonly operation?: string | undefined;
208
+ }, readonly [Schema.Struct<{
209
+ readonly agentId: Schema.optionalKey<Schema.String>;
210
+ readonly threadId: Schema.optionalKey<Schema.String>;
211
+ readonly runId: Schema.optionalKey<Schema.String>;
212
+ readonly submissionId: Schema.optionalKey<Schema.String>;
213
+ readonly attemptId: Schema.optionalKey<Schema.String>;
214
+ readonly turnId: Schema.optionalKey<Schema.String>;
215
+ readonly toolCallId: Schema.optionalKey<Schema.String>;
216
+ readonly toolName: Schema.optionalKey<Schema.String>;
217
+ readonly callId: Schema.optionalKey<Schema.String>;
218
+ readonly check: Schema.optionalKey<Schema.String>;
219
+ readonly operation: Schema.optionalKey<Schema.String>;
220
+ }>], {
221
+ readonly agentId?: string | undefined;
222
+ readonly threadId?: string | undefined;
223
+ readonly runId?: string | undefined;
224
+ readonly submissionId?: string | undefined;
225
+ readonly attemptId?: string | undefined;
226
+ readonly turnId?: string | undefined;
227
+ readonly toolCallId?: string | undefined;
228
+ readonly toolName?: string | undefined;
229
+ readonly callId?: string | undefined;
230
+ readonly check?: string | undefined;
231
+ readonly operation?: string | undefined;
232
+ }>>;
233
+ }>], {
234
+ readonly errorTag: string;
235
+ readonly message: string;
236
+ readonly diagnostic?: Diagnostic | undefined;
237
+ readonly context?: {
238
+ readonly agentId?: string | undefined;
239
+ readonly threadId?: string | undefined;
240
+ readonly runId?: string | undefined;
241
+ readonly submissionId?: string | undefined;
242
+ readonly attemptId?: string | undefined;
243
+ readonly turnId?: string | undefined;
244
+ readonly toolCallId?: string | undefined;
245
+ readonly toolName?: string | undefined;
246
+ readonly callId?: string | undefined;
247
+ readonly check?: string | undefined;
248
+ readonly operation?: string | undefined;
249
+ } | undefined;
250
+ }>>;
251
+ }>]>;
252
+ type WorkerObservation<Success extends Schema.Top> = ReturnType<typeof WorkerObservation<Success>>["Type"];
253
+ declare const operations: <const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project>(declaration: Declaration<Name, Input, Output, Parameters, Success, Failure, Prepare, Project>) => {
254
+ start: (parameters: Parameters["Type"], options: {
255
+ readonly idempotencyKey: IdempotencyKey;
256
+ readonly budgetScope?: WorkerBudgetScope;
257
+ }) => Effect.Effect<{
258
+ worker: {
259
+ readonly schemaVersion: 1;
260
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
261
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
262
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
263
+ } & import("effect/Types").UnionToIntersection<`@effect-agent/Worker/${Name}` extends (infer T) ? T extends `@effect-agent/Worker/${Name}` ? T extends (infer U extends string) ? import("effect/Brand").Brand<U> : never : never : never>;
264
+ delivery: {
265
+ readonly message: {
266
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
267
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
268
+ };
269
+ readonly status: "pending";
270
+ readonly receipt: null;
271
+ readonly settlement: null;
272
+ readonly reason: string | null;
273
+ } | {
274
+ readonly message: {
275
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
276
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
277
+ };
278
+ readonly status: "accepted";
279
+ readonly receipt: Receipt;
280
+ readonly settlement: null;
281
+ readonly reason: string | null;
282
+ } | {
283
+ readonly message: {
284
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
285
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
286
+ };
287
+ readonly status: "processed";
288
+ readonly receipt: Receipt;
289
+ readonly settlement: {
290
+ readonly settlementId: string & import("effect/Brand").Brand<"@effect-agent/core/SettlementId">;
291
+ readonly outcome: "aborted" | "completed" | "failed";
292
+ };
293
+ readonly reason: null;
294
+ } | {
295
+ readonly message: {
296
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
297
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
298
+ };
299
+ readonly status: "refused";
300
+ readonly receipt: null;
301
+ readonly settlement: null;
302
+ readonly reason: string;
303
+ } | {
304
+ readonly message: {
305
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
306
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
307
+ };
308
+ readonly status: "parked";
309
+ readonly receipt: Receipt | null;
310
+ readonly settlement: null;
311
+ readonly reason: string;
312
+ };
313
+ }, SubagentPrestartDenied | SubagentProjectionFailure | WorkerError | Failure["Type"], Prepare | SubagentHost | Parameters["EncodingServices"] | (Schema.Top & Input)["EncodingServices"]>;
314
+ followUp: (worker: {
315
+ readonly schemaVersion: 1;
316
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
317
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
318
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
319
+ } & import("effect/Types").UnionToIntersection<`@effect-agent/Worker/${Name}` extends (infer T) ? T extends `@effect-agent/Worker/${Name}` ? T extends (infer U extends string) ? import("effect/Brand").Brand<U> : never : never : never>, parameters: Parameters["Type"], options: {
320
+ readonly idempotencyKey: IdempotencyKey;
321
+ }) => Effect.Effect<{
322
+ readonly message: {
323
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
324
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
325
+ };
326
+ readonly status: "pending";
327
+ readonly receipt: null;
328
+ readonly settlement: null;
329
+ readonly reason: string | null;
330
+ } | {
331
+ readonly message: {
332
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
333
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
334
+ };
335
+ readonly status: "accepted";
336
+ readonly receipt: Receipt;
337
+ readonly settlement: null;
338
+ readonly reason: string | null;
339
+ } | {
340
+ readonly message: {
341
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
342
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
343
+ };
344
+ readonly status: "processed";
345
+ readonly receipt: Receipt;
346
+ readonly settlement: {
347
+ readonly settlementId: string & import("effect/Brand").Brand<"@effect-agent/core/SettlementId">;
348
+ readonly outcome: "aborted" | "completed" | "failed";
349
+ };
350
+ readonly reason: null;
351
+ } | {
352
+ readonly message: {
353
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
354
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
355
+ };
356
+ readonly status: "refused";
357
+ readonly receipt: null;
358
+ readonly settlement: null;
359
+ readonly reason: string;
360
+ } | {
361
+ readonly message: {
362
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
363
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
364
+ };
365
+ readonly status: "parked";
366
+ readonly receipt: Receipt | null;
367
+ readonly settlement: null;
368
+ readonly reason: string;
369
+ }, SubagentProjectionFailure | WorkerError | Failure["Type"], Prepare | SubagentHost | Parameters["EncodingServices"] | (Schema.Top & Input)["EncodingServices"]>;
370
+ inspectMessage: (worker: {
371
+ readonly schemaVersion: 1;
372
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
373
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
374
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
375
+ } & import("effect/Types").UnionToIntersection<`@effect-agent/Worker/${Name}` extends (infer T) ? T extends `@effect-agent/Worker/${Name}` ? T extends (infer U extends string) ? import("effect/Brand").Brand<U> : never : never : never>, message: {
376
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
377
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
378
+ }) => Effect.Effect<{
379
+ readonly message: {
380
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
381
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
382
+ };
383
+ readonly status: "pending";
384
+ readonly receipt: null;
385
+ readonly settlement: null;
386
+ readonly reason: string | null;
387
+ } | {
388
+ readonly message: {
389
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
390
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
391
+ };
392
+ readonly status: "accepted";
393
+ readonly receipt: Receipt;
394
+ readonly settlement: null;
395
+ readonly reason: string | null;
396
+ } | {
397
+ readonly message: {
398
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
399
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
400
+ };
401
+ readonly status: "processed";
402
+ readonly receipt: Receipt;
403
+ readonly settlement: {
404
+ readonly settlementId: string & import("effect/Brand").Brand<"@effect-agent/core/SettlementId">;
405
+ readonly outcome: "aborted" | "completed" | "failed";
406
+ };
407
+ readonly reason: null;
408
+ } | {
409
+ readonly message: {
410
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
411
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
412
+ };
413
+ readonly status: "refused";
414
+ readonly receipt: null;
415
+ readonly settlement: null;
416
+ readonly reason: string;
417
+ } | {
418
+ readonly message: {
419
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
420
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
421
+ };
422
+ readonly status: "parked";
423
+ readonly receipt: Receipt | null;
424
+ readonly settlement: null;
425
+ readonly reason: string;
426
+ }, WorkerError, SubagentHost>;
427
+ observe: (operation: "await" | "inspect", worker: {
428
+ readonly schemaVersion: 1;
429
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
430
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
431
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
432
+ } & import("effect/Types").UnionToIntersection<`@effect-agent/Worker/${Name}` extends (infer T) ? T extends `@effect-agent/Worker/${Name}` ? T extends (infer U extends string) ? import("effect/Brand").Brand<U> : never : never : never>, receipt: Receipt) => Effect.Effect<{
433
+ readonly _tag: "Pending";
434
+ readonly receipt: Receipt;
435
+ } | {
436
+ readonly _tag: "Settled";
437
+ readonly receipt: Receipt;
438
+ readonly runId?: (string & import("effect/Brand").Brand<"@effect-agent/core/RunId">) | undefined;
439
+ readonly settlementId: string & import("effect/Brand").Brand<"@effect-agent/core/SettlementId">;
440
+ readonly outcome: "aborted" | "failed";
441
+ readonly failure: SubagentExecutionFailure;
442
+ readonly diagnostic?: {
443
+ readonly errorTag: string;
444
+ readonly message: string;
445
+ readonly diagnostic?: Diagnostic | undefined;
446
+ readonly context?: {
447
+ readonly agentId?: string | undefined;
448
+ readonly threadId?: string | undefined;
449
+ readonly runId?: string | undefined;
450
+ readonly submissionId?: string | undefined;
451
+ readonly attemptId?: string | undefined;
452
+ readonly turnId?: string | undefined;
453
+ readonly toolCallId?: string | undefined;
454
+ readonly toolName?: string | undefined;
455
+ readonly callId?: string | undefined;
456
+ readonly check?: string | undefined;
457
+ readonly operation?: string | undefined;
458
+ } | undefined;
459
+ } | undefined;
460
+ } | Schema.Struct.View<{
461
+ readonly _tag: Schema.Literal<"Settled">;
462
+ readonly receipt: typeof Receipt;
463
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
464
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
465
+ readonly outcome: Schema.Literal<"completed">;
466
+ readonly result: Success;
467
+ }, "Type", Success extends {
468
+ readonly "~type.optionality": "optional";
469
+ } ? "result" : never, Success extends {
470
+ readonly "~type.mutability": "mutable";
471
+ } ? "result" : never>, SubagentProjectionFailure | WorkerError | Failure["Type"], Project | SubagentHost | Output["DecodingServices"] | Parameters["DecodingServices"] | Success["EncodingServices"]>;
472
+ list: (options?: {
473
+ readonly limit?: number;
474
+ readonly after?: ThreadId;
475
+ } | undefined) => Effect.Effect<{
476
+ items: {
477
+ state: "active" | "cancelled" | "completed" | "failed" | "idle" | "starting" | "stopped" | "stopping";
478
+ acceptedInput: {
479
+ readonly receipt: Receipt;
480
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
481
+ } | null;
482
+ appliedInput: {
483
+ readonly receipt: Receipt;
484
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
485
+ readonly runId: string & import("effect/Brand").Brand<"@effect-agent/core/RunId">;
486
+ readonly sequence: number;
487
+ } | null;
488
+ run: {
489
+ readonly runId: string & import("effect/Brand").Brand<"@effect-agent/core/RunId">;
490
+ readonly hostReceipt: Receipt;
491
+ readonly outcome: "aborted" | "completed" | "failed" | null;
492
+ readonly disposition: Schema.Json;
493
+ } | null;
494
+ pendingDelivery: {
495
+ readonly message: {
496
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
497
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
498
+ };
499
+ readonly status: "pending";
500
+ readonly receipt: null;
501
+ readonly settlement: null;
502
+ readonly reason: string | null;
503
+ } | {
504
+ readonly message: {
505
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
506
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
507
+ };
508
+ readonly status: "accepted";
509
+ readonly receipt: Receipt;
510
+ readonly settlement: null;
511
+ readonly reason: string | null;
512
+ } | {
513
+ readonly message: {
514
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
515
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
516
+ };
517
+ readonly status: "processed";
518
+ readonly receipt: Receipt;
519
+ readonly settlement: {
520
+ readonly settlementId: string & import("effect/Brand").Brand<"@effect-agent/core/SettlementId">;
521
+ readonly outcome: "aborted" | "completed" | "failed";
522
+ };
523
+ readonly reason: null;
524
+ } | {
525
+ readonly message: {
526
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
527
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
528
+ };
529
+ readonly status: "refused";
530
+ readonly receipt: null;
531
+ readonly settlement: null;
532
+ readonly reason: string;
533
+ } | {
534
+ readonly message: {
535
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
536
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
537
+ };
538
+ readonly status: "parked";
539
+ readonly receipt: Receipt | null;
540
+ readonly settlement: null;
541
+ readonly reason: string;
542
+ } | null;
543
+ watermark: {
544
+ readonly canonicalSequence: number;
545
+ readonly acceptedQueueSequence: number;
546
+ readonly pendingDeliveryVersion: number | null;
547
+ };
548
+ worker: {
549
+ readonly schemaVersion: 1;
550
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
551
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
552
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
553
+ } & import("effect/Types").UnionToIntersection<`@effect-agent/Worker/${Name}` extends (infer T) ? T extends `@effect-agent/Worker/${Name}` ? T extends (infer U extends string) ? import("effect/Brand").Brand<U> : never : never : never>;
554
+ latestReceipt: Receipt | null;
555
+ }[];
556
+ next: (string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">) | null;
557
+ }, WorkerError, SubagentHost>;
558
+ cancel: (worker: {
559
+ readonly schemaVersion: 1;
560
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
561
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
562
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
563
+ } & import("effect/Types").UnionToIntersection<`@effect-agent/Worker/${Name}` extends (infer T) ? T extends `@effect-agent/Worker/${Name}` ? T extends (infer U extends string) ? import("effect/Brand").Brand<U> : never : never : never>, receipt: Receipt) => Effect.Effect<void, JoinedToHost | WorkerError, SubagentHost>;
564
+ };
565
+ /** Retain a first worker input. The same explicit key reuses its durable delivery identity. */
566
+ declare const start: <const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project>(declaration: Declaration<Name, Input, Output, Parameters, Success, Failure, Prepare, Project>, parameters: Parameters["Type"], options: {
567
+ readonly idempotencyKey: IdempotencyKey;
568
+ readonly budgetScope?: WorkerBudgetScope;
569
+ }) => Effect.Effect<{
570
+ worker: {
571
+ readonly schemaVersion: 1;
572
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
573
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
574
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
575
+ } & import("effect/Types").UnionToIntersection<`@effect-agent/Worker/${Name}` extends (infer T) ? T extends `@effect-agent/Worker/${Name}` ? T extends (infer U extends string) ? import("effect/Brand").Brand<U> : never : never : never>;
576
+ delivery: {
577
+ readonly message: {
578
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
579
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
580
+ };
581
+ readonly status: "pending";
582
+ readonly receipt: null;
583
+ readonly settlement: null;
584
+ readonly reason: string | null;
585
+ } | {
586
+ readonly message: {
587
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
588
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
589
+ };
590
+ readonly status: "accepted";
591
+ readonly receipt: Receipt;
592
+ readonly settlement: null;
593
+ readonly reason: string | null;
594
+ } | {
595
+ readonly message: {
596
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
597
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
598
+ };
599
+ readonly status: "processed";
600
+ readonly receipt: Receipt;
601
+ readonly settlement: {
602
+ readonly settlementId: string & import("effect/Brand").Brand<"@effect-agent/core/SettlementId">;
603
+ readonly outcome: "aborted" | "completed" | "failed";
604
+ };
605
+ readonly reason: null;
606
+ } | {
607
+ readonly message: {
608
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
609
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
610
+ };
611
+ readonly status: "refused";
612
+ readonly receipt: null;
613
+ readonly settlement: null;
614
+ readonly reason: string;
615
+ } | {
616
+ readonly message: {
617
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
618
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
619
+ };
620
+ readonly status: "parked";
621
+ readonly receipt: Receipt | null;
622
+ readonly settlement: null;
623
+ readonly reason: string;
624
+ };
625
+ }, SubagentPrestartDenied | SubagentProjectionFailure | WorkerError | Failure["Type"], Prepare | SubagentHost | Parameters["EncodingServices"] | (Schema.Top & Input)["EncodingServices"]>;
626
+ /** Retain typed follow-up parameters for the same worker Thread; inspect its MessageRef for delivery. */
627
+ declare const followUp: <const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project>(declaration: Declaration<Name, Input, Output, Parameters, Success, Failure, Prepare, Project>, worker: Worker<Name>, parameters: Parameters["Type"], options: {
628
+ readonly idempotencyKey: IdempotencyKey;
629
+ }) => Effect.Effect<{
630
+ readonly message: {
631
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
632
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
633
+ };
634
+ readonly status: "pending";
635
+ readonly receipt: null;
636
+ readonly settlement: null;
637
+ readonly reason: string | null;
638
+ } | {
639
+ readonly message: {
640
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
641
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
642
+ };
643
+ readonly status: "accepted";
644
+ readonly receipt: Receipt;
645
+ readonly settlement: null;
646
+ readonly reason: string | null;
647
+ } | {
648
+ readonly message: {
649
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
650
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
651
+ };
652
+ readonly status: "processed";
653
+ readonly receipt: Receipt;
654
+ readonly settlement: {
655
+ readonly settlementId: string & import("effect/Brand").Brand<"@effect-agent/core/SettlementId">;
656
+ readonly outcome: "aborted" | "completed" | "failed";
657
+ };
658
+ readonly reason: null;
659
+ } | {
660
+ readonly message: {
661
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
662
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
663
+ };
664
+ readonly status: "refused";
665
+ readonly receipt: null;
666
+ readonly settlement: null;
667
+ readonly reason: string;
668
+ } | {
669
+ readonly message: {
670
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
671
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
672
+ };
673
+ readonly status: "parked";
674
+ readonly receipt: Receipt | null;
675
+ readonly settlement: null;
676
+ readonly reason: string;
677
+ }, SubagentProjectionFailure | WorkerError | Failure["Type"], Prepare | SubagentHost | Parameters["EncodingServices"] | (Schema.Top & Input)["EncodingServices"]>;
678
+ /** Inspect a continuing worker with the same summary contract returned by list. */
679
+ declare const summary: <const Name extends string>(declaration: WorkerDeclaration<Name> & {
680
+ readonly target: AnyDefinition;
681
+ }, worker: Worker<Name>) => Effect.Effect<{
682
+ latestReceipt: Receipt | null;
683
+ state: "active" | "cancelled" | "completed" | "failed" | "idle" | "starting" | "stopped" | "stopping";
684
+ acceptedInput: {
685
+ readonly receipt: Receipt;
686
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
687
+ } | null;
688
+ appliedInput: {
689
+ readonly receipt: Receipt;
690
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
691
+ readonly runId: string & import("effect/Brand").Brand<"@effect-agent/core/RunId">;
692
+ readonly sequence: number;
693
+ } | null;
694
+ run: {
695
+ readonly runId: string & import("effect/Brand").Brand<"@effect-agent/core/RunId">;
696
+ readonly hostReceipt: Receipt;
697
+ readonly outcome: "aborted" | "completed" | "failed" | null;
698
+ readonly disposition: Schema.Json;
699
+ } | null;
700
+ pendingDelivery: {
701
+ readonly message: {
702
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
703
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
704
+ };
705
+ readonly status: "pending";
706
+ readonly receipt: null;
707
+ readonly settlement: null;
708
+ readonly reason: string | null;
709
+ } | {
710
+ readonly message: {
711
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
712
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
713
+ };
714
+ readonly status: "accepted";
715
+ readonly receipt: Receipt;
716
+ readonly settlement: null;
717
+ readonly reason: string | null;
718
+ } | {
719
+ readonly message: {
720
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
721
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
722
+ };
723
+ readonly status: "processed";
724
+ readonly receipt: Receipt;
725
+ readonly settlement: {
726
+ readonly settlementId: string & import("effect/Brand").Brand<"@effect-agent/core/SettlementId">;
727
+ readonly outcome: "aborted" | "completed" | "failed";
728
+ };
729
+ readonly reason: null;
730
+ } | {
731
+ readonly message: {
732
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
733
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
734
+ };
735
+ readonly status: "refused";
736
+ readonly receipt: null;
737
+ readonly settlement: null;
738
+ readonly reason: string;
739
+ } | {
740
+ readonly message: {
741
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
742
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
743
+ };
744
+ readonly status: "parked";
745
+ readonly receipt: Receipt | null;
746
+ readonly settlement: null;
747
+ readonly reason: string;
748
+ } | null;
749
+ watermark: {
750
+ readonly canonicalSequence: number;
751
+ readonly acceptedQueueSequence: number;
752
+ readonly pendingDeliveryVersion: number | null;
753
+ };
754
+ worker: {
755
+ readonly schemaVersion: 1;
756
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
757
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
758
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
759
+ } & import("effect/Types").UnionToIntersection<`@effect-agent/Worker/${Name}` extends (infer T) ? T extends `@effect-agent/Worker/${Name}` ? T extends (infer U extends string) ? import("effect/Brand").Brand<U> : never : never : never>;
760
+ }, WorkerError, SubagentHost>;
761
+ /** Inspect a worker summary, retained MessageRef, or the result of one exact accepted Receipt. */
762
+ declare function inspect<const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project>(declaration: Declaration<Name, Input, Output, Parameters, Success, Failure, Prepare, Project>, worker: Worker<Name>): ReturnType<typeof summary<Name>>;
763
+ declare function inspect<const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project>(declaration: Declaration<Name, Input, Output, Parameters, Success, Failure, Prepare, Project>, worker: Worker<Name>, receipt: Receipt): ReturnType<ReturnType<typeof operations<Name, Input, Output, Parameters, Success, Failure, Prepare, Project>>["observe"]>;
764
+ declare function inspect<const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project>(declaration: Declaration<Name, Input, Output, Parameters, Success, Failure, Prepare, Project>, worker: Worker<Name>, message: MessageRef): Effect.Effect<MessageStatus, WorkerError, SubagentHost>;
765
+ /** Read an authorized finite history snapshot; pass the last emitted sequence to resume. */
766
+ declare const observe: <const Name extends string>(declaration: WorkerDeclaration<Name> & {
767
+ readonly target: AnyDefinition;
768
+ }, worker: Worker<Name>, options?: {
769
+ readonly after?: number;
770
+ }) => Stream.Stream<{
771
+ readonly sequence: number;
772
+ readonly recordId: string;
773
+ readonly record: Schema.Json;
774
+ }, WorkerError, SubagentHost>;
775
+ /** Seal a continuing worker, retaining a stable command identity across retries and Runs. */
776
+ declare const stop: <const Name extends string>(declaration: WorkerDeclaration<Name> & {
777
+ readonly target: AnyDefinition;
778
+ }, worker: Worker<Name>, options: {
779
+ readonly idempotencyKey: IdempotencyKey;
780
+ }) => Effect.Effect<{
781
+ readonly worker: {
782
+ readonly schemaVersion: 1;
783
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
784
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
785
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
786
+ };
787
+ readonly idempotencyKey: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
788
+ }, WorkerError, SubagentHost>;
789
+ /** Wait for the exact Receipt. Interrupting this Effect never cancels accepted work. */
790
+ declare const awaitWorker: <const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project>(declaration: Declaration<Name, Input, Output, Parameters, Success, Failure, Prepare, Project>, worker: Worker<Name>, receipt: Receipt) => Effect.Effect<{
791
+ readonly _tag: "Pending";
792
+ readonly receipt: Receipt;
793
+ } | {
794
+ readonly _tag: "Settled";
795
+ readonly receipt: Receipt;
796
+ readonly runId?: (string & import("effect/Brand").Brand<"@effect-agent/core/RunId">) | undefined;
797
+ readonly settlementId: string & import("effect/Brand").Brand<"@effect-agent/core/SettlementId">;
798
+ readonly outcome: "aborted" | "failed";
799
+ readonly failure: SubagentExecutionFailure;
800
+ readonly diagnostic?: {
801
+ readonly errorTag: string;
802
+ readonly message: string;
803
+ readonly diagnostic?: Diagnostic | undefined;
804
+ readonly context?: {
805
+ readonly agentId?: string | undefined;
806
+ readonly threadId?: string | undefined;
807
+ readonly runId?: string | undefined;
808
+ readonly submissionId?: string | undefined;
809
+ readonly attemptId?: string | undefined;
810
+ readonly turnId?: string | undefined;
811
+ readonly toolCallId?: string | undefined;
812
+ readonly toolName?: string | undefined;
813
+ readonly callId?: string | undefined;
814
+ readonly check?: string | undefined;
815
+ readonly operation?: string | undefined;
816
+ } | undefined;
817
+ } | undefined;
818
+ } | Schema.Struct.View<{
819
+ readonly _tag: Schema.Literal<"Settled">;
820
+ readonly receipt: typeof Receipt;
821
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
822
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
823
+ readonly outcome: Schema.Literal<"completed">;
824
+ readonly result: Success;
825
+ }, "Type", Success extends {
826
+ readonly "~type.optionality": "optional";
827
+ } ? "result" : never, Success extends {
828
+ readonly "~type.mutability": "mutable";
829
+ } ? "result" : never>, SubagentProjectionFailure | WorkerError | Failure["Type"], Project | SubagentHost | Output["DecodingServices"] | Parameters["DecodingServices"] | Success["EncodingServices"]>;
830
+ /** List only workers visible through the caller-bound host facet. */
831
+ declare const list: <const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project>(declaration: Declaration<Name, Input, Output, Parameters, Success, Failure, Prepare, Project>, options?: {
832
+ readonly limit?: number;
833
+ readonly after?: ThreadId;
834
+ }) => Effect.Effect<{
835
+ items: {
836
+ state: "active" | "cancelled" | "completed" | "failed" | "idle" | "starting" | "stopped" | "stopping";
837
+ acceptedInput: {
838
+ readonly receipt: Receipt;
839
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
840
+ } | null;
841
+ appliedInput: {
842
+ readonly receipt: Receipt;
843
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
844
+ readonly runId: string & import("effect/Brand").Brand<"@effect-agent/core/RunId">;
845
+ readonly sequence: number;
846
+ } | null;
847
+ run: {
848
+ readonly runId: string & import("effect/Brand").Brand<"@effect-agent/core/RunId">;
849
+ readonly hostReceipt: Receipt;
850
+ readonly outcome: "aborted" | "completed" | "failed" | null;
851
+ readonly disposition: Schema.Json;
852
+ } | null;
853
+ pendingDelivery: {
854
+ readonly message: {
855
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
856
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
857
+ };
858
+ readonly status: "pending";
859
+ readonly receipt: null;
860
+ readonly settlement: null;
861
+ readonly reason: string | null;
862
+ } | {
863
+ readonly message: {
864
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
865
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
866
+ };
867
+ readonly status: "accepted";
868
+ readonly receipt: Receipt;
869
+ readonly settlement: null;
870
+ readonly reason: string | null;
871
+ } | {
872
+ readonly message: {
873
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
874
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
875
+ };
876
+ readonly status: "processed";
877
+ readonly receipt: Receipt;
878
+ readonly settlement: {
879
+ readonly settlementId: string & import("effect/Brand").Brand<"@effect-agent/core/SettlementId">;
880
+ readonly outcome: "aborted" | "completed" | "failed";
881
+ };
882
+ readonly reason: null;
883
+ } | {
884
+ readonly message: {
885
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
886
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
887
+ };
888
+ readonly status: "refused";
889
+ readonly receipt: null;
890
+ readonly settlement: null;
891
+ readonly reason: string;
892
+ } | {
893
+ readonly message: {
894
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
895
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
896
+ };
897
+ readonly status: "parked";
898
+ readonly receipt: Receipt | null;
899
+ readonly settlement: null;
900
+ readonly reason: string;
901
+ } | null;
902
+ watermark: {
903
+ readonly canonicalSequence: number;
904
+ readonly acceptedQueueSequence: number;
905
+ readonly pendingDeliveryVersion: number | null;
906
+ };
907
+ worker: {
908
+ readonly schemaVersion: 1;
909
+ readonly delegationId: string & import("effect/Brand").Brand<"@effect-agent/core/DelegationId">;
910
+ readonly targetAgentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
911
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
912
+ } & import("effect/Types").UnionToIntersection<`@effect-agent/Worker/${Name}` extends (infer T) ? T extends `@effect-agent/Worker/${Name}` ? T extends (infer U extends string) ? import("effect/Brand").Brand<U> : never : never : never>;
913
+ latestReceipt: Receipt | null;
914
+ }[];
915
+ next: (string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">) | null;
916
+ }, WorkerError, SubagentHost>;
917
+ /** Request cancellation of exactly one Receipt; JoinedToHost remains a typed conflict. */
918
+ declare const cancel: <const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project>(declaration: Declaration<Name, Input, Output, Parameters, Success, Failure, Prepare, Project>, worker: Worker<Name>, receipt: Receipt) => Effect.Effect<void, JoinedToHost | WorkerError, SubagentHost>;
919
+ /** Opt in to each model-facing operation. Waiting remains programmatic only. */
920
+ interface BackgroundOptions {
921
+ /** Deliver standard completion and progress messages to the parent. */
922
+ readonly reportToParent?: true;
923
+ readonly start?: true;
924
+ readonly followUp?: true;
925
+ readonly inspect?: true;
926
+ readonly summary?: true;
927
+ readonly list?: true;
928
+ readonly cancel?: true;
929
+ /** Author-owned funding request for starts; every native admission separately authorizes it. */
930
+ readonly budgetScope?: WorkerBudgetScope;
931
+ }
932
+ type Operation = Exclude<keyof BackgroundOptions, "budgetScope" | "reportToParent">;
933
+ type Suffix = {
934
+ start: "start";
935
+ followUp: "follow_up";
936
+ inspect: "inspect";
937
+ summary: "summary";
938
+ list: "list";
939
+ cancel: "cancel";
940
+ };
941
+ declare const ReceiptParameters: <Name extends string>(declaration: WorkerDeclaration<Name>) => Schema.Struct<{
942
+ readonly worker: Schema.brand<Schema.Struct<{
943
+ readonly schemaVersion: Schema.Literal<1>;
944
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
945
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
946
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
947
+ }>, `@effect-agent/Worker/${Name}`>;
948
+ readonly receipt: typeof Receipt;
949
+ }>;
950
+ declare const InspectParameters: <Name extends string>(declaration: WorkerDeclaration<Name>) => Schema.Struct<{
951
+ readonly worker: Schema.brand<Schema.Struct<{
952
+ readonly schemaVersion: Schema.Literal<1>;
953
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
954
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
955
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
956
+ }>, `@effect-agent/Worker/${Name}`>;
957
+ readonly message: Schema.optionalKey<Schema.Struct<{
958
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
959
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
960
+ }>>;
961
+ readonly receipt: Schema.optionalKey<typeof Receipt>;
962
+ }>;
963
+ declare const Inspection: <Success extends Schema.Top>(success: Success) => Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
964
+ readonly message: Schema.Struct<{
965
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
966
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
967
+ }>;
968
+ readonly status: Schema.Literal<"pending">;
969
+ readonly receipt: Schema.Null;
970
+ readonly settlement: Schema.Null;
971
+ readonly reason: Schema.NullOr<Schema.NonEmptyString>;
972
+ }>, Schema.Struct<{
973
+ readonly message: Schema.Struct<{
974
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
975
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
976
+ }>;
977
+ readonly status: Schema.Literal<"accepted">;
978
+ readonly receipt: typeof Receipt;
979
+ readonly settlement: Schema.Null;
980
+ readonly reason: Schema.NullOr<Schema.NonEmptyString>;
981
+ }>, Schema.Struct<{
982
+ readonly message: Schema.Struct<{
983
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
984
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
985
+ }>;
986
+ readonly status: Schema.Literal<"processed">;
987
+ readonly receipt: typeof Receipt;
988
+ readonly settlement: Schema.Struct<{
989
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
990
+ readonly outcome: Schema.Literals<readonly ["completed", "failed", "aborted"]>;
991
+ }>;
992
+ readonly reason: Schema.Null;
993
+ }>, Schema.Struct<{
994
+ readonly message: Schema.Struct<{
995
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
996
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
997
+ }>;
998
+ readonly status: Schema.Literal<"refused">;
999
+ readonly receipt: Schema.Null;
1000
+ readonly settlement: Schema.Null;
1001
+ readonly reason: Schema.NonEmptyString;
1002
+ }>, Schema.Struct<{
1003
+ readonly message: Schema.Struct<{
1004
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1005
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1006
+ }>;
1007
+ readonly status: Schema.Literal<"parked">;
1008
+ readonly receipt: Schema.NullOr<typeof Receipt>;
1009
+ readonly settlement: Schema.Null;
1010
+ readonly reason: Schema.NonEmptyString;
1011
+ }>]>, Schema.Union<readonly [Schema.Struct<{
1012
+ readonly _tag: Schema.Literal<"Pending">;
1013
+ readonly receipt: typeof Receipt;
1014
+ }>, Schema.Struct<{
1015
+ readonly _tag: Schema.Literal<"Settled">;
1016
+ readonly receipt: typeof Receipt;
1017
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1018
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1019
+ readonly outcome: Schema.Literal<"completed">;
1020
+ readonly result: Success;
1021
+ }>, Schema.Struct<{
1022
+ readonly _tag: Schema.Literal<"Settled">;
1023
+ readonly receipt: typeof Receipt;
1024
+ readonly runId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">>;
1025
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1026
+ readonly outcome: Schema.Literals<readonly ["failed", "aborted"]>;
1027
+ readonly failure: typeof SubagentExecutionFailure;
1028
+ }>]>]>;
1029
+ declare const WorkerParameters: <Name extends string>(declaration: WorkerDeclaration<Name>) => Schema.Struct<{
1030
+ readonly worker: Schema.brand<Schema.Struct<{
1031
+ readonly schemaVersion: Schema.Literal<1>;
1032
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1033
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1034
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1035
+ }>, `@effect-agent/Worker/${Name}`>;
1036
+ }>;
1037
+ declare const Summary: <Name extends string>(declaration: WorkerDeclaration<Name>) => Schema.Struct<{
1038
+ readonly latestReceipt: Schema.NullOr<typeof Receipt>;
1039
+ readonly state: Schema.Literals<readonly ["starting", "active", "idle", "stopping", "stopped", "completed", "failed", "cancelled"]>;
1040
+ readonly acceptedInput: Schema.NullOr<Schema.Struct<{
1041
+ readonly receipt: typeof Receipt;
1042
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1043
+ }>>;
1044
+ readonly appliedInput: Schema.NullOr<Schema.Struct<{
1045
+ readonly receipt: typeof Receipt;
1046
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1047
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1048
+ readonly sequence: Schema.Natural;
1049
+ }>>;
1050
+ readonly run: Schema.NullOr<Schema.Struct<{
1051
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1052
+ readonly hostReceipt: typeof Receipt;
1053
+ readonly outcome: Schema.NullOr<Schema.Literals<readonly ["completed", "failed", "aborted"]>>;
1054
+ readonly disposition: Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1055
+ }>>;
1056
+ readonly pendingDelivery: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
1057
+ readonly message: Schema.Struct<{
1058
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1059
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1060
+ }>;
1061
+ readonly status: Schema.Literal<"pending">;
1062
+ readonly receipt: Schema.Null;
1063
+ readonly settlement: Schema.Null;
1064
+ readonly reason: Schema.NullOr<Schema.NonEmptyString>;
1065
+ }>, Schema.Struct<{
1066
+ readonly message: Schema.Struct<{
1067
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1068
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1069
+ }>;
1070
+ readonly status: Schema.Literal<"accepted">;
1071
+ readonly receipt: typeof Receipt;
1072
+ readonly settlement: Schema.Null;
1073
+ readonly reason: Schema.NullOr<Schema.NonEmptyString>;
1074
+ }>, Schema.Struct<{
1075
+ readonly message: Schema.Struct<{
1076
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1077
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1078
+ }>;
1079
+ readonly status: Schema.Literal<"processed">;
1080
+ readonly receipt: typeof Receipt;
1081
+ readonly settlement: Schema.Struct<{
1082
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1083
+ readonly outcome: Schema.Literals<readonly ["completed", "failed", "aborted"]>;
1084
+ }>;
1085
+ readonly reason: Schema.Null;
1086
+ }>, Schema.Struct<{
1087
+ readonly message: Schema.Struct<{
1088
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1089
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1090
+ }>;
1091
+ readonly status: Schema.Literal<"refused">;
1092
+ readonly receipt: Schema.Null;
1093
+ readonly settlement: Schema.Null;
1094
+ readonly reason: Schema.NonEmptyString;
1095
+ }>, Schema.Struct<{
1096
+ readonly message: Schema.Struct<{
1097
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1098
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1099
+ }>;
1100
+ readonly status: Schema.Literal<"parked">;
1101
+ readonly receipt: Schema.NullOr<typeof Receipt>;
1102
+ readonly settlement: Schema.Null;
1103
+ readonly reason: Schema.NonEmptyString;
1104
+ }>]>>;
1105
+ readonly watermark: Schema.Struct<{
1106
+ readonly canonicalSequence: Schema.Natural;
1107
+ readonly acceptedQueueSequence: Schema.Natural;
1108
+ readonly pendingDeliveryVersion: Schema.NullOr<Schema.Natural>;
1109
+ }>;
1110
+ readonly worker: Schema.brand<Schema.Struct<{
1111
+ readonly schemaVersion: Schema.Literal<1>;
1112
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1113
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1114
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1115
+ }>, `@effect-agent/Worker/${Name}`>;
1116
+ }>;
1117
+ declare const FollowUpParameters: <Name extends string, Parameters extends Schema.Top>(declaration: WorkerDeclaration<Name>, parameters: Parameters) => Schema.Struct<{
1118
+ readonly worker: Schema.brand<Schema.Struct<{
1119
+ readonly schemaVersion: Schema.Literal<1>;
1120
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1121
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1122
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1123
+ }>, `@effect-agent/Worker/${Name}`>;
1124
+ readonly parameters: Parameters;
1125
+ }>;
1126
+ declare const ListParameters: Schema.Struct<{
1127
+ readonly limit: Schema.optionalKey<Schema.Int>;
1128
+ readonly after: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">>;
1129
+ }>;
1130
+ declare const Started: <Name extends string>(declaration: WorkerDeclaration<Name>) => Schema.Struct<{
1131
+ readonly worker: Schema.brand<Schema.Struct<{
1132
+ readonly schemaVersion: Schema.Literal<1>;
1133
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1134
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1135
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1136
+ }>, `@effect-agent/Worker/${Name}`>;
1137
+ readonly delivery: Schema.Union<readonly [Schema.Struct<{
1138
+ readonly message: Schema.Struct<{
1139
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1140
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1141
+ }>;
1142
+ readonly status: Schema.Literal<"pending">;
1143
+ readonly receipt: Schema.Null;
1144
+ readonly settlement: Schema.Null;
1145
+ readonly reason: Schema.NullOr<Schema.NonEmptyString>;
1146
+ }>, Schema.Struct<{
1147
+ readonly message: Schema.Struct<{
1148
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1149
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1150
+ }>;
1151
+ readonly status: Schema.Literal<"accepted">;
1152
+ readonly receipt: typeof Receipt;
1153
+ readonly settlement: Schema.Null;
1154
+ readonly reason: Schema.NullOr<Schema.NonEmptyString>;
1155
+ }>, Schema.Struct<{
1156
+ readonly message: Schema.Struct<{
1157
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1158
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1159
+ }>;
1160
+ readonly status: Schema.Literal<"processed">;
1161
+ readonly receipt: typeof Receipt;
1162
+ readonly settlement: Schema.Struct<{
1163
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
1164
+ readonly outcome: Schema.Literals<readonly ["completed", "failed", "aborted"]>;
1165
+ }>;
1166
+ readonly reason: Schema.Null;
1167
+ }>, Schema.Struct<{
1168
+ readonly message: Schema.Struct<{
1169
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1170
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1171
+ }>;
1172
+ readonly status: Schema.Literal<"refused">;
1173
+ readonly receipt: Schema.Null;
1174
+ readonly settlement: Schema.Null;
1175
+ readonly reason: Schema.NonEmptyString;
1176
+ }>, Schema.Struct<{
1177
+ readonly message: Schema.Struct<{
1178
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1179
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
1180
+ }>;
1181
+ readonly status: Schema.Literal<"parked">;
1182
+ readonly receipt: Schema.NullOr<typeof Receipt>;
1183
+ readonly settlement: Schema.Null;
1184
+ readonly reason: Schema.NonEmptyString;
1185
+ }>]>;
1186
+ }>;
1187
+ declare const Page: <Name extends string>(declaration: WorkerDeclaration<Name>) => Schema.Struct<{
1188
+ readonly items: Schema.$Array<Schema.Struct<{
1189
+ readonly worker: Schema.brand<Schema.Struct<{
1190
+ readonly schemaVersion: Schema.Literal<1>;
1191
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
1192
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
1193
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
1194
+ }>, `@effect-agent/Worker/${Name}`>;
1195
+ readonly latestReceipt: Schema.NullOr<typeof Receipt>;
1196
+ readonly state: Schema.Literals<readonly ["starting", "active", "idle"]>;
1197
+ }>>;
1198
+ readonly next: Schema.NullOr<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">>;
1199
+ }>;
1200
+ declare const preparationFailure: <Failure extends Schema.Top>(failure: Failure) => Schema.Union<readonly [Failure, typeof SubagentProjectionFailure, typeof WorkerError]>;
1201
+ declare const startFailure: <Failure extends Schema.Top>(failure: Failure) => Schema.Union<readonly [Failure, typeof SubagentProjectionFailure, typeof SubagentPrestartDenied, typeof WorkerError]>;
1202
+ declare const cancelFailure: Schema.Union<readonly [typeof WorkerError, typeof JoinedToHost]>;
1203
+ type ToolSchemas<Name extends string, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top> = {
1204
+ start: {
1205
+ parameters: Parameters;
1206
+ success: ReturnType<typeof Started<Name>>;
1207
+ failure: ReturnType<typeof startFailure<Failure>>;
1208
+ };
1209
+ followUp: {
1210
+ parameters: ReturnType<typeof FollowUpParameters<Name, Parameters>>;
1211
+ success: typeof MessageStatus;
1212
+ failure: ReturnType<typeof preparationFailure<Failure>>;
1213
+ };
1214
+ inspect: {
1215
+ parameters: ReturnType<typeof InspectParameters<Name>>;
1216
+ success: ReturnType<typeof Inspection<Success>>;
1217
+ failure: ReturnType<typeof preparationFailure<Failure>>;
1218
+ };
1219
+ summary: {
1220
+ parameters: ReturnType<typeof WorkerParameters<Name>>;
1221
+ success: ReturnType<typeof Summary<Name>>;
1222
+ failure: typeof WorkerError;
1223
+ };
1224
+ list: {
1225
+ parameters: typeof ListParameters;
1226
+ success: ReturnType<typeof Page<Name>>;
1227
+ failure: typeof WorkerError;
1228
+ };
1229
+ cancel: {
1230
+ parameters: ReturnType<typeof ReceiptParameters<Name>>;
1231
+ success: typeof Schema.Void;
1232
+ failure: typeof cancelFailure;
1233
+ };
1234
+ };
1235
+ type BackgroundToolMap<Name extends string, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top> = {
1236
+ start: Tool.Tool<`${Name}_start`, ToolSchemas<Name, Parameters, Success, Failure>["start"] & {
1237
+ readonly failureMode: "error";
1238
+ }, SubagentHost | Crypto.Crypto>;
1239
+ followUp: Tool.Tool<`${Name}_follow_up`, ToolSchemas<Name, Parameters, Success, Failure>["followUp"] & {
1240
+ readonly failureMode: "error";
1241
+ }, SubagentHost | Crypto.Crypto>;
1242
+ inspect: Tool.Tool<`${Name}_inspect`, ToolSchemas<Name, Parameters, Success, Failure>["inspect"] & {
1243
+ readonly failureMode: "error";
1244
+ }, SubagentHost>;
1245
+ summary: Tool.Tool<`${Name}_summary`, ToolSchemas<Name, Parameters, Success, Failure>["summary"] & {
1246
+ readonly failureMode: "error";
1247
+ }, SubagentHost>;
1248
+ list: Tool.Tool<`${Name}_list`, ToolSchemas<Name, Parameters, Success, Failure>["list"] & {
1249
+ readonly failureMode: "error";
1250
+ }, SubagentHost>;
1251
+ cancel: Tool.Tool<`${Name}_cancel`, ToolSchemas<Name, Parameters, Success, Failure>["cancel"] & {
1252
+ readonly failureMode: "error";
1253
+ }, SubagentHost>;
1254
+ };
1255
+ /**
1256
+ * Native Tool names and schemas expose statically guaranteed selections. The handler Layer also
1257
+ * requires services for operations whose conditional flags may enable them at runtime.
1258
+ */
1259
+ type BackgroundTools<Name extends string, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Selected extends BackgroundOptions> = { readonly [Op in Operation as Selected[Op] extends true ? `${Name}_${Suffix[Op]}` : never]: BackgroundToolMap<Name, Parameters, Success, Failure>[Op]; };
1260
+ /**
1261
+ * Derive optional native AI Tools and their handler Layer from one immutable declaration.
1262
+ * Projection services are captured by the Layer; the host and stable-key Crypto service remain
1263
+ * invocation dependencies. The attached `.tool` and its suspension behavior are unchanged.
1264
+ */
1265
+ declare const background$1: <const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project, const Selected extends BackgroundOptions>(declaration: Declaration<Name, Input, Output, Parameters, Success, Failure, Prepare, Project>, selected: Selected) => Readonly<{
1266
+ tools: BackgroundTools<Name, Parameters, Success, Failure, Selected>;
1267
+ toolkit: Toolkit.Toolkit<BackgroundTools<Name, Parameters, Success, Failure, Selected>>;
1268
+ layer: Layer.Layer<Tool.HandlersFor<BackgroundTools<Name, Parameters, Success, Failure, Selected>>, never, (Selected["followUp"] extends (infer T) ? T extends Selected["followUp"] ? T extends true ? Prepare | Input["EncodingServices"] | Parameters["EncodingServices"] : never : never : never) | (Selected["inspect"] extends (infer T_1) ? T_1 extends Selected["inspect"] ? T_1 extends true ? Project | Output["DecodingServices"] | Parameters["DecodingServices"] | Success["EncodingServices"] : never : never : never) | (Selected["reportToParent"] extends (infer T_2) ? T_2 extends Selected["reportToParent"] ? T_2 extends true ? Exclude<Project, Scope.Scope> | Exclude<Output["DecodingServices"], Scope.Scope> | Exclude<Parameters["DecodingServices"], Scope.Scope> | Exclude<Success["EncodingServices"], Scope.Scope> : never : never : never) | (Selected["start"] extends (infer T_3) ? T_3 extends Selected["start"] ? T_3 extends true ? Prepare | Input["EncodingServices"] | Parameters["EncodingServices"] : never : never : never)>;
1269
+ }>;
1270
+ declare namespace Subagent_d_exports {
1271
+ export { BackgroundOptions, BackgroundTools, SubagentChildRunFailure, SubagentContainedFailure, SubagentDeclarationOptions, SubagentDefineOptions, SubagentDelegation, SubagentDurableAccounting, SubagentDurableOptions, SubagentExecutionFailure, SubagentExecutionFailureClassification, SubagentFailureMode, SubagentGrant, SubagentLayerRequirements, SubagentPolicy, SubagentPolicyInput, SubagentPrepareContext, SubagentPrestartDenied, SubagentProjectionFailure, SubagentResult, SubagentResultContext, SubagentReturnModeFailure, SubagentRuntimeOptions, SubagentTool, SubagentToolFailure, SubagentTools, Worker, WorkerCompletion, WorkerObservation, WorkerReport, awaitWorker as await, background, cancel, define, delegationAllocationFromPolicy, delegationCapsFromPolicy, followUp, inspect, layer, list, make, observe, start, stop };
1272
+ }
1273
+ /**
1274
+ * Bounded parent metadata visible to `prepareInput`.
1275
+ * It never contains the parent transcript, prompt, or a root runtime Context.
1276
+ */
1277
+ type SubagentPrepareContext = {
1278
+ readonly delegationId: DelegationId;
1279
+ } & ({
1280
+ readonly source: "tool";
1281
+ readonly toolCallId: ToolCallId;
1282
+ readonly parent: AgentSpawnerParent;
1283
+ } | {
1284
+ readonly source: "programmatic";
1285
+ readonly parent: Pick<AgentSpawnerParent, "agentId" | "threadId">;
1286
+ });
1287
+ /**
1288
+ * Bounded framework context handed to `projectResult` (SUB-034).
1289
+ * `budgetExhausted` is true exactly when the child settled through the
1290
+ * final-answer exhaustion resolution (RUN-018) — on the ephemeral path from
1291
+ * the child result's `finishReason`, on the durable path from the child
1292
+ * Settlement's honest marker — so the projection can surface a
1293
+ * budget-truncated partial to the orchestrator.
1294
+ */
1295
+ interface SubagentResultContext {
1296
+ readonly budgetExhausted: boolean;
1297
+ /** Own and disjoint attached-descendant usage; absent only for legacy/custom hosts. */
1298
+ readonly usage?: RunTotals;
1299
+ readonly delegatedUsage?: RunTotals;
1300
+ }
1301
+ /** Default delegation result, preserving partial-output information. */
1302
+ declare const SubagentResult: <Output extends Schema.Top>(output: Output) => Schema.Struct<{
1303
+ readonly output: Output;
1304
+ readonly budgetExhausted: Schema.Boolean;
1305
+ }>;
1306
+ type SubagentResult<Output extends Schema.Top> = ReturnType<typeof SubagentResult<Output>>;
1307
+ /**
1308
+ * The delegation Tool failure Schema: the author's declared failure plus the
1309
+ * framework's preflight/budget/projection/durable-execution failure family.
1310
+ * With the default `failureMode: "error"`, exactly
1311
+ * this union (plus Effect AI's own error) can enter the parent handler `E`.
1312
+ *
1313
+ * The engine-owned `ToolCallWaiting` suspension signal and the typed
1314
+ * `SubagentDurabilityError` are members so the durable branch's waiting
1315
+ * signal and coordinator-seam failures travel typed through
1316
+ * `failureMode: "error"` (S2 plan §2); neither ever reaches an ephemeral
1317
+ * caller, and a waiting signal is not a Tool failure — the batch executor
1318
+ * keeps the raising call open and suspends the Run.
1319
+ */
1320
+ type SubagentToolFailure<Failure extends Schema.Top> = Schema.Union<readonly [Failure, typeof SubagentPrestartDenied, typeof SubagentBudgetExhausted, typeof SubagentProjectionFailure, typeof SubagentExecutionFailure, typeof ToolCallWaiting, typeof SubagentDurabilityError]>;
1321
+ /**
1322
+ * Resolution for expected delegation failures (SUB-033, ADR-0019 S2).
1323
+ * `"error"` (the default) keeps today's semantics: every expected failure
1324
+ * travels the Effect error channel and fails the parent Tool batch (D-008).
1325
+ * `"return"` contains them: the declared child failure and the framework
1326
+ * failure family become model-visible result data instead of parent-fatal
1327
+ * errors, so one dead child cannot detonate the whole parent Run.
1328
+ *
1329
+ * Effect AI's native `failureMode: "return"` is deliberately NOT used: its
1330
+ * `Stream.catch` converts every handler failure into a result, which would
1331
+ * encode the engine-owned `ToolCallWaiting` suspension signal as data and
1332
+ * silently orphan a durable child. Containment therefore lives in the
1333
+ * delegation handler — the underlying Tool keeps Effect AI
1334
+ * `failureMode: "error"`, the Tool success Schema widens to a union of the
1335
+ * declared success and the contained failure family, and exactly
1336
+ * `ToolCallWaiting` and `SubagentDurabilityError` stay in the error channel,
1337
+ * preserving durable suspension semantics by construction.
1338
+ */
1339
+ type SubagentFailureMode = "error" | "return";
1340
+ /**
1341
+ * The failure family that becomes model-visible result data under
1342
+ * `failureMode: "return"`: the author-declared failure plus every expected
1343
+ * framework delegation failure. The engine-signal members are excluded by
1344
+ * construction.
1345
+ */
1346
+ type SubagentContainedFailure<Failure extends Schema.Top> = Schema.Union<readonly [Failure, typeof SubagentPrestartDenied, typeof SubagentBudgetExhausted, typeof SubagentProjectionFailure, typeof SubagentExecutionFailure]>;
1347
+ /**
1348
+ * The only failures a `"return"`-mode delegation Tool can raise: the
1349
+ * engine-owned waiting signal (consumed by the batch executor, never a Tool
1350
+ * failure) and the durable coordinator-seam error. Neither ever reaches an
1351
+ * ephemeral caller.
1352
+ */
1353
+ type SubagentReturnModeFailure = Schema.Union<readonly [typeof ToolCallWaiting, typeof SubagentDurabilityError]>;
1354
+ /**
1355
+ * The native Effect AI Tool created by `Subagent.make` (SUB-001, SUB-003).
1356
+ * Its per-call dependencies are exactly the engine-provided `AgentSpawner`,
1357
+ * `RunEventSink`, and `SubagentDurability`; every child
1358
+ * requirement except the inherited Thread history policy is a construction requirement
1359
+ * of `Subagent.layer`. The engine excludes its own per-batch services from the runtime's
1360
+ * public requirements. Runtime IDs use the overridable default reference.
1361
+ */
1362
+ type SubagentTool<Name extends string, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Mode extends SubagentFailureMode = "error"> = Mode extends "return" ? Tool.Tool<Name, {
1363
+ readonly parameters: Parameters;
1364
+ readonly success: Schema.Union<readonly [Success, SubagentContainedFailure<Failure>]>;
1365
+ readonly failure: SubagentReturnModeFailure;
1366
+ readonly failureMode: "error";
1367
+ }, AgentSpawner | RunEventSink | SubagentDurability> : Tool.Tool<Name, {
1368
+ readonly parameters: Parameters;
1369
+ readonly success: Success;
1370
+ readonly failure: SubagentToolFailure<Failure>;
1371
+ readonly failureMode: "error";
1372
+ }, AgentSpawner | RunEventSink | SubagentDurability>;
1373
+ /** Singleton Tool record provided by one `Subagent.layer`. */
1374
+ type SubagentTools<Name extends string, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Mode extends SubagentFailureMode = "error"> = { readonly [Key in Name]: SubagentTool<Name, Parameters, Success, Failure, Mode>; };
1375
+ /** Explicit options accepted by `Subagent.make`. */
1376
+ interface SubagentDefineOptions<TargetInput extends Schema.Top, TargetOutput extends Schema.Top, TargetInstructions, TargetTools extends Record<string, Tool.Any>, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, PrepareRequirements = never, ProjectRequirements = never, Mode extends SubagentFailureMode = "error"> {
1377
+ /**
1378
+ * Expected-failure resolution (SUB-033): `"error"` (default) fails the
1379
+ * parent Tool batch; `"return"` contains the declared failure and the
1380
+ * framework failure family as model-visible result data while
1381
+ * `ToolCallWaiting`/`SubagentDurabilityError` stay in the error channel.
1382
+ */
1383
+ readonly failureMode?: Mode;
1384
+ /** Model-visible description of the delegated capability. */
1385
+ readonly description?: string | undefined;
1386
+ /** The model-agnostic child Agent Definition this delegation targets (SUB-002). */
1387
+ readonly target: Definition<TargetInput, TargetOutput, TargetInstructions, Toolkit.Toolkit<TargetTools>, RunDispositionDeclaration<TargetOutput["Type"], Schema.Top> | undefined, unknown, Schema.Top | undefined>;
1388
+ /** Schema for the model-decoded delegation parameters. */
1389
+ readonly parameters: Parameters;
1390
+ /** Schema for the bounded parent Tool result. */
1391
+ readonly success: Success;
1392
+ /** Schema for the author-declared delegation failure data. */
1393
+ readonly failure: Failure;
1394
+ /**
1395
+ * Effectful, typed projection from decoded parameters and bounded parent
1396
+ * metadata to the child Agent input. It never
1397
+ * receives the parent transcript or a root Context; its expected failures
1398
+ * are already the declared Tool failure.
1399
+ */
1400
+ readonly prepareInput: (parameters: Parameters["Type"], context: SubagentPrepareContext) => Effect.Effect<TargetInput["Type"], Failure["Type"] | SubagentProjectionFailure, PrepareRequirements>;
1401
+ /**
1402
+ * Bounded result projection from the Schema-decoded child output, result
1403
+ * context, and original Schema-decoded Tool parameters to the declared Tool
1404
+ * success value. This is the explicit
1405
+ * declassification boundary for child output: the parameters let it bind
1406
+ * echoed identity and scope to the exact request without prompt parsing.
1407
+ * The context carries the
1408
+ * framework's honest exhaustion marker (SUB-034): when `budgetExhausted` is
1409
+ * true the child settled through the final-answer resolution (RUN-018) and
1410
+ * its output is a budget-truncated partial — surface it in the declared
1411
+ * success Schema so the orchestrator can decide to re-delegate with a
1412
+ * raised `toolCallAllowance`.
1413
+ */
1414
+ readonly projectResult: (output: TargetOutput["Type"], context: SubagentResultContext, parameters: Parameters["Type"]) => Effect.Effect<Success["Type"], Failure["Type"] | SubagentProjectionFailure, ProjectRequirements>;
1415
+ /**
1416
+ * Per-invocation child Tool Call allowance (SUB-034): a tightening-only
1417
+ * bound below the child Definition's own `maxToolCalls`, additionally
1418
+ * clamped to this delegation's `SubagentPolicy.maxToolCalls` (the
1419
+ * per-invocation reservation slice). `fromParameters` lets the orchestrator
1420
+ * model grant a larger allowance through an author-owned parameter field —
1421
+ * the budget-extension flow is a fresh re-delegation with a raised
1422
+ * allowance, never a mid-flight top-up. Durable establishment records the
1423
+ * effective allowance before child admission and restores it on every Attempt.
1424
+ */
1425
+ readonly toolCallAllowance?: {
1426
+ /** Applied when `fromParameters` is absent or yields nothing. */
1427
+ readonly default: number;
1428
+ /** Extract the model-granted allowance from the decoded parameters. */
1429
+ readonly fromParameters?: (parameters: Parameters["Type"]) => number | undefined;
1430
+ } | undefined;
1431
+ /** Per-child ceilings. When omitted, reserve from the parent policy's shared delegation pool. */
1432
+ readonly policy?: SubagentPolicy | undefined;
1433
+ /**
1434
+ * Authority ceiling for the child. Defaults to
1435
+ * exactly the target's declared Tool names at depth ceiling one. The engine
1436
+ * exposes only permitted Tools; nested launches also require depth and lifetime authority.
1437
+ */
1438
+ readonly grant?: SubagentGrant | undefined;
1439
+ /**
1440
+ * Native Effect AI approval metadata for establishment only (SUB-026):
1441
+ * parent approval never authorizes child actions, siblings, or retries.
1442
+ */
1443
+ readonly needsApproval?: Tool.NeedsApproval<Parameters> | undefined;
1444
+ }
1445
+ /**
1446
+ * An immutable Subagent capability: one target Agent Definition exposed to
1447
+ * a parent as one Effect AI Tool with explicit projections, policy, and
1448
+ * authority ceiling. It owns no acquired resources and
1449
+ * is not executable until `Subagent.layer` supplies the child's model Layer.
1450
+ */
1451
+ interface SubagentDelegation<Name extends string, TargetInput extends Schema.Top, TargetOutput extends Schema.Top, TargetInstructions, TargetTools extends Record<string, Tool.Any>, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, PrepareRequirements = never, ProjectRequirements = never, Mode extends SubagentFailureMode = "error"> extends SubagentDefineOptions<TargetInput, TargetOutput, TargetInstructions, TargetTools, Parameters, Success, Failure, PrepareRequirements, ProjectRequirements, Mode> {
1452
+ readonly name: Name;
1453
+ /** Stable delegation identity; S1 derives it from the unique Tool name. */
1454
+ readonly delegationId: DelegationId;
1455
+ readonly grant: SubagentGrant;
1456
+ /** The resolved expected-failure resolution (SUB-033); never absent after `make`. */
1457
+ readonly failureMode: Mode;
1458
+ /**
1459
+ * The canonical contained-failure family for this delegation (SUB-033):
1460
+ * the declared failure plus the framework members. Consumers that classify
1461
+ * returned failure data (for example a coverage gate) MUST decode through
1462
+ * this value rather than reconstructing the union, so a framework change
1463
+ * to the contained family can never diverge from their decoder.
1464
+ */
1465
+ readonly containedFailure: SubagentContainedFailure<Failure>;
1466
+ /** The real Effect AI Tool to include in the parent Toolkit (SUB-001). */
1467
+ readonly tool: SubagentTool<Name, Parameters, Success, Failure, Mode>;
1468
+ }
1469
+ /** Pure Subagent authoring surface. */
1470
+ /** Optional authoring fields; schemas default to the child's input and result envelope. */
1471
+ type SubagentDeclarationOptions<Input extends Schema.Top, Output extends Schema.Top, Instructions, Tools extends Record<string, Tool.Any>, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project, Mode extends SubagentFailureMode> = Omit<SubagentDefineOptions<Input, Output, Instructions, Tools, Parameters, Success, Failure, Prepare, Project, Mode>, "parameters" | "success" | "failure" | "prepareInput" | "projectResult"> & {
1472
+ readonly parameters?: Parameters;
1473
+ readonly success?: Success;
1474
+ readonly failure?: Failure;
1475
+ readonly prepareInput?: SubagentDefineOptions<Input, Output, Instructions, Tools, Parameters, Success, Failure, Prepare, Project, Mode>["prepareInput"];
1476
+ readonly projectResult?: SubagentDefineOptions<Input, Output, Instructions, Tools, Parameters, Success, Failure, Prepare, Project, Mode>["projectResult"];
1477
+ };
1478
+ /**
1479
+ * Expose one child Agent as an attached Effect AI Tool. The nonempty application
1480
+ * name is preserved as both Tool name and delegation identity; no prefix is required.
1481
+ * Parameters and result projections default to the child's input and result envelope.
1482
+ * Throws when the name is empty. Nested Tool visibility follows the effective inherited grant.
1483
+ */
1484
+ declare function make<const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Instructions, Tools extends Record<string, Tool.Any>, Parameters extends Schema.Top = Input, Success extends Schema.Top = SubagentResult<Output>, Failure extends Schema.Top = typeof Schema.Never, Prepare = never, Project = never, Target extends Definition<Input, Output, Instructions, Toolkit.Toolkit<Tools>, RunDispositionDeclaration<Output["Type"], Schema.Top> | undefined, unknown, Schema.Top | undefined> = Definition<Input, Output, Instructions, Toolkit.Toolkit<Tools>, RunDispositionDeclaration<Output["Type"], Schema.Top> | undefined, unknown, Schema.Top | undefined>>(name: Name, options: SubagentDeclarationOptions<Input, Output, Instructions, Tools, Parameters, Success, Failure, Prepare, Project, "return"> & {
1485
+ readonly failureMode: "return";
1486
+ readonly target: Target;
1487
+ }): SubagentDelegation<Name, Input, Output, Instructions, Tools, Parameters, Success, Failure, Prepare, Project, "return"> & {
1488
+ readonly target: Target;
1489
+ };
1490
+ declare function make<const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Instructions, Tools extends Record<string, Tool.Any>, Parameters extends Schema.Top = Input, Success extends Schema.Top = SubagentResult<Output>, Failure extends Schema.Top = typeof Schema.Never, Prepare = never, Project = never, Target extends Definition<Input, Output, Instructions, Toolkit.Toolkit<Tools>, RunDispositionDeclaration<Output["Type"], Schema.Top> | undefined, unknown, Schema.Top | undefined> = Definition<Input, Output, Instructions, Toolkit.Toolkit<Tools>, RunDispositionDeclaration<Output["Type"], Schema.Top> | undefined, unknown, Schema.Top | undefined>>(name: Name, options: SubagentDeclarationOptions<Input, Output, Instructions, Tools, Parameters, Success, Failure, Prepare, Project, "error"> & {
1491
+ readonly target: Target;
1492
+ }): SubagentDelegation<Name, Input, Output, Instructions, Tools, Parameters, Success, Failure, Prepare, Project> & {
1493
+ readonly target: Target;
1494
+ };
1495
+ /** @deprecated Use `Subagent.make`. */
1496
+ declare const define: typeof make;
1497
+ type InstructionResultOf<Instructions, Input> = Instructions extends ((input: Input) => infer Result) ? Result : Instructions;
1498
+ type InstructionErrorOf<Instructions, Input> = InstructionResultOf<Instructions, Input> extends Effect.Effect<infer _Success, infer Error, infer _Requirements> ? Error : never;
1499
+ type InstructionRequirementsOf<Instructions, Input> = InstructionResultOf<Instructions, Input> extends Effect.Effect<infer _Success, infer _Error, infer Requirements> ? Requirements : never;
1500
+ /**
1501
+ * Every expected child Run failure the delegation's total mapping must cover:
1502
+ * the child's inferred Agent failures plus
1503
+ * the interpreter's policy, protocol, and approval failures. Interruption and
1504
+ * defects are not members; they retain their distinct semantics.
1505
+ */
1506
+ type SubagentChildRunFailure<TargetInput extends Schema.Top, TargetOutput extends Schema.Top, TargetInstructions, TargetTools extends Record<string, Tool.Any>, Provider, ModelProvides, ModelRequires, InstructionError = InstructionErrorOf<TargetInstructions, TargetInput["Type"]>, InstructionRequirements = InstructionRequirementsOf<TargetInstructions, TargetInput["Type"]>, InputPromptValue extends InputPromptSource<TargetInput["Type"], unknown, unknown> | undefined = undefined, UpdatesSchema extends Schema.Top | undefined = undefined, RunDispositionValue extends RunDispositionDeclaration<TargetOutput["Type"], Schema.Top> | undefined = undefined> = AgentRuntimeFailure<RuntimeBinding<TargetInput, TargetOutput, TargetInstructions, TargetTools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema>, never, InstructionError>;
1507
+ /**
1508
+ * Construction requirements of one `Subagent.layer`: the child
1509
+ * Binding's full runtime requirements (Model Layer requirements, child Tool
1510
+ * handlers and their services, Schema services), both projection
1511
+ * requirements, and the parent-owned reservation service. Nothing here leaks
1512
+ * into the per-call Tool handler requirements. ThreadHistory and RunContextPreparation belong
1513
+ * to the parent Run's AgentSpawner and are inherited at invocation rather than captured here.
1514
+ */
1515
+ type SubagentLayerRequirements<TargetInput extends Schema.Top, TargetOutput extends Schema.Top, TargetInstructions, TargetTools extends Record<string, Tool.Any>, Provider, ModelProvides, ModelRequires, PrepareRequirements, ProjectRequirements, HookRequirements = never, InstructionError = InstructionErrorOf<TargetInstructions, TargetInput["Type"]>, InstructionRequirements = InstructionRequirementsOf<TargetInstructions, TargetInput["Type"]>, InputPromptValue extends InputPromptSource<TargetInput["Type"], unknown, unknown> | undefined = undefined, UpdatesSchema extends Schema.Top | undefined = undefined, RunDispositionValue extends RunDispositionDeclaration<TargetOutput["Type"], Schema.Top> | undefined = undefined> = Exclude<AgentRuntimeRequirements<RuntimeBinding<TargetInput, TargetOutput, TargetInstructions, TargetTools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema>, HookRequirements, InstructionRequirements>, ThreadHistory | RunContextPreparation> | TargetInput["EncodingServices"] | PrepareRequirements | ProjectRequirements | SubagentReservations;
1516
+ /**
1517
+ * Optional construction-fixed digest override for durable delegation.
1518
+ * The coordinator normally resolves the exact target Definition through its
1519
+ * existing host registration. An override must agree with that registration.
1520
+ */
1521
+ interface SubagentDurableOptions {
1522
+ /**
1523
+ * Exact digests from the target's host registration. Fixed once at handler
1524
+ * Layer construction and checked against that registration at establishment.
1525
+ * Recovery uses the canonical request's recorded digests, never current code.
1526
+ */
1527
+ readonly targetDigests: RunSubagentDigests;
1528
+ }
1529
+ declare const SubagentDurableAccounting_base: Schema.Class<SubagentDurableAccounting, Schema.Struct<{
1530
+ /** The per-invocation allocation reserved at establishment. */
1531
+ readonly allocation: typeof SubagentReservationAmounts;
1532
+ /** Final consumed decision per dimension. */
1533
+ readonly consumed: typeof SubagentReservationAmounts;
1534
+ /** Amounts returned to the parent: `allocation - consumed` per dimension. */
1535
+ readonly released: typeof SubagentReservationAmounts;
1536
+ /** How the decision was computed; the handler only ever reports conservatively. */
1537
+ readonly basis: Schema.Literals<readonly ["reserved-conservative"]>;
1538
+ }>, {}>;
1539
+ /**
1540
+ * The conservative final accounting summary the durable delegation handler
1541
+ * attaches to every settlement join. The handler has no live child usage stream at durable join
1542
+ * time, so every dimension conservatively consumes its full reservation and
1543
+ * releases nothing — unreported usage never creates budget. The coordinator
1544
+ * owns the canonical accounting decision on `SubagentJoined` and may replace
1545
+ * structural dimensions from canonical child evidence; this value is opaque
1546
+ * encoded policy math to the engine and to storage adapters (D8).
1547
+ */
1548
+ declare class SubagentDurableAccounting extends SubagentDurableAccounting_base {}
1549
+ /** Options accepted by `Subagent.layer`. */
1550
+ interface SubagentRuntimeOptions<Failure extends Schema.Top, ChildFailure, HookRequirements = never> {
1551
+ /**
1552
+ * Optional exact digest override. Without it, the durable coordinator resolves
1553
+ * the target Definition from its existing host registrations.
1554
+ */
1555
+ readonly durable?: SubagentDurableOptions | undefined;
1556
+ /**
1557
+ * Total mapping from every expected child Run failure to the declared Tool
1558
+ * failure (SUB-028). The parameter type is the child Binding's complete
1559
+ * expected failure union, so a mapping that covers only part of it is a
1560
+ * compile error. Interruption stays interruption and defects stay defects;
1561
+ * neither reaches this mapping.
1562
+ * When omitted, failures become bounded `SubagentExecutionFailure` values.
1563
+ */
1564
+ readonly mapChildFailure?: ((failure: ChildFailure) => Failure["Type"]) | undefined;
1565
+ /**
1566
+ * Override the parent-Run delegation caps registered with
1567
+ * `SubagentReservations`. An explicit policy uses `delegationCapsFromPolicy(policy)`;
1568
+ * an omitted policy uses one pool sized from the parent policy.
1569
+ * Supply shared caps explicitly when one parent Run uses several delegation
1570
+ * Tools, because re-registering different caps denies start fail-closed.
1571
+ */
1572
+ readonly parentCaps?: SubagentDelegationCaps | undefined;
1573
+ /**
1574
+ * Seed child Run options (approval, context, input hooks) so child actions
1575
+ * follow their own ordinary approval and policy (SUB-026). Hook failures
1576
+ * must be handled inside the hook (`never` in `E`); a supplied budget hook
1577
+ * is composed after the reservation's own usage observation.
1578
+ */
1579
+ readonly child?: SpawnRunOptions<never, HookRequirements> | undefined;
1580
+ }
1581
+ /**
1582
+ * Build the Toolkit handler Layer using the provided model requirement, or pass
1583
+ * a native model / explicit child Binding as an override. Without an override,
1584
+ * provide the model with Layer.provide; the handler captures it at construction.
1585
+ * AutoModel resolves each new child's own Thread ID and projected first task.
1586
+ * Share its selection store across parent Runs and child handler Layers.
1587
+ *
1588
+ * Construction requirements carry the child Binding's full runtime needs and
1589
+ * both projections; they are captured once via `Effect.context` so the
1590
+ * per-call handler requirements stay exactly the Tool's declared engine
1591
+ * dependencies. The handler dispatches on the engine-provided per-batch
1592
+ * `SubagentDurability` service mode:
1593
+ *
1594
+ * - **ephemeral** (the explicit engine default when no durable coordinator
1595
+ * supplied `RunOptions.subagent`): the S1 path unchanged — preflight, an
1596
+ * in-process scoped child Run (SUB-011/012), stable lifecycle events,
1597
+ * total-mapped expected child failures, and Scope-finalizer reservation
1598
+ * settlement on every exit path.
1599
+ * - **durable** (S2): the same fail-closed preflight and input projection,
1600
+ * then idempotent establishment through the coordinator (spec §12 steps
1601
+ * 2-9) with construction-fixed child Binding digests, encoded grant, and
1602
+ * encoded allocation; the engine-owned waiting signal while the attached
1603
+ * child is nonterminal; and, on re-entry with a settled child, output
1604
+ * decoding, `projectResult`, and ONE atomic settlement join carrying the
1605
+ * conservative accounting summary. Failed children join as the bounded
1606
+ * `SubagentExecutionFailure`; no in-process child fiber ever starts.
1607
+ */
1608
+ declare function layer<Name extends string, TargetInput extends Schema.Top, TargetOutput extends Schema.Top, TargetInstructions, TargetTools extends Record<string, Tool.Any>, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, PrepareRequirements, ProjectRequirements, HookRequirements = never, Mode extends SubagentFailureMode = "error", InstructionError = InstructionErrorOf<TargetInstructions, TargetInput["Type"]>, InstructionRequirements = InstructionRequirementsOf<TargetInstructions, TargetInput["Type"]>, InputPromptValue extends InputPromptSource<TargetInput["Type"], unknown, unknown> | undefined = undefined, UpdatesSchema extends Schema.Top | undefined = undefined, RunDispositionValue extends RunDispositionDeclaration<TargetOutput["Type"], Schema.Top> | undefined = undefined>(delegation: SubagentDelegation<Name, TargetInput, TargetOutput, TargetInstructions, TargetTools, Parameters, Success, Failure, PrepareRequirements, ProjectRequirements, Mode> & {
1609
+ readonly target: {
1610
+ readonly instructions: InstructionSource<TargetInput["Type"], NoInfer<InstructionError>, NoInfer<InstructionRequirements>>;
1611
+ readonly inputPrompt?: InputPromptValue | undefined;
1612
+ readonly updates?: UpdatesSchema | undefined;
1613
+ readonly runDisposition?: RunDispositionValue | undefined;
1614
+ };
1615
+ }, modelOrBinding?: undefined, options?: SubagentRuntimeOptions<Failure, SubagentChildRunFailure<TargetInput, TargetOutput, TargetInstructions, TargetTools, never, never, ModelServices, InstructionError, InstructionRequirements, InputPromptValue, UpdatesSchema, RunDispositionValue>, HookRequirements>): Layer.Layer<Tool.HandlersFor<SubagentTools<Name, Parameters, Success, Failure, Mode>>, never, SubagentLayerRequirements<TargetInput, TargetOutput, TargetInstructions, TargetTools, never, never, ModelServices, PrepareRequirements, ProjectRequirements, HookRequirements, InstructionError, InstructionRequirements, InputPromptValue, UpdatesSchema, RunDispositionValue>>;
1616
+ declare function layer<Name extends string, TargetInput extends Schema.Top, TargetOutput extends Schema.Top, TargetInstructions, TargetTools extends Record<string, Tool.Any>, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, PrepareRequirements, ProjectRequirements, Provider, ModelProvides, ModelRequires, HookRequirements = never, Mode extends SubagentFailureMode = "error", InstructionError = InstructionErrorOf<TargetInstructions, TargetInput["Type"]>, InstructionRequirements = InstructionRequirementsOf<TargetInstructions, TargetInput["Type"]>, InputPromptValue extends InputPromptSource<TargetInput["Type"], unknown, unknown> | undefined = undefined, UpdatesSchema extends Schema.Top | undefined = undefined, RunDispositionValue extends RunDispositionDeclaration<TargetOutput["Type"], Schema.Top> | undefined = undefined>(delegation: SubagentDelegation<Name, TargetInput, TargetOutput, TargetInstructions, TargetTools, Parameters, Success, Failure, PrepareRequirements, ProjectRequirements, Mode> & {
1617
+ readonly target: {
1618
+ readonly instructions: InstructionSource<TargetInput["Type"], NoInfer<InstructionError>, NoInfer<InstructionRequirements>>;
1619
+ readonly inputPrompt?: InputPromptValue | undefined;
1620
+ readonly updates?: UpdatesSchema | undefined;
1621
+ readonly runDisposition?: RunDispositionValue | undefined;
1622
+ };
1623
+ }, modelOrBinding: RuntimeBinding<TargetInput, TargetOutput, TargetInstructions, TargetTools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema> | RuntimeBinding<TargetInput, TargetOutput, TargetInstructions, TargetTools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, RunDispositionValue, InputPromptValue, UpdatesSchema>["model"], options?: SubagentRuntimeOptions<Failure, SubagentChildRunFailure<TargetInput, TargetOutput, TargetInstructions, TargetTools, Provider, ModelProvides, ModelRequires, InstructionError, InstructionRequirements, InputPromptValue, UpdatesSchema, RunDispositionValue>, HookRequirements>): Layer.Layer<Tool.HandlersFor<SubagentTools<Name, Parameters, Success, Failure, Mode>>, never, SubagentLayerRequirements<TargetInput, TargetOutput, TargetInstructions, TargetTools, Provider, ModelProvides, ModelRequires, PrepareRequirements, ProjectRequirements, HookRequirements, InstructionError, InstructionRequirements, InputPromptValue, UpdatesSchema, RunDispositionValue>>;
1624
+ /**
1625
+ * Derive selected background Tools directly from a child Agent, using its ID as the delegation
1626
+ * name and its input/output Schemas as the default contract. Pass an explicit Subagent.make
1627
+ * declaration to customize the name, projections, grants, or policy bounds.
1628
+ */
1629
+ declare function background<const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Instructions, Tools extends Record<string, Tool.Any>, const Selected extends BackgroundOptions>(target: Definition<Input, Output, Instructions, Toolkit.Toolkit<Tools>, RunDispositionDeclaration<Output["Type"], Schema.Top> | undefined, unknown, Schema.Top | undefined> & {
1630
+ readonly id: AgentId & Name;
1631
+ }, selected: Selected): ReturnType<typeof background$1<Name, Input, Output, Input, SubagentResult<Output>, typeof Schema.Never, never, never, Selected>>;
1632
+ declare function background<const Name extends string, Input extends Schema.Top, Output extends Schema.Top, Parameters extends Schema.Top, Success extends Schema.Top, Failure extends Schema.Top, Prepare, Project, const Selected extends BackgroundOptions>(declaration: Declaration<Name, Input, Output, Parameters, Success, Failure, Prepare, Project>, selected: Selected): ReturnType<typeof background$1<Name, Input, Output, Parameters, Success, Failure, Prepare, Project, Selected>>;
1633
+ //#endregion
1634
+ export { inspect as A, delegationCapsFromPolicy as B, BackgroundOptions as C, awaitWorker as D, WorkerObservation as E, SubagentPolicy as F, SubagentPolicyInput as I, SubagentPrestartDenied as L, observe as M, start as N, cancel as O, stop as P, SubagentProjectionFailure as R, make as S, Worker as T, SubagentTools as _, SubagentDelegation as a, define as b, SubagentFailureMode as c, SubagentResult as d, SubagentResultContext as f, SubagentToolFailure as g, SubagentTool as h, SubagentDefineOptions as i, list as j, followUp as k, SubagentLayerRequirements as l, SubagentRuntimeOptions as m, SubagentContainedFailure as n, SubagentDurableAccounting as o, SubagentReturnModeFailure as p, SubagentDeclarationOptions as r, SubagentDurableOptions as s, SubagentChildRunFailure as t, SubagentPrepareContext as u, Subagent_d_exports as v, BackgroundTools as w, layer as x, background as y, delegationAllocationFromPolicy as z };
1635
+ //# sourceMappingURL=Subagent-CNik9RiA.d.mts.map