@readmagic/workmate 0.0.21 → 0.0.23

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 (493) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-OgcBcK5A.js +1 -0
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-CDNd5-7E.js +1 -0
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-CNEifEyV.js +1 -0
  4. package/dist/chunks/App-B-3tPQ3k.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-COuhHcey.js +2 -0
  6. package/dist/chunks/BypassPermissionsModeDialog-bJek4siJ.js +1 -0
  7. package/dist/chunks/CustomSelect-DoeEXOIP.js +1 -0
  8. package/dist/chunks/DiffDialog-B3X9FMpO.js +6 -0
  9. package/dist/chunks/Doctor-6PXyjIi6.js +3 -0
  10. package/dist/chunks/Doctor-DNgkgYhB.js +1 -0
  11. package/dist/chunks/ExitFlow-DgAZp_8U.js +2 -0
  12. package/dist/chunks/Grove-CHatOzcE.js +11 -0
  13. package/dist/chunks/InvalidConfigDialog-DXL92MN9.js +1 -0
  14. package/dist/chunks/InvalidSettingsDialog-Dtmpzeps.js +1 -0
  15. package/dist/chunks/KeybindingProviderSetup-DA37QUFs.js +1 -0
  16. package/dist/chunks/MCPConnectionManager-thZd-xA_.js +1 -0
  17. package/dist/chunks/MCPToolListView-CpY-YJg4.js +1 -0
  18. package/dist/chunks/{McpParsingWarnings-6ENzOklf.js → McpParsingWarnings-JvChf3xr.js} +1 -1
  19. package/dist/chunks/MessageSelector-C0_iw7SI.js +3 -0
  20. package/dist/chunks/Messages-K4DDsDP9.js +10 -0
  21. package/dist/chunks/Onboarding-C1UdzM-1.js +1 -0
  22. package/dist/chunks/{PromptInputFooterSuggestions-Blzgj5yW.js → PromptInputFooterSuggestions-AyLog8p7.js} +1 -1
  23. package/dist/chunks/PromptInputHelpMenu-oyic20ip.js +1 -0
  24. package/dist/chunks/ProviderSetup-XcBHjUnd.js +1 -0
  25. package/dist/chunks/QueryEngine-DYxBjJ4i.js +1 -0
  26. package/dist/chunks/REPL-CQBJRrT0.js +124 -0
  27. package/dist/chunks/REPL-CrVuMQY2.js +1 -0
  28. package/dist/chunks/ResumeConversation-Dl8H9Gfy.js +1 -0
  29. package/dist/chunks/SearchExtraToolsTool-lv7VE50N.js +1 -0
  30. package/dist/chunks/SelectMulti-Bc6l11_K.js +1 -0
  31. package/dist/chunks/Settings-TGp3fPrS.js +3 -0
  32. package/dist/chunks/Spinner-zYPFVFHN.js +1 -0
  33. package/dist/chunks/SpinnerGlyph-CmkRUvHe.js +1 -0
  34. package/dist/chunks/TextInput-CD9iau2k.js +22 -0
  35. package/dist/chunks/ThemePicker-0F0hZYPX.js +1 -0
  36. package/dist/chunks/TrustDialog-C76YiMKz.js +1 -0
  37. package/dist/chunks/{ValidationErrorsList-2QWIs_6h.js → ValidationErrorsList-DgNzJQUP.js} +1 -1
  38. package/dist/chunks/_baseEach-4ff-vRlp.js +1 -0
  39. package/dist/chunks/add-dir-JMsRLGfx.js +1 -0
  40. package/dist/chunks/{agentDisplay-1Y-N-gqz.js → agentDisplay-BReJUBWg.js} +1 -1
  41. package/dist/chunks/agents-9qQ8I6zW.js +101 -0
  42. package/dist/chunks/{agents-CvW8XjoJ.js → agents-B3x8yJ_r.js} +1 -1
  43. package/dist/chunks/allErrors-DfWylHSw.js +1 -0
  44. package/dist/chunks/appleTerminalBackup-BArZWB21.js +1 -0
  45. package/dist/chunks/backgroundHousekeeping-BGxHB_OX.js +1 -0
  46. package/dist/chunks/backgroundHousekeeping-CVNIhQg8.js +17 -0
  47. package/dist/chunks/banner-Cu2-XUek.js +2 -0
  48. package/dist/chunks/{bedrockClient-DxE_mHFI.js → bedrockClient-CfiDN-kF.js} +2 -2
  49. package/dist/chunks/branch-C4TsMEkx.js +2 -0
  50. package/dist/chunks/{break-cache-BZ_UMtEL.js → break-cache-BMXqFTeS.js} +2 -2
  51. package/dist/chunks/btw-Dn1eYFAz.js +1 -0
  52. package/dist/chunks/caches-BGzKwpnc.js +1 -0
  53. package/dist/chunks/caches-DArHxBgL.js +1 -0
  54. package/dist/chunks/claudeDesktop-D8ml2767.js +1 -0
  55. package/dist/chunks/{clear-D2KRoibg.js → clear-Bdhb6b39.js} +1 -1
  56. package/dist/chunks/{client-C_jBL1yC.js → client-4iqhC8xq.js} +1 -1
  57. package/dist/chunks/client-BiqbIkwr.js +1 -0
  58. package/dist/chunks/client-CZ8nyVh5.js +1 -0
  59. package/dist/chunks/client-CpTCeWba.js +1 -0
  60. package/dist/chunks/commands-QepeBbFn.js +1 -0
  61. package/dist/chunks/compact-Bu9BUpxV.js +2 -0
  62. package/dist/chunks/config-C-Y2qtB2.js +3 -0
  63. package/dist/chunks/config-D58C3_Lu.js +1 -0
  64. package/dist/chunks/config-DD8fCYXn.js +1 -0
  65. package/dist/chunks/{context-Db9tH1VF.js → context-CY_yfdYa.js} +1 -1
  66. package/dist/chunks/context-noninteractive-BDDi3NLF.js +1 -0
  67. package/dist/chunks/{context-noninteractive-CacA9VlT.js → context-noninteractive-Dd4xIoP1.js} +10 -10
  68. package/dist/chunks/conversation-B0wxBwzv.js +1 -0
  69. package/dist/chunks/conversation-DUu9qBnq.js +1 -0
  70. package/dist/chunks/conversationRecovery-2ft8sCPE.js +1 -0
  71. package/dist/chunks/crossProjectResume-6boHMUBx.js +40 -0
  72. package/dist/chunks/cwd-Dc3NV7s8.js +1 -0
  73. package/dist/chunks/cwd-Pa83R95t.js +1 -0
  74. package/dist/chunks/{datadog-BuElf2EQ.js → datadog-BPuGcxxC.js} +1 -1
  75. package/dist/chunks/{debug-D58GQBDG.js → debug-Bglx1aTu.js} +5 -5
  76. package/dist/chunks/detectRepository-CfX8Lc0A.js +1 -0
  77. package/dist/chunks/{diff-yA6v_dpP.js → diff-BOAElpfQ.js} +1 -1
  78. package/dist/chunks/directoryCompletion-D_Rtg-4j.js +1 -0
  79. package/dist/chunks/dist-es-B3-7VFf2.js +1 -0
  80. package/dist/chunks/dist-es-B7j_mv242.js +1 -0
  81. package/dist/chunks/dist-es-BSKD_hOQ.js +1 -0
  82. package/dist/chunks/dist-es-BSRN-2nA.js +9 -0
  83. package/dist/chunks/{dist-es-yHGBqhBe.js → dist-es-BXXmyhQ2.js} +1 -1
  84. package/dist/chunks/{dist-es-C3reqy7X.js → dist-es-BaQndfvh2.js} +1 -1
  85. package/dist/chunks/dist-es-CzTYn7xo.js +1 -0
  86. package/dist/chunks/dist-es-DSkyibcN.js +1 -0
  87. package/dist/chunks/{dist-es-BOPBJQo3.js → dist-es-_UNJQniz.js} +1 -1
  88. package/dist/chunks/dist-es-hwK6468D.js +1 -0
  89. package/dist/chunks/dist-es-ovsdbtwh.js +1 -0
  90. package/dist/chunks/doctor-CkLzqAMd.js +1 -0
  91. package/dist/chunks/entry-TNOoyy7_.js +13 -0
  92. package/dist/chunks/{envUtils-DcaKZlRU.js → envUtils-DfkgIdYf.js} +1 -1
  93. package/dist/chunks/esm-eTAUP-La.js +1 -0
  94. package/dist/chunks/{execFileNoThrow-B_KRY4cT.js → execFileNoThrow-BTachNBI.js} +1 -1
  95. package/dist/chunks/exit-DXApFJIP.js +1 -0
  96. package/dist/chunks/extraUsage-CmQaLPV1.js +1 -0
  97. package/dist/chunks/extractMemories-xP63mv6R.js +1 -0
  98. package/dist/chunks/fast-C5nQH8rm.js +1 -0
  99. package/dist/chunks/fast-eGx2IxD7.js +1 -0
  100. package/dist/chunks/fetchModelList-CxLsVNsu.js +1 -0
  101. package/dist/chunks/fetchModelList-D24lRIgR.js +1 -0
  102. package/dist/chunks/fileSuggestions-DHxdwq28.js +3 -0
  103. package/dist/chunks/firstPartyEventLogger-BVAogAX8.js +1 -0
  104. package/dist/chunks/firstPartyEventLogger-M6UMli2c.js +3 -0
  105. package/dist/chunks/gemini-D_ORb_L6.js +2 -0
  106. package/dist/chunks/generateSessionName-BQoDduyA.js +1 -0
  107. package/dist/chunks/{genericProcessUtils-Cnyun_Wr.js → genericProcessUtils-DwQFuna9.js} +1 -1
  108. package/dist/chunks/goal-D7c2mSds.js +3 -0
  109. package/dist/chunks/grok-B2-ZbUiR.js +1 -0
  110. package/dist/chunks/grove-O6qp7ITR.js +1 -0
  111. package/dist/chunks/help-CZJdRviD.js +1 -0
  112. package/dist/chunks/history-CQiUERTL.js +1 -0
  113. package/dist/chunks/hooks-BNuUlMzL.js +1 -0
  114. package/dist/chunks/{hooks-BDgToO1Z.js → hooks-DIvN6gdv.js} +3 -3
  115. package/dist/chunks/install-T_CV1Slu.js +1 -0
  116. package/dist/chunks/instrumentation-BjqUZ383.js +21 -0
  117. package/dist/chunks/{job-DYMfSglZ.js → job-R6c4-3c8.js} +1 -1
  118. package/dist/chunks/keybindings-CLRaiL_Z.js +1 -0
  119. package/dist/chunks/launchLocalMemory-DrbKrwXc.js +3 -0
  120. package/dist/chunks/{launchOnboarding-BeNf51Ig.js → launchOnboarding-tqsMD8ni.js} +1 -1
  121. package/dist/chunks/loadAgentsDir-CcmY8zCj.js +1 -0
  122. package/dist/chunks/loadAgentsDir-DlPbtIsS.js +3349 -0
  123. package/dist/chunks/loadPluginHooks-C_msxVIc.js +1 -0
  124. package/dist/chunks/{loader-C33o_5kS.js → loader-CICGtLp2.js} +1 -1
  125. package/dist/chunks/{localSearch-DLz5IGGu.js → localSearch-CK-sFzPm.js} +1 -1
  126. package/dist/chunks/localSearch-DrUj0B-d.js +1 -0
  127. package/dist/chunks/log-D2TIwHBV.js +1 -0
  128. package/dist/chunks/logoUtils-x2pHV-Nl.js +1 -0
  129. package/dist/chunks/{magicDocs-DmPNMnNY.js → magicDocs-BEF8D3if.js} +3 -3
  130. package/dist/chunks/main-kOVUGxOS.js +345 -0
  131. package/dist/chunks/managedEnv-BEqrGqn1.js +1 -0
  132. package/dist/chunks/managedEnv-OPlzUPbJ.js +1 -0
  133. package/dist/chunks/mcp-BNd29r6p.js +6 -0
  134. package/dist/chunks/mcp-D0wAJrRT.js +1 -0
  135. package/dist/chunks/mcp-mgOlm1cY.js +2 -0
  136. package/dist/chunks/memory-DDLk9_LJ.js +1 -0
  137. package/dist/chunks/mode-CcNsWgK3.js +2 -0
  138. package/dist/chunks/model-BwBG0V1u.js +1 -0
  139. package/dist/chunks/model-DzCP4K-9.js +1 -0
  140. package/dist/chunks/modelOptions-DRaG3bo0.js +1 -0
  141. package/dist/chunks/nativeInstaller-C3pVPqrZ.js +1 -0
  142. package/dist/chunks/notifications-4wP1Tx9Y.js +1 -0
  143. package/dist/chunks/onChangeAppState-BlaoFbYF.js +1 -0
  144. package/dist/chunks/openai-CDN71NdX.js +2 -0
  145. package/dist/chunks/overlayContext-BT2Lq8ei.js +1 -0
  146. package/dist/chunks/{panel-Cm23FDVt.js → panel-CVS4SK_E.js} +1 -1
  147. package/dist/chunks/parser-CG5RuOCK.js +1 -0
  148. package/dist/chunks/{parser-eVu-cTRs.js → parser-Cg6hSCmn.js} +1 -1
  149. package/dist/chunks/partition-CIl_ORUT.js +1 -0
  150. package/dist/chunks/pasteStore-P0zP-ch0.js +1 -0
  151. package/dist/chunks/permissions-zSNOZSwr.js +3 -0
  152. package/dist/chunks/pidLock-BTqO-h7Y.js +3 -0
  153. package/dist/chunks/{plan-s228H7IU.js → plan-Bs6em6lk.js} +1 -1
  154. package/dist/chunks/{platform-DMQxcm4K.js → platform-BacQ6ACS.js} +1 -1
  155. package/dist/chunks/plugin-DDDxjBa0.js +17 -0
  156. package/dist/chunks/pluginAutoupdate-8qugAFhb.js +1 -0
  157. package/dist/chunks/pluginBlocklist-q01ackCf.js +1 -0
  158. package/dist/chunks/pluginCliCommands-DXZfCZsv.js +1 -0
  159. package/dist/chunks/{pluginFlagging-BSLuTk3M.js → pluginFlagging-BG2MHCQJ.js} +1 -1
  160. package/dist/chunks/pluginOperations-hXYLrzM2.js +2 -0
  161. package/dist/chunks/{pluginStartupCheck-xQbHZ5gf.js → pluginStartupCheck-DTMa6TgL.js} +1 -1
  162. package/dist/chunks/pluginStartupCheck-HS1ZceZa.js +1 -0
  163. package/dist/chunks/plugins-COoGBYk6.js +4 -0
  164. package/dist/chunks/{poorMode-Bt_A2arj.js → poorMode-B0QGV6Ci.js} +1 -1
  165. package/dist/chunks/poorMode-G-pnu6NM.js +1 -0
  166. package/dist/chunks/print-BASybEtO.js +13 -0
  167. package/dist/chunks/processBashCommand-DDi_Pymt.js +1 -0
  168. package/dist/chunks/processSlashCommand-Cq9kaoSF.js +5 -0
  169. package/dist/chunks/{projectContext-Bw3o5BrN.js → projectContext-5fmRr6Sd.js} +1 -1
  170. package/dist/chunks/{projectContext-BN2ZWzOG.js → projectContext-DhtjLv3k.js} +1 -1
  171. package/dist/chunks/projectOnboardingState-B5YATuc6.js +1 -0
  172. package/dist/chunks/prompt-CHobfCB1.js +1 -0
  173. package/dist/chunks/prompt-CMm6RHHc.js +1 -0
  174. package/dist/chunks/{prompt-BNNE5tsG.js → prompt-mM79EGnT.js} +3 -3
  175. package/dist/chunks/promptEditor-DLGN_eLu.js +4 -0
  176. package/dist/chunks/{protocolHandler-DukQ6b4Q.js → protocolHandler-DjQALaU2.js} +2 -2
  177. package/dist/chunks/{proxy-BhIc7-mj.js → proxy-CDBfZjO7.js} +2 -2
  178. package/dist/chunks/reconciler-CeXqh95g.js +1 -0
  179. package/dist/chunks/refresh-Ce2yk28a.js +1 -0
  180. package/dist/chunks/registerProtocol-CAsDme_E.js +1 -0
  181. package/dist/chunks/reject-Bld5E-bn.js +1 -0
  182. package/dist/chunks/reload-plugins-C42xSB5l.js +1 -0
  183. package/dist/chunks/rename-CtBghpxZ.js +1 -0
  184. package/dist/chunks/{renderOptions-D-aQZbzS.js → renderOptions-DV0dn0IW.js} +1 -1
  185. package/dist/chunks/resume-BWkaTDqd.js +2 -0
  186. package/dist/chunks/ripgrep-DLs8MraF.js +1 -0
  187. package/dist/chunks/ripgrep-Dl3y5r4m.js +5 -0
  188. package/dist/chunks/{runtimeObserver-DS1PK6We.js → runtimeObserver-1wQO8HSZ.js} +1 -1
  189. package/dist/chunks/{runtimeObserver-CsZw5XBt.js → runtimeObserver-XQrOux41.js} +4 -4
  190. package/dist/chunks/sandbox-adapter-8GO6eJxw.js +1 -0
  191. package/dist/chunks/sandbox-toggle-Dir9Polo.js +1 -0
  192. package/dist/chunks/searchExtraTools-BhDq8DTJ.js +1 -0
  193. package/dist/chunks/select-Bxf5-5sI.js +1 -0
  194. package/dist/chunks/sessionFileAccessHooks-CozocHQE.js +1 -0
  195. package/dist/chunks/sessionObserver-DGEQM4cO.js +1 -0
  196. package/dist/chunks/{sessionObserver-N7fORFdL.js → sessionObserver-DS4G6mb9.js} +2 -2
  197. package/dist/chunks/sessionStorage-BcAscOGE.js +1 -0
  198. package/dist/chunks/sessionTracing-BoDDYLxW.js +11 -0
  199. package/dist/chunks/settings-B2jvL8Dp.js +24 -0
  200. package/dist/chunks/settings-CisDe8DB.js +1 -0
  201. package/dist/chunks/setup-BRypY6iT.js +3 -0
  202. package/dist/chunks/{shadowedRuleDetection-DEo1hvGi.js → shadowedRuleDetection-BRxZjobz.js} +1 -1
  203. package/dist/chunks/{sideQuestion-C11KgNGL.js → sideQuestion-DLJxyrlp.js} +3 -3
  204. package/dist/chunks/sinks-CGdKmq_8.js +1 -0
  205. package/dist/chunks/sinks-Cz2HfgMU.js +1 -0
  206. package/dist/chunks/skillChangeDetector-xviGstqm.js +1 -0
  207. package/dist/chunks/{skillGapStore-H4MkUFUY.js → skillGapStore-CKN_d3pO.js} +2 -2
  208. package/dist/chunks/{skillLifecycle-ADUTDK7D.js → skillLifecycle-BMY2JGGG.js} +2 -2
  209. package/dist/chunks/{skillSearchPanel-PpfVDMGR.js → skillSearchPanel-D9trHULQ.js} +4 -4
  210. package/dist/chunks/skills-CX_AvwLG.js +1 -0
  211. package/dist/chunks/startupProfiler-BH0FoI66.js +1 -0
  212. package/dist/chunks/startupProfiler-CJdr3SxP.js +3 -0
  213. package/dist/chunks/state-B4jiUise.js +1 -0
  214. package/dist/chunks/state-BhOKSFi5.js +1 -0
  215. package/dist/chunks/status-Daaak6Bo.js +1 -0
  216. package/dist/chunks/statusNoticeHelpers-vFVgIYuw.js +1 -0
  217. package/dist/chunks/stringUtils-C718f5ey.js +4 -0
  218. package/dist/chunks/sts-ei3CGBNu.js +1 -0
  219. package/dist/chunks/switcher-BpgmH4AI.js +1 -0
  220. package/dist/chunks/{switcher-DWfKi17X.js → switcher-CAajZeNL.js} +1 -1
  221. package/dist/chunks/{tasks-BwSsj2vI.js → tasks-BWNQr2d3.js} +1 -1
  222. package/dist/chunks/tempfile-CHO5wXsV.js +1 -0
  223. package/dist/chunks/{templateJobs-fiKuu4DK.js → templateJobs-gUET39Ho.js} +1 -1
  224. package/dist/chunks/terminalSetup-B_10N_gE.js +32 -0
  225. package/dist/chunks/{terminalSetup-Cte5a4hM.js → terminalSetup-qc2PlvOm.js} +1 -1
  226. package/dist/chunks/{theme-CAoGjf2D.js → theme-B7fKI6E5.js} +1 -1
  227. package/dist/chunks/tipRegistry-DamZr34w.js +2 -0
  228. package/dist/chunks/{toolEventObserver-Cq_ZV7x9.js → toolEventObserver-BL06sDI4.js} +1 -1
  229. package/dist/chunks/toolPool-CX5wDBi1.js +1 -0
  230. package/dist/chunks/types-Dx7P7JLQ.js +81 -0
  231. package/dist/chunks/udsClient-cQz6nJ_T.js +1 -0
  232. package/dist/chunks/use-select-navigation-BiUJdWai.js +1 -0
  233. package/dist/chunks/useDoublePress-C9xxQzh1.js +1 -0
  234. package/dist/chunks/useExitOnCtrlCDWithKeybindings-C9BYG8Bo.js +1 -0
  235. package/dist/chunks/useMainLoopModel-DwjSVzzO.js +1 -0
  236. package/dist/chunks/useManagePlugins-BqfIVa6E.js +1 -0
  237. package/dist/chunks/useMergedTools-Bw8FchX8.js +1 -0
  238. package/dist/chunks/useSearchInput-B25K1RnK.js +1 -0
  239. package/dist/chunks/useSettingsErrors-DYQ44kX4.js +1 -0
  240. package/dist/chunks/util-CtlC2dsN.js +1 -0
  241. package/dist/chunks/validatePlugin-D6tFo87L.js +1 -0
  242. package/dist/chunks/vim-CoRp9lY1.js +1 -0
  243. package/dist/chunks/worktree-B8apCnVe.js +1 -0
  244. package/dist/cli.js +1 -1
  245. package/package.json +1 -5
  246. package/dist/chunks/AddWorkspaceDirectory-DgAxYgBY.js +0 -1
  247. package/dist/chunks/AgentsMdExternalIncludesDialog-DGMRVexR.js +0 -1
  248. package/dist/chunks/AgentsMdExternalIncludesDialog-Dp6CwZyI.js +0 -1
  249. package/dist/chunks/App-VWyPd524.js +0 -1
  250. package/dist/chunks/ApproveApiKey-Bolw0sPs.js +0 -1
  251. package/dist/chunks/ApproveApiKey-CyNPMd6g.js +0 -1
  252. package/dist/chunks/BackgroundTasksDialog-DxagIOOw.js +0 -2
  253. package/dist/chunks/BypassPermissionsModeDialog-OS2S66zQ.js +0 -1
  254. package/dist/chunks/DiffDialog-CMtml9iw.js +0 -6
  255. package/dist/chunks/Doctor-Bk9P37mU.js +0 -1
  256. package/dist/chunks/Doctor-D9F3tKsr.js +0 -3
  257. package/dist/chunks/ExitFlow-DhRv5JPj.js +0 -2
  258. package/dist/chunks/Grove-Bbh8PpH0.js +0 -11
  259. package/dist/chunks/HybridTransport-P1vEUwhv.js +0 -2
  260. package/dist/chunks/InvalidConfigDialog-xAYpE-20.js +0 -1
  261. package/dist/chunks/InvalidSettingsDialog-CXFSISy3.js +0 -1
  262. package/dist/chunks/MCPConnectionManager-CoId-C__.js +0 -1
  263. package/dist/chunks/MCPToolListView-BQkQ-hyF.js +0 -1
  264. package/dist/chunks/MessageSelector-BvRVrfg6.js +0 -3
  265. package/dist/chunks/Messages-Cykztq1O.js +0 -10
  266. package/dist/chunks/Onboarding-CfeRwPNQ.js +0 -1
  267. package/dist/chunks/PromptInputHelpMenu-Ckp0k8E3.js +0 -1
  268. package/dist/chunks/QueryEngine-DduzztIG.js +0 -1
  269. package/dist/chunks/REPL-B8e5UU3H.js +0 -128
  270. package/dist/chunks/REPL-C4mbOhyL.js +0 -1
  271. package/dist/chunks/RemoteSessionManager-BPESC6Wu.js +0 -2
  272. package/dist/chunks/ResumeConversation-DG1sLryB.js +0 -1
  273. package/dist/chunks/SSETransport-CDNP2PlK.js +0 -2
  274. package/dist/chunks/SearchExtraToolsTool-vK2PP628.js +0 -1
  275. package/dist/chunks/Settings-B7n_dfP-.js +0 -2
  276. package/dist/chunks/TeleportProgress-QL3ibQfK.js +0 -1
  277. package/dist/chunks/TeleportRepoMismatchDialog-f-xl7biD.js +0 -1
  278. package/dist/chunks/TeleportResumeWrapper-DzVcrFuP.js +0 -1
  279. package/dist/chunks/ThemePicker-CIFKZza0.js +0 -1
  280. package/dist/chunks/TrustDialog-C0HEwZPk.js +0 -1
  281. package/dist/chunks/add-dir-DmEhPnvj.js +0 -1
  282. package/dist/chunks/agents-D96ng5I9.js +0 -101
  283. package/dist/chunks/allErrors-CT2dbBF3.js +0 -1
  284. package/dist/chunks/api-DTyrmy1O.js +0 -1
  285. package/dist/chunks/api-DumFOErN.js +0 -1
  286. package/dist/chunks/auth-CZ4EsFWF.js +0 -10
  287. package/dist/chunks/auth-QvonHoG9.js +0 -1
  288. package/dist/chunks/auth-jV5THRH8.js +0 -1
  289. package/dist/chunks/backgroundHousekeeping-C72oPgfD.js +0 -17
  290. package/dist/chunks/backgroundHousekeeping-D9PScHES.js +0 -1
  291. package/dist/chunks/banner-ChT5Ri7Q.js +0 -2
  292. package/dist/chunks/bg-qG2osBbP.js +0 -9
  293. package/dist/chunks/branch-K8X6jx0i.js +0 -2
  294. package/dist/chunks/bridgeConfig-C-bI-slm.js +0 -1
  295. package/dist/chunks/bridgeConfig-_xpxhGB5.js +0 -1
  296. package/dist/chunks/bridgeMessaging-DSJlYarJ.js +0 -1
  297. package/dist/chunks/bridgePointer-DfTOjgtX.js +0 -1
  298. package/dist/chunks/bridgeStatusUtil-DaEq5c69.js +0 -1
  299. package/dist/chunks/btw-BNs5OX7x.js +0 -1
  300. package/dist/chunks/bundledMode--fG1S62b.js +0 -1
  301. package/dist/chunks/caches-CC5NHwAz.js +0 -1
  302. package/dist/chunks/caches-nHxJWXgO.js +0 -1
  303. package/dist/chunks/capacityWake-BpP6c7x3.js +0 -3
  304. package/dist/chunks/ccrClient-JnhF5b3z.js +0 -1
  305. package/dist/chunks/claudeDesktop-DPc_SaVn.js +0 -1
  306. package/dist/chunks/cliLaunch-DDtwAolw.js +0 -1
  307. package/dist/chunks/client-9uHzAmFH.js +0 -1
  308. package/dist/chunks/client-BVal_QII.js +0 -1
  309. package/dist/chunks/client-BtTkq0YS.js +0 -1
  310. package/dist/chunks/client-Dd7CKMRX.js +0 -1
  311. package/dist/chunks/commands-C_rYjyQZ.js +0 -1
  312. package/dist/chunks/compact-Cqd6vKpn.js +0 -2
  313. package/dist/chunks/config-Be0BkAAr.js +0 -1
  314. package/dist/chunks/config-DUTgj3js.js +0 -3
  315. package/dist/chunks/config-DoEDgAfv.js +0 -1
  316. package/dist/chunks/context-noninteractive-D9tJYwi7.js +0 -1
  317. package/dist/chunks/controlMessageCompat-IFu4Gc1y.js +0 -1
  318. package/dist/chunks/conversation-DWfE4KGH.js +0 -1
  319. package/dist/chunks/conversation-Tvo4EDpQ.js +0 -1
  320. package/dist/chunks/createSSHSession-BQ83MMtr.js +0 -5
  321. package/dist/chunks/createSession-CqHnHhCR.js +0 -1
  322. package/dist/chunks/createSession-DqTtBycR.js +0 -1
  323. package/dist/chunks/crossProjectResume-DIXtiODF.js +0 -40
  324. package/dist/chunks/cwd-DLK3znO7.js +0 -1
  325. package/dist/chunks/cwd-Nh5IZNKO.js +0 -1
  326. package/dist/chunks/debugUtils-DXBRbwCE.js +0 -1
  327. package/dist/chunks/detached-Biz-xhu0.js +0 -4
  328. package/dist/chunks/detectRepository-DUJBh5s2.js +0 -1
  329. package/dist/chunks/detectRepository-pRAVv8SH.js +0 -1
  330. package/dist/chunks/directoryCompletion-CuA3_YIT.js +0 -1
  331. package/dist/chunks/dist-es-5t7v8oaj.js +0 -1
  332. package/dist/chunks/dist-es-BIjDeceU.js +0 -1
  333. package/dist/chunks/dist-es-C-OjW2Ao.js +0 -1
  334. package/dist/chunks/dist-es-CEk66gUu.js +0 -1
  335. package/dist/chunks/dist-es-CIULjvtA2.js +0 -1
  336. package/dist/chunks/dist-es-CMtO44xC.js +0 -1
  337. package/dist/chunks/dist-es-CYPVg66r.js +0 -9
  338. package/dist/chunks/dist-es-D1Y8zSMI.js +0 -1
  339. package/dist/chunks/dist-es-Gt_DpXlP.js +0 -1
  340. package/dist/chunks/dist-es-kj-F5A132.js +0 -1
  341. package/dist/chunks/doctor-eNAm6OiS.js +0 -1
  342. package/dist/chunks/entry-DidpiR-D.js +0 -13
  343. package/dist/chunks/esm-BCUC71kt.js +0 -1
  344. package/dist/chunks/execSyncWrapper-C3ZFV9od.js +0 -1
  345. package/dist/chunks/exit-DywUeiYd.js +0 -1
  346. package/dist/chunks/extraUsage-DiAirtuk.js +0 -1
  347. package/dist/chunks/extractMemories-_xiTnX95.js +0 -1
  348. package/dist/chunks/fast-DCXZACT9.js +0 -1
  349. package/dist/chunks/fast-Qo4WVqiW.js +0 -1
  350. package/dist/chunks/fetchModelList-fQDsmR3E.js +0 -1
  351. package/dist/chunks/fetchModelList-woVzIVde.js +0 -1
  352. package/dist/chunks/fileSuggestions-CRx1D6uk.js +0 -3
  353. package/dist/chunks/firstPartyEventLogger-B261Wksn.js +0 -3
  354. package/dist/chunks/firstPartyEventLogger-DtFTeHy-.js +0 -1
  355. package/dist/chunks/flushGate-BA8dSr0i.js +0 -1
  356. package/dist/chunks/gemini-BXAyy1JN.js +0 -1
  357. package/dist/chunks/generateSessionName-Cwmk2N3F.js +0 -1
  358. package/dist/chunks/git-Wid-XppW.js +0 -5
  359. package/dist/chunks/git-hO-TMvXc.js +0 -1
  360. package/dist/chunks/githubRepoPathMapping-OV8U1VFK.js +0 -1
  361. package/dist/chunks/goal-C9clrwEH.js +0 -3
  362. package/dist/chunks/grok-CjeCecsZ.js +0 -1
  363. package/dist/chunks/grove-DqTnK9nn.js +0 -7
  364. package/dist/chunks/hash-Tu-My5Vp.js +0 -1
  365. package/dist/chunks/help-Bb6LdzXK.js +0 -1
  366. package/dist/chunks/hooks-BX2s7aoL.js +0 -1
  367. package/dist/chunks/initReplBridge-D7cuY_os.js +0 -1
  368. package/dist/chunks/install-eCA8UACi.js +0 -1
  369. package/dist/chunks/instrumentation-BaRKojJh.js +0 -21
  370. package/dist/chunks/jwtUtils-JE2okZ70.js +0 -1
  371. package/dist/chunks/keybindings-iBqc1KHL.js +0 -1
  372. package/dist/chunks/launchLocalMemory-IZPGEzMk.js +0 -3
  373. package/dist/chunks/lazySchema-DULtBUCI.js +0 -65
  374. package/dist/chunks/lib-BlVGipXx.js +0 -14
  375. package/dist/chunks/loadAgentsDir-Bpke9CtB.js +0 -1
  376. package/dist/chunks/loadAgentsDir-C96o6gCj.js +0 -3422
  377. package/dist/chunks/loadPluginHooks-0nGlugZ4.js +0 -1
  378. package/dist/chunks/localSearch-dodgnjGn.js +0 -1
  379. package/dist/chunks/log-CZ7ploQm.js +0 -1
  380. package/dist/chunks/logoUtils-Cg_6QV1Z.js +0 -1
  381. package/dist/chunks/main-7ssnA9Yb.js +0 -31
  382. package/dist/chunks/main-BEv6MqMX.js +0 -356
  383. package/dist/chunks/managedEnv-CHYvwXBH.js +0 -1
  384. package/dist/chunks/managedEnv-CbjOQmEe.js +0 -1
  385. package/dist/chunks/mappers-D8VLUZ2N.js +0 -1
  386. package/dist/chunks/mcp-BUn3yqsT.js +0 -1
  387. package/dist/chunks/mcp-BskLq9iP.js +0 -2
  388. package/dist/chunks/mcp-C-0DMaXx.js +0 -6
  389. package/dist/chunks/memoize-CumjjK2Q.js +0 -1
  390. package/dist/chunks/memory-vDkJM58W.js +0 -1
  391. package/dist/chunks/mode-Dbh21H2Y.js +0 -2
  392. package/dist/chunks/model-BaMclMXn.js +0 -1
  393. package/dist/chunks/model-atn3_JBi.js +0 -1
  394. package/dist/chunks/model-vS1Iewyq.js +0 -1
  395. package/dist/chunks/modelOptions-Cw1ThINb.js +0 -1
  396. package/dist/chunks/nativeInstaller-CfZ5uNTh.js +0 -1
  397. package/dist/chunks/oauth-D38aRTUb.js +0 -1
  398. package/dist/chunks/oauth-U649LV5H.js +0 -1
  399. package/dist/chunks/omit-B7eQ9q0x.js +0 -1
  400. package/dist/chunks/onChangeAppState-kEAt8nxV.js +0 -1
  401. package/dist/chunks/openai-wh8AX5iz.js +0 -10
  402. package/dist/chunks/parser-Cq9X7HMP.js +0 -1
  403. package/dist/chunks/partition-CENvOfiS.js +0 -1
  404. package/dist/chunks/permissions-ChuIx-d4.js +0 -3
  405. package/dist/chunks/pidLock-C1hmh3YQ.js +0 -3
  406. package/dist/chunks/plugin-DVBEWwMP.js +0 -17
  407. package/dist/chunks/pluginAutoupdate-aLXhSUVD.js +0 -1
  408. package/dist/chunks/pluginBlocklist-BprCv0En.js +0 -1
  409. package/dist/chunks/pluginCliCommands-WzzqR1Sr.js +0 -1
  410. package/dist/chunks/pluginOperations-Ca9Lup5G.js +0 -2
  411. package/dist/chunks/pluginStartupCheck-DdtxcNwH.js +0 -1
  412. package/dist/chunks/plugins-DdIaXpNb.js +0 -4
  413. package/dist/chunks/pollConfig-2nFzv6Hy.js +0 -1
  414. package/dist/chunks/poorMode-ZIq2oz7q.js +0 -1
  415. package/dist/chunks/print-vxrRE1O2.js +0 -14
  416. package/dist/chunks/processBashCommand-ISucgwpi.js +0 -1
  417. package/dist/chunks/processSlashCommand-BnpXO_fI.js +0 -5
  418. package/dist/chunks/prompt-2AA5W7EH.js +0 -1
  419. package/dist/chunks/prompt-AXiS2LoO.js +0 -1
  420. package/dist/chunks/promptEditor-DT6egmcb.js +0 -4
  421. package/dist/chunks/rcDebugLog-DSchf3Hs.js +0 -1
  422. package/dist/chunks/reconciler-D3zyJCnV.js +0 -1
  423. package/dist/chunks/refresh-BSG0t4cf.js +0 -1
  424. package/dist/chunks/registerProtocol-BOEYaX-X.js +0 -1
  425. package/dist/chunks/reload-plugins-BFMRhbv8.js +0 -1
  426. package/dist/chunks/remoteBridgeCore-D5OwvmAz.js +0 -1
  427. package/dist/chunks/remoteManagedSettings-DyGVvvcW.js +0 -1
  428. package/dist/chunks/rename-BrEwj3Xw.js +0 -1
  429. package/dist/chunks/resume-DR5JbICs.js +0 -2
  430. package/dist/chunks/ripgrep-Dt4a91S5.js +0 -5
  431. package/dist/chunks/ripgrep-KTOU5s9J.js +0 -1
  432. package/dist/chunks/sandbox-adapter-BqDyWcol.js +0 -1
  433. package/dist/chunks/sandbox-toggle-B9f_0NQI.js +0 -1
  434. package/dist/chunks/searchExtraTools-2pIT2C8u.js +0 -1
  435. package/dist/chunks/session-wkRTfdo8.js +0 -2
  436. package/dist/chunks/sessionFileAccessHooks-DV22q9JO.js +0 -1
  437. package/dist/chunks/sessionIdCompat-Dgp6PW_1.js +0 -1
  438. package/dist/chunks/sessionObserver-BLJg0qm_.js +0 -1
  439. package/dist/chunks/sessionState-8jutEorw.js +0 -11
  440. package/dist/chunks/sessionStorage-DRV7IhZF.js +0 -1
  441. package/dist/chunks/sessionStoragePortable-x0Yn02-G.js +0 -3
  442. package/dist/chunks/sessionTracing-fIp8g04N.js +0 -11
  443. package/dist/chunks/settings-BowI3jp-.js +0 -19
  444. package/dist/chunks/settings-CHn0gJCG.js +0 -1
  445. package/dist/chunks/settingsSync-DF4JgSNc.js +0 -1
  446. package/dist/chunks/setup-UiEO9i7F.js +0 -3
  447. package/dist/chunks/shellQuote-Ddgr1vif.js +0 -4
  448. package/dist/chunks/sinks-DnLqRPEC.js +0 -1
  449. package/dist/chunks/sinks-mGBiINp8.js +0 -1
  450. package/dist/chunks/skillChangeDetector-Dc6YZXJE.js +0 -1
  451. package/dist/chunks/skills-DKtN17ch.js +0 -1
  452. package/dist/chunks/startupProfiler-B90b5vuq.js +0 -3
  453. package/dist/chunks/startupProfiler-DG2TN5R_.js +0 -1
  454. package/dist/chunks/state-BStOuCh4.js +0 -1
  455. package/dist/chunks/state-D5D6QpTX.js +0 -1
  456. package/dist/chunks/stats-D4LEtkrw.js +0 -1
  457. package/dist/chunks/status-0ZBx6Ls0.js +0 -2
  458. package/dist/chunks/status-BUJ4-omB.js +0 -1
  459. package/dist/chunks/statusNoticeHelpers-BrpQWj0l.js +0 -1
  460. package/dist/chunks/stringUtils-D7oJIyY2.js +0 -4
  461. package/dist/chunks/sts-C2Gf2WYN.js +0 -1
  462. package/dist/chunks/subprocessEnv-CNBOhlDV.js +0 -1
  463. package/dist/chunks/subprocessEnv-DtBCqQIo.js +0 -1
  464. package/dist/chunks/switcher-D7Ey5uIi.js +0 -1
  465. package/dist/chunks/syncCache-DUhciJLz.js +0 -1
  466. package/dist/chunks/teleport-DwZMevmQ.js +0 -1
  467. package/dist/chunks/terminalSetup-a7-BNS4T.js +0 -32
  468. package/dist/chunks/tmux-DA06aewY.js +0 -1
  469. package/dist/chunks/toolPool-mdsxlKWR.js +0 -1
  470. package/dist/chunks/trustedDevice-C1m--Yjw.js +0 -1
  471. package/dist/chunks/trustedDevice-CeDIk_ln.js +0 -1
  472. package/dist/chunks/types-APu4OCXJ.js +0 -17
  473. package/dist/chunks/udsClient-BcwsY0XE.js +0 -1
  474. package/dist/chunks/upstreamproxy-CTOuotLO.js +0 -10
  475. package/dist/chunks/useExitOnCtrlCDWithKeybindings-L5idX6Kz.js +0 -1
  476. package/dist/chunks/useMainLoopModel-VXeS2EC6.js +0 -1
  477. package/dist/chunks/useManagePlugins-CAXp5CfH.js +0 -1
  478. package/dist/chunks/useMergedTools-DYXrPTIA.js +0 -1
  479. package/dist/chunks/useSearchInput-Bxl4wGcZ.js +0 -1
  480. package/dist/chunks/useSettingsErrors-sbjsaT7k.js +0 -1
  481. package/dist/chunks/userAgent-NbKd-hN7.js +0 -1
  482. package/dist/chunks/util-DU63xTwZ.js +0 -1
  483. package/dist/chunks/validatePlugin-DQ_9OCpP.js +0 -1
  484. package/dist/chunks/vim-xruiCyUd.js +0 -1
  485. package/dist/chunks/which-B8rchd8P.js +0 -1
  486. package/dist/chunks/windowsPaths-BdhjMYTm.js +0 -1
  487. package/dist/chunks/windowsPaths-DtGZ83kH.js +0 -1
  488. package/dist/chunks/workSecret-CaM2yIJD.js +0 -1
  489. package/dist/chunks/workerRegistry-BBgquE8F.js +0 -2
  490. package/dist/chunks/worktree-C28I8mFB.js +0 -1
  491. /package/dist/chunks/{dist-es-Cgsa8pb82.js → dist-es-Cgsa8pb8.js} +0 -0
  492. /package/dist/chunks/{dist-es-Cwru7c2B2.js → dist-es-Cwru7c2B.js} +0 -0
  493. /package/dist/chunks/{dist-es-DXIR5NLi2.js → dist-es-DXIR5NLi.js} +0 -0
