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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (553) hide show
  1. package/dist/Agent-1DMSO_Fl.mjs +86 -0
  2. package/dist/Agent-1DMSO_Fl.mjs.map +1 -0
  3. package/dist/Agent-DriBcXBN.d.mts +245 -0
  4. package/dist/AgentError-Bn1ytXRD.d.mts +117 -0
  5. package/dist/AgentPolicy-BqDoSXO6.d.mts +96 -0
  6. package/dist/AgentRuntime-CWkHuzyt.d.mts +346 -0
  7. package/dist/AgentRuntime-DLwPoEVH.mjs +4735 -0
  8. package/dist/AgentRuntime-DLwPoEVH.mjs.map +1 -0
  9. package/dist/AgentUpdates-DMJ-_xow.d.mts +53 -0
  10. package/dist/ContextCompactor-WwSIG_Z2.d.mts +161 -0
  11. package/dist/ContextWindow-DRQ5Mbm2.d.mts +58 -0
  12. package/dist/DurableAgentRuntime-PyIgNYXF.mjs +6772 -0
  13. package/dist/DurableAgentRuntime-PyIgNYXF.mjs.map +1 -0
  14. package/dist/DurableFailpoint-mx3-nsxU.d.mts +41 -0
  15. package/dist/DurableStep-Cry_iol4.d.mts +103 -0
  16. package/dist/EventSource-BUYLmL77.d.mts +51 -0
  17. package/dist/FailureDiagnostic-BElLOoED.mjs +274 -0
  18. package/dist/FailureDiagnostic-BElLOoED.mjs.map +1 -0
  19. package/dist/FailureDiagnostic-CaAkzGHL.d.mts +223 -0
  20. package/dist/Identifiers-CN2s30fF.d.mts +40 -0
  21. package/dist/InMemory.d.mts +24 -0
  22. package/dist/InMemory.mjs +24 -0
  23. package/dist/InMemory.mjs.map +1 -0
  24. package/dist/MemoryNamespace-BbRW5p71.d.mts +36 -0
  25. package/dist/MemoryReference-B8Q3UJoJ.d.mts +79 -0
  26. package/dist/Messaging-DaZDlBqh.d.mts +1067 -0
  27. package/dist/Messaging-Dkg87ebg.d.mts +221 -0
  28. package/dist/MessagingHost-D89X7ma8.mjs +110 -0
  29. package/dist/MessagingHost-D89X7ma8.mjs.map +1 -0
  30. package/dist/MessagingHost-e1Sbzfao.d.mts +74 -0
  31. package/dist/OperationAuthorizer-TzcQtpX5.d.mts +61 -0
  32. package/dist/Output-CAFJTAbP.d.mts +25 -0
  33. package/dist/PageCapture-Df8Xwskw.d.mts +583 -0
  34. package/dist/PageScreenshot-BpgZKAxl.d.mts +48 -0
  35. package/dist/PreparedInputAdmission-J3YK6LAm.d.mts +42 -0
  36. package/dist/Receipt-BAHyigAF.d.mts +33 -0
  37. package/dist/Records-4qnRmniE.d.mts +4058 -0
  38. package/dist/RunEvent-DIrzkjLr.d.mts +460 -0
  39. package/dist/RunEventSink-D5aVhISG.d.mts +108 -0
  40. package/dist/RunJournal-BXrq0VIK.mjs +931 -0
  41. package/dist/RunJournal-BXrq0VIK.mjs.map +1 -0
  42. package/dist/RunOptions-BoESJrxw.d.mts +935 -0
  43. package/dist/RunPolicyUsage-ClZxyR46.d.mts +21 -0
  44. package/dist/Sandbox-CEsDWBLq.d.mts +173 -0
  45. package/dist/Schedule-C2lH2kxY.d.mts +847 -0
  46. package/dist/Scheduling-DPb2QyAK.mjs +691 -0
  47. package/dist/Scheduling-DPb2QyAK.mjs.map +1 -0
  48. package/dist/Subagent-D9eYdGTl.mjs +1537 -0
  49. package/dist/Subagent-D9eYdGTl.mjs.map +1 -0
  50. package/dist/Subagent-F72tuaxy.d.mts +1360 -0
  51. package/dist/SubagentContract-DdT7Cqe6.d.mts +116 -0
  52. package/dist/SubagentHost-CmiNTOBZ.d.mts +149 -0
  53. package/dist/Subscription-pQUv0QD6.d.mts +945 -0
  54. package/dist/SubscriptionInput-DdJOiNMY.d.mts +41 -0
  55. package/dist/Thread-DOBQ0QUY.d.mts +96 -0
  56. package/dist/ThreadHistory-tS1KwxHR.d.mts +60 -0
  57. package/dist/ToolBroker-DWs4tZra.d.mts +133 -0
  58. package/dist/ToolExposure-9uF_Yo0T.mjs +10 -0
  59. package/dist/ToolExposure-9uF_Yo0T.mjs.map +1 -0
  60. package/dist/ToolExposure-C93U1sPu.mjs +30 -0
  61. package/dist/ToolExposure-C93U1sPu.mjs.map +1 -0
  62. package/dist/ToolExposure-UCN12eCd.d.mts +39 -0
  63. package/dist/ToolExposure-r2eOWk4F.d.mts +46 -0
  64. package/dist/ToolExposure.d.mts +8 -0
  65. package/dist/ToolExposure.mjs +21 -0
  66. package/dist/ToolExposure.mjs.map +1 -0
  67. package/dist/ToolReconciler-BmVRAHKs.d.mts +80 -0
  68. package/dist/ToolResult-BKdqWRff.d.mts +78 -0
  69. package/dist/Usage-Dx0aknfk.d.mts +121 -0
  70. package/dist/WakeScheduler-EjUF-GhC.d.mts +56 -0
  71. package/dist/Worker-Du9dhVnp.d.mts +279 -0
  72. package/dist/Worker-T_3RbaKc.mjs +210 -0
  73. package/dist/Worker-T_3RbaKc.mjs.map +1 -0
  74. package/dist/agent-registration-B5CI-Ygk.mjs +201 -0
  75. package/dist/agent-registration-B5CI-Ygk.mjs.map +1 -0
  76. package/dist/capabilities/Approval.d.mts +114 -0
  77. package/dist/capabilities/Approval.mjs +226 -0
  78. package/dist/capabilities/Approval.mjs.map +1 -0
  79. package/dist/capabilities/Budget.d.mts +112 -0
  80. package/dist/capabilities/Budget.mjs +346 -0
  81. package/dist/capabilities/Budget.mjs.map +1 -0
  82. package/dist/capabilities/CodeMode.d.mts +157 -0
  83. package/dist/capabilities/CodeMode.mjs +522 -0
  84. package/dist/capabilities/CodeMode.mjs.map +1 -0
  85. package/dist/capabilities/Commands.d.mts +55 -0
  86. package/dist/capabilities/Commands.mjs +57 -0
  87. package/dist/capabilities/Commands.mjs.map +1 -0
  88. package/dist/capabilities/ContextTools.d.mts +321 -0
  89. package/dist/capabilities/ContextTools.mjs +126 -0
  90. package/dist/capabilities/ContextTools.mjs.map +1 -0
  91. package/dist/capabilities/Mcp.d.mts +108 -0
  92. package/dist/capabilities/Mcp.mjs +260 -0
  93. package/dist/capabilities/Mcp.mjs.map +1 -0
  94. package/dist/capabilities/McpClient.d.mts +115 -0
  95. package/dist/capabilities/McpClient.mjs +506 -0
  96. package/dist/capabilities/McpClient.mjs.map +1 -0
  97. package/dist/capabilities/MemoryNotes.d.mts +424 -0
  98. package/dist/capabilities/MemoryNotes.mjs +128 -0
  99. package/dist/capabilities/MemoryNotes.mjs.map +1 -0
  100. package/dist/capabilities/Messaging.d.mts +3 -0
  101. package/dist/capabilities/Messaging.mjs +152 -0
  102. package/dist/capabilities/Messaging.mjs.map +1 -0
  103. package/dist/capabilities/ModelContext.d.mts +89 -0
  104. package/dist/capabilities/ModelContext.mjs +168 -0
  105. package/dist/capabilities/ModelContext.mjs.map +1 -0
  106. package/dist/capabilities/Redaction.d.mts +37 -0
  107. package/dist/capabilities/Redaction.mjs +104 -0
  108. package/dist/capabilities/Redaction.mjs.map +1 -0
  109. package/dist/capabilities/Remembering.d.mts +434 -0
  110. package/dist/capabilities/Remembering.mjs +290 -0
  111. package/dist/capabilities/Remembering.mjs.map +1 -0
  112. package/dist/capabilities/RunHooks.d.mts +82 -0
  113. package/dist/capabilities/RunHooks.mjs +144 -0
  114. package/dist/capabilities/RunHooks.mjs.map +1 -0
  115. package/dist/capabilities/SemanticMemory.d.mts +431 -0
  116. package/dist/capabilities/SemanticMemory.mjs +315 -0
  117. package/dist/capabilities/SemanticMemory.mjs.map +1 -0
  118. package/dist/capabilities/Subagent.d.mts +4 -0
  119. package/dist/capabilities/Subagent.mjs +5 -0
  120. package/dist/capabilities/SubagentReservations.d.mts +186 -0
  121. package/dist/capabilities/SubagentReservations.mjs +479 -0
  122. package/dist/capabilities/SubagentReservations.mjs.map +1 -0
  123. package/dist/capabilities/ToolDiscovery.d.mts +124 -0
  124. package/dist/capabilities/ToolDiscovery.mjs +230 -0
  125. package/dist/capabilities/ToolDiscovery.mjs.map +1 -0
  126. package/dist/capabilities/WebCapture.d.mts +163 -0
  127. package/dist/capabilities/WebCapture.mjs +335 -0
  128. package/dist/capabilities/WebCapture.mjs.map +1 -0
  129. package/dist/capabilities/WebSearch.d.mts +71 -0
  130. package/dist/capabilities/WebSearch.mjs +115 -0
  131. package/dist/capabilities/WebSearch.mjs.map +1 -0
  132. package/dist/compaction-C2OTceKw.mjs +505 -0
  133. package/dist/compaction-C2OTceKw.mjs.map +1 -0
  134. package/dist/core/Agent.d.mts +2 -0
  135. package/dist/core/Agent.mjs +2 -0
  136. package/dist/core/AgentError.d.mts +2 -0
  137. package/dist/core/AgentError.mjs +134 -0
  138. package/dist/core/AgentError.mjs.map +1 -0
  139. package/dist/core/AgentPolicy.d.mts +2 -0
  140. package/dist/core/AgentPolicy.mjs +94 -0
  141. package/dist/core/AgentPolicy.mjs.map +1 -0
  142. package/dist/core/AgentUpdates.d.mts +2 -0
  143. package/dist/core/AgentUpdates.mjs +63 -0
  144. package/dist/core/AgentUpdates.mjs.map +1 -0
  145. package/dist/core/FailureDiagnostic.d.mts +2 -0
  146. package/dist/core/FailureDiagnostic.mjs +2 -0
  147. package/dist/core/IdGenerator.d.mts +26 -0
  148. package/dist/core/IdGenerator.mjs +27 -0
  149. package/dist/core/IdGenerator.mjs.map +1 -0
  150. package/dist/core/Identifiers.d.mts +2 -0
  151. package/dist/core/Identifiers.mjs +43 -0
  152. package/dist/core/Identifiers.mjs.map +1 -0
  153. package/dist/core/Memory.d.mts +57 -0
  154. package/dist/core/Memory.mjs +203 -0
  155. package/dist/core/Memory.mjs.map +1 -0
  156. package/dist/core/MemoryNamespace.d.mts +2 -0
  157. package/dist/core/MemoryNamespace.mjs +116 -0
  158. package/dist/core/MemoryNamespace.mjs.map +1 -0
  159. package/dist/core/MemoryReference.d.mts +2 -0
  160. package/dist/core/MemoryReference.mjs +109 -0
  161. package/dist/core/MemoryReference.mjs.map +1 -0
  162. package/dist/core/MemoryRevalidation.d.mts +65 -0
  163. package/dist/core/MemoryRevalidation.mjs +126 -0
  164. package/dist/core/MemoryRevalidation.mjs.map +1 -0
  165. package/dist/core/MemoryStore.d.mts +186 -0
  166. package/dist/core/MemoryStore.mjs +243 -0
  167. package/dist/core/MemoryStore.mjs.map +1 -0
  168. package/dist/core/Receipt.d.mts +2 -0
  169. package/dist/core/Receipt.mjs +36 -0
  170. package/dist/core/Receipt.mjs.map +1 -0
  171. package/dist/core/RememberingStore.d.mts +1562 -0
  172. package/dist/core/RememberingStore.mjs +190 -0
  173. package/dist/core/RememberingStore.mjs.map +1 -0
  174. package/dist/core/RunEvent.d.mts +2 -0
  175. package/dist/core/RunEvent.mjs +337 -0
  176. package/dist/core/RunEvent.mjs.map +1 -0
  177. package/dist/core/RunPolicyUsage.d.mts +2 -0
  178. package/dist/core/RunPolicyUsage.mjs +21 -0
  179. package/dist/core/RunPolicyUsage.mjs.map +1 -0
  180. package/dist/core/SemanticMemoryIndex.d.mts +826 -0
  181. package/dist/core/SemanticMemoryIndex.mjs +185 -0
  182. package/dist/core/SemanticMemoryIndex.mjs.map +1 -0
  183. package/dist/core/SemanticMemoryRevalidation.d.mts +45 -0
  184. package/dist/core/SemanticMemoryRevalidation.mjs +191 -0
  185. package/dist/core/SemanticMemoryRevalidation.mjs.map +1 -0
  186. package/dist/core/SubagentContract.d.mts +2 -0
  187. package/dist/core/SubagentContract.mjs +148 -0
  188. package/dist/core/SubagentContract.mjs.map +1 -0
  189. package/dist/core/Thread.d.mts +2 -0
  190. package/dist/core/Thread.mjs +250 -0
  191. package/dist/core/Thread.mjs.map +1 -0
  192. package/dist/core/ToolResult.d.mts +2 -0
  193. package/dist/core/ToolResult.mjs +156 -0
  194. package/dist/core/ToolResult.mjs.map +1 -0
  195. package/dist/core/Usage.d.mts +2 -0
  196. package/dist/core/Usage.mjs +319 -0
  197. package/dist/core/Usage.mjs.map +1 -0
  198. package/dist/core/Worker.d.mts +3 -0
  199. package/dist/core/Worker.mjs +3 -0
  200. package/dist/durable/ActivityStore.d.mts +116 -0
  201. package/dist/durable/ActivityStore.mjs +131 -0
  202. package/dist/durable/ActivityStore.mjs.map +1 -0
  203. package/dist/durable/Admin.d.mts +2 -0
  204. package/dist/durable/Admin.mjs +330 -0
  205. package/dist/durable/Admin.mjs.map +1 -0
  206. package/dist/durable/AgentRegistration.d.mts +2 -0
  207. package/dist/durable/AgentRegistration.mjs +14 -0
  208. package/dist/durable/AgentRegistration.mjs.map +1 -0
  209. package/dist/durable/Certification.d.mts +110 -0
  210. package/dist/durable/Certification.mjs +159 -0
  211. package/dist/durable/Certification.mjs.map +1 -0
  212. package/dist/durable/CommittedActivity.d.mts +62 -0
  213. package/dist/durable/CommittedActivity.mjs +159 -0
  214. package/dist/durable/CommittedActivity.mjs.map +1 -0
  215. package/dist/durable/Digest.d.mts +2 -0
  216. package/dist/durable/Digest.mjs +50 -0
  217. package/dist/durable/Digest.mjs.map +1 -0
  218. package/dist/durable/DurableAgentRuntime.d.mts +3 -0
  219. package/dist/durable/DurableAgentRuntime.mjs +3 -0
  220. package/dist/durable/DurableFailpoint.d.mts +2 -0
  221. package/dist/durable/DurableFailpoint.mjs +98 -0
  222. package/dist/durable/DurableFailpoint.mjs.map +1 -0
  223. package/dist/durable/DurableFailpointTestControl.d.mts +14 -0
  224. package/dist/durable/DurableFailpointTestControl.mjs +19 -0
  225. package/dist/durable/DurableFailpointTestControl.mjs.map +1 -0
  226. package/dist/durable/EventSource.d.mts +2 -0
  227. package/dist/durable/EventSource.mjs +65 -0
  228. package/dist/durable/EventSource.mjs.map +1 -0
  229. package/dist/durable/GitHubWorkflowSource.d.mts +185 -0
  230. package/dist/durable/GitHubWorkflowSource.mjs +209 -0
  231. package/dist/durable/GitHubWorkflowSource.mjs.map +1 -0
  232. package/dist/durable/MessageDelivery.d.mts +876 -0
  233. package/dist/durable/MessageDelivery.mjs +549 -0
  234. package/dist/durable/MessageDelivery.mjs.map +1 -0
  235. package/dist/durable/MessageDeliveryStoreConformance.d.mts +376 -0
  236. package/dist/durable/MessageDeliveryStoreConformance.mjs +270 -0
  237. package/dist/durable/MessageDeliveryStoreConformance.mjs.map +1 -0
  238. package/dist/durable/OperationAuthorizer.d.mts +2 -0
  239. package/dist/durable/OperationAuthorizer.mjs +70 -0
  240. package/dist/durable/OperationAuthorizer.mjs.map +1 -0
  241. package/dist/durable/PersistentHistory.d.mts +16 -0
  242. package/dist/durable/PersistentHistory.mjs +125 -0
  243. package/dist/durable/PersistentHistory.mjs.map +1 -0
  244. package/dist/durable/PreparedInputAdmission.d.mts +2 -0
  245. package/dist/durable/PreparedInputAdmission.mjs +38 -0
  246. package/dist/durable/PreparedInputAdmission.mjs.map +1 -0
  247. package/dist/durable/Records.d.mts +2 -0
  248. package/dist/durable/Records.mjs +841 -0
  249. package/dist/durable/Records.mjs.map +1 -0
  250. package/dist/durable/Recovery.d.mts +2 -0
  251. package/dist/durable/Recovery.mjs +739 -0
  252. package/dist/durable/Recovery.mjs.map +1 -0
  253. package/dist/durable/RunJournal.d.mts +2 -0
  254. package/dist/durable/RunJournal.mjs +2 -0
  255. package/dist/durable/Schedule.d.mts +2 -0
  256. package/dist/durable/Schedule.mjs +391 -0
  257. package/dist/durable/Schedule.mjs.map +1 -0
  258. package/dist/durable/ScheduleStoreConformance.d.mts +17 -0
  259. package/dist/durable/ScheduleStoreConformance.mjs +420 -0
  260. package/dist/durable/ScheduleStoreConformance.mjs.map +1 -0
  261. package/dist/durable/ScheduleTransition.d.mts +24 -0
  262. package/dist/durable/ScheduleTransition.mjs +180 -0
  263. package/dist/durable/ScheduleTransition.mjs.map +1 -0
  264. package/dist/durable/Scheduling.d.mts +54 -0
  265. package/dist/durable/Scheduling.mjs +2 -0
  266. package/dist/durable/SqlMemoryStore.d.mts +29 -0
  267. package/dist/durable/SqlMemoryStore.mjs +436 -0
  268. package/dist/durable/SqlMemoryStore.mjs.map +1 -0
  269. package/dist/durable/SqlMessageDeliveryStore.d.mts +42 -0
  270. package/dist/durable/SqlMessageDeliveryStore.mjs +173 -0
  271. package/dist/durable/SqlMessageDeliveryStore.mjs.map +1 -0
  272. package/dist/durable/SqlStorageV2Upgrade.d.mts +21 -0
  273. package/dist/durable/SqlStorageV2Upgrade.mjs +459 -0
  274. package/dist/durable/SqlStorageV2Upgrade.mjs.map +1 -0
  275. package/dist/durable/SqlSubscriptionStore.d.mts +62 -0
  276. package/dist/durable/SqlSubscriptionStore.mjs +751 -0
  277. package/dist/durable/SqlSubscriptionStore.mjs.map +1 -0
  278. package/dist/durable/SqlThreadNativeReads.d.mts +49 -0
  279. package/dist/durable/SqlThreadNativeReads.mjs +153 -0
  280. package/dist/durable/SqlThreadNativeReads.mjs.map +1 -0
  281. package/dist/durable/SubmissionLedger.d.mts +3 -0
  282. package/dist/durable/SubmissionLedger.mjs +918 -0
  283. package/dist/durable/SubmissionLedger.mjs.map +1 -0
  284. package/dist/durable/SubmissionLedgerConformance.d.mts +29 -0
  285. package/dist/durable/SubmissionLedgerConformance.mjs +1993 -0
  286. package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -0
  287. package/dist/durable/SubmissionStatus.d.mts +2 -0
  288. package/dist/durable/SubmissionStatus.mjs +18 -0
  289. package/dist/durable/SubmissionStatus.mjs.map +1 -0
  290. package/dist/durable/Subscription.d.mts +2 -0
  291. package/dist/durable/Subscription.mjs +360 -0
  292. package/dist/durable/Subscription.mjs.map +1 -0
  293. package/dist/durable/SubscriptionInput.d.mts +2 -0
  294. package/dist/durable/SubscriptionInput.mjs +52 -0
  295. package/dist/durable/SubscriptionInput.mjs.map +1 -0
  296. package/dist/durable/SubscriptionStoreConformance.d.mts +16 -0
  297. package/dist/durable/SubscriptionStoreConformance.mjs +625 -0
  298. package/dist/durable/SubscriptionStoreConformance.mjs.map +1 -0
  299. package/dist/durable/SubscriptionTools.d.mts +273 -0
  300. package/dist/durable/SubscriptionTools.mjs +190 -0
  301. package/dist/durable/SubscriptionTools.mjs.map +1 -0
  302. package/dist/durable/SubscriptionTransition.d.mts +21 -0
  303. package/dist/durable/SubscriptionTransition.mjs +148 -0
  304. package/dist/durable/SubscriptionTransition.mjs.map +1 -0
  305. package/dist/durable/Subscriptions.d.mts +73 -0
  306. package/dist/durable/Subscriptions.mjs +627 -0
  307. package/dist/durable/Subscriptions.mjs.map +1 -0
  308. package/dist/durable/ThreadContextHistory.d.mts +32 -0
  309. package/dist/durable/ThreadContextHistory.mjs +152 -0
  310. package/dist/durable/ThreadContextHistory.mjs.map +1 -0
  311. package/dist/durable/ThreadContextHistoryProjection.d.mts +60 -0
  312. package/dist/durable/ThreadContextHistoryProjection.mjs +149 -0
  313. package/dist/durable/ThreadContextHistoryProjection.mjs.map +1 -0
  314. package/dist/durable/ThreadInvariants.d.mts +76 -0
  315. package/dist/durable/ThreadInvariants.mjs +246 -0
  316. package/dist/durable/ThreadInvariants.mjs.map +1 -0
  317. package/dist/durable/ThreadProjection.d.mts +78 -0
  318. package/dist/durable/ThreadProjection.mjs +158 -0
  319. package/dist/durable/ThreadProjection.mjs.map +1 -0
  320. package/dist/durable/ThreadProjectionMaintenance.d.mts +49 -0
  321. package/dist/durable/ThreadProjectionMaintenance.mjs +33 -0
  322. package/dist/durable/ThreadProjectionMaintenance.mjs.map +1 -0
  323. package/dist/durable/ThreadStore.d.mts +2 -0
  324. package/dist/durable/ThreadStore.mjs +336 -0
  325. package/dist/durable/ThreadStore.mjs.map +1 -0
  326. package/dist/durable/ThreadStoreConformance.d.mts +28 -0
  327. package/dist/durable/ThreadStoreConformance.mjs +503 -0
  328. package/dist/durable/ThreadStoreConformance.mjs.map +1 -0
  329. package/dist/durable/ToolReconciler.d.mts +2 -0
  330. package/dist/durable/ToolReconciler.mjs +85 -0
  331. package/dist/durable/ToolReconciler.mjs.map +1 -0
  332. package/dist/durable/WakeScheduler.d.mts +2 -0
  333. package/dist/durable/WakeScheduler.mjs +85 -0
  334. package/dist/durable/WakeScheduler.mjs.map +1 -0
  335. package/dist/durable/WorkerHost.d.mts +129 -0
  336. package/dist/durable/WorkerHost.mjs +77 -0
  337. package/dist/durable/WorkerHost.mjs.map +1 -0
  338. package/dist/engine/AgentRuntime.d.mts +2 -0
  339. package/dist/engine/AgentRuntime.mjs +2 -0
  340. package/dist/engine/Compaction.d.mts +7 -0
  341. package/dist/engine/Compaction.mjs +16 -0
  342. package/dist/engine/Compaction.mjs.map +1 -0
  343. package/dist/engine/ContextCompactor.d.mts +2 -0
  344. package/dist/engine/ContextCompactor.mjs +119 -0
  345. package/dist/engine/ContextCompactor.mjs.map +1 -0
  346. package/dist/engine/ContextHistory.d.mts +65 -0
  347. package/dist/engine/ContextHistory.mjs +76 -0
  348. package/dist/engine/ContextHistory.mjs.map +1 -0
  349. package/dist/engine/ContextWindow.d.mts +2 -0
  350. package/dist/engine/ContextWindow.mjs +59 -0
  351. package/dist/engine/ContextWindow.mjs.map +1 -0
  352. package/dist/engine/DurableStep.d.mts +2 -0
  353. package/dist/engine/DurableStep.mjs +62 -0
  354. package/dist/engine/DurableStep.mjs.map +1 -0
  355. package/dist/engine/MessagingHost.d.mts +2 -0
  356. package/dist/engine/MessagingHost.mjs +2 -0
  357. package/dist/engine/Output.d.mts +2 -0
  358. package/dist/engine/Output.mjs +8 -0
  359. package/dist/engine/Output.mjs.map +1 -0
  360. package/dist/engine/RunEventSink.d.mts +2 -0
  361. package/dist/engine/RunEventSink.mjs +22 -0
  362. package/dist/engine/RunEventSink.mjs.map +1 -0
  363. package/dist/engine/RunOptions.d.mts +2 -0
  364. package/dist/engine/RunOptions.mjs +124 -0
  365. package/dist/engine/RunOptions.mjs.map +1 -0
  366. package/dist/engine/SubagentHost.d.mts +2 -0
  367. package/dist/engine/SubagentHost.mjs +72 -0
  368. package/dist/engine/SubagentHost.mjs.map +1 -0
  369. package/dist/engine/ThreadHistory.d.mts +2 -0
  370. package/dist/engine/ThreadHistory.mjs +67 -0
  371. package/dist/engine/ThreadHistory.mjs.map +1 -0
  372. package/dist/engine/ToolBroker.d.mts +2 -0
  373. package/dist/engine/ToolBroker.mjs +42 -0
  374. package/dist/engine/ToolBroker.mjs.map +1 -0
  375. package/dist/foreign-diagnostic-DBQ1XHKh.mjs +37 -0
  376. package/dist/foreign-diagnostic-DBQ1XHKh.mjs.map +1 -0
  377. package/dist/index.d.mts +91 -6
  378. package/dist/index.mjs +100 -6
  379. package/dist/output-contract-BC7tjlGw.mjs +84 -0
  380. package/dist/output-contract-BC7tjlGw.mjs.map +1 -0
  381. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  382. package/dist/sandbox/CodeExecutor.d.mts +194 -0
  383. package/dist/sandbox/CodeExecutor.mjs +278 -0
  384. package/dist/sandbox/CodeExecutor.mjs.map +1 -0
  385. package/dist/sandbox/InteractiveBrowser.d.mts +160 -0
  386. package/dist/sandbox/InteractiveBrowser.mjs +184 -0
  387. package/dist/sandbox/InteractiveBrowser.mjs.map +1 -0
  388. package/dist/sandbox/PageCapture.d.mts +2 -0
  389. package/dist/sandbox/PageCapture.mjs +450 -0
  390. package/dist/sandbox/PageCapture.mjs.map +1 -0
  391. package/dist/sandbox/PageCrawl.d.mts +88 -0
  392. package/dist/sandbox/PageCrawl.mjs +124 -0
  393. package/dist/sandbox/PageCrawl.mjs.map +1 -0
  394. package/dist/sandbox/PageScreenshot.d.mts +2 -0
  395. package/dist/sandbox/PageScreenshot.mjs +53 -0
  396. package/dist/sandbox/PageScreenshot.mjs.map +1 -0
  397. package/dist/sandbox/ProtectedBrowser.d.mts +273 -0
  398. package/dist/sandbox/ProtectedBrowser.mjs +287 -0
  399. package/dist/sandbox/ProtectedBrowser.mjs.map +1 -0
  400. package/dist/sandbox/Sandbox.d.mts +2 -0
  401. package/dist/sandbox/Sandbox.mjs +208 -0
  402. package/dist/sandbox/Sandbox.mjs.map +1 -0
  403. package/dist/utf8-BYfhEkcj.mjs +11 -0
  404. package/dist/utf8-BYfhEkcj.mjs.map +1 -0
  405. package/dist/utf8-DchGZRBd.mjs +23 -0
  406. package/dist/utf8-DchGZRBd.mjs.map +1 -0
  407. package/package.json +1 -40
  408. package/src/InMemory.ts +19 -0
  409. package/src/ToolExposure.ts +2 -0
  410. package/src/capabilities/Approval.ts +352 -0
  411. package/src/capabilities/Budget.ts +536 -0
  412. package/src/capabilities/CodeMode.ts +1090 -0
  413. package/src/capabilities/Commands.ts +86 -0
  414. package/src/capabilities/ContextTools.ts +184 -0
  415. package/src/capabilities/Mcp.ts +427 -0
  416. package/src/capabilities/McpClient.ts +967 -0
  417. package/src/capabilities/MemoryNotes.ts +174 -0
  418. package/src/capabilities/Messaging.ts +261 -0
  419. package/src/capabilities/ModelContext.ts +354 -0
  420. package/src/capabilities/Redaction.ts +157 -0
  421. package/src/capabilities/Remembering.ts +550 -0
  422. package/src/capabilities/RunHooks.ts +280 -0
  423. package/src/capabilities/SemanticMemory.ts +447 -0
  424. package/src/capabilities/Subagent.ts +2488 -0
  425. package/src/capabilities/SubagentReservations.ts +850 -0
  426. package/src/capabilities/ToolDiscovery.ts +369 -0
  427. package/src/capabilities/WebCapture.ts +722 -0
  428. package/src/capabilities/WebSearch.ts +190 -0
  429. package/src/capabilities/internal/subagent-background.ts +1246 -0
  430. package/src/capabilities/internal/subagent-contract.ts +146 -0
  431. package/src/capabilities/internal/subagent-policy.ts +235 -0
  432. package/src/capabilities/internal/subagent-reporting.ts +261 -0
  433. package/src/capabilities/internal/utf8.ts +10 -0
  434. package/src/core/Agent.ts +595 -0
  435. package/src/core/AgentError.ts +172 -0
  436. package/src/core/AgentPolicy.ts +153 -0
  437. package/src/core/AgentUpdates.ts +100 -0
  438. package/src/core/FailureDiagnostic.ts +343 -0
  439. package/src/core/IdGenerator.ts +39 -0
  440. package/src/core/Identifiers.ts +48 -0
  441. package/src/core/Memory.ts +290 -0
  442. package/src/core/MemoryNamespace.ts +196 -0
  443. package/src/core/MemoryReference.ts +121 -0
  444. package/src/core/MemoryRevalidation.ts +185 -0
  445. package/src/core/MemoryStore.ts +368 -0
  446. package/src/core/Messaging.ts +72 -0
  447. package/src/core/Receipt.ts +42 -0
  448. package/src/core/RememberingStore.ts +300 -0
  449. package/src/core/RunEvent.ts +366 -0
  450. package/src/core/RunPolicyUsage.ts +17 -0
  451. package/src/core/SemanticMemoryIndex.ts +250 -0
  452. package/src/core/SemanticMemoryRevalidation.ts +254 -0
  453. package/src/core/SubagentContract.ts +196 -0
  454. package/src/core/Thread.ts +371 -0
  455. package/src/core/ToolExposure.ts +74 -0
  456. package/src/core/ToolResult.ts +190 -0
  457. package/src/core/Usage.ts +529 -0
  458. package/src/core/Worker.ts +184 -0
  459. package/src/core/internal/agent-updates.ts +34 -0
  460. package/src/core/internal/message-status.ts +60 -0
  461. package/src/core/internal/strict-schema.ts +14 -0
  462. package/src/core/internal/utf8.ts +23 -0
  463. package/src/durable/ActivityStore.ts +160 -0
  464. package/src/durable/Admin.ts +505 -0
  465. package/src/durable/AgentRegistration.ts +14 -0
  466. package/src/durable/Certification.ts +210 -0
  467. package/src/durable/CommittedActivity.ts +296 -0
  468. package/src/durable/Digest.ts +87 -0
  469. package/src/durable/DurableAgentRuntime.ts +10950 -0
  470. package/src/durable/DurableFailpoint.ts +107 -0
  471. package/src/durable/DurableFailpointTestControl.ts +39 -0
  472. package/src/durable/EventSource.ts +172 -0
  473. package/src/durable/GitHubWorkflowSource.ts +447 -0
  474. package/src/durable/MessageDelivery.ts +817 -0
  475. package/src/durable/MessageDeliveryStoreConformance.ts +410 -0
  476. package/src/durable/OperationAuthorizer.ts +85 -0
  477. package/src/durable/PersistentHistory.ts +260 -0
  478. package/src/durable/PreparedInputAdmission.ts +57 -0
  479. package/src/durable/Records.ts +1065 -0
  480. package/src/durable/Recovery.ts +1018 -0
  481. package/src/durable/RunJournal.ts +1631 -0
  482. package/src/durable/Schedule.ts +513 -0
  483. package/src/durable/ScheduleStoreConformance.ts +638 -0
  484. package/src/durable/ScheduleTransition.ts +265 -0
  485. package/src/durable/Scheduling.ts +1077 -0
  486. package/src/durable/SqlMemoryStore.ts +778 -0
  487. package/src/durable/SqlMessageDeliveryStore.ts +321 -0
  488. package/src/durable/SqlStorageV2Upgrade.ts +500 -0
  489. package/src/durable/SqlSubscriptionStore.ts +1440 -0
  490. package/src/durable/SqlThreadNativeReads.ts +256 -0
  491. package/src/durable/SubmissionLedger.ts +1205 -0
  492. package/src/durable/SubmissionLedgerConformance.ts +4590 -0
  493. package/src/durable/SubmissionStatus.ts +14 -0
  494. package/src/durable/Subscription.ts +544 -0
  495. package/src/durable/SubscriptionInput.ts +144 -0
  496. package/src/durable/SubscriptionStoreConformance.ts +945 -0
  497. package/src/durable/SubscriptionTools.ts +327 -0
  498. package/src/durable/SubscriptionTransition.ts +302 -0
  499. package/src/durable/Subscriptions.ts +1210 -0
  500. package/src/durable/ThreadContextHistory.ts +227 -0
  501. package/src/durable/ThreadContextHistoryProjection.ts +216 -0
  502. package/src/durable/ThreadInvariants.ts +507 -0
  503. package/src/durable/ThreadProjection.ts +269 -0
  504. package/src/durable/ThreadProjectionMaintenance.ts +67 -0
  505. package/src/durable/ThreadStore.ts +552 -0
  506. package/src/durable/ThreadStoreConformance.ts +1156 -0
  507. package/src/durable/ToolReconciler.ts +109 -0
  508. package/src/durable/WakeScheduler.ts +134 -0
  509. package/src/durable/WorkerHost.ts +171 -0
  510. package/src/durable/internal/agent-registration.ts +621 -0
  511. package/src/durable/internal/agent-updates.ts +302 -0
  512. package/src/durable/internal/foreign-diagnostic.ts +47 -0
  513. package/src/durable/internal/journal-checkpoint.ts +104 -0
  514. package/src/durable/internal/journal-metadata.ts +117 -0
  515. package/src/durable/internal/message-status.ts +20 -0
  516. package/src/durable/internal/messaging-host.ts +637 -0
  517. package/src/durable/internal/schedule-time.ts +303 -0
  518. package/src/durable/internal/storage-v2-layout.ts +163 -0
  519. package/src/durable/internal/storage-v2.ts +73 -0
  520. package/src/durable/internal/worker-host.ts +2678 -0
  521. package/src/durable/internal/worker-runtime.ts +9 -0
  522. package/src/engine/AgentRuntime.ts +37 -0
  523. package/src/engine/Compaction.ts +11 -0
  524. package/src/engine/ContextCompactor.ts +277 -0
  525. package/src/engine/ContextHistory.ts +73 -0
  526. package/src/engine/ContextWindow.ts +72 -0
  527. package/src/engine/DurableStep.ts +132 -0
  528. package/src/engine/MessagingHost.ts +110 -0
  529. package/src/engine/Output.ts +2 -0
  530. package/src/engine/RunEventSink.ts +132 -0
  531. package/src/engine/RunOptions.ts +1101 -0
  532. package/src/engine/SubagentHost.ts +193 -0
  533. package/src/engine/ThreadHistory.ts +120 -0
  534. package/src/engine/ToolBroker.ts +157 -0
  535. package/src/engine/ToolExposure.ts +48 -0
  536. package/src/engine/internal/agent-runtime.ts +10485 -0
  537. package/src/engine/internal/bounded-value.ts +315 -0
  538. package/src/engine/internal/compaction.ts +678 -0
  539. package/src/engine/internal/error-diagnostic.ts +39 -0
  540. package/src/engine/internal/output-contract.ts +173 -0
  541. package/src/engine/internal/primitive-delta.ts +80 -0
  542. package/src/engine/internal/provider-result-staging.ts +211 -0
  543. package/src/engine/internal/tool-derivative.ts +106 -0
  544. package/src/engine/internal/tool-exposure.ts +224 -0
  545. package/src/engine/internal/tool-telemetry.ts +484 -0
  546. package/src/index.ts +99 -21
  547. package/src/sandbox/CodeExecutor.ts +352 -0
  548. package/src/sandbox/InteractiveBrowser.ts +290 -0
  549. package/src/sandbox/PageCapture.ts +691 -0
  550. package/src/sandbox/PageCrawl.ts +148 -0
  551. package/src/sandbox/PageScreenshot.ts +81 -0
  552. package/src/sandbox/ProtectedBrowser.ts +436 -0
  553. package/src/sandbox/Sandbox.ts +241 -0
