openai 7.24.0 → 7.26.0

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 (339) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/client.d.mts +5 -6
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +5 -6
  5. package/client.d.ts.map +1 -1
  6. package/client.js +38 -10
  7. package/client.js.map +1 -1
  8. package/client.mjs +39 -11
  9. package/client.mjs.map +1 -1
  10. package/core/streaming.d.mts +4 -0
  11. package/core/streaming.d.mts.map +1 -1
  12. package/core/streaming.d.ts +4 -0
  13. package/core/streaming.d.ts.map +1 -1
  14. package/core/streaming.js +6 -0
  15. package/core/streaming.js.map +1 -1
  16. package/core/streaming.mjs +6 -0
  17. package/core/streaming.mjs.map +1 -1
  18. package/helpers/beta/agents/standard-schema.d.mts +7 -0
  19. package/helpers/beta/agents/standard-schema.d.mts.map +1 -0
  20. package/helpers/beta/agents/standard-schema.d.ts +7 -0
  21. package/helpers/beta/agents/standard-schema.d.ts.map +1 -0
  22. package/helpers/beta/agents/standard-schema.js +12 -0
  23. package/helpers/beta/agents/standard-schema.js.map +1 -0
  24. package/helpers/beta/agents/standard-schema.mjs +9 -0
  25. package/helpers/beta/agents/standard-schema.mjs.map +1 -0
  26. package/helpers/beta/agents/zod.d.mts +10 -0
  27. package/helpers/beta/agents/zod.d.mts.map +1 -0
  28. package/helpers/beta/agents/zod.d.ts +10 -0
  29. package/helpers/beta/agents/zod.d.ts.map +1 -0
  30. package/helpers/beta/agents/zod.js +12 -0
  31. package/helpers/beta/agents/zod.js.map +1 -0
  32. package/helpers/beta/agents/zod.mjs +9 -0
  33. package/helpers/beta/agents/zod.mjs.map +1 -0
  34. package/internal/realtime-credentials.d.mts +22 -1
  35. package/internal/realtime-credentials.d.mts.map +1 -1
  36. package/internal/realtime-credentials.d.ts +22 -1
  37. package/internal/realtime-credentials.d.ts.map +1 -1
  38. package/internal/realtime-credentials.js +48 -4
  39. package/internal/realtime-credentials.js.map +1 -1
  40. package/internal/realtime-credentials.mjs +45 -4
  41. package/internal/realtime-credentials.mjs.map +1 -1
  42. package/internal/responses-ws-credentials.d.mts +23 -0
  43. package/internal/responses-ws-credentials.d.mts.map +1 -0
  44. package/internal/responses-ws-credentials.d.ts +23 -0
  45. package/internal/responses-ws-credentials.d.ts.map +1 -0
  46. package/internal/responses-ws-credentials.js +108 -0
  47. package/internal/responses-ws-credentials.js.map +1 -0
  48. package/internal/responses-ws-credentials.mjs +104 -0
  49. package/internal/responses-ws-credentials.mjs.map +1 -0
  50. package/internal/ws-adapter-node.d.mts +4 -0
  51. package/internal/ws-adapter-node.d.mts.map +1 -1
  52. package/internal/ws-adapter-node.d.ts +4 -0
  53. package/internal/ws-adapter-node.d.ts.map +1 -1
  54. package/internal/ws-adapter-node.js +56 -0
  55. package/internal/ws-adapter-node.js.map +1 -1
  56. package/internal/ws-adapter-node.mjs +55 -0
  57. package/internal/ws-adapter-node.mjs.map +1 -1
  58. package/internal/ws.d.mts +27 -4
  59. package/internal/ws.d.mts.map +1 -1
  60. package/internal/ws.d.ts +27 -4
  61. package/internal/ws.d.ts.map +1 -1
  62. package/internal/ws.js +105 -5
  63. package/internal/ws.js.map +1 -1
  64. package/internal/ws.mjs +102 -4
  65. package/internal/ws.mjs.map +1 -1
  66. package/lib/agents/agent-session-stream.d.mts +13 -4
  67. package/lib/agents/agent-session-stream.d.mts.map +1 -1
  68. package/lib/agents/agent-session-stream.d.ts +13 -4
  69. package/lib/agents/agent-session-stream.d.ts.map +1 -1
  70. package/lib/agents/agent-session-stream.js +24 -21
  71. package/lib/agents/agent-session-stream.js.map +1 -1
  72. package/lib/agents/agent-session-stream.mjs +24 -21
  73. package/lib/agents/agent-session-stream.mjs.map +1 -1
  74. package/lib/beta/agents/agent-session-create-stream.d.mts +15 -0
  75. package/lib/beta/agents/agent-session-create-stream.d.mts.map +1 -0
  76. package/lib/beta/agents/agent-session-create-stream.d.ts +15 -0
  77. package/lib/beta/agents/agent-session-create-stream.d.ts.map +1 -0
  78. package/lib/beta/agents/agent-session-create-stream.js +25 -0
  79. package/lib/beta/agents/agent-session-create-stream.js.map +1 -0
  80. package/lib/beta/agents/agent-session-create-stream.mjs +22 -0
  81. package/lib/beta/agents/agent-session-create-stream.mjs.map +1 -0
  82. package/lib/beta/agents/agent-turn-result-collector.d.mts +17 -0
  83. package/lib/beta/agents/agent-turn-result-collector.d.mts.map +1 -0
  84. package/lib/beta/agents/agent-turn-result-collector.d.ts +17 -0
  85. package/lib/beta/agents/agent-turn-result-collector.d.ts.map +1 -0
  86. package/lib/beta/agents/agent-turn-result-collector.js +99 -0
  87. package/lib/beta/agents/agent-turn-result-collector.js.map +1 -0
  88. package/lib/beta/agents/agent-turn-result-collector.mjs +95 -0
  89. package/lib/beta/agents/agent-turn-result-collector.mjs.map +1 -0
  90. package/lib/beta/agents/agent-turn-result-error.d.mts +16 -0
  91. package/lib/beta/agents/agent-turn-result-error.d.mts.map +1 -0
  92. package/lib/beta/agents/agent-turn-result-error.d.ts +16 -0
  93. package/lib/beta/agents/agent-turn-result-error.d.ts.map +1 -0
  94. package/lib/beta/agents/agent-turn-result-error.js +22 -0
  95. package/lib/beta/agents/agent-turn-result-error.js.map +1 -0
  96. package/lib/beta/agents/agent-turn-result-error.mjs +18 -0
  97. package/lib/beta/agents/agent-turn-result-error.mjs.map +1 -0
  98. package/lib/beta/agents/agent-turn-result.d.mts +12 -0
  99. package/lib/beta/agents/agent-turn-result.d.mts.map +1 -0
  100. package/lib/beta/agents/agent-turn-result.d.ts +12 -0
  101. package/lib/beta/agents/agent-turn-result.d.ts.map +1 -0
  102. package/lib/beta/agents/agent-turn-result.js +22 -0
  103. package/lib/beta/agents/agent-turn-result.js.map +1 -0
  104. package/lib/beta/agents/agent-turn-result.mjs +18 -0
  105. package/lib/beta/agents/agent-turn-result.mjs.map +1 -0
  106. package/lib/beta/agents/function-tool.d.mts +27 -0
  107. package/lib/beta/agents/function-tool.d.mts.map +1 -0
  108. package/lib/beta/agents/function-tool.d.ts +27 -0
  109. package/lib/beta/agents/function-tool.d.ts.map +1 -0
  110. package/lib/beta/agents/function-tool.js +48 -0
  111. package/lib/beta/agents/function-tool.js.map +1 -0
  112. package/lib/beta/agents/function-tool.mjs +45 -0
  113. package/lib/beta/agents/function-tool.mjs.map +1 -0
  114. package/lib/beta/agents/output-format-types.d.mts +11 -0
  115. package/lib/beta/agents/output-format-types.d.mts.map +1 -0
  116. package/lib/beta/agents/output-format-types.d.ts +11 -0
  117. package/lib/beta/agents/output-format-types.d.ts.map +1 -0
  118. package/lib/beta/agents/output-format-types.js +3 -0
  119. package/lib/beta/agents/output-format-types.js.map +1 -0
  120. package/lib/beta/agents/output-format-types.mjs +2 -0
  121. package/lib/beta/agents/output-format-types.mjs.map +1 -0
  122. package/lib/beta/agents/output-format.d.mts +8 -0
  123. package/lib/beta/agents/output-format.d.mts.map +1 -0
  124. package/lib/beta/agents/output-format.d.ts +8 -0
  125. package/lib/beta/agents/output-format.d.ts.map +1 -0
  126. package/lib/beta/agents/output-format.js +20 -0
  127. package/lib/beta/agents/output-format.js.map +1 -0
  128. package/lib/beta/agents/output-format.mjs +14 -0
  129. package/lib/beta/agents/output-format.mjs.map +1 -0
  130. package/lib/beta/agents/output-parse-error.d.mts +11 -0
  131. package/lib/beta/agents/output-parse-error.d.mts.map +1 -0
  132. package/lib/beta/agents/output-parse-error.d.ts +11 -0
  133. package/lib/beta/agents/output-parse-error.d.ts.map +1 -0
  134. package/lib/beta/agents/output-parse-error.js +22 -0
  135. package/lib/beta/agents/output-parse-error.js.map +1 -0
  136. package/lib/beta/agents/output-parse-error.mjs +18 -0
  137. package/lib/beta/agents/output-parse-error.mjs.map +1 -0
  138. package/lib/beta/agents/parse-result.d.mts +95 -0
  139. package/lib/beta/agents/parse-result.d.mts.map +1 -0
  140. package/lib/beta/agents/parse-result.d.ts +95 -0
  141. package/lib/beta/agents/parse-result.d.ts.map +1 -0
  142. package/lib/beta/agents/parse-result.js +116 -0
  143. package/lib/beta/agents/parse-result.js.map +1 -0
  144. package/lib/beta/agents/parse-result.mjs +110 -0
  145. package/lib/beta/agents/parse-result.mjs.map +1 -0
  146. package/lib/beta/agents/parsed-agent-turn-result.d.mts +8 -0
  147. package/lib/beta/agents/parsed-agent-turn-result.d.mts.map +1 -0
  148. package/lib/beta/agents/parsed-agent-turn-result.d.ts +8 -0
  149. package/lib/beta/agents/parsed-agent-turn-result.d.ts.map +1 -0
  150. package/lib/beta/agents/parsed-agent-turn-result.js +14 -0
  151. package/lib/beta/agents/parsed-agent-turn-result.js.map +1 -0
  152. package/lib/beta/agents/parsed-agent-turn-result.mjs +10 -0
  153. package/lib/beta/agents/parsed-agent-turn-result.mjs.map +1 -0
  154. package/lib/beta/agents/result-collection.d.mts +15 -0
  155. package/lib/beta/agents/result-collection.d.mts.map +1 -0
  156. package/lib/beta/agents/result-collection.d.ts +15 -0
  157. package/lib/beta/agents/result-collection.d.ts.map +1 -0
  158. package/lib/beta/agents/result-collection.js +110 -0
  159. package/lib/beta/agents/result-collection.js.map +1 -0
  160. package/lib/beta/agents/result-collection.mjs +106 -0
  161. package/lib/beta/agents/result-collection.mjs.map +1 -0
  162. package/lib/beta/agents/tool-output.d.mts +7 -0
  163. package/lib/beta/agents/tool-output.d.mts.map +1 -0
  164. package/lib/beta/agents/tool-output.d.ts +7 -0
  165. package/lib/beta/agents/tool-output.d.ts.map +1 -0
  166. package/lib/beta/agents/tool-output.js +26 -0
  167. package/lib/beta/agents/tool-output.js.map +1 -0
  168. package/lib/beta/agents/tool-output.mjs +23 -0
  169. package/lib/beta/agents/tool-output.mjs.map +1 -0
  170. package/lib/responses/responses-websocket-session.d.mts +1 -1
  171. package/lib/responses/responses-websocket-session.d.mts.map +1 -1
  172. package/lib/responses/responses-websocket-session.d.ts +1 -1
  173. package/lib/responses/responses-websocket-session.d.ts.map +1 -1
  174. package/lib/responses/responses-websocket-session.js +12 -2
  175. package/lib/responses/responses-websocket-session.js.map +1 -1
  176. package/lib/responses/responses-websocket-session.mjs +12 -2
  177. package/lib/responses/responses-websocket-session.mjs.map +1 -1
  178. package/package.json +1 -1
  179. package/resources/audio/speech.d.mts +1 -1
  180. package/resources/audio/speech.d.ts +1 -1
  181. package/resources/audio/speech.js +1 -1
  182. package/resources/audio/speech.mjs +1 -1
  183. package/resources/beta/agents/agents.d.mts +574 -11
  184. package/resources/beta/agents/agents.d.mts.map +1 -1
  185. package/resources/beta/agents/agents.d.ts +574 -11
  186. package/resources/beta/agents/agents.d.ts.map +1 -1
  187. package/resources/beta/agents/agents.js.map +1 -1
  188. package/resources/beta/agents/agents.mjs.map +1 -1
  189. package/resources/beta/agents/environments/templates.d.mts +56 -3
  190. package/resources/beta/agents/environments/templates.d.mts.map +1 -1
  191. package/resources/beta/agents/environments/templates.d.ts +56 -3
  192. package/resources/beta/agents/environments/templates.d.ts.map +1 -1
  193. package/resources/beta/agents/index.d.mts +1 -1
  194. package/resources/beta/agents/index.d.mts.map +1 -1
  195. package/resources/beta/agents/index.d.ts +1 -1
  196. package/resources/beta/agents/index.d.ts.map +1 -1
  197. package/resources/beta/agents/index.js.map +1 -1
  198. package/resources/beta/agents/index.mjs.map +1 -1
  199. package/resources/beta/agents/sessions/events.d.mts +16 -12
  200. package/resources/beta/agents/sessions/events.d.mts.map +1 -1
  201. package/resources/beta/agents/sessions/events.d.ts +16 -12
  202. package/resources/beta/agents/sessions/events.d.ts.map +1 -1
  203. package/resources/beta/agents/sessions/events.js +16 -12
  204. package/resources/beta/agents/sessions/events.js.map +1 -1
  205. package/resources/beta/agents/sessions/events.mjs +16 -12
  206. package/resources/beta/agents/sessions/events.mjs.map +1 -1
  207. package/resources/beta/agents/sessions/index.d.mts +1 -0
  208. package/resources/beta/agents/sessions/index.d.mts.map +1 -1
  209. package/resources/beta/agents/sessions/index.d.ts +1 -0
  210. package/resources/beta/agents/sessions/index.d.ts.map +1 -1
  211. package/resources/beta/agents/sessions/index.js +3 -1
  212. package/resources/beta/agents/sessions/index.js.map +1 -1
  213. package/resources/beta/agents/sessions/index.mjs +1 -0
  214. package/resources/beta/agents/sessions/index.mjs.map +1 -1
  215. package/resources/beta/agents/sessions/sessions.d.mts +16 -4
  216. package/resources/beta/agents/sessions/sessions.d.mts.map +1 -1
  217. package/resources/beta/agents/sessions/sessions.d.ts +16 -4
  218. package/resources/beta/agents/sessions/sessions.d.ts.map +1 -1
  219. package/resources/beta/agents/sessions/sessions.js +17 -4
  220. package/resources/beta/agents/sessions/sessions.js.map +1 -1
  221. package/resources/beta/agents/sessions/sessions.mjs +17 -4
  222. package/resources/beta/agents/sessions/sessions.mjs.map +1 -1
  223. package/resources/beta/agents/sessions/traces.d.mts +68 -0
  224. package/resources/beta/agents/sessions/traces.d.mts.map +1 -0
  225. package/resources/beta/agents/sessions/traces.d.ts +68 -0
  226. package/resources/beta/agents/sessions/traces.d.ts.map +1 -0
  227. package/resources/beta/agents/sessions/traces.js +81 -0
  228. package/resources/beta/agents/sessions/traces.js.map +1 -0
  229. package/resources/beta/agents/sessions/traces.mjs +77 -0
  230. package/resources/beta/agents/sessions/traces.mjs.map +1 -0
  231. package/resources/beta/beta.d.mts +2 -2
  232. package/resources/beta/beta.d.mts.map +1 -1
  233. package/resources/beta/beta.d.ts +2 -2
  234. package/resources/beta/beta.d.ts.map +1 -1
  235. package/resources/beta/beta.js.map +1 -1
  236. package/resources/beta/beta.mjs.map +1 -1
  237. package/resources/beta/index.d.mts +1 -1
  238. package/resources/beta/index.d.mts.map +1 -1
  239. package/resources/beta/index.d.ts +1 -1
  240. package/resources/beta/index.d.ts.map +1 -1
  241. package/resources/beta/index.js.map +1 -1
  242. package/resources/beta/index.mjs.map +1 -1
  243. package/resources/beta/responses/ws-base.d.mts +3 -1
  244. package/resources/beta/responses/ws-base.d.mts.map +1 -1
  245. package/resources/beta/responses/ws-base.d.ts +3 -1
  246. package/resources/beta/responses/ws-base.d.ts.map +1 -1
  247. package/resources/beta/responses/ws-base.js +35 -6
  248. package/resources/beta/responses/ws-base.js.map +1 -1
  249. package/resources/beta/responses/ws-base.mjs +35 -6
  250. package/resources/beta/responses/ws-base.mjs.map +1 -1
  251. package/resources/beta/responses/ws.d.mts +10 -0
  252. package/resources/beta/responses/ws.d.mts.map +1 -1
  253. package/resources/beta/responses/ws.d.ts +10 -0
  254. package/resources/beta/responses/ws.d.ts.map +1 -1
  255. package/resources/beta/responses/ws.js +23 -22
  256. package/resources/beta/responses/ws.js.map +1 -1
  257. package/resources/beta/responses/ws.mjs +24 -23
  258. package/resources/beta/responses/ws.mjs.map +1 -1
  259. package/resources/chat/completions/completions.d.mts +1 -1
  260. package/resources/chat/completions/completions.d.mts.map +1 -1
  261. package/resources/chat/completions/completions.d.ts +1 -1
  262. package/resources/chat/completions/completions.d.ts.map +1 -1
  263. package/resources/evals/runs/runs.js +1 -1
  264. package/resources/evals/runs/runs.js.map +1 -1
  265. package/resources/evals/runs/runs.mjs +1 -1
  266. package/resources/evals/runs/runs.mjs.map +1 -1
  267. package/resources/live/forks/forks.d.mts +5 -1
  268. package/resources/live/forks/forks.d.mts.map +1 -1
  269. package/resources/live/forks/forks.d.ts +5 -1
  270. package/resources/live/forks/forks.d.ts.map +1 -1
  271. package/resources/live/live.d.mts +5 -1
  272. package/resources/live/live.d.mts.map +1 -1
  273. package/resources/live/live.d.ts +5 -1
  274. package/resources/live/live.d.ts.map +1 -1
  275. package/resources/live/live.js.map +1 -1
  276. package/resources/live/live.mjs.map +1 -1
  277. package/resources/responses/ws-base.d.mts +3 -1
  278. package/resources/responses/ws-base.d.mts.map +1 -1
  279. package/resources/responses/ws-base.d.ts +3 -1
  280. package/resources/responses/ws-base.d.ts.map +1 -1
  281. package/resources/responses/ws-base.js +35 -6
  282. package/resources/responses/ws-base.js.map +1 -1
  283. package/resources/responses/ws-base.mjs +35 -6
  284. package/resources/responses/ws-base.mjs.map +1 -1
  285. package/resources/responses/ws.d.mts +10 -0
  286. package/resources/responses/ws.d.mts.map +1 -1
  287. package/resources/responses/ws.d.ts +10 -0
  288. package/resources/responses/ws.d.ts.map +1 -1
  289. package/resources/responses/ws.js +23 -22
  290. package/resources/responses/ws.js.map +1 -1
  291. package/resources/responses/ws.mjs +24 -23
  292. package/resources/responses/ws.mjs.map +1 -1
  293. package/src/client.ts +55 -19
  294. package/src/core/streaming.ts +9 -0
  295. package/src/helpers/beta/agents/standard-schema.ts +13 -0
  296. package/src/helpers/beta/agents/zod.ts +10 -0
  297. package/src/internal/realtime-credentials.ts +70 -4
  298. package/src/internal/responses-ws-credentials.ts +160 -0
  299. package/src/internal/ws-adapter-node.ts +66 -0
  300. package/src/internal/ws.ts +139 -11
  301. package/src/lib/agents/agent-session-stream.ts +36 -24
  302. package/src/lib/beta/agents/agent-session-create-stream.ts +36 -0
  303. package/src/lib/beta/agents/agent-turn-result-collector.ts +122 -0
  304. package/src/lib/beta/agents/agent-turn-result-error.ts +33 -0
  305. package/src/lib/beta/agents/agent-turn-result.ts +22 -0
  306. package/src/lib/beta/agents/function-tool.ts +60 -0
  307. package/src/lib/beta/agents/output-format-types.ts +12 -0
  308. package/src/lib/beta/agents/output-format.ts +20 -0
  309. package/src/lib/beta/agents/output-parse-error.ts +16 -0
  310. package/src/lib/beta/agents/parse-result.ts +133 -0
  311. package/src/lib/beta/agents/parsed-agent-turn-result.ts +12 -0
  312. package/src/lib/beta/agents/result-collection.ts +115 -0
  313. package/src/lib/beta/agents/tool-output.ts +22 -0
  314. package/src/lib/responses/responses-websocket-session.ts +14 -3
  315. package/src/resources/audio/speech.ts +1 -1
  316. package/src/resources/beta/agents/agents.ts +697 -6
  317. package/src/resources/beta/agents/environments/templates.ts +64 -3
  318. package/src/resources/beta/agents/index.ts +3 -0
  319. package/src/resources/beta/agents/sessions/events.ts +16 -12
  320. package/src/resources/beta/agents/sessions/index.ts +1 -0
  321. package/src/resources/beta/agents/sessions/sessions.ts +48 -18
  322. package/src/resources/beta/agents/sessions/traces.ts +298 -0
  323. package/src/resources/beta/beta.ts +6 -0
  324. package/src/resources/beta/index.ts +3 -0
  325. package/src/resources/beta/responses/ws-base.ts +40 -6
  326. package/src/resources/beta/responses/ws.ts +37 -27
  327. package/src/resources/chat/completions/completions.ts +1 -1
  328. package/src/resources/evals/runs/runs.ts +1 -1
  329. package/src/resources/live/forks/forks.ts +6 -1
  330. package/src/resources/live/live.ts +6 -1
  331. package/src/resources/responses/ws-base.ts +40 -6
  332. package/src/resources/responses/ws.ts +37 -27
  333. package/src/tsconfig.dist-src-node.d.ts +7 -0
  334. package/src/tsconfig.dist-src.d.ts +3 -1
  335. package/src/version.ts +1 -1
  336. package/version.d.mts +1 -1
  337. package/version.d.ts +1 -1
  338. package/version.js +1 -1
  339. package/version.mjs +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-result.js","sourceRoot":"","sources":["../../../src/lib/beta/agents/parse-result.ts"],"names":[],"mappings":";;AAUA,4CAuBC;AAaD,8CAmBC;AAwBD,gDAmCC;AAGD,0DAKC;AAnID,kDAAkD;AAKlD,4EAAmE;AACnE,gEAA6D;AAE7D,gBAAgB;AAChB,SAAgB,gBAAgB,CAAI,MAAuB,EAAE,MAA6B;IACxF,IAAI,CAAC;QACH,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,6DAA6D;YAC7D,OAAO,MAAwB,CAAC;QAClC,CAAC;QACD,IAAI,KAA+B,CAAC;QACpC,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACtC,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBACtC,IAAI,OAAO,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;oBACnC,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;oBAC7C,KAAK,KAAL,KAAK,GAAK,EAAE,KAAK,EAAE,EAAC;gBACtB,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM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AChC,MAA6B;IAE7B,OAAO,gBAAgB,CAAC,MAAM,MAAM,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,110 @@