@@ -0,0 +1 @@
1
+ import{t as e}from"./backgroundHousekeeping-CVNIhQg8.js";export{e as startBackgroundHousekeeping};
@@ -0,0 +1,17 @@
1
+ import{i as e,o as t}from"./envUtils-DfkgIdYf.js";import{Eb as n,Jd as r,Jx as i,Lu as a,Pu as o,Q as s,X as c,Yi as l,Yx as ee,_r as u,aC as te,nc as d,ny as ne,pS as re,qg as f,rc as p,sr as m,ty as h,ut as g,wb as ie,xt as ae}from"./loadAgentsDir-DlPbtIsS.js";import{B as _,F as v,It as y}from"./state-B4jiUise.js";import{n as oe,t as se}from"./cwd-Pa83R95t.js";import{I as b,V as x,c as S,f as C,i as w,u as T,x as E}from"./debug-Bglx1aTu.js";import{d as D,h as O,v as k}from"./settings-B2jvL8Dp.js";import{b as A}from"./config-C-Y2qtB2.js";import{_ as j,o as M,s as N,v as P}from"./log-D2TIwHBV.js";import{n as F,r as I}from"./analytics-DJobLaWP.js";import{d as L,l as R}from"./model-BwBG0V1u.js";import{_n as z,vn as B}from"./prompt-mM79EGnT.js";import{r as V,t as H}from"./pasteStore-P0zP-ch0.js";import{r as U}from"./magicDocs-BEF8D3if.js";import{i as W,t as G}from"./nativeInstaller-C3pVPqrZ.js";import{n as K,t as ce}from"./allErrors-DfWylHSw.js";import{n as le,t as ue}from"./pluginAutoupdate-8qugAFhb.js";import{n as de}from"./registerProtocol-CAsDme_E.js";import"os";import{join as q}from"path";import"crypto";t(),y(),oe(),E(),C(),w(),P(),O(),B(),L(),p(),u(),U(),c(),M(),b(),l(),f(),c(),ne(),b(),M(),l(),f(),r();async function fe(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),a=n(se(),`.workmate`,`skills`,e,`SKILL.md`),o;try{o=await r.readFile(a,`utf-8`)}catch{N(Error(`Failed to read skill file for improvement: ${a}`));return}let c=t.map(e=>`- ${e.section}: ${e.change}`).join(`
2
+ `),l=R(),u=await s({messages:[re({content:`You are editing a skill definition file. Apply the following improvements to the skill.
3
+
4
+ <current_skill_file>
5
+ ${o}
6
+ </current_skill_file>
7
+
8
+ <improvements>
9
+ ${c}
10
+ </improvements>
11
+
12
+ Rules:
13
+ - Integrate the improvements naturally into the existing structure
14
+ - Preserve frontmatter (--- block) exactly as-is
15
+ - Preserve the overall format and style
16
+ - Do not remove existing content unless an improvement explicitly replaces it
17
+ - Output the complete updated file inside <updated_file> tags`})],systemPrompt:te([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:h().signal,options:{getToolPermissionContext:async()=>z(),model:l,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),d=i(ee(Array.isArray(u.message.content)?u.message.content:[]).trim(),`updated_file`);if(!d){N(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(a,d,`utf-8`)}catch(e){N(x(e))}}F(),a(),A(),M(),G(),V(),K(),n(),ae();var pe=30;function J(){let e=((D()||{}).cleanupPeriodDays??pe)*24*60*60*1e3;return new Date(Date.now()-e)}function me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function he(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function Y(e,t,n){let r={messages:0,errors:0};try{let i=await T().readdir(e);for(let a of i)try{he(a.name)<t&&(await T().unlink(q(e,a.name)),n?r.messages++:r.errors++)}catch(e){N(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&N(e)}return r}async function ge(){let e=T(),t=J(),n=j.errors(),r=j.baseLogs(),i=await Y(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>q(r,e.name));for(let n of a)i=me(i,await Y(n,t,!0)),await Z(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&N(e)}return i}async function X(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Z(e,t){try{await t.rmdir(e)}catch{}}async function _e(){let e=J(),t={messages:0,errors:0},n=m(),r=T(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=q(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=q(i,n.name),o=q(a,ie),s;try{s=await r.readdir(o)}catch{await Z(a,r);continue}for(let n of s)if(n.isFile())try{await X(q(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=q(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Z(i,r)}await Z(o,r),await Z(a,r)}await Z(i,r)}return t}async function Q(e,t,n=!0){let r=J(),i={messages:0,errors:0},a=T(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await X(q(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Z(e,a),i}function ve(){return Q(q(e(),`plans`),`.md`)}async function ye(){let t=J(),n={messages:0,errors:0},r=T();try{let i=q(e(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));await Promise.all(o.map(async e=>{try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}})),await Z(i,r)}catch(e){N(e)}return n}async function be(){let t=J(),n={messages:0,errors:0},r=T();try{let i=q(e(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));for(let e of o)try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}await Z(i,r)}catch(e){N(e)}return n}async function xe(){let t=J(),n={messages:0,errors:0},r=T(),i=q(e(),`debug`),a;try{a=await r.readdir(i)}catch{return n}for(let e of a)if(!(!e.isFile()||!e.name.endsWith(`.txt`)||e.name===`latest`))try{await X(q(i,e.name),t,r)&&n.messages++}catch{n.errors++}return n}async function Se(){let{errors:e}=ce();if(e.length>0&&k(`cleanupPeriodDays`)){S(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await ge(),await _e(),await ve(),await ye(),await be(),await xe(),await o(),await H(J());let t=await g(J());t>0&&I(`tengu_worktree_cleanup`,{removed:t})}y(),G(),le();var $=600*1e3;function Ce(){import(`./extractMemories-xP63mv6R.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),d(),ue(),v()&&de();let e=!0;async function t(){if(v()&&_()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Se()),v()&&_()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await W()}setTimeout(t,$).unref()}export{fe as n,Ce as t};
@@ -0,0 +1,2 @@
1
+ import{It as e,J as t}from"./state-B4jiUise.js";import{c as n,i as r}from"./debug-Bglx1aTu.js";import{Br as i,Lr as a,Or as o,Ur as s,jr as c,kn as l,wn as u}from"./settings-B2jvL8Dp.js";import{_ as d,p as f,s as p}from"./config-C-Y2qtB2.js";import{_ as m,f as h,p as g}from"./startupProfiler-CJdr3SxP.js";import{n as _,r as v}from"./detectRepository-CfX8Lc0A.js";import{homedir as y}from"os";import{join as b,sep as x}from"path";import{realpath as S,stat as C}from"fs/promises";e(),f(),r(),v(),u(),s(),a();async function w(){try{let e=await _();if(!e){n(`Not in a GitHub repository, skipping path mapping update`);return}let r=t(),i=o(r)??r,a;try{a=(await S(i)).normalize(`NFC`)}catch{a=i}let s=e.toLowerCase(),c=p().githubRepoPaths?.[s]??[];if(c[0]===a){n(`Path ${a} already tracked for repo ${s}`);return}let l=c.filter(e=>e!==a),u=[a,...l];d(e=>({...e,githubRepoPaths:{...e.githubRepoPaths,[s]:u}})),n(`Added ${a} to tracked paths for repo ${s}`)}catch(e){n(`Error updating repo path mapping: ${e}`)}}function T(e){let t=p(),n=e.toLowerCase();return t.githubRepoPaths?.[n]??[]}async function E(e){let t=await Promise.all(e.map(l));return e.filter((e,n)=>t[n])}m(),s(),a();var D=10080*60*1e3,O=1e3;function k(e){let t=[`This session was opened by an external deep link in ${M(e.cwd)}`];if(e.repo){let n=e.lastFetch?g(e.lastFetch):`never`,r=!e.lastFetch||Date.now()-e.lastFetch.getTime()>D;t.push(`Resolved ${e.repo} from local clones · last fetched ${n}${r?` — AGENTS.md may be stale`:``}`)}return e.prefillLength&&t.push(e.prefillLength>O?`The prompt below (${h(e.prefillLength)} chars) was supplied by the link — scroll to review the entire prompt before pressing Enter.`:`The prompt below was supplied by the link — review carefully before pressing Enter.`),t.join(`
2
+ `)}async function A(e){let t=await c(e);if(!t)return;let n=await i(t),[r,a]=await Promise.all([j(b(t,`FETCH_HEAD`)),n?j(b(n,`FETCH_HEAD`)):Promise.resolve(void 0)]);return r&&a?r>a?r:a:r??a}async function j(e){try{let{mtime:t}=await C(e);return t}catch{return}}function M(e){let t=y();return e===t?`~`:e.startsWith(t+x)?`~${e.slice(t.length)}`:e}export{w as a,T as i,A as n,E as r,k as t};
@@ -1,4 +1,4 @@
1
- import{a as e,n as t,r as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{_ as i,a,d as o,f as s,h as c,i as l,l as u,m as d,n as f,p,r as m,s as h,v as g,y as ee}from"./client-DchQnIJD.js";import{n as te,t as ne}from"./defineProperty-C-QyHrDq.js";import{G as re,n as ie,t as ae}from"./protocols-CnYQjBlj.js";import{c as oe,r as se}from"./serde-f76bObzR.js";import{Ht as ce,Lt as le,Pt as ue,Ut as de,t as fe}from"./dist-es-BOPBJQo3.js";import{Readable as pe}from"stream";import{Buffer as _}from"buffer";import me from"assert";import"https";function he(e,t){return new Request(e,t)}var ge=t((()=>{}));function _e(e=0){return new Promise((t,n)=>{e&&setTimeout(()=>{let t=Error(`Request did not complete within ${e} ms`);t.name=`TimeoutError`,n(t)},e)})}var ve=t((()=>{}));function ye(e){let t=e&&typeof e==`object`&&`reason`in e?e.reason:void 0;if(t){if(t instanceof Error){let e=Error(`Request aborted`);return e.name=`AbortError`,e.cause=t,e}let e=Error(String(t));return e.name=`AbortError`,e}let n=Error(`Request aborted`);return n.name=`AbortError`,n}var v,be,xe=t((()=>{ae(),ge(),ve(),te(),v={supported:void 0},be=class e{static create(t){return typeof t?.handle==`function`?t:new e(t)}constructor(e){ne(this,`config`,void 0),ne(this,`configProvider`,void 0),typeof e==`function`?this.configProvider=e().then(e=>e||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),v.supported===void 0&&(v.supported=typeof Request<`u`&&`keepalive`in he(`https://[::1]`))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);let r=n??this.config.requestTimeout,i=this.config.keepAlive===!0,a=this.config.credentials;if(t?.aborted){let e=ye(t);return Promise.reject(e)}let o=e.path,s=ie(e.query||{});s&&(o+=`?${s}`),e.fragment&&(o+=`#${e.fragment}`);let c=``;(e.username!=null||e.password!=null)&&(c=`${e.username??``}:${e.password??``}@`);let{port:l,method:u}=e,d=`${e.protocol}//${c}${e.hostname}${l?`:${l}`:``}${o}`,f=u===`GET`||u===`HEAD`?void 0:e.body,p={body:f,headers:new Headers(e.headers),method:u,credentials:a};this.config?.cache&&(p.cache=this.config.cache),f&&(p.duplex=`half`),typeof AbortController<`u`&&(p.signal=t),v.supported&&(p.keepalive=i),typeof this.config.requestInit==`function`&&Object.assign(p,this.config.requestInit(e));let m=()=>{},h=he(d,p),g=[fetch(h).then(e=>{let t=e.headers,n={};for(let e of t.entries())n[e[0]]=e[1];return e.body==null?e.blob().then(t=>({response:new re({headers:n,reason:e.statusText,statusCode:e.status,body:t})})):{response:new re({headers:n,reason:e.statusText,statusCode:e.status,body:e.body})}}),_e(r)];return t&&g.push(new Promise((e,n)=>{let r=()=>{n(ye(t))};if(typeof t.addEventListener==`function`){let e=t;e.addEventListener(`abort`,r,{once:!0}),m=()=>e.removeEventListener(`abort`,r)}else t.onabort=r})),Promise.race(g).finally(m)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=t,n))}httpHandlerConfigs(){return this.config??{}}}})),Se=t((()=>{xe(),se()})),y=n({__assign:()=>S,__asyncDelegator:()=>Le,__asyncGenerator:()=>Ie,__asyncValues:()=>Re,__await:()=>b,__awaiter:()=>Oe,__classPrivateFieldGet:()=>He,__classPrivateFieldSet:()=>Ue,__createBinding:()=>Ae,__decorate:()=>Te,__exportStar:()=>je,__extends:()=>Ce,__generator:()=>ke,__importDefault:()=>Ve,__importStar:()=>Be,__makeTemplateObject:()=>ze,__metadata:()=>De,__param:()=>Ee,__read:()=>Ne,__rest:()=>we,__spread:()=>Pe,__spreadArrays:()=>Fe,__values:()=>Me});function Ce(e,t){x(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function we(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Te(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function Ee(e,t){return function(n,r){t(n,r,e)}}function De(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function Oe(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function ke(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function Ae(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}function je(e,t){for(var n in e)n!=="default"&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function Me(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function Ne(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Pe(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Ne(arguments[t]));return e}function Fe(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function b(e){return this instanceof b?(this.v=e,this):new b(e)}function Ie(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},o(`next`),o(`throw`),o(`return`),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||s(e,t)})})}function s(e,t){try{c(r[e](t))}catch(e){d(a[0][3],e)}}function c(e){e.value instanceof b?Promise.resolve(e.value.v).then(l,u):d(a[0][2],e)}function l(e){s(`next`,e)}function u(e){s(`throw`,e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}function Le(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:b(e[r](t)),done:r===`return`}:i?i(t):t}:i}}function Re(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Me==`function`?Me(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function ze(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Be(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Ve(e){return e&&e.__esModule?e:{default:e}}function He(e,t){if(!t.has(e))throw TypeError(`attempted to get private field on non-instance`);return t.get(e)}function Ue(e,t,n){if(!t.has(e))throw TypeError(`attempted to set private field on non-instance`);return t.set(e,n),n}var x,S,C=t((()=>{x=function(e,t){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},x(e,t)},S=function(){return S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},S.apply(this,arguments)}})),We=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_HASHABLE_LENGTH=e.INIT=e.KEY=e.DIGEST_LENGTH=e.BLOCK_SIZE=void 0,e.BLOCK_SIZE=64,e.DIGEST_LENGTH=32,e.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),e.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e.MAX_HASHABLE_LENGTH=2**53-1})),Ge=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RawSha256=void 0;var t=We();e.RawSha256=function(){function e(){this.state=Int32Array.from(t.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw Error(`Attempted to update an already finished hash.`);var n=0,r=e.byteLength;if(this.bytesHashed+=r,this.bytesHashed*8>t.MAX_HASHABLE_LENGTH)throw Error(`Cannot hash more than 2^53 - 1 bits`);for(;r>0;)this.buffer[this.bufferLength++]=e[n++],r--,this.bufferLength===t.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,n=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(n.setUint8(this.bufferLength++,128),r%t.BLOCK_SIZE>=t.BLOCK_SIZE-8){for(var i=this.bufferLength;i<t.BLOCK_SIZE;i++)n.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(var i=this.bufferLength;i<t.BLOCK_SIZE-8;i++)n.setUint8(i,0);n.setUint32(t.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),n.setUint32(t.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var a=new Uint8Array(t.DIGEST_LENGTH),i=0;i<8;i++)a[i*4]=this.state[i]>>>24&255,a[i*4+1]=this.state[i]>>>16&255,a[i*4+2]=this.state[i]>>>8&255,a[i*4+3]=this.state[i]>>>0&255;return a},e.prototype.hashBuffer=function(){for(var e=this,n=e.buffer,r=e.state,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=0;f<t.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(n[f*4]&255)<<24|(n[f*4+1]&255)<<16|(n[f*4+2]&255)<<8|n[f*4+3]&255;else{var p=this.temp[f-2],m=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var h=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(m+this.temp[f-7]|0)+(h+this.temp[f-16]|0)}var g=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&l^~c&u)|0)+(d+(t.KEY[f]+this.temp[f]|0)|0)|0,ee=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&a^i&o^a&o)|0;d=u,u=l,l=c,c=s+g|0,s=o,o=a,a=i,i=g+ee|0}r[0]+=i,r[1]+=a,r[2]+=o,r[3]+=s,r[4]+=c,r[5]+=l,r[6]+=u,r[7]+=d},e}()})),Ke,qe,Je=t((()=>{Ke=e=>{let t=[];for(let n=0,r=e.length;n<r;n++){let r=e.charCodeAt(n);if(r<128)t.push(r);else if(r<2048)t.push(r>>6|192,r&63|128);else if(n+1<e.length&&(r&64512)==55296&&(e.charCodeAt(n+1)&64512)==56320){let i=65536+((r&1023)<<10)+(e.charCodeAt(++n)&1023);t.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else t.push(r>>12|224,r>>6&63|128,r&63|128)}return Uint8Array.from(t)},qe=e=>{let t=``;for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r<128)t+=String.fromCharCode(r);else if(192<=r&&r<224){let i=e[++n];t+=String.fromCharCode((r&31)<<6|i&63)}else if(240<=r&&r<365){let i=`%`+[r,e[++n],e[++n],e[++n]].map(e=>e.toString(16)).join(`%`);t+=decodeURIComponent(i)}else t+=String.fromCharCode((r&15)<<12|(e[++n]&63)<<6|e[++n]&63)}return t}}));function Ye(e){return new TextEncoder().encode(e)}function Xe(e){return new TextDecoder(`utf-8`).decode(e)}var Ze=t((()=>{})),Qe=n({fromUtf8:()=>$e,toUtf8:()=>et}),$e,et,tt=t((()=>{Je(),Ze(),$e=e=>typeof TextEncoder==`function`?Ye(e):Ke(e),et=e=>typeof TextDecoder==`function`?Xe(e):qe(e)})),nt=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var n=(tt(),e(Qe)),r=typeof Buffer<`u`&&Buffer.from?function(e){return Buffer.from(e,`utf8`)}:n.fromUtf8;function i(e){return e instanceof Uint8Array?e:typeof e==`string`?r(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.convertToBuffer=i})),rt=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isEmptyData=void 0;function t(e){return typeof e==`string`?e.length===0:e.byteLength===0}e.isEmptyData=t})),it=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.numToUint8=void 0;function t(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}e.numToUint8=t})),at=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=void 0;function t(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}e.uint32ArrayFrom=t})),ot=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=e.numToUint8=e.isEmptyData=e.convertToBuffer=void 0;var t=nt();Object.defineProperty(e,"convertToBuffer",{enumerable:!0,get:function(){return t.convertToBuffer}});var n=rt();Object.defineProperty(e,"isEmptyData",{enumerable:!0,get:function(){return n.isEmptyData}});var r=it();Object.defineProperty(e,"numToUint8",{enumerable:!0,get:function(){return r.numToUint8}});var i=at();Object.defineProperty(e,"uint32ArrayFrom",{enumerable:!0,get:function(){return i.uint32ArrayFrom}})})),st=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var n=(C(),e(y)),r=We(),i=Ge(),a=ot();t.Sha256=function(){function e(e){this.secret=e,this.hash=new i.RawSha256,this.reset()}return e.prototype.update=function(e){if(!((0,a.isEmptyData)(e)||this.error))try{this.hash.update((0,a.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new i.RawSha256,this.secret){this.outer=new i.RawSha256;var e=o(this.secret),t=new Uint8Array(r.BLOCK_SIZE);t.set(e);for(var n=0;n<r.BLOCK_SIZE;n++)e[n]^=54,t[n]^=92;this.hash.update(e),this.outer.update(t);for(var n=0;n<e.byteLength;n++)e[n]=0}},e}();function o(e){var t=(0,a.convertToBuffer)(e);if(t.byteLength>r.BLOCK_SIZE){var n=new i.RawSha256;n.update(t),t=n.digest()}var o=new Uint8Array(r.BLOCK_SIZE);return o.set(t),o}})),ct=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),(C(),e(y)).__exportStar(st(),t)})),lt=t((()=>{})),ut=t((()=>{lt()})),dt=t((()=>{})),ft,pt=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(ft||(ft={}))})),mt,ht=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(mt||(mt={}))})),gt=t((()=>{})),_t=t((()=>{})),vt=t((()=>{})),yt=t((()=>{})),bt=t((()=>{pt(),ht(),gt(),_t(),vt(),yt()})),xt=t((()=>{})),St=t((()=>{})),Ct=t((()=>{})),wt=t((()=>{})),Tt=t((()=>{})),Et=t((()=>{})),Dt=t((()=>{})),Ot=t((()=>{Tt(),Et(),Dt()})),kt=t((()=>{})),At=t((()=>{})),jt,Mt=t((()=>{(function(e){e.HTTP=`http`,e.HTTPS=`https`})(jt||(jt={}))})),Nt=t((()=>{})),Pt=t((()=>{})),Ft=t((()=>{})),It=t((()=>{})),Lt=t((()=>{})),Rt=t((()=>{Nt(),Pt(),Ft(),It(),Lt()})),zt=t((()=>{})),Bt,Vt=t((()=>{(function(e){e.MD5=`md5`,e.CRC32=`crc32`,e.CRC32C=`crc32c`,e.SHA1=`sha1`,e.SHA256=`sha256`})(Bt||(Bt={}))})),Ht=t((()=>{Vt()})),Ut=t((()=>{})),Wt=t((()=>{Ht(),Ut(),Vt()})),Gt,Kt=t((()=>{(function(e){e[e.HEADER=0]=`HEADER`,e[e.TRAILER=1]=`TRAILER`})(Gt||(Gt={}))})),qt=t((()=>{})),Jt=t((()=>{})),Yt=t((()=>{})),Xt=t((()=>{})),Zt=t((()=>{})),Qt=t((()=>{Jt(),Yt(),Xt(),Zt()})),$t=t((()=>{})),en=t((()=>{})),tn=t((()=>{})),nn,rn=t((()=>{(function(e){e.PROFILE=`profile`,e.SSO_SESSION=`sso-session`,e.SERVICES=`services`})(nn||(nn={}))})),an=t((()=>{})),on=t((()=>{})),sn=t((()=>{})),cn=t((()=>{})),ln=t((()=>{})),un=t((()=>{})),dn=t((()=>{})),fn=t((()=>{})),pn=t((()=>{})),mn,hn=t((()=>{(function(e){e.HTTP_0_9=`http/0.9`,e.HTTP_1_0=`http/1.0`,e.TDS_8_0=`tds/8.0`})(mn||(mn={}))})),gn=t((()=>{})),_n=t((()=>{})),vn=t((()=>{})),yn=t((()=>{})),bn=t((()=>{})),xn=t((()=>{})),Sn=t((()=>{dt(),bt(),xt(),St(),Ct(),wt(),Ot(),kt(),At(),Mt(),Rt(),zt(),Wt(),Kt(),qt(),Qt(),$t(),en(),tn(),rn(),an(),on(),sn(),cn(),ln(),un(),dn(),fn(),pn(),hn(),gn(),_n(),vn(),yn(),bn(),xn()})),Cn=t((()=>{Sn()})),wn=t((()=>{})),Tn=t((()=>{}));function En(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return{...t,[n]:Array.isArray(r)?[...r]:r}},{})}var Dn,On=t((()=>{Dn=class e{constructor(e){this.method=e.method||`GET`,this.hostname=e.hostname||`localhost`,this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)===`:`?e.protocol:`${e.protocol}:`:`https:`,this.path=e.path?e.path.charAt(0)===`/`?e.path:`/${e.path}`:`/`,this.username=e.username,this.password=e.password,this.fragment=e.fragment}static isInstance(e){if(!e)return!1;let t=e;return`method`in t&&`protocol`in t&&`hostname`in t&&`path`in t&&typeof t.query==`object`&&typeof t.headers==`object`}clone(){let t=new e({...this,headers:{...this.headers}});return t.query&&(t.query=En(t.query)),t}}})),kn=t((()=>{})),An=t((()=>{})),jn=t((()=>{})),w=t((()=>{ut(),Cn(),wn(),Tn(),On(),kn(),An(),jn()}));function Mn(e){if(e.length%2!=0)throw Error(`Hex encoded strings must have an even number length`);let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){let r=e.slice(n,n+2).toLowerCase();if(r in E)t[n/2]=E[r];else throw Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`)}return t}function T(e){let t=``;for(let n=0;n<e.byteLength;n++)t+=Nn[e[n]];return t}var Nn,E,D=t((()=>{Nn={},E={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),Nn[e]=t,E[t]=e}})),Pn=t((()=>{})),Fn,In=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(Fn||(Fn={}))})),Ln,Rn=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(Ln||(Ln={}))})),zn=t((()=>{})),Bn=t((()=>{})),Vn=t((()=>{})),Hn=t((()=>{})),Un=t((()=>{In(),Rn(),zn(),Bn(),Vn(),Hn()})),Wn=t((()=>{})),Gn=t((()=>{})),Kn=t((()=>{})),qn=t((()=>{})),Jn=t((()=>{})),Yn=t((()=>{})),Xn=t((()=>{})),Zn=t((()=>{Jn(),Yn(),Xn()})),Qn=t((()=>{})),$n=t((()=>{})),er,tr=t((()=>{(function(e){e.HTTP=`http`,e.HTTPS=`https`})(er||(er={}))})),nr=t((()=>{})),rr=t((()=>{})),ir=t((()=>{})),ar=t((()=>{})),or=t((()=>{})),sr=t((()=>{nr(),rr(),ir(),ar(),or()})),cr=t((()=>{})),lr,ur=t((()=>{(function(e){e.MD5=`md5`,e.CRC32=`crc32`,e.CRC32C=`crc32c`,e.SHA1=`sha1`,e.SHA256=`sha256`})(lr||(lr={}))})),dr=t((()=>{ur()})),fr=t((()=>{})),pr=t((()=>{dr(),fr(),ur()})),mr=t((()=>{})),hr,gr=t((()=>{(function(e){e[e.HEADER=0]=`HEADER`,e[e.TRAILER=1]=`TRAILER`})(hr||(hr={}))})),_r=t((()=>{})),vr=t((()=>{})),yr=t((()=>{})),br=t((()=>{})),xr=t((()=>{})),Sr=t((()=>{vr(),yr(),br(),xr()})),Cr=t((()=>{})),wr=t((()=>{})),Tr=t((()=>{})),Er,Dr=t((()=>{(function(e){e.PROFILE=`profile`,e.SSO_SESSION=`sso-session`,e.SERVICES=`services`})(Er||(Er={}))})),Or=t((()=>{})),kr=t((()=>{})),Ar=t((()=>{})),jr=t((()=>{})),Mr=t((()=>{})),Nr=t((()=>{})),Pr=t((()=>{})),Fr=t((()=>{})),Ir=t((()=>{})),Lr,Rr=t((()=>{(function(e){e.HTTP_0_9=`http/0.9`,e.HTTP_1_0=`http/1.0`,e.TDS_8_0=`tds/8.0`})(Lr||(Lr={}))})),zr=t((()=>{})),Br=t((()=>{})),Vr=t((()=>{})),Hr=t((()=>{})),Ur=t((()=>{})),Wr=t((()=>{})),Gr=t((()=>{Pn(),Un(),Wn(),Gn(),Kn(),qn(),Zn(),Qn(),$n(),tr(),sr(),cr(),pr(),mr(),gr(),_r(),Sr(),Cr(),wr(),Tr(),Dr(),Or(),kr(),Ar(),jr(),Mr(),Nr(),Pr(),Fr(),Ir(),Rr(),zr(),Br(),Vr(),Hr(),Ur(),Wr()})),Kr=t((()=>{Gr()})),qr,Jr=t((()=>{qr=e=>{if(typeof e==`function`)return e;let t=Promise.resolve(e);return()=>t}})),Yr=t((()=>{Kr(),Jr()})),O,Xr,Zr=t((()=>{O=e=>encodeURIComponent(e).replace(/[!'()*]/g,Xr),Xr=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`})),Qr=t((()=>{})),$r=t((()=>{Zr(),Qr()})),ei,ti=t((()=>{ei=e=>typeof ArrayBuffer==`function`&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`})),ni,ri=t((()=>{ni=(e,t)=>{if(typeof e!=`string`)throw TypeError(`The "input" argument must be of type string. Received type ${typeof e} (${e})`);return t?_.from(e,t):_.from(e)}})),k,ii=t((()=>{ri(),k=e=>{let t=ni(e,`utf8`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}})),A,ai=t((()=>{ii(),A=e=>typeof e==`string`?k(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)})),oi=t((()=>{})),j=t((()=>{ii(),ai(),oi()})),si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,M,Ci,wi,Ti,N=t((()=>{si=`X-Amz-Algorithm`,ci=`X-Amz-Credential`,li=`X-Amz-Date`,ui=`X-Amz-SignedHeaders`,di=`X-Amz-Expires`,fi=`X-Amz-Signature`,pi=`X-Amz-Security-Token`,mi=`authorization`,hi=li.toLowerCase(),gi=`date`,_i=[mi,hi,gi],fi.toLowerCase(),vi=`x-amz-content-sha256`,yi=pi.toLowerCase(),bi={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},xi=/^proxy-/,Si=/^sec-/,M=`AWS4-HMAC-SHA256`,Ci=`AWS4-HMAC-SHA256-PAYLOAD`,wi=`UNSIGNED-PAYLOAD`,Ti=`aws4_request`})),P,F,I,Ei,Di,Oi=t((()=>{D(),j(),N(),P={},F=[],I=(e,t,n)=>`${e}/${t}/${n}/${Ti}`,Ei=async(e,t,n,r,i)=>{let a=`${n}:${r}:${i}:${T(await Di(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(a in P)return P[a];for(F.push(a);F.length>50;)delete P[F.shift()];let o=`AWS4${t.secretAccessKey}`;for(let t of[n,r,i,Ti])o=await Di(e,o,t);return P[a]=o},Di=(e,t,n)=>{let r=new e(t);return r.update(A(n)),r.digest()}})),ki,Ai=t((()=>{N(),ki=({headers:e},t,n)=>{let r={};for(let i of Object.keys(e).sort()){if(e[i]==null)continue;let a=i.toLowerCase();(a in bi||t?.has(a)||xi.test(a)||Si.test(a))&&(!n||n&&!n.has(a))||(r[a]=e[i].trim().replace(/\s+/g,` `))}return r}})),ji,Mi=t((()=>{$r(),N(),ji=({query:e={}})=>{let t=[],n={};for(let r of Object.keys(e).sort()){if(r.toLowerCase()===`x-amz-signature`)continue;t.push(r);let i=e[r];typeof i==`string`?n[r]=`${O(r)}=${O(i)}`:Array.isArray(i)&&(n[r]=i.slice(0).reduce((e,t)=>e.concat([`${O(r)}=${O(t)}`]),[]).sort().join(`&`))}return t.map(e=>n[e]).filter(e=>e).join(`&`)}})),L,Ni=t((()=>{ti(),D(),j(),N(),L=async({headers:e,body:t},n)=>{for(let t of Object.keys(e))if(t.toLowerCase()===`x-amz-content-sha256`)return e[t];if(t==null)return`e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`;if(typeof t==`string`||ArrayBuffer.isView(t)||ei(t)){let e=new n;return e.update(A(t)),T(await e.digest())}return wi}}));function Pi(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var Fi,Ii,Li,Ri,zi=t((()=>{D(),j(),Fi=class{format(e){let t=[];for(let n of Object.keys(e)){let r=k(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}let n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case`boolean`:return Uint8Array.from([+!e.value]);case`byte`:return Uint8Array.from([2,e.value]);case`short`:let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case`integer`:let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case`long`:let r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case`binary`:let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case`string`:let o=k(e.value),s=new DataView(new ArrayBuffer(3+o.byteLength));s.setUint8(0,7),s.setUint16(1,o.byteLength,!1);let c=new Uint8Array(s.buffer);return c.set(o,3),c;case`timestamp`:let l=new Uint8Array(9);return l[0]=8,l.set(Ri.fromNumber(e.value.valueOf()).bytes,1),l;case`uuid`:if(!Li.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(Mn(e.value.replace(/\-/g,``)),1),u}}},(function(e){e[e.boolTrue=0]=`boolTrue`,e[e.boolFalse=1]=`boolFalse`,e[e.byte=2]=`byte`,e[e.short=3]=`short`,e[e.integer=4]=`integer`,e[e.long=5]=`long`,e[e.byteArray=6]=`byteArray`,e[e.string=7]=`string`,e[e.timestamp=8]=`timestamp`,e[e.uuid=9]=`uuid`})(Ii||(Ii={})),Li=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,Ri=class e{constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error(`Int64 buffers must be exactly 8 bytes`)}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let n=new Uint8Array(8);for(let e=7,r=Math.abs(Math.round(t));e>-1&&r>0;e--,r/=256)n[e]=r;return t<0&&Pi(n),new e(n)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&Pi(e),parseInt(T(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}})),Bi,Vi=t((()=>{Bi=(e,t)=>{e=e.toLowerCase();for(let n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1}})),Hi,Ui,Wi=t((()=>{Hi=({headers:e,query:t,...n})=>({...n,headers:{...e},query:t?Ui(t):void 0}),Ui=e=>Object.keys(e).reduce((t,n)=>{let r=e[n];return{...t,[n]:Array.isArray(r)?[...r]:r}},{})})),Gi,Ki=t((()=>{Wi(),Gi=(e,t={})=>{let{headers:n,query:r={}}=typeof e.clone==`function`?e.clone():Hi(e);for(let e of Object.keys(n)){let i=e.toLowerCase();i.slice(0,6)===`x-amz-`&&!t.unhoistableHeaders?.has(i)&&(r[e]=n[e],delete n[e])}return{...e,headers:n,query:r}}})),qi,Ji=t((()=>{Wi(),N(),qi=e=>{e=typeof e.clone==`function`?e.clone():Hi(e);for(let t of Object.keys(e.headers))_i.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e}})),Yi,Xi,Zi=t((()=>{Yi=e=>Xi(e).toISOString().replace(/\.\d{3}Z$/,`Z`),Xi=e=>typeof e==`number`?new Date(e*1e3):typeof e==`string`?Number(e)?new Date(Number(e)*1e3):new Date(e):e})),Qi,R,$i,ea=t((()=>{D(),Yr(),$r(),j(),N(),Oi(),Ai(),Mi(),Ni(),zi(),Vi(),Ki(),Ji(),Zi(),Qi=class{constructor({applyChecksum:e,credentials:t,region:n,service:r,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new Fi,this.service=r,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e!=`boolean`||e,this.regionProvider=qr(n),this.credentialProvider=qr(t)}async presign(e,t={}){let{signingDate:n=new Date,expiresIn:r=3600,unsignableHeaders:i,unhoistableHeaders:a,signableHeaders:o,signingRegion:s,signingService:c}=t,l=await this.credentialProvider();this.validateResolvedCredentials(l);let u=s??await this.regionProvider(),{longDate:d,shortDate:f}=R(n);if(r>604800)return Promise.reject(`Signature version 4 presigned URLs must have an expiration date less than one week in the future`);let p=I(f,u,c??this.service),m=Gi(qi(e),{unhoistableHeaders:a});l.sessionToken&&(m.query[pi]=l.sessionToken),m.query[si]=M,m.query[ci]=`${l.accessKeyId}/${p}`,m.query[li]=d,m.query[di]=r.toString(10);let h=ki(m,i,o);return m.query[ui]=$i(h),m.query[fi]=await this.getSignature(d,p,this.getSigningKey(l,u,f,c),this.createCanonicalRequest(m,h,await L(e,this.sha256))),m}async sign(e,t){return typeof e==`string`?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:r,signingRegion:i,signingService:a}){let o=i??await this.regionProvider(),{shortDate:s,longDate:c}=R(n),l=I(s,o,a??this.service),u=await L({headers:{},body:t},this.sha256),d=new this.sha256;d.update(e);let f=[Ci,c,l,r,T(await d.digest()),u].join(`
1
+ import{a as e,n as t,r as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{_ as i,a,d as o,f as s,h as c,i as l,l as u,m as d,n as f,p,r as m,s as h,v as g,y as ee}from"./client-DchQnIJD.js";import{n as te,t as ne}from"./defineProperty-C-QyHrDq.js";import{G as re,n as ie,t as ae}from"./protocols-CnYQjBlj.js";import{c as oe,r as se}from"./serde-f76bObzR.js";import{Ht as ce,Lt as le,Pt as ue,Ut as de,t as fe}from"./dist-es-_UNJQniz.js";import{Readable as pe}from"stream";import{Buffer as _}from"buffer";import me from"assert";import"https";function he(e,t){return new Request(e,t)}var ge=t((()=>{}));function _e(e=0){return new Promise((t,n)=>{e&&setTimeout(()=>{let t=Error(`Request did not complete within ${e} ms`);t.name=`TimeoutError`,n(t)},e)})}var ve=t((()=>{}));function ye(e){let t=e&&typeof e==`object`&&`reason`in e?e.reason:void 0;if(t){if(t instanceof Error){let e=Error(`Request aborted`);return e.name=`AbortError`,e.cause=t,e}let e=Error(String(t));return e.name=`AbortError`,e}let n=Error(`Request aborted`);return n.name=`AbortError`,n}var v,be,xe=t((()=>{ae(),ge(),ve(),te(),v={supported:void 0},be=class e{static create(t){return typeof t?.handle==`function`?t:new e(t)}constructor(e){ne(this,`config`,void 0),ne(this,`configProvider`,void 0),typeof e==`function`?this.configProvider=e().then(e=>e||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),v.supported===void 0&&(v.supported=typeof Request<`u`&&`keepalive`in he(`https://[::1]`))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);let r=n??this.config.requestTimeout,i=this.config.keepAlive===!0,a=this.config.credentials;if(t?.aborted){let e=ye(t);return Promise.reject(e)}let o=e.path,s=ie(e.query||{});s&&(o+=`?${s}`),e.fragment&&(o+=`#${e.fragment}`);let c=``;(e.username!=null||e.password!=null)&&(c=`${e.username??``}:${e.password??``}@`);let{port:l,method:u}=e,d=`${e.protocol}//${c}${e.hostname}${l?`:${l}`:``}${o}`,f=u===`GET`||u===`HEAD`?void 0:e.body,p={body:f,headers:new Headers(e.headers),method:u,credentials:a};this.config?.cache&&(p.cache=this.config.cache),f&&(p.duplex=`half`),typeof AbortController<`u`&&(p.signal=t),v.supported&&(p.keepalive=i),typeof this.config.requestInit==`function`&&Object.assign(p,this.config.requestInit(e));let m=()=>{},h=he(d,p),g=[fetch(h).then(e=>{let t=e.headers,n={};for(let e of t.entries())n[e[0]]=e[1];return e.body==null?e.blob().then(t=>({response:new re({headers:n,reason:e.statusText,statusCode:e.status,body:t})})):{response:new re({headers:n,reason:e.statusText,statusCode:e.status,body:e.body})}}),_e(r)];return t&&g.push(new Promise((e,n)=>{let r=()=>{n(ye(t))};if(typeof t.addEventListener==`function`){let e=t;e.addEventListener(`abort`,r,{once:!0}),m=()=>e.removeEventListener(`abort`,r)}else t.onabort=r})),Promise.race(g).finally(m)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=t,n))}httpHandlerConfigs(){return this.config??{}}}})),Se=t((()=>{xe(),se()})),y=n({__assign:()=>S,__asyncDelegator:()=>Le,__asyncGenerator:()=>Ie,__asyncValues:()=>Re,__await:()=>b,__awaiter:()=>Oe,__classPrivateFieldGet:()=>He,__classPrivateFieldSet:()=>Ue,__createBinding:()=>Ae,__decorate:()=>Te,__exportStar:()=>je,__extends:()=>Ce,__generator:()=>ke,__importDefault:()=>Ve,__importStar:()=>Be,__makeTemplateObject:()=>ze,__metadata:()=>De,__param:()=>Ee,__read:()=>Ne,__rest:()=>we,__spread:()=>Pe,__spreadArrays:()=>Fe,__values:()=>Me});function Ce(e,t){x(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function we(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Te(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function Ee(e,t){return function(n,r){t(n,r,e)}}function De(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function Oe(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function ke(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function Ae(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}function je(e,t){for(var n in e)n!=="default"&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function Me(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function Ne(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Pe(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Ne(arguments[t]));return e}function Fe(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function b(e){return this instanceof b?(this.v=e,this):new b(e)}function Ie(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},o(`next`),o(`throw`),o(`return`),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||s(e,t)})})}function s(e,t){try{c(r[e](t))}catch(e){d(a[0][3],e)}}function c(e){e.value instanceof b?Promise.resolve(e.value.v).then(l,u):d(a[0][2],e)}function l(e){s(`next`,e)}function u(e){s(`throw`,e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}function Le(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:b(e[r](t)),done:r===`return`}:i?i(t):t}:i}}function Re(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Me==`function`?Me(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function ze(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Be(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Ve(e){return e&&e.__esModule?e:{default:e}}function He(e,t){if(!t.has(e))throw TypeError(`attempted to get private field on non-instance`);return t.get(e)}function Ue(e,t,n){if(!t.has(e))throw TypeError(`attempted to set private field on non-instance`);return t.set(e,n),n}var x,S,C=t((()=>{x=function(e,t){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},x(e,t)},S=function(){return S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},S.apply(this,arguments)}})),We=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_HASHABLE_LENGTH=e.INIT=e.KEY=e.DIGEST_LENGTH=e.BLOCK_SIZE=void 0,e.BLOCK_SIZE=64,e.DIGEST_LENGTH=32,e.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),e.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e.MAX_HASHABLE_LENGTH=2**53-1})),Ge=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RawSha256=void 0;var t=We();e.RawSha256=function(){function e(){this.state=Int32Array.from(t.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw Error(`Attempted to update an already finished hash.`);var n=0,r=e.byteLength;if(this.bytesHashed+=r,this.bytesHashed*8>t.MAX_HASHABLE_LENGTH)throw Error(`Cannot hash more than 2^53 - 1 bits`);for(;r>0;)this.buffer[this.bufferLength++]=e[n++],r--,this.bufferLength===t.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,n=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(n.setUint8(this.bufferLength++,128),r%t.BLOCK_SIZE>=t.BLOCK_SIZE-8){for(var i=this.bufferLength;i<t.BLOCK_SIZE;i++)n.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(var i=this.bufferLength;i<t.BLOCK_SIZE-8;i++)n.setUint8(i,0);n.setUint32(t.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),n.setUint32(t.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var a=new Uint8Array(t.DIGEST_LENGTH),i=0;i<8;i++)a[i*4]=this.state[i]>>>24&255,a[i*4+1]=this.state[i]>>>16&255,a[i*4+2]=this.state[i]>>>8&255,a[i*4+3]=this.state[i]>>>0&255;return a},e.prototype.hashBuffer=function(){for(var e=this,n=e.buffer,r=e.state,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=0;f<t.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(n[f*4]&255)<<24|(n[f*4+1]&255)<<16|(n[f*4+2]&255)<<8|n[f*4+3]&255;else{var p=this.temp[f-2],m=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var h=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(m+this.temp[f-7]|0)+(h+this.temp[f-16]|0)}var g=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&l^~c&u)|0)+(d+(t.KEY[f]+this.temp[f]|0)|0)|0,ee=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&a^i&o^a&o)|0;d=u,u=l,l=c,c=s+g|0,s=o,o=a,a=i,i=g+ee|0}r[0]+=i,r[1]+=a,r[2]+=o,r[3]+=s,r[4]+=c,r[5]+=l,r[6]+=u,r[7]+=d},e}()})),Ke,qe,Je=t((()=>{Ke=e=>{let t=[];for(let n=0,r=e.length;n<r;n++){let r=e.charCodeAt(n);if(r<128)t.push(r);else if(r<2048)t.push(r>>6|192,r&63|128);else if(n+1<e.length&&(r&64512)==55296&&(e.charCodeAt(n+1)&64512)==56320){let i=65536+((r&1023)<<10)+(e.charCodeAt(++n)&1023);t.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else t.push(r>>12|224,r>>6&63|128,r&63|128)}return Uint8Array.from(t)},qe=e=>{let t=``;for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r<128)t+=String.fromCharCode(r);else if(192<=r&&r<224){let i=e[++n];t+=String.fromCharCode((r&31)<<6|i&63)}else if(240<=r&&r<365){let i=`%`+[r,e[++n],e[++n],e[++n]].map(e=>e.toString(16)).join(`%`);t+=decodeURIComponent(i)}else t+=String.fromCharCode((r&15)<<12|(e[++n]&63)<<6|e[++n]&63)}return t}}));function Ye(e){return new TextEncoder().encode(e)}function Xe(e){return new TextDecoder(`utf-8`).decode(e)}var Ze=t((()=>{})),Qe=n({fromUtf8:()=>$e,toUtf8:()=>et}),$e,et,tt=t((()=>{Je(),Ze(),$e=e=>typeof TextEncoder==`function`?Ye(e):Ke(e),et=e=>typeof TextDecoder==`function`?Xe(e):qe(e)})),nt=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var n=(tt(),e(Qe)),r=typeof Buffer<`u`&&Buffer.from?function(e){return Buffer.from(e,`utf8`)}:n.fromUtf8;function i(e){return e instanceof Uint8Array?e:typeof e==`string`?r(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.convertToBuffer=i})),rt=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isEmptyData=void 0;function t(e){return typeof e==`string`?e.length===0:e.byteLength===0}e.isEmptyData=t})),it=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.numToUint8=void 0;function t(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}e.numToUint8=t})),at=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=void 0;function t(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}e.uint32ArrayFrom=t})),ot=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=e.numToUint8=e.isEmptyData=e.convertToBuffer=void 0;var t=nt();Object.defineProperty(e,"convertToBuffer",{enumerable:!0,get:function(){return t.convertToBuffer}});var n=rt();Object.defineProperty(e,"isEmptyData",{enumerable:!0,get:function(){return n.isEmptyData}});var r=it();Object.defineProperty(e,"numToUint8",{enumerable:!0,get:function(){return r.numToUint8}});var i=at();Object.defineProperty(e,"uint32ArrayFrom",{enumerable:!0,get:function(){return i.uint32ArrayFrom}})})),st=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var n=(C(),e(y)),r=We(),i=Ge(),a=ot();t.Sha256=function(){function e(e){this.secret=e,this.hash=new i.RawSha256,this.reset()}return e.prototype.update=function(e){if(!((0,a.isEmptyData)(e)||this.error))try{this.hash.update((0,a.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new i.RawSha256,this.secret){this.outer=new i.RawSha256;var e=o(this.secret),t=new Uint8Array(r.BLOCK_SIZE);t.set(e);for(var n=0;n<r.BLOCK_SIZE;n++)e[n]^=54,t[n]^=92;this.hash.update(e),this.outer.update(t);for(var n=0;n<e.byteLength;n++)e[n]=0}},e}();function o(e){var t=(0,a.convertToBuffer)(e);if(t.byteLength>r.BLOCK_SIZE){var n=new i.RawSha256;n.update(t),t=n.digest()}var o=new Uint8Array(r.BLOCK_SIZE);return o.set(t),o}})),ct=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),(C(),e(y)).__exportStar(st(),t)})),lt=t((()=>{})),ut=t((()=>{lt()})),dt=t((()=>{})),ft,pt=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(ft||(ft={}))})),mt,ht=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(mt||(mt={}))})),gt=t((()=>{})),_t=t((()=>{})),vt=t((()=>{})),yt=t((()=>{})),bt=t((()=>{pt(),ht(),gt(),_t(),vt(),yt()})),xt=t((()=>{})),St=t((()=>{})),Ct=t((()=>{})),wt=t((()=>{})),Tt=t((()=>{})),Et=t((()=>{})),Dt=t((()=>{})),Ot=t((()=>{Tt(),Et(),Dt()})),kt=t((()=>{})),At=t((()=>{})),jt,Mt=t((()=>{(function(e){e.HTTP=`http`,e.HTTPS=`https`})(jt||(jt={}))})),Nt=t((()=>{})),Pt=t((()=>{})),Ft=t((()=>{})),It=t((()=>{})),Lt=t((()=>{})),Rt=t((()=>{Nt(),Pt(),Ft(),It(),Lt()})),zt=t((()=>{})),Bt,Vt=t((()=>{(function(e){e.MD5=`md5`,e.CRC32=`crc32`,e.CRC32C=`crc32c`,e.SHA1=`sha1`,e.SHA256=`sha256`})(Bt||(Bt={}))})),Ht=t((()=>{Vt()})),Ut=t((()=>{})),Wt=t((()=>{Ht(),Ut(),Vt()})),Gt,Kt=t((()=>{(function(e){e[e.HEADER=0]=`HEADER`,e[e.TRAILER=1]=`TRAILER`})(Gt||(Gt={}))})),qt=t((()=>{})),Jt=t((()=>{})),Yt=t((()=>{})),Xt=t((()=>{})),Zt=t((()=>{})),Qt=t((()=>{Jt(),Yt(),Xt(),Zt()})),$t=t((()=>{})),en=t((()=>{})),tn=t((()=>{})),nn,rn=t((()=>{(function(e){e.PROFILE=`profile`,e.SSO_SESSION=`sso-session`,e.SERVICES=`services`})(nn||(nn={}))})),an=t((()=>{})),on=t((()=>{})),sn=t((()=>{})),cn=t((()=>{})),ln=t((()=>{})),un=t((()=>{})),dn=t((()=>{})),fn=t((()=>{})),pn=t((()=>{})),mn,hn=t((()=>{(function(e){e.HTTP_0_9=`http/0.9`,e.HTTP_1_0=`http/1.0`,e.TDS_8_0=`tds/8.0`})(mn||(mn={}))})),gn=t((()=>{})),_n=t((()=>{})),vn=t((()=>{})),yn=t((()=>{})),bn=t((()=>{})),xn=t((()=>{})),Sn=t((()=>{dt(),bt(),xt(),St(),Ct(),wt(),Ot(),kt(),At(),Mt(),Rt(),zt(),Wt(),Kt(),qt(),Qt(),$t(),en(),tn(),rn(),an(),on(),sn(),cn(),ln(),un(),dn(),fn(),pn(),hn(),gn(),_n(),vn(),yn(),bn(),xn()})),Cn=t((()=>{Sn()})),wn=t((()=>{})),Tn=t((()=>{}));function En(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return{...t,[n]:Array.isArray(r)?[...r]:r}},{})}var Dn,On=t((()=>{Dn=class e{constructor(e){this.method=e.method||`GET`,this.hostname=e.hostname||`localhost`,this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)===`:`?e.protocol:`${e.protocol}:`:`https:`,this.path=e.path?e.path.charAt(0)===`/`?e.path:`/${e.path}`:`/`,this.username=e.username,this.password=e.password,this.fragment=e.fragment}static isInstance(e){if(!e)return!1;let t=e;return`method`in t&&`protocol`in t&&`hostname`in t&&`path`in t&&typeof t.query==`object`&&typeof t.headers==`object`}clone(){let t=new e({...this,headers:{...this.headers}});return t.query&&(t.query=En(t.query)),t}}})),kn=t((()=>{})),An=t((()=>{})),jn=t((()=>{})),w=t((()=>{ut(),Cn(),wn(),Tn(),On(),kn(),An(),jn()}));function Mn(e){if(e.length%2!=0)throw Error(`Hex encoded strings must have an even number length`);let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){let r=e.slice(n,n+2).toLowerCase();if(r in E)t[n/2]=E[r];else throw Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`)}return t}function T(e){let t=``;for(let n=0;n<e.byteLength;n++)t+=Nn[e[n]];return t}var Nn,E,D=t((()=>{Nn={},E={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),Nn[e]=t,E[t]=e}})),Pn=t((()=>{})),Fn,In=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(Fn||(Fn={}))})),Ln,Rn=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(Ln||(Ln={}))})),zn=t((()=>{})),Bn=t((()=>{})),Vn=t((()=>{})),Hn=t((()=>{})),Un=t((()=>{In(),Rn(),zn(),Bn(),Vn(),Hn()})),Wn=t((()=>{})),Gn=t((()=>{})),Kn=t((()=>{})),qn=t((()=>{})),Jn=t((()=>{})),Yn=t((()=>{})),Xn=t((()=>{})),Zn=t((()=>{Jn(),Yn(),Xn()})),Qn=t((()=>{})),$n=t((()=>{})),er,tr=t((()=>{(function(e){e.HTTP=`http`,e.HTTPS=`https`})(er||(er={}))})),nr=t((()=>{})),rr=t((()=>{})),ir=t((()=>{})),ar=t((()=>{})),or=t((()=>{})),sr=t((()=>{nr(),rr(),ir(),ar(),or()})),cr=t((()=>{})),lr,ur=t((()=>{(function(e){e.MD5=`md5`,e.CRC32=`crc32`,e.CRC32C=`crc32c`,e.SHA1=`sha1`,e.SHA256=`sha256`})(lr||(lr={}))})),dr=t((()=>{ur()})),fr=t((()=>{})),pr=t((()=>{dr(),fr(),ur()})),mr=t((()=>{})),hr,gr=t((()=>{(function(e){e[e.HEADER=0]=`HEADER`,e[e.TRAILER=1]=`TRAILER`})(hr||(hr={}))})),_r=t((()=>{})),vr=t((()=>{})),yr=t((()=>{})),br=t((()=>{})),xr=t((()=>{})),Sr=t((()=>{vr(),yr(),br(),xr()})),Cr=t((()=>{})),wr=t((()=>{})),Tr=t((()=>{})),Er,Dr=t((()=>{(function(e){e.PROFILE=`profile`,e.SSO_SESSION=`sso-session`,e.SERVICES=`services`})(Er||(Er={}))})),Or=t((()=>{})),kr=t((()=>{})),Ar=t((()=>{})),jr=t((()=>{})),Mr=t((()=>{})),Nr=t((()=>{})),Pr=t((()=>{})),Fr=t((()=>{})),Ir=t((()=>{})),Lr,Rr=t((()=>{(function(e){e.HTTP_0_9=`http/0.9`,e.HTTP_1_0=`http/1.0`,e.TDS_8_0=`tds/8.0`})(Lr||(Lr={}))})),zr=t((()=>{})),Br=t((()=>{})),Vr=t((()=>{})),Hr=t((()=>{})),Ur=t((()=>{})),Wr=t((()=>{})),Gr=t((()=>{Pn(),Un(),Wn(),Gn(),Kn(),qn(),Zn(),Qn(),$n(),tr(),sr(),cr(),pr(),mr(),gr(),_r(),Sr(),Cr(),wr(),Tr(),Dr(),Or(),kr(),Ar(),jr(),Mr(),Nr(),Pr(),Fr(),Ir(),Rr(),zr(),Br(),Vr(),Hr(),Ur(),Wr()})),Kr=t((()=>{Gr()})),qr,Jr=t((()=>{qr=e=>{if(typeof e==`function`)return e;let t=Promise.resolve(e);return()=>t}})),Yr=t((()=>{Kr(),Jr()})),O,Xr,Zr=t((()=>{O=e=>encodeURIComponent(e).replace(/[!'()*]/g,Xr),Xr=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`})),Qr=t((()=>{})),$r=t((()=>{Zr(),Qr()})),ei,ti=t((()=>{ei=e=>typeof ArrayBuffer==`function`&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`})),ni,ri=t((()=>{ni=(e,t)=>{if(typeof e!=`string`)throw TypeError(`The "input" argument must be of type string. Received type ${typeof e} (${e})`);return t?_.from(e,t):_.from(e)}})),k,ii=t((()=>{ri(),k=e=>{let t=ni(e,`utf8`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}})),A,ai=t((()=>{ii(),A=e=>typeof e==`string`?k(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)})),oi=t((()=>{})),j=t((()=>{ii(),ai(),oi()})),si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,M,Ci,wi,Ti,N=t((()=>{si=`X-Amz-Algorithm`,ci=`X-Amz-Credential`,li=`X-Amz-Date`,ui=`X-Amz-SignedHeaders`,di=`X-Amz-Expires`,fi=`X-Amz-Signature`,pi=`X-Amz-Security-Token`,mi=`authorization`,hi=li.toLowerCase(),gi=`date`,_i=[mi,hi,gi],fi.toLowerCase(),vi=`x-amz-content-sha256`,yi=pi.toLowerCase(),bi={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},xi=/^proxy-/,Si=/^sec-/,M=`AWS4-HMAC-SHA256`,Ci=`AWS4-HMAC-SHA256-PAYLOAD`,wi=`UNSIGNED-PAYLOAD`,Ti=`aws4_request`})),P,F,I,Ei,Di,Oi=t((()=>{D(),j(),N(),P={},F=[],I=(e,t,n)=>`${e}/${t}/${n}/${Ti}`,Ei=async(e,t,n,r,i)=>{let a=`${n}:${r}:${i}:${T(await Di(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(a in P)return P[a];for(F.push(a);F.length>50;)delete P[F.shift()];let o=`AWS4${t.secretAccessKey}`;for(let t of[n,r,i,Ti])o=await Di(e,o,t);return P[a]=o},Di=(e,t,n)=>{let r=new e(t);return r.update(A(n)),r.digest()}})),ki,Ai=t((()=>{N(),ki=({headers:e},t,n)=>{let r={};for(let i of Object.keys(e).sort()){if(e[i]==null)continue;let a=i.toLowerCase();(a in bi||t?.has(a)||xi.test(a)||Si.test(a))&&(!n||n&&!n.has(a))||(r[a]=e[i].trim().replace(/\s+/g,` `))}return r}})),ji,Mi=t((()=>{$r(),N(),ji=({query:e={}})=>{let t=[],n={};for(let r of Object.keys(e).sort()){if(r.toLowerCase()===`x-amz-signature`)continue;t.push(r);let i=e[r];typeof i==`string`?n[r]=`${O(r)}=${O(i)}`:Array.isArray(i)&&(n[r]=i.slice(0).reduce((e,t)=>e.concat([`${O(r)}=${O(t)}`]),[]).sort().join(`&`))}return t.map(e=>n[e]).filter(e=>e).join(`&`)}})),L,Ni=t((()=>{ti(),D(),j(),N(),L=async({headers:e,body:t},n)=>{for(let t of Object.keys(e))if(t.toLowerCase()===`x-amz-content-sha256`)return e[t];if(t==null)return`e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`;if(typeof t==`string`||ArrayBuffer.isView(t)||ei(t)){let e=new n;return e.update(A(t)),T(await e.digest())}return wi}}));function Pi(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var Fi,Ii,Li,Ri,zi=t((()=>{D(),j(),Fi=class{format(e){let t=[];for(let n of Object.keys(e)){let r=k(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}let n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case`boolean`:return Uint8Array.from([+!e.value]);case`byte`:return Uint8Array.from([2,e.value]);case`short`:let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case`integer`:let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case`long`:let r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case`binary`:let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case`string`:let o=k(e.value),s=new DataView(new ArrayBuffer(3+o.byteLength));s.setUint8(0,7),s.setUint16(1,o.byteLength,!1);let c=new Uint8Array(s.buffer);return c.set(o,3),c;case`timestamp`:let l=new Uint8Array(9);return l[0]=8,l.set(Ri.fromNumber(e.value.valueOf()).bytes,1),l;case`uuid`:if(!Li.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(Mn(e.value.replace(/\-/g,``)),1),u}}},(function(e){e[e.boolTrue=0]=`boolTrue`,e[e.boolFalse=1]=`boolFalse`,e[e.byte=2]=`byte`,e[e.short=3]=`short`,e[e.integer=4]=`integer`,e[e.long=5]=`long`,e[e.byteArray=6]=`byteArray`,e[e.string=7]=`string`,e[e.timestamp=8]=`timestamp`,e[e.uuid=9]=`uuid`})(Ii||(Ii={})),Li=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,Ri=class e{constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error(`Int64 buffers must be exactly 8 bytes`)}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let n=new Uint8Array(8);for(let e=7,r=Math.abs(Math.round(t));e>-1&&r>0;e--,r/=256)n[e]=r;return t<0&&Pi(n),new e(n)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&Pi(e),parseInt(T(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}})),Bi,Vi=t((()=>{Bi=(e,t)=>{e=e.toLowerCase();for(let n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1}})),Hi,Ui,Wi=t((()=>{Hi=({headers:e,query:t,...n})=>({...n,headers:{...e},query:t?Ui(t):void 0}),Ui=e=>Object.keys(e).reduce((t,n)=>{let r=e[n];return{...t,[n]:Array.isArray(r)?[...r]:r}},{})})),Gi,Ki=t((()=>{Wi(),Gi=(e,t={})=>{let{headers:n,query:r={}}=typeof e.clone==`function`?e.clone():Hi(e);for(let e of Object.keys(n)){let i=e.toLowerCase();i.slice(0,6)===`x-amz-`&&!t.unhoistableHeaders?.has(i)&&(r[e]=n[e],delete n[e])}return{...e,headers:n,query:r}}})),qi,Ji=t((()=>{Wi(),N(),qi=e=>{e=typeof e.clone==`function`?e.clone():Hi(e);for(let t of Object.keys(e.headers))_i.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e}})),Yi,Xi,Zi=t((()=>{Yi=e=>Xi(e).toISOString().replace(/\.\d{3}Z$/,`Z`),Xi=e=>typeof e==`number`?new Date(e*1e3):typeof e==`string`?Number(e)?new Date(Number(e)*1e3):new Date(e):e})),Qi,R,$i,ea=t((()=>{D(),Yr(),$r(),j(),N(),Oi(),Ai(),Mi(),Ni(),zi(),Vi(),Ki(),Ji(),Zi(),Qi=class{constructor({applyChecksum:e,credentials:t,region:n,service:r,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new Fi,this.service=r,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e!=`boolean`||e,this.regionProvider=qr(n),this.credentialProvider=qr(t)}async presign(e,t={}){let{signingDate:n=new Date,expiresIn:r=3600,unsignableHeaders:i,unhoistableHeaders:a,signableHeaders:o,signingRegion:s,signingService:c}=t,l=await this.credentialProvider();this.validateResolvedCredentials(l);let u=s??await this.regionProvider(),{longDate:d,shortDate:f}=R(n);if(r>604800)return Promise.reject(`Signature version 4 presigned URLs must have an expiration date less than one week in the future`);let p=I(f,u,c??this.service),m=Gi(qi(e),{unhoistableHeaders:a});l.sessionToken&&(m.query[pi]=l.sessionToken),m.query[si]=M,m.query[ci]=`${l.accessKeyId}/${p}`,m.query[li]=d,m.query[di]=r.toString(10);let h=ki(m,i,o);return m.query[ui]=$i(h),m.query[fi]=await this.getSignature(d,p,this.getSigningKey(l,u,f,c),this.createCanonicalRequest(m,h,await L(e,this.sha256))),m}async sign(e,t){return typeof e==`string`?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:r,signingRegion:i,signingService:a}){let o=i??await this.regionProvider(),{shortDate:s,longDate:c}=R(n),l=I(s,o,a??this.service),u=await L({headers:{},body:t},this.sha256),d=new this.sha256;d.update(e);let f=[Ci,c,l,r,T(await d.digest()),u].join(`
2
2
  `);return this.signString(f,{signingDate:n,signingRegion:o,signingService:a})}async signMessage(e,{signingDate:t=new Date,signingRegion:n,signingService:r}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:n,signingService:r,priorSignature:e.priorSignature}).then(t=>({message:e.message,signature:t}))}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:r}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:o}=R(t),s=new this.sha256(await this.getSigningKey(i,a,o,r));return s.update(A(e)),T(await s.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:r,signingRegion:i,signingService:a}={}){let o=await this.credentialProvider();this.validateResolvedCredentials(o);let s=i??await this.regionProvider(),c=qi(e),{longDate:l,shortDate:u}=R(t),d=I(u,s,a??this.service);c.headers[hi]=l,o.sessionToken&&(c.headers[yi]=o.sessionToken);let f=await L(c,this.sha256);!Bi(`x-amz-content-sha256`,c.headers)&&this.applyChecksum&&(c.headers[vi]=f);let p=ki(c,r,n),m=await this.getSignature(l,d,this.getSigningKey(o,s,u,a),this.createCanonicalRequest(c,p,f));return c.headers[mi]=`${M} Credential=${o.accessKeyId}/${d}, SignedHeaders=${$i(p)}, Signature=${m}`,c}createCanonicalRequest(e,t,n){let r=Object.keys(t).sort();return`${e.method}
3
3
  ${this.getCanonicalPath(e)}
4
4
  ${ji(e)}
@@ -9,7 +9,7 @@ ${r.join(`;`)}
9
9
  ${n}`}async createStringToSign(e,t,n){let r=new this.sha256;return r.update(A(n)),`${M}
10
10
  ${e}
11
11
  ${t}
12
- ${T(await r.digest())}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let t=[];for(let n of e.split(`/`))n?.length!==0&&n!==`.`&&(n===`..`?t.pop():t.push(n));return O(`${e?.startsWith(`/`)?`/`:``}${t.join(`/`)}${t.length>0&&e?.endsWith(`/`)?`/`:``}`).replace(/%2F/g,`/`)}return e}async getSignature(e,t,n,r){let i=await this.createStringToSign(e,t,r),a=new this.sha256(await n);return a.update(A(i)),T(await a.digest())}getSigningKey(e,t,n,r){return Ei(this.sha256,e,n,t,r||this.service)}validateResolvedCredentials(e){if(typeof e!=`object`||typeof e.accessKeyId!=`string`||typeof e.secretAccessKey!=`string`)throw Error(`Resolved credential object is not valid`)}},R=e=>{let t=Yi(e).replace(/[\-:]/g,``);return{longDate:t,shortDate:t.slice(0,8)}},$i=e=>Object.keys(e).sort().join(`;`)})),ta=t((()=>{ea(),Ai(),Mi(),Ni(),Ki(),Ji(),Oi()})),na,ra,ia,aa=t((()=>{na=ct(),Se(),w(),ta(),ra=()=>import(`./dist-es-CIULjvtA2.js`).then(({fromNodeProviderChain:e})=>e({clientConfig:{requestHandler:new be({requestInit:e=>({...e})})}})).catch(e=>{throw Error(`Failed to import '@aws-sdk/credential-providers'.You can provide a custom \`providerChainResolver\` in the client options if your runtime does not have access to '@aws-sdk/credential-providers': \`new AnthropicBedrock({ providerChainResolver })\` Original error: ${e.message}`)}),ia=async(e,t)=>{me(e.method,`Expected request method property to be set`);let n;n=t.awsAccessKey&&t.awsSecretKey?{accessKeyId:t.awsAccessKey,secretAccessKey:t.awsSecretKey,...t.awsSessionToken!=null&&{sessionToken:t.awsSessionToken}}:await(await(t.providerChainResolver?t.providerChainResolver():ra()))();let r=new Qi({service:`bedrock`,region:t.regionName,credentials:n,sha256:na.Sha256}),i=new URL(t.url),a=e.headers?Symbol.iterator in e.headers?Object.fromEntries(Array.from(e.headers).map(e=>[...e])):{...e.headers}:{};delete a.connection,a.host=i.hostname;let o=new Dn({method:e.method.toUpperCase(),protocol:i.protocol,path:i.pathname,headers:a,body:e.body});return(await r.sign(o)).headers}})),oa=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var n=(tt(),e(Qe)),r=typeof Buffer<`u`&&Buffer.from?function(e){return Buffer.from(e,`utf8`)}:n.fromUtf8;function i(e){return e instanceof Uint8Array?e:typeof e==`string`?r(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.convertToBuffer=i})),sa=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isEmptyData=void 0;function t(e){return typeof e==`string`?e.length===0:e.byteLength===0}e.isEmptyData=t})),ca=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.numToUint8=void 0;function t(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}e.numToUint8=t})),la=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=void 0;function t(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}e.uint32ArrayFrom=t})),ua=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=e.numToUint8=e.isEmptyData=e.convertToBuffer=void 0;var t=oa();Object.defineProperty(e,"convertToBuffer",{enumerable:!0,get:function(){return t.convertToBuffer}});var n=sa();Object.defineProperty(e,"isEmptyData",{enumerable:!0,get:function(){return n.isEmptyData}});var r=ca();Object.defineProperty(e,"numToUint8",{enumerable:!0,get:function(){return r.numToUint8}});var i=la();Object.defineProperty(e,"uint32ArrayFrom",{enumerable:!0,get:function(){return i.uint32ArrayFrom}})})),da=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AwsCrc32=void 0;var n=(C(),e(y)),r=ua(),i=fa();t.AwsCrc32=function(){function e(){this.crc32=new i.Crc32}return e.prototype.update=function(e){(0,r.isEmptyData)(e)||this.crc32.update((0,r.convertToBuffer)(e))},e.prototype.digest=function(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){return[2,(0,r.numToUint8)(this.crc32.digest())]})})},e.prototype.reset=function(){this.crc32=new i.Crc32},e}()})),fa=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AwsCrc32=t.Crc32=t.crc32=void 0;var n=(C(),e(y)),r=ua();function i(e){return new a().update(e).digest()}t.crc32=i;var a=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,r;try{for(var i=n.__values(e),a=i.next();!a.done;a=i.next()){var s=a.value;this.checksum=this.checksum>>>8^o[(this.checksum^s)&255]}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(this.checksum^4294967295)>>>0},e}();t.Crc32=a;var o=(0,r.uint32ArrayFrom)([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]),s=da();Object.defineProperty(t,"AwsCrc32",{enumerable:!0,get:function(){return s.AwsCrc32}})}));function pa(e){if(e.length%2!=0)throw Error(`Hex encoded strings must have an even number length`);let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){let r=e.slice(n,n+2).toLowerCase();if(r in B)t[n/2]=B[r];else throw Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`)}return t}function z(e){let t=``;for(let n=0;n<e.byteLength;n++)t+=ma[e[n]];return t}var ma,B,ha=t((()=>{ma={},B={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),ma[e]=t,B[t]=e}}));function ga(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var V,_a=t((()=>{ha(),V=class e{constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error(`Int64 buffers must be exactly 8 bytes`)}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let n=new Uint8Array(8);for(let e=7,r=Math.abs(Math.round(t));e>-1&&r>0;e--,r/=256)n[e]=r;return t<0&&ga(n),new e(n)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&ga(e),parseInt(z(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}})),va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa=t((()=>{ha(),_a(),va=class{constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){let t=[];for(let n of Object.keys(e)){let r=this.fromUtf8(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}let n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case`boolean`:return Uint8Array.from([+!e.value]);case`byte`:return Uint8Array.from([2,e.value]);case`short`:let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case`integer`:let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case`long`:let r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case`binary`:let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case`string`:let o=this.fromUtf8(e.value),s=new DataView(new ArrayBuffer(3+o.byteLength));s.setUint8(0,7),s.setUint16(1,o.byteLength,!1);let c=new Uint8Array(s.buffer);return c.set(o,3),c;case`timestamp`:let l=new Uint8Array(9);return l[0]=8,l.set(V.fromNumber(e.value.valueOf()).bytes,1),l;case`uuid`:if(!ka.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(pa(e.value.replace(/\-/g,``)),1),u}}parse(e){let t={},n=0;for(;n<e.byteLength;){let r=e.getUint8(n++),i=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,r));switch(n+=r,e.getUint8(n++)){case 0:t[i]={type:ba,value:!0};break;case 1:t[i]={type:ba,value:!1};break;case 2:t[i]={type:xa,value:e.getInt8(n++)};break;case 3:t[i]={type:Sa,value:e.getInt16(n,!1)},n+=2;break;case 4:t[i]={type:Ca,value:e.getInt32(n,!1)},n+=4;break;case 5:t[i]={type:wa,value:new V(new Uint8Array(e.buffer,e.byteOffset+n,8))},n+=8;break;case 6:let r=e.getUint16(n,!1);n+=2,t[i]={type:Ta,value:new Uint8Array(e.buffer,e.byteOffset+n,r)},n+=r;break;case 7:let a=e.getUint16(n,!1);n+=2,t[i]={type:Ea,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,a))},n+=a;break;case 8:t[i]={type:Da,value:new Date(new V(new Uint8Array(e.buffer,e.byteOffset+n,8)).valueOf())},n+=8;break;case 9:let o=new Uint8Array(e.buffer,e.byteOffset+n,16);n+=16,t[i]={type:Oa,value:`${z(o.subarray(0,4))}-${z(o.subarray(4,6))}-${z(o.subarray(6,8))}-${z(o.subarray(8,10))}-${z(o.subarray(10))}`};break;default:throw Error(`Unrecognized header type tag`)}}return t}},(function(e){e[e.boolTrue=0]=`boolTrue`,e[e.boolFalse=1]=`boolFalse`,e[e.byte=2]=`byte`,e[e.short=3]=`short`,e[e.integer=4]=`integer`,e[e.long=5]=`long`,e[e.byteArray=6]=`byteArray`,e[e.string=7]=`string`,e[e.timestamp=8]=`timestamp`,e[e.uuid=9]=`uuid`})(ya||(ya={})),ba=`boolean`,xa=`byte`,Sa=`short`,Ca=`integer`,wa=`long`,Ta=`binary`,Ea=`string`,Da=`timestamp`,Oa=`uuid`,ka=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/}));function ja({byteLength:e,byteOffset:t,buffer:n}){if(e<Pa)throw Error(`Provided message too short to accommodate event stream message overhead`);let r=new DataView(n,t,e),i=r.getUint32(0,!1);if(e!==i)throw Error(`Reported message length does not match received message length`);let a=r.getUint32(Na,!1),o=r.getUint32(H,!1),s=r.getUint32(e-U,!1),c=new Ma.Crc32().update(new Uint8Array(n,t,H));if(o!==c.digest())throw Error(`The prelude checksum specified in the message (${o}) does not match the calculated CRC32 checksum (${c.digest()})`);if(c.update(new Uint8Array(n,t+H,e-12)),s!==c.digest())throw Error(`The message checksum (${c.digest()}) did not match the expected value of ${s}`);return{headers:new DataView(n,t+H+U,a),body:new Uint8Array(n,t+H+U+a,i-a-16)}}var Ma,Na,H,U,Pa,Fa=t((()=>{Ma=fa(),Na=4,H=Na*2,U=4,Pa=16})),Ia,La,Ra=t((()=>{Ia=fa(),Aa(),Fa(),La=class{constructor(e,t){this.headerMarshaller=new va(e,t),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),t=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return t}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let t=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return t}}}encode({headers:e,body:t}){let n=this.headerMarshaller.format(e),r=n.byteLength+t.byteLength+16,i=new Uint8Array(r),a=new DataView(i.buffer,i.byteOffset,i.byteLength),o=new Ia.Crc32;return a.setUint32(0,r,!1),a.setUint32(4,n.byteLength,!1),a.setUint32(8,o.update(i.subarray(0,8)).digest(),!1),i.set(n,12),i.set(t,n.byteLength+12),a.setUint32(r-4,o.update(i.subarray(8,r-4)).digest(),!1),i}decode(e){let{headers:t,body:n}=ja(e);return{headers:this.headerMarshaller.parse(t),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}}})),za=t((()=>{})),Ba,Va=t((()=>{Ba=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}}})),Ha,Ua=t((()=>{Ha=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array)}}})),Wa,Ga=t((()=>{Wa=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let t=await this.options.deserializer(e);t!==void 0&&(yield t)}}}})),Ka,qa=t((()=>{Ka=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}}})),Ja=t((()=>{Ra(),Aa(),_a(),za(),Va(),Ua(),Ga(),qa()}));function Ya(e){let t=0,n=0,r=null,i=null,a=e=>{if(typeof e!=`number`)throw Error(`Attempted to allocate an event message where size was not a number: `+e);t=e,n=4,r=new Uint8Array(e),new DataView(r.buffer).setUint32(0,e,!1)},o=async function*(){let o=e[Symbol.asyncIterator]();for(;;){let{value:e,done:s}=await o.next();if(s){if(!t)return;if(t===n)yield r;else throw Error(`Truncated event message received.`);return}let c=e.length,l=0;for(;l<c;){if(!r){let t=c-l;i||(i=new Uint8Array(4));let r=Math.min(4-n,t);if(i.set(e.slice(l,l+r),n),n+=r,l+=r,n<4)break;a(new DataView(i.buffer).getUint32(0,!1)),i=null}let o=Math.min(t-n,c-l);r.set(e.slice(l,l+o),n),n+=o,l+=o,t&&t===n&&(yield r,r=null,t=0,n=0)}}};return{[Symbol.asyncIterator]:o}}var Xa=t((()=>{}));function Za(e,t){return async function(n){let{value:r}=n.headers[`:message-type`];if(r===`error`){let e=Error(n.headers[`:error-message`].value||`UnknownError`);throw e.name=n.headers[`:error-code`].value,e}else if(r===`exception`){let r=n.headers[`:exception-type`].value,i=await e({[r]:n});if(i.$unknown){let e=Error(t(n.body));throw e.name=r,e}throw i[r]}else if(r===`event`){let t=await e({[n.headers[`:event-type`].value]:n});return t.$unknown?void 0:t}else throw Error(`Unrecognizable event type: ${n.headers[`:event-type`].value}`)}}var Qa=t((()=>{})),$a,eo=t((()=>{Ja(),Xa(),Qa(),$a=class{constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new La(e,t),this.utfEncoder=e}deserialize(e,t){return new Wa({messageStream:new Ba({inputStream:Ya(e),decoder:this.eventStreamCodec}),deserializer:Za(t,this.utfEncoder)})}serialize(e,t){return new Ha({messageStream:new Ka({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}})),to=t((()=>{eo()})),no=t((()=>{eo(),to()}));async function*ro(e){let t=!1,n=!1,r=[];for(e.on(`error`,e=>{if(t||(t=!0),e)throw e}),e.on(`data`,e=>{r.push(e)}),e.on(`end`,()=>{t=!0});!n;){let e=await new Promise(e=>setTimeout(()=>e(r.shift()),0));e&&(yield e),n=t&&r.length===0}}var io=t((()=>{})),ao,oo=t((()=>{no(),io(),ao=class{constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new $a({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){let n=typeof e[Symbol.asyncIterator]==`function`?e:ro(e);return this.universalMarshaller.deserialize(n,t)}serialize(e,t){return pe.from(this.universalMarshaller.serialize(e,t))}}})),so=t((()=>{oo()})),co=t((()=>{oo(),so()})),lo,uo=t((()=>{lo=e=>typeof ArrayBuffer==`function`&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`})),fo,po,W=t((()=>{uo(),fo=(e,t=0,n=e.byteLength-t)=>{if(!lo(e))throw TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof e} (${e})`);return _.from(e,t,n)},po=(e,t)=>{if(typeof e!=`string`)throw TypeError(`The "input" argument must be of type string. Received type ${typeof e} (${e})`);return t?_.from(e,t):_.from(e)}})),mo,ho,go=t((()=>{W(),mo=/^[A-Za-z0-9+/]*={0,2}$/,ho=e=>{if(e.length*3%4!=0)throw TypeError(`Incorrect padding on base64 string.`);if(!mo.exec(e))throw TypeError(`Invalid base64 string.`);let t=po(e,`base64`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}})),_o,vo=t((()=>{W(),_o=e=>{let t=po(e,`utf8`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}})),yo=t((()=>{})),bo,xo=t((()=>{W(),bo=e=>{if(typeof e==`string`)return e;if(typeof e!=`object`||typeof e.byteOffset!=`number`||typeof e.byteLength!=`number`)throw Error(`@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.`);return fo(e.buffer,e.byteOffset,e.byteLength).toString(`utf8`)}})),So=t((()=>{vo(),yo(),xo()})),Co,wo=t((()=>{W(),So(),Co=e=>{let t;if(t=typeof e==`string`?_o(e):e,typeof t!=`object`||typeof t.byteOffset!=`number`||typeof t.byteLength!=`number`)throw Error(`@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.`);return fo(t.buffer,t.byteOffset,t.byteLength).toString(`base64`)}})),To=t((()=>{go(),wo()})),Eo=t((()=>{m(),d(),p(),ee()})),Do=t((()=>{})),Oo=t((()=>{})),ko=t((()=>{Oo()})),Ao=t((()=>{ko()}));function jo(e,t=`utf-8`){return t===`base64`?Co(e):bo(e)}function Mo(e,t){return t===`base64`?G.mutate(ho(e)):G.mutate(_o(e))}var No=t((()=>{To(),So(),Po()})),G,Po=t((()=>{No(),G=class e extends Uint8Array{static fromString(e,t=`utf-8`){switch(typeof e){case`string`:return Mo(e,t);default:throw Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(t){return Object.setPrototypeOf(t,e.prototype),t}transformToString(e=`utf-8`){return jo(this,e)}}})),Fo=t((()=>{})),Io=t((()=>{})),Lo=t((()=>{})),Ro=t((()=>{Io(),Lo()})),zo=t((()=>{Ro()})),Bo=t((()=>{w(),zo()})),Vo=t((()=>{w(),zo()})),Ho=t((()=>{})),Uo=t((()=>{Bo(),Vo(),Ho()})),Wo=t((()=>{Uo()})),Go=t((()=>{Po(),Fo(),Wo()})),Ko,qo=t((()=>{Go(),Ko=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return G.mutate(e);if(!e)return G.mutate(new Uint8Array);let n=t.streamCollector(e);return G.mutate(await n)}})),Jo=t((()=>{ko(),Sn()})),Yo=t((()=>{})),Xo=t((()=>{})),Zo,Qo,$o,es,K,ts,ns,rs=t((()=>{Zo=e=>{if(e!=null){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw TypeError(`Expected integer, got ${typeof e}: ${e}`)}},Qo=e=>$o(e,32),$o=(e,t)=>{let n=Zo(e);if(n!==void 0&&es(n,t)!==n)throw TypeError(`Expected ${t}-bit integer, got ${e}`);return n},es=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},K=e=>{if(e!=null){if(typeof e==`string`)return e;if([`boolean`,`number`,`bigint`].includes(typeof e))return ns.warn(ts(`Expected string, got ${typeof e}: ${e}`)),String(e);throw TypeError(`Expected string, got ${typeof e}: ${e}`)}},ts=e=>String(TypeError(e).stack||e).split(`
12
+ ${T(await r.digest())}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let t=[];for(let n of e.split(`/`))n?.length!==0&&n!==`.`&&(n===`..`?t.pop():t.push(n));return O(`${e?.startsWith(`/`)?`/`:``}${t.join(`/`)}${t.length>0&&e?.endsWith(`/`)?`/`:``}`).replace(/%2F/g,`/`)}return e}async getSignature(e,t,n,r){let i=await this.createStringToSign(e,t,r),a=new this.sha256(await n);return a.update(A(i)),T(await a.digest())}getSigningKey(e,t,n,r){return Ei(this.sha256,e,n,t,r||this.service)}validateResolvedCredentials(e){if(typeof e!=`object`||typeof e.accessKeyId!=`string`||typeof e.secretAccessKey!=`string`)throw Error(`Resolved credential object is not valid`)}},R=e=>{let t=Yi(e).replace(/[\-:]/g,``);return{longDate:t,shortDate:t.slice(0,8)}},$i=e=>Object.keys(e).sort().join(`;`)})),ta=t((()=>{ea(),Ai(),Mi(),Ni(),Ki(),Ji(),Oi()})),na,ra,ia,aa=t((()=>{na=ct(),Se(),w(),ta(),ra=()=>import(`./dist-es-hwK6468D.js`).then(({fromNodeProviderChain:e})=>e({clientConfig:{requestHandler:new be({requestInit:e=>({...e})})}})).catch(e=>{throw Error(`Failed to import '@aws-sdk/credential-providers'.You can provide a custom \`providerChainResolver\` in the client options if your runtime does not have access to '@aws-sdk/credential-providers': \`new AnthropicBedrock({ providerChainResolver })\` Original error: ${e.message}`)}),ia=async(e,t)=>{me(e.method,`Expected request method property to be set`);let n;n=t.awsAccessKey&&t.awsSecretKey?{accessKeyId:t.awsAccessKey,secretAccessKey:t.awsSecretKey,...t.awsSessionToken!=null&&{sessionToken:t.awsSessionToken}}:await(await(t.providerChainResolver?t.providerChainResolver():ra()))();let r=new Qi({service:`bedrock`,region:t.regionName,credentials:n,sha256:na.Sha256}),i=new URL(t.url),a=e.headers?Symbol.iterator in e.headers?Object.fromEntries(Array.from(e.headers).map(e=>[...e])):{...e.headers}:{};delete a.connection,a.host=i.hostname;let o=new Dn({method:e.method.toUpperCase(),protocol:i.protocol,path:i.pathname,headers:a,body:e.body});return(await r.sign(o)).headers}})),oa=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var n=(tt(),e(Qe)),r=typeof Buffer<`u`&&Buffer.from?function(e){return Buffer.from(e,`utf8`)}:n.fromUtf8;function i(e){return e instanceof Uint8Array?e:typeof e==`string`?r(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.convertToBuffer=i})),sa=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isEmptyData=void 0;function t(e){return typeof e==`string`?e.length===0:e.byteLength===0}e.isEmptyData=t})),ca=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.numToUint8=void 0;function t(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}e.numToUint8=t})),la=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=void 0;function t(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}e.uint32ArrayFrom=t})),ua=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=e.numToUint8=e.isEmptyData=e.convertToBuffer=void 0;var t=oa();Object.defineProperty(e,"convertToBuffer",{enumerable:!0,get:function(){return t.convertToBuffer}});var n=sa();Object.defineProperty(e,"isEmptyData",{enumerable:!0,get:function(){return n.isEmptyData}});var r=ca();Object.defineProperty(e,"numToUint8",{enumerable:!0,get:function(){return r.numToUint8}});var i=la();Object.defineProperty(e,"uint32ArrayFrom",{enumerable:!0,get:function(){return i.uint32ArrayFrom}})})),da=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AwsCrc32=void 0;var n=(C(),e(y)),r=ua(),i=fa();t.AwsCrc32=function(){function e(){this.crc32=new i.Crc32}return e.prototype.update=function(e){(0,r.isEmptyData)(e)||this.crc32.update((0,r.convertToBuffer)(e))},e.prototype.digest=function(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){return[2,(0,r.numToUint8)(this.crc32.digest())]})})},e.prototype.reset=function(){this.crc32=new i.Crc32},e}()})),fa=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AwsCrc32=t.Crc32=t.crc32=void 0;var n=(C(),e(y)),r=ua();function i(e){return new a().update(e).digest()}t.crc32=i;var a=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,r;try{for(var i=n.__values(e),a=i.next();!a.done;a=i.next()){var s=a.value;this.checksum=this.checksum>>>8^o[(this.checksum^s)&255]}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(this.checksum^4294967295)>>>0},e}();t.Crc32=a;var o=(0,r.uint32ArrayFrom)([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]),s=da();Object.defineProperty(t,"AwsCrc32",{enumerable:!0,get:function(){return s.AwsCrc32}})}));function pa(e){if(e.length%2!=0)throw Error(`Hex encoded strings must have an even number length`);let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){let r=e.slice(n,n+2).toLowerCase();if(r in B)t[n/2]=B[r];else throw Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`)}return t}function z(e){let t=``;for(let n=0;n<e.byteLength;n++)t+=ma[e[n]];return t}var ma,B,ha=t((()=>{ma={},B={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),ma[e]=t,B[t]=e}}));function ga(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var V,_a=t((()=>{ha(),V=class e{constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error(`Int64 buffers must be exactly 8 bytes`)}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let n=new Uint8Array(8);for(let e=7,r=Math.abs(Math.round(t));e>-1&&r>0;e--,r/=256)n[e]=r;return t<0&&ga(n),new e(n)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&ga(e),parseInt(z(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}})),va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa=t((()=>{ha(),_a(),va=class{constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){let t=[];for(let n of Object.keys(e)){let r=this.fromUtf8(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}let n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case`boolean`:return Uint8Array.from([+!e.value]);case`byte`:return Uint8Array.from([2,e.value]);case`short`:let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case`integer`:let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case`long`:let r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case`binary`:let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case`string`:let o=this.fromUtf8(e.value),s=new DataView(new ArrayBuffer(3+o.byteLength));s.setUint8(0,7),s.setUint16(1,o.byteLength,!1);let c=new Uint8Array(s.buffer);return c.set(o,3),c;case`timestamp`:let l=new Uint8Array(9);return l[0]=8,l.set(V.fromNumber(e.value.valueOf()).bytes,1),l;case`uuid`:if(!ka.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(pa(e.value.replace(/\-/g,``)),1),u}}parse(e){let t={},n=0;for(;n<e.byteLength;){let r=e.getUint8(n++),i=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,r));switch(n+=r,e.getUint8(n++)){case 0:t[i]={type:ba,value:!0};break;case 1:t[i]={type:ba,value:!1};break;case 2:t[i]={type:xa,value:e.getInt8(n++)};break;case 3:t[i]={type:Sa,value:e.getInt16(n,!1)},n+=2;break;case 4:t[i]={type:Ca,value:e.getInt32(n,!1)},n+=4;break;case 5:t[i]={type:wa,value:new V(new Uint8Array(e.buffer,e.byteOffset+n,8))},n+=8;break;case 6:let r=e.getUint16(n,!1);n+=2,t[i]={type:Ta,value:new Uint8Array(e.buffer,e.byteOffset+n,r)},n+=r;break;case 7:let a=e.getUint16(n,!1);n+=2,t[i]={type:Ea,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,a))},n+=a;break;case 8:t[i]={type:Da,value:new Date(new V(new Uint8Array(e.buffer,e.byteOffset+n,8)).valueOf())},n+=8;break;case 9:let o=new Uint8Array(e.buffer,e.byteOffset+n,16);n+=16,t[i]={type:Oa,value:`${z(o.subarray(0,4))}-${z(o.subarray(4,6))}-${z(o.subarray(6,8))}-${z(o.subarray(8,10))}-${z(o.subarray(10))}`};break;default:throw Error(`Unrecognized header type tag`)}}return t}},(function(e){e[e.boolTrue=0]=`boolTrue`,e[e.boolFalse=1]=`boolFalse`,e[e.byte=2]=`byte`,e[e.short=3]=`short`,e[e.integer=4]=`integer`,e[e.long=5]=`long`,e[e.byteArray=6]=`byteArray`,e[e.string=7]=`string`,e[e.timestamp=8]=`timestamp`,e[e.uuid=9]=`uuid`})(ya||(ya={})),ba=`boolean`,xa=`byte`,Sa=`short`,Ca=`integer`,wa=`long`,Ta=`binary`,Ea=`string`,Da=`timestamp`,Oa=`uuid`,ka=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/}));function ja({byteLength:e,byteOffset:t,buffer:n}){if(e<Pa)throw Error(`Provided message too short to accommodate event stream message overhead`);let r=new DataView(n,t,e),i=r.getUint32(0,!1);if(e!==i)throw Error(`Reported message length does not match received message length`);let a=r.getUint32(Na,!1),o=r.getUint32(H,!1),s=r.getUint32(e-U,!1),c=new Ma.Crc32().update(new Uint8Array(n,t,H));if(o!==c.digest())throw Error(`The prelude checksum specified in the message (${o}) does not match the calculated CRC32 checksum (${c.digest()})`);if(c.update(new Uint8Array(n,t+H,e-12)),s!==c.digest())throw Error(`The message checksum (${c.digest()}) did not match the expected value of ${s}`);return{headers:new DataView(n,t+H+U,a),body:new Uint8Array(n,t+H+U+a,i-a-16)}}var Ma,Na,H,U,Pa,Fa=t((()=>{Ma=fa(),Na=4,H=Na*2,U=4,Pa=16})),Ia,La,Ra=t((()=>{Ia=fa(),Aa(),Fa(),La=class{constructor(e,t){this.headerMarshaller=new va(e,t),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),t=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return t}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let t=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return t}}}encode({headers:e,body:t}){let n=this.headerMarshaller.format(e),r=n.byteLength+t.byteLength+16,i=new Uint8Array(r),a=new DataView(i.buffer,i.byteOffset,i.byteLength),o=new Ia.Crc32;return a.setUint32(0,r,!1),a.setUint32(4,n.byteLength,!1),a.setUint32(8,o.update(i.subarray(0,8)).digest(),!1),i.set(n,12),i.set(t,n.byteLength+12),a.setUint32(r-4,o.update(i.subarray(8,r-4)).digest(),!1),i}decode(e){let{headers:t,body:n}=ja(e);return{headers:this.headerMarshaller.parse(t),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}}})),za=t((()=>{})),Ba,Va=t((()=>{Ba=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}}})),Ha,Ua=t((()=>{Ha=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array)}}})),Wa,Ga=t((()=>{Wa=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let t=await this.options.deserializer(e);t!==void 0&&(yield t)}}}})),Ka,qa=t((()=>{Ka=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}}})),Ja=t((()=>{Ra(),Aa(),_a(),za(),Va(),Ua(),Ga(),qa()}));function Ya(e){let t=0,n=0,r=null,i=null,a=e=>{if(typeof e!=`number`)throw Error(`Attempted to allocate an event message where size was not a number: `+e);t=e,n=4,r=new Uint8Array(e),new DataView(r.buffer).setUint32(0,e,!1)},o=async function*(){let o=e[Symbol.asyncIterator]();for(;;){let{value:e,done:s}=await o.next();if(s){if(!t)return;if(t===n)yield r;else throw Error(`Truncated event message received.`);return}let c=e.length,l=0;for(;l<c;){if(!r){let t=c-l;i||(i=new Uint8Array(4));let r=Math.min(4-n,t);if(i.set(e.slice(l,l+r),n),n+=r,l+=r,n<4)break;a(new DataView(i.buffer).getUint32(0,!1)),i=null}let o=Math.min(t-n,c-l);r.set(e.slice(l,l+o),n),n+=o,l+=o,t&&t===n&&(yield r,r=null,t=0,n=0)}}};return{[Symbol.asyncIterator]:o}}var Xa=t((()=>{}));function Za(e,t){return async function(n){let{value:r}=n.headers[`:message-type`];if(r===`error`){let e=Error(n.headers[`:error-message`].value||`UnknownError`);throw e.name=n.headers[`:error-code`].value,e}else if(r===`exception`){let r=n.headers[`:exception-type`].value,i=await e({[r]:n});if(i.$unknown){let e=Error(t(n.body));throw e.name=r,e}throw i[r]}else if(r===`event`){let t=await e({[n.headers[`:event-type`].value]:n});return t.$unknown?void 0:t}else throw Error(`Unrecognizable event type: ${n.headers[`:event-type`].value}`)}}var Qa=t((()=>{})),$a,eo=t((()=>{Ja(),Xa(),Qa(),$a=class{constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new La(e,t),this.utfEncoder=e}deserialize(e,t){return new Wa({messageStream:new Ba({inputStream:Ya(e),decoder:this.eventStreamCodec}),deserializer:Za(t,this.utfEncoder)})}serialize(e,t){return new Ha({messageStream:new Ka({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}})),to=t((()=>{eo()})),no=t((()=>{eo(),to()}));async function*ro(e){let t=!1,n=!1,r=[];for(e.on(`error`,e=>{if(t||(t=!0),e)throw e}),e.on(`data`,e=>{r.push(e)}),e.on(`end`,()=>{t=!0});!n;){let e=await new Promise(e=>setTimeout(()=>e(r.shift()),0));e&&(yield e),n=t&&r.length===0}}var io=t((()=>{})),ao,oo=t((()=>{no(),io(),ao=class{constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new $a({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){let n=typeof e[Symbol.asyncIterator]==`function`?e:ro(e);return this.universalMarshaller.deserialize(n,t)}serialize(e,t){return pe.from(this.universalMarshaller.serialize(e,t))}}})),so=t((()=>{oo()})),co=t((()=>{oo(),so()})),lo,uo=t((()=>{lo=e=>typeof ArrayBuffer==`function`&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`})),fo,po,W=t((()=>{uo(),fo=(e,t=0,n=e.byteLength-t)=>{if(!lo(e))throw TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof e} (${e})`);return _.from(e,t,n)},po=(e,t)=>{if(typeof e!=`string`)throw TypeError(`The "input" argument must be of type string. Received type ${typeof e} (${e})`);return t?_.from(e,t):_.from(e)}})),mo,ho,go=t((()=>{W(),mo=/^[A-Za-z0-9+/]*={0,2}$/,ho=e=>{if(e.length*3%4!=0)throw TypeError(`Incorrect padding on base64 string.`);if(!mo.exec(e))throw TypeError(`Invalid base64 string.`);let t=po(e,`base64`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}})),_o,vo=t((()=>{W(),_o=e=>{let t=po(e,`utf8`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}})),yo=t((()=>{})),bo,xo=t((()=>{W(),bo=e=>{if(typeof e==`string`)return e;if(typeof e!=`object`||typeof e.byteOffset!=`number`||typeof e.byteLength!=`number`)throw Error(`@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.`);return fo(e.buffer,e.byteOffset,e.byteLength).toString(`utf8`)}})),So=t((()=>{vo(),yo(),xo()})),Co,wo=t((()=>{W(),So(),Co=e=>{let t;if(t=typeof e==`string`?_o(e):e,typeof t!=`object`||typeof t.byteOffset!=`number`||typeof t.byteLength!=`number`)throw Error(`@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.`);return fo(t.buffer,t.byteOffset,t.byteLength).toString(`base64`)}})),To=t((()=>{go(),wo()})),Eo=t((()=>{m(),d(),p(),ee()})),Do=t((()=>{})),Oo=t((()=>{})),ko=t((()=>{Oo()})),Ao=t((()=>{ko()}));function jo(e,t=`utf-8`){return t===`base64`?Co(e):bo(e)}function Mo(e,t){return t===`base64`?G.mutate(ho(e)):G.mutate(_o(e))}var No=t((()=>{To(),So(),Po()})),G,Po=t((()=>{No(),G=class e extends Uint8Array{static fromString(e,t=`utf-8`){switch(typeof e){case`string`:return Mo(e,t);default:throw Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(t){return Object.setPrototypeOf(t,e.prototype),t}transformToString(e=`utf-8`){return jo(this,e)}}})),Fo=t((()=>{})),Io=t((()=>{})),Lo=t((()=>{})),Ro=t((()=>{Io(),Lo()})),zo=t((()=>{Ro()})),Bo=t((()=>{w(),zo()})),Vo=t((()=>{w(),zo()})),Ho=t((()=>{})),Uo=t((()=>{Bo(),Vo(),Ho()})),Wo=t((()=>{Uo()})),Go=t((()=>{Po(),Fo(),Wo()})),Ko,qo=t((()=>{Go(),Ko=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return G.mutate(e);if(!e)return G.mutate(new Uint8Array);let n=t.streamCollector(e);return G.mutate(await n)}})),Jo=t((()=>{ko(),Sn()})),Yo=t((()=>{})),Xo=t((()=>{})),Zo,Qo,$o,es,K,ts,ns,rs=t((()=>{Zo=e=>{if(e!=null){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw TypeError(`Expected integer, got ${typeof e}: ${e}`)}},Qo=e=>$o(e,32),$o=(e,t)=>{let n=Zo(e);if(n!==void 0&&es(n,t)!==n)throw TypeError(`Expected ${t}-bit integer, got ${e}`);return n},es=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},K=e=>{if(e!=null){if(typeof e==`string`)return e;if([`boolean`,`number`,`bigint`].includes(typeof e))return ns.warn(ts(`Expected string, got ${typeof e}: ${e}`)),String(e);throw TypeError(`Expected string, got ${typeof e}: ${e}`)}},ts=e=>String(TypeError(e).stack||e).split(`
13
13
  `).slice(0,5).filter(e=>!e.includes(`stackTraceWarning`)).join(`
14
14
  `),ns={warn:console.warn}})),is=t((()=>{})),q,as=t((()=>{q=(e,t={})=>(Object.entries(t).filter(([,e])=>e!==void 0).forEach(([t,n])=>{(e[t]==null||e[t]===``)&&(e[t]=n)}),e.message=e.message||e.Message||`UnknownError`,delete e.Message,e)})),os=t((()=>{})),ss=t((()=>{})),cs=t((()=>{})),ls=t((()=>{Sn()})),us=t((()=>{ls()})),ds=t((()=>{us()})),fs=t((()=>{})),ps=t((()=>{})),ms=t((()=>{})),J,hs=t((()=>{J=function(){let e=Object.getPrototypeOf(this).constructor,t=new(Function.bind.apply(String,[null,...arguments]));return Object.setPrototypeOf(t,e.prototype),t},J.prototype=Object.create(String.prototype,{constructor:{value:J,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(J,String)}));function Y(e,t,n){let r,i,a;if(t===void 0&&n===void 0)r={},a=e;else{if(r=e,typeof t==`function`)return i=t,a=n,gs(r,i,a);a=t}for(let e of Object.keys(a)){if(!Array.isArray(a[e])){r[e]=a[e];continue}_s(r,null,a,e)}return r}var X,gs,_s,vs,ys,bs=t((()=>{X=(e,t)=>{let n={};for(let r in t)_s(n,e,t,r);return n},gs=(e,t,n)=>Y(e,Object.entries(n).reduce((e,[n,r])=>(Array.isArray(r)?e[n]=r:typeof r==`function`?e[n]=[t,r()]:e[n]=[t,r],e),{})),_s=(e,t,n,r)=>{if(t!==null){let i=n[r];typeof i==`function`&&(i=[,i]);let[a=vs,o=ys,s=r]=i;(typeof a==`function`&&a(t[s])||typeof a!=`function`&&a)&&(e[r]=o(t[s]));return}let[i,a]=n[r];if(typeof a==`function`){let t,n=i===void 0&&(t=a())!=null,o=typeof i==`function`&&!!i(void 0)||typeof i!=`function`&&!!i;n?e[r]=t:o&&(e[r]=a())}else{let t=i===void 0&&a!=null,n=typeof i==`function`&&!!i(a)||typeof i!=`function`&&!!i;(t||n)&&(e[r]=a)}},vs=e=>e!=null,ys=e=>e})),xs=t((()=>{})),Ss=t((()=>{})),Cs=t((()=>{})),ws=t((()=>{})),Ts=t((()=>{Do(),Ao(),qo(),Jo(),Yo(),Xo(),is(),os(),ss(),cs(),ds(),as(),fs(),ps(),ms(),hs(),bs(),rs(),xs(),Ss(),Cs(),ws()})),Es,Ds,Os,ks,As,js,Ms,Ns,Ps,Fs,Is,Z,Ls,Q,Rs=t((()=>{Ts(),fe(),Es=async(e,t)=>{let n=Y({}),r=e.body,i=X(r,{message:K});return Object.assign(n,i),q(new ue({$metadata:Z(e),...n}),e.body)},Ds=async(e,t)=>{let n=Y({}),r=e.body,i=X(r,{message:K,originalMessage:K,originalStatusCode:Qo});return Object.assign(n,i),q(new le({$metadata:Z(e),...n}),e.body)},Os=async(e,t)=>{let n=Y({}),r=e.body,i=X(r,{message:K});return Object.assign(n,i),q(new ce({$metadata:Z(e),...n}),e.body)},ks=async(e,t)=>{let n=Y({}),r=e.body,i=X(r,{message:K});return Object.assign(n,i),q(new de({$metadata:Z(e),...n}),e.body)},As=(e,t)=>t.eventStreamMarshaller.deserialize(e,async n=>n.chunk==null?n.internalServerException==null?n.modelStreamErrorException==null?n.validationException==null?n.throttlingException==null?{$unknown:e}:{throttlingException:await Ps(n.throttlingException,t)}:{validationException:await Fs(n.validationException,t)}:{modelStreamErrorException:await Ms(n.modelStreamErrorException,t)}:{internalServerException:await js(n.internalServerException,t)}:{chunk:await Ns(n.chunk,t)}),js=async(e,t)=>{let n={...e,body:await Q(e.body,t)};return Es(n,t)},Ms=async(e,t)=>{let n={...e,body:await Q(e.body,t)};return Ds(n,t)},Ns=async(e,t)=>{let n={},r=await Q(e.body,t);return Object.assign(n,Is(r,t)),n},Ps=async(e,t)=>{let n={...e,body:await Q(e.body,t)};return Os(n,t)},Fs=async(e,t)=>{let n={...e,body:await Q(e.body,t)};return ks(n,t)},Is=(e,t)=>X(e,{bytes:t.base64Decoder}),Z=e=>({httpStatusCode:e.statusCode,requestId:e.headers[`x-amzn-requestid`]??e.headers[`x-amzn-request-id`]??e.headers[`x-amz-request-id`]??``,extendedRequestId:e.headers[`x-amz-id-2`]??``,cfId:e.headers[`x-amz-cf-id`]??``}),Ls=(e,t)=>Ko(e,t).then(e=>t.utf8Encoder(e)),Q=(e,t)=>Ls(e,t).then(e=>e.length?JSON.parse(e):{})}));function zs(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var Bs=t((()=>{})),Vs=t((()=>{ee()}));function Hs(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Us,Ws,Gs,Ks=t((()=>{Vs(),Us=e=>(Us=Array.isArray,Us(e)),Ws=Us,Gs=e=>{try{return JSON.parse(e)}catch{return}}}));function $(){}function qs(e,t,n){return!t||Ys[e]>Ys[n]?$:t[e].bind(t)}function Js(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return Xs;let r=Zs.get(t);if(r&&r[0]===n)return r[1];let i={error:qs(`error`,t,n),warn:qs(`warn`,t,n),info:qs(`info`,t,n),debug:qs(`debug`,t,n)};return Zs.set(t,[n,i]),i}var Ys,Xs,Zs,Qs=t((()=>{Ks(),Ys={off:0,error:200,warn:300,info:400,debug:500},Xs={error:$,warn:$,info:$,debug:$},Zs=new WeakMap}));function $s(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var ec,tc,nc,rc,ic=t((()=>{co(),To(),Se(),o(),s(),Eo(),Rs(),Bs(),Ks(),Qs(),ec=e=>new TextDecoder(`utf-8`).decode(e),tc=e=>new TextEncoder().encode(e),nc=()=>{let e=new ao({utf8Encoder:ec,utf8Decoder:tc});return{base64Decoder:ho,base64Encoder:Co,utf8Decoder:tc,utf8Encoder:ec,eventStreamMarshaller:e,streamCollector:oe}},rc=class e extends c{static fromSSEResponse(t,n,r){let a=!1,o=r?Js(r):console;async function*s(){if(!t.body)throw n.abort(),new g(`Attempted to iterate over a response with no body`);let e=As(zs(t.body),nc());for await(let t of e)t.chunk&&t.chunk.bytes?yield{event:`chunk`,data:ec(t.chunk.bytes),raw:[]}:t.internalServerException?yield{event:`error`,data:`InternalServerException`,raw:[]}:t.modelStreamErrorException?yield{event:`error`,data:`ModelStreamErrorException`,raw:[]}:t.validationException?yield{event:`error`,data:`ValidationException`,raw:[]}:t.throttlingException&&(yield{event:`error`,data:`ThrottlingException`,raw:[]})}async function*c(){if(a)throw Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let e=!1;try{for await(let e of s()){if(e.event===`chunk`){let n;try{n=JSON.parse(e.data)}catch(t){throw o.error(`Could not parse message into JSON:`,e.data),o.error(`From chunk:`,e.raw),t}if(n&&typeof n==`object`&&n.type===`error`)throw new i(void 0,n,void 0,t.headers,n.error?.type);yield n}if(e.event===`error`){let n=e.data,r=Gs(n),a=r?void 0:n;throw i.generate(void 0,r,a,t.headers)}}e=!0}catch(e){if($s(e))return;throw e}finally{e||n.abort()}}return new e(c,n)}}})),ac,oc=t((()=>{ac=e=>{if(globalThis.process!==void 0)return globalThis.process.env?.[e]?.trim()||void 0;if(globalThis.Deno!==void 0)return globalThis.Deno.env?.get?.(e)?.trim()||void 0}}));function*sc(e){if(!e)return;if(cc in e){let{values:t,nulls:n}=e;yield*t.entries();for(let e of n)yield[e,null];return}let t=!1,n;e instanceof Headers?n=e.entries():Ws(e)?n=e:(t=!0,n=Object.entries(e??{}));for(let e of n){let n=e[0];if(typeof n!=`string`)throw TypeError(`expected header name to be a string`);let r=Ws(e[1])?e[1]:[e[1]],i=!1;for(let e of r)e!==void 0&&(t&&!i&&(i=!0,yield[n,null]),yield[n,e])}}var cc,lc,uc=t((()=>{Ks(),cc=Symbol.for(`brand.privateNullableHeaders`),lc=e=>{let t=new Headers,n=new Set;for(let r of e){let e=new Set;for(let[i,a]of sc(r)){let r=i.toLowerCase();e.has(r)||(t.delete(i),e.add(r)),a===null?(t.delete(i),n.add(r)):(t.append(i,a),n.delete(r))}}return{[cc]:!0,values:t,nulls:n}}}));function dc(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var fc,pc,mc,hc=t((()=>{Vs(),fc=Object.freeze(Object.create(null)),pc=(e=dc)=>function(t,...n){if(t.length===1)return t[0];let r=!1,i=[],a=t.reduce((t,a,o)=>{/[?#]/.test(a)&&(r=!0);let s=n[o],c=(r?encodeURIComponent:e)(``+s);return o!==n.length&&(s==null||typeof s==`object`&&s.toString===Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty??fc)??fc)?.toString)&&(c=s+``,i.push({start:t.length+a.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+a+(o===n.length?``:c)},``),o=a.split(/[?#]/,1)[0],s=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=s.exec(o))!==null;)i.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can\'t be safely passed as a path parameter`});if(i.sort((e,t)=>e.start-t.start),i.length>0){let e=0,t=i.reduce((t,n)=>{let r=` `.repeat(n.start-e),i=`^`.repeat(n.length);return e=n.start+n.length,t+r+i},``);throw new g(`Path parameters result in path with invalid segments:\n${i.map(e=>e.error).join(`
15
15
  `)}\n${a}\n${t}`)}return a},mc=pc(dc)}));function gc(e){let t=new a(e);return delete t.batches,delete t.countTokens,t}function _c(e){let t=new u(e);return delete t.promptCaching,delete t.messages.batches,delete t.messages.countTokens,t}var vc,yc,bc,xc=t((()=>{m(),l(),aa(),ic(),oc(),Ks(),uc(),hc(),Qs(),vc=`bedrock-2023-05-31`,yc=new Set([`/v1/complete`,`/v1/messages`,`/v1/messages?beta=true`]),bc=class extends f{constructor({awsRegion:e=ac(`AWS_REGION`)??`us-east-1`,baseURL:t=ac(`ANTHROPIC_BEDROCK_BASE_URL`)??`https://bedrock-runtime.${e}.amazonaws.com`,apiKey:n=ac(`AWS_BEARER_TOKEN_BEDROCK`),awsSecretKey:r=null,awsAccessKey:i=null,awsSessionToken:a=null,providerChainResolver:o=null,...s}={}){super({baseURL:t,authToken:n,...s}),this.skipAuth=!1,this.messages=gc(this),this.completions=new h(this),this.beta=_c(this),i!=null!=(r!=null)&&Js(this).warn("Warning: Passing only one of `awsAccessKey` or `awsSecretKey` is deprecated. Please provide both keys, or provide neither and rely on the AWS credential provider chain."),this.awsSecretKey=r,this.awsAccessKey=i,this.awsRegion=e,this.awsSessionToken=a,this.skipAuth=s.skipAuth??!1,this.providerChainResolver=o}validateHeaders(){}async prepareRequest(e,{url:t,options:n}){if(this.skipAuth){e.headers.delete(`Authorization`);return}if(this.authToken)return;let r=this.awsRegion;if(!r)throw Error("Expected `awsRegion` option to be passed to the client or the `AWS_REGION` environment variable to be present");e.headers=lc([await ia(e,{url:t,regionName:r,awsAccessKey:this.awsAccessKey,awsSecretKey:this.awsSecretKey,awsSessionToken:this.awsSessionToken,fetchOptions:this.fetchOptions,providerChainResolver:this.providerChainResolver}),e.headers]).values}async buildRequest(e){if(e.__streamClass=rc,Hs(e.body)&&(e.body={...e.body}),Hs(e.body)&&(e.body.anthropic_version||(e.body.anthropic_version=vc),e.headers&&!e.body.anthropic_beta)){let t=lc([e.headers]).values.get(`anthropic-beta`);t!=null&&(e.body.anthropic_beta=t.split(`,`))}if(yc.has(e.path)&&e.method===`post`){if(!Hs(e.body))throw Error(`Expected request body to be an object for post /v1/messages`);let t=e.body.model;e.body.model=void 0;let n=e.body.stream;e.body.stream=void 0,n?e.path=mc`/model/${t}/invoke-with-response-stream`:e.path=mc`/model/${t}/invoke`}return super.buildRequest(e)}}})),Sc=t((()=>{ct(),w(),ta()})),Cc=t((()=>{uc(),Vs(),m(),l(),Sc()})),wc=t((()=>{xc(),xc(),Cc()})),Tc;t((()=>{wc(),Tc=class extends bc{async buildRequest(e){let t=await super.buildRequest(e),n=t?.req;if(!n||typeof n.body!=`string`||n.body.length===0)return t;let r;try{r=JSON.parse(n.body)}catch{return t}if(!(`anthropic_beta`in r))return t;delete r.anthropic_beta;let i=JSON.stringify(r);n.body=i;let a=String(new TextEncoder().encode(i).length),o=n.headers;if(typeof Headers<`u`&&o instanceof Headers)o.has(`content-length`)&&o.set(`content-length`,a);else if(o&&typeof o==`object`){let e=o;`content-length`in e&&(e[`content-length`]=a)}return t}}}))();export{Tc as BedrockClient};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Cr as t,_r as n,mr as r,or as i,pr as a,si as o,ti as s}from"./loadAgentsDir-DlPbtIsS.js";import{l as c,u as l}from"./types-Dx7P7JLQ.js";import{It as u,J as d,st as f}from"./state-B4jiUise.js";import{C as p,x as m}from"./debug-Bglx1aTu.js";import{i as h,o as g}from"./stringUtils-C718f5ey.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{randomUUID as y}from"crypto";import{mkdir as b,readFile as x,writeFile as S}from"fs/promises";function C(e){let t=e?.message?.content;if(!t)return`Branched conversation`;let n=typeof t==`string`?t:t.find(e=>e.type===`text`)?.text;return n&&n.replace(/\s+/g,` `).trim().slice(0,100)||`Branched conversation`}async function w(e){let n=y(),o=f(),s=i(d()),c=r(n),u=a();await b(s,{recursive:!0,mode:448});let m;try{m=await x(u)}catch{throw Error(`No conversation to branch`)}if(m.length===0)throw Error(`No conversation to branch`);let h=l(m),g=h.filter(e=>t(e)&&!e.isSidechain),_=h.filter(e=>e.type===`content-replacement`&&e.sessionId===o).flatMap(e=>e.replacements);if(g.length===0)throw Error(`No messages to branch`);let v=null,C=[],w=[];for(let e of g){let t={...e,sessionId:n,parentUuid:v,isSidechain:!1,forkedFrom:{sessionId:o,messageUuid:e.uuid}},r={...e,sessionId:n};w.push(r),C.push(p(t)),e.type!==`progress`&&(v=e.uuid)}if(_.length>0){let e={type:`content-replacement`,sessionId:n,replacements:_};C.push(p(e))}return await S(c,`${C.join(`