@@ -0,0 +1,41 @@
1
+ import { Context, Effect, Layer, Schema } from "effect";
2
+ declare namespace DurableFailpoint_d_exports {
3
+ export { DurableRuntimeFailpoint, DurableRuntimeFailpointError, DurableRuntimeFailpointHandler, DurableRuntimeFailpointLocation };
4
+ }
5
+ /**
6
+ * Coordinator-owned failpoint locations (plan §Failpoints). Locations normally sit immediately
7
+ * AFTER one durable mutation of the six-step coordinator flow, so a fault injected there
8
+ * simulates a crash between two durable steps; the matching BEFORE boundary of each mutation is
9
+ * owned by the storage adapters (`ledger:*:before`, `append:before`, ...), giving every durable
10
+ * mutation a failpoint on both sides (change discipline). Run-start append also exposes its
11
+ * BEFORE boundary here to distinguish a fresh clock from a committed clock in crash tests.
12
+ *
13
+ * The `subagent:*` family covers every durable mutation of the S2 establishment/join protocol
14
+ * including reservation, request append, child admission, child readiness,
15
+ * start-link append, sibling per-call settles at the suspension seam, the `waitingForChild`
16
+ * suspension, child abort propagation, the atomic join batch, and both reservation-release
17
+ * transitions.
18
+ */
19
+ declare const DurableRuntimeFailpointLocation: Schema.Literals<readonly ["submit:after-admit", "submit:after-materialize", "claim:after-claim", "input:after-canonical-append", "run:before-start-append", "run:after-start-append", "run:before-duration-append", "run:after-duration-append", "turn:after-canonical-append", "turn:after-response-append", "turn:after-results-append", "compaction:before-canonical-append", "compaction:after-canonical-append", "checkpoint:before-save", "checkpoint:after-save", "tools:after-prepared-append", "tools:before-prepared-append", "tools:before-unavailable-append", "tools:after-unavailable-append", "policy:before-reservation-append", "policy:after-reservation-append", "step:after-step-append", "approval:after-request-append", "approval:after-suspend", "join:after-claim", "join:after-canonical-append", "resolve:after-intent", "terminalize:after-reserve", "terminalize:after-canonical-append", "abort:after-intent", "subagent:after-reserve", "subagent:after-request-append", "subagent:after-admit", "subagent:after-child-ready", "subagent:after-start-append", "subagent:after-sibling-settle", "subagent:after-suspend", "subagent:after-child-abort-intent", "subagent:before-join-append", "subagent:after-join-append", "subagent:after-release-pending", "subagent:after-release", "worker:before-source-append", "worker:after-source-append", "worker:before-origin-append", "worker:after-origin-append", "worker:before-completion-append", "worker:after-completion-append", "worker:before-subtree-append", "worker:after-subtree-append", "worker:before-report-append", "worker:after-report-append", "worker:before-report-delivery", "worker:after-report-delivery", "update:before-canonical-append", "update:after-canonical-append", "update:before-delivery-insert", "update:after-delivery-insert"]>;
20
+ type DurableRuntimeFailpointLocation = typeof DurableRuntimeFailpointLocation.Type;
21
+ declare const DurableRuntimeFailpointError_base: Schema.Class<DurableRuntimeFailpointError, Schema.TaggedStruct<"DurableRuntimeFailpointError", {
22
+ readonly location: Schema.Literals<readonly ["submit:after-admit", "submit:after-materialize", "claim:after-claim", "input:after-canonical-append", "run:before-start-append", "run:after-start-append", "run:before-duration-append", "run:after-duration-append", "turn:after-canonical-append", "turn:after-response-append", "turn:after-results-append", "compaction:before-canonical-append", "compaction:after-canonical-append", "checkpoint:before-save", "checkpoint:after-save", "tools:after-prepared-append", "tools:before-prepared-append", "tools:before-unavailable-append", "tools:after-unavailable-append", "policy:before-reservation-append", "policy:after-reservation-append", "step:after-step-append", "approval:after-request-append", "approval:after-suspend", "join:after-claim", "join:after-canonical-append", "resolve:after-intent", "terminalize:after-reserve", "terminalize:after-canonical-append", "abort:after-intent", "subagent:after-reserve", "subagent:after-request-append", "subagent:after-admit", "subagent:after-child-ready", "subagent:after-start-append", "subagent:after-sibling-settle", "subagent:after-suspend", "subagent:after-child-abort-intent", "subagent:before-join-append", "subagent:after-join-append", "subagent:after-release-pending", "subagent:after-release", "worker:before-source-append", "worker:after-source-append", "worker:before-origin-append", "worker:after-origin-append", "worker:before-completion-append", "worker:after-completion-append", "worker:before-subtree-append", "worker:after-subtree-append", "worker:before-report-append", "worker:after-report-append", "worker:before-report-delivery", "worker:after-report-delivery", "update:before-canonical-append", "update:after-canonical-append", "update:before-delivery-insert", "update:after-delivery-insert"]>;
23
+ }>, import("effect/Cause").YieldableError>;
24
+ /** Injected coordinator fault. Reaching the caller means the preceding durable step committed. */
25
+ declare class DurableRuntimeFailpointError extends DurableRuntimeFailpointError_base {}
26
+ type DurableRuntimeFailpointHandler = (location: DurableRuntimeFailpointLocation) => Effect.Effect<void, DurableRuntimeFailpointError>;
27
+ declare const DurableRuntimeFailpoint_base: Context.ServiceClass<DurableRuntimeFailpoint, "@effect-agent/thread/DurableRuntimeFailpoint", {
28
+ readonly hit: DurableRuntimeFailpointHandler;
29
+ }>;
30
+ /**
31
+ * Explicit fault-injection authority used at durable coordinator step boundaries. The process
32
+ * crash harness (WP5) maps a hit to `process.exit`; in-process tests fail the step with the
33
+ * typed `DurableRuntimeFailpointError` instead.
34
+ */
35
+ declare class DurableRuntimeFailpoint extends DurableRuntimeFailpoint_base {
36
+ /** Production default: no fault injection. */
37
+ static readonly layer: Layer.Layer<DurableRuntimeFailpoint, never, never>;
38
+ }
39
+ //#endregion
40
+ export { DurableRuntimeFailpointLocation as a, DurableRuntimeFailpointHandler as i, DurableRuntimeFailpoint as n, DurableRuntimeFailpointError as r, DurableFailpoint_d_exports as t };
41
+ //# sourceMappingURL=DurableFailpoint-mx3-nsxU.d.mts.map
@@ -0,0 +1,103 @@
1
+ import { d as ToolCallId } from "./Identifiers-CN2s30fF.mjs";
2
+ import { Tool } from "effect/unstable/ai";
3
+ import { Context, Effect, Option, Schema } from "effect";
4
+ declare namespace DurableStep_d_exports {
5
+ export { DurableStep, DurableStepError, DurableStepService, PersistedStepResult, RunStepHook, RunStepKey, ToolExecutionClass, ToolExecutionClassValue, getToolExecutionClass };
6
+ }
7
+ /**
8
+ * Declared external execution class of one Tool, used by the durable runtime
9
+ * to decide which Tool Calls need the prepared/settled uncertainty protocol:
10
+ *
11
+ * - `"readonly"`: the handler performs no external mutation. A crash between
12
+ * start and settlement is a free re-run; no prepared record is written.
13
+ * - `"idempotent"`: the handler declares an external idempotency contract
14
+ * (it owns key derivation). Prepared/settled records are written and
15
+ * recovery may re-execute without reconciliation proof.
16
+ * - `"uncertain"`: no external contract is declared. Prepared/settled records
17
+ * are written and recovery must reconcile or record an Unknown Outcome.
18
+ */
19
+ type ToolExecutionClassValue = "readonly" | "idempotent" | "uncertain";
20
+ /**
21
+ * Effect AI Tool annotation key declaring a Tool's execution class, applied
22
+ * with `Tool.annotate(ToolExecutionClass, "...")`.
23
+ *
24
+ * Unannotated Tools default to `"uncertain"`: security and durability
25
+ * decisions are fail-closed, so the framework never infers a safer class
26
+ * from a Tool's shape.
27
+ */
28
+ declare const ToolExecutionClass: Context.Reference<ToolExecutionClassValue>;
29
+ /** Read a Tool's declared execution class, falling back to the fail-closed `"uncertain"` default. */
30
+ declare const getToolExecutionClass: (tool: Tool.Any) => ToolExecutionClassValue;
31
+ /** Stable identity of one Step within one Tool Call: `(toolCallId, stepName)`. */
32
+ interface RunStepKey {
33
+ readonly toolCallId: ToolCallId;
34
+ readonly stepName: string;
35
+ }
36
+ /** A previously committed Step result in its canonical encoded form. */
37
+ interface PersistedStepResult {
38
+ readonly encodedOutput: unknown;
39
+ }
40
+ /**
41
+ * Dependency-neutral Step persistence seam implemented by a durable
42
+ * coordinator and consumed by the engine-provided `DurableStep` service.
43
+ *
44
+ * `lookup` returns the committed result for a Step identity when one exists;
45
+ * `commit` durably records one successful encoded output. Only success is
46
+ * ever committed — recording failures would replay a transient failure
47
+ * forever. Both operations are keyed by the deterministic `RunStepKey`, so
48
+ * replays and racing writers dedupe on record identity in the adapter.
49
+ */
50
+ interface RunStepHook<Error = never, Requirements = never> {
51
+ readonly lookup: (key: RunStepKey) => Effect.Effect<Option.Option<PersistedStepResult>, Error, Requirements>;
52
+ readonly commit: (key: RunStepKey, encodedOutput: unknown) => Effect.Effect<void, Error, Requirements>;
53
+ }
54
+ declare const DurableStepError_base: Schema.Class<DurableStepError, Schema.TaggedStruct<"DurableStepError", {
55
+ readonly stepName: Schema.String;
56
+ readonly reason: Schema.Literals<readonly ["duplicate-step-name", "lookup-failed", "recorded-result-invalid", "output-encoding-failed", "commit-failed", "no-active-tool-call"]>;
57
+ readonly message: Schema.String;
58
+ readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">>;
59
+ /** Diagnostic cause for the live Effect only; Run events retain the fixed public message. */
60
+ readonly cause: Schema.optionalKey<Schema.Defect>;
61
+ }>, import("effect/Cause").YieldableError>;
62
+ /**
63
+ * Typed failure of one `DurableStep.do` call.
64
+ *
65
+ * `duplicate-step-name` is an identity conflict: Step names must be
66
+ * deterministic and unique within one Tool Call, and reuse would silently
67
+ * replay another Step's recorded result. `recorded-result-invalid` is the
68
+ * replay-with-different-content conflict: a committed result that no longer
69
+ * decodes through the declared output Schema is never silently accepted.
70
+ */
71
+ declare class DurableStepError extends DurableStepError_base {}
72
+ /**
73
+ * Service value provided locally by the engine to each Tool Call's handler.
74
+ *
75
+ * `do` runs one named Step with exactly-once-recorded, at-least-once-executed
76
+ * semantics: a committed result decodes through `output` and returns without
77
+ * executing the body; otherwise the body runs (a crash mid-body re-executes
78
+ * on the next Attempt), the success is encoded through `output`, and only
79
+ * then committed. The Schema argument is the canonical codec for the recorded
80
+ * result, not decoration. A Step never makes a non-idempotent external API
81
+ * exactly-once — the body must use the external system's idempotency key,
82
+ * reconciliation API, or compensating workflow.
83
+ */
84
+ interface DurableStepService {
85
+ readonly do: <Output extends Schema.Top, BodyError, BodyServices>(name: string, output: Output, execute: Effect.Effect<Output["Type"], BodyError, BodyServices>) => Effect.Effect<Output["Type"], DurableStepError | BodyError, BodyServices | Output["DecodingServices"] | Output["EncodingServices"]>;
86
+ }
87
+ declare const DurableStep_base: Context.ServiceClass<DurableStep, "@effect-agent/engine/DurableStep", DurableStepService>;
88
+ /**
89
+ * Engine-owned Durable Step seam.
90
+ *
91
+ * Declaring this service in `Tool.make({ dependencies: [DurableStep] })` is
92
+ * what makes a Tool a Durable Tool: its handler divides external effects into
93
+ * named Steps and may be re-entered after interruption. The engine provides
94
+ * the service locally to every Tool Call, bound to that call's identity; it
95
+ * is never satisfied from an application Layer and is excluded from the
96
+ * runtime's public requirements. Without a durable runtime the engine
97
+ * provides an ephemeral pass-through that executes each Step once and
98
+ * records nothing — the durable claim attaches to the runtime, not the Tool.
99
+ */
100
+ declare class DurableStep extends DurableStep_base {}
101
+ //#endregion
102
+ export { PersistedStepResult as a, ToolExecutionClass as c, DurableStep_d_exports as i, ToolExecutionClassValue as l, DurableStepError as n, RunStepHook as o, DurableStepService as r, RunStepKey as s, DurableStep as t, getToolExecutionClass as u };
103
+ //# sourceMappingURL=DurableStep-Cry_iol4.d.mts.map
@@ -0,0 +1,51 @@
1
+ import { O as PersistedJson } from "./Records-4qnRmniE.mjs";
2
+ import { E as SubscriptionSourceError, b as SubscriptionRecord, i as EventSourceVersion, t as AcceptedEvent } from "./Subscription-pQUv0QD6.mjs";
3
+ import { Context, Effect, Schema, Scope } from "effect";
4
+ declare namespace EventSource_d_exports {
5
+ export { EventSource, EventSources, NormalizedEvent, makeEventSource };
6
+ }
7
+ interface NormalizedEvent {
8
+ readonly eventId: string;
9
+ readonly occurredAtMillis?: number;
10
+ readonly matchingKey: string;
11
+ readonly payload: PersistedJson;
12
+ }
13
+ /** Runtime-only versioned behavior. Never persist this object or silently replace its version. */
14
+ interface EventSource {
15
+ readonly source: EventSourceVersion;
16
+ readonly continuity: string;
17
+ readonly parameters: (value: unknown) => Effect.Effect<{
18
+ readonly parameters: PersistedJson;
19
+ readonly matchingKey: string;
20
+ }, SubscriptionSourceError>;
21
+ readonly normalize: (value: unknown) => Effect.Effect<NormalizedEvent, SubscriptionSourceError>;
22
+ readonly matches: (event: AcceptedEvent, subscription: SubscriptionRecord) => Effect.Effect<boolean, SubscriptionSourceError>;
23
+ readonly reconcile?: (subscription: SubscriptionRecord) => Effect.Effect<NormalizedEvent | null, SubscriptionSourceError>;
24
+ }
25
+ declare const EventSources_base: Context.ServiceClass<EventSources, "@effect-agent/thread/EventSources", {
26
+ readonly sources: ReadonlyArray<EventSource>;
27
+ }>;
28
+ declare class EventSources extends EventSources_base {}
29
+ /**
30
+ * Capture the source's explicit Effect dependencies at host assembly. Matching and key functions
31
+ * must be pure and bounded under this exact semantic version.
32
+ * The returned source accepts Schema-encoded values at intake and management boundaries.
33
+ * Each operation owns a fresh Scope for its callbacks and codecs; captured host services
34
+ * retain their host lifetime. Operation resources finalize on success, failure, or interruption.
35
+ */
36
+ declare const makeEventSource: <Event extends Schema.Top, Parameters extends Schema.Top, R = never>(options: {
37
+ readonly source: EventSourceVersion;
38
+ readonly continuity: string;
39
+ readonly event: Event;
40
+ readonly parameters: Parameters;
41
+ readonly identity: (event: Event["Type"]) => string;
42
+ /** Authenticated source time, stable across delivery retries; required for bounded retention. */
43
+ readonly occurredAtMillis?: (event: Event["Type"]) => number | undefined;
44
+ readonly eventKey: (event: Event["Type"]) => string;
45
+ readonly parameterKey: (parameters: Parameters["Type"]) => string;
46
+ readonly matches: (event: Event["Type"], parameters: Parameters["Type"]) => boolean;
47
+ readonly reconcile?: (parameters: Parameters["Type"]) => Effect.Effect<Event["Type"] | null, SubscriptionSourceError, R>;
48
+ }) => Effect.Effect<EventSource, never, Exclude<R, Scope.Scope> | Exclude<Event["DecodingServices"], Scope.Scope> | Exclude<Event["EncodingServices"], Scope.Scope> | Exclude<Parameters["DecodingServices"], Scope.Scope> | Exclude<Parameters["EncodingServices"], Scope.Scope>>;
49
+ //#endregion
50
+ export { makeEventSource as a, NormalizedEvent as i, EventSource_d_exports as n, EventSources as r, EventSource as t };
51
+ //# sourceMappingURL=EventSource-BUYLmL77.d.mts.map
@@ -0,0 +1,274 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Cause, Exit, Predicate, Redacted, Schema, SchemaParser, SchemaTransformation } from "effect";
3
+ //#region src/core/internal/strict-schema.ts
4
+ /** Keep strict parsing on nested values even when an outer parser uses its defaults. */
5
+ const strictSchema = (schema) => Schema.declareConstructor()([schema], ([codec]) => (value, _ast, options) => SchemaParser.decodeUnknownEffect(codec)(value, {
6
+ ...options,
7
+ onExcessProperty: "error"
8
+ }), { toCodecJson: ([codec]) => Schema.link()(codec, SchemaTransformation.passthrough()) });
9
+ //#endregion
10
+ //#region src/core/FailureDiagnostic.ts
11
+ var FailureDiagnostic_exports = /* @__PURE__ */ __exportAll({
12
+ Cause: () => Cause$1,
13
+ Context: () => Context$1,
14
+ Diagnostic: () => Diagnostic,
15
+ Failure: () => Failure,
16
+ Value: () => Value,
17
+ capture: () => capture,
18
+ captureContext: () => captureContext,
19
+ redactText: () => redactText
20
+ });
21
+ const Text = Schema.String.check(Schema.isMaxLength(16384));
22
+ const Name = Schema.String.check(Schema.isMaxLength(1024));
23
+ const Scalar = Schema.Union([
24
+ Text,
25
+ Schema.Finite,
26
+ Schema.Boolean,
27
+ Schema.Null
28
+ ]);
29
+ /** Correlation only: never include inputs, tool parameters, request bodies, or credentials. */
30
+ const Context$1 = Schema.Struct({
31
+ agentId: Schema.optionalKey(Name),
32
+ threadId: Schema.optionalKey(Name),
33
+ runId: Schema.optionalKey(Name),
34
+ submissionId: Schema.optionalKey(Name),
35
+ attemptId: Schema.optionalKey(Name),
36
+ turnId: Schema.optionalKey(Name),
37
+ toolCallId: Schema.optionalKey(Name),
38
+ toolName: Schema.optionalKey(Name),
39
+ callId: Schema.optionalKey(Name),
40
+ check: Schema.optionalKey(Name),
41
+ operation: Schema.optionalKey(Name)
42
+ }).pipe(strictSchema);
43
+ const diagnosticSchema = (nested) => Schema.Union([
44
+ Schema.Struct({
45
+ _tag: Schema.Literal("Error"),
46
+ errorTag: Schema.optionalKey(Name),
47
+ name: Schema.optionalKey(Name),
48
+ message: Schema.optionalKey(Text),
49
+ stack: Schema.optionalKey(Text),
50
+ reason: Schema.optionalKey(nested),
51
+ code: Schema.optionalKey(Schema.Union([Name, Schema.Finite])),
52
+ cause: Schema.optionalKey(nested),
53
+ errors: Schema.optionalKey(Schema.Array(nested).check(Schema.isMaxLength(128))),
54
+ context: Schema.optionalKey(Context$1),
55
+ omittedFields: Schema.optionalKey(Schema.Array(Name).check(Schema.isMaxLength(32))),
56
+ truncated: Schema.optionalKey(Schema.Literal(true))
57
+ }),
58
+ Schema.Struct({
59
+ _tag: Schema.Literal("Cause"),
60
+ reasons: Schema.Array(Schema.Union([
61
+ Schema.Struct({
62
+ _tag: Schema.Literal("Fail"),
63
+ error: nested
64
+ }),
65
+ Schema.Struct({
66
+ _tag: Schema.Literal("Die"),
67
+ defect: nested
68
+ }),
69
+ Schema.Struct({
70
+ _tag: Schema.Literal("Interrupt"),
71
+ fiberId: Schema.optionalKey(Schema.Finite)
72
+ })
73
+ ])).check(Schema.isMaxLength(128)),
74
+ truncated: Schema.optionalKey(Schema.Literal(true))
75
+ }),
76
+ Schema.Struct({
77
+ _tag: Schema.Literal("Value"),
78
+ value: Scalar
79
+ }),
80
+ Schema.Struct({
81
+ _tag: Schema.Literal("Omitted"),
82
+ reason: Schema.Literals([
83
+ "redacted",
84
+ "cycle",
85
+ "limit",
86
+ "unsupported"
87
+ ])
88
+ })
89
+ ]);
90
+ /** Structured, allowlisted Error fields and ordered Effect Fail/Die/Interrupt reasons. */
91
+ const Diagnostic = Schema.suspend(() => diagnosticSchema(Diagnostic)).pipe(strictSchema);
92
+ const decodeDiagnosticNode = Schema.decodeUnknownExit(diagnosticSchema(Schema.Unknown).pipe(strictSchema));
93
+ /** Remove common credential forms; hosts must keep arbitrary private payloads out of error text. */
94
+ const redactText = (text) => text.replace(/\b(Bearer|Basic)\s+[A-Za-z0-9._~+/=-]+/gi, "$1 [REDACTED]").replace(/(https?:\/\/)[^\s/@]+:[^\s/@]+@/gi, "$1[REDACTED]@").replace(/([?&](?:access_token|api_key|apikey|token|key|secret|password|signature)=)[^\s&#]*/gi, "$1[REDACTED]").replace(/\b((?:api[_-]?key|access[_-]?token|authorization|password|secret)\s*[=:]\s*)[^\s,;}]+/gi, "$1[REDACTED]");
95
+ /**
96
+ * Capture only diagnostic fields. Local values are never mutated. Cycles and exhausted limits
97
+ * are explicit, not silently dropped; capture visits at most 1,024 nodes, with 56 JSON levels
98
+ * and 128 KiB text. Inner causes have priority over outer stacks when the text budget is exhausted.
99
+ * Text remains operator-private. No generic serializer can identify secrets embedded in arbitrary
100
+ * prose: application error messages must exclude payloads, and hosts may supply stricter redaction.
101
+ */
102
+ const capture = (value, options) => {
103
+ const seen = /* @__PURE__ */ new WeakSet();
104
+ let remainingNodes = 1024;
105
+ let remainingText = 131072;
106
+ const text = (value, limit = 16384) => {
107
+ const safe = (options?.redactText ?? redactText)(value);
108
+ const length = Math.max(0, Math.min(limit, remainingText));
109
+ const marker = "[truncated]".slice(0, length);
110
+ const result = safe.length <= length ? safe : `${safe.slice(0, length - marker.length)}${marker}`;
111
+ remainingText -= result.length;
112
+ return result;
113
+ };
114
+ const visit = (value, depth) => {
115
+ if (remainingNodes <= 0 || depth >= 56) return {
116
+ _tag: "Omitted",
117
+ reason: "limit"
118
+ };
119
+ remainingNodes--;
120
+ if (Redacted.isRedacted(value)) return {
121
+ _tag: "Omitted",
122
+ reason: "redacted"
123
+ };
124
+ if (Predicate.isString(value)) return {
125
+ _tag: "Value",
126
+ value: text(value)
127
+ };
128
+ if (value === null || Predicate.isBoolean(value) || Predicate.isNumber(value) && Number.isFinite(value)) return {
129
+ _tag: "Value",
130
+ value
131
+ };
132
+ if (!Predicate.isObject(value)) return {
133
+ _tag: "Omitted",
134
+ reason: "unsupported"
135
+ };
136
+ if (seen.has(value)) return {
137
+ _tag: "Omitted",
138
+ reason: "cycle"
139
+ };
140
+ seen.add(value);
141
+ const nested = (value) => visit(value, depth + 1);
142
+ const decoded = value instanceof Error ? void 0 : decodeDiagnosticNode(value);
143
+ const node = decoded !== void 0 && Exit.isSuccess(decoded) ? decoded.value : void 0;
144
+ if (node?._tag === "Omitted" || node?._tag === "Value") {
145
+ seen.delete(value);
146
+ return node._tag === "Value" && typeof node.value === "string" ? {
147
+ _tag: "Value",
148
+ value: text(node.value)
149
+ } : node;
150
+ }
151
+ const originalReasons = Cause.isCause(value) ? value.reasons : node?._tag === "Cause" ? node.reasons : void 0;
152
+ if (originalReasons !== void 0) {
153
+ const reasons = [];
154
+ for (const reason of originalReasons) {
155
+ if (reasons.length >= 128 || remainingNodes <= 0) break;
156
+ remainingNodes--;
157
+ switch (reason._tag) {
158
+ case "Fail":
159
+ reasons.push({
160
+ _tag: "Fail",
161
+ error: visit(reason.error, depth + 3)
162
+ });
163
+ break;
164
+ case "Die":
165
+ reasons.push({
166
+ _tag: "Die",
167
+ defect: visit(reason.defect, depth + 3)
168
+ });
169
+ break;
170
+ case "Interrupt": reasons.push({
171
+ _tag: "Interrupt",
172
+ ...reason.fiberId === void 0 ? {} : { fiberId: reason.fiberId }
173
+ });
174
+ }
175
+ }
176
+ const result = {
177
+ _tag: "Cause",
178
+ ...originalReasons.length > reasons.length || node?._tag === "Cause" && node.truncated ? { truncated: true } : {},
179
+ reasons
180
+ };
181
+ seen.delete(value);
182
+ return result;
183
+ }
184
+ const retained = node?._tag === "Error" ? node : void 0;
185
+ const omittedFields = [];
186
+ const read = (key) => {
187
+ try {
188
+ return Reflect.get(value, key);
189
+ } catch {
190
+ omittedFields.push(key);
191
+ return;
192
+ }
193
+ };
194
+ const tag = retained === void 0 ? read("_tag") : retained.errorTag;
195
+ const name = read("name");
196
+ const message = read("message");
197
+ const stack = read("stack");
198
+ const reason = read("reason");
199
+ const code = read("code");
200
+ const cause = read("cause");
201
+ const errors = read("errors");
202
+ const capturedCause = cause === void 0 ? void 0 : nested(cause);
203
+ const capturedReason = reason === void 0 ? void 0 : nested(reason);
204
+ const capturedErrors = [];
205
+ if (Array.isArray(errors)) for (const error of errors) {
206
+ if (capturedErrors.length >= 128 || remainingNodes <= 0) break;
207
+ capturedErrors.push(visit(error, depth + 2));
208
+ }
209
+ for (const field of retained?.omittedFields ?? []) omittedFields.push(text(field, 1024));
210
+ const context = {};
211
+ for (const key of [
212
+ "agentId",
213
+ "threadId",
214
+ "runId",
215
+ "submissionId",
216
+ "attemptId",
217
+ "turnId",
218
+ "toolCallId",
219
+ "toolName",
220
+ "callId",
221
+ "check",
222
+ "operation"
223
+ ]) {
224
+ const field = retained === void 0 ? read(key) : retained.context?.[key];
225
+ if (Predicate.isString(field)) context[key] = text(field, 1024);
226
+ }
227
+ const result = {
228
+ _tag: "Error",
229
+ ...Predicate.isString(tag) ? { errorTag: text(tag, 1024) } : {},
230
+ ...Predicate.isString(name) ? { name: text(name, 1024) } : {},
231
+ ...Predicate.isString(message) ? { message: text(message) } : {},
232
+ ...Predicate.isString(stack) ? { stack: text(stack) } : {},
233
+ ...capturedReason === void 0 ? {} : { reason: capturedReason },
234
+ ...Predicate.isString(code) ? { code: text(code, 1024) } : Predicate.isNumber(code) && Number.isFinite(code) ? { code } : {},
235
+ ...capturedCause === void 0 ? {} : { cause: capturedCause },
236
+ ...Array.isArray(errors) ? { errors: capturedErrors } : {},
237
+ ...Object.keys(context).length === 0 ? {} : { context },
238
+ ...omittedFields.length === 0 ? {} : { omittedFields },
239
+ ...retained?.truncated || Array.isArray(errors) && errors.length > capturedErrors.length || remainingText === 0 ? { truncated: true } : {}
240
+ };
241
+ seen.delete(value);
242
+ return result;
243
+ };
244
+ return visit(value, 0);
245
+ };
246
+ /** Bound and redact a diagnostic copy; canonical identities stay in their owning records. */
247
+ const captureContext = (context) => {
248
+ const diagnostic = capture(context);
249
+ return diagnostic._tag === "Error" ? diagnostic.context ?? {} : {};
250
+ };
251
+ /**
252
+ * Preserve the original value in-process; across JSON retain its structured diagnostic projection.
253
+ * Decoding returns Diagnostic data, never claims to reconstruct an application error class.
254
+ */
255
+ const Value = Diagnostic.pipe(Schema.decodeTo(Schema.Unknown, SchemaTransformation.transform({
256
+ decode: (diagnostic) => diagnostic,
257
+ encode: (value) => capture(value)
258
+ })));
259
+ /** Original local Effect Cause; its JSON codec preserves ordered typed, defect and interrupt reasons. */
260
+ const Cause$1 = Schema.Cause(Value, Value).pipe(Schema.decodeTo(Schema.declare(Cause.isCause), SchemaTransformation.transform({
261
+ decode: (cause) => cause,
262
+ encode: (cause) => cause
263
+ })));
264
+ /** Safe summary plus optional operator-private causal evidence retained at a terminal boundary. */
265
+ const Failure = Schema.Struct({
266
+ errorTag: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
267
+ message: Text,
268
+ diagnostic: Schema.optionalKey(Diagnostic),
269
+ context: Schema.optionalKey(Context$1)
270
+ }).pipe(strictSchema);
271
+ //#endregion
272
+ export { FailureDiagnostic_exports as a, captureContext as c, Failure as i, redactText as l, Context$1 as n, Value as o, Diagnostic as r, capture as s, Cause$1 as t, strictSchema as u };
273
+
274
+ //# sourceMappingURL=FailureDiagnostic-BElLOoED.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FailureDiagnostic-BElLOoED.mjs","names":["Context","EffectCause","Cause"],"sources":["../src/core/internal/strict-schema.ts","../src/core/FailureDiagnostic.ts"],"sourcesContent":["import { Schema, SchemaParser, SchemaTransformation } from \"effect\";\n\n/** Keep strict parsing on nested values even when an outer parser uses its defaults. */\nexport const strictSchema = <S extends Schema.Top>(schema: S) =>\n Schema.declareConstructor<S[\"Type\"], S[\"Encoded\"]>()(\n [schema],\n ([codec]) =>\n (value, _ast, options) =>\n SchemaParser.decodeUnknownEffect(codec)(value, { ...options, onExcessProperty: \"error\" }),\n {\n toCodecJson: ([codec]) =>\n Schema.link<S[\"Encoded\"]>()(codec, SchemaTransformation.passthrough()),\n },\n );\n","import {\n Cause as EffectCause,\n Exit,\n Predicate,\n Redacted,\n Schema,\n SchemaTransformation,\n} from \"effect\";\n\nimport { strictSchema } from \"./internal/strict-schema.ts\";\n\nconst Text = Schema.String.check(Schema.isMaxLength(16 * 1024));\nconst Name = Schema.String.check(Schema.isMaxLength(1_024));\nconst Scalar = Schema.Union([Text, Schema.Finite, Schema.Boolean, Schema.Null]);\n\n/** Correlation only: never include inputs, tool parameters, request bodies, or credentials. */\nexport const Context = Schema.Struct({\n agentId: Schema.optionalKey(Name),\n threadId: Schema.optionalKey(Name),\n runId: Schema.optionalKey(Name),\n submissionId: Schema.optionalKey(Name),\n attemptId: Schema.optionalKey(Name),\n turnId: Schema.optionalKey(Name),\n toolCallId: Schema.optionalKey(Name),\n toolName: Schema.optionalKey(Name),\n callId: Schema.optionalKey(Name),\n check: Schema.optionalKey(Name),\n operation: Schema.optionalKey(Name),\n}).pipe(strictSchema);\n\nexport type Context = typeof Context.Type;\n\ntype CauseReason =\n | { readonly _tag: \"Fail\"; readonly error: Diagnostic }\n | { readonly _tag: \"Die\"; readonly defect: Diagnostic }\n | { readonly _tag: \"Interrupt\"; readonly fiberId?: number };\n\n/** A private diagnostic projection, not a JavaScript error reconstruction or model response. */\nexport type Diagnostic =\n | {\n readonly _tag: \"Error\";\n readonly errorTag?: string;\n readonly name?: string;\n readonly message?: string;\n readonly stack?: string;\n readonly reason?: Diagnostic;\n readonly code?: string | number;\n readonly cause?: Diagnostic;\n readonly errors?: ReadonlyArray<Diagnostic>;\n readonly context?: Context;\n readonly omittedFields?: ReadonlyArray<string>;\n readonly truncated?: true;\n }\n | {\n readonly _tag: \"Cause\";\n readonly reasons: ReadonlyArray<CauseReason>;\n readonly truncated?: true;\n }\n | { readonly _tag: \"Value\"; readonly value: string | number | boolean | null }\n | { readonly _tag: \"Omitted\"; readonly reason: \"redacted\" | \"cycle\" | \"limit\" | \"unsupported\" };\n\nconst diagnosticSchema = <Nested extends Schema.Top>(nested: Nested) =>\n Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Error\"),\n errorTag: Schema.optionalKey(Name),\n name: Schema.optionalKey(Name),\n message: Schema.optionalKey(Text),\n stack: Schema.optionalKey(Text),\n reason: Schema.optionalKey(nested),\n code: Schema.optionalKey(Schema.Union([Name, Schema.Finite])),\n cause: Schema.optionalKey(nested),\n errors: Schema.optionalKey(Schema.Array(nested).check(Schema.isMaxLength(128))),\n context: Schema.optionalKey(Context),\n omittedFields: Schema.optionalKey(Schema.Array(Name).check(Schema.isMaxLength(32))),\n truncated: Schema.optionalKey(Schema.Literal(true)),\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Cause\"),\n reasons: Schema.Array(\n Schema.Union([\n Schema.Struct({ _tag: Schema.Literal(\"Fail\"), error: nested }),\n Schema.Struct({ _tag: Schema.Literal(\"Die\"), defect: nested }),\n Schema.Struct({\n _tag: Schema.Literal(\"Interrupt\"),\n fiberId: Schema.optionalKey(Schema.Finite),\n }),\n ]),\n ).check(Schema.isMaxLength(128)),\n truncated: Schema.optionalKey(Schema.Literal(true)),\n }),\n Schema.Struct({ _tag: Schema.Literal(\"Value\"), value: Scalar }),\n Schema.Struct({\n _tag: Schema.Literal(\"Omitted\"),\n reason: Schema.Literals([\"redacted\", \"cycle\", \"limit\", \"unsupported\"]),\n }),\n ]);\n\n/** Structured, allowlisted Error fields and ordered Effect Fail/Die/Interrupt reasons. */\nexport const Diagnostic: Schema.Codec<Diagnostic> = Schema.suspend(() =>\n diagnosticSchema(Diagnostic),\n).pipe(strictSchema);\n\n// Inspect one encoded node only; recursion must share capture's depth/node/text budgets.\nconst decodeDiagnosticNode = Schema.decodeUnknownExit(\n diagnosticSchema(Schema.Unknown).pipe(strictSchema),\n);\n\n/** Remove common credential forms; hosts must keep arbitrary private payloads out of error text. */\nexport const redactText = (text: string): string =>\n text\n .replace(/\\b(Bearer|Basic)\\s+[A-Za-z0-9._~+/=-]+/gi, \"$1 [REDACTED]\")\n .replace(/(https?:\\/\\/)[^\\s/@]+:[^\\s/@]+@/gi, \"$1[REDACTED]@\")\n .replace(\n /([?&](?:access_token|api_key|apikey|token|key|secret|password|signature)=)[^\\s&#]*/gi,\n \"$1[REDACTED]\",\n )\n .replace(\n /\\b((?:api[_-]?key|access[_-]?token|authorization|password|secret)\\s*[=:]\\s*)[^\\s,;}]+/gi,\n \"$1[REDACTED]\",\n );\n\n/**\n * Capture only diagnostic fields. Local values are never mutated. Cycles and exhausted limits\n * are explicit, not silently dropped; capture visits at most 1,024 nodes, with 56 JSON levels\n * and 128 KiB text. Inner causes have priority over outer stacks when the text budget is exhausted.\n * Text remains operator-private. No generic serializer can identify secrets embedded in arbitrary\n * prose: application error messages must exclude payloads, and hosts may supply stricter redaction.\n */\nexport const capture = (\n value: unknown,\n options?: { readonly redactText?: (text: string) => string },\n): Diagnostic => {\n const seen = new WeakSet<object>();\n let remainingNodes = 1_024;\n let remainingText = 128 * 1024;\n\n const text = (value: string, limit = 16 * 1024): string => {\n const safe = (options?.redactText ?? redactText)(value);\n const length = Math.max(0, Math.min(limit, remainingText));\n\n const marker = \"[truncated]\".slice(0, length);\n\n const result =\n safe.length <= length ? safe : `${safe.slice(0, length - marker.length)}${marker}`;\n\n remainingText -= result.length;\n\n return result;\n };\n\n const visit = (value: unknown, depth: number): Diagnostic => {\n if (remainingNodes <= 0 || depth >= 56) return { _tag: \"Omitted\", reason: \"limit\" };\n remainingNodes--;\n if (Redacted.isRedacted(value)) return { _tag: \"Omitted\", reason: \"redacted\" };\n if (Predicate.isString(value)) return { _tag: \"Value\", value: text(value) };\n if (\n value === null ||\n Predicate.isBoolean(value) ||\n (Predicate.isNumber(value) && Number.isFinite(value))\n )\n return { _tag: \"Value\", value };\n if (!Predicate.isObject(value)) return { _tag: \"Omitted\", reason: \"unsupported\" };\n if (seen.has(value)) return { _tag: \"Omitted\", reason: \"cycle\" };\n seen.add(value);\n const nested = (value: unknown) => visit(value, depth + 1);\n // Local errors retain their own tag, even when it happens to be \"Error\".\n const decoded = value instanceof Error ? undefined : decodeDiagnosticNode(value);\n const node = decoded !== undefined && Exit.isSuccess(decoded) ? decoded.value : undefined;\n\n if (node?._tag === \"Omitted\" || node?._tag === \"Value\") {\n seen.delete(value);\n\n return node._tag === \"Value\" && typeof node.value === \"string\"\n ? { _tag: \"Value\", value: text(node.value) }\n : node;\n }\n\n const originalReasons = EffectCause.isCause(value)\n ? value.reasons\n : node?._tag === \"Cause\"\n ? node.reasons\n : undefined;\n\n if (originalReasons !== undefined) {\n const reasons: Array<CauseReason> = [];\n\n for (const reason of originalReasons) {\n if (reasons.length >= 128 || remainingNodes <= 0) break;\n remainingNodes--;\n\n // reasons -> array item -> error/defect contributes three JSON levels.\n switch (reason._tag) {\n case \"Fail\":\n reasons.push({ _tag: \"Fail\", error: visit(reason.error, depth + 3) });\n break;\n case \"Die\":\n reasons.push({ _tag: \"Die\", defect: visit(reason.defect, depth + 3) });\n break;\n case \"Interrupt\":\n reasons.push({\n _tag: \"Interrupt\",\n ...(reason.fiberId === undefined ? {} : { fiberId: reason.fiberId }),\n });\n break;\n }\n }\n\n const result: Diagnostic = {\n _tag: \"Cause\",\n ...(originalReasons.length > reasons.length || (node?._tag === \"Cause\" && node.truncated)\n ? { truncated: true }\n : {}),\n reasons,\n };\n\n seen.delete(value);\n\n return result;\n }\n const retained = node?._tag === \"Error\" ? node : undefined;\n const omittedFields: Array<string> = [];\n\n const read = (key: string): unknown => {\n // A throwing accessor must not replace the original failure during diagnostic capture.\n try {\n return Reflect.get(value, key);\n } catch {\n omittedFields.push(key);\n\n return undefined;\n }\n };\n\n const tag = retained === undefined ? read(\"_tag\") : retained.errorTag;\n const name = read(\"name\");\n const message = read(\"message\");\n const stack = read(\"stack\");\n const reason = read(\"reason\");\n const code = read(\"code\");\n const cause = read(\"cause\");\n const errors = read(\"errors\");\n const capturedCause = cause === undefined ? undefined : nested(cause);\n const capturedReason = reason === undefined ? undefined : nested(reason);\n const capturedErrors: Array<Diagnostic> = [];\n\n if (Array.isArray(errors))\n for (const error of errors) {\n if (capturedErrors.length >= 128 || remainingNodes <= 0) break;\n capturedErrors.push(visit(error, depth + 2));\n }\n\n for (const field of retained?.omittedFields ?? []) omittedFields.push(text(field, 1_024));\n\n const context: Record<string, string> = {};\n\n for (const key of [\n \"agentId\",\n \"threadId\",\n \"runId\",\n \"submissionId\",\n \"attemptId\",\n \"turnId\",\n \"toolCallId\",\n \"toolName\",\n \"callId\",\n \"check\",\n \"operation\",\n ] as const) {\n const field = retained === undefined ? read(key) : retained.context?.[key];\n\n if (Predicate.isString(field)) context[key] = text(field, 1_024);\n }\n\n const result: Diagnostic = {\n _tag: \"Error\",\n ...(Predicate.isString(tag) ? { errorTag: text(tag, 1_024) } : {}),\n ...(Predicate.isString(name) ? { name: text(name, 1_024) } : {}),\n ...(Predicate.isString(message) ? { message: text(message) } : {}),\n ...(Predicate.isString(stack) ? { stack: text(stack) } : {}),\n ...(capturedReason === undefined ? {} : { reason: capturedReason }),\n ...(Predicate.isString(code)\n ? { code: text(code, 1_024) }\n : Predicate.isNumber(code) && Number.isFinite(code)\n ? { code }\n : {}),\n ...(capturedCause === undefined ? {} : { cause: capturedCause }),\n ...(Array.isArray(errors) ? { errors: capturedErrors } : {}),\n ...(Object.keys(context).length === 0 ? {} : { context }),\n ...(omittedFields.length === 0 ? {} : { omittedFields }),\n ...(retained?.truncated ||\n (Array.isArray(errors) && errors.length > capturedErrors.length) ||\n remainingText === 0\n ? { truncated: true }\n : {}),\n };\n\n seen.delete(value);\n\n return result;\n };\n\n return visit(value, 0);\n};\n\n/** Bound and redact a diagnostic copy; canonical identities stay in their owning records. */\nexport const captureContext = (context: Context): Context => {\n const diagnostic = capture(context);\n\n return diagnostic._tag === \"Error\" ? (diagnostic.context ?? {}) : {};\n};\n\n/**\n * Preserve the original value in-process; across JSON retain its structured diagnostic projection.\n * Decoding returns Diagnostic data, never claims to reconstruct an application error class.\n */\nexport const Value = Diagnostic.pipe(\n Schema.decodeTo(\n Schema.Unknown,\n SchemaTransformation.transform({\n decode: (diagnostic): unknown => diagnostic,\n encode: (value: unknown) => capture(value),\n }),\n ),\n);\n\n/** Original local Effect Cause; its JSON codec preserves ordered typed, defect and interrupt reasons. */\nexport const Cause = Schema.Cause(Value, Value).pipe(\n Schema.decodeTo(\n Schema.declare<EffectCause.Cause<unknown>>(EffectCause.isCause),\n SchemaTransformation.transform({ decode: (cause) => cause, encode: (cause) => cause }),\n ),\n);\n\n/** Safe summary plus optional operator-private causal evidence retained at a terminal boundary. */\nexport const Failure = Schema.Struct({\n errorTag: Schema.NonEmptyString.check(Schema.isMaxLength(256)),\n message: Text,\n diagnostic: Schema.optionalKey(Diagnostic),\n context: Schema.optionalKey(Context),\n}).pipe(strictSchema);\n\nexport type Failure = typeof Failure.Type;\n"],"mappings":";;;;AAGA,MAAa,gBAAsC,WACjD,OAAO,mBAA4C,CAAC,CAClD,CAAC,MAAM,IACN,CAAC,YACC,OAAO,MAAM,YACZ,aAAa,oBAAoB,KAAK,CAAC,CAAC,OAAO;CAAE,GAAG;CAAS,kBAAkB;AAAQ,CAAC,GAC5F,EACE,cAAc,CAAC,WACb,OAAO,KAAmB,CAAC,CAAC,OAAO,qBAAqB,YAAY,CAAC,EACzE,CACF;;;;;;;;;;;;;ACFF,MAAM,OAAO,OAAO,OAAO,MAAM,OAAO,YAAY,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