1
+ import { OpenAIError } from "../../../core/error.mjs";
2
+ import { ParsedAgentTurnResult } from "./parsed-agent-turn-result.mjs";
3
+ import { AgentOutputParseError } from "./output-parse-error.mjs";
4
+ /** @internal */
5
+ export function parseAgentResult(result, format) {
6
+ try {
7
+ if (!format) {
8
+ // SAFETY: Absent formats use the default never/raw overload.
9
+ return result;
10
+ }
11
+ let first;
12
+ for (const message of result.messages) {
13
+ for (const content of message.content) {
14
+ if (content.type === 'output_text') {
15
+ const value = format.$parseRaw(content.text);
16
+ first ?? (first = { value });
17
+ }
18
+ }
19
+ }
20
+ if (!first) {
21
+ throw new AgentOutputParseError(result);
22
+ }
23
+ // SAFETY: Callers preserve the format's inferred T.
24
+ return new ParsedAgentTurnResult(result, first.value);
25
+ }
26
+ catch {
27
+ throw new AgentOutputParseError(result);
28
+ }
29
+ }
30
+ // Inspect only JSON-visible data fields; leave getters and inherited values to normal serialization.
31
+ function ownJSONValue(object, key) {
32
+ const descriptor = object && Object.getOwnPropertyDescriptor(object, key);
33
+ // SAFETY: The own data descriptor corresponds to the requested property in T.
34
+ return descriptor?.enumerable && 'value' in descriptor ? descriptor.value : undefined;
35
+ }
36
+ /** @internal */
37
+ export function agentFormatParser(format) {
38
+ if (!format) {
39
+ return undefined;
40
+ }
41
+ const descriptor = Object.getOwnPropertyDescriptor(format, '$parseRaw');
42
+ // oxlint-disable-next-line anti-slop/no-runtime-typeof -- An own parser data property is the explicit opt-in marker.
43
+ if (!descriptor || !('value' in descriptor) || typeof descriptor.value !== 'function') {
44
+ return undefined;
45
+ }
46
+ // SAFETY: Inspect the schema data descriptor without evaluating a caller getter; validate its discriminator below.
47
+ const schema = ownJSONValue(format, 'schema');
48
+ if (ownJSONValue(format, 'type') !== 'json_schema' || !schema) {
49
+ throw new OpenAIError('Typed agent formats require own enumerable type and schema data properties');
50
+ }
51
+ // SAFETY: The own descriptor was checked for a callable parser; retain its receiver and never reread the property.
52
+ const parse = descriptor.value;
53
+ return { type: 'json_schema', schema, $parseRaw: (text) => parse.call(format, text) };
54
+ }
55
+ // Materialize JSON-visible envelope getters once without evaluating unrelated properties.
56
+ function snapshotJSONProperty(object, key, capture = (value) => value) {
57
+ const descriptor = Object.getOwnPropertyDescriptor(object, key);
58
+ if (!descriptor?.enumerable) {
59
+ return object;
60
+ }
61
+ const value = capture(object[key]);
62
+ if ('value' in descriptor && value === descriptor.value) {
63
+ return object;
64
+ }
65
+ // SAFETY: Preserve the original properties/prototype, replacing only this captured property's value.
66
+ return Object.create(Object.getPrototypeOf(object), {
67
+ ...Object.getOwnPropertyDescriptors(object),
68
+ [key]: { value, enumerable: true, configurable: descriptor.configurable, writable: true },
69
+ });
70
+ }
71
+ /** @internal */
72
+ export function captureAgentOutput(input, options) {
73
+ const body = snapshotJSONProperty(input, 'agent', (agent) => agent
74
+ ? snapshotJSONProperty(agent, 'text', (text) => (text ? snapshotJSONProperty(text, 'format') : text))
75
+ : agent);
76
+ const agent = ownJSONValue(body, 'agent');
77
+ const text = ownJSONValue(agent, 'text');
78
+ const format = agentFormatParser(ownJSONValue(text, 'format'));
79
+ if (!format) {
80
+ return { body, options };
81
+ }
82
+ const schema = structuredClone(format.schema);
83
+ for (const envelope of [body, agent, text]) {
84
+ if (envelope && 'toJSON' in envelope) {
85
+ throw new OpenAIError('Typed agent requests cannot customize body, agent, or text serialization');
86
+ }
87
+ }
88
+ // Snapshot options once, matching the own enumerable fields native request spreading uses.
89
+ const capturedOptions = { ...options };
90
+ if (ownJSONValue(capturedOptions, 'body') !== undefined) {
91
+ throw new OpenAIError('Typed agent requests cannot override the body in request options');
92
+ }
93
+ delete capturedOptions.body;
94
+ return {
95
+ options: capturedOptions,
96
+ body: {
97
+ ...body,
98
+ agent: {
99
+ ...agent,
100
+ text: { ...text, format: { type: 'json_schema', schema } },
101
+ },
102
+ },
103
+ format,
104
+ };
105
+ }
106
+ /** @internal */
107
+ export async function parseAgentResultPromise(result, format) {
108
+ return parseAgentResult(await result, format);
109
+ }
110
+ //# sourceMappingURL=parse-result.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-result.mjs","sourceRoot":"","sources":["../../../src/lib/beta/agents/parse-result.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAKlD,OAAO,EAAE,qBAAqB,EAAE,uCAAmC;AACnE,OAAO,EAAE,qBAAqB,EAAE,iCAA6B;AAE7D,gBAAgB;AAChB,MAAM,UAAU,gBAAgB,CAAI,MAAuB,EAAE,MAA6B;IACxF,IAAI,CAAC;QACH,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,6DAA6D;YAC7D,OAAO,MAAwB,CAAC;QAClC,CAAC;QACD,IAAI,KAA+B,CAAC;QACpC,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACtC,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBACtC,IAAI,OAAO,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;oBACnC,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;oBAC7C,KAAK,KAAL,KAAK,GAAK,EAAE,KAAK,EAAE,EAAC;gBACtB,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAC1C,CAAC;QACD,oDAAoD;QACpD,OAAO,IAAI,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAmB,CAAC;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,qGAAqG;AACrG,SAAS,YAAY,CACnB,MAA4B,EA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,CAAC,CAAC;IAC/D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;IACD,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9C,KAAK,MAAM,QAAQ,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;QAC3C,IAAI,QAAQ,IAAI,QAAQ,IAAI,QAAQ,EAAE,CAAC;YACrC,MAAM,IAAI,WAAW,CAAC,0EAA0E,CAAC,CAAC;QACpG,CAAC;IACH,CAAC;IACD,2FAA2F;IAC3F,MAAM,eAAe,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;IACvC,IAAI,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,KAAK,SAAS,EAAE,CAAC;QACxD,MAAM,IAAI,WAAW,CAAC,kEAAkE,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,eAAe,CAAC,IAAI,CAAC;IAC5B,OAAO;QACL,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE;YACJ,GAAG,IAAI;YACP,KAAK,EAAE;gBACL,GAAG,KAAK;gBACR,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE;aAC3D;SACF;QACD,MAAM;KACP,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAAgC,EAChC,MAA6B;IAE7B,OAAO,gBAAgB,CAAC,MAAM,MAAM,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { AgentTurnResult } from "./agent-turn-result.mjs";
2
+ /** Beta: a completed hosted turn whose output passed the local parser. */
3
+ export declare class ParsedAgentTurnResult<T> extends AgentTurnResult {
4
+ readonly output_parsed: T;
5
+ readonly raw_result: AgentTurnResult;
6
+ constructor(result: AgentTurnResult, parsed: T);
7
+ }
8
+ //# sourceMappingURL=parsed-agent-turn-result.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsed-agent-turn-result.d.mts","sourceRoot":"","sources":["../../../src/lib/beta/agents/parsed-agent-turn-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gCAA4B;AAEtD,0EAA0E;AAC1E,qBAAa,qBAAqB,CAAC,CAAC,CAAE,SAAQ,eAAe;IAC3D,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;gBACzB,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;CAK/C"}
@@ -0,0 +1,8 @@
1
+ import { AgentTurnResult } from "./agent-turn-result.js";
2
+ /** Beta: a completed hosted turn whose output passed the local parser. */
3
+ export declare class ParsedAgentTurnResult<T> extends AgentTurnResult {
4
+ readonly output_parsed: T;
5
+ readonly raw_result: AgentTurnResult;
6
+ constructor(result: AgentTurnResult, parsed: T);
7
+ }
8
+ //# sourceMappingURL=parsed-agent-turn-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsed-agent-turn-result.d.ts","sourceRoot":"","sources":["../../../src/lib/beta/agents/parsed-agent-turn-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,+BAA4B;AAEtD,0EAA0E;AAC1E,qBAAa,qBAAqB,CAAC,CAAC,CAAE,SAAQ,eAAe;IAC3D,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;gBACzB,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;CAK/C"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ParsedAgentTurnResult = void 0;
4
+ const agent_turn_result_1 = require("./agent-turn-result.js");
5
+ /** Beta: a completed hosted turn whose output passed the local parser. */
6
+ class ParsedAgentTurnResult extends agent_turn_result_1.AgentTurnResult {
7
+ constructor(result, parsed) {
8
+ super(result.turn, result.messages);
9
+ this.raw_result = result;
10
+ this.output_parsed = parsed;
11
+ }
12
+ }
13
+ exports.ParsedAgentTurnResult = ParsedAgentTurnResult;
14
+ //# sourceMappingURL=parsed-agent-turn-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsed-agent-turn-result.js","sourceRoot":"","sources":["../../../src/lib/beta/agents/parsed-agent-turn-result.ts"],"names":[],"mappings":";;;AAAA,8DAAsD;AAEtD,0EAA0E;AAC1E,MAAa,qBAAyB,SAAQ,mCAAe;IAG3D,YAAY,MAAuB,EAAE,MAAS;QAC5C,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;IAC9B,CAAC;CACF;AARD,sDAQC"}
@@ -0,0 +1,10 @@
1
+ import { AgentTurnResult } from "./agent-turn-result.mjs";
2
+ /** Beta: a completed hosted turn whose output passed the local parser. */
3
+ export class ParsedAgentTurnResult extends AgentTurnResult {
4
+ constructor(result, parsed) {
5
+ super(result.turn, result.messages);
6
+ this.raw_result = result;
7
+ this.output_parsed = parsed;
8
+ }
9
+ }
10
+ //# sourceMappingURL=parsed-agent-turn-result.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsed-agent-turn-result.mjs","sourceRoot":"","sources":["../../../src/lib/beta/agents/parsed-agent-turn-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gCAA4B;AAEtD,0EAA0E;AAC1E,MAAM,OAAO,qBAAyB,SAAQ,eAAe;IAG3D,YAAY,MAAuB,EAAE,MAAS;QAC5C,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;IAC9B,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import type { AgentSessionEvent } from "../../../resources/beta/agents/agents.mjs";
2
+ import type { AgentTurnResult } from "./agent-turn-result.mjs";
3
+ import { AgentTurnResultCollector } from "./agent-turn-result-collector.mjs";
4
+ /** Shares collection between a raw creation stream and the follow-up helper.
5
+ * @internal
6
+ */
7
+ export declare class ResultCollection {
8
+ #private;
9
+ readonly collector: AgentTurnResultCollector;
10
+ constructor(source: () => AsyncIterator<AgentSessionEvent>, canHandle?: (name: string) => boolean, sessionID?: string, signal?: AbortSignal);
11
+ enable(): void;
12
+ iterate(): AsyncIterator<AgentSessionEvent>;
13
+ finalResult(): Promise<AgentTurnResult>;
14
+ }
15
+ //# sourceMappingURL=result-collection.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-collection.d.mts","sourceRoot":"","sources":["../../../src/lib/beta/agents/result-collection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kDAA8C;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,gCAA4B;AAC3D,OAAO,EAAE,wBAAwB,EAAE,0CAAsC;AAGzE;;GAEG;AACH,qBAAa,gBAAgB;;IAO3B,QAAQ,CAAC,SAAS,EAAE,wBAAwB,CAAC;gBAO3C,MAAM,EAAE,MAAM,aAAa,CAAC,iBAAiB,CAAC,EAC9C,SAAS,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAqB,EAClD,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,WAAW;IAQtB,MAAM,IAAI,IAAI;IASd,OAAO,IAAI,aAAa,CAAC,iBAAiB,CAAC;IAsC3C,WAAW,IAAI,OAAO,CAAC,eAAe,CAAC;CAiCxC"}
@@ -0,0 +1,15 @@
1
+ import type { AgentSessionEvent } from "../../../resources/beta/agents/agents.js";
2
+ import type { AgentTurnResult } from "./agent-turn-result.js";
3
+ import { AgentTurnResultCollector } from "./agent-turn-result-collector.js";
4
+ /** Shares collection between a raw creation stream and the follow-up helper.
5
+ * @internal
6
+ */
7
+ export declare class ResultCollection {
8
+ #private;
9
+ readonly collector: AgentTurnResultCollector;
10
+ constructor(source: () => AsyncIterator<AgentSessionEvent>, canHandle?: (name: string) => boolean, sessionID?: string, signal?: AbortSignal);
11
+ enable(): void;
12
+ iterate(): AsyncIterator<AgentSessionEvent>;
13
+ finalResult(): Promise<AgentTurnResult>;
14
+ }
15
+ //# sourceMappingURL=result-collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-collection.d.ts","sourceRoot":"","sources":["../../../src/lib/beta/agents/result-collection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iDAA8C;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA4B;AAC3D,OAAO,EAAE,wBAAwB,EAAE,yCAAsC;AAGzE;;GAEG;AACH,qBAAa,gBAAgB;;IAO3B,QAAQ,CAAC,SAAS,EAAE,wBAAwB,CAAC;gBAO3C,MAAM,EAAE,MAAM,aAAa,CAAC,iBAAiB,CAAC,EAC9C,SAAS,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAqB,EAClD,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,WAAW;IAQtB,MAAM,IAAI,IAAI;IASd,OAAO,IAAI,aAAa,CAAC,iBAAiB,CAAC;IAsC3C,WAAW,IAAI,OAAO,CAAC,eAAe,CAAC;CAiCxC"}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ var _ResultCollection_instances, _ResultCollection_iterator, _ResultCollection_ended, _ResultCollection_enabled, _ResultCollection_uncollectedEvents, _ResultCollection_error, _ResultCollection_result, _ResultCollection_source, _ResultCollection_signal, _ResultCollection_canHandle, _ResultCollection_observe, _ResultCollection_collect;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ResultCollection = void 0;
5
+ const tslib_1 = require("../../../internal/tslib.js");
6
+ const error_1 = require("../../../core/error.js");
7
+ const agent_turn_result_collector_1 = require("./agent-turn-result-collector.js");
8
+ const agent_turn_result_error_1 = require("./agent-turn-result-error.js");
9
+ /** Shares collection between a raw creation stream and the follow-up helper.
10
+ * @internal
11
+ */
12
+ class ResultCollection {
13
+ constructor(source, canHandle = () => false, sessionID, signal) {
14
+ _ResultCollection_instances.add(this);
15
+ _ResultCollection_iterator.set(this, void 0);
16
+ _ResultCollection_ended.set(this, false);
17
+ _ResultCollection_enabled.set(this, false);
18
+ _ResultCollection_uncollectedEvents.set(this, false);
19
+ _ResultCollection_error.set(this, void 0);
20
+ _ResultCollection_result.set(this, void 0);
21
+ _ResultCollection_source.set(this, void 0);
22
+ _ResultCollection_signal.set(this, void 0);
23
+ _ResultCollection_canHandle.set(this, void 0);
24
+ tslib_1.__classPrivateFieldSet(this, _ResultCollection_source, source, "f");
25
+ tslib_1.__classPrivateFieldSet(this, _ResultCollection_signal, signal, "f");
26
+ tslib_1.__classPrivateFieldSet(this, _ResultCollection_canHandle, canHandle, "f");
27
+ this.collector = new agent_turn_result_collector_1.AgentTurnResultCollector(sessionID);
28
+ }
29
+ enable() {
30
+ if (!tslib_1.__classPrivateFieldGet(this, _ResultCollection_enabled, "f") && tslib_1.__classPrivateFieldGet(this, _ResultCollection_uncollectedEvents, "f")) {
31
+ throw new error_1.OpenAIError('Call withResultCollection() before consuming events, or call finalResult() on a fresh stream.');
32
+ }
33
+ tslib_1.__classPrivateFieldSet(this, _ResultCollection_enabled, true, "f");
34
+ }
35
+ iterate() {
36
+ if (tslib_1.__classPrivateFieldGet(this, _ResultCollection_iterator, "f")) {
37
+ throw new error_1.OpenAIError('An agent result stream can only be consumed once');
38
+ }
39
+ return (tslib_1.__classPrivateFieldSet(this, _ResultCollection_iterator, tslib_1.__classPrivateFieldGet(this, _ResultCollection_instances, "m", _ResultCollection_observe).call(this), "f"));
40
+ }
41
+ finalResult() {
42
+ return (tslib_1.__classPrivateFieldSet(this, _ResultCollection_result, tslib_1.__classPrivateFieldGet(this, _ResultCollection_result, "f") ?? tslib_1.__classPrivateFieldGet(this, _ResultCollection_instances, "m", _ResultCollection_collect).call(this), "f"));
43
+ }
44
+ }
45
+ exports.ResultCollection = ResultCollection;
46
+ _ResultCollection_iterator = new WeakMap(), _ResultCollection_ended = new WeakMap(), _ResultCollection_enabled = new WeakMap(), _ResultCollection_uncollectedEvents = new WeakMap(), _ResultCollection_error = new WeakMap(), _ResultCollection_result = new WeakMap(), _ResultCollection_source = new WeakMap(), _ResultCollection_signal = new WeakMap(), _ResultCollection_canHandle = new WeakMap(), _ResultCollection_instances = new WeakSet(), _ResultCollection_observe = async function* _ResultCollection_observe() {
47
+ const iterator = tslib_1.__classPrivateFieldGet(this, _ResultCollection_source, "f").call(this);
48
+ let done = false;
49
+ try {
50
+ while (true) {
51
+ // oxlint-disable-next-line no-await-in-loop -- Pull the single-use stream sequentially.
52
+ const next = await iterator.next();
53
+ if (next.done) {
54
+ done = true;
55
+ return;
56
+ }
57
+ if (tslib_1.__classPrivateFieldGet(this, _ResultCollection_enabled, "f")) {
58
+ this.collector.accept(next.value);
59
+ }
60
+ else {
61
+ tslib_1.__classPrivateFieldSet(this, _ResultCollection_uncollectedEvents, true, "f");
62
+ }
63
+ yield next.value;
64
+ }
65
+ }
66
+ catch (error) {
67
+ if (tslib_1.__classPrivateFieldGet(this, _ResultCollection_enabled, "f")) {
68
+ tslib_1.__classPrivateFieldSet(this, _ResultCollection_error, error, "f");
69
+ }
70
+ throw error;
71
+ }
72
+ finally {
73
+ tslib_1.__classPrivateFieldSet(this, _ResultCollection_ended, true, "f");
74
+ if (!done) {
75
+ await iterator.return?.();
76
+ }
77
+ }
78
+ }, _ResultCollection_collect = async function _ResultCollection_collect() {
79
+ this.enable();
80
+ try {
81
+ const iterator = tslib_1.__classPrivateFieldGet(this, _ResultCollection_iterator, "f") ?? this.iterate();
82
+ while (!tslib_1.__classPrivateFieldGet(this, _ResultCollection_ended, "f") && !this.collector.ready) {
83
+ this.collector.checkAction(tslib_1.__classPrivateFieldGet(this, _ResultCollection_canHandle, "f"));
84
+ // oxlint-disable-next-line no-await-in-loop -- Each event can dispatch tools before the next pull.
85
+ const next = await iterator.next();
86
+ if (next.done) {
87
+ break;
88
+ }
89
+ }
90
+ if (tslib_1.__classPrivateFieldGet(this, _ResultCollection_error, "f") !== undefined && !this.collector.ready) {
91
+ throw tslib_1.__classPrivateFieldGet(this, _ResultCollection_error, "f");
92
+ }
93
+ if (!this.collector.ready && tslib_1.__classPrivateFieldGet(this, _ResultCollection_signal, "f")?.aborted) {
94
+ throw this.collector.error('observation', tslib_1.__classPrivateFieldGet(this, _ResultCollection_signal, "f").reason);
95
+ }
96
+ return this.collector.finish();
97
+ }
98
+ catch (error) {
99
+ throw error instanceof agent_turn_result_error_1.AgentTurnResultError ? error : this.collector.error('observation', error);
100
+ }
101
+ finally {
102
+ try {
103
+ await tslib_1.__classPrivateFieldGet(this, _ResultCollection_iterator, "f")?.return();
104
+ }
105
+ finally {
106
+ this.collector.release();
107
+ }
108
+ }
109
+ };
110
+ //# sourceMappingURL=result-collection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-collection.js","sourceRoot":"","sources":["../../../src/lib/beta/agents/result-collection.ts"],"names":[],"mappings":";;;;;AAAA,kDAAkD;AAGlD,kFAAyE;AACzE,0EAAiE;AAEjE;;GAEG;AACH,MAAa,gBAAgB;IAa3B,YACE,MAA8C,EAC9C,YAAuC,GAAG,EAAE,CAAC,KAAK,EAClD,SAAkB,EAClB,MAAoB;;QAhBtB,6CAA+D;QAC/D,kCAAS,KAAK,EAAC;QACf,oCAAW,KAAK,EAAC;QACjB,8CAAqB,KAAK,EAAC;QAC3B,0CAAgB;QAChB,2CAA8C;QAGrC,2CAAgD;QAChD,2CAAiC;QACjC,8CAAsC;QAQ7C,+BAAA,IAAI,4BAAW,MAAM,MAAA,CA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+BAAA,IAAI,gCAAQ,CAAC,MAAM,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,YAAY,8CAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACnG,CAAC;YAAS,CAAC;QACT,IAAI,CAAC;YACH,MAAM,+BAAA,IAAI,kCAAU,EAAE,MAAM,EAAE,CAAC;QACjC,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,106 @@
1
+ var _ResultCollection_instances, _ResultCollection_iterator, _ResultCollection_ended, _ResultCollection_enabled, _ResultCollection_uncollectedEvents, _ResultCollection_error, _ResultCollection_result, _ResultCollection_source, _ResultCollection_signal, _ResultCollection_canHandle, _ResultCollection_observe, _ResultCollection_collect;
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "../../../internal/tslib.mjs";
3
+ import { OpenAIError } from "../../../core/error.mjs";
4
+ import { AgentTurnResultCollector } from "./agent-turn-result-collector.mjs";
5
+ import { AgentTurnResultError } from "./agent-turn-result-error.mjs";
6
+ /** Shares collection between a raw creation stream and the follow-up helper.
7
+ * @internal
8
+ */
9
+ export class ResultCollection {
10
+ constructor(source, canHandle = () => false, sessionID, signal) {
11
+ _ResultCollection_instances.add(this);
12
+ _ResultCollection_iterator.set(this, void 0);
13
+ _ResultCollection_ended.set(this, false);
14
+ _ResultCollection_enabled.set(this, false);
15
+ _ResultCollection_uncollectedEvents.set(this, false);
16
+ _ResultCollection_error.set(this, void 0);
17
+ _ResultCollection_result.set(this, void 0);
18
+ _ResultCollection_source.set(this, void 0);
19
+ _ResultCollection_signal.set(this, void 0);
20
+ _ResultCollection_canHandle.set(this, void 0);
21
+ __classPrivateFieldSet(this, _ResultCollection_source, source, "f");
22
+ __classPrivateFieldSet(this, _ResultCollection_signal, signal, "f");
23
+ __classPrivateFieldSet(this, _ResultCollection_canHandle, canHandle, "f");
24
+ this.collector = new AgentTurnResultCollector(sessionID);
25
+ }
26
+ enable() {
27
+ if (!__classPrivateFieldGet(this, _ResultCollection_enabled, "f") && __classPrivateFieldGet(this, _ResultCollection_uncollectedEvents, "f")) {
28
+ throw new OpenAIError('Call withResultCollection() before consuming events, or call finalResult() on a fresh stream.');
29
+ }
30
+ __classPrivateFieldSet(this, _ResultCollection_enabled, true, "f");
31
+ }
32
+ iterate() {
33
+ if (__classPrivateFieldGet(this, _ResultCollection_iterator, "f")) {
34
+ throw new OpenAIError('An agent result stream can only be consumed once');
35
+ }
36
+ return (__classPrivateFieldSet(this, _ResultCollection_iterator, __classPrivateFieldGet(this, _ResultCollection_instances, "m", _ResultCollection_observe).call(this), "f"));
37
+ }
38
+ finalResult() {
39
+ return (__classPrivateFieldSet(this, _ResultCollection_result, __classPrivateFieldGet(this, _ResultCollection_result, "f") ?? __classPrivateFieldGet(this, _ResultCollection_instances, "m", _ResultCollection_collect).call(this), "f"));
40
+ }
41
+ }
42
+ _ResultCollection_iterator = new WeakMap(), _ResultCollection_ended = new WeakMap(), _ResultCollection_enabled = new WeakMap(), _ResultCollection_uncollectedEvents = new WeakMap(), _ResultCollection_error = new WeakMap(), _ResultCollection_result = new WeakMap(), _ResultCollection_source = new WeakMap(), _ResultCollection_signal = new WeakMap(), _ResultCollection_canHandle = new WeakMap(), _ResultCollection_instances = new WeakSet(), _ResultCollection_observe = async function* _ResultCollection_observe() {
43
+ const iterator = __classPrivateFieldGet(this, _ResultCollection_source, "f").call(this);
44
+ let done = false;
45
+ try {
46
+ while (true) {
47
+ // oxlint-disable-next-line no-await-in-loop -- Pull the single-use stream sequentially.
48
+ const next = await iterator.next();
49
+ if (next.done) {
50
+ done = true;
51
+ return;
52
+ }
53
+ if (__classPrivateFieldGet(this, _ResultCollection_enabled, "f")) {
54
+ this.collector.accept(next.value);
55
+ }
56
+ else {
57
+ __classPrivateFieldSet(this, _ResultCollection_uncollectedEvents, true, "f");
58
+ }
59
+ yield next.value;
60
+ }
61
+ }
62
+ catch (error) {
63
+ if (__classPrivateFieldGet(this, _ResultCollection_enabled, "f")) {
64
+ __classPrivateFieldSet(this, _ResultCollection_error, error, "f");
65
+ }
66
+ throw error;
67
+ }
68
+ finally {
69
+ __classPrivateFieldSet(this, _ResultCollection_ended, true, "f");
70
+ if (!done) {
71
+ await iterator.return?.();
72
+ }
73
+ }
74
+ }, _ResultCollection_collect = async function _ResultCollection_collect() {
75
+ this.enable();
76
+ try {
77
+ const iterator = __classPrivateFieldGet(this, _ResultCollection_iterator, "f") ?? this.iterate();
78
+ while (!__classPrivateFieldGet(this, _ResultCollection_ended, "f") && !this.collector.ready) {
79
+ this.collector.checkAction(__classPrivateFieldGet(this, _ResultCollection_canHandle, "f"));
80
+ // oxlint-disable-next-line no-await-in-loop -- Each event can dispatch tools before the next pull.
81
+ const next = await iterator.next();
82
+ if (next.done) {
83
+ break;
84
+ }
85
+ }
86
+ if (__classPrivateFieldGet(this, _ResultCollection_error, "f") !== undefined && !this.collector.ready) {
87
+ throw __classPrivateFieldGet(this, _ResultCollection_error, "f");
88
+ }
89
+ if (!this.collector.ready && __classPrivateFieldGet(this, _ResultCollection_signal, "f")?.aborted) {
90
+ throw this.collector.error('observation', __classPrivateFieldGet(this, _ResultCollection_signal, "f").reason);
91
+ }
92
+ return this.collector.finish();
93
+ }
94
+ catch (error) {
95
+ throw error instanceof AgentTurnResultError ? error : this.collector.error('observation', error);
96
+ }
97
+ finally {
98
+ try {
99
+ await __classPrivateFieldGet(this, _ResultCollection_iterator, "f")?.return();
100
+ }
101
+ finally {
102
+ this.collector.release();
103
+ }
104
+ }
105
+ };
106
+ //# sourceMappingURL=result-collection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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CAAC,WAAW,CAAC,uBAAA,IAAI,mCAAW,CAAC,CAAC;YAC5C,mGAAmG;YACnG,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QACD,IAAI,uBAAA,IAAI,+BAAO,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;YACvD,MAAM,uBAAA,IAAI,+BAAO,CAAC;QACpB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,uBAAA,IAAI,gCAAQ,EAAE,OAAO,EAAE,CAAC;YACnD,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,EAAE,uBAAA,IAAI,gCAAQ,CAAC,MAAM,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,YAAY,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACnG,CAAC;YAAS,CAAC;QACT,IAAI,CAAC;YACH,MAAM,uBAAA,IAAI,kCAAU,EAAE,MAAM,EAAE,CAAC;QACjC,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { InputContentParam } from "../../../resources/beta/agents/agents.mjs";
2
+ /**
3
+ * Recognizes supported content blocks without confusing JSON business data with content.
4
+ * @internal
5
+ */
6
+ export declare function isInputContent(value: unknown): value is InputContentParam;
7
+ //# sourceMappingURL=tool-output.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-output.d.mts","sourceRoot":"","sources":["../../../src/lib/beta/agents/tool-output.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kDAA8C;AAE/E;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAczE"}
@@ -0,0 +1,7 @@
1
+ import type { InputContentParam } from "../../../resources/beta/agents/agents.js";
2
+ /**
3
+ * Recognizes supported content blocks without confusing JSON business data with content.
4
+ * @internal
5
+ */
6
+ export declare function isInputContent(value: unknown): value is InputContentParam;
7
+ //# sourceMappingURL=tool-output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-output.d.ts","sourceRoot":"","sources":["../../../src/lib/beta/agents/tool-output.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iDAA8C;AAE/E;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAczE"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isInputContent = isInputContent;
4
+ const values_1 = require("../../../internal/utils/values.js");
5
+ /**
6
+ * Recognizes supported content blocks without confusing JSON business data with content.
7
+ * @internal
8
+ */
9
+ function isInputContent(value) {
10
+ if (!(0, values_1.isObj)(value)) {
11
+ return false;
12
+ }
13
+ const content = value;
14
+ let field;
15
+ if (content['type'] === 'input_text') {
16
+ field = 'text';
17
+ }
18
+ else if (content['type'] === 'input_image') {
19
+ field = 'image_url';
20
+ }
21
+ else {
22
+ return false;
23
+ }
24
+ return (0, values_1.hasOwn)(content, 'type') && (0, values_1.hasOwn)(content, field) && typeof content[field] === 'string';
25
+ }
26
+ //# sourceMappingURL=tool-output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-output.js","sourceRoot":"","sources":["../../../src/lib/beta/agents/tool-output.ts"],"names":[],"mappings":";;AAOA,wCAcC;AArBD,8DAA+D;AAG/D;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAc;IAC3C,IAAI,CAAC,IAAA,cAAK,EAAC,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC;IACtB,IAAI,KAAa,CAAC;IAClB,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,YAAY,EAAE,CAAC;QACrC,KAAK,GAAG,MAAM,CAAC;IACjB,CAAC;SAAM,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,aAAa,EAAE,CAAC;QAC7C,KAAK,GAAG,WAAW,CAAC;IACtB,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAA,eAAM,EAAC,OAAO,EAAE,MAAM,CAAC,IAAI,IAAA,eAAM,EAAC,OAAO,EAAE,KAAK,CAAC,IAAI,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC;AACjG,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { hasOwn, isObj } from "../../../internal/utils/values.mjs";
2
+ /**
3
+ * Recognizes supported content blocks without confusing JSON business data with content.
4
+ * @internal
5
+ */
6
+ export function isInputContent(value) {
7
+ if (!isObj(value)) {
8
+ return false;
9
+ }
10
+ const content = value;
11
+ let field;
12
+ if (content['type'] === 'input_text') {
13
+ field = 'text';
14
+ }
15
+ else if (content['type'] === 'input_image') {
16
+ field = 'image_url';
17
+ }
18
+ else {
19
+ return false;
20
+ }
21
+ return hasOwn(content, 'type') && hasOwn(content, field) && typeof content[field] === 'string';
22
+ }
23
+ //# sourceMappingURL=tool-output.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-output.mjs","sourceRoot":"","sources":["../../../src/lib/beta/agents/tool-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,2CAAuC;AAG/D;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC;IACtB,IAAI,KAAa,CAAC;IAClB,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,YAAY,EAAE,CAAC;QACrC,KAAK,GAAG,MAAM,CAAC;IACjB,CAAC;SAAM,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,aAAa,EAAE,CAAC;QAC7C,KAAK,GAAG,WAAW,CAAC;IACtB,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC;AACjG,CAAC"}
@@ -5,7 +5,7 @@ export { ResponsesWebSocketLane } from "./responses-websocket-lane.mjs";
5
5
  export type { ResponsesWebSocketEvent } from "./responses-websocket-lane.mjs";
