effect-agent 0.1.0-beta.163 → 0.1.0-beta.165

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 (285) hide show
  1. package/dist/{Admin-Vhz6NdaH.d.mts → Admin-CbwoQEm8.d.mts} +24 -24
  2. package/dist/{Agent-BMATXYsI.mjs → Agent-B0WrUcHy.mjs} +9 -9
  3. package/dist/Agent-B0WrUcHy.mjs.map +1 -0
  4. package/dist/{Agent-ZfnNCQXs.d.mts → Agent-D0fbFT2d.d.mts} +27 -24
  5. package/dist/{AgentError-Bn1ytXRD.d.mts → AgentError-BMqPzIVt.d.mts} +3 -3
  6. package/dist/{AgentPolicy-B4oH8TbG.d.mts → AgentPolicy-CclAEpHn.d.mts} +2 -2
  7. package/dist/{AgentRuntime-D1MmB_0z.d.mts → AgentRuntime-BM36roNi.d.mts} +44 -30
  8. package/dist/{AgentRuntime-CVMHysXm.mjs → AgentRuntime-BTfPyMXN.mjs} +91 -30
  9. package/dist/AgentRuntime-BTfPyMXN.mjs.map +1 -0
  10. package/dist/{AgentUpdates-DMJ-_xow.d.mts → AgentUpdates-DksV4D0A.d.mts} +6 -3
  11. package/dist/{ContextCompactor-BoKQOjr5.d.mts → ContextCompactor-DLpX-HUG.d.mts} +18 -12
  12. package/dist/{ContextWindow-DRQ5Mbm2.d.mts → ContextWindow-aGZOPIPq.d.mts} +24 -22
  13. package/dist/{Digest-COAt3Orl.d.mts → Digest-3l_02jaM.d.mts} +2 -2
  14. package/dist/{DurableAgentRuntime-BpB5rBcu.mjs → DurableAgentRuntime-CWmWREPj.mjs} +11 -11
  15. package/dist/{DurableAgentRuntime-BpB5rBcu.mjs.map → DurableAgentRuntime-CWmWREPj.mjs.map} +1 -1
  16. package/dist/{DurableStep-Cry_iol4.d.mts → DurableStep-CTqx6DOV.d.mts} +13 -11
  17. package/dist/{EventSource-CtS0RBM7.d.mts → EventSource-D29Jsj5U.d.mts} +3 -3
  18. package/dist/{FailureDiagnostic-BElLOoED.mjs → FailureDiagnostic-D9oW23Cn.mjs} +16 -10
  19. package/dist/FailureDiagnostic-D9oW23Cn.mjs.map +1 -0
  20. package/dist/{FailureDiagnostic-CaAkzGHL.d.mts → FailureDiagnostic-DvHruCSJ.d.mts} +10 -9
  21. package/dist/InMemory.d.mts +28 -5
  22. package/dist/InMemory.mjs +37 -4
  23. package/dist/InMemory.mjs.map +1 -1
  24. package/dist/{Messaging-CICd_CSi.d.mts → Messaging-BbuaphiQ.d.mts} +6 -6
  25. package/dist/{Messaging-7VXQnWI3.d.mts → Messaging-DF_IWnxV.d.mts} +5 -5
  26. package/dist/{MessagingHost-DXwWnrMh.d.mts → MessagingHost-Bfbfkx6f.d.mts} +13 -12
  27. package/dist/{MessagingHost-DfsbMPvq.mjs → MessagingHost-DJZJZILu.mjs} +4 -3
  28. package/dist/MessagingHost-DJZJZILu.mjs.map +1 -0
  29. package/dist/{Output-CY7NZByV.d.mts → Output-UsQKiPhz.d.mts} +4 -4
  30. package/dist/{PreparedInputAdmission-CS_zlCvD.d.mts → PreparedInputAdmission-DXvjTe4U.d.mts} +6 -6
  31. package/dist/{Receipt-BAHyigAF.d.mts → Receipt-BkM21Qiu.d.mts} +2 -2
  32. package/dist/{Records-Bm4Qt70a.d.mts → Records-CAQktL0z.d.mts} +8 -8
  33. package/dist/{RunEvent-D0aepYwN.d.mts → RunEvent-B3CRIqIC.d.mts} +5 -5
  34. package/dist/{RunEventSink-9CUdI9Ar.d.mts → RunEventSink-sDXDkrAl.d.mts} +9 -7
  35. package/dist/{RunJournal-CA2bsvHn.mjs → RunJournal-NRgq1PNe.mjs} +3 -3
  36. package/dist/{RunJournal-CA2bsvHn.mjs.map → RunJournal-NRgq1PNe.mjs.map} +1 -1
  37. package/dist/{RunOptions-BHmBa05n.d.mts → RunOptions-CkSZSuIh.d.mts} +87 -83
  38. package/dist/{RunPolicyUsage-CUudVtg_.d.mts → RunPolicyUsage-QmYVw9z8.d.mts} +2 -2
  39. package/dist/{Schedule-Bi_XVKLF.d.mts → Schedule-rEIiYnRq.d.mts} +4 -4
  40. package/dist/{Subagent-DH6G120f.mjs → Subagent-C-fyHbcp.mjs} +5 -5
  41. package/dist/{Subagent-DH6G120f.mjs.map → Subagent-C-fyHbcp.mjs.map} +1 -1
  42. package/dist/{Subagent-D59om8SR.d.mts → Subagent-t3pJDZMN.d.mts} +15 -15
  43. package/dist/{SubagentContract-tyN9v-Jv.d.mts → SubagentContract-DdPzxYQj.d.mts} +3 -2
  44. package/dist/{SubagentHost-VTyf_wEF.d.mts → SubagentHost-CXFlEpj0.d.mts} +19 -16
  45. package/dist/{Subscription-nbSNY6Hs.d.mts → Subscription-BJj-R-6V.d.mts} +8 -8
  46. package/dist/{SubscriptionInput-DbXnOMS2.d.mts → SubscriptionInput-DyQtODg2.d.mts} +3 -3
  47. package/dist/Thread-DT8RTLIQ.d.mts +117 -0
  48. package/dist/{ThreadHistory-FD-o4TsR.d.mts → ThreadHistory-DQ-IC1hU.d.mts} +12 -9
  49. package/dist/{ToolBroker-DWs4tZra.d.mts → ToolBroker-DXwv2aUT.d.mts} +14 -12
  50. package/dist/{ToolExposure-UCN12eCd.d.mts → ToolExposure-BsaSH15e.d.mts} +5 -4
  51. package/dist/{ToolExposure-r2eOWk4F.d.mts → ToolExposure-Ckg3-sTf.d.mts} +3 -2
  52. package/dist/{ToolExposure-9uF_Yo0T.mjs → ToolExposure-DBATXxmL.mjs} +2 -2
  53. package/dist/ToolExposure-DBATXxmL.mjs.map +1 -0
  54. package/dist/{ToolExposure-C93U1sPu.mjs → ToolExposure-hTJT2ekj.mjs} +3 -2
  55. package/dist/ToolExposure-hTJT2ekj.mjs.map +1 -0
  56. package/dist/ToolExposure.d.mts +2 -2
  57. package/dist/ToolExposure.mjs +2 -2
  58. package/dist/{ToolResult-BKdqWRff.d.mts → ToolResult-DqyEhJLF.d.mts} +2 -2
  59. package/dist/{Usage-BNjPR7Zr.d.mts → Usage-CzZJ6A2n.d.mts} +3 -2
  60. package/dist/{Worker-XEBYxRQv.d.mts → Worker-DH5SAVIK.d.mts} +7 -7
  61. package/dist/{Worker-CfwzMZEK.mjs → Worker-DZjdMjZn.mjs} +3 -3
  62. package/dist/Worker-DZjdMjZn.mjs.map +1 -0
  63. package/dist/{WorkerAdmission-Cmcxd6nS.mjs → WorkerAdmission-DJ76C2b-.mjs} +4 -4
  64. package/dist/{WorkerAdmission-Cmcxd6nS.mjs.map → WorkerAdmission-DJ76C2b-.mjs.map} +1 -1
  65. package/dist/{agent-registration-BIOzAej4.mjs → agent-registration-D1dWV7KK.mjs} +3 -3
  66. package/dist/{agent-registration-BIOzAej4.mjs.map → agent-registration-D1dWV7KK.mjs.map} +1 -1
  67. package/dist/capabilities/BrowserUse.d.mts +1 -1
  68. package/dist/capabilities/BrowserUse.mjs +1 -1
  69. package/dist/capabilities/CodeMode.d.mts +2 -2
  70. package/dist/capabilities/CodeMode.mjs +3 -3
  71. package/dist/capabilities/Commands.d.mts +1 -1
  72. package/dist/capabilities/ContextTools.d.mts +2 -2
  73. package/dist/capabilities/ContextTools.mjs +1 -1
  74. package/dist/capabilities/Mcp.d.mts +1 -1
  75. package/dist/capabilities/Mcp.mjs +1 -1
  76. package/dist/capabilities/McpClient.d.mts +1 -1
  77. package/dist/capabilities/McpClient.mjs +1 -1
  78. package/dist/capabilities/MemoryNotes.d.mts +2 -2
  79. package/dist/capabilities/MemoryNotes.mjs +1 -1
  80. package/dist/capabilities/Messaging.d.mts +2 -2
  81. package/dist/capabilities/Messaging.mjs +3 -3
  82. package/dist/capabilities/ModelContext.d.mts +1 -1
  83. package/dist/capabilities/Redaction.d.mts +1 -1
  84. package/dist/capabilities/RunHooks.d.mts +7 -6
  85. package/dist/capabilities/RunHooks.mjs +2 -1
  86. package/dist/capabilities/RunHooks.mjs.map +1 -1
  87. package/dist/capabilities/SemanticMemory.d.mts +1 -1
  88. package/dist/capabilities/SemanticMemory.mjs +1 -1
  89. package/dist/capabilities/Subagent.d.mts +3 -3
  90. package/dist/capabilities/Subagent.mjs +2 -2
  91. package/dist/capabilities/SubagentReservations.d.mts +64 -60
  92. package/dist/capabilities/SubagentReservations.mjs +6 -1
  93. package/dist/capabilities/SubagentReservations.mjs.map +1 -1
  94. package/dist/capabilities/ToolDiscovery.d.mts +2 -2
  95. package/dist/capabilities/ToolDiscovery.mjs +3 -3
  96. package/dist/capabilities/WebCapture.d.mts +1 -1
  97. package/dist/capabilities/WebCapture.mjs +1 -1
  98. package/dist/capabilities/WebSearch.d.mts +1 -1
  99. package/dist/capabilities/WebSearch.mjs +1 -1
  100. package/dist/{compaction-C2OTceKw.mjs → compaction-FDJhjbzH.mjs} +7 -6
  101. package/dist/compaction-FDJhjbzH.mjs.map +1 -0
  102. package/dist/core/Agent.d.mts +1 -1
  103. package/dist/core/Agent.mjs +1 -1
  104. package/dist/core/AgentError.d.mts +1 -1
  105. package/dist/core/AgentError.mjs +4 -4
  106. package/dist/core/AgentError.mjs.map +1 -1
  107. package/dist/core/AgentPolicy.d.mts +1 -1
  108. package/dist/core/AgentUpdates.d.mts +1 -1
  109. package/dist/core/AgentUpdates.mjs +5 -1
  110. package/dist/core/AgentUpdates.mjs.map +1 -1
  111. package/dist/core/FailureDiagnostic.d.mts +1 -1
  112. package/dist/core/FailureDiagnostic.mjs +1 -1
  113. package/dist/core/IdGenerator.d.mts +3 -1
  114. package/dist/core/IdGenerator.mjs +8 -5
  115. package/dist/core/IdGenerator.mjs.map +1 -1
  116. package/dist/core/Receipt.d.mts +1 -1
  117. package/dist/core/Receipt.mjs +1 -1
  118. package/dist/core/Receipt.mjs.map +1 -1
  119. package/dist/core/RunEvent.d.mts +1 -1
  120. package/dist/core/RunEvent.mjs +2 -2
  121. package/dist/core/RunEvent.mjs.map +1 -1
  122. package/dist/core/RunPolicyUsage.d.mts +1 -1
  123. package/dist/core/RunPolicyUsage.mjs +1 -1
  124. package/dist/core/RunPolicyUsage.mjs.map +1 -1
  125. package/dist/core/SubagentContract.d.mts +1 -1
  126. package/dist/core/SubagentContract.mjs +2 -1
  127. package/dist/core/SubagentContract.mjs.map +1 -1
  128. package/dist/core/Thread.d.mts +2 -2
  129. package/dist/core/Thread.mjs +82 -33
  130. package/dist/core/Thread.mjs.map +1 -1
  131. package/dist/core/ToolResult.d.mts +1 -1
  132. package/dist/core/ToolResult.mjs +1 -1
  133. package/dist/core/ToolResult.mjs.map +1 -1
  134. package/dist/core/Usage.d.mts +1 -1
  135. package/dist/core/Usage.mjs +2 -1
  136. package/dist/core/Usage.mjs.map +1 -1
  137. package/dist/core/Worker.d.mts +2 -2
  138. package/dist/core/Worker.mjs +1 -1
  139. package/dist/durable/ActivityStore.d.mts +1 -1
  140. package/dist/durable/Admin.d.mts +1 -1
  141. package/dist/durable/AgentRegistration.d.mts +1 -1
  142. package/dist/durable/AgentRegistration.mjs +1 -1
  143. package/dist/durable/Certification.d.mts +1 -1
  144. package/dist/durable/CommittedActivity.d.mts +3 -3
  145. package/dist/durable/Digest.d.mts +1 -1
  146. package/dist/durable/DurableAgentRuntime.d.mts +2 -2
  147. package/dist/durable/DurableAgentRuntime.mjs +2 -2
  148. package/dist/durable/EventSource.d.mts +1 -1
  149. package/dist/durable/GitHubWorkflowSource.d.mts +4 -4
  150. package/dist/durable/GitHubWorkflowSource.mjs +1 -1
  151. package/dist/durable/LifecyclePublication.d.mts +1 -1
  152. package/dist/durable/LifecyclePublication.mjs +1 -1
  153. package/dist/durable/MessageDelivery.d.mts +9 -9
  154. package/dist/durable/MessageDelivery.mjs +2 -2
  155. package/dist/durable/MessageDeliveryStoreConformance.d.mts +28 -28
  156. package/dist/durable/MessageDeliveryStoreConformance.mjs +1 -1
  157. package/dist/durable/PersistentHistory.d.mts +2 -2
  158. package/dist/durable/PersistentHistory.mjs +2 -2
  159. package/dist/durable/PreparedInputAdmission.d.mts +1 -1
  160. package/dist/durable/PreparedInputAdmission.mjs +1 -1
  161. package/dist/durable/Records.d.mts +1 -1
  162. package/dist/durable/Records.mjs +5 -5
  163. package/dist/durable/Recovery.d.mts +1 -1
  164. package/dist/durable/RunJournal.d.mts +1 -1
  165. package/dist/durable/RunJournal.mjs +1 -1
  166. package/dist/durable/Schedule.d.mts +1 -1
  167. package/dist/durable/Schedule.mjs +1 -1
  168. package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
  169. package/dist/durable/ScheduleTransition.d.mts +1 -1
  170. package/dist/durable/Scheduling.d.mts +4 -4
  171. package/dist/durable/SubmissionLedger.d.mts +2 -2
  172. package/dist/durable/SubmissionLedger.mjs +3 -3
  173. package/dist/durable/SubmissionLedgerConformance.d.mts +2 -2
  174. package/dist/durable/SubmissionLedgerConformance.mjs +3 -3
  175. package/dist/durable/SubmissionStatus.d.mts +1 -1
  176. package/dist/durable/Subscription.d.mts +1 -1
  177. package/dist/durable/Subscription.mjs +1 -1
  178. package/dist/durable/SubscriptionInput.d.mts +1 -1
  179. package/dist/durable/SubscriptionInput.mjs +1 -1
  180. package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
  181. package/dist/durable/SubscriptionTools.d.mts +7 -7
  182. package/dist/durable/SubscriptionTools.mjs +1 -1
  183. package/dist/durable/SubscriptionTransition.d.mts +1 -1
  184. package/dist/durable/Subscriptions.d.mts +7 -7
  185. package/dist/durable/ThreadContextHistory.d.mts +1 -1
  186. package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
  187. package/dist/durable/ThreadContextHistoryProjection.mjs +2 -2
  188. package/dist/durable/ThreadInvariants.d.mts +2 -2
  189. package/dist/durable/ThreadInvariants.mjs +1 -1
  190. package/dist/durable/ThreadProjection.d.mts +1 -1
  191. package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
  192. package/dist/durable/ThreadStore.d.mts +1 -1
  193. package/dist/durable/ThreadStore.mjs +1 -1
  194. package/dist/durable/ThreadStoreConformance.d.mts +1 -1
  195. package/dist/durable/ThreadStoreConformance.mjs +1 -1
  196. package/dist/durable/WorkerAdmission.d.mts +6 -6
  197. package/dist/durable/WorkerAdmission.mjs +1 -1
  198. package/dist/durable/WorkerHost.d.mts +7 -7
  199. package/dist/durable/WorkerHost.mjs +1 -1
  200. package/dist/engine/AgentRuntime.d.mts +1 -1
  201. package/dist/engine/AgentRuntime.mjs +1 -1
  202. package/dist/engine/Compaction.d.mts +1 -1
  203. package/dist/engine/Compaction.mjs +1 -1
  204. package/dist/engine/ContextCompactor.d.mts +1 -1
  205. package/dist/engine/ContextCompactor.mjs +8 -3
  206. package/dist/engine/ContextCompactor.mjs.map +1 -1
  207. package/dist/engine/ContextWindow.d.mts +1 -1
  208. package/dist/engine/ContextWindow.mjs +3 -1
  209. package/dist/engine/ContextWindow.mjs.map +1 -1
  210. package/dist/engine/DurableStep.d.mts +1 -1
  211. package/dist/engine/DurableStep.mjs +2 -1
  212. package/dist/engine/DurableStep.mjs.map +1 -1
  213. package/dist/engine/MessagingHost.d.mts +1 -1
  214. package/dist/engine/MessagingHost.mjs +1 -1
  215. package/dist/engine/Output.d.mts +1 -1
  216. package/dist/engine/Output.mjs +1 -1
  217. package/dist/engine/RunEventSink.d.mts +1 -1
  218. package/dist/engine/RunEventSink.mjs +2 -1
  219. package/dist/engine/RunEventSink.mjs.map +1 -1
  220. package/dist/engine/RunOptions.d.mts +1 -1
  221. package/dist/engine/RunOptions.mjs +5 -2
  222. package/dist/engine/RunOptions.mjs.map +1 -1
  223. package/dist/engine/SubagentHost.d.mts +1 -1
  224. package/dist/engine/SubagentHost.mjs +4 -2
  225. package/dist/engine/SubagentHost.mjs.map +1 -1
  226. package/dist/engine/ThreadHistory.d.mts +1 -1
  227. package/dist/engine/ThreadHistory.mjs +12 -10
  228. package/dist/engine/ThreadHistory.mjs.map +1 -1
  229. package/dist/engine/ToolBroker.d.mts +1 -1
  230. package/dist/engine/ToolBroker.mjs +2 -1
  231. package/dist/engine/ToolBroker.mjs.map +1 -1
  232. package/dist/index.d.mts +34 -34
  233. package/dist/index.mjs +9 -9
  234. package/dist/{output-contract-DS-S8mTv.mjs → output-contract-DUNIO6as.mjs} +4 -3
  235. package/dist/output-contract-DUNIO6as.mjs.map +1 -0
  236. package/package.json +1 -1
  237. package/src/InMemory.ts +61 -2
  238. package/src/capabilities/RunHooks.ts +6 -3
  239. package/src/capabilities/SubagentReservations.ts +7 -1
  240. package/src/core/Agent.ts +3 -8
  241. package/src/core/AgentError.ts +1 -1
  242. package/src/core/AgentUpdates.ts +5 -1
  243. package/src/core/FailureDiagnostic.ts +6 -8
  244. package/src/core/IdGenerator.ts +5 -2
  245. package/src/core/Messaging.ts +1 -1
  246. package/src/core/Receipt.ts +1 -1
  247. package/src/core/RunEvent.ts +1 -1
  248. package/src/core/RunPolicyUsage.ts +1 -1
  249. package/src/core/SubagentContract.ts +2 -1
  250. package/src/core/Thread.ts +163 -61
  251. package/src/core/ToolExposure.ts +2 -1
  252. package/src/core/ToolResult.ts +1 -1
  253. package/src/core/Usage.ts +2 -1
  254. package/src/core/Worker.ts +1 -1
  255. package/src/core/internal/agent-updates.ts +3 -2
  256. package/src/core/internal/message-status.ts +1 -1
  257. package/src/core/internal/strict-schema.ts +3 -1
  258. package/src/engine/ContextCompactor.ts +8 -2
  259. package/src/engine/ContextWindow.ts +4 -1
  260. package/src/engine/DurableStep.ts +2 -1
  261. package/src/engine/MessagingHost.ts +2 -1
  262. package/src/engine/RunEventSink.ts +2 -1
  263. package/src/engine/RunOptions.ts +5 -1
  264. package/src/engine/SubagentHost.ts +3 -1
  265. package/src/engine/ThreadHistory.ts +20 -10
  266. package/src/engine/ToolBroker.ts +2 -1
  267. package/src/engine/ToolExposure.ts +2 -1
  268. package/src/engine/internal/agent-runtime.ts +41 -49
  269. package/src/engine/internal/bounded-value.ts +2 -1
  270. package/src/engine/internal/compaction.ts +12 -7
  271. package/src/engine/internal/output-contract.ts +3 -2
  272. package/src/engine/internal/primitive-delta.ts +51 -10
  273. package/src/engine/internal/tool-derivative.ts +5 -1
  274. package/src/engine/internal/tool-exposure.ts +5 -2
  275. package/src/engine/internal/tool-telemetry.ts +12 -13
  276. package/dist/Agent-BMATXYsI.mjs.map +0 -1
  277. package/dist/AgentRuntime-CVMHysXm.mjs.map +0 -1
  278. package/dist/FailureDiagnostic-BElLOoED.mjs.map +0 -1
  279. package/dist/MessagingHost-DfsbMPvq.mjs.map +0 -1
  280. package/dist/Thread-DOBQ0QUY.d.mts +0 -96
  281. package/dist/ToolExposure-9uF_Yo0T.mjs.map +0 -1
  282. package/dist/ToolExposure-C93U1sPu.mjs.map +0 -1
  283. package/dist/Worker-CfwzMZEK.mjs.map +0 -1
  284. package/dist/compaction-C2OTceKw.mjs.map +0 -1
  285. package/dist/output-contract-DS-S8mTv.mjs.map +0 -1
