@readmagic/workmate 0.0.18 → 0.0.20

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 (384) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-Wa6Q24nu.js → AddWorkspaceDirectory-BYNvxNrD.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-BSSz86ER.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-3I_KlOLv.js → AgentsMdExternalIncludesDialog-CMEGV4Md.js} +1 -1
  4. package/dist/chunks/{App-BgPs1Bu8.js → App-W_9d1DjK.js} +1 -1
  5. package/dist/chunks/{ApproveApiKey-BxpapUq0.js → ApproveApiKey-Bf1Rb8Ql.js} +1 -1
  6. package/dist/chunks/ApproveApiKey-wpdvXpFr.js +1 -0
  7. package/dist/chunks/BackgroundTasksDialog-lGn1Wj1k.js +2 -0
  8. package/dist/chunks/{BypassPermissionsModeDialog-8Cq982M0.js → BypassPermissionsModeDialog-CjVjyNf8.js} +1 -1
  9. package/dist/chunks/{DiffDialog-DwQTDWYh.js → DiffDialog-DCpchgp5.js} +2 -2
  10. package/dist/chunks/Doctor-6SjW91rd.js +1 -0
  11. package/dist/chunks/Doctor-FPYTivHw.js +3 -0
  12. package/dist/chunks/ExitFlow-Dy8_1D8J.js +2 -0
  13. package/dist/chunks/{Grove-_QX_wR9C.js → Grove-Dd6rjs5P.js} +1 -1
  14. package/dist/chunks/{HybridTransport-BG2VIIBC.js → HybridTransport-CJVkWa2u.js} +1 -1
  15. package/dist/chunks/{InvalidConfigDialog-BDdMkuaL.js → InvalidConfigDialog-Bisj9ic_.js} +1 -1
  16. package/dist/chunks/{InvalidSettingsDialog-DSCqbVER.js → InvalidSettingsDialog-DyTPNRQR.js} +1 -1
  17. package/dist/chunks/MCPConnectionManager-DfyoZaiu.js +1 -0
  18. package/dist/chunks/MCPToolListView-Dioupv8F.js +1 -0
  19. package/dist/chunks/{McpParsingWarnings-Cr_n2QR6.js → McpParsingWarnings-BUlgpZAF.js} +1 -1
  20. package/dist/chunks/MessageSelector-D8fylxPg.js +3 -0
  21. package/dist/chunks/Messages-BZDFMYBT.js +10 -0
  22. package/dist/chunks/{Onboarding-Cz3CfOTl.js → Onboarding-BKLomZYo.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-GhA5Qa1I.js → PromptInputFooterSuggestions-DCum89fF.js} +1 -1
  24. package/dist/chunks/{PromptInputHelpMenu-sX_yHORM.js → PromptInputHelpMenu-DG2lRqis.js} +1 -1
  25. package/dist/chunks/QueryEngine-CyGHpX7M.js +1 -0
  26. package/dist/chunks/REPL-BDsz8KIx.js +1 -0
  27. package/dist/chunks/REPL-CCBNfZfs.js +128 -0
  28. package/dist/chunks/RemoteSessionManager-BfsOv4K6.js +2 -0
  29. package/dist/chunks/{ResumeConversation-e5sISbWn.js → ResumeConversation-pC8NLq0F.js} +1 -1
  30. package/dist/chunks/{SSETransport-BuDKErlN.js → SSETransport-B3K6eH9I.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-DYoxHo9T.js +1 -0
  32. package/dist/chunks/Settings-CKaGmKg2.js +2 -0
  33. package/dist/chunks/{TeleportProgress-BUtze4qa.js → TeleportProgress-CkgSp1cs.js} +1 -1
  34. package/dist/chunks/{TeleportRepoMismatchDialog-Dp7rzrrz.js → TeleportRepoMismatchDialog-DdO_rECq.js} +1 -1
  35. package/dist/chunks/{TeleportResumeWrapper-Ch2osY21.js → TeleportResumeWrapper-BeG4N-2z.js} +1 -1
  36. package/dist/chunks/{ThemePicker-AA-0hjpq.js → ThemePicker-iD9ufy99.js} +1 -1
  37. package/dist/chunks/{TrustDialog-rO5dZ8G-.js → TrustDialog-qO5OdQt8.js} +1 -1
  38. package/dist/chunks/{ValidationErrorsList-DayOwxq9.js → ValidationErrorsList-BfZ5gcIv.js} +1 -1
  39. package/dist/chunks/add-dir-C4eSVlZ6.js +1 -0
  40. package/dist/chunks/{agentDisplay-nVTmC7tL.js → agentDisplay-BM4QG_RX.js} +1 -1
  41. package/dist/chunks/{agents-BQwi-6GV.js → agents-BbDBN5l9.js} +1 -1
  42. package/dist/chunks/agents-D3APE_8d.js +101 -0
  43. package/dist/chunks/allErrors-BkgB7JNK.js +1 -0
  44. package/dist/chunks/api-BHBK9axp.js +1 -0
  45. package/dist/chunks/{api-DAyhTxgY.js → api-DyUWfg3a.js} +1 -1
  46. package/dist/chunks/{auth-BzrroWLq.js → auth-0rn1U4Eq.js} +1 -1
  47. package/dist/chunks/auth-BEoTPSgC.js +1 -0
  48. package/dist/chunks/auth-BPug7U_u.js +1 -0
  49. package/dist/chunks/backgroundHousekeeping-D7xAhUaE.js +1 -0
  50. package/dist/chunks/backgroundHousekeeping-km82qEh0.js +17 -0
  51. package/dist/chunks/{banner-BfIcVEUU.js → banner-BkUdig-T.js} +1 -1
  52. package/dist/chunks/{bg-C15c_rMK.js → bg-tGgpwpYx.js} +2 -2
  53. package/dist/chunks/branch-CQ38cx5n.js +2 -0
  54. package/dist/chunks/{break-cache-XKbOAw-u.js → break-cache-CcwOjTKt.js} +3 -3
  55. package/dist/chunks/{bridgeConfig-Bxkrv8ZL.js → bridgeConfig-C5L-7KaP.js} +1 -1
  56. package/dist/chunks/bridgeConfig-CJMjDoaP.js +1 -0
  57. package/dist/chunks/{bridgeMessaging-BcSjIPCZ.js → bridgeMessaging-DVC3qj-C.js} +1 -1
  58. package/dist/chunks/{bridgePointer-CGhOBNMg.js → bridgePointer-DfTOjgtX.js} +1 -1
  59. package/dist/chunks/{bridgeStatusUtil-DBWBTU31.js → bridgeStatusUtil-Cex6VowM.js} +1 -1
  60. package/dist/chunks/btw-_P96ffHR.js +1 -0
  61. package/dist/chunks/caches-DH-q8Fjf.js +1 -0
  62. package/dist/chunks/caches-Dq0pJFDP.js +1 -0
  63. package/dist/chunks/{capacityWake-C24_KT1x.js → capacityWake-BpP6c7x3.js} +1 -1
  64. package/dist/chunks/{ccrClient-CH6PsxJJ.js → ccrClient-DO563xlf.js} +1 -1
  65. package/dist/chunks/{claudeDesktop-CovdLe-b.js → claudeDesktop-DPc_SaVn.js} +1 -1
  66. package/dist/chunks/{clear-D72LxXA6.js → clear-DmqQBNKg.js} +1 -1
  67. package/dist/chunks/{cliLaunch-DDA65zeR.js → cliLaunch-DDtwAolw.js} +1 -1
  68. package/dist/chunks/{client-o5_awagP.js → client-9uHzAmFH.js} +1 -1
  69. package/dist/chunks/client-BVal_QII.js +1 -0
  70. package/dist/chunks/client-C19cqYQS.js +1 -0
  71. package/dist/chunks/{client-eLOYyeES.js → client-C_jBL1yC.js} +1 -1
  72. package/dist/chunks/client-Dd7CKMRX.js +1 -0
  73. package/dist/chunks/commands-BkpqHY9F.js +1 -0
  74. package/dist/chunks/{compact--fnu8Zd-.js → compact-DuVIvqMu.js} +2 -2
  75. package/dist/chunks/config-DMP6-Ccr.js +1 -0
  76. package/dist/chunks/{config-BybjRr09.js → config-DRy1I12M.js} +2 -2
  77. package/dist/chunks/{config-BlQhL9Bh.js → config-e0Goy478.js} +1 -1
  78. package/dist/chunks/{context-D6PaqwrR.js → context-DjgMzIfe.js} +1 -1
  79. package/dist/chunks/{context-noninteractive-CxoMCfR4.js → context-noninteractive-BzDVMnWC.js} +5 -5
  80. package/dist/chunks/context-noninteractive-DV7bIJCm.js +1 -0
  81. package/dist/chunks/conversation-BBOE_EoE.js +1 -0
  82. package/dist/chunks/conversation-WxH5pb2z.js +1 -0
  83. package/dist/chunks/{createSSHSession-B3FdForb.js → createSSHSession-LVGVXHXL.js} +1 -1
  84. package/dist/chunks/createSession-BUzna9-E.js +1 -0
  85. package/dist/chunks/{createSession-C0e_DHsW.js → createSession-Dgwxk1WA.js} +1 -1
  86. package/dist/chunks/crossProjectResume-6B2NYy8a.js +40 -0
  87. package/dist/chunks/cwd-DLK3znO7.js +1 -0
  88. package/dist/chunks/cwd-Nh5IZNKO.js +1 -0
  89. package/dist/chunks/{datadog-ZxeaKwKd.js → datadog-Bc6wkPne.js} +1 -1
  90. package/dist/chunks/{debug-D7OBvqC2.js → debug-D58GQBDG.js} +1 -1
  91. package/dist/chunks/{debugUtils-B-GMBTBk.js → debugUtils-DXBRbwCE.js} +1 -1
  92. package/dist/chunks/{detached-uMuMcLsV.js → detached-Biz-xhu0.js} +1 -1
  93. package/dist/chunks/{detectRepository-AVEUw4lk.js → detectRepository-CDOJ-M7h.js} +1 -1
  94. package/dist/chunks/detectRepository-Cv9-k6dg.js +1 -0
  95. package/dist/chunks/{diff-BA2vN7sD.js → diff-DIg66U_d.js} +1 -1
  96. package/dist/chunks/{directoryCompletion-CLcmLin8.js → directoryCompletion-BDGcGDuv.js} +1 -1
  97. package/dist/chunks/doctor-BhUmhHQU.js +1 -0
  98. package/dist/chunks/{entry-cou5DS53.js → entry-B-Y-AYeK.js} +4 -4
  99. package/dist/chunks/{esm-D9-9wS1F.js → esm-CvHtYRrr.js} +1 -1
  100. package/dist/chunks/{execFileNoThrow-BHDSgTpZ.js → execFileNoThrow-Bmb5HEFz.js} +1 -1
  101. package/dist/chunks/{execSyncWrapper-pYxQXqb-.js → execSyncWrapper-C3ZFV9od.js} +1 -1
  102. package/dist/chunks/{exit-DdZJHhy2.js → exit-CW2eqUrR.js} +1 -1
  103. package/dist/chunks/{extraUsage-CHnG6JNH.js → extraUsage-CkTon7ib.js} +1 -1
  104. package/dist/chunks/extractMemories-CfmbvayQ.js +1 -0
  105. package/dist/chunks/fast-ByahC7Gw.js +1 -0
  106. package/dist/chunks/{fast-Bl_0cs9e.js → fast-xtIP4u4y.js} +1 -1
  107. package/dist/chunks/fetchModelList-D9aePIPW.js +1 -0
  108. package/dist/chunks/{fetchModelList-CheIBH5f.js → fetchModelList-Dy-x4h3G.js} +1 -1
  109. package/dist/chunks/{fileSuggestions-Dl87JhBr.js → fileSuggestions-CFkJktgc.js} +2 -2
  110. package/dist/chunks/firstPartyEventLogger-Bt9iG9xk.js +1 -0
  111. package/dist/chunks/{firstPartyEventLogger-Cw9Bc3on.js → firstPartyEventLogger-DqGSujCz.js} +2 -2
  112. package/dist/chunks/{flushGate-BD3Tk3_k.js → flushGate-BjKW7PFC.js} +1 -1
  113. package/dist/chunks/{gemini-BARUjH_t.js → gemini-NnmxBoEp.js} +1 -1
  114. package/dist/chunks/{generateSessionName-CHaK44K-.js → generateSessionName-EpqGW-T2.js} +1 -1
  115. package/dist/chunks/{genericProcessUtils-D5hCZ2ho.js → genericProcessUtils-6E7fB1dI.js} +1 -1
  116. package/dist/chunks/{git-CNhyfMtb.js → git-By_J4XJL.js} +1 -1
  117. package/dist/chunks/git-zJCasBa6.js +1 -0
  118. package/dist/chunks/githubRepoPathMapping-CzgPGOHQ.js +1 -0
  119. package/dist/chunks/{goal-fTQFogdl.js → goal-DbS8yJfB.js} +1 -1
  120. package/dist/chunks/{grok-D0J4IiCe.js → grok-BxZ4vTDw.js} +1 -1
  121. package/dist/chunks/{grove-mDH4wkhM.js → grove-CYE1Cfcz.js} +1 -1
  122. package/dist/chunks/{help-Dr7st1Yv.js → help-DatnwM25.js} +1 -1
  123. package/dist/chunks/{hooks-DCfpFhl2.js → hooks-7iyENdDG.js} +2 -2
  124. package/dist/chunks/hooks-DjbqtbUV.js +1 -0
  125. package/dist/chunks/initReplBridge-BEZW5PEY.js +1 -0
  126. package/dist/chunks/install-DJukI-kL.js +1 -0
  127. package/dist/chunks/{instrumentation-DS2S1m1a.js → instrumentation-2HH15DPu.js} +4 -4
  128. package/dist/chunks/{job-Dry-GMc5.js → job-CXz7SLZp.js} +1 -1
  129. package/dist/chunks/{jwtUtils-ClCcC8lO.js → jwtUtils-C_LG1txt.js} +1 -1
  130. package/dist/chunks/keybindings-C9l5il16.js +1 -0
  131. package/dist/chunks/{launchLocalMemory-_T0oHfh9.js → launchLocalMemory-BfGenqj1.js} +1 -1
  132. package/dist/chunks/{launchOnboarding-D4fS6pLc.js → launchOnboarding-DjMmXeQE.js} +1 -1
  133. package/dist/chunks/{loadAgentsDir-DnsldjYU.js → loadAgentsDir-DaNpxaO-.js} +588 -623
  134. package/dist/chunks/loadAgentsDir-DcI-8FQF.js +1 -0
  135. package/dist/chunks/{loadPluginHooks-CRoYa_il.js → loadPluginHooks-CGgpcyEC.js} +1 -1
  136. package/dist/chunks/{loader-C-PQ3onD.js → loader-C33o_5kS.js} +1 -1
  137. package/dist/chunks/{localSearch-nuNjYVKq.js → localSearch-C2SZ9bGW.js} +1 -1
  138. package/dist/chunks/localSearch-CTTwYTU1.js +1 -0
  139. package/dist/chunks/{log-CR0v5KUR.js → log-CZ7ploQm.js} +1 -1
  140. package/dist/chunks/{logoV2Utils-CZwL_VX1.js → logoUtils-CbIqOFrX.js} +1 -1
  141. package/dist/chunks/{magicDocs-D0rjtxup.js → magicDocs-CrTwULyJ.js} +2 -2
  142. package/dist/chunks/{main-DKqCPH3G.js → main-Blm02_Js.js} +2 -2
  143. package/dist/chunks/{main-C8n_p7yX.js → main-bJXadFi0.js} +30 -30
  144. package/dist/chunks/managedEnv-CUsdYhAI.js +1 -0
  145. package/dist/chunks/managedEnv-DXeaUDSK.js +1 -0
  146. package/dist/chunks/{mappers-BIDALdjB.js → mappers-_B-s9fNz.js} +1 -1
  147. package/dist/chunks/mcp-BbbYzWpy.js +6 -0
  148. package/dist/chunks/mcp-D91sH9a8.js +1 -0
  149. package/dist/chunks/mcp-Dx-zgUgu.js +2 -0
  150. package/dist/chunks/{memoize-C7xmvAQ0.js → memoize-CumjjK2Q.js} +1 -1
  151. package/dist/chunks/memory-BeL7ui9m.js +1 -0
  152. package/dist/chunks/{mode-CajUX4Uz.js → mode-D695kgLI.js} +1 -1
  153. package/dist/chunks/model-DX0TtzqX.js +1 -0
  154. package/dist/chunks/{model-xI2MbgRj.js → model-Do0f476p.js} +1 -1
  155. package/dist/chunks/model-DpcM8dz5.js +1 -0
  156. package/dist/chunks/{modelOptions-Ct80yABl.js → modelOptions-B3nis9cC.js} +1 -1
  157. package/dist/chunks/{src-l6_O0K-a.js → modifiersNative-BYHdmWw1.js} +1 -1
  158. package/dist/chunks/modifiersNative-D7nm70eq.js +1 -0
  159. package/dist/chunks/{nativeInstaller-C6aWHxve.js → nativeInstaller-CymO8TNe.js} +1 -1
  160. package/dist/chunks/omit-DO61BHZu.js +1 -0
  161. package/dist/chunks/onChangeAppState-vKml_lit.js +1 -0
  162. package/dist/chunks/{openai-wsPCDwGL.js → openai-DdupGVdC.js} +2 -2
  163. package/dist/chunks/{panel-BKMLX5AR.js → panel-CVd1dzYl.js} +1 -1
  164. package/dist/chunks/parser-Cq9X7HMP.js +1 -0
  165. package/dist/chunks/{parser-Dy-RMf4a.js → parser-eVu-cTRs.js} +1 -1
  166. package/dist/chunks/partition-BivH9MBJ.js +1 -0
  167. package/dist/chunks/permissions-C9iqR4_N.js +3 -0
  168. package/dist/chunks/pidLock-DiKz5Tza.js +3 -0
  169. package/dist/chunks/{plan-CTiLy_c4.js → plan-KDN5IGWY.js} +1 -1
  170. package/dist/chunks/{platform-BZm4WVLM.js → platform-DMQxcm4K.js} +1 -1
  171. package/dist/chunks/plugin-D0rzUb8E.js +17 -0
  172. package/dist/chunks/{pluginAutoupdate-DzK-fXJC.js → pluginAutoupdate-C2xTKLR_.js} +1 -1
  173. package/dist/chunks/{pluginBlocklist-B3JVl1h2.js → pluginBlocklist-xdiUmUpt.js} +1 -1
  174. package/dist/chunks/{pluginCliCommands-CubOvlhc.js → pluginCliCommands-CIDDvVN7.js} +1 -1
  175. package/dist/chunks/{pluginFlagging-Dp7W2eL8.js → pluginFlagging-DRA0m76J.js} +1 -1
  176. package/dist/chunks/pluginOperations-BEYsarAn.js +2 -0
  177. package/dist/chunks/{pluginStartupCheck-CL24_zVV.js → pluginStartupCheck-BF1N4Lih.js} +1 -1
  178. package/dist/chunks/pluginStartupCheck-DVkI4pqo.js +1 -0
  179. package/dist/chunks/{plugins-DA3lpRU4.js → plugins-CWWU4BKs.js} +4 -4
  180. package/dist/chunks/poorMode-BTIe8W_H.js +1 -0
  181. package/dist/chunks/poorMode-CKQfWf3S.js +1 -0
  182. package/dist/chunks/print-B5H2xbBS.js +14 -0
  183. package/dist/chunks/processBashCommand-EQ9EWaRV.js +1 -0
  184. package/dist/chunks/processSlashCommand-C4PKNyFT.js +5 -0
  185. package/dist/chunks/{prompt-CzQkcxfg.js → prompt-8u06WVES.js} +17 -17
  186. package/dist/chunks/prompt-B9sDzLPK.js +1 -0
  187. package/dist/chunks/prompt-WsoTRhoh.js +1 -0
  188. package/dist/chunks/{promptEditor-C6w1vT5E.js → promptEditor-Cr4w-4Bz.js} +1 -1
  189. package/dist/chunks/{protocolHandler-B3bQyB6W.js → protocolHandler-DzHVaPl3.js} +2 -2
  190. package/dist/chunks/{proxy-DFIxRT0i.js → proxy-BhIc7-mj.js} +1 -1
  191. package/dist/chunks/reconciler-RIKmaPg7.js +1 -0
  192. package/dist/chunks/refresh-CCSCAjgz.js +1 -0
  193. package/dist/chunks/registerProtocol-C0IlPEoa.js +1 -0
  194. package/dist/chunks/{reload-plugins-BnZzcRcd.js → reload-plugins-DC-tbXVv.js} +1 -1
  195. package/dist/chunks/{remoteBridgeCore-DAK9KSWp.js → remoteBridgeCore-NGTnhQgw.js} +1 -1
  196. package/dist/chunks/remoteManagedSettings-BoOYHzYP.js +1 -0
  197. package/dist/chunks/{rename-OSN3Ua2J.js → rename-DS1AmW-F.js} +1 -1
  198. package/dist/chunks/{renderOptions-XgkOdKCJ.js → renderOptions-D-aQZbzS.js} +1 -1
  199. package/dist/chunks/resume-Cf5PSoPw.js +2 -0
  200. package/dist/chunks/{ripgrep-C_XuTqp3.js → ripgrep-C3jtZL7k.js} +1 -1
  201. package/dist/chunks/ripgrep-CBUbn6Po.js +1 -0
  202. package/dist/chunks/{runtimeObserver-CuTsWhhF.js → runtimeObserver-DzesbvgI.js} +1 -1
  203. package/dist/chunks/{runtimeObserver-D9sujsqj.js → runtimeObserver-L6041elO.js} +2 -2
  204. package/dist/chunks/sandbox-adapter-Z4Phj31K.js +1 -0
  205. package/dist/chunks/{sandbox-toggle-oasrWfbj.js → sandbox-toggle-COZE8Lo4.js} +1 -1
  206. package/dist/chunks/sanitization-DV-94a9Z.js +1 -0
  207. package/dist/chunks/searchExtraTools-CvkRbL2m.js +1 -0
  208. package/dist/chunks/{session-c46jULDV.js → session-BvA99K4j.js} +1 -1
  209. package/dist/chunks/sessionFileAccessHooks-6XfAf6ke.js +1 -0
  210. package/dist/chunks/{sessionObserver-Cu7vykWp.js → sessionObserver-0D8xFoRK.js} +1 -1
  211. package/dist/chunks/sessionObserver-CRWUBJEY.js +1 -0
  212. package/dist/chunks/{sessionState-B3tFm9SC.js → sessionState-CQhbGfmh.js} +2 -2
  213. package/dist/chunks/sessionStorage-DqEuxDlb.js +1 -0
  214. package/dist/chunks/{sessionTracing-BRp_Ej-e.js → sessionTracing-BoOZsXU2.js} +1 -1
  215. package/dist/chunks/{settings-DUyIag_5.js → settings-3xZ0fsvE.js} +4 -4
  216. package/dist/chunks/settings-Crx1cI1u.js +1 -0
  217. package/dist/chunks/settingsSync-rkWmClKS.js +1 -0
  218. package/dist/chunks/setup-D8L275fT.js +3 -0
  219. package/dist/chunks/{shadowedRuleDetection-ChoqK1Iq.js → shadowedRuleDetection-Cy9tsuKc.js} +1 -1
  220. package/dist/chunks/{shellQuote-C-7PluUY.js → shellQuote-Ddgr1vif.js} +1 -1
  221. package/dist/chunks/{sideQuestion-CkC27Pf3.js → sideQuestion-Ds7Elgs4.js} +1 -1
  222. package/dist/chunks/{sinks-C9qCsi94.js → sinks-BXX72cbf.js} +1 -1
  223. package/dist/chunks/sinks-DMp6uEzM.js +1 -0
  224. package/dist/chunks/skillChangeDetector-CtithJ4a.js +1 -0
  225. package/dist/chunks/{skillGapStore-DC8s2Whn.js → skillGapStore-BxCxKPev.js} +2 -2
  226. package/dist/chunks/{skillLifecycle-BaqH5lw_.js → skillLifecycle-CfyNC3sW.js} +2 -2
  227. package/dist/chunks/{skillSearchPanel-Dtvyo2Dk.js → skillSearchPanel-CMNJFIEC.js} +3 -3
  228. package/dist/chunks/{skills-DXW57WeY.js → skills-DXMk-498.js} +1 -1
  229. package/dist/chunks/{startupProfiler-BqUlQEaV.js → startupProfiler-CbzxVmbv.js} +1 -1
  230. package/dist/chunks/startupProfiler-uHetQush.js +1 -0
  231. package/dist/chunks/state-BStOuCh4.js +1 -0
  232. package/dist/chunks/{state-B3zvBu4R.js → state-D5D6QpTX.js} +1 -1
  233. package/dist/chunks/{stats-vvwEVnon.js → stats-Ce15gc3E.js} +1 -1
  234. package/dist/chunks/{status-g_dhM6Ep.js → status-CFrLuGbf.js} +2 -2
  235. package/dist/chunks/status-D5OCkMZG.js +1 -0
  236. package/dist/chunks/{statusNoticeHelpers-B235FWru.js → statusNoticeHelpers-CZoOse-_.js} +1 -1
  237. package/dist/chunks/{stringUtils-CGZoOfer.js → stringUtils-CKD8qDqx.js} +1 -1
  238. package/dist/chunks/switcher-AiMcRzoi.js +1 -0
  239. package/dist/chunks/{switcher-OAeeTHHt.js → switcher-DQF5ZNal.js} +1 -1
  240. package/dist/chunks/syncCache-qWJ_VfBo.js +1 -0
  241. package/dist/chunks/{tasks--7yJk7MD.js → tasks-C8pb6ftc.js} +1 -1
  242. package/dist/chunks/{teleport-ja50aVy3.js → teleport-Bi_1VFIZ.js} +1 -1
  243. package/dist/chunks/{templateJobs-DSM3tNDS.js → templateJobs-DJ4dcfcL.js} +1 -1
  244. package/dist/chunks/{terminalSetup-C735-5lZ.js → terminalSetup-7PdC4fV5.js} +1 -1
  245. package/dist/chunks/{terminalSetup-BpZXqE_G.js → terminalSetup-kWdZRKWq.js} +1 -1
  246. package/dist/chunks/{theme-BX54e0r7.js → theme-CEKOCSLw.js} +1 -1
  247. package/dist/chunks/{tmux-BIdWN33b.js → tmux-CpGd0Aca.js} +1 -1
  248. package/dist/chunks/{toolEventObserver-O6ljakS9.js → toolEventObserver-D2nk8ZbW.js} +1 -1
  249. package/dist/chunks/toolPool-Df5iUqJ-.js +1 -0
  250. package/dist/chunks/{trustedDevice-Kyid5Fuy.js → trustedDevice-CB6rNzl-.js} +1 -1
  251. package/dist/chunks/trustedDevice-DXGePUAC.js +1 -0
  252. package/dist/chunks/{types-DDku8UKF.js → types-APu4OCXJ.js} +1 -1
  253. package/dist/chunks/{udsClient-B2yCKNgT.js → udsClient-U7MEfYj7.js} +1 -1
  254. package/dist/chunks/{upstreamproxy--RTAcgrE.js → upstreamproxy-CTOuotLO.js} +1 -1
  255. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-BnmDpMkm.js → useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js} +1 -1
  256. package/dist/chunks/useMainLoopModel-CIG2cjS2.js +1 -0
  257. package/dist/chunks/useManagePlugins-MSHw-qHx.js +1 -0
  258. package/dist/chunks/{useMergedTools-ChLA8dsy.js → useMergedTools-Bb-INJa2.js} +1 -1
  259. package/dist/chunks/{useSearchInput-DqymtQhH.js → useSearchInput-QL_VtdJD.js} +1 -1
  260. package/dist/chunks/useSettingsErrors-Dvi6zLCr.js +1 -0
  261. package/dist/chunks/{userAgent-D8vvjitA.js → userAgent-i-oGzf40.js} +1 -1
  262. package/dist/chunks/{util-CC-NRn16.js → util-CLQvtXuD.js} +1 -1
  263. package/dist/chunks/validatePlugin-1mTZ3TJR.js +1 -0
  264. package/dist/chunks/{vim-CIK2DjfK.js → vim-BagKUX4j.js} +1 -1
  265. package/dist/chunks/{which-3MmqfsNV.js → which-BxQ1hpjp.js} +1 -1
  266. package/dist/chunks/{windowsPaths-x-CxdtFP.js → windowsPaths-BdhjMYTm.js} +1 -1
  267. package/dist/chunks/windowsPaths-DtGZ83kH.js +1 -0
  268. package/dist/chunks/{workSecret-BsolC5S7.js → workSecret-CaM2yIJD.js} +1 -1
  269. package/dist/chunks/{workerRegistry-DE4Ghp-n.js → workerRegistry-BjxoZ12l.js} +2 -2
  270. package/dist/chunks/worktree-DpksgxdF.js +1 -0
  271. package/dist/cli.js +1 -1
  272. package/package.json +1 -5
  273. package/dist/chunks/AgentsMdExternalIncludesDialog-h150UBir.js +0 -1
  274. package/dist/chunks/ApproveApiKey-DIIIi6U8.js +0 -1
  275. package/dist/chunks/BackgroundTasksDialog-nfRmiGl3.js +0 -2
  276. package/dist/chunks/Doctor-Beo5yEMD.js +0 -1
  277. package/dist/chunks/Doctor-BxXAGr-Z.js +0 -3
  278. package/dist/chunks/ExitFlow-CVIuvrHT.js +0 -2
  279. package/dist/chunks/MCPConnectionManager-Cer1UawR.js +0 -1
  280. package/dist/chunks/MCPToolListView-DndNWDr1.js +0 -1
  281. package/dist/chunks/MessageSelector-BfmbAG8E.js +0 -3
  282. package/dist/chunks/Messages-CUJJ6nHV.js +0 -10
  283. package/dist/chunks/QueryEngine-C6Dx_-U8.js +0 -1
  284. package/dist/chunks/REPL-BPig-OIh.js +0 -128
  285. package/dist/chunks/REPL-e5wWV2Sl.js +0 -1
  286. package/dist/chunks/RemoteSessionManager-Cax4g0GH.js +0 -2
  287. package/dist/chunks/SearchExtraToolsTool-B_z74zwG.js +0 -1
  288. package/dist/chunks/Settings-B9rxF2wR.js +0 -2
  289. package/dist/chunks/add-dir-Cz33IGht.js +0 -1
  290. package/dist/chunks/agents-rfuJUSSc.js +0 -101
  291. package/dist/chunks/allErrors-YIRWFBD9.js +0 -1
  292. package/dist/chunks/api-CGk-0H2x.js +0 -1
  293. package/dist/chunks/attributionHooks-C0aXyx9L.js +0 -1
  294. package/dist/chunks/auth-DWWb8STf.js +0 -1
  295. package/dist/chunks/auth-DsqlBO-Q.js +0 -1
  296. package/dist/chunks/backgroundHousekeeping-CXv_Pm5h.js +0 -17
  297. package/dist/chunks/backgroundHousekeeping-Crx3oXIu.js +0 -1
  298. package/dist/chunks/branch-BEaujq-M.js +0 -2
  299. package/dist/chunks/bridgeConfig-Ctl7I_RR.js +0 -1
  300. package/dist/chunks/btw-8JqSG3o7.js +0 -1
  301. package/dist/chunks/caches-dnO4Ae_m.js +0 -1
  302. package/dist/chunks/caches-lPzD_yGv.js +0 -1
  303. package/dist/chunks/client-BFjMSlp7.js +0 -1
  304. package/dist/chunks/client-Byat5HpG.js +0 -1
  305. package/dist/chunks/client-Dzx24jGZ.js +0 -1
  306. package/dist/chunks/commands-D3lQbt9p.js +0 -1
  307. package/dist/chunks/config-CPGSP_1Z.js +0 -1
  308. package/dist/chunks/context-noninteractive-CwlOID3q.js +0 -1
  309. package/dist/chunks/conversation-BLEWB1BE.js +0 -1
  310. package/dist/chunks/conversation-Bos7yTIv.js +0 -1
  311. package/dist/chunks/createSession-B4wkDNam.js +0 -1
  312. package/dist/chunks/crossProjectResume-C5QtstD6.js +0 -40
  313. package/dist/chunks/cwd-BfiQQAqr.js +0 -1
  314. package/dist/chunks/cwd-Dj2ynhWd.js +0 -1
  315. package/dist/chunks/detectRepository-CWI2xcdR.js +0 -1
  316. package/dist/chunks/doctor-BV6zhneX.js +0 -1
  317. package/dist/chunks/extractMemories-DxGHxoNO.js +0 -1
  318. package/dist/chunks/fast-Bf-g-wR6.js +0 -1
  319. package/dist/chunks/fetchModelList-vk-RMDfG.js +0 -1
  320. package/dist/chunks/firstPartyEventLogger-DvsZdBy2.js +0 -1
  321. package/dist/chunks/git-Bujlb5tq.js +0 -1
  322. package/dist/chunks/githubRepoPathMapping-Dhz4cvw2.js +0 -1
  323. package/dist/chunks/hooks-C5YSYzSl.js +0 -1
  324. package/dist/chunks/initReplBridge-BFYTAFlT.js +0 -1
  325. package/dist/chunks/install-CjacxFXg.js +0 -1
  326. package/dist/chunks/keybindings-D01jzjKu.js +0 -1
  327. package/dist/chunks/loadAgentsDir-xG1HswS_.js +0 -1
  328. package/dist/chunks/localSearch-B17Mzd84.js +0 -1
  329. package/dist/chunks/managedEnv-C7bVtcgA.js +0 -1
  330. package/dist/chunks/managedEnv-d7HliQYg.js +0 -1
  331. package/dist/chunks/mcp-BcEApfqn.js +0 -1
  332. package/dist/chunks/mcp-CBbVcOTy.js +0 -2
  333. package/dist/chunks/mcp-DYtfHeRa.js +0 -6
  334. package/dist/chunks/memory-CijapyZk.js +0 -1
  335. package/dist/chunks/model-CyF5u3zH.js +0 -1
  336. package/dist/chunks/model-DaYZWYJe.js +0 -1
  337. package/dist/chunks/omit-BhPlISSj.js +0 -1
  338. package/dist/chunks/onChangeAppState-BOJd4Yce.js +0 -1
  339. package/dist/chunks/parser-B-QFQfSO.js +0 -1
  340. package/dist/chunks/partition-_qZZlGjS.js +0 -1
  341. package/dist/chunks/permissions-CcjGscyg.js +0 -3
  342. package/dist/chunks/pidLock-Cm9FWa4w.js +0 -3
  343. package/dist/chunks/plugin-D7vjs6Hu.js +0 -17
  344. package/dist/chunks/pluginOperations-BxHoy0pC.js +0 -2
  345. package/dist/chunks/pluginStartupCheck-CtX6QkdO.js +0 -1
  346. package/dist/chunks/poorMode-DyAWNRRM.js +0 -1
  347. package/dist/chunks/poorMode-aMzKXz6G.js +0 -1
  348. package/dist/chunks/postCommitAttribution-DoSP9wZD.js +0 -1
  349. package/dist/chunks/print-BrqZ3AgP.js +0 -14
  350. package/dist/chunks/processBashCommand-C6mBgRVz.js +0 -1
  351. package/dist/chunks/processSlashCommand-t0-BVku8.js +0 -5
  352. package/dist/chunks/prompt-BJ3xYAvE.js +0 -1
  353. package/dist/chunks/prompt-Di2lNwYp.js +0 -1
  354. package/dist/chunks/reconciler-p4lAu9ft.js +0 -1
  355. package/dist/chunks/refresh-DCQChX5A.js +0 -1
  356. package/dist/chunks/registerProtocol-CrzdmgCD.js +0 -1
  357. package/dist/chunks/remoteManagedSettings-DkLfclxa.js +0 -1
  358. package/dist/chunks/resume-K9q5B1li.js +0 -2
  359. package/dist/chunks/ripgrep-DLPH9MP9.js +0 -1
  360. package/dist/chunks/sandbox-adapter-CRxZBMAP.js +0 -1
  361. package/dist/chunks/searchExtraTools-BAYzzTE8.js +0 -1
  362. package/dist/chunks/sessionFileAccessHooks-CwnjOk6S.js +0 -1
  363. package/dist/chunks/sessionObserver-DNjDoJmy.js +0 -1
  364. package/dist/chunks/sessionStorage-CVZ0MUSE.js +0 -1
  365. package/dist/chunks/settings-DsqFBv6J.js +0 -1
  366. package/dist/chunks/settingsSync-yE43qjMS.js +0 -1
  367. package/dist/chunks/setup-CFOc-hPM.js +0 -3
  368. package/dist/chunks/sinks-B64r_OBE.js +0 -1
  369. package/dist/chunks/skillChangeDetector-CLnn22Jo.js +0 -1
  370. package/dist/chunks/src-DPUAq5Ty.js +0 -1
  371. package/dist/chunks/startupProfiler-yBU6FaAV.js +0 -1
  372. package/dist/chunks/state-mHtumqEo.js +0 -1
  373. package/dist/chunks/status--Ql7l0VG.js +0 -1
  374. package/dist/chunks/switcher-Cb9R9247.js +0 -1
  375. package/dist/chunks/syncCache-BiqQEess.js +0 -1
  376. package/dist/chunks/toolPool-H_kXc8vo.js +0 -1
  377. package/dist/chunks/trustedDevice-Dm_SY3Ko.js +0 -1
  378. package/dist/chunks/useMainLoopModel-DG8pghH7.js +0 -1
  379. package/dist/chunks/useManagePlugins-HMHtjIY-.js +0 -1
  380. package/dist/chunks/useSettingsErrors-Bs9uyzW4.js +0 -1
  381. package/dist/chunks/validatePlugin-yCb8gsVF.js +0 -1
  382. package/dist/chunks/windowsPaths-Dd_S96Bq.js +0 -1
  383. package/dist/chunks/worktree-D-CgffvU.js +0 -1
  384. /package/dist/chunks/{src-DLz3FZm1.js → urlHandler-DLz3FZm1.js} +0 -0
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{$_ as r,La as i,U_ as a,V_ as o,ev as s,ka as c}from"./loadAgentsDir-DnsldjYU.js";import{I as l,P as u,s as d,t as f}from"./src-DL3w8VPk2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{cn as m,ln as h,wn as g,xn as _}from"./settings-DUyIag_5.js";import{_ as v,v as y}from"./startupProfiler-BqUlQEaV.js";import{Et as b,Ot as x,Xt as S,an as C,in as w,nn as T}from"./prompt-CzQkcxfg.js";import{n as E,t as D}from"./staticRender-D9AbnQFr.js";function O(e){let t=[];return k(e,t),A(e,t),M(e,t),N(e,t),ee(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function k(e,t){e.percentage>=L&&t.push({severity:`warning`,title:`Context is ${e.percentage}% full`,detail:e.isAutoCompactEnabled?`Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.`:`Autocompact is disabled. Use /compact to free space, or enable autocompact in /config.`})}function A(e,t){if(e.messageBreakdown)for(let n of e.messageBreakdown.toolCallsByType){let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100;if(i<P||r<F)continue;let a=j(n.name,r,i);a&&t.push(a)}}function j(e,t,n){let r=v(t);switch(e){case w:return{severity:`warning`,title:`Bash results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Pipe output through head, tail, or grep to reduce result size. Avoid cat on large files — use Read with offset/limit instead.`,savingsTokens:Math.floor(t*.5)};case S:return{severity:`info`,title:`Read results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Use offset and limit parameters to read only the sections you need. Avoid re-reading entire files when you only need a few lines.`,savingsTokens:Math.floor(t*.3)};case b:return{severity:`info`,title:`Grep results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Add more specific patterns or use the glob or type parameter to narrow file types. Consider Glob for file discovery instead of Grep.`,savingsTokens:Math.floor(t*.3)};default:return n>=20?{severity:`info`,title:`${e} using ${r} tokens (${n.toFixed(0)}%)`,detail:`This tool is consuming a significant portion of context.`,savingsTokens:Math.floor(t*.2)}:null}}function M(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===S);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=P&&r>=F||a>=I&&n.resultTokens>=F&&t.push({severity:`info`,title:`File reads using ${v(n.resultTokens)} tokens (${a.toFixed(0)}%)`,detail:`If you are re-reading files, consider referencing earlier reads. Use offset/limit for large files.`,savingsTokens:Math.floor(n.resultTokens*.3)})}function N(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=R&&n>=z){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${_(e.path)} (${v(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${v(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function ee(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<L&&t.push({severity:`info`,title:`Autocompact is disabled`,detail:`Without autocompact, you will hit context limits and lose the conversation. Enable it in /config or use /compact manually.`})}var P,F,I,L,R,z,B=e((()=>{C(),T(),x(),g(),y(),P=15,F=1e4,I=5,L=80,R=5,z=5e3}));function V({suggestions:e}){return e.length===0?null:(0,H.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,H.jsx)(u,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,H.jsxs)(l,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,H.jsxs)(l,{children:[(0,H.jsx)(d,{status:e.severity,withSpace:!0}),(0,H.jsx)(u,{bold:!0,children:e.title}),e.savingsTokens?(0,H.jsxs)(u,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,v(e.savingsTokens)]}):null]}),(0,H.jsx)(l,{marginLeft:2,children:(0,H.jsx)(u,{dimColor:!0,children:e.detail})})]},t))]})}var H,U=e((()=>{t(),f(),y(),H=p()}));function W(){return null}function G(e){let t=new Map;for(let n of e){let e=m(n.source),r=t.get(e)||[];r.push(n),t.set(e,r)}for(let[e,n]of t.entries())t.set(e,n.sort((e,t)=>t.tokens-e.tokens));let n=new Map;for(let e of Y){let r=t.get(e);r&&n.set(e,r)}return n}function K({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,gridRows:a,model:o,memoryFiles:s,mcpTools:c,deferredBuiltinTools:d=[],agents:f,skills:p,cacheHitRate:m,cacheThreshold:h}=e,g=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==J&&!e.isDeferred),y=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),b=t.find(e=>e.name===J);return(0,q.jsxs)(l,{flexDirection:`column`,paddingLeft:1,children:[(0,q.jsx)(u,{bold:!0,children:`Context Usage`}),(0,q.jsxs)(l,{flexDirection:`row`,gap:2,children:[(0,q.jsx)(l,{flexDirection:`column`,flexShrink:0,children:a.map((e,t)=>(0,q.jsx)(l,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,q.jsx)(u,{dimColor:!0,children:`⛶ `},t):e.categoryName===J?(0,q.jsx)(u,{color:e.color,children:`⛝ `},t):(0,q.jsx)(u,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,q.jsxs)(l,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,q.jsxs)(u,{dimColor:!0,children:[o,` · `,v(n),`/`,v(r),` tokens (`,i,`%)`]}),(0,q.jsx)(W,{}),m!==void 0&&h!==void 0&&(0,q.jsxs)(u,{color:m<h?`warning`:void 0,children:[`Cache hit rate: `,m.toFixed(0),`%`,m<h?` (below ${h}% threshold)`:``]}),(0,q.jsx)(u,{children:` `}),(0,q.jsx)(u,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),g.map((e,t)=>{let n=v(e.tokens),i=e.isDeferred?`N/A`:`${(e.tokens/r*100).toFixed(1)}%`,a=e.name===J,o=e.name,s=e.isDeferred?` `:a?`⛝`:`⛁`;return(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{color:e.color,children:s}),(0,q.jsxs)(u,{children:[` `,o,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[n,` tokens (`,i,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{dimColor:!0,children:`⛶`}),(0,q.jsx)(u,{children:` Free space: `}),(0,q.jsxs)(u,{dimColor:!0,children:[v(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/r*100).toFixed(1),`%)`]})]}),b&&b.tokens>0&&(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{color:b.color,children:`⛝`}),(0,q.jsxs)(u,{dimColor:!0,children:[` `,b.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(b.tokens),` tokens (`,(b.tokens/r*100).toFixed(1),`%)`]})]})]})]}),(0,q.jsxs)(l,{flexDirection:`column`,marginLeft:-1,children:[c.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`MCP tools`}),(0,q.jsxs)(u,{dimColor:!0,children:[` · /mcp`,y?` (loaded on-demand)`:``]})]}),c.some(e=>e.isLoaded)&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:`Loaded`}),c.filter(e=>e.isLoaded).map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]}),y&&c.some(e=>!e.isLoaded)&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:`Available`}),c.filter(e=>!e.isLoaded).map((e,t)=>(0,q.jsx)(l,{children:(0,q.jsxs)(u,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!y&&c.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]}),f.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Custom agents`}),(0,q.jsx)(u,{dimColor:!0,children:` · /agents`})]}),Array.from(G(f).entries()).map(([e,t])=>(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.agentType,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]},e))]}),s.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Memory files`}),(0,q.jsx)(u,{dimColor:!0,children:` · /memory`})]}),s.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,_(e.path),`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]}),p&&p.tokens>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Skills`}),(0,q.jsx)(u,{dimColor:!0,children:` · /skills`})]}),Array.from(G(p.skillFrontmatter).entries()).map(([e,t])=>(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]},e))]})]}),(0,q.jsx)(V,{suggestions:O(e)})]})}var q,J,Y,X=e((()=>{f(),B(),g(),y(),h(),U(),q=p(),J=`Autocompact buffer`,Y=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function Z(e){return c(e)}async function Q(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,c=Z(n),{messages:l}=await s(c),u=process.stdout.columns||80,d=r();return e(await E((0,$.jsx)(K,{data:await o(l,i,async()=>d.toolPermissionContext,a,d.agentDefinitions,u,t,void 0,c)}))),null}var $;e((()=>{X(),r(),a(),i(),D(),$=p()}))();export{Q as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{$_ as r,La as i,U_ as a,V_ as o,ev as s,ka as c}from"./loadAgentsDir-DaNpxaO-.js";import{I as l,P as u,s as d,t as f}from"./src-DL3w8VPk2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Cn as m,bn as h,cn as g,sn as _}from"./settings-3xZ0fsvE.js";import{_ as v,v as y}from"./startupProfiler-CbzxVmbv.js";import{Et as b,Ot as x,Yt as S,in as C,rn as w,tn as T}from"./prompt-8u06WVES.js";import{n as E,t as D}from"./staticRender-D9AbnQFr.js";function O(e){let t=[];return k(e,t),A(e,t),M(e,t),N(e,t),ee(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function k(e,t){e.percentage>=L&&t.push({severity:`warning`,title:`Context is ${e.percentage}% full`,detail:e.isAutoCompactEnabled?`Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.`:`Autocompact is disabled. Use /compact to free space, or enable autocompact in /config.`})}function A(e,t){if(e.messageBreakdown)for(let n of e.messageBreakdown.toolCallsByType){let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100;if(i<P||r<F)continue;let a=j(n.name,r,i);a&&t.push(a)}}function j(e,t,n){let r=v(t);switch(e){case w:return{severity:`warning`,title:`Bash results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Pipe output through head, tail, or grep to reduce result size. Avoid cat on large files — use Read with offset/limit instead.`,savingsTokens:Math.floor(t*.5)};case S:return{severity:`info`,title:`Read results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Use offset and limit parameters to read only the sections you need. Avoid re-reading entire files when you only need a few lines.`,savingsTokens:Math.floor(t*.3)};case b:return{severity:`info`,title:`Grep results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Add more specific patterns or use the glob or type parameter to narrow file types. Consider Glob for file discovery instead of Grep.`,savingsTokens:Math.floor(t*.3)};default:return n>=20?{severity:`info`,title:`${e} using ${r} tokens (${n.toFixed(0)}%)`,detail:`This tool is consuming a significant portion of context.`,savingsTokens:Math.floor(t*.2)}:null}}function M(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===S);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=P&&r>=F||a>=I&&n.resultTokens>=F&&t.push({severity:`info`,title:`File reads using ${v(n.resultTokens)} tokens (${a.toFixed(0)}%)`,detail:`If you are re-reading files, consider referencing earlier reads. Use offset/limit for large files.`,savingsTokens:Math.floor(n.resultTokens*.3)})}function N(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=R&&n>=z){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${h(e.path)} (${v(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${v(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function ee(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<L&&t.push({severity:`info`,title:`Autocompact is disabled`,detail:`Without autocompact, you will hit context limits and lose the conversation. Enable it in /config or use /compact manually.`})}var P,F,I,L,R,z,B=e((()=>{C(),T(),x(),m(),y(),P=15,F=1e4,I=5,L=80,R=5,z=5e3}));function V({suggestions:e}){return e.length===0?null:(0,H.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,H.jsx)(u,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,H.jsxs)(l,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,H.jsxs)(l,{children:[(0,H.jsx)(d,{status:e.severity,withSpace:!0}),(0,H.jsx)(u,{bold:!0,children:e.title}),e.savingsTokens?(0,H.jsxs)(u,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,v(e.savingsTokens)]}):null]}),(0,H.jsx)(l,{marginLeft:2,children:(0,H.jsx)(u,{dimColor:!0,children:e.detail})})]},t))]})}var H,U=e((()=>{t(),f(),y(),H=p()}));function W(){return null}function G(e){let t=new Map;for(let n of e){let e=_(n.source),r=t.get(e)||[];r.push(n),t.set(e,r)}for(let[e,n]of t.entries())t.set(e,n.sort((e,t)=>t.tokens-e.tokens));let n=new Map;for(let e of Y){let r=t.get(e);r&&n.set(e,r)}return n}function K({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,gridRows:a,model:o,memoryFiles:s,mcpTools:c,deferredBuiltinTools:d=[],agents:f,skills:p,cacheHitRate:m,cacheThreshold:g}=e,_=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==J&&!e.isDeferred),y=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),b=t.find(e=>e.name===J);return(0,q.jsxs)(l,{flexDirection:`column`,paddingLeft:1,children:[(0,q.jsx)(u,{bold:!0,children:`Context Usage`}),(0,q.jsxs)(l,{flexDirection:`row`,gap:2,children:[(0,q.jsx)(l,{flexDirection:`column`,flexShrink:0,children:a.map((e,t)=>(0,q.jsx)(l,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,q.jsx)(u,{dimColor:!0,children:`⛶ `},t):e.categoryName===J?(0,q.jsx)(u,{color:e.color,children:`⛝ `},t):(0,q.jsx)(u,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,q.jsxs)(l,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,q.jsxs)(u,{dimColor:!0,children:[o,` · `,v(n),`/`,v(r),` tokens (`,i,`%)`]}),(0,q.jsx)(W,{}),m!==void 0&&g!==void 0&&(0,q.jsxs)(u,{color:m<g?`warning`:void 0,children:[`Cache hit rate: `,m.toFixed(0),`%`,m<g?` (below ${g}% threshold)`:``]}),(0,q.jsx)(u,{children:` `}),(0,q.jsx)(u,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),_.map((e,t)=>{let n=v(e.tokens),i=e.isDeferred?`N/A`:`${(e.tokens/r*100).toFixed(1)}%`,a=e.name===J,o=e.name,s=e.isDeferred?` `:a?`⛝`:`⛁`;return(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{color:e.color,children:s}),(0,q.jsxs)(u,{children:[` `,o,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[n,` tokens (`,i,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{dimColor:!0,children:`⛶`}),(0,q.jsx)(u,{children:` Free space: `}),(0,q.jsxs)(u,{dimColor:!0,children:[v(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/r*100).toFixed(1),`%)`]})]}),b&&b.tokens>0&&(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{color:b.color,children:`⛝`}),(0,q.jsxs)(u,{dimColor:!0,children:[` `,b.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(b.tokens),` tokens (`,(b.tokens/r*100).toFixed(1),`%)`]})]})]})]}),(0,q.jsxs)(l,{flexDirection:`column`,marginLeft:-1,children:[c.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`MCP tools`}),(0,q.jsxs)(u,{dimColor:!0,children:[` · /mcp`,y?` (loaded on-demand)`:``]})]}),c.some(e=>e.isLoaded)&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:`Loaded`}),c.filter(e=>e.isLoaded).map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]}),y&&c.some(e=>!e.isLoaded)&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:`Available`}),c.filter(e=>!e.isLoaded).map((e,t)=>(0,q.jsx)(l,{children:(0,q.jsxs)(u,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!y&&c.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]}),f.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Custom agents`}),(0,q.jsx)(u,{dimColor:!0,children:` · /agents`})]}),Array.from(G(f).entries()).map(([e,t])=>(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.agentType,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]},e))]}),s.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Memory files`}),(0,q.jsx)(u,{dimColor:!0,children:` · /memory`})]}),s.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,h(e.path),`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]}),p&&p.tokens>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Skills`}),(0,q.jsx)(u,{dimColor:!0,children:` · /skills`})]}),Array.from(G(p.skillFrontmatter).entries()).map(([e,t])=>(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[v(e.tokens),` tokens`]})]},t))]},e))]})]}),(0,q.jsx)(V,{suggestions:O(e)})]})}var q,J,Y,X=e((()=>{f(),B(),m(),y(),g(),U(),q=p(),J=`Autocompact buffer`,Y=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function Z(e){return c(e)}async function Q(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,c=Z(n),{messages:l}=await s(c),u=process.stdout.columns||80,d=r();return e(await E((0,$.jsx)(K,{data:await o(l,i,async()=>d.toolPermissionContext,a,d.agentDefinitions,u,t,void 0,c)}))),null}var $;e((()=>{X(),r(),a(),i(),D(),$=p()}))();export{Q as call};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$_ as t,La as n,U_ as r,V_ as i,ev as a,ka as o}from"./loadAgentsDir-DnsldjYU.js";import{cn as s,ln as c}from"./settings-DUyIag_5.js";import{_ as l,v as u}from"./startupProfiler-BqUlQEaV.js";async function d(e){let{messages:t,getAppState:n,options:{mainLoopModel:r,tools:s,agentDefinitions:c,customSystemPrompt:l,appendSystemPrompt:u}}=e,d=o(t),{messages:f}=await a(d),p=n();return i(f,r,async()=>p.toolPermissionContext,s,c,void 0,{options:{customSystemPrompt:l,appendSystemPrompt:u}},void 0,d)}async function f(e,t){return{type:`text`,value:p(await d(t))}}function p(e){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,model:a,memoryFiles:o,mcpTools:c,agents:u,skills:d}=e,f=`## Context Usage
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$_ as t,La as n,U_ as r,V_ as i,ev as a,ka as o}from"./loadAgentsDir-DaNpxaO-.js";import{cn as s,sn as c}from"./settings-3xZ0fsvE.js";import{_ as l,v as u}from"./startupProfiler-CbzxVmbv.js";async function d(e){let{messages:t,getAppState:n,options:{mainLoopModel:r,tools:s,agentDefinitions:c,customSystemPrompt:l,appendSystemPrompt:u}}=e,d=o(t),{messages:f}=await a(d),p=n();return i(f,r,async()=>p.toolPermissionContext,s,c,void 0,{options:{customSystemPrompt:l,appendSystemPrompt:u}},void 0,d)}async function f(e,t){return{type:`text`,value:p(await d(t))}}function p(e){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,model:a,memoryFiles:o,mcpTools:s,agents:u,skills:d}=e,f=`## Context Usage
2
2
 
3
3
  `;f+=`**Model:** ${a} \n`,f+=`**Tokens:** ${l(n)} / ${l(r)} (${i}%)\n`,f+=`
4
4
  `;let p=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==`Autocompact buffer`);if(p.length>0){f+=`### Estimated usage by category
@@ -6,11 +6,11 @@ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$_ as t,La as n,U_ as
6
6
  `,f+=`| Category | Tokens | Percentage |
7
7
  `,f+=`|----------|--------|------------|
8
8
  `;for(let e of p){let t=(e.tokens/r*100).toFixed(1);f+=`| ${e.name} | ${l(e.tokens)} | ${t}% |\n`}let e=t.find(e=>e.name===`Free space`);if(e&&e.tokens>0){let t=(e.tokens/r*100).toFixed(1);f+=`| Free space | ${l(e.tokens)} | ${t}% |\n`}let n=t.find(e=>e.name===`Autocompact buffer`);if(n&&n.tokens>0){let e=(n.tokens/r*100).toFixed(1);f+=`| Autocompact buffer | ${l(n.tokens)} | ${e}% |\n`}f+=`
9
- `}if(c.length>0){f+=`### MCP Tools
9
+ `}if(s.length>0){f+=`### MCP Tools
10
10
 
11
11
  `,f+=`| Tool | Server | Tokens |
12
12
  `,f+=`|------|--------|--------|
13
- `;for(let e of c)f+=`| ${e.name} | ${e.serverName} | ${l(e.tokens)} |\n`;f+=`
13
+ `;for(let e of s)f+=`| ${e.name} | ${e.serverName} | ${l(e.tokens)} |\n`;f+=`
14
14
  `}if(u.length>0){f+=`### Custom Agents
15
15
 
16
16
  `,f+=`| Agent Type | Source | Tokens |
@@ -25,5 +25,5 @@ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$_ as t,La as n,U_ as
25
25
 
26
26
  `,f+=`| Skill | Source | Tokens |
27
27
  `,f+=`|-------|--------|--------|
28
- `;for(let e of d.skillFrontmatter)f+=`| ${e.name} | ${s(e.source)} | ${l(e.tokens)} |\n`;f+=`
29
- `}return f}var m=e((()=>{t(),r(),u(),n(),c()}));export{d as n,m as r,f as t};
28
+ `;for(let e of d.skillFrontmatter)f+=`| ${e.name} | ${c(e.source)} | ${l(e.tokens)} |\n`;f+=`
29
+ `}return f}var m=e((()=>{t(),r(),u(),n(),s()}));export{d as n,m as r,f as t};
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./context-noninteractive-BzDVMnWC.js";t();export{n as call,e as collectContextData};
@@ -0,0 +1 @@
1
+ import{a as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";import{AC as n,Ch as r,Dn as i,Fg as a,HT as o,Kn as s,Lg as c,Ls as l,Mg as u,On as d,Rs as f,St as p,Th as m,Tn as h,YT as g,br as _,di as v,h_ as y,hc as b,hn as x,jg as S,kC as C,m_ as w,mi as T,qt as E,sn as D,ti as O,tr as k,yt as A}from"./loadAgentsDir-DaNpxaO-.js";import{$ as j,$t as M,Cn as N,En as P,Ut as F,W as I,Zt as L,wn as R}from"./state-D5D6QpTX.js";import{o as z,s as B}from"./log-CZ7ploQm.js";import{n as V,r as H}from"./analytics-DJobLaWP.js";import{at as U,ut as W}from"./sessionState-CQhbGfmh.js";import{n as G,t as K}from"./caches-DH-q8Fjf.js";import{randomUUID as q}from"crypto";function J(){return Y}var Y,X=t((()=>{b(),Y=null}));function Z(){let e=J();if(!e)return;e.markTranscriptReset?.();let t={type:`status`,subtype:`status`,status:`conversation_cleared`,message:`conversation_cleared`,uuid:q()};e.writeSdkMessages([t])}async function Q({setMessages:t,readFileState:c,discoveredSkillNames:l,loadedNestedMemoryPaths:d,getAppState:p,setAppState:m,setConversationId:g}){let b=D();await E(`clear`,{getAppState:p,setAppState:m,signal:AbortSignal.timeout(b),timeoutMs:b});let x=I();x&&H(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:x});let S=new Set,C=[],w=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(p)for(let e of Object.values(p().tasks))w(e)||f(e)&&(S.add(e.agentId),C.push(e));t(()=>[]),Z();let{setContextBlocked:F}=(U(),e(W));F(!1),g&&g(q()),K(S),N(null),R(null),P(null),M(),n(j()),c.clear(),l?.clear(),d?.clear(),m&&m(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!w(r)){t[n]=r;continue}try{r.status===`running`&&(u(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){B(e)}h(n)}return{...e,tasks:t,attribution:r(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:e.mcp.pluginReconnectKey}}}),o(),s(),L({setCurrentAsParent:!0}),await O();for(let e of C)e.status===`running`&&i(e.id,k(a(e.agentId)));let{saveMode:z}=(_(),e(T));z(`normal`);let V=A();V&&v(V);let G=await y(`clear`);G.length>0&&t(()=>G)}var $=t((()=>{X(),F(),V(),l(),S(),c(),m(),x(),z(),g(),C(),w(),_(),d(),p(),G()}));export{$ as n,Q as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./conversation-BBOE_EoE.js";e();export{t as clearConversation};
@@ -1,4 +1,4 @@
1
- import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{C as n,S as r,c as i,i as a,x as o}from"./debug-D7OBvqC2.js";import{l as s,u as c}from"./oauth-D38aRTUb.js";import{Pt as l,St as u}from"./model-xI2MbgRj.js";import{t as d}from"./cliLaunch-DDA65zeR.js";import{resolve as f}from"path";import{existsSync as p,unlinkSync as m}from"fs";import{randomUUID as h}from"crypto";a(),o(),e();function g(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}var _=2e3,v=15e3,y=3,b=class{constructor(e,n){t(this,`proc`,void 0),t(this,`options`,void 0),t(this,`connected`,!1),t(this,`disconnected`,!1),t(this,`readLoopAbort`,null),t(this,`reconnectAttempt`,0),t(this,`maxReconnectAttempts`,void 0),t(this,`userInitiatedDisconnect`,!1),t(this,`reconnecting`,!1),this.proc=e,this.options=n,this.maxReconnectAttempts=n.maxReconnectAttempts??y}connect(){this.connected||(this.readLoopAbort=new AbortController,this.startReadLoop(),this.monitorExit(),this.connected=!0,this.options.onConnected())}async startReadLoop(){let e=this.proc.stdout;if(!e){this.options.onError(Error(`SSH process stdout is not available`));return}let t=e.getReader(),n=new TextDecoder,r=``;try{for(;!this.disconnected;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.split(`
1
+ import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{C as n,S as r,c as i,i as a,x as o}from"./debug-D58GQBDG.js";import{l as s,u as c}from"./oauth-D38aRTUb.js";import{Pt as l,St as u}from"./model-Do0f476p.js";import{t as d}from"./cliLaunch-DDtwAolw.js";import{resolve as f}from"path";import{existsSync as p,unlinkSync as m}from"fs";import{randomUUID as h}from"crypto";a(),o(),e();function g(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}var _=2e3,v=15e3,y=3,b=class{constructor(e,n){t(this,`proc`,void 0),t(this,`options`,void 0),t(this,`connected`,!1),t(this,`disconnected`,!1),t(this,`readLoopAbort`,null),t(this,`reconnectAttempt`,0),t(this,`maxReconnectAttempts`,void 0),t(this,`userInitiatedDisconnect`,!1),t(this,`reconnecting`,!1),this.proc=e,this.options=n,this.maxReconnectAttempts=n.maxReconnectAttempts??y}connect(){this.connected||(this.readLoopAbort=new AbortController,this.startReadLoop(),this.monitorExit(),this.connected=!0,this.options.onConnected())}async startReadLoop(){let e=this.proc.stdout;if(!e){this.options.onError(Error(`SSH process stdout is not available`));return}let t=e.getReader(),n=new TextDecoder,r=``;try{for(;!this.disconnected;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.split(`
2
2
  `);r=a.pop()??``;for(let e of a){let t=e.trim();t&&this.processLine(t)}}}catch(e){this.disconnected||this.options.onError(e instanceof Error?e:Error(String(e)))}finally{t.releaseLock(),!this.disconnected&&!this.userInitiatedDisconnect&&this.handleProcessExit()}}monitorExit(){if(this.proc.exitCode!==null){this.userInitiatedDisconnect||this.handleProcessExit();return}this.proc.exited.then(()=>{!this.disconnected&&!this.userInitiatedDisconnect&&this.handleProcessExit()}).catch(()=>{!this.disconnected&&!this.userInitiatedDisconnect&&this.handleProcessExit()})}async handleProcessExit(){if(!(this.disconnected||this.reconnecting)){if(this.connected=!1,!this.options.reconnect){this.disconnected=!0,this.options.onDisconnected();return}if(this.reconnectAttempt>=this.maxReconnectAttempts){this.disconnected=!0,this.options.onDisconnected();return}this.reconnecting=!0;try{await this.attemptReconnect()}finally{this.reconnecting=!1}}}async attemptReconnect(){let e=this.options.reconnect;for(;this.reconnectAttempt<this.maxReconnectAttempts;){this.reconnectAttempt++,this.options.onReconnecting(this.reconnectAttempt,this.maxReconnectAttempts);let t=Math.min(_*2**(this.reconnectAttempt-1),v);if(await new Promise(e=>setTimeout(e,t)),this.userInitiatedDisconnect)return;try{let t=await e();this.proc=t,this.reconnectAttempt=0,this.connected=!0,this.startReadLoop(),this.monitorExit(),this.options.onConnected();return}catch(e){i(`[SSH] reconnect attempt ${this.reconnectAttempt} failed: ${e instanceof Error?e.message:String(e)}`)}}this.disconnected=!0,this.options.onDisconnected()}processLine(e){let t;try{t=r(e)}catch{return}if(!g(t))return;let n=t;if(n.type===`control_request`){let e=n;e.request.subtype===`can_use_tool`?this.options.onPermissionRequest(e.request,e.request_id):(i(`[SSH] Unsupported control request subtype: ${e.request.subtype}`),this.sendErrorResponse(e.request_id,`Unsupported control request subtype: ${e.request.subtype}`));return}n.type!==`control_response`&&n.type!==`keep_alive`&&n.type!==`control_cancel_request`&&n.type!==`streamlined_text`&&n.type!==`streamlined_tool_use_summary`&&!(n.type===`system`&&n.subtype===`post_turn_summary`)&&this.options.onMessage(n)}writeToStdin(e){try{let t=this.proc.stdin;if(!t||typeof t==`number`||this.disconnected)return!1;let n=new TextEncoder().encode(`${e}\n`);return t.write(n),t.flush?.(),!0}catch{return!1}}async sendMessage(e){let t=n({type:`user`,message:{role:`user`,content:e},parent_tool_use_id:null,session_id:``});return this.writeToStdin(t)}sendInterrupt(){let e=n({type:`control_request`,request_id:crypto.randomUUID(),request:{subtype:`interrupt`}});this.writeToStdin(e)}respondToPermissionRequest(e,t){let r=n({type:`control_response`,response:{subtype:`success`,request_id:e,response:{behavior:t.behavior,...t.behavior===`allow`?{updatedInput:t.updatedInput}:{message:t.message}}}});this.writeToStdin(r)}sendErrorResponse(e,t){let r=n({type:`control_response`,response:{subtype:`error`,request_id:e,error:t}});this.writeToStdin(r)}disconnect(){if(!this.disconnected){this.userInitiatedDisconnect=!0,this.disconnected=!0,this.connected=!1,this.readLoopAbort?.abort();try{let e=this.proc.stdin;e&&typeof e!=`number`&&e.end?.()}catch{}try{this.proc.kill()}catch{}}}isConnected(){return this.connected&&!this.disconnected}};l(),c(),a();var x=process.platform===`win32`;function S(){let e=process.env.ANTHROPIC_API_KEY;if(e)return{"x-api-key":e};let t=u();return t?.accessToken?{Authorization:`Bearer ${t.accessToken}`}:{}}function C(){return process.env.ANTHROPIC_BASE_URL||s().BASE_API_URL}async function w(e,t){if(t&&e.headers.get(`x-auth-nonce`)!==t)return new Response(`Forbidden`,{status:403});let n=C(),r=new URL(e.url),a=`${n}${r.pathname}${r.search}`,o=S();if(Object.keys(o).length===0)return new Response(JSON.stringify({error:`No API credentials available on local machine`}),{status:401,headers:{"content-type":`application/json`}});let s=new Headers(e.headers);for(let[e,t]of Object.entries(o))s.set(e,t);s.delete(`host`),s.delete(`x-auth-nonce`),i(`[SSHAuthProxy] ${e.method} ${r.pathname} -> ${a}`);try{let t=await fetch(a,{method:e.method,headers:s,body:e.body,duplex:`half`}),n=new Headers(t.headers);return n.delete(`content-encoding`),n.delete(`content-length`),new Response(t.body,{status:t.status,statusText:t.statusText,headers:n})}catch(e){let t=e instanceof Error?e.message:String(e);return i(`[SSHAuthProxy] upstream error: ${t}`),new Response(JSON.stringify({error:`Proxy upstream error: ${t}`}),{status:502,headers:{"content-type":`application/json`}})}}async function T(){let e=h();return x?D(e):E(e)}async function E(e){let t=`/tmp/claude-ssh-auth-${e}.sock`,n=Bun.serve({unix:t,fetch:e=>w(e,null)});return i(`[SSHAuthProxy] listening on unix:${t}`),{proxy:{stop(){n.stop(!0);try{m(t)}catch{}}},localAddress:t,authEnv:{ANTHROPIC_AUTH_SOCKET:t}}}async function D(e){let t=h(),n=Bun.serve({port:0,hostname:`127.0.0.1`,fetch:e=>w(e,t)}),r=n.port;return i(`[SSHAuthProxy] listening on TCP 127.0.0.1:${r} (nonce-protected)`),{proxy:{stop(){n.stop(!0)}},localAddress:`127.0.0.1:${r}`,authEnv:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${r}`,ANTHROPIC_AUTH_NONCE:t}}}a();var O=15e3,k=class extends Error{constructor(e){super(e),this.name=`SSHProbeError`}};async function A(e,t){t?.(`Probing remote host…`);let n=Bun.spawn([`ssh`,`-o`,`BatchMode=yes`,`-o`,`ConnectTimeout=10`,e,`CLAUDE_BIN=$(test -x "$HOME/.local/bin/claude" && echo "$HOME/.local/bin/claude" || command -v claude 2>/dev/null); echo "$CLAUDE_BIN"; $CLAUDE_BIN --version 2>/dev/null; uname -sm; pwd`],{stdin:`ignore`,stdout:`pipe`,stderr:`pipe`}),r=await Promise.race([n.exited,new Promise((e,t)=>setTimeout(()=>t(new k(`SSH probe timed out after ${O/1e3}s`)),O))]),a=await new Response(n.stdout).text(),o=await new Response(n.stderr).text();if(r!==0)throw new k(`SSH probe failed: ${o.trim()||`exit code ${r}`}`);let s=a.split(`
3
3
  `).map(e=>e.trim()).filter(Boolean);i(`[SSHProbe] raw lines: ${JSON.stringify(s)}`);let c=s.findIndex(e=>/^(Linux|Darwin)\s/.test(e));if(c===-1)throw new k(`Could not detect remote platform (uname output missing)`);let l=c>=2&&s[c-2]||null,u=c>=1&&s[c-1]||null,d=u&&/^\d+\.\d+/.test(u)?u:null,f=l?.startsWith(`/`)??!1,p=s[c+1]||`/`,[m,h]=s[c].split(/\s+/),g=m===`Darwin`?`darwin`:`linux`,_=h===`aarch64`||h===`arm64`?`arm64`:`x64`;return t?.(`Detected ${g}/${_}`),{hasBinary:f&&d!==null,remoteVersion:d,remotePlatform:g,remoteArch:_,defaultCwd:p,binaryPath:f?l:null}}a();var j=6e4,M=`~/.local/bin`,N=`claude-code-cli.js`,P=`claude`;async function F(e,t,n=j){let r=Bun.spawn([`ssh`,`-o`,`ConnectTimeout=10`,e,t],{stdout:`pipe`,stderr:`pipe`}),i=setTimeout(()=>r.kill(),n);try{let[e,t]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]),n=await r.exited;return{stdout:e.trim(),stderr:t.trim(),exitCode:n}}finally{clearTimeout(i)}}function I(){let e=f(import.meta.dir,`../..`),t=f(e,`dist/cli.js`);if(p(t))return t;let n=f(e,`src/entrypoints/cli.tsx`);if(p(n))return n;throw Error("Cannot find local CLI binary to deploy. Run `bun run build` first.")}async function L(e){let{host:t,remotePlatform:n,remoteArch:r,localVersion:a,onProgress:o}=e;if(n!==`linux`&&n!==`darwin`)throw Error(`Remote platform "${n}" is not supported. Only linux and darwin are supported.`);i(`[SSHDeploy] deploying to ${t} (${n}/${r}, v${a})`);let s=I();i(`[SSHDeploy] local binary: ${s}`),o?.(`Creating remote directory...`);let c=await F(t,`mkdir -p ${M}`);if(c.exitCode!==0)throw Error(`Failed to create remote directory: ${c.stderr}`);o?.(`Uploading binary...`);let l=`${M}/${N}`,u=Bun.spawn([`scp`,`-o`,`ConnectTimeout=10`,s,`${t}:${l}`],{stdout:`pipe`,stderr:`pipe`}),d=setTimeout(()=>u.kill(),j),f=await new Response(u.stderr).text(),p=await u.exited;if(clearTimeout(d),p!==0)throw Error(`SCP upload failed (exit ${p}): ${f.trim()}`);o?.(`Installing wrapper script...`);let m=await F(t,[`cat > ${M}/${P} << 'WRAPPER'`,`#!/bin/sh`,`exec bun ${M}/${N} "$@"`,`WRAPPER`,`chmod +x ${M}/${P}`].join(`
4
4
  `));if(m.exitCode!==0)throw Error(`Failed to install wrapper script: ${m.stderr}`);o?.(`Verifying installation...`);let h=await F(t,`${M}/${P} --version`);if(h.exitCode!==0)throw Error(`Binary deployed but verification failed (exit ${h.exitCode}): ${h.stderr}`);return i(`[SSHDeploy] deployed successfully, remote version: ${h.stdout}`),o?.(`Deployed v${h.stdout}`),`${M}/${P}`}a(),o();var R=3e4,z=20,B=class extends Error{constructor(e){super(e),this.name=`SSHSessionError`}};async function V(e,t){let{host:n,localVersion:r,extraCliArgs:a,remoteBin:o}=e,s=t?.onProgress,c,l=`/`;if(o){s?.(`Using custom remote binary, skipping probe/deploy…`),c=o,i(`[SSH] custom remoteBin: ${o}`);try{let e=Bun.spawn([`ssh`,`-o`,`BatchMode=yes`,`-o`,`ConnectTimeout=5`,n,`pwd`],{stdin:`ignore`,stdout:`pipe`,stderr:`ignore`});await e.exited;let t=(await new Response(e.stdout).text()).trim();t.startsWith(`/`)&&(l=t)}catch{}}else{let e=await A(n,s);i(`[SSH] probe result: ${JSON.stringify(e)}`),l=e.defaultCwd,c=e.binaryPath??`~/.local/bin/claude`,(!e.hasBinary||e.remoteVersion!==r)&&(s?.(e.hasBinary?`Updating remote binary (${e.remoteVersion} → ${r})…`:`Deploying binary to remote…`),c=await L({host:n,remotePlatform:e.remotePlatform,remoteArch:e.remoteArch,localVersion:r,onProgress:s}))}let{proxy:u,localAddress:d,authEnv:f}=await T();i(`[SSH] auth proxy listening on ${d}`);let p=h().slice(0,8),m=process.platform===`win32`,g=[];for(let[e,t]of Object.entries(f))g.push(`${e}=${t}`);g.push(c,`--output-format`,`stream-json`,`--input-format`,`stream-json`,`--verbose`,`-p`),e.cwd&&g.push(`--cwd`,e.cwd),e.permissionMode&&g.push(`--permission-mode`,e.permissionMode),e.dangerouslySkipPermissions&&g.push(`--dangerously-skip-permissions`),g.push(...a);let _=[`ssh`];if(m){let e=d.split(`:`)[1],t=1e4+Math.floor(Math.random()*5e4);_.push(`-R`,`${t}:127.0.0.1:${e}`);let n=g.findIndex(e=>e.startsWith(`ANTHROPIC_BASE_URL=`));n!==-1&&(g[n]=`ANTHROPIC_BASE_URL=http://127.0.0.1:${t}`)}else{let e=`/tmp/claude-ssh-auth-${p}.sock`;_.push(`-R`,`${e}:${d}`),_.push(`-o`,`StreamLocalBindUnlink=yes`);let t=g.indexOf(`ANTHROPIC_AUTH_SOCKET=${f.ANTHROPIC_AUTH_SOCKET}`);t!==-1&&(g[t]=`ANTHROPIC_AUTH_SOCKET=${e}`)}_.push(n,g.join(` `)),s?.(`Starting remote session…`),i(`[SSH] spawning: ${_.join(` `)}`);let v;try{v=Bun.spawn(_,{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`})}catch(e){throw u.stop(),new B(`Failed to spawn SSH process: ${e instanceof Error?e.message:String(e)}`)}let y=[];W(v,y);let x;if(o){let t=await Promise.race([v.exited.then(e=>e),new Promise(e=>setTimeout(()=>e(null),3e3))]);if(t!==null){u.stop();let e=y.join(``).trim();throw new B(`Remote process exited immediately (code ${t})${e?`: ${e}`:``}`)}x=e.cwd||l||`/`}else try{x=await U(v,e.cwd||l)}catch(e){throw u.stop(),v.kill(),e}i(`[SSH] remote session initialized, remoteCwd=${x}`);let S=v,C=async()=>{i(`[SSH] reconnect: re-spawning SSH process with --continue`);let e=[..._],t=e.length-1,n=e[t];n.includes(`--continue`)||(e[t]=n.replace(/ -p(?:\s|$)/,` -p --continue `));let r=Bun.spawn(e,{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`}),a=[];return W(r,a),await U(r,x),S=r,y.length=0,y.push(...a),r};return{remoteCwd:x,get proc(){return S},proxy:u,createManager(e){return new b(S,{...e,reconnect:C})},getStderrTail(){return y.slice(-20).join(``)}}}async function H(e){let{proxy:t,authEnv:n}=await T(),r=[`--output-format`,`stream-json`,`--input-format`,`stream-json`,`-p`];e.cwd&&r.push(`--cwd`,e.cwd),e.permissionMode&&r.push(`--permission-mode`,e.permissionMode),e.dangerouslySkipPermissions&&r.push(`--dangerously-skip-permissions`);let a=d(r),o;try{o=Bun.spawn([a.execPath,...a.args],{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`,env:{...a.env,...n}})}catch(e){throw t.stop(),new B(`Failed to spawn local CLI process: ${e instanceof Error?e.message:String(e)}`)}i(`[SSH] local session spawned, waiting for init message...`);let s=[];W(o,s);let c;try{c=await U(o,e.cwd)}catch(e){throw t.stop(),o.kill(),e}i(`[SSH] local session initialized, remoteCwd=${c}`);let l=o,u=async()=>{i(`[SSH] local reconnect: re-spawning CLI with --continue`);let e=[...r];e.includes(`--continue`)||e.push(`--continue`);let t=d(e),a=Bun.spawn([t.execPath,...t.args],{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`,env:{...t.env,...n}}),o=[];return W(a,o),await U(a,c),l=a,s.length=0,s.push(...o),a};return{remoteCwd:c,get proc(){return l},proxy:t,createManager(e){return new b(l,{...e,reconnect:u})},getStderrTail(){return s.slice(-20).join(``)}}}async function U(e,t){let n=e.stdout;if(!n)throw new B(`Child process stdout is not readable`);let i=n.getReader(),a=new TextDecoder,o=``,s=Date.now()+R;try{for(;Date.now()<s;){let e=s-Date.now(),n=await Promise.race([i.read(),new Promise((t,n)=>setTimeout(()=>n(new B(`Remote CLI did not initialize within 30 seconds. Check SSH connectivity and remote binary.`)),e))]);if(n.done)throw new B(`Child process exited before sending init message`);o+=a.decode(n.value,{stream:!0});let c=o.split(`
@@ -0,0 +1 @@
1
+ import{a as e,i as t,n,r}from"./createSession-Dgwxk1WA.js";t();export{n as createBridgeSession,r as getBridgeSession,e as updateBridgeSessionTitle};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{P as t,R as n,c as r,i}from"./debug-D7OBvqC2.js";import{i as a,t as o}from"./sessionIdCompat-Dgp6PW_1.js";import{i as s,o as c}from"./debugUtils-B-GMBTBk.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-DsqlBO-Q.js`),{getOrganizationUUID:p}=await import(`./client-Byat5HpG.js`),{getOauthConfig:m}=await import(`./oauth-U649LV5H.js`),{getOAuthHeaders:h}=await import(`./api-CGk-0H2x.js`),{parseGitHubRepository:g}=await import(`./detectRepository-CWI2xcdR.js`),{getDefaultBranch:_}=await import(`./git-Bujlb5tq.js`),{getMainLoopModel:v}=await import(`./model-DaYZWYJe.js`),{default:y}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-Ctl7I_RR.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-CWI2xcdR.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-DsqlBO-Q.js`),{getOrganizationUUID:a}=await import(`./client-Byat5HpG.js`),{getOauthConfig:o}=await import(`./oauth-U649LV5H.js`),{getOAuthHeaders:c}=await import(`./api-CGk-0H2x.js`),{default:l}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-Ctl7I_RR.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-DsqlBO-Q.js`),{getOrganizationUUID:i}=await import(`./client-Byat5HpG.js`),{getOauthConfig:a}=await import(`./oauth-U649LV5H.js`),{getOAuthHeaders:o}=await import(`./api-CGk-0H2x.js`),{default:c}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-Ctl7I_RR.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-DsqlBO-Q.js`),{getOrganizationUUID:c}=await import(`./client-Byat5HpG.js`),{getOauthConfig:l}=await import(`./oauth-U649LV5H.js`),{getOAuthHeaders:u}=await import(`./api-CGk-0H2x.js`),{default:d}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-Ctl7I_RR.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((()=>{i(),n(),c(),o()}));export{f as a,p as i,l as n,u as r,d as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{P as t,R as n,c as r,i}from"./debug-D58GQBDG.js";import{i as a,t as o}from"./sessionIdCompat-Dgp6PW_1.js";import{i as s,o as c}from"./debugUtils-DXBRbwCE.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-BEoTPSgC.js`),{getOrganizationUUID:p}=await import(`./client-C19cqYQS.js`),{getOauthConfig:m}=await import(`./oauth-U649LV5H.js`),{getOAuthHeaders:h}=await import(`./api-BHBK9axp.js`),{parseGitHubRepository:g}=await import(`./detectRepository-Cv9-k6dg.js`),{getDefaultBranch:_}=await import(`./git-zJCasBa6.js`),{getMainLoopModel:v}=await import(`./model-DX0TtzqX.js`),{default:y}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-CJMjDoaP.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-Cv9-k6dg.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-BEoTPSgC.js`),{getOrganizationUUID:a}=await import(`./client-C19cqYQS.js`),{getOauthConfig:o}=await import(`./oauth-U649LV5H.js`),{getOAuthHeaders:c}=await import(`./api-BHBK9axp.js`),{default:l}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-CJMjDoaP.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-BEoTPSgC.js`),{getOrganizationUUID:i}=await import(`./client-C19cqYQS.js`),{getOauthConfig:a}=await import(`./oauth-U649LV5H.js`),{getOAuthHeaders:o}=await import(`./api-BHBK9axp.js`),{default:c}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-CJMjDoaP.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-BEoTPSgC.js`),{getOrganizationUUID:c}=await import(`./client-C19cqYQS.js`),{getOauthConfig:l}=await import(`./oauth-U649LV5H.js`),{getOAuthHeaders:u}=await import(`./api-BHBK9axp.js`),{default:d}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-CJMjDoaP.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((()=>{i(),n(),c(),o()}));export{f as a,p as i,l as n,u as r,d as t};
@@ -0,0 +1,40 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$u as n,Ci as r,Dp as i,Gc as a,Hu as o,Mu as s,Nr as c,Op as l,Pu as u,Qu as d,Si as f,Sr as ee,Uu as p,Uw as m,Ww as h,br as g,cd as te,fr as _,gC as v,ir as y,ld as ne,oi as re,qc as ie,uC as b,wr as x}from"./loadAgentsDir-DaNpxaO-.js";import{C as ae,D as S,Gr as C,H as oe,I as w,P as T,T as E,Wt as se,Xn as ce,ai as D,di as O,fi as le,hn as ue,k as de,oi as fe,ot as pe,p as k,t as me}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{$ as he,Ut as ge,ft as _e}from"./state-D5D6QpTX.js";import{S as j,c as M,i as ve,x as ye}from"./debug-D58GQBDG.js";import{In as N,Ln as be}from"./settings-3xZ0fsvE.js";import{i as xe,m as Se}from"./git-By_J4XJL.js";import{a as Ce,o as we,s as Te}from"./log-CZ7ploQm.js";import{n as Ee,r as P}from"./analytics-DJobLaWP.js";import{C as De,d as Oe,m as ke,v as Ae}from"./startupProfiler-CbzxVmbv.js";import{_ as F,h as I}from"./model-Do0f476p.js";import{i as je,r as Me}from"./shellQuote-Ddgr1vif.js";import{n as Ne,t as Pe}from"./useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js";import{t as Fe}from"./SearchBox-CwwV0W-w.js";import{n as Ie,t as Le}from"./useSearchInput-QL_VtdJD.js";import{n as L,t as R}from"./Messages-BZDFMYBT.js";function Re({log:e,onExit:t,onSelect:n}){let[r,o]=z.useState(null);z.useEffect(()=>{o(null),x(e)&&c(e).then(o)},[e]);let s=x(e)&&r===null,l=r??e,u=_(l)||``,d=a();return se(`confirm:no`,t,{context:`Confirmation`}),se(`confirm:yes`,(0,z.useCallback)(()=>{n(r??e)},[n,r,e]),{context:`Confirmation`}),s?(0,B.jsxs)(w,{flexDirection:`column`,padding:1,children:[(0,B.jsx)(k,{message:`Loading session…`}),(0,B.jsx)(T,{dimColor:!0,children:(0,B.jsx)(E,{children:(0,B.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,B.jsxs)(w,{flexDirection:`column`,children:[(0,B.jsx)(R,{messages:l.messages,tools:d,commands:[],verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:u,screen:`transcript`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1}),(0,B.jsxs)(w,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,B.jsxs)(T,{children:[ke(l.modified),` · `,l.messageCount,` messages`,l.gitBranch?` · ${l.gitBranch}`:``]}),(0,B.jsx)(T,{dimColor:!0,children:(0,B.jsxs)(E,{children:[(0,B.jsx)(S,{shortcut:`Enter`,action:`resume`}),(0,B.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var z,B,ze=e((()=>{z=t(D(),1),me(),b(),ie(),Ae(),g(),l(),L(),B=A()}));function V(e,t){if(e===U)return 5;let n=C(e),r=t?Math.min(n,t-W-G):n;return Math.max(0,r)+W+G}function Be(e,t){let n=t-W-G;return C(e)<=n?e:n<=1?e.charAt(0):De(e,n)}function Ve({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,o=Math.max(Ke,qe),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=>V(e,l)),d=0,f=e.length;if(u.reduce((e,t,n)=>e+t+ +(n<u.length-1),0)>s){let t=s-Ge,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 ee=d,p=e.length-f,m=e.slice(d,f),h=m.map((e,t)=>d+t);return(0,H.jsxs)(w,{flexDirection:`row`,gap:1,children:[(0,H.jsx)(T,{color:`suggestion`,children:i}),ee>0&&(0,H.jsxs)(T,{dimColor:!0,children:[K,ee]}),m.map((e,t)=>{let n=h[t]===c,r=e===U?e:`#${Be(e,l-W)}`;return(0,H.jsxs)(T,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),p>0?(0,H.jsxs)(T,{dimColor:!0,children:[He,p,Ue]}):(0,H.jsx)(T,{dimColor:!0,children:We})]})}var H,U,W,G,K,He,Ue,We,Ge,Ke,qe,Je=e((()=>{me(),Ae(),H=A(),U=`All`,W=2,G=1,K=`← `,He=`→`,Ue=` (tab to cycle)`,We=`(tab to cycle)`,Ge=5,Ke=18,qe=14}));function Ye({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:f,getParentPrefix:ee,getChildPrefix:p,onUpFromFirstItem:m}){let[h,g]=q.useState(new Set),te=q.useRef(!1),_=q.useRef(null),v=q.useCallback(e=>l?l(e):h.has(e),[l,h]),y=q.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=v(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,v]),ne=q.useCallback(e=>e?`▼ `:`▶ `,[]),re=q.useCallback(e=>` ▸ `,[]),ie=ee??ne,b=p??re,x=q.useCallback(e=>{let t=``;return e.hasChildren?t=ie(e.isExpanded):e.depth>0&&(t=b(e.depth)),t+e.node.label},[ie,b]),ae=q.useMemo(()=>y.map(e=>({label:x(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[y,x]),S=q.useMemo(()=>{let e=new Map;return y.forEach(t=>e.set(t.node.id,t.node)),e},[y]),C=q.useCallback(e=>y.find(t=>t.node.id===e),[y]),oe=q.useCallback((e,t)=>{C(e)?.hasChildren&&(t?u?u(e):g(t=>new Set(t).add(e)):f?f(e):g(t=>{let n=new Set(t);return n.delete(e),n}))},[C,u,f]);return(0,Xe.jsx)(w,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||s)return;let t=C(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),oe(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),oe(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),te.current=!0,oe(t.parentId,!1),r)){let e=S.get(t.parentId);e&&r(e)}}}},children:(0,Xe.jsx)(d,{options:ae,onChange:q.useCallback(e=>{let n=S.get(e);n&&t(n)},[S,t]),onFocus:q.useCallback(e=>{if(te.current){te.current=!1;return}if(_.current!==e&&(_.current=e,r)){let t=S.get(e);t&&r(t)}},[r,S]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:o,isDisabled:s,hideIndexes:c,onUpFromFirstItem:m})})}var q,Xe,Ze=e((()=>{q=t(D(),1),me(),n(),Xe=A()}));function Qe(e,t){return De(e.replace(/\s+/g,` `).trim(),t)}function $e({before:e,match:t,after:n},r){return O.dim(e)+r(t)+O.dim(n)}function et(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 tt(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?ct:i?lt:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${Qe(Ce(e),l)}${c}${s}`}function nt(e,t){let{isChild:n=!1,showProjectPath:r=!1}=t||{},i=n?` `:``,a=Oe(e),o=r&&e.projectPath?` · ${e.projectPath}`:``;return i+a+o}function rt({logs:e,maxHeight:t=1/0,forceWidth:n,onCancel:r,onSelect:a,onLogsChanged:c,onLoadMore:l,initialSearchQuery:u,showAllProjects:p=!1,onToggleAllProjects:m,onAgenticSearch:h}){let g=pe(),v=n===void 0?g.columns:n,ne=Ne(r),ie=ce(),b=ee(),[x]=oe(),C=o(x),D=J.useMemo(()=>e=>fe(e,C.warning),[C.warning]),[O,le]=J.useState(null),[k,me]=J.useState(!1),[A,ge]=J.useState(!1),[j,M]=J.useState(!1),ve=J.useMemo(()=>he(),[]),[ye,N]=J.useState(``),[be,Se]=J.useState(0),[we,Te]=J.useState(new Set),[Ee,De]=J.useState(null),[ke,Ae]=J.useState(1),[F,I]=J.useState(`list`),[je,Me]=J.useState(null),Pe=J.useRef(null),[Fe,Le]=J.useState(0),[L,R]=J.useState({status:`idle`}),[z,B]=J.useState(!1),ze=J.useRef(null),{query:V,setQuery:Be,cursorOffset:H}=Ie({isActive:F===`search`&&L.status!==`searching`,onExit:()=>{I(`list`),P(`tengu_session_search_toggled`,{enabled:!1})},onExitUp:()=>{I(`list`),P(`tengu_session_search_toggled`,{enabled:!1})},passthroughCtrlKeys:[`n`],initialQuery:u||``}),U=J.useDeferredValue(V),[W,G]=J.useState(``);J.useEffect(()=>{if(!U){G(``);return}let e=setTimeout(G,300,U);return()=>clearTimeout(e)},[U]);let[K,He]=J.useState(null),[Ue,We]=J.useState(!1);J.useEffect(()=>{xe().then(e=>le(e)),f(ve).then(e=>{M(e.length>1)})},[ve]);let Ge=J.useMemo(()=>new Map(e.map(e=>[e,at(e)])),[e]),Ke=J.useMemo(()=>null,[e,Ge,!1]),qe=J.useMemo(()=>st(e),[e]),Je=qe.length>0,q=J.useMemo(()=>Je?[`All`,...qe]:[],[Je,qe]),Xe=q.length>0&&Fe<q.length?Fe:0,Ze=q[Xe],rt=Ze===`All`?void 0:Ze,it=+!!Je,ct=J.useMemo(()=>{let t=e;return b&&(t=e.filter(e=>{let t=_e(),n=_(e);return!!(t&&n===t||e.customTitle||y(e.messages)||e.firstPrompt||e.customTitle)})),rt!==void 0&&(t=t.filter(e=>e.tag===rt)),k&&O&&(t=t.filter(e=>e.gitBranch===O)),j&&!A&&(t=t.filter(e=>e.projectPath===ve)),t},[e,b,rt,k,O,j,A,ve]),lt=J.useMemo(()=>{if(!V)return ct;let e=V.toLowerCase();return ct.filter(t=>{let n=Ce(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)})},[ct,V]);J.useEffect(()=>{},[U,W,!1]),J.useEffect(()=>{He(null),We(!1)},[W,Ke,!1]);let{filteredLogs:ut,snippets:X}=J.useMemo(()=>{let e=new Map,t=lt;if(K&&W&&K.query===W){for(let t of K.results)if(t.searchableText){let n=et(t.searchableText,W,dt);n&&e.set(t.log,n)}let n=new Set(t.map(e=>e.messages[0]?.uuid)),r=K.results.map(e=>e.log).filter(e=>!n.has(e.messages[0]?.uuid));t=[...t,...r]}return{filteredLogs:t,snippets:e}},[lt,K,W]),Z=J.useMemo(()=>L.status===`results`&&L.results.length>0?L.results:ut,[L,ut]),Q=Math.max(30,v-4),ft=J.useMemo(()=>{if(!b)return[];let e=ot(Z);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=Z.indexOf(n),i=X.get(n),a=i?$e(i,D):null;if(t.length===1){let t=nt(n,{showProjectPath:p});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:tt(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?$e(i,D):null,o=nt(t,{isChild:!0,showProjectPath:p});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:tt(t,Q,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),c=nt(n,{showProjectPath:p});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:tt(n,Q,{isGroupHeader:!0,forkCount:o}),description:a?`${c}\n ${a}`:c,dimDescription:!0,children:s}})},[b,Z,Q,p,X,D]),pt=J.useMemo(()=>b?[]:Z.map((e,t)=>{let n=Qe(Ce(e)+(e.isSidechain?` (sidechain)`:``),Q),r=Oe(e),i=p&&e.projectPath?` · ${e.projectPath}`:``,a=X.get(e),o=a?$e(a,D):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[b,Z,D,Q,p,X]),$=Ee?.value.log??null,mt=()=>{if(!b||!$)return``;let e=_($);if(!e)return``;let t=Z.filter(t=>_(t)===e);if(!(t.length>1))return``;let n=we.has(e);return t.indexOf($)>0||n?`← to collapse`:`→ to expand`},ht=J.useCallback(async()=>{let e=$?_($):void 0;if(!$||!e){I(`list`),N(``);return}ye.trim()&&(await re(e,ye.trim(),$.fullPath),b&&c&&c()),I(`list`),N(``)},[$,ye,c,b]),gt=J.useCallback(()=>{I(`list`),P(`tengu_session_search_toggled`,{enabled:!1})},[]),_t=J.useCallback(()=>{I(`search`),P(`tengu_session_search_toggled`,{enabled:!0})},[]),vt=J.useCallback(async()=>{if(!V.trim()||!h||!0)return;ze.current?.abort();let t=new AbortController;ze.current=t,R({status:`searching`}),P(`tengu_agentic_search_started`,{query_length:V.length});try{let n=await h(V,e,t.signal);if(t.signal.aborted)return;R({status:`results`,results:n,query:V}),P(`tengu_agentic_search_completed`,{query_length:V.length,results_count:n.length})}catch(e){if(t.signal.aborted)return;R({status:`error`,message:e instanceof Error?e.message:`Search failed`}),P(`tengu_agentic_search_error`,{query_length:V.length})}},[V,h,!1,e]);J.useEffect(()=>{L.status!==`idle`&&L.status!==`searching`&&(L.status===`results`&&L.query!==V||L.status===`error`)&&R({status:`idle`})},[V,L]),J.useEffect(()=>()=>{ze.current?.abort()},[]);let yt=J.useRef(L.status);J.useEffect(()=>{let e=yt.current;if(yt.current=L.status,e===`searching`&&L.status===`results`){if(b&&ft.length>0)De(ft[0]);else if(!b&&Z.length>0){let e=Z[0];De({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[L.status,b,ft,Z]);let bt=J.useCallback(e=>{let t=parseInt(e,10),n=Z[t];!n||Pe.current===t.toString()||(Pe.current=t.toString(),De({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),Ae(t+1))},[Z]),xt=J.useCallback(e=>{De(e);let t=Z.findIndex(t=>_(t)===_(e.value.log));t>=0&&Ae(t+1)},[Z]);se(`confirm:no`,()=>{ze.current?.abort(),R({status:`idle`}),P(`tengu_agentic_search_cancelled`,{})},{context:`Confirmation`,isActive:F!==`preview`&&L.status===`searching`}),se(`confirm:no`,()=>{I(`list`),N(``)},{context:`Settings`,isActive:F===`rename`&&L.status!==`searching`}),se(`confirm:no`,()=>{Be(``),B(!1),r?.()},{context:`Confirmation`,isActive:F!==`preview`&&F!==`rename`&&F!==`search`&&z&&L.status!==`searching`}),ue((e,t)=>{if(F!==`preview`&&L.status!==`searching`&&F!==`rename`)if(F===`search`)e.toLowerCase()===`n`&&t.ctrl?gt():(t.return||t.downArrow)&&V.trim();else{if(z){if(t.return){vt(),B(!1);return}else if(t.downArrow){B(!1);return}else if(t.upArrow){I(`search`),B(!1);return}}if(Je&&t.tab){let e=t.shift?-1:1;Le(t=>{let n=((t<q.length?t:0)+q.length+e)%q.length,r=q[n];return P(`tengu_session_tag_filter_changed`,{is_all:r===`All`,tag_count:qe.length}),n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();if(r===`a`&&t.ctrl&&m)m(),P(`tengu_session_all_projects_toggled`,{enabled:!p});else if(r===`b`&&t.ctrl){let e=!k;me(e),P(`tengu_session_branch_filter_toggled`,{enabled:e})}else if(r===`w`&&t.ctrl&&j){let e=!A;ge(e),P(`tengu_session_worktree_filter_toggled`,{enabled:e})}else r===`/`&&n?(I(`search`),P(`tengu_session_search_toggled`,{enabled:!0})):r===`r`&&t.ctrl&&$?(I(`rename`),N(``),P(`tengu_session_rename_started`,{})):r===`v`&&t.ctrl&&$?(Me($),I(`preview`),P(`tengu_session_preview_opened`,{messageCount:$.messageCount})):$&&n&&e.length>0&&!/^\s+$/.test(e)&&(I(`search`),Be(e),P(`tengu_session_search_toggled`,{enabled:!0}))}},{isActive:!0});let St=[];k&&O&&St.push(O),j&&!A&&St.push(`current worktree`);let Ct=8+ +(St.length>0&&F!==`search`)+it,wt=Math.max(1,Math.floor((t-Ct-2)/3));return J.useEffect(()=>{if(!l)return;let e=wt*2;ke+e>=Z.length&&l(wt*3)},[ke,wt,Z.length,l]),e.length===0?null:F===`preview`&&je&&b?(0,Y.jsx)(Re,{log:je,onExit:()=>{I(`list`),Me(null)},onSelect:a}):(0,Y.jsxs)(w,{flexDirection:`column`,height:t-1,children:[(0,Y.jsx)(w,{flexShrink:0,children:(0,Y.jsx)(ae,{color:`suggestion`})}),(0,Y.jsx)(w,{flexShrink:0,children:(0,Y.jsx)(T,{children:` `})}),Je?(0,Y.jsx)(Ve,{tabs:q,selectedIndex:Xe,availableWidth:v,showAllProjects:p}):(0,Y.jsx)(w,{flexShrink:0,children:(0,Y.jsxs)(T,{bold:!0,color:`suggestion`,children:[`Resume Session`,F===`list`&&Z.length>wt&&(0,Y.jsxs)(T,{dimColor:!0,children:[` `,`(`,ke,` of `,Z.length,`)`]})]})}),(0,Y.jsx)(de,{query:V,isFocused:F===`search`,isTerminalFocused:ie,cursorOffset:H}),St.length>0&&F!==`search`&&(0,Y.jsx)(w,{flexShrink:0,paddingLeft:2,children:(0,Y.jsx)(T,{dimColor:!0,children:(0,Y.jsx)(E,{children:St})})}),(0,Y.jsx)(w,{flexShrink:0,children:(0,Y.jsx)(T,{children:` `})}),L.status===`searching`&&(0,Y.jsxs)(w,{paddingLeft:1,flexShrink:0,children:[(0,Y.jsx)(s,{}),(0,Y.jsx)(T,{children:` Searching…`})]}),L.status===`results`&&L.results.length>0&&(0,Y.jsx)(w,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(T,{dimColor:!0,italic:!0,children:`Work Mate found these results:`})}),L.status===`results`&&L.results.length===0&&ut.length===0&&(0,Y.jsx)(w,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(T,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),L.status===`error`&&ut.length===0&&(0,Y.jsx)(w,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(T,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!V.trim()&&h&&!1,L.status===`searching`?null:F===`rename`&&$?(0,Y.jsxs)(w,{paddingLeft:2,flexDirection:`column`,children:[(0,Y.jsx)(T,{bold:!0,children:`Rename session:`}),(0,Y.jsx)(w,{paddingTop:1,children:(0,Y.jsx)(te,{value:ye,onChange:N,onSubmit:ht,placeholder:Ce($,`Enter new session name`),columns:v,cursorOffset:be,onChangeCursorOffset:Se,showCursor:!0})})]}):b?(0,Y.jsx)(Ye,{nodes:ft,onSelect:e=>{a(e.value.log)},onFocus:xt,onCancel:r,focusNodeId:Ee?.id,visibleOptionCount:wt,layout:`expanded`,isDisabled:F===`search`||z,hideIndexes:!1,isNodeExpanded:e=>{if(F===`search`||k)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?we.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&(Te(e=>new Set(e).add(t)),P(`tengu_session_group_expanded`,{}))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&Te(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:_t}):(0,Y.jsx)(d,{options:pt,onChange:e=>{let t=Z[parseInt(e,10)];t&&a(t)},visibleOptionCount:wt,onCancel:r,onFocus:bt,defaultFocusValue:Ee?.id.toString(),layout:`expanded`,isDisabled:F===`search`||z,onUpFromFirstItem:_t}),(0,Y.jsx)(w,{paddingLeft:2,children:ne.pending?(0,Y.jsxs)(T,{dimColor:!0,children:[`Press `,ne.keyName,` again to exit`]}):F===`rename`?(0,Y.jsx)(T,{dimColor:!0,children:(0,Y.jsxs)(E,{children:[(0,Y.jsx)(S,{shortcut:`Enter`,action:`save`}),(0,Y.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):L.status===`searching`?(0,Y.jsx)(T,{dimColor:!0,children:(0,Y.jsxs)(E,{children:[(0,Y.jsx)(T,{children:`Searching with Work Mate…`}),(0,Y.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):z?(0,Y.jsx)(T,{dimColor:!0,children:(0,Y.jsxs)(E,{children:[(0,Y.jsx)(S,{shortcut:`Enter`,action:`search`}),(0,Y.jsx)(S,{shortcut:`↓`,action:`skip`}),(0,Y.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):F===`search`?(0,Y.jsx)(T,{dimColor:!0,children:(0,Y.jsxs)(E,{children:[(0,Y.jsx)(T,{children:`Type to Search`}),(0,Y.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,Y.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,Y.jsx)(T,{dimColor:!0,children:(0,Y.jsxs)(E,{children:[m&&(0,Y.jsx)(S,{shortcut:`Ctrl+A`,action:`show ${p?`current dir`:`all projects`}`}),O&&(0,Y.jsx)(S,{shortcut:`Ctrl+B`,action:`toggle branch`}),j&&(0,Y.jsx)(S,{shortcut:`Ctrl+W`,action:`show ${A?`current worktree`:`all worktrees`}`}),(0,Y.jsx)(S,{shortcut:`Ctrl+V`,action:`preview`}),(0,Y.jsx)(S,{shortcut:`Ctrl+R`,action:`rename`}),(0,Y.jsx)(T,{children:`Type to search`}),(0,Y.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),mt()&&(0,Y.jsx)(T,{children:mt()})]})})})]})}function it(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 at(e){let t=(e.messages.length<=ut?e.messages:[...e.messages.slice(0,X),...e.messages.slice(-1e3)]).map(it).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 ot(e){let t=new Map;for(let n of e){let e=_(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 st(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 J,Y,ct,lt,ut,X,Z,dt,Q=e((()=>{le(),J=t(D(),1),ge(),Pe(),Le(),v(),me(),b(),Ee(),Ae(),r(),Se(),we(),g(),p(),l(),n(),Fe(),ze(),u(),Je(),ne(),Ze(),Y=A(),ct=2,lt=4,ut=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!!(Ce(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 r=e.toLowerCase(),i=t.filter(e=>$(e,r)),a;if(i.length>=_t)a=i.slice(0,_t);else{let e=t.filter(e=>!$(e,r)),n=_t-i.length;a=[...i,...e.slice(0,n)]}M(`Agentic search: ${a.length}/${t.length} logs, query="${e}", matching: ${i.length}, with messages: ${N(a,e=>e.messages?.length>0)}`);let o=a.map(async e=>{if(x(e))try{return await c(e)}catch(t){return Te(t),e}return e}),s=await Promise.all(o);M(`Agentic search: loaded ${N(s,e=>e.messages?.length>0)}/${a.length} logs with transcripts`);let l=`Sessions:
2
+ ${s.map((e,t)=>{let n=[`${t}:`],r=Ce(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.`;M(`Agentic search prompt (first 500 chars): ${l.slice(0,500)}...`);try{let e=I();M(`Agentic search using model: ${e}`);let t=(await h({model:e,system:vt,messages:[{role:`user`,content:l}],signal:n,querySource:`session_search`})).content.find(e=>e.type===`text`);if(t?.type!==`text`)return M(`No text content in agentic search response`),[];M(`Agentic search response: ${t.text}`);let r=t.text.match(/\{[\s\S]*\}/);if(!r)return M(`Could not find JSON in agentic search response`),[];let i=(j(r[0]).relevant_indices||[]).filter(e=>e>=0&&e<s.length).map(e=>s[e]);return M(`Agentic search found ${i.length} relevant sessions`),i}catch(e){return Te(e),M(`Agentic search error: ${e}`),[]}}var ht,gt,_t,vt,yt=e((()=>{be(),ve(),we(),F(),g(),m(),ye(),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=he();if(!t||!e.projectPath||e.projectPath===n)return{isCrossProject:!1};let r=_(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${je([e.projectPath])} && claude --resume ${r}`,projectPath:e.projectPath}}var xt=e((()=>{ge(),Me(),g()}));export{rt as a,yt as i,xt as n,Q as o,mt as r,bt as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./cwd-Nh5IZNKO.js";e();export{t as getCwd};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$ as t,D as n,Ut as r}from"./state-D5D6QpTX.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 t()}}var c,l=e((()=>{r(),c=new i}));export{a as i,l as n,o as r,s as t};
@@ -1 +1 @@
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-BybjRr09.js";import{o as s,s as c}from"./log-CR0v5KUR.js";import{$r as l,N as u,R as d,_ as f,r as p,ti as m}from"./model-xI2MbgRj.js";import{Z as h,et as g}from"./esm-D9-9wS1F.js";import{f as _,p as v}from"./firstPartyEventLogger-Cw9Bc3on.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(l()!==`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=p(i.model.replace(/\[1m]$/i,``));i.model=e in u?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:`workmate`,hostname:`workmate`,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(),f(),m(),d(),_(),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_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`,`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
+ 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-DRy1I12M.js";import{o as s,s as c}from"./log-CZ7ploQm.js";import{$r as l,N as u,R as d,_ as f,r as p,ti as m}from"./model-Do0f476p.js";import{Z as h,et as g}from"./esm-CvHtYRrr.js";import{f as _,p as v}from"./firstPartyEventLogger-DqGSujCz.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(l()!==`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=p(i.model.replace(/\[1m]$/i,``));i.model=e in u?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:`workmate`,hostname:`workmate`,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(),f(),m(),d(),_(),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_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`,`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,4 +1,4 @@
1
- import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{i,l as a,o}from"./envUtils-DcaKZlRU.js";import{n as s,t as c}from"./defineProperty-C-QyHrDq.js";import{Wt as l,pt as u}from"./state-B3zvBu4R.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?.[1])t.push(`mcp`),t.push(n[1].toLowerCase());else{let n=e.match(/^([^:[]+):/);n?.[1]&&t.push(n[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);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?.[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,x,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,S=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 x({message:r,cause:Ne(n)});let a=n,o=a?.error?.type;return t===400?new Ie(t,a,r,i,o):t===401?new Le(t,a,r,i,o):t===403?new Re(t,a,r,i,o):t===404?new ze(t,a,r,i,o):t===409?new Be(t,a,r,i,o):t===422?new Ve(t,a,r,i,o):t===429?new He(t,a,r,i,o):t>=500?new Ue(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)}},x=class extends y{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},Fe=class extends x{constructor({message:e}={}){super({message:e??`Request timed out.`})}},Ie=class extends y{},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{}}));function We(e){return typeof e==`object`?e??{}:{}}function Ge(e){if(!e)return!0;for(let t in e)return!1;return!0}function Ke(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var qe,Je,Ye,Xe,Ze,Qe,$e=e((()=>{S(),qe=/^[a-z][a-z0-9+.-]*:/i,Je=e=>qe.test(e),Ye=e=>(Ye=Array.isArray,Ye(e)),Xe=Ye,Ze=(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},Qe=e=>{try{return JSON.parse(e)}catch{return}}})),et,tt=e((()=>{et=e=>new Promise(t=>setTimeout(t,e))})),C,nt=e((()=>{C=`0.81.0`}));function rt(){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 it(){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 at,ot,st,ct,lt,ut,dt=e((()=>{nt(),at=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`,ot=()=>{let e=rt();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":ct(Deno.build.os),"X-Stainless-Arch":st(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":C,"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":C,"X-Stainless-OS":ct(globalThis.process.platform??`unknown`),"X-Stainless-Arch":st(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=it();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"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":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}},st=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,ct=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`),ut=()=>lt??(lt=ot())}));function ft(){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 pt(...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 mt(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return pt({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function ht(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 gt(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 _t=e((()=>{})),vt,yt=e((()=>{vt=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)})}));function bt(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 xt=e((()=>{S()}));function St(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 Ct(e){let t;return(Tt??(t=new globalThis.TextEncoder,Tt=t.encode.bind(t)))(e)}function wt(e){let t;return(Et??(t=new globalThis.TextDecoder,Et=t.decode.bind(t)))(e)}var Tt,Et,Dt=e((()=>{}));function Ot(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 kt(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 w,T,At,jt=e((()=>{_(),Dt(),At=class{constructor(){w.set(this,void 0),T.set(this,void 0),h(this,w,new Uint8Array,`f`),h(this,T,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?Ct(e):e;h(this,w,St([g(this,w,`f`),t]),`f`);let n=[],r;for(;(r=Ot(g(this,w,`f`),g(this,T,`f`)))!=null;){if(r.carriage&&g(this,T,`f`)==null){h(this,T,r.index,`f`);continue}if(g(this,T,`f`)!=null&&(r.index!==g(this,T,`f`)+1||r.carriage)){n.push(wt(g(this,w,`f`).subarray(0,g(this,T,`f`)-1))),h(this,w,g(this,w,`f`).subarray(g(this,T,`f`)),`f`),h(this,T,null,`f`);continue}let e=g(this,T,`f`)===null?r.preceding:r.preceding-1,t=wt(g(this,w,`f`).subarray(0,e));n.push(t),h(this,w,g(this,w,`f`).subarray(r.index),`f`),h(this,T,null,`f`)}return n}flush(){return g(this,w,`f`).length?this.decode(`
1
+ import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{i,l as a,o}from"./envUtils-DcaKZlRU.js";import{n as s,t as c}from"./defineProperty-C-QyHrDq.js";import{Ut as l,ft as u}from"./state-D5D6QpTX.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?.[1])t.push(`mcp`),t.push(n[1].toLowerCase());else{let n=e.match(/^([^:[]+):/);n?.[1]&&t.push(n[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);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?.[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,x,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,S=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 x({message:r,cause:Ne(n)});let a=n,o=a?.error?.type;return t===400?new Ie(t,a,r,i,o):t===401?new Le(t,a,r,i,o):t===403?new Re(t,a,r,i,o):t===404?new ze(t,a,r,i,o):t===409?new Be(t,a,r,i,o):t===422?new Ve(t,a,r,i,o):t===429?new He(t,a,r,i,o):t>=500?new Ue(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)}},x=class extends y{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},Fe=class extends x{constructor({message:e}={}){super({message:e??`Request timed out.`})}},Ie=class extends y{},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{}}));function We(e){return typeof e==`object`?e??{}:{}}function Ge(e){if(!e)return!0;for(let t in e)return!1;return!0}function Ke(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var qe,Je,Ye,Xe,Ze,Qe,$e=e((()=>{S(),qe=/^[a-z][a-z0-9+.-]*:/i,Je=e=>qe.test(e),Ye=e=>(Ye=Array.isArray,Ye(e)),Xe=Ye,Ze=(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},Qe=e=>{try{return JSON.parse(e)}catch{return}}})),et,tt=e((()=>{et=e=>new Promise(t=>setTimeout(t,e))})),C,nt=e((()=>{C=`0.81.0`}));function rt(){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 it(){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 at,ot,st,ct,lt,ut,dt=e((()=>{nt(),at=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`,ot=()=>{let e=rt();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":ct(Deno.build.os),"X-Stainless-Arch":st(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":C,"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":C,"X-Stainless-OS":ct(globalThis.process.platform??`unknown`),"X-Stainless-Arch":st(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=it();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"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":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}},st=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,ct=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`),ut=()=>lt??(lt=ot())}));function ft(){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 pt(...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 mt(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return pt({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function ht(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 gt(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 _t=e((()=>{})),vt,yt=e((()=>{vt=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)})}));function bt(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 xt=e((()=>{S()}));function St(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 Ct(e){let t;return(Tt??(t=new globalThis.TextEncoder,Tt=t.encode.bind(t)))(e)}function wt(e){let t;return(Et??(t=new globalThis.TextDecoder,Et=t.decode.bind(t)))(e)}var Tt,Et,Dt=e((()=>{}));function Ot(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 kt(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 w,T,At,jt=e((()=>{_(),Dt(),At=class{constructor(){w.set(this,void 0),T.set(this,void 0),h(this,w,new Uint8Array,`f`),h(this,T,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?Ct(e):e;h(this,w,St([g(this,w,`f`),t]),`f`);let n=[],r;for(;(r=Ot(g(this,w,`f`),g(this,T,`f`)))!=null;){if(r.carriage&&g(this,T,`f`)==null){h(this,T,r.index,`f`);continue}if(g(this,T,`f`)!=null&&(r.index!==g(this,T,`f`)+1||r.carriage)){n.push(wt(g(this,w,`f`).subarray(0,g(this,T,`f`)-1))),h(this,w,g(this,w,`f`).subarray(g(this,T,`f`)),`f`),h(this,T,null,`f`);continue}let e=g(this,T,`f`)===null?r.preceding:r.preceding-1,t=wt(g(this,w,`f`).subarray(0,e));n.push(t),h(this,w,g(this,w,`f`).subarray(r.index),`f`),h(this,T,null,`f`)}return n}flush(){return g(this,w,`f`).length?this.decode(`
2
2
  `):[]}},w=new WeakMap,T=new WeakMap,At.NEWLINE_CHARS=new Set([`
3
3
  `,`\r`]),At.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((()=>{$e(),Pt={off:0,error:200,warn:300,info:400,debug:500},Ft=(e,t,n)=>{if(e){if(Ke(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 Wt,r=new At,i=ht(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`?Ct(n):n,r=new Uint8Array(t.length+e.length);r.set(t),r.set(e,t.length),t=r;let i;for(;(i=kt(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,Ut,Wt,Gt=e((()=>{_(),S(),_t(),jt(),Pe(),$e(),Dt(),Rt(),Ut=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=Qe(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 At,n=ht(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 pt({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=Ct(JSON.stringify(n)+`
4
4
  `);e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await t.return?.()}})}},Wt=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{C as t,P as n,R as r,c as i,i as a,x as o}from"./debug-D7OBvqC2.js";import{n as s,r as c}from"./analytics-DJobLaWP.js";function l(e){return e.replace(_,(e,t,n)=>n.length<v?`"${t}":"[REDACTED]"`:`"${t}":"${`${n.slice(0,8)}...${n.slice(-4)}`}"`)}function u(e){let t=e.replace(/\n/g,`\\n`);return t.length<=g?t:`${t.slice(0,g)}... (${t.length} chars)`}function d(e){let n=l(typeof e==`string`?e:t(e));return n.length<=g?n:`${n.slice(0,g)}... (${n.length} chars)`}function f(e){let t=n(e);if(e&&typeof e==`object`&&`response`in e){let n=e.response;if(n?.data&&typeof n.data==`object`){let e=n.data,r=typeof e.message==`string`?e.message:typeof e.error==`object`&&e.error&&`message`in e.error&&typeof e.error.message==`string`?e.error.message:void 0;if(r)return`${t}: ${r}`}}return t}function p(e){if(e&&typeof e==`object`&&`response`in e&&e.response&&typeof e.response.status==`number`)return e.response.status}function m(e){if(!(!e||typeof e!=`object`)){if(`message`in e&&typeof e.message==`string`)return e.message;if(`error`in e&&e.error!==null&&typeof e.error==`object`&&`message`in e.error&&typeof e.error.message==`string`)return e.error.message}}function h(e,t,n){t&&i(t),c(`tengu_bridge_repl_skipped`,{reason:e,...n!==void 0&&{v2:n}})}var g,_,v,y=e((()=>{s(),a(),r(),o(),g=2e3,_=RegExp(`"(${[`session_ingress_token`,`environment_secret`,`access_token`,`secret`,`token`].join(`|`)})"\\s*:\\s*"([^"]*)"`,`g`),v=16}));export{p as a,m as i,u as n,y as o,f as r,h as s,d as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{C as t,P as n,R as r,c as i,i as a,x as o}from"./debug-D58GQBDG.js";import{n as s,r as c}from"./analytics-DJobLaWP.js";function l(e){return e.replace(_,(e,t,n)=>n.length<v?`"${t}":"[REDACTED]"`:`"${t}":"${`${n.slice(0,8)}...${n.slice(-4)}`}"`)}function u(e){let t=e.replace(/\n/g,`\\n`);return t.length<=g?t:`${t.slice(0,g)}... (${t.length} chars)`}function d(e){let n=l(typeof e==`string`?e:t(e));return n.length<=g?n:`${n.slice(0,g)}... (${n.length} chars)`}function f(e){let t=n(e);if(e&&typeof e==`object`&&`response`in e){let n=e.response;if(n?.data&&typeof n.data==`object`){let e=n.data,r=typeof e.message==`string`?e.message:typeof e.error==`object`&&e.error&&`message`in e.error&&typeof e.error.message==`string`?e.error.message:void 0;if(r)return`${t}: ${r}`}}return t}function p(e){if(e&&typeof e==`object`&&`response`in e&&e.response&&typeof e.response.status==`number`)return e.response.status}function m(e){if(!(!e||typeof e!=`object`)){if(`message`in e&&typeof e.message==`string`)return e.message;if(`error`in e&&e.error!==null&&typeof e.error==`object`&&`message`in e.error&&typeof e.error.message==`string`)return e.error.message}}function h(e,t,n){t&&i(t),c(`tengu_bridge_repl_skipped`,{reason:e,...n!==void 0&&{v2:n}})}var g,_,v,y=e((()=>{s(),a(),r(),o(),g=2e3,_=RegExp(`"(${[`session_ingress_token`,`environment_secret`,`access_token`,`secret`,`token`].join(`|`)})"\\s*:\\s*"([^"]*)"`,`g`),v=16}));export{p as a,m as i,u as n,y as o,f as r,h as s,d as t};
@@ -1,4 +1,4 @@
1
- import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{a as n,t as r}from"./cliLaunch-DDA65zeR.js";import{dirname as i}from"path";import{closeSync as a,createReadStream as o,mkdirSync as s,openSync as c,readSync as l,statSync as u,unwatchFile as d,watchFile as f}from"fs";import{createInterface as p}from"readline";async function m(e){let t=0;try{if(t=u(e).size,t>0){let n=p({input:o(e,{start:0,end:t-1})});for await(let e of n)process.stdout.write(`${e}\n`)}}catch{}return console.log(`
1
+ import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{a as n,t as r}from"./cliLaunch-DDtwAolw.js";import{dirname as i}from"path";import{closeSync as a,createReadStream as o,mkdirSync as s,openSync as c,readSync as l,statSync as u,unwatchFile as d,watchFile as f}from"fs";import{createInterface as p}from"readline";async function m(e){let t=0;try{if(t=u(e).size,t>0){let n=p({input:o(e,{start:0,end:t-1})});for await(let e of n)process.stdout.write(`${e}\n`)}}catch{}return console.log(`
2
2
  [tail] Watching for new output... (Ctrl+C to detach)
3
3
  `),new Promise(n=>{let r=()=>{d(e),process.removeListener(`SIGINT`,r),console.log(`
4
4
  [tail] Detached from session.`),n()};process.on(`SIGINT`,r),f(e,{interval:300},()=>{try{let n=u(e);if(n.size<=t)return;let r=c(e,`r`);try{let e=Buffer.alloc(n.size-t);l(r,e,0,e.length,t),process.stdout.write(e),t=n.size}finally{a(r)}}catch{}})})}e();var h=class{constructor(){t(this,`name`,`detached`),t(this,`supportsInteractiveInput`,!1)}async available(){return!0}async start(e){s(i(e.logPath),{recursive:!0});let t=c(e.logPath,`a`),o=n(r(e.args,{env:{...e.env,CLAUDE_CODE_SESSION_KIND:`bg`,CLAUDE_CODE_SESSION_NAME:e.sessionName,CLAUDE_CODE_SESSION_LOG:e.logPath}}),{detached:!0,stdio:[`ignore`,t,t],cwd:e.cwd});return o.unref(),a(t),{pid:o.pid??0,sessionName:e.sessionName,logPath:e.logPath,engineUsed:`detached`}}async attach(e){if(!e.logPath)throw Error(`Session ${e.sessionId} has no log path.`);await m(e.logPath)}};export{h as DetachedEngine};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-Dj2ynhWd.js";import{c as r,i}from"./debug-D7OBvqC2.js";import{m as a,u as o}from"./git-CNhyfMtb.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(r(`Git remote URL: ${t}`),!t)return r(`No git remote URL found`),p.set(e,null),null;let n=u(t);return r(`Parsed repository: ${n?`${n.host}/${n.owner}/${n.name}`:null} from URL: ${t}`),p.set(e,n),n}catch(t){return r(`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 r(`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(),i(),a(),p=new Map}));export{d as a,m as i,c as n,u as o,l as r,s as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-Nh5IZNKO.js";import{c as r,i}from"./debug-D58GQBDG.js";import{m as a,u as o}from"./git-By_J4XJL.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(r(`Git remote URL: ${t}`),!t)return r(`No git remote URL found`),p.set(e,null),null;let n=u(t);return r(`Parsed repository: ${n?`${n.host}/${n.owner}/${n.name}`:null} from URL: ${t}`),p.set(e,n),n}catch(t){return r(`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 r(`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(),i(),a(),p=new Map}));export{d as a,m as i,c as n,u as o,l as r,s as t};
@@ -0,0 +1 @@
1
+ import{a as e,i as t,o as n}from"./detectRepository-CDOJ-M7h.js";t();export{e as parseGitHubRepository,n as parseGitRemote};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";var n,r;e((()=>{n=t(),r=async(e,t)=>{let{DiffDialog:r}=await import(`./DiffDialog-DwQTDWYh.js`);return(0,n.jsx)(r,{messages:t.messages,onDone:e})}}))();export{r as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";var n,r;e((()=>{n=t(),r=async(e,t)=>{let{DiffDialog:r}=await import(`./DiffDialog-DCpchgp5.js`);return(0,n.jsx)(r,{messages:t.messages,onDone:e})}}))();export{r as call};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-Dj2ynhWd.js";import{f as r,u as i}from"./debug-D7OBvqC2.js";import{cr as a,or as o}from"./settings-DUyIag_5.js";import{o as s,s as c}from"./log-CR0v5KUR.js";import{a as l,i as u}from"./memoize-C7xmvAQ0.js";import{basename as d,dirname as f,join as p,sep as m}from"path";function h(e,t){if(!e)return{directory:t||n(),prefix:``};let r=o(e,t);return e.endsWith(`/`)||e.endsWith(m)?{directory:r,prefix:``}:{directory:f(r),prefix:d(e)}}async function g(e){let t=C.get(e);if(t)return t;try{let t=(await i().readdir(e)).filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:`directory`})).slice(0,100);return C.set(e,t),t}catch(e){return c(e),[]}}async function _(e,t={}){let{basePath:r=n(),maxResults:i=10}=t,{directory:a,prefix:o}=h(e,r),s=await g(a),c=o.toLowerCase();return s.filter(e=>e.name.toLowerCase().startsWith(c)).slice(0,i).map(e=>({id:e.path,displayText:`${e.name}/`,description:`directory`,metadata:{type:`directory`}}))}function v(e){return e.startsWith(`~/`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`)||e===`~`||e===`.`||e===`..`}async function y(e,t=!1){let n=`${e}:${t}`,r=w.get(n);if(r)return r;try{let r=(await i().readdir(e)).filter(e=>t||!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:t.isDirectory()?`directory`:`file`})).sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name)).slice(0,100);return w.set(n,r),r}catch(e){return c(e),[]}}async function b(e,t={}){let{basePath:r=n(),maxResults:i=10,includeFiles:a=!0,includeHidden:o=!1}=t,{directory:s,prefix:c}=h(e,r),l=await y(s,o),u=c.toLowerCase(),d=l.filter(e=>!a&&e.type===`file`?!1:e.name.toLowerCase().startsWith(u)).slice(0,i),f=e.includes(`/`)||e.includes(m),p=``;if(f){let t=e.lastIndexOf(`/`),n=e.lastIndexOf(m),r=Math.max(t,n);p=e.substring(0,r+1)}return(p.startsWith(`./`)||p.startsWith(`.${m}`))&&(p=p.slice(2)),d.map(e=>{let t=p+e.name;return{id:t,displayText:e.type===`directory`?`${t}/`:t,metadata:{type:e.type}}})}var x,S,C,w,T=e((()=>{l(),t(),r(),s(),a(),x=500,S=300*1e3,C=new u({max:x,ttl:S}),w=new u({max:x,ttl:S})}));export{v as i,b as n,T as r,_ as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-Nh5IZNKO.js";import{f as r,u as i}from"./debug-D58GQBDG.js";import{ar as a,sr as o}from"./settings-3xZ0fsvE.js";import{o as s,s as c}from"./log-CZ7ploQm.js";import{a as l,i as u}from"./memoize-CumjjK2Q.js";import{basename as d,dirname as f,join as p,sep as m}from"path";function h(e,t){if(!e)return{directory:t||n(),prefix:``};let r=a(e,t);return e.endsWith(`/`)||e.endsWith(m)?{directory:r,prefix:``}:{directory:f(r),prefix:d(e)}}async function g(e){let t=C.get(e);if(t)return t;try{let t=(await i().readdir(e)).filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:`directory`})).slice(0,100);return C.set(e,t),t}catch(e){return c(e),[]}}async function _(e,t={}){let{basePath:r=n(),maxResults:i=10}=t,{directory:a,prefix:o}=h(e,r),s=await g(a),c=o.toLowerCase();return s.filter(e=>e.name.toLowerCase().startsWith(c)).slice(0,i).map(e=>({id:e.path,displayText:`${e.name}/`,description:`directory`,metadata:{type:`directory`}}))}function v(e){return e.startsWith(`~/`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`)||e===`~`||e===`.`||e===`..`}async function y(e,t=!1){let n=`${e}:${t}`,r=w.get(n);if(r)return r;try{let r=(await i().readdir(e)).filter(e=>t||!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:t.isDirectory()?`directory`:`file`})).sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name)).slice(0,100);return w.set(n,r),r}catch(e){return c(e),[]}}async function b(e,t={}){let{basePath:r=n(),maxResults:i=10,includeFiles:a=!0,includeHidden:o=!1}=t,{directory:s,prefix:c}=h(e,r),l=await y(s,o),u=c.toLowerCase(),d=l.filter(e=>!a&&e.type===`file`?!1:e.name.toLowerCase().startsWith(u)).slice(0,i),f=e.includes(`/`)||e.includes(m),p=``;if(f){let t=e.lastIndexOf(`/`),n=e.lastIndexOf(m),r=Math.max(t,n);p=e.substring(0,r+1)}return(p.startsWith(`./`)||p.startsWith(`.${m}`))&&(p=p.slice(2)),d.map(e=>{let t=p+e.name;return{id:t,displayText:e.type===`directory`?`${t}/`:t,metadata:{type:e.type}}})}var x,S,C,w,T=e((()=>{l(),t(),r(),s(),o(),x=500,S=300*1e3,C=new u({max:x,ttl:S}),w=new u({max:x,ttl:S})}));export{v as i,b as n,T as r,_ as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Doctor-FPYTivHw.js";var i,a;e((()=>{n(),i=t(),a=(e,t,n)=>Promise.resolve((0,i.jsx)(r,{onDone:e}))}))();export{a as call};