effect-agent 0.1.0-beta.9 → 0.1.0-beta.90

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 (538) hide show
  1. package/dist/Agent-CN0EWRsR.d.mts +226 -0
  2. package/dist/Agent-RklVROrm.mjs +83 -0
  3. package/dist/Agent-RklVROrm.mjs.map +1 -0
  4. package/dist/AgentError-CggcAQ7V.d.mts +101 -0
  5. package/dist/AgentPolicy-CetmQrf3.d.mts +96 -0
  6. package/dist/AgentRuntime-CHipL2jG.mjs +4598 -0
  7. package/dist/AgentRuntime-CHipL2jG.mjs.map +1 -0
  8. package/dist/AgentRuntime-uxR_a4VM.d.mts +346 -0
  9. package/dist/AgentUpdates-DMJ-_xow.d.mts +53 -0
  10. package/dist/ContextCompactor-Dxu5zhOL.d.mts +161 -0
  11. package/dist/ContextWindow-DRQ5Mbm2.d.mts +58 -0
  12. package/dist/DurableAgentRuntime-D7gDKGjH.mjs +6368 -0
  13. package/dist/DurableAgentRuntime-D7gDKGjH.mjs.map +1 -0
  14. package/dist/DurableFailpoint-Oinuuedm.d.mts +41 -0
  15. package/dist/DurableStep-Cry_iol4.d.mts +103 -0
  16. package/dist/Ephemeral.d.mts +22 -0
  17. package/dist/Ephemeral.mjs +22 -0
  18. package/dist/Ephemeral.mjs.map +1 -0
  19. package/dist/EventSource-OqS_P9ug.d.mts +51 -0
  20. package/dist/Identifiers-CN2s30fF.d.mts +40 -0
  21. package/dist/MemoryNamespace-BbRW5p71.d.mts +36 -0
  22. package/dist/MemoryReference-B8Q3UJoJ.d.mts +79 -0
  23. package/dist/Messaging-CkcIdt4I.d.mts +490 -0
  24. package/dist/MessagingHost-CRk0kXzT.d.mts +246 -0
  25. package/dist/MessagingHost-CWi_PP3g.mjs +137 -0
  26. package/dist/MessagingHost-CWi_PP3g.mjs.map +1 -0
  27. package/dist/OperationAuthorizer-TzcQtpX5.d.mts +61 -0
  28. package/dist/Output-D6SkedVx.d.mts +25 -0
  29. package/dist/PageCapture-Df8Xwskw.d.mts +583 -0
  30. package/dist/PageScreenshot-BpgZKAxl.d.mts +48 -0
  31. package/dist/PreparedInputAdmission-C4HbjHgl.d.mts +38 -0
  32. package/dist/Receipt-BAHyigAF.d.mts +33 -0
  33. package/dist/Records-BAGkekt8.d.mts +3570 -0
  34. package/dist/RunEvent-DIrzkjLr.d.mts +460 -0
  35. package/dist/RunEventSink-D5aVhISG.d.mts +108 -0
  36. package/dist/RunJournal-Cgg1kNvc.mjs +825 -0
  37. package/dist/RunJournal-Cgg1kNvc.mjs.map +1 -0
  38. package/dist/RunOptions-g1aigcKI.d.mts +915 -0
  39. package/dist/RunPolicyUsage-ClZxyR46.d.mts +21 -0
  40. package/dist/Sandbox-CEsDWBLq.d.mts +173 -0
  41. package/dist/Schedule-H3SEYX9g.d.mts +842 -0
  42. package/dist/Scheduling-C9aIP8zT.mjs +691 -0
  43. package/dist/Scheduling-C9aIP8zT.mjs.map +1 -0
  44. package/dist/Subagent-DyfzHNdv.d.mts +826 -0
  45. package/dist/Subagent-U5qXOFE8.mjs +1469 -0
  46. package/dist/Subagent-U5qXOFE8.mjs.map +1 -0
  47. package/dist/SubagentContract-DdT7Cqe6.d.mts +116 -0
  48. package/dist/SubagentHost-CJUBQlcc.d.mts +140 -0
  49. package/dist/Subscription-BEP8oQO5.d.mts +921 -0
  50. package/dist/SubscriptionInput-vAAOBrK7.d.mts +41 -0
  51. package/dist/Thread-DOBQ0QUY.d.mts +96 -0
  52. package/dist/ThreadHistory-tS1KwxHR.d.mts +60 -0
  53. package/dist/ToolBroker-DWs4tZra.d.mts +133 -0
  54. package/dist/ToolExposure-9uF_Yo0T.mjs +10 -0
  55. package/dist/ToolExposure-9uF_Yo0T.mjs.map +1 -0
  56. package/dist/ToolExposure-C93U1sPu.mjs +30 -0
  57. package/dist/ToolExposure-C93U1sPu.mjs.map +1 -0
  58. package/dist/ToolExposure-UCN12eCd.d.mts +39 -0
  59. package/dist/ToolExposure-r2eOWk4F.d.mts +46 -0
  60. package/dist/ToolExposure.d.mts +8 -0
  61. package/dist/ToolExposure.mjs +21 -0
  62. package/dist/ToolExposure.mjs.map +1 -0
  63. package/dist/ToolReconciler-DQVaJfpE.d.mts +76 -0
  64. package/dist/ToolResult-DmmgoChv.d.mts +61 -0
  65. package/dist/Usage-Dx0aknfk.d.mts +121 -0
  66. package/dist/WakeScheduler-EjUF-GhC.d.mts +56 -0
  67. package/dist/Worker-CaPYykpe.d.mts +228 -0
  68. package/dist/agent-registration-CWDMOAZA.mjs +172 -0
  69. package/dist/agent-registration-CWDMOAZA.mjs.map +1 -0
  70. package/dist/capabilities/Approval.d.mts +114 -0
  71. package/dist/capabilities/Approval.mjs +226 -0
  72. package/dist/capabilities/Approval.mjs.map +1 -0
  73. package/dist/capabilities/Budget.d.mts +112 -0
  74. package/dist/capabilities/Budget.mjs +346 -0
  75. package/dist/capabilities/Budget.mjs.map +1 -0
  76. package/dist/capabilities/CodeMode.d.mts +157 -0
  77. package/dist/capabilities/CodeMode.mjs +522 -0
  78. package/dist/capabilities/CodeMode.mjs.map +1 -0
  79. package/dist/capabilities/Commands.d.mts +55 -0
  80. package/dist/capabilities/Commands.mjs +57 -0
  81. package/dist/capabilities/Commands.mjs.map +1 -0
  82. package/dist/capabilities/ContextTools.d.mts +321 -0
  83. package/dist/capabilities/ContextTools.mjs +126 -0
  84. package/dist/capabilities/ContextTools.mjs.map +1 -0
  85. package/dist/capabilities/Mcp.d.mts +108 -0
  86. package/dist/capabilities/Mcp.mjs +260 -0
  87. package/dist/capabilities/Mcp.mjs.map +1 -0
  88. package/dist/capabilities/McpClient.d.mts +115 -0
  89. package/dist/capabilities/McpClient.mjs +506 -0
  90. package/dist/capabilities/McpClient.mjs.map +1 -0
  91. package/dist/capabilities/MemoryNotes.d.mts +424 -0
  92. package/dist/capabilities/MemoryNotes.mjs +128 -0
  93. package/dist/capabilities/MemoryNotes.mjs.map +1 -0
  94. package/dist/capabilities/Messaging.d.mts +3 -0
  95. package/dist/capabilities/Messaging.mjs +151 -0
  96. package/dist/capabilities/Messaging.mjs.map +1 -0
  97. package/dist/capabilities/ModelContext.d.mts +89 -0
  98. package/dist/capabilities/ModelContext.mjs +168 -0
  99. package/dist/capabilities/ModelContext.mjs.map +1 -0
  100. package/dist/capabilities/Redaction.d.mts +37 -0
  101. package/dist/capabilities/Redaction.mjs +104 -0
  102. package/dist/capabilities/Redaction.mjs.map +1 -0
  103. package/dist/capabilities/Remembering.d.mts +434 -0
  104. package/dist/capabilities/Remembering.mjs +290 -0
  105. package/dist/capabilities/Remembering.mjs.map +1 -0
  106. package/dist/capabilities/RunHooks.d.mts +82 -0
  107. package/dist/capabilities/RunHooks.mjs +144 -0
  108. package/dist/capabilities/RunHooks.mjs.map +1 -0
  109. package/dist/capabilities/SemanticMemory.d.mts +431 -0
  110. package/dist/capabilities/SemanticMemory.mjs +315 -0
  111. package/dist/capabilities/SemanticMemory.mjs.map +1 -0
  112. package/dist/capabilities/Subagent.d.mts +4 -0
  113. package/dist/capabilities/Subagent.mjs +5 -0
  114. package/dist/capabilities/SubagentReservations.d.mts +186 -0
  115. package/dist/capabilities/SubagentReservations.mjs +479 -0
  116. package/dist/capabilities/SubagentReservations.mjs.map +1 -0
  117. package/dist/capabilities/ToolDiscovery.d.mts +109 -0
  118. package/dist/capabilities/ToolDiscovery.mjs +211 -0
  119. package/dist/capabilities/ToolDiscovery.mjs.map +1 -0
  120. package/dist/capabilities/WebCapture.d.mts +163 -0
  121. package/dist/capabilities/WebCapture.mjs +335 -0
  122. package/dist/capabilities/WebCapture.mjs.map +1 -0
  123. package/dist/capabilities/WebSearch.d.mts +71 -0
  124. package/dist/capabilities/WebSearch.mjs +112 -0
  125. package/dist/capabilities/WebSearch.mjs.map +1 -0
  126. package/dist/compaction-C2OTceKw.mjs +505 -0
  127. package/dist/compaction-C2OTceKw.mjs.map +1 -0
  128. package/dist/core/Agent.d.mts +2 -0
  129. package/dist/core/Agent.mjs +2 -0
  130. package/dist/core/AgentError.d.mts +2 -0
  131. package/dist/core/AgentError.mjs +117 -0
  132. package/dist/core/AgentError.mjs.map +1 -0
  133. package/dist/core/AgentPolicy.d.mts +2 -0
  134. package/dist/core/AgentPolicy.mjs +94 -0
  135. package/dist/core/AgentPolicy.mjs.map +1 -0
  136. package/dist/core/AgentUpdates.d.mts +2 -0
  137. package/dist/core/AgentUpdates.mjs +63 -0
  138. package/dist/core/AgentUpdates.mjs.map +1 -0
  139. package/dist/core/IdGenerator.d.mts +26 -0
  140. package/dist/core/IdGenerator.mjs +27 -0
  141. package/dist/core/IdGenerator.mjs.map +1 -0
  142. package/dist/core/Identifiers.d.mts +2 -0
  143. package/dist/core/Identifiers.mjs +43 -0
  144. package/dist/core/Identifiers.mjs.map +1 -0
  145. package/dist/core/Memory.d.mts +57 -0
  146. package/dist/core/Memory.mjs +203 -0
  147. package/dist/core/Memory.mjs.map +1 -0
  148. package/dist/core/MemoryNamespace.d.mts +2 -0
  149. package/dist/core/MemoryNamespace.mjs +116 -0
  150. package/dist/core/MemoryNamespace.mjs.map +1 -0
  151. package/dist/core/MemoryReference.d.mts +2 -0
  152. package/dist/core/MemoryReference.mjs +109 -0
  153. package/dist/core/MemoryReference.mjs.map +1 -0
  154. package/dist/core/MemoryRevalidation.d.mts +65 -0
  155. package/dist/core/MemoryRevalidation.mjs +126 -0
  156. package/dist/core/MemoryRevalidation.mjs.map +1 -0
  157. package/dist/core/MemoryStore.d.mts +186 -0
  158. package/dist/core/MemoryStore.mjs +243 -0
  159. package/dist/core/MemoryStore.mjs.map +1 -0
  160. package/dist/core/Receipt.d.mts +2 -0
  161. package/dist/core/Receipt.mjs +36 -0
  162. package/dist/core/Receipt.mjs.map +1 -0
  163. package/dist/core/RememberingStore.d.mts +1562 -0
  164. package/dist/core/RememberingStore.mjs +190 -0
  165. package/dist/core/RememberingStore.mjs.map +1 -0
  166. package/dist/core/RunEvent.d.mts +2 -0
  167. package/dist/core/RunEvent.mjs +337 -0
  168. package/dist/core/RunEvent.mjs.map +1 -0
  169. package/dist/core/RunPolicyUsage.d.mts +2 -0
  170. package/dist/core/RunPolicyUsage.mjs +21 -0
  171. package/dist/core/RunPolicyUsage.mjs.map +1 -0
  172. package/dist/core/SemanticMemoryIndex.d.mts +826 -0
  173. package/dist/core/SemanticMemoryIndex.mjs +185 -0
  174. package/dist/core/SemanticMemoryIndex.mjs.map +1 -0
  175. package/dist/core/SemanticMemoryRevalidation.d.mts +45 -0
  176. package/dist/core/SemanticMemoryRevalidation.mjs +191 -0
  177. package/dist/core/SemanticMemoryRevalidation.mjs.map +1 -0
  178. package/dist/core/SubagentContract.d.mts +2 -0
  179. package/dist/core/SubagentContract.mjs +148 -0
  180. package/dist/core/SubagentContract.mjs.map +1 -0
  181. package/dist/core/Thread.d.mts +2 -0
  182. package/dist/core/Thread.mjs +250 -0
  183. package/dist/core/Thread.mjs.map +1 -0
  184. package/dist/core/ToolResult.d.mts +2 -0
  185. package/dist/core/ToolResult.mjs +140 -0
  186. package/dist/core/ToolResult.mjs.map +1 -0
  187. package/dist/core/Usage.d.mts +2 -0
  188. package/dist/core/Usage.mjs +319 -0
  189. package/dist/core/Usage.mjs.map +1 -0
  190. package/dist/core/Worker.d.mts +3 -0
  191. package/dist/core/Worker.mjs +147 -0
  192. package/dist/core/Worker.mjs.map +1 -0
  193. package/dist/durable/ActivityStore.d.mts +116 -0
  194. package/dist/durable/ActivityStore.mjs +131 -0
  195. package/dist/durable/ActivityStore.mjs.map +1 -0
  196. package/dist/durable/Admin.d.mts +2 -0
  197. package/dist/durable/Admin.mjs +328 -0
  198. package/dist/durable/Admin.mjs.map +1 -0
  199. package/dist/durable/AgentRegistration.d.mts +2 -0
  200. package/dist/durable/AgentRegistration.mjs +14 -0
  201. package/dist/durable/AgentRegistration.mjs.map +1 -0
  202. package/dist/durable/Certification.d.mts +111 -0
  203. package/dist/durable/Certification.mjs +159 -0
  204. package/dist/durable/Certification.mjs.map +1 -0
  205. package/dist/durable/CommittedActivity.d.mts +62 -0
  206. package/dist/durable/CommittedActivity.mjs +159 -0
  207. package/dist/durable/CommittedActivity.mjs.map +1 -0
  208. package/dist/durable/Digest.d.mts +2 -0
  209. package/dist/durable/Digest.mjs +50 -0
  210. package/dist/durable/Digest.mjs.map +1 -0
  211. package/dist/durable/DurableAgentRuntime.d.mts +3 -0
  212. package/dist/durable/DurableAgentRuntime.mjs +3 -0
  213. package/dist/durable/DurableFailpoint.d.mts +2 -0
  214. package/dist/durable/DurableFailpoint.mjs +94 -0
  215. package/dist/durable/DurableFailpoint.mjs.map +1 -0
  216. package/dist/durable/DurableFailpointTestControl.d.mts +15 -0
  217. package/dist/durable/DurableFailpointTestControl.mjs +19 -0
  218. package/dist/durable/DurableFailpointTestControl.mjs.map +1 -0
  219. package/dist/durable/EventSource.d.mts +2 -0
  220. package/dist/durable/EventSource.mjs +65 -0
  221. package/dist/durable/EventSource.mjs.map +1 -0
  222. package/dist/durable/GitHubWorkflowSource.d.mts +144 -0
  223. package/dist/durable/GitHubWorkflowSource.mjs +209 -0
  224. package/dist/durable/GitHubWorkflowSource.mjs.map +1 -0
  225. package/dist/durable/MessageDelivery.d.mts +492 -0
  226. package/dist/durable/MessageDelivery.mjs +495 -0
  227. package/dist/durable/MessageDelivery.mjs.map +1 -0
  228. package/dist/durable/MessageDeliveryStoreConformance.d.mts +358 -0
  229. package/dist/durable/MessageDeliveryStoreConformance.mjs +243 -0
  230. package/dist/durable/MessageDeliveryStoreConformance.mjs.map +1 -0
  231. package/dist/durable/OperationAuthorizer.d.mts +2 -0
  232. package/dist/durable/OperationAuthorizer.mjs +70 -0
  233. package/dist/durable/OperationAuthorizer.mjs.map +1 -0
  234. package/dist/durable/PersistentHistory.d.mts +16 -0
  235. package/dist/durable/PersistentHistory.mjs +125 -0
  236. package/dist/durable/PersistentHistory.mjs.map +1 -0
  237. package/dist/durable/PreparedInputAdmission.d.mts +2 -0
  238. package/dist/durable/PreparedInputAdmission.mjs +34 -0
  239. package/dist/durable/PreparedInputAdmission.mjs.map +1 -0
  240. package/dist/durable/Records.d.mts +2 -0
  241. package/dist/durable/Records.mjs +795 -0
  242. package/dist/durable/Records.mjs.map +1 -0
  243. package/dist/durable/Recovery.d.mts +2 -0
  244. package/dist/durable/Recovery.mjs +739 -0
  245. package/dist/durable/Recovery.mjs.map +1 -0
  246. package/dist/durable/RunJournal.d.mts +2 -0
  247. package/dist/durable/RunJournal.mjs +2 -0
  248. package/dist/durable/Schedule.d.mts +2 -0
  249. package/dist/durable/Schedule.mjs +382 -0
  250. package/dist/durable/Schedule.mjs.map +1 -0
  251. package/dist/durable/ScheduleStoreConformance.d.mts +18 -0
  252. package/dist/durable/ScheduleStoreConformance.mjs +420 -0
  253. package/dist/durable/ScheduleStoreConformance.mjs.map +1 -0
  254. package/dist/durable/ScheduleTransition.d.mts +24 -0
  255. package/dist/durable/ScheduleTransition.mjs +180 -0
  256. package/dist/durable/ScheduleTransition.mjs.map +1 -0
  257. package/dist/durable/Scheduling.d.mts +54 -0
  258. package/dist/durable/Scheduling.mjs +2 -0
  259. package/dist/durable/SqlMemoryStore.d.mts +30 -0
  260. package/dist/durable/SqlMemoryStore.mjs +435 -0
  261. package/dist/durable/SqlMemoryStore.mjs.map +1 -0
  262. package/dist/durable/SqlMessageDeliveryStore.d.mts +40 -0
  263. package/dist/durable/SqlMessageDeliveryStore.mjs +167 -0
  264. package/dist/durable/SqlMessageDeliveryStore.mjs.map +1 -0
  265. package/dist/durable/SqlStorageV2Upgrade.d.mts +22 -0
  266. package/dist/durable/SqlStorageV2Upgrade.mjs +459 -0
  267. package/dist/durable/SqlStorageV2Upgrade.mjs.map +1 -0
  268. package/dist/durable/SqlSubscriptionStore.d.mts +63 -0
  269. package/dist/durable/SqlSubscriptionStore.mjs +751 -0
  270. package/dist/durable/SqlSubscriptionStore.mjs.map +1 -0
  271. package/dist/durable/SubmissionLedger.d.mts +3 -0
  272. package/dist/durable/SubmissionLedger.mjs +914 -0
  273. package/dist/durable/SubmissionLedger.mjs.map +1 -0
  274. package/dist/durable/SubmissionLedgerConformance.d.mts +30 -0
  275. package/dist/durable/SubmissionLedgerConformance.mjs +1986 -0
  276. package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -0
  277. package/dist/durable/SubmissionStatus.d.mts +2 -0
  278. package/dist/durable/SubmissionStatus.mjs +18 -0
  279. package/dist/durable/SubmissionStatus.mjs.map +1 -0
  280. package/dist/durable/Subscription.d.mts +2 -0
  281. package/dist/durable/Subscription.mjs +360 -0
  282. package/dist/durable/Subscription.mjs.map +1 -0
  283. package/dist/durable/SubscriptionInput.d.mts +2 -0
  284. package/dist/durable/SubscriptionInput.mjs +52 -0
  285. package/dist/durable/SubscriptionInput.mjs.map +1 -0
  286. package/dist/durable/SubscriptionStoreConformance.d.mts +17 -0
  287. package/dist/durable/SubscriptionStoreConformance.mjs +625 -0
  288. package/dist/durable/SubscriptionStoreConformance.mjs.map +1 -0
  289. package/dist/durable/SubscriptionTools.d.mts +273 -0
  290. package/dist/durable/SubscriptionTools.mjs +190 -0
  291. package/dist/durable/SubscriptionTools.mjs.map +1 -0
  292. package/dist/durable/SubscriptionTransition.d.mts +21 -0
  293. package/dist/durable/SubscriptionTransition.mjs +148 -0
  294. package/dist/durable/SubscriptionTransition.mjs.map +1 -0
  295. package/dist/durable/Subscriptions.d.mts +73 -0
  296. package/dist/durable/Subscriptions.mjs +627 -0
  297. package/dist/durable/Subscriptions.mjs.map +1 -0
  298. package/dist/durable/ThreadContextHistory.d.mts +32 -0
  299. package/dist/durable/ThreadContextHistory.mjs +152 -0
  300. package/dist/durable/ThreadContextHistory.mjs.map +1 -0
  301. package/dist/durable/ThreadContextHistoryProjection.d.mts +60 -0
  302. package/dist/durable/ThreadContextHistoryProjection.mjs +149 -0
  303. package/dist/durable/ThreadContextHistoryProjection.mjs.map +1 -0
  304. package/dist/durable/ThreadInvariants.d.mts +74 -0
  305. package/dist/durable/ThreadInvariants.mjs +200 -0
  306. package/dist/durable/ThreadInvariants.mjs.map +1 -0
  307. package/dist/durable/ThreadProjection.d.mts +78 -0
  308. package/dist/durable/ThreadProjection.mjs +158 -0
  309. package/dist/durable/ThreadProjection.mjs.map +1 -0
  310. package/dist/durable/ThreadProjectionMaintenance.d.mts +49 -0
  311. package/dist/durable/ThreadProjectionMaintenance.mjs +33 -0
  312. package/dist/durable/ThreadProjectionMaintenance.mjs.map +1 -0
  313. package/dist/durable/ThreadStore.d.mts +2 -0
  314. package/dist/durable/ThreadStore.mjs +147 -0
  315. package/dist/durable/ThreadStore.mjs.map +1 -0
  316. package/dist/durable/ThreadStoreConformance.d.mts +29 -0
  317. package/dist/durable/ThreadStoreConformance.mjs +248 -0
  318. package/dist/durable/ThreadStoreConformance.mjs.map +1 -0
  319. package/dist/durable/ToolReconciler.d.mts +2 -0
  320. package/dist/durable/ToolReconciler.mjs +81 -0
  321. package/dist/durable/ToolReconciler.mjs.map +1 -0
  322. package/dist/durable/WakeScheduler.d.mts +2 -0
  323. package/dist/durable/WakeScheduler.mjs +85 -0
  324. package/dist/durable/WakeScheduler.mjs.map +1 -0
  325. package/dist/durable/WorkerHost.d.mts +129 -0
  326. package/dist/durable/WorkerHost.mjs +77 -0
  327. package/dist/durable/WorkerHost.mjs.map +1 -0
  328. package/dist/engine/AgentRuntime.d.mts +2 -0
  329. package/dist/engine/AgentRuntime.mjs +2 -0
  330. package/dist/engine/Compaction.d.mts +7 -0
  331. package/dist/engine/Compaction.mjs +16 -0
  332. package/dist/engine/Compaction.mjs.map +1 -0
  333. package/dist/engine/ContextCompactor.d.mts +2 -0
  334. package/dist/engine/ContextCompactor.mjs +119 -0
  335. package/dist/engine/ContextCompactor.mjs.map +1 -0
  336. package/dist/engine/ContextHistory.d.mts +65 -0
  337. package/dist/engine/ContextHistory.mjs +76 -0
  338. package/dist/engine/ContextHistory.mjs.map +1 -0
  339. package/dist/engine/ContextWindow.d.mts +2 -0
  340. package/dist/engine/ContextWindow.mjs +59 -0
  341. package/dist/engine/ContextWindow.mjs.map +1 -0
  342. package/dist/engine/DurableStep.d.mts +2 -0
  343. package/dist/engine/DurableStep.mjs +62 -0
  344. package/dist/engine/DurableStep.mjs.map +1 -0
  345. package/dist/engine/MessagingHost.d.mts +2 -0
  346. package/dist/engine/MessagingHost.mjs +2 -0
  347. package/dist/engine/Output.d.mts +2 -0
  348. package/dist/engine/Output.mjs +8 -0
  349. package/dist/engine/Output.mjs.map +1 -0
  350. package/dist/engine/RunEventSink.d.mts +2 -0
  351. package/dist/engine/RunEventSink.mjs +22 -0
  352. package/dist/engine/RunEventSink.mjs.map +1 -0
  353. package/dist/engine/RunOptions.d.mts +2 -0
  354. package/dist/engine/RunOptions.mjs +122 -0
  355. package/dist/engine/RunOptions.mjs.map +1 -0
  356. package/dist/engine/SubagentHost.d.mts +2 -0
  357. package/dist/engine/SubagentHost.mjs +72 -0
  358. package/dist/engine/SubagentHost.mjs.map +1 -0
  359. package/dist/engine/ThreadHistory.d.mts +2 -0
  360. package/dist/engine/ThreadHistory.mjs +67 -0
  361. package/dist/engine/ThreadHistory.mjs.map +1 -0
  362. package/dist/engine/ToolBroker.d.mts +2 -0
  363. package/dist/engine/ToolBroker.mjs +42 -0
  364. package/dist/engine/ToolBroker.mjs.map +1 -0
  365. package/dist/foreign-diagnostic-DBQ1XHKh.mjs +37 -0
  366. package/dist/foreign-diagnostic-DBQ1XHKh.mjs.map +1 -0
  367. package/dist/index.d.mts +89 -6
  368. package/dist/index.mjs +98 -6
  369. package/dist/output-contract-BC7tjlGw.mjs +84 -0
  370. package/dist/output-contract-BC7tjlGw.mjs.map +1 -0
  371. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  372. package/dist/sandbox/CodeExecutor.d.mts +194 -0
  373. package/dist/sandbox/CodeExecutor.mjs +278 -0
  374. package/dist/sandbox/CodeExecutor.mjs.map +1 -0
  375. package/dist/sandbox/InteractiveBrowser.d.mts +142 -0
  376. package/dist/sandbox/InteractiveBrowser.mjs +165 -0
  377. package/dist/sandbox/InteractiveBrowser.mjs.map +1 -0
  378. package/dist/sandbox/PageCapture.d.mts +2 -0
  379. package/dist/sandbox/PageCapture.mjs +450 -0
  380. package/dist/sandbox/PageCapture.mjs.map +1 -0
  381. package/dist/sandbox/PageCrawl.d.mts +88 -0
  382. package/dist/sandbox/PageCrawl.mjs +124 -0
  383. package/dist/sandbox/PageCrawl.mjs.map +1 -0
  384. package/dist/sandbox/PageScreenshot.d.mts +2 -0
  385. package/dist/sandbox/PageScreenshot.mjs +53 -0
  386. package/dist/sandbox/PageScreenshot.mjs.map +1 -0
  387. package/dist/sandbox/ProtectedBrowser.d.mts +273 -0
  388. package/dist/sandbox/ProtectedBrowser.mjs +287 -0
  389. package/dist/sandbox/ProtectedBrowser.mjs.map +1 -0
  390. package/dist/sandbox/Sandbox.d.mts +2 -0
  391. package/dist/sandbox/Sandbox.mjs +208 -0
  392. package/dist/sandbox/Sandbox.mjs.map +1 -0
  393. package/dist/utf8-BYfhEkcj.mjs +11 -0
  394. package/dist/utf8-BYfhEkcj.mjs.map +1 -0
  395. package/dist/utf8-DchGZRBd.mjs +23 -0
  396. package/dist/utf8-DchGZRBd.mjs.map +1 -0
  397. package/package.json +1 -40
  398. package/src/Ephemeral.ts +17 -0
  399. package/src/ToolExposure.ts +2 -0
  400. package/src/capabilities/Approval.ts +352 -0
  401. package/src/capabilities/Budget.ts +536 -0
  402. package/src/capabilities/CodeMode.ts +1090 -0
  403. package/src/capabilities/Commands.ts +86 -0
  404. package/src/capabilities/ContextTools.ts +184 -0
  405. package/src/capabilities/Mcp.ts +427 -0
  406. package/src/capabilities/McpClient.ts +967 -0
  407. package/src/capabilities/MemoryNotes.ts +174 -0
  408. package/src/capabilities/Messaging.ts +261 -0
  409. package/src/capabilities/ModelContext.ts +354 -0
  410. package/src/capabilities/Redaction.ts +157 -0
  411. package/src/capabilities/Remembering.ts +550 -0
  412. package/src/capabilities/RunHooks.ts +280 -0
  413. package/src/capabilities/SemanticMemory.ts +447 -0
  414. package/src/capabilities/Subagent.ts +2277 -0
  415. package/src/capabilities/SubagentReservations.ts +850 -0
  416. package/src/capabilities/ToolDiscovery.ts +339 -0
  417. package/src/capabilities/WebCapture.ts +722 -0
  418. package/src/capabilities/WebSearch.ts +184 -0
  419. package/src/capabilities/internal/subagent-background.ts +1106 -0
  420. package/src/capabilities/internal/subagent-contract.ts +142 -0
  421. package/src/capabilities/internal/subagent-policy.ts +235 -0
  422. package/src/capabilities/internal/subagent-reporting.ts +261 -0
  423. package/src/capabilities/internal/utf8.ts +10 -0
  424. package/src/core/Agent.ts +575 -0
  425. package/src/core/AgentError.ts +152 -0
  426. package/src/core/AgentPolicy.ts +153 -0
  427. package/src/core/AgentUpdates.ts +100 -0
  428. package/src/core/IdGenerator.ts +39 -0
  429. package/src/core/Identifiers.ts +48 -0
  430. package/src/core/Memory.ts +290 -0
  431. package/src/core/MemoryNamespace.ts +196 -0
  432. package/src/core/MemoryReference.ts +121 -0
  433. package/src/core/MemoryRevalidation.ts +185 -0
  434. package/src/core/MemoryStore.ts +368 -0
  435. package/src/core/Messaging.ts +90 -0
  436. package/src/core/Receipt.ts +42 -0
  437. package/src/core/RememberingStore.ts +300 -0
  438. package/src/core/RunEvent.ts +366 -0
  439. package/src/core/RunPolicyUsage.ts +17 -0
  440. package/src/core/SemanticMemoryIndex.ts +250 -0
  441. package/src/core/SemanticMemoryRevalidation.ts +254 -0
  442. package/src/core/SubagentContract.ts +196 -0
  443. package/src/core/Thread.ts +371 -0
  444. package/src/core/ToolExposure.ts +74 -0
  445. package/src/core/ToolResult.ts +170 -0
  446. package/src/core/Usage.ts +529 -0
  447. package/src/core/Worker.ts +173 -0
  448. package/src/core/internal/agent-updates.ts +32 -0
  449. package/src/core/internal/utf8.ts +23 -0
  450. package/src/durable/ActivityStore.ts +160 -0
  451. package/src/durable/Admin.ts +496 -0
  452. package/src/durable/AgentRegistration.ts +13 -0
  453. package/src/durable/Certification.ts +210 -0
  454. package/src/durable/CommittedActivity.ts +296 -0
  455. package/src/durable/Digest.ts +93 -0
  456. package/src/durable/DurableAgentRuntime.ts +10340 -0
  457. package/src/durable/DurableFailpoint.ts +103 -0
  458. package/src/durable/DurableFailpointTestControl.ts +39 -0
  459. package/src/durable/EventSource.ts +172 -0
  460. package/src/durable/GitHubWorkflowSource.ts +453 -0
  461. package/src/durable/MessageDelivery.ts +708 -0
  462. package/src/durable/MessageDeliveryStoreConformance.ts +363 -0
  463. package/src/durable/OperationAuthorizer.ts +85 -0
  464. package/src/durable/PersistentHistory.ts +260 -0
  465. package/src/durable/PreparedInputAdmission.ts +44 -0
  466. package/src/durable/Records.ts +1010 -0
  467. package/src/durable/Recovery.ts +1018 -0
  468. package/src/durable/RunJournal.ts +1479 -0
  469. package/src/durable/Schedule.ts +504 -0
  470. package/src/durable/ScheduleStoreConformance.ts +638 -0
  471. package/src/durable/ScheduleTransition.ts +265 -0
  472. package/src/durable/Scheduling.ts +1077 -0
  473. package/src/durable/SqlMemoryStore.ts +774 -0
  474. package/src/durable/SqlMessageDeliveryStore.ts +302 -0
  475. package/src/durable/SqlStorageV2Upgrade.ts +500 -0
  476. package/src/durable/SqlSubscriptionStore.ts +1440 -0
  477. package/src/durable/SubmissionLedger.ts +1201 -0
  478. package/src/durable/SubmissionLedgerConformance.ts +4579 -0
  479. package/src/durable/SubmissionStatus.ts +14 -0
  480. package/src/durable/Subscription.ts +544 -0
  481. package/src/durable/SubscriptionInput.ts +144 -0
  482. package/src/durable/SubscriptionStoreConformance.ts +945 -0
  483. package/src/durable/SubscriptionTools.ts +327 -0
  484. package/src/durable/SubscriptionTransition.ts +302 -0
  485. package/src/durable/Subscriptions.ts +1210 -0
  486. package/src/durable/ThreadContextHistory.ts +227 -0
  487. package/src/durable/ThreadContextHistoryProjection.ts +216 -0
  488. package/src/durable/ThreadInvariants.ts +442 -0
  489. package/src/durable/ThreadProjection.ts +269 -0
  490. package/src/durable/ThreadProjectionMaintenance.ts +67 -0
  491. package/src/durable/ThreadStore.ts +242 -0
  492. package/src/durable/ThreadStoreConformance.ts +710 -0
  493. package/src/durable/ToolReconciler.ts +105 -0
  494. package/src/durable/WakeScheduler.ts +134 -0
  495. package/src/durable/WorkerHost.ts +171 -0
  496. package/src/durable/internal/agent-registration.ts +525 -0
  497. package/src/durable/internal/agent-updates.ts +302 -0
  498. package/src/durable/internal/foreign-diagnostic.ts +47 -0
  499. package/src/durable/internal/journal-checkpoint.ts +104 -0
  500. package/src/durable/internal/journal-metadata.ts +107 -0
  501. package/src/durable/internal/messaging-host.ts +608 -0
  502. package/src/durable/internal/schedule-time.ts +303 -0
  503. package/src/durable/internal/storage-v2-layout.ts +163 -0
  504. package/src/durable/internal/storage-v2.ts +73 -0
  505. package/src/durable/internal/worker-host.ts +2467 -0
  506. package/src/durable/internal/worker-runtime.ts +9 -0
  507. package/src/engine/AgentRuntime.ts +37 -0
  508. package/src/engine/Compaction.ts +11 -0
  509. package/src/engine/ContextCompactor.ts +277 -0
  510. package/src/engine/ContextHistory.ts +73 -0
  511. package/src/engine/ContextWindow.ts +72 -0
  512. package/src/engine/DurableStep.ts +132 -0
  513. package/src/engine/MessagingHost.ts +110 -0
  514. package/src/engine/Output.ts +2 -0
  515. package/src/engine/RunEventSink.ts +132 -0
  516. package/src/engine/RunOptions.ts +1077 -0
  517. package/src/engine/SubagentHost.ts +181 -0
  518. package/src/engine/ThreadHistory.ts +120 -0
  519. package/src/engine/ToolBroker.ts +157 -0
  520. package/src/engine/ToolExposure.ts +48 -0
  521. package/src/engine/internal/agent-runtime.ts +10162 -0
  522. package/src/engine/internal/bounded-value.ts +315 -0
  523. package/src/engine/internal/compaction.ts +678 -0
  524. package/src/engine/internal/error-diagnostic.ts +39 -0
  525. package/src/engine/internal/output-contract.ts +173 -0
  526. package/src/engine/internal/primitive-delta.ts +80 -0
  527. package/src/engine/internal/provider-result-staging.ts +211 -0
  528. package/src/engine/internal/tool-derivative.ts +106 -0
  529. package/src/engine/internal/tool-exposure.ts +224 -0
  530. package/src/engine/internal/tool-telemetry.ts +484 -0
  531. package/src/index.ts +97 -22
  532. package/src/sandbox/CodeExecutor.ts +352 -0
  533. package/src/sandbox/InteractiveBrowser.ts +257 -0
  534. package/src/sandbox/PageCapture.ts +692 -0
  535. package/src/sandbox/PageCrawl.ts +148 -0
  536. package/src/sandbox/PageScreenshot.ts +81 -0
  537. package/src/sandbox/ProtectedBrowser.ts +436 -0
  538. package/src/sandbox/Sandbox.ts +241 -0
