alchemylab-opencode 2.0.1 → 2.0.4

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 (232) hide show
  1. package/NODE_COMPAT.md +8 -1
  2. package/dist/20260127222353_familiar_lady_ursula-YYOFSQD5.js +18 -0
  3. package/dist/20260211171708_add_project_commands-3GKQTPBZ.js +18 -0
  4. package/dist/20260213144116_wakeful_the_professor-ROO7OAVL.js +18 -0
  5. package/dist/20260225215848_workspace-V2OZTNFF.js +18 -0
  6. package/dist/20260227213759_add_session_workspace_id-GVDWAXKM.js +18 -0
  7. package/dist/20260228203230_blue_harpoon-Z5QP2II5.js +18 -0
  8. package/dist/20260303231226_add_workspace_fields-QOVAFN7W.js +18 -0
  9. package/dist/20260309230000_move_org_to_state-RQURSDZD.js +18 -0
  10. package/dist/20260312043431_session_message_cursor-VBISKDXL.js +18 -0
  11. package/dist/20260323234822_events-PILJHLNA.js +18 -0
  12. package/dist/20260410174513_workspace-name-63YCZ5NS.js +18 -0
  13. package/dist/20260413175956_chief_energizer-NMAZYGDO.js +18 -0
  14. package/dist/20260423070820_add_icon_url_override-RAJCVNEP.js +18 -0
  15. package/dist/20260427172553_slow_nightmare-ULYYZLR4.js +18 -0
  16. package/dist/20260428004200_add_session_path-U4WO2TGE.js +18 -0
  17. package/dist/20260501142318_next_venus-6BCYATSC.js +18 -0
  18. package/dist/20260504145000_add_sync_owner-RGVHV6LN.js +18 -0
  19. package/dist/20260507164347_add_workspace_time-GE6UHNPM.js +18 -0
  20. package/dist/{20260510033149_session_usage-UGBVOXZB.js → 20260510033149_session_usage-7XHCFVKY.js} +5 -1
  21. package/dist/20260511000411_data_migration_state-2EGZKFLB.js +18 -0
  22. package/dist/20260511173437_session-metadata-K322YY33.js +18 -0
  23. package/dist/20260601010001_normalize_storage_paths-VZDTY366.js +18 -0
  24. package/dist/{20260225215848_workspace-ZMSOZSPA.js → 20260601202201_amazing_prowler-YT6PLK3L.js} +5 -1
  25. package/dist/{20260228203230_blue_harpoon-IW3Z4TQZ.js → 20260602002951_lowly_union_jack-6VLQTBVB.js} +5 -1
  26. package/dist/20260602182828_add_project_directories-TVSRD25A.js +18 -0
  27. package/dist/20260603001617_session_message_projection_indexes-PHKTF6HK.js +18 -0
  28. package/dist/{20260622170816_reset_v2_session_state-5JPHJTZG.js → 20260603040000_session_message_projection_order-7RTV2POG.js} +5 -1
  29. package/dist/20260603141458_session_input_inbox-RSBWABG7.js +18 -0
  30. package/dist/20260603160727_jittery_ezekiel_stane-DXBLLRVV.js +18 -0
  31. package/dist/20260604172448_event_sourced_session_input-H6Z3JEBD.js +18 -0
  32. package/dist/20260605003541_add_session_context_snapshot-6FDPM2TK.js +18 -0
  33. package/dist/20260605042240_add_context_epoch_agent-C2OF2UKR.js +18 -0
  34. package/dist/20260611035744_credential-YNZ47FSH.js +18 -0
  35. package/dist/20260611192811_lush_chimera-E357VI6P.js +18 -0
  36. package/dist/20260612174303_project_dir_strategy-VUGGK42O.js +18 -0
  37. package/dist/20260622142730_simplify_session_context_epoch-UYGXZ5BX.js +18 -0
  38. package/dist/20260622170816_reset_v2_session_state-EILLPCJQ.js +18 -0
  39. package/dist/20260622202450_simplify_session_input-Y65GDGBO.js +18 -0
  40. package/dist/NodeSdk-AGMQWBHH.js +18 -0
  41. package/dist/anthropic-45OFTLAW.js +18 -0
  42. package/dist/anthropic-FVULF7C3.js +18 -0
  43. package/dist/app-runtime-LDQWNGWP.js +18 -0
  44. package/dist/chunk-2JE3QYG6.js +18 -0
  45. package/dist/chunk-2MRHL4B2.js +18 -0
  46. package/dist/chunk-4GJE6OMN.js +190 -0
  47. package/dist/chunk-4MBUHJHY.js +22 -0
  48. package/dist/chunk-5BLZCAU6.js +55 -0
  49. package/dist/chunk-7XX6TY62.js +259 -0
  50. package/dist/chunk-ANF3QA3Z.js +48 -0
  51. package/dist/chunk-AZUMH3TO.js +18 -0
  52. package/dist/chunk-B74WSFN4.js +878 -0
  53. package/dist/chunk-BQ4IEPN3.js +19 -0
  54. package/dist/chunk-CYRZU5QM.js +33 -0
  55. package/dist/chunk-DADVNQTM.js +1490 -0
  56. package/dist/chunk-DO2UZ6NY.js +18 -0
  57. package/dist/chunk-DWEYXIQI.js +780 -0
  58. package/dist/chunk-EK6FQQHY.js +20 -0
  59. package/dist/chunk-ELPXQ32J.js +90 -0
  60. package/dist/chunk-FGLPSSRK.js +19 -0
  61. package/dist/chunk-FOHYZ7MJ.js +55 -0
  62. package/dist/chunk-FV7U6PVP.js +18 -0
  63. package/dist/chunk-FYYAOZPU.js +18 -0
  64. package/dist/chunk-G7PFO5HG.js +920 -0
  65. package/dist/chunk-GDWO6EXN.js +22 -0
  66. package/dist/chunk-GW3ZRKAI.js +20 -0
  67. package/dist/chunk-IYUSBBGY.js +35 -0
  68. package/dist/chunk-JPOFLMNH.js +18 -0
  69. package/dist/{chunk-VURLSDCB.js → chunk-K5LKDIVU.js} +4 -0
  70. package/dist/chunk-KS4WLVK5.js +19 -0
  71. package/dist/chunk-LIXP4TPL.js +18 -0
  72. package/dist/chunk-LSC4RT5V.js +36 -0
  73. package/dist/chunk-M5A6NFHQ.js +28 -0
  74. package/dist/chunk-M6E6KNLV.js +30 -0
  75. package/dist/chunk-MLFZXUGQ.js +18 -0
  76. package/dist/chunk-NDI67DRG.js +31 -0
  77. package/dist/chunk-NGT6LCW6.js +18 -0
  78. package/dist/chunk-OCWGUTZJ.js +36 -0
  79. package/dist/chunk-OGDRUXMJ.js +18 -0
  80. package/dist/chunk-OGJKLJC7.js +29 -0
  81. package/dist/chunk-OT2YNR56.js +19 -0
  82. package/dist/chunk-OUVSKG2H.js +19 -0
  83. package/dist/chunk-P5RLCJUV.js +18 -0
  84. package/dist/chunk-Q3WIUQXB.js +18 -0
  85. package/dist/{20260227213759_add_session_workspace_id-ROENWPKA.js → chunk-QCRIXKIC.js} +5 -1
  86. package/dist/chunk-QD24DLUD.js +18 -0
  87. package/dist/chunk-R2GWBJEP.js +18 -0
  88. package/dist/chunk-RPAXSOGH.js +18 -0
  89. package/dist/chunk-TK5R7QUN.js +18 -0
  90. package/dist/chunk-TNQWZFIZ.js +28 -0
  91. package/dist/chunk-UCLPBO4I.js +18 -0
  92. package/dist/chunk-UPEPL4I2.js +18 -0
  93. package/dist/chunk-V6FDDNGV.js +117 -0
  94. package/dist/chunk-V6HERYFV.js +18 -0
  95. package/dist/chunk-V7XKKJ7X.js +24 -0
  96. package/dist/chunk-VHDYUBBS.js +23 -0
  97. package/dist/chunk-VWLJXTZ5.js +18 -0
  98. package/dist/chunk-VXAPFOIL.js +22 -0
  99. package/dist/chunk-WKZYINC7.js +29 -0
  100. package/dist/chunk-WPMP2ZFE.js +40 -0
  101. package/dist/chunk-WRTNIOI3.js +18 -0
  102. package/dist/chunk-X5F46HR5.js +18 -0
  103. package/dist/chunk-XPS7TQZG.js +22 -0
  104. package/dist/chunk-YJPP6IQ3.js +23 -0
  105. package/dist/chunk-ZYQWFC55.js +22 -0
  106. package/dist/code-mode-YYOGD36U.js +502 -0
  107. package/dist/copilot-provider-QVMLQZZC.js +18 -0
  108. package/dist/dist-5NQOHNPL.js +18 -0
  109. package/dist/dist-7CT3XCNN.js +32 -0
  110. package/dist/dist-CL46WFZG.js +18 -0
  111. package/dist/{20260605042240_add_context_epoch_agent-W6IQYZXE.js → dist-CYBRID2F.js} +5 -1
  112. package/dist/dist-HXJTF22W.js +32 -0
  113. package/dist/dist-JFXI53ZF.js +22 -0
  114. package/dist/dist-KBYKWVT5.js +22 -0
  115. package/dist/dist-KM5HCPZX.js +35 -0
  116. package/dist/dist-KTNLTEHB.js +18 -0
  117. package/dist/dist-KZ5R5QM5.js +24 -0
  118. package/dist/dist-NLXUYBW7.js +32 -0
  119. package/dist/dist-O4DF72J2.js +22 -0
  120. package/dist/dist-PH4MEGVR.js +22 -0
  121. package/dist/{20260511000411_data_migration_state-FB4LBFSE.js → dist-QJPOJCLB.js} +5 -1
  122. package/dist/dist-QYH62TCJ.js +22 -0
  123. package/dist/{20260303231226_add_workspace_fields-OUVZMNAG.js → dist-RIC4WKHC.js} +5 -1
  124. package/dist/dist-T776XKTM.js +22 -0
  125. package/dist/dist-TCE5MKZQ.js +23 -0
  126. package/dist/dist-TH2Q44RX.js +50 -0
  127. package/dist/dist-VV5FV5RT.js +101 -0
  128. package/dist/dist-XAFENVUS.js +22 -0
  129. package/dist/dist-XPFB35TX.js +32 -0
  130. package/dist/dist-YUH4RKR5.js +28 -0
  131. package/dist/dist-es-43ZM44MP.js +18 -0
  132. package/dist/dist-es-6PLFRCS4.js +18 -0
  133. package/dist/dist-es-G5UIJOU7.js +26 -0
  134. package/dist/{20260428004200_add_session_path-LGW75WYA.js → dist-es-HYIIGUNX.js} +5 -1
  135. package/dist/dist-es-L2GU465G.js +18 -0
  136. package/dist/dist-es-LSR2QCFZ.js +18 -0
  137. package/dist/dist-es-RGEIM2BP.js +18 -0
  138. package/dist/dist-es-SITTNOGV.js +18 -0
  139. package/dist/dist-es-W5GYOX6F.js +18 -0
  140. package/dist/esm-NN5W7YCL.js +18 -0
  141. package/dist/esm-XWJSHYHG.js +18 -0
  142. package/dist/getMachineId-bsd-L5I5TZ5I.js +18 -0
  143. package/dist/getMachineId-darwin-YB7KG37W.js +19 -0
  144. package/dist/getMachineId-linux-EL47KXX7.js +18 -0
  145. package/dist/getMachineId-unsupported-QOWPEBPN.js +18 -0
  146. package/dist/getMachineId-win-HCRYRDFJ.js +18 -0
  147. package/dist/lib-ZP7Q6A3E.js +199 -0
  148. package/dist/loadCognitoIdentity-EWT55EI7.js +18 -0
  149. package/dist/loadSso-AGOUE6RL.js +18 -0
  150. package/dist/{20260213144116_wakeful_the_professor-ZVDD54AK.js → loadSts-RH5L3PIX.js} +5 -1
  151. package/dist/mantle-IJXDXT4M.js +25 -0
  152. package/dist/mime-types-46EO4HOZ.js +18 -0
  153. package/dist/multipart-parser-KZWMKXA4.js +19 -0
  154. package/dist/{20260211171708_add_project_commands-GDOHPDPF.js → open-7KXTRM37.js} +5 -1
  155. package/dist/openai-ZOJI6I5R.js +18 -0
  156. package/dist/p-map-CYL6ILJW.js +18 -0
  157. package/dist/photon-W56QZY4L.js +18 -0
  158. package/dist/{20260423070820_add_icon_url_override-X5SHFGTI.js → pkce-VT4ITJTB.js} +5 -1
  159. package/dist/{pty.node-Y3N2XKYG.js → pty.node-IWULXXG6.js} +5 -1
  160. package/dist/run.js +5 -1
  161. package/dist/serve.js +143 -1
  162. package/dist/server-LVIHYOCY.js +21 -0
  163. package/dist/session-6OPJNJMK.js +18 -0
  164. package/dist/signin-OCIW23YM.js +18 -0
  165. package/dist/src-3NCXEROI.js +18 -0
  166. package/dist/src-LXWGIUZH.js +18 -0
  167. package/dist/src-WDYKISPD.js +20 -0
  168. package/dist/src-YAAFIGTW.js +18 -0
  169. package/dist/sso-oidc-OMMKINFE.js +18 -0
  170. package/dist/sts-MWK22JIX.js +18 -0
  171. package/dist/token-QPO3OAGS.js +18 -0
  172. package/dist/token-util-YGPCEEPO.js +18 -0
  173. package/dist/unified-W3ZKZ4HG.js +18 -0
  174. package/dist/worktree-32M5MTFE.js +18 -0
  175. package/package.json +40 -40
  176. package/postinstall.cjs +4 -2
  177. package/dist/20260127222353_familiar_lady_ursula-KV747FJX.js +0 -14
  178. package/dist/20260309230000_move_org_to_state-NOXAPU5V.js +0 -14
  179. package/dist/20260312043431_session_message_cursor-DJ4T3T4R.js +0 -14
  180. package/dist/20260323234822_events-72GIKJ2A.js +0 -14
  181. package/dist/20260410174513_workspace-name-JXSWFBJN.js +0 -14
  182. package/dist/20260413175956_chief_energizer-4HEWZ6U3.js +0 -14
  183. package/dist/20260427172553_slow_nightmare-PS5T2AH2.js +0 -14
  184. package/dist/20260501142318_next_venus-J3TLVXZ6.js +0 -14
  185. package/dist/20260504145000_add_sync_owner-3R52GB4C.js +0 -14
  186. package/dist/20260507164347_add_workspace_time-JHDRCZAR.js +0 -14
  187. package/dist/20260511173437_session-metadata-T2XHGWHS.js +0 -14
  188. package/dist/20260601010001_normalize_storage_paths-5MAY5GT3.js +0 -14
  189. package/dist/20260601202201_amazing_prowler-PET224YG.js +0 -14
  190. package/dist/20260602002951_lowly_union_jack-PG6XDMGL.js +0 -14
  191. package/dist/20260602182828_add_project_directories-ZCH2ACGG.js +0 -14
  192. package/dist/20260603001617_session_message_projection_indexes-XVLJTUF2.js +0 -14
  193. package/dist/20260603040000_session_message_projection_order-XG6RACZQ.js +0 -14
  194. package/dist/20260603141458_session_input_inbox-K2VQ7V6E.js +0 -14
  195. package/dist/20260603160727_jittery_ezekiel_stane-WKJLRDO7.js +0 -14
  196. package/dist/20260604172448_event_sourced_session_input-NTXOECR7.js +0 -14
  197. package/dist/20260605003541_add_session_context_snapshot-DXMQEXMT.js +0 -14
  198. package/dist/20260611035744_credential-XTMSYTJD.js +0 -14
  199. package/dist/20260611192811_lush_chimera-XPLIQMJD.js +0 -14
  200. package/dist/20260612174303_project_dir_strategy-FR2NGQKK.js +0 -14
  201. package/dist/20260622142730_simplify_session_context_epoch-NTQZR3RE.js +0 -14
  202. package/dist/20260622202450_simplify_session_input-2EXF2HMV.js +0 -14
  203. package/dist/app-runtime-HQBOCDV5.js +0 -14
  204. package/dist/chunk-4FEBIOI5.js +0 -865
  205. package/dist/chunk-4K2RXRZL.js +0 -14
  206. package/dist/chunk-4RFMKEKM.js +0 -1455
  207. package/dist/chunk-BM2C7NHL.js +0 -41
  208. package/dist/chunk-MKEMZFJI.js +0 -393
  209. package/dist/chunk-OMDJ6ZZ2.js +0 -684
  210. package/dist/chunk-OWMG4NNF.js +0 -186
  211. package/dist/chunk-QRABYJKL.js +0 -14
  212. package/dist/chunk-RHIWAYN5.js +0 -14
  213. package/dist/chunk-Z5TLIUAI.js +0 -28
  214. package/dist/code-mode-7BQJUARW.js +0 -40
  215. package/dist/copilot-provider-TX4YFKJZ.js +0 -14
  216. package/dist/photon-VQS5F5BI.js +0 -14
  217. package/dist/server-BFUQR7MX.js +0 -17
  218. package/dist/session-6RNXZNG6.js +0 -14
  219. package/dist/worktree-QHQHX3SG.js +0 -14
  220. package/patches/@ai-sdk%2Famazon-bedrock@4.0.166.patch +0 -164
  221. package/patches/@ai-sdk%2Fanthropic@3.0.111.patch +0 -528
  222. package/patches/@ai-sdk%2Fgoogle@3.0.73.patch +0 -69
  223. package/patches/@ai-sdk%2Fgroq@3.0.31.patch +0 -79
  224. package/patches/@ai-sdk%2Fmistral@3.0.51.patch +0 -714
  225. package/patches/@ai-sdk%2Fopenai-compatible@2.0.41.patch +0 -39
  226. package/patches/@ai-sdk%2Fopenai@3.0.88.patch +0 -280
  227. package/patches/@ai-sdk%2Fxai@3.0.139.patch +0 -296
  228. package/patches/@modelcontextprotocol%2Fsdk@1.29.0.patch +0 -647
  229. package/patches/@npmcli%2Fagent@4.0.2.patch +0 -13
  230. package/patches/effect@4.0.0-beta.83.patch +0 -57
  231. package/patches/gcp-metadata@8.1.2.patch +0 -14
  232. package/patches/pacote@21.5.0.patch +0 -18