@@ -4,28 +4,60 @@ import { n as utf8ByteLength } from "./utf8-DchGZRBd.mjs";
4
4
  import { ToolParameterRejection, TruncatedToolResult, applyToolResultBounds, unserializableToolResult } from "./core/ToolResult.mjs";
5
5
  import { IdempotencyKey } from "./core/Receipt.mjs";
6
6
  import { Emitter, Update, UpdateError } from "./core/AgentUpdates.mjs";
7
- import { i as isModelResolver } from "./Agent-BMATXYsI.mjs";
7
+ import { i as isModelResolver } from "./Agent-B0WrUcHy.mjs";
8
8
  import { AgentApprovalDenied, AgentApprovalPending, AgentInputError, AgentOutputError, AgentPolicyError, AgentRunDispositionError, AgentToolAuthorizationDenied, ContextBudgetError, ContextOverflowError, ModelProtocolError } from "./core/AgentError.mjs";
9
- import { IdGenerator as IdGenerator$1 } from "./core/IdGenerator.mjs";
9
+ import { IdGenerator } from "./core/IdGenerator.mjs";
10
10
  import { DelegationDepth, SubagentParentLink, getToolExecutionKind, isSubagentToolAllowed } from "./core/SubagentContract.mjs";
11
- import { a as PinnedTool, c as ToolNames, i as Limits, l as ToolNamespace, n as DiscoveryTool, o as Selection, r as IncludesCatalogDocumentation, s as Snapshot, t as AdditionalToolCatalog } from "./ToolExposure-C93U1sPu.mjs";
11
+ import { a as PinnedTool, c as ToolNames, i as Limits, l as ToolNamespace, n as DiscoveryTool, o as Selection, r as IncludesCatalogDocumentation, s as Snapshot, t as AdditionalToolCatalog } from "./ToolExposure-hTJT2ekj.mjs";
12
12
  import { InputTokenUsage, ModelCallUsage, ModelResponseIdentity, OutputTokenUsage, RunTotals, RunUsageReport, emptyRunTotals, sumRunTotals, unknownRunTotals } from "./core/Usage.mjs";
