@desplega.ai/agent-swarm 2.14.0 → 2.14.1

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 (344) hide show
  1. package/dist/acp-adapter-7jv7w8jh.js +17 -0
  2. package/dist/{acp-targets-23exz4z4.js → acp-targets-0ebmg3et.js} +10 -10
  3. package/dist/{actions-zcr25x27.js → actions-0ds9dx6c.js} +28 -28
  4. package/dist/{agent-fs-provision-7fa9e12e.js → agent-fs-provision-zpbxa9jc.js} +4 -4
  5. package/dist/{amp-adapter-s7ytmv6b.js → amp-adapter-awh5nn7a.js} +3 -3
  6. package/dist/{anthropic-messages-vdd1zmha.js → anthropic-messages-gtgp9r85.js} +17 -17
  7. package/dist/{app-5d3sz1hy.js → app-nzejkvpp.js} +10 -10
  8. package/dist/{approval-notifications-7qgkzkzx.js → approval-notifications-hbqtb2w3.js} +11 -11
  9. package/dist/{assistant-p2yvhc3j.js → assistant-1paft129.js} +29 -29
  10. package/dist/{boot-args-schema-ry6cb0p7.js → boot-args-schema-zs435mfx.js} +1 -1
  11. package/dist/{boot-reembed-2hkm3vz2.js → boot-reembed-7xq2qgg4.js} +1 -1
  12. package/dist/{boot-reembed-c9643ms3.js → boot-reembed-91qrd4mz.js} +1 -1
  13. package/dist/{boot-scrub-sweep-3ycxr51t.js → boot-scrub-sweep-3h5xscw6.js} +2 -2
  14. package/dist/{boot-seeds-2hzvvzg0.js → boot-seeds-xkxqa8zc.js} +4 -4
  15. package/dist/{boxd-9py3x0jb.js → boxd-464x3w4m.js} +3 -3
  16. package/dist/{claude-adapter-dnkww93e.js → claude-adapter-6d8eyf2f.js} +12 -13
  17. package/dist/{claude-managed-adapter-yk0cr5x6.js → claude-managed-adapter-jzxcaf9m.js} +4 -4
  18. package/dist/{claude-managed-setup-4byxpp47.js → claude-managed-setup-5fcx0qh3.js} +10 -10
  19. package/dist/{claude-sdk-session-4wf3dbvs.js → claude-sdk-session-11vhz1hc.js} +11442 -12786
  20. package/dist/{cli-2ckwgs7q.js → cli-02ba8qx5.js} +1 -1
  21. package/dist/{cli-wvgg7r4j.js → cli-08gfvs58.js} +2 -2
  22. package/dist/{cli-ad00h1st.js → cli-0dkpdvnn.js} +10 -10
  23. package/dist/{cli-879txsac.js → cli-0mq8kxfx.js} +4 -4
  24. package/dist/{cli-rp1n2xpd.js → cli-0nvqg1hb.js} +1 -1
  25. package/dist/{cli-qrwjk4xy.js → cli-0qyfna7a.js} +5 -5
  26. package/dist/cli-0vxbrxr3.js +1006 -0
  27. package/dist/{cli-vxmmttmt.js → cli-132h67ps.js} +52 -52
  28. package/dist/{cli-yd7e590v.js → cli-1e13gvfn.js} +14 -14
  29. package/dist/cli-1hj68b3h.js +30 -0
  30. package/dist/{cli-hzhv7yac.js → cli-1zbj28py.js} +1 -1
  31. package/dist/{cli-0k7ppk9k.js → cli-20mkgwev.js} +43 -38
  32. package/dist/{cli-ejnhs815.js → cli-288k5ep1.js} +11 -11
  33. package/dist/{cli-njvpngc6.js → cli-2n7qdqfv.js} +3 -3
  34. package/dist/{cli-r04ve9xw.js → cli-2r62jy9s.js} +1 -1
  35. package/dist/{cli-9j1t3kf6.js → cli-3179w2rz.js} +2 -2
  36. package/dist/cli-3a3hm1z8.js +15 -0
  37. package/dist/cli-3bagv8rt.js +37 -0
  38. package/dist/{cli-6ajyhxh7.js → cli-3bcsc3m7.js} +2 -2
  39. package/dist/{cli-jgq9xptq.js → cli-3g0vbq46.js} +4 -4
  40. package/dist/{cli-69szn7w7.js → cli-3ktfe5jx.js} +71 -47
  41. package/dist/{cli-yjb3cddd.js → cli-44r66df2.js} +1 -1
  42. package/dist/{cli-mv8ft7b0.js → cli-4y2bekkn.js} +3 -3
  43. package/dist/cli-547fsc36.js +15 -0
  44. package/dist/{cli-6p8p2e6r.js → cli-5pyes68e.js} +1278 -23
  45. package/dist/{cli-930zbczq.js → cli-5t00r6c9.js} +3 -3
  46. package/dist/{cli-kc7vd07m.js → cli-5xjdft4s.js} +3601 -1700
  47. package/dist/{cli-4dyzzkfb.js → cli-643skca1.js} +954 -180
  48. package/dist/{cli-vr4eyq6p.js → cli-6a77m17n.js} +540 -412
  49. package/dist/{cli-v41kn3cd.js → cli-6prwz0zn.js} +4427 -5566
  50. package/dist/{cli-1nfabrt4.js → cli-6xrbpj5j.js} +4 -4
  51. package/dist/{cli-meydjstb.js → cli-6yhjqd6k.js} +4965 -69
  52. package/dist/{cli-6yy4fepf.js → cli-727sq1f9.js} +4 -4
  53. package/dist/{cli-snxhtehz.js → cli-7abeph0b.js} +7 -8
  54. package/dist/{cli-ty3gha1p.js → cli-7b9bwrfg.js} +2 -2
  55. package/dist/{cli-g6a696c0.js → cli-7dwsn9y5.js} +4 -4
  56. package/dist/{cli-r9d2tya0.js → cli-7qkbab03.js} +5 -5
  57. package/dist/{cli-7ca8hczj.js → cli-7svwhw1a.js} +1 -1
  58. package/dist/{cli-ze1ndjs4.js → cli-83kf2y60.js} +8 -8
  59. package/dist/{cli-rs1rzwp4.js → cli-8crn0510.js} +1 -1
  60. package/dist/{cli-wym6rxgt.js → cli-8kemtj1r.js} +10 -15
  61. package/dist/{cli-md4tn21h.js → cli-967jrz7j.js} +40 -26
  62. package/dist/{cli-jcnc5ret.js → cli-976m0zcw.js} +38 -28
  63. package/dist/{cli-cbg0j1yt.js → cli-98sea4d9.js} +3 -3
  64. package/dist/{cli-xh5fpmg8.js → cli-9txap41q.js} +101 -18
  65. package/dist/{cli-24wervhz.js → cli-aktk3qt6.js} +3 -3
  66. package/dist/{cli-096aftq6.js → cli-b70cpf8f.js} +7 -7
  67. package/dist/{cli-2ap1the6.js → cli-by7s3n4p.js} +1 -1
  68. package/dist/{cli-w4bvtxet.js → cli-byzq8xht.js} +7 -7
  69. package/dist/{cli-phe2vcw5.js → cli-d1zkys4j.js} +150 -99
  70. package/dist/cli-dr6x9qdk.js +15 -0
  71. package/dist/cli-dt931hb8.js +9740 -0
  72. package/dist/{cli-0e914dp9.js → cli-e1wprqnd.js} +3 -3
  73. package/dist/{cli-2ayk9gn8.js → cli-e2wzzw17.js} +2 -2
  74. package/dist/{cli-1jx0srjt.js → cli-e9p9h14n.js} +1921 -80
  75. package/dist/{cli-2savn6mm.js → cli-eaqxkeq0.js} +10 -10
  76. package/dist/{cli-dw9rtjm3.js → cli-etykr11s.js} +3061 -727
  77. package/dist/{cli-73rmgm45.js → cli-f07sgaax.js} +2 -2
  78. package/dist/{cli-gc6b94tj.js → cli-fe8he9cy.js} +2 -2
  79. package/dist/{cli-s4pccby1.js → cli-h0edykd1.js} +1 -1
  80. package/dist/cli-h5cveb69.js +15 -0
  81. package/dist/{cli-gcyws2bp.js → cli-hamdfjtx.js} +2 -2
  82. package/dist/{cli-jwnac23b.js → cli-hh5m39pt.js} +1 -1
  83. package/dist/{cli-f9g96z28.js → cli-j8fmn3wv.js} +11 -11
  84. package/dist/cli-jngvszex.js +1514 -0
  85. package/dist/{cli-8vbxjzk0.js → cli-k791mabe.js} +6 -6
  86. package/dist/{cli-9fwznq4p.js → cli-k9m8fckz.js} +7 -7
  87. package/dist/{cli-39t9d248.js → cli-kz8rar0g.js} +1 -1
  88. package/dist/{cli-rzbsh6bw.js → cli-n15fhd43.js} +1 -1
  89. package/dist/{cli-wvbaq052.js → cli-nmdy8bzf.js} +10 -3
  90. package/dist/{cli-t9pzz2eq.js → cli-ntmjzyte.js} +4 -1
  91. package/dist/{cli-adzmmcvf.js → cli-ny8f5g7t.js} +2 -2
  92. package/dist/cli-p0g0erm9.js +15 -0
  93. package/dist/{cli-2zjxake1.js → cli-pgdqhdkw.js} +4 -4
  94. package/dist/cli-ph1jce1b.js +16 -0
  95. package/dist/{cli-v4z5v3jd.js → cli-phantfg3.js} +480 -328
  96. package/dist/{cli-2414h5r9.js → cli-rb1z91g8.js} +10221 -1397
  97. package/dist/{cli-a49frv85.js → cli-redtbppc.js} +1 -1
  98. package/dist/{cli-91amj3md.js → cli-s7bfz1ye.js} +15 -15
  99. package/dist/{cli-kg63yp1r.js → cli-sf5kp73f.js} +18 -18
  100. package/dist/{cli-fww016hh.js → cli-sq32dgfe.js} +1373 -7129
  101. package/dist/{cli-enavhq6r.js → cli-tbrjvrrg.js} +1 -1
  102. package/dist/{cli-84xn7bgz.js → cli-tdd9dvw6.js} +1 -1
  103. package/dist/{cli-qkbevqer.js → cli-tjrrabez.js} +3 -3
  104. package/dist/{cli-q457ga28.js → cli-tkrp183j.js} +11 -11
  105. package/dist/{cli-7w1fs01q.js → cli-trvtxwzt.js} +2 -2
  106. package/dist/{cli-ayxxkk3p.js → cli-v1rhq77v.js} +8 -8
  107. package/dist/{cli-9j47sgzy.js → cli-v3jxx8dv.js} +2 -2
  108. package/dist/{cli-f2rwt43y.js → cli-v84kb7af.js} +13 -13
  109. package/dist/{cli-3mhdmcd4.js → cli-vp2ksaq9.js} +1 -1
  110. package/dist/{cli-b0m3bg0f.js → cli-vrb8pvrf.js} +6 -6
  111. package/dist/cli-vxxdf2ma.js +15 -0
  112. package/dist/{cli-wd7b5hgc.js → cli-w81s97bn.js} +1 -1
  113. package/dist/{cli-bqfx72e6.js → cli-wkzrknpt.js} +1 -1
  114. package/dist/{cli-cg1q8ymp.js → cli-wqpvfq2m.js} +1 -1
  115. package/dist/{cli-pq0kv31y.js → cli-wsh5vfa7.js} +9 -9
  116. package/dist/{cli-shyhb4t5.js → cli-wtwe8vng.js} +39 -39
  117. package/dist/{cli-3wsabyt0.js → cli-ww8wxfzx.js} +2 -2
  118. package/dist/{cli-e8trbfx1.js → cli-x80zagf5.js} +1 -1
  119. package/dist/{cli-r495stwd.js → cli-xd6ntv7x.js} +2 -2
  120. package/dist/{cli-0h6m6z5g.js → cli-xmc2nrtv.js} +1 -1
  121. package/dist/{cli-q5n3deaf.js → cli-ytgtqsy9.js} +1 -1
  122. package/dist/{cli-srq69pn1.js → cli-yvnnyjxm.js} +1 -1
  123. package/dist/{cli-krk8y8c7.js → cli-z0c98h7h.js} +1747 -439
  124. package/dist/{cli-mw1tmn3x.js → cli-z0effej1.js} +7 -7
  125. package/dist/{cli-7g5qj2ca.js → cli-zcb64xzv.js} +1 -1
  126. package/dist/{cli-m0ea8ggd.js → cli-zdkcp8p0.js} +2 -2
  127. package/dist/{cli-37p61fcg.js → cli-zgsd2w2k.js} +20 -22
  128. package/dist/{cli-tc165vrb.js → cli-zmfs06hg.js} +7 -6
  129. package/dist/{cli-edxfzgah.js → cli-zvsy4abb.js} +4 -4
  130. package/dist/{cli-z8t4485r.js → cli-zyf288rw.js} +2 -2
  131. package/dist/cli.js +58 -59
  132. package/dist/{codex-adapter-eq61radw.js → codex-adapter-seht4h9t.js} +9 -9
  133. package/dist/{codex-hook-8nmepvz6.js → codex-hook-w5nmtrn2.js} +2 -2
  134. package/dist/{codex-login-vbd9707w.js → codex-login-67qarfcg.js} +1 -1
  135. package/dist/{codex-session-runner-rfx355h4.js → codex-session-runner-tq95x3gq.js} +10 -10
  136. package/dist/{commands-d1z0sx62.js → commands-0awwqxq5.js} +3 -3
  137. package/dist/{controller-9hz6d8x3.js → controller-hgjx521c.js} +4 -4
  138. package/dist/{controllers-connect-tz07d2xr.js → controllers-connect-j4kdmhfj.js} +28 -28
  139. package/dist/core-8fw1gwg7.js +41 -0
  140. package/dist/{cursor-adapter-ef22ze3j.js → cursor-adapter-0rg8wk6j.js} +2 -2
  141. package/dist/{db-gd81d68c.js → db-8xs2js3s.js} +3 -3
  142. package/dist/{db-vrckks6q.js → db-dd6hj211.js} +2 -2
  143. package/dist/{devin-adapter-kdt6a2bh.js → devin-adapter-tn1twrha.js} +1 -1
  144. package/dist/{devtools-qxfgbsqz.js → devtools-b8qts77k.js} +1 -1
  145. package/dist/{dispatcher-76as8w2t.js → dispatcher-v7drd034.js} +24 -24
  146. package/dist/{docker-51ta7jsh.js → docker-6007r2fj.js} +2 -2
  147. package/dist/{dsh-adapter-ypfvcdyz.js → dsh-adapter-ah8npj2x.js} +2 -2
  148. package/dist/{e2b-dm9r8hpy.js → e2b-hg80w0qr.js} +2 -2
  149. package/dist/{e2b-05kn3kpq.js → e2b-z1g7vpz6.js} +4 -4
  150. package/dist/{easter-egg-3d-sg21j15g.js → easter-egg-3d-8n4w3s9k.js} +1 -1
  151. package/dist/{embedding-space-zsdw37bb.js → embedding-space-0p921zt3.js} +5 -5
  152. package/dist/{embeddings-p4e3e1m6.js → embeddings-9s7kbrc6.js} +1 -1
  153. package/dist/emscripten-module-Q67P5WYC-3sde6cre.js +2458 -0
  154. package/dist/{event-bus-tvf2grf4.js → event-bus-pawddp92.js} +1 -1
  155. package/dist/{execute-nztd0af0.js → execute-x0fy9j0m.js} +1 -1
  156. package/dist/{external-channel-717yzn4d.js → external-channel-ktfvn29c.js} +2 -2
  157. package/dist/ffi-cbfmmtqk.js +85 -0
  158. package/dist/fx-adapter-15vjxvgm.js +20 -0
  159. package/dist/getMachineId-bsd-2rd3pnz7.js +36 -0
  160. package/dist/getMachineId-bsd-3p48mkt1.js +36 -0
  161. package/dist/{getMachineId-bsd-637a7rbk.js → getMachineId-bsd-bk6tmeen.js} +5 -5
  162. package/dist/getMachineId-bsd-pssqgwmm.js +37 -0
  163. package/dist/getMachineId-bsd-v218x3xd.js +36 -0
  164. package/dist/getMachineId-bsd-wbxcazef.js +36 -0
  165. package/dist/getMachineId-bsd-x0942pbz.js +36 -0
  166. package/dist/getMachineId-darwin-5qsy4qcg.js +36 -0
  167. package/dist/getMachineId-darwin-6v7zsshx.js +37 -0
  168. package/dist/getMachineId-darwin-fcc3fjag.js +36 -0
  169. package/dist/getMachineId-darwin-pg84hftj.js +36 -0
  170. package/dist/{getMachineId-darwin-9vytrcnn.js → getMachineId-darwin-tyyevt26.js} +5 -5
  171. package/dist/getMachineId-darwin-wagmbf0d.js +36 -0
  172. package/dist/getMachineId-darwin-zvkmwr3y.js +36 -0
  173. package/dist/{getMachineId-linux-mkzsvyyz.js → getMachineId-linux-2ncg1epd.js} +3 -3
  174. package/dist/getMachineId-linux-2tmt2ptc.js +29 -0
  175. package/dist/getMachineId-linux-empwyp2y.js +29 -0
  176. package/dist/getMachineId-linux-fanqd45b.js +29 -0
  177. package/dist/getMachineId-linux-h6fyga0x.js +29 -0
  178. package/dist/getMachineId-linux-tbhgz1k9.js +29 -0
  179. package/dist/getMachineId-linux-zrbyw7dt.js +29 -0
  180. package/dist/getMachineId-unsupported-29g9dkgv.js +19 -0
  181. package/dist/getMachineId-unsupported-8xfq8djv.js +19 -0
  182. package/dist/getMachineId-unsupported-8y9cag1p.js +19 -0
  183. package/dist/getMachineId-unsupported-a6sjrm02.js +19 -0
  184. package/dist/getMachineId-unsupported-bp3w7ds0.js +19 -0
  185. package/dist/{getMachineId-unsupported-4cfs2n11.js → getMachineId-unsupported-sj6fk8sw.js} +3 -3
  186. package/dist/getMachineId-unsupported-v0p5gdxp.js +19 -0
  187. package/dist/getMachineId-win-hc996p0x.js +38 -0
  188. package/dist/{getMachineId-win-154s3qma.js → getMachineId-win-msq9ad87.js} +6 -6
  189. package/dist/getMachineId-win-tajyqwd6.js +38 -0
  190. package/dist/getMachineId-win-tzc163da.js +38 -0
  191. package/dist/getMachineId-win-xdaa0mgq.js +38 -0
  192. package/dist/getMachineId-win-xk6p98m5.js +38 -0
  193. package/dist/getMachineId-win-xtk658fm.js +38 -0
  194. package/dist/{google-generative-ai-sw77egmr.js → google-generative-ai-nzndg246.js} +1 -1
  195. package/dist/{google-vertex-rrw93g8h.js → google-vertex-ragh3nnw.js} +1 -1
  196. package/dist/grok-adapter-77httan0.js +20 -0
  197. package/dist/handlers-c1jp5b6h.js +39 -0
  198. package/dist/heartbeat-5yaj6dym.js +49 -0
  199. package/dist/{hook-ctz0xmp3.js → hook-2jttae8s.js} +10 -11
  200. package/dist/hook-c99nycyh.js +21 -0
  201. package/dist/{http-zregegrx.js → http-7y9dbfrr.js} +155 -122
  202. package/dist/{index-kzdqn3dd.js → index-6g9rdcrj.js} +3036 -758
  203. package/dist/index-7dwh9kxh.js +41 -0
  204. package/dist/{index-ym9fgxad.js → index-8p03vx1h.js} +8 -8
  205. package/dist/{index-maddg9ys.js → index-cw8nxnba.js} +4330 -15375
  206. package/dist/{index-fdym6ryb.js → index-dm7c6hw5.js} +28 -28
  207. package/dist/index-fqf82sbk.js +10584 -0
  208. package/dist/{index-126v2d0t.js → index-g7rthzrv.js} +11 -2923
  209. package/dist/{index-x9qf8dg7.js → index-h9xnzfhx.js} +21 -20
  210. package/dist/{index-42jq9yy3.js → index-jvfp0j47.js} +516 -10
  211. package/dist/{index-mtnbhe12.js → index-q60mhcpd.js} +23631 -19921
  212. package/dist/{index-evay0xyk.js → index-qxcfv8vq.js} +1 -1
  213. package/dist/{index-rz8ve510.js → index-t274qhhs.js} +6 -6
  214. package/dist/{index-kdmkfjt7.js → index-t4n9z755.js} +3491 -2487
  215. package/dist/{index-7dgxveck.js → index-tcegcysh.js} +5 -5
  216. package/dist/{index-whysn1wf.js → index-tn1m3q9b.js} +3 -3
  217. package/dist/index-wp9tarbt.js +43 -0
  218. package/dist/{index-5kx15d19.js → index-xhp7yp3t.js} +1 -1
  219. package/dist/index-z6np2405.js +38 -0
  220. package/dist/{k8s-ejkk0aw7.js → k8s-mr1r12th.js} +2 -2
  221. package/dist/{keepalive-zdqay870.js → keepalive-7eyb8y4t.js} +4 -4
  222. package/dist/lead-50cgn8s1.js +81 -0
  223. package/dist/{maintenance-t5ndg11m.js → maintenance-tdrd8nwv.js} +1 -1
  224. package/dist/module-ES6BEMUI-6htewwha.js +1210 -0
  225. package/dist/{node-0as4n1ef.js → node-gbx1t3pa.js} +1 -1
  226. package/dist/{oauth-refresh-sweep-y9zyd7t6.js → oauth-refresh-sweep-f4c7g37h.js} +3 -3
  227. package/dist/{object-webhooks-mkca91s0.js → object-webhooks-p190rdxp.js} +7 -7
  228. package/dist/{onboard-ss995244.js → onboard-56h4sks6.js} +7 -7
  229. package/dist/{opencode-adapter-mwpz0278.js → opencode-adapter-xg3yxfr0.js} +8 -8
  230. package/dist/{otel-impl-6n6vva3x.js → otel-impl-kepzgm4n.js} +36360 -9179
  231. package/dist/{pending-2sxh1t6j.js → pending-xgv316w0.js} +25 -25
  232. package/dist/{pi-mono-adapter-sfb7zy43.js → pi-mono-adapter-txe0syzb.js} +19 -22
  233. package/dist/{pricing-refresh-h79bg4cf.js → pricing-refresh-041zpyhf.js} +2 -2
  234. package/dist/{rbac-roles-ckq0czp4.js → rbac-roles-8f3jbcaf.js} +2 -2
  235. package/dist/{rbac-roles-jg2e260w.js → rbac-roles-cw7rrw5b.js} +3 -3
  236. package/dist/{render-v2-ymbshmn0.js → render-v2-2ezw4mzt.js} +10 -10
  237. package/dist/{resume-jdhnt4jk.js → resume-p14wdx8m.js} +13 -13
  238. package/dist/{runtime-y28jhhnf.js → runtime-he7c9g1r.js} +1 -1
  239. package/dist/{session-access-k4ta5hvp.js → session-access-8jvq86fj.js} +5 -5
  240. package/dist/{session-source-backfill-528j4s8j.js → session-source-backfill-6fe3hcgb.js} +3 -3
  241. package/dist/{setup-d6pj82fr.js → setup-6v0bn4r1.js} +3 -3
  242. package/dist/thread-buffer-8860v1ta.js +40 -0
  243. package/dist/{token-util-pjgekqxr.js → token-util-hnzceyn9.js} +1 -1
  244. package/dist/{token-pgr2w4s3.js → token-xnc02n6w.js} +21 -14
  245. package/dist/{tree-visibility-kjxv3nxk.js → tree-visibility-g1a8ff4r.js} +2 -2
  246. package/dist/{user-merge-jobs-rabbncf6.js → user-merge-jobs-vjsps179.js} +3 -3
  247. package/dist/{virtual-modules-22k51txd.js → virtual-modules-mreda4fp.js} +3 -3
  248. package/dist/{work-objects-xtjbar3r.js → work-objects-hfw15e35.js} +26 -26
  249. package/dist/{worker-follow-up-fg48vk6d.js → worker-follow-up-gbaz2ydz.js} +24 -24
  250. package/dist/worker-hkm8ftqp.js +81 -0
  251. package/dist/{x-vfsqypht.js → x-k29vmskt.js} +2 -2
  252. package/openapi.json +57 -1
  253. package/package.json +39 -39
  254. package/src/be/db/model-profiles.ts +103 -12
  255. package/src/be/db/tasks/read.ts +5 -0
  256. package/src/be/db.ts +14 -4
  257. package/src/be/model-group-resolution.ts +134 -0
  258. package/src/be/model-tier-resolution.ts +120 -17
  259. package/src/be/model-validation.ts +9 -1
  260. package/src/be/runtime-pools/routing.ts +22 -8
  261. package/src/be/scripts/extract-schema.ts +7 -0
  262. package/src/be/swarm-config-guard.ts +17 -7
  263. package/src/commands/onboard/agent-fs-version.ts +1 -1
  264. package/src/extensions/contract-types.generated.ts +1 -1
  265. package/src/http/db-query.ts +8 -2
  266. package/src/http/operator-actor.ts +3 -8
  267. package/src/http/poll.ts +20 -1
  268. package/src/http/repos.ts +3 -1
  269. package/src/http/schedules.ts +23 -3
  270. package/src/http/tasks.ts +11 -1
  271. package/src/prompts/base-prompt.ts +10 -6
  272. package/src/prompts/session-templates.ts +3 -3
  273. package/src/providers/acp-targets.ts +1 -1
  274. package/src/providers/amp-adapter.ts +11 -9
  275. package/src/providers/cursor-adapter.ts +1 -1
  276. package/src/realtime/browser.generated.txt +1 -1
  277. package/src/scheduler/schedule-task.ts +1 -0
  278. package/src/scripts-runtime/types/swarm-extension.d.ts +2 -0
  279. package/src/slack/config.ts +4 -0
  280. package/src/slack/render-v2.ts +2 -1
  281. package/src/slack/responses.ts +2 -1
  282. package/src/tasks/follow-up-gate.ts +142 -38
  283. package/src/tasks/worker-follow-up.ts +126 -37
  284. package/src/tests/amp-adapter.test.ts +57 -9
  285. package/src/tests/base-prompt.test.ts +36 -2
  286. package/src/tests/db-retention-defaults.test.ts +28 -3
  287. package/src/tests/entrypoint-repo-autoclone-args.test.ts +10 -0
  288. package/src/tests/follow-up-gate-shadow.test.ts +268 -10
  289. package/src/tests/linear-outbound-sync.test.ts +59 -25
  290. package/src/tests/operator-actor-keyless.test.ts +103 -0
  291. package/src/tests/profile-tier-alias.test.ts +9 -3
  292. package/src/tests/runner-repo-clone-args.test.ts +15 -6
  293. package/src/tests/workflow-system-one-extraction.test.ts +21 -0
  294. package/src/tests/workflow-wait-filter.test.ts +7 -7
  295. package/src/tests/worktree-reaper.test.ts +15 -4
  296. package/src/tools/schedules/create-schedule.ts +20 -3
  297. package/src/tools/schedules/patch-schedule.ts +30 -4
  298. package/src/tools/schedules/update-schedule.ts +30 -4
  299. package/src/tools/send-task.ts +17 -3
  300. package/src/tools/slack-post.ts +7 -2
  301. package/src/tools/slack-reply.ts +6 -2
  302. package/src/tools/task-action.ts +16 -3
  303. package/src/tools/utils.ts +1 -1
  304. package/src/types.ts +10 -0
  305. package/src/utils/amp-models.ts +20 -4
  306. package/src/utils/secret-scrubber.ts +6 -4
  307. package/src/workflows/engine.ts +36 -8
  308. package/src/workflows/executors/agent-task.ts +13 -2
  309. package/src/workflows/executors/code-match.ts +11 -31
  310. package/src/workflows/executors/script.ts +13 -0
  311. package/src/workflows/executors/system-one-extraction.ts +9 -6
  312. package/src/workflows/executors/wait.ts +1 -1
  313. package/src/workflows/foreach-driver.ts +5 -1
  314. package/src/workflows/model-validation.ts +13 -1
  315. package/src/workflows/predicate-sandbox.ts +171 -0
  316. package/src/workflows/retry-poller.ts +1 -1
  317. package/src/workflows/wait-filter.ts +14 -192
  318. package/templates/skills/heartbeat-runbook/content.md +1 -0
  319. package/templates/skills/slack-interaction/content.md +4 -0
  320. package/templates/skills/swarm-docs/content.md +1 -0
  321. package/dist/acp-adapter-99n6z9ky.js +0 -17
  322. package/dist/cli-5ss6qqt9.js +0 -45
  323. package/dist/cli-dzzh58sy.js +0 -6996
  324. package/dist/cli-j9ccfveb.js +0 -1849
  325. package/dist/cli-mna6pmfx.js +0 -1485
  326. package/dist/cli-r8ddn0hf.js +0 -25583
  327. package/dist/core-dynsv289.js +0 -41
  328. package/dist/fx-adapter-9k0hptnz.js +0 -20
  329. package/dist/grok-adapter-skdj2pce.js +0 -20
  330. package/dist/handlers-5btjqkz6.js +0 -39
  331. package/dist/heartbeat-vfb1gy84.js +0 -49
  332. package/dist/hook-eh52p7yd.js +0 -22
  333. package/dist/index-7w8p6em0.js +0 -41
  334. package/dist/index-t56y945n.js +0 -4
  335. package/dist/index-vfemrwwk.js +0 -10002
  336. package/dist/index-vz4semsx.js +0 -38
  337. package/dist/index-y3s0xp2v.js +0 -43
  338. package/dist/lead-6cscw8a5.js +0 -82
  339. package/dist/thread-buffer-9w6x5zec.js +0 -40
  340. package/dist/worker-g4aj93dt.js +0 -82
  341. package/dist/{azure-openai-responses-jeaas6x0.js → azure-openai-responses-e76k86gf.js} +4 -4
  342. package/dist/{openai-codex-responses-70g39cgz.js → openai-codex-responses-z2h941b8.js} +4 -4
  343. package/dist/{openai-completions-cv3hp4h5.js → openai-completions-5bxdkeg9.js} +4 -4
  344. package/dist/{openai-responses-trsvnks6.js → openai-responses-dzf3e8r5.js} +4 -4
