@cortex-agent/server 2026.10.28 → 2026.12.5

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 (401) hide show
  1. package/LICENSE +255 -21
  2. package/README.md +36 -7
  3. package/THIRD_PARTY_NOTICES.txt +1990 -593
  4. package/defaults/hooks/cortex-hook-api.mjs +2 -1
  5. package/defaults/hooks/quota-stop.mjs +37 -0
  6. package/defaults/plugins/cortex-system/skills/client-manage/SKILL.md +23 -15
  7. package/defaults/prompts/clean-workspace.md +5 -0
  8. package/dist/agent-adapter/claude/remote-mcp-proxy.js +1 -1
  9. package/dist/chunks/agent-runner-LVZVKBZX.js +4 -0
  10. package/dist/chunks/anthropic-messages-TT6454AA.js +8 -0
  11. package/dist/chunks/azure-openai-responses-52LR2XZD.js +4 -0
  12. package/dist/chunks/bedrock-converse-stream-EOZGYUNY.js +60 -0
  13. package/dist/chunks/bowser-MLGGLXTZ.js +20 -0
  14. package/dist/chunks/child-runner-SMG2VOU5.js +4 -0
  15. package/dist/chunks/chunk-24DH4IR5.js +4 -0
  16. package/dist/chunks/chunk-25XKBRDT.js +70 -0
  17. package/dist/chunks/chunk-2ABET62E.js +23 -0
  18. package/dist/chunks/chunk-2BVUA256.js +4 -0
  19. package/dist/chunks/{chunk-LEUENXI2.js → chunk-2WFL62UO.js} +1 -1
  20. package/dist/chunks/{chunk-OZGBWAT2.js → chunk-2YTYYG4K.js} +1 -1
  21. package/dist/chunks/chunk-335SSANX.js +4 -0
  22. package/dist/chunks/chunk-377OPTXX.js +17 -0
  23. package/dist/chunks/chunk-3EZNVLBF.js +129 -0
  24. package/dist/chunks/chunk-3O6ZG5HA.js +7 -0
  25. package/dist/chunks/{chunk-6AKUD3CF.js → chunk-3XLHL5YT.js} +1 -1
  26. package/dist/chunks/chunk-4HRI75GU.js +4 -0
  27. package/dist/chunks/chunk-4JBYLRPM.js +57 -0
  28. package/dist/chunks/chunk-4KKV7VKE.js +4 -0
  29. package/dist/chunks/chunk-4KQHDDC5.js +4 -0
  30. package/dist/chunks/chunk-4SWD4JMP.js +33 -0
  31. package/dist/chunks/chunk-52VCLZS5.js +4 -0
  32. package/dist/chunks/chunk-54P7TSY3.js +10 -0
  33. package/dist/chunks/chunk-5DVSAXOI.js +7 -0
  34. package/dist/chunks/chunk-5F3A62YS.js +4 -0
  35. package/dist/chunks/{chunk-XNSSUVT6.js → chunk-5FHETFZM.js} +1 -1
  36. package/dist/chunks/{chunk-A34TDMIC.js → chunk-5LBLRAHS.js} +1 -1
  37. package/dist/chunks/chunk-5UYVNA3W.js +4 -0
  38. package/dist/chunks/chunk-6G3OYMCV.js +21 -0
  39. package/dist/chunks/chunk-7GGPYU5E.js +30 -0
  40. package/dist/chunks/chunk-7TYSMLUV.js +4 -0
  41. package/dist/chunks/chunk-7W7VYUTK.js +5 -0
  42. package/dist/chunks/chunk-AXYAZTTN.js +6 -0
  43. package/dist/chunks/{chunk-BGVHA2D4.js → chunk-B3NB243Z.js} +1 -1
  44. package/dist/chunks/chunk-BKYP6AGM.js +8 -0
  45. package/dist/chunks/chunk-BVEDNESB.js +4 -0
  46. package/dist/chunks/chunk-BWDJS6A4.js +12 -0
  47. package/dist/chunks/chunk-C6YVF7EI.js +4 -0
  48. package/dist/chunks/chunk-CEJIYYVE.js +15 -0
  49. package/dist/chunks/chunk-CI2RHH74.js +50 -0
  50. package/dist/chunks/chunk-CMSOOLJB.js +4 -0
  51. package/dist/chunks/chunk-CSVTYYLP.js +4 -0
  52. package/dist/chunks/chunk-DE5EGVKG.js +6 -0
  53. package/dist/chunks/{chunk-E6BYRULL.js → chunk-DK3RPZOQ.js} +1 -1
  54. package/dist/chunks/{chunk-YPK2CAIZ.js → chunk-DK4UCK7L.js} +1 -1
  55. package/dist/chunks/chunk-DYLBVUAU.js +4 -0
  56. package/dist/chunks/chunk-FDC2GRBK.js +27 -0
  57. package/dist/chunks/chunk-FE7HH5JS.js +18 -0
  58. package/dist/chunks/chunk-FYD57YRO.js +436 -0
  59. package/dist/chunks/chunk-G264APQN.js +5 -0
  60. package/dist/chunks/chunk-G4JYZFEO.js +11 -0
  61. package/dist/chunks/chunk-GFFM56U2.js +4 -0
  62. package/dist/chunks/chunk-GOS3P7KS.js +132 -0
  63. package/dist/chunks/chunk-HVN37UXD.js +4 -0
  64. package/dist/chunks/chunk-IA6IODY3.js +4 -0
  65. package/dist/chunks/{chunk-HU6UIDEJ.js → chunk-IGZWZP7Z.js} +1 -1
  66. package/dist/chunks/{chunk-NR6U3WIZ.js → chunk-IJ7XFQMI.js} +1 -1
  67. package/dist/chunks/chunk-IMMGYDAB.js +6 -0
  68. package/dist/chunks/chunk-IOWBF7UK.js +10 -0
  69. package/dist/chunks/{chunk-HALUQ7ZF.js → chunk-ITGCWQFK.js} +1 -1
  70. package/dist/chunks/chunk-IVZ7QUEG.js +4 -0
  71. package/dist/chunks/{chunk-YAEVYJAR.js → chunk-IWY2HIFK.js} +1 -1
  72. package/dist/chunks/{chunk-KGJZAYQD.js → chunk-J7OBATRN.js} +1 -1
  73. package/dist/chunks/{chunk-QWAQHHRS.js → chunk-JGUEIW2W.js} +1 -1
  74. package/dist/chunks/chunk-JKL3AK5D.js +106 -0
  75. package/dist/chunks/chunk-JZ7U7RUK.js +351 -0
  76. package/dist/chunks/chunk-KJUQCCB5.js +4 -0
  77. package/dist/chunks/chunk-KST6OY76.js +10 -0
  78. package/dist/chunks/chunk-KZSAFVSY.js +129 -0
  79. package/dist/chunks/chunk-LD2ZSH3M.js +903 -0
  80. package/dist/chunks/chunk-LE6QPXN6.js +7 -0
  81. package/dist/chunks/chunk-LEAV3FFG.js +4 -0
  82. package/dist/chunks/chunk-LIIZI3HY.js +5 -0
  83. package/dist/chunks/chunk-LP72AF56.js +45 -0
  84. package/dist/chunks/{chunk-FXDIR3SQ.js → chunk-MJQ2D2OP.js} +1 -1
  85. package/dist/chunks/{chunk-6LZK4DDH.js → chunk-NHHR4DCF.js} +1 -1
  86. package/dist/chunks/chunk-NW4GW47L.js +4 -0
  87. package/dist/chunks/chunk-OALEJ6FG.js +60 -0
  88. package/dist/chunks/chunk-OIV4DIMB.js +4 -0
  89. package/dist/chunks/chunk-OJ37ZWBG.js +4 -0
  90. package/dist/chunks/chunk-OZXMPBUX.js +4 -0
  91. package/dist/chunks/{chunk-3THJYAEF.js → chunk-PG7452XE.js} +1 -1
  92. package/dist/chunks/chunk-PJCUB7YJ.js +4 -0
  93. package/dist/chunks/chunk-PTS3J4DQ.js +6 -0
  94. package/dist/chunks/{chunk-PXS5SHOV.js → chunk-PVVEEBUU.js} +1 -1
  95. package/dist/chunks/chunk-Q7BZLPBU.js +8 -0
  96. package/dist/chunks/{chunk-FOJQXLL2.js → chunk-QC66ZXPP.js} +1 -1
  97. package/dist/chunks/chunk-QXFWIL4C.js +4 -0
  98. package/dist/chunks/{chunk-PFMEUFJ7.js → chunk-R2CCD4OF.js} +1 -1
  99. package/dist/chunks/chunk-R6CGBSTC.js +22 -0
  100. package/dist/chunks/chunk-RG5GP4RB.js +5 -0
  101. package/dist/chunks/{chunk-D3NXKK2L.js → chunk-RW2F2QNP.js} +1 -1
  102. package/dist/chunks/{models-L5VF4I5O-XXNJYQMQ.js → chunk-RWPO3NZ3.js} +1 -1
  103. package/dist/chunks/chunk-SAJD4EKE.js +10 -0
  104. package/dist/chunks/chunk-SDUS2H3E.js +4 -0
  105. package/dist/chunks/chunk-SIHGKM4E.js +4 -0
  106. package/dist/chunks/chunk-SKHFU5DI.js +4 -0
  107. package/dist/chunks/{chunk-STUHNKQS.js → chunk-SM45TH22.js} +1 -1
  108. package/dist/chunks/chunk-T54CZKNJ.js +6 -0
  109. package/dist/chunks/chunk-TKFFQNAP.js +19 -0
  110. package/dist/chunks/chunk-TMV2ZDOI.js +18 -0
  111. package/dist/chunks/chunk-TRXLIL7V.js +4 -0
  112. package/dist/chunks/{chunk-SUFW24P4.js → chunk-UEEW2R4E.js} +1 -1
  113. package/dist/chunks/chunk-UHXPRU6G.js +10 -0
  114. package/dist/chunks/chunk-UPQVWHZ3.js +4 -0
  115. package/dist/chunks/{chunk-JERCOLY3.js → chunk-V35MFAUQ.js} +4 -6
  116. package/dist/chunks/chunk-V7K3KNDM.js +4 -0
  117. package/dist/chunks/chunk-VHX2GHBF.js +4 -0
  118. package/dist/chunks/chunk-VOAKRJ4R.js +4 -0
  119. package/dist/chunks/{chunk-X2GYYRVM.js → chunk-VW7TLY3P.js} +1 -1
  120. package/dist/chunks/chunk-W34AK4SK.js +65 -0
  121. package/dist/chunks/{chunk-REBNWCKI.js → chunk-WU7RNAZD.js} +1 -1
  122. package/dist/chunks/chunk-WZC4TDDM.js +6 -0
  123. package/dist/chunks/chunk-WZYS2HAK.js +4 -0
  124. package/dist/chunks/chunk-X2TKJ7KR.js +11 -0
  125. package/dist/chunks/{chunk-H2FP6DG4.js → chunk-X5ND4H4P.js} +1 -1
  126. package/dist/chunks/{chunk-4U7XXM4W.js → chunk-Y3AOGNDT.js} +1 -1
  127. package/dist/chunks/chunk-Y6DGVTKM.js +6 -0
  128. package/dist/chunks/{chunk-KENCMLRE.js → chunk-YAEHSSR4.js} +1 -1
  129. package/dist/chunks/chunk-YWPBE5LP.js +4 -0
  130. package/dist/chunks/chunk-ZAVX7G2M.js +15 -0
  131. package/dist/chunks/chunk-ZD2M73XA.js +19 -0
  132. package/dist/chunks/chunk-ZD4O6NPV.js +4 -0
  133. package/dist/chunks/chunk-ZNAMETPQ.js +4 -0
  134. package/dist/chunks/chunk-ZY6N5LVQ.js +4 -0
  135. package/dist/chunks/chunk-ZYQ4TDTT.js +81 -0
  136. package/dist/chunks/cli-VB2N7HEK.js +55 -0
  137. package/dist/chunks/cloudflare-workers-ai-system-one-YKU742EC.js +4 -0
  138. package/dist/chunks/context-CI2FKEQE.js +4 -0
  139. package/dist/chunks/cost-CZRRSIUF.js +5 -0
  140. package/dist/chunks/dist-QCNQN6DY.js +4 -0
  141. package/dist/chunks/easter-egg-3d-XR5S2O3T.js +4 -0
  142. package/dist/chunks/{event-streams-3JSFPOTZ.js → event-streams-AVE4MSS6.js} +1 -1
  143. package/dist/chunks/{execution-repo-ZLJTBWFC.js → execution-repo-5TLV2NM4.js} +1 -1
  144. package/dist/chunks/{executions-6ARGR3IO.js → executions-I3UUIGSL.js} +1 -1
  145. package/dist/chunks/file-Y5G56IUT.js +4 -0
  146. package/dist/chunks/github-copilot-BRU2SRRZ.js +4 -0
  147. package/dist/chunks/google-generative-ai-ZF5QEUZV.js +4 -0
  148. package/dist/chunks/google-vertex-4PJZZI3Y.js +4 -0
  149. package/dist/chunks/init-A6GY656J.js +4 -0
  150. package/dist/chunks/{install-cli-4IZCSDFZ.js → install-cli-FALWKQYO.js} +1 -1
  151. package/dist/chunks/{interaction-ask-G5T3H3CG.js → interaction-ask-O5HGF6CH.js} +1 -1
  152. package/dist/chunks/{interaction-plan-E5V42MUP.js → interaction-plan-JTVDN3BC.js} +1 -1
  153. package/dist/chunks/kimi-coding-ZCIBMDZ6.js +4 -0
  154. package/dist/chunks/{llama-cpp-classify-OTXZWCMW.js → llama-cpp-classify-NRUXAIGQ.js} +3 -3
  155. package/dist/chunks/local-client-stop-RS4AHNF4.js +4 -0
  156. package/dist/chunks/{memory-cli-PYOILNN5.js → memory-cli-DIT4DQF3.js} +1 -1
  157. package/dist/chunks/meta-JQH66YU7.js +4 -0
  158. package/dist/chunks/mistral-conversations-CXHOECUV.js +7 -0
  159. package/dist/chunks/model-resolver-GIBPYRKP.js +4 -0
  160. package/dist/chunks/monitor-Z2HKNY5E.js +4 -0
  161. package/dist/chunks/{node-PTK2HCDV.js → node-DAO3SX7O.js} +1 -1
  162. package/dist/chunks/{openai-codex-2REL6UQU.js → openai-codex-JULCKICT.js} +1 -1
  163. package/dist/chunks/openai-codex-responses-U6DGMGDK.js +12 -0
  164. package/dist/chunks/openai-completions-PP4XLLOM.js +9 -0
  165. package/dist/chunks/{openai-decisions-2N6ZRPZC.js → openai-decisions-JU6QQKEM.js} +1 -1
  166. package/dist/chunks/openai-responses-2SG757TL.js +6 -0
  167. package/dist/chunks/openrouter-images-32M7YZWC.js +4 -0
  168. package/dist/chunks/pi-messages-VSINMXN4.js +10 -0
  169. package/dist/chunks/radius-THYKWV4E.js +4 -0
  170. package/dist/chunks/remote-ops-2WBEFQ3E.js +14 -0
  171. package/dist/chunks/runner-5MKMRTIN.js +4 -0
  172. package/dist/chunks/runtime-DST3H5JP.js +4 -0
  173. package/dist/chunks/schedule-cli-V7Y2BBVY.js +4 -0
  174. package/dist/chunks/slack-R7SEJYMY.js +4 -0
  175. package/dist/chunks/start-ui-http-7K5JOLPU.js +43 -0
  176. package/dist/chunks/subagent-Z5IQ4L54.js +4 -0
  177. package/dist/chunks/{time-KEHDQT6K.js → time-P6PE52WL.js} +1 -1
  178. package/dist/chunks/tool-shims-YCXZWTST.js +4 -0
  179. package/dist/chunks/typesafe-system-one-M2DABJSZ.js +4 -0
  180. package/dist/chunks/ui-board-HQIE4RZG.js +5 -0
  181. package/dist/chunks/ui-decision-YBZDS4YW.js +4 -0
  182. package/dist/chunks/{ui-file-GVH53O3X.js → ui-file-SRD4ILBS.js} +1 -1
  183. package/dist/chunks/ui-view-Z25MTZT7.js +4 -0
  184. package/dist/chunks/virtual-modules-H4DXPJZB.js +4 -0
  185. package/dist/chunks/waitpoint-M6JZBSLT.js +5 -0
  186. package/dist/chunks/workers-SQ2R32TK.js +4 -0
  187. package/dist/client-bundle/client.mjs +273 -93
  188. package/dist/client-bundle/manifest.json +2 -2
  189. package/dist/core/pi-sdk.js +1 -1
  190. package/dist/domain/auth/cc-auth-cli.js +1 -1
  191. package/dist/domain/mcp/bundled-server.js +1 -1
  192. package/dist/domain/mcp/feishu/client.js +4 -0
  193. package/dist/entry/app.js +151 -559
  194. package/dist/entry/browser-cli.js +10 -10
  195. package/dist/entry/cli.js +1 -1
  196. package/dist/entry/cortex-cli.js +1 -1
  197. package/dist/entry/daemon.js +4 -4
  198. package/dist/entry/hook-cli.js +2 -2
  199. package/dist/entry/production-app-bootstrap.js +1 -1
  200. package/dist/entry/production-evidence-export-cli.js +1 -1
  201. package/dist/entry/signal-cli.js +2 -2
  202. package/dist/tui/index.js +41 -41
  203. package/package.json +3 -3
  204. package/vendor/pi/CHANGELOG.md +330 -0
  205. package/vendor/pi/dist/codemode-worker.js +2 -0
  206. package/vendor/pi/dist/core/export-html/ansi-to-html.js +57 -20
  207. package/vendor/pi/dist/core/export-html/template.css +9 -0
  208. package/vendor/pi/dist/core/export-html/template.js +166 -46
  209. package/vendor/pi/dist/core/export-html/tool-renderer.js +5 -3
  210. package/vendor/pi/dist/core/extensions/loader.js +1 -1
  211. package/vendor/pi/dist/extensions/codemode/execute.js +15 -13
  212. package/vendor/pi/dist/modes/interactive/theme/theme.js +36 -23
  213. package/vendor/pi/dist/utils/image-resize-worker.js +1 -1
  214. package/vendor/pi/dist/utils/image-resize.js +1 -1
  215. package/vendor/pi/docs/cli.md +35 -12
  216. package/vendor/pi/docs/custom-provider.md +2 -0
  217. package/vendor/pi/docs/environment-variables.md +2 -0
  218. package/vendor/pi/docs/extensions.md +3192 -225
  219. package/vendor/pi/docs/keybindings.md +2 -2
  220. package/vendor/pi/docs/llama-cpp.md +27 -19
  221. package/vendor/pi/docs/mcp.md +6 -4
  222. package/vendor/pi/docs/message-types.md +1 -1
  223. package/vendor/pi/docs/models-configuration.md +9 -3
  224. package/vendor/pi/docs/models.md +2 -1
  225. package/vendor/pi/docs/nvidia-rtx-llama-cpp.md +5 -5
  226. package/vendor/pi/docs/packages.md +24 -0
  227. package/vendor/pi/docs/prompt-templates.md +1 -1
  228. package/vendor/pi/docs/providers.md +4 -2
  229. package/vendor/pi/docs/quickstart.md +7 -3
  230. package/vendor/pi/docs/rpc-commands.md +1 -1
  231. package/vendor/pi/docs/rpc.md +4 -2
  232. package/vendor/pi/docs/sessions.md +17 -3
  233. package/vendor/pi/docs/settings.md +6 -5
  234. package/vendor/pi/docs/slash-commands.md +3 -2
  235. package/vendor/pi/docs/terminal-setup.md +3 -1
  236. package/vendor/pi/docs/tmux.md +6 -0
  237. package/vendor/pi/docs/tui.md +4 -0
  238. package/vendor/pi/docs/windows.md +27 -0
  239. package/vendor/pi/examples/extensions/README.md +2 -1
  240. package/vendor/pi/examples/extensions/custom-provider-anthropic/index.ts +27 -31
  241. package/vendor/pi/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  242. package/vendor/pi/examples/extensions/custom-provider-anthropic/package.json +1 -1
  243. package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  244. package/vendor/pi/examples/extensions/debug-provider.ts +2 -2
  245. package/vendor/pi/examples/extensions/gondolin/index.ts +4 -7
  246. package/vendor/pi/examples/extensions/gondolin/package-lock.json +19 -29
  247. package/vendor/pi/examples/extensions/gondolin/package.json +2 -2
  248. package/vendor/pi/examples/extensions/plan-mode/index.ts +23 -13
  249. package/vendor/pi/examples/extensions/plan-mode/utils.ts +42 -16
  250. package/vendor/pi/examples/extensions/preset.ts +2 -0
  251. package/vendor/pi/examples/extensions/reload-runtime.ts +17 -5
  252. package/vendor/pi/examples/extensions/subagent/README.md +14 -11
  253. package/vendor/pi/examples/extensions/subagent/index.ts +392 -171
  254. package/vendor/pi/examples/extensions/todo.ts +7 -0
  255. package/vendor/pi/examples/extensions/tools.ts +2 -0
  256. package/vendor/pi/examples/extensions/with-deps/package-lock.json +2 -2
  257. package/vendor/pi/examples/extensions/with-deps/package.json +1 -1
  258. package/vendor/pi/examples/tsconfig.json +208 -0
  259. package/vendor/pi/package.json +15 -16
  260. package/vendor/pi/schemas/models.schema.json +66 -37
  261. package/vendor/pi/schemas/settings.schema.json +18 -1
  262. package/vendor/pi-ai/bedrock.js +1 -1
  263. package/vendor/pi-ai/oauth-load.js +1 -1
  264. package/web/dist/assets/{board-math-css-BPXakv_3.js → board-math-css-DKX6FcUS.js} +1 -1
  265. package/web/dist/assets/index-D11wi0uG.js +540 -0
  266. package/web/dist/assets/index-JedYumhY.css +1 -0
  267. package/web/dist/assets/{index-WCm6wwmM.js → index-jl30Gy8P.js} +1 -1
  268. package/web/dist/assets/pdf-worker-DdZgk2mV.js +57 -0
  269. package/web/dist/assets/pdf.worker.min-Bz_KHX45.js +55 -0
  270. package/web/dist/index.html +2 -2
  271. package/web/dist/theme.css +22 -0
  272. package/dist/chunks/anthropic-messages-M3SMXACA.js +0 -8
  273. package/dist/chunks/api-GM53PHIL-GFHEXXE6.js +0 -4
  274. package/dist/chunks/azure-openai-responses-76YWXHSB.js +0 -4
  275. package/dist/chunks/bedrock-converse-stream-5UPX4NTQ.js +0 -58
  276. package/dist/chunks/child-runner-3GHOWGZP.js +0 -4
  277. package/dist/chunks/chunk-2ZNLUY2U.js +0 -128
  278. package/dist/chunks/chunk-3F6WW7HR.js +0 -13
  279. package/dist/chunks/chunk-3OKHUVEM.js +0 -7
  280. package/dist/chunks/chunk-3YHOCPQU.js +0 -10
  281. package/dist/chunks/chunk-4EX2JJWB.js +0 -4
  282. package/dist/chunks/chunk-4LLH5OWM.js +0 -10
  283. package/dist/chunks/chunk-52T37Y47.js +0 -8
  284. package/dist/chunks/chunk-7MU2AKNM.js +0 -4
  285. package/dist/chunks/chunk-AAA3UBIS.js +0 -4
  286. package/dist/chunks/chunk-ASYQHJVQ.js +0 -9
  287. package/dist/chunks/chunk-BKHDWCRT.js +0 -79
  288. package/dist/chunks/chunk-CQLH4UVX.js +0 -4
  289. package/dist/chunks/chunk-CVC66CFV.js +0 -33
  290. package/dist/chunks/chunk-D6UA4BZC.js +0 -19
  291. package/dist/chunks/chunk-DGMNI4AO.js +0 -4
  292. package/dist/chunks/chunk-DHSA5ACV.js +0 -125
  293. package/dist/chunks/chunk-DPQPXBTP.js +0 -68
  294. package/dist/chunks/chunk-DXBSQXJL.js +0 -18
  295. package/dist/chunks/chunk-E7ZMYIY6.js +0 -30
  296. package/dist/chunks/chunk-EQITBTJC.js +0 -10
  297. package/dist/chunks/chunk-EXJA5RIX.js +0 -357
  298. package/dist/chunks/chunk-FF7UELTU.js +0 -4
  299. package/dist/chunks/chunk-FH74NME3.js +0 -115
  300. package/dist/chunks/chunk-FOQ7VLIL.js +0 -17
  301. package/dist/chunks/chunk-FX6MOGLR.js +0 -11
  302. package/dist/chunks/chunk-G2V65UBA.js +0 -4
  303. package/dist/chunks/chunk-HGPBHTVD.js +0 -6
  304. package/dist/chunks/chunk-J5DVLUKY.js +0 -6
  305. package/dist/chunks/chunk-JW2HFMTF.js +0 -4
  306. package/dist/chunks/chunk-KDYEGGMW.js +0 -4
  307. package/dist/chunks/chunk-KIGMAATV.js +0 -23
  308. package/dist/chunks/chunk-KIU5FAPY.js +0 -5
  309. package/dist/chunks/chunk-KIWMQPH7.js +0 -739
  310. package/dist/chunks/chunk-L6VCIGWS.js +0 -11
  311. package/dist/chunks/chunk-LACGULCN.js +0 -10
  312. package/dist/chunks/chunk-LMSQZ6TQ.js +0 -4
  313. package/dist/chunks/chunk-MEPASGPP.js +0 -6
  314. package/dist/chunks/chunk-MFAEUHMV.js +0 -28
  315. package/dist/chunks/chunk-NAA7GF6Q.js +0 -5
  316. package/dist/chunks/chunk-NKDMKRSB.js +0 -68
  317. package/dist/chunks/chunk-NKXV32S6.js +0 -4
  318. package/dist/chunks/chunk-NVX5IPRN.js +0 -4
  319. package/dist/chunks/chunk-O3JW2F7D.js +0 -8
  320. package/dist/chunks/chunk-OE4KH3NJ.js +0 -4
  321. package/dist/chunks/chunk-OISO5JXB.js +0 -4
  322. package/dist/chunks/chunk-OPYXNSMY.js +0 -4
  323. package/dist/chunks/chunk-OSEIQ7SS.js +0 -4
  324. package/dist/chunks/chunk-P52RMIYX.js +0 -6
  325. package/dist/chunks/chunk-PBJ5MPPX.js +0 -60
  326. package/dist/chunks/chunk-PZMGBKUR.js +0 -13
  327. package/dist/chunks/chunk-PZMXHA6X.js +0 -9
  328. package/dist/chunks/chunk-Q7CE3UIE.js +0 -133
  329. package/dist/chunks/chunk-QBKCAIJG.js +0 -4
  330. package/dist/chunks/chunk-QEOFEETJ.js +0 -4
  331. package/dist/chunks/chunk-QUUEQRIT.js +0 -4
  332. package/dist/chunks/chunk-RA6HKFBV.js +0 -4
  333. package/dist/chunks/chunk-REPYBMQS.js +0 -4
  334. package/dist/chunks/chunk-SKHLZ6XY.js +0 -9
  335. package/dist/chunks/chunk-TAWLERZA.js +0 -4
  336. package/dist/chunks/chunk-TWAEABGG.js +0 -52
  337. package/dist/chunks/chunk-TZFLHVOQ.js +0 -7
  338. package/dist/chunks/chunk-UD3NMUHR.js +0 -12
  339. package/dist/chunks/chunk-UNVEZI57.js +0 -4
  340. package/dist/chunks/chunk-VQUPKMDR.js +0 -4
  341. package/dist/chunks/chunk-W25TB3PU.js +0 -4
  342. package/dist/chunks/chunk-W5LGYSPZ.js +0 -4
  343. package/dist/chunks/chunk-WEZWKMYU.js +0 -4
  344. package/dist/chunks/chunk-XAJLZR7C.js +0 -28
  345. package/dist/chunks/chunk-XH6FMP3N.js +0 -71
  346. package/dist/chunks/chunk-XSRZHN63.js +0 -4
  347. package/dist/chunks/chunk-Y3GFB5XM.js +0 -8
  348. package/dist/chunks/chunk-YG7OEPR2.js +0 -6
  349. package/dist/chunks/chunk-YHIWOGVL.js +0 -4
  350. package/dist/chunks/chunk-YKKEI5GI.js +0 -4
  351. package/dist/chunks/chunk-YZSHTWNM.js +0 -92
  352. package/dist/chunks/chunk-Z4H3VDHI.js +0 -4
  353. package/dist/chunks/cli-5DBTRMHU.js +0 -53
  354. package/dist/chunks/client-XOGYH5UR.js +0 -4
  355. package/dist/chunks/cloudflare-workers-ai-system-one-32JCFHI3.js +0 -4
  356. package/dist/chunks/config-DJSQI77S-335IXHSM.js +0 -4
  357. package/dist/chunks/context-VCQH5OB6.js +0 -4
  358. package/dist/chunks/cost-PGGFI7QJ.js +0 -5
  359. package/dist/chunks/dist-PUKMZ7GW.js +0 -4
  360. package/dist/chunks/easter-egg-3d-MO4MOEVF.js +0 -4
  361. package/dist/chunks/es5-VNTQPCKX.js +0 -4
  362. package/dist/chunks/file-7BN7RCAY.js +0 -4
  363. package/dist/chunks/gateway-UCRPMR75.js +0 -36
  364. package/dist/chunks/github-copilot-HAI2DA62.js +0 -4
  365. package/dist/chunks/google-generative-ai-2VXWLHWI.js +0 -4
  366. package/dist/chunks/google-vertex-UA36QP2U.js +0 -4
  367. package/dist/chunks/init-HA7FAQ73.js +0 -4
  368. package/dist/chunks/kimi-coding-HMJRKCPA.js +0 -4
  369. package/dist/chunks/local-client-stop-SQRU7ZZM.js +0 -4
  370. package/dist/chunks/meta-KY3LNFV2.js +0 -4
  371. package/dist/chunks/mistral-conversations-34F66L3O.js +0 -7
  372. package/dist/chunks/model-resolver-N3DTAQ2S.js +0 -4
  373. package/dist/chunks/openai-codex-responses-ZBVHREB3.js +0 -12
  374. package/dist/chunks/openai-completions-VVIB26SH.js +0 -9
  375. package/dist/chunks/openai-responses-735XA2ZX.js +0 -6
  376. package/dist/chunks/openrouter-images-3IKETHAC.js +0 -4
  377. package/dist/chunks/pi-messages-I3E4ZFHA.js +0 -10
  378. package/dist/chunks/radius-HXRZVBDB.js +0 -4
  379. package/dist/chunks/remote-ops-BALZYKH6.js +0 -14
  380. package/dist/chunks/runner-PLVZDGHB.js +0 -4
  381. package/dist/chunks/runtime-6YLTA2ZD.js +0 -4
  382. package/dist/chunks/schedule-cli-OLASBBYJ.js +0 -4
  383. package/dist/chunks/slack-WAGSPZUX.js +0 -4
  384. package/dist/chunks/start-ui-http-QALT7C3P.js +0 -43
  385. package/dist/chunks/subagent-E3UC7ZHC.js +0 -4
  386. package/dist/chunks/tool-shims-Q6P6UXVC.js +0 -4
  387. package/dist/chunks/typesafe-system-one-6ULACYD4.js +0 -4
  388. package/dist/chunks/ui-board-4GYW6KKW.js +0 -5
  389. package/dist/chunks/ui-decision-U2FXSEC2.js +0 -4
  390. package/dist/chunks/ui-view-O7PLANT7.js +0 -4
  391. package/dist/chunks/virtual-modules-IDC5YKZJ.js +0 -4
  392. package/dist/chunks/waitpoint-2FGQBIAC.js +0 -5
  393. package/dist/chunks/workers-XN4PSTH6.js +0 -4
  394. package/vendor/aistatus/gateway-cli.js +0 -21
  395. package/vendor/pi/examples/extensions/sandbox/index.ts +0 -321
  396. package/vendor/pi/examples/extensions/sandbox/package-lock.json +0 -92
  397. package/vendor/pi/examples/extensions/sandbox/package.json +0 -19
  398. package/web/dist/assets/index-BHZpFXhc.js +0 -525
  399. package/web/dist/assets/index-DqWMdMkh.css +0 -1
  400. package/web/dist/assets/pdf-worker-Hp15W1QJ.js +0 -57
  401. package/web/dist/assets/pdf.worker.min-DnhTvCwe.js +0 -55