13
13
  import { AgentUpdateEmitted, ApprovalRequested, BudgetWarning, CompactionPerformed, ModelRestarted, ModelStarted, ReasoningDelta, RunCompleted, RunFailed, RunStarted, RunSuspended, SubagentCompleted, SubagentFailed, SubagentInterrupted, SubagentJoined, SubagentProgress, SubagentRequested, SubagentStarted, TextDelta, ToolCallDeclared, ToolCallFailed, ToolCallStarted, ToolCallSucceeded, ToolProgress, TurnCompleted, TurnStarted } from "./core/RunEvent.mjs";
14
- import { r as FrameworkMessage, t as AssignmentDisposition } from "./Worker-CfwzMZEK.mjs";
15
- import { t as MessagingHost } from "./MessagingHost-DfsbMPvq.mjs";
14
+ import { r as FrameworkMessage, t as AssignmentDisposition } from "./Worker-DZjdMjZn.mjs";
15
+ import { t as MessagingHost } from "./MessagingHost-DJZJZILu.mjs";
16
16
  import { SubagentHost } from "./engine/SubagentHost.mjs";
17
17
  import { ThreadHistory, ThreadHistoryError } from "./engine/ThreadHistory.mjs";
18
- import { n as RunToolVisibility, t as CurrentToolCatalog } from "./ToolExposure-9uF_Yo0T.mjs";
19
- import { n as outputSchemaContract, r as prepareModelPrompt, t as isTextOutput } from "./output-contract-DS-S8mTv.mjs";
20
- import { _ as initialCompactionState, b as boundedCanonicalJsonSnapshot, d as collectCoveredMessages, f as contextWindowId, g as evaluateMessageTokenEstimates, h as estimatePromptTokens, s as buildCompactedView, v as isContextOverflowMessage, x as boundedJsonSnapshot } from "./compaction-C2OTceKw.mjs";
18
+ import { n as RunToolVisibility, t as CurrentToolCatalog } from "./ToolExposure-DBATXxmL.mjs";
19
+ import { n as outputSchemaContract, r as prepareModelPrompt, t as isTextOutput } from "./output-contract-DUNIO6as.mjs";
20
+ import { _ as initialCompactionState, b as boundedCanonicalJsonSnapshot, d as collectCoveredMessages, f as contextWindowId, g as evaluateMessageTokenEstimates, h as estimatePromptTokens, s as buildCompactedView, v as isContextOverflowMessage, x as boundedJsonSnapshot } from "./compaction-FDJhjbzH.mjs";
21
21
  import { ContextRolloverRequest, ContextRolloverSelection, ContextRolloverTool, ContextWindow, ContextWindowStatus, ModelCallContext } from "./engine/ContextWindow.mjs";