2
+ `)}\n`,{encoding:`utf8`,mode:384}),{sessionId:n,title:e,forkPath:c,serializedMessages:w,contentReplacementRecords:_}}async function T(e){let t=`${e} (Branch)`;if((await o(t,{exact:!0})).length===0)return t;let n=await o(`${e} (Branch`),r=new Set([1]),i=RegExp(`^${h(e)} \\(Branch(?: (\\d+))?\\)$`);for(let e of n){let t=e.customTitle?.match(i);t&&(t[1]?r.add(parseInt(t[1],10)):r.add(1))}let a=2;for(;r.has(a);)a++;return`${e} (Branch ${a})`}async function E(e,t,n){let r=n?.trim()||void 0,i=f();try{let{sessionId:n,title:a,forkPath:o,serializedMessages:c,contentReplacementRecords:l}=await w(r),u=new Date,d=C(c.find(e=>e.type===`user`)),f=await T(a??d);await s(n,f,o),v(`tengu_conversation_forked`,{message_count:c.length,has_custom_title:!!a});let p={date:u.toISOString().split(`T`)[0],messages:c,fullPath:o,value:u.getTime(),created:u,modified:u,firstPrompt:d,messageCount:c.length,isSidechain:!1,sessionId:n,customTitle:f,contentReplacements:l},m=a?` "${a}"`:``,h=`Branched conversation${m}. You are now in the branch.${`\nTo resume the original: claude -r ${i}`}`;return t.resume?(await t.resume(n,p,`fork`),e(h,{display:`system`})):e(`Branched conversation${m}. Resume with: /resume ${n}`),null}catch(t){return e(`Failed to branch conversation: ${t instanceof Error?t.message:`Unknown error occurred`}`),null}}e((()=>{u(),_(),c(),n(),m(),g()}))();export{E as call,C as deriveFirstPrompt};
@@ -1,7 +1,7 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DcaKZlRU.js";import{R as r,Ut as i}from"./state-D5D6QpTX.js";import{join as a}from"node:path";import{appendFileSync as o,existsSync as s,mkdirSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d}from"node:fs";function f(){return a(t(),`.next-request-no-cache`)}function p(){return a(t(),`.break-cache-always`)}function m(){return a(t(),`break-cache-events.jsonl`)}function h(){try{let e=l(m(),`utf8`).trim().split(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DfkgIdYf.js";import{I as r,It as i}from"./state-B4jiUise.js";import{join as a}from"node:path";import{appendFileSync as o,existsSync as s,mkdirSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d}from"node:fs";function f(){return a(t(),`.next-request-no-cache`)}function p(){return a(t(),`.break-cache-always`)}function m(){return a(t(),`break-cache-events.jsonl`)}function h(){try{let e=l(m(),`utf8`).trim().split(`
2
2
  `).filter(Boolean).map(e=>{try{return JSON.parse(e)}catch{return null}}).filter(e=>e!==null),t=e.filter(e=>e.kind===`once`),n=e[e.length-1],r=e.filter(e=>e.kind===`always_on`||e.kind===`always_off`),i=r[r.length-1];return{totalBreaks:t.length,lastBreakAt:n?.at??null,alwaysModeEnabled:i?.kind===`always_on`}}catch{return{totalBreaks:0,lastBreakAt:null,alwaysModeEnabled:!1}}}function g(e){let n=m();c(t(),{recursive:!0});let r={at:new Date().toISOString(),kind:e};o(n,`${JSON.stringify(r)}\n`,`utf8`)}function _(){g(`once`)}async function v(e){let t=e.trim().toLowerCase(),n=f(),r=p();if(t===`status`){let e=h(),t=s(n),i=s(r);return{type:`text`,value:[`## Break-Cache Status`,``,` Once marker: ${t?`ACTIVE (next call will bust cache)`:`not set`}`,` Always mode: ${i?`ON (every call busts cache)`:`off`}`,``,`## Stats`,` total_breaks: ${e.totalBreaks}`,` last_break_at: ${e.lastBreakAt??`never`}`].join(`
3
3
  `)}}if(t===`off`){let e=!1;return s(n)&&(u(n),e=!0),s(r)&&(u(r),e=!0),g(`always_off`),{type:`text`,value:e?`Break-cache disabled. Removed once marker and/or always flag.`:`Break-cache was not active.`}}if(t===`--clear`)return s(n)?(u(n),{type:`text`,value:`Cache-break marker cleared.\n \`${n}\``}):{type:`text`,value:`No cache-break marker was set.`};if(t===`always`)return d(r,new Date().toISOString(),`utf8`),g(`always_on`),{type:`text`,value:[`## Always-on cache break enabled`,``,`Flag written: \`${r}\``,``,`Every API call will now append a random nonce to the system prompt,`,`permanently preventing prompt-cache hits for this session.`,``,"To disable: `/break-cache off`"].join(`
4
4
  `)};if(t===``||t===`once`){let e=new Date().toISOString();d(n,e,`utf8`),_();let t=h();return{type:`text`,value:[`## Cache break scheduled`,``,`Marker written: \`${n}\``,`Timestamp: ${e}`,``,`The next API call will append a random nonce to the system prompt,`,`causing a cache miss. The marker is removed automatically after use.`,``,"To cancel before the next call: `/break-cache --clear`","For every call: `/break-cache always`",``,`Total breaks this session: ${t.totalBreaks}`,``,`_How it works: The prompt cache keys on the system-prompt prefix hash._`,`_A unique nonce invalidates the hash, forcing a fresh compute._`].join(`
5
5
  `)}}return{type:`text`,value:[`Unknown scope: "${t}"`,``,y].join(`
6
6
  `)}}var y,b,x,S=e((()=>{i(),n(),y=[`Usage: /break-cache [scope]`,``,` (no args) Schedule a one-time cache break for the next API call`,` once Same as no args`,` always Enable persistent cache-break mode (every request)`,` off Disable always mode and clear any pending marker`,` --clear Clear the pending once marker (cancel before next call)`,` status Show current break-cache status and stats`,``,`How it works:`,` The prompt cache keys on the system-prompt prefix hash.`,` A unique nonce invalidates the hash, forcing a fresh compute.`,` This is useful when you want to ensure a clean context window.`].join(`
7
- `),b={type:`local-jsx`,name:`break-cache`,description:`管理 prompt cache 的打断。打开操作面板,或运行:once、status、always、off`,isHidden:!1,isEnabled:()=>!r(),argumentHint:`[once|status|always|off|--clear]`,load:()=>import(`./panel-Cm23FDVt.js`)},x={type:`local`,name:`break-cache`,description:`强制下一次(或所有)API 调用不命中 prompt cache。作用域:once、status、always、off`,isHidden:!1,isEnabled:()=>r(),supportsNonInteractive:!0,load:async()=>({call:v})}}));export{f as a,p as i,x as n,S as o,v as r,b as t};
7
+ `),b={type:`local-jsx`,name:`break-cache`,description:`管理 prompt cache 的打断。打开操作面板,或运行:once、status、always、off`,isHidden:!1,isEnabled:()=>!r(),argumentHint:`[once|status|always|off|--clear]`,load:()=>import(`./panel-CVS4SK_E.js`)},x={type:`local`,name:`break-cache`,description:`强制下一次(或所有)API 调用不命中 prompt cache。作用域:once、status、always、off`,isHidden:!1,isEnabled:()=>r(),supportsNonInteractive:!0,load:async()=>({call:v})}}));export{f as a,p as i,x as n,S as o,v as r,b as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Hs as n,Mh as r,Nh as i,Qx as a,Us as o,Yi as s,aC as c,at as l,bb as u,cd as d,it as f,jh as p,ny as m,qg as h,ty as g,ud as _}from"./loadAgentsDir-DlPbtIsS.js";import{I as v,P as y,ai as b,bn as x,ot as S,t as C,vn as w,xt as T}from"./src-DL3w8VPk.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{I as D,M as O}from"./debug-Bglx1aTu.js";import{Ht as k}from"./settings-B2jvL8Dp.js";import{_ as A,p as j}from"./config-C-Y2qtB2.js";import{n as M,t as N}from"./SpinnerGlyph-CmkRUvHe.js";import{n as P,r as F}from"./sideQuestion-DLJxyrlp.js";import{i as I,n as L}from"./modalContext-DDZdU1J8.js";function R({question:e,context:t,onDone:n}){let[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(0),l=(0,H.useRef)(null),{rows:u}=I(S());x(()=>c(e=>e+1),r||a?null:80);function f(e){if(e.key===`escape`||e.key===`return`||e.key===` `||e.ctrl&&(e.key===`c`||e.key===`d`)){e.preventDefault(),n(void 0,{display:`skip`});return}(e.key===`up`||e.ctrl&&e.key===`p`)&&(e.preventDefault(),l.current?.scrollBy(-3)),(e.key===`down`||e.ctrl&&e.key===`n`)&&(e.preventDefault(),l.current?.scrollBy(K))}(0,H.useEffect)(()=>{let n=g();async function r(){try{let r=await F({question:e,cacheSafeParams:await B(t)});n.signal.aborted||(r.response?i(r.response):o(`No response received`))}catch(e){n.signal.aborted||o(O(e)||`Failed to get response`)}}return r(),()=>{n.abort()}},[e,t]);let p=Math.max(5,u-W-G);return(0,U.jsxs)(v,{flexDirection:`column`,paddingLeft:2,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:f,children:[(0,U.jsxs)(v,{children:[(0,U.jsxs)(y,{color:`warning`,bold:!0,children:[`/btw`,` `]}),(0,U.jsx)(y,{dimColor:!0,children:e})]}),(0,U.jsx)(v,{marginTop:1,marginLeft:2,maxHeight:p,children:(0,U.jsx)(T,{ref:l,flexDirection:`column`,flexGrow:1,children:a?(0,U.jsx)(y,{color:`error`,children:a}):r?(0,U.jsx)(d,{children:r}):(0,U.jsxs)(v,{children:[(0,U.jsx)(N,{frame:s,messageColor:`warning`}),(0,U.jsx)(y,{color:`warning`,children:`Answering...`})]})})}),(r||a)&&(0,U.jsx)(v,{marginTop:1,children:(0,U.jsxs)(y,{dimColor:!0,children:[`↑`,`/`,`↓`,` to scroll · Space, Enter, or Escape to dismiss`]})})]})}function z(e){let t=e.at(-1);return t?.type===`assistant`&&t.message.stop_reason===null?e.slice(0,-1):e}async function B(e){let t=a(z(e.messages)),i=n();if(i)return{systemPrompt:i.systemPrompt,userContext:i.userContext,systemContext:i.systemContext,toolUseContext:e,forkContextMessages:t};let[o,s,l]=await Promise.all([f(e.options.tools,e.options.mainLoopModel,[],e.options.mcpClients),r(),p()]);return{systemPrompt:c(o),userContext:s,systemContext:l,toolUseContext:e,forkContextMessages:t}}async function V(e,t,n){let r=n?.trim();return r?(A(e=>({...e,btwUseCount:e.btwUseCount+1})),(0,U.jsx)(R,{question:r,context:t,onDone:e})):(e(`Usage: /btw <your question>`,{display:`system`}),null)}var H,U,W,G,K;e((()=>{H=t(b(),1),w(),_(),M(),k(),l(),L(),i(),u(),C(),m(),j(),D(),o(),s(),P(),h(),U=E(),W=5,G=6,K=3}))();export{V as call};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./caches-DArHxBgL.js";e();export{t as clearSessionCaches};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ah as t,Fb as n,Fh as r,Fu as i,G as a,Gi as o,Ib as s,Ih as c,Lu as l,Mh as u,Nh as d,Ni as f,Ph as p,Ud as m,Vi as h,b_ as g,es as _,ig as v,jh as y,og as b,op as x,q as S,sp as C,ts as w,wi as T,xf as E,y_ as D,yf as O}from"./loadAgentsDir-DlPbtIsS.js";import{It as k,gn as A,l as j}from"./state-B4jiUise.js";import{Ur as M,zr as N}from"./settings-B2jvL8Dp.js";import{a as P,n as F}from"./fileSuggestions-DHxdwq28.js";import{r as I,t as L}from"./magicDocs-BEF8D3if.js";import{r as R,t as z}from"./detectRepository-CfX8Lc0A.js";function B(e=new Set){let o=e.size>0;u.cache.clear?.(),y.cache.clear?.(),t.cache.clear?.(),r.cache.clear?.(),F(),T(),o||b(),p(null),A(null),E(),w(),g(`session_start`),i(),z(),a(),j(e),N(),h(),C(),L(),n(),import(`./SearchExtraToolsTool-lv7VE50N.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-CcmY8zCj.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-CMm6RHHc.js`).then(({clearPromptCache:e})=>e())}var V=e((()=>{k(),f(),c(),d(),P(),m(),v(),O(),x(),I(),o(),_(),S(),D(),R(),M(),l(),s()}));export{V as n,B as t};
@@ -0,0 +1 @@
1
+ import{a as e,f as t,i as n,l as r}from"./types-Dx7P7JLQ.js";import{I as i,N as a}from"./debug-Bglx1aTu.js";import{o,s}from"./log-D2TIwHBV.js";import{i as c,o as l,t as u}from"./platform-BacQ6ACS.js";import{homedir as d}from"os";import{join as f}from"path";import{readFile as p,readdir as m,stat as h}from"fs/promises";e(),i(),r(),o(),l();async function g(){let e=c();if(!u.includes(e))throw Error(`Unsupported platform: ${e} - Work Mate Desktop integration only works on macOS and WSL.`);if(e===`macos`)return f(d(),`Library`,`Application Support`,`Work Mate`,`claude_desktop_config.json`);let t=process.env.USERPROFILE?process.env.USERPROFILE.replace(/\\/g,`/`):null;if(t){let e=`/mnt/c${t.replace(/^[A-Z]:/,``)}/AppData/Roaming/Work Mate/claude_desktop_config.json`;try{return await h(e),e}catch{}}try{let e=`/mnt/c/Users`;try{let t=await m(e,{withFileTypes:!0});for(let n of t){if(n.name===`Public`||n.name===`Default`||n.name===`Default User`||n.name===`All Users`)continue;let t=f(e,n.name,`AppData`,`Roaming`,`Work Mate`,`claude_desktop_config.json`);try{return await h(t),t}catch{}}}catch{}}catch(e){s(e)}throw Error(`Could not find Work Mate Desktop config file in Windows. Make sure Work Mate Desktop is installed on Windows.`)}async function _(){if(!u.includes(c()))throw Error(`Unsupported platform - Work Mate Desktop integration only works on macOS and WSL.`);try{let e=await g(),r;try{r=await p(e,{encoding:`utf8`})}catch(e){if(a(e)===`ENOENT`)return{};throw e}let i=t(r);if(!i||typeof i!=`object`)return{};let o=i.mcpServers;if(!o||typeof o!=`object`)return{};let s={};for(let[e,t]of Object.entries(o)){if(!t||typeof t!=`object`)continue;let r=n().safeParse(t);r.success&&(s[e]=r.data)}return s}catch(e){return s(e),{}}}export{_ as readClaudeDesktopMcpServers};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-Tvo4EDpQ.js";var r;e((()=>{t(),r=async(e,t)=>(await n(t),{type:`text`,value:``})}))();export{r as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-DUu9qBnq.js";var r;e((()=>{t(),r=async(e,t)=>(await n(t),{type:`text`,value:``})}))();export{r as call};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,l as n}from"./proxy-BhIc7-mj.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";import{r as a,t as o}from"./store-Z8rTjDHe.js";function s(e){if(!e)return 0;let t=0,n=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g,r;for(;(r=n.exec(e))!==null;){let e=Number(r[1]);switch(r[2]){case`ms`:t+=e/1e3;break;case`s`:t+=e;break;case`m`:t+=e*60;break;case`h`:t+=e*3600;break;case`d`:t+=e*86400;break}}if(t===0){let n=Number(e);Number.isFinite(n)&&(t=n)}return t<=0?0:Math.floor(Date.now()/1e3)+t}function c(e,t){if(e===null||t===null)return null;let n=Number(e),r=Number(t);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=0)return null;let i=Math.max(0,r-n);return Math.min(1,Math.max(0,i/r))}var l,u=e((()=>{l={providerId:`openai`,parseHeaders(e){let t=[],n=c(e.get(`x-ratelimit-remaining-requests`),e.get(`x-ratelimit-limit-requests`));n!==null&&t.push({kind:`requests`,label:`RPM`,utilization:n,resetsAt:s(e.get(`x-ratelimit-reset-requests`))||void 0});let r=c(e.get(`x-ratelimit-remaining-tokens`),e.get(`x-ratelimit-limit-tokens`));return r!==null&&t.push({kind:`tokens`,label:`TPM`,utilization:r,resetsAt:s(e.get(`x-ratelimit-reset-tokens`))||void 0}),t}}}));function d(e){return async(...t)=>{let n=await e(...t);try{a(`openai`,l.parseHeaders(n.headers))}catch{}return n}}function f(e){if(m)return m;let n=process.env.OPENAI_API_KEY||``,i=process.env.OPENAI_BASE_URL,a=d(e?.fetchOverride??globalThis.fetch),o=new r({apiKey:n,...i&&{baseURL:i},maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,...process.env.OPENAI_ORG_ID&&{organization:process.env.OPENAI_ORG_ID},...process.env.OPENAI_PROJECT_ID&&{project:process.env.OPENAI_PROJECT_ID},fetchOptions:t({forAnthropicAPI:!1}),fetch:a});return e?.fetchOverride||(m=o),o}function p(){m=null}var m,h=e((()=>{i(),u(),o(),n(),m=null}));export{f as n,h as r,p as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./proxy-CDBfZjO7.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";import{r as a,t as o}from"./store-Z8rTjDHe.js";function s(e){if(!e)return 0;let t=0,n=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g,r;for(;(r=n.exec(e))!==null;){let e=Number(r[1]);switch(r[2]){case`ms`:t+=e/1e3;break;case`s`:t+=e;break;case`m`:t+=e*60;break;case`h`:t+=e*3600;break;case`d`:t+=e*86400;break}}if(t===0){let n=Number(e);Number.isFinite(n)&&(t=n)}return t<=0?0:Math.floor(Date.now()/1e3)+t}function c(e,t){if(e===null||t===null)return null;let n=Number(e),r=Number(t);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=0)return null;let i=Math.max(0,r-n);return Math.min(1,Math.max(0,i/r))}var l,u=e((()=>{l={providerId:`openai`,parseHeaders(e){let t=[],n=c(e.get(`x-ratelimit-remaining-requests`),e.get(`x-ratelimit-limit-requests`));n!==null&&t.push({kind:`requests`,label:`RPM`,utilization:n,resetsAt:s(e.get(`x-ratelimit-reset-requests`))||void 0});let r=c(e.get(`x-ratelimit-remaining-tokens`),e.get(`x-ratelimit-limit-tokens`));return r!==null&&t.push({kind:`tokens`,label:`TPM`,utilization:r,resetsAt:s(e.get(`x-ratelimit-reset-tokens`))||void 0}),t}}}));function d(e){return async(...t)=>{let n=await e(...t);try{a(`openai`,l.parseHeaders(n.headers))}catch{}return n}}function f(e){if(m)return m;let t=process.env.OPENAI_API_KEY||``,i=process.env.OPENAI_BASE_URL,a=d(e?.fetchOverride??globalThis.fetch),o=new r({apiKey:t,...i&&{baseURL:i},maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,...process.env.OPENAI_ORG_ID&&{organization:process.env.OPENAI_ORG_ID},...process.env.OPENAI_PROJECT_ID&&{project:process.env.OPENAI_PROJECT_ID},fetchOptions:n({forAnthropicAPI:!1}),fetch:a});return e?.fetchOverride||(m=o),o}function p(){m=null}var m,h=e((()=>{i(),u(),o(),t(),m=null}));export{f as n,h as r,p as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./client-CpTCeWba.js";e();export{t as getGrokClient};
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./client-4iqhC8xq.js";e();export{t as clearOpenAIClientCache};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./proxy-CDBfZjO7.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";function a(e){if(s)return s;let t=new r({apiKey:process.env.GROK_API_KEY||process.env.XAI_API_KEY||``,baseURL:process.env.GROK_BASE_URL||o,maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:n({forAnthropicAPI:!1}),...e?.fetchOverride&&{fetch:e.fetchOverride}});return e?.fetchOverride||(s=t),t}var o,s,c=e((()=>{i(),t(),o=`https://api.x.ai/v1`,s=null}));export{c as n,a as t};
@@ -0,0 +1 @@
1
+ import{Ni as e,Oi as t,wi as n}from"./loadAgentsDir-DlPbtIsS.js";e();export{n as clearCommandsCache,t as getCommands};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Gm as t,Hh as n,Jm as r,Lh as i,Mh as a,Nh as o,Oh as s,Qx as c,Rh as l,Vh as u,Wm as d,Xh as f,Yi as p,ag as m,at as h,ed as g,hf as _,ig as v,it as y,jh as b,kh as x,mn as S,ng as C,pf as w,qm as T,td as E,vb as D,xf as O,yb as k,yf as A}from"./loadAgentsDir-DlPbtIsS.js";import{di as j,fi as M}from"./src-DL3w8VPk.js";import{It as N,Rt as P}from"./state-B4jiUise.js";import{F,I}from"./debug-Bglx1aTu.js";import{o as L,s as R}from"./log-D2TIwHBV.js";function z(e,t){let n=g(`tip`),r=D(`app:toggleTranscript`,`Global`,`ctrl+o`),i=[...e.options.verbose?[]:[`(${r} to see full summary)`],...t?[t]:[],...n?[n]:[]];return j.dim(`Compacted ${i.join(`
2
+ `)}`)}async function B(e,t){let n=e.getAppState(),r=await y(e.options.tools,e.options.mainLoopModel,Array.from(n.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),i=s({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:r,appendSystemPrompt:e.options.appendSystemPrompt}),[o,c]=await Promise.all([a(),b()]);return{systemPrompt:i,userContext:o,systemContext:c,toolUseContext:e,forkContextMessages:t}}var V;e((()=>{M(),N(),h(),o(),k(),v(),r(),u(),i(),A(),w(),f(),I(),S(),L(),p(),E(),x(),V=async(e,r)=>{let{abortController:i}=r,{messages:o}=r;if(o=c(o),o.length===0)throw Error(`No messages to compact`);let s=e.trim();try{if(!s){let e=await _(o,r.agentId);if(e)return a.cache.clear?.(),O(),m(r.options.querySource??`compact`,r.agentId),P(),n(),{type:`compact`,compactionResult:e,displayText:z(r)}}let e=(await l(o,r)).messages,t=await T(e,r,await B(r,e),!1,s,!1);return C(void 0),n(),a.cache.clear?.(),O(),{type:`compact`,compactionResult:t,displayText:z(r,t.userDisplayMessage)}}catch(e){throw i.signal.aborted?Error(`Compaction canceled.`):F(e,`Not enough messages to compact. Send a few more messages first, then try again.`)?Error(t):F(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(d):(R(e),Error(`Error during compaction: ${e}`))}}}))();export{V as call};
@@ -0,0 +1,3 @@
1
+ import{i as e,n as t,t as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./isObject-C6qM3WEW.js";import{n as a,t as o}from"./memoize-BK3gG5ob.js";import{c as s,i as c,l,o as u}from"./envUtils-DfkgIdYf.js";import{t as d}from"./graceful-fs-DDVg0cja.js";import{f,h as p,l as m,m as h}from"./types-Dx7P7JLQ.js";import{$r as g,Gr as _,It as v,J as y,Q as b,Qr as ee,Wr as te,Xr as ne,Zr as re,dr as ie,fr as ae,hr as oe,lt as se,mr as ce,ni as le,oi as ue,or as de,pr as fe,ri as pe,si as me,sr as he,ur as ge,vr as _e,yr as ve}from"./state-B4jiUise.js";import{n as ye,t as be}from"./cwd-Pa83R95t.js";import{$ as xe,C as x,I as Se,N as S,O as C,S as Ce,c as w,et as we,f as Te,i as Ee,u as T,x as De}from"./debug-Bglx1aTu.js";import{Dr as Oe,Fn as ke,Kt as E,Lr as Ae,Qt as je,Xr as Me,Xt as Ne,Yr as Pe,ai as Fe,di as Ie,h as Le,hi as Re,ii as ze,mi as Be,nr as Ve,qt as He,rr as Ue,s as D,t as We,ui as Ge,vr as Ke,wn as qe}from"./settings-B2jvL8Dp.js";import{d as Je,o as Ye,s as Xe,u as Ze}from"./log-D2TIwHBV.js";import{n as Qe,r as O}from"./analytics-DJobLaWP.js";import{homedir as $e}from"os";import{basename as et,dirname as k,isAbsolute as tt,join as A,normalize as j,resolve as nt,sep as rt}from"path";import{unwatchFile as it,watchFile as at}from"fs";import{randomBytes as ot}from"crypto";var M,st=t((()=>{me(),Fe(),re(),ee(),M=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)ue(t,ne(e)),e=ze(e);return t}:g}));function ct(e){return le(e,Ie,M)}var lt=t((()=>{pe(),st(),Ge()}));function ut(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(l(e))return!1;if(s(e))return!0;if(l(process.env.CLAUDE_CODE_SIMPLE)||l(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=We();return t.autoMemoryEnabled===void 0||t.autoMemoryEnabled}function dt(){return!1}function ft(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:c()}function pt(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=j(e||`.`);if(t===`.`||t===`..`)return;n=A($e(),e)}let r=j(n).replace(/[/\\]+$/,``);if(!(!tt(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+rt).normalize(`NFC`)}function mt(){return pt(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function ht(){return pt(D(`policySettings`)?.autoMemoryDirectory??D(`flagSettings`)?.autoMemoryDirectory??D(`localSettings`)?.autoMemoryDirectory??D(`userSettings`)?.autoMemoryDirectory,!0)}function gt(){return mt()!==void 0}function _t(){return Oe(b())??b()}function vt(){return A(N(),xt)}function yt(e){return j(e).startsWith(N())}var bt,xt,N,St=t((()=>{o(),v(),u(),Ae(),Ve(),Le(),bt=`memory`,xt=`MEMORY.md`,N=a(()=>(mt()??ht())||(A(A(ft(),`projects`),Ke(_t()),bt)+rt).normalize(`NFC`),()=>b())}));function Ct(e,t,n,i){if(!r(e))return e;t=ce(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=fe(t[a]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):void 0,u===void 0&&(u=r(d)?d:_(t[a+1])?[]:{})}Be(c,l,u),c=c[l]}return e}var wt=t((()=>{Re(),oe(),te(),i(),ae()}));function Tt(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=ge(e,o);n(s,o)&&Ct(a,ce(o,e),s)}return a}var Et=t((()=>{ie(),wt(),oe()}));function Dt(e,t){if(e==null)return{};var n=_e(ct(e),function(e){return[e]});return t=de(t),Tt(e,n,function(e,n){return t(e,n[0])})}var Ot=t((()=>{ve(),he(),Et(),lt()})),kt=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),At=n((e=>{var t=kt();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),jt=n(((e,t)=>{t.exports=At()})),Mt=n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),Nt=n(((t,n)=>{var r=global.process,i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=e(`assert`),o=Mt(),s=/^win/i.test(r.platform),c=e(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}else return _.apply(this,arguments)}}})),Pt=n(((e,t)=>{var n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),Ft=n(((t,n)=>{var r=e(`path`),i=d(),a=jt(),o=Nt(),s=Pt(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function f(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?f(e,{...t,stale:0},n):n(r);if(!p(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));m(e,t,r=>{if(r)return n(r);f(e,{...t,stale:0},n)})})})}function p(e,t){return e.mtime.getTime()<Date.now()-t.stale}function m(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function h(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return g(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,h(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function g(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function _(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{f(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};h(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));v(r,{...t,realpath:!1},e)})})})})}function v(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],m(r,t,n)})}function y(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!p(r,t)))})}function b(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=_,n.exports.unlock=v,n.exports.check=y,n.exports.getLocks=b})),It=n(((e,t)=>{var n=d();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),Lt=n(((e,t)=>{var n=Ft(),{toPromise:r,toSync:i,toSyncOptions:a}=It();async function o(e,t){return r(await r(n.lock)(e,t))}function s(e,t){return i(i(n.lock)(e,a(t)))}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}));function P(){return F||(F=Lt()),F}function Rt(e,t){return P().lock(e,t)}function zt(e,t){return P().lockSync(e,t)}function Bt(e,t){return P().check(e,t)}var F,Vt=t((()=>{}));function I(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:`dark`,preferredNotifChannel:`auto`,verbose:!1,editorMode:`normal`,autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:`auto`,env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,autoConnectIde:!1,autoInstallIdeExtension:!0,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},respectGitignore:!0}}function Ht(){return ln||(ln=Ut())}function Ut(){if(se())return!0;let e=V(),t=$();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=Ue(be());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=Ue(nt(n,`..`));if(t===n)break;n=t}return!1}function L(e){let t=q.config;return t?t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0:!1}function R(e){let t=null;try{Jt(E(),I,n=>{let r=e(n);return r===n?n:(t={...r,projects:Gt(n.projects)},t)})&&t&&B(t)}catch(n){w(`Failed to save config with lock: ${n}`,{level:`error`});let r=U(E(),I);if(L(r)){w(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),O(`tengu_config_auth_loss_prevented`,{});return}let i=e(r);if(i===r)return;t={...i,projects:Gt(r.projects)},qt(E(),t,K),B(t)}}function Wt(){let e=Y+X;e>0&&O(`tengu_config_cache_stats`,{cache_hits:Y,cache_misses:X,hit_rate:Y/e}),Y=0,X=0}function z(e){if(e.installMethod!==void 0)return e;let t=e,n=`unknown`,r=e.autoUpdates??!0;switch(t.autoUpdaterStatus){case`migrated`:n=`local`;break;case`installed`:n=`native`;break;case`disabled`:r=!1;break;case`enabled`:case`no_permissions`:case`not_configured`:n=`global`;break;case void 0:break}return{...e,installMethod:n,autoUpdates:r}}function Gt(e){if(!e)return e;let t={},n=!1;for(let[r,i]of Object.entries(e)){let e=i;if(e.history!==void 0){n=!0;let{history:i,...a}=e;t[r]=a}else t[r]=i}return n?t:e}function Kt(){if(Z)return;Z=!0;let e=E();at(e,{interval:dn,persistent:!1},t=>{t.mtimeMs<=q.mtime||T().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=q.mtime)return;let n=f(p(e));typeof n!=`object`||!n||(q={config:z({...I(),...n}),mtime:t.mtimeMs},J={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),we(async()=>{it(e),Z=!1})}function B(e){q={config:e,mtime:Date.now()},J=null}function V(){if(q.config)return Y++,q.config;X++;try{let e=null;try{e=T().statSync(E())}catch{}let t=z(U(E(),I));return q={config:t,mtime:e?.mtimeMs??Date.now()},J=e?{mtime:e.mtimeMs,size:e.size}:null,Kt(),t}catch{return z(U(E(),I))}}function qt(e,t,n){let r=k(e);T().mkdirSync(r),ke(e,x(Dt(t,(e,t)=>x(e)!==x(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===E()&&un++}function Jt(e,t,n){let r=t(),i=k(e),a=T();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=zt(e,{lockfilePath:i,onCompromised:e=>{w(`Config lock compromised: ${e}`,{level:`error`})}});let c=Date.now()-s;if(c>100&&(w(`Lock acquisition took longer than expected - another Work Mate instance may be running`),O(`tengu_config_lock_contention`,{lock_time_ms:c})),J&&e===E())try{let t=a.statSync(e);(t.mtimeMs!==J.mtime||t.size!==J.size)&&O(`tengu_config_stale_write`,{read_mtime:J.mtime,write_mtime:t.mtimeMs,read_size:J.size,write_size:t.size})}catch(e){if(S(e)!==`ENOENT`)throw e}let l=U(e,t);if(e===E()&&L(l))return w(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.workmate.json. See GH #3117.`,{level:`error`}),O(`tengu_config_auth_loss_prevented`,{}),!1;let u=n(l);if(u===l)return!1;let d=Dt(u,(e,t)=>x(e)!==x(r[t]));try{let t=et(e),n=H();try{a.mkdirSync(n)}catch(e){if(S(e)!==`EEXIST`)throw e}let r=a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse(),i=r[0],o=i?Number(i.split(`.backup.`).pop()):0,s=Number.isNaN(o)||Date.now()-o>=6e4;if(s){let r=A(n,`${t}.backup.${Date.now()}`);a.copyFileSync(e,r)}let c=s?a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse():r;for(let e of c.slice(5))try{a.unlinkSync(A(n,e))}catch{}}catch(e){S(e)!==`ENOENT`&&w(`Failed to backup config: ${e}`,{level:`error`})}return ke(e,x(d,null,2),{encoding:`utf-8`,mode:384}),e===E()&&un++,!0}finally{o&&o()}}function Yt(){if(Q)return;let e=Date.now();Me(`info`,`enable_configs_started`),Q=!0,U(E(),I,!0),Me(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function H(){return A(c(),`backups`)}function Xt(e){let t=T(),n=et(e),r=H();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return A(r,e)}catch{}let i=k(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return A(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function U(e,t,n){if(!Q)throw Error(`Config accessed before allowed.`);let r=T();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=Ce(p(n));return{...t(),...e}}catch(n){throw new C(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(S(i)===`ENOENT`){let n=Xt(e);return n&&process.stderr.write(`\nWork Mate configuration file not found at: ${e}\nA backup file exists at: ${n}\nYou can manually restore it by running: cp "${n}" "${e}"\n\n`),t()}if(i instanceof C&&n)throw i;if(i instanceof C){if(w(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!W){W=!0;try{Xe(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}O(`tengu_config_parse_error`,{has_backup:t})}finally{W=!1}}process.stderr.write(`\nWork Mate configuration file at ${e} is corrupted: ${i.message}\n`);let t=et(e),n=H();try{r.mkdirSync(n)}catch(e){if(S(e)!==`EEXIST`)throw e}let a=r.readdirStringSync(n).filter(e=>e.startsWith(`${t}.corrupted.`)),o,s=!1,c=r.readFileSync(e,{encoding:`utf-8`});for(let e of a)try{if(c===r.readFileSync(A(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=A(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),w(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=Xt(e);o?process.stderr.write(`The corrupted file has been backed up to: ${o}\n`):s&&process.stderr.write(`The corrupted file has already been backed up.
2
+ `),l?process.stderr.write(`A backup file exists at: ${l}\nYou can manually restore it by running: cp "${l}" "${e}"\n\n`):process.stderr.write(`
3
+ `)}return t()}}function Zt(){let e=$(),t=V();if(!t.projects)return G;let n=t.projects[e]??G;return typeof n.allowedTools==`string`&&(n.allowedTools=f(n.allowedTools)??[]),n}function Qt(e){let t=$(),n=null;try{Jt(E(),I,r=>{let i=r.projects?.[t]??G,a=e(i);return a===i?r:(n={...r,projects:{...r.projects,[t]:a}},n)})&&n&&B(n)}catch(r){w(`Failed to save config with lock: ${r}`,{level:`error`});let i=U(E(),I);if(L(i)){w(`saveCurrentProjectConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),O(`tengu_config_auth_loss_prevented`,{});return}let a=i.projects?.[t]??G,o=e(a);if(o===a)return;n={...i,projects:{...i.projects,[t]:o}},qt(E(),n,K),B(n)}}function $t(){return nn()!==null}function en(){return $t()&&!l(process.env.FORCE_AUTOUPDATE_PLUGINS)}function tn(e){switch(e.type){case`development`:return`development build`;case`env`:return`${e.envVar} set`;case`config`:return`config`}}function nn(){if(!l(process.env.ENABLE_AUTOUPDATER))return{type:`config`};if(l(process.env.DISABLE_AUTOUPDATER))return{type:`env`,envVar:`DISABLE_AUTOUPDATER`};let e=Ze();if(e)return{type:`env`,envVar:e};let t=V();return t.autoUpdates===!1&&(t.installMethod!==`native`||t.autoUpdatesProtectedForNative!==!0)?{type:`config`}:null}function rn(){let e=V();if(e.userID)return e.userID;let t=ot(32).toString(`hex`);return R(e=>({...e,userID:t})),t}function an(){if(!V().firstStartTime){let e=new Date().toISOString();R(t=>({...t,firstStartTime:t.firstStartTime??e}))}}function on(e){let t=y();switch(e){case`User`:return A(c(),`AGENTS.md`);case`Local`:return A(t,`AGENTS.local.md`);case`Project`:return A(t,`AGENTS.md`);case`Managed`:return A(Ne(),`AGENTS.md`);case`AutoMem`:return vt();default:return A(c(),`AGENTS.md`)}}function sn(){return A(Ne(),`.workmate`,`rules`)}function cn(){return A(c(),`rules`)}var W,G,K,ln,q,J,Y,X,un,dn,Z,Q,$,fn=t((()=>{o(),Ot(),v(),St(),Qe(),ye(),xe(),Ee(),Pe(),He(),u(),Se(),qe(),Te(),Ae(),m(),h(),Vt(),Ye(),Ve(),Je(),je(),De(),W=!1,G={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!1},K=I(),ln=!1,{...K},{...G},q={config:null,mtime:0},J=null,Y=0,X=0,un=0,we(async()=>{Wt()}),dn=1e3,Z=!1,Q=!1,$=a(()=>{let e=y();return Ue(Oe(e)||nt(e))})}));export{ut as A,wt as C,gt as D,ft as E,st as F,ct as M,lt as N,St as O,M as P,Ct as S,N as T,R as _,nn as a,Vt as b,sn as c,$ as d,cn as f,Qt as g,an as h,tn as i,dt as j,yt as k,on as l,$t as m,Ht as n,Zt as o,fn as p,Yt as r,V as s,K as t,rn as u,en as v,vt as w,Rt as x,Bt as y};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Settings-TGp3fPrS.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Config`})}))();export{a as call};
@@ -0,0 +1 @@
1
+ import{p as e,r as t}from"./config-C-Y2qtB2.js";e();export{t as enableConfigs};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{O_ as r,ea as i,g_ as a,k_ as o,v_ as s,vw as c}from"./loadAgentsDir-C96o6gCj.js";import{I as l,P as u,s as d,t as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Cn as m,bn as h,cn as g,sn as _}from"./settings-BowI3jp-.js";import{_ as v,v as y}from"./startupProfiler-B90b5vuq.js";import{Et as b,Ot as x,Yt as S,in as C,rn as w,tn as T}from"./prompt-BNNE5tsG.js";import{n as E,t as D}from"./staticRender-BVWx0IM1.js";function O(e){let t=[];return k(e,t),A(e,t),M(e,t),N(e,t),ee(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function k(e,t){e.percentage>=L&&t.push({severity:`warning`,title:`Context is ${e.percentage}% full`,detail:e.isAutoCompactEnabled?`Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.`:`Autocompact is disabled. Use /compact to free space, or enable autocompact in /config.`})}function A(e,t){if(e.messageBreakdown)for(let n of e.messageBreakdown.toolCallsByType){let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100;if(i<P||r<F)continue;let a=j(n.name,r,i);a&&t.push(a)}}function j(e,t,n){let r=v(t);switch(e){case w:return{severity:`warning`,title:`Bash results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Pipe output through head, tail, or grep to reduce result size. Avoid cat on large files — use Read with offset/limit instead.`,savingsTokens:Math.floor(t*.5)};case S:return{severity:`info`,title:`Read results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Use offset and limit parameters to read only the sections you need. Avoid re-reading entire files when you only need a few lines.`,savingsTokens:Math.floor(t*.3)};case b:return{severity:`info`,title:`Grep results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Add more specific patterns or use the glob or type parameter to narrow file types. Consider Glob for file discovery instead of Grep.`,savingsTokens:Math.floor(t*.3)};default:return n>=20?{severity:`info`,title:`${e} using ${r} tokens (${n.toFixed(0)}%)`,detail:`This tool is consuming a significant portion of context.`,savingsTokens:Math.floor(t*.2)}:null}}function M(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===S);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=P&&r>=F||a>=I&&n.resultTokens>=F&&t.push({severity:`info`,title:`File reads using ${v(n.resultTokens)} tokens (${a.toFixed(0)}%)`,detail:`If you are re-reading files, consider referencing earlier reads. Use offset/limit for large files.`,savingsTokens:Math.floor(n.resultTokens*.3)})}function N(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=R&&n>=z){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${h(e.path)} (${v(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${v(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function ee(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<L&&t.push({severity:`info`,title:`Autocompact is disabled`,detail:`Without autocompact, you will hit context limits and lose the conversation. Enable it in /config or use /compact manually.`})}var P,F,I,L,R,z,B=e((()=>{C(),T(),x(),m(),y(),P=15,F=1e4,I=5,L=80,R=5,z=5e3}));function V({suggestions:e}){return e.length===0?null:(0,H.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,H.jsx)(u,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,H.jsxs)(l,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,H.jsxs)(l,{children:[(0,H.jsx)(d,{status:e.severity,withSpace:!0}),(0,H.jsx)(u,{bold:!0,children:e.title}),e.savingsTokens?(0,H.jsxs)(u,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,v(e.savingsTokens)]}):null]}),(0,H.jsx)(l,{marginLeft:2,children:(0,H.jsx)(u,{dimColor:!0,children:e.detail})})]},t))]})}var H,U=e((()=>{t(),f(),y(),H=p()}));function W(){return null}function G(e){let t=new Map;for(let n of e){let e=_(n.source),r=t.get(e)||[];r.push(n),t.set(e,r)}for(let[e,n]of t.entries())t.set(e,n.sort((e,t)=>t.tokens-e.tokens));let n=new Map;for(let e of Y){let r=t.get(e);r&&n.set(e,r)}return n}function K({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,gridRows:a,model:o,memoryFiles:s,mcpTools:c,deferredBuiltinTools:d=[],agents:f,skills:p,cacheHitRate:m,cacheThreshold:g}=e,_=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==J&&!e.isDeferred),y=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),b=t.find(e=>e.name===J);return(0,q.jsxs)(l,{flexDirection:`column`,paddingLeft:1,children:[(0,q.jsx)(u,{bold:!0,children:`Context Usage`}),(0,q.jsxs)(l,{flexDirection:`row`,gap:2,children:[(0,q.jsx)(l,{flexDirection:`column`,flexShrink:0,children:a.map((e,t)=>(0,q.jsx)(l,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,q.jsx)(u,{dimColor:!0,children:`⛶ `},t):e.categoryName===J?(0,q.jsx)(u,{color:e.color,children:`⛝ `},t):(0,q.jsx)(u,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,q.jsxs)(l,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,q.jsxs)(u,{dimColor:!0,children:[o,` · `,v(n),`/`,v(r),` tokens (`,i,`%)`]}),(0,q.jsx)(W,{}),m!==void 0&&g!==void 0&&(0,q.jsxs)(u,{color:m<g?`warning`:void 0,children:[`Cache hit rate: `,m.toFixed(0),`%`,m<g?` (below ${g}% threshold)`:``]}),(0,q.jsx)(u,{children:` `}),(0,q.jsx)(u,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),_.map((e,t)=>{let n=v(e.tokens),i=e.isDeferred?`N/A`:`${(e.tokens/r*100).toFixed(1)}%`,a=e.name===J,o=e.name,s=e.isDeferred?` `:a?`⛝`:`⛁`;return(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{color:e.color,children:s}),(0,q.jsxs)(u,{children:[` `,o,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[n,` tokens (`,i,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{dimColor:!0,children:`⛶`}),(0,q.jsx)(u,{children:` Free space: `}),(0,q.jsxs)(u,{dimColor:!0,children:[v(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/r*100).toFixed(1),`%)`]})]}),b&&b.tokens>0&&(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{color:b.color,children:`⛝`}),(0,q.jsxs)(u,{dimColor:!0,children:[` `,b.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(b.tokens),` tokens (`,(b.tokens/r*100).toFixed(1),`%)`]})]})]})]}),(0,q.jsxs)(l,{flexDirection:`column`,marginLeft:-1,children:[c.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`MCP tools`}),(0,q.jsxs)(u,{dimColor:!0,children:[` · /mcp`,y?` (loaded on-demand)`:``]})]}),c.some(e=>e.isLoaded)&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:`Loaded`}),c.filter(e=>e.isLoaded).map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]}),y&&c.some(e=>!e.isLoaded)&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:`Available`}),c.filter(e=>!e.isLoaded).map((e,t)=>(0,q.jsx)(l,{children:(0,q.jsxs)(u,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!y&&c.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]}),f.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Custom agents`}),(0,q.jsx)(u,{dimColor:!0,children:` · /agents`})]}),Array.from(G(f).entries()).map(([e,t])=>(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.agentType,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]},e))]}),s.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Memory files`}),(0,q.jsx)(u,{dimColor:!0,children:` · /memory`})]}),s.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,h(e.path),`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]}),p&&p.tokens>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Skills`}),(0,q.jsx)(u,{dimColor:!0,children:` · /skills`})]}),Array.from(G(p.skillFrontmatter).entries()).map(([e,t])=>(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]},e))]})]}),(0,q.jsx)(V,{suggestions:O(e)})]})}var q,J,Y,X=e((()=>{f(),B(),m(),y(),g(),U(),q=p(),J=`Autocompact buffer`,Y=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function Z(e){return c(e)}async function Q(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:s}}=t,c=Z(n),{messages:l}=await o(c),u=process.stdout.columns||80,d=r();return e(await E((0,$.jsx)(K,{data:await a(l,i,async()=>d.toolPermissionContext,s,d.agentDefinitions,u,t,void 0,c)}))),null}var $;e((()=>{X(),r(),s(),i(),D(),$=p()}))();export{Q as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{Dh as r,Lh as i,Qx as a,Rh as o,Th as s,Yi as c}from"./loadAgentsDir-DlPbtIsS.js";import{I as l,P as u,s as d,t as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{cn as m,ln as h,wn as g,xn as _}from"./settings-B2jvL8Dp.js";import{_ as v,g as y}from"./startupProfiler-CJdr3SxP.js";import{Et as b,Ot as x,Yt as S,in as C,rn as w,tn as T}from"./prompt-mM79EGnT.js";import{n as E,t as D}from"./staticRender-BVWx0IM1.js";function O(e){let t=[];return k(e,t),A(e,t),M(e,t),N(e,t),ee(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function k(e,t){e.percentage>=L&&t.push({severity:`warning`,title:`Context is ${e.percentage}% full`,detail:e.isAutoCompactEnabled?`Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.`:`Autocompact is disabled. Use /compact to free space, or enable autocompact in /config.`})}function A(e,t){if(e.messageBreakdown)for(let n of e.messageBreakdown.toolCallsByType){let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100;if(i<P||r<F)continue;let a=j(n.name,r,i);a&&t.push(a)}}function j(e,t,n){let r=y(t);switch(e){case w:return{severity:`warning`,title:`Bash results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Pipe output through head, tail, or grep to reduce result size. Avoid cat on large files — use Read with offset/limit instead.`,savingsTokens:Math.floor(t*.5)};case S:return{severity:`info`,title:`Read results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Use offset and limit parameters to read only the sections you need. Avoid re-reading entire files when you only need a few lines.`,savingsTokens:Math.floor(t*.3)};case b:return{severity:`info`,title:`Grep results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Add more specific patterns or use the glob or type parameter to narrow file types. Consider Glob for file discovery instead of Grep.`,savingsTokens:Math.floor(t*.3)};default:return n>=20?{severity:`info`,title:`${e} using ${r} tokens (${n.toFixed(0)}%)`,detail:`This tool is consuming a significant portion of context.`,savingsTokens:Math.floor(t*.2)}:null}}function M(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===S);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=P&&r>=F||a>=I&&n.resultTokens>=F&&t.push({severity:`info`,title:`File reads using ${y(n.resultTokens)} tokens (${a.toFixed(0)}%)`,detail:`If you are re-reading files, consider referencing earlier reads. Use offset/limit for large files.`,savingsTokens:Math.floor(n.resultTokens*.3)})}function N(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=R&&n>=z){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${_(e.path)} (${y(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${y(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function ee(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<L&&t.push({severity:`info`,title:`Autocompact is disabled`,detail:`Without autocompact, you will hit context limits and lose the conversation. Enable it in /config or use /compact manually.`})}var P,F,I,L,R,z,B=e((()=>{C(),T(),x(),g(),v(),P=15,F=1e4,I=5,L=80,R=5,z=5e3}));function V({suggestions:e}){return e.length===0?null:(0,H.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,H.jsx)(u,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,H.jsxs)(l,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,H.jsxs)(l,{children:[(0,H.jsx)(d,{status:e.severity,withSpace:!0}),(0,H.jsx)(u,{bold:!0,children:e.title}),e.savingsTokens?(0,H.jsxs)(u,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,y(e.savingsTokens)]}):null]}),(0,H.jsx)(l,{marginLeft:2,children:(0,H.jsx)(u,{dimColor:!0,children:e.detail})})]},t))]})}var H,U=e((()=>{t(),f(),v(),H=p()}));function W(){return null}function G(e){let t=new Map;for(let n of e){let e=m(n.source),r=t.get(e)||[];r.push(n),t.set(e,r)}for(let[e,n]of t.entries())t.set(e,n.sort((e,t)=>t.tokens-e.tokens));let n=new Map;for(let e of Y){let r=t.get(e);r&&n.set(e,r)}return n}function K({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,gridRows:a,model:o,memoryFiles:s,mcpTools:c,deferredBuiltinTools:d=[],agents:f,skills:p,cacheHitRate:m,cacheThreshold:h}=e,g=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==J&&!e.isDeferred),v=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),b=t.find(e=>e.name===J);return(0,q.jsxs)(l,{flexDirection:`column`,paddingLeft:1,children:[(0,q.jsx)(u,{bold:!0,children:`Context Usage`}),(0,q.jsxs)(l,{flexDirection:`row`,gap:2,children:[(0,q.jsx)(l,{flexDirection:`column`,flexShrink:0,children:a.map((e,t)=>(0,q.jsx)(l,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,q.jsx)(u,{dimColor:!0,children:`⛶ `},t):e.categoryName===J?(0,q.jsx)(u,{color:e.color,children:`⛝ `},t):(0,q.jsx)(u,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,q.jsxs)(l,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,q.jsxs)(u,{dimColor:!0,children:[o,` · `,y(n),`/`,y(r),` tokens (`,i,`%)`]}),(0,q.jsx)(W,{}),m!==void 0&&h!==void 0&&(0,q.jsxs)(u,{color:m<h?`warning`:void 0,children:[`Cache hit rate: `,m.toFixed(0),`%`,m<h?` (below ${h}% threshold)`:``]}),(0,q.jsx)(u,{children:` `}),(0,q.jsx)(u,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),g.map((e,t)=>{let n=y(e.tokens),i=e.isDeferred?`N/A`:`${(e.tokens/r*100).toFixed(1)}%`,a=e.name===J,o=e.name,s=e.isDeferred?` `:a?`⛝`:`⛁`;return(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{color:e.color,children:s}),(0,q.jsxs)(u,{children:[` `,o,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[n,` tokens (`,i,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{dimColor:!0,children:`⛶`}),(0,q.jsx)(u,{children:` Free space: `}),(0,q.jsxs)(u,{dimColor:!0,children:[y(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/r*100).toFixed(1),`%)`]})]}),b&&b.tokens>0&&(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{color:b.color,children:`⛝`}),(0,q.jsxs)(u,{dimColor:!0,children:[` `,b.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[y(b.tokens),` tokens (`,(b.tokens/r*100).toFixed(1),`%)`]})]})]})]}),(0,q.jsxs)(l,{flexDirection:`column`,marginLeft:-1,children:[c.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`MCP tools`}),(0,q.jsxs)(u,{dimColor:!0,children:[` · /mcp`,v?` (loaded on-demand)`:``]})]}),c.some(e=>e.isLoaded)&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:`Loaded`}),c.filter(e=>e.isLoaded).map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),v&&c.some(e=>!e.isLoaded)&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:`Available`}),c.filter(e=>!e.isLoaded).map((e,t)=>(0,q.jsx)(l,{children:(0,q.jsxs)(u,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!v&&c.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),f.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Custom agents`}),(0,q.jsx)(u,{dimColor:!0,children:` · /agents`})]}),Array.from(G(f).entries()).map(([e,t])=>(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.agentType,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]}),s.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Memory files`}),(0,q.jsx)(u,{dimColor:!0,children:` · /memory`})]}),s.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,_(e.path),`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),p&&p.tokens>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Skills`}),(0,q.jsx)(u,{dimColor:!0,children:` · /skills`})]}),Array.from(G(p.skillFrontmatter).entries()).map(([e,t])=>(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]})]}),(0,q.jsx)(V,{suggestions:O(e)})]})}var q,J,Y,X=e((()=>{f(),B(),g(),v(),h(),U(),q=p(),J=`Autocompact buffer`,Y=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function Z(e){return a(e)}async function Q(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,c=Z(n),{messages:l}=await o(c),u=process.stdout.columns||80,d=r();return e(await E((0,$.jsx)(K,{data:await s(l,i,async()=>d.toolPermissionContext,a,d.agentDefinitions,u,t,void 0,c)}))),null}var $;e((()=>{X(),i(),r(),c(),D(),$=p()}))();export{Q as call};
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./context-noninteractive-Dd4xIoP1.js";t();export{n as call,e as collectContextData};