@@ -7,15 +7,14 @@ import {
7
7
  require_checksum,
8
8
  require_event_streams,
9
9
  require_protocols,
10
- require_retry,
11
10
  require_dist_cjs,
11
+ require_retry,
12
12
  require_client2,
13
13
  require_httpAuthSchemes,
14
- require_dist_cjs2,
15
14
  require_protocols2,
16
15
  require_sso_oidc,
17
16
  require_dist_cjs3
18
- } from "./cli-v41kn3cd.js";
17
+ } from "./cli-6prwz0zn.js";
19
18
  import {
20
19
  resolveHttpProxyUrlForTarget,
21
20
  init_node_http_proxy
@@ -91,7 +90,7 @@ import {
91
90
  } from "./cli-242037k3.js";
92
91
 
93
92
  // node_modules/@aws-sdk/middleware-eventstream/dist-cjs/index.js
94
- var require_dist_cjs4 = __commonJS(function(exports) {
93
+ var require_dist_cjs2 = __commonJS(function(exports) {
95
94
  var { HttpRequest } = require_protocols();
96
95
  function resolveEventStreamConfig(input) {
97
96
  const eventSigner = input.signer;
@@ -158,8 +157,9 @@ var require_util = __commonJS(function(exports) {
158
157
  var validate = (str) => typeof str === "string" && str.indexOf("arn:") === 0 && str.split(":").length >= 6;
159
158
  var parse = (arn) => {
160
159
  const segments = arn.split(":");
161
- if (segments.length < 6 || segments[0] !== "arn")
160
+ if (segments.length < 6 || segments[0] !== "arn") {
162
161
  throw new Error("Malformed ARN");
162
+ }
163
163
  const [, partition, service, region, accountId, ...resource] = segments;
164
164
  return {
165
165
  partition,
@@ -215,7 +215,7 @@ var require_util = __commonJS(function(exports) {
215
215
  });
216
216
 
217
217
  // node_modules/@smithy/fetch-http-handler/dist-cjs/index.js
218
- var require_dist_cjs5 = __commonJS(function(exports) {
218
+ var require_dist_cjs4 = __commonJS(function(exports) {
219
219
  var { buildQueryString, HttpResponse } = require_protocols();
220
220
  var { streamCollector } = require_serde();
221
221
  exports.streamCollector = streamCollector;
@@ -223,15 +223,17 @@ var require_dist_cjs5 = __commonJS(function(exports) {
223
223
  return new Request(url, requestOptions);
224
224
  }
225
225
  function requestTimeout(timeoutInMs = 0) {
226
- return new Promise((resolve, reject) => {
226
+ let timeoutId;
227
+ const promise = new Promise((resolve, reject) => {
227
228
  if (timeoutInMs) {
228
- setTimeout(() => {
229
+ timeoutId = setTimeout(() => {
229
230
  const timeoutError = new Error(`Request did not complete within ${timeoutInMs} ms`);
230
231
  timeoutError.name = "TimeoutError";
231
232
  reject(timeoutError);
232
233
  }, timeoutInMs);
233
234
  }
234
235
  });
236
+ return { promise, cancel: () => clearTimeout(timeoutId) };
235
237
  }
236
238
  var keepAliveSupport = {
237
239
  supported: undefined
@@ -309,6 +311,7 @@ var require_dist_cjs5 = __commonJS(function(exports) {
309
311
  Object.assign(requestOptions, this.config.requestInit(request));
310
312
  }
311
313
  let removeSignalEventListener = () => {};
314
+ const timeout = requestTimeout(requestTimeoutInMs);
312
315
  const fetchRequest = createRequest(url, requestOptions);
313
316
  const raceOfPromises = [
314
317
  fetchFn(fetchRequest).then((response) => {
@@ -337,7 +340,7 @@ var require_dist_cjs5 = __commonJS(function(exports) {
337
340
  })
338
341
  };
339
342
  }),
340
- requestTimeout(requestTimeoutInMs)
343
+ timeout.promise
341
344
  ];
342
345
  if (abortSignal) {
343
346
  raceOfPromises.push(new Promise((resolve, reject) => {
@@ -354,7 +357,10 @@ var require_dist_cjs5 = __commonJS(function(exports) {
354
357
  }
355
358
  }));
356
359
  }
357
- return Promise.race(raceOfPromises).finally(removeSignalEventListener);
360
+ return Promise.race(raceOfPromises).finally(() => {
361
+ timeout.cancel();
362
+ removeSignalEventListener();
363
+ });
358
364
  }
359
365
  updateHttpClientConfig(key, value) {
360
366
  this.config = undefined;
@@ -389,12 +395,12 @@ var require_dist_cjs5 = __commonJS(function(exports) {
389
395
  });
390
396
 
391
397
  // node_modules/@aws-sdk/middleware-websocket/dist-cjs/index.js
392
- var require_dist_cjs6 = __commonJS(function(exports) {
398
+ var require_dist_cjs5 = __commonJS(function(exports) {
393
399
  var { formatUrl } = require_util();
394
400
  var { iterableToReadableStream, readableStreamToIterable, EventStreamCodec } = require_event_streams();
395
401
  var { HttpResponse, HttpRequest } = require_protocols();
396
402
  var { fromBase64, fromHex } = require_serde();
397
- var { FetchHttpHandler } = require_dist_cjs5();
403
+ var { FetchHttpHandler } = require_dist_cjs4();
398
404
  var isWebSocketRequest = (request) => request.protocol === "ws:" || request.protocol === "wss:";
399
405
  var DEFAULT_WS_CONNECTION_TIMEOUT_MS = 3000;
400
406
 
@@ -770,7 +776,7 @@ var require_dist_cjs6 = __commonJS(function(exports) {
770
776
  });
771
777
 
772
778
  // node_modules/@aws-sdk/eventstream-handler-node/dist-cjs/index.js
773
- var require_dist_cjs7 = __commonJS(function(exports) {
779
+ var require_dist_cjs6 = __commonJS(function(exports) {
774
780
  var { EventStreamCodec } = require_event_streams();
775
781
  var { Transform, Readable, PassThrough, pipeline } = __require("node:stream");
776
782
 
@@ -890,7 +896,7 @@ var require_dist_cjs7 = __commonJS(function(exports) {
890
896
  });
891
897
 
892
898
  // node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/token-providers/dist-cjs/index.js
893
- var require_dist_cjs8 = __commonJS(function(exports) {
899
+ var require_dist_cjs7 = __commonJS(function(exports) {
894
900
  var { setTokenFeature } = require_client2();
895
901
  var { getBearerTokenEnvKey } = require_httpAuthSchemes();
896
902
  var { TokenProviderError, getSSOTokenFilepath, parseKnownFiles, getProfileName, loadSsoSessionData, getSSOTokenFromFile, memoize, chain } = require_config();
@@ -1035,10 +1041,836 @@ var require_dist_cjs8 = __commonJS(function(exports) {
1035
1041
  exports.nodeProvider = nodeProvider;
1036
1042
  });
1037
1043
 
1044
+ // node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-cjs/index.js
1045
+ var require_dist_cjs8 = __commonJS(function(exports) {
1046
+ var { hasOwn } = require_serde();
1047
+ var { streamCollector } = require_serde();
1048
+ exports.streamCollector = streamCollector;
1049
+ var { buildQueryString, HttpResponse } = require_protocols();
1050
+ var node_https = __require("node:https");
1051
+ var { Readable } = __require("node:stream");
1052
+ var http2 = __require("node:http2");
1053
+ function buildAbortError(abortSignal) {
1054
+ const reason = abortSignal && typeof abortSignal === "object" && "reason" in abortSignal ? abortSignal.reason : undefined;
1055
+ if (reason) {
1056
+ if (reason instanceof Error) {
1057
+ const abortError = new Error("Request aborted");
1058
+ abortError.name = "AbortError";
1059
+ abortError.cause = reason;
1060
+ return abortError;
1061
+ }
1062
+ const abortError = new Error(String(reason));
1063
+ abortError.name = "AbortError";
1064
+ return abortError;
1065
+ }
1066
+ const abortError = new Error("Request aborted");
1067
+ abortError.name = "AbortError";
1068
+ return abortError;
1069
+ }
1070
+ var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"];
1071
+ var getTransformedHeaders = (headers) => {
1072
+ const transformedHeaders = {};
1073
+ for (const name in headers) {
1074
+ if (!hasOwn(headers, name))
1075
+ continue;
1076
+ const headerValues = headers[name];
1077
+ transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues;
1078
+ }
1079
+ return transformedHeaders;
1080
+ };
1081
+ var timing = {
1082
+ setTimeout: (cb, ms) => setTimeout(cb, ms),
1083
+ clearTimeout: (timeoutId) => clearTimeout(timeoutId)
1084
+ };
1085
+ var DEFER_EVENT_LISTENER_TIME$2 = 1000;
1086
+ var setConnectionTimeout = (request, reject, timeoutInMs = 0) => {
1087
+ if (!timeoutInMs) {
1088
+ return -1;
1089
+ }
1090
+ const registerTimeout = (offset) => {
1091
+ const timeoutId = timing.setTimeout(() => {
1092
+ request.destroy();
1093
+ reject(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${timeoutInMs} ms.`), {
1094
+ name: "TimeoutError"
1095
+ }));
1096
+ }, timeoutInMs - offset);
1097
+ const doWithSocket = (socket) => {
1098
+ if (socket?.connecting) {
1099
+ socket.on("connect", () => {
1100
+ timing.clearTimeout(timeoutId);
1101
+ });
1102
+ } else {
1103
+ timing.clearTimeout(timeoutId);
1104
+ }
1105
+ };
1106
+ if (request.socket) {
1107
+ doWithSocket(request.socket);
1108
+ } else {
1109
+ request.on("socket", doWithSocket);
1110
+ }
1111
+ };
1112
+ if (timeoutInMs < 2000) {
1113
+ registerTimeout(0);
1114
+ return 0;
1115
+ }
1116
+ return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME$2), DEFER_EVENT_LISTENER_TIME$2);
1117
+ };
1118
+ var setRequestTimeout = (req, reject, timeoutInMs = 0, throwOnRequestTimeout, logger) => {
1119
+ if (timeoutInMs) {
1120
+ return timing.setTimeout(() => {
1121
+ let msg = `@smithy/node-http-handler - [${throwOnRequestTimeout ? "ERROR" : "WARN"}] a request has exceeded the configured ${timeoutInMs} ms requestTimeout.`;
1122
+ if (throwOnRequestTimeout) {
1123
+ const error = Object.assign(new Error(msg), {
1124
+ name: "TimeoutError",
1125
+ code: "ETIMEDOUT"
1126
+ });
1127
+ req.destroy(error);
1128
+ reject(error);
1129
+ } else {
1130
+ msg += ` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;
1131
+ logger?.warn?.(msg);
1132
+ }
1133
+ }, timeoutInMs);
1134
+ }
1135
+ return -1;
1136
+ };
1137
+ var DEFER_EVENT_LISTENER_TIME$1 = 3000;
1138
+ var setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME$1) => {
1139
+ if (keepAlive !== true) {
1140
+ return -1;
1141
+ }
1142
+ const registerListener = () => {
1143
+ if (request.socket) {
1144
+ request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
1145
+ } else {
1146
+ request.on("socket", (socket) => {
1147
+ socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
1148
+ });
1149
+ }
1150
+ };
1151
+ if (deferTimeMs === 0) {
1152
+ registerListener();
1153
+ return 0;
1154
+ }
1155
+ return timing.setTimeout(registerListener, deferTimeMs);
1156
+ };
1157
+ var DEFER_EVENT_LISTENER_TIME = 3000;
1158
+ var setSocketTimeout = (request, reject, timeoutInMs = 0) => {
1159
+ const registerTimeout = (offset) => {
1160
+ const timeout = timeoutInMs - offset;
1161
+ const onTimeout = () => {
1162
+ request.destroy();
1163
+ reject(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (configured by client requestHandler).`), { name: "TimeoutError" }));
1164
+ };
1165
+ if (request.socket) {
1166
+ request.socket.setTimeout(timeout, onTimeout);
1167
+ request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
1168
+ } else {
1169
+ request.setTimeout(timeout, onTimeout);
1170
+ }
1171
+ };
1172
+ if (0 < timeoutInMs && timeoutInMs < 6000) {
1173
+ registerTimeout(0);
1174
+ return 0;
1175
+ }
1176
+ return timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
1177
+ };
1178
+ var MIN_WAIT_TIME = 6000;
1179
+ async function writeRequestBody(httpRequest, request, maxContinueTimeoutMs = MIN_WAIT_TIME, externalAgent = false) {
1180
+ const headers = request.headers;
1181
+ const expect = headers ? headers.Expect || headers.expect : undefined;
1182
+ let timeoutId = -1;
1183
+ let sendBody = true;
1184
+ if (!externalAgent && expect === "100-continue") {
1185
+ sendBody = await Promise.race([
1186
+ new Promise((resolve) => {
1187
+ timeoutId = Number(timing.setTimeout(() => resolve(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
1188
+ }),
1189
+ new Promise((resolve) => {
1190
+ httpRequest.on("continue", () => {
1191
+ timing.clearTimeout(timeoutId);
1192
+ resolve(true);
1193
+ });
1194
+ httpRequest.on("response", () => {
1195
+ timing.clearTimeout(timeoutId);
1196
+ resolve(false);
1197
+ });
1198
+ httpRequest.on("error", () => {
1199
+ timing.clearTimeout(timeoutId);
1200
+ resolve(false);
1201
+ });
1202
+ })
1203
+ ]);
1204
+ }
1205
+ if (sendBody) {
1206
+ writeBody(httpRequest, request.body);
1207
+ }
1208
+ }
1209
+ function writeBody(httpRequest, body) {
1210
+ if (body instanceof Readable) {
1211
+ body.pipe(httpRequest);
1212
+ return;
1213
+ }
1214
+ if (body) {
1215
+ const isBuffer = Buffer.isBuffer(body);
1216
+ const isString = typeof body === "string";
1217
+ if (isBuffer || isString) {
1218
+ if (isBuffer && body.byteLength === 0) {
1219
+ httpRequest.end();
1220
+ } else {
1221
+ httpRequest.end(body);
1222
+ }
1223
+ return;
1224
+ }
1225
+ const uint8 = body;
1226
+ if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") {
1227
+ httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength));
1228
+ return;
1229
+ }
1230
+ httpRequest.end(Buffer.from(body));
1231
+ return;
1232
+ }
1233
+ httpRequest.end();
1234
+ }
1235
+ var DEFAULT_REQUEST_TIMEOUT = 0;
1236
+ var hAgent = undefined;
1237
+ var hRequest = undefined;
1238
+
1239
+ class NodeHttpHandler {
1240
+ config;
1241
+ configProvider;
1242
+ socketWarningTimestamp = 0;
1243
+ externalAgent = false;
1244
+ metadata = { handlerProtocol: "http/1.1" };
1245
+ static create(instanceOrOptions) {
1246
+ if (typeof instanceOrOptions?.handle === "function") {
1247
+ return instanceOrOptions;
1248
+ }
1249
+ return new NodeHttpHandler(instanceOrOptions);
1250
+ }
1251
+ static checkSocketUsage(agent, socketWarningTimestamp, logger = console) {
1252
+ const { sockets, requests, maxSockets } = agent;
1253
+ if (typeof maxSockets !== "number" || maxSockets === Infinity) {
1254
+ return socketWarningTimestamp;
1255
+ }
1256
+ const interval = 15000;
1257
+ if (Date.now() - interval < socketWarningTimestamp) {
1258
+ return socketWarningTimestamp;
1259
+ }
1260
+ if (sockets && requests) {
1261
+ for (const origin in sockets) {
1262
+ if (!hasOwn(sockets, origin))
1263
+ continue;
1264
+ const socketsInUse = sockets[origin]?.length ?? 0;
1265
+ const requestsEnqueued = requests[origin]?.length ?? 0;
1266
+ if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) {
1267
+ logger?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
1268
+ See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
1269
+ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);
1270
+ return Date.now();
1271
+ }
1272
+ }
1273
+ }
1274
+ return socketWarningTimestamp;
1275
+ }
1276
+ constructor(options) {
1277
+ this.configProvider = new Promise((resolve, reject) => {
1278
+ if (typeof options === "function") {
1279
+ options().then((_options) => {
1280
+ resolve(this.resolveDefaultConfig(_options));
1281
+ }).catch(reject);
1282
+ } else {
1283
+ resolve(this.resolveDefaultConfig(options));
1284
+ }
1285
+ });
1286
+ }
1287
+ destroy() {
1288
+ this.config?.httpAgent?.destroy();
1289
+ this.config?.httpsAgent?.destroy();
1290
+ }
1291
+ async handle(request2, { abortSignal, requestTimeout } = {}) {
1292
+ if (!this.config) {
1293
+ this.config = await this.configProvider;
1294
+ }
1295
+ const config = this.config;
1296
+ const logger = config.logger;
1297
+ const isSSL = request2.protocol === "https:";
1298
+ if (!isSSL && !this.config.httpAgent) {
1299
+ this.config.httpAgent = await this.config.httpAgentProvider();
1300
+ }
1301
+ return new Promise((_resolve, _reject) => {
1302
+ let writeRequestBodyPromise = undefined;
1303
+ let socketWarningTimeoutId = -1;
1304
+ let connectionTimeoutId = -1;
1305
+ let requestTimeoutId = -1;
1306
+ let socketTimeoutId = -1;
1307
+ let keepAliveTimeoutId = -1;
1308
+ const clearTimeouts = () => {
1309
+ timing.clearTimeout(socketWarningTimeoutId);
1310
+ timing.clearTimeout(connectionTimeoutId);
1311
+ timing.clearTimeout(requestTimeoutId);
1312
+ timing.clearTimeout(socketTimeoutId);
1313
+ timing.clearTimeout(keepAliveTimeoutId);
1314
+ };
1315
+ const resolve = async (arg) => {
1316
+ await writeRequestBodyPromise;
1317
+ clearTimeouts();
1318
+ _resolve(arg);
1319
+ };
1320
+ const reject = async (arg) => {
1321
+ await writeRequestBodyPromise;
1322
+ clearTimeouts();
1323
+ _reject(arg);
1324
+ };
1325
+ if (abortSignal?.aborted) {
1326
+ const abortError = buildAbortError(abortSignal);
1327
+ reject(abortError);
1328
+ return;
1329
+ }
1330
+ const headers = request2.headers;
1331
+ const expectContinue = headers ? (headers.Expect ?? headers.expect) === "100-continue" : false;
1332
+ let agent = isSSL ? config.httpsAgent : config.httpAgent;
1333
+ if (expectContinue && !this.externalAgent) {
1334
+ agent = new (isSSL ? node_https.Agent : hAgent)({
1335
+ keepAlive: false,
1336
+ maxSockets: Infinity
1337
+ });
1338
+ }
1339
+ socketWarningTimeoutId = timing.setTimeout(() => {
1340
+ this.socketWarningTimestamp = NodeHttpHandler.checkSocketUsage(agent, this.socketWarningTimestamp, logger);
1341
+ }, config.socketAcquisitionWarningTimeout ?? (config.requestTimeout ?? 2000) + (config.connectionTimeout ?? 1000));
1342
+ const queryString = request2.query ? buildQueryString(request2.query) : "";
1343
+ let auth = undefined;
1344
+ if (request2.username != null || request2.password != null) {
1345
+ const username = request2.username ?? "";
1346
+ const password = request2.password ?? "";
1347
+ auth = `${username}:${password}`;
1348
+ }
1349
+ let path = request2.path;
1350
+ if (queryString) {
1351
+ path += `?${queryString}`;
1352
+ }
1353
+ if (request2.fragment) {
1354
+ path += `#${request2.fragment}`;
1355
+ }
1356
+ let hostname = request2.hostname ?? "";
1357
+ if (hostname[0] === "[" && hostname.endsWith("]")) {
1358
+ hostname = request2.hostname.slice(1, -1);
1359
+ } else {
1360
+ hostname = request2.hostname;
1361
+ }
1362
+ const nodeHttpsOptions = {
1363
+ headers: request2.headers,
1364
+ host: hostname,
1365
+ method: request2.method,
1366
+ path,
1367
+ port: request2.port,
1368
+ agent,
1369
+ auth
1370
+ };
1371
+ const requestFunc = isSSL ? node_https.request : hRequest;
1372
+ const req = requestFunc(nodeHttpsOptions, (res) => {
1373
+ const httpResponse = new HttpResponse({
1374
+ statusCode: res.statusCode || -1,
1375
+ reason: res.statusMessage,
1376
+ headers: getTransformedHeaders(res.headers),
1377
+ body: res
1378
+ });
1379
+ resolve({ response: httpResponse });
1380
+ });
1381
+ req.on("error", (err) => {
1382
+ if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
1383
+ reject(Object.assign(err, { name: "TimeoutError" }));
1384
+ } else {
1385
+ reject(err);
1386
+ }
1387
+ });
1388
+ if (abortSignal) {
1389
+ const onAbort = () => {
1390
+ req.destroy();
1391
+ const abortError = buildAbortError(abortSignal);
1392
+ reject(abortError);
1393
+ };
1394
+ if (typeof abortSignal.addEventListener === "function") {
1395
+ const signal = abortSignal;
1396
+ signal.addEventListener("abort", onAbort, { once: true });
1397
+ req.once("close", () => signal.removeEventListener("abort", onAbort));
1398
+ } else {
1399
+ abortSignal.onabort = onAbort;
1400
+ }
1401
+ }
1402
+ const effectiveRequestTimeout = requestTimeout ?? config.requestTimeout;
1403
+ connectionTimeoutId = setConnectionTimeout(req, reject, config.connectionTimeout);
1404
+ requestTimeoutId = setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, logger ?? console);
1405
+ socketTimeoutId = setSocketTimeout(req, reject, config.socketTimeout);
1406
+ const httpAgent = nodeHttpsOptions.agent;
1407
+ if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
1408
+ keepAliveTimeoutId = setSocketKeepAlive(req, {
1409
+ keepAlive: httpAgent.keepAlive,
1410
+ keepAliveMsecs: httpAgent.keepAliveMsecs
1411
+ });
1412
+ }
1413
+ writeRequestBodyPromise = writeRequestBody(req, request2, effectiveRequestTimeout, this.externalAgent).catch((e) => {
1414
+ clearTimeouts();
1415
+ return _reject(e);
1416
+ });
1417
+ });
1418
+ }
1419
+ updateHttpClientConfig(key, value) {
1420
+ this.config = undefined;
1421
+ this.configProvider = this.configProvider.then((config) => {
1422
+ if (key === Symbol.for("logger")) {
1423
+ return {
1424
+ ...config,
1425
+ logger: config.logger ?? value
1426
+ };
1427
+ }
1428
+ return {
1429
+ ...config,
1430
+ [key]: value
1431
+ };
1432
+ });
1433
+ }
1434
+ httpHandlerConfigs() {
1435
+ return this.config ?? {};
1436
+ }
1437
+ resolveDefaultConfig(options) {
1438
+ const { requestTimeout, connectionTimeout, socketTimeout, socketAcquisitionWarningTimeout, httpAgent, httpsAgent, throwOnRequestTimeout, logger } = options || {};
1439
+ const keepAlive = true;
1440
+ const maxSockets = 50;
1441
+ return {
1442
+ connectionTimeout,
1443
+ requestTimeout,
1444
+ socketTimeout,
1445
+ socketAcquisitionWarningTimeout,
1446
+ throwOnRequestTimeout,
1447
+ httpAgentProvider: async () => {
1448
+ const node_http = __require("node:http");
1449
+ const { Agent, request } = node_http.default ?? node_http;
1450
+ hRequest = request;
1451
+ hAgent = Agent;
1452
+ if (httpAgent instanceof hAgent || typeof httpAgent?.destroy === "function") {
1453
+ this.externalAgent = true;
1454
+ return httpAgent;
1455
+ }
1456
+ return new hAgent({ keepAlive, maxSockets, ...httpAgent });
1457
+ },
1458
+ httpsAgent: (() => {
1459
+ if (httpsAgent instanceof node_https.Agent || typeof httpsAgent?.destroy === "function") {
1460
+ this.externalAgent = true;
1461
+ return httpsAgent;
1462
+ }
1463
+ return new node_https.Agent({ keepAlive, maxSockets, ...httpsAgent });
1464
+ })(),
1465
+ logger
1466
+ };
1467
+ }
1468
+ }
1469
+ var ids = new Uint16Array(1);
1470
+
1471
+ class ClientHttp2SessionRef {
1472
+ id = ids[0]++;
1473
+ total = 0;
1474
+ max = 0;
1475
+ session;
1476
+ refs = 0;
1477
+ constructor(session) {
1478
+ session.unref();
1479
+ this.session = session;
1480
+ }
1481
+ retain() {
1482
+ if (this.session.destroyed) {
1483
+ throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");
1484
+ }
1485
+ this.refs += 1;
1486
+ this.total += 1;
1487
+ this.max = Math.max(this.refs, this.max);
1488
+ this.session.ref();
1489
+ }
1490
+ free() {
1491
+ if (this.session.destroyed) {
1492
+ return;
1493
+ }
1494
+ this.refs -= 1;
1495
+ if (this.refs === 0) {
1496
+ this.session.unref();
1497
+ }
1498
+ if (this.refs < 0) {
1499
+ throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.");
1500
+ }
1501
+ }
1502
+ deref() {
1503
+ return this.session;
1504
+ }
1505
+ close() {
1506
+ if (!this.session.closed) {
1507
+ this.session.close();
1508
+ }
1509
+ }
1510
+ destroy() {
1511
+ this.refs = 0;
1512
+ if (!this.session.destroyed) {
1513
+ this.session.setTimeout(0);
1514
+ this.session.destroy();
1515
+ }
1516
+ }
1517
+ useCount() {
1518
+ return this.refs;
1519
+ }
1520
+ }
1521
+
1522
+ class NodeHttp2ConnectionPool {
1523
+ sessions = [];
1524
+ maxConcurrency = 0;
1525
+ constructor(sessions) {
1526
+ this.sessions = (sessions ?? []).map((session) => new ClientHttp2SessionRef(session));
1527
+ }
1528
+ poll() {
1529
+ let cleanup = false;
1530
+ for (const session of this.sessions) {
1531
+ if (session.deref().destroyed) {
1532
+ cleanup = true;
1533
+ continue;
1534
+ }
1535
+ if (!this.maxConcurrency || session.useCount() < this.maxConcurrency) {
1536
+ return session;
1537
+ }
1538
+ }
1539
+ if (cleanup) {
1540
+ for (const session of this.sessions) {
1541
+ if (session.deref().destroyed) {
1542
+ this.remove(session);
1543
+ }
1544
+ }
1545
+ }
1546
+ }
1547
+ offerLast(ref) {
1548
+ this.sessions.push(ref);
1549
+ }
1550
+ remove(ref) {
1551
+ const ix = this.sessions.indexOf(ref);
1552
+ if (ix > -1) {
1553
+ this.sessions.splice(ix, 1);
1554
+ }
1555
+ }
1556
+ [Symbol.iterator]() {
1557
+ return this.sessions[Symbol.iterator]();
1558
+ }
1559
+ setMaxConcurrency(maxConcurrency) {
1560
+ this.maxConcurrency = maxConcurrency;
1561
+ }
1562
+ destroy(ref) {
1563
+ this.remove(ref);
1564
+ ref.destroy();
1565
+ }
1566
+ }
1567
+
1568
+ class NodeHttp2ConnectionManager {
1569
+ config;
1570
+ connectOptions;
1571
+ connectionPools = new Map;
1572
+ constructor(config) {
1573
+ this.config = config;
1574
+ if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) {
1575
+ throw new RangeError("maxConcurrency must be greater than zero.");
1576
+ }
1577
+ }
1578
+ lease(requestContext, connectionConfiguration) {
1579
+ const url = this.getUrlString(requestContext);
1580
+ const pool = this.getPool(url);
1581
+ if (!this.config.disableConcurrency && !connectionConfiguration.isEventStream) {
1582
+ const available = pool.poll();
1583
+ if (available) {
1584
+ available.retain();
1585
+ return available;
1586
+ }
1587
+ }
1588
+ const ref = new ClientHttp2SessionRef(this.connect(url));
1589
+ const session = ref.deref();
1590
+ if (this.config.maxConcurrency) {
1591
+ session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => {
1592
+ if (err) {
1593
+ throw new Error("Fail to set maxConcurrentStreams to " + this.config.maxConcurrency + "when creating new session for " + requestContext.destination.toString());
1594
+ }
1595
+ });
1596
+ }
1597
+ const graceful = () => {
1598
+ this.removeFromPoolAndClose(url, ref);
1599
+ };
1600
+ const ensureDestroyed = () => {
1601
+ this.removeFromPoolAndCheckedDestroy(url, ref);
1602
+ };
1603
+ session.on("goaway", graceful);
1604
+ session.on("error", ensureDestroyed);
1605
+ session.on("frameError", ensureDestroyed);
1606
+ session.on("close", ensureDestroyed);
1607
+ if (connectionConfiguration.requestTimeout) {
1608
+ session.setTimeout(connectionConfiguration.requestTimeout, ensureDestroyed);
1609
+ }
1610
+ pool.offerLast(ref);
1611
+ ref.retain();
1612
+ return ref;
1613
+ }
1614
+ release(_requestContext, ref) {
1615
+ ref.free();
1616
+ }
1617
+ createIsolatedSession(requestContext, connectionConfiguration) {
1618
+ const url = this.getUrlString(requestContext);
1619
+ const ref = new ClientHttp2SessionRef(this.connect(url));
1620
+ const session = ref.deref();
1621
+ session.settings({ maxConcurrentStreams: 1 });
1622
+ const ensureDestroyed = () => {
1623
+ ref.destroy();
1624
+ };
1625
+ session.on("error", ensureDestroyed);
1626
+ session.on("frameError", ensureDestroyed);
1627
+ session.on("close", ensureDestroyed);
1628
+ const timeout = connectionConfiguration.requestTimeout ?? 300000;
1629
+ session.setTimeout(timeout, ensureDestroyed);
1630
+ ref.retain();
1631
+ return ref;
1632
+ }
1633
+ destroy() {
1634
+ for (const [url, connectionPool] of this.connectionPools) {
1635
+ for (const session of [...connectionPool]) {
1636
+ session.destroy();
1637
+ }
1638
+ this.connectionPools.delete(url);
1639
+ }
1640
+ }
1641
+ setMaxConcurrentStreams(maxConcurrentStreams) {
1642
+ if (maxConcurrentStreams && maxConcurrentStreams <= 0) {
1643
+ throw new RangeError("maxConcurrentStreams must be greater than zero.");
1644
+ }
1645
+ this.config.maxConcurrency = maxConcurrentStreams;
1646
+ for (const pool of this.connectionPools.values()) {
1647
+ pool.setMaxConcurrency(maxConcurrentStreams);
1648
+ }
1649
+ }
1650
+ setDisableConcurrentStreams(disableConcurrentStreams) {
1651
+ this.config.disableConcurrency = disableConcurrentStreams;
1652
+ }
1653
+ setNodeHttp2ConnectOptions(nodeHttp2ConnectOptions) {
1654
+ this.connectOptions = nodeHttp2ConnectOptions;
1655
+ }
1656
+ debug() {
1657
+ const pools = {};
1658
+ for (const [url, pool] of this.connectionPools) {
1659
+ const sessions = [];
1660
+ for (const ref of pool) {
1661
+ sessions.push({
1662
+ id: ref.id,
1663
+ active: ref.useCount(),
1664
+ maxConcurrent: ref.max,
1665
+ totalRequests: ref.total
1666
+ });
1667
+ }
1668
+ pools[url] = { sessions };
1669
+ }
1670
+ return pools;
1671
+ }
1672
+ removeFromPoolAndClose(authority, ref) {
1673
+ this.connectionPools.get(authority)?.remove(ref);
1674
+ ref.close();
1675
+ }
1676
+ removeFromPoolAndCheckedDestroy(authority, ref) {
1677
+ this.connectionPools.get(authority)?.remove(ref);
1678
+ ref.destroy();
1679
+ }
1680
+ getPool(url) {
1681
+ if (!this.connectionPools.has(url)) {
1682
+ const pool = new NodeHttp2ConnectionPool;
1683
+ if (this.config.maxConcurrency) {
1684
+ pool.setMaxConcurrency(this.config.maxConcurrency);
1685
+ }
1686
+ this.connectionPools.set(url, pool);
1687
+ }
1688
+ return this.connectionPools.get(url);
1689
+ }
1690
+ getUrlString(request) {
1691
+ return request.destination.toString();
1692
+ }
1693
+ connect(url) {
1694
+ return this.connectOptions === undefined ? http2.connect(url) : http2.connect(url, this.connectOptions);
1695
+ }
1696
+ }
1697
+ var { constants } = http2;
1698
+
1699
+ class NodeHttp2Handler {
1700
+ config;
1701
+ configProvider;
1702
+ metadata = { handlerProtocol: "h2" };
1703
+ connectionManager = new NodeHttp2ConnectionManager({});
1704
+ static create(instanceOrOptions) {
1705
+ if (typeof instanceOrOptions?.handle === "function") {
1706
+ return instanceOrOptions;
1707
+ }
1708
+ return new NodeHttp2Handler(instanceOrOptions);
1709
+ }
1710
+ constructor(options) {
1711
+ this.configProvider = new Promise((resolve, reject) => {
1712
+ if (typeof options === "function") {
1713
+ options().then((opts) => {
1714
+ resolve(opts || {});
1715
+ }).catch(reject);
1716
+ } else {
1717
+ resolve(options || {});
1718
+ }
1719
+ });
1720
+ }
1721
+ destroy() {
1722
+ this.connectionManager.destroy();
1723
+ }
1724
+ async handle(request, { abortSignal, requestTimeout, isEventStream } = {}) {
1725
+ if (!this.config) {
1726
+ this.config = await this.configProvider;
1727
+ const { disableConcurrentStreams, maxConcurrentStreams, nodeHttp2ConnectOptions } = this.config;
1728
+ this.connectionManager.setDisableConcurrentStreams(disableConcurrentStreams ?? false);
1729
+ if (maxConcurrentStreams) {
1730
+ this.connectionManager.setMaxConcurrentStreams(maxConcurrentStreams);
1731
+ }
1732
+ if (nodeHttp2ConnectOptions) {
1733
+ this.connectionManager.setNodeHttp2ConnectOptions(nodeHttp2ConnectOptions);
1734
+ }
1735
+ }
1736
+ const { requestTimeout: configRequestTimeout, disableConcurrentStreams } = this.config;
1737
+ const useIsolatedSession = disableConcurrentStreams || isEventStream;
1738
+ const effectiveRequestTimeout = requestTimeout ?? configRequestTimeout;
1739
+ return new Promise((_resolve, _reject) => {
1740
+ let fulfilled = false;
1741
+ let writeRequestBodyPromise = undefined;
1742
+ const resolve = async (arg) => {
1743
+ await writeRequestBodyPromise;
1744
+ _resolve(arg);
1745
+ };
1746
+ const reject = async (arg) => {
1747
+ await writeRequestBodyPromise;
1748
+ _reject(arg);
1749
+ };
1750
+ if (abortSignal?.aborted) {
1751
+ fulfilled = true;
1752
+ const abortError = buildAbortError(abortSignal);
1753
+ reject(abortError);
1754
+ return;
1755
+ }
1756
+ const { hostname, method, port, protocol, query } = request;
1757
+ let auth = "";
1758
+ if (request.username != null || request.password != null) {
1759
+ const username = request.username ?? "";
1760
+ const password = request.password ?? "";
1761
+ auth = `${username}:${password}@`;
1762
+ }
1763
+ const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`;
1764
+ const requestContext = { destination: new URL(authority) };
1765
+ const connectConfig = {
1766
+ requestTimeout: this.config?.sessionTimeout,
1767
+ isEventStream
1768
+ };
1769
+ const ref = useIsolatedSession ? this.connectionManager.createIsolatedSession(requestContext, connectConfig) : this.connectionManager.lease(requestContext, connectConfig);
1770
+ const session = ref.deref();
1771
+ const rejectWithDestroy = (err) => {
1772
+ if (useIsolatedSession) {
1773
+ ref.destroy();
1774
+ }
1775
+ fulfilled = true;
1776
+ reject(err);
1777
+ };
1778
+ const queryString = query ? buildQueryString(query) : "";
1779
+ let path = request.path;
1780
+ if (queryString) {
1781
+ path += `?${queryString}`;
1782
+ }
1783
+ if (request.fragment) {
1784
+ path += `#${request.fragment}`;
1785
+ }
1786
+ const clientHttp2Stream = session.request({
1787
+ ...request.headers,
1788
+ [constants.HTTP2_HEADER_PATH]: path,
1789
+ [constants.HTTP2_HEADER_METHOD]: method
1790
+ });
1791
+ if (effectiveRequestTimeout) {
1792
+ clientHttp2Stream.setTimeout(effectiveRequestTimeout, () => {
1793
+ clientHttp2Stream.close();
1794
+ const timeoutError = new Error(`Stream timed out because of no activity for ${effectiveRequestTimeout} ms`);
1795
+ timeoutError.name = "TimeoutError";
1796
+ rejectWithDestroy(timeoutError);
1797
+ });
1798
+ }
1799
+ if (abortSignal) {
1800
+ const onAbort = () => {
1801
+ clientHttp2Stream.close();
1802
+ const abortError = buildAbortError(abortSignal);
1803
+ rejectWithDestroy(abortError);
1804
+ };
1805
+ if (typeof abortSignal.addEventListener === "function") {
1806
+ const signal = abortSignal;
1807
+ signal.addEventListener("abort", onAbort, { once: true });
1808
+ clientHttp2Stream.once("close", () => signal.removeEventListener("abort", onAbort));
1809
+ } else {
1810
+ abortSignal.onabort = onAbort;
1811
+ }
1812
+ }
1813
+ clientHttp2Stream.on("frameError", (type, code, id) => {
1814
+ rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`));
1815
+ });
1816
+ clientHttp2Stream.on("error", rejectWithDestroy);
1817
+ clientHttp2Stream.on("aborted", () => {
1818
+ rejectWithDestroy(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${clientHttp2Stream.rstCode}.`));
1819
+ });
1820
+ clientHttp2Stream.on("response", (headers) => {
1821
+ const httpResponse = new HttpResponse({
1822
+ statusCode: headers[":status"] ?? -1,
1823
+ headers: getTransformedHeaders(headers),
1824
+ body: clientHttp2Stream
1825
+ });
1826
+ fulfilled = true;
1827
+ resolve({ response: httpResponse });
1828
+ if (useIsolatedSession) {
1829
+ session.close();
1830
+ clientHttp2Stream.on("end", () => {
1831
+ ref.destroy();
1832
+ });
1833
+ }
1834
+ });
1835
+ clientHttp2Stream.on("close", () => {
1836
+ if (useIsolatedSession) {
1837
+ ref.destroy();
1838
+ } else {
1839
+ this.connectionManager.release(requestContext, ref);
1840
+ }
1841
+ if (!fulfilled) {
1842
+ const error = new Error("Unexpected error: http2 request did not get a response");
1843
+ if (session.destroyed) {
1844
+ error.name = "TimeoutError";
1845
+ }
1846
+ rejectWithDestroy(error);
1847
+ }
1848
+ });
1849
+ writeRequestBodyPromise = writeRequestBody(clientHttp2Stream, request, effectiveRequestTimeout);
1850
+ });
1851
+ }
1852
+ updateHttpClientConfig(key, value) {
1853
+ this.config = undefined;
1854
+ this.configProvider = this.configProvider.then((config) => {
1855
+ return {
1856
+ ...config,
1857
+ [key]: value
1858
+ };
1859
+ });
1860
+ }
1861
+ httpHandlerConfigs() {
1862
+ return this.config ?? {};
1863
+ }
1864
+ }
1865
+ exports.DEFAULT_REQUEST_TIMEOUT = DEFAULT_REQUEST_TIMEOUT;
1866
+ exports.NodeHttp2Handler = NodeHttp2Handler;
1867
+ exports.NodeHttpHandler = NodeHttpHandler;
1868
+ });
1869
+
1038
1870
  // node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js
1039
1871
  var { awsEndpointFunctions, emitWarningIfUnsupportedVersion: emitWarningIfUnsupportedVersion$1, createDefaultUserAgentProvider, NODE_APP_ID_CONFIG_OPTIONS, getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, resolveUserAgentConfig, resolveHostHeaderConfig, getUserAgentPlugin, getHostHeaderPlugin, getLoggerPlugin, getRecursionDetectionPlugin } = require_client2();
1040
- var { resolveEventStreamConfig, getEventStreamPlugin } = require_dist_cjs4();
1041
- var { resolveWebSocketConfig, getWebSocketPlugin } = require_dist_cjs6();
1872
+ var { resolveEventStreamConfig, getEventStreamPlugin } = require_dist_cjs2();
1873
+ var { resolveWebSocketConfig, getWebSocketPlugin } = require_dist_cjs5();
1042
1874
  var { memoizeIdentityProvider, isIdentityExpired, doesIdentityRequireRefresh, HttpBearerAuthSigner, getHttpAuthSchemeEndpointRuleSetPlugin, DefaultIdentityProviderConfig, getHttpSigningPlugin, createPaginator } = require_dist_cjs();
1043
1875
  var { normalizeProvider, getSmithyContext, ServiceException, NoOpLogger, emitWarningIfUnsupportedVersion, loadConfigsForDefaultMode, getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig, Client, makeBuilder, createAggregatedClient } = require_client();
1044
1876
  var { Command: $Command } = require_client();
@@ -1050,10 +1882,10 @@ var { DEFAULT_RETRY_MODE, NODE_RETRY_MODE_CONFIG_OPTIONS, NODE_MAX_ATTEMPT_CONFI
1050
1882
  var { TypeRegistry, getSchemaSerdePlugin } = require_schema();
1051
1883
  var { resolveAwsSdkSigV4Config, AwsSdkSigV4Signer, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS } = require_httpAuthSchemes();
1052
1884
  var { defaultProvider } = require_dist_cjs3();
1053
- var { eventStreamPayloadHandlerProvider } = require_dist_cjs7();
1054
- var { fromEnvSigningName, nodeProvider } = require_dist_cjs8();
1885
+ var { eventStreamPayloadHandlerProvider } = require_dist_cjs6();
1886
+ var { fromEnvSigningName, nodeProvider } = require_dist_cjs7();
1055
1887
  var { toUtf8, fromUtf8, toBase64, fromBase64, calculateBodyLength } = require_serde();
1056
- var { streamCollector, NodeHttp2Handler } = require_dist_cjs2();
1888
+ var { streamCollector, NodeHttp2Handler } = require_dist_cjs8();
1057
1889
  var { AwsRestJsonProtocol } = require_protocols2();
1058
1890
  var { Sha256 } = require_checksum();
1059
1891
  var defaultBedrockRuntimeHttpAuthSchemeParametersProvider = async (config, context, input) => {
@@ -4316,8 +5148,431 @@ var $ImageFormat = ImageFormat;
4316
5148
  var $StopReason = StopReason;
4317
5149
  var $ToolResultStatus = ToolResultStatus;
4318
5150
 
4319
- // node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js
4320
- var import_node_http_handler = __toESM(require_dist_cjs2(), 1);
5151
+ // node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-cjs/index.js
5152
+ var { hasOwn } = require_serde();
5153
+ var { streamCollector: streamCollector2 } = require_serde();
5154
+ var { buildQueryString, HttpResponse } = require_protocols();
5155
+ var node_https = __require("node:https");
5156
+ var { Readable } = __require("node:stream");
5157
+ var http2 = __require("node:http2");
5158
+ function buildAbortError(abortSignal) {
5159
+ const reason = abortSignal && typeof abortSignal === "object" && "reason" in abortSignal ? abortSignal.reason : undefined;
5160
+ if (reason) {
5161
+ if (reason instanceof Error) {
5162
+ const abortError = new Error("Request aborted");
5163
+ abortError.name = "AbortError";
5164
+ abortError.cause = reason;
5165
+ return abortError;
5166
+ }
5167
+ const abortError = new Error(String(reason));
5168
+ abortError.name = "AbortError";
5169
+ return abortError;
5170
+ }
5171
+ const abortError = new Error("Request aborted");
5172
+ abortError.name = "AbortError";
5173
+ return abortError;
5174
+ }
5175
+ var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"];
5176
+ var getTransformedHeaders = (headers) => {
5177
+ const transformedHeaders = {};
5178
+ for (const name in headers) {
5179
+ if (!hasOwn(headers, name))
5180
+ continue;
5181
+ const headerValues = headers[name];
5182
+ transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues;
5183
+ }
5184
+ return transformedHeaders;
5185
+ };
5186
+ var timing = {
5187
+ setTimeout: (cb, ms) => setTimeout(cb, ms),
5188
+ clearTimeout: (timeoutId) => clearTimeout(timeoutId)
5189
+ };
5190
+ var DEFER_EVENT_LISTENER_TIME$2 = 1000;
5191
+ var setConnectionTimeout = (request, reject, timeoutInMs = 0) => {
5192
+ if (!timeoutInMs) {
5193
+ return -1;
5194
+ }
5195
+ const registerTimeout = (offset) => {
5196
+ const timeoutId = timing.setTimeout(() => {
5197
+ request.destroy();
5198
+ reject(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${timeoutInMs} ms.`), {
5199
+ name: "TimeoutError"
5200
+ }));
5201
+ }, timeoutInMs - offset);
5202
+ const doWithSocket = (socket) => {
5203
+ if (socket?.connecting) {
5204
+ socket.on("connect", () => {
5205
+ timing.clearTimeout(timeoutId);
5206
+ });
5207
+ } else {
5208
+ timing.clearTimeout(timeoutId);
5209
+ }
5210
+ };
5211
+ if (request.socket) {
5212
+ doWithSocket(request.socket);
5213
+ } else {
5214
+ request.on("socket", doWithSocket);
5215
+ }
5216
+ };
5217
+ if (timeoutInMs < 2000) {
5218
+ registerTimeout(0);
5219
+ return 0;
5220
+ }
5221
+ return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME$2), DEFER_EVENT_LISTENER_TIME$2);
5222
+ };
5223
+ var setRequestTimeout = (req, reject, timeoutInMs = 0, throwOnRequestTimeout, logger) => {
5224
+ if (timeoutInMs) {
5225
+ return timing.setTimeout(() => {
5226
+ let msg = `@smithy/node-http-handler - [${throwOnRequestTimeout ? "ERROR" : "WARN"}] a request has exceeded the configured ${timeoutInMs} ms requestTimeout.`;
5227
+ if (throwOnRequestTimeout) {
5228
+ const error = Object.assign(new Error(msg), {
5229
+ name: "TimeoutError",
5230
+ code: "ETIMEDOUT"
5231
+ });
5232
+ req.destroy(error);
5233
+ reject(error);
5234
+ } else {
5235
+ msg += ` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;
5236
+ logger?.warn?.(msg);
5237
+ }
5238
+ }, timeoutInMs);
5239
+ }
5240
+ return -1;
5241
+ };
5242
+ var DEFER_EVENT_LISTENER_TIME$1 = 3000;
5243
+ var setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME$1) => {
5244
+ if (keepAlive !== true) {
5245
+ return -1;
5246
+ }
5247
+ const registerListener = () => {
5248
+ if (request.socket) {
5249
+ request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
5250
+ } else {
5251
+ request.on("socket", (socket) => {
5252
+ socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
5253
+ });
5254
+ }
5255
+ };
5256
+ if (deferTimeMs === 0) {
5257
+ registerListener();
5258
+ return 0;
5259
+ }
5260
+ return timing.setTimeout(registerListener, deferTimeMs);
5261
+ };
5262
+ var DEFER_EVENT_LISTENER_TIME = 3000;
5263
+ var setSocketTimeout = (request, reject, timeoutInMs = 0) => {
5264
+ const registerTimeout = (offset) => {
5265
+ const timeout = timeoutInMs - offset;
5266
+ const onTimeout = () => {
5267
+ request.destroy();
5268
+ reject(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (configured by client requestHandler).`), { name: "TimeoutError" }));
5269
+ };
5270
+ if (request.socket) {
5271
+ request.socket.setTimeout(timeout, onTimeout);
5272
+ request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
5273
+ } else {
5274
+ request.setTimeout(timeout, onTimeout);
5275
+ }
5276
+ };
5277
+ if (0 < timeoutInMs && timeoutInMs < 6000) {
5278
+ registerTimeout(0);
5279
+ return 0;
5280
+ }
5281
+ return timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
5282
+ };
5283
+ var MIN_WAIT_TIME = 6000;
5284
+ async function writeRequestBody(httpRequest, request, maxContinueTimeoutMs = MIN_WAIT_TIME, externalAgent = false) {
5285
+ const headers = request.headers;
5286
+ const expect = headers ? headers.Expect || headers.expect : undefined;
5287
+ let timeoutId = -1;
5288
+ let sendBody = true;
5289
+ if (!externalAgent && expect === "100-continue") {
5290
+ sendBody = await Promise.race([
5291
+ new Promise((resolve) => {
5292
+ timeoutId = Number(timing.setTimeout(() => resolve(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
5293
+ }),
5294
+ new Promise((resolve) => {
5295
+ httpRequest.on("continue", () => {
5296
+ timing.clearTimeout(timeoutId);
5297
+ resolve(true);
5298
+ });
5299
+ httpRequest.on("response", () => {
5300
+ timing.clearTimeout(timeoutId);
5301
+ resolve(false);
5302
+ });
5303
+ httpRequest.on("error", () => {
5304
+ timing.clearTimeout(timeoutId);
5305
+ resolve(false);
5306
+ });
5307
+ })
5308
+ ]);
5309
+ }
5310
+ if (sendBody) {
5311
+ writeBody(httpRequest, request.body);
5312
+ }
5313
+ }
5314
+ function writeBody(httpRequest, body) {
5315
+ if (body instanceof Readable) {
5316
+ body.pipe(httpRequest);
5317
+ return;
5318
+ }
5319
+ if (body) {
5320
+ const isBuffer = Buffer.isBuffer(body);
5321
+ const isString = typeof body === "string";
5322
+ if (isBuffer || isString) {
5323
+ if (isBuffer && body.byteLength === 0) {
5324
+ httpRequest.end();
5325
+ } else {
5326
+ httpRequest.end(body);
5327
+ }
5328
+ return;
5329
+ }
5330
+ const uint8 = body;
5331
+ if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") {
5332
+ httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength));
5333
+ return;
5334
+ }
5335
+ httpRequest.end(Buffer.from(body));
5336
+ return;
5337
+ }
5338
+ httpRequest.end();
5339
+ }
5340
+ var hAgent = undefined;
5341
+ var hRequest = undefined;
5342
+
5343
+ class NodeHttpHandler {
5344
+ config;
5345
+ configProvider;
5346
+ socketWarningTimestamp = 0;
5347
+ externalAgent = false;
5348
+ metadata = { handlerProtocol: "http/1.1" };
5349
+ static create(instanceOrOptions) {
5350
+ if (typeof instanceOrOptions?.handle === "function") {
5351
+ return instanceOrOptions;
5352
+ }
5353
+ return new NodeHttpHandler(instanceOrOptions);
5354
+ }
5355
+ static checkSocketUsage(agent, socketWarningTimestamp, logger = console) {
5356
+ const { sockets, requests, maxSockets } = agent;
5357
+ if (typeof maxSockets !== "number" || maxSockets === Infinity) {
5358
+ return socketWarningTimestamp;
5359
+ }
5360
+ const interval = 15000;
5361
+ if (Date.now() - interval < socketWarningTimestamp) {
5362
+ return socketWarningTimestamp;
5363
+ }
5364
+ if (sockets && requests) {
5365
+ for (const origin in sockets) {
5366
+ if (!hasOwn(sockets, origin))
5367
+ continue;
5368
+ const socketsInUse = sockets[origin]?.length ?? 0;
5369
+ const requestsEnqueued = requests[origin]?.length ?? 0;
5370
+ if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) {
5371
+ logger?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
5372
+ See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
5373
+ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);
5374
+ return Date.now();
5375
+ }
5376
+ }
5377
+ }
5378
+ return socketWarningTimestamp;
5379
+ }
5380
+ constructor(options) {
5381
+ this.configProvider = new Promise((resolve, reject) => {
5382
+ if (typeof options === "function") {
5383
+ options().then((_options) => {
5384
+ resolve(this.resolveDefaultConfig(_options));
5385
+ }).catch(reject);
5386
+ } else {
5387
+ resolve(this.resolveDefaultConfig(options));
5388
+ }
5389
+ });
5390
+ }
5391
+ destroy() {
5392
+ this.config?.httpAgent?.destroy();
5393
+ this.config?.httpsAgent?.destroy();
5394
+ }
5395
+ async handle(request, { abortSignal, requestTimeout } = {}) {
5396
+ if (!this.config) {
5397
+ this.config = await this.configProvider;
5398
+ }
5399
+ const config = this.config;
5400
+ const logger = config.logger;
5401
+ const isSSL = request.protocol === "https:";
5402
+ if (!isSSL && !this.config.httpAgent) {
5403
+ this.config.httpAgent = await this.config.httpAgentProvider();
5404
+ }
5405
+ return new Promise((_resolve, _reject) => {
5406
+ let writeRequestBodyPromise = undefined;
5407
+ let socketWarningTimeoutId = -1;
5408
+ let connectionTimeoutId = -1;
5409
+ let requestTimeoutId = -1;
5410
+ let socketTimeoutId = -1;
5411
+ let keepAliveTimeoutId = -1;
5412
+ const clearTimeouts = () => {
5413
+ timing.clearTimeout(socketWarningTimeoutId);
5414
+ timing.clearTimeout(connectionTimeoutId);
5415
+ timing.clearTimeout(requestTimeoutId);
5416
+ timing.clearTimeout(socketTimeoutId);
5417
+ timing.clearTimeout(keepAliveTimeoutId);
5418
+ };
5419
+ const resolve = async (arg) => {
5420
+ await writeRequestBodyPromise;
5421
+ clearTimeouts();
5422
+ _resolve(arg);
5423
+ };
5424
+ const reject = async (arg) => {
5425
+ await writeRequestBodyPromise;
5426
+ clearTimeouts();
5427
+ _reject(arg);
5428
+ };
5429
+ if (abortSignal?.aborted) {
5430
+ const abortError = buildAbortError(abortSignal);
5431
+ reject(abortError);
5432
+ return;
5433
+ }
5434
+ const headers = request.headers;
5435
+ const expectContinue = headers ? (headers.Expect ?? headers.expect) === "100-continue" : false;
5436
+ let agent = isSSL ? config.httpsAgent : config.httpAgent;
5437
+ if (expectContinue && !this.externalAgent) {
5438
+ agent = new (isSSL ? node_https.Agent : hAgent)({
5439
+ keepAlive: false,
5440
+ maxSockets: Infinity
5441
+ });
5442
+ }
5443
+ socketWarningTimeoutId = timing.setTimeout(() => {
5444
+ this.socketWarningTimestamp = NodeHttpHandler.checkSocketUsage(agent, this.socketWarningTimestamp, logger);
5445
+ }, config.socketAcquisitionWarningTimeout ?? (config.requestTimeout ?? 2000) + (config.connectionTimeout ?? 1000));
5446
+ const queryString = request.query ? buildQueryString(request.query) : "";
5447
+ let auth = undefined;
5448
+ if (request.username != null || request.password != null) {
5449
+ const username = request.username ?? "";
5450
+ const password = request.password ?? "";
5451
+ auth = `${username}:${password}`;
5452
+ }
5453
+ let path = request.path;
5454
+ if (queryString) {
5455
+ path += `?${queryString}`;
5456
+ }
5457
+ if (request.fragment) {
5458
+ path += `#${request.fragment}`;
5459
+ }
5460
+ let hostname = request.hostname ?? "";
5461
+ if (hostname[0] === "[" && hostname.endsWith("]")) {
5462
+ hostname = request.hostname.slice(1, -1);
5463
+ } else {
5464
+ hostname = request.hostname;
5465
+ }
5466
+ const nodeHttpsOptions = {
5467
+ headers: request.headers,
5468
+ host: hostname,
5469
+ method: request.method,
5470
+ path,
5471
+ port: request.port,
5472
+ agent,
5473
+ auth
5474
+ };
5475
+ const requestFunc = isSSL ? node_https.request : hRequest;
5476
+ const req = requestFunc(nodeHttpsOptions, (res) => {
5477
+ const httpResponse = new HttpResponse({
5478
+ statusCode: res.statusCode || -1,
5479
+ reason: res.statusMessage,
5480
+ headers: getTransformedHeaders(res.headers),
5481
+ body: res
5482
+ });
5483
+ resolve({ response: httpResponse });
5484
+ });
5485
+ req.on("error", (err) => {
5486
+ if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
5487
+ reject(Object.assign(err, { name: "TimeoutError" }));
5488
+ } else {
5489
+ reject(err);
5490
+ }
5491
+ });
5492
+ if (abortSignal) {
5493
+ const onAbort = () => {
5494
+ req.destroy();
5495
+ const abortError = buildAbortError(abortSignal);
5496
+ reject(abortError);
5497
+ };
5498
+ if (typeof abortSignal.addEventListener === "function") {
5499
+ const signal = abortSignal;
5500
+ signal.addEventListener("abort", onAbort, { once: true });
5501
+ req.once("close", () => signal.removeEventListener("abort", onAbort));
5502
+ } else {
5503
+ abortSignal.onabort = onAbort;
5504
+ }
5505
+ }
5506
+ const effectiveRequestTimeout = requestTimeout ?? config.requestTimeout;
5507
+ connectionTimeoutId = setConnectionTimeout(req, reject, config.connectionTimeout);
5508
+ requestTimeoutId = setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, logger ?? console);
5509
+ socketTimeoutId = setSocketTimeout(req, reject, config.socketTimeout);
5510
+ const httpAgent = nodeHttpsOptions.agent;
5511
+ if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
5512
+ keepAliveTimeoutId = setSocketKeepAlive(req, {
5513
+ keepAlive: httpAgent.keepAlive,
5514
+ keepAliveMsecs: httpAgent.keepAliveMsecs
5515
+ });
5516
+ }
5517
+ writeRequestBodyPromise = writeRequestBody(req, request, effectiveRequestTimeout, this.externalAgent).catch((e) => {
5518
+ clearTimeouts();
5519
+ return _reject(e);
5520
+ });
5521
+ });
5522
+ }
5523
+ updateHttpClientConfig(key, value) {
5524
+ this.config = undefined;
5525
+ this.configProvider = this.configProvider.then((config) => {
5526
+ if (key === Symbol.for("logger")) {
5527
+ return {
5528
+ ...config,
5529
+ logger: config.logger ?? value
5530
+ };
5531
+ }
5532
+ return {
5533
+ ...config,
5534
+ [key]: value
5535
+ };
5536
+ });
5537
+ }
5538
+ httpHandlerConfigs() {
5539
+ return this.config ?? {};
5540
+ }
5541
+ resolveDefaultConfig(options) {
5542
+ const { requestTimeout, connectionTimeout, socketTimeout, socketAcquisitionWarningTimeout, httpAgent, httpsAgent, throwOnRequestTimeout, logger } = options || {};
5543
+ const keepAlive = true;
5544
+ const maxSockets = 50;
5545
+ return {
5546
+ connectionTimeout,
5547
+ requestTimeout,
5548
+ socketTimeout,
5549
+ socketAcquisitionWarningTimeout,
5550
+ throwOnRequestTimeout,
5551
+ httpAgentProvider: async () => {
5552
+ const node_http = __require("node:http");
5553
+ const { Agent, request } = node_http.default ?? node_http;
5554
+ hRequest = request;
5555
+ hAgent = Agent;
5556
+ if (httpAgent instanceof hAgent || typeof httpAgent?.destroy === "function") {
5557
+ this.externalAgent = true;
5558
+ return httpAgent;
5559
+ }
5560
+ return new hAgent({ keepAlive, maxSockets, ...httpAgent });
5561
+ },
5562
+ httpsAgent: (() => {
5563
+ if (httpsAgent instanceof node_https.Agent || typeof httpsAgent?.destroy === "function") {
5564
+ this.externalAgent = true;
5565
+ return httpsAgent;
5566
+ }
5567
+ return new node_https.Agent({ keepAlive, maxSockets, ...httpsAgent });
5568
+ })(),
5569
+ logger
5570
+ };
5571
+ }
5572
+ }
5573
+ var ids = new Uint16Array(1);
5574
+ var { constants } = http2;
5575
+ var $NodeHttpHandler = NodeHttpHandler;
4321
5576
 
4322
5577
  // node_modules/http-proxy-agent/dist/index.js
4323
5578
  var import_debug = __toESM(require_src3(), 1);
@@ -4904,12 +6159,12 @@ var stream = (model, context, options = {}) => {
4904
6159
  }
4905
6160
  const proxyUrl = resolveHttpProxyUrlForTarget(model.baseUrl, options.env);
4906
6161
  if (proxyUrl) {
4907
- config.requestHandler = new import_node_http_handler.NodeHttpHandler({
6162
+ config.requestHandler = new $NodeHttpHandler({
4908
6163
  httpAgent: new HttpProxyAgent(proxyUrl),
4909
6164
  httpsAgent: new HttpsProxyAgent(proxyUrl)
4910
6165
  });
4911
6166
  } else if (getProviderEnvValue("AWS_BEDROCK_FORCE_HTTP1", options.env) === "1") {
4912
- config.requestHandler = new import_node_http_handler.NodeHttpHandler;
6167
+ config.requestHandler = new $NodeHttpHandler;
4913
6168
  }
4914
6169
  } else {
4915
6170
  config.region = configuredRegion || (endpointRegion && useExplicitEndpoint ? endpointRegion : undefined) || "us-east-1";