22
22
  import { DurableStep, DurableStepError, getToolExecutionClass } from "./engine/DurableStep.mjs";
23
23
  import { CompactionDecision, CompactionError, ContextCompactor } from "./engine/ContextCompactor.mjs";
24
24
  import { RunEventSink, RunEventSinkClosedError } from "./engine/RunEventSink.mjs";
25
25
  import { AgentUpdateAcceptance, CurrentToolFailureObserver, ModelUsageAccounting, RunContextPreparation, RunResumeUsageSchema, RunToolAuthorization, RunToolScheduling, RunTurnResumeSettledCallSchema } from "./engine/RunOptions.mjs";
26
26
  import { ToolBroker, ToolBrokerConfigurationError, ToolBrokerUnavailableError } from "./engine/ToolBroker.mjs";
27
- import { AiError, LanguageModel, Model, Prompt, Response, ResponseIdTracker, Tool, Toolkit } from "effect/unstable/ai";
28
- import { Cause, Channel, Clock, Context, DateTime, Duration, Effect, Equal, ErrorReporter, Exit, Fiber, Layer, Metric, Option, PubSub, Queue, Redacted, Result, Schedule, Schema, SchemaAST, SchemaGetter, Scope, Semaphore, Stream, Tracer } from "effect";
27
+ import * as Schema from "effect/Schema";
28
+ import * as Tool from "effect/unstable/ai/Tool";
29
+ import * as Toolkit from "effect/unstable/ai/Toolkit";
30
+ import * as Duration from "effect/Duration";
31
+ import * as AiError from "effect/unstable/ai/AiError";
32
+ import * as Context from "effect/Context";
33
+ import * as Effect from "effect/Effect";
34
+ import * as Option from "effect/Option";
35
+ import * as Stream from "effect/Stream";
36
+ import * as Cause from "effect/Cause";
37
+ import * as Exit from "effect/Exit";
38
+ import * as Redacted from "effect/Redacted";
39
+ import * as Channel from "effect/Channel";
40
+ import * as Clock from "effect/Clock";
41
+ import * as DateTime from "effect/DateTime";
42
+ import * as Equal from "effect/Equal";
43
+ import * as Fiber from "effect/Fiber";
44
+ import * as Layer from "effect/Layer";
45
+ import * as Metric from "effect/Metric";
46
+ import * as PubSub from "effect/PubSub";
47
+ import * as Queue from "effect/Queue";
48
+ import * as Result from "effect/Result";
49
+ import * as Schedule from "effect/Schedule";
50
+ import * as SchemaAST from "effect/SchemaAST";
51
+ import * as SchemaGetter from "effect/SchemaGetter";
52
+ import * as Scope from "effect/Scope";
53
+ import * as Semaphore from "effect/Semaphore";
54
+ import * as Tracer from "effect/Tracer";
55
+ import * as LanguageModel from "effect/unstable/ai/LanguageModel";
56
+ import * as Model from "effect/unstable/ai/Model";
57
+ import * as Prompt from "effect/unstable/ai/Prompt";
58
+ import * as Response from "effect/unstable/ai/Response";
59
+ import * as ResponseIdTracker from "effect/unstable/ai/ResponseIdTracker";
60
+ import * as ErrorReporter from "effect/ErrorReporter";
29
61
  //#region src/engine/internal/bounded-value.ts