@@ -0,0 +1,18 @@
1
+ // Built by esbuild from opencode-server source
2
+ if (typeof globalThis.Bun === 'undefined') {
3
+ globalThis.Bun = {
4
+ version: '0.0.0-node-compat',
5
+ stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
6
+ which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
7
+ };
8
+ }
9
+ if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
10
+ if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
11
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+ import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
14
+ import { dirname as __alchemyDirname } from 'node:path';
15
+ const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
16
+ const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
17
+
18
+ import{a as u,b as v,d as _}from"./chunk-2MRHL4B2.js";var C=_(a=>{"use strict";var g=u((t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),"a"),B=g(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sync=t.isexe=void 0;var e=v("node:fs"),r=v("node:fs/promises"),n=u(async(c,o={})=>{let{ignoreErrors:i=!1}=o;try{return p(await(0,r.stat)(c),o)}catch(l){let f=l;if(i||f.code==="EACCES")return!1;throw f}},"q");t.isexe=n;var s=u((c,o={})=>{let{ignoreErrors:i=!1}=o;try{return p((0,e.statSync)(c),o)}catch(l){let f=l;if(i||f.code==="EACCES")return!1;throw f}},"m");t.sync=s;var p=u((c,o)=>c.isFile()&&h(c,o),"d"),h=u((c,o)=>{let i=o.uid??process.getuid?.(),l=o.groups??process.getgroups?.()??[],f=o.gid??process.getgid?.()??l[0];if(i===void 0||f===void 0)throw new Error("cannot get uid or gid");let E=new Set([f,...l]),d=c.mode,x=c.uid,H=c.gid,w=parseInt("100",8),y=parseInt("010",8),N=parseInt("001",8),R=w|y;return!!(d&N||d&y&&E.has(H)||d&w&&x===i||d&R&&i===0)},"A")}),m=g(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sync=t.isexe=void 0;var e=v("node:fs"),r=v("node:fs/promises"),n=v("node:path"),s=u(async(o,i={})=>{let{ignoreErrors:l=!1}=i;try{return c(await(0,r.stat)(o),o,i)}catch(f){let E=f;if(l||E.code==="EACCES")return!1;throw E}},"F");t.isexe=s;var p=u((o,i={})=>{let{ignoreErrors:l=!1}=i;try{return c((0,e.statSync)(o),o,i)}catch(f){let E=f;if(l||E.code==="EACCES")return!1;throw E}},"L");t.sync=p;var h=u((o,i)=>{let{pathExt:l=process.env.PATHEXT||""}=i,f=l.split(n.delimiter);if(f.indexOf("")!==-1)return!0;for(let E of f){let d=E.toLowerCase(),x=o.substring(o.length-d.length).toLowerCase();if(d&&x===d)return!0}return!1},"B"),c=u((o,i,l)=>o.isFile()&&h(i,l),"y")}),D=g(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})}),O=a&&a.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:u(function(){return e[r]},"get")}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),G=a&&a.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),P=a&&a.__importStar||(function(){var t=u(function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[n.length]=s);return n},t(e)},"t");return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),s=0;s<n.length;s++)n[s]!=="default"&&O(r,e,n[s]);return G(r,e),r}})(),W=a&&a.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&O(e,t,r)};Object.defineProperty(a,"__esModule",{value:!0});a.sync=a.isexe=a.posix=a.win32=void 0;var b=P(B());a.posix=b;var j=P(m());a.win32=j;W(D(),a);var k=process.env._ISEXE_TEST_PLATFORM_||process.platform,S=k==="win32"?j:b;a.isexe=S.isexe;a.sync=S.sync});var Y=_((et,X)=>{var{isexe:z,sync:J}=C(),{join:K,delimiter:Q,sep:M,posix:T}=v("path"),A=process.platform==="win32",q=new RegExp(`[${T.sep}${M===T.sep?"":M}]`.replace(/(\\)/g,"\\$1")),U=new RegExp(`^\\.${q.source}`),I=u(t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),"getNotFoundError"),$=u((t,{path:e=process.env.PATH,pathExt:r=process.env.PATHEXT,delimiter:n=Q})=>{let s=t.match(q)?[""]:[...A?[process.cwd()]:[],...(e||"").split(n)];if(A){let p=r||[".EXE",".CMD",".BAT",".COM"].join(n),h=p.split(n).flatMap(c=>[c,c.toLowerCase()]);return t.includes(".")&&h[0]!==""&&h.unshift(""),{pathEnv:s,pathExt:h,pathExtExe:p}}return{pathEnv:s,pathExt:[""]}},"getPathInfo"),F=u((t,e)=>{let r=/^".*"$/.test(t)?t.slice(1,-1):t;return(!r&&U.test(e)?e.slice(0,2):"")+K(r,e)},"getPathPart"),L=u(async(t,e={})=>{let{pathEnv:r,pathExt:n,pathExtExe:s}=$(t,e),p=[];for(let h of r){let c=F(h,t);for(let o of n){let i=c+o;if(await z(i,{pathExt:s,ignoreErrors:!0})){if(!e.all)return i;p.push(i)}}}if(e.all&&p.length)return p;if(e.nothrow)return null;throw I(t)},"which"),V=u((t,e={})=>{let{pathEnv:r,pathExt:n,pathExtExe:s}=$(t,e),p=[];for(let h of r){let c=F(h,t);for(let o of n){let i=c+o;if(J(i,{pathExt:s,ignoreErrors:!0})){if(!e.all)return i;p.push(i)}}}if(e.all&&p.length)return p;if(e.nothrow)return null;throw I(t)},"whichSync");X.exports=L;L.sync=V});export{Y as a};
@@ -0,0 +1,18 @@
1
+ // Built by esbuild from opencode-server source
2
+ if (typeof globalThis.Bun === 'undefined') {
3
+ globalThis.Bun = {
4
+ version: '0.0.0-node-compat',
5
+ stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
6
+ which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
7
+ };
8
+ }
9
+ if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
10
+ if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
11
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+ import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
14
+ import { dirname as __alchemyDirname } from 'node:path';
15
+ const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
16
+ const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
17
+
18
+ import{c as At,d as se}from"./chunk-V6HERYFV.js";import{a as mt,b as lt,c as I,d as ft,e as P,f as c,g as St,h as re,j as B,k as U,l as Et,n as Tt,p as st,q as Lt,r as it,s as gt,t as x,u as Pt,w as z,x as xt,z as S}from"./chunk-DO2UZ6NY.js";import{a as R}from"./chunk-AZUMH3TO.js";import{a as o,c as d,e as ee,g as O}from"./chunk-2MRHL4B2.js";var Ct,Ot=d(()=>{Ct="exception"});var h,T,$,wt=d(()=>{h=O(R());S();T=O(re());Ot();$=class{static{o(this,"SpanImpl")}_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:h.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){let e=Date.now();if(this._spanContext=t.spanContext,this._performanceStartTime=B.now(),this._performanceOffset=e-(this._performanceStartTime+B.timeOrigin),this._startTimeProvided=t.startTime!=null,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,t.links)for(let r of t.links)this.addLink(r);this.startTime=this._getTime(t.startTime??e),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,t.attributes!=null&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,e){if(e==null||this._isSpanEnded())return this;if(t.length===0)return h.diag.warn(`Invalid attribute key: ${t}`),this;if(!ft(e))return h.diag.warn(`Invalid attribute value set for key: ${t}`),this;let{attributeCountLimit:r}=this._spanLimits,i=!Object.prototype.hasOwnProperty.call(this.attributes,t);return r!==void 0&&this._attributesCount>=r&&i?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(e),i&&this._attributesCount++,this)}setAttributes(t){for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&this.setAttribute(e,t[e]);return this}addEvent(t,e,r){if(this._isSpanEnded())return this;let{eventCountLimit:i}=this._spanLimits;if(i===0)return h.diag.warn("No events allowed."),this._droppedEventsCount++,this;i!==void 0&&this.events.length>=i&&(this._droppedEventsCount===0&&h.diag.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),it(e)&&(it(r)||(r=e),e=void 0);let n=I(e),{attributePerEventCountLimit:p}=this._spanLimits,a={},m=0,_=0;for(let E in n){if(!Object.prototype.hasOwnProperty.call(n,E))continue;let k=n[E];if(p!==void 0&&_>=p){m++;continue}a[E]=this._truncateToSize(k),_++}return this.events.push({name:t,attributes:a,time:this._getTime(r),droppedAttributesCount:m}),this}addLink(t){if(this._isSpanEnded())return this;let{linkCountLimit:e}=this._spanLimits;if(e===0)return this._droppedLinksCount++,this;e!==void 0&&this.links.length>=e&&(this._droppedLinksCount===0&&h.diag.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:r}=this._spanLimits,i=I(t.attributes),n={},p=0,a=0;for(let _ in i){if(!Object.prototype.hasOwnProperty.call(i,_))continue;let E=i[_];if(r!==void 0&&a>=r){p++;continue}n[_]=this._truncateToSize(E),a++}let m={context:t.context};return a>0&&(m.attributes=n),p>0&&(m.droppedAttributesCount=p),this.links.push(m),this}addLinks(t){for(let e of t)this.addLink(e);return this}setStatus(t){if(this._isSpanEnded())return this;if(t.code===h.SpanStatusCode.UNSET)return this;if(this.status.code===h.SpanStatusCode.OK)return this;let e={code:t.code};return t.code===h.SpanStatusCode.ERROR&&(typeof t.message=="string"?e.message=t.message:t.message!=null&&h.diag.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`)),this.status=e,this}updateName(t){return this._isSpanEnded()?this:(this.name=t,this)}end(t){if(this._isSpanEnded()){h.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(t),this._duration=Tt(this.startTime,this.endTime),this._duration[0]<0&&(h.diag.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&h.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&h.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(t){if(typeof t=="number"&&t<=B.now())return Et(t+this._performanceOffset);if(typeof t=="number")return U(t);if(t instanceof Date)return U(t.getTime());if(Lt(t))return t;if(this._startTimeProvided)return U(Date.now());let e=B.now()-this._performanceStartTime;return gt(this.startTime,U(e))}isRecording(){return this._ended===!1}recordException(t,e){let r={};typeof t=="string"?r[T.ATTR_EXCEPTION_MESSAGE]=t:t&&(t.code?r[T.ATTR_EXCEPTION_TYPE]=t.code.toString():t.name&&(r[T.ATTR_EXCEPTION_TYPE]=t.name),t.message&&(r[T.ATTR_EXCEPTION_MESSAGE]=t.message),t.stack&&(r[T.ATTR_EXCEPTION_STACKTRACE]=t.stack)),r[T.ATTR_EXCEPTION_TYPE]||r[T.ATTR_EXCEPTION_MESSAGE]?this.addEvent(Ct,r,e):h.diag.warn(`Failed to record an exception ${t}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let t=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);h.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,t)}return this._ended}_truncateToLimitUtil(t,e){return t.length<=e?t:t.substring(0,e)}_truncateToSize(t){let e=this._attributeValueLengthLimit;return e<=0?(h.diag.warn(`Attribute value limit must be positive, got ${e}`),t):typeof t=="string"?this._truncateToLimitUtil(t,e):Array.isArray(t)?t.map(r=>typeof r=="string"?this._truncateToLimitUtil(r,e):r):t}}});var l,M=d(()=>{(function(s){s[s.NOT_RECORD=0]="NOT_RECORD",s[s.RECORD=1]="RECORD",s[s.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(l||(l={}))});var L,G=d(()=>{M();L=class{static{o(this,"AlwaysOffSampler")}shouldSample(){return{decision:l.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}});var f,V=d(()=>{M();f=class{static{o(this,"AlwaysOnSampler")}shouldSample(){return{decision:l.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}});var b,A,nt=d(()=>{b=O(R());S();G();V();A=class{static{o(this,"ParentBasedSampler")}_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(t){this._root=t.root,this._root||(P(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new f),this._remoteParentSampled=t.remoteParentSampled??new f,this._remoteParentNotSampled=t.remoteParentNotSampled??new L,this._localParentSampled=t.localParentSampled??new f,this._localParentNotSampled=t.localParentNotSampled??new L}shouldSample(t,e,r,i,n,p){let a=b.trace.getSpanContext(t);return!a||!(0,b.isSpanContextValid)(a)?this._root.shouldSample(t,e,r,i,n,p):a.isRemote?a.traceFlags&b.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(t,e,r,i,n,p):this._remoteParentNotSampled.shouldSample(t,e,r,i,n,p):a.traceFlags&b.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(t,e,r,i,n,p):this._localParentNotSampled.shouldSample(t,e,r,i,n,p)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}});var Rt,N,ot=d(()=>{Rt=O(R());M();N=class{static{o(this,"TraceIdRatioBasedSampler")}_ratio;_upperBound;constructor(t=0){this._ratio=this._normalize(t),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(t,e){return{decision:(0,Rt.isValidTraceId)(e)&&this._accumulate(e)<this._upperBound?l.RECORD_AND_SAMPLED:l.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return typeof t!="number"||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let e=0;for(let r=0;r<t.length/8;r++){let i=r*8,n=parseInt(t.slice(i,i+8),16);e=(e^n)>>>0}return e}}});function j(){return{sampler:at(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:c("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:c("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:c("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:c("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:c("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:c("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:c("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:c("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}function at(){let s=St("OTEL_TRACES_SAMPLER")??g.ParentBasedAlwaysOn;switch(s){case g.AlwaysOn:return new f;case g.AlwaysOff:return new L;case g.ParentBasedAlwaysOn:return new A({root:new f});case g.ParentBasedAlwaysOff:return new A({root:new L});case g.TraceIdRatio:return new N(It());case g.ParentBasedTraceIdRatio:return new A({root:new N(It())});default:return Q.diag.error(`OTEL_TRACES_SAMPLER value "${s}" invalid, defaulting to "${g.ParentBasedAlwaysOn}".`),new A({root:new f})}}function It(){let s=c("OTEL_TRACES_SAMPLER_ARG");return s==null?(Q.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${H}.`),H):s<0||s>1?(Q.diag.error(`OTEL_TRACES_SAMPLER_ARG=${s} was given, but it is out of range ([0..1]), defaulting to ${H}.`),H):s}var Q,g,H,pt=d(()=>{Q=O(R());S();G();V();nt();ot();(function(s){s.AlwaysOff="always_off",s.AlwaysOn="always_on",s.ParentBasedAlwaysOff="parentbased_always_off",s.ParentBasedAlwaysOn="parentbased_always_on",s.ParentBasedTraceIdRatio="parentbased_traceidratio",s.TraceIdRatio="traceidratio"})(g||(g={}));H=1;o(j,"loadDefaultConfig");o(at,"buildSamplerFromEnv");o(It,"getSamplerProbabilityFromEnv")});function bt(s){let t={sampler:at()},e=j(),r=Object.assign({},e,t,s);return r.generalLimits=Object.assign({},e.generalLimits,s.generalLimits||{}),r.spanLimits=Object.assign({},e.spanLimits,s.spanLimits||{}),r}function Nt(s){let t=Object.assign({},s.spanLimits);return t.attributeCountLimit=s.spanLimits?.attributeCountLimit??s.generalLimits?.attributeCountLimit??c("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??c("OTEL_ATTRIBUTE_COUNT_LIMIT")??ie,t.attributeValueLengthLimit=s.spanLimits?.attributeValueLengthLimit??s.generalLimits?.attributeValueLengthLimit??c("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??c("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??ne,Object.assign({},s,{spanLimits:t})}var ie,ne,ut=d(()=>{pt();S();ie=128,ne=1/0;o(bt,"mergeConfig");o(Nt,"reconfigureLimits")});var C,Y,Dt=d(()=>{C=O(R());S();Y=class{static{o(this,"BatchSpanProcessorBase")}_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(t,e){this._exporter=t,this._maxExportBatchSize=typeof e?.maxExportBatchSize=="number"?e.maxExportBatchSize:c("OTEL_BSP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=typeof e?.maxQueueSize=="number"?e.maxQueueSize:c("OTEL_BSP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=typeof e?.scheduledDelayMillis=="number"?e.scheduledDelayMillis:c("OTEL_BSP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=typeof e?.exportTimeoutMillis=="number"?e.exportTimeoutMillis:c("OTEL_BSP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new z(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(C.diag.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,e){}onEnd(t){this._shutdownOnce.isCalled||(t.spanContext().traceFlags&C.TraceFlags.SAMPLED)!==0&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&C.diag.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(C.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise((t,e)=>{let r=[],i=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let n=0,p=i;n<p;n++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{t()}).catch(e)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((t,e)=>{let r=setTimeout(()=>{e(new Error("Timeout"))},this._exportTimeoutMillis);C.context.with(mt(C.context.active()),()=>{let i;this._finishedSpans.length<=this._maxExportBatchSize?(i=this._finishedSpans,this._finishedSpans=[]):i=this._finishedSpans.splice(0,this._maxExportBatchSize);let n=o(()=>this._exporter.export(i,a=>{clearTimeout(r),a.code===x.SUCCESS?t():e(a.error??new Error("BatchSpanProcessor: span export failed"))}),"doExport"),p=null;for(let a=0,m=i.length;a<m;a++){let _=i[a];_.resource.asyncAttributesPending&&_.resource.waitForAsyncAttributes&&(p??=[],p.push(_.resource.waitForAsyncAttributes()))}p===null?n():Promise.all(p).then(n,a=>{P(a),e(a)})})})}_maybeStartTimer(){if(this._isExporting)return;let t=o(()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,P(e)})},"flush");if(this._finishedSpans.length>=this._maxExportBatchSize)return t();this._timer===void 0&&(this._timer=setTimeout(()=>t(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}});var v,Mt=d(()=>{Dt();v=class extends Y{static{o(this,"BatchSpanProcessor")}onShutdown(){}}});function vt(s){return o(function(){for(let e=0;e<s/4;e++)X.writeUInt32BE(Math.random()*2**32>>>0,e*4);for(let e=0;e<s&&!(X[e]>0);e++)e===s-1&&(X[s-1]=1);return X.toString("hex",0,s)},"generateId")}var w,X,yt=d(()=>{w=class{static{o(this,"RandomIdGenerator")}generateTraceId=vt(16);generateSpanId=vt(8)},X=Buffer.allocUnsafe(16);o(vt,"getIdGenerator")});var Bt=d(()=>{Mt();yt()});var dt=d(()=>{Bt()});var Ut,ct,kt,Ft,zt=d(()=>{Ut="otel.span.parent.origin",ct="otel.span.sampling_result",kt="otel.sdk.span.live",Ft="otel.sdk.span.started"});function oe(s){return s?s.isRemote?"remote":"local":"none"}function ae(s){switch(s){case l.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case l.RECORD:return"RECORD_ONLY";case l.NOT_RECORD:return"DROP"}}var K,$t=d(()=>{M();zt();K=class{static{o(this,"TracerMetrics")}startedSpans;liveSpans;constructor(t){this.startedSpans=t.createCounter(Ft,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=t.createUpDownCounter(kt,{unit:"{span}",description:"The number of currently live spans."})}startSpan(t,e){let r=ae(e);if(this.startedSpans.add(1,{[Ut]:oe(t),[ct]:r}),e===l.NOT_RECORD)return()=>{};let i={[ct]:r};return this.liveSpans.add(1,i),()=>{this.liveSpans.add(-1,i)}}};o(oe,"parentOrigin");o(ae,"samplingDecisionToString")});var Gt,Vt=d(()=>{Gt="2.6.1"});var u,Z,Ht=d(()=>{u=O(R());S();wt();ut();dt();$t();Vt();Z=class{static{o(this,"Tracer")}_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(t,e,r,i){let n=bt(e);this._sampler=n.sampler,this._generalLimits=n.generalLimits,this._spanLimits=n.spanLimits,this._idGenerator=e.idGenerator||new w,this._resource=r,this._spanProcessor=i,this.instrumentationScope=t;let p=n.meterProvider?n.meterProvider.getMeter("@opentelemetry/sdk-trace",Gt):u.createNoopMeter();this._tracerMetrics=new K(p)}startSpan(t,e={},r=u.context.active()){e.root&&(r=u.trace.deleteSpan(r));let i=u.trace.getSpan(r);if(lt(r))return u.diag.debug("Instrumentation suppressed, returning Noop Span"),u.trace.wrapSpanContext(u.INVALID_SPAN_CONTEXT);let n=i?.spanContext(),p=this._idGenerator.generateSpanId(),a,m,_;!n||!u.trace.isSpanContextValid(n)?m=this._idGenerator.generateTraceId():(m=n.traceId,_=n.traceState,a=n);let E=e.kind??u.SpanKind.INTERNAL,k=(e.links??[]).map(F=>({context:F.context,attributes:I(F.attributes)})),ht=I(e.attributes),y=this._sampler.shouldSample(r,m,t,E,ht,k),Wt=this._tracerMetrics.startSpan(n,y.decision);_=y.traceState??_;let Jt=y.decision===u.SamplingDecision.RECORD_AND_SAMPLED?u.TraceFlags.SAMPLED:u.TraceFlags.NONE,_t={traceId:m,spanId:p,traceFlags:Jt,traceState:_};if(y.decision===u.SamplingDecision.NOT_RECORD)return u.diag.debug("Recording is off, propagating context in a non-recording span"),u.trace.wrapSpanContext(_t);let te=I(Object.assign(ht,y.attributes));return new $({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:_t,name:t,kind:E,links:k,parentSpanContext:a,attributes:te,startTime:e.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:Wt})}startActiveSpan(t,e,r,i){let n,p,a;if(arguments.length<2)return;arguments.length===2?a=e:arguments.length===3?(n=e,a=r):(n=e,p=r,a=i);let m=p??u.context.active(),_=this.startSpan(t,n,m),E=u.trace.setSpan(m,_);return u.context.with(E,a,void 0,_)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}});var q,Qt=d(()=>{S();q=class{static{o(this,"MultiSpanProcessor")}_spanProcessors;constructor(t){this._spanProcessors=t}forceFlush(){let t=[];for(let e of this._spanProcessors)t.push(e.forceFlush());return new Promise(e=>{Promise.all(t).then(()=>{e()}).catch(r=>{P(r||new Error("MultiSpanProcessor: forceFlush failed")),e()})})}onStart(t,e){for(let r of this._spanProcessors)r.onStart(t,e)}onEnding(t){for(let e of this._spanProcessors)e.onEnding&&e.onEnding(t)}onEnd(t){for(let e of this._spanProcessors)e.onEnd(t)}shutdown(){let t=[];for(let e of this._spanProcessors)t.push(e.shutdown());return new Promise((e,r)=>{Promise.all(t).then(()=>{e()},r)})}}});var D,W,jt=d(()=>{S();se();Ht();pt();Qt();ut();(function(s){s[s.resolved=0]="resolved",s[s.timeout=1]="timeout",s[s.error=2]="error",s[s.unresolved=3]="unresolved"})(D||(D={}));W=class{static{o(this,"BasicTracerProvider")}_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(t={}){let e=Pt({},j(),Nt(t));this._resource=e.resource??At(),this._config=Object.assign({},e,{resource:this._resource});let r=[];t.spanProcessors?.length&&r.push(...t.spanProcessors),this._activeSpanProcessor=new q(r)}getTracer(t,e,r){let i=`${t}@${e||""}:${r?.schemaUrl||""}`;return this._tracers.has(i)||this._tracers.set(i,new Z({name:t,version:e,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(i)}forceFlush(){let t=this._config.forceFlushTimeoutMillis,e=this._activeSpanProcessor._spanProcessors.map(r=>new Promise(i=>{let n,p=setTimeout(()=>{i(new Error(`Span processor did not completed within timeout period of ${t} ms`)),n=D.timeout},t);r.forceFlush().then(()=>{clearTimeout(p),n!==D.timeout&&(n=D.resolved,i(n))}).catch(a=>{clearTimeout(p),n=D.error,i(a)})}));return new Promise((r,i)=>{Promise.all(e).then(n=>{let p=n.filter(a=>a!==D.resolved);p.length>0?i(p):r()}).catch(n=>i([n]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}});var J,Yt=d(()=>{S();J=class{static{o(this,"ConsoleSpanExporter")}export(t,e){return this._sendSpans(t,e)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(t){return{resource:{attributes:t.resource.attributes},instrumentationScope:t.instrumentationScope,traceId:t.spanContext().traceId,parentSpanContext:t.parentSpanContext,traceState:t.spanContext().traceState?.serialize(),name:t.name,id:t.spanContext().spanId,kind:t.kind,timestamp:st(t.startTime),duration:st(t.duration),attributes:t.attributes,status:t.status,events:t.events,links:t.links}}_sendSpans(t,e){for(let r of t)console.dir(this._exportInfo(r),{depth:3});if(e)return e({code:x.SUCCESS})}}});var tt,Xt=d(()=>{S();tt=class{static{o(this,"InMemorySpanExporter")}_finishedSpans=[];_stopped=!1;export(t,e){if(this._stopped)return e({code:x.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...t),setTimeout(()=>e({code:x.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}});var Kt,et,Zt=d(()=>{Kt=O(R());S();et=class{static{o(this,"SimpleSpanProcessor")}_exporter;_shutdownOnce;_pendingExports;constructor(t){this._exporter=t,this._shutdownOnce=new z(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(t,e){}onEnd(t){if(this._shutdownOnce.isCalled||(t.spanContext().traceFlags&Kt.TraceFlags.SAMPLED)===0)return;let e=this._doExport(t).catch(r=>P(r));this._pendingExports.add(e),e.finally(()=>this._pendingExports.delete(e))}async _doExport(t){t.resource.asyncAttributesPending&&await t.resource.waitForAsyncAttributes?.();let e=await xt._export(this._exporter,[t]);if(e.code!==x.SUCCESS)throw e.error??new Error(`SimpleSpanProcessor: span export failed (status ${e})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}});var rt,qt=d(()=>{rt=class{static{o(this,"NoopSpanProcessor")}onStart(t,e){}onEnd(t){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}});var pe={};ee(pe,{AlwaysOffSampler:()=>L,AlwaysOnSampler:()=>f,BasicTracerProvider:()=>W,BatchSpanProcessor:()=>v,ConsoleSpanExporter:()=>J,InMemorySpanExporter:()=>tt,NoopSpanProcessor:()=>rt,ParentBasedSampler:()=>A,RandomIdGenerator:()=>w,SamplingDecision:()=>l,SimpleSpanProcessor:()=>et,TraceIdRatioBasedSampler:()=>N});var ue=d(()=>{jt();dt();Yt();Xt();Zt();qt();G();V();nt();ot();M()});export{l as a,L as b,f as c,A as d,N as e,v as f,w as g,W as h,J as i,tt as j,et as k,rt as l,pe as m,ue as n};