@@ -0,0 +1,7 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import{a as ii}from"./chunk-I6OPDRVF.js";import{e as ti,f as ri}from"./chunk-LP72AF56.js";import{e as Se}from"./chunk-7W7VYUTK.js";import{a as F,c as f}from"./chunk-WHC7AYZD.js";var ee=f(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.ErrorCode=void 0;U.errorWithCode=V;U.requestErrorWithOriginal=ni;U.httpErrorFromResponse=ai;U.platformErrorFromResult=oi;U.rateLimitedErrorWithDelay=li;var $;(function(r){r.RequestError="slack_webapi_request_error",r.HTTPError="slack_webapi_http_error",r.PlatformError="slack_webapi_platform_error",r.RateLimitedError="slack_webapi_rate_limited_error",r.FileUploadInvalidArgumentsError="slack_webapi_file_upload_invalid_args_error",r.FileUploadReadFileDataError="slack_webapi_file_upload_read_file_data_error"})($||(U.ErrorCode=$={}));function V(r,e){let t=r;return t.code=e,t}function ni(r,e){let t=V(new Error(`A request error occurred: ${r.message}`),$.RequestError);return e&&(t.original=r),t}function ai(r){let e=V(new Error(`An HTTP protocol error occurred: statusCode = ${r.status}`),$.HTTPError);e.statusCode=r.status,e.statusMessage=r.statusText;let t={};for(let i of Object.keys(r.headers))i&&r.headers[i]&&(t[i]=r.headers[i]);return e.headers=t,e.body=r.data,e}function oi(r){let e=V(new Error(`An API error occurred: ${r.error}`),$.PlatformError);return e.data=r,e}function li(r){let e=V(new Error(`A rate-limit has been reached, you may retry this request in ${r} seconds`),$.RateLimitedError);return e.retryAfter=r,e}});var Re=f((qs,ui)=>{ui.exports={name:"@slack/web-api",version:"7.19.0",description:"Official library for using the Slack Platform's Web API",author:"Slack Technologies, LLC",license:"MIT",keywords:["slack","web-api","bot","client","http","api","proxy","rate-limiting","pagination"],main:"dist/index.js",types:"./dist/index.d.ts",files:["dist/**/*"],engines:{node:">= 18",npm:">= 8.6.0"},repository:{type:"git",url:"git+https://github.com/slackapi/node-slack-sdk.git"},homepage:"https://docs.slack.dev/tools/node-slack-sdk/web-api/",publishConfig:{access:"public"},bugs:{url:"https://github.com/slackapi/node-slack-sdk/issues"},scripts:{build:"npm run build:clean && tsc","build:clean":"shx rm -rf ./dist",docs:"npx typedoc --plugin typedoc-plugin-markdown",prepack:"npm run build",test:"npm run build && bash -c 'node --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=test-results.xml --import tsx --test src/*.test.ts'","test:coverage":"npm run build && node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=lcov.info --test-reporter=junit --test-reporter-destination=test-results.xml --import tsx --test src/*.test.ts","test:integration":"npm run build && node test/integration/commonjs-project/index.js && node test/integration/esm-project/index.mjs && npm run test:integration:ts","test:integration:ts":"cd test/integration/ts-4.7-project && npm i && npm run build","test:types":"tsd",watch:"npx nodemon --watch 'src' --ext 'ts' --exec npm run build"},dependencies:{"@slack/logger":"^4.0.1","@slack/types":"^2.21.0","@types/node":">=18","@types/retry":"0.12.0",axios:"^1.16.0",eventemitter3:"^5.0.1","form-data":"^4.0.4","is-electron":"2.2.2","is-stream":"^2","p-queue":"^6","p-retry":"^4",retry:"^0.13.1"},devDependencies:{"@types/busboy":"^1.5.4","@types/sinon":"^21",busboy:"^1",nock:"^14",sinon:"^21",tsd:"^0.33.0"},tsd:{directory:"test/types"}}});var ue=f(R=>{"use strict";var ci=R&&R.__createBinding||(Object.create?(function(r,e,t,i){i===void 0&&(i=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,i,n)}):(function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]})),di=R&&R.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),hi=R&&R.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var i=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[i.length]=n);return i},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i=r(e),n=0;n<i.length;n++)i[n]!=="default"&&ci(t,e,i[n]);return di(t,e),t}})();Object.defineProperty(R,"__esModule",{value:!0});R.addAppMetadata=_i;R.getUserAgent=vi;var Te=hi(F("node:os")),fi=F("node:path"),Ue=Re();function Le(r){return r.replace("/",":")}var pi=255;function mi(r){let e="";for(let t of r)e+=t.charCodeAt(0)<=pi?t:encodeURIComponent(t);return e}var gi=`${Le(Ue.name)}/${Ue.version} ${mi((0,fi.basename)(process.title))}/${process.version.replace("v","")} ${Te.platform()}/${Te.release()}`,Fe={};function _i({name:r,version:e}){Fe[Le(r)]=e}function vi(){let r=Object.entries(Fe).map(([e,t])=>`${e}/${t}`).join(" ");return(r.length>0?`${r} `:"")+gi}});var ce=f(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.ConsoleLogger=N.LogLevel=void 0;var P;(function(r){r.ERROR="error",r.WARN="warn",r.INFO="info",r.DEBUG="debug"})(P||(N.LogLevel=P={}));var J=class r{constructor(){this.level=P.INFO,this.name=""}getLevel(){return this.level}setLevel(e){this.level=e}setName(e){this.name=e}debug(...e){r.isMoreOrEqualSevere(P.DEBUG,this.level)&&console.debug(r.labels.get(P.DEBUG),this.name,...e)}info(...e){r.isMoreOrEqualSevere(P.INFO,this.level)&&console.info(r.labels.get(P.INFO),this.name,...e)}warn(...e){r.isMoreOrEqualSevere(P.WARN,this.level)&&console.warn(r.labels.get(P.WARN),this.name,...e)}error(...e){r.isMoreOrEqualSevere(P.ERROR,this.level)&&console.error(r.labels.get(P.ERROR),this.name,...e)}static isMoreOrEqualSevere(e,t){return r.severity[e]>=r.severity[t]}};N.ConsoleLogger=J;J.labels=(()=>{let e=Object.entries(P).map(([t,i])=>[i,`[${t}] `]);return new Map(e)})();J.severity={[P.ERROR]:400,[P.WARN]:300,[P.INFO]:200,[P.DEBUG]:100}});var de=f(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.LogLevel=void 0;G.getLogger=wi;var yi=ce(),bi=ce();Object.defineProperty(G,"LogLevel",{enumerable:!0,get:function(){return bi.LogLevel}});var De=0;function wi(r,e,t){let i=De;De+=1;let n=t!==void 0?t:new yi.ConsoleLogger;return n.setName(`web-api:${r}:${i}`),e!==void 0&&n.setLevel(e),n}});var he=f(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.rapidRetryPolicy=q.fiveRetriesInFiveMinutes=q.tenRetriesInAboutThirtyMinutes=void 0;q.tenRetriesInAboutThirtyMinutes={retries:10,factor:1.96821,randomize:!0};q.fiveRetriesInFiveMinutes={retries:5,factor:3.86};q.rapidRetryPolicy={minTimeout:0,maxTimeout:1};var Oi={tenRetriesInAboutThirtyMinutes:q.tenRetriesInAboutThirtyMinutes,fiveRetriesInFiveMinutes:q.fiveRetriesInFiveMinutes,rapidRetryPolicy:q.rapidRetryPolicy};q.default=Oi});var $e=f(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0})});var ze=f(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0})});var me=f(z=>{"use strict";var fe=z&&z.__rest||function(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t};Object.defineProperty(z,"__esModule",{value:!0});z.ChatStreamer=void 0;var pe=class{constructor(e,t,i,n){var o;this.buffer="",this.client=e,this.logger=t,this.options={buffer_size:(o=n.buffer_size)!==null&&o!==void 0?o:256},this.state="starting",this.streamArgs=i}get ts(){return this.streamTs}async append(e){if(this.state==="completed")throw new Error(`failed to append stream: stream state is ${this.state}`);let{markdown_text:t,chunks:i}=e,n=fe(e,["markdown_text","chunks"]);if(n.token&&(this.token=n.token),t&&(this.buffer+=t),this.buffer.length>=this.options.buffer_size||i)return await this.flushBuffer(Object.assign({chunks:i},n));let o={bufferLength:this.buffer.length,bufferSize:this.options.buffer_size,channel:this.streamArgs.channel,recipientTeamId:this.streamArgs.recipient_team_id,recipientUserId:this.streamArgs.recipient_user_id,threadTs:this.streamArgs.thread_ts};return this.logger.debug(`ChatStreamer appended to buffer: ${JSON.stringify(o)}`),null}async stop(e){if(this.state==="completed")throw new Error(`failed to stop stream: stream state is ${this.state}`);let t=e??{},{markdown_text:i,chunks:n}=t,o=fe(t,["markdown_text","chunks"]);if(o.token&&(this.token=o.token),i&&(this.buffer+=i),!this.streamTs){let a=await this.client.chat.startStream(Object.assign(Object.assign({},this.streamArgs),{token:this.token}));if(!a.ts)throw new Error("failed to stop stream: stream not started");this.streamTs=a.ts,this.state="in_progress"}let l=[];this.buffer.length>0&&l.push({type:"markdown_text",text:this.buffer}),n&&l.push(...n);let u=await this.client.chat.stopStream(Object.assign({token:this.token,channel:this.streamArgs.channel,ts:this.streamTs,chunks:l},o));return this.state="completed",u}async flushBuffer(e){let t=e??{},{chunks:i}=t,n=fe(t,["chunks"]),o=[];if(this.buffer.length>0&&o.push({type:"markdown_text",text:this.buffer}),i&&o.push(...i),!this.streamTs){let u=await this.client.chat.startStream(Object.assign(Object.assign(Object.assign({},this.streamArgs),{token:this.token,chunks:o}),n));return this.buffer="",this.streamTs=u.ts,this.state="in_progress",u}let l=await this.client.chat.appendStream(Object.assign({token:this.token,channel:this.streamArgs.channel,ts:this.streamTs,chunks:o},n));return this.buffer="",l}};z.ChatStreamer=pe});var Ve=f((Ls,Be)=>{function Ei(){return!!(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0)}Be.exports=Ei});var Ge=f((Fs,Je)=>{"use strict";var T=r=>r!==null&&typeof r=="object"&&typeof r.pipe=="function";T.writable=r=>T(r)&&r.writable!==!1&&typeof r._write=="function"&&typeof r._writableState=="object";T.readable=r=>T(r)&&r.readable!==!1&&typeof r._read=="function"&&typeof r._readableState=="object";T.duplex=r=>T.writable(r)&&T.readable(r);T.transform=r=>T.duplex(r)&&typeof r._transform=="function";Je.exports=T});var He=f((Ds,ge)=>{"use strict";var Pi=Object.prototype.hasOwnProperty,M="~";function K(){}Object.create&&(K.prototype=Object.create(null),new K().__proto__||(M=!1));function ki(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function Ke(r,e,t,i,n){if(typeof t!="function")throw new TypeError("The listener must be a function");var o=new ki(t,i||r,n),l=M?M+e:e;return r._events[l]?r._events[l].fn?r._events[l]=[r._events[l],o]:r._events[l].push(o):(r._events[l]=o,r._eventsCount++),r}function te(r,e){--r._eventsCount===0?r._events=new K:delete r._events[e]}function k(){this._events=new K,this._eventsCount=0}k.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)Pi.call(t,i)&&e.push(M?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};k.prototype.listeners=function(e){var t=M?M+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,o=i.length,l=new Array(o);n<o;n++)l[n]=i[n].fn;return l};k.prototype.listenerCount=function(e){var t=M?M+e:e,i=this._events[t];return i?i.fn?1:i.length:0};k.prototype.emit=function(e,t,i,n,o,l){var u=M?M+e:e;if(!this._events[u])return!1;var a=this._events[u],h=arguments.length,d,c;if(a.fn){switch(a.once&&this.removeListener(e,a.fn,void 0,!0),h){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,t),!0;case 3:return a.fn.call(a.context,t,i),!0;case 4:return a.fn.call(a.context,t,i,n),!0;case 5:return a.fn.call(a.context,t,i,n,o),!0;case 6:return a.fn.call(a.context,t,i,n,o,l),!0}for(c=1,d=new Array(h-1);c<h;c++)d[c-1]=arguments[c];a.fn.apply(a.context,d)}else{var E=a.length,p;for(c=0;c<E;c++)switch(a[c].once&&this.removeListener(e,a[c].fn,void 0,!0),h){case 1:a[c].fn.call(a[c].context);break;case 2:a[c].fn.call(a[c].context,t);break;case 3:a[c].fn.call(a[c].context,t,i);break;case 4:a[c].fn.call(a[c].context,t,i,n);break;default:if(!d)for(p=1,d=new Array(h-1);p<h;p++)d[p-1]=arguments[p];a[c].fn.apply(a[c].context,d)}}return!0};k.prototype.on=function(e,t,i){return Ke(this,e,t,i,!1)};k.prototype.once=function(e,t,i){return Ke(this,e,t,i,!0)};k.prototype.removeListener=function(e,t,i,n){var o=M?M+e:e;if(!this._events[o])return this;if(!t)return te(this,o),this;var l=this._events[o];if(l.fn)l.fn===t&&(!n||l.once)&&(!i||l.context===i)&&te(this,o);else{for(var u=0,a=[],h=l.length;u<h;u++)(l[u].fn!==t||n&&!l[u].once||i&&l[u].context!==i)&&a.push(l[u]);a.length?this._events[o]=a.length===1?a[0]:a:te(this,o)}return this};k.prototype.removeAllListeners=function(e){var t;return e?(t=M?M+e:e,this._events[t]&&te(this,t)):(this._events=new K,this._eventsCount=0),this};k.prototype.off=k.prototype.removeListener;k.prototype.addListener=k.prototype.on;k.prefixed=M;k.EventEmitter=k;typeof ge<"u"&&(ge.exports=k)});var Qe=f((Ws,Ye)=>{"use strict";Ye.exports=(r,e)=>(e=e||(()=>{}),r.then(t=>new Promise(i=>{i(e())}).then(()=>t),t=>new Promise(i=>{i(e())}).then(()=>{throw t})))});var Ze=f(($s,ie)=>{"use strict";var Ci=Qe(),re=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},Xe=(r,e,t)=>new Promise((i,n)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){i(r);return}let o=setTimeout(()=>{if(typeof t=="function"){try{i(t())}catch(a){n(a)}return}let l=typeof t=="string"?t:`Promise timed out after ${e} milliseconds`,u=t instanceof Error?t:new re(l);typeof r.cancel=="function"&&r.cancel(),n(u)},e);Ci(r.then(i,n),()=>{clearTimeout(o)})});ie.exports=Xe;ie.exports.default=Xe;ie.exports.TimeoutError=re});var et=f(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});function Mi(r,e,t){let i=0,n=r.length;for(;n>0;){let o=n/2|0,l=i+o;t(r[l],e)<=0?(i=++l,n-=o+1):n=o}return i}_e.default=Mi});var tt=f(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});var ji=et(),ve=class{constructor(){this._queue=[]}enqueue(e,t){t=Object.assign({priority:0},t);let i={priority:t.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority){this._queue.push(i);return}let n=ji.default(this._queue,i,(o,l)=>l.priority-o.priority);this._queue.splice(n,0,i)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return this._queue.length}};ye.default=ve});var it=f(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});var qi=He(),rt=Ze(),Ii=tt(),se=()=>{},Ai=new rt.TimeoutError,be=class extends qi{constructor(e){var t,i,n,o;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=se,this._resolveIdle=se,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:Ii.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(i=(t=e.intervalCap)===null||t===void 0?void 0:t.toString())!==null&&i!==void 0?i:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(o=(n=e.interval)===null||n===void 0?void 0:n.toString())!==null&&o!==void 0?o:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||e.interval===0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=e.throwOnTimeout===!0,this._isPaused=e.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=se,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=se,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let e=Date.now();if(this._intervalId===void 0){let t=this._intervalEnd-e;if(t<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},t)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let t=this._queue.dequeue();return t?(this.emit("active"),t(),e&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,t={}){return new Promise((i,n)=>{let o=async()=>{this._pendingCount++,this._intervalCount++;try{let l=this._timeout===void 0&&t.timeout===void 0?e():rt.default(Promise.resolve(e()),t.timeout===void 0?this._timeout:t.timeout,()=>{(t.throwOnTimeout===void 0?this._throwOnTimeout:t.throwOnTimeout)&&n(Ai)});i(await l)}catch(l){n(l)}this._next()};this._queue.enqueue(o,t),this._tryToStartAnother(),this.emit("add")})}async addAll(e,t){return Promise.all(e.map(async i=>this.add(i,t)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(e=>{let t=this._resolveEmpty;this._resolveEmpty=()=>{t(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let t=this._resolveIdle;this._resolveIdle=()=>{t(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}};we.default=be});var Et=f(v=>{"use strict";Object.defineProperty(v,"__esModule",{value:!0});v.getFileUploadJob=Oe;v.getMultipleFileUploadJobs=Ri;v.getFileData=st;v.getFileDataLength=nt;v.getFileDataAsStream=at;v.getAllFileUploadsToComplete=Ti;v.warnIfNotUsingFilesUploadV2=Ui;v.warnIfChannels=ot;v.errorIfChannelsCsv=lt;v.errorIfInvalidOrMissingFileData=ut;v.warnIfMissingOrInvalidFileNameAndDefault=ct;v.warnIfLegacyFileType=dt;v.buildMissingFileIdError=ht;v.buildFileSizeErrorMsg=ft;v.buildLegacyFileTypeWarning=pt;v.buildMissingFileNameWarning=mt;v.buildMissingExtensionWarning=gt;v.buildLegacyMethodWarning=_t;v.buildGeneralFilesUploadWarning=vt;v.buildFilesUploadMissingMessage=yt;v.buildChannelsWarning=bt;v.buildMultipleChannelsErrorMsg=wt;v.buildInvalidFilesUploadParamError=Ot;var Si=F("node:fs"),xi=F("node:stream"),w=ee();async function Oe(r,e){var t,i,n,o;dt(r,e),ot(r,e),lt(r);let l=ct(r,e),u=await st(r),a=nt(u),h={alt_text:r.alt_text,blocks:r.blocks,channel_id:(t=r.channels)!==null&&t!==void 0?t:r.channel_id,filename:(i=r.filename)!==null&&i!==void 0?i:l,highlight_type:r.highlight_type,initial_comment:r.initial_comment,snippet_type:r.snippet_type,title:(o=(n=r.title)!==null&&n!==void 0?n:r.filename)!==null&&o!==void 0?o:l,data:u,length:a};if("thread_ts"in r&&(h.thread_ts=r.thread_ts),"token"in r&&(h.token=r.token),"content"in r)return Object.assign({content:r.content},h);if("file"in r)return Object.assign({file:r.file},h);throw(0,w.errorWithCode)(new Error("Either a file or content field is required for valid file upload. You must supply one"),w.ErrorCode.FileUploadInvalidArgumentsError)}async function Ri(r,e){if("file_uploads"in r)return Promise.all(r.file_uploads.map(t=>{let{blocks:i,channel_id:n,channels:o,initial_comment:l,thread_ts:u}=t;if(i||n||o||l||u)throw(0,w.errorWithCode)(new Error(Ot()),w.ErrorCode.FileUploadInvalidArgumentsError);let a=Object.assign(Object.assign({},t),{blocks:r.blocks,channels:r.channels,channel_id:r.channel_id,initial_comment:r.initial_comment});if("thread_ts"in r&&(a.thread_ts=r.thread_ts),"token"in r&&(a.token=r.token),"content"in t)return Oe(Object.assign({content:t.content},a),e);if("file"in t)return Oe(Object.assign({file:t.file},a),e);throw(0,w.errorWithCode)(new Error("Either a file or content field is required for valid file upload. You must supply one"),w.ErrorCode.FileUploadInvalidArgumentsError)}));throw new Error(yt())}async function st(r){if(ut(r),"file"in r){let{file:e}=r;if(Buffer.isBuffer(e))return e;if(typeof e=="string")try{return(0,Si.readFileSync)(e)}catch{throw(0,w.errorWithCode)(new Error(`Unable to resolve file data for ${e}. Please supply a filepath string, or binary data Buffer or String directly.`),w.ErrorCode.FileUploadInvalidArgumentsError)}let t=await at(e);if(t)return t}if("content"in r)return Buffer.from(r.content);throw(0,w.errorWithCode)(new Error("There was an issue getting the file data for the file or content supplied"),w.ErrorCode.FileUploadReadFileDataError)}function nt(r){if(r)return Buffer.byteLength(r,"utf8");throw(0,w.errorWithCode)(new Error(ft()),w.ErrorCode.FileUploadReadFileDataError)}async function at(r){let e=[];return new Promise((t,i)=>{r.on("readable",()=>{let n=r.read();for(;n!==null;)e.push(n),n=r.read()}),r.on("end",()=>{if(e.length>0){let n=Buffer.concat(e);t(n)}else i(Error("No data in supplied file"))})})}function Ti(r){let e={};for(let t of r){let{blocks:i,channel_id:n,thread_ts:o,highlight_type:l,initial_comment:u,file_id:a,title:h}=t;if(a){let d=`:::${n}:::${o}:::${u}:::${JSON.stringify(i)}`;if(Object.prototype.hasOwnProperty.call(e,d))e[d].files.push({id:a,title:h,highlight_type:l});else{if(e[d]={files:[{id:a,title:h,highlight_type:l}],channel_id:n,blocks:i,initial_comment:u},o&&n){let c={channel_id:n,thread_ts:o};e[d]=Object.assign(Object.assign({},e[d]),c)}"token"in t&&(e[d].token=t.token)}}else throw new Error(ht())}return e}function Ui(r,e){let i=["files.upload"].includes(r);r==="files.upload"&&e.warn(_t(r)),i&&e.info(vt())}function ot(r,e){r.channels&&e.warn(bt())}function lt(r){if((r.channels?r.channels.split(","):[]).length>1)throw(0,w.errorWithCode)(new Error(wt()),w.ErrorCode.FileUploadInvalidArgumentsError)}function ut(r){let e="file"in r,t="content"in r;if(!(e||t)||e&&t)throw(0,w.errorWithCode)(new Error("Either a file or content field is required for valid file upload. You cannot supply both"),w.ErrorCode.FileUploadInvalidArgumentsError);if("file"in r){let{file:i}=r;if(i&&!(typeof i=="string"||Buffer.isBuffer(i)||i instanceof xi.Readable))throw(0,w.errorWithCode)(new Error("file must be a valid string path, buffer or Readable"),w.ErrorCode.FileUploadInvalidArgumentsError)}if("content"in r&&r.content&&typeof r.content!="string")throw(0,w.errorWithCode)(new Error("content must be a string"),w.ErrorCode.FileUploadInvalidArgumentsError)}function ct(r,e){var t;let n=`file.${(t=r.filetype)!==null&&t!==void 0?t:"txt"}`,{filename:o}=r;return o?(o.split(".").length<2&&e.warn(gt(o)),o):(e.warn(mt()),n)}function dt(r,e){r.filetype&&e.warn(pt())}function ht(){return"Missing required file id for file upload completion"}function ft(){return"There was an issue calculating the size of your file"}function pt(){return`filetype is no longer a supported field in files.uploadV2.
5
+ Please remove this field. To indicate file type, please do so via the required filename property using the appropriate file extension, e.g. image.png, text.txt`}function mt(){return`filename is a required field for files.uploadV2.
6
+ For backwards compatibility and ease of migration, defaulting the filename. For best experience and consistent unfurl behavior, you should set the filename property with correct file extension, e.g. image.png, text.txt`}function gt(r){return`filename supplied '${r}' may be missing a proper extension. Missing extenions may result in unexpected unfurl behavior when shared`}function _t(r){return`${r} may cause some issues like timeouts for relatively large files.`}function vt(){return"Our latest recommendation is to use client.files.uploadV2() method, which is mostly compatible and much stabler, instead."}function yt(){return"Something went wrong with processing file_uploads"}function bt(){return"Although the 'channels' parameter is still supported for smoother migration from legacy files.upload, we recommend using the new channel_id parameter with a single str value instead (e.g. 'C12345')."}function wt(){return"Sharing files with multiple channels is no longer supported in v2. Share files in each channel separately instead."}function Ot(){return"You may supply file_uploads only for a single channel, message, or thread respectively. Therefore, please supply any channel_id, initial_comment or blocks, or thread_ts in the top-layer."}});var Pt=f(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.default=Li;function Li(r){return new Promise(e=>{setTimeout(e,r)})}});var Ct=f((Gs,Pe)=>{"use strict";var Fi=Object.prototype.hasOwnProperty,j="~";function H(){}Object.create&&(H.prototype=Object.create(null),new H().__proto__||(j=!1));function Di(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function kt(r,e,t,i,n){if(typeof t!="function")throw new TypeError("The listener must be a function");var o=new Di(t,i||r,n),l=j?j+e:e;return r._events[l]?r._events[l].fn?r._events[l]=[r._events[l],o]:r._events[l].push(o):(r._events[l]=o,r._eventsCount++),r}function ne(r,e){--r._eventsCount===0?r._events=new H:delete r._events[e]}function C(){this._events=new H,this._eventsCount=0}C.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)Fi.call(t,i)&&e.push(j?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};C.prototype.listeners=function(e){var t=j?j+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,o=i.length,l=new Array(o);n<o;n++)l[n]=i[n].fn;return l};C.prototype.listenerCount=function(e){var t=j?j+e:e,i=this._events[t];return i?i.fn?1:i.length:0};C.prototype.emit=function(e,t,i,n,o,l){var u=j?j+e:e;if(!this._events[u])return!1;var a=this._events[u],h=arguments.length,d,c;if(a.fn){switch(a.once&&this.removeListener(e,a.fn,void 0,!0),h){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,t),!0;case 3:return a.fn.call(a.context,t,i),!0;case 4:return a.fn.call(a.context,t,i,n),!0;case 5:return a.fn.call(a.context,t,i,n,o),!0;case 6:return a.fn.call(a.context,t,i,n,o,l),!0}for(c=1,d=new Array(h-1);c<h;c++)d[c-1]=arguments[c];a.fn.apply(a.context,d)}else{var E=a.length,p;for(c=0;c<E;c++)switch(a[c].once&&this.removeListener(e,a[c].fn,void 0,!0),h){case 1:a[c].fn.call(a[c].context);break;case 2:a[c].fn.call(a[c].context,t);break;case 3:a[c].fn.call(a[c].context,t,i);break;case 4:a[c].fn.call(a[c].context,t,i,n);break;default:if(!d)for(p=1,d=new Array(h-1);p<h;p++)d[p-1]=arguments[p];a[c].fn.apply(a[c].context,d)}}return!0};C.prototype.on=function(e,t,i){return kt(this,e,t,i,!1)};C.prototype.once=function(e,t,i){return kt(this,e,t,i,!0)};C.prototype.removeListener=function(e,t,i,n){var o=j?j+e:e;if(!this._events[o])return this;if(!t)return ne(this,o),this;var l=this._events[o];if(l.fn)l.fn===t&&(!n||l.once)&&(!i||l.context===i)&&ne(this,o);else{for(var u=0,a=[],h=l.length;u<h;u++)(l[u].fn!==t||n&&!l[u].once||i&&l[u].context!==i)&&a.push(l[u]);a.length?this._events[o]=a.length===1?a[0]:a:ne(this,o)}return this};C.prototype.removeAllListeners=function(e){var t;return e?(t=j?j+e:e,this._events[t]&&ne(this,t)):(this._events=new H,this._eventsCount=0),this};C.prototype.off=C.prototype.removeListener;C.prototype.addListener=C.prototype.on;C.prefixed=j;C.EventEmitter=C;typeof Pe<"u"&&(Pe.exports=C)});var jt=f(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0})});var It=f(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0})});var St=f(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0})});var Rt=f(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0})});var Ut=f(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0})});var Ft=f(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0})});var Wt=f(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0})});var Nt=f($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0})});var Bt=f(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0})});var Jt=f(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0})});var Kt=f(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0})});var Yt=f(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0})});var Xt=f(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0})});var er=f(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0})});var rr=f(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0})});var sr=f(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0})});var ar=f(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0})});var lr=f(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0})});var cr=f(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0})});var hr=f(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0})});var pr=f(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0})});var gr=f(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0})});var vr=f(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0})});var br=f(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0})});var Or=f(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0})});var Pr=f(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0})});var Cr=f(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0})});var jr=f(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0})});var Ir=f(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0})});var Sr=f(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0})});var Rr=f(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0})});var Ur=f(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0})});var Fr=f(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0})});var Dr=f(g=>{"use strict";var Wi=g&&g.__createBinding||(Object.create?(function(r,e,t,i){i===void 0&&(i=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,i,n)}):(function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]})),_=g&&g.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Wi(e,r,t)};Object.defineProperty(g,"__esModule",{value:!0});_(Nt(),g);_(Bt(),g);_(Jt(),g);_(Kt(),g);_(Yt(),g);_(Xt(),g);_(er(),g);_(rr(),g);_(sr(),g);_(ar(),g);_(lr(),g);_(cr(),g);_(hr(),g);_(pr(),g);_(gr(),g);_(vr(),g);_(br(),g);_(Or(),g);_(Pr(),g);_(Cr(),g);_(jr(),g);_(Ir(),g);_(Sr(),g);_(Rr(),g);_(Ur(),g);_(Fr(),g)});var $r=f(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0})});var Br=f(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.CustomFieldType=B.EntityType=void 0;var Nr;(function(r){r.Task="slack#/entities/task",r.File="slack#/entities/file",r.Item="slack#/entities/item",r.Incident="slack#/entities/incident",r.ContentItem="slack#/entities/content_item"})(Nr||(B.EntityType=Nr={}));var zr;(function(r){r.Integer="integer",r.String="string",r.Array="array",r.Date="slack#/types/date",r.Timestamp="slack#/types/timestamp",r.Image="slack#/types/image",r.ChannelId="slack#/types/channel_id",r.User="slack#/types/user",r.EntityRef="slack#/types/entity_ref",r.Boolean="boolean",r.Link="slack#/types/link",r.Email="slack#/types/email"})(zr||(B.CustomFieldType=zr={}))});var Jr=f(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0})});var Gr=f(O=>{"use strict";var $i=O&&O.__createBinding||(Object.create?(function(r,e,t,i){i===void 0&&(i=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,i,n)}):(function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]})),A=O&&O.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&$i(e,r,t)};Object.defineProperty(O,"__esModule",{value:!0});A(jt(),O);A(It(),O);A(St(),O);A(Rt(),O);A(Ut(),O);A(Ft(),O);A(Wt(),O);A(Dr(),O);A($r(),O);A(Br(),O);A(Jr(),O)});var Ce=f(L=>{"use strict";var Ni=L&&L.__createBinding||(Object.create?(function(r,e,t,i){i===void 0&&(i=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,i,n)}):(function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]})),zi=L&&L.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Ni(e,r,t)};Object.defineProperty(L,"__esModule",{value:!0});L.Methods=void 0;var Bi=Ct(),Kr=Me();function s(r,e){return r.apiCall.bind(r,e)}function m(r,e){return r.apiCall.bind(r,e)}function Vi(r){return r.filesUploadV2.bind(r)}var ke=class extends Bi.EventEmitter{constructor(){if(super(),this.admin={analytics:{getFile:s(this,"admin.analytics.getFile")},apps:{activities:{list:m(this,"admin.apps.activities.list")},approve:s(this,"admin.apps.approve"),approved:{list:s(this,"admin.apps.approved.list")},clearResolution:s(this,"admin.apps.clearResolution"),config:{lookup:s(this,"admin.apps.config.lookup"),set:s(this,"admin.apps.config.set")},requests:{cancel:s(this,"admin.apps.requests.cancel"),list:s(this,"admin.apps.requests.list")},restrict:s(this,"admin.apps.restrict"),restricted:{list:s(this,"admin.apps.restricted.list")},uninstall:s(this,"admin.apps.uninstall")},auth:{policy:{assignEntities:s(this,"admin.auth.policy.assignEntities"),getEntities:s(this,"admin.auth.policy.getEntities"),removeEntities:s(this,"admin.auth.policy.removeEntities")}},barriers:{create:s(this,"admin.barriers.create"),delete:s(this,"admin.barriers.delete"),list:m(this,"admin.barriers.list"),update:s(this,"admin.barriers.update")},conversations:{archive:s(this,"admin.conversations.archive"),bulkArchive:s(this,"admin.conversations.bulkArchive"),bulkDelete:s(this,"admin.conversations.bulkDelete"),bulkMove:s(this,"admin.conversations.bulkMove"),convertToPrivate:s(this,"admin.conversations.convertToPrivate"),convertToPublic:s(this,"admin.conversations.convertToPublic"),create:s(this,"admin.conversations.create"),delete:s(this,"admin.conversations.delete"),disconnectShared:s(this,"admin.conversations.disconnectShared"),ekm:{listOriginalConnectedChannelInfo:m(this,"admin.conversations.ekm.listOriginalConnectedChannelInfo")},getConversationPrefs:s(this,"admin.conversations.getConversationPrefs"),getCustomRetention:s(this,"admin.conversations.getCustomRetention"),getTeams:s(this,"admin.conversations.getTeams"),invite:s(this,"admin.conversations.invite"),lookup:s(this,"admin.conversations.lookup"),removeCustomRetention:s(this,"admin.conversations.removeCustomRetention"),rename:s(this,"admin.conversations.rename"),restrictAccess:{addGroup:s(this,"admin.conversations.restrictAccess.addGroup"),listGroups:s(this,"admin.conversations.restrictAccess.listGroups"),removeGroup:s(this,"admin.conversations.restrictAccess.removeGroup")},search:m(this,"admin.conversations.search"),setConversationPrefs:s(this,"admin.conversations.setConversationPrefs"),setCustomRetention:s(this,"admin.conversations.setCustomRetention"),setTeams:s(this,"admin.conversations.setTeams"),unarchive:s(this,"admin.conversations.unarchive")},emoji:{add:s(this,"admin.emoji.add"),addAlias:s(this,"admin.emoji.addAlias"),list:m(this,"admin.emoji.list"),remove:s(this,"admin.emoji.remove"),rename:s(this,"admin.emoji.rename")},functions:{list:s(this,"admin.functions.list"),permissions:{lookup:s(this,"admin.functions.permissions.lookup"),set:s(this,"admin.functions.permissions.set")}},inviteRequests:{approve:s(this,"admin.inviteRequests.approve"),approved:{list:s(this,"admin.inviteRequests.approved.list")},denied:{list:s(this,"admin.inviteRequests.denied.list")},deny:s(this,"admin.inviteRequests.deny"),list:s(this,"admin.inviteRequests.list")},roles:{addAssignments:s(this,"admin.roles.addAssignments"),listAssignments:m(this,"admin.roles.listAssignments"),removeAssignments:s(this,"admin.roles.removeAssignments")},teams:{admins:{list:s(this,"admin.teams.admins.list")},create:s(this,"admin.teams.create"),list:m(this,"admin.teams.list"),owners:{list:s(this,"admin.teams.owners.list")},settings:{info:s(this,"admin.teams.settings.info"),setDefaultChannels:s(this,"admin.teams.settings.setDefaultChannels"),setDescription:s(this,"admin.teams.settings.setDescription"),setDiscoverability:s(this,"admin.teams.settings.setDiscoverability"),setIcon:s(this,"admin.teams.settings.setIcon"),setName:s(this,"admin.teams.settings.setName")}},usergroups:{addChannels:s(this,"admin.usergroups.addChannels"),addTeams:s(this,"admin.usergroups.addTeams"),listChannels:s(this,"admin.usergroups.listChannels"),removeChannels:s(this,"admin.usergroups.removeChannels")},users:{assign:s(this,"admin.users.assign"),invite:s(this,"admin.users.invite"),list:m(this,"admin.users.list"),remove:s(this,"admin.users.remove"),session:{clearSettings:s(this,"admin.users.session.clearSettings"),getSettings:s(this,"admin.users.session.getSettings"),invalidate:s(this,"admin.users.session.invalidate"),list:m(this,"admin.users.session.list"),reset:s(this,"admin.users.session.reset"),resetBulk:s(this,"admin.users.session.resetBulk"),setSettings:s(this,"admin.users.session.setSettings")},setAdmin:s(this,"admin.users.setAdmin"),setExpiration:s(this,"admin.users.setExpiration"),setOwner:s(this,"admin.users.setOwner"),setRegular:s(this,"admin.users.setRegular"),unsupportedVersions:{export:s(this,"admin.users.unsupportedVersions.export")}},workflows:{collaborators:{add:s(this,"admin.workflows.collaborators.add"),remove:s(this,"admin.workflows.collaborators.remove")},permissions:{lookup:s(this,"admin.workflows.permissions.lookup")},search:m(this,"admin.workflows.search"),unpublish:s(this,"admin.workflows.unpublish")}},this.api={test:m(this,"api.test")},this.assistant={threads:{setStatus:s(this,"assistant.threads.setStatus"),setSuggestedPrompts:s(this,"assistant.threads.setSuggestedPrompts"),setTitle:s(this,"assistant.threads.setTitle")}},this.apps={connections:{open:m(this,"apps.connections.open")},event:{authorizations:{list:s(this,"apps.event.authorizations.list")}},manifest:{create:s(this,"apps.manifest.create"),delete:s(this,"apps.manifest.delete"),export:s(this,"apps.manifest.export"),update:s(this,"apps.manifest.update"),validate:s(this,"apps.manifest.validate")},uninstall:s(this,"apps.uninstall"),user:{connection:{update:s(this,"apps.user.connection.update")}}},this.auth={revoke:m(this,"auth.revoke"),teams:{list:m(this,"auth.teams.list")},test:m(this,"auth.test")},this.bookmarks={add:s(this,"bookmarks.add"),edit:s(this,"bookmarks.edit"),list:s(this,"bookmarks.list"),remove:s(this,"bookmarks.remove")},this.bots={info:m(this,"bots.info")},this.calls={add:s(this,"calls.add"),end:s(this,"calls.end"),info:s(this,"calls.info"),update:s(this,"calls.update"),participants:{add:s(this,"calls.participants.add"),remove:s(this,"calls.participants.remove")}},this.canvases={access:{delete:s(this,"canvases.access.delete"),set:s(this,"canvases.access.set")},create:m(this,"canvases.create"),delete:s(this,"canvases.delete"),edit:s(this,"canvases.edit"),sections:{lookup:s(this,"canvases.sections.lookup")}},this.chat={appendStream:s(this,"chat.appendStream"),delete:s(this,"chat.delete"),deleteScheduledMessage:s(this,"chat.deleteScheduledMessage"),getPermalink:s(this,"chat.getPermalink"),meMessage:s(this,"chat.meMessage"),postEphemeral:s(this,"chat.postEphemeral"),postMessage:s(this,"chat.postMessage"),scheduleMessage:s(this,"chat.scheduleMessage"),scheduledMessages:{list:m(this,"chat.scheduledMessages.list")},startStream:s(this,"chat.startStream"),stopStream:s(this,"chat.stopStream"),unfurl:s(this,"chat.unfurl"),update:s(this,"chat.update")},this.conversations={acceptSharedInvite:s(this,"conversations.acceptSharedInvite"),approveSharedInvite:s(this,"conversations.approveSharedInvite"),archive:s(this,"conversations.archive"),canvases:{create:s(this,"conversations.canvases.create")},close:s(this,"conversations.close"),create:s(this,"conversations.create"),declineSharedInvite:s(this,"conversations.declineSharedInvite"),externalInvitePermissions:{set:s(this,"conversations.externalInvitePermissions.set")},history:s(this,"conversations.history"),info:s(this,"conversations.info"),invite:s(this,"conversations.invite"),inviteShared:s(this,"conversations.inviteShared"),join:s(this,"conversations.join"),kick:s(this,"conversations.kick"),leave:s(this,"conversations.leave"),list:m(this,"conversations.list"),listConnectInvites:m(this,"conversations.listConnectInvites"),mark:s(this,"conversations.mark"),members:s(this,"conversations.members"),open:s(this,"conversations.open"),rename:s(this,"conversations.rename"),replies:s(this,"conversations.replies"),requestSharedInvite:{approve:s(this,"conversations.requestSharedInvite.approve"),deny:s(this,"conversations.requestSharedInvite.deny"),list:m(this,"conversations.requestSharedInvite.list")},setPurpose:s(this,"conversations.setPurpose"),setTopic:s(this,"conversations.setTopic"),unarchive:s(this,"conversations.unarchive")},this.dialog={open:s(this,"dialog.open")},this.dnd={endDnd:m(this,"dnd.endDnd"),endSnooze:m(this,"dnd.endSnooze"),info:m(this,"dnd.info"),setSnooze:s(this,"dnd.setSnooze"),teamInfo:s(this,"dnd.teamInfo")},this.emoji={list:m(this,"emoji.list")},this.entity={presentDetails:s(this,"entity.presentDetails")},this.files={completeUploadExternal:s(this,"files.completeUploadExternal"),delete:s(this,"files.delete"),getUploadURLExternal:s(this,"files.getUploadURLExternal"),info:s(this,"files.info"),list:s(this,"files.list"),revokePublicURL:s(this,"files.revokePublicURL"),sharedPublicURL:s(this,"files.sharedPublicURL"),upload:s(this,"files.upload"),uploadV2:Vi(this),comments:{delete:s(this,"files.comments.delete")},remote:{add:s(this,"files.remote.add"),info:s(this,"files.remote.info"),list:s(this,"files.remote.list"),remove:s(this,"files.remote.remove"),share:s(this,"files.remote.share"),update:s(this,"files.remote.update")}},this.functions={completeError:s(this,"functions.completeError"),completeSuccess:s(this,"functions.completeSuccess")},this.migration={exchange:s(this,"migration.exchange")},this.oauth={access:s(this,"oauth.access"),v2:{access:s(this,"oauth.v2.access"),exchange:s(this,"oauth.v2.exchange")}},this.openid={connect:{token:s(this,"openid.connect.token"),userInfo:m(this,"openid.connect.userInfo")}},this.pins={add:s(this,"pins.add"),list:s(this,"pins.list"),remove:s(this,"pins.remove")},this.reactions={add:s(this,"reactions.add"),get:s(this,"reactions.get"),list:m(this,"reactions.list"),remove:s(this,"reactions.remove")},this.reminders={add:s(this,"reminders.add"),complete:s(this,"reminders.complete"),delete:s(this,"reminders.delete"),info:s(this,"reminders.info"),list:m(this,"reminders.list")},this.rtm={connect:m(this,"rtm.connect"),start:m(this,"rtm.start")},this.search={all:s(this,"search.all"),files:s(this,"search.files"),messages:s(this,"search.messages")},this.slackLists={access:{delete:s(this,"slackLists.access.delete"),set:s(this,"slackLists.access.set")},create:s(this,"slackLists.create"),download:{get:s(this,"slackLists.download.get"),start:s(this,"slackLists.download.start")},items:{create:s(this,"slackLists.items.create"),delete:s(this,"slackLists.items.delete"),deleteMultiple:s(this,"slackLists.items.deleteMultiple"),info:s(this,"slackLists.items.info"),list:s(this,"slackLists.items.list"),update:s(this,"slackLists.items.update")},update:s(this,"slackLists.update")},this.team={accessLogs:m(this,"team.accessLogs"),billableInfo:m(this,"team.billableInfo"),billing:{info:s(this,"team.billing.info")},externalTeams:{disconnect:s(this,"team.externalTeams.disconnect"),list:s(this,"team.externalTeams.list")},info:m(this,"team.info"),integrationLogs:m(this,"team.integrationLogs"),preferences:{list:m(this,"team.preferences.list")},profile:{get:m(this,"team.profile.get")}},this.tooling={tokens:{rotate:s(this,"tooling.tokens.rotate")}},this.usergroups={create:s(this,"usergroups.create"),disable:s(this,"usergroups.disable"),enable:s(this,"usergroups.enable"),list:m(this,"usergroups.list"),update:s(this,"usergroups.update"),users:{list:s(this,"usergroups.users.list"),update:s(this,"usergroups.users.update")}},this.users={conversations:s(this,"users.conversations"),deletePhoto:s(this,"users.deletePhoto"),discoverableContacts:{lookup:s(this,"users.discoverableContacts.lookup")},getPresence:s(this,"users.getPresence"),identity:s(this,"users.identity"),info:s(this,"users.info"),list:s(this,"users.list"),lookupByEmail:s(this,"users.lookupByEmail"),setPhoto:s(this,"users.setPhoto"),setPresence:s(this,"users.setPresence"),profile:{get:s(this,"users.profile.get"),set:s(this,"users.profile.set")}},this.views={open:s(this,"views.open"),publish:s(this,"views.publish"),push:s(this,"views.push"),update:s(this,"views.update")},this.stars={add:s(this,"stars.add"),list:s(this,"stars.list"),remove:s(this,"stars.remove")},this.workflows={featured:{add:s(this,"workflows.featured.add"),list:s(this,"workflows.featured.list"),remove:s(this,"workflows.featured.remove"),set:s(this,"workflows.featured.set")},stepCompleted:s(this,"workflows.stepCompleted"),stepFailed:s(this,"workflows.stepFailed"),updateStep:s(this,"workflows.updateStep")},new.target!==Kr.WebClient&&!(new.target.prototype instanceof Kr.WebClient))throw new Error("Attempt to inherit from WebClient methods without inheriting from WebClient")}};L.Methods=ke;zi(Gr(),L)});var Me=f(b=>{"use strict";var Ji=b&&b.__createBinding||(Object.create?(function(r,e,t,i){i===void 0&&(i=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,i,n)}):(function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]})),Gi=b&&b.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ki=b&&b.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var i=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[i.length]=n);return i},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i=r(e),n=0;n<i.length;n++)i[n]!=="default"&&Ji(t,e,i[n]);return Gi(t,e),t}})(),Q=b&&b.__await||function(r){return this instanceof Q?(this.v=r,this):new Q(r)},Hi=b&&b.__asyncGenerator||function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),n,o=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",l),n[Symbol.asyncIterator]=function(){return this},n;function l(p){return function(I){return Promise.resolve(I).then(p,c)}}function u(p,I){i[p]&&(n[p]=function(S){return new Promise(function(x,D){o.push([p,S,x,D])>1||a(p,S)})},I&&(n[p]=I(n[p])))}function a(p,I){try{h(i[p](I))}catch(S){E(o[0][3],S)}}function h(p){p.value instanceof Q?Promise.resolve(p.value.v).then(d,c):E(o[0][2],p)}function d(p){a("next",p)}function c(p){a("throw",p)}function E(p,I){p(I),o.shift(),o.length&&a(o[0][0],o[0][1])}},Yi=b&&b.__asyncValues||function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(o){t[o]=r[o]&&function(l){return new Promise(function(u,a){l=r[o](l),n(u,a,l.done,l.value)})}}function n(o,l,u,a){Promise.resolve(a).then(function(h){o({value:h,done:u})},l)}},Qi=b&&b.__rest||function(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t},W=b&&b.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(b,"__esModule",{value:!0});b.WebClient=b.WebClientEvent=void 0;b.buildThreadTsWarningMessage=Zr;var Hr=F("node:path"),Xi=F("node:querystring"),Zi=F("node:util"),es=W(F("node:zlib")),ts=W(ri()),rs=W(ti()),is=W(Ve()),qe=W(Ge()),ss=W(it()),je=Ki(ii()),ns=me(),Y=ee(),ae=Et(),as=W(Pt()),os=ue(),Yr=de(),ls=Ce(),us=he(),cs=["delete","common","get","put","head","post","link","patch","purge","unlink","options"],ds="Untitled",hs=200,fs=()=>{},Ie;(function(r){r.RATE_LIMITED="rate_limited"})(Ie||(b.WebClientEvent=Ie={}));var X=class r extends ls.Methods{constructor(e,{slackApiUrl:t="https://slack.com/api/",logger:i=void 0,logLevel:n=void 0,maxRequestConcurrency:o=100,retryConfig:l=us.tenRetriesInAboutThirtyMinutes,agent:u=void 0,tls:a=void 0,timeout:h=0,rejectRateLimitedCalls:d=!1,headers:c={},teamId:E=void 0,allowAbsoluteUrls:p=!0,attachOriginalToWebAPIRequestError:I=!0,requestInterceptor:S=void 0,adapter:x=void 0}={}){super(),this.token=e,this.slackApiUrl=t,this.slackApiUrl.endsWith("/")||(this.slackApiUrl+="/"),this.retryConfig=l,this.requestQueue=new ss.default({concurrency:o}),this.tlsConfig=a!==void 0?a:{},this.rejectRateLimitedCalls=d,this.teamId=E,this.allowAbsoluteUrls=p,this.attachOriginalToWebAPIRequestError=I,typeof i<"u"?(this.logger=i,typeof n<"u"&&this.logger.debug("The logLevel given to WebClient was ignored as you also gave logger")):this.logger=(0,Yr.getLogger)(r.loggerName,n??Yr.LogLevel.INFO,i),this.token&&!c.Authorization&&(c.Authorization=`Bearer ${this.token}`),this.axios=ts.default.create({adapter:x?D=>x(Object.assign(Object.assign({},D),{adapter:void 0})):void 0,timeout:h,baseURL:this.slackApiUrl,headers:(0,is.default)()?c:Object.assign({"User-Agent":(0,os.getUserAgent)()},c),httpAgent:u,httpsAgent:u,validateStatus:()=>!0,maxRedirects:0,proxy:!1}),this.axios.defaults.headers.post["Content-Type"]=void 0,S&&this.axios.interceptors.request.use(S,null),this.axios.interceptors.request.use(this.serializeApiCallData.bind(this),null),this.logger.debug("initialized")}async apiCall(e,t={}){if(this.logger.debug(`apiCall('${e}') start`),ms(e,this.logger),gs(e,this.logger,t),_s(e,this.logger,t),typeof t=="string"||typeof t=="number"||typeof t=="boolean")throw new TypeError(`Expected an options argument but instead received a ${typeof t}`);if((0,ae.warnIfNotUsingFilesUploadV2)(e,this.logger),e==="files.uploadV2")return this.filesUploadV2(t);let i={};t.token&&(i.Authorization=`Bearer ${t.token}`);let n=this.deriveRequestUrl(e),o=await this.makeRequest(n,Object.assign({team_id:this.teamId},t),i),l=await this.buildResult(o);if(this.logger.debug(`http request result: ${JSON.stringify(l)}`),l.response_metadata!==void 0&&l.response_metadata.warnings!==void 0&&l.response_metadata.warnings.forEach(this.logger.warn.bind(this.logger)),l.response_metadata!==void 0&&l.response_metadata.messages!==void 0)for(let u of l.response_metadata.messages){let a=/\[ERROR\](.*)/,h=/\[WARN\](.*)/;if(a.test(u)){let d=u.match(a);d!=null&&this.logger.error(d[1].trim())}else if(h.test(u)){let d=u.match(h);d!=null&&this.logger.warn(d[1].trim())}}if(!l.ok&&o.headers["content-type"]!=="application/gzip"||"ok"in l&&l.ok===!1)throw(0,Y.platformErrorFromResult)(l);return this.logger.debug(`apiCall('${e}') end`),l}paginate(e,t,i,n){let o=(()=>{if(t!==void 0&&typeof t.limit=="number"){let{limit:h}=t;return t.limit=void 0,h}return hs})();function l(){return Hi(this,arguments,function*(){let d,c={limit:o};for(t!==void 0&&t.cursor!==void 0&&(c.cursor=t.cursor);d===void 0||c!==void 0;)d=yield Q(this.apiCall(e,Object.assign(t!==void 0?t:{},c))),yield yield Q(d),c=ps(d,o)})}if(i===void 0)return l.call(this);let u=n!==void 0?n:fs,a=0;return(async()=>{var h,d,c,E;let p=l.call(this),S=(await p.next(void 0)).value,x=u(void 0,S,a);if(a+=1,i(S))return x;try{for(var D=!0,oe=Yi(p),le;le=await oe.next(),h=le.done,!h;D=!0){E=le.value,D=!1;let Z=E;if(x=u(x,Z,a),i(Z))return x;a+=1}}catch(Z){d={error:Z}}finally{try{!D&&!h&&(c=oe.return)&&await c.call(oe)}finally{if(d)throw d.error}}return x})()}chatStream(e){let{buffer_size:t}=e,i=Qi(e,["buffer_size"]),n={buffer_size:t};return new ns.ChatStreamer(this,this.logger,i,n)}async filesUploadV2(e){this.logger.debug("files.uploadV2() start");let t=await this.getAllFileUploads(e);return(await this.fetchAllUploadURLExternal(t)).forEach((o,l)=>{t[l].upload_url=o.upload_url,t[l].file_id=o.file_id}),await this.postFileUploadsToExternalURL(t,e),{ok:!0,files:await this.completeFileUploads(t)}}async fetchAllUploadURLExternal(e){return Promise.all(e.map(t=>{let i={filename:t.filename,length:t.length,alt_text:t.alt_text,snippet_type:t.snippet_type};return"token"in t&&(i.token=t.token),this.files.getUploadURLExternal(i)}))}async completeFileUploads(e){let t=Object.values((0,ae.getAllFileUploadsToComplete)(e));return Promise.all(t.map(i=>this.files.completeUploadExternal(i)))}async postFileUploadsToExternalURL(e,t){return Promise.all(e.map(async i=>{let{upload_url:n,file_id:o,filename:l,data:u}=i,a=u;if(n){let h={};t.token&&(h.Authorization=`Bearer ${t.token}`);let d=await this.makeRequest(n,{body:a},h);if(d.status!==200)return Promise.reject(Error(`Failed to upload file (id:${o}, filename: ${l})`));let c={ok:!0,body:d.data};return Promise.resolve(c)}return Promise.reject(Error(`No upload url found for file (id: ${o}, filename: ${l}`))}))}async getAllFileUploads(e){let t=[];return("file"in e||"content"in e)&&t.push(await(0,ae.getFileUploadJob)(e,this.logger)),"file_uploads"in e&&(t=t.concat(await(0,ae.getMultipleFileUploadJobs)(e,this.logger))),t}async makeRequest(e,t,i={}){let n=()=>this.requestQueue.add(async()=>{try{let o=Object.assign({headers:i},this.tlsConfig);e.endsWith("admin.analytics.getFile")&&(o.responseType="arraybuffer"),e.endsWith("apps.event.authorizations.list")&&(t.token=void 0),this.logger.debug(`http request url: ${e}`),this.logger.debug(`http request body: ${JSON.stringify(Xr(t))}`);let l=Object.keys(this.axios.defaults.headers).reduce((a,h)=>(cs.includes(h)||(a[h]=this.axios.defaults.headers[h]),a),{});l=Object.assign(Object.assign(Object.assign({},this.axios.defaults.headers.common),l),i),this.logger.debug(`http request headers: ${JSON.stringify(Xr(l))}`);let u=await this.axios.post(e,t,o);if(this.logger.debug("http response received"),u.status===429){let a=Qr(u);throw a!==void 0?(this.emit(Ie.RATE_LIMITED,a,{url:e,body:t}),this.rejectRateLimitedCalls?new je.AbortError((0,Y.rateLimitedErrorWithDelay)(a)):(this.logger.info(`API Call failed due to rate limiting. Will retry in ${a} seconds.`),this.requestQueue.pause(),await(0,as.default)(a*1e3),this.requestQueue.start(),new Error(`A rate limit was exceeded (url: ${e}, retry-after: ${a})`))):new je.AbortError(new Error(`Retry header did not contain a valid timeout (url: ${e}, retry-after header: ${u.headers["retry-after"]})`))}if(u.status!==200)throw(0,Y.httpErrorFromResponse)(u);return u}catch(o){let l=o;throw this.logger.warn("http request failed",l.message),l.request?(0,Y.requestErrorWithOriginal)(l,this.attachOriginalToWebAPIRequestError):o}});return(0,je.default)(n,this.retryConfig)}deriveRequestUrl(e){return(e.startsWith("https://")||e.startsWith("http://"))&&this.allowAbsoluteUrls?e:`${this.axios.getUri()+e}`}serializeApiCallData(e){let{data:t,headers:i}=e,n=!1,o=Object.entries(t).map(([u,a])=>{if(a==null)return[];let h=a;return Buffer.isBuffer(a)||(0,qe.default)(a)?n=!0:typeof a!="string"&&typeof a!="number"&&typeof a!="boolean"&&(h=JSON.stringify(a)),[u,h]});if(n){this.logger.debug("Request arguments contain binary data");let u=o.reduce((a,[h,d])=>{if(Buffer.isBuffer(d)||(0,qe.default)(d)){let c={};c.filename=(()=>{let E=d;return typeof E.name=="string"?(0,Hr.basename)(E.name):typeof E.path=="string"?(0,Hr.basename)(E.path):ds})(),a.append(h,d,c)}else h!==void 0&&d!==void 0&&a.append(h,d);return a},new rs.default);if(i)for(let[a,h]of Object.entries(u.getHeaders()))i[a]=h;return e.data=u,e.headers=i,e}i&&(i["Content-Type"]="application/x-www-form-urlencoded");let l={};return e.data=(0,Xi.stringify)(o.reduce((u,[a,h])=>(a!==void 0&&h!==void 0&&(u[a]=h),u),l)),e.headers=i,e}async buildResult(e){let{data:t}=e,i=e.headers["content-type"]==="application/gzip";if(i)try{let o=await new Promise((u,a)=>{es.default.unzip(t,(h,d)=>h?a(h):u(d.toString().split(`
7
+ `)))}).then(u=>u).catch(u=>{throw u}),l=[];if(Array.isArray(o))for(let u of o)u&&u.length>0&&l.push(JSON.parse(u));t={file_data:l}}catch(o){t={ok:!1,error:o}}else!i&&e.request.path==="/api/admin.analytics.getFile"&&(t=JSON.parse(new Zi.TextDecoder().decode(t)));if(typeof t=="string")try{t=JSON.parse(t)}catch{t={ok:!1,error:t}}t.response_metadata===void 0&&(t.response_metadata={}),e.headers["x-oauth-scopes"]!==void 0&&(t.response_metadata.scopes=e.headers["x-oauth-scopes"].trim().split(/\s*,\s*/)),e.headers["x-accepted-oauth-scopes"]!==void 0&&(t.response_metadata.acceptedScopes=e.headers["x-accepted-oauth-scopes"].trim().split(/\s*,\s*/));let n=Qr(e);return n!==void 0&&(t.response_metadata.retryAfter=n),t}};b.WebClient=X;X.loggerName="WebClient";b.default=X;function ps(r,e){if(r!==void 0&&r.response_metadata!==void 0&&r.response_metadata.next_cursor!==void 0&&r.response_metadata.next_cursor!=="")return{limit:e,cursor:r.response_metadata.next_cursor}}function Qr(r){if(r.headers["retry-after"]!==void 0){let e=Number.parseInt(r.headers["retry-after"],10);if(!Number.isNaN(e))return e}}function ms(r,e){["workflows.stepCompleted","workflows.stepFailed","workflows.updateStep"].some(n=>new RegExp(`^${n}`).test(r))&&e.warn(`${r} is deprecated. Please check on https://docs.slack.dev/reference/methods for an alternative.`)}function gs(r,e,t){let n=["chat.postEphemeral","chat.postMessage","chat.scheduleMessage"].includes(r),o=d=>Array.isArray(d.attachments)&&d.attachments.length,l=d=>Array.isArray(d.attachments)&&d.attachments.some(c=>!c.fallback||c.fallback.trim()===""),u=d=>(d.text===void 0||d.text===null||d.text==="")&&(d.markdown_text===void 0||d.markdown===null||d.markdown_text===""),a=()=>`The top-level \`text\` argument is missing in the request payload for a ${r} call - It's a best practice to always provide a \`text\` argument when posting a message. The \`text\` is used in places where the content cannot be rendered such as: system push notifications, assistive technology such as screen readers, etc.`,h=()=>`Additionally, the attachment-level \`fallback\` argument is missing in the request payload for a ${r} call - To avoid this warning, it is recommended to always provide a top-level \`text\` argument when posting a message. Alternatively, you can provide an attachment-level \`fallback\` argument, though this is now considered a legacy field (see https://docs.slack.dev/legacy/legacy-messaging/legacy-secondary-message-attachments for more details).`;n&&typeof t=="object"&&(o(t)?l(t)&&u(t)&&(e.warn(a()),e.warn(h())):u(t)&&e.warn(a()))}function _s(r,e,t){["chat.postEphemeral","chat.postMessage","chat.scheduleMessage","files.upload"].includes(r)&&t?.thread_ts!==void 0&&typeof t?.thread_ts!="string"&&e.warn(Zr(r))}function Zr(r){return`The given thread_ts value in the request payload for a ${r} call is a float value. We highly recommend using a string value instead.`}function Xr(r){let e=Object.entries(r).map(([i,n])=>{if(n==null)return[];let o=n;return(i.match(/.*token.*/)!==null||i.match(/[Aa]uthorization/))&&(o="[[REDACTED]]"),Buffer.isBuffer(n)||(0,qe.default)(n)?o="[[BINARY VALUE OMITTED]]":typeof n!="string"&&typeof n!="number"&&typeof n!="boolean"&&(o=JSON.stringify(n)),[i,o]}),t={};return e.reduce((i,[n,o])=>(n!==void 0&&o!==void 0&&(i[n]=o),i),t)}});var ks=f(y=>{"use strict";var vs=y&&y.__createBinding||(Object.create?(function(r,e,t,i){i===void 0&&(i=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,i,n)}):(function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]})),Ae=y&&y.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&vs(e,r,t)},ys=y&&y.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(y,"__esModule",{value:!0});y.WebClientEvent=y.WebClient=y.ChatStreamer=y.retryPolicies=y.LogLevel=y.addAppMetadata=y.ErrorCode=void 0;var bs=ee();Object.defineProperty(y,"ErrorCode",{enumerable:!0,get:function(){return bs.ErrorCode}});var ws=ue();Object.defineProperty(y,"addAppMetadata",{enumerable:!0,get:function(){return ws.addAppMetadata}});var Os=de();Object.defineProperty(y,"LogLevel",{enumerable:!0,get:function(){return Os.LogLevel}});var Es=he();Object.defineProperty(y,"retryPolicies",{enumerable:!0,get:function(){return ys(Es).default}});Ae($e(),y);Ae(ze(),y);var Ps=me();Object.defineProperty(y,"ChatStreamer",{enumerable:!0,get:function(){return Ps.ChatStreamer}});var ei=Me();Object.defineProperty(y,"WebClient",{enumerable:!0,get:function(){return ei.WebClient}});Object.defineProperty(y,"WebClientEvent",{enumerable:!0,get:function(){return ei.WebClientEvent}});Ae(Ce(),y)});var si=Se("rate-limiter"),xe=class{globalCapacity;globalRefillPerSec;perChannelCapacity;perChannelRefillPerSec;cleanupIntervalMs;buckets=new Map;cleanupTimer=null;constructor(e={}){this.globalCapacity=e.globalCapacity??20,this.globalRefillPerSec=e.globalRefillPerSec??1,this.perChannelCapacity=e.perChannelCapacity??1,this.perChannelRefillPerSec=e.perChannelRefillPerSec??1,this.cleanupIntervalMs=e.cleanupIntervalMs??6e4,this.cleanupTimer=setInterval(()=>this._cleanup(),this.cleanupIntervalMs),typeof this.cleanupTimer.unref=="function"&&this.cleanupTimer.unref()}tryAcquire(e,t){let{globalKey:i,channelKey:n}=this._keys(e,t),o=this._tryConsume(i);if(!o.ok)return o;if(n!==i){let l=this._tryConsume(n);if(!l.ok)return this._refund(i),l}return{ok:!0}}async acquire(e,t){for(;;){let i=this.tryAcquire(e,t);if(i.ok)return;await this._sleep(Math.min(i.retryAfterMs??200,200))}}reportThrottled(e,t,i){let n=i&&i>0?i*1e3+1e3:1e4,o=Date.now()+n,{globalKey:l,channelKey:u}=this._keys(e,t);this._getOrCreate(l).backoffUntil=o,u!==l&&(this._getOrCreate(u).backoffUntil=o),si.warn(`${e}${t?`:${t}`:""} received 429, backing off ${n}ms`)}dispose(){this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null),this.buckets.clear()}_bucketCount(){return this.buckets.size}_advanceTime(e){let t=Date.now();for(let i of this.buckets.values())i.lastRefill=t-e}_keys(e,t){let i=`__global__:${e}`,n=t?`${e}:${t}`:i;return{globalKey:i,channelKey:n}}_tryConsume(e){let t=this._getOrCreate(e),i=Date.now();if(t.backoffUntil>i)return{ok:!1,retryAfterMs:t.backoffUntil-i};if(this._refill(t,i,e),t.tokens>=1)return t.tokens-=1,{ok:!0};let n=this._refillPerSecForKey(e),o=n>0?Math.ceil((1-t.tokens)/n*1e3):1e3;return{ok:!1,retryAfterMs:Math.min(o,5e3)}}_refund(e){let t=this.buckets.get(e);if(!t)return;let i=this._capacityForKey(e);t.tokens=Math.min(t.tokens+1,i)}_getOrCreate(e){let t=this.buckets.get(e);return t||(t={tokens:this._capacityForKey(e),lastRefill:Date.now(),backoffUntil:0},this.buckets.set(e,t)),t}_refill(e,t,i){let n=(t-e.lastRefill)/1e3;if(n<=0)return;let o=this._refillPerSecForKey(i),l=this._capacityForKey(i);e.tokens=Math.min(e.tokens+n*o,l),e.lastRefill=t}_capacityForKey(e){return e.startsWith("__global__")?this.globalCapacity:this.perChannelCapacity}_refillPerSecForKey(e){return e.startsWith("__global__")?this.globalRefillPerSec:this.perChannelRefillPerSec}_cleanup(){let e=Date.now()-3e5;for(let[t,i]of this.buckets)i.lastRefill<e&&i.backoffUntil<e&&this.buckets.delete(t)}_sleep(e){return new Promise(t=>setTimeout(t,e))}};export{xe as a,ce as b,Ct as c,Gr as d,ks as e};
@@ -0,0 +1,4 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ var a=["anthropic-messages","openai-completions","openai-responses","google-generative-ai"],m=/^[a-zA-Z0-9_-]+$/;function p(r){let e=[],s=r.name?.trim()??"";s?m.test(s)||e.push("name-charset"):e.push("name-required"),a.includes(r.api)||e.push("api-invalid");let t=r.upstreamUrl?.trim()??"";t?/^https?:\/\/\S+$/i.test(t)||e.push("upstream-scheme"):e.push("upstream-required");let n=r.models??[];if(n.length===0)e.push("models-required");else{let i=n.map(o=>o.id?.trim()??"");i.some(o=>!o)?e.push("model-id-required"):new Set(i).size!==i.length&&e.push("model-id-duplicate")}return e}function d(r){return{...r,name:r.name?.trim()??"",upstreamUrl:r.upstreamUrl?.trim()??"",models:(r.models??[]).map(e=>({...e,id:e.id?.trim()??""}))}}function u(r){return(Array.isArray(r.models)?r.models:[]).filter(s=>!!s&&typeof s=="object").map(s=>{let t={id:String(s.id??"")};return typeof s.contextWindow=="number"&&(t.contextWindow=s.contextWindow),typeof s.maxTokens=="number"&&(t.maxTokens=s.maxTokens),typeof s.reasoning=="boolean"&&(t.reasoning=s.reasoning),t})}export{a,m as b,p as c,d,u as e};
@@ -0,0 +1,5 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import{e as m}from"./chunk-TRXLIL7V.js";import{e as x}from"./chunk-7W7VYUTK.js";import{j as C}from"./chunk-T54CZKNJ.js";import{readFileSync as I}from"node:fs";import*as k from"node:path";var a=x("connections"),f=k.join(C,"connections.json"),p="subscription",A="plan",d=/^[a-zA-Z0-9_-]+$/;function u(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function c(n){return typeof n=="string"&&n.trim()?n.trim():void 0}function S(n){if(Array.isArray(n))return n.filter(t=>typeof t=="string"&&t.length>0)}function E(n){if(!u(n))return;let t=Object.entries(n).filter(([,e])=>typeof e=="string");return t.length>0?Object.fromEntries(t):void 0}function K(n){return"api"in n}function h(n){return"type"in n&&n.type==="account"}function B(n){return n.filter(t=>t.backend==="claude"&&!h(t))}function G(n){return n.filter(t=>t.backend==="pi"&&!h(t))}function $(n,t){let e=c(n.key);if(!e||t===p)return null;let r={id:t,backend:"claude",label:c(n.label)??t,authStyle:n.authStyle==="bearer"?"bearer":"x-api-key",key:e,billing:n.billing==="subscription"?"subscription":"metered"},o=c(n.baseUrl);o&&(r.baseUrl=o);let i=S(n.models);return i&&(r.models=i),r}function j(n){return Array.isArray(n)?n.filter(t=>u(t)&&!!c(t.id)):[]}function _(n,t){let e=c(n.provider)??t,r=c(n.baseUrl);if(!d.test(e)||!r)return null;let o={id:e,backend:"pi",provider:e,baseUrl:r},i=c(n.label);i&&(o.label=i);let b=c(n.key);b&&(o.key=b);let y=c(n.api);if(!y)return o;let l={...o,api:y,models:j(n.models)},g=E(n.headers);return g&&(l.headers=g),u(n.compat)&&Object.keys(n.compat).length>0&&(l.compat=n.compat),l}function U(n,t){let e=c(n.label)??t,r=n.pending===!0?{pending:!0}:{};if(n.backend==="claude")return t===p?null:{id:t,backend:"claude",type:"account",label:e,...r};let o=c(n.provider);return!o||!d.test(o)||o===t?null:{id:t,backend:"pi",type:"account",label:e,provider:o,...r}}function L(n){if(!u(n))return null;let t=c(n.id);return!t||!d.test(t)?null:n.type==="account"&&(n.backend==="claude"||n.backend==="pi")?U(n,t):n.backend==="claude"?$(n,t):n.backend==="pi"?_(n,t):null}function s(n){return`${n.backend}:${n.id}`}function T(n){let t=u(n)&&Array.isArray(n.connections)?n.connections:[],e=new Set,r=[];for(let o of t){let i=L(o);if(!i||e.has(s(i))){a.warn("Ignoring an invalid or duplicate entry in connections.json");continue}e.add(s(i)),r.push(i)}return r}function O(n=f){let t;try{t=I(n,"utf8")}catch(e){return e.code!=="ENOENT"&&a.warn(`Could not read ${n}: ${e.message}`),[]}try{return T(JSON.parse(t))}catch(e){return a.warn(`Ignoring corrupt ${n}: ${e.message}`),[]}}function N(n,t=f){m(t,`${JSON.stringify({version:1,connections:n},null,2)}
5
+ `,{mode:384})}function J(n,t=f){let e=s(n),r=O(t),o=r.findIndex(i=>s(i)===e);o>=0?r[o]=n:r.push(n),N(r,t)}function v(n,t=f){let e=s(n),r=O(t),o=r.filter(i=>s(i)!==e);return o.length===r.length?!1:(N(o,t),!0)}function z(n){return n&&n!==p?n:null}function W(n){return n?n.length<12?"\u2022\u2022\u2022\u2022":`${n.slice(0,3)}\u2026${n.slice(-4)}`:null}function P(n,t){return n!=="claude"||typeof t!="string"||!t?null:t===A?p:t}function Y(n){if(!u(n)||!("mode"in n)||"connection"in n)return n;let{mode:t,...e}=n;return{...e,connection:P(e.backend,t)}}export{f as a,p as b,A as c,d,K as e,h as f,B as g,G as h,s as i,O as j,N as k,J as l,v as m,z as n,W as o,P as p,Y as q};