@readmagic/workmate 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (552) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-BSLHrjbt.js +1 -0
  2. package/dist/chunks/App-DY5O6IKw.js +1 -0
  3. package/dist/chunks/ApproveApiKey-BEzfC6r3.js +1 -0
  4. package/dist/chunks/ApproveApiKey-DfAPwDix.js +1 -0
  5. package/dist/chunks/AssistantSessionChooser-Ce3PraaD.js +1 -0
  6. package/dist/chunks/BackgroundTasksDialog-Dvhcgahe.js +2 -0
  7. package/dist/chunks/BypassPermissionsModeDialog-B68V1bCq.js +1 -0
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog-BV7HHcgL.js +1 -0
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-CTWhpIm8.js +1 -0
  10. package/dist/chunks/ConsoleOAuthFlow-CU5fCPKq.js +1 -0
  11. package/dist/chunks/DesktopHandoff-BRbU4is4.js +1 -0
  12. package/dist/chunks/Dialog-vfLXEPed.js +1 -0
  13. package/dist/chunks/DiffDialog-CBluIK-x.js +6 -0
  14. package/dist/chunks/Doctor-B0CRtxi2.js +1 -0
  15. package/dist/chunks/Doctor-WxNv49HC.js +3 -0
  16. package/dist/chunks/ExitFlow-CRPgptCN.js +2 -0
  17. package/dist/chunks/Feedback-CEtzaLr3.js +2 -0
  18. package/dist/chunks/Grove--kttLxvs.js +11 -0
  19. package/dist/chunks/Grove-CelgLWH4.js +1 -0
  20. package/dist/chunks/HybridTransport-BgV5_7Az.js +4 -0
  21. package/dist/chunks/InvalidConfigDialog-DCGwXW_p.js +1 -0
  22. package/dist/chunks/InvalidSettingsDialog-jTwsdXWr.js +1 -0
  23. package/dist/chunks/ListItem-vfLXEPed.js +1 -0
  24. package/dist/chunks/MCPConnectionManager-BX0LMz9J.js +1 -0
  25. package/dist/chunks/McpParsingWarnings-WQrWJeWP.js +1 -0
  26. package/dist/chunks/MessageSelector-_UZB8cGb.js +3 -0
  27. package/dist/chunks/Messages-jCoW_1Rr.js +11 -0
  28. package/dist/chunks/Onboarding-BoIVNCgc.js +1 -0
  29. package/dist/chunks/OverageCreditUpsell-1FCN8bH3.js +1 -0
  30. package/dist/chunks/PermissionDialog-0ya1CU5k.js +1 -0
  31. package/dist/chunks/PluginSettings-BD9JLV9-.js +17 -0
  32. package/dist/chunks/PressEnterToContinue-Dl9Hg9Mf.js +1 -0
  33. package/dist/chunks/PromptInputFooterSuggestions-CrGST0Cq.js +1 -0
  34. package/dist/chunks/PromptInputHelpMenu-B2TDpbpw.js +1 -0
  35. package/dist/chunks/QueryEngine-D2HUnwmU.js +1 -0
  36. package/dist/chunks/REPL-BV4WyYMg.js +142 -0
  37. package/dist/chunks/REPL-DcpN3MRC.js +1 -0
  38. package/dist/chunks/RemoteCallout-DS_EV6Fh.js +1 -0
  39. package/dist/chunks/RemoteSessionManager-Tx1N2uVL.js +2 -0
  40. package/dist/chunks/ResumeConversation-Cw3vP4G8.js +1 -0
  41. package/dist/chunks/SSETransport-BXiEBMpb.js +4 -0
  42. package/dist/chunks/SearchBox-vfLXEPed.js +1 -0
  43. package/dist/chunks/SearchExtraToolsTool-D3VOFq9R.js +1 -0
  44. package/dist/chunks/Settings-ns6mRsDc.js +2 -0
  45. package/dist/chunks/TeleportProgress-CcDzMC5L.js +1 -0
  46. package/dist/chunks/TeleportRepoMismatchDialog-DZbxl4sD.js +1 -0
  47. package/dist/chunks/TeleportResumeWrapper-EowJO5nm.js +1 -0
  48. package/dist/chunks/ThemePicker-BYbChJpu.js +1 -0
  49. package/dist/chunks/TrustDialog-DA3YTk_k.js +1 -0
  50. package/dist/chunks/TungstenTool-Cb7gJvq4.js +1 -0
  51. package/dist/chunks/TungstenTool-CxMQVCuF.js +1 -0
  52. package/dist/chunks/ValidationErrorsList-Cx-hoRwG.js +2 -0
  53. package/dist/chunks/WelcomeV2-BTfttGcv.js +1 -0
  54. package/dist/chunks/add-dir-CWt69NAZ.js +1 -0
  55. package/dist/chunks/agentDisplay-CQ4mZWFH.js +1 -0
  56. package/dist/chunks/agents-C6jzKOit.js +2 -0
  57. package/dist/chunks/agents-D4clhuCl.js +103 -0
  58. package/dist/chunks/ajv-5vMo9UcX.js +8 -0
  59. package/dist/chunks/allErrors-HMPqE0jK.js +1 -0
  60. package/dist/chunks/analytics-BotDBGh0.js +1 -0
  61. package/dist/chunks/ant-9Z5bppVC.js +1 -0
  62. package/dist/chunks/api-L2IgleTV.js +1 -0
  63. package/dist/chunks/api-TgV7fl9V.js +1 -0
  64. package/dist/chunks/asciicast-DYbkzGCN.js +1 -0
  65. package/dist/chunks/asciicast-n-BBfgDq.js +4 -0
  66. package/dist/chunks/assistant-BA9_Mo9U.js +1 -0
  67. package/dist/chunks/assistant-BiNOSla3.js +1 -0
  68. package/dist/chunks/assistant-YvbVKjVh.js +1 -0
  69. package/dist/chunks/attributionHooks-CUAoGkU6.js +1 -0
  70. package/dist/chunks/attributionTrailer-oKKrF3z8.js +1 -0
  71. package/dist/chunks/auth-CEig4Gxp.js +1 -0
  72. package/dist/chunks/auth-CbGDlhyO.js +1 -0
  73. package/dist/chunks/auth-DHyCIxCk.js +15 -0
  74. package/dist/chunks/autoMode-Db4QrgFr.js +45 -0
  75. package/dist/chunks/autoModeDenials-BxNzGJdR.js +1 -0
  76. package/dist/chunks/autonomy-BkAMA7du.js +1 -0
  77. package/dist/chunks/autonomy-D4Vy-RPQ.js +15 -0
  78. package/dist/chunks/autonomyPanel-EjfO8jvg.js +1 -0
  79. package/dist/chunks/axios-BHBm_hhU.js +1 -0
  80. package/dist/chunks/axios-DaWTGg7G.js +16 -0
  81. package/dist/chunks/backgroundHousekeeping-BNEKWHhH.js +1 -0
  82. package/dist/chunks/backgroundHousekeeping-hDDE8mJC.js +17 -0
  83. package/dist/chunks/banner-hD6wZygx.js +2 -0
  84. package/dist/chunks/base64-js-0wLHn8zB.js +1 -0
  85. package/dist/chunks/bedrockClient-DxE_mHFI.js +15 -0
  86. package/dist/chunks/bg-BzG63WOm.js +1 -0
  87. package/dist/chunks/bg-DQ0Q3Qv-.js +9 -0
  88. package/dist/chunks/branch-CeQ9IyZk.js +3 -0
  89. package/dist/chunks/break-cache-Bd0clV2N.js +8 -0
  90. package/dist/chunks/bridge-yerAiaK2.js +2 -0
  91. package/dist/chunks/bridgeConfig-CCtXe8ak.js +1 -0
  92. package/dist/chunks/bridgeConfig-D5dB38xD.js +1 -0
  93. package/dist/chunks/bridgeEnabled--F-6TUi4.js +1 -0
  94. package/dist/chunks/bridgeEnabled-DKX8-T_H.js +1 -0
  95. package/dist/chunks/bridgeMain--R1HFbOv.js +68 -0
  96. package/dist/chunks/bridgeMain-d06JByZn.js +1 -0
  97. package/dist/chunks/bridgeMessaging-CqbLTDcx.js +1 -0
  98. package/dist/chunks/bridgePointer-W_jdQ8zf.js +1 -0
  99. package/dist/chunks/browser-Bd7GeBH1.js +1 -0
  100. package/dist/chunks/btw-CVGRmL9a.js +1 -0
  101. package/dist/chunks/bundledMode--fG1S62b.js +1 -0
  102. package/dist/chunks/caches-BtmAri4e.js +3 -0
  103. package/dist/chunks/caches-BuTIAOtY.js +1 -0
  104. package/dist/chunks/capacityWake-CV_x9H8j.js +1 -0
  105. package/dist/chunks/ccrClient-HqMi5Kfu.js +1 -0
  106. package/dist/chunks/checksum-DgbnMdM-.js +1 -0
  107. package/dist/chunks/classPrivateFieldSet2-D4U5K-I3.js +1 -0
  108. package/dist/chunks/classPrivateMethodInitSpec-BXQD0Vh4.js +1 -0
  109. package/dist/chunks/claudeDesktop-aUMx06RK.js +1 -0
  110. package/dist/chunks/clear-C6nRzIQE.js +1 -0
  111. package/dist/chunks/cliLaunch-2AUoMnqx.js +1 -0
  112. package/dist/chunks/client-BeET1hnC.js +1 -0
  113. package/dist/chunks/client-DchQnIJD.js +36 -0
  114. package/dist/chunks/client-DvAL7lY8.js +8 -0
  115. package/dist/chunks/color-DXI_4ibU.js +1 -0
  116. package/dist/chunks/color-convert-p91EwGT7.js +1 -0
  117. package/dist/chunks/commands-VjcG4qFq.js +1 -0
  118. package/dist/chunks/commitAttribution-Cm40fdNU.js +2 -0
  119. package/dist/chunks/commitAttribution-Lb3qUlAR.js +1 -0
  120. package/dist/chunks/compact-DPTVpJ4D.js +2 -0
  121. package/dist/chunks/completionCache-BQaLkB4d.js +4 -0
  122. package/dist/chunks/completionCache-CW8lKIgy.js +1 -0
  123. package/dist/chunks/config-0cRberzR.js +1 -0
  124. package/dist/chunks/config-BSXLgwpD.js +1 -0
  125. package/dist/chunks/config-BrxKpHpR.js +1 -0
  126. package/dist/chunks/config-C7YHKCPV.js +3 -0
  127. package/dist/chunks/config-CLmFk-5V.js +1 -0
  128. package/dist/chunks/connectHeadless-CqRoEtrg.js +1 -0
  129. package/dist/chunks/context-C_cKrBUn.js +1 -0
  130. package/dist/chunks/context-noninteractive-DnH6Q9Lu.js +54 -0
  131. package/dist/chunks/context-noninteractive-rUZ3ydmJ.js +1 -0
  132. package/dist/chunks/controlMessageCompat-IFu4Gc1y.js +1 -0
  133. package/dist/chunks/conversation-GJxfkr6M.js +1 -0
  134. package/dist/chunks/conversation-oK3aFzqO.js +1 -0
  135. package/dist/chunks/createSSHSession--bWmmIk9.js +6 -0
  136. package/dist/chunks/createSession-DIr4sUp6.js +1 -0
  137. package/dist/chunks/createSession-DM4acqaC.js +1 -0
  138. package/dist/chunks/cron-3LntnnhJ.js +1 -0
  139. package/dist/chunks/crossProjectResume-DKrtjTpm.js +40 -0
  140. package/dist/chunks/cwd-BuJhkTrc.js +1 -0
  141. package/dist/chunks/cwd-D-tY2NKc.js +1 -0
  142. package/dist/chunks/daemon-B9lBPdBJ.js +2 -0
  143. package/dist/chunks/dangerousBackend-DwcP0P08.js +1 -0
  144. package/dist/chunks/datadog-ByS7LGGa.js +1 -0
  145. package/dist/chunks/datadog-DNCsyfSO.js +1 -0
  146. package/dist/chunks/debug-DzZUT2Wv.js +1 -0
  147. package/dist/chunks/debug-IKW-jE7K.js +39 -0
  148. package/dist/chunks/debugUtils-D2981c0Z.js +1 -0
  149. package/dist/chunks/defineProperty-C-QyHrDq.js +1 -0
  150. package/dist/chunks/desktop-B5cvrcOQ.js +1 -0
  151. package/dist/chunks/detached-rfIUyc-B.js +5 -0
  152. package/dist/chunks/detect-libc-CxbBtWJu.js +1 -0
  153. package/dist/chunks/detectRepository-6nw-Aw3v.js +1 -0
  154. package/dist/chunks/detectRepository-ReZ0Fz8Z.js +1 -0
  155. package/dist/chunks/diff-cXAp9cNN.js +1 -0
  156. package/dist/chunks/directoryCompletion-DBM2o5kx.js +1 -0
  157. package/dist/chunks/dist-CXlEpGqr.js +20 -0
  158. package/dist/chunks/dist-DESLAofA.js +1 -0
  159. package/dist/chunks/dist-DIee4wq1.js +29 -0
  160. package/dist/chunks/dist-Dopnn8wS.js +5 -0
  161. package/dist/chunks/dist-es-5t7v8oaj.js +1 -0
  162. package/dist/chunks/dist-es-BF6bR-Ik.js +2 -0
  163. package/dist/chunks/dist-es-BIjDeceU.js +1 -0
  164. package/dist/chunks/dist-es-BOPBJQo3.js +1 -0
  165. package/dist/chunks/dist-es-Bfr4TzQe.js +3 -0
  166. package/dist/chunks/dist-es-Byxccz_-.js +1 -0
  167. package/dist/chunks/dist-es-C-OjW2Ao.js +1 -0
  168. package/dist/chunks/dist-es-C3reqy7X.js +1 -0
  169. package/dist/chunks/dist-es-C7vygWzp.js +1 -0
  170. package/dist/chunks/dist-es-CEk66gUu.js +1 -0
  171. package/dist/chunks/dist-es-CIULjvtA2.js +1 -0
  172. package/dist/chunks/dist-es-CMtO44xC.js +1 -0
  173. package/dist/chunks/dist-es-CQMt6zRM.js +1 -0
  174. package/dist/chunks/dist-es-CYPVg66r.js +9 -0
  175. package/dist/chunks/dist-es-Cd_AeqMK.js +6 -0
  176. package/dist/chunks/dist-es-Cgsa8pb82.js +1 -0
  177. package/dist/chunks/dist-es-Cwru7c2B2.js +1 -0
  178. package/dist/chunks/dist-es-D1Y8zSMI.js +1 -0
  179. package/dist/chunks/dist-es-D1wHe_zh.js +1 -0
  180. package/dist/chunks/dist-es-DKFm0FJ7.js +1 -0
  181. package/dist/chunks/dist-es-DKIwwJME.js +1 -0
  182. package/dist/chunks/dist-es-DNFTCbrP.js +1 -0
  183. package/dist/chunks/dist-es-DXIR5NLi2.js +1 -0
  184. package/dist/chunks/dist-es-DelBIxNM.js +1 -0
  185. package/dist/chunks/dist-es-DmdZmEJ-.js +1 -0
  186. package/dist/chunks/dist-es-Gt_DpXlP.js +1 -0
  187. package/dist/chunks/dist-es-gUzZ_7Vf.js +1 -0
  188. package/dist/chunks/dist-es-kj-F5A132.js +1 -0
  189. package/dist/chunks/dist-es-yHGBqhBe.js +1 -0
  190. package/dist/chunks/doctor-CTMHXZvQ.js +1 -0
  191. package/dist/chunks/earlyInput-BTC_Wucv.js +2 -0
  192. package/dist/chunks/earlyInput-xcoTbKQn.js +1 -0
  193. package/dist/chunks/effort-Br8KKHdx.js +9 -0
  194. package/dist/chunks/entry-4lIRMrLI.js +14 -0
  195. package/dist/chunks/envLessBridgeConfig-CGuIxFzJ.js +1 -0
  196. package/dist/chunks/envLessBridgeConfig-D_Jg4fJy.js +1 -0
  197. package/dist/chunks/envUtils-DSxRz_kt.js +1 -0
  198. package/dist/chunks/esm-BYnFh4pG.js +1 -0
  199. package/dist/chunks/esm-Bx6rTxIs.js +1 -0
  200. package/dist/chunks/esm-C367Cyo-.js +1 -0
  201. package/dist/chunks/esm-C8Zkk1Ux.js +1 -0
  202. package/dist/chunks/esm-CGx9qY3q.js +56 -0
  203. package/dist/chunks/esm-CXM9jqO_.js +1 -0
  204. package/dist/chunks/esm-CXczu_-W.js +1 -0
  205. package/dist/chunks/esm-CXt5K8Xt.js +1 -0
  206. package/dist/chunks/esm-Cb-L4oAk.js +1 -0
  207. package/dist/chunks/esm-D6ZZCdtk.js +1 -0
  208. package/dist/chunks/esm-DhRjocaU.js +1 -0
  209. package/dist/chunks/esm-DklLYEuz.js +1 -0
  210. package/dist/chunks/esm-IYgGg4wR.js +1 -0
  211. package/dist/chunks/esm-lWlUmoUA.js +1 -0
  212. package/dist/chunks/esm-lyfry1WB.js +10 -0
  213. package/dist/chunks/esm-wGnzjq4Z.js +1 -0
  214. package/dist/chunks/event-streams-C0Zy0Uqv.js +1 -0
  215. package/dist/chunks/event-streams-DoqJmjFN.js +1 -0
  216. package/dist/chunks/eventLoopStallDetector-Cg_RXU1q.js +1 -0
  217. package/dist/chunks/execAsync-Bv2yxuGe.js +1 -0
  218. package/dist/chunks/execFileNoThrow-COKYqVQj.js +34 -0
  219. package/dist/chunks/execSyncWrapper-DZJ3tNWF.js +1 -0
  220. package/dist/chunks/exit-BOhGfSlm.js +2 -0
  221. package/dist/chunks/exit-Z9oWrqE4.js +1 -0
  222. package/dist/chunks/extra-usage-BS4aVOt5.js +1 -0
  223. package/dist/chunks/extra-usage-DtAIhW74.js +1 -0
  224. package/dist/chunks/extra-usage-core-CdL1ltqq.js +1 -0
  225. package/dist/chunks/extra-usage-noninteractive-DxxRI0Yx.js +1 -0
  226. package/dist/chunks/extraUsage-BYZdi44Y.js +1 -0
  227. package/dist/chunks/extractMemories-C4f9JWuI.js +1 -0
  228. package/dist/chunks/fast-B0OB4x7K.js +1 -0
  229. package/dist/chunks/fast-DKqiojzf.js +1 -0
  230. package/dist/chunks/featureCheck-CrJeuheQ.js +1 -0
  231. package/dist/chunks/featureCheck-HslM03dr.js +1 -0
  232. package/dist/chunks/feedback-yB19xph5.js +1 -0
  233. package/dist/chunks/figures-5ThXQEtq.js +1 -0
  234. package/dist/chunks/file-D1cN3LMK.js +12 -0
  235. package/dist/chunks/fileStateCache-DDW5toIs.js +1 -0
  236. package/dist/chunks/files-DAzGtmzz.js +2 -0
  237. package/dist/chunks/firstPartyEventLogger-CdUpe6Lh.js +1 -0
  238. package/dist/chunks/firstPartyEventLogger-hU-LPkje.js +5 -0
  239. package/dist/chunks/flushGate-ZFr8yv7F.js +1 -0
  240. package/dist/chunks/foundry-sdk-BdeF2aBu.js +1 -0
  241. package/dist/chunks/fpsMetrics-Cf_hdtiJ.js +1 -0
  242. package/dist/chunks/from-CgDRRLiX.js +4 -0
  243. package/dist/chunks/gemini-DqAv8_GY.js +1 -0
  244. package/dist/chunks/generateRecap-lO2PDlx8.js +1 -0
  245. package/dist/chunks/generateSessionName-48veu5dv.js +1 -0
  246. package/dist/chunks/genericProcessUtils-F1Qcb1sO.js +23 -0
  247. package/dist/chunks/getMachineId-bsd-Cut1kHoA.js +1 -0
  248. package/dist/chunks/getMachineId-darwin-CsRhaP3y.js +2 -0
  249. package/dist/chunks/getMachineId-linux-Bd7UBNRQ.js +1 -0
  250. package/dist/chunks/getMachineId-unsupported-vFGP8E_8.js +1 -0
  251. package/dist/chunks/getMachineId-win-DamF2CH_.js +1 -0
  252. package/dist/chunks/git-BE_FiJZp.js +1 -0
  253. package/dist/chunks/git-tyaWOgRL.js +6 -0
  254. package/dist/chunks/githubRepoPathMapping-BlR0BphY.js +1 -0
  255. package/dist/chunks/goal-Bn8Kz2Dp.js +3 -0
  256. package/dist/chunks/graceful-fs-DDVg0cja.js +2 -0
  257. package/dist/chunks/grok-DhnO_KDC.js +1 -0
  258. package/dist/chunks/grove-DotW04-v.js +7 -0
  259. package/dist/chunks/hash-Tu-My5Vp.js +1 -0
  260. package/dist/chunks/heapdump-DkZSKNbp.js +5 -0
  261. package/dist/chunks/help-DU_BcZtU.js +1 -0
  262. package/dist/chunks/hooks-BTMWE5Qx.js +79 -0
  263. package/dist/chunks/hooks-DONAb_nq.js +1 -0
  264. package/dist/chunks/hostGuard-Dh296c6q.js +1 -0
  265. package/dist/chunks/inboundAttachments-BcEgi49j.js +1 -0
  266. package/dist/chunks/inboundAttachments-DVs3_m48.js +1 -0
  267. package/dist/chunks/index.min-D75yiGLN.js +1 -0
  268. package/dist/chunks/initReplBridge-D0Xec8S-.js +1 -0
  269. package/dist/chunks/install-BkfXeXpv.js +1 -0
  270. package/dist/chunks/instinctParser-Dt-lqnDe.js +1 -0
  271. package/dist/chunks/instrumentation-H0XRS1yG.js +21 -0
  272. package/dist/chunks/intl-cKc-V6Mq.js +1 -0
  273. package/dist/chunks/isObject-C6qM3WEW.js +1 -0
  274. package/dist/chunks/isSymbol-BO6cdPI7.js +1 -0
  275. package/dist/chunks/job-DKtLkF8V.js +2 -0
  276. package/dist/chunks/json-bigint-bonnP-Hz.js +8 -0
  277. package/dist/chunks/jsx-runtime-Bb4Xn-E0.js +1 -0
  278. package/dist/chunks/jws-BscXOT9I.js +3 -0
  279. package/dist/chunks/jwtUtils-C-ojmb8W.js +1 -0
  280. package/dist/chunks/keybindings-ez51eHHp.js +2 -0
  281. package/dist/chunks/language-BuRSO2sR.js +1 -0
  282. package/dist/chunks/language-Da4KNbjm.js +1 -0
  283. package/dist/chunks/launchAgentsPlatform-BQyPdrHp.js +1 -0
  284. package/dist/chunks/launchCommand-1qkTCKpf.js +1 -0
  285. package/dist/chunks/launchLocalMemory-CWHAj7CX.js +3 -0
  286. package/dist/chunks/launchLocalVault-D8iJdtsP.js +3 -0
  287. package/dist/chunks/launchMemoryStores-W7jWG2uH.js +1 -0
  288. package/dist/chunks/launchOnboarding-q__LaLy1.js +8 -0
  289. package/dist/chunks/launchSchedule-BWi9F5vh.js +1 -0
  290. package/dist/chunks/launchSkillStore-4wd4MQBc.js +1 -0
  291. package/dist/chunks/launchTeleport-BlCf2QM_.js +3 -0
  292. package/dist/chunks/launchVault-C7u7LZV7.js +1 -0
  293. package/dist/chunks/lazySchema-uxlVVNM1.js +1 -0
  294. package/dist/chunks/lib-BSzUGQb_.js +2 -0
  295. package/dist/chunks/lib-BlVGipXx.js +14 -0
  296. package/dist/chunks/lib-rQZENxQg.js +8 -0
  297. package/dist/chunks/loadAgentsDir-Dgd-fzNt.js +1 -0
  298. package/dist/chunks/loadAgentsDir-nzr38hai.js +3990 -0
  299. package/dist/chunks/loadPluginHooks-z1-zvBLw.js +1 -0
  300. package/dist/chunks/loadSso-DSxfVpgX.js +1 -0
  301. package/dist/chunks/localSearch-B-L_ldos.js +1 -0
  302. package/dist/chunks/localSearch-D-FprOMr.js +1 -0
  303. package/dist/chunks/lockfile-D5-j7HOZ.js +1 -0
  304. package/dist/chunks/log-B3eB4EFv.js +1 -0
  305. package/dist/chunks/logoV2Utils-RQ160dI2.js +1 -0
  306. package/dist/chunks/magicDocs-BqZ0GewA.js +57 -0
  307. package/dist/chunks/main-DeFMhaFE.js +31 -0
  308. package/dist/chunks/main-y7LJ5qUc.js +1243 -0
  309. package/dist/chunks/mappers-CWykjGfP.js +1 -0
  310. package/dist/chunks/mcp-CSFPAfaW.js +2 -0
  311. package/dist/chunks/mcp-DBwT4pa9.js +6 -0
  312. package/dist/chunks/mcp-DvZTaHZE.js +1 -0
  313. package/dist/chunks/memoize-BK3gG5ob.js +1 -0
  314. package/dist/chunks/memoize-BO31Ws9Q.js +1 -0
  315. package/dist/chunks/memory-DcpPpYN0.js +1 -0
  316. package/dist/chunks/metadata-BRLJvh61.js +1 -0
  317. package/dist/chunks/modalContext-DFjKLCB6.js +1 -0
  318. package/dist/chunks/mode-BkViT_0o.js +2 -0
  319. package/dist/chunks/model--z4Di9QO.js +1 -0
  320. package/dist/chunks/model-CZktWw6o.js +1 -0
  321. package/dist/chunks/model-DfFA3qMO.js +1 -0
  322. package/dist/chunks/multipart-parser-DDLYsngd.js +2 -0
  323. package/dist/chunks/nativeInstaller-GcIk7G2Y.js +1 -0
  324. package/dist/chunks/oauth-BqJqV-2M.js +1 -0
  325. package/dist/chunks/oauth-C8X_p8Gc.js +1 -0
  326. package/dist/chunks/observationStore-DzCdXq8U.js +4 -0
  327. package/dist/chunks/onChangeAppState-DwGVi-BC.js +1 -0
  328. package/dist/chunks/open-BtQHzzL9.js +1 -0
  329. package/dist/chunks/openai-B2wxZDQx.js +10 -0
  330. package/dist/chunks/openaiShared-G2-w4gJt.js +1 -0
  331. package/dist/chunks/output-style-BM3qAHLA.js +1 -0
  332. package/dist/chunks/overageCreditGrant-CjK49axw.js +1 -0
  333. package/dist/chunks/p-map-B1EeBuI8.js +1 -0
  334. package/dist/chunks/p-map-HKDr3iDo.js +1 -0
  335. package/dist/chunks/package-BC0bllK8.js +1 -0
  336. package/dist/chunks/panel-B-nrcHpm.js +1 -0
  337. package/dist/chunks/panel-R4ue6pSW.js +1 -0
  338. package/dist/chunks/panelCall-I_fbgub5.js +1 -0
  339. package/dist/chunks/parseConnectUrl-BiyKR5-x.js +1 -0
  340. package/dist/chunks/parser-BlM_Fk4J.js +1 -0
  341. package/dist/chunks/parser-CQrasoUB.js +1 -0
  342. package/dist/chunks/partition-CxRF7T-f.js +1 -0
  343. package/dist/chunks/passes-U_h-hNu-.js +1 -0
  344. package/dist/chunks/path-BCSE0S-c.js +1 -0
  345. package/dist/chunks/permissions-B8epy16o.js +3 -0
  346. package/dist/chunks/permissions-CeYKbtSC.js +1 -0
  347. package/dist/chunks/permissions-Cn_6f8CB.js +1 -0
  348. package/dist/chunks/pidLock-CBJDnBG_.js +3 -0
  349. package/dist/chunks/pipeTransport-D3Qx9v1V.js +1 -0
  350. package/dist/chunks/plan-BAhStVci.js +1 -0
  351. package/dist/chunks/platform-EtecGacO.js +2 -0
  352. package/dist/chunks/plist-Bzo2VMe9.js +6 -0
  353. package/dist/chunks/plugin-D9huNnv6.js +1 -0
  354. package/dist/chunks/pluginAutoupdate-BfmyxR5g.js +1 -0
  355. package/dist/chunks/pluginBlocklist-03sZaZa6.js +1 -0
  356. package/dist/chunks/pluginCliCommands-P2Ndi1r1.js +1 -0
  357. package/dist/chunks/pluginFlagging-BVy7Xv_0.js +1 -0
  358. package/dist/chunks/pluginOperations-Cz37qcjF.js +2 -0
  359. package/dist/chunks/pluginStartupCheck-BqUwHcMD.js +1 -0
  360. package/dist/chunks/pluginStartupCheck-w24D-wwk.js +1 -0
  361. package/dist/chunks/plugins-B0hiIN4q.js +4 -0
  362. package/dist/chunks/policyLimits-Dem-XJ_h.js +1 -0
  363. package/dist/chunks/pollConfig-C2Ac8WMU.js +1 -0
  364. package/dist/chunks/poller-CpLBoB-N.js +1 -0
  365. package/dist/chunks/poor-CfbMKZNJ.js +1 -0
  366. package/dist/chunks/poorMode-Bsw2V-V_.js +1 -0
  367. package/dist/chunks/poorMode-jvImnkty.js +1 -0
  368. package/dist/chunks/postCommitAttribution-DoSP9wZD.js +1 -0
  369. package/dist/chunks/print-ozjC0Mhg.js +23 -0
  370. package/dist/chunks/privacy-settings-DeGoBRrZ.js +1 -0
  371. package/dist/chunks/process-CNfq37LF.js +1 -0
  372. package/dist/chunks/process-gEbdy6uY.js +1 -0
  373. package/dist/chunks/processBashCommand-loWZ8MSE.js +1 -0
  374. package/dist/chunks/processSlashCommand-BdouajZb.js +5 -0
  375. package/dist/chunks/projectContext-BaDZBAoK.js +1 -0
  376. package/dist/chunks/projectContext-D9MDwJUF.js +1 -0
  377. package/dist/chunks/prompt-Bef63FhB.js +132 -0
  378. package/dist/chunks/prompt-C7wd1H_i.js +1 -0
  379. package/dist/chunks/prompt-DIoNqZvO.js +1 -0
  380. package/dist/chunks/promptEditor-foiayhdY.js +4 -0
  381. package/dist/chunks/protocolHandler-BsiB1oW_.js +13 -0
  382. package/dist/chunks/protocols-CCsohXid.js +18 -0
  383. package/dist/chunks/protocols-CnYQjBlj.js +2 -0
  384. package/dist/chunks/proxy-Cn2YwITp.js +99 -0
  385. package/dist/chunks/rate-limit-options-DTJPDcTr.js +1 -0
  386. package/dist/chunks/rcDebugLog-BUuD-X1D.js +11 -0
  387. package/dist/chunks/reconciler-DqXTmV3J.js +4 -0
  388. package/dist/chunks/referral-DP_GshTS.js +1 -0
  389. package/dist/chunks/refresh-CNzXPAFw.js +1 -0
  390. package/dist/chunks/registerProtocol-CjxlFsKw.js +36 -0
  391. package/dist/chunks/release-notes-BxgK8zWO.js +4 -0
  392. package/dist/chunks/releaseNotes-CbSktIJW.js +2 -0
  393. package/dist/chunks/reload-plugins-CDu6yU5-.js +1 -0
  394. package/dist/chunks/remote-env-B4HnhISc.js +1 -0
  395. package/dist/chunks/remoteBridgeCore-D-wG5jau.js +1 -0
  396. package/dist/chunks/remoteManagedSettings-B7gt0VAX.js +1 -0
  397. package/dist/chunks/rename-DlbMb24l.js +1 -0
  398. package/dist/chunks/renderOptions-5kWQpVr2.js +1 -0
  399. package/dist/chunks/resume-BB5iBogS.js +2 -0
  400. package/dist/chunks/rewind-D12hCfZD.js +1 -0
  401. package/dist/chunks/ripgrep-BQgJ02F9.js +1 -0
  402. package/dist/chunks/ripgrep-BvDwiKJ3.js +5 -0
  403. package/dist/chunks/rollback-BPWRKlIZ.js +11 -0
  404. package/dist/chunks/rolldown-runtime-DaDcL9Zw.js +1 -0
  405. package/dist/chunks/runtimeObserver-BNH2WGE3.js +1 -0
  406. package/dist/chunks/runtimeObserver-Ci-5gvYg.js +10 -0
  407. package/dist/chunks/sandbox-adapter-Coe1GDAE.js +1 -0
  408. package/dist/chunks/sandbox-toggle-B2Yk4y2V.js +1 -0
  409. package/dist/chunks/sanitization-DV-94a9Z.js +1 -0
  410. package/dist/chunks/satisfies-DQJHNtpQ.js +1 -0
  411. package/dist/chunks/sdkHeapDumpMonitor-WdXUV7DV.js +1 -0
  412. package/dist/chunks/searchExtraTools-BnWZ9roi.js +1 -0
  413. package/dist/chunks/semver-BMRJYn3q.js +1 -0
  414. package/dist/chunks/semver-DQo45qGo.js +1 -0
  415. package/dist/chunks/serde-f76bObzR.js +4 -0
  416. package/dist/chunks/server-LdbAb0sV.js +1 -0
  417. package/dist/chunks/serverBanner-BdExKFHT.js +1 -0
  418. package/dist/chunks/serverLog-BFmvyJ93.js +1 -0
  419. package/dist/chunks/session-Bmx7L3Mt.js +2 -0
  420. package/dist/chunks/sessionDataUploader-CaCjwsA2.js +1 -0
  421. package/dist/chunks/sessionDiscovery-DcEAr5vJ.js +1 -0
  422. package/dist/chunks/sessionFileAccessHooks-BhdOmW9o.js +1 -0
  423. package/dist/chunks/sessionManager-CPa049BO.js +1 -0
  424. package/dist/chunks/sessionMemory-Bsg2unYX.js +1 -0
  425. package/dist/chunks/sessionMemory-CIbCojm-.js +1 -0
  426. package/dist/chunks/sessionMemoryUtils-Cjb57wtC.js +1 -0
  427. package/dist/chunks/sessionObserver-CRU1qWnP.js +1 -0
  428. package/dist/chunks/sessionObserver-DQwHsDrM.js +20 -0
  429. package/dist/chunks/sessionStorage-BxDN8qRc.js +1 -0
  430. package/dist/chunks/sessionStoragePortable-Cx6JQ5Ye.js +3 -0
  431. package/dist/chunks/sessionTitle-B8jcexkQ.js +14 -0
  432. package/dist/chunks/sessionTracing-BuLsL6qA.js +11 -0
  433. package/dist/chunks/settings-5PQdphqC.js +19 -0
  434. package/dist/chunks/settingsSync-BDeuErb5.js +1 -0
  435. package/dist/chunks/setup-BKEnSLR9.js +3 -0
  436. package/dist/chunks/shadowedRuleDetection-7Z8ezTKF.js +1 -0
  437. package/dist/chunks/shellQuote-fB02N16J.js +4 -0
  438. package/dist/chunks/sideQuestion-CYdNATPW.js +20 -0
  439. package/dist/chunks/signin-CPaEtsnK.js +1 -0
  440. package/dist/chunks/sink-DjKoYMsA.js +1 -0
  441. package/dist/chunks/sink-iYxWapbU.js +1 -0
  442. package/dist/chunks/sinks-GryGVRT8.js +2 -0
  443. package/dist/chunks/sinks-jfaIjsRJ.js +1 -0
  444. package/dist/chunks/skill-learning-E8tQed-Q.js +5 -0
  445. package/dist/chunks/skillChangeDetector-A8SAuyo9.js +1 -0
  446. package/dist/chunks/skillGapStore-B5rl12bV.js +1 -0
  447. package/dist/chunks/skillGapStore-CjJrxxjk.js +5 -0
  448. package/dist/chunks/skillGenerator-BDR_z3-X.js +8 -0
  449. package/dist/chunks/skillLearning-BQtfFE0g.js +1 -0
  450. package/dist/chunks/skillLearning-C8ihdryM.js +1 -0
  451. package/dist/chunks/skillPanel-yR8Oi-mO.js +28 -0
  452. package/dist/chunks/skillSearchPanel-DUQQUCUS.js +21 -0
  453. package/dist/chunks/skills-NAZQ3j-t.js +1 -0
  454. package/dist/chunks/slashCommandParsing-RQb_7Xzt.js +1 -0
  455. package/dist/chunks/src-CDCSSo0U2.js +53 -0
  456. package/dist/chunks/src-CHw1lvBc.js +3 -0
  457. package/dist/chunks/src-CST_jFnT.js +1 -0
  458. package/dist/chunks/src-CgZmCiiH.js +2 -0
  459. package/dist/chunks/src-CiJCsqUl.js +9 -0
  460. package/dist/chunks/src-D06Xyj4g.js +2 -0
  461. package/dist/chunks/src-DCUgdrYl.js +5 -0
  462. package/dist/chunks/src-DLz3FZm1.js +1 -0
  463. package/dist/chunks/src-DPUAq5Ty.js +1 -0
  464. package/dist/chunks/src-DQOX_xI1.js +1 -0
  465. package/dist/chunks/src-Dt5IJd3C.js +1 -0
  466. package/dist/chunks/src-Dvp6-vB7.js +19 -0
  467. package/dist/chunks/src-PM8NIIu_.js +1 -0
  468. package/dist/chunks/src-l6_O0K-a.js +1 -0
  469. package/dist/chunks/src-xRRBgNzF.js +25 -0
  470. package/dist/chunks/sso-oidc-DFJ7SBvI.js +1 -0
  471. package/dist/chunks/startupProfiler-B0m6crkd.js +1 -0
  472. package/dist/chunks/startupProfiler-DxRQteII.js +3 -0
  473. package/dist/chunks/state-4KQ3kaqz.js +1 -0
  474. package/dist/chunks/state-53JDbNQM.js +1 -0
  475. package/dist/chunks/state-Cn_m2NOf.js +1 -0
  476. package/dist/chunks/staticRender-BIxpgNUq.js +1 -0
  477. package/dist/chunks/stats-h4yu84Q-.js +1 -0
  478. package/dist/chunks/status-BbdeubJG.js +1 -0
  479. package/dist/chunks/status-is_Bg_IB.js +2 -0
  480. package/dist/chunks/statusNoticeHelpers-CQ7CUugR.js +1 -0
  481. package/dist/chunks/stdio-4S7b8Uhx.js +1 -0
  482. package/dist/chunks/stdio-W_Kokrkh.js +3 -0
  483. package/dist/chunks/stickers-qJoNhPk4.js +1 -0
  484. package/dist/chunks/store-Z8rTjDHe.js +1 -0
  485. package/dist/chunks/stringUtils-CvXbHQRH.js +4 -0
  486. package/dist/chunks/sts-C2Gf2WYN.js +1 -0
  487. package/dist/chunks/subprocessEnv-BSQSomcK.js +1 -0
  488. package/dist/chunks/subprocessEnv-vrwzMgKn.js +1 -0
  489. package/dist/chunks/supports-color-uJ1LqA-P.js +1 -0
  490. package/dist/chunks/systemPromptSections-CgpggIYX.js +1 -0
  491. package/dist/chunks/systemPromptSections-IePG5K8r.js +1 -0
  492. package/dist/chunks/systemTheme-Ceakddth.js +1 -0
  493. package/dist/chunks/tag-i3HZ4lhj.js +11 -0
  494. package/dist/chunks/tasks-HzsYNTZ1.js +1 -0
  495. package/dist/chunks/teleport-hN3cAbYC.js +1 -0
  496. package/dist/chunks/templateJobs-CIv_ysje.js +12 -0
  497. package/dist/chunks/terminalSetup-C0PF87iu.js +33 -0
  498. package/dist/chunks/terminalSetup-CxniwSF-.js +1 -0
  499. package/dist/chunks/theme-BKIHX_Dx.js +1 -0
  500. package/dist/chunks/thinkback-BA4cMz4D.js +1 -0
  501. package/dist/chunks/thinkback-mT-8FIT-.js +1 -0
  502. package/dist/chunks/thinkback-play-Cfk49mvF.js +1 -0
  503. package/dist/chunks/tmux-CbsW-VDJ.js +1 -0
  504. package/dist/chunks/toolEventObserver-8FQtxeVv.js +1 -0
  505. package/dist/chunks/toolEventObserver-B1xvyKdE.js +1 -0
  506. package/dist/chunks/toolPool-CHVDZqh7.js +1 -0
  507. package/dist/chunks/trustedDevice-BYCh1ff7.js +1 -0
  508. package/dist/chunks/trustedDevice-DnIWErCt.js +1 -0
  509. package/dist/chunks/tui-fTa_pzdA.js +6 -0
  510. package/dist/chunks/types-BUyOCzUt.js +1 -0
  511. package/dist/chunks/types-Czs-_G1S.js +3 -0
  512. package/dist/chunks/types-a7X-tJpJ.js +17 -0
  513. package/dist/chunks/udsClient-Cg9bBD0p.js +1 -0
  514. package/dist/chunks/ultrareviewCommand-DCFRZsKp.js +3 -0
  515. package/dist/chunks/undercover-B-kKUWtK.js +1 -0
  516. package/dist/chunks/undercover-CsLPQb-a.js +31 -0
  517. package/dist/chunks/up-dO5BcPaq.js +12 -0
  518. package/dist/chunks/updateCCB-CfUnkOLT.js +11 -0
  519. package/dist/chunks/upgrade-CngUwvY4.js +1 -0
  520. package/dist/chunks/upgrade-kpttjebY.js +1 -0
  521. package/dist/chunks/upload-DDhQqV8n.js +1 -0
  522. package/dist/chunks/upstreamproxy-CvcjNY7J.js +11 -0
  523. package/dist/chunks/usage-CJ5w0907.js +1 -0
  524. package/dist/chunks/usage-eZRwLa77.js +1 -0
  525. package/dist/chunks/useExitOnCtrlCDWithKeybindings-yAroCqu4.js +1 -0
  526. package/dist/chunks/useMainLoopModel-BNFW-g8E.js +1 -0
  527. package/dist/chunks/useManagePlugins-CTtPaQRP.js +1 -0
  528. package/dist/chunks/useMergedTools-CZJffsmf.js +1 -0
  529. package/dist/chunks/useSearchInput-C-CqUK6w.js +1 -0
  530. package/dist/chunks/useSettingsErrors-BWlJCgYF.js +1 -0
  531. package/dist/chunks/util-DJV0joAW.js +1 -0
  532. package/dist/chunks/v4-jw6qOKwQ.js +65 -0
  533. package/dist/chunks/validatePlugin-CRmpIGLV.js +1 -0
  534. package/dist/chunks/vertex-sdk-DjXcZ2J7.js +9 -0
  535. package/dist/chunks/vim-n8-UT5w-.js +1 -0
  536. package/dist/chunks/which-BBCjXfI2.js +1 -0
  537. package/dist/chunks/windowsPaths-D6T_3XaU.js +1 -0
  538. package/dist/chunks/windowsPaths-DUKTzBck.js +1 -0
  539. package/dist/chunks/workSecret-C_lv0dRh.js +1 -0
  540. package/dist/chunks/workerRegistry-BdHi7_sN.js +1 -0
  541. package/dist/chunks/worktree-YDeHMlHZ.js +1 -0
  542. package/dist/chunks/worktreeModeEnabled-BFOYTTTr.js +1 -0
  543. package/dist/chunks/worktreeModeEnabled-D68iEHpC.js +1 -0
  544. package/dist/chunks/wrapper-K8ZapJVu.js +6 -0
  545. package/dist/chunks/xdg-DcF9ejUM.js +1 -0
  546. package/dist/chunks/zod-CuNujUwx.js +1 -0
  547. package/dist/cli-bun.js +2 -0
  548. package/dist/cli-node.js +2 -0
  549. package/dist/cli.js +2 -0
  550. package/dist/vendor/ripgrep/x64-linux/rg +0 -0
  551. package/package.json +218 -0
  552. package/scripts/postinstall.cjs +389 -0
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{B as n,E as r,O as i,U as a,l as o,p as s,z as c}from"./debug-IKW-jE7K.js";import{M as l,j as u}from"./git-tyaWOgRL.js";import{lr as d,ur as f,vn as p,yn as m}from"./model-DfFA3qMO.js";import{l as h,r as g}from"./proxy-Cn2YwITp.js";import{D as _,E as v,O as y,a as b,l as x,r as S}from"./rcDebugLog-BUuD-X1D.js";import{n as C}from"./jwtUtils-C-ojmb8W.js";import{randomUUID as w}from"crypto";a(),o(),u(),h(),f(),p(),y(),S(),r(),e();var T=class extends Error{constructor(e,n){super(e),t(this,`retryAfterMs`,void 0),this.retryAfterMs=n}},E=class{constructor(e){t(this,`pending`,[]),t(this,`pendingAtClose`,0),t(this,`draining`,!1),t(this,`closed`,!1),t(this,`backpressureResolvers`,[]),t(this,`sleepResolve`,null),t(this,`flushResolvers`,[]),t(this,`droppedBatches`,0),t(this,`config`,void 0),this.config=e}get droppedBatchCount(){return this.droppedBatches}get pendingCount(){return this.closed?this.pendingAtClose:this.pending.length}async enqueue(e){if(this.closed)return;let t=Array.isArray(e)?e:[e];if(t.length!==0){for(;this.pending.length+t.length>this.config.maxQueueSize&&!this.closed;)await new Promise(e=>{this.backpressureResolvers.push(e)});this.closed||(this.pending.push(...t),this.drain())}}flush(){return this.pending.length===0&&!this.draining?Promise.resolve():(this.drain(),new Promise(e=>{this.flushResolvers.push(e)}))}close(){if(!this.closed){this.closed=!0,this.pendingAtClose=this.pending.length,this.pending=[],this.sleepResolve?.(),this.sleepResolve=null;for(let e of this.backpressureResolvers)e();this.backpressureResolvers=[];for(let e of this.flushResolvers)e();this.flushResolvers=[]}}async drain(){if(this.draining||this.closed)return;this.draining=!0;let e=0;try{for(;this.pending.length>0&&!this.closed;){let t=this.takeBatch();if(t.length!==0){try{await this.config.send(t),e=0}catch(n){if(e++,this.config.maxConsecutiveFailures!==void 0&&e>=this.config.maxConsecutiveFailures){this.droppedBatches++,this.config.onBatchDropped?.(t.length,e),e=0,this.releaseBackpressure();continue}this.pending=t.concat(this.pending);let r=n instanceof T?n.retryAfterMs:void 0;await this.sleep(this.retryDelay(e,r));continue}this.releaseBackpressure()}}}finally{if(this.draining=!1,this.pending.length===0){for(let e of this.flushResolvers)e();this.flushResolvers=[]}}}takeBatch(){let{maxBatchSize:e,maxBatchBytes:t}=this.config;if(t===void 0)return this.pending.splice(0,e);let n=0,r=0;for(;r<this.pending.length&&r<e;){let e;try{e=Buffer.byteLength(i(this.pending[r]))}catch{this.pending.splice(r,1);continue}if(r>0&&n+e>t)break;n+=e,r++}return this.pending.splice(0,r)}retryDelay(e,t){let n=Math.random()*this.config.jitterMs;return t===void 0?Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+n:Math.max(this.config.baseDelayMs,Math.min(t,this.config.maxDelayMs))+n}releaseBackpressure(){let e=this.backpressureResolvers;this.backpressureResolvers=[];for(let t of e)t()}sleep(e){return new Promise(t=>{this.sleepResolve=t,setTimeout((e,t)=>{e.sleepResolve=null,t()},e,this,t)})}};e();var D=class{constructor(e){t(this,`inflight`,null),t(this,`pending`,null),t(this,`closed`,!1),t(this,`config`,void 0),this.config=e}enqueue(e){this.closed||(this.pending=this.pending?O(this.pending,e):e,this.drain())}close(){this.closed=!0,this.pending=null}async drain(){if(this.inflight||this.closed||!this.pending)return;let e=this.pending;this.pending=null,this.inflight=this.sendWithRetry(e).then(()=>{this.inflight=null,this.pending&&!this.closed&&this.drain()})}async sendWithRetry(e){let t=e,n=0;for(;!this.closed;){if(await this.config.send(t))return;n++,await m(this.retryDelay(n)),this.pending&&!this.closed&&(t=O(t,this.pending),this.pending=null)}}retryDelay(e){return Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+Math.random()*this.config.jitterMs}};function O(e,t){let n={...e};for(let[e,r]of Object.entries(t))(e===`external_metadata`||e===`internal_metadata`)&&n[e]&&typeof n[e]==`object`&&typeof r==`object`&&r?n[e]={...n[e],...r}:n[e]=r;return n}p(),e();var k=2e4,A=100;function j(){return!0}var M=class extends Error{constructor(e){super(`CCRClient init failed: ${e}`),t(this,`reason`,void 0),this.reason=e}},N=10;function P(){return{byMessage:new Map,scopeToMessage:new Map}}function F(e){return`${e.session_id}:${e.parent_tool_use_id??``}`}function I(e,t){let n=[],r=new Map;for(let i of e){let e=i.event;switch(e.type){case`message_start`:{let r=e.message.id,a=t.scopeToMessage.get(F(i));a&&t.byMessage.delete(a),t.scopeToMessage.set(F(i),r),t.byMessage.set(r,[]),n.push(i);break}case`content_block_delta`:{let a=e.delta;if(a.type!==`text_delta`){n.push(i);break}let o=t.scopeToMessage.get(F(i)),s=o?t.byMessage.get(o):void 0;if(!s){n.push(i);break}let c=e.index,l=s[c]??(s[c]=[]);l.push(a.text);let u=r.get(l);if(u){u.event.delta={type:`text_delta`,text:l.join(``)};break}let d={type:`stream_event`,uuid:i.uuid,session_id:i.session_id,parent_tool_use_id:i.parent_tool_use_id,event:{type:`content_block_delta`,index:c,delta:{type:`text_delta`,text:l.join(``)}}};r.set(l,d),n.push(d);break}default:n.push(i)}}return n}function L(e,t){e.byMessage.delete(t.message.id);let n=F(t);e.scopeToMessage.get(n)===t.message.id&&e.scopeToMessage.delete(n)}var R=class{constructor(e,n,r){if(t(this,`workerEpoch`,0),t(this,`heartbeatIntervalMs`,void 0),t(this,`heartbeatJitterFraction`,void 0),t(this,`heartbeatTimer`,null),t(this,`heartbeatInFlight`,!1),t(this,`closed`,!1),t(this,`consecutiveAuthFailures`,0),t(this,`currentState`,null),t(this,`sessionBaseUrl`,void 0),t(this,`sessionId`,void 0),t(this,`http`,g({keepAlive:!0})),t(this,`streamEventBuffer`,[]),t(this,`streamEventTimer`,null),t(this,`streamTextAccumulator`,P()),t(this,`workerState`,void 0),t(this,`eventUploader`,void 0),t(this,`internalEventUploader`,void 0),t(this,`deliveryUploader`,void 0),t(this,`onEpochMismatch`,void 0),t(this,`getAuthHeaders`,void 0),this.onEpochMismatch=r?.onEpochMismatch??(()=>{process.exit(1)}),this.heartbeatIntervalMs=r?.heartbeatIntervalMs??k,this.heartbeatJitterFraction=r?.heartbeatJitterFraction??0,this.getAuthHeaders=r?.getAuthHeaders??v,n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`CCRClient: Expected http(s) URL, got ${n.protocol}`);let i=n.pathname.replace(/\/$/,``);this.sessionBaseUrl=`${n.protocol}//${n.host}${i}`,this.sessionId=i.split(`/`).pop()||``,this.workerState=new D({send:e=>this.request(`put`,`/worker`,{worker_epoch:this.workerEpoch,...e},`PUT worker`).then(e=>e.ok),baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.eventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:1e5,send:async e=>{let t=await this.request(`post`,`/worker/events`,{worker_epoch:this.workerEpoch,events:e},`client events`);if(!t.ok)throw new T(`client event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.internalEventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:200,send:async e=>{let t=await this.request(`post`,`/worker/internal-events`,{worker_epoch:this.workerEpoch,events:e},`internal events`);if(!t.ok)throw new T(`internal event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.deliveryUploader=new E({maxBatchSize:64,maxQueueSize:64,send:async e=>{let t=await this.request(`post`,`/worker/events/delivery`,{worker_epoch:this.workerEpoch,updates:e.map(e=>({event_id:e.eventId,status:e.status}))},`delivery batch`);if(!t.ok)throw new T(`delivery POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),e.setOnEvent(e=>{this.reportDelivery(e.event_id,`received`)})}async initialize(e){let t=Date.now();if(Object.keys(this.getAuthHeaders()).length===0)throw new M(`no_auth_headers`);if(e===void 0){let t=process.env.CLAUDE_CODE_WORKER_EPOCH;e=t?parseInt(t,10):NaN}if(isNaN(e))throw new M(`missing_epoch`);this.workerEpoch=e;let n=this.getWorkerState();if(!(await this.request(`put`,`/worker`,{worker_status:`idle`,worker_epoch:this.workerEpoch,external_metadata:{pending_action:null,task_summary:null,automation_state:null}},`PUT worker (init)`)).ok)throw new M(`worker_register_failed`);this.currentState=`idle`,this.startHeartbeat(),b(()=>{this.writeEvent({type:`keep_alive`})}),s(`CCRClient: initialized, epoch=${this.workerEpoch}`),l(`info`,`cli_worker_lifecycle_initialized`,{epoch:this.workerEpoch,duration_ms:Date.now()-t});let{metadata:r,durationMs:i}=await n;return this.closed||l(`info`,`cli_worker_state_restored`,{duration_ms:i,had_state:r!==null}),r}async getWorkerState(){let e=Date.now(),t=this.getAuthHeaders();return Object.keys(t).length===0?{metadata:null,durationMs:0}:{metadata:(await this.getWithRetry(`${this.sessionBaseUrl}/worker`,t,`worker_state`))?.worker?.external_metadata??null,durationMs:Date.now()-e}}async request(e,t,r,i,{timeout:a=1e4}={}){let o=this.getAuthHeaders();if(Object.keys(o).length===0)return{ok:!1};try{let n=await this.http[e](`${this.sessionBaseUrl}${t}`,r,{headers:{...o,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":d()},validateStatus:j,timeout:a});if(n.status>=200&&n.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(n.status===409&&this.handleEpochMismatch(),n.status===401||n.status===403){let e=_(),t=e?C(e):null;t!==null&&t*1e3<Date.now()&&(s(`CCRClient: session_token expired (exp=${new Date(t*1e3).toISOString()}) — no refresh was delivered, exiting`,{level:`error`}),l(`error`,`cli_worker_token_expired_no_refresh`),this.onEpochMismatch()),this.consecutiveAuthFailures++,this.consecutiveAuthFailures>=N&&(s(`CCRClient: ${this.consecutiveAuthFailures} consecutive auth failures with a valid-looking token — server-side auth unrecoverable, exiting`,{level:`error`}),l(`error`,`cli_worker_auth_failures_exhausted`),this.onEpochMismatch())}if(s(`CCRClient: ${i} returned ${n.status}`,{level:`warn`}),l(`warn`,`cli_worker_request_failed`,{method:e,path:t,status:n.status}),n.status===429){let e=n.headers?.[`retry-after`],t=typeof e==`string`?parseInt(e,10):NaN;if(!isNaN(t)&&t>=0)return{ok:!1,retryAfterMs:t*1e3}}return{ok:!1}}catch(r){return s(`CCRClient: ${i} failed: ${c(r)}`,{level:`warn`}),l(`warn`,`cli_worker_request_error`,{method:e,path:t,error_code:n(r)}),{ok:!1}}}reportState(e,t){e===this.currentState&&!t||(this.currentState=e,this.workerState.enqueue({worker_status:e,requires_action_details:t?{tool_name:t.tool_name,action_description:t.action_description,request_id:t.request_id}:null}))}reportMetadata(e){this.workerState.enqueue({external_metadata:e})}handleEpochMismatch(){s(`CCRClient: Epoch mismatch (409), shutting down`,{level:`error`}),l(`error`,`cli_worker_epoch_mismatch`),this.onEpochMismatch()}startHeartbeat(){this.stopHeartbeat();let e=()=>{let e=this.heartbeatIntervalMs*this.heartbeatJitterFraction*(2*Math.random()-1);this.heartbeatTimer=setTimeout(t,this.heartbeatIntervalMs+e)},t=()=>{this.sendHeartbeat(),this.heartbeatTimer!==null&&e()};e()}stopHeartbeat(){this.heartbeatTimer&&(clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null)}async sendHeartbeat(){if(!this.heartbeatInFlight){this.heartbeatInFlight=!0;try{(await this.request(`post`,`/worker/heartbeat`,{session_id:this.sessionId,worker_epoch:this.workerEpoch},`Heartbeat`,{timeout:5e3})).ok&&s(`CCRClient: Heartbeat sent`)}finally{this.heartbeatInFlight=!1}}}async writeEvent(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>void this.flushStreamEventBuffer(),A));return}await this.flushStreamEventBuffer(),e.type===`assistant`&&L(this.streamTextAccumulator,e),await this.eventUploader.enqueue(this.toClientEvent(e))}toClientEvent(e){let t=e;return{payload:{...t,uuid:typeof t.uuid==`string`?t.uuid:w()}}}async flushStreamEventBuffer(){if(this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer.length===0)return;let e=this.streamEventBuffer;this.streamEventBuffer=[];let t=I(e,this.streamTextAccumulator);await this.eventUploader.enqueue(t.map(e=>({payload:e,ephemeral:!0})))}async writeInternalEvent(e,t,{isCompaction:n=!1,agentId:r}={}){let i={payload:{type:e,...t,uuid:typeof t.uuid==`string`?t.uuid:w()},...n&&{is_compaction:!0},...r&&{agent_id:r}};await this.internalEventUploader.enqueue(i)}flushInternalEvents(){return this.internalEventUploader.flush()}async flush(){return await this.flushStreamEventBuffer(),this.eventUploader.flush()}async readInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{},`internal_events`)}async readSubagentInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{subagents:`true`},`subagent_events`)}async paginatedGet(e,t,n){let r=this.getAuthHeaders();if(Object.keys(r).length===0)return null;let i=[],a;do{let o=new URL(`${this.sessionBaseUrl}${e}`);for(let[e,n]of Object.entries(t))o.searchParams.set(e,n);a&&o.searchParams.set(`cursor`,a);let s=await this.getWithRetry(o.toString(),r,n);if(!s)return null;i.push(...s.data??[]),a=s.next_cursor}while(a);return s(`CCRClient: Read ${i.length} internal events from ${e}${t.subagents?` (subagents)`:``}`),i}async getWithRetry(e,t,n){for(let n=1;n<=10;n++){let r;try{r=await this.http.get(e,{headers:{...t,"anthropic-version":`2023-06-01`,"User-Agent":d()},validateStatus:j,timeout:3e4})}catch(t){s(`CCRClient: GET ${e} failed (attempt ${n}/10): ${c(t)}`,{level:`warn`}),n<10&&await m(Math.min(500*2**(n-1),3e4)+Math.random()*500);continue}if(r.status>=200&&r.status<300)return r.data;r.status===409&&this.handleEpochMismatch(),s(`CCRClient: GET ${e} returned ${r.status} (attempt ${n}/10)`,{level:`warn`}),n<10&&await m(Math.min(500*2**(n-1),3e4)+Math.random()*500)}return s(`CCRClient: GET retries exhausted`,{level:`error`}),l(`error`,`cli_worker_get_retries_exhausted`,{context:n}),null}reportDelivery(e,t){this.deliveryUploader.enqueue({eventId:e,status:t})}getWorkerEpoch(){return this.workerEpoch}get internalEventsPending(){return this.internalEventUploader.pendingCount}close(){this.closed=!0,this.stopHeartbeat(),x(),this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[],this.streamTextAccumulator.byMessage.clear(),this.streamTextAccumulator.scopeToMessage.clear(),this.workerState.close(),this.eventUploader.close(),this.internalEventUploader.close(),this.deliveryUploader.close()}};export{M as n,E as r,R as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{r,u as i}from"./serde-f76bObzR.js";import{createHash as a,createHmac as o}from"node:crypto";import*as s from"node:zlib";var c,l,u,d=e((()=>{t(),c=new Uint32Array(256);for(let e=0;e<256;++e){let t=e;for(let e=0;e<8;++e)t=t&1?3988292384^t>>>1:t>>>1;c[e]=t>>>0}l=4294967295,u=class{constructor(){n(this,`digestLength`,4),n(this,`checksum`,l)}update(e){for(let t=0;t<e.length;++t)this.checksum=this.checksum>>>8^c[(this.checksum^e[t])&255]}digestSync(){return(this.checksum^l)>>>0}async digest(){let e=this.digestSync(),t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!1),t}reset(){this.checksum=l}}}));function f(e){return class{constructor(){n(this,`digestLength`,4),n(this,`value`,0)}update(t){this.value=e(t,this.value)}digestSync(){return this.value>>>0}async digest(){let e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,this.digestSync(),!1),e}reset(){this.value=0}}}var p,m,h=e((()=>{d(),t(),p=typeof s.crc32==`function`?s.crc32:void 0,m=p?f(p):u})),g,_,v,y,b,x,S=e((()=>{r(),t(),g=64,_=32,v=2**53-1,y=class e{constructor(t){if(n(this,`digestLength`,_),n(this,`state`,Int32Array.from(b)),n(this,`w`,void 0),n(this,`buffer`,new Uint8Array(64)),n(this,`bufferLength`,0),n(this,`bytesHashed`,0),n(this,`finished`,!1),n(this,`inner`,void 0),n(this,`outer`,void 0),t){let n=e.normalizeKey(t);this.inner=new e,this.outer=new e;let{inner:r,outer:i}=this,a=new Uint8Array(g*2);for(let e=0;e<g;++e)a[e]=54^n[e],a[e+g]=92^n[e];r.update(a.subarray(0,g)),i.update(a.subarray(g))}}update(e){if(this.finished)throw Error(`Attempted to update an already finished HMAC.`);if(this.inner){this.inner.update(e);return}let t=i(e),n=0,{byteLength:r}=t;if(this.bytesHashed+=r,this.bytesHashed*8>v)throw Error(`Cannot hash more than 2^53 - 1 bits`);for(;r>0;)this.buffer[this.bufferLength++]=t[n++],r--,this.bufferLength===g&&(this.hashBuffer(),this.bufferLength=0)}async digest(){let{inner:e,outer:t}=this;if(e&&t){if(this.finished)throw Error(`Attempted to digest an already finished HMAC.`);this.finished=!0;let n=e.digestSync();return t.update(n),t.digestSync()}return this.digestSync()}reset(){this.state=Int32Array.from(b),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0}digestSync(){let e=this.state.slice(),t=this.buffer.slice(),n=this.bufferLength,r=this.bytesHashed*8,i=new DataView(t.buffer,t.byteOffset,t.byteLength);if(i.setUint8(n++,128),(n-1)%g>=g-8){for(let e=n;e<g;++e)i.setUint8(e,0);this.hashBufferWith(e,t),n=0}for(let e=n;e<g-8;++e)i.setUint8(e,0);i.setUint32(g-8,Math.floor(r/4294967296),!1),i.setUint32(g-4,r,!1),this.hashBufferWith(e,t);let a=new Uint8Array(_);for(let t=0;t<8;++t)a[t*4]=e[t]>>>24&255,a[t*4+1]=e[t]>>>16&255,a[t*4+2]=e[t]>>>8&255,a[t*4+3]=e[t]>>>0&255;return a}static normalizeKey(t){let n=i(t);if(n.byteLength>g){let t=new e;t.update(n);let r=t.digestSync(),i=new Uint8Array(g);return i.set(r),i}if(n.byteLength<g){let e=new Uint8Array(g);return e.set(n),e}return n}hashBuffer(){this.hashBufferWith(this.state,this.buffer)}hashBufferWith(e,t){let n=this.w??(this.w=new Int32Array(64)),r=e[0],i=e[1],a=e[2],o=e[3],s=e[4],c=e[5],l=e[6],u=e[7];for(let e=0;e<g;++e){if(e<16)n[e]=(t[e*4]&255)<<24|(t[e*4+1]&255)<<16|(t[e*4+2]&255)<<8|t[e*4+3]&255;else{let t=n[e-2],r=(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10;t=n[e-15];let i=(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3;n[e]=(r+n[e-7]|0)+(i+n[e-16]|0)}let d=(((s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+(s&c^~s&l)|0)+(u+(x[e]+n[e]|0)|0)|0,f=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&i^r&a^i&a)|0;u=l,l=c,c=s,s=o+d|0,o=a,a=i,i=r,r=d+f|0}e[0]+=r,e[1]+=i,e[2]+=a,e[3]+=o,e[4]+=s,e[5]+=c,e[6]+=l,e[7]+=u}},b=new Int32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),x=new Int32Array([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])}));function C(){return class{constructor(e){n(this,`digestLength`,32),n(this,`secret`,void 0),n(this,`hash`,void 0),n(this,`isHmac`,void 0),n(this,`finished`,!1),this.secret=e,this.isHmac=!!e,this.hash=this.createHash()}update(e){if(this.finished)throw Error(`Attempted to update an already finished hash.`);this.hash.update(e)}async digest(){let e;return this.isHmac?(this.finished=!0,e=this.hash.digest()):e=this.hash.copy().digest(),new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}reset(){this.hash=this.createHash(),this.finished=!1}createHash(){return this.secret?o(`sha256`,w(this.secret)):a(`sha256`)}}}function w(e){return typeof e==`string`?e:ArrayBuffer.isView(e)?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e)}var T,E,D=e((()=>{S(),t(),T=(()=>{try{return a(`sha256`),!0}catch{return!1}})(),E=T?C():y})),O=e((()=>{d(),h(),S(),D()}));export{h as a,m as i,E as n,D as r,O as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";function t(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}var n=e((()=>{}));function r(e,n,r){t(e,n),n.set(e,r)}var i=e((()=>{n()}));function a(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}var o=e((()=>{}));function s(e,t){return e.get(a(e,t))}var c=e((()=>{o()}));function l(e,t,n){return e.set(a(e,t),n),n}var u=e((()=>{o()}));export{a,i as c,c as i,t as l,u as n,o,s as r,r as s,l as t,n as u};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,u as n}from"./classPrivateFieldSet2-D4U5K-I3.js";function r(e,n){t(e,n),n.add(e)}var i=e((()=>{n()}));export{i as n,r as t};
@@ -0,0 +1 @@
1
+ import{B as e,U as t}from"./debug-IKW-jE7K.js";import{o as n,s as r}from"./log-B3eB4EFv.js";import{i,o as a,t as o}from"./platform-EtecGacO.js";import{a as s,i as c,s as l,u}from"./types-a7X-tJpJ.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";s(),t(),l(),n(),a();async function g(){let e=i();if(!o.includes(e))throw Error(`Unsupported platform: ${e} - Claude Desktop integration only works on macOS and WSL.`);if(e===`macos`)return f(d(),`Library`,`Application Support`,`Claude`,`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/Claude/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`,`Claude`,`claude_desktop_config.json`);try{return await h(t),t}catch{}}}catch{}}catch(e){r(e)}throw Error(`Could not find Claude Desktop config file in Windows. Make sure Claude Desktop is installed on Windows.`)}async function _(){if(!o.includes(i()))throw Error(`Unsupported platform - Claude Desktop integration only works on macOS and WSL.`);try{let t=await g(),n;try{n=await p(t,{encoding:`utf8`})}catch(t){if(e(t)===`ENOENT`)return{};throw t}let r=u(n);if(!r||typeof r!=`object`)return{};let i=r.mcpServers;if(!i||typeof i!=`object`)return{};let a={};for(let[e,t]of Object.entries(i)){if(!t||typeof t!=`object`)continue;let n=c().safeParse(t);n.success&&(a[e]=n.data)}return a}catch(e){return r(e),{}}}export{_ as readClaudeDesktopMcpServers};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-GJxfkr6M.js";var r;e((()=>{t(),r=async(e,t)=>(await n(t),{type:`text`,value:``})}))();export{r as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./bundledMode--fG1S62b.js";import{i as r,r as i}from"./shellQuote-fB02N16J.js";import{spawn as a}from"child_process";function o(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];if(i===`-d`||i.startsWith(`-d `)||i.startsWith(`-d `)){n.push(i),i===`-d`&&r+1<e.length&&n.push(e[++r]);continue}if(i.startsWith(`-d`)&&i.includes(`:`)){n.push(i);continue}if(i===`--feature`){n.push(i),r+1<e.length&&n.push(e[++r]);continue}if(/^--inspect(-brk)?(=|$)/.test(i)){n.push(i);continue}if(i.startsWith(`--`)&&!i.includes(`=`)&&r+1<e.length){if(t())continue;n.push(i),n.push(e[++r]);continue}i.startsWith(`-`)&&!t()&&n.push(i)}return n}function s(e,n){let r=n?.env??process.env,i=t()||!p?[...f,...e]:[...f,p,...e],a={...r};return h&&(process.env.CLAUDE_CODE_GIT_BASH_PATH&&!a.CLAUDE_CODE_GIT_BASH_PATH&&(a.CLAUDE_CODE_GIT_BASH_PATH=process.env.CLAUDE_CODE_GIT_BASH_PATH),process.env.SHELL&&!a.SHELL&&(a.SHELL=process.env.SHELL)),{execPath:m,args:i,env:a,windowsHide:h}}function c(e,t){return a(e.execPath,e.args,{...t,env:{...e.env,...t.env},windowsHide:e.windowsHide})}function l(e){return r([e.execPath,...e.args])}function u(){return f}function d(){return p}var f,p,m,h,g=e((()=>{n(),i(),f=Object.freeze(o(process.execArgv)),p=process.argv[1],m=process.execPath,h=process.platform===`win32`}));export{l as a,g as i,u as n,c as o,d as r,s as t};
@@ -0,0 +1 @@
1
+ import{Hr as e,Ur as t}from"./model-DfFA3qMO.js";t();export{e as getOrganizationUUID};
@@ -0,0 +1,36 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";function t(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var n,r=e((()=>{n=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)}})),i,a,o,s,c,l,u,d,f,p,ee,m,te,h=e((()=>{r(),i=class extends Error{},a=class e extends i{constructor(t,n,r,i,a){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`request-id`),this.error=n,this.type=a??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,r,i,a){if(!t||!a)return new s({message:i,cause:n(r)});let o=r,c=o?.error?.type;return t===400?new l(t,o,i,a,c):t===401?new u(t,o,i,a,c):t===403?new d(t,o,i,a,c):t===404?new f(t,o,i,a,c):t===409?new p(t,o,i,a,c):t===422?new ee(t,o,i,a,c):t===429?new m(t,o,i,a,c):t>=500?new te(t,o,i,a,c):new e(t,o,i,a,c)}},o=class extends a{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},s=class extends a{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},c=class extends s{constructor({message:e}={}){super({message:e??`Request timed out.`})}},l=class extends a{},u=class extends a{},d=class extends a{},f=class extends a{},p=class extends a{},ee=class extends a{},m=class extends a{},te=class extends a{}}));function g(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function _(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var v=e((()=>{})),ne,re=e((()=>{ne=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return ne=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))}}));function ie(e){return typeof e==`object`?e??{}:{}}function ae(e){if(!e)return!0;for(let t in e)return!1;return!0}function oe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var se,ce,le,ue,de,fe,pe=e((()=>{h(),se=/^[a-z][a-z0-9+.-]*:/i,ce=e=>se.test(e),le=e=>(le=Array.isArray,le(e)),ue=le,de=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new i(`${e} must be an integer`);if(t<0)throw new i(`${e} must be a positive integer`);return t},fe=e=>{try{return JSON.parse(e)}catch{return}}})),me,he=e((()=>{me=e=>new Promise(t=>setTimeout(t,e))})),y,ge=e((()=>{y=`0.93.0`}));function _e(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}function ve(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}var ye,be,xe,Se,Ce,we,Te=e((()=>{ge(),ye=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`,be=()=>{let e=_e();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":y,"X-Stainless-OS":Se(Deno.build.os),"X-Stainless-Arch":xe(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":y,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":y,"X-Stainless-OS":Se(globalThis.process.platform??`unknown`),"X-Stainless-Arch":xe(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=ve();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":y,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":y,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}},xe=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,Se=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`),we=()=>Ce??(Ce=be())}));function Ee(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function De(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function Oe(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return De({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function ke(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}}}async function Ae(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var je=e((()=>{})),Me,Ne=e((()=>{Me=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)})}));function Pe(e){return Object.entries(e).filter(([e,t])=>t!==void 0).map(([e,t])=>{if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(t===null)return`${encodeURIComponent(e)}=`;throw new i(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join(`&`)}var Fe=e((()=>{h()}));function Ie(e){if(!e)return;let t;try{t=new URL(e)}catch(t){throw new x(`Invalid token endpoint base URL "${e}": ${t}`)}if(t.protocol===`https:`)return;let n=t.hostname.toLowerCase().replace(/^\[|\]$/g,``);if(!(t.protocol===`http:`&&(n===`localhost`||n===`127.0.0.1`||n===`::1`)))throw new x(`Refusing to send credential over non-https token endpoint "${e}"`)}async function Le(e,t){let n=await Be(e),r;try{r=JSON.parse(n)}catch{throw new x(`Token endpoint returned non-JSON response (status ${e.status})`,e.status,b(n),t)}if(!r.access_token)throw new x(`Token endpoint response missing access_token: ${JSON.stringify(b(r))}`,e.status,b(r),t);if(r.token_type&&r.token_type.toLowerCase()!==`bearer`)throw new x(`Token endpoint response: unsupported token_type "${r.token_type}" (want Bearer)`,e.status,b(r),t);return r}function b(e){if(e==null)return e;if(typeof e==`string`){let t;try{t=JSON.parse(e)}catch{return e.length<=qe?e:e.slice(0,qe)+`... <${e.length-qe} more chars>`}return JSON.stringify(b(t))}if(typeof e==`object`&&!Array.isArray(e)){let t={};for(let[n,r]of Object.entries(e))Je.has(n)&&(t[n]=r);return t}return null}async function Re(e,t=e=>console.warn(`anthropic-sdk: ${e}`)){if(typeof process>`u`||process.platform===`win32`)return;let n=await import(`node:fs`),r=e,i;try{r=await n.promises.realpath(e),i=await n.promises.stat(r)}catch{return}let a=i.mode&511;if(a&18)throw new x(`Credentials file at ${r} is group/world-writable (mode 0o${a.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${r}\`.`);if(a&36)throw new x(`Credentials file at ${r} is group/world-readable (mode 0o${a.toString(8)}); run \`chmod 600 ${r}\` before retrying.`);typeof process.getuid==`function`&&i.uid!==process.getuid()&&t(`credentials file at ${r} is owned by uid ${i.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function ze(e,t){let n=await import(`node:fs`),r=(await import(`node:path`)).dirname(e);await n.promises.mkdir(r,{recursive:!0,mode:448});let i=`${e}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let r=await n.promises.open(i,`w`,384);try{await r.writeFile(JSON.stringify(t,null,2)),await r.sync()}finally{await r.close()}await n.promises.rename(i,e)}catch(e){throw await n.promises.unlink(i).catch(()=>{}),e}try{let e=await n.promises.open(r,`r`);try{await e.sync()}finally{await e.close()}}catch{}}async function Be(e){if(!e.body)return``;let t=e.body.getReader(),n=[],r=0;for(;;){let{done:e,value:i}=await t.read();if(e)break;if(r+i.length>Ke){let e=Ke-r;e>0&&n.push(i.subarray(0,e)),await t.cancel();break}n.push(i),r+=i.length}let i;if(n.length===1)i=n[0];else{i=new Uint8Array(n.reduce((e,t)=>e+t.length,0));let e=0;for(let t of n)i.set(t,e),e+=t.length}return new TextDecoder(`utf-8`).decode(i)}var Ve,He,Ue,We,Ge,Ke,qe,Je,x,Ye=e((()=>{h(),Ve=`urn:ietf:params:oauth:grant-type:jwt-bearer`,He=`refresh_token`,Ue=`/v1/oauth/token`,We=`oauth-2025-04-20`,Ge=`oidc-federation-2026-04-01`,Ke=1<<20,qe=2e3,Je=new Set([`error`,`error_description`,`error_uri`]),x=class extends i{constructor(e,t=null,n=null,r=null){super(e),this.statusCode=t,this.body=n,this.requestId=r}}}));function S(){return Math.floor(Date.now()/1e3)}var Xe=e((()=>{})),Ze,Qe=e((()=>{Ye(),Xe(),Ze=class{constructor(e,t){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=e,this.onAdvisoryRefreshError=t}async getToken(){let e=this.nextForce;this.nextForce=!1;let t=this.cached;if(e||t==null)return(await this.refresh(e)).token;if(t.expiresAt==null)return t.token;let n=t.expiresAt-S();return n>120?t.token:n>30?(this.backgroundRefresh(),t.token):(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(e=!1){return this.pendingRefresh&&!e?this.pendingRefresh:this.doRefresh(e)}backgroundRefresh(){this.pendingRefresh||S()-this.lastAdvisoryError<5||this.doRefresh().catch(e=>{this.lastAdvisoryError=S(),this.onAdvisoryRefreshError?.(e)})}doRefresh(e=!1){return this.pendingRefresh=this.provider(e?{forceRefresh:!0}:void 0).then(e=>(this.cached=e,this.pendingRefresh=null,e),e=>{throw this.pendingRefresh=null,e}),this.pendingRefresh}}})),C,$e=e((()=>{C=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 et(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function tt(e){let t;return(rt??(t=new globalThis.TextEncoder,rt=t.encode.bind(t)))(e)}function nt(e){let t;return(it??(t=new globalThis.TextDecoder,it=t.decode.bind(t)))(e)}var rt,it,at=e((()=>{})),ot=e((()=>{}));function st(){}function ct(e,t,n){return!t||lt[e]>lt[n]?st:t[e].bind(t)}function w(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return dt;let r=ft.get(t);if(r&&r[0]===n)return r[1];let i={error:ct(`error`,t,n),warn:ct(`warn`,t,n),info:ct(`info`,t,n),debug:ct(`debug`,t,n)};return ft.set(t,[n,i]),i}var lt,ut,dt,ft,T,pt=e((()=>{pe(),lt={off:0,error:200,warn:300,info:400,debug:500},ut=(e,t,n)=>{if(e){if(oe(lt,e))return e;w(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(lt))}`)}},dt={error:st,warn:st,info:st,debug:st},ft=new WeakMap,T=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`x-api-key`||e.toLowerCase()===`authorization`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t]))),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e)})),mt=e((()=>{pe(),ot(),$e(),pt(),re(),he(),Fe()}));function ht(e){if(!e)throw Error(`profile name is empty`);if(e===`.`||e===`..`)throw Error(`profile name "${e}" is not allowed`);if(e.includes(`/`)||e.includes(`\\`))throw Error(`profile name "${e}" must not contain path separators`);if(!gt.test(e))throw Error(`profile name "${e}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var gt,_t,vt,yt,bt,xt,St=e((()=>{Te(),mt(),gt=/^[A-Za-z0-9_.-]+$/,_t=async e=>{var t,n;let r=await yt();if(r===null)return null;let i=e??await xt();if(i===null)return null;ht(i);let a=await import(`node:fs`),o=(await import(`node:path`)).join(r,`configs`,`${i}.json`),s;try{s=await a.promises.readFile(o,`utf-8`)}catch(e){if(e?.code!==`ENOENT`)throw Error(`failed to read config file ${o}: ${e}`);s=null}if(s===null){let e=C(`ANTHROPIC_ORGANIZATION_ID`),t=C(`ANTHROPIC_IDENTITY_TOKEN_FILE`),n=C(`ANTHROPIC_FEDERATION_RULE_ID`);return n&&e?{organization_id:e,base_url:C(`ANTHROPIC_BASE_URL`),authentication:{type:`oidc_federation`,federation_rule_id:n,service_account_id:C(`ANTHROPIC_SERVICE_ACCOUNT_ID`),identity_token:t?{source:`file`,path:t}:void 0,scope:C(`ANTHROPIC_SCOPE`)}}:null}let c;try{c=JSON.parse(s)}catch(e){throw Error(`failed to parse config file ${o}: ${e}`)}if(!c.authentication)throw Error(`config file ${o} is missing "authentication"`);let l=c.authentication.type;if(l!==`oidc_federation`&&l!==`user_oauth`)throw Error(`authentication.type "${l}" is not a known authentication type`);if(c.organization_id??(c.organization_id=C(`ANTHROPIC_ORGANIZATION_ID`)),c.base_url??(c.base_url=C(`ANTHROPIC_BASE_URL`)),(t=c.authentication).scope??(t.scope=C(`ANTHROPIC_SCOPE`)),c.authentication.type===`oidc_federation`){if(!c.authentication.identity_token){let e=C(`ANTHROPIC_IDENTITY_TOKEN_FILE`);e&&(c.authentication.identity_token={source:`file`,path:e})}c.authentication.federation_rule_id||(c.authentication.federation_rule_id=C(`ANTHROPIC_FEDERATION_RULE_ID`)??``),(n=c.authentication).service_account_id??(n.service_account_id=C(`ANTHROPIC_SERVICE_ACCOUNT_ID`))}return c},vt=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let n=await yt();if(!n)return null;let r=t??await xt();return r?(ht(r),(await import(`node:path`)).join(n,`credentials`,`${r}.json`)):null},yt=async()=>{if(!bt())return null;let e=await import(`node:path`),t=C(`ANTHROPIC_CONFIG_DIR`);if(t)return t;if(we()[`X-Stainless-OS`]===`Windows`){let t=C(`APPDATA`);if(t)return e.join(t,`Anthropic`);let n=C(`USERPROFILE`);return n?e.join(n,`AppData`,`Roaming`,`Anthropic`):null}let n=C(`XDG_CONFIG_HOME`);if(n)return e.join(n,`anthropic`);let r=C(`HOME`);return r?e.join(r,`.config`,`anthropic`):null},bt=()=>{let e=we()[`X-Stainless-Runtime`];return e===`node`||e===`deno`},xt=async()=>{let e=await yt();if(!e)return null;let t=C(`ANTHROPIC_PROFILE`);if(t)return t;let n=await import(`node:fs`),r=(await import(`node:path`)).join(e,`active_config`);try{return(await n.promises.readFile(r,`utf-8`)).trim()||`default`}catch(e){if(e?.code!==`ENOENT`)throw Error(`failed to read ${r}: ${e}`);return`default`}}}));function Ct(e){if(!e)throw new i(`Identity token file path is empty`);return async()=>{let t=await import(`node:fs`),n;try{n=await t.promises.readFile(e,`utf-8`)}catch(t){throw new i(`Failed to read identity token file at ${e}: ${t}`)}let r=n.trim();if(!r)throw new i(`Identity token file at ${e} is empty`);return r}}function wt(e){if(!e)throw new i(`Identity token value is empty`);return()=>e}var Tt=e((()=>{h()}));function Et(e){return async()=>{Ie(e.baseURL);let t=await e.identityTokenProvider();if(t.length>16*1024)throw new x(`Identity token is ${Math.ceil(t.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let n={grant_type:Ve,assertion:t,federation_rule_id:e.federationRuleId,organization_id:e.organizationId};e.serviceAccountId&&(n.service_account_id=e.serviceAccountId);let r=`${e.baseURL}${Ue}`,i;try{i=await e.fetch(r,{method:`POST`,headers:{"Content-Type":`application/json`,"anthropic-beta":`${We},${Ge}`,"User-Agent":e.userAgent||`anthropic-sdk-typescript/0.93.0 oidcFederationProvider`},body:JSON.stringify(n)})}catch(e){throw new x(`Failed to reach token endpoint ${r}: ${e}`)}let a=i.headers.get(`Request-Id`);if(!i.ok){let e=b(await i.text().catch(()=>``));throw new x(`Token exchange failed with status ${i.status}${a?` (request-id ${a})`:``}: ${e}`,i.status,e,a)}let o=await Le(i,a),s=Number(o.expires_in);if(!Number.isFinite(s))throw new x(`Token endpoint response missing required fields: ${JSON.stringify(b(o))}`,i.status,b(o),a);return{token:o.access_token,expiresAt:S()+s}}}var Dt=e((()=>{Ye(),Xe(),ge()}));function Ot(e){return async t=>{let n=await import(`node:fs`);await Re(e.credentialsPath,e.onSafetyWarning);let r;try{r=await n.promises.readFile(e.credentialsPath,`utf-8`)}catch(t){throw new x(`Credentials file not found at ${e.credentialsPath}: ${t}`)}let i;try{i=JSON.parse(r)}catch(t){throw new x(`Credentials file at ${e.credentialsPath} is not valid JSON: ${t}`)}let a=i.access_token;if(!a)throw new x(`Credentials file at ${e.credentialsPath} must include 'access_token'`);let o=i.expires_at;if(!t?.forceRefresh&&(o==null||S()<o-30))return{token:a,expiresAt:o??null};let s=i.refresh_token;if(!e.clientId||!s)throw new x(`Access token at ${e.credentialsPath} has expired and no refresh is available (client_id ${e.clientId?`set`:`empty`}, refresh_token ${s?`set`:`empty`})`);Ie(e.baseURL);let c={grant_type:He,refresh_token:s,client_id:e.clientId},l=`${e.baseURL}${Ue}`,u;try{u=await e.fetch(l,{method:`POST`,headers:{"Content-Type":`application/json`,"anthropic-beta":We,"User-Agent":e.userAgent||`anthropic-sdk-typescript/0.93.0 userOAuthProvider`},body:JSON.stringify(c)})}catch(e){throw new x(`User OAuth refresh failed to reach token endpoint: ${e}`)}let d=u.headers.get(`Request-Id`);if(!u.ok){let e=await u.text().catch(()=>``);throw new x(`User OAuth refresh failed (HTTP ${u.status}): ${b(e)}`,u.status,b(e),d)}let f=await Le(u,d),p=Number(f.expires_in);if(!Number.isFinite(p))throw new x(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(b(f))}`,u.status,b(f),d);let ee=S()+p,m=f.refresh_token||s;return await ze(e.credentialsPath,{...i,version:`1.0`,type:`oauth_token`,access_token:f.access_token,expires_at:ee,refresh_token:m}),{token:f.access_token,expiresAt:ee}}}var kt=e((()=>{St(),Ye(),Xe(),ge()}));function At(e,t){let n=Mt(e,e.authentication.credentials_path??null,(e.base_url||t.baseURL).replace(/\/+$/,``),t),r={};return e.workspace_id&&e.authentication.type===`user_oauth`&&(r[`anthropic-workspace-id`]=e.workspace_id),{provider:n,extraHeaders:r,baseURL:e.base_url||void 0}}async function jt(e,t){let n=await _t(t);return n?At(n.authentication.credentials_path?n:{...n,authentication:{...n.authentication,credentials_path:await vt(n,t)??void 0}},e):null}function Mt(e,t,n,r){switch(e.authentication.type){case`oidc_federation`:{let i=e.authentication,a=Nt(i);if(!a)throw new x(`oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)`);if(!i.federation_rule_id)throw new x(`oidc_federation config requires 'federation_rule_id'. Set it in authentication.federation_rule_id in your profile, or via ANTHROPIC_FEDERATION_RULE_ID (profile takes precedence).`);if(!e.organization_id)throw new x(`oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)`);let o=Et({identityTokenProvider:a,federationRuleId:i.federation_rule_id,organizationId:e.organization_id,serviceAccountId:i.service_account_id,baseURL:n,fetch:r.fetch,userAgent:r.userAgent});return t?Pt(o,t,r.onCacheWriteError,r.onSafetyWarning):o}case`user_oauth`:if(!t)throw new x(`user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)`);return Ot({credentialsPath:t,clientId:e.authentication.client_id,baseURL:n,fetch:r.fetch,userAgent:r.userAgent,onSafetyWarning:r.onSafetyWarning});default:{let t=e.authentication.type;throw new x(`authentication.type "${t}" is not a known authentication type`)}}}function Nt(e){if(e.identity_token){let t=e.identity_token.source;if(t!==`file`)throw new x(`identity_token.source "${t}" is not supported by this SDK version (only "file")`);if(!e.identity_token.path)throw new x(`identity_token.source "file" requires a non-empty path`);return Ct(e.identity_token.path)}let t=C(`ANTHROPIC_IDENTITY_TOKEN_FILE`);if(t)return Ct(t);let n=C(`ANTHROPIC_IDENTITY_TOKEN`);return n?wt(n):null}function Pt(e,t,n,r){return async i=>{let a=await import(`node:fs`);await Re(t,r);let o;try{let e=await a.promises.readFile(t,`utf-8`);o=JSON.parse(e);let n=o?.access_token;if(n&&!i?.forceRefresh){let e=o?.expires_at;if(e==null||S()<e-30)return{token:n,expiresAt:e??null}}}catch(e){e?.code!==`ENOENT`&&!(e instanceof SyntaxError)&&n?.(e)}let s=await e(i);try{await ze(t,{...o??{},version:`1.0`,type:`oauth_token`,access_token:s.token,expires_at:s.expiresAt})}catch(e){n?.(e)}return s}}var Ft=e((()=>{$e(),St(),Ye(),Xe(),Tt(),Dt(),kt()}));function It(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function Lt(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}var E,D,Rt,zt=e((()=>{v(),at(),Rt=class{constructor(){E.set(this,void 0),D.set(this,void 0),g(this,E,new Uint8Array,`f`),g(this,D,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?tt(e):e;g(this,E,et([_(this,E,`f`),t]),`f`);let n=[],r;for(;(r=It(_(this,E,`f`),_(this,D,`f`)))!=null;){if(r.carriage&&_(this,D,`f`)==null){g(this,D,r.index,`f`);continue}if(_(this,D,`f`)!=null&&(r.index!==_(this,D,`f`)+1||r.carriage)){n.push(nt(_(this,E,`f`).subarray(0,_(this,D,`f`)-1))),g(this,E,_(this,E,`f`).subarray(_(this,D,`f`)),`f`),g(this,D,null,`f`);continue}let e=_(this,D,`f`)===null?r.preceding:r.preceding-1,t=nt(_(this,E,`f`).subarray(0,e));n.push(t),g(this,E,_(this,E,`f`).subarray(r.index),`f`),g(this,D,null,`f`)}return n}flush(){return _(this,E,`f`).length?this.decode(`
2
+ `):[]}},E=new WeakMap,D=new WeakMap,Rt.NEWLINE_CHARS=new Set([`
3
+ `,`\r`]),Rt.NEWLINE_REGEXP=/\r\n|[\n\r]/g}));async function*Bt(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new i(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new i(`Attempted to iterate over a response with no body`);let n=new Wt,r=new Rt,a=ke(e.body);for await(let e of Vt(a))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*Vt(e){let t=new Uint8Array;for await(let n of e){if(n==null)continue;let e=n instanceof ArrayBuffer?new Uint8Array(n):typeof n==`string`?tt(n):n,r=new Uint8Array(t.length+e.length);r.set(t),r.set(e,t.length),t=r;let i;for(;(i=Lt(t))!==-1;)yield t.slice(0,i),t=t.slice(i)}t.length>0&&(yield t)}function Ht(e,t){let n=e.indexOf(t);return n===-1?[e,``,``]:[e.substring(0,n),t,e.substring(n+t.length)]}var Ut,O,Wt,Gt=e((()=>{v(),h(),je(),zt(),r(),pe(),at(),pt(),O=class e{constructor(e,t,n){this.iterator=e,Ut.set(this,void 0),this.controller=t,g(this,Ut,n,`f`)}static fromSSEResponse(n,r,o){let s=!1,c=o?w(o):console;async function*l(){if(s)throw new i("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");s=!0;let e=!1;try{for await(let e of Bt(n,r)){if(e.event===`completion`)try{yield JSON.parse(e.data)}catch(t){throw c.error(`Could not parse message into JSON:`,e.data),c.error(`From chunk:`,e.raw),t}if(e.event===`message_start`||e.event===`message_delta`||e.event===`message_stop`||e.event===`content_block_start`||e.event===`content_block_delta`||e.event===`content_block_stop`||e.event===`message`||e.event===`user.message`||e.event===`user.interrupt`||e.event===`user.tool_confirmation`||e.event===`user.custom_tool_result`||e.event===`agent.message`||e.event===`agent.thinking`||e.event===`agent.tool_use`||e.event===`agent.tool_result`||e.event===`agent.mcp_tool_use`||e.event===`agent.mcp_tool_result`||e.event===`agent.custom_tool_use`||e.event===`agent.thread_context_compacted`||e.event===`session.status_running`||e.event===`session.status_idle`||e.event===`session.status_rescheduled`||e.event===`session.status_terminated`||e.event===`session.error`||e.event===`session.deleted`||e.event===`span.model_request_start`||e.event===`span.model_request_end`)try{yield JSON.parse(e.data)}catch(t){throw c.error(`Could not parse message into JSON:`,e.data),c.error(`From chunk:`,e.raw),t}if(e.event!==`ping`&&e.event===`error`){let t=fe(e.data)??e.data,r=t?.error?.type;throw new a(void 0,t,void 0,n.headers,r)}}e=!0}catch(e){if(t(e))return;throw e}finally{e||r.abort()}}return new e(l,r,o)}static fromReadableStream(n,r,a){let o=!1;async function*s(){let e=new Rt,t=ke(n);for await(let n of t)for(let t of e.decode(n))yield t;for(let t of e.flush())yield t}async function*c(){if(o)throw new i("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let e=!1;try{for await(let t of s())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(t(e))return;throw e}finally{e||r.abort()}}return new e(c,r,a)}[(Ut=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,_(this,Ut,`f`)),new e(()=>i(n),this.controller,_(this,Ut,`f`))]}toReadableStream(){let e=this,t;return De({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{let{value:n,done:r}=await t.next();if(r)return e.close();let i=tt(JSON.stringify(n)+`
4
+ `);e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await t.return?.()}})}},Wt=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
5
+ `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],e}if(this.chunks.push(e),e.startsWith(`:`))return null;let[t,n,r]=Ht(e,`:`);return r.startsWith(` `)&&(r=r.substring(1)),t===`event`?this.event=r:t===`data`&&this.data.push(r),null}}}));async function Kt(e,t){let{response:n,requestLogID:r,retryOfRequestLogID:i,startTime:a}=t,o=await(async()=>{if(t.options.stream)return w(e).debug(`response`,n.status,n.url,n.headers,n.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(n,t.controller):O.fromSSEResponse(n,t.controller);if(n.status===204)return null;if(t.options.__binaryResponse)return n;let r=n.headers.get(`content-type`)?.split(`;`)[0]?.trim();return r?.includes(`application/json`)||r?.endsWith(`+json`)?n.headers.get(`content-length`)===`0`?void 0:qt(await n.json(),n):await n.text()})();return w(e).debug(`[${r}] response parsed`,T({retryOfRequestLogID:i,url:n.url,status:n.status,body:o,durationMs:Date.now()-a})),o}function qt(e,t){return!e||typeof e!=`object`||Array.isArray(e)?e:Object.defineProperty(e,"_request_id",{value:t.headers.get(`request-id`),enumerable:!1})}var Jt=e((()=>{Gt(),pt()})),Yt,Xt,Zt=e((()=>{v(),Jt(),Xt=class e extends Promise{constructor(e,t,n=Kt){super(e=>{e(null)}),this.responsePromise=t,this.parseResponse=n,Yt.set(this,void 0),g(this,Yt,e,`f`)}_thenUnwrap(t){return new e(_(this,Yt,`f`),this.responsePromise,async(e,n)=>qt(t(await this.parseResponse(e,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t,request_id:t.headers.get(`request-id`)}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(_(this,Yt,`f`),e))),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},Yt=new WeakMap})),Qt,$t,en,tn,k,A=e((()=>{v(),h(),Jt(),Zt(),pe(),$t=class{constructor(e,t,n,r){Qt.set(this,void 0),g(this,Qt,e,`f`),this.options=r,this.response=t,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new i("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await _(this,Qt,`f`).requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Qt=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}},en=class extends Xt{constructor(e,t,n){super(e,t,async(e,t)=>new n(e,t.response,await Kt(e,t),t.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}},tn=class extends $t{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.has_more=n.has_more||!1,this.first_id=n.first_id||null,this.last_id=n.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more!==!1&&super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let e=this.first_id;return e?{...this.options,query:{...ie(this.options.query),before_id:e}}:null}let e=this.last_id;return e?{...this.options,query:{...ie(this.options.query),after_id:e}}:null}},k=class extends $t{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.next_page=n.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let e=this.next_page;return e?{...this.options,query:{...ie(this.options.query),page:e}}:null}}}));function nn(e,t,n){return on(),new File(e,t??`unknown_file`,n)}function rn(e,t){let n=typeof e==`object`&&!!e&&(`name`in e&&e.name&&String(e.name)||`url`in e&&e.url&&String(e.url)||`filename`in e&&e.filename&&String(e.filename)||`path`in e&&e.path&&String(e.path))||``;return t?n.split(/[\\/]/).pop()||void 0:n}function an(e){let t=typeof e==`function`?e:e.fetch,n=ln.get(t);if(n)return n;let r=(async()=>{try{let e=`Response`in t?t.Response:(await t(`data:,`)).constructor,n=new FormData;return n.toString()!==await new e(n).text()}catch{return!0}})();return ln.set(t,r),r}var on,sn,cn,ln,un,dn,fn,pn=e((()=>{je(),on=()=>{if(typeof File>`u`){let{process:e}=globalThis,t=typeof e?.versions?.node==`string`&&parseInt(e.versions.node.split(`.`))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":``))}},sn=e=>typeof e==`object`&&!!e&&typeof e[Symbol.asyncIterator]==`function`,cn=async(e,t,n=!0)=>({...e,body:await un(e.body,t,n)}),ln=new WeakMap,un=async(e,t,n=!0)=>{if(!await an(t))throw TypeError(`The provided fetch function does not support file uploads with the current global FormData class.`);let r=new FormData;return await Promise.all(Object.entries(e||{}).map(([e,t])=>fn(r,e,t,n))),r},dn=e=>e instanceof Blob&&`name`in e,fn=async(e,t,n,r)=>{if(n!==void 0){if(n==null)throw TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if(typeof n==`string`||typeof n==`number`||typeof n==`boolean`)e.append(t,String(n));else if(n instanceof Response){let i={},a=n.headers.get(`Content-Type`);a&&(i={type:a}),e.append(t,nn([await n.blob()],rn(n,r),i))}else if(sn(n))e.append(t,nn([await new Response(Oe(n)).blob()],rn(n,r)));else if(dn(n))e.append(t,nn([n],rn(n,r),{type:n.type}));else if(Array.isArray(n))await Promise.all(n.map(n=>fn(e,t+`[]`,n,r)));else if(typeof n==`object`)await Promise.all(Object.entries(n).map(([n,i])=>fn(e,`${t}[${n}]`,i,r)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${n} instead`)}}}));async function mn(e,t,n){if(on(),e=await e,t||(t=rn(e,!0)),vn(e))return e instanceof File&&t==null&&n==null?e:nn([await e.arrayBuffer()],t??e.name,{type:e.type,lastModified:e.lastModified,...n});if(yn(e)){let r=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()),nn(await hn(r),t,n)}let r=await hn(e);if(!n?.type){let e=r.find(e=>typeof e==`object`&&`type`in e&&e.type);typeof e==`string`&&(n={...n,type:e})}return nn(r,t,n)}async function hn(e){let t=[];if(typeof e==`string`||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(_n(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else if(sn(e))for await(let n of e)t.push(...await hn(n));else{let t=e?.constructor?.name;throw Error(`Unexpected data type: ${typeof e}${t?`; constructor: ${t}`:``}${gn(e)}`)}return t}function gn(e){return typeof e!=`object`||!e?``:`; props: [${Object.getOwnPropertyNames(e).map(e=>`"${e}"`).join(`, `)}]`}var _n,vn,yn,bn=e((()=>{pn(),_n=e=>typeof e==`object`&&!!e&&typeof e.size==`number`&&typeof e.type==`string`&&typeof e.text==`function`&&typeof e.slice==`function`&&typeof e.arrayBuffer==`function`,vn=e=>typeof e==`object`&&!!e&&typeof e.name==`string`&&typeof e.lastModified==`number`&&_n(e),yn=e=>typeof e==`object`&&!!e&&typeof e.url==`string`&&typeof e.blob==`function`})),xn=e((()=>{bn()})),Sn=e((()=>{})),j,M=e((()=>{j=class{constructor(e){this._client=e}}}));function*Cn(e){if(!e)return;if(wn 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():ue(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=ue(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 wn,N,P=e((()=>{pe(),wn=Symbol.for(`brand.privateNullableHeaders`),N=e=>{let t=new Headers,n=new Set;for(let r of e){let e=new Set;for(let[i,a]of Cn(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{[wn]:!0,values:t,nulls:n}}}));function Tn(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var En,Dn,F,I=e((()=>{h(),En=Object.freeze(Object.create(null)),Dn=(e=Tn)=>function(t,...n){if(t.length===1)return t[0];let r=!1,a=[],o=t.reduce((t,i,o)=>{/[?#]/.test(i)&&(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??En)??En)?.toString)&&(c=s+``,a.push({start:t.length+i.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+i+(o===n.length?``:c)},``),s=o.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;for(;(l=c.exec(s))!==null;)a.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can\'t be safely passed as a path parameter`});if(a.sort((e,t)=>e.start-t.start),a.length>0){let e=0,t=a.reduce((t,n)=>{let r=` `.repeat(n.start-e),i=`^`.repeat(n.length);return e=n.start+n.length,t+r+i},``);throw new i(`Path parameters result in path with invalid segments:\n${a.map(e=>e.error).join(`
6
+ `)}\n${o}\n${t}`)}return o},F=Dn(Tn)})),On,kn=e((()=>{M(),A(),P(),I(),On=class extends j{create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/environments?beta=true`,{body:r,...t,headers:N([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(F`/v1/environments/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}update(e,t,n){let{betas:r,...i}=t;return this._client.post(F`/v1/environments/${e}?beta=true`,{body:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/environments?beta=true`,k,{query:r,...t,headers:N([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(F`/v1/environments/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(F`/v1/environments/${e}/archive?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}}}));function An(e){return typeof e==`object`&&!!e&&Pn in e}function jn(e,t){let n=new Set;if(e)for(let t of e)An(t)&&n.add(t[Pn]);if(t){for(let e of t)if(An(e)&&n.add(e[Pn]),Array.isArray(e.content))for(let t of e.content)An(t)&&n.add(t[Pn])}return Array.from(n)}function Mn(e,t){let n=jn(e,t);return n.length===0?{}:{"x-stainless-helper":n.join(`, `)}}function Nn(e){return An(e)?{"x-stainless-helper":e[Pn]}:{}}var Pn,Fn=e((()=>{Pn=Symbol(`anthropic.sdk.stainlessHelper`)})),In,Ln=e((()=>{M(),A(),P(),Fn(),pn(),I(),In=class extends j{list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/files?beta=true`,tn,{query:r,...t,headers:N([{"anthropic-beta":[...n??[],`files-api-2025-04-14`].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(F`/v1/files/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`files-api-2025-04-14`].toString()},n?.headers])})}download(e,t={},n){let{betas:r}=t??{};return this._client.get(F`/v1/files/${e}/content?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`files-api-2025-04-14`].toString(),Accept:`application/binary`},n?.headers]),__binaryResponse:!0})}retrieveMetadata(e,t={},n){let{betas:r}=t??{};return this._client.get(F`/v1/files/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`files-api-2025-04-14`].toString()},n?.headers])})}upload(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/files?beta=true`,cn({body:r,...t,headers:N([{"anthropic-beta":[...n??[],`files-api-2025-04-14`].toString()},Nn(r.file),t?.headers])},this._client))}}})),Rn,zn=e((()=>{M(),A(),P(),I(),Rn=class extends j{retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(F`/v1/models/${e}?beta=true`,{...n,headers:N([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/models?beta=true`,tn,{query:r,...t,headers:N([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()}},t?.headers])})}}})),Bn,Vn=e((()=>{M(),A(),P(),I(),Bn=class extends j{create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/user_profiles?beta=true`,{body:r,...t,headers:N([{"anthropic-beta":[...n??[],`user-profiles-2026-03-24`].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(F`/v1/user_profiles/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`user-profiles-2026-03-24`].toString()},n?.headers])})}update(e,t,n){let{betas:r,...i}=t;return this._client.post(F`/v1/user_profiles/${e}?beta=true`,{body:i,...n,headers:N([{"anthropic-beta":[...r??[],`user-profiles-2026-03-24`].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/user_profiles?beta=true`,k,{query:r,...t,headers:N([{"anthropic-beta":[...n??[],`user-profiles-2026-03-24`].toString()},t?.headers])})}createEnrollmentURL(e,t={},n){let{betas:r}=t??{};return this._client.post(F`/v1/user_profiles/${e}/enrollment_url?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`user-profiles-2026-03-24`].toString()},n?.headers])})}}})),Hn,Un=e((()=>{M(),A(),P(),I(),Hn=class extends j{list(e,t={},n){let{betas:r,...i}=t??{};return this._client.getAPIList(F`/v1/agents/${e}/versions?beta=true`,k,{query:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}}})),Wn,Gn=e((()=>{M(),Un(),A(),P(),I(),Wn=class extends j{constructor(){super(...arguments),this.versions=new Hn(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/agents?beta=true`,{body:r,...t,headers:N([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r,...i}=t??{};return this._client.get(F`/v1/agents/${e}?beta=true`,{query:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}update(e,t,n){let{betas:r,...i}=t;return this._client.post(F`/v1/agents/${e}?beta=true`,{body:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/agents?beta=true`,k,{query:r,...t,headers:N([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString()},t?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(F`/v1/agents/${e}/archive?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}},Wn.Versions=Hn})),Kn,qn=e((()=>{M(),A(),P(),I(),Kn=class extends j{create(e,t,n){let{view:r,betas:i,...a}=t;return this._client.post(F`/v1/memory_stores/${e}/memories?beta=true`,{query:{view:r},body:a,...n,headers:N([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}retrieve(e,t,n){let{memory_store_id:r,betas:i,...a}=t;return this._client.get(F`/v1/memory_stores/${r}/memories/${e}?beta=true`,{query:a,...n,headers:N([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}update(e,t,n){let{memory_store_id:r,view:i,betas:a,...o}=t;return this._client.post(F`/v1/memory_stores/${r}/memories/${e}?beta=true`,{query:{view:i},body:o,...n,headers:N([{"anthropic-beta":[...a??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...i}=t??{};return this._client.getAPIList(F`/v1/memory_stores/${e}/memories?beta=true`,k,{query:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}delete(e,t,n){let{memory_store_id:r,expected_content_sha256:i,betas:a}=t;return this._client.delete(F`/v1/memory_stores/${r}/memories/${e}?beta=true`,{query:{expected_content_sha256:i},...n,headers:N([{"anthropic-beta":[...a??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}}})),Jn,Yn=e((()=>{M(),A(),P(),I(),Jn=class extends j{retrieve(e,t,n){let{memory_store_id:r,betas:i,...a}=t;return this._client.get(F`/v1/memory_stores/${r}/memory_versions/${e}?beta=true`,{query:a,...n,headers:N([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...i}=t??{};return this._client.getAPIList(F`/v1/memory_stores/${e}/memory_versions?beta=true`,k,{query:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}redact(e,t,n){let{memory_store_id:r,betas:i}=t;return this._client.post(F`/v1/memory_stores/${r}/memory_versions/${e}/redact?beta=true`,{...n,headers:N([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}}})),Xn,Zn=e((()=>{M(),qn(),Yn(),A(),P(),I(),Xn=class extends j{constructor(){super(...arguments),this.memories=new Kn(this._client),this.memoryVersions=new Jn(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/memory_stores?beta=true`,{body:r,...t,headers:N([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(F`/v1/memory_stores/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}update(e,t,n){let{betas:r,...i}=t;return this._client.post(F`/v1/memory_stores/${e}?beta=true`,{body:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/memory_stores?beta=true`,k,{query:r,...t,headers:N([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(F`/v1/memory_stores/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(F`/v1/memory_stores/${e}/archive?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}},Xn.Memories=Kn,Xn.MemoryVersions=Jn})),Qn=e((()=>{h()})),$n,er=e((()=>{h(),je(),zt(),$n=class e{constructor(e,t){this.iterator=e,this.controller=t}async*decoder(){let e=new Rt;for await(let t of this.iterator)for(let n of e.decode(t))yield JSON.parse(n);for(let t of e.flush())yield JSON.parse(t)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(t,n){if(!t.body)throw n.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new i(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new i(`Attempted to iterate over a response with no body`);return new e(ke(t.body),n)}}})),tr,nr=e((()=>{M(),A(),P(),er(),Qn(),I(),tr=class extends j{create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/messages/batches?beta=true`,{body:r,...t,headers:N([{"anthropic-beta":[...n??[],`message-batches-2024-09-24`].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(F`/v1/messages/batches/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`message-batches-2024-09-24`].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/messages/batches?beta=true`,tn,{query:r,...t,headers:N([{"anthropic-beta":[...n??[],`message-batches-2024-09-24`].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(F`/v1/messages/batches/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`message-batches-2024-09-24`].toString()},n?.headers])})}cancel(e,t={},n){let{betas:r}=t??{};return this._client.post(F`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`message-batches-2024-09-24`].toString()},n?.headers])})}async results(e,t={},n){let r=await this.retrieve(e);if(!r.results_url)throw new i(`No batch \`results_url\`; Has it finished processing? ${r.processing_status} - ${r.id}`);let{betas:a}=t??{};return this._client.get(r.results_url,{...n,headers:N([{"anthropic-beta":[...a??[],`message-batches-2024-09-24`].toString(),Accept:`application/binary`},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((e,t)=>$n.fromResponse(t.response,t.controller))}}})),rr,ir=e((()=>{rr={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192}}));function ar(e){return e?.output_format??e?.output_config?.format}function or(e,t,n){let r=ar(t);return!t||!(`parse`in(r??{}))?{...e,content:e.content.map(e=>{if(e.type===`text`){let t=Object.defineProperty({...e},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(t,"parsed",{get(){return n.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return e}),parsed_output:null}:sr(e,t,n)}function sr(e,t,n){let r=null,i=e.content.map(e=>{if(e.type===`text`){let i=cr(t,e.text);r===null&&(r=i);let a=Object.defineProperty({...e},"parsed_output",{value:i,enumerable:!1});return Object.defineProperty(a,"parsed",{get(){return n.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),i},enumerable:!1})}return e});return{...e,content:i,parsed_output:r}}function cr(e,t){let n=ar(e);if(n?.type!==`json_schema`)return null;try{return`parse`in n?n.parse(t):JSON.parse(t)}catch(e){throw new i(`Failed to parse structured output: ${e}`)}}var lr=e((()=>{h()})),ur,dr,fr,pr,mr,hr=e((()=>{ur=e=>{let t=0,n=[];for(;t<e.length;){let r=e[t];if(r===`\\`){t++;continue}if(r===`{`){n.push({type:`brace`,value:`{`}),t++;continue}if(r===`}`){n.push({type:`brace`,value:`}`}),t++;continue}if(r===`[`){n.push({type:`paren`,value:`[`}),t++;continue}if(r===`]`){n.push({type:`paren`,value:`]`}),t++;continue}if(r===`:`){n.push({type:`separator`,value:`:`}),t++;continue}if(r===`,`){n.push({type:`delimiter`,value:`,`}),t++;continue}if(r===`"`){let i=``,a=!1;for(r=e[++t];r!==`"`;){if(t===e.length){a=!0;break}if(r===`\\`){if(t++,t===e.length){a=!0;break}i+=r+e[t],r=e[++t]}else i+=r,r=e[++t]}r=e[++t],a||n.push({type:`string`,value:i});continue}if(r&&/\s/.test(r)){t++;continue}let i=/[0-9]/;if(r&&i.test(r)||r===`-`||r===`.`){let a=``;for(r===`-`&&(a+=r,r=e[++t]);r&&i.test(r)||r===`.`;)a+=r,r=e[++t];n.push({type:`number`,value:a});continue}let a=/[a-z]/i;if(r&&a.test(r)){let i=``;for(;r&&a.test(r)&&t!==e.length;)i+=r,r=e[++t];if(i==`true`||i==`false`||i===`null`)n.push({type:`name`,value:i});else{t++;continue}continue}t++}return n},dr=e=>{if(e.length===0)return e;let t=e[e.length-1];switch(t.type){case`separator`:return e=e.slice(0,e.length-1),dr(e);case`number`:let n=t.value[t.value.length-1];if(n===`.`||n===`-`)return e=e.slice(0,e.length-1),dr(e);case`string`:let r=e[e.length-2];if(r?.type===`delimiter`||r?.type===`brace`&&r.value===`{`)return e=e.slice(0,e.length-1),dr(e);break;case`delimiter`:return e=e.slice(0,e.length-1),dr(e)}return e},fr=e=>{let t=[];return e.map(e=>{e.type===`brace`&&(e.value===`{`?t.push(`}`):t.splice(t.lastIndexOf(`}`),1)),e.type===`paren`&&(e.value===`[`?t.push(`]`):t.splice(t.lastIndexOf(`]`),1))}),t.length>0&&t.reverse().map(t=>{t===`}`?e.push({type:`brace`,value:`}`}):t===`]`&&e.push({type:`paren`,value:`]`})}),e},pr=e=>{let t=``;return e.map(e=>{switch(e.type){case`string`:t+=`"`+e.value+`"`;break;default:t+=e.value;break}}),t},mr=e=>JSON.parse(pr(fr(dr(ur(e)))))})),gr=e((()=>{Gt()}));function _r(e){return e.type===`tool_use`||e.type===`server_tool_use`||e.type===`mcp_tool_use`}var L,R,vr,yr,br,xr,Sr,Cr,wr,z,Tr,Er,Dr,B,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br=e((()=>{v(),hr(),Qn(),r(),gr(),lr(),Rr=`__json_buf`,zr=class e{constructor(e,n){L.add(this),this.messages=[],this.receivedMessages=[],R.set(this,void 0),vr.set(this,null),this.controller=new AbortController,yr.set(this,void 0),br.set(this,()=>{}),xr.set(this,()=>{}),Sr.set(this,void 0),Cr.set(this,()=>{}),wr.set(this,()=>{}),z.set(this,{}),Tr.set(this,!1),Er.set(this,!1),Dr.set(this,!1),B.set(this,!1),Or.set(this,void 0),kr.set(this,void 0),Ar.set(this,void 0),Nr.set(this,e=>{if(g(this,Er,!0,`f`),t(e)&&(e=new o),e instanceof o)return g(this,Dr,!0,`f`),this._emit(`abort`,e);if(e instanceof i)return this._emit(`error`,e);if(e instanceof Error){let t=new i(e.message);return t.cause=e,this._emit(`error`,t)}return this._emit(`error`,new i(String(e)))}),g(this,yr,new Promise((e,t)=>{g(this,br,e,`f`),g(this,xr,t,`f`)}),`f`),g(this,Sr,new Promise((e,t)=>{g(this,Cr,e,`f`),g(this,wr,t,`f`)}),`f`),_(this,yr,`f`).catch(()=>{}),_(this,Sr,`f`).catch(()=>{}),g(this,vr,e,`f`),g(this,Ar,n?.logger??console,`f`)}get response(){return _(this,Or,`f`)}get request_id(){return _(this,kr,`f`)}async withResponse(){g(this,B,!0,`f`);let e=await _(this,yr,`f`);if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get(`request-id`)}}static fromReadableStream(t){let n=new e(null);return n._run(()=>n._fromReadableStream(t)),n}static createMessage(t,n,r,{logger:i}={}){let a=new e(n,{logger:i});for(let e of n.messages)a._addMessageParam(e);return g(a,vr,{...n,stream:!0},`f`),a._run(()=>a._createMessage(t,{...n,stream:!0},{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`stream`}})),a}_run(e){e().then(()=>{this._emitFinal(),this._emit(`end`)},_(this,Nr,`f`))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){this.receivedMessages.push(e),t&&this._emit(`message`,e)}async _createMessage(e,t,n){let r=n?.signal,i;r&&(r.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),r.addEventListener(`abort`,i));try{_(this,L,`m`,Pr).call(this);let{response:r,data:i}=await e.create({...t,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(r);for await(let e of i)_(this,L,`m`,Fr).call(this,e);if(i.controller.signal?.aborted)throw new o;_(this,L,`m`,Ir).call(this)}finally{r&&i&&r.removeEventListener(`abort`,i)}}_connected(e){this.ended||(g(this,Or,e,`f`),g(this,kr,e?.headers.get(`request-id`),`f`),_(this,br,`f`).call(this,e),this._emit(`connect`))}get ended(){return _(this,Tr,`f`)}get errored(){return _(this,Er,`f`)}get aborted(){return _(this,Dr,`f`)}abort(){this.controller.abort()}on(e,t){return(_(this,z,`f`)[e]||(_(this,z,`f`)[e]=[])).push({listener:t}),this}off(e,t){let n=_(this,z,`f`)[e];if(!n)return this;let r=n.findIndex(e=>e.listener===t);return r>=0&&n.splice(r,1),this}once(e,t){return(_(this,z,`f`)[e]||(_(this,z,`f`)[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,n)=>{g(this,B,!0,`f`),e!==`error`&&this.once(`error`,n),this.once(e,t)})}async done(){g(this,B,!0,`f`),await _(this,Sr,`f`)}get currentMessage(){return _(this,R,`f`)}async finalMessage(){return await this.done(),_(this,L,`m`,jr).call(this)}async finalText(){return await this.done(),_(this,L,`m`,Mr).call(this)}_emit(e,...t){if(_(this,Tr,`f`))return;e===`end`&&(g(this,Tr,!0,`f`),_(this,Cr,`f`).call(this));let n=_(this,z,`f`)[e];if(n&&(_(this,z,`f`)[e]=n.filter(e=>!e.once),n.forEach(({listener:e})=>e(...t))),e===`abort`){let e=t[0];!_(this,B,`f`)&&!n?.length&&Promise.reject(e),_(this,xr,`f`).call(this,e),_(this,wr,`f`).call(this,e),this._emit(`end`);return}if(e===`error`){let e=t[0];!_(this,B,`f`)&&!n?.length&&Promise.reject(e),_(this,xr,`f`).call(this,e),_(this,wr,`f`).call(this,e),this._emit(`end`)}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit(`finalMessage`,_(this,L,`m`,jr).call(this))}async _fromReadableStream(e,t){let n=t?.signal,r;n&&(n.aborted&&this.controller.abort(),r=this.controller.abort.bind(this.controller),n.addEventListener(`abort`,r));try{_(this,L,`m`,Pr).call(this),this._connected(null);let t=O.fromReadableStream(e,this.controller);for await(let e of t)_(this,L,`m`,Fr).call(this,e);if(t.controller.signal?.aborted)throw new o;_(this,L,`m`,Ir).call(this)}finally{n&&r&&n.removeEventListener(`abort`,r)}}[(R=new WeakMap,vr=new WeakMap,yr=new WeakMap,br=new WeakMap,xr=new WeakMap,Sr=new WeakMap,Cr=new WeakMap,wr=new WeakMap,z=new WeakMap,Tr=new WeakMap,Er=new WeakMap,Dr=new WeakMap,B=new WeakMap,Or=new WeakMap,kr=new WeakMap,Ar=new WeakMap,Nr=new WeakMap,L=new WeakSet,jr=function(){if(this.receivedMessages.length===0)throw new i(`stream ended without producing a Message with role=assistant`);return this.receivedMessages.at(-1)},Mr=function(){if(this.receivedMessages.length===0)throw new i(`stream ended without producing a Message with role=assistant`);let e=this.receivedMessages.at(-1).content.filter(e=>e.type===`text`).map(e=>e.text);if(e.length===0)throw new i(`stream ended without producing a content block with type=text`);return e.join(` `)},Pr=function(){this.ended||g(this,R,void 0,`f`)},Fr=function(e){if(this.ended)return;let t=_(this,L,`m`,Lr).call(this,e);switch(this._emit(`streamEvent`,e,t),e.type){case`content_block_delta`:{let n=t.content.at(-1);switch(e.delta.type){case`text_delta`:n.type===`text`&&this._emit(`text`,e.delta.text,n.text||``);break;case`citations_delta`:n.type===`text`&&this._emit(`citation`,e.delta.citation,n.citations??[]);break;case`input_json_delta`:_r(n)&&n.input&&this._emit(`inputJson`,e.delta.partial_json,n.input);break;case`thinking_delta`:n.type===`thinking`&&this._emit(`thinking`,e.delta.thinking,n.thinking);break;case`signature_delta`:n.type===`thinking`&&this._emit(`signature`,n.signature);break;case`compaction_delta`:n.type===`compaction`&&n.content&&this._emit(`compaction`,n.content);break;default:e.delta}break}case`message_stop`:this._addMessageParam(t),this._addMessage(or(t,_(this,vr,`f`),{logger:_(this,Ar,`f`)}),!0);break;case`content_block_stop`:this._emit(`contentBlock`,t.content.at(-1));break;case`message_start`:g(this,R,t,`f`);break;case`content_block_start`:case`message_delta`:break}},Ir=function(){if(this.ended)throw new i(`stream has ended, this shouldn't happen`);let e=_(this,R,`f`);if(!e)throw new i(`request ended without sending any chunks`);return g(this,R,void 0,`f`),or(e,_(this,vr,`f`),{logger:_(this,Ar,`f`)})},Lr=function(e){let t=_(this,R,`f`);if(e.type===`message_start`){if(t)throw new i(`Unexpected event order, got ${e.type} before receiving "message_stop"`);return e.message}if(!t)throw new i(`Unexpected event order, got ${e.type} before "message_start"`);switch(e.type){case`message_stop`:return t;case`message_delta`:return t.container=e.delta.container,t.stop_reason=e.delta.stop_reason,t.stop_sequence=e.delta.stop_sequence,t.usage.output_tokens=e.usage.output_tokens,t.context_management=e.context_management,e.usage.input_tokens!=null&&(t.usage.input_tokens=e.usage.input_tokens),e.usage.cache_creation_input_tokens!=null&&(t.usage.cache_creation_input_tokens=e.usage.cache_creation_input_tokens),e.usage.cache_read_input_tokens!=null&&(t.usage.cache_read_input_tokens=e.usage.cache_read_input_tokens),e.usage.server_tool_use!=null&&(t.usage.server_tool_use=e.usage.server_tool_use),e.usage.iterations!=null&&(t.usage.iterations=e.usage.iterations),t;case`content_block_start`:return t.content.push(e.content_block),t;case`content_block_delta`:{let n=t.content.at(e.index);switch(e.delta.type){case`text_delta`:n?.type===`text`&&(t.content[e.index]={...n,text:(n.text||``)+e.delta.text});break;case`citations_delta`:n?.type===`text`&&(t.content[e.index]={...n,citations:[...n.citations??[],e.delta.citation]});break;case`input_json_delta`:if(n&&_r(n)){let r=n[Rr]||``;r+=e.delta.partial_json;let a={...n};if(Object.defineProperty(a,Rr,{value:r,enumerable:!1,writable:!0}),r)try{a.input=mr(r)}catch(e){let t=new i(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${e}. JSON: ${r}`);_(this,Nr,`f`).call(this,t)}t.content[e.index]=a}break;case`thinking_delta`:n?.type===`thinking`&&(t.content[e.index]={...n,thinking:n.thinking+e.delta.thinking});break;case`signature_delta`:n?.type===`thinking`&&(t.content[e.index]={...n,signature:e.delta.signature});break;case`compaction_delta`:n?.type===`compaction`&&(t.content[e.index]={...n,content:(n.content||``)+e.delta.content});break;default:e.delta}return t}case`content_block_stop`:return t}},Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on(`streamEvent`,n=>{let r=t.shift();r?r.resolve(n):e.push(n)}),this.on(`end`,()=>{n=!0;for(let e of t)e.resolve(void 0);t.length=0}),this.on(`abort`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),this.on(`error`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((e,n)=>t.push({resolve:e,reject:n})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new O(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}})),Vr,Hr=e((()=>{Vr=class extends Error{constructor(e){let t=typeof e==`string`?e:e.map(e=>e.type===`text`?e.text:`[${e.type}]`).join(` `);super(t),this.name=`ToolError`,this.content=e}}})),Ur,Wr=e((()=>{Ur=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
7
+ 1. Task Overview
8
+ The user's core request and success criteria
9
+ Any clarifications or constraints they specified
10
+ 2. Current State
11
+ What has been completed so far
12
+ Files created, modified, or analyzed (with paths if relevant)
13
+ Key outputs or artifacts produced
14
+ 3. Important Discoveries
15
+ Technical constraints or requirements uncovered
16
+ Decisions made and their rationale
17
+ Errors encountered and how they were resolved
18
+ What approaches were tried that didn't work (and why)
19
+ 4. Next Steps
20
+ Specific actions needed to complete the task
21
+ Any blockers or open questions to resolve
22
+ Priority order if multiple steps remain
23
+ 5. Context to Preserve
24
+ User preferences or style requirements
25
+ Domain-specific details that aren't obvious
26
+ Any promises made to the user
27
+ Be concise but complete—err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
28
+ Wrap your summary in <summary></summary> tags.`}));function Gr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function Kr(e,t=e.messages.at(-1),n){if(!t||t.role!==`assistant`||!t.content||typeof t.content==`string`)return null;let r=t.content.filter(e=>e.type===`tool_use`);return r.length===0?null:{role:`user`,content:await Promise.all(r.map(async t=>{let r=e.tools.find(e=>(`name`in e?e.name:e.mcp_server_name)===t.name);if(!r||!(`run`in r))return{type:`tool_result`,tool_use_id:t.id,content:`Error: Tool '${t.name}' not found`,is_error:!0};try{let e=t.input;`parse`in r&&r.parse&&(e=r.parse(e));let i=await r.run(e,{toolUseBlock:t,signal:n?.signal});return{type:`tool_result`,tool_use_id:t.id,content:i}}catch(e){return{type:`tool_result`,tool_use_id:t.id,content:e instanceof Vr?e.content:`Error: ${e instanceof Error?e.message:String(e)}`,is_error:!0}}}))}}var qr,Jr,V,H,U,W,G,K,Yr,Xr,Zr,Qr,$r=e((()=>{v(),Hr(),h(),P(),Wr(),Fn(),Qr=class{constructor(e,t,n){qr.add(this),this.client=e,Jr.set(this,!1),V.set(this,!1),H.set(this,void 0),U.set(this,void 0),W.set(this,void 0),G.set(this,void 0),K.set(this,void 0),Yr.set(this,0),g(this,H,{params:{...t,messages:structuredClone(t.messages)}},`f`);let r=[`BetaToolRunner`,...jn(t.tools,t.messages)].join(`, `);g(this,U,{...n,headers:N([{"x-stainless-helper":r},n?.headers])},`f`),g(this,K,Gr(),`f`),t.compactionControl?.enabled&&console.warn('Anthropic: The `compactionControl` parameter is deprecated and will be removed in a future version. Use server-side compaction instead by passing `edits: [{ type: "compact_20260112" }]` in the params passed to `toolRunner()`. See https://platform.claude.com/docs/en/build-with-claude/compaction')}async*[(Jr=new WeakMap,V=new WeakMap,H=new WeakMap,U=new WeakMap,W=new WeakMap,G=new WeakMap,K=new WeakMap,Yr=new WeakMap,qr=new WeakSet,Xr=async function(){let e=_(this,H,`f`).params.compactionControl;if(!e||!e.enabled)return!1;let t=0;if(_(this,W,`f`)!==void 0)try{let e=await _(this,W,`f`);t=e.usage.input_tokens+(e.usage.cache_creation_input_tokens??0)+(e.usage.cache_read_input_tokens??0)+e.usage.output_tokens}catch{return!1}let n=e.contextTokenThreshold??1e5;if(t<n)return!1;let r=e.model??_(this,H,`f`).params.model,a=e.summaryPrompt??Ur,o=_(this,H,`f`).params.messages;if(o[o.length-1].role===`assistant`){let e=o[o.length-1];if(Array.isArray(e.content)){let t=e.content.filter(e=>e.type!==`tool_use`);t.length===0?o.pop():e.content=t}}let s=await this.client.beta.messages.create({model:r,messages:[...o,{role:`user`,content:[{type:`text`,text:a}]}],max_tokens:_(this,H,`f`).params.max_tokens},{signal:_(this,U,`f`).signal,headers:N([_(this,U,`f`).headers,{"x-stainless-helper":`compaction`}])});if(s.content[0]?.type!==`text`)throw new i(`Expected text response for compaction`);return _(this,H,`f`).params.messages=[{role:`user`,content:s.content}],!0},Symbol.asyncIterator)](){var e;if(_(this,Jr,`f`))throw new i(`Cannot iterate over a consumed stream`);g(this,Jr,!0,`f`),g(this,V,!0,`f`),g(this,G,void 0,`f`);try{for(;;){let t;try{if(_(this,H,`f`).params.max_iterations&&_(this,Yr,`f`)>=_(this,H,`f`).params.max_iterations)break;g(this,V,!1,`f`),g(this,G,void 0,`f`),g(this,Yr,(e=_(this,Yr,`f`),e++,e),`f`),g(this,W,void 0,`f`);let{max_iterations:n,compactionControl:r,...i}=_(this,H,`f`).params;if(i.stream?(t=this.client.beta.messages.stream({...i},_(this,U,`f`)),g(this,W,t.finalMessage(),`f`),_(this,W,`f`).catch(()=>{}),yield t):(g(this,W,this.client.beta.messages.create({...i,stream:!1},_(this,U,`f`)),`f`),yield _(this,W,`f`)),!await _(this,qr,`m`,Xr).call(this)){if(!_(this,V,`f`)){let{role:e,content:t}=await _(this,W,`f`);_(this,H,`f`).params.messages.push({role:e,content:t})}let e=await _(this,qr,`m`,Zr).call(this,_(this,H,`f`).params.messages.at(-1));if(e)_(this,H,`f`).params.messages.push(e);else if(!_(this,V,`f`))break}}finally{t&&t.abort()}}if(!_(this,W,`f`))throw new i(`ToolRunner concluded without a message from the server`);_(this,K,`f`).resolve(await _(this,W,`f`))}catch(e){throw g(this,Jr,!1,`f`),_(this,K,`f`).promise.catch(()=>{}),_(this,K,`f`).reject(e),g(this,K,Gr(),`f`),e}}setMessagesParams(e){typeof e==`function`?_(this,H,`f`).params=e(_(this,H,`f`).params):_(this,H,`f`).params=e,g(this,V,!0,`f`),g(this,G,void 0,`f`)}setRequestOptions(e){typeof e==`function`?g(this,U,e(_(this,U,`f`)),`f`):g(this,U,{..._(this,U,`f`),...e},`f`)}async generateToolResponse(e=_(this,U,`f`).signal){let t=await _(this,W,`f`)??this.params.messages.at(-1);return t?_(this,qr,`m`,Zr).call(this,t,e):null}done(){return _(this,K,`f`).promise}async runUntilDone(){if(!_(this,Jr,`f`))for await(let e of this);return this.done()}get params(){return _(this,H,`f`).params}pushMessages(...e){this.setMessagesParams(t=>({...t,messages:[...t.messages,...e]}))}then(e,t){return this.runUntilDone().then(e,t)}},Zr=async function(e,t=_(this,U,`f`).signal){return _(this,G,`f`)===void 0&&g(this,G,Kr(_(this,H,`f`).params,e,{..._(this,U,`f`),signal:t}),`f`),_(this,G,`f`)}}));function ei(e){if(!e.output_format)return e;if(e.output_config?.format)throw new i(`Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).`);let{output_format:t,...n}=e;return{...n,output_config:{...e.output_config,format:t}}}var ti,ni,ri,ii=e((()=>{Qn(),nr(),M(),ir(),P(),Fn(),lr(),Br(),$r(),Hr(),ti={"claude-1.3":`November 6th, 2024`,"claude-1.3-100k":`November 6th, 2024`,"claude-instant-1.1":`November 6th, 2024`,"claude-instant-1.1-100k":`November 6th, 2024`,"claude-instant-1.2":`November 6th, 2024`,"claude-3-sonnet-20240229":`July 21st, 2025`,"claude-3-opus-20240229":`January 5th, 2026`,"claude-2.1":`July 21st, 2025`,"claude-2.0":`July 21st, 2025`,"claude-3-7-sonnet-latest":`February 19th, 2026`,"claude-3-7-sonnet-20250219":`February 19th, 2026`},ni=[`claude-mythos-preview`,`claude-opus-4-6`],ri=class extends j{constructor(){super(...arguments),this.batches=new tr(this._client)}create(e,t){let n=ei(e),{betas:r,...i}=n;i.model in ti&&console.warn(`The model '${i.model}' is deprecated and will reach end-of-life on ${ti[i.model]}\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),ni.includes(i.model)&&i.thinking&&i.thinking.type===`enabled`&&console.warn(`Using Claude with ${i.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let a=this._client._options.timeout;if(!i.stream&&a==null){let e=rr[i.model]??void 0;a=this._client.calculateNonstreamingTimeout(i.max_tokens,e)}let o=Mn(i.tools,i.messages);return this._client.post(`/v1/messages?beta=true`,{body:i,timeout:a??6e5,...t,headers:N([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},o,t?.headers]),stream:n.stream??!1})}parse(e,t){return t={...t,headers:N([{"anthropic-beta":[...e.betas??[],`structured-outputs-2025-12-15`].toString()},t?.headers])},this.create(e,t).then(t=>sr(t,e,{logger:this._client.logger??console}))}stream(e,t){return zr.createMessage(this,e,t)}countTokens(e,t){let{betas:n,...r}=ei(e);return this._client.post(`/v1/messages/count_tokens?beta=true`,{body:r,...t,headers:N([{"anthropic-beta":[...n??[],`token-counting-2024-11-01`].toString()},t?.headers])})}toolRunner(e,t){return new Qr(this._client,e,t)}},ri.Batches=tr,ri.BetaToolRunner=Qr,ri.ToolError=Vr})),ai,oi=e((()=>{M(),A(),P(),I(),ai=class extends j{list(e,t={},n){let{betas:r,...i}=t??{};return this._client.getAPIList(F`/v1/sessions/${e}/events?beta=true`,k,{query:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}send(e,t,n){let{betas:r,...i}=t;return this._client.post(F`/v1/sessions/${e}/events?beta=true`,{body:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}stream(e,t={},n){let{betas:r}=t??{};return this._client.get(F`/v1/sessions/${e}/events/stream?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers]),stream:!0})}}})),si,ci=e((()=>{M(),A(),P(),I(),si=class extends j{retrieve(e,t,n){let{session_id:r,betas:i}=t;return this._client.get(F`/v1/sessions/${r}/resources/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}update(e,t,n){let{session_id:r,betas:i,...a}=t;return this._client.post(F`/v1/sessions/${r}/resources/${e}?beta=true`,{body:a,...n,headers:N([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...i}=t??{};return this._client.getAPIList(F`/v1/sessions/${e}/resources?beta=true`,k,{query:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}delete(e,t,n){let{session_id:r,betas:i}=t;return this._client.delete(F`/v1/sessions/${r}/resources/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}add(e,t,n){let{betas:r,...i}=t;return this._client.post(F`/v1/sessions/${e}/resources?beta=true`,{body:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}}})),li,ui=e((()=>{M(),oi(),ci(),A(),P(),I(),li=class extends j{constructor(){super(...arguments),this.events=new ai(this._client),this.resources=new si(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/sessions?beta=true`,{body:r,...t,headers:N([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(F`/v1/sessions/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}update(e,t,n){let{betas:r,...i}=t;return this._client.post(F`/v1/sessions/${e}?beta=true`,{body:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/sessions?beta=true`,k,{query:r,...t,headers:N([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(F`/v1/sessions/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(F`/v1/sessions/${e}/archive?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}},li.Events=ai,li.Resources=si})),di,fi=e((()=>{M(),A(),P(),pn(),I(),di=class extends j{create(e,t={},n){let{betas:r,...i}=t??{};return this._client.post(F`/v1/skills/${e}/versions?beta=true`,cn({body:i,...n,headers:N([{"anthropic-beta":[...r??[],`skills-2025-10-02`].toString()},n?.headers])},this._client))}retrieve(e,t,n){let{skill_id:r,betas:i}=t;return this._client.get(F`/v1/skills/${r}/versions/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...i??[],`skills-2025-10-02`].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...i}=t??{};return this._client.getAPIList(F`/v1/skills/${e}/versions?beta=true`,k,{query:i,...n,headers:N([{"anthropic-beta":[...r??[],`skills-2025-10-02`].toString()},n?.headers])})}delete(e,t,n){let{skill_id:r,betas:i}=t;return this._client.delete(F`/v1/skills/${r}/versions/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...i??[],`skills-2025-10-02`].toString()},n?.headers])})}}})),pi,mi=e((()=>{M(),fi(),A(),P(),pn(),I(),pi=class extends j{constructor(){super(...arguments),this.versions=new di(this._client)}create(e={},t){let{betas:n,...r}=e??{};return this._client.post(`/v1/skills?beta=true`,cn({body:r,...t,headers:N([{"anthropic-beta":[...n??[],`skills-2025-10-02`].toString()},t?.headers])},this._client,!1))}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(F`/v1/skills/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`skills-2025-10-02`].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/skills?beta=true`,k,{query:r,...t,headers:N([{"anthropic-beta":[...n??[],`skills-2025-10-02`].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(F`/v1/skills/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`skills-2025-10-02`].toString()},n?.headers])})}},pi.Versions=di})),hi,gi=e((()=>{M(),A(),P(),I(),hi=class extends j{create(e,t,n){let{betas:r,...i}=t;return this._client.post(F`/v1/vaults/${e}/credentials?beta=true`,{body:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}retrieve(e,t,n){let{vault_id:r,betas:i}=t;return this._client.get(F`/v1/vaults/${r}/credentials/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}update(e,t,n){let{vault_id:r,betas:i,...a}=t;return this._client.post(F`/v1/vaults/${r}/credentials/${e}?beta=true`,{body:a,...n,headers:N([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...i}=t??{};return this._client.getAPIList(F`/v1/vaults/${e}/credentials?beta=true`,k,{query:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}delete(e,t,n){let{vault_id:r,betas:i}=t;return this._client.delete(F`/v1/vaults/${r}/credentials/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}archive(e,t,n){let{vault_id:r,betas:i}=t;return this._client.post(F`/v1/vaults/${r}/credentials/${e}/archive?beta=true`,{...n,headers:N([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}}})),_i,vi=e((()=>{M(),gi(),A(),P(),I(),_i=class extends j{constructor(){super(...arguments),this.credentials=new hi(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/vaults?beta=true`,{body:r,...t,headers:N([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(F`/v1/vaults/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}update(e,t,n){let{betas:r,...i}=t;return this._client.post(F`/v1/vaults/${e}?beta=true`,{body:i,...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/vaults?beta=true`,k,{query:r,...t,headers:N([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(F`/v1/vaults/${e}?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(F`/v1/vaults/${e}/archive?beta=true`,{...n,headers:N([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}},_i.Credentials=hi})),q,yi=e((()=>{M(),kn(),Ln(),zn(),Vn(),Gn(),Zn(),ii(),ui(),mi(),vi(),q=class extends j{constructor(){super(...arguments),this.models=new Rn(this._client),this.messages=new ri(this._client),this.agents=new Wn(this._client),this.environments=new On(this._client),this.sessions=new li(this._client),this.vaults=new _i(this._client),this.memoryStores=new Xn(this._client),this.files=new In(this._client),this.skills=new pi(this._client),this.userProfiles=new Bn(this._client)}},q.Models=Rn,q.Messages=ri,q.Agents=Wn,q.Environments=On,q.Sessions=li,q.Vaults=_i,q.MemoryStores=Xn,q.Files=In,q.Skills=pi,q.UserProfiles=Bn})),bi,xi=e((()=>{M(),P(),bi=class extends j{create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/complete`,{body:r,timeout:this._client._options.timeout??6e5,...t,headers:N([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()}},t?.headers]),stream:e.stream??!1})}}}));function Si(e){return e?.output_config?.format}function Ci(e,t,n){let r=Si(t);return!t||!(`parse`in(r??{}))?{...e,content:e.content.map(e=>e.type===`text`?Object.defineProperty({...e},"parsed_output",{value:null,enumerable:!1}):e),parsed_output:null}:wi(e,t,n)}function wi(e,t,n){let r=null,i=e.content.map(e=>{if(e.type===`text`){let n=Ti(t,e.text);return r===null&&(r=n),Object.defineProperty({...e},"parsed_output",{value:n,enumerable:!1})}return e});return{...e,content:i,parsed_output:r}}function Ti(e,t){let n=Si(e);if(n?.type!==`json_schema`)return null;try{return`parse`in n?n.parse(t):JSON.parse(t)}catch(e){throw new i(`Failed to parse structured output: ${e}`)}}var Ei=e((()=>{h()}));function Di(e){return e.type===`tool_use`||e.type===`server_tool_use`}var J,Y,X,Oi,ki,Ai,ji,Mi,Ni,Z,Pi,Fi,Ii,Q,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi=e((()=>{v(),r(),Qn(),gr(),hr(),Ei(),qi=`__json_buf`,Ji=class e{constructor(e,n){J.add(this),this.messages=[],this.receivedMessages=[],Y.set(this,void 0),X.set(this,null),this.controller=new AbortController,Oi.set(this,void 0),ki.set(this,()=>{}),Ai.set(this,()=>{}),ji.set(this,void 0),Mi.set(this,()=>{}),Ni.set(this,()=>{}),Z.set(this,{}),Pi.set(this,!1),Fi.set(this,!1),Ii.set(this,!1),Q.set(this,!1),Li.set(this,void 0),Ri.set(this,void 0),zi.set(this,void 0),Hi.set(this,e=>{if(g(this,Fi,!0,`f`),t(e)&&(e=new o),e instanceof o)return g(this,Ii,!0,`f`),this._emit(`abort`,e);if(e instanceof i)return this._emit(`error`,e);if(e instanceof Error){let t=new i(e.message);return t.cause=e,this._emit(`error`,t)}return this._emit(`error`,new i(String(e)))}),g(this,Oi,new Promise((e,t)=>{g(this,ki,e,`f`),g(this,Ai,t,`f`)}),`f`),g(this,ji,new Promise((e,t)=>{g(this,Mi,e,`f`),g(this,Ni,t,`f`)}),`f`),_(this,Oi,`f`).catch(()=>{}),_(this,ji,`f`).catch(()=>{}),g(this,X,e,`f`),g(this,zi,n?.logger??console,`f`)}get response(){return _(this,Li,`f`)}get request_id(){return _(this,Ri,`f`)}async withResponse(){g(this,Q,!0,`f`);let e=await _(this,Oi,`f`);if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get(`request-id`)}}static fromReadableStream(t){let n=new e(null);return n._run(()=>n._fromReadableStream(t)),n}static createMessage(t,n,r,{logger:i}={}){let a=new e(n,{logger:i});for(let e of n.messages)a._addMessageParam(e);return g(a,X,{...n,stream:!0},`f`),a._run(()=>a._createMessage(t,{...n,stream:!0},{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`stream`}})),a}_run(e){e().then(()=>{this._emitFinal(),this._emit(`end`)},_(this,Hi,`f`))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){this.receivedMessages.push(e),t&&this._emit(`message`,e)}async _createMessage(e,t,n){let r=n?.signal,i;r&&(r.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),r.addEventListener(`abort`,i));try{_(this,J,`m`,Ui).call(this);let{response:r,data:i}=await e.create({...t,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(r);for await(let e of i)_(this,J,`m`,Wi).call(this,e);if(i.controller.signal?.aborted)throw new o;_(this,J,`m`,Gi).call(this)}finally{r&&i&&r.removeEventListener(`abort`,i)}}_connected(e){this.ended||(g(this,Li,e,`f`),g(this,Ri,e?.headers.get(`request-id`),`f`),_(this,ki,`f`).call(this,e),this._emit(`connect`))}get ended(){return _(this,Pi,`f`)}get errored(){return _(this,Fi,`f`)}get aborted(){return _(this,Ii,`f`)}abort(){this.controller.abort()}on(e,t){return(_(this,Z,`f`)[e]||(_(this,Z,`f`)[e]=[])).push({listener:t}),this}off(e,t){let n=_(this,Z,`f`)[e];if(!n)return this;let r=n.findIndex(e=>e.listener===t);return r>=0&&n.splice(r,1),this}once(e,t){return(_(this,Z,`f`)[e]||(_(this,Z,`f`)[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,n)=>{g(this,Q,!0,`f`),e!==`error`&&this.once(`error`,n),this.once(e,t)})}async done(){g(this,Q,!0,`f`),await _(this,ji,`f`)}get currentMessage(){return _(this,Y,`f`)}async finalMessage(){return await this.done(),_(this,J,`m`,Bi).call(this)}async finalText(){return await this.done(),_(this,J,`m`,Vi).call(this)}_emit(e,...t){if(_(this,Pi,`f`))return;e===`end`&&(g(this,Pi,!0,`f`),_(this,Mi,`f`).call(this));let n=_(this,Z,`f`)[e];if(n&&(_(this,Z,`f`)[e]=n.filter(e=>!e.once),n.forEach(({listener:e})=>e(...t))),e===`abort`){let e=t[0];!_(this,Q,`f`)&&!n?.length&&Promise.reject(e),_(this,Ai,`f`).call(this,e),_(this,Ni,`f`).call(this,e),this._emit(`end`);return}if(e===`error`){let e=t[0];!_(this,Q,`f`)&&!n?.length&&Promise.reject(e),_(this,Ai,`f`).call(this,e),_(this,Ni,`f`).call(this,e),this._emit(`end`)}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit(`finalMessage`,_(this,J,`m`,Bi).call(this))}async _fromReadableStream(e,t){let n=t?.signal,r;n&&(n.aborted&&this.controller.abort(),r=this.controller.abort.bind(this.controller),n.addEventListener(`abort`,r));try{_(this,J,`m`,Ui).call(this),this._connected(null);let t=O.fromReadableStream(e,this.controller);for await(let e of t)_(this,J,`m`,Wi).call(this,e);if(t.controller.signal?.aborted)throw new o;_(this,J,`m`,Gi).call(this)}finally{n&&r&&n.removeEventListener(`abort`,r)}}[(Y=new WeakMap,X=new WeakMap,Oi=new WeakMap,ki=new WeakMap,Ai=new WeakMap,ji=new WeakMap,Mi=new WeakMap,Ni=new WeakMap,Z=new WeakMap,Pi=new WeakMap,Fi=new WeakMap,Ii=new WeakMap,Q=new WeakMap,Li=new WeakMap,Ri=new WeakMap,zi=new WeakMap,Hi=new WeakMap,J=new WeakSet,Bi=function(){if(this.receivedMessages.length===0)throw new i(`stream ended without producing a Message with role=assistant`);return this.receivedMessages.at(-1)},Vi=function(){if(this.receivedMessages.length===0)throw new i(`stream ended without producing a Message with role=assistant`);let e=this.receivedMessages.at(-1).content.filter(e=>e.type===`text`).map(e=>e.text);if(e.length===0)throw new i(`stream ended without producing a content block with type=text`);return e.join(` `)},Ui=function(){this.ended||g(this,Y,void 0,`f`)},Wi=function(e){if(this.ended)return;let t=_(this,J,`m`,Ki).call(this,e);switch(this._emit(`streamEvent`,e,t),e.type){case`content_block_delta`:{let n=t.content.at(-1);switch(e.delta.type){case`text_delta`:n.type===`text`&&this._emit(`text`,e.delta.text,n.text||``);break;case`citations_delta`:n.type===`text`&&this._emit(`citation`,e.delta.citation,n.citations??[]);break;case`input_json_delta`:Di(n)&&n.input&&this._emit(`inputJson`,e.delta.partial_json,n.input);break;case`thinking_delta`:n.type===`thinking`&&this._emit(`thinking`,e.delta.thinking,n.thinking);break;case`signature_delta`:n.type===`thinking`&&this._emit(`signature`,n.signature);break;default:e.delta}break}case`message_stop`:this._addMessageParam(t),this._addMessage(Ci(t,_(this,X,`f`),{logger:_(this,zi,`f`)}),!0);break;case`content_block_stop`:this._emit(`contentBlock`,t.content.at(-1));break;case`message_start`:g(this,Y,t,`f`);break;case`content_block_start`:case`message_delta`:break}},Gi=function(){if(this.ended)throw new i(`stream has ended, this shouldn't happen`);let e=_(this,Y,`f`);if(!e)throw new i(`request ended without sending any chunks`);return g(this,Y,void 0,`f`),Ci(e,_(this,X,`f`),{logger:_(this,zi,`f`)})},Ki=function(e){let t=_(this,Y,`f`);if(e.type===`message_start`){if(t)throw new i(`Unexpected event order, got ${e.type} before receiving "message_stop"`);return e.message}if(!t)throw new i(`Unexpected event order, got ${e.type} before "message_start"`);switch(e.type){case`message_stop`:return t;case`message_delta`:return t.stop_reason=e.delta.stop_reason,t.stop_sequence=e.delta.stop_sequence,t.usage.output_tokens=e.usage.output_tokens,e.usage.input_tokens!=null&&(t.usage.input_tokens=e.usage.input_tokens),e.usage.cache_creation_input_tokens!=null&&(t.usage.cache_creation_input_tokens=e.usage.cache_creation_input_tokens),e.usage.cache_read_input_tokens!=null&&(t.usage.cache_read_input_tokens=e.usage.cache_read_input_tokens),e.usage.server_tool_use!=null&&(t.usage.server_tool_use=e.usage.server_tool_use),t;case`content_block_start`:return t.content.push({...e.content_block}),t;case`content_block_delta`:{let n=t.content.at(e.index);switch(e.delta.type){case`text_delta`:n?.type===`text`&&(t.content[e.index]={...n,text:(n.text||``)+e.delta.text});break;case`citations_delta`:n?.type===`text`&&(t.content[e.index]={...n,citations:[...n.citations??[],e.delta.citation]});break;case`input_json_delta`:if(n&&Di(n)){let r=n[qi]||``;r+=e.delta.partial_json;let i={...n};Object.defineProperty(i,qi,{value:r,enumerable:!1,writable:!0}),r&&(i.input=mr(r)),t.content[e.index]=i}break;case`thinking_delta`:n?.type===`thinking`&&(t.content[e.index]={...n,thinking:n.thinking+e.delta.thinking});break;case`signature_delta`:n?.type===`thinking`&&(t.content[e.index]={...n,signature:e.delta.signature});break;default:e.delta}return t}case`content_block_stop`:return t}},Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on(`streamEvent`,n=>{let r=t.shift();r?r.resolve(n):e.push(n)}),this.on(`end`,()=>{n=!0;for(let e of t)e.resolve(void 0);t.length=0}),this.on(`abort`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),this.on(`error`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((e,n)=>t.push({resolve:e,reject:n})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new O(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}})),Xi,Zi=e((()=>{M(),A(),P(),er(),Qn(),I(),Xi=class extends j{create(e,t){return this._client.post(`/v1/messages/batches`,{body:e,...t})}retrieve(e,t){return this._client.get(F`/v1/messages/batches/${e}`,t)}list(e={},t){return this._client.getAPIList(`/v1/messages/batches`,tn,{query:e,...t})}delete(e,t){return this._client.delete(F`/v1/messages/batches/${e}`,t)}cancel(e,t){return this._client.post(F`/v1/messages/batches/${e}/cancel`,t)}async results(e,t){let n=await this.retrieve(e);if(!n.results_url)throw new i(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...t,headers:N([{Accept:`application/binary`},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((e,t)=>$n.fromResponse(t.response,t.controller))}}})),Qi,$i,ea,ta=e((()=>{M(),P(),Fn(),Yi(),Ei(),Zi(),ir(),Qi=class extends j{constructor(){super(...arguments),this.batches=new Xi(this._client)}create(e,t){e.model in $i&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${$i[e.model]}\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),ea.includes(e.model)&&e.thinking&&e.thinking.type===`enabled`&&console.warn(`Using Claude with ${e.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let n=this._client._options.timeout;if(!e.stream&&n==null){let t=rr[e.model]??void 0;n=this._client.calculateNonstreamingTimeout(e.max_tokens,t)}let r=Mn(e.tools,e.messages);return this._client.post(`/v1/messages`,{body:e,timeout:n??6e5,...t,headers:N([r,t?.headers]),stream:e.stream??!1})}parse(e,t){return this.create(e,t).then(t=>wi(t,e,{logger:this._client.logger??console}))}stream(e,t){return Ji.createMessage(this,e,t,{logger:this._client.logger??console})}countTokens(e,t){return this._client.post(`/v1/messages/count_tokens`,{body:e,...t})}},$i={"claude-1.3":`November 6th, 2024`,"claude-1.3-100k":`November 6th, 2024`,"claude-instant-1.1":`November 6th, 2024`,"claude-instant-1.1-100k":`November 6th, 2024`,"claude-instant-1.2":`November 6th, 2024`,"claude-3-sonnet-20240229":`July 21st, 2025`,"claude-3-opus-20240229":`January 5th, 2026`,"claude-2.1":`July 21st, 2025`,"claude-2.0":`July 21st, 2025`,"claude-3-7-sonnet-latest":`February 19th, 2026`,"claude-3-7-sonnet-20250219":`February 19th, 2026`,"claude-3-5-haiku-latest":`February 19th, 2026`,"claude-3-5-haiku-20241022":`February 19th, 2026`,"claude-opus-4-0":`June 15th, 2026`,"claude-opus-4-20250514":`June 15th, 2026`,"claude-sonnet-4-0":`June 15th, 2026`,"claude-sonnet-4-20250514":`June 15th, 2026`},ea=[`claude-mythos-preview`,`claude-opus-4-6`],Qi.Batches=Xi})),na,ra=e((()=>{M(),A(),P(),I(),na=class extends j{retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(F`/v1/models/${e}`,{...n,headers:N([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/models`,tn,{query:r,...t,headers:N([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()}},t?.headers])})}}})),ia=e((()=>{Sn(),yi(),xi(),ta(),ra()})),aa,oa,sa,ca,la,ua,$,da,fa=e((()=>{v(),re(),pe(),he(),r(),Te(),je(),Ne(),Fe(),ge(),h(),Ye(),Qe(),Ft(),A(),xn(),ia(),Zt(),xi(),ra(),yi(),ta(),P(),$e(),pt(),la=`\\n\\nHuman:`,ua=`\\n\\nAssistant:`,$=class{get credentials(){return this._authState.provider}constructor({baseURL:e=C(`ANTHROPIC_BASE_URL`),apiKey:t,authToken:n,...r}={}){if(aa.add(this),this._requestAuthFlags=new WeakMap,sa.set(this,void 0),t===void 0&&(t=r.profile==null?C(`ANTHROPIC_API_KEY`)??null:null),n===void 0&&(n=r.profile==null?C(`ANTHROPIC_AUTH_TOKEN`)??null:null),r.profile!=null&&(r.credentials!=null||r.config!=null))throw TypeError("Pass at most one of `profile`, `credentials`, or `config`.");let a={apiKey:t,authToken:n,...r,baseURL:e||`https://api.anthropic.com`};if(!a.dangerouslyAllowBrowser&&ye())throw new i(`It looks like you're running in a browser-like environment.
29
+
30
+ This is disabled by default, as it risks exposing your secret API credentials to attackers.
31
+ If you understand the risks and have appropriate mitigations in place,
32
+ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
33
+
34
+ new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
35
+ `);this.baseURL=a.baseURL,this._baseURLIsExplicit=r.__baseURLIsExplicit??!!e,this.timeout=a.timeout??oa.DEFAULT_TIMEOUT,this.logger=a.logger??console;let o=`warn`;this.logLevel=o,this.logLevel=ut(a.logLevel,`ClientOptions.logLevel`,this)??ut(C(`ANTHROPIC_LOG`),`process.env['ANTHROPIC_LOG']`,this)??o,this.fetchOptions=a.fetchOptions,this.maxRetries=a.maxRetries??2,this.fetch=a.fetch??Ee(),g(this,sa,Me,`f`);let s=C(`ANTHROPIC_CUSTOM_HEADERS`);if(s){let e={};for(let t of s.split(`
36
+ `)){let n=t.indexOf(`:`);n>=0&&(e[t.substring(0,n).trim()]=t.substring(n+1).trim())}a.defaultHeaders={...e,...a.defaultHeaders}}let c=r.__auth;if(delete a.__auth,delete a.__baseURLIsExplicit,this._options=a,this.apiKey=typeof t==`string`?t:null,this.authToken=n,c)this._authState=c,!this._baseURLIsExplicit&&c.baseURL&&(this.baseURL=c.baseURL);else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let e=a.credentials??null;if(e)this._authState.provider=e,this._authState.tokenCache=this._makeTokenCache(e);else if(a.config!=null){let e=At(a.config,this._credentialResolverOptions());this._authState.provider=e.provider,this._authState.tokenCache=this._makeTokenCache(e.provider),this._authState.extraHeaders=e.extraHeaders,this._applyCredentialBaseURL(e.baseURL)}else a.profile==null?this._authState.resolution=this._resolveDefaultCredentials():this._authState.resolution=this._resolveDefaultCredentials(a.profile)}}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,``);this._authState.baseURL=t,this._baseURLIsExplicit||(this.baseURL=t)}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this.fetch,userAgent:this.getUserAgent(),onCacheWriteError:e=>{w(this).debug(`credential cache write failed (best-effort)`,e)},onSafetyWarning:e=>{w(this).warn(e)}}}_makeTokenCache(e){return new Ze(e,e=>{w(this).debug(`advisory token refresh failed; serving cached token`,e)})}withOptions(e){let t=`credentials`in e||`config`in e||`profile`in e,n=`apiKey`in e||`authToken`in e||t,r={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:n?void 0:this._authState,__baseURLIsExplicit:`baseURL`in e||this._baseURLIsExplicit};return new this.constructor(r)}async _resolveDefaultCredentials(e){try{let t=await jt(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(e!=null)throw new i(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(e){this._authState.error=e}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(e.get(`x-api-key`)||e.get(`authorization`))){if(this._authState.error)throw this._authState.error;if(!(this._authState.tokenCache||this._authState.resolution)&&!(this.apiKey&&e.get(`x-api-key`))&&!t.has(`x-api-key`)&&!(this.authToken&&e.get(`authorization`))&&!t.has(`authorization`))throw Error(`Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted`)}}_authFlags(e){let t=this._requestAuthFlags.get(e);return t||(t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t)),t}async authHeaders(e){if(this._authState.resolution&&await this._authState.resolution,!this._authState.error){if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,N([{Authorization:`Bearer ${t}`}])}return N([await this.apiKeyAuth(e),await this.bearerAuth(e)])}}async apiKeyAuth(e){if(this.apiKey!=null)return N([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return N([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return Pe(e)}getUserAgent(){return`${this.constructor.name}/JS ${y}`}defaultIdempotencyKey(){return`stainless-node-retry-${ne()}`}makeStatusError(e,t,n,r){return a.generate(e,t,n,r)}buildURL(e,t,n){let r=!_(this,aa,`m`,ca).call(this)&&n||this.baseURL,i=ce(e)?new URL(e):new URL(r+(r.endsWith(`/`)&&e.startsWith(`/`)?e.slice(1):e)),a=this.defaultQuery(),o=Object.fromEntries(i.searchParams);return(!ae(a)||!ae(o))&&(t={...o,...a,...t}),typeof t==`object`&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new i(`Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details`);return 600*1e3}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){if(this._authState.tokenCache&&this.apiKey==null){let t=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[e,n]of Object.entries(this._authState.extraHeaders))t.has(e)||t.set(e,n);(t.get(`anthropic-beta`)?.split(`,`).map(e=>e.trim()))?.includes(`oauth-2025-04-20`)||t.append(`anthropic-beta`,We),e.headers=t}}get(e,t){return this.methodRequest(`get`,e,t)}post(e,t){return this.methodRequest(`post`,e,t)}patch(e,t){return this.methodRequest(`patch`,e,t)}put(e,t){return this.methodRequest(`put`,e,t)}delete(e,t){return this.methodRequest(`delete`,e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(n=>({method:e,path:t,...n})))}request(e,t=null){return new Xt(this,this.makeRequest(e,t,void 0))}async makeRequest(e,r,i){let a=await e,l=a.maxRetries??this.maxRetries;r??(r=l,this._requestAuthFlags.delete(a)),await this.prepareOptions(a);let{req:u,url:d,timeout:f}=await this.buildRequest(a,{retryCount:l-r});await this.prepareRequest(u,{url:d,options:a});let p=`log_`+(Math.random()*(1<<24)|0).toString(16).padStart(6,`0`),ee=i===void 0?``:`, retryOf: ${i}`,m=Date.now();if(w(this).debug(`[${p}] sending request`,T({retryOfRequestLogID:i,method:a.method,url:d,options:a,headers:u.headers})),a.signal?.aborted)throw new o;let te=new AbortController,h=await this.fetchWithTimeout(d,u,f,te).catch(n),g=Date.now();if(h instanceof globalThis.Error){let e=`retrying, ${r} attempts remaining`;if(a.signal?.aborted)throw new o;let n=t(h)||/timed? ?out/i.test(String(h)+(`cause`in h?String(h.cause):``));if(r)return w(this).info(`[${p}] connection ${n?`timed out`:`failed`} - ${e}`),w(this).debug(`[${p}] connection ${n?`timed out`:`failed`} (${e})`,T({retryOfRequestLogID:i,url:d,durationMs:g-m,message:h.message})),this.retryRequest(a,r,i??p);throw w(this).info(`[${p}] connection ${n?`timed out`:`failed`} - error; no more retries left`),w(this).debug(`[${p}] connection ${n?`timed out`:`failed`} (error; no more retries left)`,T({retryOfRequestLogID:i,url:d,durationMs:g-m,message:h.message})),n?new c:new s({cause:h})}let _=`[${p}${ee}${[...h.headers.entries()].filter(([e])=>e===`request-id`).map(([e,t])=>`, `+e+`: `+JSON.stringify(t)).join(``)}] ${u.method} ${d} ${h.ok?`succeeded`:`failed`} with status ${h.status} in ${g-m}ms`;if(!h.ok){let e=await this.shouldRetry(h,a);if(r&&e){let e=`retrying, ${r} attempts remaining`;return await Ae(h.body),w(this).info(`${_} - ${e}`),w(this).debug(`[${p}] response error (${e})`,T({retryOfRequestLogID:i,url:h.url,status:h.status,headers:h.headers,durationMs:g-m})),this.retryRequest(a,r,i??p,h.headers)}let t=e?`error; no more retries left`:`error; not retryable`;w(this).info(`${_} - ${t}`);let o=await h.text().catch(e=>n(e).message),s=fe(o),c=s?void 0:o;throw w(this).debug(`[${p}] response error (${t})`,T({retryOfRequestLogID:i,url:h.url,status:h.status,headers:h.headers,message:c,durationMs:Date.now()-m})),this.makeStatusError(h.status,s,c,h.headers)}return w(this).info(_),w(this).debug(`[${p}] response start`,T({retryOfRequestLogID:i,url:h.url,status:h.status,headers:h.headers,durationMs:g-m})),{response:h,options:a,controller:te,requestLogID:p,retryOfRequestLogID:i,startTime:m}}getAPIList(e,t,n){return this.requestAPIList(t,n&&`then`in n?n.then(t=>({method:`get`,path:e,...t})):{method:`get`,path:e,...n})}requestAPIList(e,t){let n=this.makeRequest(t,null,void 0);return new en(this,n,e)}async fetchWithTimeout(e,t,n,r){let{signal:i,method:a,...o}=t||{},s=this._makeAbort(r);i&&i.addEventListener(`abort`,s,{once:!0});let c=setTimeout(s,n),l=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||typeof o.body==`object`&&o.body!==null&&Symbol.asyncIterator in o.body,u={signal:r.signal,...l?{duplex:`half`}:{},method:`GET`,...o};a&&(u.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,u)}finally{clearTimeout(c)}}async shouldRetry(e,t){let n=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&n.usedTokenCache&&!n.didRefreshFor401)return n.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let r=e.headers.get(`x-should-retry`);return r===`true`?!0:r===`false`?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,n,r){let i,a=r?.get(`retry-after-ms`);if(a){let e=parseFloat(a);Number.isNaN(e)||(i=e)}let o=r?.get(`retry-after`);if(o&&!i){let e=parseFloat(o);i=Number.isNaN(e)?Date.parse(o)-Date.now():e*1e3}if(i===void 0){let n=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,n)}return await me(i),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e;return Math.min(.5*2**n,8)*(1-Math.random()*.25)*1e3}calculateNonstreamingTimeout(e,t){let n=600*1e3;if(36e5*e/128e3>n||t!=null&&e>t)throw new i(`Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details`);return n}async buildRequest(e,{retryCount:t=0}={}){let n={...e},{method:r,path:i,query:a,defaultBaseURL:o}=n;this._authState.resolution&&await this._authState.resolution,!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL&&(this.baseURL=this._authState.baseURL);let s=this.buildURL(i,a,o);`timeout`in n&&de(`timeout`,n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:c,body:l}=this.buildBody({options:n});return{req:{method:r,headers:await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t}),...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:`half`},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:s,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let i={};this.idempotencyHeader&&t!==`get`&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let a=N([i,{Accept:`application/json`,"User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...we(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":`true`}:void 0,"anthropic-version":`2023-06-01`},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=N([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==`string`&&n.values.has(`content-type`)||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e==`object`&&(Symbol.asyncIterator in e||Symbol.iterator in e&&`next`in e&&typeof e.next==`function`)?{bodyHeaders:void 0,body:Oe(e)}:typeof e==`object`&&n.values.get(`content-type`)===`application/x-www-form-urlencoded`?{bodyHeaders:{"content-type":`application/x-www-form-urlencoded`},body:this.stringifyQuery(e)}:_(this,sa,`f`).call(this,{body:e,headers:n})}},oa=$,sa=new WeakMap,aa=new WeakSet,ca=function(){return this.baseURL!==`https://api.anthropic.com`},$.Anthropic=oa,$.HUMAN_PROMPT=la,$.AI_PROMPT=ua,$.DEFAULT_TIMEOUT=6e5,$.AnthropicError=i,$.APIError=a,$.APIConnectionError=s,$.APIConnectionTimeoutError=c,$.APIUserAbortError=o,$.NotFoundError=f,$.ConflictError=p,$.RateLimitError=m,$.BadRequestError=l,$.AuthenticationError=u,$.InternalServerError=te,$.PermissionDeniedError=d,$.UnprocessableEntityError=ee,$.toFile=mn,da=class extends ${constructor(){super(...arguments),this.completions=new bi(this),this.messages=new Qi(this),this.models=new na(this),this.beta=new q(this)}},da.Completions=bi,da.Messages=Qi,da.Models=na,da.Beta=q}));export{a as _,Qi as a,xi as c,gr as d,Qn as f,Gt as g,O as h,ia as i,q as l,Zt as m,$ as n,ta as o,A as p,fa as r,bi as s,da as t,yi as u,i as v,h as y};
@@ -0,0 +1,8 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{A as r,D as i,G as a,H as o,I as s,R as c,W as l,Y as u,Z as d,et as f,it as p,nt as m,q as h,t as g}from"./protocols-CnYQjBlj.js";import{F as ee,i as te,r as ne}from"./serde-f76bObzR.js";import{m as re,o as ie,s as ae,t as oe}from"./config-BSXLgwpD.js";import{_ as se,t as ce}from"./dist-es-BF6bR-Ik.js";import{env as le,versions as ue}from"node:process";import{platform as de,release as fe}from"node:os";import{Readable as pe}from"node:stream";var _,me,he=e((()=>{_={warningEmitted:!1},me=e=>{if(e&&!_.warningEmitted){if(process.env.AWS_SDK_JS_NODE_VERSION_SUPPORT_WARNING_DISABLED===`true`){_.warningEmitted=!0;return}parseInt(e.substring(1,e.indexOf(`.`)))<22&&(_.warningEmitted=!0,process.emitWarning(`NodeVersionSupportWarning: The AWS SDK for JavaScript (v3)
2
+ versions published after the first week of January 2027
3
+ will require node >=22. You are running node ${e}.
4
+
5
+ To continue receiving updates to AWS services, bug fixes,
6
+ and security updates please upgrade to node >=22.
7
+
8
+ More information can be found at: https://a.co/c895JFp`))}}}));function ge(e,t,n){return e.$source||(e.$source={}),e.$source[t]=n,e}var _e=e((()=>{})),ve,ye=e((()=>{ve=e=>e?.body instanceof pe||typeof ReadableStream<`u`&&e?.body instanceof ReadableStream})),v,y,b,be,xe,Se=e((()=>{v=(e,t)=>{let n=[];if(e&&n.push(e),t)for(let e of t)n.push(e);return n},y=(e,t)=>`${e||`anonymous`}${t&&t.length>0?` (a.k.a. ${t.join(`,`)})`:``}`,b=()=>{let e=[],t=[],n=!1,r=new Set,i=e=>e.sort((e,t)=>be[t.step]-be[e.step]||xe[t.priority||`normal`]-xe[e.priority||`normal`]),a=n=>{let i=!1,a=e=>{let t=v(e.name,e.aliases);if(t.includes(n)){i=!0;for(let e of t)r.delete(e);return!1}return!0};return e=e.filter(a),t=t.filter(a),i},o=n=>{let i=!1,a=e=>{if(e.middleware===n){i=!0;for(let t of v(e.name,e.aliases))r.delete(t);return!1}return!0};return e=e.filter(a),t=t.filter(a),i},s=n=>(e.forEach(e=>{n.add(e.middleware,{...e})}),t.forEach(e=>{n.addRelativeTo(e.middleware,{...e})}),n.identifyOnResolve?.(u.identifyOnResolve()),n),c=e=>{let t=[];return e.before.forEach(e=>{e.before.length===0&&e.after.length===0?t.push(e):t.push(...c(e))}),t.push(e),e.after.reverse().forEach(e=>{e.before.length===0&&e.after.length===0?t.push(e):t.push(...c(e))}),t},l=(n=!1)=>{let r=[],a=[],o={};return e.forEach(e=>{let t={...e,before:[],after:[]};for(let e of v(t.name,t.aliases))o[e]=t;r.push(t)}),t.forEach(e=>{let t={...e,before:[],after:[]};for(let e of v(t.name,t.aliases))o[e]=t;a.push(t)}),a.forEach(e=>{if(e.toMiddleware){let t=o[e.toMiddleware];if(t===void 0){if(n)return;throw Error(`${e.toMiddleware} is not found when adding ${y(e.name,e.aliases)} middleware ${e.relation} ${e.toMiddleware}`)}e.relation===`after`&&t.after.push(e),e.relation===`before`&&t.before.push(e)}}),i(r).map(c).reduce((e,t)=>(e.push(...t),e),[])},u={add:(t,n={})=>{let{name:i,override:a,aliases:o}=n,s={step:`initialize`,priority:`normal`,middleware:t,...n},c=v(i,o);if(c.length>0){if(c.some(e=>r.has(e))){if(!a)throw Error(`Duplicate middleware name '${y(i,o)}'`);for(let t of c){let n=e.findIndex(e=>e.name===t||e.aliases?.some(e=>e===t));if(n===-1)continue;let r=e[n];if(r.step!==s.step||s.priority!==r.priority)throw Error(`"${y(r.name,r.aliases)}" middleware with ${r.priority} priority in ${r.step} step cannot be overridden by "${y(i,o)}" middleware with ${s.priority} priority in ${s.step} step.`);e.splice(n,1)}}for(let e of c)r.add(e)}e.push(s)},addRelativeTo:(e,n)=>{let{name:i,override:a,aliases:o}=n,s={middleware:e,...n},c=v(i,o);if(c.length>0){if(c.some(e=>r.has(e))){if(!a)throw Error(`Duplicate middleware name '${y(i,o)}'`);for(let e of c){let n=t.findIndex(t=>t.name===e||t.aliases?.some(t=>t===e));if(n===-1)continue;let r=t[n];if(r.toMiddleware!==s.toMiddleware||r.relation!==s.relation)throw Error(`"${y(r.name,r.aliases)}" middleware ${r.relation} "${r.toMiddleware}" middleware cannot be overridden by "${y(i,o)}" middleware ${s.relation} "${s.toMiddleware}" middleware.`);t.splice(n,1)}}for(let e of c)r.add(e)}t.push(s)},clone:()=>s(b()),use:e=>{e.applyToStack(u)},remove:e=>typeof e==`string`?a(e):o(e),removeByTag:n=>{let i=!1,a=e=>{let{tags:t,name:a,aliases:o}=e;if(t&&t.includes(n)){let e=v(a,o);for(let t of e)r.delete(t);return i=!0,!1}return!0};return e=e.filter(a),t=t.filter(a),i},concat:e=>{let t=s(b());return t.use(e),t.identifyOnResolve(n||t.identifyOnResolve()||(e.identifyOnResolve?.()??!1)),t},applyToStack:s,identify:()=>l(!0).map(e=>{let t=e.step??e.relation+` `+e.toMiddleware;return y(e.name,e.aliases)+` - `+t}),identifyOnResolve(e){return typeof e==`boolean`&&(n=e),n},resolve:(e,t)=>{for(let n of l().map(e=>e.middleware).reverse())e=n(e,t);return n&&console.log(u.identify()),e}};return u},be={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},xe={high:3,normal:2,low:1}})),Ce,we=e((()=>{Se(),t(),Ce=class{constructor(e){n(this,`config`,void 0),n(this,`middlewareStack`,b()),n(this,`initConfig`,void 0),n(this,`handlers`,void 0),this.config=e;let{protocol:t,protocolSettings:r}=e;r&&typeof t==`function`&&(e.protocol=new t(r))}send(e,t,n){let r=typeof t==`function`?void 0:t,i=typeof t==`function`?t:n,a=r===void 0&&this.config.cacheMiddleware===!0,o;if(a){this.handlers||(this.handlers=new WeakMap);let t=this.handlers;t.has(e.constructor)?o=t.get(e.constructor):(o=e.resolveMiddleware(this.middlewareStack,this.config,r),t.set(e.constructor,o))}else delete this.handlers,o=e.resolveMiddleware(this.middlewareStack,this.config,r);if(i)o(e).then(e=>i(null,e.output),e=>i(e)).catch(()=>{});else return o(e).then(e=>e.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}}));function Te(e,t){if(t==null)return t;let n=r.of(e);if(n.getMergedTraits().sensitive)return x;if(n.isListSchema()){if(n.getValueSchema().getMergedTraits().sensitive)return x}else if(n.isMapSchema()){if(n.getKeySchema().getMergedTraits().sensitive||n.getValueSchema().getMergedTraits().sensitive)return x}else if(n.isStructSchema()&&typeof t==`object`){let e=t,r={};for(let[t,i]of n.structIterator())e[t]!=null&&(r[t]=Te(i,e[t]));return r}return t}var x,Ee=e((()=>{i(),x=`***SensitiveInformation***`})),S,De,Oe=e((()=>{d(),Se(),Ee(),t(),S=class{constructor(){n(this,`middlewareStack`,b()),n(this,`schema`,void 0)}static classBuilder(){return new De}resolveMiddlewareWithContext(e,t,n,{middlewareFn:r,clientName:i,commandName:a,inputFilterSensitiveLog:o,outputFilterSensitiveLog:s,smithyContext:c,additionalContext:l,CommandCtor:u}){for(let i of r.bind(this)(u,e,t,n))this.middlewareStack.use(i);let d=e.concat(this.middlewareStack),{logger:p}=t,m={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:o,outputFilterSensitiveLog:s,[f]:{commandInstance:this,...c},...l},{requestHandler:h}=t,g=n??{};return c.eventStream&&(g={isEventStream:!0,...g}),d.resolve(e=>h.handle(e.request,g),m)}},De=class{constructor(){n(this,`_init`,()=>{}),n(this,`_ep`,{}),n(this,`_middlewareFn`,()=>[]),n(this,`_commandName`,``),n(this,`_clientName`,``),n(this,`_additionalContext`,{}),n(this,`_smithyContext`,{}),n(this,`_inputFilterSensitiveLog`,void 0),n(this,`_outputFilterSensitiveLog`,void 0),n(this,`_serializer`,null),n(this,`_deserializer`,null),n(this,`_operationSchema`,void 0)}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,n={}){return this._smithyContext={service:e,operation:t,...n},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=e=>e,t=e=>e){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){let e=this,t;return t=class extends S{static getEndpointParameterInstructions(){return e._ep}constructor(...[t]){super(),n(this,`input`,void 0),n(this,`serialize`,e._serializer),n(this,`deserialize`,e._deserializer),this.input=t??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(n,r,i){let a=e._operationSchema,o=a?.[4]??a?.input,s=a?.[5]??a?.output;return this.resolveMiddlewareWithContext(n,r,i,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(a?Te.bind(null,o):e=>e),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(a?Te.bind(null,s):e=>e),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}})),ke,Ae=e((()=>{ke=(e,t,n)=>{for(let[n,r]of Object.entries(e)){let e=async function(e,t,n){let i=new r(e);if(typeof t==`function`)this.send(i,t);else if(typeof n==`function`){if(typeof t!=`object`)throw Error(`Expected http options but got ${typeof t}`);this.send(i,t||{},n)}else return this.send(i,t)},i=(n[0].toLowerCase()+n.slice(1)).replace(/Command$/,``);t.prototype[i]=e}let{paginators:r={},waiters:i={}}=n??{};for(let[e,n]of Object.entries(r))t.prototype[e]===void 0&&(t.prototype[e]=function(e={},t,...r){return n({...t,client:this},e,...r)});for(let[e,n]of Object.entries(i))t.prototype[e]===void 0&&(t.prototype[e]=async function(e={},t,...r){let i=t;return typeof t==`number`&&(i={maxWaitTime:t}),n({...i,client:this},e,...r)})}})),je,Me,Ne,Pe=e((()=>{t(),je=Symbol.hasInstance,Me=class e extends Error{constructor(e){super(e.message),n(this,`$fault`,void 0),n(this,`$response`,void 0),n(this,`$retryable`,void 0),n(this,`$metadata`,void 0),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(t){if(!t)return!1;let n=t;return e.prototype.isPrototypeOf(n)||!!n.$fault&&!!n.$metadata&&(n.$fault===`client`||n.$fault===`server`)}static[je](t){if(!t)return!1;let n=t;return this===e?e.isInstance(t):e.isInstance(t)?n.name&&this.name?this.prototype.isPrototypeOf(t)||n.name===this.name:this.prototype.isPrototypeOf(t):!1}},Ne=(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)})),Fe,Ie=e((()=>{Fe=e=>{switch(e){case`standard`:return{retryMode:`standard`,connectionTimeout:3100};case`in-region`:return{retryMode:`standard`,connectionTimeout:1100};case`cross-region`:return{retryMode:`standard`,connectionTimeout:3100};case`mobile`:return{retryMode:`standard`,connectionTimeout:3e4};default:return{}}}})),Le,Re,ze=e((()=>{Le=!1,Re=e=>{e&&!Le&&parseInt(e.substring(1,e.indexOf(`.`)))<16&&(Le=!0)}})),Be,Ve,He,Ue=e((()=>{d(),Be=Object.values(m),Ve=e=>{let t=[];for(let n in m){let r=m[n];e[r]!==void 0&&t.push({algorithmId:()=>r,checksumConstructor:()=>e[r]})}for(let[n,r]of Object.entries(e.checksumAlgorithms??{}))t.push({algorithmId:()=>n,checksumConstructor:()=>r});return{addChecksumAlgorithm(n){e.checksumAlgorithms=e.checksumAlgorithms??{};let r=n.algorithmId(),i=n.checksumConstructor();Be.includes(r)?e.checksumAlgorithms[r.toUpperCase()]=i:e.checksumAlgorithms[r]=i,t.push(n)},checksumAlgorithms(){return t}}},He=e=>{let t={};return e.checksumAlgorithms().forEach(e=>{let n=e.algorithmId();Be.includes(n)&&(t[n]=e.checksumConstructor())}),t}})),We,Ge,Ke=e((()=>{We=e=>({setRetryStrategy(t){e.retryStrategy=t},retryStrategy(){return e.retryStrategy}}),Ge=e=>{let t={};return t.retryStrategy=e.retryStrategy(),t}})),qe,Je,Ye=e((()=>{Ue(),Ke(),qe=e=>Object.assign(Ve(e),We(e)),Je=e=>Object.assign(He(e),Ge(e))})),Xe,Ze=e((()=>{Xe=e=>{let t=`#text`;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&e[n][t]!==void 0?e[n]=e[n][t]:typeof e[n]==`object`&&e[n]!==null&&(e[n]=Xe(e[n]));return e}})),Qe,$e=e((()=>{Qe=class{trace(){}debug(){}info(){}warn(){}error(){}}}));function et(e,t,n,r){return function(i,a,o,s,c={}){let l=Object.assign({},e,i);return S.classBuilder().ep(l).m(function(e,t,n,i){let o=a.call(this,e,t,n,i);return o.unshift(r(n,e.getEndpointParameterInstructions())),o}).s(t,o,c).n(n,o.charAt(0).toUpperCase()+o.slice(1)+`Command`).sc(s).build()}}var tt=e((()=>{Oe()})),C=e((()=>{Se(),s(),we(),Oe(),Ae(),Pe(),Ie(),ze(),Ye(),Ue(),Ke(),Ze(),$e(),Ee(),tt()})),nt,rt,it,at=e((()=>{oe(),nt=`AWS_ENDPOINT_URL`,rt=`endpoint_url`,it=e=>({environmentVariableSelector:t=>{let n=e.split(` `).map(e=>e.toUpperCase()),r=t[[nt,...n].join(`_`)];if(r)return r;let i=t[nt];if(i)return i},configFileSelector:(t,n)=>{if(n&&t.services){let r=n[[`services`,t.services].join(`.`)];if(r){let t=r[[e.split(` `).map(e=>e.toLowerCase()).join(`_`),rt].join(`.`)];if(t)return t}}let r=t[rt];if(r)return r},default:void 0})})),w,ot=e((()=>{oe(),at(),w=async e=>re(it(e??``))()})),st,ct,lt,ut,dt,ft,pt=e((()=>{st=async e=>{let t=e?.Bucket||``;if(typeof e.Bucket==`string`&&(e.Bucket=t.replace(/#/g,`%23`).replace(/\?/g,`%3F`)),ft(t)){if(e.ForcePathStyle===!0)throw Error(`Path-style addressing cannot be used with ARN buckets`)}else(!dt(t)||t.indexOf(`.`)!==-1&&!String(e.Endpoint).startsWith(`http:`)||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e},ct=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,lt=/(\d+\.){3}\d+/,ut=/\.\./,dt=e=>ct.test(e)&&!lt.test(e)&&!ut.test(e),ft=e=>{let[t,n,r,,,i]=e.split(`:`),a=t===`arn`&&e.split(`:`).length>=6,o=!!(a&&n&&r&&i);if(a&&!o)throw Error(`Invalid ARN: ${e} was an invalid ARN.`);return o}})),mt=e((()=>{pt()})),ht,gt=e((()=>{ht=(e,t,n,r=!1)=>{let i=async()=>{let i;return i=r?n.clientContextParams?.[e]??n[e]??n[t]:n[e]??n[t],typeof i==`function`?i():i};return e===`credentialScope`||t===`CredentialScope`?async()=>{let e=typeof n.credentials==`function`?await n.credentials():n.credentials;return e?.credentialScope??e?.CredentialScope}:e===`accountId`||t===`AccountId`?async()=>{let e=typeof n.credentials==`function`?await n.credentials():n.credentials;return e?.accountId??e?.AccountId}:e===`endpoint`||t===`endpoint`?async()=>{if(n.isCustomEndpoint===!1)return;let e=await i();if(e&&typeof e==`object`){if(`url`in e)return e.url.href;if(`hostname`in e){let{protocol:t,hostname:n,port:r,path:i}=e;return`${t}//${n}${r?`:`+r:``}${i}`}}return e}:i}})),_t=e((()=>{s()}));function vt(e){return async(t,n,r,i)=>{if(!r.isCustomEndpoint){let t;t=r.serviceConfiguredEndpoint?await r.serviceConfiguredEndpoint():await e(r.serviceId),t&&(r.endpoint=()=>Promise.resolve(c(t)),r.isCustomEndpoint=!0)}let a=await yt(t,n,r);if(typeof r.endpointProvider!=`function`)throw Error(`config.endpointProvider is not set.`);let o=r.endpointProvider(a,i);if(r.isCustomEndpoint&&r.endpoint){let e=await r.endpoint();if(e?.headers){o.headers??(o.headers={});for(let[t,n]of Object.entries(e.headers))o.headers[t]=Array.isArray(n)?n:[n]}}return o}}var yt,T=e((()=>{mt(),gt(),_t(),yt=async(e,t,n)=>{let r={},i=t?.getEndpointParameterInstructions?.()||{};for(let[t,a]of Object.entries(i))switch(a.type){case`staticContextParams`:r[t]=a.value;break;case`contextParams`:r[t]=e[a.name];break;case`clientContextParams`:case`builtInParams`:r[t]=await ht(a.name,t,n,a.type!==`builtInParams`)();break;case`operationContextParams`:r[t]=a.get(e);break;default:throw Error(`Unrecognized endpoint parameter instruction: `+JSON.stringify(a))}return Object.keys(i).length===0&&Object.assign(r,n),String(n.serviceId).toLowerCase()===`s3`&&await st(r),r}}));function bt(e,t,n){e.__smithy_context?e.__smithy_context.features||(e.__smithy_context.features={}):e.__smithy_context={features:{}},e.__smithy_context.features[t]=n}function xt(e){let t=vt(e);return({config:e,instructions:n})=>(r,i)=>async a=>{e.isCustomEndpoint&&bt(i,`ENDPOINT_OVERRIDE`,`N`);let o=await t(a.input,{getEndpointParameterInstructions(){return n}},{...e},i);i.endpointV2=o,i.authSchemes=o.properties?.authSchemes;let s=i.authSchemes?.[0];if(s){i.signing_region=s.signingRegion,i.signing_service=s.signingName;let e=u(i)?.selectedHttpAuthScheme?.httpAuthOption;e&&(e.signingProperties=Object.assign(e.signingProperties||{},{signing_region:s.signingRegion,signingRegion:s.signingRegion,signing_service:s.signingName,signingName:s.signingName,signingRegionSet:s.signingRegionSet},s.properties))}return r({...a})}}var St=e((()=>{s(),T()}));function Ct(e){let t=xt(e);return(e,n)=>({applyToStack:r=>{r.addRelativeTo(t({config:e,instructions:n}),Tt)}})}var wt,Tt,Et=e((()=>{St(),wt={name:`serializerMiddleware`,step:`serialize`,tags:[`SERIALIZER`],override:!0},Tt={step:`serialize`,tags:[`ENDPOINT_PARAMETERS`,`ENDPOINT_V2`,`ENDPOINT`],name:`endpointV2Middleware`,override:!0,relation:`before`,toMiddleware:wt.name}}));function Dt(e){return t=>{let n=t.tls??!0,{endpoint:r,useDualstackEndpoint:i,useFipsEndpoint:a}=t,s=Object.assign(t,{endpoint:r==null?void 0:async()=>c(await o(r)()),tls:n,isCustomEndpoint:!!r,useDualstackEndpoint:o(i??!1),useFipsEndpoint:o(a??!1)}),l;return s.serviceConfiguredEndpoint=async()=>(t.serviceId&&!l&&(l=e(t.serviceId)),l),s}}var Ot=e((()=>{s(),_t()})),kt,At=e((()=>{t(),kt=class e{constructor(e,t,r,i){n(this,`nodes`,void 0),n(this,`root`,void 0),n(this,`conditions`,void 0),n(this,`results`,void 0),this.nodes=e,this.root=t,this.conditions=r,this.results=i}static from(t,n,r,i){return new e(t,n,r,i)}}})),jt,Mt=e((()=>{t(),jt=class{constructor({size:e,params:t}){n(this,`capacity`,void 0),n(this,`data`,new Map),n(this,`parameters`,[]),this.capacity=e??50,t&&(this.parameters=t)}get(e,t){let n=this.hash(e);if(n===!1)return t();if(!this.data.has(n)){if(this.data.size>this.capacity+10){let e=this.data.keys(),t=0;for(;;){let{value:n,done:r}=e.next();if(this.data.delete(n),r||++t>10)break}}this.data.set(n,t())}return this.data.get(n)}size(){return this.data.size}hash(e){let t=``,{parameters:n}=this;if(n.length===0)return!1;for(let r of n){let n=String(e[r]??``);if(n.includes(`|;`))return!1;t+=n+`|;`}return t}}})),E,Nt=e((()=>{E=class extends Error{constructor(e){super(e),this.name=`EndpointError`}}})),D=e((()=>{Nt()})),Pt,Ft=e((()=>{Pt=`endpoints`}));function O(e){return typeof e!=`object`||!e?e:`ref`in e?`$${O(e.ref)}`:`fn`in e?`${e.fn}(${(e.argv||[]).map(O).join(`, `)})`:JSON.stringify(e,null,2)}var It=e((()=>{})),Lt=e((()=>{Ft(),It()})),k,Rt=e((()=>{k={}})),zt,Bt=e((()=>{zt=(e,t)=>e===t}));function Vt(...e){for(let t of e)if(t!=null)return t}var Ht=e((()=>{})),Ut,Wt=e((()=>{D(),Ut=e=>{let t=e.split(`.`),n=[];for(let r of t){let t=r.indexOf(`[`);if(t!==-1){if(r.indexOf(`]`)!==r.length-1)throw new E(`Path: '${e}' does not end with ']'`);let i=r.slice(t+1,-1);if(Number.isNaN(parseInt(i)))throw new E(`Invalid array index: '${i}' in path: '${e}'`);t!==0&&n.push(r.slice(0,t)),n.push(i)}else n.push(r)}return n}})),Gt,Kt=e((()=>{D(),Wt(),Gt=(e,t)=>Ut(t).reduce((n,r)=>{if(typeof n!=`object`)throw new E(`Index '${r}' in '${t}' not found in '${JSON.stringify(e)}'`);if(Array.isArray(n)){let e=parseInt(r);return n[e<0?n.length+e:e]}return n[r]},e)})),qt,Jt=e((()=>{qt=e=>e!=null}));function Yt(e,t,n){return e?t:n}var Xt=e((()=>{})),Zt,Qt=e((()=>{Zt=e=>!e})),$t,en,tn=e((()=>{$t=RegExp(`^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$`),en=e=>$t.test(e)||e.startsWith(`[`)&&e.endsWith(`]`)})),A,nn,rn=e((()=>{d(),tn(),A={[p.HTTP]:80,[p.HTTPS]:443},nn=e=>{let t=(()=>{try{if(e instanceof URL)return e;if(typeof e==`object`&&`hostname`in e){let{hostname:t,port:n,protocol:r=``,path:i=``,query:a={}}=e,o=new URL(`${r}//${t}${n?`:${n}`:``}${i}`);return o.search=Object.entries(a).map(([e,t])=>`${e}=${t}`).join(`&`),o}return new URL(e)}catch{return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;let n=t.href,{host:r,hostname:i,pathname:a,protocol:o,search:s}=t;if(s)return null;let c=o.slice(0,-1);if(!Object.values(p).includes(c))return null;let l=en(i);return{scheme:c,authority:`${r}${n.includes(`${r}:${A[c]}`)||typeof e==`string`&&e.includes(`${r}:${A[c]}`)?`:${A[c]}`:``}`,path:a,normalizedPath:a.endsWith(`/`)?a:`${a}/`,isIp:l}}}));function an(e,t,n){if(n===1)return[e];if(e===``)return[``];let r=e.split(t);return n===0?r:r.slice(0,n-1).concat(r.slice(1).join(t))}var on=e((()=>{})),sn,cn=e((()=>{sn=(e,t)=>e===t})),ln,un=e((()=>{ln=(e,t,n,r)=>e==null||t>=n||e.length<n||/[^\u0000-\u007f]/.test(e)?null:r?e.substring(e.length-n,e.length-t):e.substring(t,n)})),dn,fn=e((()=>{dn=e=>encodeURIComponent(e).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)})),pn=e((()=>{Bt(),Ht(),Kt(),Jt(),s(),Xt(),Qt(),rn(),on(),cn(),un(),fn()})),mn,hn=e((()=>{pn(),mn={booleanEquals:zt,coalesce:Vt,getAttr:Gt,isSet:qt,isValidHostLabel:l,ite:Yt,not:Zt,parseURL:nn,split:an,stringEquals:sn,substring:ln,uriEncode:dn}})),gn,_n=e((()=>{pn(),gn=(e,t)=>{let n=[],{referenceRecord:r,endpointParams:i}=t,a=0;for(;a<e.length;){let t=e.indexOf(`{`,a);if(t===-1){n.push(e.slice(a));break}n.push(e.slice(a,t));let o=e.indexOf(`}`,t);if(o===-1){n.push(e.slice(t));break}e[t+1]===`{`&&e[o+1]===`}`&&(n.push(e.slice(t+1,o)),a=o+2);let s=e.substring(t+1,o);if(s.includes(`#`)){let[e,t]=s.split(`#`);n.push(Gt(r[e]??i[e],t))}else n.push(r[s]??i[s]);a=o+1}return n.join(``)}})),vn,yn=e((()=>{vn=({ref:e},t)=>t.referenceRecord[e]??t.endpointParams[e]})),j,bn,M,N=e((()=>{D(),Rt(),hn(),_n(),yn(),j=(e,t,n)=>{if(typeof e==`string`)return gn(e,n);if(e.fn)return M.callFunction(e,n);if(e.ref)return vn(e,n);throw new E(`'${t}': ${String(e)} is not a string, function or reference.`)},bn=({fn:e,argv:t},n)=>{let r=Array(t.length);for(let e=0;e<r.length;++e){let i=t[e];typeof i==`boolean`||typeof i==`number`?r[e]=i:r[e]=M.evaluateExpression(i,`arg`,n)}let i=e.indexOf(`.`);if(i!==-1){let t=k[e.slice(0,i)]?.[e.slice(i+1)];if(typeof t==`function`)return t(...r)}let a=mn[e];if(typeof a==`function`)return a(...r);throw Error(`function ${e} not loaded in endpointFunctions.`)},M={evaluateExpression:j,callFunction:bn}})),xn=e((()=>{N()})),Sn,Cn=e((()=>{Lt(),D(),xn(),Sn=(e,t)=>{let{assign:n}=e;if(n&&n in t.referenceRecord)throw new E(`'${n}' is already defined in Reference Record.`);let r=bn(e,t);t.logger?.debug?.(`${Pt} evaluateCondition: ${O(e)} = ${O(r)}`);let i=r===``||!!r;return n==null?{result:i}:{result:i,toAssign:{name:n,value:r}}}})),wn,Tn=e((()=>{D(),N(),wn=(e,t)=>Object.entries(e??{}).reduce((e,[n,r])=>(e[n]=r.map(e=>{let r=j(e,`Header value entry`,t);if(typeof r!=`string`)throw new E(`Header '${n}' value '${r}' is not a string`);return r}),e),{})})),P,En,Dn,On=e((()=>{D(),_n(),P=(e,t)=>Object.entries(e).reduce((e,[n,r])=>(e[n]=Dn.getEndpointProperty(r,t),e),{}),En=(e,t)=>{if(Array.isArray(e))return e.map(e=>En(e,t));switch(typeof e){case`string`:return gn(e,t);case`object`:if(e===null)throw new E(`Unexpected endpoint property: ${e}`);return Dn.getEndpointProperties(e,t);case`boolean`:return e;default:throw new E(`Unexpected endpoint property type: ${typeof e}`)}},Dn={getEndpointProperty:En,getEndpointProperties:P}})),kn,An=e((()=>{D(),N(),kn=(e,t)=>{let n=j(e,`Endpoint URL`,t);if(typeof n==`string`)try{return new URL(n)}catch(e){throw console.error(`Failed to construct URL with ${n}`,e),e}throw new E(`Endpoint URL must be a string, got ${typeof n}`)}})),F,jn,Mn=e((()=>{D(),Cn(),N(),Tn(),On(),An(),F=1e8,jn=(e,t)=>{let{nodes:n,root:r,results:i,conditions:a}=e,o=r,s={},c={referenceRecord:s,endpointParams:t.endpointParams,logger:t.logger};for(;o!==1&&o!==-1&&o<F;){let e=3*(Math.abs(o)-1),[t,r,i]=[n[e],n[e+1],n[e+2]],[l,u,d]=a[t],f=Sn({fn:l,assign:d,argv:u},c);if(f.toAssign){let{name:e,value:t}=f.toAssign;s[e]=t}o=o>=0===f.result?r:i}if(o>=F){let e=i[o-F];if(e[0]===-1){let[,t]=e;throw new E(j(t,`Error`,c))}let[t,n,r]=e;return{url:kn(t,c),properties:P(n,c),headers:wn(r??{},c)}}throw new E(`No matching endpoint.`)}})),Nn,Pn,I=e((()=>{ot(),T(),St(),Et(),Ot(),At(),Mt(),Mn(),tn(),s(),Rt(),Lt(),D(),Cn(),Tn(),On(),An(),N(),_t(),Nn=Dt(w),xt(w),Pn=Ct(w)})),Fn,In,Ln,Rn,zn,Bn=e((()=>{Fn=[`BandwidthLimitExceeded`,`EC2ThrottledException`,`LimitExceededException`,`PriorRequestNotComplete`,`ProvisionedThroughputExceededException`,`RequestLimitExceeded`,`RequestThrottled`,`RequestThrottledException`,`SlowDown`,`ThrottledException`,`Throttling`,`ThrottlingException`,`TooManyRequestsException`,`TransactionInProgressException`],In=[`TimeoutError`,`RequestTimeout`,`RequestTimeoutException`],Ln=[500,502,503,504],Rn=[`ECONNRESET`,`ECONNREFUSED`,`EPIPE`,`ETIMEDOUT`],zn=[`EHOSTUNREACH`,`ENETUNREACH`,`ENOTFOUND`,`EAI_AGAIN`]}));function Vn(e){return e.code===`ERR_HTTP2_STREAM_ERROR`&&e.message.includes(`NGHTTP2_REFUSED_STREAM`)}var Hn,Un,Wn,Gn,L,Kn,R=e((()=>{Bn(),Hn=e=>e?.$retryable!==void 0,Un=e=>e.$metadata?.clockSkewCorrected,Wn=e=>{let t=new Set([`Failed to fetch`,`NetworkError when attempting to fetch resource`,`The Internet connection appears to be offline`,`Load failed`,`Network request failed`]);return e&&e instanceof TypeError?t.has(e.message):!1},Gn=e=>e.$metadata?.httpStatusCode===429||Fn.includes(e.name)||e.$retryable?.throttling==1,L=(e,t=0)=>Hn(e)||Un(e)||e.name===`InvalidSignatureException`&&e.message?.includes(`Signature expired`)||In.includes(e.name)||Rn.includes(e?.code||``)||zn.includes(e?.code||``)||Ln.includes(e.$metadata?.httpStatusCode||0)||Wn(e)||Vn(e)||e.cause!==void 0&&t<=10&&L(e.cause,t+1),Kn=e=>{if(e.$metadata?.httpStatusCode!==void 0){let t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!L(e)}return!1}})),qn,Jn,Yn,z=e((()=>{qn=20*1e3,Jn=`amz-sdk-invocation-id`,Yn=`amz-sdk-request`}));function Xn(e,t){if(a.isInstance(e))for(let n of Object.keys(e.headers)){let r=n.toLowerCase();if(r===`retry-after`){let r=e.headers[n],i=NaN;if(r.endsWith(`GMT`))try{i=(ee(r).getTime()-Date.now())/1e3}catch(e){t?.trace?.(`Failed to parse retry-after header`),t?.trace?.(e)}else r.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?i=Number(r.match(/ GMT, ([\d.]+)$/)?.[1]):r.match(/^((\d+)|(\d+\.\d+))$/)?i=Number(r):Date.parse(r)>=Date.now()&&(i=(Date.parse(r)-Date.now())/1e3);return isNaN(i)?void 0:new Date(Date.now()+i*1e3)}else if(r===`x-amz-retry-after`){let r=e.headers[n],i=Number(r);if(isNaN(i)){t?.trace?.(`Failed to parse x-amz-retry-after=${r}`);return}return new Date(Date.now()+i)}}}var Zn=e((()=>{g(),ne()})),Qn,$n=e((()=>{Qn=e=>e instanceof Error?e:e instanceof Object?Object.assign(Error(),e):Error(typeof e==`string`?e:`AWS SDK error wrapper for ${e}`)}));function er(e){return t=>(n,r)=>async i=>{let a=await t.retryStrategy(),o=await t.maxAttempts();if(rr(a)){a=a;let s=await a.acquireInitialRetryToken((r.partition_id??``)+(r.__retryLongPoll?`:longpoll`:``)),c=Error(),l=0,u=0,{request:d}=i,f=h.isInstance(d);for(f&&(d.headers[Jn]=te());;)try{f&&(d.headers[Yn]=`attempt=${l+1}; max=${o}`);let{response:e,output:t}=await n(i);return a.recordSuccess(s),t.$metadata.attempts=l+1,t.$metadata.totalRetryDelay=u,{response:e,output:t}}catch(n){let i=ir(n,t.logger);if(c=Qn(n),f&&e(d))throw(r.logger instanceof Qe?console:r.logger)?.warn(`An error was encountered in a non-retryable streaming request.`),c;try{s=await a.refreshRetryTokenForRetry(s,i)}catch{throw c.$metadata||(c.$metadata={}),c.$metadata.attempts=l+1,c.$metadata.totalRetryDelay=u,c}l=s.getRetryCount();let o=s.getRetryDelay();u+=(s?.$retryLog?.acquisitionDelay??0)+o,o>0&&await nr(o)}}else return a=a,a?.mode&&(r.userAgent=[...r.userAgent||[],[`cfg/retry-mode`,a.mode]]),a.retry(n,i)}}function tr(e){let t=er(e);return e=>({applyToStack:n=>{n.add(t(e),or)}})}var nr,rr,ir,ar,or,sr=e((()=>{C(),g(),ne(),R(),z(),Zn(),$n(),nr=e=>new Promise(t=>setTimeout(t,e)),rr=e=>e.acquireInitialRetryToken!==void 0&&e.refreshRetryTokenForRetry!==void 0&&e.recordSuccess!==void 0,ir=(e,t)=>{let n={error:e,errorType:ar(e)},r=Xn(e.$response,t);return r&&(n.retryAfterHint=r),n},ar=e=>Gn(e)?`THROTTLING`:L(e)?`TRANSIENT`:Kn(e)?`SERVER_ERROR`:`CLIENT_ERROR`,or={name:`retryMiddleware`,tags:[`RETRY`],step:`finalizeRequest`,priority:`high`,override:!0}})),cr,lr=e((()=>{R(),t(),cr=class e{constructor(e){n(this,`beta`,void 0),n(this,`minCapacity`,void 0),n(this,`minFillRate`,void 0),n(this,`scaleConstant`,void 0),n(this,`smooth`,void 0),n(this,`enabled`,!1),n(this,`availableTokens`,0),n(this,`lastMaxRate`,0),n(this,`measuredTxRate`,0),n(this,`requestCount`,0),n(this,`fillRate`,void 0),n(this,`lastThrottleTime`,void 0),n(this,`lastTimestamp`,0),n(this,`lastTxRateBucket`,void 0),n(this,`maxCapacity`,void 0),n(this,`timeWindow`,0),this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){let t;this.updateMeasuredRate();let n=e;if(n?.errorType===`THROTTLING`||Gn(n?.error??e)){let e=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=e,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(e),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());let r=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(r)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(t){if(this.enabled){for(this.refillTokenBucket();t>this.availableTokens;){let n=(t-this.availableTokens)/this.fillRate*1e3;await new Promise(t=>e.setTimeoutFn(t,n)),this.refillTokenBucket()}this.availableTokens-=t}}refillTokenBucket(){let e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}let t=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+t),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise((this.lastMaxRate*(1-this.beta)/this.scaleConstant)**(1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*(e-this.lastThrottleTime-this.timeWindow)**3+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){let e=this.getCurrentTimeInSeconds(),t=Math.floor(e*2)/2;if(this.requestCount++,t>this.lastTxRateBucket){let e=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(e*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}},n(cr,`setTimeoutFn`,(e,t)=>setTimeout(e,t))})),B,V=e((()=>{t(),B=class e{static delay(){return e.v2026?50:100}static throttlingDelay(){return e.v2026?1e3:500}static cost(){return e.v2026?14:5}static throttlingCost(){return e.v2026?5:10}static modifiedCostType(){return e.v2026?`THROTTLING`:`TRANSIENT`}},n(B,`v2026`,typeof process<`u`&&process.env?.SMITHY_NEW_RETRIES_2026===`true`)})),ur,dr=e((()=>{z(),V(),t(),ur=class{constructor(){n(this,`x`,B.delay())}computeNextBackoffDelay(e){let t=Math.random()*Math.min(this.x*2**e,qn);return Math.floor(t)}setDelayBase(e){this.x=e}}})),fr,pr=e((()=>{z(),t(),fr=class{constructor(e,t,r,i){n(this,`delay`,void 0),n(this,`count`,void 0),n(this,`cost`,void 0),n(this,`longPoll`,void 0),n(this,`$retryLog`,{acquisitionDelay:0}),this.delay=e,this.count=t,this.cost=r,this.longPoll=i}getRetryCount(){return this.count}getRetryDelay(){return Math.min(qn,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}})),H,mr,U=e((()=>{(function(e){e.STANDARD=`standard`,e.ADAPTIVE=`adaptive`})(H||(H={})),mr=H.STANDARD})),W,G,hr=e((()=>{dr(),pr(),U(),z(),V(),t(),W={incompatible:1,attempts:2,capacity:3},G=class{constructor(e){n(this,`mode`,H.STANDARD),n(this,`retryBackoffStrategy`,void 0),n(this,`capacity`,500),n(this,`maxAttemptsProvider`,void 0),n(this,`baseDelay`,void 0),typeof e==`number`?this.maxAttemptsProvider=async()=>e:typeof e==`function`?this.maxAttemptsProvider=e:e&&typeof e==`object`&&(this.maxAttemptsProvider=async()=>e.maxAttempts,this.baseDelay=e.baseDelay,this.retryBackoffStrategy=e.backoff),this.maxAttemptsProvider??(this.maxAttemptsProvider=async()=>3),this.baseDelay??(this.baseDelay=B.delay()),this.retryBackoffStrategy??(this.retryBackoffStrategy=new ur)}async acquireInitialRetryToken(e){return new fr(B.delay(),0,void 0,B.v2026&&e.includes(`:longpoll`))}async refreshRetryTokenForRetry(e,t){let n=await this.getMaxAttempts(),r=this.retryCode(e,t,n),i=r===0,a=e.isLongPoll?.();if(i||a){let n=t.errorType;this.retryBackoffStrategy.setDelayBase(n===`THROTTLING`?B.throttlingDelay():this.baseDelay);let o=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),s=o;if(t.retryAfterHint instanceof Date&&(s=Math.max(o,Math.min(t.retryAfterHint.getTime()-Date.now(),o+5e3))),i){let t=this.getCapacityCost(n);this.capacity-=t;let r=new fr(0,e.getRetryCount()+1,t,e.isLongPoll?.()??!1);return await new Promise(e=>setTimeout(e,s)),r.$retryLog.acquisitionDelay=s,r}else{let e=B.v2026&&r===W.capacity&&a?s:0;e>0&&await new Promise(t=>setTimeout(t,e))}}throw Error(`No retry token available`)}recordSuccess(e){this.capacity=Math.min(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of 3`),3}}retryCode(e,t,n){let r=e.getRetryCount()+1,i=this.isRetryableError(t.errorType)?0:W.incompatible,a=r<n?0:W.attempts,o=this.capacity>=this.getCapacityCost(t.errorType)?0:W.capacity;return i||a||o}getCapacityCost(e){return e===B.modifiedCostType()?B.throttlingCost():B.cost()}isRetryableError(e){return e===`THROTTLING`||e===`TRANSIENT`}}})),gr,_r=e((()=>{lr(),hr(),U(),t(),gr=class{constructor(e,t){n(this,`mode`,H.ADAPTIVE),n(this,`rateLimiter`,void 0),n(this,`standardRetryStrategy`,void 0);let{rateLimiter:r}=t??{};this.rateLimiter=r??new cr,this.standardRetryStrategy=t?new G({maxAttempts:typeof e==`number`?e:3,...t}):new G(e)}async acquireInitialRetryToken(e){let t=await this.standardRetryStrategy.acquireInitialRetryToken(e);return await this.rateLimiter.getSendToken(),t}async refreshRetryTokenForRetry(e,t){this.rateLimiter.updateClientSendingRate(t);let n=await this.standardRetryStrategy.refreshRetryTokenForRetry(e,t);return await this.rateLimiter.getSendToken(),n}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}}})),vr,yr,br,xr,Sr,Cr,wr,Tr=e((()=>{C(),_r(),hr(),U(),V(),vr=`AWS_MAX_ATTEMPTS`,yr=`max_attempts`,br={environmentVariableSelector:e=>{let t=e[vr];if(!t)return;let n=parseInt(t);if(Number.isNaN(n))throw Error(`Environment variable ${vr} mast be a number, got "${t}"`);return n},configFileSelector:e=>{let t=e[yr];if(!t)return;let n=parseInt(t);if(Number.isNaN(n))throw Error(`Shared config file entry ${yr} mast be a number, got "${t}"`);return n},default:3},xr=(e,t)=>{let{retryStrategy:n,retryMode:r}=e,{defaultMaxAttempts:i=3,defaultBaseDelay:a=B.delay()}=t??{},s=o(e.maxAttempts??i),c=n?Promise.resolve(n):void 0,l=async()=>{let e=await s();return await o(r)()===H.ADAPTIVE?new gr(s,{maxAttempts:e,baseDelay:a}):new G({maxAttempts:e,baseDelay:a})};return Object.assign(e,{maxAttempts:s,retryStrategy:()=>c??(c=l())})},Sr=`AWS_RETRY_MODE`,Cr=`retry_mode`,wr={environmentVariableSelector:e=>e[Sr],configFileSelector:e=>e[Cr],default:mr}})),Er,Dr=e((()=>{ye(),sr(),R(),_r(),hr(),V(),lr(),U(),z(),I(),$n(),Tr(),Zn(),Er=tr(ve)}));function K(e,t,n){e.__aws_sdk_context?e.__aws_sdk_context.features||(e.__aws_sdk_context.features={}):e.__aws_sdk_context={features:{}},e.__aws_sdk_context.features[t]=n}var Or=e((()=>{Dr(),B.v2026||(B.v2026=typeof process==`object`&&process.env?.AWS_NEW_RETRIES_2026===`true`)}));function kr(e,t,n){return e.$source||(e.$source={}),e.$source[t]=n,e}var Ar=e((()=>{}));function jr(e){return e}var Mr,Nr,Pr,Fr=e((()=>{g(),Mr=e=>t=>async n=>{if(!h.isInstance(n.request))return t(n);let{request:r}=n,{handlerProtocol:i=``}=e.requestHandler.metadata||{};if(i.indexOf(`h2`)>=0&&!r.headers[`:authority`])delete r.headers.host,r.headers[`:authority`]=r.hostname+(r.port?`:`+r.port:``);else if(!r.headers.host){let e=r.hostname;r.port!=null&&(e+=`:${r.port}`),r.headers.host=e}return t(n)},Nr={name:`hostHeaderMiddleware`,step:`build`,priority:`low`,tags:[`HOST`],override:!0},Pr=e=>({applyToStack:t=>{t.add(Mr(e),Nr)}})})),Ir,Lr,Rr,zr=e((()=>{Ir=()=>(e,t)=>async n=>{try{let r=await e(n),{clientName:i,commandName:a,logger:o,dynamoDbDocumentClientOptions:s={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:l}=s,u=c??t.inputFilterSensitiveLog,d=l??t.outputFilterSensitiveLog,{$metadata:f,...p}=r.output;return o?.info?.({clientName:i,commandName:a,input:u(n.input),output:d(p),metadata:f}),r}catch(e){let{clientName:r,commandName:i,logger:a,dynamoDbDocumentClientOptions:o={}}=t,{overrideInputFilterSensitiveLog:s}=o,c=s??t.inputFilterSensitiveLog;throw a?.error?.({clientName:r,commandName:i,input:c(n.input),error:e,metadata:e.$metadata}),e}},Lr={name:`loggerMiddleware`,tags:[`LOGGER`],step:`initialize`,override:!0},Rr=e=>({applyToStack:e=>{e.add(Ir(),Lr)}})})),Br,Vr=e((()=>{Br={step:`build`,tags:[`RECURSION_DETECTION`,`TRACE_CONTEXT_PROPAGATION`],name:`recursionDetectionMiddleware`,override:!0,priority:`low`}})),q,J,Y,Hr,Ur,X,Wr=e((()=>{t(),q={REQUEST_ID:Symbol.for(`_AWS_LAMBDA_REQUEST_ID`),X_RAY_TRACE_ID:Symbol.for(`_AWS_LAMBDA_X_RAY_TRACE_ID`),TENANT_ID:Symbol.for(`_AWS_LAMBDA_TENANT_ID`),TRACEPARENT:Symbol.for(`_AWS_LAMBDA_TRACEPARENT`),TRACESTATE:Symbol.for(`_AWS_LAMBDA_TRACESTATE`),BAGGAGE:Symbol.for(`_AWS_LAMBDA_BAGGAGE`)},J=[`true`,`1`].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??``),J||(globalThis.awslambda=globalThis.awslambda||{}),Y=class{isProtectedKey(e){return Object.values(q).includes(e)}getRequestId(){return this.get(q.REQUEST_ID)??`-`}getXRayTraceId(){return this.get(q.X_RAY_TRACE_ID)}getTenantId(){return this.get(q.TENANT_ID)}getTraceparent(){return this.get(q.TRACEPARENT)}getTracestate(){return this.get(q.TRACESTATE)}getBaggage(){return this.get(q.BAGGAGE)}},n(Y,`PROTECTED_KEYS`,q),Hr=class extends Y{constructor(...e){super(...e),n(this,`currentContext`,void 0)}getContext(){return this.currentContext}hasContext(){return this.currentContext!==void 0}get(e){return this.currentContext?.[e]}set(e,t){if(this.isProtectedKey(e))throw Error(`Cannot modify protected Lambda context field: ${String(e)}`);this.currentContext=this.currentContext||{},this.currentContext[e]=t}run(e,t){return this.currentContext=e,t()}},Ur=class e extends Y{constructor(...e){super(...e),n(this,`als`,void 0)}static async create(){let t=new e;return t.als=new(await(import(`node:async_hooks`))).AsyncLocalStorage,t}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==void 0}get(e){return this.als.getStore()?.[e]}set(e,t){if(this.isProtectedKey(e))throw Error(`Cannot modify protected Lambda context field: ${String(e)}`);let n=this.als.getStore();if(!n)throw Error(`No context available`);n[e]=t}run(e,t){return this.als.run(e,t)}},(function(e){let t=null;async function n(e){return t||(t=(async()=>{let t=e===!0||`AWS_LAMBDA_MAX_CONCURRENCY`in process.env?await Ur.create():new Hr;return!J&&globalThis.awslambda?.InvokeStore?globalThis.awslambda.InvokeStore:(!J&&globalThis.awslambda&&(globalThis.awslambda.InvokeStore=t),t)})()),t}e.getInstanceAsync=n,e._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE===`1`?{reset:()=>{t=null,globalThis.awslambda?.InvokeStore&&delete globalThis.awslambda.InvokeStore,globalThis.awslambda={InvokeStore:void 0}}}:void 0})(X||(X={}))}));function Gr(e){for(let t of Object.keys(e)){let n=t.toLowerCase();t!==n&&(n===Q||n===Jr||n===Yr)&&(e[n]=e[t],delete e[t])}}var Kr,qr,Z,Q,Jr,Yr,Xr,Zr=e((()=>{Wr(),g(),Kr=`AWS_LAMBDA_FUNCTION_NAME`,qr=`_X_AMZN_TRACE_ID`,Z=`X-Amzn-Trace-Id`,Q=`traceparent`,Jr=`tracestate`,Yr=`baggage`,Xr=()=>e=>async t=>{let{request:n}=t;if(!h.isInstance(n))return e(t);let r;{let e=Object.keys(n.headers??{}).find(e=>e.toLowerCase()===Z.toLowerCase())??Z;if(!n.headers.hasOwnProperty(e)){let e=process.env[Kr],t=process.env[qr];r??(r=await X.getInstanceAsync());let i=r?.getXRayTraceId()??t,a=e=>typeof e==`string`&&e.length>0;a(e)&&a(i)&&(n.headers[Z]=i)}}if(Gr(n.headers),!n.headers[Q]){let e=(r??(r=await X.getInstanceAsync()))?.getTraceparent?.();if(e){n.headers[Q]=e;let t=r?.getTracestate?.();t&&(n.headers[Jr]=t);let i=r?.getBaggage?.();i&&(n.headers[Yr]=i)}}return e(t)}})),Qr,$r=e((()=>{Vr(),Zr(),Qr=e=>({applyToStack:e=>{e.add(Xr(),Br)}})}));function ei(e){return e===void 0||typeof e==`string`&&e.length<=50}function ti(e){let t=se(e.userAgentAppId??void 0),{customUserAgent:n}=e;return Object.assign(e,{customUserAgent:typeof n==`string`?[[n]]:n,userAgentAppId:async()=>{let n=await t();if(!ei(n)){let t=e.logger?.constructor?.name===`NoOpLogger`||!e.logger?console:e.logger;typeof n==`string`?n.length>50&&t?.warn(`The provided userAgentAppId exceeds the maximum length of 50 characters.`):t?.warn(`userAgentAppId must be a string or undefined.`)}return n}})}var ni=e((()=>{ce()})),ri,ii=e((()=>{ri={partitions:[{id:`aws`,outputs:{dnsSuffix:`amazonaws.com`,dualStackDnsSuffix:`api.aws`,implicitGlobalRegion:`us-east-1`,name:`aws`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$`,regions:{"af-south-1":{description:`Africa (Cape Town)`},"ap-east-1":{description:`Asia Pacific (Hong Kong)`},"ap-east-2":{description:`Asia Pacific (Taipei)`},"ap-northeast-1":{description:`Asia Pacific (Tokyo)`},"ap-northeast-2":{description:`Asia Pacific (Seoul)`},"ap-northeast-3":{description:`Asia Pacific (Osaka)`},"ap-south-1":{description:`Asia Pacific (Mumbai)`},"ap-south-2":{description:`Asia Pacific (Hyderabad)`},"ap-southeast-1":{description:`Asia Pacific (Singapore)`},"ap-southeast-2":{description:`Asia Pacific (Sydney)`},"ap-southeast-3":{description:`Asia Pacific (Jakarta)`},"ap-southeast-4":{description:`Asia Pacific (Melbourne)`},"ap-southeast-5":{description:`Asia Pacific (Malaysia)`},"ap-southeast-6":{description:`Asia Pacific (New Zealand)`},"ap-southeast-7":{description:`Asia Pacific (Thailand)`},"aws-global":{description:`aws global region`},"ca-central-1":{description:`Canada (Central)`},"ca-west-1":{description:`Canada West (Calgary)`},"eu-central-1":{description:`Europe (Frankfurt)`},"eu-central-2":{description:`Europe (Zurich)`},"eu-north-1":{description:`Europe (Stockholm)`},"eu-south-1":{description:`Europe (Milan)`},"eu-south-2":{description:`Europe (Spain)`},"eu-west-1":{description:`Europe (Ireland)`},"eu-west-2":{description:`Europe (London)`},"eu-west-3":{description:`Europe (Paris)`},"il-central-1":{description:`Israel (Tel Aviv)`},"me-central-1":{description:`Middle East (UAE)`},"me-south-1":{description:`Middle East (Bahrain)`},"mx-central-1":{description:`Mexico (Central)`},"sa-east-1":{description:`South America (Sao Paulo)`},"us-east-1":{description:`US East (N. Virginia)`},"us-east-2":{description:`US East (Ohio)`},"us-west-1":{description:`US West (N. California)`},"us-west-2":{description:`US West (Oregon)`}}},{id:`aws-cn`,outputs:{dnsSuffix:`amazonaws.com.cn`,dualStackDnsSuffix:`api.amazonwebservices.com.cn`,implicitGlobalRegion:`cn-northwest-1`,name:`aws-cn`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^cn\\-\\w+\\-\\d+$`,regions:{"aws-cn-global":{description:`aws-cn global region`},"cn-north-1":{description:`China (Beijing)`},"cn-northwest-1":{description:`China (Ningxia)`}}},{id:`aws-eusc`,outputs:{dnsSuffix:`amazonaws.eu`,dualStackDnsSuffix:`api.amazonwebservices.eu`,implicitGlobalRegion:`eusc-de-east-1`,name:`aws-eusc`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^eusc\\-(de)\\-\\w+\\-\\d+$`,regions:{"eusc-de-east-1":{description:`AWS European Sovereign Cloud (Germany)`}}},{id:`aws-iso`,outputs:{dnsSuffix:`c2s.ic.gov`,dualStackDnsSuffix:`api.aws.ic.gov`,implicitGlobalRegion:`us-iso-east-1`,name:`aws-iso`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^us\\-iso\\-\\w+\\-\\d+$`,regions:{"aws-iso-global":{description:`aws-iso global region`},"us-iso-east-1":{description:`US ISO East`},"us-iso-west-1":{description:`US ISO WEST`}}},{id:`aws-iso-b`,outputs:{dnsSuffix:`sc2s.sgov.gov`,dualStackDnsSuffix:`api.aws.scloud`,implicitGlobalRegion:`us-isob-east-1`,name:`aws-iso-b`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^us\\-isob\\-\\w+\\-\\d+$`,regions:{"aws-iso-b-global":{description:`aws-iso-b global region`},"us-isob-east-1":{description:`US ISOB East (Ohio)`},"us-isob-west-1":{description:`US ISOB West`}}},{id:`aws-iso-e`,outputs:{dnsSuffix:`cloud.adc-e.uk`,dualStackDnsSuffix:`api.cloud-aws.adc-e.uk`,implicitGlobalRegion:`eu-isoe-west-1`,name:`aws-iso-e`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^eu\\-isoe\\-\\w+\\-\\d+$`,regions:{"aws-iso-e-global":{description:`aws-iso-e global region`},"eu-isoe-west-1":{description:`EU ISOE West`}}},{id:`aws-iso-f`,outputs:{dnsSuffix:`csp.hci.ic.gov`,dualStackDnsSuffix:`api.aws.hci.ic.gov`,implicitGlobalRegion:`us-isof-south-1`,name:`aws-iso-f`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^us\\-isof\\-\\w+\\-\\d+$`,regions:{"aws-iso-f-global":{description:`aws-iso-f global region`},"us-isof-east-1":{description:`US ISOF EAST`},"us-isof-south-1":{description:`US ISOF SOUTH`}}},{id:`aws-us-gov`,outputs:{dnsSuffix:`amazonaws.com`,dualStackDnsSuffix:`api.aws`,implicitGlobalRegion:`us-gov-west-1`,name:`aws-us-gov`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^us\\-gov\\-\\w+\\-\\d+$`,regions:{"aws-us-gov-global":{description:`aws-us-gov global region`},"us-gov-east-1":{description:`AWS GovCloud (US-East)`},"us-gov-west-1":{description:`AWS GovCloud (US-West)`}}}],version:`1.1`}})),ai,oi,si,ci,li=e((()=>{ii(),ai=ri,oi=``,si=e=>{let{partitions:t}=ai;for(let n of t){let{regions:t,outputs:r}=n;for(let[n,i]of Object.entries(t))if(n===e)return{...r,...i}}for(let n of t){let{regionRegex:t,outputs:r}=n;if(new RegExp(t).test(e))return{...r}}let n=t.find(e=>e.id===`aws`);if(!n)throw Error(`Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.`);return{...n.outputs}},ci=()=>oi}));async function ui(e,t,n){if(n.request?.headers?.[`smithy-protocol`]===`rpc-v2-cbor`&&K(e,`PROTOCOL_RPC_V2_CBOR`,`M`),typeof t.retryStrategy==`function`){let n=await t.retryStrategy();if(typeof n.mode==`string`)switch(n.mode){case H.ADAPTIVE:K(e,`RETRY_MODE_ADAPTIVE`,`F`);break;case H.STANDARD:K(e,`RETRY_MODE_STANDARD`,`E`);break}}if(typeof t.accountIdEndpointMode==`function`){let n=e.endpointV2;switch(String(n?.url?.hostname).match(di)&&K(e,`ACCOUNT_ID_ENDPOINT`,`O`),await t.accountIdEndpointMode?.()){case`disabled`:K(e,`ACCOUNT_ID_MODE_DISABLED`,`Q`);break;case`preferred`:K(e,`ACCOUNT_ID_MODE_PREFERRED`,`P`);break;case`required`:K(e,`ACCOUNT_ID_MODE_REQUIRED`,`R`);break}}let r=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(r?.$source){let t=r;t.accountId&&K(e,`RESOLVED_ACCOUNT_ID`,`T`);for(let[n,r]of Object.entries(t.$source??{}))K(e,n,r)}}var di,fi=e((()=>{Dr(),Or(),di=/\d{12}\.ddb/})),pi,mi,hi,gi,_i=e((()=>{pi=`user-agent`,mi=`x-amz-user-agent`,hi=/[^!$%&'*+\-.^_`|~\w]/g,gi=/[^!$%&'*+\-.^_`|~\w#]/g}));function vi(e){let t=``;for(let n in e){let r=e[n];if(t.length+r.length+1<=yi){t.length?t+=`,`+r:t+=r;continue}break}return t}var yi,bi=e((()=>{yi=1024})),xi,$,Si,Ci,wi=e((()=>{g(),li(),fi(),_i(),bi(),xi=e=>(t,n)=>async r=>{let{request:i}=r;if(!h.isInstance(i))return t(r);let{headers:a}=i,o=n?.userAgent?.map($)||[],s=(await e.defaultUserAgentProvider()).map($);await ui(n,e,r);let c=n;s.push(`m/${vi(Object.assign({},n.__smithy_context?.features,c.__aws_sdk_context?.features))}`);let l=e?.customUserAgent?.map($)||[],u=await e.userAgentAppId();u&&s.push($([`app`,`${u}`]));let d=ci(),f=(d?[d]:[]).concat([...s,...o,...l]).join(` `),p=[...s.filter(e=>e.startsWith(`aws-sdk-`)),...l].join(` `);return e.runtime===`browser`?a[mi]=f:(p&&(a[mi]=a[`x-amz-user-agent`]?`${a[pi]} ${p}`:p),a[pi]=f),t({...r,request:i})},$=e=>{let t=e[0].split(`/`).map(e=>e.replace(hi,`-`)).join(`/`),n=e[1]?.replace(gi,`-`),r=t.indexOf(`/`),i=t.substring(0,r),a=t.substring(r+1);return i===`api`&&(a=a.toLowerCase()),[i,a,n].filter(e=>e&&e.length>0).reduce((e,t,n)=>{switch(n){case 0:return t;case 1:return`${e}/${t}`;default:return`${e}#${t}`}},``)},Si={name:`getUserAgentMiddleware`,step:`build`,priority:`low`,tags:[`SET_USER_AGENT`,`USER_AGENT`],override:!0},Ci=e=>({applyToStack:t=>{t.add(xi(e),Si)}})})),Ti,Ei=e((()=>{Ti=()=>{for(let e of[`deno`,`bun`,`llrt`])if(ue[e])return[`md/${e}`,ue[e]];return[`md/nodejs`,ue.node]}})),Di,Oi=e((()=>{Di={isCrtAvailable:!1}})),ki,Ai=e((()=>{Oi(),ki=()=>Di.isCrtAvailable?[`md/crt-avail`]:null})),ji,Mi=e((()=>{Ei(),Ai(),Oi(),ji=({serviceId:e,clientVersion:t})=>{let n=Ti();return async r=>{let i=[[`aws-sdk-js`,t],[`ua`,`2.1`],[`os/${de()}`,fe()],[`lang/js`],n],a=ki();a&&i.push(a),e&&i.push([`api/${e}`,t]),le.AWS_EXECUTION_ENV&&i.push([`exec-env/${le.AWS_EXECUTION_ENV}`]);let o=await r?.userAgentAppId?.();return o?[...i,[`app/${o}`]]:[...i]}}})),Ni,Pi,Fi,Ii=e((()=>{ni(),Ni=`AWS_SDK_UA_APP_ID`,Pi=`sdk-ua-app-id`,Fi={environmentVariableSelector:e=>e[Ni],configFileSelector:e=>e.sdk_ua_app_id??e[Pi],default:void 0}})),Li=e((()=>{I()})),Ri,zi=e((()=>{I(),Li(),Ri=(e,t=!1)=>{if(t){for(let t of e.split(`.`))if(!Ri(t))return!1;return!0}return!(!l(e)||e.length<3||e.length>63||e!==e.toLowerCase()||en(e))}})),Bi,Vi,Hi,Ui=e((()=>{Bi=`:`,Vi=`/`,Hi=e=>{let t=e.split(Bi);if(t.length<6)return null;let[n,r,i,a,o,...s]=t;return n!==`arn`||r===``||i===``||s.join(Bi)===``?null:{partition:r,service:i,region:a,accountId:o,resourceId:s.map(e=>e.split(Vi)).flat()}}})),Wi,Gi=e((()=>{I(),zi(),Ui(),li(),Wi={isVirtualHostableS3Bucket:Ri,parseArn:Hi,partition:si},k.aws=Wi}));function Ki(e={}){return re({...ae,async default(){return qi.silence||console.warn(`@aws-sdk - WARN - default STS region of us-east-1 used. See @aws-sdk/credential-providers README and set a region explicitly.`),`us-east-1`}},{...ie,...e})}var qi,Ji=e((()=>{oe(),qi={silence:!1}})),Yi,Xi,Zi=e((()=>{Yi=e=>({setRegion(t){e.region=t},region(){return e.region}}),Xi=e=>({region:e.region()})})),Qi=e((()=>{he(),_e(),Or(),Ar(),Fr(),zr(),Vr(),$r(),Zr(),ni(),wi(),Mi(),Ii(),Gi(),I(),Li(),zi(),Ui(),li(),C(),Ji(),Zi()}));export{Ze as $,Tr as A,Rt as B,jr as C,Dr as D,Er as E,I as F,T as G,Mt as H,Nn as I,tt as J,yt as K,jn as L,mr as M,U as N,br as O,Pn as P,Xe as Q,Mn as R,Fr as S,kr as T,kt as U,jt as V,At as W,Qe as X,et as Y,$e as Z,Qr as _,ge as _t,Ji as a,Ie as at,zr as b,Gi as c,Ne as ct,ji as d,Ae as dt,qe as et,Mi as f,S as ft,ti as g,_e as gt,ni as h,we as ht,Xi as i,ze as it,xr as j,wr as k,Fi as l,Pe as lt,wi as m,Ce as mt,Yi as n,Je as nt,Ki as o,Fe as ot,Ci as p,Oe as pt,C as q,Zi as r,Re as rt,Wi as s,Me as st,Qi as t,Ye as tt,Ii as u,ke as ut,$r as v,me as vt,Ar as w,Pr as x,Rr as y,he as yt,k as z};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n}from"./state-4KQ3kaqz.js";import{$d as r,Er as i,Xd as a,jr as o,mi as s}from"./loadAgentsDir-nzr38hai.js";async function c(e,t,r){if(!r||r.trim()===``)return e(`Please provide a color. Available colors: ${a.join(`, `)}, default`,{display:`system`}),null;let o=r.trim().toLowerCase();return l.includes(o)?(await s(n(),`default`,i()),t.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:void 0}})),e(`Session color reset to default`,{display:`system`}),null):a.includes(o)?(await s(n(),o,i()),t.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:o}})),e(`Session color set to: ${o}`,{display:`system`}),null):(e(`Invalid color "${o}". Available colors: ${a.join(`, `)}, default`,{display:`system`}),null)}var l;e((()=>{t(),r(),o(),l=[`default`,`reset`,`none`,`gray`,`grey`]}))();export{c as call};
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-DaDcL9Zw.js";var t=e(((e,t)=>{t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}})),n=e(((e,n)=>{var r=t(),i={};for(let e of Object.keys(r))i[r[e]]=e;var a={rgb:{channels:3,labels:`rgb`},hsl:{channels:3,labels:`hsl`},hsv:{channels:3,labels:`hsv`},hwb:{channels:3,labels:`hwb`},cmyk:{channels:4,labels:`cmyk`},xyz:{channels:3,labels:`xyz`},lab:{channels:3,labels:`lab`},lch:{channels:3,labels:`lch`},hex:{channels:1,labels:[`hex`]},keyword:{channels:1,labels:[`keyword`]},ansi16:{channels:1,labels:[`ansi16`]},ansi256:{channels:1,labels:[`ansi256`]},hcg:{channels:3,labels:[`h`,`c`,`g`]},apple:{channels:3,labels:[`r16`,`g16`,`b16`]},gray:{channels:1,labels:[`gray`]}};n.exports=a;for(let e of Object.keys(a)){if(!(`channels`in a[e]))throw Error(`missing channels property: `+e);if(!(`labels`in a[e]))throw Error(`missing channel labels property: `+e);if(a[e].labels.length!==a[e].channels)throw Error(`channel and label counts mismatch: `+e);let{channels:t,labels:n}=a[e];delete a[e].channels,delete a[e].labels,Object.defineProperty(a[e],"channels",{value:t}),Object.defineProperty(a[e],"labels",{value:n})}a.rgb.hsl=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s,c;a===i?s=0:t===a?s=(n-r)/o:n===a?s=2+(r-t)/o:r===a&&(s=4+(t-n)/o),s=Math.min(s*60,360),s<0&&(s+=360);let l=(i+a)/2;return c=a===i?0:l<=.5?o/(a+i):o/(2-a-i),[s,c*100,l*100]},a.rgb.hsv=function(e){let t,n,r,i,a,o=e[0]/255,s=e[1]/255,c=e[2]/255,l=Math.max(o,s,c),u=l-Math.min(o,s,c),d=function(e){return(l-e)/6/u+1/2};return u===0?(i=0,a=0):(a=u/l,t=d(o),n=d(s),r=d(c),o===l?i=r-n:s===l?i=1/3+t-r:c===l&&(i=2/3+n-t),i<0?i+=1:i>1&&--i),[i*360,a*100,l*100]},a.rgb.hwb=function(e){let t=e[0],n=e[1],r=e[2],i=a.rgb.hsl(e)[0],o=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[i,o*100,r*100]},a.rgb.cmyk=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(1-t,1-n,1-r),a=(1-t-i)/(1-i)||0,o=(1-n-i)/(1-i)||0,s=(1-r-i)/(1-i)||0;return[a*100,o*100,s*100,i*100]};function o(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}a.rgb.keyword=function(e){let t=i[e];if(t)return t;let n=1/0,a;for(let t of Object.keys(r)){let i=r[t],s=o(e,i);s<n&&(n=s,a=t)}return a},a.keyword.rgb=function(e){return r[e]},a.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;let i=t*.4124+n*.3576+r*.1805,a=t*.2126+n*.7152+r*.0722,o=t*.0193+n*.1192+r*.9505;return[i*100,a*100,o*100]},a.rgb.lab=function(e){let t=a.rgb.xyz(e),n=t[0],r=t[1],i=t[2];return n/=95.047,r/=100,i/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,[116*r-16,500*(n-r),200*(r-i)]},a.hsl.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i,a,o;if(n===0)return o=r*255,[o,o,o];i=r<.5?r*(1+n):r+n-r*n;let s=2*r-i,c=[0,0,0];for(let e=0;e<3;e++)a=t+1/3*-(e-1),a<0&&a++,a>1&&a--,o=6*a<1?s+(i-s)*6*a:2*a<1?i:3*a<2?s+(i-s)*(2/3-a)*6:s,c[e]=o*255;return c},a.hsl.hsv=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=n,a=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,i*=a<=1?a:2-a;let o=(r+n)/2;return[t,(r===0?2*i/(a+i):2*n/(r+n))*100,o*100]},a.hsv.rgb=function(e){let t=e[0]/60,n=e[1]/100,r=e[2]/100,i=Math.floor(t)%6,a=t-Math.floor(t),o=255*r*(1-n),s=255*r*(1-n*a),c=255*r*(1-n*(1-a));switch(r*=255,i){case 0:return[r,c,o];case 1:return[s,r,o];case 2:return[o,r,c];case 3:return[o,s,r];case 4:return[c,o,r];case 5:return[r,o,s]}},a.hsv.hsl=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=Math.max(r,.01),a,o;o=(2-n)*r;let s=(2-n)*i;return a=n*i,a/=s<=1?s:2-s,a=a||0,o/=2,[t,a*100,o*100]},a.hwb.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i=n+r,a;i>1&&(n/=i,r/=i);let o=Math.floor(6*t),s=1-r;a=6*t-o,o&1&&(a=1-a);let c=n+a*(s-n),l,u,d;switch(o){default:case 6:case 0:l=s,u=c,d=n;break;case 1:l=c,u=s,d=n;break;case 2:l=n,u=s,d=c;break;case 3:l=n,u=c,d=s;break;case 4:l=c,u=n,d=s;break;case 5:l=s,u=n,d=c;break}return[l*255,u*255,d*255]},a.cmyk.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=e[3]/100,a=1-Math.min(1,t*(1-i)+i),o=1-Math.min(1,n*(1-i)+i),s=1-Math.min(1,r*(1-i)+i);return[a*255,o*255,s*255]},a.xyz.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i,a,o;return i=t*3.2406+n*-1.5372+r*-.4986,a=t*-.9689+n*1.8758+r*.0415,o=t*.0557+n*-.204+r*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[i*255,a*255,o*255]},a.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];return t/=95.047,n/=100,r/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,[116*n-16,500*(t-n),200*(n-r)]},a.lab.xyz=function(e){let t=e[0],n=e[1],r=e[2],i,a,o;a=(t+16)/116,i=n/500+a,o=a-r/200;let s=a**3,c=i**3,l=o**3;return a=s>.008856?s:(a-16/116)/7.787,i=c>.008856?c:(i-16/116)/7.787,o=l>.008856?l:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]},a.lab.lch=function(e){let t=e[0],n=e[1],r=e[2],i;return i=Math.atan2(r,n)*360/2/Math.PI,i<0&&(i+=360),[t,Math.sqrt(n*n+r*r),i]},a.lch.lab=function(e){let t=e[0],n=e[1],r=e[2]/360*2*Math.PI;return[t,n*Math.cos(r),n*Math.sin(r)]},a.rgb.ansi16=function(e,t=null){let[n,r,i]=e,o=t===null?a.rgb.hsv(e)[2]:t;if(o=Math.round(o/50),o===0)return 30;let s=30+(Math.round(i/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return o===2&&(s+=60),s},a.hsv.ansi16=function(e){return a.rgb.ansi16(a.hsv.rgb(e),e[2])},a.rgb.ansi256=function(e){let t=e[0],n=e[1],r=e[2];return t===n&&n===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},a.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let n=(~~(e>50)+1)*.5;return[(t&1)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},a.ansi256.rgb=function(e){if(e>=232){let t=(e-232)*10+8;return[t,t,t]}e-=16;let t;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},a.rgb.hex=function(e){let t=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return`000000`.substring(t.length)+t},a.hex.rgb=function(e){let t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];t[0].length===3&&(n=n.split(``).map(e=>e+e).join(``));let r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},a.rgb.hcg=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.max(Math.max(t,n),r),a=Math.min(Math.min(t,n),r),o=i-a,s,c;return s=o<1?a/(1-o):0,c=o<=0?0:i===t?(n-r)/o%6:i===n?2+(r-t)/o:4+(t-n)/o,c/=6,c%=1,[c*360,o*100,s*100]},a.hsl.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n),i=0;return r<1&&(i=(n-.5*r)/(1-r)),[e[0],r*100,i*100]},a.hsv.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=t*n,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},a.hcg.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];let i=[0,0,0],a=t%1*6,o=a%1,s=1-o,c=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return c=(1-n)*r,[(n*i[0]+c)*255,(n*i[1]+c)*255,(n*i[2]+c)*255]},a.hcg.hsv=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t),r=0;return n>0&&(r=t/n),[e[0],r*100,n*100]},a.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+.5*t,r=0;return n>0&&n<.5?r=t/(2*n):n>=.5&&n<1&&(r=t/(2*(1-n))),[e[0],r*100,n*100]},a.hcg.hwb=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],(n-t)*100,(1-n)*100]},a.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,r=n-t,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},a.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},a.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},a.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},a.gray.hsl=function(e){return[0,0,e[0]]},a.gray.hsv=a.gray.hsl,a.gray.hwb=function(e){return[0,100,e[0]]},a.gray.cmyk=function(e){return[0,0,0,e[0]]},a.gray.lab=function(e){return[e[0],0,0]},a.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return`000000`.substring(n.length)+n},a.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}})),r=e(((e,t)=>{var r=n();function i(){let e={},t=Object.keys(r);for(let n=t.length,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function a(e){let t=i(),n=[e];for(t[e].distance=0;n.length;){let e=n.pop(),i=Object.keys(r[e]);for(let r=i.length,a=0;a<r;a++){let r=i[a],o=t[r];o.distance===-1&&(o.distance=t[e].distance+1,o.parent=e,n.unshift(r))}}return t}function o(e,t){return function(n){return t(e(n))}}function s(e,t){let n=[t[e].parent,e],i=r[t[e].parent][e],a=t[e].parent;for(;t[a].parent;)n.unshift(t[a].parent),i=o(r[t[a].parent][a],i),a=t[a].parent;return i.conversion=n,i}t.exports=function(e){let t=a(e),n={},r=Object.keys(t);for(let e=r.length,i=0;i<e;i++){let e=r[i];t[e].parent!==null&&(n[e]=s(e,t))}return n}})),i=e(((e,t)=>{var i=n(),a=r(),o={},s=Object.keys(i);function c(e){let t=function(...t){let n=t[0];return n==null?n:(n.length>1&&(t=n),e(t))};return`conversion`in e&&(t.conversion=e.conversion),t}function l(e){let t=function(...t){let n=t[0];if(n==null)return n;n.length>1&&(t=n);let r=e(t);if(typeof r==`object`)for(let e=r.length,t=0;t<e;t++)r[t]=Math.round(r[t]);return r};return`conversion`in e&&(t.conversion=e.conversion),t}s.forEach(e=>{o[e]={},Object.defineProperty(o[e],"channels",{value:i[e].channels}),Object.defineProperty(o[e],"labels",{value:i[e].labels});let t=a(e);Object.keys(t).forEach(n=>{let r=t[n];o[e][n]=l(r),o[e][n].raw=c(r)})}),t.exports=o}));export{t as n,i as t};
@@ -0,0 +1 @@
1
+ import{Qi as e,Vi as t,qi as n}from"./loadAgentsDir-nzr38hai.js";e();export{t as clearCommandsCache,n as getCommands};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n,nt as r}from"./state-4KQ3kaqz.js";import{n as i,t as a}from"./cwd-BuJhkTrc.js";import{_ as o,l as s}from"./debug-IKW-jE7K.js";import{T as c,_ as l,g as u,r as d,w as f}from"./git-tyaWOgRL.js";import{n as p,r as m}from"./execFileNoThrow-COKYqVQj.js";import{o as h}from"./log-B3eB4EFv.js";import{Ci as g,Si as _,_ as v}from"./model-DfFA3qMO.js";import{basename as y,extname as b,join as x,posix as S,sep as C}from"path";import{randomUUID as w}from"crypto";import{stat as T}from"fs/promises";function E(e){let t=S.sep+e.split(C).join(S.sep).replace(/^\/+/,``),n=y(e).toLowerCase(),r=b(e).toLowerCase();if(D.has(n)||O.has(r))return!0;let i=n.split(`.`);if(i.length>2){let e=`.`+i.slice(-2).join(`.`);if(O.has(e))return!0}for(let e of k)if(t.includes(e))return!0;for(let e of A)if(e.test(n))return!0;return!1}var D,O,k,A,j=e((()=>{D=new Set([`package-lock.json`,`yarn.lock`,`pnpm-lock.yaml`,`bun.lockb`,`bun.lock`,`composer.lock`,`gemfile.lock`,`cargo.lock`,`poetry.lock`,`pipfile.lock`,`shrinkwrap.json`,`npm-shrinkwrap.json`]),O=new Set([`.lock`,`.min.js`,`.min.css`,`.min.html`,`.bundle.js`,`.bundle.css`,`.generated.ts`,`.generated.js`,`.d.ts`]),k=[`/dist/`,`/build/`,`/out/`,`/output/`,`/node_modules/`,`/vendor/`,`/vendored/`,`/third_party/`,`/third-party/`,`/external/`,`/.next/`,`/.nuxt/`,`/.svelte-kit/`,`/coverage/`,`/__pycache__/`,`/.tox/`,`/venv/`,`/.venv/`,`/target/release/`,`/target/debug/`],A=[/^.*\.min\.[a-z]+$/i,/^.*-min\.[a-z]+$/i,/^.*\.bundle\.[a-z]+$/i,/^.*\.generated\.[a-z]+$/i,/^.*\.gen\.[a-z]+$/i,/^.*\.auto\.[a-z]+$/i,/^.*_generated\.[a-z]+$/i,/^.*_gen\.[a-z]+$/i,/^.*\.pb\.(go|js|ts|py|rb)$/i,/^.*_pb2?\.py$/i,/^.*\.pb\.h$/i,/^.*\.grpc\.[a-z]+$/i,/^.*\.swagger\.[a-z]+$/i,/^.*\.openapi\.[a-z]+$/i]}));function M(){return d(a())??r()}function N(){return W}function P(){return process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}function F(){return{fileStates:new Map,sessionBaselines:new Map,surface:P(),startingHeadSha:null,promptCount:0,promptCountAtLastCommit:0,permissionPromptCount:0,permissionPromptCountAtLastCommit:0,escapeCount:0,escapeCountAtLastCommit:0}}async function I(e,t){let r=M(),i=n(),a={},o=[],s=new Set,c={},l=0,u=0,d=new Map,f=new Map;for(let t of e){s.add(t.surface);let e=t.sessionBaselines instanceof Map?t.sessionBaselines:new Map(Object.entries(t.sessionBaselines??{}));for(let[t,n]of e)f.has(t)||f.set(t,n);let n=t.fileStates instanceof Map?t.fileStates:new Map(Object.entries(t.fileStates??{}));for(let[e,t]of n){let n=d.get(e);n?d.set(e,{...t,claudeContribution:n.claudeContribution+t.claudeContribution}):d.set(e,t)}}let p=await Promise.all(t.map(async t=>{if(E(t))return{type:`generated`,file:t};let n=x(r,t),i=d.get(t),a=f.get(t),o=e[0].surface,s=0,c=0;if(await R(t))if(i)s=i.claudeContribution,c=0;else{let e=await L(t);c=e>0?e:100}else try{let e=await T(n);if(i)s=i.claudeContribution,c=0;else if(a){let n=await L(t);c=n>0?n:e.size}else c=e.size}catch{return null}s=Math.max(0,s),c=Math.max(0,c);let l=s+c,u=l>0?Math.round(s/l*100):0;return{type:`file`,file:t,claudeChars:s,humanChars:c,percent:u,surface:o}}));for(let e of p)if(e){if(e.type===`generated`){o.push(e.file);continue}a[e.file]={claudeChars:e.claudeChars,humanChars:e.humanChars,percent:e.percent,surface:e.surface},l+=e.claudeChars,u+=e.humanChars,c[e.surface]=(c[e.surface]??0)+e.claudeChars}let m=l+u,h=m>0?Math.round(l/m*100):0,g={};for(let[e,t]of Object.entries(c))g[e]={claudeChars:t,percent:m>0?Math.round(t/m*100):0};return{version:1,summary:{claudePercent:h,claudeChars:l,humanChars:u,surfaces:Array.from(s)},files:a,surfaceBreakdown:g,excludedGenerated:o,sessions:[i]}}async function L(e){let t=M();try{let n=await p(u(),[`diff`,`--cached`,`--stat`,`--`,e],{cwd:t,timeout:5e3});if(n.code!==0||!n.stdout)return 0;let r=n.stdout.split(`
2
+ `).filter(Boolean),i=0;for(let e of r)if(e.includes(`file changed`)||e.includes(`files changed`)){let t=e.match(/(\d+) insertions?/),n=e.match(/(\d+) deletions?/),r=t?parseInt(t[1],10):0,a=n?parseInt(n[1],10):0;i+=(r+a)*40}return i}catch{return 0}}async function R(e){let t=M();try{let n=await p(u(),[`diff`,`--cached`,`--name-status`,`--`,e],{cwd:t,timeout:5e3});if(n.code===0&&n.stdout)return n.stdout.trim().startsWith(`D `)}catch{}return!1}function z(e,t){let n={};for(let[t,r]of e.fileStates)n[t]=r;return{type:`attribution-snapshot`,messageId:t,surface:e.surface,fileStates:n,promptCount:e.promptCount,promptCountAtLastCommit:e.promptCountAtLastCommit,permissionPromptCount:e.permissionPromptCount,permissionPromptCountAtLastCommit:e.permissionPromptCountAtLastCommit,escapeCount:e.escapeCount,escapeCountAtLastCommit:e.escapeCountAtLastCommit}}function B(e){let t=F(),n=e[e.length-1];if(!n)return t;t.surface=n.surface;for(let[e,r]of Object.entries(n.fileStates))t.fileStates.set(e,r);return t.promptCount=n.promptCount??0,t.promptCountAtLastCommit=n.promptCountAtLastCommit??0,t.permissionPromptCount=n.permissionPromptCount??0,t.permissionPromptCountAtLastCommit=n.permissionPromptCountAtLastCommit??0,t.escapeCount=n.escapeCount??0,t.escapeCountAtLastCommit=n.escapeCountAtLastCommit??0,t}function V(e,t){t(B(e))}function H(e,t){let n={...e,promptCount:e.promptCount+1};return t(z(n,w())),n}var U,W,G,K=e((()=>{t(),i(),s(),m(),o(),j(),c(),l(),h(),v(),_(),U=`github.com:anthropics/claude-cli-internal,github.com/anthropics/claude-cli-internal,github.com:anthropics/anthropic,github.com/anthropics/anthropic,github.com:anthropics/apps,github.com/anthropics/apps,github.com:anthropics/casino,github.com/anthropics/casino,github.com:anthropics/dbt,github.com/anthropics/dbt,github.com:anthropics/dotfiles,github.com/anthropics/dotfiles,github.com:anthropics/terraform-config,github.com/anthropics/terraform-config,github.com:anthropics/hex-export,github.com/anthropics/hex-export,github.com:anthropics/feedback-v2,github.com/anthropics/feedback-v2,github.com:anthropics/labs,github.com/anthropics/labs,github.com:anthropics/argo-rollouts,github.com/anthropics/argo-rollouts,github.com:anthropics/starling-configs,github.com/anthropics/starling-configs,github.com:anthropics/ts-tools,github.com/anthropics/ts-tools,github.com:anthropics/ts-capsules,github.com/anthropics/ts-capsules,github.com:anthropics/feldspar-testing,github.com/anthropics/feldspar-testing,github.com:anthropics/trellis,github.com/anthropics/trellis,github.com:anthropics/claude-for-hiring,github.com/anthropics/claude-for-hiring,github.com:anthropics/forge-web,github.com/anthropics/forge-web,github.com:anthropics/infra-manifests,github.com/anthropics/infra-manifests,github.com:anthropics/mycro_manifests,github.com/anthropics/mycro_manifests,github.com:anthropics/mycro_configs,github.com/anthropics/mycro_configs,github.com:anthropics/mobile-apps,github.com/anthropics/mobile-apps`.split(`,`),W=null,G=g(async()=>{if(W!==null)return W===`internal`;let e=await f(M());if(!e)return W=`none`,!1;let t=U.some(t=>e.includes(t));return W=t?`internal`:`external`,t})}));export{P as a,H as c,G as d,B as f,M as i,K as l,I as n,L as o,z as p,F as r,N as s,V as t,R as u};
@@ -0,0 +1 @@
1
+ import{d as e,l as t}from"./commitAttribution-Cm40fdNU.js";t();export{e as isInternalModelRepo};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{di as t,ui as n}from"./src-CDCSSo0U2.js";import{en as r,rn as i}from"./state-4KQ3kaqz.js";import{Ao as a,GT as o,Gu as s,KT as c,Kx as l,OT as u,PT as d,Sl as f,Wu as p,_l as m,dE as h,dl as g,fh as _,hE as v,hl as y,ll as b,lt as x,mE as S,oE as C,ph as w,qT as T,qx as E,sE as D,uE as O,ut as k,vl as A,xl as j,yl as M,yn as N,zo as P}from"./loadAgentsDir-nzr38hai.js";import{H as F,U as I}from"./debug-IKW-jE7K.js";import{o as L,s as R}from"./log-B3eB4EFv.js";function z(e,t){let r=_(`tip`),i=l(`app:toggleTranscript`,`Global`,`ctrl+o`),a=[...e.options.verbose?[]:[`(${i} to see full summary)`],...t?[t]:[],...r?[r]:[]];return n.dim(`Compacted `+a.join(`
2
+ `))}async function B(e,t){let n=e.getAppState(),r=await x(e.options.tools,e.options.mainLoopModel,Array.from(n.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),i=p({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:r,appendSystemPrompt:e.options.appendSystemPrompt}),[a,s]=await Promise.all([c(),o()]);return{systemPrompt:i,userContext:a,systemContext:s,toolUseContext:e,forkContextMessages:t}}var V;e((()=>{t(),r(),k(),T(),E(),S(),f(),O(),C(),y(),b(),u(),I(),N(),L(),P(),w(),s(),V=async(e,t)=>{let{abortController:n}=t,{messages:r}=t;if(r=a(r),r.length===0)throw Error(`No messages to compact`);let o=e.trim();try{if(!o){let e=await g(r,t.agentId);if(e)return c.cache.clear?.(),m(),v(t.options.querySource??`compact`,t.agentId),i(),h(),{type:`compact`,compactionResult:e,displayText:z(t)}}let e=(await D(r,t)).messages,n=await j(e,t,await B(t,e),!1,o,!1);return d(void 0),h(),c.cache.clear?.(),m(),{type:`compact`,compactionResult:n,displayText:z(t,n.userDisplayMessage)}}catch(e){throw n.signal.aborted?Error(`Compaction canceled.`):F(e,`Not enough messages to compact. Send a few more messages first, then try again.`)?Error(M):F(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(A):(R(e),Error(`Error during compaction: ${e}`))}}}))();export{V as call};