@readmagic/workmate 0.0.9 → 0.0.11

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 (445) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-qFZy3FOD.js → AddWorkspaceDirectory-ag2JTpmU.js} +1 -1
  2. package/dist/chunks/{App-DW4elk6E.js → App-BuKmqFPm.js} +1 -1
  3. package/dist/chunks/ApproveApiKey-CIWOi_7v.js +1 -0
  4. package/dist/chunks/ApproveApiKey-M6U-NafA.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-Pnpl3Ixx.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-BuRFF1fQ.js → BypassPermissionsModeDialog-B05t83wa.js} +1 -1
  7. package/dist/chunks/{ClaudeMdExternalIncludesDialog-CDrArsSX.js → ClaudeMdExternalIncludesDialog-CSywJdVL.js} +1 -1
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog-D-w166RC.js +1 -0
  9. package/dist/chunks/ConsoleOAuthFlow-CV6PcJOP.js +1 -0
  10. package/dist/chunks/{DiffDialog-BIcwpgSr.js → DiffDialog-DUbFrzKu.js} +3 -3
  11. package/dist/chunks/Doctor-BcnUfJ4I.js +1 -0
  12. package/dist/chunks/Doctor-Dz4TuYas.js +3 -0
  13. package/dist/chunks/ExitFlow-BwyAtIHx.js +2 -0
  14. package/dist/chunks/{Grove-BmirUB6V.js → Grove-BDoVj02t.js} +2 -2
  15. package/dist/chunks/{HybridTransport-BVmSUHf0.js → HybridTransport-C_U0IJfz.js} +4 -4
  16. package/dist/chunks/{InvalidConfigDialog-WRywkKeS.js → InvalidConfigDialog-bih293Xt.js} +1 -1
  17. package/dist/chunks/{InvalidSettingsDialog-C4n3A72C.js → InvalidSettingsDialog-Br8kQOHz.js} +1 -1
  18. package/dist/chunks/MCPConnectionManager-B9n4SXN4.js +1 -0
  19. package/dist/chunks/MCPToolListView-DJ06N1DG.js +1 -0
  20. package/dist/chunks/{McpParsingWarnings-CH4yyMAL.js → McpParsingWarnings-COa71S9q.js} +1 -1
  21. package/dist/chunks/MessageSelector-o4ULADFg.js +3 -0
  22. package/dist/chunks/Messages-qqwHuAW5.js +11 -0
  23. package/dist/chunks/{Onboarding-BboWs1pp.js → Onboarding-BzuQjney.js} +1 -1
  24. package/dist/chunks/{PromptInputFooterSuggestions-BpC9COmh.js → PromptInputFooterSuggestions-to5eYBvI.js} +1 -1
  25. package/dist/chunks/PromptInputHelpMenu-CfMFx-TF.js +1 -0
  26. package/dist/chunks/QueryEngine-Dt0BKUeF.js +1 -0
  27. package/dist/chunks/REPL-CUbEDqEl.js +133 -0
  28. package/dist/chunks/REPL-DMaKNhTa.js +1 -0
  29. package/dist/chunks/RemoteSessionManager-Bf44A0Ol.js +2 -0
  30. package/dist/chunks/ResumeConversation-Ctw5Q1g9.js +1 -0
  31. package/dist/chunks/{SSETransport-1KBBUikF.js → SSETransport-DN4tCDEh.js} +3 -3
  32. package/dist/chunks/SearchExtraToolsTool-C80OdtPZ.js +1 -0
  33. package/dist/chunks/Settings-DfdcmvOV.js +2 -0
  34. package/dist/chunks/{TeleportProgress-BmgPAZAi.js → TeleportProgress-C2LQVLav.js} +1 -1
  35. package/dist/chunks/{TeleportRepoMismatchDialog-sgxNOeM_.js → TeleportRepoMismatchDialog-BZL8Zblz.js} +1 -1
  36. package/dist/chunks/{TeleportResumeWrapper-GptvrUdv.js → TeleportResumeWrapper-wPiIs8xg.js} +1 -1
  37. package/dist/chunks/{ThemePicker-gAMqqD1P.js → ThemePicker-BT_NaRQC.js} +1 -1
  38. package/dist/chunks/{TrustDialog-CWt-4Evl.js → TrustDialog-ACaJ_m7A.js} +1 -1
  39. package/dist/chunks/{ValidationErrorsList-De3kzHtz.js → ValidationErrorsList-C-hWdy_8.js} +1 -1
  40. package/dist/chunks/WelcomeV2-ZQRKlcT4.js +1 -0
  41. package/dist/chunks/add-dir-SAKTkw0S.js +1 -0
  42. package/dist/chunks/{agentDisplay-5gnCQwUY.js → agentDisplay-CuSHqgZc.js} +1 -1
  43. package/dist/chunks/{agents-Bz1MLp4A.js → agents-CMC0iQP4.js} +1 -1
  44. package/dist/chunks/agents-ZgRKpjHv.js +103 -0
  45. package/dist/chunks/allErrors-_cOQksHC.js +1 -0
  46. package/dist/chunks/{api-DzccRM_z.js → api-BbJfMXRS.js} +1 -1
  47. package/dist/chunks/api-DS1MiW01.js +1 -0
  48. package/dist/chunks/{auth-Cjnyy10u.js → auth-7mJGtlZp.js} +2 -2
  49. package/dist/chunks/auth-DGZzCbU0.js +1 -0
  50. package/dist/chunks/auth-DN1MUpB8.js +1 -0
  51. package/dist/chunks/{autoMode-CQ5nqP9c.js → autoMode-CBtY7ACs.js} +6 -6
  52. package/dist/chunks/autonomy-DuQmYhq6.js +15 -0
  53. package/dist/chunks/{autonomy-CPUCe-YU.js → autonomy-lJV7yWUl.js} +1 -1
  54. package/dist/chunks/autonomyPanel-DAQm6lDz.js +1 -0
  55. package/dist/chunks/backgroundHousekeeping-BTy71bcY.js +1 -0
  56. package/dist/chunks/backgroundHousekeeping-Cc7Ag7JG.js +17 -0
  57. package/dist/chunks/{banner-BJZNMppT.js → banner-1Wyeyawe.js} +1 -1
  58. package/dist/chunks/{bg-w3Vlsm3Y.js → bg-CJ0YWFli.js} +2 -2
  59. package/dist/chunks/bg-CeUrRz_7.js +1 -0
  60. package/dist/chunks/branch-k3kirqbA.js +3 -0
  61. package/dist/chunks/{break-cache-DXV0brco.js → break-cache-CAoZ9b72.js} +2 -2
  62. package/dist/chunks/bridgeConfig-CzRUPn-D.js +1 -0
  63. package/dist/chunks/{bridgeConfig-vORehbGG.js → bridgeConfig-UgaUfuP6.js} +1 -1
  64. package/dist/chunks/bridgeMessaging-Ci5H68MX.js +1 -0
  65. package/dist/chunks/{bridgePointer-D4W9GpWw.js → bridgePointer-BL8-lGvN.js} +1 -1
  66. package/dist/chunks/bridgeStatusUtil-C36w15ge.js +1 -0
  67. package/dist/chunks/{btw-DDUC_t0w.js → btw-nVoVuIae.js} +1 -1
  68. package/dist/chunks/caches-B8sM3Zys.js +1 -0
  69. package/dist/chunks/caches-Bp9MZ7IE.js +1 -0
  70. package/dist/chunks/{capacityWake-L7b1mMft.js → capacityWake-BOySRJUJ.js} +1 -1
  71. package/dist/chunks/ccrClient-Br4LAofR.js +1 -0
  72. package/dist/chunks/{claudeDesktop-CAmnheYx.js → claudeDesktop-Bgds1-YT.js} +1 -1
  73. package/dist/chunks/{clear-DdWexxbM.js → clear-C4Vtnbye.js} +1 -1
  74. package/dist/chunks/{cliLaunch-BWWOgBFh.js → cliLaunch-BTpfAGGI.js} +1 -1
  75. package/dist/chunks/{client-CoXtVRzi.js → client-B9404qIP.js} +1 -1
  76. package/dist/chunks/client-BCAbKdNz.js +1 -0
  77. package/dist/chunks/client-CJE6gEvU.js +1 -0
  78. package/dist/chunks/commands-DL-BzoMQ.js +1 -0
  79. package/dist/chunks/compact-Cx7BPXLU.js +2 -0
  80. package/dist/chunks/config-S5OW4Xqr.js +1 -0
  81. package/dist/chunks/config-aRiTrtCv.js +3 -0
  82. package/dist/chunks/{config-CVvUNkj2.js → config-kB2eazPX.js} +1 -1
  83. package/dist/chunks/{context-BWcfhhDj.js → context-BN7DEjoH.js} +1 -1
  84. package/dist/chunks/{context-noninteractive-c7jGVWHQ.js → context-noninteractive-D91W2B8e.js} +5 -5
  85. package/dist/chunks/context-noninteractive-DPacEFJ1.js +1 -0
  86. package/dist/chunks/conversation-D5Nbu9eT.js +1 -0
  87. package/dist/chunks/conversation-hcUx9e-C.js +1 -0
  88. package/dist/chunks/{createSSHSession-DP7B8yvb.js → createSSHSession-DecOR6M5.js} +6 -6
  89. package/dist/chunks/createSession-D27zvmOs.js +1 -0
  90. package/dist/chunks/createSession-DRqkLZWt.js +1 -0
  91. package/dist/chunks/crossProjectResume-Bw3U0Ty6.js +40 -0
  92. package/dist/chunks/cwd-Cfdf7z7s.js +1 -0
  93. package/dist/chunks/cwd-ClLru_7T.js +1 -0
  94. package/dist/chunks/datadog-bm551AVV.js +1 -0
  95. package/dist/chunks/debug-BecbSVoN.js +39 -0
  96. package/dist/chunks/{debugUtils-CezNYZ-4.js → debugUtils-CmJfIUxW.js} +1 -1
  97. package/dist/chunks/{detached-CkPpYMJj.js → detached-CIyF0M5O.js} +1 -1
  98. package/dist/chunks/detectRepository-C15umvKN.js +1 -0
  99. package/dist/chunks/detectRepository-DDfLfKcM.js +1 -0
  100. package/dist/chunks/{diff-DHzz9WAp.js → diff-DeK4bwjw.js} +1 -1
  101. package/dist/chunks/{directoryCompletion-D5AvL7TF.js → directoryCompletion-BJCu19HJ.js} +1 -1
  102. package/dist/chunks/doctor-BJORBomU.js +1 -0
  103. package/dist/chunks/earlyInput-BEjRkAtH.js +1 -0
  104. package/dist/chunks/{earlyInput-BTC_Wucv.js → earlyInput-IghoCjG5.js} +1 -1
  105. package/dist/chunks/entry-mdegyj8z.js +14 -0
  106. package/dist/chunks/esm-Ka3lhafK.js +1 -0
  107. package/dist/chunks/{execFileNoThrow-5SylUnAI.js → execFileNoThrow-DHyW8FMX.js} +2 -2
  108. package/dist/chunks/execSyncWrapper-CDzB0BM1.js +1 -0
  109. package/dist/chunks/exit-CF3KBl-S.js +1 -0
  110. package/dist/chunks/{extraUsage-Dt5mw35U.js → extraUsage-BrKbpBK-.js} +1 -1
  111. package/dist/chunks/extractMemories-4lBn134y.js +1 -0
  112. package/dist/chunks/fast-0Vi354KI.js +1 -0
  113. package/dist/chunks/{fast-ClYQcEv5.js → fast-DWn40OcQ.js} +1 -1
  114. package/dist/chunks/featureCheck-D6FjD-nt.js +1 -0
  115. package/dist/chunks/featureCheck-JOur3pHb.js +1 -0
  116. package/dist/chunks/{fileSuggestions-fNxREjpe.js → fileSuggestions-C7Pwq2yj.js} +3 -3
  117. package/dist/chunks/firstPartyEventLogger-BHjBQH0J.js +5 -0
  118. package/dist/chunks/firstPartyEventLogger-BNBnLYPK.js +1 -0
  119. package/dist/chunks/flushGate-DdJjxCes.js +1 -0
  120. package/dist/chunks/{gemini-fZ0VPU2A.js → gemini-DHv2iVfy.js} +1 -1
  121. package/dist/chunks/generateSessionName-DhS_6oHd.js +1 -0
  122. package/dist/chunks/{genericProcessUtils-BmDSLcMf.js → genericProcessUtils-B2HcDYhg.js} +1 -1
  123. package/dist/chunks/git-DBlOv64X.js +6 -0
  124. package/dist/chunks/git-DF4RFFaT.js +1 -0
  125. package/dist/chunks/githubRepoPathMapping-CK56bUDe.js +1 -0
  126. package/dist/chunks/{goal-IasZVqKh.js → goal-BZG4gtnb.js} +3 -3
  127. package/dist/chunks/{grok-Dk3LyzMa.js → grok-BS57ZhyW.js} +1 -1
  128. package/dist/chunks/{grove-BE4fQ6tG.js → grove-_zlQ83yR.js} +2 -2
  129. package/dist/chunks/help-C_2tdXHC.js +1 -0
  130. package/dist/chunks/{hooks-BrKy5XWQ.js → hooks-C7Bn7MBe.js} +2 -2
  131. package/dist/chunks/hooks-DT80Arzc.js +1 -0
  132. package/dist/chunks/initReplBridge-NkZRcM77.js +1 -0
  133. package/dist/chunks/{install-CVGZ55wV.js → install-Du-DSVzj.js} +1 -1
  134. package/dist/chunks/{instrumentation-BmWotlxR.js → instrumentation-DMs3b82f.js} +5 -5
  135. package/dist/chunks/intl-D2kgJmX7.js +1 -0
  136. package/dist/chunks/{job-DEXxW_Zo.js → job-rbX1VZmp.js} +1 -1
  137. package/dist/chunks/jwtUtils-OzxN2zts.js +1 -0
  138. package/dist/chunks/keybindings-CwdC_8S0.js +2 -0
  139. package/dist/chunks/{launchLocalMemory-CLSSVFoj.js → launchLocalMemory-BLRCK1_o.js} +2 -2
  140. package/dist/chunks/{launchOnboarding-BkJfKviO.js → launchOnboarding-Al_X75Vz.js} +1 -1
  141. package/dist/chunks/{loadAgentsDir-CKSb56Gp.js → loadAgentsDir-BL93ulMm.js} +2197 -2332
  142. package/dist/chunks/loadAgentsDir-eVKq8efm.js +1 -0
  143. package/dist/chunks/loadPluginHooks-B0au35a4.js +1 -0
  144. package/dist/chunks/{localSearch-CPOnyi8I.js → localSearch-C5ipegd9.js} +1 -1
  145. package/dist/chunks/localSearch-CZlFfR_X.js +1 -0
  146. package/dist/chunks/log-Dauqle-Z.js +1 -0
  147. package/dist/chunks/{logoV2Utils-we1sfJvf.js → logoV2Utils-CkvOihX7.js} +1 -1
  148. package/dist/chunks/{magicDocs-DmKlTQvK.js → magicDocs-DLav5QK0.js} +3 -3
  149. package/dist/chunks/main-CVNWNAoh.js +513 -0
  150. package/dist/chunks/{main-ClXu1ilx.js → main-LMyE3jXY.js} +4 -4
  151. package/dist/chunks/managedEnv-CYepSnm8.js +1 -0
  152. package/dist/chunks/{managedEnv-Cl7YbYzf.js → managedEnv-DJSCuqCb.js} +1 -1
  153. package/dist/chunks/{mappers-xQC-Z4-h.js → mappers-DQxMcezy.js} +1 -1
  154. package/dist/chunks/mcp-BAbbEaBA.js +1 -0
  155. package/dist/chunks/mcp-Ct4Sum6A.js +6 -0
  156. package/dist/chunks/mcp-D5HkCqUh.js +2 -0
  157. package/dist/chunks/{memoize-FJv2HV1u.js → memoize-FeyE7JEh.js} +1 -1
  158. package/dist/chunks/memory-COa7aUbx.js +1 -0
  159. package/dist/chunks/{mode-lYTs0XHs.js → mode-Bl2RZC8M.js} +2 -2
  160. package/dist/chunks/model-B7rtZ7KV.js +1 -0
  161. package/dist/chunks/model-Bgh_r4lg.js +1 -0
  162. package/dist/chunks/model-DiuEAv6h.js +1 -0
  163. package/dist/chunks/{modelOptions-efCGKnXT.js → modelOptions-BtEZe5BB.js} +1 -1
  164. package/dist/chunks/nativeInstaller-BEwayifa.js +1 -0
  165. package/dist/chunks/omit--yH_T4rf.js +1 -0
  166. package/dist/chunks/onChangeAppState-ZdwI7boX.js +1 -0
  167. package/dist/chunks/{openai-DJLYqiRl.js → openai-DWs4D-nQ.js} +3 -3
  168. package/dist/chunks/panel-CoNfXy3K.js +1 -0
  169. package/dist/chunks/{parser-BdCj2GrE.js → parser-BH4u7QiV.js} +1 -1
  170. package/dist/chunks/parser-BMIaRErw.js +1 -0
  171. package/dist/chunks/partition-DLcW5Oo_.js +1 -0
  172. package/dist/chunks/permissions-CaucYK3s.js +3 -0
  173. package/dist/chunks/pidLock-DgOBc1Xo.js +3 -0
  174. package/dist/chunks/{plan-BeoIjNPv.js → plan-BNYDTnQd.js} +1 -1
  175. package/dist/chunks/{platform-D6IMiyqT.js → platform-B0uTQc9P.js} +1 -1
  176. package/dist/chunks/plugin-BN-of1_H.js +17 -0
  177. package/dist/chunks/pluginAutoupdate-BBU9Jn4p.js +1 -0
  178. package/dist/chunks/pluginBlocklist-DXQlbG0P.js +1 -0
  179. package/dist/chunks/pluginCliCommands-CfdVNs8D.js +1 -0
  180. package/dist/chunks/pluginFlagging-DcJ_FQuv.js +1 -0
  181. package/dist/chunks/pluginOperations-DnhzFbYI.js +2 -0
  182. package/dist/chunks/pluginStartupCheck-CKBFaMFr.js +1 -0
  183. package/dist/chunks/pluginStartupCheck-CpNB4jxG.js +1 -0
  184. package/dist/chunks/{plugins-pmipe7kE.js → plugins-CBW7kPyp.js} +4 -4
  185. package/dist/chunks/{poorMode-BxsyllUK.js → poorMode-B_xEvuEV.js} +1 -1
  186. package/dist/chunks/poorMode-yH1o41cQ.js +1 -0
  187. package/dist/chunks/print-BZOx09SU.js +26 -0
  188. package/dist/chunks/processBashCommand-dcCNCiBp.js +1 -0
  189. package/dist/chunks/processSlashCommand-YDiM63Qr.js +5 -0
  190. package/dist/chunks/prompt-CXGy0llt.js +1 -0
  191. package/dist/chunks/prompt-DovNDmcx.js +1 -0
  192. package/dist/chunks/{prompt-CybUvG8G.js → prompt-Dx7IWhBt.js} +34 -34
  193. package/dist/chunks/{promptEditor-0Ug93P2I.js → promptEditor-WCkmpejM.js} +2 -2
  194. package/dist/chunks/{protocolHandler-ClfbHTjI.js → protocolHandler-BiVWrpHi.js} +4 -4
  195. package/dist/chunks/{proxy-Blq4W6Ox.js → proxy-CVn7o19p.js} +3 -3
  196. package/dist/chunks/reconciler-C2Nd_e4n.js +1 -0
  197. package/dist/chunks/refresh-B84H2Ezd.js +1 -0
  198. package/dist/chunks/{registerProtocol-3_ozAuDK.js → registerProtocol-E0Iu5hEx.js} +2 -2
  199. package/dist/chunks/{reload-plugins-Dn1ibOiI.js → reload-plugins-D-3AUT9g.js} +1 -1
  200. package/dist/chunks/{remoteBridgeCore-Dpg6Se9C.js → remoteBridgeCore-CV6we3ZA.js} +1 -1
  201. package/dist/chunks/remoteManagedSettings-D26Q09-7.js +1 -0
  202. package/dist/chunks/rename-CSavuBIE.js +1 -0
  203. package/dist/chunks/{renderOptions-CLcco6fc.js → renderOptions-DDLbSMQU.js} +1 -1
  204. package/dist/chunks/resume-CROylN3J.js +2 -0
  205. package/dist/chunks/ripgrep-2M1GkXqJ.js +1 -0
  206. package/dist/chunks/{ripgrep-DkL2S7-I.js → ripgrep-C1ydIMzT.js} +5 -5
  207. package/dist/chunks/{runtimeObserver-DonWCJOx.js → runtimeObserver-L7pSIWBT.js} +4 -4
  208. package/dist/chunks/{runtimeObserver-B0xfyLiA.js → runtimeObserver-OU8KrZQG.js} +1 -1
  209. package/dist/chunks/sandbox-adapter-6UwMLh6e.js +1 -0
  210. package/dist/chunks/{sandbox-toggle-CSdnHWp-.js → sandbox-toggle-YrQNWGsr.js} +1 -1
  211. package/dist/chunks/searchExtraTools-Bdv5HJ74.js +1 -0
  212. package/dist/chunks/{session-BbQlh2S5.js → session-DUYsfPy_.js} +2 -2
  213. package/dist/chunks/sessionFileAccessHooks-Czen7Ejz.js +1 -0
  214. package/dist/chunks/sessionObserver-B0zucj_c.js +1 -0
  215. package/dist/chunks/{sessionObserver-XV6N0XER.js → sessionObserver-Dv3Ba8eA.js} +2 -2
  216. package/dist/chunks/sessionState-D-SaBzWD.js +11 -0
  217. package/dist/chunks/sessionStorage-BM1x51Z7.js +1 -0
  218. package/dist/chunks/{sessionTitle-E1FvsKM9.js → sessionTitle-uCuYaNif.js} +2 -2
  219. package/dist/chunks/{sessionTracing-ClGQ08jM.js → sessionTracing-Bqb3vJTt.js} +3 -3
  220. package/dist/chunks/settings-BG15IFYx.js +1 -0
  221. package/dist/chunks/settings-D4CpDv2y.js +20 -0
  222. package/dist/chunks/settingsSync-BSrpnyqo.js +1 -0
  223. package/dist/chunks/setup-C62oq4AZ.js +3 -0
  224. package/dist/chunks/{shadowedRuleDetection-B9iSx6mB.js → shadowedRuleDetection-BzAZ57p2.js} +1 -1
  225. package/dist/chunks/{shellQuote-Bth6IZgX.js → shellQuote-DS6WrivY.js} +2 -2
  226. package/dist/chunks/{sideQuestion-D2dPToW8.js → sideQuestion-CvMBBjI8.js} +3 -3
  227. package/dist/chunks/sinks-WJ7nzLQs.js +1 -0
  228. package/dist/chunks/sinks-f7qYjbKJ.js +2 -0
  229. package/dist/chunks/skillChangeDetector-U5kRU5nd.js +1 -0
  230. package/dist/chunks/{skillGapStore-DylpOKJ6.js → skillGapStore-CqaT8c0C.js} +2 -2
  231. package/dist/chunks/{skillLifecycle-GK-8eyyn.js → skillLifecycle-CnR8IqJM.js} +2 -2
  232. package/dist/chunks/skillSearchPanel-D9qrOXpI.js +21 -0
  233. package/dist/chunks/{skills-t6krW8GZ.js → skills-BgcFh0vy.js} +1 -1
  234. package/dist/chunks/startupProfiler-B4HBBbHN.js +1 -0
  235. package/dist/chunks/{startupProfiler-jeId9f2i.js → startupProfiler-CmH_aVy2.js} +3 -3
  236. package/dist/chunks/state-BemZdQIl.js +1 -0
  237. package/dist/chunks/state-D_lk6z-C.js +1 -0
  238. package/dist/chunks/{stats-BJBhl-Lc.js → stats-B8uQ-UDi.js} +1 -1
  239. package/dist/chunks/{status-BtsnKNVY.js → status-BekdWoIj.js} +1 -1
  240. package/dist/chunks/{status-nZQEar7T.js → status-D6KlRJmR.js} +2 -2
  241. package/dist/chunks/statusNoticeHelpers-BMM8_uJ1.js +1 -0
  242. package/dist/chunks/{stringUtils-CbS6OkmE.js → stringUtils-C8PaYpQF.js} +1 -1
  243. package/dist/chunks/switcher-Ck9CrXrr.js +1 -0
  244. package/dist/chunks/{switcher-77h2J5HC.js → switcher-DnAhkyIn.js} +1 -1
  245. package/dist/chunks/syncCache-ClP9aBqK.js +1 -0
  246. package/dist/chunks/{tasks-BNrdmF9p.js → tasks-Dmh6qikm.js} +1 -1
  247. package/dist/chunks/teleport-DH3IuAUQ.js +1 -0
  248. package/dist/chunks/{templateJobs-Dkv4I9c1.js → templateJobs-CxqU-s5i.js} +1 -1
  249. package/dist/chunks/{terminalSetup-DQopnSPR.js → terminalSetup-BKGcmlWp.js} +1 -1
  250. package/dist/chunks/{terminalSetup-DTGm1Eo2.js → terminalSetup-Cy19F1Js.js} +4 -4
  251. package/dist/chunks/{theme-BjpBVRf5.js → theme-U7lMFHQ0.js} +1 -1
  252. package/dist/chunks/{tmux-CMRiI6CD.js → tmux-D5EvHWi3.js} +1 -1
  253. package/dist/chunks/{toolEventObserver-D-sNBvOe.js → toolEventObserver-D9qjoVl5.js} +1 -1
  254. package/dist/chunks/toolPool-69mfSPAs.js +1 -0
  255. package/dist/chunks/trustedDevice-B6AKlsl_.js +1 -0
  256. package/dist/chunks/trustedDevice-DL0pWP4_.js +1 -0
  257. package/dist/chunks/{types-DWRxAH0E.js → types-DafcFtmb.js} +2 -2
  258. package/dist/chunks/udsClient-CWnfsgFP.js +1 -0
  259. package/dist/chunks/updateCCB-C6XftzIG.js +11 -0
  260. package/dist/chunks/{upstreamproxy-DDVMwoRi.js → upstreamproxy-CXmjxHpl.js} +2 -2
  261. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-D2FvHieH.js → useExitOnCtrlCDWithKeybindings-DEEJhm_W.js} +1 -1
  262. package/dist/chunks/useMainLoopModel-6w7mhwhU.js +1 -0
  263. package/dist/chunks/useManagePlugins-CjnsO-Of.js +1 -0
  264. package/dist/chunks/{useMergedTools-B-Z9XQ6U.js → useMergedTools-DbhqKk1-.js} +1 -1
  265. package/dist/chunks/{useSearchInput-C6d6nt9S.js → useSearchInput-gUDbkLaC.js} +1 -1
  266. package/dist/chunks/useSettingsErrors-CgPad-H0.js +1 -0
  267. package/dist/chunks/{userAgent-Ng_TTjWr.js → userAgent-CU7Ndh79.js} +1 -1
  268. package/dist/chunks/util-B4oMhJKh.js +1 -0
  269. package/dist/chunks/validatePlugin-y_O_tCEL.js +1 -0
  270. package/dist/chunks/{vim-3mUqsEJm.js → vim-w37BfGZ5.js} +1 -1
  271. package/dist/chunks/{which-DznMOwny.js → which-BRWBO7Gu.js} +1 -1
  272. package/dist/chunks/windowsPaths-BY-IVNwQ.js +1 -0
  273. package/dist/chunks/windowsPaths-DtWHLjmE.js +1 -0
  274. package/dist/chunks/{workSecret-DtiFreRl.js → workSecret-BEhXgH2M.js} +1 -1
  275. package/dist/chunks/workerRegistry-Bq9bS5pw.js +6 -0
  276. package/dist/chunks/worktree-4SUJ4dtz.js +1 -0
  277. package/dist/cli.js +1 -1
  278. package/package.json +2 -3
  279. package/dist/chunks/ApproveApiKey-D05WywHU.js +0 -1
  280. package/dist/chunks/ApproveApiKey-DHAbdwkC.js +0 -1
  281. package/dist/chunks/BackgroundTasksDialog-QgFwoaaC.js +0 -2
  282. package/dist/chunks/ClaudeMdExternalIncludesDialog-DpecRCAt.js +0 -1
  283. package/dist/chunks/ConsoleOAuthFlow-D1MYL1dJ.js +0 -1
  284. package/dist/chunks/Doctor-D160J8Ad.js +0 -3
  285. package/dist/chunks/Doctor-VhJi2cmL.js +0 -1
  286. package/dist/chunks/ExitFlow-CoWHhKHJ.js +0 -2
  287. package/dist/chunks/MCPConnectionManager-DPFe4hPh.js +0 -1
  288. package/dist/chunks/MCPToolListView-BPmE0C2o.js +0 -1
  289. package/dist/chunks/MessageSelector-kOn2GaU-.js +0 -3
  290. package/dist/chunks/Messages-4EnHFeh1.js +0 -11
  291. package/dist/chunks/PromptInputHelpMenu-BvcAzbSi.js +0 -1
  292. package/dist/chunks/QueryEngine-J6ElcO16.js +0 -1
  293. package/dist/chunks/REPL-DBjbAJsm.js +0 -133
  294. package/dist/chunks/REPL-oBemMXvp.js +0 -1
  295. package/dist/chunks/RemoteSessionManager-CoIyFKKa.js +0 -2
  296. package/dist/chunks/ResumeConversation-wBG8OD9P.js +0 -1
  297. package/dist/chunks/SearchExtraToolsTool-BugrzImr.js +0 -1
  298. package/dist/chunks/Settings-DptKuJE7.js +0 -2
  299. package/dist/chunks/WelcomeV2-BWF-cJOu.js +0 -1
  300. package/dist/chunks/add-dir-DBVT1cEK.js +0 -1
  301. package/dist/chunks/agents-CnwTOlqO.js +0 -103
  302. package/dist/chunks/allErrors-DYw_q14e.js +0 -1
  303. package/dist/chunks/api-DXDXTFGa.js +0 -1
  304. package/dist/chunks/attributionTrailer-oKKrF3z8.js +0 -1
  305. package/dist/chunks/auth-CnLb6RWc.js +0 -1
  306. package/dist/chunks/auth-D-SGHS0K.js +0 -1
  307. package/dist/chunks/autonomy-dSJl0hN1.js +0 -15
  308. package/dist/chunks/autonomyPanel-Ccr9ilei.js +0 -1
  309. package/dist/chunks/backgroundHousekeeping--cs5crp7.js +0 -17
  310. package/dist/chunks/backgroundHousekeeping-CcbHitKC.js +0 -1
  311. package/dist/chunks/bg-DWloqGwk.js +0 -1
  312. package/dist/chunks/branch-CG0AKS1J.js +0 -3
  313. package/dist/chunks/bridgeConfig-Dmc1ZDev.js +0 -1
  314. package/dist/chunks/bridgeMessaging-DlczTV9X.js +0 -1
  315. package/dist/chunks/caches-1IFb6_M_.js +0 -1
  316. package/dist/chunks/caches-CB8MHqy2.js +0 -1
  317. package/dist/chunks/ccrClient-CG6HTv_n.js +0 -1
  318. package/dist/chunks/client-Crrwkw7g.js +0 -1
  319. package/dist/chunks/client-D8hKghba.js +0 -1
  320. package/dist/chunks/color-Cuq0c6xy.js +0 -1
  321. package/dist/chunks/commands-D3sESsTp.js +0 -1
  322. package/dist/chunks/compact-DIpwuBDq.js +0 -2
  323. package/dist/chunks/config-D4G8_MqJ.js +0 -3
  324. package/dist/chunks/config-q9D4hFiK.js +0 -1
  325. package/dist/chunks/context-noninteractive-Bwt9A3XD.js +0 -1
  326. package/dist/chunks/conversation-Bjo_8kia.js +0 -1
  327. package/dist/chunks/conversation-DrHZIQX2.js +0 -1
  328. package/dist/chunks/createSession-CPo6GBSb.js +0 -1
  329. package/dist/chunks/createSession-DnykRoia.js +0 -1
  330. package/dist/chunks/crossProjectResume-D2A-qjgP.js +0 -40
  331. package/dist/chunks/cwd--q1ONL7P.js +0 -1
  332. package/dist/chunks/cwd-L4wygFqJ.js +0 -1
  333. package/dist/chunks/daemon-D2vFIVOz.js +0 -2
  334. package/dist/chunks/datadog-DrmHyl3_.js +0 -1
  335. package/dist/chunks/debug-BdqxZ7rV.js +0 -39
  336. package/dist/chunks/detectRepository-DA1Q_Skc.js +0 -1
  337. package/dist/chunks/detectRepository-DvxoaPlk.js +0 -1
  338. package/dist/chunks/doctor-PWqB46xd.js +0 -1
  339. package/dist/chunks/earlyInput-xcoTbKQn.js +0 -1
  340. package/dist/chunks/entry-4JtoJONR.js +0 -14
  341. package/dist/chunks/esm-DcIr7tVd.js +0 -1
  342. package/dist/chunks/execSyncWrapper-DKuxVTaf.js +0 -1
  343. package/dist/chunks/exit-OW9g7b9A.js +0 -1
  344. package/dist/chunks/extractMemories-1VlmCGwa.js +0 -1
  345. package/dist/chunks/fast-CrvLdpy3.js +0 -1
  346. package/dist/chunks/featureCheck-CrJeuheQ.js +0 -1
  347. package/dist/chunks/featureCheck-HslM03dr.js +0 -1
  348. package/dist/chunks/firstPartyEventLogger-BBXEQUf0.js +0 -1
  349. package/dist/chunks/firstPartyEventLogger-DhEPWcit.js +0 -5
  350. package/dist/chunks/flushGate-ch-Tvwjj.js +0 -1
  351. package/dist/chunks/generateRecap-BIBVlB__.js +0 -1
  352. package/dist/chunks/generateSessionName-nZj_VvKZ.js +0 -1
  353. package/dist/chunks/git-B9uvt96d.js +0 -6
  354. package/dist/chunks/git-BfS5Hk4S.js +0 -1
  355. package/dist/chunks/githubRepoPathMapping-Cqx3pSfc.js +0 -1
  356. package/dist/chunks/help-D2-v9Ug9.js +0 -1
  357. package/dist/chunks/hooks-DGd02IKF.js +0 -1
  358. package/dist/chunks/initReplBridge-RhCAlmHE.js +0 -1
  359. package/dist/chunks/intl-cKc-V6Mq.js +0 -1
  360. package/dist/chunks/jwtUtils-C9sdGhvT.js +0 -1
  361. package/dist/chunks/keybindings-BRdSOSUD.js +0 -2
  362. package/dist/chunks/language-C0cIpKE2.js +0 -1
  363. package/dist/chunks/language-CxThoWRC.js +0 -1
  364. package/dist/chunks/loadAgentsDir-8UprzS4w.js +0 -1
  365. package/dist/chunks/loadPluginHooks-LbaURHVH.js +0 -1
  366. package/dist/chunks/localSearch-DNjbr4S9.js +0 -1
  367. package/dist/chunks/log-CTFl4qpD.js +0 -1
  368. package/dist/chunks/main-BIiwW4mM.js +0 -605
  369. package/dist/chunks/managedEnv-CpiiQx_v.js +0 -1
  370. package/dist/chunks/mcp-B_m1XBDt.js +0 -6
  371. package/dist/chunks/mcp-BiyfH9Sd.js +0 -1
  372. package/dist/chunks/mcp-BjlaPUWX.js +0 -2
  373. package/dist/chunks/memory-LN8f_p2b.js +0 -1
  374. package/dist/chunks/model-C2e73CJD.js +0 -1
  375. package/dist/chunks/model-CvmS-Esk.js +0 -1
  376. package/dist/chunks/model-DJ8mFfuR.js +0 -1
  377. package/dist/chunks/nativeInstaller-DQIFwdat.js +0 -1
  378. package/dist/chunks/omit-CLPZGevl.js +0 -1
  379. package/dist/chunks/onChangeAppState-DhBO34OK.js +0 -1
  380. package/dist/chunks/panel-q0_iT9cg.js +0 -1
  381. package/dist/chunks/panelCall-sum-3zvi.js +0 -1
  382. package/dist/chunks/parser-BcdhBGx0.js +0 -1
  383. package/dist/chunks/partition-CpfoVrg1.js +0 -1
  384. package/dist/chunks/permissions-DTb9wkAP.js +0 -3
  385. package/dist/chunks/pidLock-BR5M6RQw.js +0 -3
  386. package/dist/chunks/pipeTransport-B3TIkTAp.js +0 -1
  387. package/dist/chunks/plugin-D_dHjTud.js +0 -17
  388. package/dist/chunks/pluginAutoupdate-BHKlOOXI.js +0 -1
  389. package/dist/chunks/pluginBlocklist-D93Hd1GF.js +0 -1
  390. package/dist/chunks/pluginCliCommands-vv0wNt4O.js +0 -1
  391. package/dist/chunks/pluginFlagging-CxuRF2Vc.js +0 -1
  392. package/dist/chunks/pluginOperations-BTq4AjYB.js +0 -2
  393. package/dist/chunks/pluginStartupCheck-B6leNWq9.js +0 -1
  394. package/dist/chunks/pluginStartupCheck-DBOCHUHQ.js +0 -1
  395. package/dist/chunks/poorMode-iV1NwC5L.js +0 -1
  396. package/dist/chunks/print-CAUvczBM.js +0 -23
  397. package/dist/chunks/processBashCommand-CdeQg_c6.js +0 -1
  398. package/dist/chunks/processSlashCommand-CbkshIC6.js +0 -5
  399. package/dist/chunks/prompt-RBn4JdEg.js +0 -1
  400. package/dist/chunks/prompt-Rb8zXlDo.js +0 -1
  401. package/dist/chunks/reconciler-Drq3HSkj.js +0 -4
  402. package/dist/chunks/refresh-D8TLHO_T.js +0 -1
  403. package/dist/chunks/remoteManagedSettings-CCrq-qL-.js +0 -1
  404. package/dist/chunks/rename-CKsSc7Z3.js +0 -1
  405. package/dist/chunks/replBridgeHandle-DNC797_T.js +0 -1
  406. package/dist/chunks/resume-B1a5gLVR.js +0 -2
  407. package/dist/chunks/ripgrep-BisRODQ2.js +0 -1
  408. package/dist/chunks/sandbox-adapter-BnBOSkKJ.js +0 -1
  409. package/dist/chunks/searchExtraTools-DbgfnQkH.js +0 -1
  410. package/dist/chunks/sessionFileAccessHooks-Xfr1NiXG.js +0 -1
  411. package/dist/chunks/sessionMemory-7UOFdp29.js +0 -1
  412. package/dist/chunks/sessionMemory-fAzgAS7Q.js +0 -1
  413. package/dist/chunks/sessionMemoryUtils-DVjFw5Bd.js +0 -1
  414. package/dist/chunks/sessionObserver-Cl26OdaW.js +0 -1
  415. package/dist/chunks/sessionState-BvECKycx.js +0 -11
  416. package/dist/chunks/sessionStorage-DSj9yZkl.js +0 -1
  417. package/dist/chunks/settings-B-R9ZJNY.js +0 -1
  418. package/dist/chunks/settings-Xbq6AaD-.js +0 -20
  419. package/dist/chunks/settingsSync-NCN0a4sc.js +0 -1
  420. package/dist/chunks/setup-uZ0dSekt.js +0 -3
  421. package/dist/chunks/sinks-C7q46rvE.js +0 -2
  422. package/dist/chunks/sinks-D3bXeHlQ.js +0 -1
  423. package/dist/chunks/skillChangeDetector-C1EJ7rUL.js +0 -1
  424. package/dist/chunks/skillSearchPanel-mpaC62y4.js +0 -21
  425. package/dist/chunks/startupProfiler-BaiXZ9tr.js +0 -1
  426. package/dist/chunks/state-B4HwLt8i.js +0 -1
  427. package/dist/chunks/state-Bs5xweDL.js +0 -1
  428. package/dist/chunks/statusNoticeHelpers-DMqRGFOh.js +0 -1
  429. package/dist/chunks/switcher-B2CYzCC_.js +0 -1
  430. package/dist/chunks/syncCache-By_-buUC.js +0 -1
  431. package/dist/chunks/teleport-mdnhIZBj.js +0 -1
  432. package/dist/chunks/toolPool-Di30gn_Y.js +0 -1
  433. package/dist/chunks/trustedDevice-CupLMpO8.js +0 -1
  434. package/dist/chunks/trustedDevice-j1u2TG5U.js +0 -1
  435. package/dist/chunks/udsClient-Cm3HqYUu.js +0 -1
  436. package/dist/chunks/updateCCB-BlUAU2Vp.js +0 -11
  437. package/dist/chunks/useMainLoopModel-ylPQNj7Z.js +0 -1
  438. package/dist/chunks/useManagePlugins-BbWJNLe8.js +0 -1
  439. package/dist/chunks/useSettingsErrors-DKh4rkGi.js +0 -1
  440. package/dist/chunks/util-D-X8i5Z2.js +0 -1
  441. package/dist/chunks/validatePlugin-DSw08u76.js +0 -1
  442. package/dist/chunks/windowsPaths-1mgenSWa.js +0 -1
  443. package/dist/chunks/windowsPaths-BVztIhXM.js +0 -1
  444. package/dist/chunks/workerRegistry-DdOYjLm3.js +0 -6
  445. package/dist/chunks/worktree-BX1ULzrw.js +0 -1