6
6
  /** Limits for this optional helper. They do not change the underlying socket's limits. */
7
7
  export interface ResponsesWebSocketSessionOptions {
8
- /** Maximum lane IDs registered until the next reconnect, including detached lanes. */
8
+ /** Maximum lane IDs registered on the socket until the next reconnect, including detached lanes. */
9
9
  maxLanes: number;
10
10
  /** Maximum queued events across all lanes. */
11
11
  maxBufferedEvents: number;
@@ -1 +1 @@
1
- {"version":3,"file":"responses-websocket-session.d.mts","sourceRoot":"","sources":["../../src/lib/responses/responses-websocket-session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oDAAgD;AAIhF,OAAO,KAAK,EAAE,aAAa,EAAE,sCAAkC;AAQ/D,OAAO,EAAE,sBAAsB,EAAmB,uCAAmC;AAErF,OAAO,EAAE,sBAAsB,EAAE,uCAAmC;AACpE,YAAY,EAAE,uBAAuB,EAAE,uCAAmC;AAQ1E,0FAA0F;AAC1F,MAAM,WAAW,gCAAgC;IAC/C,sFAAsF;IACtF,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAsCD;;;;;;;GAOG;AACH,qBAAa,yBAAyB;;gBAalC,UAAU,EAAE,gBAAgB,GAAG;QAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;KAAE,EACjE,OAAO,EAAE,gCAAgC;IAoB3C;;;OAGG;IACH,IAAI,CACF,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,GAAE;QAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAO,GACrE,sBAAsB;IA+CzB,KAAK,IAAI,IAAI;CAsJd"}
1
+ {"version":3,"file":"responses-websocket-session.d.mts","sourceRoot":"","sources":["../../src/lib/responses/responses-websocket-session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oDAAgD;AAIhF,OAAO,KAAK,EAAE,aAAa,EAAE,sCAAkC;AAQ/D,OAAO,EAAE,sBAAsB,EAAmB,uCAAmC;AAErF,OAAO,EAAE,sBAAsB,EAAE,uCAAmC;AACpE,YAAY,EAAE,uBAAuB,EAAE,uCAAmC;AAY1E,0FAA0F;AAC1F,MAAM,WAAW,gCAAgC;IAC/C,oGAAoG;IACpG,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAsCD;;;;;;;GAOG;AACH,qBAAa,yBAAyB;;gBAalC,UAAU,EAAE,gBAAgB,GAAG;QAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;KAAE,EACjE,OAAO,EAAE,gCAAgC;IAoB3C;;;OAGG;IACH,IAAI,CACF,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,GAAE;QAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAO,GACrE,sBAAsB;IAsDzB,KAAK,IAAI,IAAI;CAsJd"}
@@ -5,7 +5,7 @@ export { ResponsesWebSocketLane } from "./responses-websocket-lane.js";
5
5
  export type { ResponsesWebSocketEvent } from "./responses-websocket-lane.js";
6
6
  /** Limits for this optional helper. They do not change the underlying socket's limits. */
7
7
  export interface ResponsesWebSocketSessionOptions {
8
- /** Maximum lane IDs registered until the next reconnect, including detached lanes. */
8
+ /** Maximum lane IDs registered on the socket until the next reconnect, including detached lanes. */
9
9
  maxLanes: number;
10
10
  /** Maximum queued events across all lanes. */
11
11
  maxBufferedEvents: number;
@@ -1 +1 @@
1
- {"version":3,"file":"responses-websocket-session.d.ts","sourceRoot":"","sources":["../../src/lib/responses/responses-websocket-session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mDAAgD;AAIhF,OAAO,KAAK,EAAE,aAAa,EAAE,qCAAkC;AAQ/D,OAAO,EAAE,sBAAsB,EAAmB,sCAAmC;AAErF,OAAO,EAAE,sBAAsB,EAAE,sCAAmC;AACpE,YAAY,EAAE,uBAAuB,EAAE,sCAAmC;AAQ1E,0FAA0F;AAC1F,MAAM,WAAW,gCAAgC;IAC/C,sFAAsF;IACtF,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAsCD;;;;;;;GAOG;AACH,qBAAa,yBAAyB;;gBAalC,UAAU,EAAE,gBAAgB,GAAG;QAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;KAAE,EACjE,OAAO,EAAE,gCAAgC;IAoB3C;;;OAGG;IACH,IAAI,CACF,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,GAAE;QAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAO,GACrE,sBAAsB;IA+CzB,KAAK,IAAI,IAAI;CAsJd"}
1
+ {"version":3,"file":"responses-websocket-session.d.ts","sourceRoot":"","sources":["../../src/lib/responses/responses-websocket-session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mDAAgD;AAIhF,OAAO,KAAK,EAAE,aAAa,EAAE,qCAAkC;AAQ/D,OAAO,EAAE,sBAAsB,EAAmB,sCAAmC;AAErF,OAAO,EAAE,sBAAsB,EAAE,sCAAmC;AACpE,YAAY,EAAE,uBAAuB,EAAE,sCAAmC;AAY1E,0FAA0F;AAC1F,MAAM,WAAW,gCAAgC;IAC/C,oGAAoG;IACpG,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAsCD;;;;;;;GAOG;AACH,qBAAa,yBAAyB;;gBAalC,UAAU,EAAE,gBAAgB,GAAG;QAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;KAAE,EACjE,OAAO,EAAE,gCAAgC;IAoB3C;;;OAGG;IACH,IAAI,CACF,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,GAAE;QAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAO,GACrE,sBAAsB;IAsDzB,KAAK,IAAI,IAAI;CAsJd"}