@@ -0,0 +1,226 @@
1
+ import { t as AgentId } from "./Identifiers-CN2s30fF.mjs";
2
+ import { i as UpdateError, n as Emitter } from "./AgentUpdates-DMJ-_xow.mjs";
3
+ import { r as Configuration } from "./ToolExposure-r2eOWk4F.mjs";
4
+ import { a as AgentInputError, l as AgentRunDispositionError, s as AgentOutputError } from "./AgentError-CggcAQ7V.mjs";
5
+ import { n as AgentPolicyInput, t as AgentPolicy } from "./AgentPolicy-CetmQrf3.mjs";
6
+ import { AiError, LanguageModel, Model, Prompt, Tool, Toolkit } from "effect/unstable/ai";
7
+ import { Effect, Layer, Option, Schema } from "effect";
8
+ //#region src/core/internal/agent-updates.d.ts
9
+ /** Definition-owned native Tool. Runtime supplies its handler under the same identity. */
10
+ declare const updateTool: <S extends Schema.Top>(schema: S) => Tool.Tool<"emit_update", {
11
+ readonly parameters: Schema.Struct<{
12
+ readonly value: S;
13
+ }>;
14
+ readonly success: Schema.Void;
15
+ readonly failure: typeof UpdateError;
16
+ readonly failureMode: "return";
17
+ }, Emitter>;
18
+ type UpdateToolkit<T extends Toolkit.Any, S extends Schema.Top | undefined> = S extends Schema.Top ? Toolkit.Toolkit<T["tools"] & {
19
+ readonly emit_update: ReturnType<typeof updateTool<S>>;
20
+ }> : T;
21
+ declare namespace Agent_d_exports {
22
+ export { Any, AnyDefinition, Binding, CompletionFromToolDeclaration, CompletionProjectionInput, CompletionToolDeclaration, Definition, DefinitionOptions, DefinitionRequirements, EncodedInput, Failure, Input, InputPromptSource, InputSchema, InstructionResult, InstructionSource, ModelServices, Name, NativeModel, Output, OutputSchema, Requirements, RunDisposition, RunDispositionDeclaration, RunDispositionFailure, RunDispositionSchema, ToolInspection, ToolUnion, Tools, Update, UpdatesSchema, inspectTools, make, withModel };
23
+ }
24
+ /** Prompt input produced directly or by an Effect that preserves its failure and requirements. */
25
+ type InstructionResult<E = never, R = never> = Prompt.RawInput | Effect.Effect<Prompt.RawInput, E, R>;
26
+ /** Static prompt input or an input-dependent source evaluated once while preparing a run. */
27
+ type InstructionSource<Input, E = never, R = never> = Prompt.RawInput | ((input: Input) => InstructionResult<E, R>);
28
+ /** Definition-owned projection from decoded Agent input to model-visible prompt content. */
29
+ type InputPromptSource<Input, E = never, R = never> = (input: Input) => InstructionResult<E, R>;
30
+ /** Native services needed to execute and identify model calls. */
31
+ type ModelServices = LanguageModel.LanguageModel | Model.ProviderName | Model.ModelName;
32
+ /** Accepts Layers providing the native model and both identity services. */
33
+ type NativeModel<ModelValue> = ModelValue extends Layer.Layer<infer Provides, never, infer _Requires> ? ModelServices extends Provides ? ModelValue : never : never;
34
+ /** Definition-owned boundary for selecting and validating an application run disposition. */
35
+ interface RunDispositionDeclaration<Output, DispositionSchema extends Schema.Top> {
36
+ /** Canonical Schema used to validate and encode the selected disposition. */
37
+ readonly schema: DispositionSchema;
38
+ /** Pure selection from decoded output; `undefined` means this ordinary Run declares none. */
39
+ readonly fromOutput: (output: Output) => unknown;
40
+ }
41
+ /** Values available to a Definition-owned completion Tool projector after canonical decoding. */
42
+ interface CompletionProjectionInput<Parameters = unknown, Result = unknown> {
43
+ readonly parameters: Parameters;
44
+ readonly result: Result;
45
+ }
46
+ /**
47
+ * One application Tool whose successful result can complete its owning Agent when it is the
48
+ * only application call. Provider-executed calls may accompany it only with terminal results.
49
+ * Mixed, wholly unexecuted application batches are rejected with failed Tool results so the
50
+ * model can correct them within ordinary Run budgets; completed provider results are retained.
51
+ * Missing provider results and invalid pending resumed batches fail closed. The completion
52
+ * designation never permits side-effect replay.
53
+ */
54
+ interface CompletionToolDeclaration<Parameters = unknown, Result = unknown, Output = unknown> {
55
+ readonly tool: string;
56
+ /** Require native Tool use on every model Turn and this Tool for final completion. */
57
+ readonly required?: boolean | undefined;
58
+ readonly project: (input: CompletionProjectionInput<Parameters, Result>) => Output;
59
+ }
60
+ type CompletionToolFor<ToolkitValue extends Toolkit.Any, Output> = { readonly [Name in keyof ToolkitValue["tools"] & string]: CompletionToolDeclaration<Tool.Parameters<ToolkitValue["tools"][Name]>, Tool.Success<ToolkitValue["tools"][Name]>, Output> & {
61
+ readonly tool: Name;
62
+ }; }[keyof ToolkitValue["tools"] & string];
63
+ /**
64
+ * An ordinary action Tool whose canonical success may satisfy the whole request.
65
+ * Projectors must be pure and deterministic: recovery re-evaluates them. None preserves
66
+ * ordinary continuation; Some is validated as the Agent output. These Tools must be the sole
67
+ * application call; terminal provider results may accompany them. They never receive the
68
+ * required completion Tool's exhaustion allowance.
69
+ */
70
+ interface CompletionFromToolDeclaration<Parameters = unknown, Result = unknown, Output = unknown> {
71
+ readonly tool: string;
72
+ readonly project: (input: CompletionProjectionInput<Parameters, Result>) => Option.Option<Output>;
73
+ }
74
+ type CompletionFromToolFor<ToolkitValue extends Toolkit.Any, Output> = { readonly [Name in keyof ToolkitValue["tools"] & string]: CompletionFromToolDeclaration<Tool.Parameters<ToolkitValue["tools"][Name]>, Tool.Success<ToolkitValue["tools"][Name]>, Output> & {
75
+ readonly tool: Name;
76
+ }; }[keyof ToolkitValue["tools"] & string];
77
+ /** Immutable, model-agnostic schemas, behavior, tools, and bounds for an agent. */
78
+ interface Definition<InputSchema extends Schema.Top, OutputSchema extends Schema.Top, Instructions, ToolkitValue extends Toolkit.Any, RunDispositionValue = undefined, InputPromptValue = undefined, UpdatesSchema extends Schema.Top | undefined = undefined> {
79
+ /** Stable agent identity; changing it creates a distinct definition identity. */
80
+ readonly id: AgentId;
81
+ /** Canonical Schema for intermediate updates emitted by this Agent. */
82
+ readonly updates?: UpdatesSchema;
83
+ /** Canonical schema used to decode and encode run input. */
84
+ readonly input: InputSchema;
85
+ /** Canonical schema used to decode the final model output. */
86
+ readonly output: OutputSchema;
87
+ /** Instructions evaluated once while preparing each run. */
88
+ readonly instructions: Instructions;
89
+ /** Optional projection from decoded input to model-visible native Effect AI prompt content. */
90
+ readonly inputPrompt?: InputPromptValue | undefined;
91
+ /** Native Effect AI toolkit whose failures and requirements remain visible. */
92
+ readonly toolkit: ToolkitValue;
93
+ readonly toolExposure?: Configuration | undefined;
94
+ /** Finite execution bounds enforced by the runtime. */
95
+ readonly policy: AgentPolicy;
96
+ /** Explicit policy fields, retained so delegated runs can inherit omitted fields. */
97
+ readonly policyOverrides?: Partial<AgentPolicyInput> | undefined;
98
+ /** Optional successful Tool result that projects directly to the Agent output and settles. */
99
+ readonly completion?: CompletionToolDeclaration | undefined;
100
+ readonly completionFromTools?: ReadonlyArray<CompletionFromToolDeclaration> | undefined;
101
+ readonly runDisposition?: RunDispositionValue | undefined;
102
+ readonly description?: string | undefined;
103
+ readonly metadata?: Readonly<Record<string, string>> | undefined;
104
+ }
105
+ /** Options for a model-agnostic agent definition. */
106
+ interface DefinitionOptions<InputSchema extends Schema.Top, OutputSchema extends Schema.Top, Instructions extends InstructionSource<InputSchema["Type"], unknown, unknown>, ToolkitValue extends Toolkit.Any, RunDispositionValue extends RunDispositionDeclaration<OutputSchema["Type"], Schema.Top> | undefined = undefined, InputPromptValue extends InputPromptSource<InputSchema["Type"], unknown, unknown> | undefined = undefined, UpdatesSchema extends Schema.Top | undefined = undefined> {
107
+ readonly updates?: UpdatesSchema;
108
+ readonly input: InputSchema;
109
+ readonly output: OutputSchema;
110
+ readonly instructions: Instructions;
111
+ readonly inputPrompt?: InputPromptValue | undefined;
112
+ readonly toolkit: ToolkitValue;
113
+ readonly toolExposure?: Configuration | undefined;
114
+ readonly policy?: Partial<AgentPolicyInput> | undefined;
115
+ readonly completion?: CompletionToolFor<ToolkitValue, OutputSchema["Type"]> | undefined;
116
+ readonly completionFromTools?: ReadonlyArray<CompletionFromToolFor<ToolkitValue, OutputSchema["Type"]>> | undefined;
117
+ readonly runDisposition?: RunDispositionValue | undefined;
118
+ readonly description?: string | undefined;
119
+ readonly metadata?: Readonly<Record<string, string>> | undefined;
120
+ }
121
+ type AnyDefinitionShape = Definition<Schema.Top, Schema.Top, unknown, Toolkit.Any, RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined>;
122
+ /** Immutable pairing of an agent definition with its native model Layer. */
123
+ interface Binding<DefinitionValue extends AnyDefinitionShape, ModelValue> {
124
+ readonly definition: DefinitionValue;
125
+ readonly model: NativeModel<ModelValue>;
126
+ }
127
+ type InstructionEffect<Instructions, Input> = Instructions extends ((input: Input) => infer Result) ? Result : Instructions;
128
+ type InputPromptEffect<InputPrompt, Input> = InputPrompt extends ((input: Input) => infer Result) ? Result : never;
129
+ type EffectError<Value> = Value extends Effect.Effect<infer _Success, infer Error, infer _Services> ? Error : never;
130
+ type EffectServices<Value> = Value extends Effect.Effect<infer _Success, infer _Error, infer Services> ? Services : never;
131
+ type ModelRequirements<Value> = Value extends Layer.Layer<infer _Provides, infer _Error, infer Services> ? Services : never;
132
+ /** Constructors and type projections for definitions and runnable model bindings. */
133
+ /** Type-erased definition used at generic framework boundaries. */
134
+ type AnyDefinition = AnyDefinitionShape;
135
+ /** Read-only interpreter program or binding used at inspection and projection boundaries. */
136
+ interface Any {
137
+ readonly definition: AnyDefinition;
138
+ readonly model?: unknown;
139
+ }
140
+ /** Native Tool configuration for inspection; it does not predict an invocation's outcome. */
141
+ declare const ToolInspection: Schema.Struct<{
142
+ readonly name: Schema.String;
143
+ readonly failureMode: Schema.Literals<readonly ["error", "return"]>;
144
+ /** False for provider-executed Tools, whose results do not pass through local handlers. */
145
+ readonly requiresHandler: Schema.Boolean;
146
+ }>;
147
+ type ToolInspection = typeof ToolInspection.Type;
148
+ /**
149
+ * Inspect registered native Tools in declaration order without acquiring handlers or a Model.
150
+ * This is the full Definition toolkit, before run-specific visibility or exposure filtering.
151
+ * `failureMode` is Effect AI's configured mode, including its `"error"` default. Handler-level
152
+ * recovery, programmatic invocation and Subagent containment can change where failures go;
153
+ * consult execution diagnostics for the actual route. No arguments, results or services are read.
154
+ */
155
+ declare const inspectTools: (agent: AnyDefinition | Any) => ReadonlyArray<ToolInspection>;
156
+ type DefinitionOf<AgentValue extends AnyDefinition | Any> = AgentValue extends {
157
+ readonly definition: infer DefinitionValue extends AnyDefinition;
158
+ } ? DefinitionValue : AgentValue;
159
+ type RunDispositionSchemaOf<DefinitionValue extends AnyDefinition> = [Exclude<DefinitionValue["runDisposition"], undefined>] extends [never] ? never : Exclude<DefinitionValue["runDisposition"], undefined> extends RunDispositionDeclaration<never, infer DispositionSchema> ? DispositionSchema : never;
160
+ /** Literal Agent ID, retained by Agent.make. */
161
+ type Name<A extends AnyDefinition | Any> = DefinitionOf<A>["id"] extends AgentId & (infer N extends string) ? N : string;
162
+ /** Declared update Schema, or never for Agents without updates. */
163
+ type UpdatesSchema<A extends AnyDefinition | Any> = Exclude<DefinitionOf<A>["updates"], undefined>;
164
+ /** Decoded intermediate update value. */
165
+ type Update<A extends AnyDefinition | Any> = UpdatesSchema<A>["Type"];
166
+ /** Decoded input type of a definition or binding. */
167
+ type Input<AgentValue extends AnyDefinition | Any> = DefinitionOf<AgentValue>["input"]["Type"];
168
+ /** Encoded input accepted by the primary execution operations. */
169
+ type EncodedInput<AgentValue extends AnyDefinition | Any> = DefinitionOf<AgentValue>["input"]["Encoded"];
170
+ /** Decoded output type of a definition or binding. */
171
+ type Output<AgentValue extends AnyDefinition | Any> = DefinitionOf<AgentValue>["output"]["Type"];
172
+ /** Input Schema carried by a definition or binding. */
173
+ type InputSchema<AgentValue extends AnyDefinition | Any> = DefinitionOf<AgentValue>["input"];
174
+ /** Output Schema carried by a definition or binding. */
175
+ type OutputSchema<AgentValue extends AnyDefinition | Any> = DefinitionOf<AgentValue>["output"];
176
+ /** Application run-disposition Schema carried by a definition or binding, or `never`. */
177
+ type RunDispositionSchema<AgentValue extends AnyDefinition | Any> = RunDispositionSchemaOf<DefinitionOf<AgentValue>>;
178
+ /** Decoded application run disposition declared by a definition or binding. */
179
+ type RunDisposition<AgentValue extends AnyDefinition | Any> = [RunDispositionSchema<AgentValue>] extends [never] ? never : RunDispositionSchema<AgentValue>["Type"];
180
+ /** Validation failure admitted only by definitions that declare a run disposition. */
181
+ type RunDispositionFailure<AgentValue extends AnyDefinition | Any> = [RunDispositionSchemaOf<DefinitionOf<AgentValue>>] extends [never] ? never : AgentRunDispositionError;
182
+ /** Effect AI tool map carried by a definition or binding. */
183
+ type Tools<AgentValue extends AnyDefinition | Any> = Toolkit.Tools<DefinitionOf<AgentValue>["toolkit"]>;
184
+ type ApplicationTools<A extends AnyDefinition> = [UpdatesSchema<A>] extends [never] ? Tools<A> : Omit<Tools<A>, "emit_update">;
185
+ type ToolMapValues<ToolMap extends Record<string, Tool.Any>> = ToolMap extends unknown ? ToolMap[keyof ToolMap] : never;
186
+ /** All possible tools, including keys present in only one definition or binding branch. */
187
+ type ToolUnion<AgentValue extends AnyDefinition | Any> = ToolMapValues<Tools<AgentValue>>;
188
+ /** Instruction, tool-handler, and Schema services required before a Model is bound. */
189
+ type DefinitionRequirements<DefinitionValue extends AnyDefinition> = DefinitionValue extends unknown ? EffectServices<InstructionEffect<DefinitionValue["instructions"], Input<DefinitionValue>>> | EffectServices<InputPromptEffect<DefinitionValue["inputPrompt"], Input<DefinitionValue>>> | Tool.HandlersFor<ApplicationTools<DefinitionValue>> | Tool.HandlerServices<ToolMapValues<ApplicationTools<DefinitionValue>>> | Tool.ParametersSchema<ToolUnion<DefinitionValue>>["EncodingServices"] | Tool.SuccessSchema<ToolUnion<DefinitionValue>>["DecodingServices"] | DefinitionValue["input"]["DecodingServices"] | DefinitionValue["input"]["EncodingServices"] | DefinitionValue["output"]["DecodingServices"] | DefinitionValue["output"]["EncodingServices"] | UpdatesSchema<DefinitionValue>["DecodingServices"] | UpdatesSchema<DefinitionValue>["EncodingServices"] | RunDispositionSchemaOf<DefinitionValue>["DecodingServices"] | RunDispositionSchemaOf<DefinitionValue>["EncodingServices"] : never;
190
+ /** Definition services plus native model services, or a binding's model Layer requirements. */
191
+ type Requirements<AgentValue extends AnyDefinition | Any> = DefinitionRequirements<DefinitionOf<AgentValue>> | (AgentValue extends {
192
+ readonly model: infer ModelValue;
193
+ } ? ModelRequirements<ModelValue> : ModelServices);
194
+ type DefinitionFailure<DefinitionValue extends AnyDefinition> = DefinitionValue extends unknown ? EffectError<InstructionEffect<DefinitionValue["instructions"], Input<DefinitionValue>>> | EffectError<InputPromptEffect<DefinitionValue["inputPrompt"], Input<DefinitionValue>>> | Tool.HandlerError<ToolUnion<DefinitionValue>> : never;
195
+ /** Failures from every possible definition, preserving each branch's instruction input type. */
196
+ type Failure<AgentValue extends AnyDefinition | Any> = DefinitionFailure<DefinitionOf<AgentValue>> | AiError.AiError | AgentInputError | AgentOutputError | RunDispositionFailure<AgentValue>;
197
+ /** Validate an agent ID and return a shallowly frozen, model-agnostic definition. */
198
+ declare function make<const Name extends string, InputSchema extends Schema.Top, OutputSchema extends Schema.Top, Instructions extends InstructionSource<InputSchema["Type"], unknown, unknown>, ToolkitValue extends Toolkit.Any, DispositionSchema extends Schema.Top, InputPromptValue extends InputPromptSource<InputSchema["Type"], unknown, unknown> | undefined, UpdatesSchema extends Schema.Top | undefined = undefined>(id: Name, options: DefinitionOptions<InputSchema, OutputSchema, Instructions, ToolkitValue, RunDispositionDeclaration<OutputSchema["Type"], DispositionSchema>, InputPromptValue, UpdatesSchema> & {
199
+ readonly runDisposition: RunDispositionDeclaration<OutputSchema["Type"], DispositionSchema>;
200
+ readonly inputPrompt: InputPromptValue;
201
+ }): Definition<InputSchema, OutputSchema, Instructions, UpdateToolkit<ToolkitValue, NoInfer<UpdatesSchema>>, RunDispositionDeclaration<OutputSchema["Type"], DispositionSchema>, InputPromptValue, NoInfer<UpdatesSchema>> & {
202
+ readonly id: AgentId & Name;
203
+ };
204
+ declare function make<const Name extends string, InputSchema extends Schema.Top, OutputSchema extends Schema.Top, Instructions extends InstructionSource<InputSchema["Type"], unknown, unknown>, ToolkitValue extends Toolkit.Any, DispositionSchema extends Schema.Top, UpdatesSchema extends Schema.Top | undefined = undefined>(id: Name, options: DefinitionOptions<InputSchema, OutputSchema, Instructions, ToolkitValue, RunDispositionDeclaration<OutputSchema["Type"], DispositionSchema>, undefined, UpdatesSchema> & {
205
+ readonly runDisposition: RunDispositionDeclaration<OutputSchema["Type"], DispositionSchema>;
206
+ readonly inputPrompt?: undefined;
207
+ }): Definition<InputSchema, OutputSchema, Instructions, UpdateToolkit<ToolkitValue, NoInfer<UpdatesSchema>>, RunDispositionDeclaration<OutputSchema["Type"], DispositionSchema>, undefined, NoInfer<UpdatesSchema>> & {
208
+ readonly id: AgentId & Name;
209
+ };
210
+ declare function make<const Name extends string, InputSchema extends Schema.Top, OutputSchema extends Schema.Top, Instructions extends InstructionSource<InputSchema["Type"], unknown, unknown>, ToolkitValue extends Toolkit.Any, InputPromptValue extends InputPromptSource<InputSchema["Type"], unknown, unknown> | undefined, UpdatesSchema extends Schema.Top | undefined = undefined>(id: Name, options: DefinitionOptions<InputSchema, OutputSchema, Instructions, ToolkitValue, undefined, InputPromptValue, UpdatesSchema> & {
211
+ readonly inputPrompt: InputPromptValue;
212
+ readonly runDisposition?: undefined;
213
+ }): Definition<InputSchema, OutputSchema, Instructions, UpdateToolkit<ToolkitValue, NoInfer<UpdatesSchema>>, undefined, InputPromptValue, NoInfer<UpdatesSchema>> & {
214
+ readonly id: AgentId & Name;
215
+ };
216
+ declare function make<const Name extends string, InputSchema extends Schema.Top, OutputSchema extends Schema.Top, Instructions extends InstructionSource<InputSchema["Type"], unknown, unknown>, ToolkitValue extends Toolkit.Any, UpdatesSchema extends Schema.Top | undefined = undefined>(id: Name, options: DefinitionOptions<InputSchema, OutputSchema, Instructions, ToolkitValue, undefined, undefined, UpdatesSchema> & {
217
+ readonly inputPrompt?: undefined;
218
+ readonly runDisposition?: undefined;
219
+ }): Definition<InputSchema, OutputSchema, Instructions, UpdateToolkit<ToolkitValue, NoInfer<UpdatesSchema>>, undefined, undefined, NoInfer<UpdatesSchema>> & {
220
+ readonly id: AgentId & Name;
221
+ };
222
+ /** Fix a model Layer for registration or delegation without acquiring or hiding its requirements. */
223
+ declare const withModel: <DefinitionValue extends AnyDefinition, ModelValue>(definition: DefinitionValue, model: NativeModel<ModelValue>) => Binding<DefinitionValue, ModelValue>;
224
+ //#endregion
225
+ export { Tools as A, Requirements as C, RunDispositionSchema as D, RunDispositionFailure as E, withModel as F, UpdatesSchema as M, inspectTools as N, ToolInspection as O, make as P, OutputSchema as S, RunDispositionDeclaration as T, InstructionSource as _, CompletionFromToolDeclaration as a, NativeModel as b, Definition as c, EncodedInput as d, Failure as f, InstructionResult as g, InputSchema as h, Binding as i, Update as j, ToolUnion as k, DefinitionOptions as l, InputPromptSource as m, Any as n, CompletionProjectionInput as o, Input as p, AnyDefinition as r, CompletionToolDeclaration as s, Agent_d_exports as t, DefinitionRequirements as u, ModelServices as v, RunDisposition as w, Output as x, Name as y };
226
+ //# sourceMappingURL=Agent-CN0EWRsR.d.mts.map
@@ -0,0 +1,83 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { AgentPolicy } from "./core/AgentPolicy.mjs";
3
+ import { AgentId } from "./core/Identifiers.mjs";
4
+ import { Emitter, UpdateError } from "./core/AgentUpdates.mjs";
5
+ import * as S from "effect/Schema";
6
+ import { Tool, Toolkit } from "effect/unstable/ai";
7
+ import { Schema } from "effect";
8
+ //#region src/core/internal/agent-updates.ts
9
+ /** Definition-owned native Tool. Runtime supplies its handler under the same identity. */
10
+ const updateTool = (schema) => Tool.make("emit_update", {
11
+ description: "Emit a structured intermediate update. This does not complete the task.",
12
+ parameters: Schema.Struct({ value: schema }),
13
+ success: Schema.Void,
14
+ failure: UpdateError,
15
+ failureMode: "return"
16
+ }).addDependency(Emitter);
17
+ const withUpdateTool = (toolkit, schema) => {
18
+ if (schema === void 0) return toolkit;
19
+ if (Object.hasOwn(toolkit.tools, "emit_update")) throw new TypeError("emit_update is reserved for Agent updates");
20
+ return Toolkit.make(...Object.values(toolkit.tools), updateTool(schema));
21
+ };
22
+ //#endregion
23
+ //#region src/core/Agent.ts
24
+ var Agent_exports = /* @__PURE__ */ __exportAll({
25
+ ToolInspection: () => ToolInspection,
26
+ inspectTools: () => inspectTools,
27
+ make: () => make,
28
+ withModel: () => withModel
29
+ });
30
+ /** Native Tool configuration for inspection; it does not predict an invocation's outcome. */
31
+ const ToolInspection = S.Struct({
32
+ name: S.String,
33
+ failureMode: S.Literals(["error", "return"]),
34
+ /** False for provider-executed Tools, whose results do not pass through local handlers. */
35
+ requiresHandler: S.Boolean
36
+ });
37
+ /**
38
+ * Inspect registered native Tools in declaration order without acquiring handlers or a Model.
39
+ * This is the full Definition toolkit, before run-specific visibility or exposure filtering.
40
+ * `failureMode` is Effect AI's configured mode, including its `"error"` default. Handler-level
41
+ * recovery, programmatic invocation and Subagent containment can change where failures go;
42
+ * consult execution diagnostics for the actual route. No arguments, results or services are read.
43
+ */
44
+ const inspectTools = (agent) => {
45
+ const definition = "definition" in agent ? agent.definition : agent;
46
+ return Object.values(definition.toolkit.tools).map((tool) => ToolInspection.make({
47
+ name: tool.name,
48
+ failureMode: tool.failureMode,
49
+ requiresHandler: !Tool.isProviderDefined(tool) || tool.requiresHandler
50
+ }));
51
+ };
52
+ function make(id, options) {
53
+ const completionNames = /* @__PURE__ */ new Set();
54
+ for (const declaration of options.completionFromTools ?? []) {
55
+ if (declaration.tool === options.completion?.tool || completionNames.has(declaration.tool)) throw new Error(`Tool ${declaration.tool} has more than one completion declaration`);
56
+ if (!Object.hasOwn(options.toolkit.tools, declaration.tool)) throw new Error(`Unknown completion Tool ${declaration.tool}`);
57
+ completionNames.add(declaration.tool);
58
+ }
59
+ return Object.freeze({
60
+ ...options,
61
+ toolkit: withUpdateTool(options.toolkit, options.updates),
62
+ policy: AgentPolicy.resolve(options.policy),
63
+ policyOverrides: Object.freeze({ ...options.policy }),
64
+ toolExposure: options.toolExposure === void 0 ? void 0 : Object.freeze({
65
+ ...options.toolExposure,
66
+ initialToolNames: Object.freeze([...options.toolExposure.initialToolNames ?? []])
67
+ }),
68
+ id: S.decodeSync(AgentId)(id),
69
+ metadata: options.metadata === void 0 ? void 0 : Object.freeze({ ...options.metadata }),
70
+ completion: options.completion === void 0 ? void 0 : Object.freeze({ ...options.completion }),
71
+ completionFromTools: options.completionFromTools === void 0 ? void 0 : Object.freeze(options.completionFromTools.map((declaration) => Object.freeze({ ...declaration }))),
72
+ runDisposition: options.runDisposition === void 0 ? void 0 : Object.freeze({ ...options.runDisposition })
73
+ });
74
+ }
75
+ /** Fix a model Layer for registration or delegation without acquiring or hiding its requirements. */
76
+ const withModel = (definition, model) => Object.freeze({
77
+ definition,
78
+ model
79
+ });
80
+ //#endregion
81
+ export { withModel as a, make as i, ToolInspection as n, inspectTools as r, Agent_exports as t };
82
+
83
+ //# sourceMappingURL=Agent-RklVROrm.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Agent-RklVROrm.mjs","names":[],"sources":["../src/core/internal/agent-updates.ts","../src/core/Agent.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { Tool, Toolkit } from \"effect/unstable/ai\";\n\nimport { Emitter, UpdateError } from \"../AgentUpdates.ts\";\n\n/** Definition-owned native Tool. Runtime supplies its handler under the same identity. */\nexport const updateTool = <S extends Schema.Top>(schema: S) =>\n Tool.make(\"emit_update\", {\n description: \"Emit a structured intermediate update. This does not complete the task.\",\n parameters: Schema.Struct({ value: schema }),\n success: Schema.Void,\n failure: UpdateError,\n failureMode: \"return\",\n }).addDependency(Emitter);\n\nexport type UpdateToolkit<\n T extends Toolkit.Any,\n S extends Schema.Top | undefined,\n> = S extends Schema.Top\n ? Toolkit.Toolkit<T[\"tools\"] & { readonly emit_update: ReturnType<typeof updateTool<S>> }>\n : T;\n\nexport const withUpdateTool = (\n toolkit: Toolkit.Any,\n schema: Schema.Top | undefined,\n): Toolkit.Any => {\n if (schema === undefined) return toolkit;\n if (Object.hasOwn(toolkit.tools, \"emit_update\"))\n throw new TypeError(\"emit_update is reserved for Agent updates\");\n\n return Toolkit.make(...Object.values(toolkit.tools), updateTool(schema));\n};\n","import type { Effect, Layer, Option, Schema } from \"effect\";\nimport * as S from \"effect/Schema\";\nimport {\n type AiError,\n type LanguageModel,\n type Model,\n type Prompt,\n Tool,\n type Toolkit,\n} from \"effect/unstable/ai\";\n\nimport type { AgentInputError, AgentOutputError, AgentRunDispositionError } from \"./AgentError.ts\";\nimport { AgentPolicy, type AgentPolicyInput } from \"./AgentPolicy.ts\";\nimport { AgentId } from \"./Identifiers.ts\";\nimport { type UpdateToolkit, withUpdateTool } from \"./internal/agent-updates.ts\";\nimport type { Configuration } from \"./ToolExposure.ts\";\n\n/** Prompt input produced directly or by an Effect that preserves its failure and requirements. */\nexport type InstructionResult<E = never, R = never> =\n | Prompt.RawInput\n | Effect.Effect<Prompt.RawInput, E, R>;\n\n/** Static prompt input or an input-dependent source evaluated once while preparing a run. */\nexport type InstructionSource<Input, E = never, R = never> =\n | Prompt.RawInput\n | ((input: Input) => InstructionResult<E, R>);\n\n/** Definition-owned projection from decoded Agent input to model-visible prompt content. */\nexport type InputPromptSource<Input, E = never, R = never> = (\n input: Input,\n) => InstructionResult<E, R>;\n\n/** Native services needed to execute and identify model calls. */\nexport type ModelServices = LanguageModel.LanguageModel | Model.ProviderName | Model.ModelName;\n\n/** Accepts Layers providing the native model and both identity services. */\nexport type NativeModel<ModelValue> =\n ModelValue extends Layer.Layer<infer Provides, never, infer _Requires>\n ? ModelServices extends Provides\n ? ModelValue\n : never\n : never;\n\n/** Definition-owned boundary for selecting and validating an application run disposition. */\nexport interface RunDispositionDeclaration<Output, DispositionSchema extends Schema.Top> {\n /** Canonical Schema used to validate and encode the selected disposition. */\n readonly schema: DispositionSchema;\n /** Pure selection from decoded output; `undefined` means this ordinary Run declares none. */\n readonly fromOutput: (output: Output) => unknown;\n}\n\n/** Values available to a Definition-owned completion Tool projector after canonical decoding. */\nexport interface CompletionProjectionInput<Parameters = unknown, Result = unknown> {\n readonly parameters: Parameters;\n readonly result: Result;\n}\n\n/**\n * One application Tool whose successful result can complete its owning Agent when it is the\n * only application call. Provider-executed calls may accompany it only with terminal results.\n * Mixed, wholly unexecuted application batches are rejected with failed Tool results so the\n * model can correct them within ordinary Run budgets; completed provider results are retained.\n * Missing provider results and invalid pending resumed batches fail closed. The completion\n * designation never permits side-effect replay.\n */\nexport interface CompletionToolDeclaration<\n Parameters = unknown,\n Result = unknown,\n Output = unknown,\n> {\n readonly tool: string;\n /** Require native Tool use on every model Turn and this Tool for final completion. */\n readonly required?: boolean | undefined;\n readonly project: (input: CompletionProjectionInput<Parameters, Result>) => Output;\n}\n\ntype CompletionToolFor<ToolkitValue extends Toolkit.Any, Output> = {\n readonly [Name in keyof ToolkitValue[\"tools\"] & string]: CompletionToolDeclaration<\n Tool.Parameters<ToolkitValue[\"tools\"][Name]>,\n Tool.Success<ToolkitValue[\"tools\"][Name]>,\n Output\n > & { readonly tool: Name };\n}[keyof ToolkitValue[\"tools\"] & string];\n\n/**\n * An ordinary action Tool whose canonical success may satisfy the whole request.\n * Projectors must be pure and deterministic: recovery re-evaluates them. None preserves\n * ordinary continuation; Some is validated as the Agent output. These Tools must be the sole\n * application call; terminal provider results may accompany them. They never receive the\n * required completion Tool's exhaustion allowance.\n */\nexport interface CompletionFromToolDeclaration<\n Parameters = unknown,\n Result = unknown,\n Output = unknown,\n> {\n readonly tool: string;\n readonly project: (input: CompletionProjectionInput<Parameters, Result>) => Option.Option<Output>;\n}\n\ntype CompletionFromToolFor<ToolkitValue extends Toolkit.Any, Output> = {\n readonly [Name in keyof ToolkitValue[\"tools\"] & string]: CompletionFromToolDeclaration<\n Tool.Parameters<ToolkitValue[\"tools\"][Name]>,\n Tool.Success<ToolkitValue[\"tools\"][Name]>,\n Output\n > & { readonly tool: Name };\n}[keyof ToolkitValue[\"tools\"] & string];\n\n/** Immutable, model-agnostic schemas, behavior, tools, and bounds for an agent. */\nexport interface Definition<\n InputSchema extends Schema.Top,\n OutputSchema extends Schema.Top,\n Instructions,\n ToolkitValue extends Toolkit.Any,\n RunDispositionValue = undefined,\n InputPromptValue = undefined,\n UpdatesSchema extends Schema.Top | undefined = undefined,\n> {\n /** Stable agent identity; changing it creates a distinct definition identity. */\n readonly id: AgentId;\n /** Canonical Schema for intermediate updates emitted by this Agent. */\n readonly updates?: UpdatesSchema;\n /** Canonical schema used to decode and encode run input. */\n readonly input: InputSchema;\n /** Canonical schema used to decode the final model output. */\n readonly output: OutputSchema;\n /** Instructions evaluated once while preparing each run. */\n readonly instructions: Instructions;\n /** Optional projection from decoded input to model-visible native Effect AI prompt content. */\n readonly inputPrompt?: InputPromptValue | undefined;\n /** Native Effect AI toolkit whose failures and requirements remain visible. */\n readonly toolkit: ToolkitValue;\n readonly toolExposure?: Configuration | undefined;\n /** Finite execution bounds enforced by the runtime. */\n readonly policy: AgentPolicy;\n /** Explicit policy fields, retained so delegated runs can inherit omitted fields. */\n readonly policyOverrides?: Partial<AgentPolicyInput> | undefined;\n /** Optional successful Tool result that projects directly to the Agent output and settles. */\n readonly completion?: CompletionToolDeclaration | undefined;\n readonly completionFromTools?: ReadonlyArray<CompletionFromToolDeclaration> | undefined;\n readonly runDisposition?: RunDispositionValue | undefined;\n readonly description?: string | undefined;\n readonly metadata?: Readonly<Record<string, string>> | undefined;\n}\n\n/** Options for a model-agnostic agent definition. */\nexport interface DefinitionOptions<\n InputSchema extends Schema.Top,\n OutputSchema extends Schema.Top,\n Instructions extends InstructionSource<InputSchema[\"Type\"], unknown, unknown>,\n ToolkitValue extends Toolkit.Any,\n RunDispositionValue extends\n | RunDispositionDeclaration<OutputSchema[\"Type\"], Schema.Top>\n | undefined = undefined,\n InputPromptValue extends InputPromptSource<InputSchema[\"Type\"], unknown, unknown> | undefined =\n undefined,\n UpdatesSchema extends Schema.Top | undefined = undefined,\n> {\n readonly updates?: UpdatesSchema;\n readonly input: InputSchema;\n readonly output: OutputSchema;\n readonly instructions: Instructions;\n readonly inputPrompt?: InputPromptValue | undefined;\n readonly toolkit: ToolkitValue;\n readonly toolExposure?: Configuration | undefined;\n readonly policy?: Partial<AgentPolicyInput> | undefined;\n readonly completion?: CompletionToolFor<ToolkitValue, OutputSchema[\"Type\"]> | undefined;\n readonly completionFromTools?:\n | ReadonlyArray<CompletionFromToolFor<ToolkitValue, OutputSchema[\"Type\"]>>\n | undefined;\n readonly runDisposition?: RunDispositionValue | undefined;\n readonly description?: string | undefined;\n readonly metadata?: Readonly<Record<string, string>> | undefined;\n}\n\ntype AnyDefinitionShape = Definition<\n Schema.Top,\n Schema.Top,\n unknown,\n Toolkit.Any,\n RunDispositionDeclaration<never, Schema.Top> | undefined,\n unknown,\n Schema.Top | undefined\n>;\n\n/** Immutable pairing of an agent definition with its native model Layer. */\nexport interface Binding<DefinitionValue extends AnyDefinitionShape, ModelValue> {\n readonly definition: DefinitionValue;\n readonly model: NativeModel<ModelValue>;\n}\n\ntype InstructionEffect<Instructions, Input> = Instructions extends (input: Input) => infer Result\n ? Result\n : Instructions;\n\ntype InputPromptEffect<InputPrompt, Input> = InputPrompt extends (input: Input) => infer Result\n ? Result\n : never;\n\ntype EffectError<Value> =\n Value extends Effect.Effect<infer _Success, infer Error, infer _Services> ? Error : never;\n\ntype EffectServices<Value> =\n Value extends Effect.Effect<infer _Success, infer _Error, infer Services> ? Services : never;\n\ntype ModelRequirements<Value> =\n Value extends Layer.Layer<infer _Provides, infer _Error, infer Services> ? Services : never;\n\n/** Constructors and type projections for definitions and runnable model bindings. */\n\n/** Type-erased definition used at generic framework boundaries. */\nexport type AnyDefinition = AnyDefinitionShape;\n\n/** Read-only interpreter program or binding used at inspection and projection boundaries. */\nexport interface Any {\n readonly definition: AnyDefinition;\n readonly model?: unknown;\n}\n\n/** Native Tool configuration for inspection; it does not predict an invocation's outcome. */\nexport const ToolInspection = S.Struct({\n name: S.String,\n failureMode: S.Literals([\"error\", \"return\"]),\n /** False for provider-executed Tools, whose results do not pass through local handlers. */\n requiresHandler: S.Boolean,\n});\n\nexport type ToolInspection = typeof ToolInspection.Type;\n\n/**\n * Inspect registered native Tools in declaration order without acquiring handlers or a Model.\n * This is the full Definition toolkit, before run-specific visibility or exposure filtering.\n * `failureMode` is Effect AI's configured mode, including its `\"error\"` default. Handler-level\n * recovery, programmatic invocation and Subagent containment can change where failures go;\n * consult execution diagnostics for the actual route. No arguments, results or services are read.\n */\nexport const inspectTools = (agent: AnyDefinition | Any): ReadonlyArray<ToolInspection> => {\n const definition = \"definition\" in agent ? agent.definition : agent;\n\n return Object.values(definition.toolkit.tools).map((tool) =>\n ToolInspection.make({\n name: tool.name,\n failureMode: tool.failureMode,\n requiresHandler: !Tool.isProviderDefined(tool) || tool.requiresHandler,\n }),\n );\n};\n\ntype DefinitionOf<AgentValue extends AnyDefinition | Any> = AgentValue extends {\n readonly definition: infer DefinitionValue extends AnyDefinition;\n}\n ? DefinitionValue\n : AgentValue;\n\ntype RunDispositionSchemaOf<DefinitionValue extends AnyDefinition> = [\n Exclude<DefinitionValue[\"runDisposition\"], undefined>,\n] extends [never]\n ? never\n : Exclude<DefinitionValue[\"runDisposition\"], undefined> extends RunDispositionDeclaration<\n never,\n infer DispositionSchema\n >\n ? DispositionSchema\n : never;\n\n/** Literal Agent ID, retained by Agent.make. */\nexport type Name<A extends AnyDefinition | Any> = DefinitionOf<A>[\"id\"] extends AgentId &\n (infer N extends string)\n ? N\n : string;\n\n/** Declared update Schema, or never for Agents without updates. */\nexport type UpdatesSchema<A extends AnyDefinition | Any> = Exclude<\n DefinitionOf<A>[\"updates\"],\n undefined\n>;\n\n/** Decoded intermediate update value. */\nexport type Update<A extends AnyDefinition | Any> = UpdatesSchema<A>[\"Type\"];\n\n/** Decoded input type of a definition or binding. */\nexport type Input<AgentValue extends AnyDefinition | Any> =\n DefinitionOf<AgentValue>[\"input\"][\"Type\"];\n\n/** Encoded input accepted by the primary execution operations. */\nexport type EncodedInput<AgentValue extends AnyDefinition | Any> =\n DefinitionOf<AgentValue>[\"input\"][\"Encoded\"];\n\n/** Decoded output type of a definition or binding. */\nexport type Output<AgentValue extends AnyDefinition | Any> =\n DefinitionOf<AgentValue>[\"output\"][\"Type\"];\n\n/** Input Schema carried by a definition or binding. */\nexport type InputSchema<AgentValue extends AnyDefinition | Any> = DefinitionOf<AgentValue>[\"input\"];\n\n/** Output Schema carried by a definition or binding. */\nexport type OutputSchema<AgentValue extends AnyDefinition | Any> =\n DefinitionOf<AgentValue>[\"output\"];\n\n/** Application run-disposition Schema carried by a definition or binding, or `never`. */\nexport type RunDispositionSchema<AgentValue extends AnyDefinition | Any> = RunDispositionSchemaOf<\n DefinitionOf<AgentValue>\n>;\n\n/** Decoded application run disposition declared by a definition or binding. */\nexport type RunDisposition<AgentValue extends AnyDefinition | Any> = [\n RunDispositionSchema<AgentValue>,\n] extends [never]\n ? never\n : RunDispositionSchema<AgentValue>[\"Type\"];\n\n/** Validation failure admitted only by definitions that declare a run disposition. */\nexport type RunDispositionFailure<AgentValue extends AnyDefinition | Any> = [\n RunDispositionSchemaOf<DefinitionOf<AgentValue>>,\n] extends [never]\n ? never\n : AgentRunDispositionError;\n\n/** Effect AI tool map carried by a definition or binding. */\nexport type Tools<AgentValue extends AnyDefinition | Any> = Toolkit.Tools<\n DefinitionOf<AgentValue>[\"toolkit\"]\n>;\n\ntype ApplicationTools<A extends AnyDefinition> = [UpdatesSchema<A>] extends [never]\n ? Tools<A>\n : Omit<Tools<A>, \"emit_update\">;\n\ntype ToolMapValues<ToolMap extends Record<string, Tool.Any>> = ToolMap extends unknown\n ? ToolMap[keyof ToolMap]\n : never;\n\n/** All possible tools, including keys present in only one definition or binding branch. */\nexport type ToolUnion<AgentValue extends AnyDefinition | Any> = ToolMapValues<Tools<AgentValue>>;\n\n/** Instruction, tool-handler, and Schema services required before a Model is bound. */\nexport type DefinitionRequirements<DefinitionValue extends AnyDefinition> =\n DefinitionValue extends unknown\n ?\n | EffectServices<InstructionEffect<DefinitionValue[\"instructions\"], Input<DefinitionValue>>>\n | EffectServices<InputPromptEffect<DefinitionValue[\"inputPrompt\"], Input<DefinitionValue>>>\n | Tool.HandlersFor<ApplicationTools<DefinitionValue>>\n | Tool.HandlerServices<ToolMapValues<ApplicationTools<DefinitionValue>>>\n // The interpreter canonically re-encodes decoded Tool parameters before recording them.\n | Tool.ParametersSchema<ToolUnion<DefinitionValue>>[\"EncodingServices\"]\n | Tool.SuccessSchema<ToolUnion<DefinitionValue>>[\"DecodingServices\"]\n | DefinitionValue[\"input\"][\"DecodingServices\"]\n | DefinitionValue[\"input\"][\"EncodingServices\"]\n | DefinitionValue[\"output\"][\"DecodingServices\"]\n | DefinitionValue[\"output\"][\"EncodingServices\"]\n | UpdatesSchema<DefinitionValue>[\"DecodingServices\"]\n | UpdatesSchema<DefinitionValue>[\"EncodingServices\"]\n | RunDispositionSchemaOf<DefinitionValue>[\"DecodingServices\"]\n | RunDispositionSchemaOf<DefinitionValue>[\"EncodingServices\"]\n : never;\n\n/** Definition services plus native model services, or a binding's model Layer requirements. */\nexport type Requirements<AgentValue extends AnyDefinition | Any> =\n | DefinitionRequirements<DefinitionOf<AgentValue>>\n | (AgentValue extends { readonly model: infer ModelValue }\n ? ModelRequirements<ModelValue>\n : ModelServices);\n\n// Distribute after unwrapping bindings too: withModel may itself contain a definition union.\ntype DefinitionFailure<DefinitionValue extends AnyDefinition> = DefinitionValue extends unknown\n ?\n | EffectError<InstructionEffect<DefinitionValue[\"instructions\"], Input<DefinitionValue>>>\n | EffectError<InputPromptEffect<DefinitionValue[\"inputPrompt\"], Input<DefinitionValue>>>\n | Tool.HandlerError<ToolUnion<DefinitionValue>>\n : never;\n\n/** Failures from every possible definition, preserving each branch's instruction input type. */\nexport type Failure<AgentValue extends AnyDefinition | Any> =\n | DefinitionFailure<DefinitionOf<AgentValue>>\n | AiError.AiError\n | AgentInputError\n | AgentOutputError\n | RunDispositionFailure<AgentValue>;\n\n/** Validate an agent ID and return a shallowly frozen, model-agnostic definition. */\nexport function make<\n const Name extends string,\n InputSchema extends Schema.Top,\n OutputSchema extends Schema.Top,\n Instructions extends InstructionSource<InputSchema[\"Type\"], unknown, unknown>,\n ToolkitValue extends Toolkit.Any,\n DispositionSchema extends Schema.Top,\n InputPromptValue extends InputPromptSource<InputSchema[\"Type\"], unknown, unknown> | undefined,\n UpdatesSchema extends Schema.Top | undefined = undefined,\n>(\n id: Name,\n options: DefinitionOptions<\n InputSchema,\n OutputSchema,\n Instructions,\n ToolkitValue,\n RunDispositionDeclaration<OutputSchema[\"Type\"], DispositionSchema>,\n InputPromptValue,\n UpdatesSchema\n > & {\n readonly runDisposition: RunDispositionDeclaration<OutputSchema[\"Type\"], DispositionSchema>;\n readonly inputPrompt: InputPromptValue;\n },\n): Definition<\n InputSchema,\n OutputSchema,\n Instructions,\n UpdateToolkit<ToolkitValue, NoInfer<UpdatesSchema>>,\n RunDispositionDeclaration<OutputSchema[\"Type\"], DispositionSchema>,\n InputPromptValue,\n NoInfer<UpdatesSchema>\n> & { readonly id: AgentId & Name };\n\nexport function make<\n const Name extends string,\n InputSchema extends Schema.Top,\n OutputSchema extends Schema.Top,\n Instructions extends InstructionSource<InputSchema[\"Type\"], unknown, unknown>,\n ToolkitValue extends Toolkit.Any,\n DispositionSchema extends Schema.Top,\n UpdatesSchema extends Schema.Top | undefined = undefined,\n>(\n id: Name,\n options: DefinitionOptions<\n InputSchema,\n OutputSchema,\n Instructions,\n ToolkitValue,\n RunDispositionDeclaration<OutputSchema[\"Type\"], DispositionSchema>,\n undefined,\n UpdatesSchema\n > & {\n readonly runDisposition: RunDispositionDeclaration<OutputSchema[\"Type\"], DispositionSchema>;\n readonly inputPrompt?: undefined;\n },\n): Definition<\n InputSchema,\n OutputSchema,\n Instructions,\n UpdateToolkit<ToolkitValue, NoInfer<UpdatesSchema>>,\n RunDispositionDeclaration<OutputSchema[\"Type\"], DispositionSchema>,\n undefined,\n NoInfer<UpdatesSchema>\n> & { readonly id: AgentId & Name };\n\nexport function make<\n const Name extends string,\n InputSchema extends Schema.Top,\n OutputSchema extends Schema.Top,\n Instructions extends InstructionSource<InputSchema[\"Type\"], unknown, unknown>,\n ToolkitValue extends Toolkit.Any,\n InputPromptValue extends InputPromptSource<InputSchema[\"Type\"], unknown, unknown> | undefined,\n UpdatesSchema extends Schema.Top | undefined = undefined,\n>(\n id: Name,\n options: DefinitionOptions<\n InputSchema,\n OutputSchema,\n Instructions,\n ToolkitValue,\n undefined,\n InputPromptValue,\n UpdatesSchema\n > & {\n readonly inputPrompt: InputPromptValue;\n readonly runDisposition?: undefined;\n },\n): Definition<\n InputSchema,\n OutputSchema,\n Instructions,\n UpdateToolkit<ToolkitValue, NoInfer<UpdatesSchema>>,\n undefined,\n InputPromptValue,\n NoInfer<UpdatesSchema>\n> & { readonly id: AgentId & Name };\n\nexport function make<\n const Name extends string,\n InputSchema extends Schema.Top,\n OutputSchema extends Schema.Top,\n Instructions extends InstructionSource<InputSchema[\"Type\"], unknown, unknown>,\n ToolkitValue extends Toolkit.Any,\n UpdatesSchema extends Schema.Top | undefined = undefined,\n>(\n id: Name,\n options: DefinitionOptions<\n InputSchema,\n OutputSchema,\n Instructions,\n ToolkitValue,\n undefined,\n undefined,\n UpdatesSchema\n > & {\n readonly inputPrompt?: undefined;\n readonly runDisposition?: undefined;\n },\n): Definition<\n InputSchema,\n OutputSchema,\n Instructions,\n UpdateToolkit<ToolkitValue, NoInfer<UpdatesSchema>>,\n undefined,\n undefined,\n NoInfer<UpdatesSchema>\n> & { readonly id: AgentId & Name };\n\nexport function make(\n id: string,\n options: {\n readonly updates?: Schema.Top | undefined;\n readonly input: Schema.Top;\n readonly output: Schema.Top;\n readonly instructions: unknown;\n readonly inputPrompt?: unknown;\n readonly toolkit: Toolkit.Any;\n readonly toolExposure?: Configuration | undefined;\n readonly policy?: Partial<AgentPolicyInput> | undefined;\n readonly completion?: CompletionToolDeclaration | undefined;\n readonly completionFromTools?: ReadonlyArray<CompletionFromToolDeclaration> | undefined;\n readonly runDisposition?: RunDispositionDeclaration<never, Schema.Top> | undefined;\n readonly description?: string | undefined;\n readonly metadata?: Readonly<Record<string, string>> | undefined;\n },\n): AnyDefinition {\n const completionNames = new Set<string>();\n\n for (const declaration of options.completionFromTools ?? []) {\n if (declaration.tool === options.completion?.tool || completionNames.has(declaration.tool)) {\n throw new Error(`Tool ${declaration.tool} has more than one completion declaration`);\n }\n if (!Object.hasOwn(options.toolkit.tools, declaration.tool)) {\n throw new Error(`Unknown completion Tool ${declaration.tool}`);\n }\n completionNames.add(declaration.tool);\n }\n\n return Object.freeze({\n ...options,\n toolkit: withUpdateTool(options.toolkit, options.updates),\n policy: AgentPolicy.resolve(options.policy),\n policyOverrides: Object.freeze({ ...options.policy }),\n toolExposure:\n options.toolExposure === undefined\n ? undefined\n : Object.freeze({\n ...options.toolExposure,\n initialToolNames: Object.freeze([...(options.toolExposure.initialToolNames ?? [])]),\n }),\n id: S.decodeSync(AgentId)(id),\n metadata: options.metadata === undefined ? undefined : Object.freeze({ ...options.metadata }),\n completion:\n options.completion === undefined ? undefined : Object.freeze({ ...options.completion }),\n completionFromTools:\n options.completionFromTools === undefined\n ? undefined\n : Object.freeze(\n options.completionFromTools.map((declaration) => Object.freeze({ ...declaration })),\n ),\n runDisposition:\n options.runDisposition === undefined\n ? undefined\n : Object.freeze({ ...options.runDisposition }),\n });\n}\n\n/** Fix a model Layer for registration or delegation without acquiring or hiding its requirements. */\nexport const withModel = <DefinitionValue extends AnyDefinition, ModelValue>(\n definition: DefinitionValue,\n model: NativeModel<ModelValue>,\n): Binding<DefinitionValue, ModelValue> =>\n Object.freeze({\n definition,\n model,\n });\n"],"mappings":";;;;;;;;;AAMA,MAAa,cAAoC,WAC/C,KAAK,KAAK,eAAe;CACvB,aAAa;CACb,YAAY,OAAO,OAAO,EAAE,OAAO,OAAO,CAAC;CAC3C,SAAS,OAAO;CAChB,SAAS;CACT,aAAa;AACf,CAAC,CAAC,CAAC,cAAc,OAAO;AAS1B,MAAa,kBACX,SACA,WACgB;CAChB,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,IAAI,OAAO,OAAO,QAAQ,OAAO,aAAa,GAC5C,MAAM,IAAI,UAAU,2CAA2C;CAEjE,OAAO,QAAQ,KAAK,GAAG,OAAO,OAAO,QAAQ,KAAK,GAAG,WAAW,MAAM,CAAC;AACzE;;;;;;;;;;AC6LA,MAAa,iBAAiB,EAAE,OAAO;CACrC,MAAM,EAAE;CACR,aAAa,EAAE,SAAS,CAAC,SAAS,QAAQ,CAAC;;CAE3C,iBAAiB,EAAE;AACrB,CAAC;;;;;;;;AAWD,MAAa,gBAAgB,UAA8D;CACzF,MAAM,aAAa,gBAAgB,QAAQ,MAAM,aAAa;CAE9D,OAAO,OAAO,OAAO,WAAW,QAAQ,KAAK,CAAC,CAAC,KAAK,SAClD,eAAe,KAAK;EAClB,MAAM,KAAK;EACX,aAAa,KAAK;EAClB,iBAAiB,CAAC,KAAK,kBAAkB,IAAI,KAAK,KAAK;CACzD,CAAC,CACH;AACF;AAqQA,SAAgB,KACd,IACA,SAee;CACf,MAAM,kCAAkB,IAAI,IAAY;CAExC,KAAK,MAAM,eAAe,QAAQ,uBAAuB,CAAC,GAAG;EAC3D,IAAI,YAAY,SAAS,QAAQ,YAAY,QAAQ,gBAAgB,IAAI,YAAY,IAAI,GACvF,MAAM,IAAI,MAAM,QAAQ,YAAY,KAAK,0CAA0C;EAErF,IAAI,CAAC,OAAO,OAAO,QAAQ,QAAQ,OAAO,YAAY,IAAI,GACxD,MAAM,IAAI,MAAM,2BAA2B,YAAY,MAAM;EAE/D,gBAAgB,IAAI,YAAY,IAAI;CACtC;CAEA,OAAO,OAAO,OAAO;EACnB,GAAG;EACH,SAAS,eAAe,QAAQ,SAAS,QAAQ,OAAO;EACxD,QAAQ,YAAY,QAAQ,QAAQ,MAAM;EAC1C,iBAAiB,OAAO,OAAO,EAAE,GAAG,QAAQ,OAAO,CAAC;EACpD,cACE,QAAQ,iBAAiB,KAAA,IACrB,KAAA,IACA,OAAO,OAAO;GACZ,GAAG,QAAQ;GACX,kBAAkB,OAAO,OAAO,CAAC,GAAI,QAAQ,aAAa,oBAAoB,CAAC,CAAE,CAAC;EACpF,CAAC;EACP,IAAI,EAAE,WAAW,OAAO,CAAC,CAAC,EAAE;EAC5B,UAAU,QAAQ,aAAa,KAAA,IAAY,KAAA,IAAY,OAAO,OAAO,EAAE,GAAG,QAAQ,SAAS,CAAC;EAC5F,YACE,QAAQ,eAAe,KAAA,IAAY,KAAA,IAAY,OAAO,OAAO,EAAE,GAAG,QAAQ,WAAW,CAAC;EACxF,qBACE,QAAQ,wBAAwB,KAAA,IAC5B,KAAA,IACA,OAAO,OACL,QAAQ,oBAAoB,KAAK,gBAAgB,OAAO,OAAO,EAAE,GAAG,YAAY,CAAC,CAAC,CACpF;EACN,gBACE,QAAQ,mBAAmB,KAAA,IACvB,KAAA,IACA,OAAO,OAAO,EAAE,GAAG,QAAQ,eAAe,CAAC;CACnD,CAAC;AACH;;AAGA,MAAa,aACX,YACA,UAEA,OAAO,OAAO;CACZ;CACA;AACF,CAAC"}
@@ -0,0 +1,101 @@
1
+ import { Schema } from "effect";
2
+ declare namespace AgentError_d_exports {
3
+ export { AgentApprovalDenied, AgentApprovalPending, AgentError, AgentInputError, AgentInterrupted, AgentOutputError, AgentPolicyError, AgentRunDispositionError, AgentToolAuthorizationDenied, ContextBudgetError, ContextOverflowError, ModelProtocolError, PolicyLimit };
4
+ }
5
+ declare const AgentInputError_base: Schema.Class<AgentInputError, Schema.TaggedStruct<"AgentInputError", {
6
+ readonly message: Schema.String;
7
+ }>, import("effect/Cause").YieldableError>;
8
+ /** Run input failed to decode through the agent definition's input Schema. */
9
+ declare class AgentInputError extends AgentInputError_base {}
10
+ declare const AgentOutputError_base: Schema.Class<AgentOutputError, Schema.TaggedStruct<"AgentOutputError", {
11
+ readonly message: Schema.String;
12
+ }>, import("effect/Cause").YieldableError>;
13
+ /** Final model output failed to decode through the agent definition's output Schema. */
14
+ declare class AgentOutputError extends AgentOutputError_base {}
15
+ declare const AgentRunDispositionError_base: Schema.Class<AgentRunDispositionError, Schema.TaggedStruct<"AgentRunDispositionError", {
16
+ readonly cause: Schema.Defect;
17
+ readonly message: Schema.String;
18
+ }>, import("effect/Cause").YieldableError>;
19
+ /** An application-selected run disposition failed its definition-owned Schema boundary. */
20
+ declare class AgentRunDispositionError extends AgentRunDispositionError_base {}
21
+ /** The finite policy dimension a run exhausted; shared with durable settlement metadata. */
22
+ declare const PolicyLimit: Schema.Literals<readonly ["turns", "tool-calls", "duration", "usage", "tokens", "cost", "repeated-failures"]>;
23
+ type PolicyLimit = typeof PolicyLimit.Type;
24
+ declare const AgentPolicyError_base: Schema.Class<AgentPolicyError, Schema.TaggedStruct<"AgentPolicyError", {
25
+ readonly limit: Schema.Literals<readonly ["turns", "tool-calls", "duration", "usage", "tokens", "cost", "repeated-failures"]>;
26
+ readonly message: Schema.String;
27
+ }>, import("effect/Cause").YieldableError>;
28
+ /** A run exhausted one of its finite policy limits. */
29
+ declare class AgentPolicyError extends AgentPolicyError_base {}
30
+ declare const AgentApprovalDenied_base: Schema.Class<AgentApprovalDenied, Schema.TaggedStruct<"AgentApprovalDenied", {
31
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
32
+ readonly toolName: Schema.NonEmptyString;
33
+ readonly message: Schema.String;
34
+ }>, import("effect/Cause").YieldableError>;
35
+ /** A native Effect AI Tool approval was explicitly denied before its Handler started. */
36
+ declare class AgentApprovalDenied extends AgentApprovalDenied_base {
37
+ /** Decode the native Effect AI Tool Call ID at the core error boundary. */
38
+ static make(input: {
39
+ readonly toolCallId: string;
40
+ readonly toolName: string;
41
+ readonly message: string;
42
+ }): AgentApprovalDenied;
43
+ }
44
+ declare const AgentToolAuthorizationDenied_base: Schema.Class<AgentToolAuthorizationDenied, Schema.TaggedStruct<"AgentToolAuthorizationDenied", {
45
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
46
+ readonly toolName: Schema.NonEmptyString;
47
+ readonly message: Schema.String;
48
+ }>, import("effect/Cause").YieldableError>;
49
+ /** A host denied current execution authority for a Tool Call before its Handler started. */
50
+ declare class AgentToolAuthorizationDenied extends AgentToolAuthorizationDenied_base {}
51
+ declare const AgentApprovalPending_base: Schema.Class<AgentApprovalPending, Schema.TaggedStruct<"AgentApprovalPending", {
52
+ readonly approvalId: Schema.NonEmptyString;
53
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
54
+ readonly toolName: Schema.NonEmptyString;
55
+ readonly message: Schema.String;
56
+ }>, import("effect/Cause").YieldableError>;
57
+ /** A native Effect AI Tool approval has no decision and the ephemeral Run cannot proceed. */
58
+ declare class AgentApprovalPending extends AgentApprovalPending_base {
59
+ /** Decode the native Effect AI Tool Call ID at the core error boundary. */
60
+ static make(input: {
61
+ readonly approvalId: string;
62
+ readonly toolCallId: string;
63
+ readonly toolName: string;
64
+ readonly message: string;
65
+ }): AgentApprovalPending;
66
+ }
67
+ declare const ModelProtocolError_base: Schema.Class<ModelProtocolError, Schema.TaggedStruct<"ModelProtocolError", {
68
+ readonly message: Schema.String;
69
+ }>, import("effect/Cause").YieldableError>;
70
+ /** A model response sequence violated an agent-loop protocol invariant. */
71
+ declare class ModelProtocolError extends ModelProtocolError_base {}
72
+ declare const AgentInterrupted_base: Schema.Class<AgentInterrupted, Schema.TaggedStruct<"AgentInterrupted", {
73
+ readonly message: Schema.String;
74
+ }>, import("effect/Cause").YieldableError>;
75
+ /** A run was interrupted without manufacturing a successful result. */
76
+ declare class AgentInterrupted extends AgentInterrupted_base {}
77
+ declare const ContextOverflowError_base: Schema.Class<ContextOverflowError, Schema.TaggedStruct<"ContextOverflowError", {
78
+ readonly message: Schema.String;
79
+ readonly retried: Schema.Boolean;
80
+ }>, import("effect/Cause").YieldableError>;
81
+ /**
82
+ * The provider rejected a prompt that exceeds the model context window and
83
+ * compaction recovery is unavailable or was already attempted once. This is
84
+ * an expected failure: the engine classifies the provider error rather than
85
+ * surfacing an opaque transport failure.
86
+ */
87
+ declare class ContextOverflowError extends ContextOverflowError_base {}
88
+ declare const ContextBudgetError_base: Schema.Class<ContextBudgetError, Schema.TaggedStruct<"ContextBudgetError", {
89
+ readonly message: Schema.String;
90
+ readonly estimatedTokens: Schema.Natural;
91
+ readonly targetTokens: Schema.Natural;
92
+ readonly completionReserveTokens: Schema.Natural;
93
+ }>, import("effect/Cause").YieldableError>;
94
+ /** Local context preparation could not fit a legal prompt inside its target before provider I/O. */
95
+ declare class ContextBudgetError extends ContextBudgetError_base {}
96
+ /** Schema for framework-owned agent errors; application and Effect AI failures remain separate. */
97
+ declare const AgentError: Schema.Union<readonly [typeof AgentInputError, typeof AgentOutputError, typeof AgentRunDispositionError, typeof AgentPolicyError, typeof AgentApprovalDenied, typeof AgentToolAuthorizationDenied, typeof AgentApprovalPending, typeof ModelProtocolError, typeof AgentInterrupted, typeof ContextOverflowError, typeof ContextBudgetError]>;
98
+ type AgentError = typeof AgentError.Type;
99
+ //#endregion
100
+ export { AgentInputError as a, AgentPolicyError as c, ContextBudgetError as d, ContextOverflowError as f, AgentError_d_exports as i, AgentRunDispositionError as l, PolicyLimit as m, AgentApprovalPending as n, AgentInterrupted as o, ModelProtocolError as p, AgentError as r, AgentOutputError as s, AgentApprovalDenied as t, AgentToolAuthorizationDenied as u };
101
+ //# sourceMappingURL=AgentError-CggcAQ7V.d.mts.map
@@ -0,0 +1,96 @@
1
+ import { t as ToolResultBounds } from "./ToolResult-DmmgoChv.mjs";
2
+ import * as Schema from "effect/Schema";
3
+ import * as Duration from "effect/Duration";
4
+ declare namespace AgentPolicy_d_exports {
5
+ export { AgentPolicy, AgentPolicyInput, CompactionPolicy, CompactionPolicyInput };
6
+ }
7
+ declare const CompactionMode: Schema.Literals<readonly ["prune", "summarize", "prune-then-summarize"]>;
8
+ /** Inputs normalized and validated by `CompactionPolicy.make`. */
9
+ type CompactionPolicyInput = Readonly<{
10
+ /** Estimated tokens of recent history preserved verbatim across a compaction; defaults to `20_000`. */
11
+ readonly keepRecentTokens?: number;
12
+ /** Compaction strategy order; defaults to `"prune-then-summarize"`. */
13
+ readonly mode?: typeof CompactionMode.Type;
14
+ }>;
15
+ declare const CompactionPolicy_base: Schema.Class<CompactionPolicy, Schema.Struct<{
16
+ readonly keepRecentTokens: Schema.Int;
17
+ readonly mode: Schema.Literals<readonly ["prune", "summarize", "prune-then-summarize"]>;
18
+ }>, {}>;
19
+ /** How the engine reduces model context when `contextTokenLimit` is crossed. */
20
+ declare class CompactionPolicy extends CompactionPolicy_base {
21
+ /** Normalize and validate compaction bounds, filling documented defaults. */
22
+ static make(input?: CompactionPolicyInput): CompactionPolicy;
23
+ }
24
+ /**
25
+ * Resolution when `maxTurns`, `maxToolCalls`, or `tokenBudget` is exhausted:
26
+ * `"final-answer"` gives the model one constrained opportunity to settle with
27
+ * output (the Run completes with `finishReason: "budget-exhausted"` and the
28
+ * exhausted-dimension marker), while `"fail"` fails the Run typed. Turn and
29
+ * Tool Call bounds resolve per RUN-018/RUN-019; the token dimension
30
+ * participates per RUN-025 with a one-shot bound (at most one grace call).
31
+ * Duration, cost, and repeated-failure bounds are hard rails regardless of
32
+ * this setting.
33
+ */
34
+ declare const OnExhaustion: Schema.Literals<readonly ["final-answer", "fail"]>;
35
+ declare const AgentPolicyFields: Schema.Struct<{
36
+ readonly maxTurns: Schema.Int;
37
+ readonly maxToolCalls: Schema.Int;
38
+ readonly maxDuration: Schema.refine<Duration.Duration, Schema.Duration>;
39
+ readonly toolConcurrency: Schema.Int;
40
+ readonly repeatedFailureLimit: Schema.Int;
41
+ readonly onExhaustion: Schema.Literals<readonly ["final-answer", "fail"]>;
42
+ readonly tokenBudget: Schema.optionalKey<Schema.Int>;
43
+ /** Tokens withheld from research calls so one final delivery call remains admissible. */
44
+ readonly completionReserveTokens: Schema.Int;
45
+ readonly costBudgetMicrousd: Schema.optionalKey<Schema.Int>;
46
+ /** Per-model-call live-context bound; crossing it triggers compaction rather than failure. */
47
+ readonly contextTokenLimit: Schema.optionalKey<Schema.Int>;
48
+ readonly toolResultBounds: typeof ToolResultBounds;
49
+ readonly runStatus: Schema.Literals<readonly ["appended", "off"]>;
50
+ readonly compaction: typeof CompactionPolicy;
51
+ }>;
52
+ type AgentPolicyFields = typeof AgentPolicyFields.Type;
53
+ /** Inputs normalized and validated by `AgentPolicy.make`. */
54
+ type AgentPolicyInput = Readonly<Omit<AgentPolicyFields, "maxDuration" | "repeatedFailureLimit" | "onExhaustion" | "toolResultBounds" | "runStatus" | "compaction" | "completionReserveTokens"> & {
55
+ /** Finite, positive wall-clock duration accepted in any Effect Duration input form. */
56
+ readonly maxDuration: Duration.Input;
57
+ /** Non-negative repeated-failure bound; defaults to `3`. */
58
+ readonly repeatedFailureLimit?: number;
59
+ /** Turn/Tool-Call/token exhaustion resolution; defaults to `"final-answer"`. */
60
+ readonly onExhaustion?: typeof OnExhaustion.Type;
61
+ /** Byte bound for each encoded Tool result; defaults to `50 KiB`. */
62
+ readonly toolResultBounds?: ToolResultBounds;
63
+ /** Whether a derived run-status message is appended to each model call; defaults to `"off"` to preserve retained prompt cache boundaries. */
64
+ readonly runStatus?: AgentPolicyFields["runStatus"];
65
+ /** Tokens reserved for final delivery; defaults to 20% of tokenBudget, capped at 4,096. */
66
+ readonly completionReserveTokens?: number;
67
+ /** Compaction strategy applied when `contextTokenLimit` is crossed; defaults documented on `CompactionPolicy`. */
68
+ readonly compaction?: CompactionPolicy;
69
+ }>;
70
+ declare const AgentPolicy_base: Schema.Class<AgentPolicy, Schema.Struct<{
71
+ readonly maxTurns: Schema.Int;
72
+ readonly maxToolCalls: Schema.Int;
73
+ readonly maxDuration: Schema.refine<Duration.Duration, Schema.Duration>;
74
+ readonly toolConcurrency: Schema.Int;
75
+ readonly repeatedFailureLimit: Schema.Int;
76
+ readonly onExhaustion: Schema.Literals<readonly ["final-answer", "fail"]>;
77
+ readonly tokenBudget: Schema.optionalKey<Schema.Int>;
78
+ /** Tokens withheld from research calls so one final delivery call remains admissible. */
79
+ readonly completionReserveTokens: Schema.Int;
80
+ readonly costBudgetMicrousd: Schema.optionalKey<Schema.Int>;
81
+ /** Per-model-call live-context bound; crossing it triggers compaction rather than failure. */
82
+ readonly contextTokenLimit: Schema.optionalKey<Schema.Int>;
83
+ readonly toolResultBounds: typeof ToolResultBounds;
84
+ readonly runStatus: Schema.Literals<readonly ["appended", "off"]>;
85
+ readonly compaction: typeof CompactionPolicy;
86
+ }>, {}>;
87
+ /** Schema class for finite agent run limits. */
88
+ declare class AgentPolicy extends AgentPolicy_base {
89
+ /** Resolve an optional declaration against finite standalone or parent defaults. */
90
+ static resolve(input?: Partial<AgentPolicyInput>, parent?: AgentPolicy): AgentPolicy;
91
+ /** Normalize and validate finite policy bounds, throwing on invalid input. */
92
+ static make(input: AgentPolicyInput): AgentPolicy;
93
+ }
94
+ //#endregion
95
+ export { CompactionPolicyInput as a, CompactionPolicy as i, AgentPolicyInput as n, AgentPolicy_d_exports as r, AgentPolicy as t };
96
+ //# sourceMappingURL=AgentPolicy-CetmQrf3.d.mts.map