@@ -1,3 +0,0 @@
1
- import{i as e,n as t,t as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./isObject-C6qM3WEW.js";import{n as a,t as o}from"./memoize-BK3gG5ob.js";import{c as s,l as c,n as l,o as u}from"./envUtils-BDhHQY0-.js";import{t as d}from"./graceful-fs-DDVg0cja.js";import{Ar as f,Ei as p,Er as m,Kt as h,Lr as g,Mr as _,Nr as v,Pr as y,Rr as ee,Si as te,Ti as ne,Tr as re,_i as ie,_t as ae,at as b,gi as oe,hi as se,jr as ce,kr as le,li as ue,tt as de,ui as fe,vi as pe,xi as me}from"./state-Bs5xweDL.js";import{n as he,t as ge}from"./cwd-L4wygFqJ.js";import{C as _e,I as x,S as ve,a as ye,d as S,k as C,l as w,nt as be,p as xe,rt as Se,w as T,z as Ce}from"./debug-BdqxZ7rV.js";import{Cn as we,Cr as Te,Dr as Ee,Er as De,Jt as Oe,Kt as E,Pn as ke,Sr as Ae,Yt as je,Zt as Me,_r as Ne,c as D,cr as O,g as Pe,gr as Fe,n as Ie,sr as Le}from"./settings-Xbq6AaD-.js";import{O as Re,k as ze,m as Be,n as Ve}from"./git-B9uvt96d.js";import{d as He,o as Ue,s as We,u as Ge}from"./log-CTFl4qpD.js";import{m as Ke}from"./sessionStoragePortable-JZnGwqUM.js";import{f as qe,p as Je,s as Ye,u as Xe}from"./types-DWRxAH0E.js";import{n as Ze,r as k}from"./analytics-DJobLaWP.js";import{homedir as Qe}from"os";import{basename as A,dirname as j,isAbsolute as $e,join as M,normalize as N,resolve as et,sep as tt}from"path";import{unwatchFile as nt,watchFile as rt}from"fs";import{randomBytes as it}from"crypto";var P,at=t((()=>{p(),Ne(),oe(),ie(),P=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)ne(t,se(e)),e=Fe(e);return t}:pe}));function ot(e){return me(e,Te,P)}var st=t((()=>{te(),at(),Ae()}));function ct(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(c(e))return!1;if(s(e))return!0;if(c(process.env.CLAUDE_CODE_SIMPLE)||c(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=Ie();return t.autoMemoryEnabled===void 0||t.autoMemoryEnabled}function lt(){return!1}function ut(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:l()}function dt(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=N(e||`.`);if(t===`.`||t===`..`)return;n=M(Qe(),e)}let r=N(n).replace(/[/\\]+$/,``);if(!(!$e(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+tt).normalize(`NFC`)}function ft(){return dt(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function pt(){return dt(D(`policySettings`)?.autoMemoryDirectory??D(`flagSettings`)?.autoMemoryDirectory??D(`localSettings`)?.autoMemoryDirectory??D(`userSettings`)?.autoMemoryDirectory,!0)}function mt(){return ft()!==void 0}function ht(){return Ve(b())??b()}function gt(){return M(F(),yt)}function _t(e){return N(e).startsWith(F())}var vt,yt,F,bt=t((()=>{o(),h(),u(),Be(),Le(),Pe(),vt=`memory`,yt=`MEMORY.md`,F=a(()=>(ft()??pt())||(M(M(ut(),`projects`),Ke(ht()),vt)+tt).normalize(`NFC`),()=>b())}));function xt(e,t,n,i){if(!r(e))return e;t=v(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=_(t[a]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):void 0,u===void 0&&(u=r(d)?d:fe(t[a+1])?[]:{})}De(c,l,u),c=c[l]}return e}var St=t((()=>{Ee(),y(),ue(),i(),ce()}));function Ct(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=le(e,o);n(s,o)&&xt(a,v(o,e),s)}return a}var wt=t((()=>{f(),St(),y()}));function I(e,t){if(e==null)return{};var n=g(ot(e),function(e){return[e]});return t=re(t),Ct(e,n,function(e,n){return t(e,n[0])})}var Tt=t((()=>{ee(),m(),wt(),st()})),Et=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),Dt=n((e=>{var t=Et();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),Ot=n(((e,t)=>{t.exports=Dt()})),kt=n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),At=n(((t,n)=>{var r=global.process,i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=e(`assert`),o=kt(),s=/^win/i.test(r.platform),c=e(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}else return _.apply(this,arguments)}}})),jt=n(((e,t)=>{var n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),Mt=n(((t,n)=>{var r=e(`path`),i=d(),a=Ot(),o=At(),s=jt(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function f(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?f(e,{...t,stale:0},n):n(r);if(!p(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));m(e,t,r=>{if(r)return n(r);f(e,{...t,stale:0},n)})})})}function p(e,t){return e.mtime.getTime()<Date.now()-t.stale}function m(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function h(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return g(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,h(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function g(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function _(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{f(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};h(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));v(r,{...t,realpath:!1},e)})})})})}function v(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],m(r,t,n)})}function y(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!p(r,t)))})}function ee(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=_,n.exports.unlock=v,n.exports.check=y,n.exports.getLocks=ee})),Nt=n(((e,t)=>{var n=d();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),Pt=n(((e,t)=>{var n=Mt(),{toPromise:r,toSync:i,toSyncOptions:a}=Nt();async function o(e,t){return r(await r(n.lock)(e,t))}function s(e,t){return i(i(n.lock)(e,a(t)))}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}));function L(){return R||(R=Pt()),R}function Ft(e,t){return L().lock(e,t)}function It(e,t){return L().lockSync(e,t)}function Lt(e,t){return L().check(e,t)}var R,Rt=t((()=>{}));function z(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:`dark`,preferredNotifChannel:`auto`,verbose:!1,editorMode:`normal`,autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:`auto`,customApiKeyResponses:{approved:[],rejected:[]},env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,autoConnectIde:!1,autoInstallIdeExtension:!0,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},respectGitignore:!0}}function zt(){return dn||(dn=Bt())}function Bt(){if(ae())return!0;let e=H(),t=$();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=O(ge());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=O(et(n,`..`));if(t===n)break;n=t}return!1}function B(e){let t=q.config;if(!t)return!1;let n=t.oauthAccount!==void 0&&e.oauthAccount===void 0,r=t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0;return n||r}function Vt(e){let t=null;try{Yt(E(),z,n=>{let r=e(n);return r===n?n:(t={...r,projects:Wt(n.projects)},t)})&&t&&V(t)}catch(n){w(`Failed to save config with lock: ${n}`,{level:`error`});let r=U(E(),z);if(B(r)){w(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),k(`tengu_config_auth_loss_prevented`,{});return}let i=e(r);if(i===r)return;t={...i,projects:Wt(r.projects)},Jt(E(),t,K),V(t)}}function Ht(){let e=Y+X;e>0&&k(`tengu_config_cache_stats`,{cache_hits:Y,cache_misses:X,hit_rate:Y/e}),Y=0,X=0}function Ut(e){if(e.installMethod!==void 0)return e;let t=e,n=`unknown`,r=e.autoUpdates??!0;switch(t.autoUpdaterStatus){case`migrated`:n=`local`;break;case`installed`:n=`native`;break;case`disabled`:r=!1;break;case`enabled`:case`no_permissions`:case`not_configured`:n=`global`;break;case void 0:break}return{...e,installMethod:n,autoUpdates:r}}function Wt(e){if(!e)return e;let t={},n=!1;for(let[r,i]of Object.entries(e)){let e=i;if(e.history!==void 0){n=!0;let{history:i,...a}=e;t[r]=a}else t[r]=i}return n?t:e}function Gt(){if(Z)return;Z=!0;let e=E();rt(e,{interval:pn,persistent:!1},t=>{t.mtimeMs<=q.mtime||S().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=q.mtime)return;let n=Xe(Je(e));typeof n!=`object`||!n||(q={config:Ut({...z(),...n}),mtime:t.mtimeMs},J={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),Se(async()=>{nt(e),Z=!1})}function V(e){q={config:e,mtime:Date.now()},J=null}function H(){if(q.config)return Y++,q.config;X++;try{let e=null;try{e=S().statSync(E())}catch{}let t=Ut(U(E(),z));return q={config:t,mtime:e?.mtimeMs??Date.now()},J=e?{mtime:e.mtimeMs,size:e.size}:null,Gt(),t}catch{return Ut(U(E(),z))}}function Kt(){let e=H().remoteControlAtStartup;return e!==void 0&&e}function qt(e){let t=H();return t.customApiKeyResponses?.approved?.includes(e)?`approved`:t.customApiKeyResponses?.rejected?.includes(e)?`rejected`:`new`}function Jt(e,t,n){let r=j(e);S().mkdirSync(r),ke(e,T(I(t,(e,t)=>T(e)!==T(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===E()&&fn++}function Yt(e,t,n){let r=t(),i=j(e),a=S();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=It(e,{lockfilePath:i,onCompromised:e=>{w(`Config lock compromised: ${e}`,{level:`error`})}});let c=Date.now()-s;if(c>100&&(w(`Lock acquisition took longer than expected - another Claude instance may be running`),k(`tengu_config_lock_contention`,{lock_time_ms:c})),J&&e===E())try{let t=a.statSync(e);(t.mtimeMs!==J.mtime||t.size!==J.size)&&k(`tengu_config_stale_write`,{read_mtime:J.mtime,write_mtime:t.mtimeMs,read_size:J.size,write_size:t.size})}catch(e){if(x(e)!==`ENOENT`)throw e}let l=U(e,t);if(e===E()&&B(l))return w(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.claude.json. See GH #3117.`,{level:`error`}),k(`tengu_config_auth_loss_prevented`,{}),!1;let u=n(l);if(u===l)return!1;let d=I(u,(e,t)=>T(e)!==T(r[t]));try{let t=A(e),n=Zt();try{a.mkdirSync(n)}catch(e){if(x(e)!==`EEXIST`)throw e}let r=a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse(),i=r[0],o=i?Number(i.split(`.backup.`).pop()):0,s=Number.isNaN(o)||Date.now()-o>=6e4;if(s){let r=M(n,`${t}.backup.${Date.now()}`);a.copyFileSync(e,r)}let c=s?a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse():r;for(let e of c.slice(5))try{a.unlinkSync(M(n,e))}catch{}}catch(e){x(e)!==`ENOENT`&&w(`Failed to backup config: ${e}`,{level:`error`})}return ke(e,T(d,null,2),{encoding:`utf-8`,mode:384}),e===E()&&fn++,!0}finally{o&&o()}}function Xt(){if(Q)return;let e=Date.now();ze(`info`,`enable_configs_started`),Q=!0,U(E(),z,!0),ze(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function Zt(){return M(l(),`backups`)}function Qt(e){let t=S(),n=A(e),r=Zt();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return M(r,e)}catch{}let i=j(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return M(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function U(e,t,n){if(!Q)throw Error(`Config accessed before allowed.`);let r=S();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=_e(Je(n));return{...t(),...e}}catch(n){throw new C(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(x(i)===`ENOENT`){let n=Qt(e);return n&&process.stderr.write(`\nClaude configuration file not found at: ${e}\nA backup file exists at: ${n}\nYou can manually restore it by running: cp "${n}" "${e}"\n\n`),t()}if(i instanceof C&&n)throw i;if(i instanceof C){if(w(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!W){W=!0;try{We(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}k(`tengu_config_parse_error`,{has_backup:t})}finally{W=!1}}process.stderr.write(`\nClaude configuration file at ${e} is corrupted: ${i.message}\n`);let t=A(e),n=Zt();try{r.mkdirSync(n)}catch(e){if(x(e)!==`EEXIST`)throw e}let a=r.readdirStringSync(n).filter(e=>e.startsWith(`${t}.corrupted.`)),o,s=!1,c=r.readFileSync(e,{encoding:`utf-8`});for(let e of a)try{if(c===r.readFileSync(M(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=M(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),w(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=Qt(e);o?process.stderr.write(`The corrupted file has been backed up to: ${o}\n`):s&&process.stderr.write(`The corrupted file has already been backed up.
2
- `),l?process.stderr.write(`A backup file exists at: ${l}\nYou can manually restore it by running: cp "${l}" "${e}"\n\n`):process.stderr.write(`
3
- `)}return t()}}function $t(){let e=$(),t=H();if(!t.projects)return G;let n=t.projects[e]??G;return typeof n.allowedTools==`string`&&(n.allowedTools=Xe(n.allowedTools)??[]),n}function en(e){let t=$(),n=null;try{Yt(E(),z,r=>{let i=r.projects?.[t]??G,a=e(i);return a===i?r:(n={...r,projects:{...r.projects,[t]:a}},n)})&&n&&V(n)}catch(r){w(`Failed to save config with lock: ${r}`,{level:`error`});let i=U(E(),z);if(B(i)){w(`saveCurrentProjectConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),k(`tengu_config_auth_loss_prevented`,{});return}let a=i.projects?.[t]??G,o=e(a);if(o===a)return;n={...i,projects:{...i.projects,[t]:o}},Jt(E(),n,K),V(n)}}function tn(){return an()!==null}function nn(){return tn()&&!c(process.env.FORCE_AUTOUPDATE_PLUGINS)}function rn(e){switch(e.type){case`development`:return`development build`;case`env`:return`${e.envVar} set`;case`config`:return`config`}}function an(){if(!c(process.env.ENABLE_AUTOUPDATER))return{type:`config`};if(c(process.env.DISABLE_AUTOUPDATER))return{type:`env`,envVar:`DISABLE_AUTOUPDATER`};let e=Ge();if(e)return{type:`env`,envVar:e};let t=H();return t.autoUpdates===!1&&(t.installMethod!==`native`||t.autoUpdatesProtectedForNative!==!0)?{type:`config`}:null}function on(){let e=H();if(e.userID)return e.userID;let t=it(32).toString(`hex`);return Vt(e=>({...e,userID:t})),t}function sn(){if(!H().firstStartTime){let e=new Date().toISOString();Vt(t=>({...t,firstStartTime:t.firstStartTime??e}))}}function cn(e){let t=de();switch(e){case`User`:return M(l(),`CLAUDE.md`);case`Local`:return M(t,`CLAUDE.local.md`);case`Project`:return M(t,`CLAUDE.md`);case`Managed`:return M(je(),`CLAUDE.md`);case`AutoMem`:return gt();default:return M(l(),`CLAUDE.md`)}}function ln(){return M(je(),`.claude`,`rules`)}function un(){return M(l(),`rules`)}var W,G,K,dn,q,J,Y,X,fn,pn,Z,Q,$,mn=t((()=>{o(),Tt(),h(),bt(),Ze(),he(),be(),ye(),Re(),Oe(),u(),Ce(),we(),xe(),Be(),Ye(),qe(),Rt(),Ue(),Le(),He(),Me(),ve(),W=!1,G={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasClaudeMdExternalIncludesApproved:!1,hasClaudeMdExternalIncludesWarningShown:!1},K=z(),dn=!1,{...K},{...G},q={config:null,mtime:0},J=null,Y=0,X=0,fn=0,Se(async()=>{Ht()}),pn=1e3,Z=!1,Q=!1,$=a(()=>{let e=de();return O(Ve(e)||et(e))})}));export{ut as A,Ft as C,St as D,xt as E,lt as F,ot as I,st as L,bt as M,_t as N,gt as O,ct as P,P as R,Rt as S,I as T,sn as _,an as a,nn as b,H as c,on as d,$ as f,tn as g,mn as h,rn as i,mt as j,F as k,ln as l,un as m,zt as n,$t as o,Kt as p,Xt as r,qt as s,K as t,cn as u,en as v,Tt as w,Lt as x,Vt as y,at as z};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Settings-DptKuJE7.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Config`})}))();export{a as call};
@@ -1 +0,0 @@
1
- import{n as e,r as t,t as n}from"./context-noninteractive-c7jGVWHQ.js";t();export{n as call,e as collectContextData};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./conversation-DrHZIQX2.js";e();export{t as clearConversation};
@@ -1 +0,0 @@
1
- import{a as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";import{An as n,Ar as r,FT as i,OT as a,On as o,Qs as s,Si as c,St as l,Ti as u,Tt as d,Xt as f,Zs as p,bv as m,cg as h,cy as g,di as _,fy as v,jn as y,lD as b,ly as x,my as S,sD as C,sg as w,tr as T,un as E,ur as D,vn as O,xv as k}from"./loadAgentsDir-CKSb56Gp.js";import{Dn as A,En as j,K as M,Kt as N,en as P,kn as F,nn as I,tt as L}from"./state-Bs5xweDL.js";import{o as R,s as z}from"./log-CTFl4qpD.js";import{n as B,r as V}from"./analytics-DJobLaWP.js";import{C as H,D as U}from"./sessionState-BvECKycx.js";import{n as W,t as G}from"./caches-1IFb6_M_.js";import{n as K,t as q}from"./replBridgeHandle-DNC797_T.js";import{randomUUID as J}from"crypto";function Y(){let e=q();if(!e)return;e.markTranscriptReset?.();let t={type:`status`,subtype:`status`,status:`conversation_cleared`,message:`conversation_cleared`,uuid:J()};e.writeSdkMessages([t])}async function X({setMessages:t,readFileState:i,discoveredSkillNames:d,loadedNestedMemoryPaths:p,getAppState:m,setAppState:g,setConversationId:y}){let b=E();await f(`clear`,{getAppState:m,setAppState:g,signal:AbortSignal.timeout(b),timeoutMs:b});let S=M();S&&V(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:S});let w=new Set,O=[],N=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(m)for(let e of Object.values(m().tasks))N(e)||s(e)&&(w.add(e.agentId),O.push(e));t(()=>[]),Y();{let{setContextBlocked:t}=(H(),e(U));t(!1)}y&&y(J()),G(w),j(null),A(null),F(null),I(),k(L()),i.clear(),d?.clear(),p?.clear(),g&&g(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!N(r)){t[n]=r;continue}try{r.status===`running`&&(x(r)&&(r.shellCommand?.kill(),r.shellCommand?.cleanup(),r.cleanupTimeoutId&&clearTimeout(r.cleanupTimeoutId)),`abortController`in r&&r.abortController?.abort(),`unregisterCleanup`in r&&r.unregisterCleanup?.())}catch(e){z(e)}o(n)}return{...e,tasks:t,attribution:C(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:e.mcp.pluginReconnectKey}}}),a(),T(),P({setCurrentAsParent:!0}),await _();for(let e of O)e.status===`running`&&n(e.id,D(v(e.agentId)));let{saveMode:R}=(r(),e(u));R(`normal`);let B=l();B&&c(B);let W=await h(`clear`);W.length>0&&t(()=>W)}var Z=t((()=>{K(),N(),B(),p(),g(),S(),b(),O(),R(),i(),m(),w(),r(),y(),d(),W()}));export{Z as n,X as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{F as t,a as n,l as r,z as i}from"./debug-BdqxZ7rV.js";import{i as a,t as o}from"./sessionIdCompat-DMayYBrf.js";import{i as s,o as c}from"./debugUtils-CezNYZ-4.js";async function l({environmentId:e,title:n,events:i,gitRepoUrl:a,branch:o,signal:c,baseUrl:l,getAccessToken:u,permissionMode:d}){let{getClaudeAIOAuthTokens:f}=await import(`./auth-CnLb6RWc.js`),{getOrganizationUUID:p}=await import(`./client-Crrwkw7g.js`),{getOauthConfig:m}=await import(`./oauth-BN2I0_jl.js`),{getOAuthHeaders:h}=await import(`./api-DXDXTFGa.js`),{parseGitHubRepository:g}=await import(`./detectRepository-DA1Q_Skc.js`),{getDefaultBranch:_}=await import(`./git-BfS5Hk4S.js`),{getMainLoopModel:v}=await import(`./model-DJ8mFfuR.js`),{default:y}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-Dmc1ZDev.js`),x=u?.()??f()?.accessToken;if(!x)return r(`[bridge] No access token for session creation`),null;let S=b()?`self-hosted`:await p();if(!S)return r(`[bridge] No org UUID for session creation`),null;let C=null,w=null;if(a){let{parseGitRemote:e}=await import(`./detectRepository-DA1Q_Skc.js`),t=e(a);if(t){let{host:e,owner:n,name:r}=t,i=o||await _()||void 0;C={type:`git_repository`,url:`https://${e}/${n}/${r}`,revision:i},w={type:`git_repository`,git_info:{type:`github`,repo:`${n}/${r}`,branches:[`claude/${o||`task`}`]}}}else{let e=g(a);if(e){let[t,n]=e.split(`/`);if(t&&n){let e=o||await _()||void 0;C={type:`git_repository`,url:`https://github.com/${t}/${n}`,revision:e},w={type:`git_repository`,git_info:{type:`github`,repo:`${t}/${n}`,branches:[`claude/${o||`task`}`]}}}}}}let T={...n!==void 0&&{title:n},events:i,session_context:{sources:C?[C]:[],outcomes:w?[w]:[],model:v()},environment_id:e,source:`remote-control`,...d&&{permission_mode:d}},E={...h(x),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":S},D=`${l??m().BASE_API_URL}/v1/sessions`,O;try{O=await y.post(D,T,{headers:E,signal:c,validateStatus:e=>e<500})}catch(e){return r(`[bridge] Session creation request failed: ${t(e)}`),null}if(!(O.status===200||O.status===201)){let e=s(O.data);return r(`[bridge] Session creation failed with status ${O.status}${e?`: ${e}`:``}`),null}let k=O.data;return!k||typeof k!=`object`||!(`id`in k)||typeof k.id!=`string`?(r(`[bridge] No session ID in response`),null):k.id}async function u(e,n){let{getClaudeAIOAuthTokens:i}=await import(`./auth-CnLb6RWc.js`),{getOrganizationUUID:a}=await import(`./client-Crrwkw7g.js`),{getOauthConfig:o}=await import(`./oauth-BN2I0_jl.js`),{getOAuthHeaders:c}=await import(`./api-DXDXTFGa.js`),{default:l}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-Dmc1ZDev.js`),d=n?.getAccessToken?.()??i()?.accessToken;if(!d)return r(`[bridge] No access token for session fetch`),null;let f=u()?`self-hosted`:await a();if(!f)return r(`[bridge] No org UUID for session fetch`),null;let p={...c(d),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":f},m=`${n?.baseUrl??o().BASE_API_URL}/v1/sessions/${e}`;r(`[bridge] Fetching session ${e}`);let h;try{h=await l.get(m,{headers:p,timeout:1e4,validateStatus:e=>e<500})}catch(e){return r(`[bridge] Session fetch request failed: ${t(e)}`),null}if(h.status!==200){let e=s(h.data);return r(`[bridge] Session fetch failed with status ${h.status}${e?`: ${e}`:``}`),null}return h.data}async function d(e,t){let{getClaudeAIOAuthTokens:n}=await import(`./auth-CnLb6RWc.js`),{getOrganizationUUID:i}=await import(`./client-Crrwkw7g.js`),{getOauthConfig:a}=await import(`./oauth-BN2I0_jl.js`),{getOAuthHeaders:o}=await import(`./api-DXDXTFGa.js`),{default:c}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-Dmc1ZDev.js`),u=t?.getAccessToken?.()??n()?.accessToken;if(!u){r(`[bridge] No access token for session archive`);return}let d=l()?`self-hosted`:await i();if(!d){r(`[bridge] No org UUID for session archive`);return}let f={...o(u),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":d},p=`${t?.baseUrl??a().BASE_API_URL}/v1/sessions/${e}/archive`;r(`[bridge] Archiving session ${e}`);let m=await c.post(p,{},{headers:f,timeout:t?.timeoutMs??1e4,validateStatus:e=>e<500});if(m.status===200)r(`[bridge] Session ${e} archived successfully`);else{let e=s(m.data);r(`[bridge] Session archive failed with status ${m.status}${e?`: ${e}`:``}`)}}async function f(e,n,i){let{getClaudeAIOAuthTokens:o}=await import(`./auth-CnLb6RWc.js`),{getOrganizationUUID:c}=await import(`./client-Crrwkw7g.js`),{getOauthConfig:l}=await import(`./oauth-BN2I0_jl.js`),{getOAuthHeaders:u}=await import(`./api-DXDXTFGa.js`),{default:d}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-Dmc1ZDev.js`),p=i?.getAccessToken?.()??o()?.accessToken;if(!p){r(`[bridge] No access token for session title update`);return}let m=f()?`self-hosted`:await c();if(!m){r(`[bridge] No org UUID for session title update`);return}let h={...u(p),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":m},g=a(e),_=`${i?.baseUrl??l().BASE_API_URL}/v1/sessions/${g}`;r(`[bridge] Updating session title: ${g} → ${n}`);try{let e=await d.patch(_,{title:n},{headers:h,timeout:1e4,validateStatus:e=>e<500});if(e.status===200)r(`[bridge] Session title updated successfully`);else{let t=s(e.data);r(`[bridge] Session title update failed with status ${e.status}${t?`: ${t}`:``}`)}}catch(e){r(`[bridge] Session title update request failed: ${t(e)}`)}}var p=e((()=>{n(),i(),c(),o()}));export{f as a,p as i,l as n,u as r,d as t};
@@ -1 +0,0 @@
1
- import{a as e,i as t,n,r}from"./createSession-CPo6GBSb.js";t();export{n as createBridgeSession,r as getBridgeSession,e as updateBridgeSessionTitle};
@@ -1,40 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Ar as n,Bm as r,Ew as i,Mr as a,Ni as o,Pi as s,Pr as c,Sd as l,Sr as u,Ur as d,Vu as f,Xu as p,Yu as ee,_i as te,_m as m,dd as ne,fd as h,fl as g,mr as re,pw as _,ul as ie,vm as v,xd as ae,zm as oe,zu as se}from"./loadAgentsDir-CKSb56Gp.js";import{C as ce,D as y,Gr as b,H as le,I as x,P as S,T as C,Wt as ue,Xn as de,ai as fe,di as pe,fi as w,hn as me,k as he,ot as ge,p as _e,t as T,ui as ve}from"./src-P_wYS_NJ2.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{Kt as ye,mt as be,tt as xe}from"./state-Bs5xweDL.js";import{C as D,S as Se,a as Ce,l as O}from"./debug-BdqxZ7rV.js";import{In as k,Ln as we}from"./settings-Xbq6AaD-.js";import{i as Te,m as Ee}from"./git-B9uvt96d.js";import{a as De,o as Oe,s as ke}from"./log-CTFl4qpD.js";import{n as Ae,r as A}from"./analytics-DJobLaWP.js";import{C as j,d as je,m as Me,v as Ne}from"./startupProfiler-jeId9f2i.js";import{_ as M,h as N}from"./model-C2e73CJD.js";import{i as Pe,r as Fe}from"./shellQuote-Bth6IZgX.js";import{n as Ie,t as Le}from"./useExitOnCtrlCDWithKeybindings-D2FvHieH.js";import{t as Re}from"./SearchBox-C9vUA4IM.js";import{n as ze,t as Be}from"./useSearchInput-C6d6nt9S.js";import{n as P,t as F}from"./Messages-4EnHFeh1.js";function Ve({log:e,onExit:t,onSelect:n}){let[r,i]=I.useState(null);I.useEffect(()=>{i(null),c(e)&&d(e).then(i)},[e]);let a=c(e)&&r===null,o=r??e,s=u(o)||``,l=ie();return ue(`confirm:no`,t,{context:`Confirmation`}),ue(`confirm:yes`,(0,I.useCallback)(()=>{n(r??e)},[n,r,e]),{context:`Confirmation`}),a?(0,L.jsxs)(x,{flexDirection:`column`,padding:1,children:[(0,L.jsx)(_e,{message:`Loading session…`}),(0,L.jsx)(S,{dimColor:!0,children:(0,L.jsx)(C,{children:(0,L.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,L.jsxs)(x,{flexDirection:`column`,children:[(0,L.jsx)(F,{messages:o.messages,tools:l,commands:[],verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:s,screen:`transcript`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1}),(0,L.jsxs)(x,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,L.jsxs)(S,{children:[Me(o.modified),` · `,o.messageCount,` messages`,o.gitBranch?` · ${o.gitBranch}`:``]}),(0,L.jsx)(S,{dimColor:!0,children:(0,L.jsxs)(C,{children:[(0,L.jsx)(y,{shortcut:`Enter`,action:`resume`}),(0,L.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var I,L,He=e((()=>{I=t(w(),1),T(),i(),g(),Ne(),n(),v(),P(),L=E()}));function R(e,t){if(e===B)return 5;let n=b(e),r=t?Math.min(n,t-V-H):n;return Math.max(0,r)+V+H}function Ue(e,t){let n=t-V-H;return b(e)<=n?e:n<=1?e.charAt(0):j(e,n)}function We({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,o=Math.max(Ye,W),s=n-a-o-2,c=Math.max(0,Math.min(t,e.length-1)),l=Math.max(20,Math.floor(s/2)),u=e.map(e=>R(e,l)),d=0,f=e.length;if(u.reduce((e,t,n)=>e+t+ +(n<u.length-1),0)>s){let t=s-Je,n=u[c]??0;for(d=c,f=c+1;d>0||f<e.length;){let r=d>0,i=f<e.length;if(r){let e=(u[d-1]??0)+1;if(n+e<=t){d--,n+=e;continue}}if(i){let e=(u[f]??0)+1;if(n+e<=t){f++,n+=e;continue}}break}}let p=d,ee=e.length-f,te=e.slice(d,f),m=te.map((e,t)=>d+t);return(0,z.jsxs)(x,{flexDirection:`row`,gap:1,children:[(0,z.jsx)(S,{color:`suggestion`,children:i}),p>0&&(0,z.jsxs)(S,{dimColor:!0,children:[U,p]}),te.map((e,t)=>{let n=m[t]===c,r=e===B?e:`#${Ue(e,l-V)}`;return(0,z.jsxs)(S,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),ee>0?(0,z.jsxs)(S,{dimColor:!0,children:[Ge,ee,Ke]}):(0,z.jsx)(S,{dimColor:!0,children:qe})]})}var z,B,V,H,U,Ge,Ke,qe,Je,Ye,W,G=e((()=>{w(),T(),Ne(),z=E(),B=`All`,V=2,H=1,U=`← `,Ge=`→`,Ke=` (tab to cycle)`,qe=`(tab to cycle)`,Je=5,Ye=18,W=14}));function Xe({nodes:e,onSelect:t,onCancel:n,onFocus:r,focusNodeId:i,visibleOptionCount:a,layout:o=`expanded`,isDisabled:s=!1,hideIndexes:c=!1,isNodeExpanded:l,onExpand:u,onCollapse:d,getParentPrefix:f,getChildPrefix:p,onUpFromFirstItem:ee}){let[te,m]=K.useState(new Set),h=K.useRef(!1),g=K.useRef(null),re=K.useCallback(e=>l?l(e):te.has(e),[l,te]),_=K.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=re(e.id);if(t.push({node:e,depth:r,isExpanded:o,hasChildren:a,parentId:i}),a&&o&&e.children)for(let t of e.children)n(t,r+1,e.id)}for(let t of e)n(t,0);return t},[e,re]),ie=K.useCallback(e=>e?`▼ `:`▶ `,[]),v=K.useCallback(e=>` ▸ `,[]),ae=f??ie,oe=p??v,se=K.useCallback(e=>{let t=``;return e.hasChildren?t=ae(e.isExpanded):e.depth>0&&(t=oe(e.depth)),t+e.node.label},[ae,oe]),ce=K.useMemo(()=>_.map(e=>({label:se(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[_,se]),y=K.useMemo(()=>{let e=new Map;return _.forEach(t=>e.set(t.node.id,t.node)),e},[_]),b=K.useCallback(e=>_.find(t=>t.node.id===e),[_]),le=K.useCallback((e,t)=>{let n=b(e);!n||!n.hasChildren||(t?u?u(e):m(t=>new Set(t).add(e)):d?d(e):m(t=>{let n=new Set(t);return n.delete(e),n}))},[b,u,d]);return(0,Ze.jsx)(x,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||s)return;let t=b(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),le(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),le(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),h.current=!0,le(t.parentId,!1),r)){let e=y.get(t.parentId);e&&r(e)}}}},children:(0,Ze.jsx)(ne,{options:ce,onChange:K.useCallback(e=>{let n=y.get(e);n&&t(n)},[y,t]),onFocus:K.useCallback(e=>{if(h.current){h.current=!1;return}if(g.current!==e&&(g.current=e,r)){let t=y.get(e);t&&r(t)}},[r,y]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:o,isDisabled:s,hideIndexes:c,onUpFromFirstItem:ee})})}var K,Ze,Qe=e((()=>{K=t(w(),1),T(),h(),Ze=E()}));function $e(e,t){return j(e.replace(/\s+/g,` `).trim(),t)}function et({before:e,match:t,after:n},r){return ve.dim(e)+r(t)+ve.dim(n)}function tt(e,t,n){let r=e.toLowerCase().indexOf(t.toLowerCase());if(r===-1)return null;let i=r+t.length,a=Math.max(0,r-n),o=Math.min(e.length,i+n),s=e.slice(a,r),c=e.slice(r,i),l=e.slice(i,o);return{before:(a>0?`…`:``)+s.replace(/\s+/g,` `).trimStart(),match:c.trim(),after:l.replace(/\s+/g,` `).trimEnd()+(o<e.length?`…`:``)}}function nt(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?lt:i?ut:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${$e(De(e),l)}${c}${s}`}function rt(e,t){let{isChild:n=!1,showProjectPath:r=!1}=t||{},i=n?` `:``,a=je(e),o=r&&e.projectPath?` · ${e.projectPath}`:``;return i+a+o}function it({logs:e,maxHeight:t=1/0,forceWidth:n,onCancel:r,onSelect:i,onLogsChanged:s,onLoadMore:c,initialSearchQuery:l,showAllProjects:d=!1,onToggleAllProjects:f,onAgenticSearch:p}){let h=ge(),g=n===void 0?h.columns:n,_=Ie(r),ie=de(),v=a(),[oe]=le(),b=ee(oe),pe=q.useMemo(()=>e=>fe(e,b.warning),[b.warning]),[w,_e]=q.useState(null),[T,ve]=q.useState(!1),[E,ye]=q.useState(!1),[D,Se]=q.useState(!1),Ce=q.useMemo(()=>xe(),[]),[O,k]=q.useState(``),[we,Ee]=q.useState(0),[Oe,ke]=q.useState(new Set),[Ae,j]=q.useState(null),[Me,Ne]=q.useState(1),[M,N]=q.useState(`list`),[Pe,Fe]=q.useState(null),Le=q.useRef(null),[Re,Be]=q.useState(0),[P,F]=q.useState({status:`idle`}),[I,L]=q.useState(!1),He=q.useRef(null),{query:R,setQuery:Ue,cursorOffset:z}=ze({isActive:M===`search`&&P.status!==`searching`,onExit:()=>{N(`list`),A(`tengu_session_search_toggled`,{enabled:!1})},onExitUp:()=>{N(`list`),A(`tengu_session_search_toggled`,{enabled:!1})},passthroughCtrlKeys:[`n`],initialQuery:l||``}),B=q.useDeferredValue(R),[V,H]=q.useState(``);q.useEffect(()=>{if(!B){H(``);return}let e=setTimeout(H,300,B);return()=>clearTimeout(e)},[B]);let[U,Ge]=q.useState(null),[Ke,qe]=q.useState(!1);q.useEffect(()=>{Te().then(e=>_e(e)),o(Ce).then(e=>{Se(e.length>1)})},[Ce]);let Je=q.useMemo(()=>new Map(e.map(e=>[e,ot(e)])),[e]),Ye=q.useMemo(()=>null,[e,Je,!1]),W=q.useMemo(()=>ct(e),[e]),G=W.length>0,K=q.useMemo(()=>G?[`All`,...W]:[],[G,W]),Ze=K.length>0&&Re<K.length?Re:0,Qe=K[Ze],it=Qe===`All`?void 0:Qe,at=+!!G,lt=q.useMemo(()=>{let t=e;return v&&(t=e.filter(e=>{let t=be(),n=u(e);return!!(t&&n===t||e.customTitle||re(e.messages)||e.firstPrompt||e.customTitle)})),it!==void 0&&(t=t.filter(e=>e.tag===it)),T&&w&&(t=t.filter(e=>e.gitBranch===w)),D&&!E&&(t=t.filter(e=>e.projectPath===Ce)),t},[e,v,it,T,w,D,E,Ce]),ut=q.useMemo(()=>{if(!R)return lt;let e=R.toLowerCase();return lt.filter(t=>{let n=De(t).toLowerCase(),r=(t.gitBranch||``).toLowerCase(),i=(t.tag||``).toLowerCase(),a=t.prNumber?`pr #${t.prNumber} ${t.prRepository||``}`.toLowerCase():``;return n.includes(e)||r.includes(e)||i.includes(e)||a.includes(e)})},[lt,R]);q.useEffect(()=>{},[B,V,!1]),q.useEffect(()=>{Ge(null),qe(!1)},[V,Ye,!1]);let{filteredLogs:Y,snippets:X}=q.useMemo(()=>{let e=new Map,t=ut;if(U&&V&&U.query===V){for(let t of U.results)if(t.searchableText){let n=tt(t.searchableText,V,dt);n&&e.set(t.log,n)}let n=new Set(t.map(e=>e.messages[0]?.uuid)),r=U.results.map(e=>e.log).filter(e=>!n.has(e.messages[0]?.uuid));t=[...t,...r]}return{filteredLogs:t,snippets:e}},[ut,U,V]),Z=q.useMemo(()=>P.status===`results`&&P.results.length>0?P.results:Y,[P,Y]),Q=Math.max(30,g-4),ft=q.useMemo(()=>{if(!v)return[];let e=st(Z);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=Z.indexOf(n),i=X.get(n),a=i?et(i,pe):null;if(t.length===1){let t=rt(n,{showProjectPath:d});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:nt(n,Q),description:a?`${t}\n ${a}`:t,dimDescription:!0}}let o=t.length-1,s=t.slice(1).map((t,n)=>{let r=Z.indexOf(t),i=X.get(t),a=i?et(i,pe):null,o=rt(t,{isChild:!0,showProjectPath:d});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:nt(t,Q,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),c=rt(n,{showProjectPath:d});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:nt(n,Q,{isGroupHeader:!0,forkCount:o}),description:a?`${c}\n ${a}`:c,dimDescription:!0,children:s}})},[v,Z,Q,d,X,pe]),pt=q.useMemo(()=>v?[]:Z.map((e,t)=>{let n=$e(De(e)+(e.isSidechain?` (sidechain)`:``),Q),r=je(e),i=d&&e.projectPath?` · ${e.projectPath}`:``,a=X.get(e),o=a?et(a,pe):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[v,Z,pe,Q,d,X]),$=Ae?.value.log??null,mt=()=>{if(!v||!$)return``;let e=u($);if(!e)return``;let t=Z.filter(t=>u(t)===e);if(!(t.length>1))return``;let n=Oe.has(e);return t.indexOf($)>0||n?`← to collapse`:`→ to expand`},ht=q.useCallback(async()=>{let e=$?u($):void 0;if(!$||!e){N(`list`),k(``);return}O.trim()&&(await te(e,O.trim(),$.fullPath),v&&s&&s()),N(`list`),k(``)},[$,O,s,v]),gt=q.useCallback(()=>{N(`list`),A(`tengu_session_search_toggled`,{enabled:!1})},[]),_t=q.useCallback(()=>{N(`search`),A(`tengu_session_search_toggled`,{enabled:!0})},[]),vt=q.useCallback(async()=>{if(!R.trim()||!p||!0)return;He.current?.abort();let t=new AbortController;He.current=t,F({status:`searching`}),A(`tengu_agentic_search_started`,{query_length:R.length});try{let n=await p(R,e,t.signal);if(t.signal.aborted)return;F({status:`results`,results:n,query:R}),A(`tengu_agentic_search_completed`,{query_length:R.length,results_count:n.length})}catch(e){if(t.signal.aborted)return;F({status:`error`,message:e instanceof Error?e.message:`Search failed`}),A(`tengu_agentic_search_error`,{query_length:R.length})}},[R,p,!1,e]);q.useEffect(()=>{P.status!==`idle`&&P.status!==`searching`&&(P.status===`results`&&P.query!==R||P.status===`error`)&&F({status:`idle`})},[R,P]),q.useEffect(()=>()=>{He.current?.abort()},[]);let yt=q.useRef(P.status);q.useEffect(()=>{let e=yt.current;if(yt.current=P.status,e===`searching`&&P.status===`results`){if(v&&ft.length>0)j(ft[0]);else if(!v&&Z.length>0){let e=Z[0];j({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[P.status,v,ft,Z]);let bt=q.useCallback(e=>{let t=parseInt(e,10),n=Z[t];!n||Le.current===t.toString()||(Le.current=t.toString(),j({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),Ne(t+1))},[Z]),xt=q.useCallback(e=>{j(e);let t=Z.findIndex(t=>u(t)===u(e.value.log));t>=0&&Ne(t+1)},[Z]);ue(`confirm:no`,()=>{He.current?.abort(),F({status:`idle`}),A(`tengu_agentic_search_cancelled`,{})},{context:`Confirmation`,isActive:M!==`preview`&&P.status===`searching`}),ue(`confirm:no`,()=>{N(`list`),k(``)},{context:`Settings`,isActive:M===`rename`&&P.status!==`searching`}),ue(`confirm:no`,()=>{Ue(``),L(!1),r?.()},{context:`Confirmation`,isActive:M!==`preview`&&M!==`rename`&&M!==`search`&&I&&P.status!==`searching`}),me((e,t)=>{if(M!==`preview`&&P.status!==`searching`&&M!==`rename`)if(M===`search`)e.toLowerCase()===`n`&&t.ctrl?gt():(t.return||t.downArrow)&&R.trim();else{if(I){if(t.return){vt(),L(!1);return}else if(t.downArrow){L(!1);return}else if(t.upArrow){N(`search`),L(!1);return}}if(G&&t.tab){let e=t.shift?-1:1;Be(t=>{let n=((t<K.length?t:0)+K.length+e)%K.length,r=K[n];return A(`tengu_session_tag_filter_changed`,{is_all:r===`All`,tag_count:W.length}),n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();if(r===`a`&&t.ctrl&&f)f(),A(`tengu_session_all_projects_toggled`,{enabled:!d});else if(r===`b`&&t.ctrl){let e=!T;ve(e),A(`tengu_session_branch_filter_toggled`,{enabled:e})}else if(r===`w`&&t.ctrl&&D){let e=!E;ye(e),A(`tengu_session_worktree_filter_toggled`,{enabled:e})}else r===`/`&&n?(N(`search`),A(`tengu_session_search_toggled`,{enabled:!0})):r===`r`&&t.ctrl&&$?(N(`rename`),k(``),A(`tengu_session_rename_started`,{})):r===`v`&&t.ctrl&&$?(Fe($),N(`preview`),A(`tengu_session_preview_opened`,{messageCount:$.messageCount})):$&&n&&e.length>0&&!/^\s+$/.test(e)&&(N(`search`),Ue(e),A(`tengu_session_search_toggled`,{enabled:!0}))}},{isActive:!0});let St=[];T&&w&&St.push(w),D&&!E&&St.push(`current worktree`);let Ct=8+ +(St.length>0&&M!==`search`)+at,wt=Math.max(1,Math.floor((t-Ct-2)/3));return q.useEffect(()=>{if(!c)return;let e=wt*2;Me+e>=Z.length&&c(wt*3)},[Me,wt,Z.length,c]),e.length===0?null:M===`preview`&&Pe&&v?(0,J.jsx)(Ve,{log:Pe,onExit:()=>{N(`list`),Fe(null)},onSelect:i}):(0,J.jsxs)(x,{flexDirection:`column`,height:t-1,children:[(0,J.jsx)(x,{flexShrink:0,children:(0,J.jsx)(ce,{color:`suggestion`})}),(0,J.jsx)(x,{flexShrink:0,children:(0,J.jsx)(S,{children:` `})}),G?(0,J.jsx)(We,{tabs:K,selectedIndex:Ze,availableWidth:g,showAllProjects:d}):(0,J.jsx)(x,{flexShrink:0,children:(0,J.jsxs)(S,{bold:!0,color:`suggestion`,children:[`Resume Session`,M===`list`&&Z.length>wt&&(0,J.jsxs)(S,{dimColor:!0,children:[` `,`(`,Me,` of `,Z.length,`)`]})]})}),(0,J.jsx)(he,{query:R,isFocused:M===`search`,isTerminalFocused:ie,cursorOffset:z}),St.length>0&&M!==`search`&&(0,J.jsx)(x,{flexShrink:0,paddingLeft:2,children:(0,J.jsx)(S,{dimColor:!0,children:(0,J.jsx)(C,{children:St})})}),(0,J.jsx)(x,{flexShrink:0,children:(0,J.jsx)(S,{children:` `})}),P.status===`searching`&&(0,J.jsxs)(x,{paddingLeft:1,flexShrink:0,children:[(0,J.jsx)(se,{}),(0,J.jsx)(S,{children:` Searching…`})]}),P.status===`results`&&P.results.length>0&&(0,J.jsx)(x,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(S,{dimColor:!0,italic:!0,children:`Claude found these results:`})}),P.status===`results`&&P.results.length===0&&Y.length===0&&(0,J.jsx)(x,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(S,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),P.status===`error`&&Y.length===0&&(0,J.jsx)(x,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(S,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!R.trim()&&p&&!1,P.status===`searching`?null:M===`rename`&&$?(0,J.jsxs)(x,{paddingLeft:2,flexDirection:`column`,children:[(0,J.jsx)(S,{bold:!0,children:`Rename session:`}),(0,J.jsx)(x,{paddingTop:1,children:(0,J.jsx)(ae,{value:O,onChange:k,onSubmit:ht,placeholder:De($,`Enter new session name`),columns:g,cursorOffset:we,onChangeCursorOffset:Ee,showCursor:!0})})]}):v?(0,J.jsx)(Xe,{nodes:ft,onSelect:e=>{i(e.value.log)},onFocus:xt,onCancel:r,focusNodeId:Ae?.id,visibleOptionCount:wt,layout:`expanded`,isDisabled:M===`search`||I,hideIndexes:!1,isNodeExpanded:e=>{if(M===`search`||T)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?Oe.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&(ke(e=>new Set(e).add(t)),A(`tengu_session_group_expanded`,{}))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&ke(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:_t}):(0,J.jsx)(ne,{options:pt,onChange:e=>{let t=Z[parseInt(e,10)];t&&i(t)},visibleOptionCount:wt,onCancel:r,onFocus:bt,defaultFocusValue:Ae?.id.toString(),layout:`expanded`,isDisabled:M===`search`||I,onUpFromFirstItem:_t}),(0,J.jsx)(x,{paddingLeft:2,children:_.pending?(0,J.jsxs)(S,{dimColor:!0,children:[`Press `,_.keyName,` again to exit`]}):M===`rename`?(0,J.jsx)(S,{dimColor:!0,children:(0,J.jsxs)(C,{children:[(0,J.jsx)(y,{shortcut:`Enter`,action:`save`}),(0,J.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):P.status===`searching`?(0,J.jsx)(S,{dimColor:!0,children:(0,J.jsxs)(C,{children:[(0,J.jsx)(S,{children:`Searching with Claude…`}),(0,J.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):I?(0,J.jsx)(S,{dimColor:!0,children:(0,J.jsxs)(C,{children:[(0,J.jsx)(y,{shortcut:`Enter`,action:`search`}),(0,J.jsx)(y,{shortcut:`↓`,action:`skip`}),(0,J.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):M===`search`?(0,J.jsx)(S,{dimColor:!0,children:(0,J.jsxs)(C,{children:[(0,J.jsx)(S,{children:`Type to Search`}),(0,J.jsx)(y,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,J.jsx)(S,{dimColor:!0,children:(0,J.jsxs)(C,{children:[f&&(0,J.jsx)(y,{shortcut:`Ctrl+A`,action:`show ${d?`current dir`:`all projects`}`}),w&&(0,J.jsx)(y,{shortcut:`Ctrl+B`,action:`toggle branch`}),D&&(0,J.jsx)(y,{shortcut:`Ctrl+W`,action:`show ${E?`current worktree`:`all worktrees`}`}),(0,J.jsx)(y,{shortcut:`Ctrl+V`,action:`preview`}),(0,J.jsx)(y,{shortcut:`Ctrl+R`,action:`rename`}),(0,J.jsx)(S,{children:`Type to search`}),(0,J.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),mt()&&(0,J.jsx)(S,{children:mt()})]})})})]})}function at(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function ot(e){let t=(e.messages.length<=Y?e.messages:[...e.messages.slice(0,X),...e.messages.slice(-1e3)]).map(at).filter(Boolean).join(` `),n=`${[e.customTitle,e.summary,e.firstPrompt,e.gitBranch,e.tag,e.prNumber?`PR #${e.prNumber}`:void 0,e.prRepository].filter(Boolean).join(` `)} ${t}`.trim();return n.length>Z?n.slice(0,Z):n}function st(e){let t=new Map;for(let n of e){let e=u(n);if(e){let r=t.get(e);r?r.push(n):t.set(e,[n])}}return t.forEach(e=>e.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime())),t}function ct(e){let t=new Set;for(let n of e)n.tag&&t.add(n.tag);return Array.from(t).sort((e,t)=>e.localeCompare(t))}var q,J,lt,ut,Y,X,Z,dt,Q=e((()=>{pe(),q=t(w(),1),ye(),Le(),Be(),_(),T(),i(),Ae(),Ne(),s(),Ee(),Oe(),n(),p(),v(),h(),Re(),He(),f(),G(),l(),Qe(),J=E(),lt=2,ut=4,Y=2e3,X=1e3,Z=5e4,dt=50}));function ft(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function pt(e){if(e.length===0)return``;let t=(e.length<=gt?e:[...e.slice(0,gt/2),...e.slice(-100/2)]).map(ft).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();return t.length>ht?t.slice(0,ht)+`…`:t}function $(e,t){return!!(De(e).toLowerCase().includes(t)||e.customTitle?.toLowerCase().includes(t)||e.tag?.toLowerCase().includes(t)||e.gitBranch?.toLowerCase().includes(t)||e.summary?.toLowerCase().includes(t)||e.firstPrompt?.toLowerCase().includes(t)||e.messages&&e.messages.length>0&&pt(e.messages).toLowerCase().includes(t))}async function mt(e,t,n){if(!e.trim()||t.length===0)return[];let i=e.toLowerCase(),a=t.filter(e=>$(e,i)),o;if(a.length>=_t)o=a.slice(0,_t);else{let e=t.filter(e=>!$(e,i)),n=_t-a.length;o=[...a,...e.slice(0,n)]}O(`Agentic search: ${o.length}/${t.length} logs, query="${e}", matching: ${a.length}, with messages: ${k(o,e=>e.messages?.length>0)}`);let s=o.map(async e=>{if(c(e))try{return await d(e)}catch(t){return ke(t),e}return e}),l=await Promise.all(s);O(`Agentic search: loaded ${k(l,e=>e.messages?.length>0)}/${o.length} logs with transcripts`);let u=`Sessions:
2
- ${l.map((e,t)=>{let n=[`${t}:`],r=De(e);if(n.push(r),e.customTitle&&e.customTitle!==r&&n.push(`[custom title: ${e.customTitle}]`),e.tag&&n.push(`[tag: ${e.tag}]`),e.gitBranch&&n.push(`[branch: ${e.gitBranch}]`),e.summary&&n.push(`- Summary: ${e.summary}`),e.firstPrompt&&e.firstPrompt!==`No prompt`&&n.push(`- First message: ${e.firstPrompt.slice(0,300)}`),e.messages&&e.messages.length>0){let t=pt(e.messages);t&&n.push(`- Transcript: ${t}`)}return n.join(` `)}).join(`
3
- `)}
4
-
5
- Search query: "${e}"
6
-
7
- Find the sessions that are most relevant to this query.`;O(`Agentic search prompt (first 500 chars): ${u.slice(0,500)}...`);try{let e=N();O(`Agentic search using model: ${e}`);let t=(await r({model:e,system:vt,messages:[{role:`user`,content:u}],signal:n,querySource:`session_search`})).content.find(e=>e.type===`text`);if(!t||t.type!==`text`)return O(`No text content in agentic search response`),[];O(`Agentic search response: ${t.text}`);let i=t.text.match(/\{[\s\S]*\}/);if(!i)return O(`Could not find JSON in agentic search response`),[];let a=(D(i[0]).relevant_indices||[]).filter(e=>e>=0&&e<l.length).map(e=>l[e]);return O(`Agentic search found ${a.length} relevant sessions`),a}catch(e){return ke(e),O(`Agentic search error: ${e}`),[]}}var ht,gt,_t,vt,yt=e((()=>{we(),Ce(),Oe(),M(),n(),oe(),Se(),ht=2e3,gt=100,_t=100,vt=`Your goal is to find relevant sessions based on a user's search query.
8
-
9
- You will be given a list of sessions with their metadata and a search query. Identify which sessions are most relevant to the query.
10
-
11
- Each session may include:
12
- - Title (display name or custom title)
13
- - Tag (user-assigned category, shown as [tag: name] - users tag sessions with /tag command to categorize them)
14
- - Branch (git branch name, shown as [branch: name])
15
- - Summary (AI-generated summary)
16
- - First message (beginning of the conversation)
17
- - Transcript (excerpt of conversation content)
18
-
19
- IMPORTANT: Tags are user-assigned labels that indicate the session's topic or category. If the query matches a tag exactly or partially, those sessions should be highly prioritized.
20
-
21
- For each session, consider (in order of priority):
22
- 1. Exact tag matches (highest priority - user explicitly categorized this session)
23
- 2. Partial tag matches or tag-related terms
24
- 3. Title matches (custom titles or first message content)
25
- 4. Branch name matches
26
- 5. Summary and transcript content matches
27
- 6. Semantic similarity and related concepts
28
-
29
- CRITICAL: Be VERY inclusive in your matching. Include sessions that:
30
- - Contain the query term anywhere in any field
31
- - Are semantically related to the query (e.g., "testing" matches sessions about "tests", "unit tests", "QA", etc.)
32
- - Discuss topics that could be related to the query
33
- - Have transcripts that mention the concept even in passing
34
-
35
- When in doubt, INCLUDE the session. It's better to return too many results than too few. The user can easily scan through results, but missing relevant sessions is frustrating.
36
-
37
- Return sessions ordered by relevance (most relevant first). If truly no sessions have ANY connection to the query, return an empty array - but this should be rare.
38
-
39
- Respond with ONLY the JSON object, no markdown formatting:
40
- {"relevant_indices": [2, 5, 0]}`}));function bt(e,t){let n=xe();if(!t||!e.projectPath||e.projectPath===n)return{isCrossProject:!1};let r=u(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${Pe([e.projectPath])} && claude --resume ${r}`,projectPath:e.projectPath}}var xt=e((()=>{ye(),Fe(),n()}));export{it as a,yt as i,xt as n,Q as o,mt as r,bt as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./cwd-L4wygFqJ.js";e();export{t as getCwd};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Kt as t,O as n,tt as r}from"./state-Bs5xweDL.js";import{AsyncLocalStorage as i}from"async_hooks";function a(e,t){return c.run(e,t)}function o(){return c.getStore()??n()}function s(){try{return o()}catch{return r()}}var c,l=e((()=>{t(),c=new i}));export{a as i,l as n,o as r,s as t};
@@ -1,2 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";async function t(e,t,r){let i=r?r.trim().split(/\s+/):[],a=i[0]||`status`;return a===`attach`?(e("Use `claude daemon attach` from the CLI. Attach is not available inside the REPL.",{display:`system`}),null):(e((await n(async()=>{if(a===`bg`)await(await import(`./bg-DWloqGwk.js`)).handleBgStart(i.slice(1));else{let{daemonMain:e}=await import(`./main-ClXu1ilx.js`);await e([a,...i.slice(1)])}})).join(`
2
- `)||`Done.`,{display:`system`}),null)}async function n(e){let t=[],n=console.log,r=console.error;console.log=(...e)=>t.push(e.map(String).join(` `)),console.error=(...e)=>t.push(e.map(String).join(` `));try{await e()}finally{console.log=n,console.error=r}return t}e((()=>{}))();export{t as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{d as a,h as o}from"./config-D4G8_MqJ.js";import{o as s,s as c}from"./log-CTFl4qpD.js";import{W as l,_ as u,ai as d,r as f,si as p,z as m}from"./model-C2e73CJD.js";import{Z as h,et as g}from"./esm-DcIr7tVd.js";import{f as _,p as v}from"./firstPartyEventLogger-DhEPWcit.js";import{createHash as y}from"crypto";function b(e){return e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}async function x(){if(N.length===0)return;let e=N;N=[];try{await r.post(E,e,{headers:{"Content-Type":`application/json`,"DD-API-KEY":D},timeout:A})}catch(e){c(e)}}function S(){P||(P=setTimeout(()=>{P=null,x()},T()).unref())}async function C(){P&&(clearTimeout(P),P=null),await x()}async function w(e,t){if(d()!==`firstParty`)return;let n=F;if(n===null&&(n=await I()),!(!n||!j.has(e)))try{let{envContext:n,...r}=await h({model:t.model,betas:t.betas}),i={...r,...n,...t,userBucket:R()};if(typeof i.toolName==`string`&&i.toolName.startsWith(`mcp__`)&&(i.toolName=`mcp`),typeof i.model==`string`){let e=f(i.model.replace(/\[1m]$/i,``));i.model=e in m?e:`other`}if(typeof i.version==`string`&&(i.version=i.version.replace(/^(\d+\.\d+\.\d+-dev\.\d{8})\.t\d+\.sha[a-f0-9]+$/,`$1`)),i.status!==void 0&&i.status!==null){let e=String(i.status);i.http_status=e;let t=e.charAt(0);t>=`1`&&t<=`5`&&(i.http_status_range=`${t}xx`),delete i.status}let a=i,o={ddsource:`nodejs`,ddtags:[`event:${e}`,...M.filter(e=>a[e]!==void 0&&a[e]!==null).map(e=>`${b(e)}:${a[e]}`)].join(`,`),message:e,service:`claude-code`,hostname:`claude-code`,env:process.env.USER_TYPE};for(let[e,t]of Object.entries(i))t!=null&&(o[b(e)]=t);N.push(o),N.length>=k?(P&&(clearTimeout(P),P=null),x()):S()}catch(e){c(e)}}function T(){return parseInt(process.env.CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS||``,10)||O}var E,D,O,k,A,j,M,N,P,F,I,L,R,z=e((()=>{i(),n(),o(),s(),u(),p(),l(),_(),g(),E=process.env.DATADOG_LOGS_ENDPOINT??``,D=process.env.DATADOG_API_KEY??``,O=15e3,k=100,A=5e3,j=new Set(`tengu_api_error.tengu_api_success.tengu_brief_mode_enabled.tengu_brief_mode_toggled.tengu_brief_send.tengu_cancel.tengu_compact_failed.tengu_exit.tengu_flicker.tengu_init.tengu_model_fallback_triggered.tengu_oauth_error.tengu_oauth_success.tengu_oauth_token_refresh_failure.tengu_oauth_token_refresh_success.tengu_oauth_token_refresh_lock_acquiring.tengu_oauth_token_refresh_lock_acquired.tengu_oauth_token_refresh_starting.tengu_oauth_token_refresh_completed.tengu_oauth_token_refresh_lock_releasing.tengu_oauth_token_refresh_lock_released.tengu_query_error.tengu_session_file_read.tengu_started.tengu_tool_use_error.tengu_tool_use_granted_in_prompt_permanent.tengu_tool_use_granted_in_prompt_temporary.tengu_tool_use_rejected_in_prompt.tengu_tool_use_success.tengu_uncaught_exception.tengu_unhandled_rejection.tengu_voice_recording_started.tengu_voice_toggled.tengu_team_mem_sync_pull.tengu_team_mem_sync_push.tengu_team_mem_sync_started.tengu_team_mem_entries_capped`.split(`.`)),M=[`arch`,`clientType`,`errorType`,`http_status_range`,`http_status`,`kairosActive`,`model`,`platform`,`provider`,`skillMode`,`subscriptionType`,`toolName`,`userBucket`,`userType`,`version`,`versionBase`],N=[],P=null,F=null,I=t(async()=>{if(v()||!E||!D)return F=!1,!1;try{return F=!0,!0}catch(e){return c(e),F=!1,!1}}),L=30,R=t(()=>{let e=a(),t=y(`sha256`).update(e).digest(`hex`);return parseInt(t.slice(0,8),16)%L})}));export{C as n,w as r,z as t};
@@ -1,39 +0,0 @@
1
- import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{l as i,n as a,o}from"./envUtils-BDhHQY0-.js";import{n as s,t as c}from"./defineProperty-C-QyHrDq.js";import{Kt as l,mt as u}from"./state-Bs5xweDL.js";import{a as ee,n as d}from"./process-gEbdy6uY.js";import{homedir as f}from"os";import*as p from"path";import{dirname as te,join as ne,resolve as re}from"path";import*as m from"fs";import{closeSync as ie,fsyncSync as ae,openSync as oe,writeFileSync as se}from"fs";import{appendFile as ce,mkdir as le,open as ue,readFile as de,readdir as fe,rename as pe,rm as me,rmdir as he,stat as ge,symlink as _e,unlink as ve}from"fs/promises";function ye({writeFn:e,flushIntervalMs:t=1e3,maxBufferSize:n=100,maxBufferBytes:r=1/0,immediateMode:i=!1}){let a=[],o=0,s=null,c=null;function l(){s&&(clearTimeout(s),s=null)}function u(){c&&(e(c.join(``)),c=null),a.length!==0&&(e(a.join(``)),a=[],o=0,l())}function ee(){s||(s=setTimeout(u,t))}function d(){if(c){c.push(...a),a=[],o=0,l();return}let t=a;a=[],o=0,l(),c=t,setImmediate(()=>{let t=c;c=null,t&&e(t.join(``))})}return{write(t){if(i){e(t);return}a.push(t),o+=t.length,ee(),(a.length>=n||o>=r)&&d()},flush:u,dispose(){u()}}}var be=e((()=>{}));function xe(e){return Ce.add(e),()=>Ce.delete(e)}async function Se(){await Promise.all(Array.from(Ce).map(e=>e()))}var Ce,we=e((()=>{Ce=new Set}));function Te(e){let t=[],n=e.match(/^MCP server ["']([^"']+)["']/);if(n&&n[1])t.push(`mcp`),t.push(n[1].toLowerCase());else{let n=e.match(/^([^:[]+):/);n&&n[1]&&t.push(n[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);r&&r[1]&&t.push(r[1].trim().toLowerCase()),e.toLowerCase().includes(`1p event:`)&&t.push(`1p`);let i=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(i&&i[1]){let e=i[1].trim().toLowerCase();e.length<30&&!e.includes(` `)&&t.push(e)}return Array.from(new Set(t))}function Ee(e,t){return t?e.length===0?!1:t.isExclusive?!e.some(e=>t.exclude.includes(e)):e.some(e=>t.include.includes(e)):!0}function De(e,t){return!t||Ee(Te(e),t)}var Oe,ke=e((()=>{r(),Oe=n(e=>{if(!e||e.trim()===``)return null;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some(e=>e.startsWith(`!`)),r=t.some(e=>!e.startsWith(`!`));if(n&&r)return null;let i=t.map(e=>e.replace(/^!/,``).toLowerCase());return{include:n?[]:i,exclude:n?i:[],isExclusive:n}})}));function h(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 g(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 _=e((()=>{})),Ae,je=e((()=>{Ae=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Ae=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 Me(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var Ne,Pe=e((()=>{Ne=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)}})),v,y,b,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,x=e((()=>{Pe(),v=class extends Error{},y=class e extends v{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,n,r,i){if(!t||!i)return new Fe({message:r,cause:Ne(n)});let a=n,o=a?.error?.type;return t===400?new Le(t,a,r,i,o):t===401?new Re(t,a,r,i,o):t===403?new ze(t,a,r,i,o):t===404?new Be(t,a,r,i,o):t===409?new Ve(t,a,r,i,o):t===422?new He(t,a,r,i,o):t===429?new Ue(t,a,r,i,o):t>=500?new We(t,a,r,i,o):new e(t,a,r,i,o)}},b=class extends y{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},Fe=class extends y{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},Ie=class extends Fe{constructor({message:e}={}){super({message:e??`Request timed out.`})}},Le=class extends y{},Re=class extends y{},ze=class extends y{},Be=class extends y{},Ve=class extends y{},He=class extends y{},Ue=class extends y{},We=class extends y{}}));function Ge(e){return typeof e==`object`?e??{}:{}}function Ke(e){if(!e)return!0;for(let t in e)return!1;return!0}function qe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Je,Ye,Xe,Ze,Qe,$e,et=e((()=>{x(),Je=/^[a-z][a-z0-9+.-]*:/i,Ye=e=>Je.test(e),Xe=e=>(Xe=Array.isArray,Xe(e)),Ze=Xe,Qe=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new v(`${e} must be an integer`);if(t<0)throw new v(`${e} must be a positive integer`);return t},$e=e=>{try{return JSON.parse(e)}catch{return}}})),tt,nt=e((()=>{tt=e=>new Promise(t=>setTimeout(t,e))})),S,rt=e((()=>{S=`0.81.0`}));function it(){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 at(){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 ot,st,ct,lt,ut,dt,ft=e((()=>{rt(),ot=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`,st=()=>{let e=it();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":lt(Deno.build.os),"X-Stainless-Arch":ct(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":S,"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":S,"X-Stainless-OS":lt(globalThis.process.platform??`unknown`),"X-Stainless-Arch":ct(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=at();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"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":S,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}},ct=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,lt=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`),dt=()=>ut??(ut=st())}));function pt(){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 mt(...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 ht(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return mt({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function gt(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 _t(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 vt=e((()=>{})),yt,bt=e((()=>{yt=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)})}));function xt(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 v(`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 St=e((()=>{x()}));function Ct(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 wt(e){let t;return(Et??(t=new globalThis.TextEncoder,Et=t.encode.bind(t)))(e)}function Tt(e){let t;return(Dt??(t=new globalThis.TextDecoder,Dt=t.decode.bind(t)))(e)}var Et,Dt,Ot=e((()=>{}));function kt(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 At(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 C,w,T,jt=e((()=>{_(),Ot(),T=class{constructor(){C.set(this,void 0),w.set(this,void 0),h(this,C,new Uint8Array,`f`),h(this,w,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?wt(e):e;h(this,C,Ct([g(this,C,`f`),t]),`f`);let n=[],r;for(;(r=kt(g(this,C,`f`),g(this,w,`f`)))!=null;){if(r.carriage&&g(this,w,`f`)==null){h(this,w,r.index,`f`);continue}if(g(this,w,`f`)!=null&&(r.index!==g(this,w,`f`)+1||r.carriage)){n.push(Tt(g(this,C,`f`).subarray(0,g(this,w,`f`)-1))),h(this,C,g(this,C,`f`).subarray(g(this,w,`f`)),`f`),h(this,w,null,`f`);continue}let e=g(this,w,`f`)===null?r.preceding:r.preceding-1,t=Tt(g(this,C,`f`).subarray(0,e));n.push(t),h(this,C,g(this,C,`f`).subarray(r.index),`f`),h(this,w,null,`f`)}return n}flush(){return g(this,C,`f`).length?this.decode(`
2
- `):[]}},C=new WeakMap,w=new WeakMap,T.NEWLINE_CHARS=new Set([`
3
- `,`\r`]),T.NEWLINE_REGEXP=/\r\n|[\n\r]/g}));function Mt(){}function Nt(e,t,n){return!t||Pt[e]>Pt[n]?Mt:t[e].bind(t)}function E(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return It;let r=Lt.get(t);if(r&&r[0]===n)return r[1];let i={error:Nt(`error`,t,n),warn:Nt(`warn`,t,n),info:Nt(`info`,t,n),debug:Nt(`debug`,t,n)};return Lt.set(t,[n,i]),i}var Pt,Ft,It,Lt,D,Rt=e((()=>{et(),Pt={off:0,error:200,warn:300,info:400,debug:500},Ft=(e,t,n)=>{if(e){if(qe(Pt,e))return e;E(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Pt))}`)}},It={error:Mt,warn:Mt,info:Mt,debug:Mt},Lt=new WeakMap,D=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)}));async function*zt(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new v(`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 v(`Attempted to iterate over a response with no body`);let n=new Ut,r=new T,i=gt(e.body);for await(let e of Bt(i))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*Bt(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`?wt(n):n,r=new Uint8Array(t.length+e.length);r.set(t),r.set(e,t.length),t=r;let i;for(;(i=At(t))!==-1;)yield t.slice(0,i),t=t.slice(i)}t.length>0&&(yield t)}function Vt(e,t){let n=e.indexOf(t);return n===-1?[e,``,``]:[e.substring(0,n),t,e.substring(n+t.length)]}var Ht,O,Ut,Wt=e((()=>{_(),x(),vt(),jt(),Pe(),et(),Ot(),Rt(),O=class e{constructor(e,t,n){this.iterator=e,Ht.set(this,void 0),this.controller=t,h(this,Ht,n,`f`)}static fromSSEResponse(t,n,r){let i=!1,a=r?E(r):console;async function*o(){if(i)throw new v("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let e of zt(t,n)){if(e.event===`completion`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.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`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}if(e.event!==`ping`&&e.event===`error`){let n=$e(e.data)??e.data,r=n?.error?.type;throw new y(void 0,n,void 0,t.headers,r)}}e=!0}catch(e){if(Me(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new T,n=gt(t);for await(let t of n)for(let n of e.decode(t))yield n;for(let t of e.flush())yield t}async function*o(){if(i)throw new v("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(Me(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(Ht=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,g(this,Ht,`f`)),new e(()=>i(n),this.controller,g(this,Ht,`f`))]}toReadableStream(){let e=this,t;return mt({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=wt(JSON.stringify(n)+`
4
- `);e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await t.return?.()}})}},Ut=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]=Vt(e,`:`);return r.startsWith(` `)&&(r=r.substring(1)),t===`event`?this.event=r:t===`data`&&this.data.push(r),null}}}));async function Gt(e,t){let{response:n,requestLogID:r,retryOfRequestLogID:i,startTime:a}=t,o=await(async()=>{if(t.options.stream)return E(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:Kt(await n.json(),n):await n.text()})();return E(e).debug(`[${r}] response parsed`,D({retryOfRequestLogID:i,url:n.url,status:n.status,body:o,durationMs:Date.now()-a})),o}function Kt(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 qt=e((()=>{Wt(),Rt()})),Jt,Yt,Xt=e((()=>{_(),qt(),Yt=class e extends Promise{constructor(e,t,n=Gt){super(e=>{e(null)}),this.responsePromise=t,this.parseResponse=n,Jt.set(this,void 0),h(this,Jt,e,`f`)}_thenUnwrap(t){return new e(g(this,Jt,`f`),this.responsePromise,async(e,n)=>Kt(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(g(this,Jt,`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)}},Jt=new WeakMap})),Zt,Qt,$t,en,tn,k=e((()=>{_(),x(),qt(),Xt(),et(),Qt=class{constructor(e,t,n,r){Zt.set(this,void 0),h(this,Zt,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 v("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await g(this,Zt,`f`).requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Zt=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}},$t=class extends Yt{constructor(e,t,n){super(e,t,async(e,t)=>new n(e,t.response,await Gt(e,t),t.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}},en=class extends Qt{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:{...Ge(this.options.query),before_id:e}}:null}let e=this.last_id;return e?{...this.options,query:{...Ge(this.options.query),after_id:e}}:null}},tn=class extends Qt{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.has_more=n.has_more||!1,this.next_page=n.next_page||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more!==!1&&super.hasNextPage()}nextPageRequestOptions(){let e=this.next_page;return e?{...this.options,query:{...Ge(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((()=>{vt(),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(ht(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((()=>{})),A,j=e((()=>{A=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():Ze(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=Ze(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,M,N=e((()=>{et(),wn=Symbol.for(`brand.privateNullableHeaders`),M=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 typeof e==`object`&&!!e&&kn in e}function En(e,t){let n=new Set;if(e)for(let t of e)Tn(t)&&n.add(t[kn]);if(t){for(let e of t)if(Tn(e)&&n.add(e[kn]),Array.isArray(e.content))for(let t of e.content)Tn(t)&&n.add(t[kn])}return Array.from(n)}function Dn(e,t){let n=En(e,t);return n.length===0?{}:{"x-stainless-helper":n.join(`, `)}}function On(e){return Tn(e)?{"x-stainless-helper":e[kn]}:{}}var kn,An=e((()=>{kn=Symbol(`anthropic.sdk.stainlessHelper`)}));function jn(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Mn,Nn,P,F=e((()=>{x(),Mn=Object.freeze(Object.create(null)),Nn=(e=jn)=>function(t,...n){if(t.length===1)return t[0];let r=!1,i=[],a=t.reduce((t,a,o)=>{/[?#]/.test(a)&&(r=!0);let s=n[o],c=(r?encodeURIComponent:e)(``+s);return o!==n.length&&(s==null||typeof s==`object`&&s.toString===Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty??Mn)??Mn)?.toString)&&(c=s+``,i.push({start:t.length+a.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+a+(o===n.length?``:c)},``),o=a.split(/[?#]/,1)[0],s=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=s.exec(o))!==null;)i.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can\'t be safely passed as a path parameter`});if(i.sort((e,t)=>e.start-t.start),i.length>0){let e=0,t=i.reduce((t,n)=>{let r=` `.repeat(n.start-e),i=`^`.repeat(n.length);return e=n.start+n.length,t+r+i},``);throw new v(`Path parameters result in path with invalid segments:\n${i.map(e=>e.error).join(`
6
- `)}\n${a}\n${t}`)}return a},P=Nn(jn)})),Pn,Fn=e((()=>{j(),k(),N(),An(),pn(),F(),Pn=class extends A{list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/files`,en,{query:r,...t,headers:M([{"anthropic-beta":[...n??[],`files-api-2025-04-14`].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(P`/v1/files/${e}`,{...n,headers:M([{"anthropic-beta":[...r??[],`files-api-2025-04-14`].toString()},n?.headers])})}download(e,t={},n){let{betas:r}=t??{};return this._client.get(P`/v1/files/${e}/content`,{...n,headers:M([{"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(P`/v1/files/${e}`,{...n,headers:M([{"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`,cn({body:r,...t,headers:M([{"anthropic-beta":[...n??[],`files-api-2025-04-14`].toString()},On(r.file),t?.headers])},this._client))}}})),In,Ln=e((()=>{j(),k(),N(),F(),In=class extends A{retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(P`/v1/models/${e}?beta=true`,{...n,headers:M([{...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`,en,{query:r,...t,headers:M([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()}},t?.headers])})}}})),Rn=e((()=>{x()})),zn,Bn=e((()=>{zn={"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 Vn(e){return e?.output_format??e?.output_config?.format}function Hn(e,t,n){let r=Vn(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}:Un(e,t,n)}function Un(e,t,n){let r=null,i=e.content.map(e=>{if(e.type===`text`){let i=Wn(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 Wn(e,t){let n=Vn(e);if(n?.type!==`json_schema`)return null;try{return`parse`in n?n.parse(t):JSON.parse(t)}catch(e){throw new v(`Failed to parse structured output: ${e}`)}}var Gn=e((()=>{x()})),Kn,qn,Jn,Yn,Xn,Zn=e((()=>{Kn=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},qn=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),qn(e);case`number`:let n=t.value[t.value.length-1];if(n===`.`||n===`-`)return e=e.slice(0,e.length-1),qn(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),qn(e);break;case`delimiter`:return e=e.slice(0,e.length-1),qn(e)}return e},Jn=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},Yn=e=>{let t=``;return e.map(e=>{switch(e.type){case`string`:t+=`"`+e.value+`"`;break;default:t+=e.value;break}}),t},Xn=e=>JSON.parse(Yn(Jn(qn(Kn(e)))))})),Qn=e((()=>{Wt()}));function $n(e){return e.type===`tool_use`||e.type===`server_tool_use`||e.type===`mcp_tool_use`}var I,L,er,tr,nr,rr,ir,ar,or,R,sr,cr,lr,z,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,br,xr,Sr=e((()=>{_(),Zn(),Rn(),Pe(),Qn(),Gn(),br=`__json_buf`,xr=class e{constructor(e,t){I.add(this),this.messages=[],this.receivedMessages=[],L.set(this,void 0),er.set(this,null),this.controller=new AbortController,tr.set(this,void 0),nr.set(this,()=>{}),rr.set(this,()=>{}),ir.set(this,void 0),ar.set(this,()=>{}),or.set(this,()=>{}),R.set(this,{}),sr.set(this,!1),cr.set(this,!1),lr.set(this,!1),z.set(this,!1),ur.set(this,void 0),dr.set(this,void 0),fr.set(this,void 0),hr.set(this,e=>{if(h(this,cr,!0,`f`),Me(e)&&(e=new b),e instanceof b)return h(this,lr,!0,`f`),this._emit(`abort`,e);if(e instanceof v)return this._emit(`error`,e);if(e instanceof Error){let t=new v(e.message);return t.cause=e,this._emit(`error`,t)}return this._emit(`error`,new v(String(e)))}),h(this,tr,new Promise((e,t)=>{h(this,nr,e,`f`),h(this,rr,t,`f`)}),`f`),h(this,ir,new Promise((e,t)=>{h(this,ar,e,`f`),h(this,or,t,`f`)}),`f`),g(this,tr,`f`).catch(()=>{}),g(this,ir,`f`).catch(()=>{}),h(this,er,e,`f`),h(this,fr,t?.logger??console,`f`)}get response(){return g(this,ur,`f`)}get request_id(){return g(this,dr,`f`)}async withResponse(){h(this,z,!0,`f`);let e=await g(this,tr,`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 h(a,er,{...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`)},g(this,hr,`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{g(this,I,`m`,gr).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)g(this,I,`m`,_r).call(this,e);if(i.controller.signal?.aborted)throw new b;g(this,I,`m`,vr).call(this)}finally{r&&i&&r.removeEventListener(`abort`,i)}}_connected(e){this.ended||(h(this,ur,e,`f`),h(this,dr,e?.headers.get(`request-id`),`f`),g(this,nr,`f`).call(this,e),this._emit(`connect`))}get ended(){return g(this,sr,`f`)}get errored(){return g(this,cr,`f`)}get aborted(){return g(this,lr,`f`)}abort(){this.controller.abort()}on(e,t){return(g(this,R,`f`)[e]||(g(this,R,`f`)[e]=[])).push({listener:t}),this}off(e,t){let n=g(this,R,`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(g(this,R,`f`)[e]||(g(this,R,`f`)[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,n)=>{h(this,z,!0,`f`),e!==`error`&&this.once(`error`,n),this.once(e,t)})}async done(){h(this,z,!0,`f`),await g(this,ir,`f`)}get currentMessage(){return g(this,L,`f`)}async finalMessage(){return await this.done(),g(this,I,`m`,pr).call(this)}async finalText(){return await this.done(),g(this,I,`m`,mr).call(this)}_emit(e,...t){if(g(this,sr,`f`))return;e===`end`&&(h(this,sr,!0,`f`),g(this,ar,`f`).call(this));let n=g(this,R,`f`)[e];if(n&&(g(this,R,`f`)[e]=n.filter(e=>!e.once),n.forEach(({listener:e})=>e(...t))),e===`abort`){let e=t[0];!g(this,z,`f`)&&!n?.length&&Promise.reject(e),g(this,rr,`f`).call(this,e),g(this,or,`f`).call(this,e),this._emit(`end`);return}if(e===`error`){let e=t[0];!g(this,z,`f`)&&!n?.length&&Promise.reject(e),g(this,rr,`f`).call(this,e),g(this,or,`f`).call(this,e),this._emit(`end`)}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit(`finalMessage`,g(this,I,`m`,pr).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{g(this,I,`m`,gr).call(this),this._connected(null);let t=O.fromReadableStream(e,this.controller);for await(let e of t)g(this,I,`m`,_r).call(this,e);if(t.controller.signal?.aborted)throw new b;g(this,I,`m`,vr).call(this)}finally{n&&r&&n.removeEventListener(`abort`,r)}}[(L=new WeakMap,er=new WeakMap,tr=new WeakMap,nr=new WeakMap,rr=new WeakMap,ir=new WeakMap,ar=new WeakMap,or=new WeakMap,R=new WeakMap,sr=new WeakMap,cr=new WeakMap,lr=new WeakMap,z=new WeakMap,ur=new WeakMap,dr=new WeakMap,fr=new WeakMap,hr=new WeakMap,I=new WeakSet,pr=function(){if(this.receivedMessages.length===0)throw new v(`stream ended without producing a Message with role=assistant`);return this.receivedMessages.at(-1)},mr=function(){if(this.receivedMessages.length===0)throw new v(`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 v(`stream ended without producing a content block with type=text`);return e.join(` `)},gr=function(){this.ended||h(this,L,void 0,`f`)},_r=function(e){if(this.ended)return;let t=g(this,I,`m`,yr).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`:$n(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(Hn(t,g(this,er,`f`),{logger:g(this,fr,`f`)}),!0);break;case`content_block_stop`:this._emit(`contentBlock`,t.content.at(-1));break;case`message_start`:h(this,L,t,`f`);break;case`content_block_start`:case`message_delta`:break}},vr=function(){if(this.ended)throw new v(`stream has ended, this shouldn't happen`);let e=g(this,L,`f`);if(!e)throw new v(`request ended without sending any chunks`);return h(this,L,void 0,`f`),Hn(e,g(this,er,`f`),{logger:g(this,fr,`f`)})},yr=function(e){let t=g(this,L,`f`);if(e.type===`message_start`){if(t)throw new v(`Unexpected event order, got ${e.type} before receiving "message_stop"`);return e.message}if(!t)throw new v(`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&&$n(n)){let r=n[br]||``;r+=e.delta.partial_json;let i={...n};if(Object.defineProperty(i,br,{value:r,enumerable:!1,writable:!0}),r)try{i.input=Xn(r)}catch(e){let t=new v(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${e}. JSON: ${r}`);g(this,hr,`f`).call(this,t)}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;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()}}})),Cr,wr=e((()=>{Cr=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}}})),Tr,Er=e((()=>{Tr=`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 Dr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function Or(e,t=e.messages.at(-1)){if(!t||t.role!==`assistant`||!t.content||typeof t.content==`string`)return null;let n=t.content.filter(e=>e.type===`tool_use`);return n.length===0?null:{role:`user`,content:await Promise.all(n.map(async t=>{let n=e.tools.find(e=>(`name`in e?e.name:e.mcp_server_name)===t.name);if(!n||!(`run`in n))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 n&&n.parse&&(e=n.parse(e));let r=await n.run(e);return{type:`tool_result`,tool_use_id:t.id,content:r}}catch(e){return{type:`tool_result`,tool_use_id:t.id,content:e instanceof Cr?e.content:`Error: ${e instanceof Error?e.message:String(e)}`,is_error:!0}}}))}}var kr,Ar,B,V,jr,H,U,W,Mr,Nr,Pr,Fr,Ir=e((()=>{_(),wr(),x(),N(),Er(),An(),Fr=class{constructor(e,t,n){kr.add(this),this.client=e,Ar.set(this,!1),B.set(this,!1),V.set(this,void 0),jr.set(this,void 0),H.set(this,void 0),U.set(this,void 0),W.set(this,void 0),Mr.set(this,0),h(this,V,{params:{...t,messages:structuredClone(t.messages)}},`f`);let r=[`BetaToolRunner`,...En(t.tools,t.messages)].join(`, `);h(this,jr,{...n,headers:M([{"x-stainless-helper":r},n?.headers])},`f`),h(this,W,Dr(),`f`)}async*[(Ar=new WeakMap,B=new WeakMap,V=new WeakMap,jr=new WeakMap,H=new WeakMap,U=new WeakMap,W=new WeakMap,Mr=new WeakMap,kr=new WeakSet,Nr=async function(){let e=g(this,V,`f`).params.compactionControl;if(!e||!e.enabled)return!1;let t=0;if(g(this,H,`f`)!==void 0)try{let e=await g(this,H,`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??g(this,V,`f`).params.model,i=e.summaryPrompt??Tr,a=g(this,V,`f`).params.messages;if(a[a.length-1].role===`assistant`){let e=a[a.length-1];if(Array.isArray(e.content)){let t=e.content.filter(e=>e.type!==`tool_use`);t.length===0?a.pop():e.content=t}}let o=await this.client.beta.messages.create({model:r,messages:[...a,{role:`user`,content:[{type:`text`,text:i}]}],max_tokens:g(this,V,`f`).params.max_tokens},{headers:{"x-stainless-helper":`compaction`}});if(o.content[0]?.type!==`text`)throw new v(`Expected text response for compaction`);return g(this,V,`f`).params.messages=[{role:`user`,content:o.content}],!0},Symbol.asyncIterator)](){var e;if(g(this,Ar,`f`))throw new v(`Cannot iterate over a consumed stream`);h(this,Ar,!0,`f`),h(this,B,!0,`f`),h(this,U,void 0,`f`);try{for(;;){let t;try{if(g(this,V,`f`).params.max_iterations&&g(this,Mr,`f`)>=g(this,V,`f`).params.max_iterations)break;h(this,B,!1,`f`),h(this,U,void 0,`f`),h(this,Mr,(e=g(this,Mr,`f`),e++,e),`f`),h(this,H,void 0,`f`);let{max_iterations:n,compactionControl:r,...i}=g(this,V,`f`).params;if(i.stream?(t=this.client.beta.messages.stream({...i},g(this,jr,`f`)),h(this,H,t.finalMessage(),`f`),g(this,H,`f`).catch(()=>{}),yield t):(h(this,H,this.client.beta.messages.create({...i,stream:!1},g(this,jr,`f`)),`f`),yield g(this,H,`f`)),!await g(this,kr,`m`,Nr).call(this)){if(!g(this,B,`f`)){let{role:e,content:t}=await g(this,H,`f`);g(this,V,`f`).params.messages.push({role:e,content:t})}let e=await g(this,kr,`m`,Pr).call(this,g(this,V,`f`).params.messages.at(-1));if(e)g(this,V,`f`).params.messages.push(e);else if(!g(this,B,`f`))break}}finally{t&&t.abort()}}if(!g(this,H,`f`))throw new v(`ToolRunner concluded without a message from the server`);g(this,W,`f`).resolve(await g(this,H,`f`))}catch(e){throw h(this,Ar,!1,`f`),g(this,W,`f`).promise.catch(()=>{}),g(this,W,`f`).reject(e),h(this,W,Dr(),`f`),e}}setMessagesParams(e){typeof e==`function`?g(this,V,`f`).params=e(g(this,V,`f`).params):g(this,V,`f`).params=e,h(this,B,!0,`f`),h(this,U,void 0,`f`)}async generateToolResponse(){let e=await g(this,H,`f`)??this.params.messages.at(-1);return e?g(this,kr,`m`,Pr).call(this,e):null}done(){return g(this,W,`f`).promise}async runUntilDone(){if(!g(this,Ar,`f`))for await(let e of this);return this.done()}get params(){return g(this,V,`f`).params}pushMessages(...e){this.setMessagesParams(t=>({...t,messages:[...t.messages,...e]}))}then(e,t){return this.runUntilDone().then(e,t)}},Pr=async function(e){return g(this,U,`f`)===void 0&&h(this,U,Or(g(this,V,`f`).params,e),`f`),g(this,U,`f`)}})),Lr,Rr=e((()=>{x(),vt(),jt(),Lr=class e{constructor(e,t){this.iterator=e,this.controller=t}async*decoder(){let e=new T;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 v(`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 v(`Attempted to iterate over a response with no body`);return new e(gt(t.body),n)}}})),zr,Br=e((()=>{j(),k(),N(),Rr(),Rn(),F(),zr=class extends A{create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/messages/batches?beta=true`,{body:r,...t,headers:M([{"anthropic-beta":[...n??[],`message-batches-2024-09-24`].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(P`/v1/messages/batches/${e}?beta=true`,{...n,headers:M([{"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`,en,{query:r,...t,headers:M([{"anthropic-beta":[...n??[],`message-batches-2024-09-24`].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(P`/v1/messages/batches/${e}?beta=true`,{...n,headers:M([{"anthropic-beta":[...r??[],`message-batches-2024-09-24`].toString()},n?.headers])})}cancel(e,t={},n){let{betas:r}=t??{};return this._client.post(P`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:M([{"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 v(`No batch \`results_url\`; Has it finished processing? ${r.processing_status} - ${r.id}`);let{betas:i}=t??{};return this._client.get(r.results_url,{...n,headers:M([{"anthropic-beta":[...i??[],`message-batches-2024-09-24`].toString(),Accept:`application/binary`},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((e,t)=>Lr.fromResponse(t.response,t.controller))}}}));function Vr(e){if(!e.output_format)return e;if(e.output_config?.format)throw new v(`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 Hr,Ur,Wr,Gr=e((()=>{Rn(),j(),Bn(),N(),An(),Gn(),Sr(),Ir(),wr(),Br(),Hr={"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`},Ur=[`claude-opus-4-6`],Wr=class extends A{constructor(){super(...arguments),this.batches=new zr(this._client)}create(e,t){let n=Vr(e),{betas:r,...i}=n;i.model in Hr&&console.warn(`The model '${i.model}' is deprecated and will reach end-of-life on ${Hr[i.model]}\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),i.model in Ur&&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=zn[i.model]??void 0;a=this._client.calculateNonstreamingTimeout(i.max_tokens,e)}let o=Dn(i.tools,i.messages);return this._client.post(`/v1/messages?beta=true`,{body:i,timeout:a??6e5,...t,headers:M([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},o,t?.headers]),stream:n.stream??!1})}parse(e,t){return t={...t,headers:M([{"anthropic-beta":[...e.betas??[],`structured-outputs-2025-12-15`].toString()},t?.headers])},this.create(e,t).then(t=>Un(t,e,{logger:this._client.logger??console}))}stream(e,t){return xr.createMessage(this,e,t)}countTokens(e,t){let{betas:n,...r}=Vr(e);return this._client.post(`/v1/messages/count_tokens?beta=true`,{body:r,...t,headers:M([{"anthropic-beta":[...n??[],`token-counting-2024-11-01`].toString()},t?.headers])})}toolRunner(e,t){return new Fr(this._client,e,t)}},Wr.Batches=zr,Wr.BetaToolRunner=Fr,Wr.ToolError=Cr})),Kr,qr=e((()=>{j(),k(),N(),pn(),F(),Kr=class extends A{create(e,t={},n){let{betas:r,...i}=t??{};return this._client.post(P`/v1/skills/${e}/versions?beta=true`,cn({body:i,...n,headers:M([{"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(P`/v1/skills/${r}/versions/${e}?beta=true`,{...n,headers:M([{"anthropic-beta":[...i??[],`skills-2025-10-02`].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...i}=t??{};return this._client.getAPIList(P`/v1/skills/${e}/versions?beta=true`,tn,{query:i,...n,headers:M([{"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(P`/v1/skills/${r}/versions/${e}?beta=true`,{...n,headers:M([{"anthropic-beta":[...i??[],`skills-2025-10-02`].toString()},n?.headers])})}}})),Jr,Yr=e((()=>{j(),qr(),k(),N(),pn(),F(),Jr=class extends A{constructor(){super(...arguments),this.versions=new Kr(this._client)}create(e={},t){let{betas:n,...r}=e??{};return this._client.post(`/v1/skills?beta=true`,cn({body:r,...t,headers:M([{"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(P`/v1/skills/${e}?beta=true`,{...n,headers:M([{"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`,tn,{query:r,...t,headers:M([{"anthropic-beta":[...n??[],`skills-2025-10-02`].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(P`/v1/skills/${e}?beta=true`,{...n,headers:M([{"anthropic-beta":[...r??[],`skills-2025-10-02`].toString()},n?.headers])})}},Jr.Versions=Kr})),G,Xr=e((()=>{j(),Fn(),Ln(),Gr(),Yr(),G=class extends A{constructor(){super(...arguments),this.models=new In(this._client),this.messages=new Wr(this._client),this.files=new Pn(this._client),this.skills=new Jr(this._client)}},G.Models=In,G.Messages=Wr,G.Files=Pn,G.Skills=Jr})),Zr,Qr=e((()=>{j(),N(),Zr=class extends A{create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/complete`,{body:r,timeout:this._client._options.timeout??6e5,...t,headers:M([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()}},t?.headers]),stream:e.stream??!1})}}}));function $r(e){return e?.output_config?.format}function ei(e,t,n){let r=$r(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}:ti(e,t,n)}function ti(e,t,n){let r=null,i=e.content.map(e=>{if(e.type===`text`){let n=ni(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 ni(e,t){let n=$r(e);if(n?.type!==`json_schema`)return null;try{return`parse`in n?n.parse(t):JSON.parse(t)}catch(e){throw new v(`Failed to parse structured output: ${e}`)}}var ri=e((()=>{x()}));function ii(e){return e.type===`tool_use`||e.type===`server_tool_use`}var K,q,ai,oi,si,ci,li,ui,di,J,fi,pi,mi,Y,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di=e((()=>{_(),Pe(),Rn(),Qn(),Zn(),ri(),Ti=`__json_buf`,Ei=class e{constructor(e,t){K.add(this),this.messages=[],this.receivedMessages=[],q.set(this,void 0),ai.set(this,null),this.controller=new AbortController,oi.set(this,void 0),si.set(this,()=>{}),ci.set(this,()=>{}),li.set(this,void 0),ui.set(this,()=>{}),di.set(this,()=>{}),J.set(this,{}),fi.set(this,!1),pi.set(this,!1),mi.set(this,!1),Y.set(this,!1),hi.set(this,void 0),gi.set(this,void 0),_i.set(this,void 0),bi.set(this,e=>{if(h(this,pi,!0,`f`),Me(e)&&(e=new b),e instanceof b)return h(this,mi,!0,`f`),this._emit(`abort`,e);if(e instanceof v)return this._emit(`error`,e);if(e instanceof Error){let t=new v(e.message);return t.cause=e,this._emit(`error`,t)}return this._emit(`error`,new v(String(e)))}),h(this,oi,new Promise((e,t)=>{h(this,si,e,`f`),h(this,ci,t,`f`)}),`f`),h(this,li,new Promise((e,t)=>{h(this,ui,e,`f`),h(this,di,t,`f`)}),`f`),g(this,oi,`f`).catch(()=>{}),g(this,li,`f`).catch(()=>{}),h(this,ai,e,`f`),h(this,_i,t?.logger??console,`f`)}get response(){return g(this,hi,`f`)}get request_id(){return g(this,gi,`f`)}async withResponse(){h(this,Y,!0,`f`);let e=await g(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 h(a,ai,{...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`)},g(this,bi,`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{g(this,K,`m`,xi).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)g(this,K,`m`,Si).call(this,e);if(i.controller.signal?.aborted)throw new b;g(this,K,`m`,Ci).call(this)}finally{r&&i&&r.removeEventListener(`abort`,i)}}_connected(e){this.ended||(h(this,hi,e,`f`),h(this,gi,e?.headers.get(`request-id`),`f`),g(this,si,`f`).call(this,e),this._emit(`connect`))}get ended(){return g(this,fi,`f`)}get errored(){return g(this,pi,`f`)}get aborted(){return g(this,mi,`f`)}abort(){this.controller.abort()}on(e,t){return(g(this,J,`f`)[e]||(g(this,J,`f`)[e]=[])).push({listener:t}),this}off(e,t){let n=g(this,J,`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(g(this,J,`f`)[e]||(g(this,J,`f`)[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,n)=>{h(this,Y,!0,`f`),e!==`error`&&this.once(`error`,n),this.once(e,t)})}async done(){h(this,Y,!0,`f`),await g(this,li,`f`)}get currentMessage(){return g(this,q,`f`)}async finalMessage(){return await this.done(),g(this,K,`m`,vi).call(this)}async finalText(){return await this.done(),g(this,K,`m`,yi).call(this)}_emit(e,...t){if(g(this,fi,`f`))return;e===`end`&&(h(this,fi,!0,`f`),g(this,ui,`f`).call(this));let n=g(this,J,`f`)[e];if(n&&(g(this,J,`f`)[e]=n.filter(e=>!e.once),n.forEach(({listener:e})=>e(...t))),e===`abort`){let e=t[0];!g(this,Y,`f`)&&!n?.length&&Promise.reject(e),g(this,ci,`f`).call(this,e),g(this,di,`f`).call(this,e),this._emit(`end`);return}if(e===`error`){let e=t[0];!g(this,Y,`f`)&&!n?.length&&Promise.reject(e),g(this,ci,`f`).call(this,e),g(this,di,`f`).call(this,e),this._emit(`end`)}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit(`finalMessage`,g(this,K,`m`,vi).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{g(this,K,`m`,xi).call(this),this._connected(null);let t=O.fromReadableStream(e,this.controller);for await(let e of t)g(this,K,`m`,Si).call(this,e);if(t.controller.signal?.aborted)throw new b;g(this,K,`m`,Ci).call(this)}finally{n&&r&&n.removeEventListener(`abort`,r)}}[(q=new WeakMap,ai=new WeakMap,oi=new WeakMap,si=new WeakMap,ci=new WeakMap,li=new WeakMap,ui=new WeakMap,di=new WeakMap,J=new WeakMap,fi=new WeakMap,pi=new WeakMap,mi=new WeakMap,Y=new WeakMap,hi=new WeakMap,gi=new WeakMap,_i=new WeakMap,bi=new WeakMap,K=new WeakSet,vi=function(){if(this.receivedMessages.length===0)throw new v(`stream ended without producing a Message with role=assistant`);return this.receivedMessages.at(-1)},yi=function(){if(this.receivedMessages.length===0)throw new v(`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 v(`stream ended without producing a content block with type=text`);return e.join(` `)},xi=function(){this.ended||h(this,q,void 0,`f`)},Si=function(e){if(this.ended)return;let t=g(this,K,`m`,wi).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`:ii(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(ei(t,g(this,ai,`f`),{logger:g(this,_i,`f`)}),!0);break;case`content_block_stop`:this._emit(`contentBlock`,t.content.at(-1));break;case`message_start`:h(this,q,t,`f`);break;case`content_block_start`:case`message_delta`:break}},Ci=function(){if(this.ended)throw new v(`stream has ended, this shouldn't happen`);let e=g(this,q,`f`);if(!e)throw new v(`request ended without sending any chunks`);return h(this,q,void 0,`f`),ei(e,g(this,ai,`f`),{logger:g(this,_i,`f`)})},wi=function(e){let t=g(this,q,`f`);if(e.type===`message_start`){if(t)throw new v(`Unexpected event order, got ${e.type} before receiving "message_stop"`);return e.message}if(!t)throw new v(`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&&ii(n)){let r=n[Ti]||``;r+=e.delta.partial_json;let i={...n};Object.defineProperty(i,Ti,{value:r,enumerable:!1,writable:!0}),r&&(i.input=Xn(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()}}})),Oi,ki=e((()=>{j(),k(),N(),Rr(),Rn(),F(),Oi=class extends A{create(e,t){return this._client.post(`/v1/messages/batches`,{body:e,...t})}retrieve(e,t){return this._client.get(P`/v1/messages/batches/${e}`,t)}list(e={},t){return this._client.getAPIList(`/v1/messages/batches`,en,{query:e,...t})}delete(e,t){return this._client.delete(P`/v1/messages/batches/${e}`,t)}cancel(e,t){return this._client.post(P`/v1/messages/batches/${e}/cancel`,t)}async results(e,t){let n=await this.retrieve(e);if(!n.results_url)throw new v(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...t,headers:M([{Accept:`application/binary`},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((e,t)=>Lr.fromResponse(t.response,t.controller))}}})),Ai,ji,Mi,Ni=e((()=>{j(),N(),An(),Di(),ri(),ki(),Bn(),Ai=class extends A{constructor(){super(...arguments),this.batches=new Oi(this._client)}create(e,t){e.model in ji&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${ji[e.model]}\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),e.model in Mi&&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=zn[e.model]??void 0;n=this._client.calculateNonstreamingTimeout(e.max_tokens,t)}let r=Dn(e.tools,e.messages);return this._client.post(`/v1/messages`,{body:e,timeout:n??6e5,...t,headers:M([r,t?.headers]),stream:e.stream??!1})}parse(e,t){return this.create(e,t).then(t=>ti(t,e,{logger:this._client.logger??console}))}stream(e,t){return Ei.createMessage(this,e,t,{logger:this._client.logger??console})}countTokens(e,t){return this._client.post(`/v1/messages/count_tokens`,{body:e,...t})}},ji={"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`},Mi=[`claude-opus-4-6`],Ai.Batches=Oi})),Pi,Fi=e((()=>{j(),k(),N(),F(),Pi=class extends A{retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(P`/v1/models/${e}`,{...n,headers:M([{...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`,en,{query:r,...t,headers:M([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()}},t?.headers])})}}})),Ii=e((()=>{Sn(),Xr(),Qr(),Ni(),Fi()})),Li,Ri=e((()=>{Li=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()}})),zi,Bi,Vi,Hi,Ui,Wi,X,Gi,Ki=e((()=>{_(),je(),et(),nt(),Pe(),ft(),vt(),bt(),St(),rt(),x(),k(),xn(),Ii(),Xt(),Qr(),Fi(),Xr(),Ni(),N(),Ri(),Rt(),Ui=`\\n\\nHuman:`,Wi=`\\n\\nAssistant:`,X=class{constructor({baseURL:e=Li(`ANTHROPIC_BASE_URL`),apiKey:t=Li(`ANTHROPIC_API_KEY`)??null,authToken:n=Li(`ANTHROPIC_AUTH_TOKEN`)??null,...r}={}){zi.add(this),Vi.set(this,void 0);let i={apiKey:t,authToken:n,...r,baseURL:e||`https://api.anthropic.com`};if(!i.dangerouslyAllowBrowser&&ot())throw new v(`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=i.baseURL,this.timeout=i.timeout??Bi.DEFAULT_TIMEOUT,this.logger=i.logger??console;let a=`warn`;this.logLevel=a,this.logLevel=Ft(i.logLevel,`ClientOptions.logLevel`,this)??Ft(Li(`ANTHROPIC_LOG`),`process.env['ANTHROPIC_LOG']`,this)??a,this.fetchOptions=i.fetchOptions,this.maxRetries=i.maxRetries??2,this.fetch=i.fetch??pt(),h(this,Vi,yt,`f`),this._options=i,this.apiKey=typeof t==`string`?t:null,this.authToken=n}withOptions(e){return new this.constructor({...this._options,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,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(e.get(`x-api-key`)||e.get(`authorization`))&&!(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 either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted`)}async authHeaders(e){return M([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey!=null)return M([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return M([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return xt(e)}getUserAgent(){return`${this.constructor.name}/JS ${S}`}defaultIdempotencyKey(){return`stainless-node-retry-${Ae()}`}makeStatusError(e,t,n,r){return y.generate(e,t,n,r)}buildURL(e,t,n){let r=!g(this,zi,`m`,Hi).call(this)&&n||this.baseURL,i=Ye(e)?new URL(e):new URL(r+(r.endsWith(`/`)&&e.startsWith(`/`)?e.slice(1):e)),a=this.defaultQuery(),o=Object.fromEntries(i.searchParams);return(!Ke(a)||!Ke(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 v(`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}){}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 Yt(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){let r=await e,i=r.maxRetries??this.maxRetries;t??(t=i),await this.prepareOptions(r);let{req:a,url:o,timeout:s}=await this.buildRequest(r,{retryCount:i-t});await this.prepareRequest(a,{url:o,options:r});let c=`log_`+(Math.random()*(1<<24)|0).toString(16).padStart(6,`0`),l=n===void 0?``:`, retryOf: ${n}`,u=Date.now();if(E(this).debug(`[${c}] sending request`,D({retryOfRequestLogID:n,method:r.method,url:o,options:r,headers:a.headers})),r.signal?.aborted)throw new b;let ee=new AbortController,d=await this.fetchWithTimeout(o,a,s,ee).catch(Ne),f=Date.now();if(d instanceof globalThis.Error){let e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new b;let i=Me(d)||/timed? ?out/i.test(String(d)+(`cause`in d?String(d.cause):``));if(t)return E(this).info(`[${c}] connection ${i?`timed out`:`failed`} - ${e}`),E(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (${e})`,D({retryOfRequestLogID:n,url:o,durationMs:f-u,message:d.message})),this.retryRequest(r,t,n??c);throw E(this).info(`[${c}] connection ${i?`timed out`:`failed`} - error; no more retries left`),E(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (error; no more retries left)`,D({retryOfRequestLogID:n,url:o,durationMs:f-u,message:d.message})),i?new Ie:new Fe({cause:d})}let p=`[${c}${l}${[...d.headers.entries()].filter(([e])=>e===`request-id`).map(([e,t])=>`, `+e+`: `+JSON.stringify(t)).join(``)}] ${a.method} ${o} ${d.ok?`succeeded`:`failed`} with status ${d.status} in ${f-u}ms`;if(!d.ok){let e=await this.shouldRetry(d);if(t&&e){let e=`retrying, ${t} attempts remaining`;return await _t(d.body),E(this).info(`${p} - ${e}`),E(this).debug(`[${c}] response error (${e})`,D({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,durationMs:f-u})),this.retryRequest(r,t,n??c,d.headers)}let i=e?`error; no more retries left`:`error; not retryable`;E(this).info(`${p} - ${i}`);let a=await d.text().catch(e=>Ne(e).message),o=$e(a),s=o?void 0:a;throw E(this).debug(`[${c}] response error (${i})`,D({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,message:s,durationMs:Date.now()-u})),this.makeStatusError(d.status,o,s,d.headers)}return E(this).info(p),E(this).debug(`[${c}] response start`,D({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,durationMs:f-u})),{response:d,options:r,controller:ee,requestLogID:c,retryOfRequestLogID:n,startTime:u}}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 $t(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){let t=e.headers.get(`x-should-retry`);return t===`true`?!0:t===`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 tt(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 v(`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,s=this.buildURL(i,a,o);`timeout`in n&&Qe(`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=M([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))}:{},...dt(),...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=M([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:ht(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)}:g(this,Vi,`f`).call(this,{body:e,headers:n})}},Bi=X,Vi=new WeakMap,zi=new WeakSet,Hi=function(){return this.baseURL!==`https://api.anthropic.com`},X.Anthropic=Bi,X.HUMAN_PROMPT=Ui,X.AI_PROMPT=Wi,X.DEFAULT_TIMEOUT=6e5,X.AnthropicError=v,X.APIError=y,X.APIConnectionError=Fe,X.APIConnectionTimeoutError=Ie,X.APIUserAbortError=b,X.NotFoundError=Be,X.ConflictError=Ve,X.RateLimitError=Ue,X.BadRequestError=Le,X.AuthenticationError=Re,X.InternalServerError=We,X.PermissionDeniedError=ze,X.UnprocessableEntityError=He,X.toFile=mn,Gi=class extends X{constructor(){super(...arguments),this.completions=new Zr(this),this.messages=new Ai(this),this.models=new Pi(this),this.beta=new G(this)}},Gi.Completions=Zr,Gi.Messages=Ai,Gi.Models=Pi,Gi.Beta=G})),qi=e((()=>{Ki(),xn(),Xt(),k(),x()}));function Ji(e){return e instanceof oa||e instanceof b||e instanceof Error&&e.name===`AbortError`}function Yi(e,t){return e instanceof Error&&e.message===t}function Xi(e){return e instanceof Error?e:Error(String(e))}function Zi(e){return e instanceof Error?e.message:String(e)}function Qi(e){if(e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`)return e.code}function $i(e){return Qi(e)===`ENOENT`}function ea(e){if(e&&typeof e==`object`&&`path`in e&&typeof e.path==`string`)return e.path}function ta(e,t=5){if(!(e instanceof Error))return String(e);if(!e.stack)return e.message;let n=e.stack.split(`
36
- `),r=n[0]??e.message,i=n.slice(1).filter(e=>e.trim().startsWith(`at `));return i.length<=t?e.stack:[r,...i.slice(0,t)].join(`
37
- `)}function na(e){let t=Qi(e);return t===`ENOENT`||t===`EACCES`||t===`EPERM`||t===`ENOTDIR`||t===`ELOOP`}function ra(e){let t=Zi(e);if(!e||typeof e!=`object`||!(`isAxiosError`in e)||!e.isAxiosError)return{kind:`other`,message:t};let n=e,r=n.response?.status;return r===401||r===403?{kind:`auth`,status:r,message:t}:n.code===`ECONNABORTED`?{kind:`timeout`,status:r,message:t}:n.code===`ECONNREFUSED`||n.code===`ENOTFOUND`?{kind:`network`,status:r,message:t}:{kind:`http`,status:r,message:t}}var ia,aa,oa,sa,ca,la,ua,da=e((()=>{qi(),s(),ia=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},aa=class extends Error{},oa=class extends Error{constructor(e){super(e),this.name=`AbortError`}},sa=class extends Error{constructor(e,t,n){super(e),c(this,`filePath`,void 0),c(this,`defaultConfig`,void 0),this.name=`ConfigParseError`,this.filePath=t,this.defaultConfig=n}},ca=class extends Error{constructor(e,t,n,r){super(`Shell command failed`),c(this,`stdout`,void 0),c(this,`stderr`,void 0),c(this,`code`,void 0),c(this,`interrupted`,void 0),this.stdout=e,this.stderr=t,this.code=n,this.interrupted=r,this.name=`ShellError`}},la=class extends Error{constructor(e,t){super(e),c(this,`formattedMessage`,void 0),this.formattedMessage=t,this.name=`TeleportOperationError`}},ua=class extends Error{constructor(e,t){super(e),c(this,`telemetryMessage`,void 0),this.name=`TelemetrySafeError`,this.telemetryMessage=t??e}}}));function fa(){return ga}function pa(e,t,n){return Z`JSON.stringify(${e})`,JSON.stringify(e,t,n)}function ma(e,t){return Z`structuredClone(${e})`,structuredClone(e,t)}function ha(e,t,n){if(Z`fs.writeFileSync(${e}, ${t})`,typeof n==`object`&&n&&`flush`in n&&n.flush===!0){let r=typeof n==`object`&&`encoding`in n?n.encoding:void 0,i=typeof n==`object`&&`mode`in n?n.mode:void 0,a;try{a=oe(e,`w`,i),se(a,t,{encoding:r??void 0}),ae(a)}finally{a!==void 0&&ie(a)}}else se(e,t,n)}var ga,Z,_a,va=e((()=>{l(),$a(),(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})(),ga={[Symbol.dispose](){}},Z=fa,_a=(e,t)=>(Z`JSON.parse(${e})`,t===void 0?JSON.parse(e):JSON.parse(e,t))}));function ya(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,i=this.e,a=0;function o(){for(;r=n.pop();)try{if(!r.a&&a===1)return a=0,n.push(r),Promise.resolve().then(o);if(r.d){var e=r.d.call(r.v);if(r.a)return a|=2,Promise.resolve(e).then(o,s)}else a|=1}catch(e){return s(e)}if(a===1)return i===t?Promise.resolve():Promise.reject(i);if(i!==t)throw i}function s(n){return i=i===t?n:new e(n,i),o()}return o()}}}var ba=e((()=>{}));function xa(e,t){if(t.startsWith(`//`)||t.startsWith(`\\\\`))return{resolvedPath:t,isSymlink:!1,isCanonical:!1};try{let n=e.lstatSync(t);if(n.isFIFO()||n.isSocket()||n.isCharacterDevice()||n.isBlockDevice())return{resolvedPath:t,isSymlink:!1,isCanonical:!1};let r=e.realpathSync(t);return{resolvedPath:r,isSymlink:r!==t,isCanonical:!0}}catch{return{resolvedPath:t,isSymlink:!1,isCanonical:!1}}}function Sa(e,t,n){let{resolvedPath:r}=xa(e,t);return n.has(r)?!0:(n.add(r),!1)}function Ca(e,t){let n=t,r=[];for(;n!==p.dirname(n);){let t;try{t=e.lstatSync(n)}catch{r.unshift(p.basename(n)),n=p.dirname(n);continue}if(t.isSymbolicLink())try{let t=e.realpathSync(n);return r.length===0?t:p.join(t,...r)}catch{let t=e.readlinkSync(n),i=p.isAbsolute(t)?t:p.resolve(p.dirname(n),t);return r.length===0?i:p.join(i,...r)}try{let t=e.realpathSync(n);if(t!==n)return r.length===0?t:p.join(t,...r)}catch{}return}}function wa(e){let t=e;t===`~`?t=f().normalize(`NFC`):t.startsWith(`~/`)&&(t=p.join(f().normalize(`NFC`),t.slice(2)));let n=new Set,r=Ta();if(n.add(t),t.startsWith(`//`)||t.startsWith(`\\\\`))return Array.from(n);try{let e=t,i=new Set;for(let a=0;a<40&&!i.has(e);a++){if(i.add(e),!r.existsSync(e)){if(e===t){let e=Ca(r,t);e!==void 0&&n.add(e)}break}let a=r.lstatSync(e);if(a.isFIFO()||a.isSocket()||a.isCharacterDevice()||a.isBlockDevice()||!a.isSymbolicLink())break;let o=r.readlinkSync(e),s=p.isAbsolute(o)?o:p.resolve(p.dirname(e),o);n.add(s),e=s}}catch{}let{resolvedPath:i,isSymlink:a}=xa(r,t);return a&&i!==t&&n.add(i),Array.from(n)}function Ta(){return Aa}async function Ea(e,t,n){try{var r=ya();let i=r.a(await ue(e,`r`)),a=(await i.stat()).size;if(a<=t)return null;let o=Math.min(a-t,n),s=Buffer.allocUnsafe(o),c=0;for(;c<o;){let{bytesRead:e}=await i.read(s,c,o-c,t+c);if(e===0)break;c+=e}return{content:s.toString(`utf8`,0,c),bytesRead:c,bytesTotal:a}}catch(e){r.e=e}finally{await r.d()}}async function Da(e,t){try{var n=ya();let r=n.a(await ue(e,`r`)),i=(await r.stat()).size;if(i===0)return{content:``,bytesRead:0,bytesTotal:0};let a=Math.max(0,i-t),o=i-a,s=Buffer.allocUnsafe(o),c=0;for(;c<o;){let{bytesRead:e}=await r.read(s,c,o-c,a+c);if(e===0)break;c+=e}return{content:s.toString(`utf8`,0,c),bytesRead:c,bytesTotal:i}}catch(e){n.e=e}finally{await n.d()}}async function*Oa(e){let t=1024*4,n=await ue(e,`r`);try{let e=(await n.stat()).size,r=Buffer.alloc(0),i=Buffer.alloc(t);for(;e>0;){let a=Math.min(t,e);e-=a,await n.read(i,0,a,e);let o=Buffer.concat([i.subarray(0,a),r]),s=o.indexOf(10);if(s===-1){r=o;continue}r=Buffer.from(o.subarray(0,s));let c=o.toString(`utf8`,s+1).split(`
38
- `);for(let e=c.length-1;e>=0;e--){let t=c[e];t&&(yield t)}}r.length>0&&(yield r.toString(`utf8`))}finally{await n.close()}}var ka,Aa,ja=e((()=>{da(),va(),ba(),ka={cwd(){return process.cwd()},existsSync(e){return Z`fs.existsSync(${e})`,m.existsSync(e)},async stat(e){return ge(e)},async readdir(e){return fe(e,{withFileTypes:!0})},async unlink(e){return ve(e)},async rmdir(e){return he(e)},async rm(e,t){return me(e,t)},async mkdir(e,t){try{await le(e,{recursive:!0,...t})}catch(e){if(Qi(e)!==`EEXIST`)throw e}},async readFile(e,t){return de(e,{encoding:t.encoding})},async rename(e,t){return pe(e,t)},statSync(e){return Z`fs.statSync(${e})`,m.statSync(e)},lstatSync(e){return Z`fs.lstatSync(${e})`,m.lstatSync(e)},readFileSync(e,t){return Z`fs.readFileSync(${e})`,m.readFileSync(e,{encoding:t.encoding})},readFileBytesSync(e){return Z`fs.readFileBytesSync(${e})`,m.readFileSync(e)},readSync(e,t){Z`fs.readSync(${e}, ${t.length} bytes)`;let n;try{n=m.openSync(e,`r`);let r=Buffer.alloc(t.length);return{buffer:r,bytesRead:m.readSync(n,r,0,t.length,0)}}finally{n&&m.closeSync(n)}},appendFileSync(e,t,n){if(Z`fs.appendFileSync(${e}, ${t.length} chars)`,n?.mode!==void 0)try{let r=m.openSync(e,`ax`,n.mode);try{m.appendFileSync(r,t)}finally{m.closeSync(r)}return}catch(e){if(Qi(e)!==`EEXIST`)throw e}m.appendFileSync(e,t)},copyFileSync(e,t){Z`fs.copyFileSync(${e} → ${t})`,m.copyFileSync(e,t)},unlinkSync(e){Z`fs.unlinkSync(${e})`,m.unlinkSync(e)},renameSync(e,t){Z`fs.renameSync(${e} → ${t})`,m.renameSync(e,t)},linkSync(e,t){Z`fs.linkSync(${e} → ${t})`,m.linkSync(e,t)},symlinkSync(e,t,n){Z`fs.symlinkSync(${e} → ${t})`,m.symlinkSync(e,t,n)},readlinkSync(e){return Z`fs.readlinkSync(${e})`,m.readlinkSync(e)},realpathSync(e){return Z`fs.realpathSync(${e})`,m.realpathSync(e).normalize(`NFC`)},mkdirSync(e,t){Z`fs.mkdirSync(${e})`;let n={recursive:!0};t?.mode!==void 0&&(n.mode=t.mode);try{m.mkdirSync(e,n)}catch(e){if(Qi(e)!==`EEXIST`)throw e}},readdirSync(e){return Z`fs.readdirSync(${e})`,m.readdirSync(e,{withFileTypes:!0})},readdirStringSync(e){return Z`fs.readdirStringSync(${e})`,m.readdirSync(e)},isDirEmptySync(e){return Z`fs.isDirEmptySync(${e})`,this.readdirSync(e).length===0},rmdirSync(e){Z`fs.rmdirSync(${e})`,m.rmdirSync(e)},rmSync(e,t){Z`fs.rmSync(${e})`,m.rmSync(e,t)},createWriteStream(e){return m.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return de(e);let n=await ue(e,`r`);try{let{size:e}=await n.stat(),r=Math.min(e,t),i=Buffer.allocUnsafe(r),a=0;for(;a<r;){let{bytesRead:e}=await n.read(i,a,r-a,a);if(e===0)break;a+=e}return a<r?i.subarray(0,a):i}finally{await n.close()}}},Aa=ka})),Ma=t({enableDebugLogging:()=>Na,flushDebugLogs:()=>Ba,getDebugFilePath:()=>Ya,getDebugFilter:()=>qa,getDebugLogPath:()=>Ha,getHasFormattedOutput:()=>Ia,getMinDebugLogLevel:()=>Ga,isDebugMode:()=>Q,isDebugToStdErr:()=>Ja,logAntError:()=>Ua,logForDebugging:()=>Va,setHasFormattedOutput:()=>Fa});function Na(){let e=Q();return Ka=!0,Q.cache.clear?.(),e}function Pa(e){return!Q()||typeof process>`u`||process.versions===void 0||process.versions.node===void 0?!1:De(e,qa())}function Fa(e){Xa=e}function Ia(){return Xa}async function La(e,t,n,r){e&&await le(t,{recursive:!0}).catch(()=>{}),await ce(n,r),Qa()}function Ra(){}function za(){if(!$){let e=null;$=ye({writeFn:t=>{let n=Ha(),r=te(n),i=e!==r;if(e=r,Q()){if(i)try{Ta().mkdirSync(r)}catch{}try{Ta().appendFileSync(n,t)}catch{try{Ta().mkdirSync(r),Ta().appendFileSync(n,t)}catch{}}Qa();return}Za=Za.then(La.bind(null,i,r,n,t)).catch(Ra)},flushIntervalMs:1e3,maxBufferSize:100,immediateMode:Q()}),xe(async()=>{$?.dispose(),await Za})}return $}async function Ba(){$?.flush(),await Za}function Va(e,{level:t}={level:`debug`}){if(Wa[t]<Wa[Ga()]||!Pa(e))return;Xa&&e.includes(`
39
- `)&&(e=pa(e));let n=`${new Date().toISOString()} [${t.toUpperCase()}] ${e.trim()}\n`;if(Ja()){ee(n);return}za().write(n)}function Ha(){return Ya()??(process.env.CLAUDE_CODE_DEBUG_LOGS_DIR?re(process.env.CLAUDE_CODE_DEBUG_LOGS_DIR):null)??ne(a(),`debug`,`${u()}.txt`)}function Ua(e,t){t instanceof Error&&t.stack&&Va(`[ANT-ONLY] ${e} stack trace:\n${t.stack}`,{level:`error`})}var Wa,Ga,Ka,Q,qa,Ja,Ya,Xa,$,Za,Qa,$a=e((()=>{r(),l(),be(),we(),ke(),o(),ja(),d(),va(),Wa={verbose:0,debug:1,info:2,warn:3,error:4},Ga=n(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();return e&&Object.hasOwn(Wa,e)?e:`debug`}),Ka=!1,Q=n(()=>Ka||i(process.env.DEBUG)||i(process.env.DEBUG_SDK)||process.argv.includes(`--debug`)||process.argv.includes(`-d`)||Ja()||process.argv.some(e=>e.startsWith(`--debug=`))||Ya()!==null),qa=n(()=>{let e=process.argv.find(e=>e.startsWith(`--debug=`));return e?Oe(e.substring(8)):null}),Ja=n(()=>process.argv.includes(`--debug-to-stderr`)),Ya=n(()=>{for(let e=0;e<process.argv.length;e++){let t=process.argv[e];if(t.startsWith(`--debug-file=`))return re(t.substring(13));if(t===`--debug-file`&&e+1<process.argv.length)return re(process.argv[e+1])}return null}),Xa=!1,$=null,Za=Promise.resolve(),Qa=n(async()=>{try{let e=Ha(),t=ne(te(e),`latest`);await ve(t).catch(()=>{}),await _e(e,t)}catch{}})}));export{Re as $,aa as A,Ji as B,_a as C,oa as D,ha as E,Zi as F,qi as G,na as H,Qi as I,Rn as J,Gi as K,ea as L,ua as M,la as N,ia as O,ra as P,b as Q,Yi as R,va as S,Z as T,ta as U,$i as V,Xi as W,Ie as X,Fe as Y,y as Z,xa as _,$a as a,ye as at,ba as b,Ua as c,Ta as d,Be as et,wa as f,Oa as g,Ea as h,Ia as i,Se as it,ca as j,sa as k,Va as l,Sa as m,Na as n,we as nt,Q as o,be as ot,ja as p,Ki as q,Ha as r,xe as rt,Ja as s,Ma as t,x as tt,Fa as u,Da as v,pa as w,ma as x,ya as y,da as z};
@@ -1 +0,0 @@
1
- import{a as e,i as t,o as n}from"./detectRepository-DvxoaPlk.js";t();export{e as parseGitHubRepository,n as parseGitRemote};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-L4wygFqJ.js";import{a as r,l as i}from"./debug-BdqxZ7rV.js";import{m as a,u as o}from"./git-B9uvt96d.js";function s(){p.clear()}async function c(){let e=await l();return!e||e.host!==`github.com`?null:`${e.owner}/${e.name}`}async function l(){let e=n();if(p.has(e))return p.get(e)??null;try{let t=await o();if(i(`Git remote URL: ${t}`),!t)return i(`No git remote URL found`),p.set(e,null),null;let n=u(t);return i(`Parsed repository: ${n?`${n.host}/${n.owner}/${n.name}`:null} from URL: ${t}`),p.set(e,n),n}catch(t){return i(`Error detecting repository: ${t}`),p.set(e,null),null}}function u(e){let t=e.trim(),n=t.match(/^git@([^:]+):([^/]+)\/([^/]+?)(?:\.git)?$/);if(n?.[1]&&n[2]&&n[3])return f(n[1])?{host:n[1],owner:n[2],name:n[3]}:null;let r=t.match(/^(https?|ssh|git):\/\/(?:[^@]+@)?([^/:]+(?::\d+)?)\/([^/]+)\/([^/]+?)(?:\.git)?$/);if(r?.[1]&&r[2]&&r[3]&&r[4]){let e=r[1],t=r[2],n=t.split(`:`)[0]??``;return f(n)?{host:e===`https`||e===`http`?t:n,owner:r[3],name:r[4]}:null}return null}function d(e){let t=e.trim(),n=u(t);if(n)return n.host===`github.com`?`${n.owner}/${n.name}`:null;if(!t.includes(`://`)&&!t.includes(`@`)&&t.includes(`/`)){let e=t.split(`/`);if(e.length===2&&e[0]&&e[1]){let t=e[1].replace(/\.git$/,``);return`${e[0]}/${t}`}}return i(`Could not parse repository from: ${t}`),null}function f(e){if(!e.includes(`.`))return!1;let t=e.split(`.`).pop();return t?/^[a-zA-Z]+$/.test(t):!1}var p,m=e((()=>{t(),r(),a(),p=new Map}));export{d as a,m as i,c as n,u as o,l as r,s as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Doctor-D160J8Ad.js";var i,a;e((()=>{n(),i=t(),a=(e,t,n)=>Promise.resolve((0,i.jsx)(r,{onDone:e}))}))();export{a as call};
@@ -1 +0,0 @@
1
- import{r as e}from"./earlyInput-BTC_Wucv.js";export{e as startCapturingEarlyInput};