30
62
  const DEFAULT_MAX_DEPTH = 128;
31
63
  const OBJECT_OVERHEAD_BYTES = 32;
@@ -223,14 +255,28 @@ const boundedValueFootprint = (root, maxBytes, knownSafePrototypes = /* @__PURE_
223
255
  };
224
256
  //#endregion
225
257
  //#region src/engine/internal/primitive-delta.ts
258
+ const brand = "~effect/ai/Response/Part";
226
259
  const keys = [
227
- "~effect/ai/Response/Part",
260
+ brand,
228
261
  "type",
229
262
  "id",
230
263
  "delta",
231
264
  "metadata"
232
265
  ];
233
- const decode = Schema.decodeUnknownOption(Schema.toType(Schema.Union([Response.TextDeltaPart, Response.ReasoningDeltaPart])));
266
+ const boundaryKeys = [
267
+ brand,
268
+ "type",
269
+ "id",
270
+ "metadata"
271
+ ];
272
+ const decode = Schema.decodeUnknownOption(Schema.toType(Schema.Union([
273
+ Response.TextDeltaPart,
274
+ Response.ReasoningDeltaPart,
275
+ Response.TextStartPart,
276
+ Response.TextEndPart,
277
+ Response.ReasoningStartPart,
278
+ Response.ReasoningEndPart
279
+ ])));
234
280
  const overhead = (type) => ({
235
281
  source: boundedValueFootprint(Response.makePart(type, {
236
282
  id: "",
@@ -243,33 +289,50 @@ const overhead = (type) => ({
243
289
  metadata: {}
244
290
  }, Number.MAX_SAFE_INTEGER)
245
291
  });
292
+ const boundaryOverhead = (type) => ({
293
+ source: boundedValueFootprint(Response.makePart(type, { id: "" }), Number.MAX_SAFE_INTEGER),
294
+ encoded: boundedValueFootprint({
295
+ type,
296
+ id: "",
297
+ metadata: {}
298
+ }, Number.MAX_SAFE_INTEGER)
299
+ });
246
300
  const overheads = {
247
301
  "text-delta": overhead("text-delta"),
248
- "reasoning-delta": overhead("reasoning-delta")
302
+ "reasoning-delta": overhead("reasoning-delta"),
303
+ "text-start": boundaryOverhead("text-start"),
304
+ "text-end": boundaryOverhead("text-end"),
305
+ "reasoning-start": boundaryOverhead("reasoning-start"),
306
+ "reasoning-end": boundaryOverhead("reasoning-end")
249
307
  };
250
308
  /**
251
- * Copy the common primitive delta into owned data before native Schema validation.
309
+ * Copy primitive text and reasoning parts into owned data before native Schema validation.
252
310
  * Descriptor checks select this optimization; they do not replace the native codec.
253
311
  * Extra fields, accessors, and nonempty metadata use the general ownership path.
254
312
  * No provider object survives, including an empty metadata object's hidden storage.
255
313
  * Unlike a generic footprint shortcut, this cannot retain an exotic backing buffer.
256
314
  */
257
- const ownPrimitiveDelta = (part, maxBytes) => {
315
+ const ownPrimitiveTextPart = (part, maxBytes) => {
258
316
  try {
259
317
  if (part === null || typeof part !== "object") return void 0;
260
318
  if (Array.isArray(part) || ArrayBuffer.isView(part)) return void 0;
261
319
  const prototype = Object.getPrototypeOf(part);
262
320
  if (prototype !== Object.prototype && prototype !== null) return void 0;
263
- if (Reflect.ownKeys(part).length !== keys.length) return void 0;
321
+ const typeDescriptor = Object.getOwnPropertyDescriptor(part, "type");
322
+ if (typeDescriptor === void 0 || !("value" in typeDescriptor)) return void 0;
323
+ const isDelta = typeDescriptor.value === "text-delta" || typeDescriptor.value === "reasoning-delta";
324
+ const selectedKeys = isDelta ? keys : boundaryKeys;
325
+ if (Reflect.ownKeys(part).length !== selectedKeys.length) return void 0;
264
326
  const snapshot = {};
265
- for (const key of keys) {
327
+ for (const key of selectedKeys) {
266
328
  const descriptor = Object.getOwnPropertyDescriptor(part, key);
267
329
  if (descriptor === void 0 || !("value" in descriptor)) return void 0;
268
330
  snapshot[key] = descriptor.value;
269
331
  }
270
332
  const { type, id, delta, metadata } = snapshot;
271
- if (type !== "text-delta" && type !== "reasoning-delta") return void 0;
272
- if (typeof id !== "string" || typeof delta !== "string") return void 0;
333
+ if (type !== "text-delta" && type !== "reasoning-delta" && type !== "text-start" && type !== "text-end" && type !== "reasoning-start" && type !== "reasoning-end") return;
334
+ if (isDelta !== (type === "text-delta" || type === "reasoning-delta")) return void 0;
335
+ if (typeof id !== "string" || isDelta && typeof delta !== "string") return void 0;
273
336
  if (metadata === null || typeof metadata !== "object") return void 0;
274
337
  if (Array.isArray(metadata) || ArrayBuffer.isView(metadata)) return void 0;
275
338
  const metadataPrototype = Object.getPrototypeOf(metadata);
@@ -277,7 +340,7 @@ const ownPrimitiveDelta = (part, maxBytes) => {
277
340
  if (Reflect.ownKeys(metadata).length !== 0) return void 0;
278
341
  const fixed = overheads[type];
279
342
  if (fixed.source === void 0 || fixed.encoded === void 0) return void 0;
280
- const bytes = utf8ByteLength(id) + utf8ByteLength(delta);
343
+ const bytes = utf8ByteLength(id) + (typeof delta === "string" ? utf8ByteLength(delta) : 0);
281
344
  if (bytes + fixed.source > maxBytes || bytes + fixed.encoded > maxBytes) return void 0;
282
345
  snapshot.metadata = {};
283
346
  const validated = decode(snapshot);
@@ -910,8 +973,7 @@ const ownModelResponsePartGeneral = Effect.fnUntraced(function* (part, toolkit,
910
973
  yield* inspectModelResponsePartCapacity(usage, preflight ?? part, limits);
911
974
  }
912
975
  const codec = modelResponseCodecFor(toolkit);
913
- const encodingFailure = ModelProtocolError.make({ message: "Model response part failed canonical encoding" });
914
- const encoded = yield* Schema.encodeUnknownEffect(codec)(part).pipe(Effect.mapError(() => encodingFailure));
976
+ const encoded = yield* Schema.encodeUnknownEffect(codec)(part).pipe(Effect.mapError(() => ModelProtocolError.make({ message: "Model response part failed canonical encoding" })));
915
977
  const retainedBytes = yield* inspectModelResponsePartCapacity(usage, encoded, limits);
916
978
  const ownedEncoded = yield* Effect.try({
917
979
  try: () => {
@@ -920,14 +982,13 @@ const ownModelResponsePartGeneral = Effect.fnUntraced(function* (part, toolkit,
920
982
  },
921
983
  catch: () => ModelProtocolError.make({ message: "Model response part could not be converted into engine-owned data" })
922
984
  });
923
- const decodingFailure = ModelProtocolError.make({ message: "Model response part failed canonical decoding" });
924
985
  return {
925
- ownedPart: yield* Schema.decodeUnknownEffect(codec)(ownedEncoded).pipe(Effect.mapError(() => decodingFailure)),
986
+ ownedPart: yield* Schema.decodeUnknownEffect(codec)(ownedEncoded).pipe(Effect.mapError(() => ModelProtocolError.make({ message: "Model response part failed canonical decoding" }))),
926
987
  retainedBytes
927
988
  };
928
989
  });
929
990
  const ownModelResponsePart = (part, toolkit, usage, limits) => Effect.suspend(() => {
930
- const primitive = usage.responsePartCount < limits.maxModelResponseParts ? ownPrimitiveDelta(part, limits.maxModelResponseBytes - usage.responsePartBytes) : void 0;
991
+ const primitive = usage.responsePartCount < limits.maxModelResponseParts ? ownPrimitiveTextPart(part, limits.maxModelResponseBytes - usage.responsePartBytes) : void 0;
931
992
  return primitive === void 0 ? ownModelResponsePartGeneral(part, toolkit, usage, limits) : Effect.succeed(primitive);
932
993
  });
933
994
  const consumeModelResponsePart = (usage, retainedBytes, limits) => Effect.suspend(() => {
@@ -1386,7 +1447,7 @@ const toolTelemetryAttributes = (descriptor) => ({
1386
1447
  toolName: descriptor.toolName
1387
1448
  });
1388
1449
  /** Canonical content-free terminal signal for any application Tool handler attempt. */
1389
- const terminalToolTelemetry = (descriptor, outcome, failureMarker, failureHandling) => annotateToolSpanTerminalOutcome(outcome, failureMarker, failureHandling, descriptor.failureMode).pipe(Effect.andThen((outcome === "success" ? Effect.logInfo("agent tool execution completed") : Effect.logWarning("agent tool execution failed")).pipe(Effect.annotateLogs({
1450
+ const terminalToolTelemetry = (descriptor, outcome, failureMarker, failureHandling) => annotateToolSpanTerminalOutcome(outcome, failureMarker, failureHandling, descriptor.failureMode).pipe(Effect.andThen((outcome === "success" ? Effect.logDebug("agent tool execution completed") : Effect.logWarning("agent tool execution failed")).pipe(Effect.annotateLogs({
1390
1451
  ...toolTelemetryAttributes(descriptor),
1391
1452
  "effect_agent.tool.outcome": outcome,
1392
1453
  ...failureHandling === void 0 ? {} : { "effect_agent.tool.failure_handling": failureHandling },
@@ -2820,7 +2881,7 @@ const makeTurn = (agent, context, prompt, turn, priorToolCalls, options, restart
2820
2881
  limit: turn > bounds.maxTurns ? "turns" : priorToolCalls + context.programmaticToolCalls > bounds.maxToolCalls ? "tool-calls" : "tokens",
2821
2882
  message: "Agent already used its one grace finalization"
2822
2883
  }));
2823
- const turnId = yield* (yield* IdGenerator$1).nextTurnId;
2884
+ const turnId = yield* (yield* IdGenerator).nextTurnId;
2824
2885
  const outputContract = outputSchemaContract(agent.definition);
2825
2886
  const outputContractMessage = outputContract._tag === "rendered" ? outputContract.message : void 0;
2826
2887
  const contextRequest = {
@@ -3717,7 +3778,7 @@ function streamWithCompletion(agentValue, input, runOptions = {}, onCompleted, o
3717
3778
  const preparation = yield* Effect.serviceOption(RunContextPreparation).pipe(Effect.map(Option.getOrElse(() => RunContextPreparation.of({}))));
3718
3779
  const authorization = yield* Effect.serviceOption(RunToolAuthorization).pipe(Effect.map(Option.getOrUndefined));
3719
3780
  const visibility = yield* RunToolVisibility;
3720
- const ids = yield* IdGenerator$1;
3781
+ const ids = yield* IdGenerator;
3721
3782
  const threadId = runOptions.threadId ?? (yield* ids.nextThreadId);
3722
3783
  const runId = runOptions.runId ?? (yield* ids.nextRunId);
3723
3784
  const retained = history.retention === "incremental" && runOptions.durability !== void 0 ? void 0 : yield* history.open({
@@ -4726,7 +4787,7 @@ const waitingFromCause = (cause) => {
4726
4787
  * services; delegation handlers do not select separate host policies.
4727
4788
  */
4728
4789
  const spawnWithParent = (parent, depth, history, preparation, onChild) => Effect.fn("AgentSpawner.spawn")(function* (binding, input, delegation, options) {
4729
- const ids = yield* IdGenerator$1;
4790
+ const ids = yield* IdGenerator;
4730
4791
  const threadId = yield* ids.nextThreadId;
4731
4792
  const runId = yield* ids.nextRunId;
4732
4793
  const childDepth = yield* Schema.decodeEffect(DelegationDepth)(depth + 1).pipe(Effect.orDie);
@@ -4841,4 +4902,4 @@ var AgentRuntime_exports = /* @__PURE__ */ __exportAll({
4841
4902
  //#endregion
4842
4903
  export { stream as _, SubagentDurability as a, withTerminalDefectEvent as b, decodeFinalOutput as c, projectCompletionOutput as d, renderInputPrompt as f, startUnknown as g, start as h, AgentSpawner as i, encodeRunDisposition as l, runUnknown as m, AgentChildPending as n, SubagentDurabilityError as o, run as p, AgentResultSchema as r, ToolCallWaiting as s, AgentRuntime_exports as t, projectCompletionFromToolOutput as u, streamUnknown as v, streamWithUsageAccountingUnknown as y };
4843
4904
 
4844
- //# sourceMappingURL=AgentRuntime-CVMHysXm.mjs.map
4905
+ //# sourceMappingURL=AgentRuntime-BTfPyMXN.mjs.map