@readmagic/workmate 0.0.19 → 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 (256) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-9FcHMKgX.js → AddWorkspaceDirectory-BYNvxNrD.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-BSSz86ER.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-DLnj3JQO.js → AgentsMdExternalIncludesDialog-CMEGV4Md.js} +1 -1
  4. package/dist/chunks/{App-NkBqbDbC.js → App-W_9d1DjK.js} +1 -1
  5. package/dist/chunks/{ApproveApiKey-rgB6AsYD.js → ApproveApiKey-Bf1Rb8Ql.js} +1 -1
  6. package/dist/chunks/ApproveApiKey-wpdvXpFr.js +1 -0
  7. package/dist/chunks/{BackgroundTasksDialog-CcViruUO.js → BackgroundTasksDialog-lGn1Wj1k.js} +1 -1
  8. package/dist/chunks/{BypassPermissionsModeDialog-D254L98G.js → BypassPermissionsModeDialog-CjVjyNf8.js} +1 -1
  9. package/dist/chunks/{DiffDialog-6Srcz3NW.js → DiffDialog-DCpchgp5.js} +1 -1
  10. package/dist/chunks/Doctor-6SjW91rd.js +1 -0
  11. package/dist/chunks/{Doctor-DiNxlXfC.js → Doctor-FPYTivHw.js} +1 -1
  12. package/dist/chunks/{ExitFlow-Bt2De110.js → ExitFlow-Dy8_1D8J.js} +1 -1
  13. package/dist/chunks/{Grove-DC4jyxeB.js → Grove-Dd6rjs5P.js} +1 -1
  14. package/dist/chunks/{HybridTransport-DArmWb1V.js → HybridTransport-CJVkWa2u.js} +1 -1
  15. package/dist/chunks/{InvalidConfigDialog-DFiB0Kzc.js → InvalidConfigDialog-Bisj9ic_.js} +1 -1
  16. package/dist/chunks/{InvalidSettingsDialog-BHNo2__T.js → InvalidSettingsDialog-DyTPNRQR.js} +1 -1
  17. package/dist/chunks/{MCPConnectionManager-CdpO2Tj9.js → MCPConnectionManager-DfyoZaiu.js} +1 -1
  18. package/dist/chunks/{MCPToolListView-Ch4jOk_x.js → MCPToolListView-Dioupv8F.js} +1 -1
  19. package/dist/chunks/{McpParsingWarnings-D4UQ8Q2e.js → McpParsingWarnings-BUlgpZAF.js} +1 -1
  20. package/dist/chunks/{MessageSelector-BgsrdJur.js → MessageSelector-D8fylxPg.js} +1 -1
  21. package/dist/chunks/{Messages-DB1pmDY_.js → Messages-BZDFMYBT.js} +1 -1
  22. package/dist/chunks/{Onboarding-BnjdTwci.js → Onboarding-BKLomZYo.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-Chg9U-BC.js → PromptInputFooterSuggestions-DCum89fF.js} +1 -1
  24. package/dist/chunks/{PromptInputHelpMenu-C0ZSo12s.js → PromptInputHelpMenu-DG2lRqis.js} +1 -1
  25. package/dist/chunks/{QueryEngine-bKlupZpA.js → QueryEngine-CyGHpX7M.js} +1 -1
  26. package/dist/chunks/REPL-BDsz8KIx.js +1 -0
  27. package/dist/chunks/{REPL-Cg8UXYpX.js → REPL-CCBNfZfs.js} +5 -5
  28. package/dist/chunks/{RemoteSessionManager-CRWOHvKf.js → RemoteSessionManager-BfsOv4K6.js} +1 -1
  29. package/dist/chunks/{ResumeConversation-Ld7tYLKO.js → ResumeConversation-pC8NLq0F.js} +1 -1
  30. package/dist/chunks/{SSETransport-pPrlSZNF.js → SSETransport-B3K6eH9I.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-DYoxHo9T.js +1 -0
  32. package/dist/chunks/{Settings-CsOlPcIW.js → Settings-CKaGmKg2.js} +2 -2
  33. package/dist/chunks/{TeleportProgress-Di-PMey7.js → TeleportProgress-CkgSp1cs.js} +1 -1
  34. package/dist/chunks/{TeleportRepoMismatchDialog-CDv1cbo-.js → TeleportRepoMismatchDialog-DdO_rECq.js} +1 -1
  35. package/dist/chunks/{TeleportResumeWrapper-Bmf13tGU.js → TeleportResumeWrapper-BeG4N-2z.js} +1 -1
  36. package/dist/chunks/{ThemePicker-B3AO3_jA.js → ThemePicker-iD9ufy99.js} +1 -1
  37. package/dist/chunks/{TrustDialog-C0aiR_LU.js → TrustDialog-qO5OdQt8.js} +1 -1
  38. package/dist/chunks/{add-dir-w1Ay3861.js → add-dir-C4eSVlZ6.js} +1 -1
  39. package/dist/chunks/{agentDisplay-D01ZlnVX.js → agentDisplay-BM4QG_RX.js} +1 -1
  40. package/dist/chunks/{agents-Bxenhf8S.js → agents-BbDBN5l9.js} +1 -1
  41. package/dist/chunks/{agents-B_hUgPnR.js → agents-D3APE_8d.js} +1 -1
  42. package/dist/chunks/{allErrors-C_iHQOlK.js → allErrors-BkgB7JNK.js} +1 -1
  43. package/dist/chunks/api-BHBK9axp.js +1 -0
  44. package/dist/chunks/{api-C5ULzZny.js → api-DyUWfg3a.js} +1 -1
  45. package/dist/chunks/{auth-DvcZHXGk.js → auth-0rn1U4Eq.js} +1 -1
  46. package/dist/chunks/auth-BEoTPSgC.js +1 -0
  47. package/dist/chunks/auth-BPug7U_u.js +1 -0
  48. package/dist/chunks/backgroundHousekeeping-D7xAhUaE.js +1 -0
  49. package/dist/chunks/{backgroundHousekeeping-BGKR5cdA.js → backgroundHousekeeping-km82qEh0.js} +2 -2
  50. package/dist/chunks/{branch-CqQxCSHG.js → branch-CQ38cx5n.js} +1 -1
  51. package/dist/chunks/{bridgeConfig-MxsnEEPx.js → bridgeConfig-C5L-7KaP.js} +1 -1
  52. package/dist/chunks/bridgeConfig-CJMjDoaP.js +1 -0
  53. package/dist/chunks/{bridgeMessaging-Bx5pkkkx.js → bridgeMessaging-DVC3qj-C.js} +1 -1
  54. package/dist/chunks/{bridgeStatusUtil-B9EcQksI.js → bridgeStatusUtil-Cex6VowM.js} +1 -1
  55. package/dist/chunks/{btw-DeznoRrw.js → btw-_P96ffHR.js} +1 -1
  56. package/dist/chunks/caches-DH-q8Fjf.js +1 -0
  57. package/dist/chunks/caches-Dq0pJFDP.js +1 -0
  58. package/dist/chunks/{ccrClient-CimQTd0b.js → ccrClient-DO563xlf.js} +1 -1
  59. package/dist/chunks/{clear-KvoD-lFN.js → clear-DmqQBNKg.js} +1 -1
  60. package/dist/chunks/client-C19cqYQS.js +1 -0
  61. package/dist/chunks/commands-BkpqHY9F.js +1 -0
  62. package/dist/chunks/{compact-Dgzve3dI.js → compact-DuVIvqMu.js} +1 -1
  63. package/dist/chunks/config-DMP6-Ccr.js +1 -0
  64. package/dist/chunks/{context-Dz-bbYCw.js → context-DjgMzIfe.js} +1 -1
  65. package/dist/chunks/{context-noninteractive-ApbVPU86.js → context-noninteractive-BzDVMnWC.js} +1 -1
  66. package/dist/chunks/context-noninteractive-DV7bIJCm.js +1 -0
  67. package/dist/chunks/{conversation-CJ-d0O-U.js → conversation-BBOE_EoE.js} +1 -1
  68. package/dist/chunks/conversation-WxH5pb2z.js +1 -0
  69. package/dist/chunks/{createSSHSession-DOz_Ox1_.js → createSSHSession-LVGVXHXL.js} +1 -1
  70. package/dist/chunks/createSession-BUzna9-E.js +1 -0
  71. package/dist/chunks/{createSession-yR87Rhiv.js → createSession-Dgwxk1WA.js} +1 -1
  72. package/dist/chunks/{crossProjectResume-DNnZo3gU.js → crossProjectResume-6B2NYy8a.js} +1 -1
  73. package/dist/chunks/{datadog-DBgIEaEd.js → datadog-Bc6wkPne.js} +1 -1
  74. package/dist/chunks/{diff-qOom_T1G.js → diff-DIg66U_d.js} +1 -1
  75. package/dist/chunks/doctor-BhUmhHQU.js +1 -0
  76. package/dist/chunks/{entry-EmOA7oWN.js → entry-B-Y-AYeK.js} +1 -1
  77. package/dist/chunks/{esm-DBMVQDVv.js → esm-CvHtYRrr.js} +1 -1
  78. package/dist/chunks/{exit-DDrAFCzE.js → exit-CW2eqUrR.js} +1 -1
  79. package/dist/chunks/{extraUsage-DylXI7Fc.js → extraUsage-CkTon7ib.js} +1 -1
  80. package/dist/chunks/extractMemories-CfmbvayQ.js +1 -0
  81. package/dist/chunks/fast-ByahC7Gw.js +1 -0
  82. package/dist/chunks/{fast-BCkhj9Dq.js → fast-xtIP4u4y.js} +1 -1
  83. package/dist/chunks/fetchModelList-D9aePIPW.js +1 -0
  84. package/dist/chunks/{fetchModelList-BbjuFHQT.js → fetchModelList-Dy-x4h3G.js} +1 -1
  85. package/dist/chunks/{fileSuggestions-Ct7vKEpR.js → fileSuggestions-CFkJktgc.js} +1 -1
  86. package/dist/chunks/firstPartyEventLogger-Bt9iG9xk.js +1 -0
  87. package/dist/chunks/{firstPartyEventLogger-CxUuXQhL.js → firstPartyEventLogger-DqGSujCz.js} +2 -2
  88. package/dist/chunks/{flushGate-BZe_QwEz.js → flushGate-BjKW7PFC.js} +1 -1
  89. package/dist/chunks/{gemini-8sSwOtEf.js → gemini-NnmxBoEp.js} +1 -1
  90. package/dist/chunks/{generateSessionName-vT1khubt.js → generateSessionName-EpqGW-T2.js} +1 -1
  91. package/dist/chunks/{goal-CznQA1n1.js → goal-DbS8yJfB.js} +1 -1
  92. package/dist/chunks/{grok-cEzUsG-s.js → grok-BxZ4vTDw.js} +1 -1
  93. package/dist/chunks/{grove--HtQL4QZ.js → grove-CYE1Cfcz.js} +1 -1
  94. package/dist/chunks/{help-B6A_kDQA.js → help-DatnwM25.js} +1 -1
  95. package/dist/chunks/{hooks-CN5hLrhi.js → hooks-7iyENdDG.js} +1 -1
  96. package/dist/chunks/hooks-DjbqtbUV.js +1 -0
  97. package/dist/chunks/{initReplBridge-BJhmlcVt.js → initReplBridge-BEZW5PEY.js} +1 -1
  98. package/dist/chunks/{install-DUOtI2Hq.js → install-DJukI-kL.js} +1 -1
  99. package/dist/chunks/{instrumentation-DpgB3GFx.js → instrumentation-2HH15DPu.js} +3 -3
  100. package/dist/chunks/{job-DDoX1iFe.js → job-CXz7SLZp.js} +1 -1
  101. package/dist/chunks/{keybindings-BGTuYfk-.js → keybindings-C9l5il16.js} +1 -1
  102. package/dist/chunks/{launchLocalMemory-CoWeLNeP.js → launchLocalMemory-BfGenqj1.js} +1 -1
  103. package/dist/chunks/{launchOnboarding-CTIBGSLV.js → launchOnboarding-DjMmXeQE.js} +1 -1
  104. package/dist/chunks/{loadAgentsDir-DXOkUcW3.js → loadAgentsDir-DaNpxaO-.js} +587 -612
  105. package/dist/chunks/loadAgentsDir-DcI-8FQF.js +1 -0
  106. package/dist/chunks/{loadPluginHooks-DrNVtTBq.js → loadPluginHooks-CGgpcyEC.js} +1 -1
  107. package/dist/chunks/{localSearch-DnT21UkF.js → localSearch-C2SZ9bGW.js} +1 -1
  108. package/dist/chunks/localSearch-CTTwYTU1.js +1 -0
  109. package/dist/chunks/{logoUtils-YwL3izJt.js → logoUtils-CbIqOFrX.js} +1 -1
  110. package/dist/chunks/{magicDocs-rxv0rR8E.js → magicDocs-CrTwULyJ.js} +1 -1
  111. package/dist/chunks/{main-BOvY4O6D.js → main-bJXadFi0.js} +10 -10
  112. package/dist/chunks/{managedEnv-CpgCYISH.js → managedEnv-CUsdYhAI.js} +1 -1
  113. package/dist/chunks/managedEnv-DXeaUDSK.js +1 -0
  114. package/dist/chunks/{mappers-DYtq2XVS.js → mappers-_B-s9fNz.js} +1 -1
  115. package/dist/chunks/{mcp-BoU3TNFs.js → mcp-BbbYzWpy.js} +2 -2
  116. package/dist/chunks/{mcp-BPvcoKDY.js → mcp-D91sH9a8.js} +1 -1
  117. package/dist/chunks/{mcp-BfqsHRx0.js → mcp-Dx-zgUgu.js} +1 -1
  118. package/dist/chunks/{memory-BPKRdkBb.js → memory-BeL7ui9m.js} +1 -1
  119. package/dist/chunks/{mode-CXpXux2s.js → mode-D695kgLI.js} +1 -1
  120. package/dist/chunks/model-DX0TtzqX.js +1 -0
  121. package/dist/chunks/{model-Cxx3suBa.js → model-Do0f476p.js} +1 -1
  122. package/dist/chunks/{model-CxPYKiW1.js → model-DpcM8dz5.js} +1 -1
  123. package/dist/chunks/{modelOptions-BqBHEyiR.js → modelOptions-B3nis9cC.js} +1 -1
  124. package/dist/chunks/{src-l6_O0K-a.js → modifiersNative-BYHdmWw1.js} +1 -1
  125. package/dist/chunks/modifiersNative-D7nm70eq.js +1 -0
  126. package/dist/chunks/{nativeInstaller-CaXwRpoR.js → nativeInstaller-CymO8TNe.js} +1 -1
  127. package/dist/chunks/{omit-DZUxsClb.js → omit-DO61BHZu.js} +1 -1
  128. package/dist/chunks/{onChangeAppState-qHXqufwy.js → onChangeAppState-vKml_lit.js} +1 -1
  129. package/dist/chunks/{openai-_FQ9EhuR.js → openai-DdupGVdC.js} +1 -1
  130. package/dist/chunks/{partition-BgwHlPsO.js → partition-BivH9MBJ.js} +1 -1
  131. package/dist/chunks/{permissions-Dv5d5Nu3.js → permissions-C9iqR4_N.js} +1 -1
  132. package/dist/chunks/{pidLock-CEhbTkBE.js → pidLock-DiKz5Tza.js} +2 -2
  133. package/dist/chunks/{plan-DVPBW5OS.js → plan-KDN5IGWY.js} +1 -1
  134. package/dist/chunks/{plugin-Bh2eBwLW.js → plugin-D0rzUb8E.js} +1 -1
  135. package/dist/chunks/{pluginAutoupdate-C2YbEHrP.js → pluginAutoupdate-C2xTKLR_.js} +1 -1
  136. package/dist/chunks/{pluginBlocklist-B2NAKaB9.js → pluginBlocklist-xdiUmUpt.js} +1 -1
  137. package/dist/chunks/{pluginCliCommands-Cw5TrYYb.js → pluginCliCommands-CIDDvVN7.js} +1 -1
  138. package/dist/chunks/{pluginFlagging-BDTgCYuC.js → pluginFlagging-DRA0m76J.js} +1 -1
  139. package/dist/chunks/{pluginOperations-BBwGEdfC.js → pluginOperations-BEYsarAn.js} +1 -1
  140. package/dist/chunks/{pluginStartupCheck-DhhMk3dA.js → pluginStartupCheck-BF1N4Lih.js} +1 -1
  141. package/dist/chunks/pluginStartupCheck-DVkI4pqo.js +1 -0
  142. package/dist/chunks/{plugins-r0h93GT_.js → plugins-CWWU4BKs.js} +1 -1
  143. package/dist/chunks/{print-CDzhHi2F.js → print-B5H2xbBS.js} +3 -3
  144. package/dist/chunks/{processBashCommand-DmdCAWOR.js → processBashCommand-EQ9EWaRV.js} +1 -1
  145. package/dist/chunks/{processSlashCommand-B43TkiaI.js → processSlashCommand-C4PKNyFT.js} +1 -1
  146. package/dist/chunks/{prompt-DEioJrx_.js → prompt-8u06WVES.js} +1 -1
  147. package/dist/chunks/prompt-B9sDzLPK.js +1 -0
  148. package/dist/chunks/prompt-WsoTRhoh.js +1 -0
  149. package/dist/chunks/{promptEditor-eJzbtNn4.js → promptEditor-Cr4w-4Bz.js} +1 -1
  150. package/dist/chunks/{protocolHandler-C-CFTcUJ.js → protocolHandler-DzHVaPl3.js} +2 -2
  151. package/dist/chunks/{reconciler-DZP4dJJG.js → reconciler-RIKmaPg7.js} +1 -1
  152. package/dist/chunks/{refresh-vaY-Sr80.js → refresh-CCSCAjgz.js} +1 -1
  153. package/dist/chunks/registerProtocol-C0IlPEoa.js +1 -0
  154. package/dist/chunks/{reload-plugins-m9CzoIxu.js → reload-plugins-DC-tbXVv.js} +1 -1
  155. package/dist/chunks/{remoteBridgeCore-C4vSr1gp.js → remoteBridgeCore-NGTnhQgw.js} +1 -1
  156. package/dist/chunks/{remoteManagedSettings-6RAHPt_g.js → remoteManagedSettings-BoOYHzYP.js} +1 -1
  157. package/dist/chunks/{rename-DmauGVBX.js → rename-DS1AmW-F.js} +1 -1
  158. package/dist/chunks/{resume-ut_pBrLN.js → resume-Cf5PSoPw.js} +1 -1
  159. package/dist/chunks/{runtimeObserver-CSroopId.js → runtimeObserver-DzesbvgI.js} +1 -1
  160. package/dist/chunks/{runtimeObserver-C2vjqtCE.js → runtimeObserver-L6041elO.js} +2 -2
  161. package/dist/chunks/sandbox-adapter-Z4Phj31K.js +1 -0
  162. package/dist/chunks/{sandbox-toggle-BJKd1ZYk.js → sandbox-toggle-COZE8Lo4.js} +1 -1
  163. package/dist/chunks/sanitization-DV-94a9Z.js +1 -0
  164. package/dist/chunks/searchExtraTools-CvkRbL2m.js +1 -0
  165. package/dist/chunks/{session-DTin6hOR.js → session-BvA99K4j.js} +1 -1
  166. package/dist/chunks/sessionFileAccessHooks-6XfAf6ke.js +1 -0
  167. package/dist/chunks/{sessionObserver-iAJLH92a.js → sessionObserver-0D8xFoRK.js} +1 -1
  168. package/dist/chunks/sessionObserver-CRWUBJEY.js +1 -0
  169. package/dist/chunks/{sessionState-DAcub-HK.js → sessionState-CQhbGfmh.js} +1 -1
  170. package/dist/chunks/sessionStorage-DqEuxDlb.js +1 -0
  171. package/dist/chunks/{sessionTracing-Dvi520eN.js → sessionTracing-BoOZsXU2.js} +1 -1
  172. package/dist/chunks/{settingsSync-aHn3p-6J.js → settingsSync-rkWmClKS.js} +1 -1
  173. package/dist/chunks/{setup-CK3ybjjM.js → setup-D8L275fT.js} +2 -2
  174. package/dist/chunks/{shadowedRuleDetection-BL7dEv-u.js → shadowedRuleDetection-Cy9tsuKc.js} +1 -1
  175. package/dist/chunks/{sideQuestion-Ct87yvOR.js → sideQuestion-Ds7Elgs4.js} +1 -1
  176. package/dist/chunks/{sinks-Bmn3li0M.js → sinks-BXX72cbf.js} +1 -1
  177. package/dist/chunks/sinks-DMp6uEzM.js +1 -0
  178. package/dist/chunks/{skillChangeDetector-Bco3UoeW.js → skillChangeDetector-CtithJ4a.js} +1 -1
  179. package/dist/chunks/{skillGapStore-MtlRyYmT.js → skillGapStore-BxCxKPev.js} +2 -2
  180. package/dist/chunks/{skillLifecycle-Drs6gEv9.js → skillLifecycle-CfyNC3sW.js} +2 -2
  181. package/dist/chunks/{skillSearchPanel-DkvmjNaw.js → skillSearchPanel-CMNJFIEC.js} +2 -2
  182. package/dist/chunks/{skills-axToWEo0.js → skills-DXMk-498.js} +1 -1
  183. package/dist/chunks/{status-CGp4uRlH.js → status-CFrLuGbf.js} +1 -1
  184. package/dist/chunks/status-D5OCkMZG.js +1 -0
  185. package/dist/chunks/{statusNoticeHelpers-BrN_2q7H.js → statusNoticeHelpers-CZoOse-_.js} +1 -1
  186. package/dist/chunks/switcher-AiMcRzoi.js +1 -0
  187. package/dist/chunks/{switcher-99gm2vpe.js → switcher-DQF5ZNal.js} +1 -1
  188. package/dist/chunks/{syncCache-B3OVvp8K.js → syncCache-qWJ_VfBo.js} +1 -1
  189. package/dist/chunks/{tasks-t5zT_D32.js → tasks-C8pb6ftc.js} +1 -1
  190. package/dist/chunks/{teleport-CvX_nUjQ.js → teleport-Bi_1VFIZ.js} +1 -1
  191. package/dist/chunks/{templateJobs-Bm8bovHx.js → templateJobs-DJ4dcfcL.js} +1 -1
  192. package/dist/chunks/{theme-DzaSXOpQ.js → theme-CEKOCSLw.js} +1 -1
  193. package/dist/chunks/{toolEventObserver-C_nHI27x.js → toolEventObserver-D2nk8ZbW.js} +1 -1
  194. package/dist/chunks/{toolPool-CgKK0K8f.js → toolPool-Df5iUqJ-.js} +1 -1
  195. package/dist/chunks/{trustedDevice-Bb7O8_tj.js → trustedDevice-CB6rNzl-.js} +1 -1
  196. package/dist/chunks/trustedDevice-DXGePUAC.js +1 -0
  197. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-D0uqGxGw.js → useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js} +1 -1
  198. package/dist/chunks/useMainLoopModel-CIG2cjS2.js +1 -0
  199. package/dist/chunks/{useManagePlugins-ITVFO9dz.js → useManagePlugins-MSHw-qHx.js} +1 -1
  200. package/dist/chunks/{useMergedTools-rQ19rFvH.js → useMergedTools-Bb-INJa2.js} +1 -1
  201. package/dist/chunks/{useSearchInput-CXTa-leH.js → useSearchInput-QL_VtdJD.js} +1 -1
  202. package/dist/chunks/{useSettingsErrors-Xc6RYjYF.js → useSettingsErrors-Dvi6zLCr.js} +1 -1
  203. package/dist/chunks/{userAgent-CJ5Rp9kc.js → userAgent-i-oGzf40.js} +1 -1
  204. package/dist/chunks/{util-CD3ar4of.js → util-CLQvtXuD.js} +1 -1
  205. package/dist/chunks/{validatePlugin-CxrlCKc1.js → validatePlugin-1mTZ3TJR.js} +1 -1
  206. package/dist/chunks/{workerRegistry-BGJtgrko.js → workerRegistry-BjxoZ12l.js} +2 -2
  207. package/dist/chunks/worktree-DpksgxdF.js +1 -0
  208. package/dist/cli.js +1 -1
  209. package/package.json +1 -5
  210. package/dist/chunks/AgentsMdExternalIncludesDialog-Bny8WDwC.js +0 -1
  211. package/dist/chunks/ApproveApiKey-BKzkEkW-.js +0 -1
  212. package/dist/chunks/Doctor-DYEdLRxR.js +0 -1
  213. package/dist/chunks/REPL-yzvMFfaU.js +0 -1
  214. package/dist/chunks/SearchExtraToolsTool-CdgQlm--.js +0 -1
  215. package/dist/chunks/api-CB3e0De0.js +0 -1
  216. package/dist/chunks/attributionHooks-C0aXyx9L.js +0 -1
  217. package/dist/chunks/auth-CsYEYXBO.js +0 -1
  218. package/dist/chunks/auth-CubXYcRl.js +0 -1
  219. package/dist/chunks/backgroundHousekeeping-CykbtljP.js +0 -1
  220. package/dist/chunks/bridgeConfig-Cp2x_wtE.js +0 -1
  221. package/dist/chunks/caches-BiVRgePi.js +0 -1
  222. package/dist/chunks/caches-CGzKSWiP.js +0 -1
  223. package/dist/chunks/client-CmnPWgLq.js +0 -1
  224. package/dist/chunks/commands-CrzVgHxp.js +0 -1
  225. package/dist/chunks/config-Df8jooTW.js +0 -1
  226. package/dist/chunks/context-noninteractive-m4O3VtG7.js +0 -1
  227. package/dist/chunks/conversation-BYBX07j8.js +0 -1
  228. package/dist/chunks/createSession-C_-ZEQT5.js +0 -1
  229. package/dist/chunks/doctor-CflXjqVK.js +0 -1
  230. package/dist/chunks/extractMemories-B_8wZpXA.js +0 -1
  231. package/dist/chunks/fast-4ajfJv-M.js +0 -1
  232. package/dist/chunks/fetchModelList-V8_e2O1N.js +0 -1
  233. package/dist/chunks/firstPartyEventLogger-YQm0DoVu.js +0 -1
  234. package/dist/chunks/hooks-CJY5Vfy6.js +0 -1
  235. package/dist/chunks/loadAgentsDir-Dxz1vp3F.js +0 -1
  236. package/dist/chunks/localSearch-CCs5fOd_.js +0 -1
  237. package/dist/chunks/managedEnv-CrnBYTtQ.js +0 -1
  238. package/dist/chunks/model-aEJ54cMA.js +0 -1
  239. package/dist/chunks/pluginStartupCheck-CHx379_R.js +0 -1
  240. package/dist/chunks/postCommitAttribution-DoSP9wZD.js +0 -1
  241. package/dist/chunks/prompt-C50mDqWv.js +0 -1
  242. package/dist/chunks/prompt-WGH9CcXh.js +0 -1
  243. package/dist/chunks/registerProtocol-Xsq4ldwg.js +0 -1
  244. package/dist/chunks/sandbox-adapter-CL0qdcxn.js +0 -1
  245. package/dist/chunks/searchExtraTools-ByWuNCGo.js +0 -1
  246. package/dist/chunks/sessionFileAccessHooks-DorzHolr.js +0 -1
  247. package/dist/chunks/sessionObserver-Dy6NFlzL.js +0 -1
  248. package/dist/chunks/sessionStorage-DItJMkwx.js +0 -1
  249. package/dist/chunks/sinks-QQ_6Op7q.js +0 -1
  250. package/dist/chunks/src-DPUAq5Ty.js +0 -1
  251. package/dist/chunks/status-3uevwSMo.js +0 -1
  252. package/dist/chunks/switcher-DJDxjLPQ.js +0 -1
  253. package/dist/chunks/trustedDevice-C2gnF9Lc.js +0 -1
  254. package/dist/chunks/useMainLoopModel-BGPOmBkl.js +0 -1
  255. package/dist/chunks/worktree-CanG5GhE.js +0 -1
  256. /package/dist/chunks/{src-DLz3FZm1.js → urlHandler-DLz3FZm1.js} +0 -0
@@ -1,2 +1,2 @@
1
- import{n as e,t}from"./memoize-BK3gG5ob.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{$y as i,Io as a,Ro as o,Sr as s,Sw as c,To as ee,Xy as te,bg as ne,br as l,fT as u,hC as d,mC as f,mg as p,pT as m,ww as re,xo as ie}from"./loadAgentsDir-DXOkUcW3.js";import{di as ae,fi as h,j as g,t as _}from"./src-DL3w8VPk2.js";import{n as v,t as y}from"./cwd-Nh5IZNKO.js";import{C as b,P as x,R as S,S as oe,c as C,i as w,x as se}from"./debug-D58GQBDG.js";import{Gt as T,Jt as E,d as D,h as ce,t as O}from"./settings-3xZ0fsvE.js";import{c as k,h as A,o as j,v as M,y as N}from"./config-DRy1I12M.js";import{f as P,l as F,m as I,p as L}from"./git-By_J4XJL.js";import{n as R,r as z}from"./execFileNoThrow-Bmb5HEFz.js";import{o as B,s as V}from"./log-CZ7ploQm.js";import{i as H,o as U}from"./platform-DMQxcm4K.js";import{l as W,u as G}from"./oauth-D38aRTUb.js";import{$r as le,Ft as ue,Pt as de,ti as fe}from"./model-Cxx3suBa.js";import{c as pe,h as me,l as he,m as K,s as ge}from"./proxy-BhIc7-mj.js";import{c as _e,i as ve}from"./terminalSetup-kWdZRKWq.js";import{l as ye,o as be}from"./api-C5ULzZny.js";import{c as xe,u as Se}from"./firstPartyEventLogger-CxUuXQhL.js";import{randomUUID as Ce}from"crypto";t(),u(),v(),A(),E(),z(),I(),B(),Se();var we=[/(?:^|\/)(?:package-lock\.json|yarn\.lock|bun\.lock|bun\.lockb|pnpm-lock\.yaml|Pipfile\.lock|poetry\.lock|Cargo\.lock|Gemfile\.lock|go\.sum|composer\.lock|uv\.lock)$/,/\.generated\./,/(?:^|\/)(?:dist|build|out|target|node_modules|\.next|__pycache__)\//,/\.(?:min\.js|min\.css|map|pyc|pyo)$/,/\.(?:json|ya?ml|toml|xml|ini|cfg|conf|env|lock|txt|md|mdx|rst|csv|log|svg)$/i,/(?:^|\/)\.?(?:eslintrc|prettierrc|babelrc|editorconfig|gitignore|gitattributes|dockerignore|npmrc)/,/(?:^|\/)(?:tsconfig|jsconfig|biome|vitest\.config|jest\.config|webpack\.config|vite\.config|rollup\.config)\.[a-z]+$/,/(?:^|\/)\.(?:github|vscode|idea|claude)\//,/(?:^|\/)(?:CHANGELOG|LICENSE|CONTRIBUTING|CODEOWNERS|README)(?:\.[a-z]+)?$/i];function Te(e){return!we.some(t=>t.test(e))}function Ee(e,t){let n=[],r=new Set,i=new Map;for(let a=1;n.length<t&&a<=t;a++)for(let o of e){if(n.length>=t)break;if(!Te(o))continue;let e=Math.max(o.lastIndexOf(`/`),o.lastIndexOf(`\\`)),s=e>=0?o.slice(e+1):o;if(!s||r.has(s))continue;let c=e>=0?o.slice(0,e):`.`;(i.get(c)??0)>=a||(n.push(s),r.add(s),i.set(c,(i.get(c)??0)+1))}return n.length>=t?n:[]}async function De(){if(T.platform===`win32`||!await F())return[];try{let e=await xe(),t=[`log`,`-n`,`1000`,`--pretty=format:`,`--name-only`,`--diff-filter=M`],n=new Map,r=e=>{for(let t of e.split(`
1
+ import{n as e,t}from"./memoize-BK3gG5ob.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{$y as i,Io as a,Ro as o,Sr as s,Sw as c,To as ee,Xy as te,bg as ne,br as l,fT as u,hC as d,mC as f,mg as p,pT as m,ww as re,xo as ie}from"./loadAgentsDir-DaNpxaO-.js";import{di as ae,fi as h,j as g,t as _}from"./src-DL3w8VPk2.js";import{n as v,t as y}from"./cwd-Nh5IZNKO.js";import{C as b,P as x,R as S,S as oe,c as C,i as w,x as se}from"./debug-D58GQBDG.js";import{Gt as T,Jt as E,d as D,h as ce,t as O}from"./settings-3xZ0fsvE.js";import{c as k,h as A,o as j,v as M,y as N}from"./config-DRy1I12M.js";import{f as P,l as F,m as I,p as L}from"./git-By_J4XJL.js";import{n as R,r as z}from"./execFileNoThrow-Bmb5HEFz.js";import{o as B,s as V}from"./log-CZ7ploQm.js";import{i as H,o as U}from"./platform-DMQxcm4K.js";import{l as W,u as G}from"./oauth-D38aRTUb.js";import{$r as le,Ft as ue,Pt as de,ti as fe}from"./model-Do0f476p.js";import{c as pe,h as me,l as he,m as K,s as ge}from"./proxy-BhIc7-mj.js";import{c as _e,i as ve}from"./terminalSetup-kWdZRKWq.js";import{l as ye,o as be}from"./api-DyUWfg3a.js";import{c as xe,u as Se}from"./firstPartyEventLogger-DqGSujCz.js";import{randomUUID as Ce}from"crypto";t(),u(),v(),A(),E(),z(),I(),B(),Se();var we=[/(?:^|\/)(?:package-lock\.json|yarn\.lock|bun\.lock|bun\.lockb|pnpm-lock\.yaml|Pipfile\.lock|poetry\.lock|Cargo\.lock|Gemfile\.lock|go\.sum|composer\.lock|uv\.lock)$/,/\.generated\./,/(?:^|\/)(?:dist|build|out|target|node_modules|\.next|__pycache__)\//,/\.(?:min\.js|min\.css|map|pyc|pyo)$/,/\.(?:json|ya?ml|toml|xml|ini|cfg|conf|env|lock|txt|md|mdx|rst|csv|log|svg)$/i,/(?:^|\/)\.?(?:eslintrc|prettierrc|babelrc|editorconfig|gitignore|gitattributes|dockerignore|npmrc)/,/(?:^|\/)(?:tsconfig|jsconfig|biome|vitest\.config|jest\.config|webpack\.config|vite\.config|rollup\.config)\.[a-z]+$/,/(?:^|\/)\.(?:github|vscode|idea|claude)\//,/(?:^|\/)(?:CHANGELOG|LICENSE|CONTRIBUTING|CODEOWNERS|README)(?:\.[a-z]+)?$/i];function Te(e){return!we.some(t=>t.test(e))}function Ee(e,t){let n=[],r=new Set,i=new Map;for(let a=1;n.length<t&&a<=t;a++)for(let o of e){if(n.length>=t)break;if(!Te(o))continue;let e=Math.max(o.lastIndexOf(`/`),o.lastIndexOf(`\\`)),s=e>=0?o.slice(e+1):o;if(!s||r.has(s))continue;let c=e>=0?o.slice(0,e):`.`;(i.get(c)??0)>=a||(n.push(s),r.add(s),i.set(c,(i.get(c)??0)+1))}return n.length>=t?n:[]}async function De(){if(T.platform===`win32`||!await F())return[];try{let e=await xe(),t=[`log`,`-n`,`1000`,`--pretty=format:`,`--name-only`,`--diff-filter=M`],n=new Map,r=e=>{for(let t of e.split(`
2
2
  `)){let e=t.trim();e&&n.set(e,(n.get(e)??0)+1)}};if(e){let{stdout:n}=await R(`git`,[...t,`--author=${e}`],{cwd:y()});r(n)}if(n.size<10){let{stdout:e}=await R(L(),t,{cwd:y()});r(e)}return Ee(Array.from(n.entries()).sort((e,t)=>t[1]-e[1]).map(([e])=>e),5)}catch(e){return V(e),[]}}var Oe=10080*60*1e3,ke=e(()=>{let e=j(),t=e.exampleFiles?.length?m(e.exampleFiles):`<filepath>`;return`Try "${m([`fix lint errors`,`fix typecheck errors`,`how does ${t} work?`,`refactor ${t}`,`how do I log an error?`,`edit ${t} to...`,`write a test for ${t}`,`create a util logging.py that...`])}"`}),Ae=e(async()=>{let e=j();Date.now()-(e.exampleFilesGeneratedAt??0)>Oe&&(e.exampleFiles=[]),e.exampleFiles?.length||De().then(e=>{e.length&&M(t=>({...t,exampleFiles:e,exampleFilesGeneratedAt:Date.now()}))})});fe();var je={"claude-3-opus":{modelName:`Work Mate 3 Opus`,retirementDates:{firstParty:`January 5, 2026`,bedrock:`January 15, 2026`,vertex:`January 5, 2026`,foundry:`January 5, 2026`}},"claude-3-7-sonnet":{modelName:`Work Mate 3.7 Sonnet`,retirementDates:{firstParty:`February 19, 2026`,bedrock:`April 28, 2026`,vertex:`May 11, 2026`,foundry:`February 19, 2026`}},"claude-3-5-haiku":{modelName:`Work Mate 3.5 Haiku`,retirementDates:{firstParty:`February 19, 2026`,bedrock:null,vertex:null,foundry:null}}};function Me(e){let t=e.toLowerCase(),n=le();for(let[e,r]of Object.entries(je)){let i=r.retirementDates[n];if(!(!t.includes(e)||!i))return{isDeprecated:!0,modelName:r.modelName,retirementDate:i}}return{isDeprecated:!1}}function Ne(e){if(!e)return null;let t=Me(e);return t.isDeprecated?`⚠ ${t.modelName} will be retired on ${t.retirementDate}. Consider switching to a newer model.`:null}n(),h(),_(),S(),se(),w(),U(),G(),ce(),de(),re(),d(),i(),ne(),ve(),a(),ie(),l(),A();function Pe(e){let t=k().numStartups;N(n=>{let r=n.tipsHistory??{};return r[e]===t?n:{...n,tipsHistory:{...r,[e]:t}}})}function q(e){let t=k(),n=t.tipsHistory?.[e];return n?t.numStartups-n:1/0}A(),E(),I();var J;async function Fe(){return J===void 0&&(J=c in await o()),J}async function Y(e,t,n){if(!await Fe()||ee(`${e}@claude-plugins-official`))return!1;let{bashTools:r}=t??{};return!!(n.cli&&r?.size&&n.cli.some(e=>r.has(e))||n.filePath&&t?.readFileState&&te(t.readFileState).some(e=>n.filePath.test(e)))}var Ie=[{id:`new-user-warmup`,content:async()=>`Start with small features or bug fixes, tell Work Mate to propose a plan, and verify its suggested edits`,cooldownSessions:3,async isRelevant(){return k().numStartups<10}},{id:`plan-mode-for-complex-tasks`,content:async()=>`Use Plan Mode to prepare for a complex request before making changes. Press ${f(`chat:cycleMode`,`Chat`,`shift+tab`)} twice to enable.`,cooldownSessions:5,isRelevant:async()=>{let e=k();return(e.lastPlanModeUse?(Date.now()-e.lastPlanModeUse)/(1e3*60*60*24):1/0)>7}},{id:`default-permission-mode-config`,content:async()=>`Use /config to change your default permission mode (including Plan Mode)`,cooldownSessions:10,isRelevant:async()=>{try{let e=k(),t=D(),n=!!e.lastPlanModeUse,r=!!t?.permissions?.defaultMode;return n&&!r}catch(e){return C(`Failed to check default-permission-mode-config tip relevance: ${e}`,{level:`warn`}),!1}}},{id:`git-worktrees`,content:async()=>`Use git worktrees to run multiple Work Mate sessions in parallel.`,cooldownSessions:10,isRelevant:async()=>{try{let e=k();return await P()<=1&&e.numStartups>50}catch{return!1}}},{id:`terminal-setup`,content:async()=>T.terminal===`Apple_Terminal`?`Run /terminal-setup to enable convenient terminal integration like Option + Enter for new line and more`:`Run /terminal-setup to enable convenient terminal integration like Shift + Enter for new line and more`,cooldownSessions:10,async isRelevant(){let e=k();return T.terminal===`Apple_Terminal`?!e.optionAsMetaKeyInstalled:!e.shiftEnterKeyBindingInstalled}},{id:`shift-enter`,content:async()=>T.terminal===`Apple_Terminal`?`Press Option+Enter to send a multi-line message`:`Press Shift+Enter to send a multi-line message`,cooldownSessions:10,async isRelevant(){let e=k();return!!((T.terminal===`Apple_Terminal`?e.optionAsMetaKeyInstalled:e.shiftEnterKeyBindingInstalled)&&e.numStartups>3)}},{id:`shift-enter-setup`,content:async()=>T.terminal===`Apple_Terminal`?`Run /terminal-setup to enable Option+Enter for new lines`:`Run /terminal-setup to enable Shift+Enter for new lines`,cooldownSessions:10,async isRelevant(){if(!_e())return!1;let e=k();return!(T.terminal===`Apple_Terminal`?e.optionAsMetaKeyInstalled:e.shiftEnterKeyBindingInstalled)}},{id:`memory-command`,content:async()=>`Use /memory to view and manage Work Mate memory`,cooldownSessions:15,async isRelevant(){return k().memoryUsageCount<=0}},{id:`theme-command`,content:async()=>`Use /theme to change the color theme`,cooldownSessions:20,isRelevant:async()=>!0},{id:`colorterm-truecolor`,content:async()=>`Try setting environment variable COLORTERM=truecolor for richer colors`,cooldownSessions:30,isRelevant:async()=>!process.env.COLORTERM&&ae.level<3},{id:`powershell-tool-env`,content:async()=>`Set CLAUDE_CODE_USE_POWERSHELL_TOOL=1 to enable the PowerShell tool (preview)`,cooldownSessions:10,isRelevant:async()=>H()===`windows`&&process.env.CLAUDE_CODE_USE_POWERSHELL_TOOL===void 0},{id:`status-line`,content:async()=>`Use /statusline to set up a custom status line that will display beneath the input box`,cooldownSessions:25,isRelevant:async()=>D().statusLine===void 0},{id:`prompt-queue`,content:async()=>`Hit Enter to queue up additional messages while Work Mate is working.`,cooldownSessions:5,async isRelevant(){return k().promptQueueUseCount<=3}},{id:`enter-to-steer-in-relatime`,content:async()=>`Send messages to Work Mate while it works to steer Work Mate in real-time`,cooldownSessions:20,isRelevant:async()=>!0},{id:`todo-list`,content:async()=>`Ask Work Mate to create a todo list when working on complex tasks to track progress and remain on track`,cooldownSessions:20,isRelevant:async()=>!0},{id:`permissions`,content:async()=>`Use /permissions to pre-approve and pre-deny bash, edit, and MCP tools`,cooldownSessions:10,async isRelevant(){return k().numStartups>10}},{id:`drag-and-drop-images`,content:async()=>`Did you know you can drag and drop image files into your terminal?`,cooldownSessions:10,isRelevant:async()=>!T.isSSH()},{id:`paste-images-mac`,content:async()=>`Paste images into Work Mate using control+v (not cmd+v!)`,cooldownSessions:10,isRelevant:async()=>H()===`macos`},{id:`double-esc`,content:async()=>`Double-tap esc to rewind the conversation to a previous point in time`,cooldownSessions:10,isRelevant:async()=>!p()},{id:`double-esc-code-restore`,content:async()=>`Double-tap esc to rewind the code and/or conversation to a previous point in time`,cooldownSessions:10,isRelevant:async()=>p()},{id:`continue`,content:async()=>`Run claude --continue or claude --resume to resume a conversation`,cooldownSessions:10,isRelevant:async()=>!0},{id:`rename-conversation`,content:async()=>`Name your conversations with /rename to find them easily in /resume later`,cooldownSessions:15,isRelevant:async()=>s()&&k().numStartups>10},{id:`custom-commands`,content:async()=>`Create skills by adding .md files to .workmate/skills/ in your project or ~/.workmate/skills/ for skills that work in any project`,cooldownSessions:15,async isRelevant(){return k().numStartups>10}},{id:`shift-tab`,content:async()=>`Hit ${f(`chat:cycleMode`,`Chat`,`shift+tab`)} to cycle between default, accept edits, plan, auto, and bypass modes`,cooldownSessions:10,isRelevant:async()=>!0},{id:`image-paste`,content:async()=>`Use ${f(`chat:imagePaste`,`Chat`,`ctrl+v`)} to paste images from your clipboard`,cooldownSessions:20,isRelevant:async()=>!0},{id:`custom-agents`,content:async()=>`Use /agents to optimize specific tasks. Eg. Software Architect, Code Writer, Code Reviewer`,cooldownSessions:15,async isRelevant(){return k().numStartups>5}},{id:`agent-flag`,content:async()=>`Use --agent <agent_name> to directly start a conversation with a subagent`,cooldownSessions:15,async isRelevant(){return k().numStartups>5}},{id:`frontend-design-plugin`,content:async e=>`Working with HTML/CSS? Install the frontend-design plugin:\n${g(`suggestion`,e?.theme??`dark`)(`/plugin install frontend-design@${c}`)}`,cooldownSessions:3,isRelevant:async e=>Y(`frontend-design`,e,{filePath:/\.(html|css|htm)$/i})},{id:`vercel-plugin`,content:async e=>`Working with Vercel? Install the vercel plugin:\n${g(`suggestion`,e?.theme??`dark`)(`/plugin install vercel@${c}`)}`,cooldownSessions:3,isRelevant:async e=>Y(`vercel`,e,{filePath:/(?:^|[/\\])vercel\.json$/i,cli:[`vercel`]})},{id:`subagent-fanout-nudge`,content:async e=>`Say ${g(`suggestion`,e?.theme??`dark`)(`"fan out subagents"`)} and Work Mate sends a team. Each one digs deep so nothing gets missed.`,cooldownSessions:3,isRelevant:async()=>(ue(),!1)}],Le=[];function X(){let e=O().spinnerTipsOverride;return e?.tips?.length?e.tips.map((e,t)=>({id:`custom-tip-${t}`,content:async()=>e,cooldownSessions:0,isRelevant:async()=>!0})):[]}async function Re(e){let t=O().spinnerTipsOverride,n=X();if(t?.excludeDefault&&n.length>0)return n;let r=[...Ie,...Le],i=await Promise.all(r.map(t=>t.isRelevant?.(e)??Promise.resolve(!0)));return[...r.filter((e,t)=>i[t]).filter(e=>q(e.id)>=e.cooldownSessions),...n]}be(),w(),B(),me(),he();var Z=2e3,Q=5,ze=3e4,$=3,Be=new Set([4003]);function Ve(e){return typeof e!=`object`||!e||!(`type`in e)?!1:typeof e.type==`string`}var He=class{constructor(e,t,n,i){r(this,`sessionId`,void 0),r(this,`orgUuid`,void 0),r(this,`getAccessToken`,void 0),r(this,`callbacks`,void 0),r(this,`ws`,null),r(this,`state`,`closed`),r(this,`reconnectAttempts`,0),r(this,`sessionNotFoundRetries`,0),r(this,`pingInterval`,null),r(this,`reconnectTimer`,null),this.sessionId=e,this.orgUuid=t,this.getAccessToken=n,this.callbacks=i}async connect(){if(this.state===`connecting`){C(`[SessionsWebSocket] Already connecting`);return}this.state=`connecting`;let e=`${W().BASE_API_URL.replace(`http`,`ws`)}/v1/sessions/ws/${this.sessionId}/subscribe?organization_uuid=${this.orgUuid}`;C(`[SessionsWebSocket] Connecting to ${e}`);let t={Authorization:`Bearer ${this.getAccessToken()}`,"anthropic-version":`2023-06-01`};if(typeof Bun<`u`){let n=new globalThis.WebSocket(e,{headers:t,proxy:pe(e),tls:K()||void 0});this.ws=n,n.addEventListener(`open`,()=>{C(`[SessionsWebSocket] Connection opened, authenticated via headers`),this.state=`connected`,this.reconnectAttempts=0,this.sessionNotFoundRetries=0,this.startPingInterval(),this.callbacks.onConnected?.()}),n.addEventListener(`message`,e=>{let t=typeof e.data==`string`?e.data:String(e.data);this.handleMessage(t)}),n.addEventListener(`error`,()=>{let e=Error(`[SessionsWebSocket] WebSocket error`);V(e),this.callbacks.onError?.(e)}),n.addEventListener(`close`,e=>{C(`[SessionsWebSocket] Closed: code=${e.code} reason=${e.reason}`),this.handleClose(e.code)}),n.addEventListener(`pong`,()=>{C(`[SessionsWebSocket] Pong received`)})}else{let{default:n}=await import(`./wrapper-K8ZapJVu.js`),r=new n(e,{headers:t,agent:ge(e),...K()});this.ws=r,r.on(`open`,()=>{C(`[SessionsWebSocket] Connection opened, authenticated via headers`),this.state=`connected`,this.reconnectAttempts=0,this.sessionNotFoundRetries=0,this.startPingInterval(),this.callbacks.onConnected?.()}),r.on(`message`,e=>{this.handleMessage(e.toString())}),r.on(`error`,e=>{V(Error(`[SessionsWebSocket] Error: ${e.message}`)),this.callbacks.onError?.(e)}),r.on(`close`,(e,t)=>{C(`[SessionsWebSocket] Closed: code=${e} reason=${t.toString()}`),this.handleClose(e)}),r.on(`pong`,()=>{C(`[SessionsWebSocket] Pong received`)})}}handleMessage(e){try{let t=oe(e);Ve(t)?this.callbacks.onMessage(t):C(`[SessionsWebSocket] Ignoring message type: ${typeof t==`object`&&t&&`type`in t?String(t.type):`unknown`}`)}catch(e){V(Error(`[SessionsWebSocket] Failed to parse message: ${x(e)}`))}}handleClose(e){if(this.stopPingInterval(),this.state===`closed`)return;this.ws=null;let t=this.state;if(this.state=`closed`,Be.has(e)){C(`[SessionsWebSocket] Permanent close code ${e}, not reconnecting`),this.callbacks.onClose?.();return}if(e===4001){if(this.sessionNotFoundRetries++,this.sessionNotFoundRetries>$){C(`[SessionsWebSocket] 4001 retry budget exhausted (${$}), not reconnecting`),this.callbacks.onClose?.();return}this.scheduleReconnect(Z*this.sessionNotFoundRetries,`4001 attempt ${this.sessionNotFoundRetries}/${$}`);return}t===`connected`&&this.reconnectAttempts<Q?(this.reconnectAttempts++,this.scheduleReconnect(Z,`attempt ${this.reconnectAttempts}/${Q}`)):(C(`[SessionsWebSocket] Not reconnecting`),this.callbacks.onClose?.())}scheduleReconnect(e,t){this.callbacks.onReconnecting?.(),C(`[SessionsWebSocket] Scheduling reconnect (${t}) in ${e}ms`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}startPingInterval(){this.stopPingInterval(),this.pingInterval=setInterval(()=>{if(this.ws&&this.state===`connected`)try{this.ws.ping?.()}catch{}},ze)}stopPingInterval(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null)}sendControlResponse(e){if(!this.ws||this.state!==`connected`){V(Error(`[SessionsWebSocket] Cannot send: not connected`));return}C(`[SessionsWebSocket] Sending control response`),this.ws.send(b(e))}sendControlRequest(e){if(!this.ws||this.state!==`connected`){V(Error(`[SessionsWebSocket] Cannot send: not connected`));return}let t={type:`control_request`,request_id:Ce(),request:e};C(`[SessionsWebSocket] Sending control request: ${e.subtype}`),this.ws.send(b(t))}isConnected(){return this.state===`connected`}close(){C(`[SessionsWebSocket] Closing connection`),this.state=`closed`,this.stopPingInterval(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(),this.ws=null)}reconnect(){C(`[SessionsWebSocket] Force reconnecting`),this.reconnectAttempts=0,this.sessionNotFoundRetries=0,this.close(),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},500)}};w(),B(),n();function Ue(e){return e.type!==`control_request`&&e.type!==`control_response`&&e.type!==`control_cancel_request`}var We=class{constructor(e,t){r(this,`config`,void 0),r(this,`callbacks`,void 0),r(this,`websocket`,null),r(this,`pendingPermissionRequests`,new Map),this.config=e,this.callbacks=t}connect(){C(`[RemoteSessionManager] Connecting to session ${this.config.sessionId}`);let e={onMessage:e=>this.handleMessage(e),onConnected:()=>{C(`[RemoteSessionManager] Connected`),this.callbacks.onConnected?.()},onClose:()=>{C(`[RemoteSessionManager] Disconnected`),this.callbacks.onDisconnected?.()},onReconnecting:()=>{C(`[RemoteSessionManager] Reconnecting`),this.callbacks.onReconnecting?.()},onError:e=>{V(e),this.callbacks.onError?.(e)}};this.websocket=new He(this.config.sessionId,this.config.orgUuid,this.config.getAccessToken,e),this.websocket.connect()}handleMessage(e){if(e.type===`control_request`){this.handleControlRequest(e);return}if(e.type===`control_cancel_request`){let{request_id:t}=e,n=this.pendingPermissionRequests.get(t);C(`[RemoteSessionManager] Permission request cancelled: ${t}`),this.pendingPermissionRequests.delete(t),this.callbacks.onPermissionCancelled?.(t,n?.tool_use_id);return}if(e.type===`control_response`){C(`[RemoteSessionManager] Received control response`);return}Ue(e)&&this.callbacks.onMessage(e)}handleControlRequest(e){let t=e.request_id,n=e.request;if(n.subtype===`can_use_tool`)C(`[RemoteSessionManager] Permission request for tool: ${n.tool_name}`),this.pendingPermissionRequests.set(t,n),this.callbacks.onPermissionRequest(n,t);else{C(`[RemoteSessionManager] Unsupported control request subtype: ${n.subtype}`);let e={type:`control_response`,response:{subtype:`error`,request_id:t,error:`Unsupported control request subtype: ${n.subtype}`}};this.websocket?.sendControlResponse(e)}}async sendMessage(e,t){C(`[RemoteSessionManager] Sending message to session ${this.config.sessionId}`);let n=await ye(this.config.sessionId,e,t);return n||V(Error(`[RemoteSessionManager] Failed to send message to session ${this.config.sessionId}`)),n}respondToPermissionRequest(e,t){if(!this.pendingPermissionRequests.get(e)){V(Error(`[RemoteSessionManager] No pending permission request with ID: ${e}`));return}this.pendingPermissionRequests.delete(e);let n={type:`control_response`,response:{subtype:`success`,request_id:e,response:{behavior:t.behavior,...t.behavior===`allow`?{updatedInput:t.updatedInput}:{message:t.message}}}};C(`[RemoteSessionManager] Sending permission response: ${t.behavior}`),this.websocket?.sendControlResponse(n)}isConnected(){return this.websocket?.isConnected()??!1}cancelSession(){C(`[RemoteSessionManager] Sending interrupt signal`),this.websocket?.sendControlRequest({subtype:`interrupt`})}getSessionId(){return this.config.sessionId}disconnect(){C(`[RemoteSessionManager] Disconnecting`),this.websocket?.close(),this.websocket=null,this.pendingPermissionRequests.clear()}reconnect(){C(`[RemoteSessionManager] Reconnecting WebSocket`),this.websocket?.reconnect()}};function Ge(e,t,n,r=!1,i=!1){return{sessionId:e,getAccessToken:t,orgUuid:n,hasInitialPrompt:r,viewerOnly:i}}export{Pe as a,Ae as c,q as i,Ge as n,Ne as o,Re as r,ke as s,We as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$h as t,Ig as n,Ir as r,Lg as i,Mu as a,Ny as o,Pu as s,Py as ee,Rn as c,Sr as te,Tu as ne,Wr as re,Xh as l,Yn as u,Zh as d,bc as f,br as p,gC as m,hc as h,jr as ie,ni as ae,ti as oe,uC as g,wu as _}from"./loadAgentsDir-DXOkUcW3.js";import{I as v,P as y,Wt as b,ai as x,dr as S,ot as C,t as w}from"./src-DL3w8VPk2.js";import{t as T}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as E,ar as se}from"./state-D5D6QpTX.js";import{o as D,s as O}from"./log-CZ7ploQm.js";import{n as k,r as A}from"./analytics-DJobLaWP.js";import{a as ce,n as le,s as ue}from"./skillChangeDetector-Bco3UoeW.js";import{t as de}from"./REPL-Cg8UXYpX.js";import{a as fe,i as j,n as M,o as N,r as P,t as F}from"./crossProjectResume-DNnZo3gU.js";import{dirname as I}from"path";var L=e(x(),1);m(),E(),N(),s(),o(),w(),g(),k(),l(),i(),j(),h(),_(),M(),D(),p();var R=T();function z(e){let t=parseInt(e,10);if(!isNaN(t)&&t>0)return t;let n=e.match(/github\.com\/[^/]+\/[^/]+\/pull\/(\d+)/);return n?.[1]?parseInt(n[1],10):null}function B({commands:e,worktreePaths:i,initialTools:o,mcpClients:s,dynamicMcpConfig:l,debug:p,mainThreadAgentDefinition:m,autoConnectIdeFlag:h,strictMcpConfig:g=!1,systemPrompt:_,appendSystemPrompt:b,initialSearchQuery:x,disableSlashCommands:w=!1,forkSession:T,taskListId:E,filterByPr:D,thinkingConfig:k,onTurnComplete:j}){let{rows:M}=C(),N=d(e=>e.agentDefinitions),B=t(),[H,U]=L.useState([]),[me,W]=L.useState(!0),[he,ge]=L.useState(!1),[G,_e]=L.useState(!1),[K,ve]=L.useState(null),[q,J]=L.useState(null),Y=L.useRef(null),X=L.useRef(0),Z=L.useMemo(()=>{let e=H.filter(e=>!e.isSidechain);if(D!==void 0){if(D===!0)e=e.filter(e=>e.prNumber!==void 0);else if(typeof D==`number`)e=e.filter(e=>e.prNumber===D);else if(typeof D==`string`){let t=z(D);t!==null&&(e=e.filter(e=>e.prNumber===t))}}return e},[H,D]),ye=te();L.useEffect(()=>{r(i).then(e=>{Y.current=e,X.current=e.logs.length,U(e.logs),W(!1)}).catch(e=>{O(e),W(!1)})},[i]);let Q=L.useCallback(e=>{let t=Y.current;!t||t.nextIndex>=t.allStatLogs.length||u(t.allStatLogs,t.nextIndex,e).then(n=>{if(t.nextIndex=n.nextIndex,n.logs.length>0){let e=X.current;n.logs.forEach((t,n)=>{t.value=e+n}),U(e=>e.concat(n.logs)),X.current+=n.logs.length}else t.nextIndex<t.allStatLogs.length&&Q(e)})},[]),$=L.useCallback(e=>{W(!0),(e?ie():r(i)).then(e=>{Y.current=e,X.current=e.logs.length,U(e.logs)}).catch(e=>{O(e)}).finally(()=>{W(!1)})},[i]),be=L.useCallback(()=>{let e=!G;_e(e),$(e)},[G,$]);function xe(){process.exit(1)}async function Se(e){ge(!0);let t=performance.now(),r=F(e,G);if(r.isCrossProject&&!r.isSameRepoWorktree){let e=r.command,t=await S(e);t&&process.stdout.write(t),J(e);return}try{let r=await ne(e,void 0);if(!r)throw Error(`Failed to load conversation`);r.sessionId&&!T?(se(n(r.sessionId),e.fullPath?I(e.fullPath):null),await oe(),ee(r.sessionId)):T&&r.contentReplacements?.length&&await re(r.contentReplacements);let{agentDefinition:i}=ce(r.agentSetting,m,N);B(e=>({...e,agent:i?.agentType}));let a=le(r.agentName,r.agentColor);a&&B(e=>({...e,standaloneAgentContext:a})),f(r.agentName),ae(T?{...r,worktreeSession:void 0}:r),T||(ue(r.worktreeSession),r.sessionId&&c()),A(`tengu_session_resumed`,{entrypoint:`picker`,success:!0,resume_duration_ms:Math.round(performance.now()-t)}),U([]),ve({messages:r.messages,fileHistorySnapshots:r.fileHistorySnapshots,contentReplacements:r.contentReplacements,agentName:r.agentName,agentColor:r.agentColor==="default"?void 0:r.agentColor,mainThreadAgentDefinition:i})}catch(e){throw A(`tengu_session_resumed`,{entrypoint:`picker`,success:!1}),O(e),e}}return q?(0,R.jsx)(pe,{command:q}):K?(0,R.jsx)(de,{debug:p,commands:e,initialTools:o,initialMessages:K.messages,initialFileHistorySnapshots:K.fileHistorySnapshots,initialContentReplacements:K.contentReplacements,initialAgentName:K.agentName,initialAgentColor:K.agentColor,mcpClients:s,dynamicMcpConfig:l,strictMcpConfig:g,systemPrompt:_,appendSystemPrompt:b,mainThreadAgentDefinition:K.mainThreadAgentDefinition,autoConnectIdeFlag:h,disableSlashCommands:w,taskListId:E,thinkingConfig:k,onTurnComplete:j}):me?(0,R.jsxs)(v,{children:[(0,R.jsx)(a,{}),(0,R.jsx)(y,{children:` Loading conversations…`})]}):he?(0,R.jsxs)(v,{children:[(0,R.jsx)(a,{}),(0,R.jsx)(y,{children:` Resuming conversation…`})]}):Z.length===0?(0,R.jsx)(V,{}):(0,R.jsx)(fe,{logs:Z,maxHeight:M,onCancel:xe,onSelect:Se,onLogsChanged:ye?()=>$(G):void 0,onLoadMore:Q,initialSearchQuery:x,showAllProjects:G,onToggleAllProjects:be,onAgenticSearch:P})}function V(){return b(`app:interrupt`,()=>{process.exit(1)},{context:`Global`}),(0,R.jsxs)(v,{flexDirection:`column`,children:[(0,R.jsx)(y,{children:`No conversations found to resume.`}),(0,R.jsx)(y,{dimColor:!0,children:`Press Ctrl+C to exit and start a new conversation.`})]})}function pe({command:e}){return L.useEffect(()=>{let e=setTimeout(()=>{process.exit(0)},100);return()=>clearTimeout(e)},[]),(0,R.jsxs)(v,{flexDirection:`column`,gap:1,children:[(0,R.jsx)(y,{children:`This conversation is from a different directory.`}),(0,R.jsxs)(v,{flexDirection:`column`,children:[(0,R.jsx)(y,{children:`To resume, run:`}),(0,R.jsxs)(y,{children:[` `,e]})]}),(0,R.jsx)(y,{dimColor:!0,children:`(Command copied to clipboard)`})]})}export{B as ResumeConversation};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$h as t,Ig as n,Ir as r,Lg as i,Mu as a,Ny as o,Pu as s,Py as ee,Rn as c,Sr as te,Tu as ne,Wr as re,Xh as l,Yn as u,Zh as d,bc as f,br as p,gC as m,hc as h,jr as ie,ni as ae,ti as oe,uC as g,wu as _}from"./loadAgentsDir-DaNpxaO-.js";import{I as v,P as y,Wt as b,ai as x,dr as S,ot as C,t as w}from"./src-DL3w8VPk2.js";import{t as T}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as E,ar as se}from"./state-D5D6QpTX.js";import{o as D,s as O}from"./log-CZ7ploQm.js";import{n as k,r as A}from"./analytics-DJobLaWP.js";import{a as ce,n as le,s as ue}from"./skillChangeDetector-CtithJ4a.js";import{t as de}from"./REPL-CCBNfZfs.js";import{a as fe,i as j,n as M,o as N,r as P,t as F}from"./crossProjectResume-6B2NYy8a.js";import{dirname as I}from"path";var L=e(x(),1);m(),E(),N(),s(),o(),w(),g(),k(),l(),i(),j(),h(),_(),M(),D(),p();var R=T();function z(e){let t=parseInt(e,10);if(!isNaN(t)&&t>0)return t;let n=e.match(/github\.com\/[^/]+\/[^/]+\/pull\/(\d+)/);return n?.[1]?parseInt(n[1],10):null}function B({commands:e,worktreePaths:i,initialTools:o,mcpClients:s,dynamicMcpConfig:l,debug:p,mainThreadAgentDefinition:m,autoConnectIdeFlag:h,strictMcpConfig:g=!1,systemPrompt:_,appendSystemPrompt:b,initialSearchQuery:x,disableSlashCommands:w=!1,forkSession:T,taskListId:E,filterByPr:D,thinkingConfig:k,onTurnComplete:j}){let{rows:M}=C(),N=d(e=>e.agentDefinitions),B=t(),[H,U]=L.useState([]),[me,W]=L.useState(!0),[he,ge]=L.useState(!1),[G,_e]=L.useState(!1),[K,ve]=L.useState(null),[q,J]=L.useState(null),Y=L.useRef(null),X=L.useRef(0),Z=L.useMemo(()=>{let e=H.filter(e=>!e.isSidechain);if(D!==void 0){if(D===!0)e=e.filter(e=>e.prNumber!==void 0);else if(typeof D==`number`)e=e.filter(e=>e.prNumber===D);else if(typeof D==`string`){let t=z(D);t!==null&&(e=e.filter(e=>e.prNumber===t))}}return e},[H,D]),ye=te();L.useEffect(()=>{r(i).then(e=>{Y.current=e,X.current=e.logs.length,U(e.logs),W(!1)}).catch(e=>{O(e),W(!1)})},[i]);let Q=L.useCallback(e=>{let t=Y.current;!t||t.nextIndex>=t.allStatLogs.length||u(t.allStatLogs,t.nextIndex,e).then(n=>{if(t.nextIndex=n.nextIndex,n.logs.length>0){let e=X.current;n.logs.forEach((t,n)=>{t.value=e+n}),U(e=>e.concat(n.logs)),X.current+=n.logs.length}else t.nextIndex<t.allStatLogs.length&&Q(e)})},[]),$=L.useCallback(e=>{W(!0),(e?ie():r(i)).then(e=>{Y.current=e,X.current=e.logs.length,U(e.logs)}).catch(e=>{O(e)}).finally(()=>{W(!1)})},[i]),be=L.useCallback(()=>{let e=!G;_e(e),$(e)},[G,$]);function xe(){process.exit(1)}async function Se(e){ge(!0);let t=performance.now(),r=F(e,G);if(r.isCrossProject&&!r.isSameRepoWorktree){let e=r.command,t=await S(e);t&&process.stdout.write(t),J(e);return}try{let r=await ne(e,void 0);if(!r)throw Error(`Failed to load conversation`);r.sessionId&&!T?(se(n(r.sessionId),e.fullPath?I(e.fullPath):null),await oe(),ee(r.sessionId)):T&&r.contentReplacements?.length&&await re(r.contentReplacements);let{agentDefinition:i}=ce(r.agentSetting,m,N);B(e=>({...e,agent:i?.agentType}));let a=le(r.agentName,r.agentColor);a&&B(e=>({...e,standaloneAgentContext:a})),f(r.agentName),ae(T?{...r,worktreeSession:void 0}:r),T||(ue(r.worktreeSession),r.sessionId&&c()),A(`tengu_session_resumed`,{entrypoint:`picker`,success:!0,resume_duration_ms:Math.round(performance.now()-t)}),U([]),ve({messages:r.messages,fileHistorySnapshots:r.fileHistorySnapshots,contentReplacements:r.contentReplacements,agentName:r.agentName,agentColor:r.agentColor==="default"?void 0:r.agentColor,mainThreadAgentDefinition:i})}catch(e){throw A(`tengu_session_resumed`,{entrypoint:`picker`,success:!1}),O(e),e}}return q?(0,R.jsx)(pe,{command:q}):K?(0,R.jsx)(de,{debug:p,commands:e,initialTools:o,initialMessages:K.messages,initialFileHistorySnapshots:K.fileHistorySnapshots,initialContentReplacements:K.contentReplacements,initialAgentName:K.agentName,initialAgentColor:K.agentColor,mcpClients:s,dynamicMcpConfig:l,strictMcpConfig:g,systemPrompt:_,appendSystemPrompt:b,mainThreadAgentDefinition:K.mainThreadAgentDefinition,autoConnectIdeFlag:h,disableSlashCommands:w,taskListId:E,thinkingConfig:k,onTurnComplete:j}):me?(0,R.jsxs)(v,{children:[(0,R.jsx)(a,{}),(0,R.jsx)(y,{children:` Loading conversations…`})]}):he?(0,R.jsxs)(v,{children:[(0,R.jsx)(a,{}),(0,R.jsx)(y,{children:` Resuming conversation…`})]}):Z.length===0?(0,R.jsx)(V,{}):(0,R.jsx)(fe,{logs:Z,maxHeight:M,onCancel:xe,onSelect:Se,onLogsChanged:ye?()=>$(G):void 0,onLoadMore:Q,initialSearchQuery:x,showAllProjects:G,onToggleAllProjects:be,onAgenticSearch:P})}function V(){return b(`app:interrupt`,()=>{process.exit(1)},{context:`Global`}),(0,R.jsxs)(v,{flexDirection:`column`,children:[(0,R.jsx)(y,{children:`No conversations found to resume.`}),(0,R.jsx)(y,{dimColor:!0,children:`Press Ctrl+C to exit and start a new conversation.`})]})}function pe({command:e}){return L.useEffect(()=>{let e=setTimeout(()=>{process.exit(0)},100);return()=>clearTimeout(e)},[]),(0,R.jsxs)(v,{flexDirection:`column`,gap:1,children:[(0,R.jsx)(y,{children:`This conversation is from a different directory.`}),(0,R.jsxs)(v,{flexDirection:`column`,children:[(0,R.jsx)(y,{children:`To resume, run:`}),(0,R.jsxs)(y,{children:[` `,e]})]}),(0,R.jsx)(y,{dimColor:!0,children:`(Command copied to clipboard)`})]})}export{B as ResumeConversation};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{C as a,P as o,R as s,S as c,c as l,i as u,x as d}from"./debug-D58GQBDG.js";import{O as f,k as p}from"./git-By_J4XJL.js";import{dn as m,fn as h}from"./model-Cxx3suBa.js";import{n as g,t as _}from"./userAgent-CJ5Rp9kc.js";import{C as v,x as y}from"./sessionState-DAcub-HK.js";import{n as b,t as x}from"./rcDebugLog-DSchf3Hs.js";function S(){return!0}function C(e){let t=[],n=0,r=/\r?\n\r?\n/g;r.lastIndex=n;let i;for(;(i=r.exec(e))!==null;){let r=i.index,a=e.slice(n,r);if(n=r+i[0].length,!a.trim())continue;let o={},s=!1;for(let e of a.split(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{C as a,P as o,R as s,S as c,c as l,i as u,x as d}from"./debug-D58GQBDG.js";import{O as f,k as p}from"./git-By_J4XJL.js";import{dn as m,fn as h}from"./model-Do0f476p.js";import{n as g,t as _}from"./userAgent-i-oGzf40.js";import{C as v,x as y}from"./sessionState-CQhbGfmh.js";import{n as b,t as x}from"./rcDebugLog-DSchf3Hs.js";function S(){return!0}function C(e){let t=[],n=0,r=/\r?\n\r?\n/g;r.lastIndex=n;let i;for(;(i=r.exec(e))!==null;){let r=i.index,a=e.slice(n,r);if(n=r+i[0].length,!a.trim())continue;let o={},s=!1;for(let e of a.split(`
2
2
  `)){let t=e[e.length-1]===`\r`?e.slice(0,-1):e;if(t.startsWith(`:`)){s=!0;continue}let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n),i=t[n+1]===` `?t.slice(n+2):t.slice(n+1);switch(r){case`event`:o.event=i;break;case`id`:o.id=i;break;case`data`:o.data=o.data?`${o.data}\n${i}`:i;break}}(o.data||s)&&t.push(o)}return{frames:t,remaining:e.slice(n)}}function w(e){let t=e.pathname;return t.endsWith(`/stream`)&&(t=t.slice(0,-7)),`${e.protocol}//${e.host}${t}`}var T,E,D,O,k,A,j,M,N,P,F=e((()=>{i(),u(),x(),f(),s(),v(),m(),d(),g(),t(),T=1e3,E=3e4,D=6e5,O=45e3,k=new Set([401,403,404]),A=10,j=500,M=8e3,N={stream:!0},P=class{constructor(e,t={},r,i,a,o){n(this,`url`,void 0),n(this,`state`,`idle`),n(this,`onData`,void 0),n(this,`onCloseCallback`,void 0),n(this,`onEventCallback`,void 0),n(this,`headers`,void 0),n(this,`sessionId`,void 0),n(this,`refreshHeaders`,void 0),n(this,`getAuthHeaders`,void 0),n(this,`abortController`,null),n(this,`lastSequenceNum`,0),n(this,`seenSequenceNums`,new Set),n(this,`reconnectAttempts`,0),n(this,`reconnectStartTime`,null),n(this,`reconnectTimer`,null),n(this,`livenessTimer`,null),n(this,`lastActivityTime`,0),n(this,`postUrl`,void 0),n(this,`onLivenessTimeout`,()=>{this.livenessTimer=null,b(`SSE liveness timeout (${O}ms) lastSeqNum=${this.getLastSequenceNum()} state=${this.state}`),l(`SSETransport: Liveness timeout, reconnecting`,{level:`error`}),p(`error`,`cli_sse_liveness_timeout`),this.abortController?.abort(),this.handleConnectionError()}),this.url=e,this.headers=t,this.sessionId=r,this.refreshHeaders=i,this.getAuthHeaders=o??y,this.postUrl=w(e),a!==void 0&&a>0&&(this.lastSequenceNum=a),l(`SSETransport: SSE URL = ${e.href}`),l(`SSETransport: POST URL = ${this.postUrl}`),p(`info`,`cli_sse_transport_initialized`)}getLastSequenceNum(){return this.lastSequenceNum}async connect(){if(this.state!==`idle`&&this.state!==`reconnecting`){l(`SSETransport: Cannot connect, current state is ${this.state}`,{level:`error`}),p(`error`,`cli_sse_connect_failed`);return}this.state=`reconnecting`;let e=Date.now(),t=new URL(this.url.href);this.lastSequenceNum>0&&t.searchParams.set(`from_sequence_num`,String(this.lastSequenceNum));let n=this.getAuthHeaders(),r={...this.headers,...n,Accept:`text/event-stream`,"anthropic-version":`2023-06-01`,"User-Agent":_()};n.Cookie&&delete r.Authorization,this.lastSequenceNum>0&&(r[`Last-Event-ID`]=String(this.lastSequenceNum)),l(`SSETransport: Opening ${t.href}`),p(`info`,`cli_sse_connect_opening`),this.abortController=new AbortController;try{let n=await fetch(t.href,{headers:r,signal:this.abortController.signal});if(!n.ok){let e=k.has(n.status);if(l(`SSETransport: HTTP ${n.status}${e?` (permanent)`:``}`,{level:`error`}),p(`error`,`cli_sse_connect_http_error`,{status:n.status}),e){this.state=`closed`,this.onCloseCallback?.(n.status);return}this.handleConnectionError();return}if(!n.body){l(`SSETransport: No response body`),this.handleConnectionError();return}let i=Date.now()-e;l(`SSETransport: Connected`),p(`info`,`cli_sse_connect_connected`,{duration_ms:i}),this.state=`connected`,this.reconnectAttempts=0,this.reconnectStartTime=null,this.resetLivenessTimer(),await this.readStream(n.body)}catch(e){if(this.abortController?.signal.aborted)return;l(`SSETransport: Connection error: ${o(e)}`,{level:`error`}),p(`error`,`cli_sse_connect_error`),this.handleConnectionError()}}async readStream(e){let t=e.getReader(),n=new TextDecoder,r=``,i=1024*1024;try{for(;;){let{done:e,value:a}=await t.read();if(e)break;if(r+=n.decode(a,N),r.length>i){l(`SSETransport: Buffer exceeded ${i} bytes — dropping connection`,{level:`error`}),p(`error`,`cli_sse_buffer_overflow`);break}let{frames:o,remaining:s}=C(r);r=s;for(let e of o){if(this.resetLivenessTimer(),e.id){let t=parseInt(e.id,10);if(!isNaN(t)){if(this.seenSequenceNums.has(t))l(`SSETransport: DUPLICATE frame seq=${t} (lastSequenceNum=${this.lastSequenceNum}, seenCount=${this.seenSequenceNums.size})`,{level:`warn`}),p(`warn`,`cli_sse_duplicate_sequence`);else if(this.seenSequenceNums.add(t),this.seenSequenceNums.size>1e3){let e=this.lastSequenceNum-200;for(let t of this.seenSequenceNums)t<e&&this.seenSequenceNums.delete(t)}t>this.lastSequenceNum&&(this.lastSequenceNum=t)}}e.event&&e.data?this.handleSSEFrame(e.event,e.data):e.data&&(l(`SSETransport: Frame has data: but no event: field — dropped`,{level:`warn`}),p(`warn`,`cli_sse_frame_missing_event_field`))}}}catch(e){if(this.abortController?.signal.aborted)return;l(`SSETransport: Stream read error: ${o(e)}`,{level:`error`}),p(`error`,`cli_sse_stream_read_error`)}finally{t.releaseLock()}this.state!==`closing`&&this.state!==`closed`&&(l(`SSETransport: Stream ended, reconnecting`),this.handleConnectionError())}handleSSEFrame(e,t){if(e!==`client_event`){l(`SSETransport: Unexpected SSE event type '${e}' on worker stream`,{level:`warn`}),p(`warn`,`cli_sse_unexpected_event_type`,{event_type:e});return}let n;try{n=c(t)}catch(e){l(`SSETransport: Failed to parse client_event data: ${o(e)}`,{level:`error`});return}let r=n.payload;if(r&&typeof r==`object`&&`type`in r){let e=this.sessionId?` session=${this.sessionId}`:``;l(`SSETransport: Event seq=${n.sequence_num} event_id=${n.event_id} event_type=${n.event_type} payload_type=${String(r.type)}${e}`),p(`info`,`cli_sse_message_received`),this.onData?.(`${a(r)}\n`)}else l(`SSETransport: Ignoring client_event with no type in payload: event_id=${n.event_id}`);this.onEventCallback?.(n)}handleConnectionError(){if(b(`SSE handleConnectionError: state=${this.state} lastSeqNum=${this.getLastSequenceNum()} reconnectAttempts=${this.reconnectAttempts} msSinceLastActivity=${this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1}`),this.clearLivenessTimer(),this.state===`closing`||this.state===`closed`)return;this.abortController?.abort(),this.abortController=null;let e=Date.now();this.reconnectStartTime||(this.reconnectStartTime=e);let t=e-this.reconnectStartTime;if(t<D){if(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.refreshHeaders){let e=this.refreshHeaders();Object.assign(this.headers,e),l(`SSETransport: Refreshed headers for reconnect`)}this.state=`reconnecting`,this.reconnectAttempts++;let e=Math.min(T*2**(this.reconnectAttempts-1),E),n=Math.max(0,e+e*.25*(2*Math.random()-1));l(`SSETransport: Reconnecting in ${Math.round(n)}ms (attempt ${this.reconnectAttempts}, ${Math.round(t/1e3)}s elapsed)`),p(`error`,`cli_sse_reconnect_attempt`,{reconnectAttempts:this.reconnectAttempts}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}else l(`SSETransport: Reconnection time budget exhausted after ${Math.round(t/1e3)}s`,{level:`error`}),p(`error`,`cli_sse_reconnect_exhausted`,{reconnectAttempts:this.reconnectAttempts,elapsedMs:t}),this.state=`closed`,this.onCloseCallback?.()}resetLivenessTimer(){this.clearLivenessTimer(),this.livenessTimer=setTimeout(this.onLivenessTimeout,O)}clearLivenessTimer(){this.livenessTimer&&(clearTimeout(this.livenessTimer),this.livenessTimer=null)}async write(e){let t=this.getAuthHeaders();if(Object.keys(t).length===0){l(`SSETransport: No session token available for POST`),p(`warn`,`cli_sse_post_no_token`);return}let n={...t,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":_()};l(`SSETransport: POST body keys=${Object.keys(e).join(`,`)}`);for(let t=1;t<=A;t++){try{let i=await r.post(this.postUrl,e,{headers:n,validateStatus:S});if(i.status===200||i.status===201){l(`SSETransport: POST success type=${e.type}`);return}if(l(`SSETransport: POST ${i.status} body=${a(i.data).slice(0,200)}`),i.status>=400&&i.status<500&&i.status!==429){l(`SSETransport: POST returned ${i.status} (client error), not retrying`),p(`warn`,`cli_sse_post_client_error`,{status:i.status});return}l(`SSETransport: POST returned ${i.status}, attempt ${t}/${A}`),p(`warn`,`cli_sse_post_retryable_error`,{status:i.status,attempt:t})}catch(e){l(`SSETransport: POST error: ${e.message}, attempt ${t}/${A}`),p(`warn`,`cli_sse_post_network_error`,{attempt:t})}if(t===A){l(`SSETransport: POST failed after ${A} attempts, continuing`),p(`warn`,`cli_sse_post_retries_exhausted`);return}await h(Math.min(j*2**(t-1),M))}}isConnectedStatus(){return this.state===`connected`}isClosedStatus(){return this.state===`closed`}setOnData(e){this.onData=e}setOnClose(e){this.onCloseCallback=e}setOnEvent(e){this.onEventCallback=e}close(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.clearLivenessTimer(),this.state=`closing`,this.abortController?.abort(),this.abortController=null}}}));export{F as n,C as r,P as t};
@@ -0,0 +1 @@
1
+ import{E_ as e,T_ as t}from"./loadAgentsDir-DaNpxaO-.js";e();export{t as clearSearchExtraToolsDescriptionCache};
@@ -1,2 +1,2 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{d as n,l as r,o as i}from"./envUtils-DcaKZlRU.js";import{n as a,t as o}from"./figures-5ThXQEtq.js";import{$h as ee,$u as te,Dp as s,Gy as ne,Hy as re,Ky as c,Op as ie,Qh as ae,Qu as oe,Uh as se,Wh as ce,Wy as le,Xh as l,Zh as u,Zu as d,b as f,br as p,cd as m,eo as h,gC as g,j as ue,ld as de,no as _,ob as fe,rr as pe,sb as me,to as v,uC as he,ub as ge}from"./loadAgentsDir-DXOkUcW3.js";import{D as y,Gt as _e,H as ve,I as b,P as x,T as S,U as ye,Wt as be,Xn as xe,a as Se,ai as C,di as w,fi as T,k as Ce,n as we,ot as Te,r as E,t as D,x as O,y as Ee}from"./src-DL3w8VPk2.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as De,ft as Oe}from"./state-D5D6QpTX.js";import{n as ke,t as A}from"./cwd-Nh5IZNKO.js";import{Ft as Ae,Nt as je,Pt as Me,Rt as Ne,b as j,h as M,jt as Pe,s as Fe,t as Ie,zt as Le}from"./settings-3xZ0fsvE.js";import{a as Re,c as N,h as ze,i as Be,o as Ve,y as P}from"./config-DRy1I12M.js";import{o as He,s as Ue}from"./log-CZ7ploQm.js";import{n as We,r as F}from"./analytics-DJobLaWP.js";import{B as Ge,J as I,Q as Ke,V as qe,Y as Je,Z as Ye,_ as Xe,b as Ze,hr as Qe,mr as L,x as $e,z as et}from"./model-Cxx3suBa.js";import{a as tt,c as nt,d as rt,i as it,l as at,n as ot,o as R,r as st,s as ct,t as z,u as B}from"./status-CGp4uRlH.js";import{n as V,t as lt}from"./useExitOnCtrlCDWithKeybindings-D0uqGxGw.js";import{i as ut,n as dt,r as ft}from"./modalContext-wY9CeN4G.js";import{n as pt,t as mt}from"./ThemePicker-B3AO3_jA.js";import{i as ht,n as gt,r as _t,t as vt}from"./extraUsage-DylXI7Fc.js";import{n as yt,t as bt}from"./AgentsMdExternalIncludesDialog-DLnj3JQO.js";import{t as H}from"./SearchBox-CwwV0W-w.js";import{n as xt,t as St}from"./useSearchInput-CXTa-leH.js";function Ct(){let e=Oe();return[{label:`Version`,value:`0.0.19`},{label:`Session name`,value:pe(e)??(0,K.jsx)(x,{dimColor:!0,children:`/rename to add a name`})},{label:`Session ID`,value:e},{label:`cwd`,value:A()},...ot(),...z()]}function wt({mainLoopModel:e,mcp:t,theme:n,context:r}){return[{label:`Model`,value:B(e)},...st(t.clients,r.options.ideInstallationStatus,n),...R(t.clients,n),...nt(),...at()]}async function U(){return[...await it(),...await tt(),...await ct()]}function Tt({value:e}){return Array.isArray(e)?(0,K.jsx)(b,{flexWrap:`wrap`,columnGap:1,flexShrink:99,children:e.map((t,n)=>(0,K.jsxs)(x,{children:[t,n<e.length-1?`,`:``]},n))}):typeof e==`string`?(0,K.jsx)(x,{children:e}):e}function Et({context:e,diagnosticsPromise:t}){let n=u(e=>e.mainLoopModel),r=u(e=>e.mcp),[i]=ve(),a=W.useMemo(()=>[Ct(),wt({mainLoopModel:n,mcp:r,theme:i,context:e})],[n,r,i,e]),o=ft()?1:void 0;return(0,K.jsxs)(b,{flexDirection:`column`,flexGrow:o,children:[(0,K.jsxs)(b,{flexDirection:`column`,gap:1,flexGrow:o,children:[a.map((e,t)=>e.length>0&&(0,K.jsx)(b,{flexDirection:`column`,children:e.map(({label:e,value:t},n)=>(0,K.jsxs)(b,{flexDirection:`row`,gap:1,flexShrink:0,children:[e!==void 0&&(0,K.jsxs)(x,{bold:!0,children:[e,`:`]}),(0,K.jsx)(Tt,{value:t})]},n))},t)),(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Dt,{promise:t})})]}),(0,K.jsx)(x,{dimColor:!0,children:(0,K.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})})]})}function Dt({promise:e}){let t=(0,G.use)(e);return t.length===0?null:(0,K.jsxs)(b,{flexDirection:`column`,paddingBottom:1,children:[(0,K.jsx)(x,{bold:!0,children:`System Diagnostics`}),t.map((e,t)=>(0,K.jsxs)(b,{flexDirection:`row`,gap:1,paddingX:1,children:[(0,K.jsx)(x,{color:`error`,children:o.warning}),typeof e==`string`?(0,K.jsx)(x,{wrap:`wrap`,children:e}):e]},t))]})}var W,G,K,Ot=e((()=>{a(),W=t(C(),1),G=t(C(),1),De(),dt(),D(),l(),ke(),p(),rt(),ie(),K=k()}));function kt({currentVersion:e,onChoice:t}){function n(e){t(e)}function r(){t(`cancel`)}return(0,At.jsxs)(Ee,{title:`Switch to Stable Channel`,onCancel:r,color:`permission`,hideBorder:!0,hideInputGuide:!0,children:[(0,At.jsxs)(x,{children:[`The stable channel may have an older version than what you're currently running (`,e,`).`]}),(0,At.jsx)(x,{dimColor:!0,children:`How would you like to handle this?`}),(0,At.jsx)(oe,{options:[{label:`Allow possible downgrade to stable version`,value:`downgrade`},{label:`Stay on current version (${e}) until stable catches up`,value:`stay`}],onChange:n})]})}var At,jt=e((()=>{D(),d(),At=k()}));function Mt(e){return Object.entries(e).map(([e,t])=>({label:t?.name??Ft,value:e,description:t?.description??It}))}function Nt({initialStyle:e,onComplete:t,onCancel:n,isStandaloneCommand:r}){let[i,a]=(0,Pt.useState)([]),[o,ee]=(0,Pt.useState)(!0);(0,Pt.useEffect)(()=>{v(A()).then(e=>{let t=Mt(e);a(t),ee(!1)}).catch(()=>{let e=Mt(h);a(e),ee(!1)})},[]);let te=(0,Pt.useCallback)(e=>{t(e)},[t]);return(0,q.jsx)(Ee,{title:`Preferred output style`,onCancel:n,hideInputGuide:!r,hideBorder:!r,children:(0,q.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,q.jsx)(b,{marginTop:1,children:(0,q.jsx)(x,{dimColor:!0,children:`This changes how Work Mate communicates with you`})}),o?(0,q.jsx)(x,{dimColor:!0,children:`Loading output styles…`}):(0,q.jsx)(oe,{options:i,onChange:te,visibleOptionCount:10,defaultValue:e})]})})}var Pt,q,Ft,It,Lt=e((()=>{Pt=t(C(),1),_(),D(),ke(),te(),q=k(),Ft=`Default`,It=`Work Mate completes coding tasks efficiently and provides concise responses`}));function Rt({initialLanguage:e,onComplete:t,onCancel:n}){let[r,i]=(0,zt.useState)(e),[a,ee]=(0,zt.useState)((e??``).length);be(`confirm:no`,n,{context:`Settings`});function te(){let e=r?.trim();t(e||void 0)}return(0,J.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(x,{children:`Enter your preferred response and voice language:`}),(0,J.jsxs)(b,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(x,{children:o.pointer}),(0,J.jsx)(m,{value:r??``,onChange:i,onSubmit:te,focus:!0,showCursor:!0,placeholder:`e.g., Japanese, 日本語, Español${o.ellipsis}`,columns:60,cursorOffset:a,onChangeCursorOffset:ee})]}),(0,J.jsx)(x,{dimColor:!0,children:`Leave empty for default (English)`})]})}var zt,J,Bt=e((()=>{a(),zt=t(C(),1),D(),he(),de(),J=k()}));function Vt({onClose:e,context:t,setTabsHidden:i,onIsSearchModeChange:a,contentHeight:te}){let{headerFocused:c,focusHeader:ie}=Se(),se=ft(),[,l]=ve(),d=ye(),[f,p]=(0,X.useState)(N()),m=Y.useRef(N()),[h,g]=(0,X.useState)(Ie()),de=Y.useRef(Ie()),[_,pe]=(0,X.useState)(h?.outputStyle||`default`),me=Y.useRef(_),[v,he]=(0,X.useState)(h?.language),C=Y.useRef(v),[T,we]=(0,X.useState)(0),[E,D]=(0,X.useState)(0),[O,k]=(0,X.useState)(!1),De=xe(),{rows:Oe}=Te(),ke=te??Math.min(Math.floor(Oe*.8),30),A=Math.max(5,ke-10),M=u(e=>e.mainLoopModel),Pe=u(e=>e.verbose),ze=u(e=>e.thinkingEnabled),He=u(e=>Ye()?e.fastMode:!1);u(e=>e.promptSuggestionEnabled);let We=Me(h?.permissions?.defaultMode??`default`),I=ee(),[Xe,L]=(0,X.useState)({}),tt=Y.useRef(ze),[nt]=(0,X.useState)(()=>Fe(`localSettings`)),[rt]=(0,X.useState)(()=>Fe(`userSettings`)),it=Y.useRef(d),at=ae(),[ot]=(0,X.useState)(()=>{let e=at.getState();return{mainLoopModel:e.mainLoopModel,mainLoopModelForSession:e.mainLoopModelForSession,verbose:e.verbose,thinkingEnabled:e.thinkingEnabled,fastMode:e.fastMode,promptSuggestionEnabled:e.promptSuggestionEnabled,replBridgeEnabled:e.replBridgeEnabled,replBridgeOutboundOnly:e.replBridgeOutboundOnly,settings:e.settings}}),R=Y.useRef(!1),[st,ct]=(0,X.useState)(!1),[z,B]=(0,X.useState)(null),{query:V,setQuery:lt,cursorOffset:ut}=xt({isActive:O&&z===null&&!c,onExit:()=>k(!1),onExitUp:ie,passthroughCtrlKeys:[`c`,`d`]}),dt=O&&!c;Y.useEffect(()=>{a?.(dt)},[dt,a]);let pt=fe(t.options.mcpClients),ht=!r(process.env.CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING),vt=Y.use(le(!0)),yt=ne(vt),H=Re();function St(e){F(`tengu_config_model_changed`,{from_model:M,to_model:e}),I(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null})),L(t=>{let n=$e(e)+(gt(e,!1,Ze())?` · Billed as extra usage`:``);if(`model`in t){let{model:e,...r}=t;return{...r,model:n}}return{...t,model:n}})}function Ct(e){P(t=>({...t,verbose:e})),p({...N(),verbose:e}),I(t=>({...t,verbose:e})),L(t=>{if(`verbose`in t){let{verbose:e,...n}=t;return n}return{...t,verbose:e}})}let wt=[{id:`autoCompactEnabled`,label:`Auto-compact`,value:f.autoCompactEnabled,type:`boolean`,onChange(e){P(t=>({...t,autoCompactEnabled:e})),p({...N(),autoCompactEnabled:e}),F(`tengu_auto_compact_setting_changed`,{enabled:e})}},{id:`spinnerTipsEnabled`,label:`Show tips`,value:h?.spinnerTipsEnabled??!0,type:`boolean`,onChange(e){j(`localSettings`,{spinnerTipsEnabled:e}),g(t=>({...t,spinnerTipsEnabled:e})),F(`tengu_tips_setting_changed`,{enabled:e})}},{id:`cacheWarningEnabled`,label:`Cache warnings`,value:h?.cacheWarningEnabled??!0,type:`boolean`,onChange(e){j(`localSettings`,{cacheWarningEnabled:e}),g(t=>({...t,cacheWarningEnabled:e})),F(`tengu_cache_warning_setting_changed`,{enabled:e})}},{id:`prefersReducedMotion`,label:`Reduce motion`,value:h?.prefersReducedMotion??!1,type:`boolean`,onChange(e){j(`localSettings`,{prefersReducedMotion:e}),g(t=>({...t,prefersReducedMotion:e})),I(t=>({...t,settings:{...t.settings,prefersReducedMotion:e}})),F(`tengu_reduce_motion_setting_changed`,{enabled:e})}},{id:`thinkingEnabled`,label:`Thinking mode`,value:ze??!0,type:`boolean`,onChange(e){I(t=>({...t,thinkingEnabled:e})),j(`userSettings`,{alwaysThinkingEnabled:e?void 0:!1}),F(`tengu_thinking_toggled`,{enabled:e})}},...Ye()&&Je()?[{id:`fastMode`,label:`Fast mode (${et} only)`,value:!!He,type:`boolean`,onChange(e){Ge(),j(`userSettings`,{fastMode:e?!0:void 0}),e?(I(e=>({...e,mainLoopModel:qe(),mainLoopModelForSession:null,fastMode:!0})),L(e=>({...e,model:qe(),"Fast mode":`ON`}))):(I(e=>({...e,fastMode:!1})),L(e=>({...e,"Fast mode":`OFF`})))}}]:[],...ht?[{id:`fileCheckpointingEnabled`,label:`Rewind code (checkpoints)`,value:f.fileCheckpointingEnabled,type:`boolean`,onChange(e){P(t=>({...t,fileCheckpointingEnabled:e})),p({...N(),fileCheckpointingEnabled:e}),F(`tengu_file_history_snapshots_setting_changed`,{enabled:e})}}]:[],{id:`verbose`,label:`Verbose output`,value:Pe,type:`boolean`,onChange:Ct},{id:`terminalProgressBarEnabled`,label:`Terminal progress bar`,value:f.terminalProgressBarEnabled,type:`boolean`,onChange(e){P(t=>({...t,terminalProgressBarEnabled:e})),p({...N(),terminalProgressBarEnabled:e}),F(`tengu_terminal_progress_bar_setting_changed`,{enabled:e})}},{id:`showTurnDuration`,label:`Show turn duration`,value:f.showTurnDuration,type:`boolean`,onChange(e){P(t=>({...t,showTurnDuration:e})),p({...N(),showTurnDuration:e}),F(`tengu_show_turn_duration_setting_changed`,{enabled:e})}},{id:`defaultPermissionMode`,label:`Default permission mode`,value:We,options:(()=>{let e=[`default`,`plan`];return[...e,...Le.filter(t=>!e.includes(t))]})(),type:`enum`,onChange(e){let t=Me(e),n=t===`auto`?t:je(t)?Ne(t):t,r=j(`userSettings`,{permissions:{...h?.permissions,defaultMode:n}});if(r.error){Ue(r.error);return}g(e=>({...e,permissions:{...e?.permissions,defaultMode:n}})),L(t=>({...t,defaultPermissionMode:e})),F(`tengu_config_changed`,{setting:`defaultPermissionMode`,value:e})}},{id:`respectGitignore`,label:`Respect .gitignore in file picker`,value:f.respectGitignore,type:`boolean`,onChange(e){P(t=>({...t,respectGitignore:e})),p({...N(),respectGitignore:e}),F(`tengu_respect_gitignore_setting_changed`,{enabled:e})}},...ce()?[{id:`copyOnSelect`,label:`Copy on select`,value:f.copyOnSelect??!0,type:`boolean`,onChange(e){P(t=>({...t,copyOnSelect:e})),p({...N(),copyOnSelect:e}),F(`tengu_config_changed`,{setting:`copyOnSelect`,value:String(e)})}}]:[],H?{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:`disabled`,type:`managedEnum`,onChange(){}}:{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:h?.autoUpdatesChannel??`latest`,type:`managedEnum`,onChange(){}},{id:`theme`,label:`Theme`,value:d,type:`managedEnum`,onChange:l},{id:`notifChannel`,label:`Notifications`,value:f.preferredNotifChannel,options:[`auto`,`iterm2`,`terminal_bell`,`iterm2_with_bell`,`kitty`,`ghostty`,`notifications_disabled`],type:`enum`,onChange(e){P(t=>({...t,preferredNotifChannel:e})),p({...N(),preferredNotifChannel:e})}},{id:`outputStyle`,label:`Output style`,value:_,type:`managedEnum`,onChange:()=>{}},{id:`language`,label:`Language`,value:v??`Default (English)`,type:`managedEnum`,onChange:()=>{}},{id:`editorMode`,label:`Editor mode`,value:f.editorMode===`emacs`?`normal`:f.editorMode||`normal`,options:[`normal`,`vim`],type:`enum`,onChange(e){P(t=>({...t,editorMode:e})),p({...N(),editorMode:e}),F(`tengu_editor_mode_changed`,{mode:e,source:`config_panel`})}},{id:`prStatusFooterEnabled`,label:`Show PR status footer`,value:f.prStatusFooterEnabled??!0,type:`boolean`,onChange(e){P(t=>t.prStatusFooterEnabled===e?t:{...t,prStatusFooterEnabled:e}),p({...N(),prStatusFooterEnabled:e}),F(`tengu_pr_status_footer_setting_changed`,{enabled:e})}},{id:`model`,label:`Model`,value:M===null?`Default (recommended)`:M,type:`managedEnum`,onChange:St},...pt?[{id:`diffTool`,label:`Diff tool`,value:f.diffTool??`auto`,options:[`terminal`,`auto`],type:`enum`,onChange(e){P(t=>({...t,diffTool:e})),p({...N(),diffTool:e}),F(`tengu_diff_tool_changed`,{tool:e,source:`config_panel`})}}]:[],...ge()?[]:[{id:`autoConnectIde`,label:`Auto-connect to IDE (external terminal)`,value:f.autoConnectIde??!1,type:`boolean`,onChange(e){P(t=>({...t,autoConnectIde:e})),p({...N(),autoConnectIde:e}),F(`tengu_auto_connect_ide_changed`,{enabled:e,source:`config_panel`})}}],...ge()?[{id:`autoInstallIdeExtension`,label:`Auto-install IDE extension`,value:f.autoInstallIdeExtension??!0,type:`boolean`,onChange(e){P(t=>({...t,autoInstallIdeExtension:e})),p({...N(),autoInstallIdeExtension:e}),F(`tengu_auto_install_ide_extension_changed`,{enabled:e,source:`config_panel`})}}]:[],...yt?[{id:`showExternalIncludesDialog`,label:`External AGENTS.md includes`,value:Ve().hasAgentsMdExternalIncludesApproved?`true`:`false`,type:`managedEnum`,onChange(){}}]:[],...process.env.ANTHROPIC_API_KEY&&!n()?[{id:`apiKey`,label:(0,Z.jsxs)(x,{children:[`Use custom API key: `,(0,Z.jsx)(x,{bold:!0,children:Qe(process.env.ANTHROPIC_API_KEY)})]}),searchText:`Use custom API key`,value:!!(process.env.ANTHROPIC_API_KEY&&f.customApiKeyResponses?.approved?.includes(Qe(process.env.ANTHROPIC_API_KEY))),type:`boolean`,onChange(e){P(t=>{let n={...t};if(n.customApiKeyResponses||(n.customApiKeyResponses={approved:[],rejected:[]}),n.customApiKeyResponses.approved||(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]}),n.customApiKeyResponses.rejected||(n.customApiKeyResponses={...n.customApiKeyResponses,rejected:[]}),process.env.ANTHROPIC_API_KEY){let t=Qe(process.env.ANTHROPIC_API_KEY);e?n.customApiKeyResponses={...n.customApiKeyResponses,approved:[...(n.customApiKeyResponses.approved??[]).filter(e=>e!==t),t],rejected:(n.customApiKeyResponses.rejected??[]).filter(e=>e!==t)}:n.customApiKeyResponses={...n.customApiKeyResponses,approved:(n.customApiKeyResponses.approved??[]).filter(e=>e!==t),rejected:[...(n.customApiKeyResponses.rejected??[]).filter(e=>e!==t),t]}}return n}),p(N())}}]:[]],U=Y.useMemo(()=>{if(!V)return wt;let e=V.toLowerCase();return wt.filter(t=>t.id.toLowerCase().includes(e)?!0:(`searchText`in t?t.searchText:t.label).toLowerCase().includes(e))},[wt,V]);Y.useEffect(()=>{if(T>=U.length){let e=Math.max(0,U.length-1);we(e),D(Math.max(0,e-A+1));return}D(e=>T<e?T:T>=e+A?T-A+1:e)},[U.length,T,A]);let Tt=(0,X.useCallback)(e=>{D(t=>e<t?e:e>=t+A?e-A+1:t)},[A]),Et=(0,X.useCallback)(()=>{if(z!==null)return;let t=Object.entries(Xe).map(([e,t])=>(F(`tengu_config_changed`,{key:e,value:t}),`Set ${e} to ${w.bold(t)}`)),r=n()?void 0:process.env.ANTHROPIC_API_KEY,i=!!(r&&m.current.customApiKeyResponses?.approved?.includes(Qe(r))),a=!!(r&&f.customApiKeyResponses?.approved?.includes(Qe(r)));if(i!==a&&(t.push(`${a?`Enabled`:`Disabled`} custom API key`),F(`tengu_config_changed`,{key:`env.ANTHROPIC_API_KEY`,value:a})),f.theme!==m.current.theme&&t.push(`Set theme to ${w.bold(f.theme)}`),f.preferredNotifChannel!==m.current.preferredNotifChannel&&t.push(`Set notifications to ${w.bold(f.preferredNotifChannel)}`),_!==me.current&&t.push(`Set output style to ${w.bold(_)}`),v!==C.current&&t.push(`Set response language to ${w.bold(v??`Default (English)`)}`),f.editorMode!==m.current.editorMode&&t.push(`Set editor mode to ${w.bold(f.editorMode||`emacs`)}`),f.diffTool!==m.current.diffTool&&t.push(`Set diff tool to ${w.bold(f.diffTool)}`),f.autoConnectIde!==m.current.autoConnectIde&&t.push(`${f.autoConnectIde?`Enabled`:`Disabled`} auto-connect to IDE`),f.autoInstallIdeExtension!==m.current.autoInstallIdeExtension&&t.push(`${f.autoInstallIdeExtension?`Enabled`:`Disabled`} auto-install IDE extension`),f.autoCompactEnabled!==m.current.autoCompactEnabled&&t.push(`${f.autoCompactEnabled?`Enabled`:`Disabled`} auto-compact`),f.respectGitignore!==m.current.respectGitignore&&t.push(`${f.respectGitignore?`Enabled`:`Disabled`} respect .gitignore in file picker`),f.copyOnSelect!==m.current.copyOnSelect&&t.push(`${f.copyOnSelect?`Enabled`:`Disabled`} copy on select`),f.terminalProgressBarEnabled!==m.current.terminalProgressBarEnabled&&t.push(`${f.terminalProgressBarEnabled?`Enabled`:`Disabled`} terminal progress bar`),f.showStatusInTerminalTab!==m.current.showStatusInTerminalTab&&t.push(`${f.showStatusInTerminalTab?`Enabled`:`Disabled`} terminal tab status`),f.showTurnDuration!==m.current.showTurnDuration&&t.push(`${f.showTurnDuration?`Enabled`:`Disabled`} turn duration`),f.remoteControlAtStartup!==m.current.remoteControlAtStartup){let e=f.remoteControlAtStartup===void 0?`Reset Remote Control to default`:`${f.remoteControlAtStartup?`Enabled`:`Disabled`} Remote Control for all sessions`;t.push(e)}h?.autoUpdatesChannel!==de.current?.autoUpdatesChannel&&t.push(`Set auto-update channel to ${w.bold(h?.autoUpdatesChannel??`latest`)}`),t.length>0?e(t.join(`
2
- `)):e(`Config dialog dismissed`,{display:`system`})},[z,Xe,f,M,_,v,h?.autoUpdatesChannel,Ye()?h?.fastMode:void 0,e]),Dt=(0,X.useCallback)(()=>{d!==it.current&&l(it.current),P(()=>m.current);let e=nt;j(`localSettings`,{spinnerTipsEnabled:e?.spinnerTipsEnabled,prefersReducedMotion:e?.prefersReducedMotion,defaultView:e?.defaultView,outputStyle:e?.outputStyle});let t=rt;j(`userSettings`,{alwaysThinkingEnabled:t?.alwaysThinkingEnabled,fastMode:t?.fastMode,promptSuggestionEnabled:t?.promptSuggestionEnabled,autoUpdatesChannel:t?.autoUpdatesChannel,minimumVersion:t?.minimumVersion,language:t?.language,syntaxHighlightingDisabled:t?.syntaxHighlightingDisabled,permissions:t?.permissions===void 0?void 0:{...t.permissions,defaultMode:t.permissions.defaultMode}});let n=ot;I(e=>({...e,mainLoopModel:n.mainLoopModel,mainLoopModelForSession:n.mainLoopModelForSession,verbose:n.verbose,thinkingEnabled:n.thinkingEnabled,fastMode:n.fastMode,promptSuggestionEnabled:n.promptSuggestionEnabled,replBridgeEnabled:n.replBridgeEnabled,replBridgeOutboundOnly:n.replBridgeOutboundOnly,settings:n.settings,toolPermissionContext:ue(e.toolPermissionContext)}))},[d,l,nt,rt,ot,I]);be(`confirm:no`,(0,X.useCallback)(()=>{z===null&&(R.current&&Dt(),e(`Config dialog dismissed`,{display:`system`}))},[z,Dt,e]),{context:`Settings`,isActive:z===null&&!O&&!c}),be(`settings:close`,Et,{context:`Settings`,isActive:z===null&&!O&&!c});let W=(0,X.useCallback)(()=>{let e=U[T];if(e?.onChange){if(e.type===`boolean`){R.current=!0,e.onChange(!e.value),e.id===`thinkingEnabled`&&(!e.value===tt.current?ct(!1):t.messages.some(e=>e.type===`assistant`)&&ct(!0));return}if(e.id===`theme`||e.id===`model`||e.id===`showExternalIncludesDialog`||e.id===`outputStyle`||e.id===`language`)switch(e.id){case`theme`:B(`Theme`),i(!0);return;case`model`:B(`Model`),i(!0);return;case`showExternalIncludesDialog`:B(`ExternalIncludes`),i(!0);return;case`outputStyle`:B(`OutputStyle`),i(!0);return;case`language`:B(`Language`),i(!0);return}if(e.id===`autoUpdatesChannel`){if(H){B(`EnableAutoUpdates`),i(!0);return}(h?.autoUpdatesChannel??`latest`)===`latest`?(B(`ChannelDowngrade`),i(!0)):(R.current=!0,j(`userSettings`,{autoUpdatesChannel:`latest`,minimumVersion:void 0}),g(e=>({...e,autoUpdatesChannel:`latest`,minimumVersion:void 0})),F(`tengu_autoupdate_channel_changed`,{channel:`latest`}));return}if(e.type===`enum`){R.current=!0;let t=(e.options.indexOf(e.value)+1)%e.options.length;e.onChange(e.options[t]);return}}},[H,U,T,h?.autoUpdatesChannel,i]),G=e=>{ct(!1);let t=Math.max(0,Math.min(U.length-1,T+e));we(t),Tt(t)};return _e({"select:previous":()=>{T===0?(ct(!1),k(!0),D(0)):G(-1)},"select:next":()=>G(1),"scroll:lineUp":()=>G(-1),"scroll:lineDown":()=>G(1),"select:accept":W,"select:previousValue":()=>W(),"select:nextValue":()=>W(),"settings:search":()=>{k(!0),lt(``)}},{context:`Settings`,isActive:z===null&&!O&&!c}),(0,Z.jsx)(b,{flexDirection:`column`,width:`100%`,tabIndex:0,autoFocus:!0,onKeyDown:(0,X.useCallback)(e=>{if(z===null&&!c){if(O){if(e.key===`escape`){e.preventDefault(),V.length>0?lt(``):k(!1);return}(e.key===`return`||e.key===`down`||e.key===`wheeldown`)&&(e.preventDefault(),k(!1),we(0),D(0));return}if(e.key===`left`||e.key===`right`||e.key===`tab`){e.preventDefault(),W();return}e.ctrl||e.meta||e.key===`j`||e.key===`k`||e.key===`/`||e.key.length===1&&e.key!==` `&&(e.preventDefault(),k(!0),lt(e.key))}},[z,c,O,V,lt,W]),children:z===`Theme`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(mt,{onThemeSelect:e=>{R.current=!0,l(e),B(null),i(!1)},onCancel:()=>{B(null),i(!1)},hideEscToCancel:!0,skipExitHandling:!0}),(0,Z.jsx)(b,{children:(0,Z.jsx)(x,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`select`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]}):z===`Model`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_t,{initial:M,onSelect:e=>{R.current=!0,St(e),B(null),i(!1)},onCancel:()=>{B(null),i(!1)},showFastModeNotice:Ye()?He&&Ke(M)&&Je():!1}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`ExternalIncludes`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(bt,{onDone:()=>{B(null),i(!1)},externalIncludes:re(vt)}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`disable external includes`})]})})]}):z===`OutputStyle`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Nt,{initialStyle:_,onComplete:e=>{R.current=!0,pe(e??`default`),B(null),i(!1),j(`localSettings`,{outputStyle:e}),F(`tengu_output_style_changed`,{style:e??`default`,source:`config_panel`,settings_source:`localSettings`})},onCancel:()=>{B(null),i(!1)}}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`Language`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Rt,{initialLanguage:v,onComplete:e=>{R.current=!0,he(e),B(null),i(!1),j(`userSettings`,{language:e}),F(`tengu_language_changed`,{language:e??`default`,source:`config_panel`})},onCancel:()=>{B(null),i(!1)}}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]}):z===`EnableAutoUpdates`?(0,Z.jsx)(Ee,{title:`Enable Auto-Updates`,onCancel:()=>{B(null),i(!1)},hideBorder:!0,hideInputGuide:!0,children:H?.type===`config`?(0,Z.jsx)(oe,{options:[{label:`Enable with latest channel`,value:`latest`},{label:`Enable with stable channel`,value:`stable`}],onChange:e=>{R.current=!0,B(null),i(!1),P(e=>({...e,autoUpdates:!0})),p({...N(),autoUpdates:!0}),j(`userSettings`,{autoUpdatesChannel:e,minimumVersion:void 0}),g(t=>({...t,autoUpdatesChannel:e,minimumVersion:void 0})),F(`tengu_autoupdate_enabled`,{channel:e})}}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{children:H?.type===`env`?`Auto-updates are controlled by an environment variable and cannot be changed here.`:`Auto-updates are disabled in development builds.`}),H?.type===`env`&&(0,Z.jsxs)(x,{dimColor:!0,children:[`Unset `,H.envVar,` to re-enable auto-updates.`]})]})}):z===`ChannelDowngrade`?(0,Z.jsx)(kt,{currentVersion:`0.0.19`,onChoice:e=>{if(B(null),i(!1),e===`cancel`)return;R.current=!0;let t={autoUpdatesChannel:`stable`};e===`stay`&&(t.minimumVersion=`0.0.19`),j(`userSettings`,t),g(e=>({...e,...t})),F(`tengu_autoupdate_channel_changed`,{channel:`stable`,minimum_version_set:e===`stay`})}}):(0,Z.jsxs)(b,{flexDirection:`column`,gap:1,marginY:se?void 0:1,children:[(0,Z.jsx)(Ce,{query:V,isFocused:O&&!c,isTerminalFocused:De,cursorOffset:ut,placeholder:`Search settings…`}),(0,Z.jsx)(b,{flexDirection:`column`,children:U.length===0?(0,Z.jsxs)(x,{dimColor:!0,italic:!0,children:[`No settings match "`,V,`"`]}):(0,Z.jsxs)(Z.Fragment,{children:[E>0&&(0,Z.jsxs)(x,{dimColor:!0,children:[o.arrowUp,` `,E,` more above`]}),U.slice(E,E+A).map((e,t)=>{let n=E+t===T&&!c&&!O;return(0,Z.jsx)(Y.Fragment,{children:(0,Z.jsxs)(b,{width:`100%`,children:[(0,Z.jsx)(b,{width:44,children:(0,Z.jsxs)(x,{color:n?`suggestion`:void 0,children:[n?o.pointer:` `,` `,e.label]})}),(0,Z.jsx)(b,{flexGrow:1,children:e.type===`boolean`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:e.value.toString()}),st&&e.id===`thinkingEnabled`&&(0,Z.jsxs)(x,{color:`warning`,children:[` `,`Changing thinking mode mid-conversation will increase latency and may reduce quality.`]})]}):e.id===`theme`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:Ut[e.value.toString()]??e.value.toString()}):e.id===`notifChannel`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:(0,Z.jsx)(Ht,{value:e.value.toString()})}):e.id===`defaultPermissionMode`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:Ae(e.value)}):e.id===`autoUpdatesChannel`&&H?(0,Z.jsxs)(b,{flexDirection:`column`,children:[(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:`disabled`}),(0,Z.jsxs)(x,{dimColor:!0,children:[`(`,Be(H),`)`]})]}):(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:e.value.toString()})})]})},e.id)}),E+A<U.length&&(0,Z.jsxs)(x,{dimColor:!0,children:[o.arrowDown,` `,U.length-E-A,` more below`]})]})}),c?(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`←/→ tab`,action:`switch`}),(0,Z.jsx)(y,{shortcut:`↓`,action:`return`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`close`})]})}):O?(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(x,{children:`Type to filter`}),(0,Z.jsx)(y,{shortcut:`Enter/↓`,action:`select`}),(0,Z.jsx)(y,{shortcut:`↑`,action:`tabs`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`clear`})]})}):(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(s,{action:`select:accept`,context:`Settings`,fallback:`Space`,description:`change`}),(0,Z.jsx)(s,{action:`settings:close`,context:`Settings`,fallback:`Enter`,description:`save`}),(0,Z.jsx)(s,{action:`settings:search`,context:`Settings`,fallback:`/`,description:`search`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]})})}function Ht({value:e}){switch(e){case`auto`:return`Auto`;case`iterm2`:return(0,Z.jsxs)(x,{children:[`iTerm2 `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 9)`})]});case`terminal_bell`:return(0,Z.jsxs)(x,{children:[`Terminal Bell `,(0,Z.jsx)(x,{dimColor:!0,children:`(\\a)`})]});case`kitty`:return(0,Z.jsxs)(x,{children:[`Kitty `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 99)`})]});case`ghostty`:return(0,Z.jsxs)(x,{children:[`Ghostty `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 777)`})]});case`iterm2_with_bell`:return`iTerm2 w/ Bell`;case`notifications_disabled`:return`Disabled`;default:return e}}var Y,X,Z,Ut,Wt=e((()=>{D(),Y=t(C(),1),X=t(C(),1),he(),a(),ze(),L(),T(),Pe(),f(),He(),We(),pt(),l(),ht(),Xe(),vt(),yt(),jt(),d(),Lt(),Bt(),c(),ie(),dt(),H(),me(),M(),_(),i(),St(),g(),I(),se(),Z=k(),Ut={auto:`Auto (match terminal)`,dark:`Dark mode`,light:`Light mode`,"dark-daltonized":`Dark mode (colorblind-friendly)`,"light-daltonized":`Light mode (colorblind-friendly)`,"dark-ansi":`Dark mode (ANSI colors only)`,"light-ansi":`Light mode (ANSI colors only)`}}));function Gt({onClose:e,context:t,defaultTab:n}){let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(!1),[ee,te]=(0,Q.useState)(!1),s=ft(),{rows:ne}=ut(Te()),re=s?ne+1:Math.max(15,Math.min(Math.floor(ne*.8),30)),[c]=(0,Q.useState)(()=>U().catch(()=>[]));return V(),be(`confirm:no`,()=>{a||e(`Status dialog dismissed`,{display:`system`})},{context:`Settings`,isActive:!a&&!(r===`Config`&&ee)}),(0,$.jsx)(O,{color:`permission`,children:(0,$.jsx)(E,{color:`permission`,selectedTab:r,onTabChange:i,hidden:a,initialHeaderFocused:n!==`Config`,contentHeight:a||s?void 0:re,children:[(0,$.jsx)(we,{title:`Status`,children:(0,$.jsx)(Et,{context:t,diagnosticsPromise:c})},`status`),(0,$.jsx)(we,{title:`Config`,children:(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(Vt,{context:t,onClose:e,setTabsHidden:o,onIsSearchModeChange:te,contentHeight:re})})},`config`)]})})}var Q,$,Kt=e((()=>{Q=t(C(),1),he(),lt(),g(),dt(),D(),Ot(),Wt(),$=k()}));export{Kt as n,Gt as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{d as n,l as r,o as i}from"./envUtils-DcaKZlRU.js";import{n as a,t as o}from"./figures-5ThXQEtq.js";import{$h as ee,$u as te,Dp as s,Gy as ne,Hy as re,Ky as c,Op as ie,Qh as ae,Qu as oe,Uh as se,Wh as ce,Wy as le,Xh as l,Zh as u,Zu as d,b as f,br as p,cd as m,eo as h,gC as g,j as ue,ld as de,no as _,ob as fe,rr as pe,sb as me,to as v,uC as he,ub as ge}from"./loadAgentsDir-DaNpxaO-.js";import{D as y,Gt as _e,H as ve,I as b,P as x,T as S,U as ye,Wt as be,Xn as xe,a as Se,ai as C,di as w,fi as T,k as Ce,n as we,ot as Te,r as E,t as D,x as O,y as Ee}from"./src-DL3w8VPk2.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as De,ft as Oe}from"./state-D5D6QpTX.js";import{n as ke,t as A}from"./cwd-Nh5IZNKO.js";import{Ft as Ae,Nt as je,Pt as Me,Rt as Ne,b as j,h as M,jt as Pe,s as Fe,t as Ie,zt as Le}from"./settings-3xZ0fsvE.js";import{a as Re,c as N,h as ze,i as Be,o as Ve,y as P}from"./config-DRy1I12M.js";import{o as He,s as Ue}from"./log-CZ7ploQm.js";import{n as We,r as F}from"./analytics-DJobLaWP.js";import{B as Ge,J as I,Q as Ke,V as qe,Y as Je,Z as Ye,_ as Xe,b as Ze,hr as Qe,mr as L,x as $e,z as et}from"./model-Do0f476p.js";import{a as tt,c as nt,d as rt,i as it,l as at,n as ot,o as R,r as st,s as ct,t as z,u as B}from"./status-CFrLuGbf.js";import{n as V,t as lt}from"./useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js";import{i as ut,n as dt,r as ft}from"./modalContext-wY9CeN4G.js";import{n as pt,t as mt}from"./ThemePicker-iD9ufy99.js";import{i as ht,n as gt,r as _t,t as vt}from"./extraUsage-CkTon7ib.js";import{n as yt,t as bt}from"./AgentsMdExternalIncludesDialog-CMEGV4Md.js";import{t as H}from"./SearchBox-CwwV0W-w.js";import{n as xt,t as St}from"./useSearchInput-QL_VtdJD.js";function Ct(){let e=Oe();return[{label:`Version`,value:`0.0.20`},{label:`Session name`,value:pe(e)??(0,K.jsx)(x,{dimColor:!0,children:`/rename to add a name`})},{label:`Session ID`,value:e},{label:`cwd`,value:A()},...ot(),...z()]}function wt({mainLoopModel:e,mcp:t,theme:n,context:r}){return[{label:`Model`,value:B(e)},...st(t.clients,r.options.ideInstallationStatus,n),...R(t.clients,n),...nt(),...at()]}async function U(){return[...await it(),...await tt(),...await ct()]}function Tt({value:e}){return Array.isArray(e)?(0,K.jsx)(b,{flexWrap:`wrap`,columnGap:1,flexShrink:99,children:e.map((t,n)=>(0,K.jsxs)(x,{children:[t,n<e.length-1?`,`:``]},n))}):typeof e==`string`?(0,K.jsx)(x,{children:e}):e}function Et({context:e,diagnosticsPromise:t}){let n=u(e=>e.mainLoopModel),r=u(e=>e.mcp),[i]=ve(),a=W.useMemo(()=>[Ct(),wt({mainLoopModel:n,mcp:r,theme:i,context:e})],[n,r,i,e]),o=ft()?1:void 0;return(0,K.jsxs)(b,{flexDirection:`column`,flexGrow:o,children:[(0,K.jsxs)(b,{flexDirection:`column`,gap:1,flexGrow:o,children:[a.map((e,t)=>e.length>0&&(0,K.jsx)(b,{flexDirection:`column`,children:e.map(({label:e,value:t},n)=>(0,K.jsxs)(b,{flexDirection:`row`,gap:1,flexShrink:0,children:[e!==void 0&&(0,K.jsxs)(x,{bold:!0,children:[e,`:`]}),(0,K.jsx)(Tt,{value:t})]},n))},t)),(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Dt,{promise:t})})]}),(0,K.jsx)(x,{dimColor:!0,children:(0,K.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})})]})}function Dt({promise:e}){let t=(0,G.use)(e);return t.length===0?null:(0,K.jsxs)(b,{flexDirection:`column`,paddingBottom:1,children:[(0,K.jsx)(x,{bold:!0,children:`System Diagnostics`}),t.map((e,t)=>(0,K.jsxs)(b,{flexDirection:`row`,gap:1,paddingX:1,children:[(0,K.jsx)(x,{color:`error`,children:o.warning}),typeof e==`string`?(0,K.jsx)(x,{wrap:`wrap`,children:e}):e]},t))]})}var W,G,K,Ot=e((()=>{a(),W=t(C(),1),G=t(C(),1),De(),dt(),D(),l(),ke(),p(),rt(),ie(),K=k()}));function kt({currentVersion:e,onChoice:t}){function n(e){t(e)}function r(){t(`cancel`)}return(0,At.jsxs)(Ee,{title:`Switch to Stable Channel`,onCancel:r,color:`permission`,hideBorder:!0,hideInputGuide:!0,children:[(0,At.jsxs)(x,{children:[`The stable channel may have an older version than what you're currently running (`,e,`).`]}),(0,At.jsx)(x,{dimColor:!0,children:`How would you like to handle this?`}),(0,At.jsx)(oe,{options:[{label:`Allow possible downgrade to stable version`,value:`downgrade`},{label:`Stay on current version (${e}) until stable catches up`,value:`stay`}],onChange:n})]})}var At,jt=e((()=>{D(),d(),At=k()}));function Mt(e){return Object.entries(e).map(([e,t])=>({label:t?.name??Ft,value:e,description:t?.description??It}))}function Nt({initialStyle:e,onComplete:t,onCancel:n,isStandaloneCommand:r}){let[i,a]=(0,Pt.useState)([]),[o,ee]=(0,Pt.useState)(!0);(0,Pt.useEffect)(()=>{v(A()).then(e=>{let t=Mt(e);a(t),ee(!1)}).catch(()=>{let e=Mt(h);a(e),ee(!1)})},[]);let te=(0,Pt.useCallback)(e=>{t(e)},[t]);return(0,q.jsx)(Ee,{title:`Preferred output style`,onCancel:n,hideInputGuide:!r,hideBorder:!r,children:(0,q.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,q.jsx)(b,{marginTop:1,children:(0,q.jsx)(x,{dimColor:!0,children:`This changes how Work Mate communicates with you`})}),o?(0,q.jsx)(x,{dimColor:!0,children:`Loading output styles…`}):(0,q.jsx)(oe,{options:i,onChange:te,visibleOptionCount:10,defaultValue:e})]})})}var Pt,q,Ft,It,Lt=e((()=>{Pt=t(C(),1),_(),D(),ke(),te(),q=k(),Ft=`Default`,It=`Work Mate completes coding tasks efficiently and provides concise responses`}));function Rt({initialLanguage:e,onComplete:t,onCancel:n}){let[r,i]=(0,zt.useState)(e),[a,ee]=(0,zt.useState)((e??``).length);be(`confirm:no`,n,{context:`Settings`});function te(){let e=r?.trim();t(e||void 0)}return(0,J.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(x,{children:`Enter your preferred response and voice language:`}),(0,J.jsxs)(b,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(x,{children:o.pointer}),(0,J.jsx)(m,{value:r??``,onChange:i,onSubmit:te,focus:!0,showCursor:!0,placeholder:`e.g., Japanese, 日本語, Español${o.ellipsis}`,columns:60,cursorOffset:a,onChangeCursorOffset:ee})]}),(0,J.jsx)(x,{dimColor:!0,children:`Leave empty for default (English)`})]})}var zt,J,Bt=e((()=>{a(),zt=t(C(),1),D(),he(),de(),J=k()}));function Vt({onClose:e,context:t,setTabsHidden:i,onIsSearchModeChange:a,contentHeight:te}){let{headerFocused:c,focusHeader:ie}=Se(),se=ft(),[,l]=ve(),d=ye(),[f,p]=(0,X.useState)(N()),m=Y.useRef(N()),[h,g]=(0,X.useState)(Ie()),de=Y.useRef(Ie()),[_,pe]=(0,X.useState)(h?.outputStyle||`default`),me=Y.useRef(_),[v,he]=(0,X.useState)(h?.language),C=Y.useRef(v),[T,we]=(0,X.useState)(0),[E,D]=(0,X.useState)(0),[O,k]=(0,X.useState)(!1),De=xe(),{rows:Oe}=Te(),ke=te??Math.min(Math.floor(Oe*.8),30),A=Math.max(5,ke-10),M=u(e=>e.mainLoopModel),Pe=u(e=>e.verbose),ze=u(e=>e.thinkingEnabled),He=u(e=>Ye()?e.fastMode:!1);u(e=>e.promptSuggestionEnabled);let We=Me(h?.permissions?.defaultMode??`default`),I=ee(),[Xe,L]=(0,X.useState)({}),tt=Y.useRef(ze),[nt]=(0,X.useState)(()=>Fe(`localSettings`)),[rt]=(0,X.useState)(()=>Fe(`userSettings`)),it=Y.useRef(d),at=ae(),[ot]=(0,X.useState)(()=>{let e=at.getState();return{mainLoopModel:e.mainLoopModel,mainLoopModelForSession:e.mainLoopModelForSession,verbose:e.verbose,thinkingEnabled:e.thinkingEnabled,fastMode:e.fastMode,promptSuggestionEnabled:e.promptSuggestionEnabled,replBridgeEnabled:e.replBridgeEnabled,replBridgeOutboundOnly:e.replBridgeOutboundOnly,settings:e.settings}}),R=Y.useRef(!1),[st,ct]=(0,X.useState)(!1),[z,B]=(0,X.useState)(null),{query:V,setQuery:lt,cursorOffset:ut}=xt({isActive:O&&z===null&&!c,onExit:()=>k(!1),onExitUp:ie,passthroughCtrlKeys:[`c`,`d`]}),dt=O&&!c;Y.useEffect(()=>{a?.(dt)},[dt,a]);let pt=fe(t.options.mcpClients),ht=!r(process.env.CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING),vt=Y.use(le(!0)),yt=ne(vt),H=Re();function St(e){F(`tengu_config_model_changed`,{from_model:M,to_model:e}),I(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null})),L(t=>{let n=$e(e)+(gt(e,!1,Ze())?` · Billed as extra usage`:``);if(`model`in t){let{model:e,...r}=t;return{...r,model:n}}return{...t,model:n}})}function Ct(e){P(t=>({...t,verbose:e})),p({...N(),verbose:e}),I(t=>({...t,verbose:e})),L(t=>{if(`verbose`in t){let{verbose:e,...n}=t;return n}return{...t,verbose:e}})}let wt=[{id:`autoCompactEnabled`,label:`Auto-compact`,value:f.autoCompactEnabled,type:`boolean`,onChange(e){P(t=>({...t,autoCompactEnabled:e})),p({...N(),autoCompactEnabled:e}),F(`tengu_auto_compact_setting_changed`,{enabled:e})}},{id:`spinnerTipsEnabled`,label:`Show tips`,value:h?.spinnerTipsEnabled??!0,type:`boolean`,onChange(e){j(`localSettings`,{spinnerTipsEnabled:e}),g(t=>({...t,spinnerTipsEnabled:e})),F(`tengu_tips_setting_changed`,{enabled:e})}},{id:`cacheWarningEnabled`,label:`Cache warnings`,value:h?.cacheWarningEnabled??!0,type:`boolean`,onChange(e){j(`localSettings`,{cacheWarningEnabled:e}),g(t=>({...t,cacheWarningEnabled:e})),F(`tengu_cache_warning_setting_changed`,{enabled:e})}},{id:`prefersReducedMotion`,label:`Reduce motion`,value:h?.prefersReducedMotion??!1,type:`boolean`,onChange(e){j(`localSettings`,{prefersReducedMotion:e}),g(t=>({...t,prefersReducedMotion:e})),I(t=>({...t,settings:{...t.settings,prefersReducedMotion:e}})),F(`tengu_reduce_motion_setting_changed`,{enabled:e})}},{id:`thinkingEnabled`,label:`Thinking mode`,value:ze??!0,type:`boolean`,onChange(e){I(t=>({...t,thinkingEnabled:e})),j(`userSettings`,{alwaysThinkingEnabled:e?void 0:!1}),F(`tengu_thinking_toggled`,{enabled:e})}},...Ye()&&Je()?[{id:`fastMode`,label:`Fast mode (${et} only)`,value:!!He,type:`boolean`,onChange(e){Ge(),j(`userSettings`,{fastMode:e?!0:void 0}),e?(I(e=>({...e,mainLoopModel:qe(),mainLoopModelForSession:null,fastMode:!0})),L(e=>({...e,model:qe(),"Fast mode":`ON`}))):(I(e=>({...e,fastMode:!1})),L(e=>({...e,"Fast mode":`OFF`})))}}]:[],...ht?[{id:`fileCheckpointingEnabled`,label:`Rewind code (checkpoints)`,value:f.fileCheckpointingEnabled,type:`boolean`,onChange(e){P(t=>({...t,fileCheckpointingEnabled:e})),p({...N(),fileCheckpointingEnabled:e}),F(`tengu_file_history_snapshots_setting_changed`,{enabled:e})}}]:[],{id:`verbose`,label:`Verbose output`,value:Pe,type:`boolean`,onChange:Ct},{id:`terminalProgressBarEnabled`,label:`Terminal progress bar`,value:f.terminalProgressBarEnabled,type:`boolean`,onChange(e){P(t=>({...t,terminalProgressBarEnabled:e})),p({...N(),terminalProgressBarEnabled:e}),F(`tengu_terminal_progress_bar_setting_changed`,{enabled:e})}},{id:`showTurnDuration`,label:`Show turn duration`,value:f.showTurnDuration,type:`boolean`,onChange(e){P(t=>({...t,showTurnDuration:e})),p({...N(),showTurnDuration:e}),F(`tengu_show_turn_duration_setting_changed`,{enabled:e})}},{id:`defaultPermissionMode`,label:`Default permission mode`,value:We,options:(()=>{let e=[`default`,`plan`];return[...e,...Le.filter(t=>!e.includes(t))]})(),type:`enum`,onChange(e){let t=Me(e),n=t===`auto`?t:je(t)?Ne(t):t,r=j(`userSettings`,{permissions:{...h?.permissions,defaultMode:n}});if(r.error){Ue(r.error);return}g(e=>({...e,permissions:{...e?.permissions,defaultMode:n}})),L(t=>({...t,defaultPermissionMode:e})),F(`tengu_config_changed`,{setting:`defaultPermissionMode`,value:e})}},{id:`respectGitignore`,label:`Respect .gitignore in file picker`,value:f.respectGitignore,type:`boolean`,onChange(e){P(t=>({...t,respectGitignore:e})),p({...N(),respectGitignore:e}),F(`tengu_respect_gitignore_setting_changed`,{enabled:e})}},...ce()?[{id:`copyOnSelect`,label:`Copy on select`,value:f.copyOnSelect??!0,type:`boolean`,onChange(e){P(t=>({...t,copyOnSelect:e})),p({...N(),copyOnSelect:e}),F(`tengu_config_changed`,{setting:`copyOnSelect`,value:String(e)})}}]:[],H?{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:`disabled`,type:`managedEnum`,onChange(){}}:{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:h?.autoUpdatesChannel??`latest`,type:`managedEnum`,onChange(){}},{id:`theme`,label:`Theme`,value:d,type:`managedEnum`,onChange:l},{id:`notifChannel`,label:`Notifications`,value:f.preferredNotifChannel,options:[`auto`,`iterm2`,`terminal_bell`,`iterm2_with_bell`,`kitty`,`ghostty`,`notifications_disabled`],type:`enum`,onChange(e){P(t=>({...t,preferredNotifChannel:e})),p({...N(),preferredNotifChannel:e})}},{id:`outputStyle`,label:`Output style`,value:_,type:`managedEnum`,onChange:()=>{}},{id:`language`,label:`Language`,value:v??`Default (English)`,type:`managedEnum`,onChange:()=>{}},{id:`editorMode`,label:`Editor mode`,value:f.editorMode===`emacs`?`normal`:f.editorMode||`normal`,options:[`normal`,`vim`],type:`enum`,onChange(e){P(t=>({...t,editorMode:e})),p({...N(),editorMode:e}),F(`tengu_editor_mode_changed`,{mode:e,source:`config_panel`})}},{id:`prStatusFooterEnabled`,label:`Show PR status footer`,value:f.prStatusFooterEnabled??!0,type:`boolean`,onChange(e){P(t=>t.prStatusFooterEnabled===e?t:{...t,prStatusFooterEnabled:e}),p({...N(),prStatusFooterEnabled:e}),F(`tengu_pr_status_footer_setting_changed`,{enabled:e})}},{id:`model`,label:`Model`,value:M===null?`Default (recommended)`:M,type:`managedEnum`,onChange:St},...pt?[{id:`diffTool`,label:`Diff tool`,value:f.diffTool??`auto`,options:[`terminal`,`auto`],type:`enum`,onChange(e){P(t=>({...t,diffTool:e})),p({...N(),diffTool:e}),F(`tengu_diff_tool_changed`,{tool:e,source:`config_panel`})}}]:[],...ge()?[]:[{id:`autoConnectIde`,label:`Auto-connect to IDE (external terminal)`,value:f.autoConnectIde??!1,type:`boolean`,onChange(e){P(t=>({...t,autoConnectIde:e})),p({...N(),autoConnectIde:e}),F(`tengu_auto_connect_ide_changed`,{enabled:e,source:`config_panel`})}}],...ge()?[{id:`autoInstallIdeExtension`,label:`Auto-install IDE extension`,value:f.autoInstallIdeExtension??!0,type:`boolean`,onChange(e){P(t=>({...t,autoInstallIdeExtension:e})),p({...N(),autoInstallIdeExtension:e}),F(`tengu_auto_install_ide_extension_changed`,{enabled:e,source:`config_panel`})}}]:[],...yt?[{id:`showExternalIncludesDialog`,label:`External AGENTS.md includes`,value:Ve().hasAgentsMdExternalIncludesApproved?`true`:`false`,type:`managedEnum`,onChange(){}}]:[],...process.env.ANTHROPIC_API_KEY&&!n()?[{id:`apiKey`,label:(0,Z.jsxs)(x,{children:[`Use custom API key: `,(0,Z.jsx)(x,{bold:!0,children:Qe(process.env.ANTHROPIC_API_KEY)})]}),searchText:`Use custom API key`,value:!!(process.env.ANTHROPIC_API_KEY&&f.customApiKeyResponses?.approved?.includes(Qe(process.env.ANTHROPIC_API_KEY))),type:`boolean`,onChange(e){P(t=>{let n={...t};if(n.customApiKeyResponses||(n.customApiKeyResponses={approved:[],rejected:[]}),n.customApiKeyResponses.approved||(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]}),n.customApiKeyResponses.rejected||(n.customApiKeyResponses={...n.customApiKeyResponses,rejected:[]}),process.env.ANTHROPIC_API_KEY){let t=Qe(process.env.ANTHROPIC_API_KEY);e?n.customApiKeyResponses={...n.customApiKeyResponses,approved:[...(n.customApiKeyResponses.approved??[]).filter(e=>e!==t),t],rejected:(n.customApiKeyResponses.rejected??[]).filter(e=>e!==t)}:n.customApiKeyResponses={...n.customApiKeyResponses,approved:(n.customApiKeyResponses.approved??[]).filter(e=>e!==t),rejected:[...(n.customApiKeyResponses.rejected??[]).filter(e=>e!==t),t]}}return n}),p(N())}}]:[]],U=Y.useMemo(()=>{if(!V)return wt;let e=V.toLowerCase();return wt.filter(t=>t.id.toLowerCase().includes(e)?!0:(`searchText`in t?t.searchText:t.label).toLowerCase().includes(e))},[wt,V]);Y.useEffect(()=>{if(T>=U.length){let e=Math.max(0,U.length-1);we(e),D(Math.max(0,e-A+1));return}D(e=>T<e?T:T>=e+A?T-A+1:e)},[U.length,T,A]);let Tt=(0,X.useCallback)(e=>{D(t=>e<t?e:e>=t+A?e-A+1:t)},[A]),Et=(0,X.useCallback)(()=>{if(z!==null)return;let t=Object.entries(Xe).map(([e,t])=>(F(`tengu_config_changed`,{key:e,value:t}),`Set ${e} to ${w.bold(t)}`)),r=n()?void 0:process.env.ANTHROPIC_API_KEY,i=!!(r&&m.current.customApiKeyResponses?.approved?.includes(Qe(r))),a=!!(r&&f.customApiKeyResponses?.approved?.includes(Qe(r)));if(i!==a&&(t.push(`${a?`Enabled`:`Disabled`} custom API key`),F(`tengu_config_changed`,{key:`env.ANTHROPIC_API_KEY`,value:a})),f.theme!==m.current.theme&&t.push(`Set theme to ${w.bold(f.theme)}`),f.preferredNotifChannel!==m.current.preferredNotifChannel&&t.push(`Set notifications to ${w.bold(f.preferredNotifChannel)}`),_!==me.current&&t.push(`Set output style to ${w.bold(_)}`),v!==C.current&&t.push(`Set response language to ${w.bold(v??`Default (English)`)}`),f.editorMode!==m.current.editorMode&&t.push(`Set editor mode to ${w.bold(f.editorMode||`emacs`)}`),f.diffTool!==m.current.diffTool&&t.push(`Set diff tool to ${w.bold(f.diffTool)}`),f.autoConnectIde!==m.current.autoConnectIde&&t.push(`${f.autoConnectIde?`Enabled`:`Disabled`} auto-connect to IDE`),f.autoInstallIdeExtension!==m.current.autoInstallIdeExtension&&t.push(`${f.autoInstallIdeExtension?`Enabled`:`Disabled`} auto-install IDE extension`),f.autoCompactEnabled!==m.current.autoCompactEnabled&&t.push(`${f.autoCompactEnabled?`Enabled`:`Disabled`} auto-compact`),f.respectGitignore!==m.current.respectGitignore&&t.push(`${f.respectGitignore?`Enabled`:`Disabled`} respect .gitignore in file picker`),f.copyOnSelect!==m.current.copyOnSelect&&t.push(`${f.copyOnSelect?`Enabled`:`Disabled`} copy on select`),f.terminalProgressBarEnabled!==m.current.terminalProgressBarEnabled&&t.push(`${f.terminalProgressBarEnabled?`Enabled`:`Disabled`} terminal progress bar`),f.showStatusInTerminalTab!==m.current.showStatusInTerminalTab&&t.push(`${f.showStatusInTerminalTab?`Enabled`:`Disabled`} terminal tab status`),f.showTurnDuration!==m.current.showTurnDuration&&t.push(`${f.showTurnDuration?`Enabled`:`Disabled`} turn duration`),f.remoteControlAtStartup!==m.current.remoteControlAtStartup){let e=f.remoteControlAtStartup===void 0?`Reset Remote Control to default`:`${f.remoteControlAtStartup?`Enabled`:`Disabled`} Remote Control for all sessions`;t.push(e)}h?.autoUpdatesChannel!==de.current?.autoUpdatesChannel&&t.push(`Set auto-update channel to ${w.bold(h?.autoUpdatesChannel??`latest`)}`),t.length>0?e(t.join(`
2
+ `)):e(`Config dialog dismissed`,{display:`system`})},[z,Xe,f,M,_,v,h?.autoUpdatesChannel,Ye()?h?.fastMode:void 0,e]),Dt=(0,X.useCallback)(()=>{d!==it.current&&l(it.current),P(()=>m.current);let e=nt;j(`localSettings`,{spinnerTipsEnabled:e?.spinnerTipsEnabled,prefersReducedMotion:e?.prefersReducedMotion,defaultView:e?.defaultView,outputStyle:e?.outputStyle});let t=rt;j(`userSettings`,{alwaysThinkingEnabled:t?.alwaysThinkingEnabled,fastMode:t?.fastMode,promptSuggestionEnabled:t?.promptSuggestionEnabled,autoUpdatesChannel:t?.autoUpdatesChannel,minimumVersion:t?.minimumVersion,language:t?.language,syntaxHighlightingDisabled:t?.syntaxHighlightingDisabled,permissions:t?.permissions===void 0?void 0:{...t.permissions,defaultMode:t.permissions.defaultMode}});let n=ot;I(e=>({...e,mainLoopModel:n.mainLoopModel,mainLoopModelForSession:n.mainLoopModelForSession,verbose:n.verbose,thinkingEnabled:n.thinkingEnabled,fastMode:n.fastMode,promptSuggestionEnabled:n.promptSuggestionEnabled,replBridgeEnabled:n.replBridgeEnabled,replBridgeOutboundOnly:n.replBridgeOutboundOnly,settings:n.settings,toolPermissionContext:ue(e.toolPermissionContext)}))},[d,l,nt,rt,ot,I]);be(`confirm:no`,(0,X.useCallback)(()=>{z===null&&(R.current&&Dt(),e(`Config dialog dismissed`,{display:`system`}))},[z,Dt,e]),{context:`Settings`,isActive:z===null&&!O&&!c}),be(`settings:close`,Et,{context:`Settings`,isActive:z===null&&!O&&!c});let W=(0,X.useCallback)(()=>{let e=U[T];if(e?.onChange){if(e.type===`boolean`){R.current=!0,e.onChange(!e.value),e.id===`thinkingEnabled`&&(!e.value===tt.current?ct(!1):t.messages.some(e=>e.type===`assistant`)&&ct(!0));return}if(e.id===`theme`||e.id===`model`||e.id===`showExternalIncludesDialog`||e.id===`outputStyle`||e.id===`language`)switch(e.id){case`theme`:B(`Theme`),i(!0);return;case`model`:B(`Model`),i(!0);return;case`showExternalIncludesDialog`:B(`ExternalIncludes`),i(!0);return;case`outputStyle`:B(`OutputStyle`),i(!0);return;case`language`:B(`Language`),i(!0);return}if(e.id===`autoUpdatesChannel`){if(H){B(`EnableAutoUpdates`),i(!0);return}(h?.autoUpdatesChannel??`latest`)===`latest`?(B(`ChannelDowngrade`),i(!0)):(R.current=!0,j(`userSettings`,{autoUpdatesChannel:`latest`,minimumVersion:void 0}),g(e=>({...e,autoUpdatesChannel:`latest`,minimumVersion:void 0})),F(`tengu_autoupdate_channel_changed`,{channel:`latest`}));return}if(e.type===`enum`){R.current=!0;let t=(e.options.indexOf(e.value)+1)%e.options.length;e.onChange(e.options[t]);return}}},[H,U,T,h?.autoUpdatesChannel,i]),G=e=>{ct(!1);let t=Math.max(0,Math.min(U.length-1,T+e));we(t),Tt(t)};return _e({"select:previous":()=>{T===0?(ct(!1),k(!0),D(0)):G(-1)},"select:next":()=>G(1),"scroll:lineUp":()=>G(-1),"scroll:lineDown":()=>G(1),"select:accept":W,"select:previousValue":()=>W(),"select:nextValue":()=>W(),"settings:search":()=>{k(!0),lt(``)}},{context:`Settings`,isActive:z===null&&!O&&!c}),(0,Z.jsx)(b,{flexDirection:`column`,width:`100%`,tabIndex:0,autoFocus:!0,onKeyDown:(0,X.useCallback)(e=>{if(z===null&&!c){if(O){if(e.key===`escape`){e.preventDefault(),V.length>0?lt(``):k(!1);return}(e.key===`return`||e.key===`down`||e.key===`wheeldown`)&&(e.preventDefault(),k(!1),we(0),D(0));return}if(e.key===`left`||e.key===`right`||e.key===`tab`){e.preventDefault(),W();return}e.ctrl||e.meta||e.key===`j`||e.key===`k`||e.key===`/`||e.key.length===1&&e.key!==` `&&(e.preventDefault(),k(!0),lt(e.key))}},[z,c,O,V,lt,W]),children:z===`Theme`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(mt,{onThemeSelect:e=>{R.current=!0,l(e),B(null),i(!1)},onCancel:()=>{B(null),i(!1)},hideEscToCancel:!0,skipExitHandling:!0}),(0,Z.jsx)(b,{children:(0,Z.jsx)(x,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`select`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]}):z===`Model`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_t,{initial:M,onSelect:e=>{R.current=!0,St(e),B(null),i(!1)},onCancel:()=>{B(null),i(!1)},showFastModeNotice:Ye()?He&&Ke(M)&&Je():!1}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`ExternalIncludes`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(bt,{onDone:()=>{B(null),i(!1)},externalIncludes:re(vt)}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`disable external includes`})]})})]}):z===`OutputStyle`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Nt,{initialStyle:_,onComplete:e=>{R.current=!0,pe(e??`default`),B(null),i(!1),j(`localSettings`,{outputStyle:e}),F(`tengu_output_style_changed`,{style:e??`default`,source:`config_panel`,settings_source:`localSettings`})},onCancel:()=>{B(null),i(!1)}}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`Language`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Rt,{initialLanguage:v,onComplete:e=>{R.current=!0,he(e),B(null),i(!1),j(`userSettings`,{language:e}),F(`tengu_language_changed`,{language:e??`default`,source:`config_panel`})},onCancel:()=>{B(null),i(!1)}}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]}):z===`EnableAutoUpdates`?(0,Z.jsx)(Ee,{title:`Enable Auto-Updates`,onCancel:()=>{B(null),i(!1)},hideBorder:!0,hideInputGuide:!0,children:H?.type===`config`?(0,Z.jsx)(oe,{options:[{label:`Enable with latest channel`,value:`latest`},{label:`Enable with stable channel`,value:`stable`}],onChange:e=>{R.current=!0,B(null),i(!1),P(e=>({...e,autoUpdates:!0})),p({...N(),autoUpdates:!0}),j(`userSettings`,{autoUpdatesChannel:e,minimumVersion:void 0}),g(t=>({...t,autoUpdatesChannel:e,minimumVersion:void 0})),F(`tengu_autoupdate_enabled`,{channel:e})}}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{children:H?.type===`env`?`Auto-updates are controlled by an environment variable and cannot be changed here.`:`Auto-updates are disabled in development builds.`}),H?.type===`env`&&(0,Z.jsxs)(x,{dimColor:!0,children:[`Unset `,H.envVar,` to re-enable auto-updates.`]})]})}):z===`ChannelDowngrade`?(0,Z.jsx)(kt,{currentVersion:`0.0.20`,onChoice:e=>{if(B(null),i(!1),e===`cancel`)return;R.current=!0;let t={autoUpdatesChannel:`stable`};e===`stay`&&(t.minimumVersion=`0.0.20`),j(`userSettings`,t),g(e=>({...e,...t})),F(`tengu_autoupdate_channel_changed`,{channel:`stable`,minimum_version_set:e===`stay`})}}):(0,Z.jsxs)(b,{flexDirection:`column`,gap:1,marginY:se?void 0:1,children:[(0,Z.jsx)(Ce,{query:V,isFocused:O&&!c,isTerminalFocused:De,cursorOffset:ut,placeholder:`Search settings…`}),(0,Z.jsx)(b,{flexDirection:`column`,children:U.length===0?(0,Z.jsxs)(x,{dimColor:!0,italic:!0,children:[`No settings match "`,V,`"`]}):(0,Z.jsxs)(Z.Fragment,{children:[E>0&&(0,Z.jsxs)(x,{dimColor:!0,children:[o.arrowUp,` `,E,` more above`]}),U.slice(E,E+A).map((e,t)=>{let n=E+t===T&&!c&&!O;return(0,Z.jsx)(Y.Fragment,{children:(0,Z.jsxs)(b,{width:`100%`,children:[(0,Z.jsx)(b,{width:44,children:(0,Z.jsxs)(x,{color:n?`suggestion`:void 0,children:[n?o.pointer:` `,` `,e.label]})}),(0,Z.jsx)(b,{flexGrow:1,children:e.type===`boolean`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:e.value.toString()}),st&&e.id===`thinkingEnabled`&&(0,Z.jsxs)(x,{color:`warning`,children:[` `,`Changing thinking mode mid-conversation will increase latency and may reduce quality.`]})]}):e.id===`theme`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:Ut[e.value.toString()]??e.value.toString()}):e.id===`notifChannel`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:(0,Z.jsx)(Ht,{value:e.value.toString()})}):e.id===`defaultPermissionMode`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:Ae(e.value)}):e.id===`autoUpdatesChannel`&&H?(0,Z.jsxs)(b,{flexDirection:`column`,children:[(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:`disabled`}),(0,Z.jsxs)(x,{dimColor:!0,children:[`(`,Be(H),`)`]})]}):(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:e.value.toString()})})]})},e.id)}),E+A<U.length&&(0,Z.jsxs)(x,{dimColor:!0,children:[o.arrowDown,` `,U.length-E-A,` more below`]})]})}),c?(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`←/→ tab`,action:`switch`}),(0,Z.jsx)(y,{shortcut:`↓`,action:`return`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`close`})]})}):O?(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(x,{children:`Type to filter`}),(0,Z.jsx)(y,{shortcut:`Enter/↓`,action:`select`}),(0,Z.jsx)(y,{shortcut:`↑`,action:`tabs`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`clear`})]})}):(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(s,{action:`select:accept`,context:`Settings`,fallback:`Space`,description:`change`}),(0,Z.jsx)(s,{action:`settings:close`,context:`Settings`,fallback:`Enter`,description:`save`}),(0,Z.jsx)(s,{action:`settings:search`,context:`Settings`,fallback:`/`,description:`search`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]})})}function Ht({value:e}){switch(e){case`auto`:return`Auto`;case`iterm2`:return(0,Z.jsxs)(x,{children:[`iTerm2 `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 9)`})]});case`terminal_bell`:return(0,Z.jsxs)(x,{children:[`Terminal Bell `,(0,Z.jsx)(x,{dimColor:!0,children:`(\\a)`})]});case`kitty`:return(0,Z.jsxs)(x,{children:[`Kitty `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 99)`})]});case`ghostty`:return(0,Z.jsxs)(x,{children:[`Ghostty `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 777)`})]});case`iterm2_with_bell`:return`iTerm2 w/ Bell`;case`notifications_disabled`:return`Disabled`;default:return e}}var Y,X,Z,Ut,Wt=e((()=>{D(),Y=t(C(),1),X=t(C(),1),he(),a(),ze(),L(),T(),Pe(),f(),He(),We(),pt(),l(),ht(),Xe(),vt(),yt(),jt(),d(),Lt(),Bt(),c(),ie(),dt(),H(),me(),M(),_(),i(),St(),g(),I(),se(),Z=k(),Ut={auto:`Auto (match terminal)`,dark:`Dark mode`,light:`Light mode`,"dark-daltonized":`Dark mode (colorblind-friendly)`,"light-daltonized":`Light mode (colorblind-friendly)`,"dark-ansi":`Dark mode (ANSI colors only)`,"light-ansi":`Light mode (ANSI colors only)`}}));function Gt({onClose:e,context:t,defaultTab:n}){let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(!1),[ee,te]=(0,Q.useState)(!1),s=ft(),{rows:ne}=ut(Te()),re=s?ne+1:Math.max(15,Math.min(Math.floor(ne*.8),30)),[c]=(0,Q.useState)(()=>U().catch(()=>[]));return V(),be(`confirm:no`,()=>{a||e(`Status dialog dismissed`,{display:`system`})},{context:`Settings`,isActive:!a&&!(r===`Config`&&ee)}),(0,$.jsx)(O,{color:`permission`,children:(0,$.jsx)(E,{color:`permission`,selectedTab:r,onTabChange:i,hidden:a,initialHeaderFocused:n!==`Config`,contentHeight:a||s?void 0:re,children:[(0,$.jsx)(we,{title:`Status`,children:(0,$.jsx)(Et,{context:t,diagnosticsPromise:c})},`status`),(0,$.jsx)(we,{title:`Config`,children:(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(Vt,{context:t,onClose:e,setTabsHidden:o,onIsSearchModeChange:te,contentHeight:re})})},`config`)]})})}var Q,$,Kt=e((()=>{Q=t(C(),1),he(),lt(),g(),dt(),D(),Ot(),Wt(),$=k()}));export{Kt as n,Gt as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{Xh as r,Yh as i,cu as a,du as o,lu as s,pu as c}from"./loadAgentsDir-DXOkUcW3.js";import{I as l,P as u,ai as d,mt as f,t as p}from"./src-DL3w8VPk2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";t();var h=e(d(),1);p(),r(),s();var g=m(),_=[`◐`,`◓`,`◑`,`◒`],v=[{key:`validating`,label:`Validating session`},{key:`fetching_logs`,label:`Fetching session logs`},{key:`fetching_branch`,label:`Getting branch info`},{key:`checking_out`,label:`Checking out branch`}];function y({currentStep:e,sessionId:t}){let[r,i]=f(100),a=Math.floor(i/100)%_.length,o=v.findIndex(t=>t.key===e);return(0,g.jsxs)(l,{ref:r,flexDirection:`column`,paddingX:1,paddingY:1,children:[(0,g.jsx)(l,{marginBottom:1,children:(0,g.jsxs)(u,{bold:!0,color:`claude`,children:[_[a],` Teleporting session…`]})}),t&&(0,g.jsx)(l,{marginBottom:1,children:(0,g.jsx)(u,{dimColor:!0,children:t})}),(0,g.jsx)(l,{flexDirection:`column`,marginLeft:2,children:v.map((e,t)=>{let r=t<o,i=t===o,s=t>o,c,d;return r?(c=n.tick,d=`green`):i?(c=_[a],d=`claude`):(c=n.circle,d=void 0),(0,g.jsxs)(l,{flexDirection:`row`,children:[(0,g.jsx)(l,{width:2,children:(0,g.jsx)(u,{color:d,dimColor:s,children:c})}),(0,g.jsx)(u,{dimColor:s,bold:i,children:e.label})]},e.key)})})]})}async function b(e,t){let n=()=>{};function r(){let[e,r]=(0,h.useState)(`validating`);return n=r,(0,g.jsx)(y,{currentStep:e,sessionId:t})}e.render((0,g.jsx)(i,{children:(0,g.jsx)(r,{})}));let s=await c(t,n);n(`checking_out`);let{branchName:l,branchError:u}=await a(s.branch);return{messages:o(s.log,u),branchName:l}}export{b as teleportWithProgress};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{Xh as r,Yh as i,cu as a,du as o,lu as s,pu as c}from"./loadAgentsDir-DaNpxaO-.js";import{I as l,P as u,ai as d,mt as f,t as p}from"./src-DL3w8VPk2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";t();var h=e(d(),1);p(),r(),s();var g=m(),_=[`◐`,`◓`,`◑`,`◒`],v=[{key:`validating`,label:`Validating session`},{key:`fetching_logs`,label:`Fetching session logs`},{key:`fetching_branch`,label:`Getting branch info`},{key:`checking_out`,label:`Checking out branch`}];function y({currentStep:e,sessionId:t}){let[r,i]=f(100),a=Math.floor(i/100)%_.length,o=v.findIndex(t=>t.key===e);return(0,g.jsxs)(l,{ref:r,flexDirection:`column`,paddingX:1,paddingY:1,children:[(0,g.jsx)(l,{marginBottom:1,children:(0,g.jsxs)(u,{bold:!0,color:`claude`,children:[_[a],` Teleporting session…`]})}),t&&(0,g.jsx)(l,{marginBottom:1,children:(0,g.jsx)(u,{dimColor:!0,children:t})}),(0,g.jsx)(l,{flexDirection:`column`,marginLeft:2,children:v.map((e,t)=>{let r=t<o,i=t===o,s=t>o,c,d;return r?(c=n.tick,d=`green`):i?(c=_[a],d=`claude`):(c=n.circle,d=void 0),(0,g.jsxs)(l,{flexDirection:`row`,children:[(0,g.jsx)(l,{width:2,children:(0,g.jsx)(u,{color:d,dimColor:s,children:c})}),(0,g.jsx)(u,{dimColor:s,bold:i,children:e.label})]},e.key)})})]})}async function b(e,t){let n=()=>{};function r(){let[e,r]=(0,h.useState)(`validating`);return n=r,(0,g.jsx)(y,{currentStep:e,sessionId:t})}e.render((0,g.jsx)(i,{children:(0,g.jsx)(r,{})}));let s=await c(t,n);n(`checking_out`);let{branchName:l,branchError:u}=await a(s.branch);return{messages:o(s.log,u),branchName:l}}export{b as teleportWithProgress};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Mu as t,Pu as n,Qu as r,Zu as i}from"./loadAgentsDir-DXOkUcW3.js";import{I as a,P as o,ai as s,t as c,y as l}from"./src-DL3w8VPk2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{Cn as d,bn as f}from"./settings-3xZ0fsvE.js";import{a as p,r as m}from"./githubRepoPathMapping-CzgPGOHQ.js";var h=e(s(),1);c(),d(),i(),n();var g=u();function _({targetRepo:e,initialPaths:n,onSelectPath:i,onCancel:s}){let[c,u]=(0,h.useState)(n),[d,_]=(0,h.useState)(null),[v,y]=(0,h.useState)(!1),b=(0,h.useCallback)(async t=>{if(t===`cancel`){s();return}if(y(!0),_(null),await p(t,e)){i(t);return}m(e,t);let n=c.filter(e=>e!==t);u(n),y(!1),_(`${f(t)} no longer contains the correct repository. Select another path.`)},[e,c,i,s]),x=[...c.map(e=>({label:(0,g.jsxs)(o,{children:[`Use `,(0,g.jsx)(o,{bold:!0,children:f(e)})]}),value:e})),{label:`Cancel`,value:`cancel`}];return(0,g.jsx)(l,{title:`Teleport to Repo`,onCancel:s,color:`background`,children:c.length>0?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[d&&(0,g.jsx)(o,{color:`error`,children:d}),(0,g.jsxs)(o,{children:[`Open Work Mate in `,(0,g.jsx)(o,{bold:!0,children:e}),`:`]})]}),v?(0,g.jsxs)(a,{children:[(0,g.jsx)(t,{}),(0,g.jsx)(o,{children:` Validating repository…`})]}):(0,g.jsx)(r,{options:x,onChange:e=>void b(e)})]}):(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[d&&(0,g.jsx)(o,{color:`error`,children:d}),(0,g.jsxs)(o,{dimColor:!0,children:[`Run claude --teleport from a checkout of `,e]})]})})}export{_ as TeleportRepoMismatchDialog};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Mu as t,Pu as n,Qu as r,Zu as i}from"./loadAgentsDir-DaNpxaO-.js";import{I as a,P as o,ai as s,t as c,y as l}from"./src-DL3w8VPk2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{Cn as d,bn as f}from"./settings-3xZ0fsvE.js";import{a as p,r as m}from"./githubRepoPathMapping-CzgPGOHQ.js";var h=e(s(),1);c(),d(),i(),n();var g=u();function _({targetRepo:e,initialPaths:n,onSelectPath:i,onCancel:s}){let[c,u]=(0,h.useState)(n),[d,_]=(0,h.useState)(null),[v,y]=(0,h.useState)(!1),b=(0,h.useCallback)(async t=>{if(t===`cancel`){s();return}if(y(!0),_(null),await p(t,e)){i(t);return}m(e,t);let n=c.filter(e=>e!==t);u(n),y(!1),_(`${f(t)} no longer contains the correct repository. Select another path.`)},[e,c,i,s]),x=[...c.map(e=>({label:(0,g.jsxs)(o,{children:[`Use `,(0,g.jsx)(o,{bold:!0,children:f(e)})]}),value:e})),{label:`Cancel`,value:`cancel`}];return(0,g.jsx)(l,{title:`Teleport to Repo`,onCancel:s,color:`background`,children:c.length>0?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[d&&(0,g.jsx)(o,{color:`error`,children:d}),(0,g.jsxs)(o,{children:[`Open Work Mate in `,(0,g.jsx)(o,{bold:!0,children:e}),`:`]})]}),v?(0,g.jsxs)(a,{children:[(0,g.jsx)(t,{}),(0,g.jsx)(o,{children:` Validating repository…`})]}):(0,g.jsx)(r,{options:x,onChange:e=>void b(e)})]}):(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[d&&(0,g.jsx)(o,{color:`error`,children:d}),(0,g.jsxs)(o,{dimColor:!0,children:[`Run claude --teleport from a checkout of `,e]})]})})}export{_ as TeleportRepoMismatchDialog};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Au as t,Dp as n,Mu as r,Op as i,Pu as a,Qu as o,Zu as s,dC as c,fC as l,gC as u,ju as d,lu as f,pu as p,uC as m}from"./loadAgentsDir-DXOkUcW3.js";import{D as h,I as g,P as _,T as v,Wt as y,ai as b,hn as x,ot as S,t as C}from"./src-DL3w8VPk2.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as T,tr as E}from"./state-D5D6QpTX.js";import{M as D,P as O,R as k,c as A,i as j}from"./debug-D58GQBDG.js";import{n as M,r as N}from"./analytics-DJobLaWP.js";import{p as P,v as F}from"./startupProfiler-CbzxVmbv.js";import{i as I,n as L}from"./detectRepository-CDOJ-M7h.js";import{n as R,o as z}from"./api-C5ULzZny.js";var B=e(b(),1);T(),M(),k(),f();function V(e){let[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(null);return{resumeSession:(0,B.useCallback)(async t=>{n(!0),i(null),o(t),N(`tengu_teleport_resume_session`,{source:e,session_id:t.id});try{let e=await p(t.id);return E({sessionId:t.id}),n(!1),e}catch(e){let t={message:e instanceof D?e.message:O(e),formattedMessage:e instanceof D?e.formattedMessage:void 0,isOperationError:e instanceof D};return i(t),n(!1),null}},[e]),isResuming:t,error:r,selectedSession:a,clearError:(0,B.useCallback)(()=>{i(null)},[])}}u(),z(),C(),m(),c(),j(),I(),F(),i(),s(),a(),d();var H=w(),U=`Updated`,W=` `;function G({onSelect:e,onCancel:i,isEmbedded:a=!1}){let{rows:s}=S(),[c,u]=(0,B.useState)([]),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(!0),[b,C]=(0,B.useState)(null),[w,T]=(0,B.useState)(!1),[E,D]=(0,B.useState)(!1),[O,k]=(0,B.useState)(1),j=l(`confirm:no`,`Confirmation`,`Esc`),M=(0,B.useCallback)(async()=>{try{m(!0),C(null);let e=await L();f(e),A(`Current repository: ${e||`not detected`}`);let t=await R(),n=t;e&&(n=t.filter(t=>t.repo?`${t.repo.owner.login}/${t.repo.name}`===e:!1),A(`Filtered ${n.length} sessions for repo ${e} from ${t.length} total`));let r=[...n].sort((e,t)=>{let n=new Date(e.updated_at);return new Date(t.updated_at).getTime()-n.getTime()});u(r)}catch(e){let t=e instanceof Error?e.message:String(e);A(`Error loading code sessions: ${t}`),C(K(t))}finally{m(!1),T(!1)}},[]),N=()=>{T(!0),M()};y(`confirm:no`,i,{context:`Confirmation`}),x((e,t)=>{if(t.ctrl&&e===`c`){i();return}if(t.ctrl&&e===`r`&&b){N();return}if(b!==null&&t.return){i();return}});let F=(0,B.useCallback)(()=>{D(!0),M()},[D,M]);if(!E)return(0,H.jsx)(t,{onComplete:F});if(p)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(g,{flexDirection:`row`,children:[(0,H.jsx)(r,{}),(0,H.jsx)(_,{bold:!0,children:`Loading Work Mate sessions…`})]}),(0,H.jsx)(_,{dimColor:!0,children:w?`Retrying…`:`Fetching your Work Mate sessions…`})]});if(b)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsx)(_,{bold:!0,color:`error`,children:`Error loading Work Mate sessions`}),q(b),(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:`Ctrl+R`}),` to retry · Press `,(0,H.jsx)(_,{bold:!0,children:j}),` to cancel`]})]});if(c.length===0)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(_,{bold:!0,children:[`No Work Mate sessions found`,d&&(0,H.jsxs)(_,{children:[` for `,d]})]}),(0,H.jsx)(g,{marginTop:1,children:(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:j}),` to cancel`]})})]});let I=c.map(e=>({...e,timeString:P(new Date(e.updated_at))})),z=Math.max(7,...I.map(e=>e.timeString.length)),V=I.map(({timeString:e,title:t,id:n})=>({label:`${e.padEnd(z,` `)} ${t}`,value:n})),G=Math.max(1,a?Math.min(c.length,5,s-6-7):Math.min(c.length,s-1-7));return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,height:G+7,children:[(0,H.jsxs)(_,{bold:!0,children:[`Select a session to resume`,c.length>G&&(0,H.jsxs)(_,{dimColor:!0,children:[` `,`(`,O,` of `,c.length,`)`]}),d&&(0,H.jsxs)(_,{dimColor:!0,children:[` (`,d,`)`]}),`:`]}),(0,H.jsxs)(g,{flexDirection:`column`,marginTop:1,flexGrow:1,children:[(0,H.jsx)(g,{marginLeft:2,children:(0,H.jsxs)(_,{bold:!0,children:[U.padEnd(z,` `),W,`Session Title`]})}),(0,H.jsx)(o,{visibleOptionCount:G,options:V,onChange:t=>{let n=c.find(e=>e.id===t);n&&e(n)},onFocus:e=>{let t=V.findIndex(t=>t.value===e);t>=0&&k(t+1)}})]}),(0,H.jsx)(g,{flexDirection:`row`,children:(0,H.jsx)(_,{dimColor:!0,children:(0,H.jsxs)(v,{children:[(0,H.jsx)(h,{shortcut:`↑/↓`,action:`select`}),(0,H.jsx)(h,{shortcut:`Enter`,action:`confirm`}),(0,H.jsx)(n,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}function K(e){let t=e.toLowerCase();return t.includes(`fetch`)||t.includes(`network`)||t.includes(`timeout`)?`network`:t.includes(`auth`)||t.includes(`token`)||t.includes(`permission`)||t.includes(`oauth`)||t.includes(`not authenticated`)||t.includes(`/login`)||t.includes(`console account`)||t.includes(`403`)?`auth`:t.includes(`api`)||t.includes(`rate limit`)||t.includes(`500`)||t.includes(`529`)?`api`:`other`}function q(e){switch(e){case`network`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Check your internet connection`})});case`auth`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Teleport requires a Work Mate account`})});case`api`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Sorry, Work Mate encountered an error`})});case`other`:return(0,H.jsx)(g,{marginY:1,flexDirection:`row`,children:(0,H.jsx)(_,{dimColor:!0,children:`Sorry, Work Mate encountered an error`})})}}M(),C(),m(),a();function J({onComplete:e,onCancel:t,onError:n,isEmbedded:i=!1,source:a}){let{resumeSession:o,isResuming:s,error:c,selectedSession:l}=V(a);(0,B.useEffect)(()=>{N(`tengu_teleport_started`,{source:a})},[a]);let u=async t=>{let r=await o(t);r?e(r):c&&n&&n(c.message,c.formattedMessage)},d=()=>{N(`tengu_teleport_cancelled`,{}),t()};return y(`app:interrupt`,d,{context:`Global`,isActive:!!c&&!n}),s&&l?(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(g,{flexDirection:`row`,children:[(0,H.jsx)(r,{}),(0,H.jsx)(_,{bold:!0,children:`Resuming session…`})]}),(0,H.jsxs)(_,{dimColor:!0,children:[`Loading "`,l.title,`"…`]})]}):c&&!n?(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsx)(_,{bold:!0,color:`error`,children:`Failed to resume session`}),(0,H.jsx)(_,{dimColor:!0,children:c.message}),(0,H.jsx)(g,{marginTop:1,children:(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:`Esc`}),` to cancel`]})})]}):(0,H.jsx)(G,{onSelect:u,onCancel:d,isEmbedded:i})}export{J as TeleportResumeWrapper};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Au as t,Dp as n,Mu as r,Op as i,Pu as a,Qu as o,Zu as s,dC as c,fC as l,gC as u,ju as d,lu as f,pu as p,uC as m}from"./loadAgentsDir-DaNpxaO-.js";import{D as h,I as g,P as _,T as v,Wt as y,ai as b,hn as x,ot as S,t as C}from"./src-DL3w8VPk2.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as T,tr as E}from"./state-D5D6QpTX.js";import{M as D,P as O,R as k,c as A,i as j}from"./debug-D58GQBDG.js";import{n as M,r as N}from"./analytics-DJobLaWP.js";import{p as P,v as F}from"./startupProfiler-CbzxVmbv.js";import{i as I,n as L}from"./detectRepository-CDOJ-M7h.js";import{n as R,o as z}from"./api-DyUWfg3a.js";var B=e(b(),1);T(),M(),k(),f();function V(e){let[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(null);return{resumeSession:(0,B.useCallback)(async t=>{n(!0),i(null),o(t),N(`tengu_teleport_resume_session`,{source:e,session_id:t.id});try{let e=await p(t.id);return E({sessionId:t.id}),n(!1),e}catch(e){let t={message:e instanceof D?e.message:O(e),formattedMessage:e instanceof D?e.formattedMessage:void 0,isOperationError:e instanceof D};return i(t),n(!1),null}},[e]),isResuming:t,error:r,selectedSession:a,clearError:(0,B.useCallback)(()=>{i(null)},[])}}u(),z(),C(),m(),c(),j(),I(),F(),i(),s(),a(),d();var H=w(),U=`Updated`,W=` `;function G({onSelect:e,onCancel:i,isEmbedded:a=!1}){let{rows:s}=S(),[c,u]=(0,B.useState)([]),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(!0),[b,C]=(0,B.useState)(null),[w,T]=(0,B.useState)(!1),[E,D]=(0,B.useState)(!1),[O,k]=(0,B.useState)(1),j=l(`confirm:no`,`Confirmation`,`Esc`),M=(0,B.useCallback)(async()=>{try{m(!0),C(null);let e=await L();f(e),A(`Current repository: ${e||`not detected`}`);let t=await R(),n=t;e&&(n=t.filter(t=>t.repo?`${t.repo.owner.login}/${t.repo.name}`===e:!1),A(`Filtered ${n.length} sessions for repo ${e} from ${t.length} total`));let r=[...n].sort((e,t)=>{let n=new Date(e.updated_at);return new Date(t.updated_at).getTime()-n.getTime()});u(r)}catch(e){let t=e instanceof Error?e.message:String(e);A(`Error loading code sessions: ${t}`),C(K(t))}finally{m(!1),T(!1)}},[]),N=()=>{T(!0),M()};y(`confirm:no`,i,{context:`Confirmation`}),x((e,t)=>{if(t.ctrl&&e===`c`){i();return}if(t.ctrl&&e===`r`&&b){N();return}if(b!==null&&t.return){i();return}});let F=(0,B.useCallback)(()=>{D(!0),M()},[D,M]);if(!E)return(0,H.jsx)(t,{onComplete:F});if(p)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(g,{flexDirection:`row`,children:[(0,H.jsx)(r,{}),(0,H.jsx)(_,{bold:!0,children:`Loading Work Mate sessions…`})]}),(0,H.jsx)(_,{dimColor:!0,children:w?`Retrying…`:`Fetching your Work Mate sessions…`})]});if(b)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsx)(_,{bold:!0,color:`error`,children:`Error loading Work Mate sessions`}),q(b),(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:`Ctrl+R`}),` to retry · Press `,(0,H.jsx)(_,{bold:!0,children:j}),` to cancel`]})]});if(c.length===0)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(_,{bold:!0,children:[`No Work Mate sessions found`,d&&(0,H.jsxs)(_,{children:[` for `,d]})]}),(0,H.jsx)(g,{marginTop:1,children:(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:j}),` to cancel`]})})]});let I=c.map(e=>({...e,timeString:P(new Date(e.updated_at))})),z=Math.max(7,...I.map(e=>e.timeString.length)),V=I.map(({timeString:e,title:t,id:n})=>({label:`${e.padEnd(z,` `)} ${t}`,value:n})),G=Math.max(1,a?Math.min(c.length,5,s-6-7):Math.min(c.length,s-1-7));return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,height:G+7,children:[(0,H.jsxs)(_,{bold:!0,children:[`Select a session to resume`,c.length>G&&(0,H.jsxs)(_,{dimColor:!0,children:[` `,`(`,O,` of `,c.length,`)`]}),d&&(0,H.jsxs)(_,{dimColor:!0,children:[` (`,d,`)`]}),`:`]}),(0,H.jsxs)(g,{flexDirection:`column`,marginTop:1,flexGrow:1,children:[(0,H.jsx)(g,{marginLeft:2,children:(0,H.jsxs)(_,{bold:!0,children:[U.padEnd(z,` `),W,`Session Title`]})}),(0,H.jsx)(o,{visibleOptionCount:G,options:V,onChange:t=>{let n=c.find(e=>e.id===t);n&&e(n)},onFocus:e=>{let t=V.findIndex(t=>t.value===e);t>=0&&k(t+1)}})]}),(0,H.jsx)(g,{flexDirection:`row`,children:(0,H.jsx)(_,{dimColor:!0,children:(0,H.jsxs)(v,{children:[(0,H.jsx)(h,{shortcut:`↑/↓`,action:`select`}),(0,H.jsx)(h,{shortcut:`Enter`,action:`confirm`}),(0,H.jsx)(n,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}function K(e){let t=e.toLowerCase();return t.includes(`fetch`)||t.includes(`network`)||t.includes(`timeout`)?`network`:t.includes(`auth`)||t.includes(`token`)||t.includes(`permission`)||t.includes(`oauth`)||t.includes(`not authenticated`)||t.includes(`/login`)||t.includes(`console account`)||t.includes(`403`)?`auth`:t.includes(`api`)||t.includes(`rate limit`)||t.includes(`500`)||t.includes(`529`)?`api`:`other`}function q(e){switch(e){case`network`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Check your internet connection`})});case`auth`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Teleport requires a Work Mate account`})});case`api`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Sorry, Work Mate encountered an error`})});case`other`:return(0,H.jsx)(g,{marginY:1,flexDirection:`row`,children:(0,H.jsx)(_,{dimColor:!0,children:`Sorry, Work Mate encountered an error`})})}}M(),C(),m(),a();function J({onComplete:e,onCancel:t,onError:n,isEmbedded:i=!1,source:a}){let{resumeSession:o,isResuming:s,error:c,selectedSession:l}=V(a);(0,B.useEffect)(()=>{N(`tengu_teleport_started`,{source:a})},[a]);let u=async t=>{let r=await o(t);r?e(r):c&&n&&n(c.message,c.formattedMessage)},d=()=>{N(`tengu_teleport_cancelled`,{}),t()};return y(`app:interrupt`,d,{context:`Global`,isActive:!!c&&!n}),s&&l?(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(g,{flexDirection:`row`,children:[(0,H.jsx)(r,{}),(0,H.jsx)(_,{bold:!0,children:`Resuming session…`})]}),(0,H.jsxs)(_,{dimColor:!0,children:[`Loading "`,l.title,`"…`]})]}):c&&!n?(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsx)(_,{bold:!0,color:`error`,children:`Failed to resume session`}),(0,H.jsx)(_,{dimColor:!0,children:c.message}),(0,H.jsx)(g,{marginTop:1,children:(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:`Esc`}),` to cancel`]})})]}):(0,H.jsx)(G,{onSelect:u,onCancel:d,isEmbedded:i})}export{J as TeleportResumeWrapper};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,$h as n,Lh as r,Nh as i,Ph as a,Qu as o,Rh as s,Xh as c,Zd as l,Zh as u,Zu as d,dC as f,fC as p,gC as m,pC as h,uC as g,zh as _}from"./loadAgentsDir-DXOkUcW3.js";import{D as v,H as y,I as b,P as x,T as S,U as C,V as w,Wt as T,Xt as E,ot as D,t as O}from"./src-DL3w8VPk2.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{b as A,h as j}from"./settings-3xZ0fsvE.js";import{n as M,t as N}from"./useExitOnCtrlCDWithKeybindings-D0uqGxGw.js";function P({onThemeSelect:e,showIntroText:t=!1,helpText:a=``,showHelpTextBelow:c=!1,hideEscToCancel:d=!1,skipExitHandling:f=!1,onCancel:m}){let[h]=y(),g=C(),{columns:_}=D(),O=r(),k=O===null?s(h):null,{setPreviewTheme:j,savePreview:N,cancelPreview:P}=w(),I=u(e=>e.settings.syntaxHighlightingDisabled)??!1,L=n();E(`ThemePicker`);let R=p(`theme:toggleSyntaxHighlighting`,`ThemePicker`,`ctrl+t`);T(`theme:toggleSyntaxHighlighting`,()=>{if(O===null){let e=!I;A(`userSettings`,{syntaxHighlightingDisabled:e}),L(t=>({...t,settings:{...t.settings,syntaxHighlightingDisabled:e}}))}},{context:`ThemePicker`});let z=M(f?()=>{}:void 0),B=[{label:`Dark mode`,value:`dark`},{label:`Light mode`,value:`light`},{label:`Dark mode (colorblind-friendly)`,value:`dark-daltonized`},{label:`Light mode (colorblind-friendly)`,value:`light-daltonized`},{label:`Dark mode (ANSI colors only)`,value:`dark-ansi`},{label:`Light mode (ANSI colors only)`,value:`light-ansi`}],V=(0,F.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,F.jsxs)(b,{flexDirection:`column`,gap:1,children:[t?(0,F.jsx)(x,{children:`Let's get started.`}):(0,F.jsx)(x,{bold:!0,color:`permission`,children:`Theme`}),(0,F.jsxs)(b,{flexDirection:`column`,children:[(0,F.jsx)(x,{bold:!0,children:`Choose the text style that looks best with your terminal`}),a&&!c&&(0,F.jsx)(x,{dimColor:!0,children:a})]}),(0,F.jsx)(o,{options:B,onFocus:e=>{j(e)},onChange:t=>{N(),e(t)},onCancel:f?()=>{P(),m?.()}:async()=>{P(),await l(0)},visibleOptionCount:B.length,defaultValue:g,defaultFocusValue:g})]}),(0,F.jsxs)(b,{flexDirection:`column`,width:`100%`,children:[(0,F.jsx)(b,{flexDirection:`column`,borderTop:!0,borderBottom:!0,borderLeft:!1,borderRight:!1,borderStyle:`dashed`,borderColor:`subtle`,children:(0,F.jsx)(i,{patch:{oldStart:1,newStart:1,oldLines:3,newLines:3,lines:[` function greet() {`,`- console.log("Hello, World!");`,`+ console.log("Hello, Work Mate!");`,` }`]},dim:!1,filePath:`demo.js`,firstLine:null,width:_})}),(0,F.jsxs)(x,{dimColor:!0,children:[` `,O===`env`?`Syntax highlighting disabled (via CLAUDE_CODE_SYNTAX_HIGHLIGHT=${process.env.CLAUDE_CODE_SYNTAX_HIGHLIGHT})`:I?`Syntax highlighting disabled (${R} to enable)`:k?`Syntax theme: ${k.theme}${k.source?` (from ${k.source})`:``} (${R} to disable)`:`Syntax highlighting enabled (${R} to disable)`]})]})]});return t?V:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(b,{flexDirection:`column`,children:V}),(0,F.jsxs)(b,{marginTop:1,children:[c&&a&&(0,F.jsx)(b,{marginLeft:3,children:(0,F.jsx)(x,{dimColor:!0,children:a})}),!d&&(0,F.jsx)(b,{children:(0,F.jsx)(x,{dimColor:!0,italic:!0,children:z.pending?(0,F.jsxs)(F.Fragment,{children:[`Press `,z.keyName,` again to exit`]}):(0,F.jsxs)(S,{children:[(0,F.jsx)(v,{shortcut:`Enter`,action:`select`}),(0,F.jsx)(v,{shortcut:`Esc`,action:`cancel`})]})})})]})]})}var F,I=e((()=>{N(),m(),O(),h(),g(),f(),c(),t(),j(),d(),_(),a(),F=k()}));export{I as n,P as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,$h as n,Lh as r,Nh as i,Ph as a,Qu as o,Rh as s,Xh as c,Zd as l,Zh as u,Zu as d,dC as f,fC as p,gC as m,pC as h,uC as g,zh as _}from"./loadAgentsDir-DaNpxaO-.js";import{D as v,H as y,I as b,P as x,T as S,U as C,V as w,Wt as T,Xt as E,ot as D,t as O}from"./src-DL3w8VPk2.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{b as A,h as j}from"./settings-3xZ0fsvE.js";import{n as M,t as N}from"./useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js";function P({onThemeSelect:e,showIntroText:t=!1,helpText:a=``,showHelpTextBelow:c=!1,hideEscToCancel:d=!1,skipExitHandling:f=!1,onCancel:m}){let[h]=y(),g=C(),{columns:_}=D(),O=r(),k=O===null?s(h):null,{setPreviewTheme:j,savePreview:N,cancelPreview:P}=w(),I=u(e=>e.settings.syntaxHighlightingDisabled)??!1,L=n();E(`ThemePicker`);let R=p(`theme:toggleSyntaxHighlighting`,`ThemePicker`,`ctrl+t`);T(`theme:toggleSyntaxHighlighting`,()=>{if(O===null){let e=!I;A(`userSettings`,{syntaxHighlightingDisabled:e}),L(t=>({...t,settings:{...t.settings,syntaxHighlightingDisabled:e}}))}},{context:`ThemePicker`});let z=M(f?()=>{}:void 0),B=[{label:`Dark mode`,value:`dark`},{label:`Light mode`,value:`light`},{label:`Dark mode (colorblind-friendly)`,value:`dark-daltonized`},{label:`Light mode (colorblind-friendly)`,value:`light-daltonized`},{label:`Dark mode (ANSI colors only)`,value:`dark-ansi`},{label:`Light mode (ANSI colors only)`,value:`light-ansi`}],V=(0,F.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,F.jsxs)(b,{flexDirection:`column`,gap:1,children:[t?(0,F.jsx)(x,{children:`Let's get started.`}):(0,F.jsx)(x,{bold:!0,color:`permission`,children:`Theme`}),(0,F.jsxs)(b,{flexDirection:`column`,children:[(0,F.jsx)(x,{bold:!0,children:`Choose the text style that looks best with your terminal`}),a&&!c&&(0,F.jsx)(x,{dimColor:!0,children:a})]}),(0,F.jsx)(o,{options:B,onFocus:e=>{j(e)},onChange:t=>{N(),e(t)},onCancel:f?()=>{P(),m?.()}:async()=>{P(),await l(0)},visibleOptionCount:B.length,defaultValue:g,defaultFocusValue:g})]}),(0,F.jsxs)(b,{flexDirection:`column`,width:`100%`,children:[(0,F.jsx)(b,{flexDirection:`column`,borderTop:!0,borderBottom:!0,borderLeft:!1,borderRight:!1,borderStyle:`dashed`,borderColor:`subtle`,children:(0,F.jsx)(i,{patch:{oldStart:1,newStart:1,oldLines:3,newLines:3,lines:[` function greet() {`,`- console.log("Hello, World!");`,`+ console.log("Hello, Work Mate!");`,` }`]},dim:!1,filePath:`demo.js`,firstLine:null,width:_})}),(0,F.jsxs)(x,{dimColor:!0,children:[` `,O===`env`?`Syntax highlighting disabled (via CLAUDE_CODE_SYNTAX_HIGHLIGHT=${process.env.CLAUDE_CODE_SYNTAX_HIGHLIGHT})`:I?`Syntax highlighting disabled (${R} to enable)`:k?`Syntax theme: ${k.theme}${k.source?` (from ${k.source})`:``} (${R} to disable)`:`Syntax highlighting enabled (${R} to disable)`]})]})]});return t?V:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(b,{flexDirection:`column`,children:V}),(0,F.jsxs)(b,{marginTop:1,children:[c&&a&&(0,F.jsx)(b,{marginLeft:3,children:(0,F.jsx)(x,{dimColor:!0,children:a})}),!d&&(0,F.jsx)(b,{children:(0,F.jsx)(x,{dimColor:!0,italic:!0,children:z.pending?(0,F.jsxs)(F.Fragment,{children:[`Press `,z.keyName,` again to exit`]}):(0,F.jsxs)(S,{children:[(0,F.jsx)(v,{shortcut:`Enter`,action:`select`}),(0,F.jsx)(v,{shortcut:`Esc`,action:`cancel`})]})})})]})]})}var F,I=e((()=>{N(),m(),O(),h(),g(),f(),c(),t(),j(),d(),_(),a(),F=k()}));export{I as n,P as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Ox as n,Qd as r,Qu as i,Xg as a,Yg as o,Zu as s,jx as c,uC as l}from"./loadAgentsDir-DXOkUcW3.js";import{I as u,P as d,Wt as f,ai as p,t as m}from"./src-DL3w8VPk2.js";import{t as h}from"./jsx-runtime-Bb4Xn-E0.js";import{Qn as g,Ut as _}from"./state-D5D6QpTX.js";import{n as v,t as y}from"./cwd-Nh5IZNKO.js";import{f as b,u as x}from"./debug-D58GQBDG.js";import{h as S,s as C}from"./settings-3xZ0fsvE.js";import{h as w,n as T,v as E}from"./config-DRy1I12M.js";import{n as D,r as O}from"./analytics-DJobLaWP.js";import{in as k}from"./prompt-DEioJrx_.js";import{n as A,t as j}from"./managedEnvConstants-BPwL2aWI.js";import{n as M,t as N}from"./useExitOnCtrlCDWithKeybindings-D0uqGxGw.js";import{n as P,t as F}from"./PermissionDialog-BPhvs5xH.js";import{homedir as I}from"os";var L=e(p(),1),R=h();m(),_(),v(),b(),D(),w(),l(),c(),t(),s(),N(),P(),S(),k(),A(),a();function z(e){if(e===null||e.disableAllHooks)return!1;if(e.statusLine||e.fileSuggestion)return!0;if(!e.hooks)return!1;for(let t of Object.values(e.hooks))if(t.length>0)return!0;return!1}function B(){let e=[];return z(C(`projectSettings`))&&e.push(`.workmate/settings.json`),z(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function V(e){return e.some(e=>e.ruleBehavior===`allow`&&(e.ruleValue.toolName===`Bash`||e.ruleValue.toolName.startsWith(`Bash(`)))}function H(){let e=[];return V(o(`projectSettings`))&&e.push(`.workmate/settings.json`),V(o(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function U(e){return!!e?.otelHeadersHelper}function W(){let e=[];return U(C(`projectSettings`))&&e.push(`.workmate/settings.json`),U(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function G(e){return!!e?.apiKeyHelper}function K(){let e=[];return G(C(`projectSettings`))&&e.push(`.workmate/settings.json`),G(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function q(e){return!!(e?.awsAuthRefresh||e?.awsCredentialExport)}function J(){let e=[];return q(C(`projectSettings`))&&e.push(`.workmate/settings.json`),q(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function Y(e){return!!e?.gcpAuthRefresh}function X(){let e=[];return Y(C(`projectSettings`))&&e.push(`.workmate/settings.json`),Y(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function Z(e){return e?.env?Object.keys(e.env).some(e=>!j.has(e.toUpperCase())):!1}function Q(){let e=[];return Z(C(`projectSettings`))&&e.push(`.workmate/settings.json`),Z(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}k();function $({onDone:e,commands:t}){let{servers:a}=n(`project`),o=Object.keys(a).length>0,s=B().length>0,c=H(),l=K().length>0,p=J().length>0,m=X().length>0,h=W().length>0,_=Q().length>0,v=t?.some(e=>e.type===`prompt`&&e.loadedFrom===`commands_DEPRECATED`&&(e.source===`projectSettings`||e.source===`localSettings`)&&e.allowedTools?.some(e=>e===`Bash`||e.startsWith(`Bash(`)))??!1,b=t?.some(e=>e.type===`prompt`&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`)&&(e.source===`projectSettings`||e.source===`localSettings`||e.source===`plugin`)&&e.allowedTools?.some(e=>e===`Bash`||e.startsWith(`Bash(`)))??!1,S=c.length>0||v||b,C=T(),[w,D]=L.useState(null);L.useEffect(()=>{if(w!==null){let e=w,t=setTimeout(()=>r(e));return()=>clearTimeout(t)}},[w]),L.useEffect(()=>{O(`tengu_trust_dialog_shown`,{isHomeDir:I()===y(),hasMcpServers:o,hasHooks:s,hasBashExecution:S,hasApiKeyHelper:l,hasAwsCommands:p,hasGcpCommands:m,hasOtelHeadersHelper:h,hasDangerousEnvVars:_})},[o,s,S,l,p,m,h,_]);function k(t){if(t===`exit`){D(1);return}let n=I()===y();O(`tengu_trust_dialog_accept`,{isHomeDir:n,hasMcpServers:o,hasHooks:s,hasBashExecution:S,hasApiKeyHelper:l,hasAwsCommands:p,hasGcpCommands:m,hasOtelHeadersHelper:h,hasDangerousEnvVars:_}),n?g(!0):E(e=>({...e,hasTrustDialogAccepted:!0})),e()}let A=M(()=>D(1));return f(`confirm:no`,()=>{D(0)},{context:`Confirmation`}),w===null?C?(setTimeout(e),null):(0,R.jsx)(F,{color:`warning`,titleColor:`warning`,title:`Accessing workspace:`,children:(0,R.jsxs)(u,{flexDirection:`column`,gap:1,paddingTop:1,children:[(0,R.jsx)(d,{bold:!0,children:x().cwd()}),(0,R.jsx)(d,{children:`Is this a project you trust? (Your own code, a well-known open source project, or work from your team).`}),(0,R.jsx)(d,{children:`Once trusted, Work Mate can read, edit, and run commands in this folder.`}),(0,R.jsx)(i,{options:[{label:`Yes, I trust this folder`,value:`enable_all`},{label:`No, exit`,value:`exit`}],onChange:e=>k(e),onCancel:()=>k(`exit`)}),(0,R.jsx)(d,{dimColor:!0,children:A.pending?(0,R.jsxs)(R.Fragment,{children:[`Press `,A.keyName,` again to exit`]}):(0,R.jsx)(R.Fragment,{children:`Enter to confirm · Esc to cancel`})})]})}):null}export{$ as TrustDialog};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Ox as n,Qd as r,Qu as i,Xg as a,Yg as o,Zu as s,jx as c,uC as l}from"./loadAgentsDir-DaNpxaO-.js";import{I as u,P as d,Wt as f,ai as p,t as m}from"./src-DL3w8VPk2.js";import{t as h}from"./jsx-runtime-Bb4Xn-E0.js";import{Qn as g,Ut as _}from"./state-D5D6QpTX.js";import{n as v,t as y}from"./cwd-Nh5IZNKO.js";import{f as b,u as x}from"./debug-D58GQBDG.js";import{h as S,s as C}from"./settings-3xZ0fsvE.js";import{h as w,n as T,v as E}from"./config-DRy1I12M.js";import{n as D,r as O}from"./analytics-DJobLaWP.js";import{in as k}from"./prompt-8u06WVES.js";import{n as A,t as j}from"./managedEnvConstants-BPwL2aWI.js";import{n as M,t as N}from"./useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js";import{n as P,t as F}from"./PermissionDialog-BPhvs5xH.js";import{homedir as I}from"os";var L=e(p(),1),R=h();m(),_(),v(),b(),D(),w(),l(),c(),t(),s(),N(),P(),S(),k(),A(),a();function z(e){if(e===null||e.disableAllHooks)return!1;if(e.statusLine||e.fileSuggestion)return!0;if(!e.hooks)return!1;for(let t of Object.values(e.hooks))if(t.length>0)return!0;return!1}function B(){let e=[];return z(C(`projectSettings`))&&e.push(`.workmate/settings.json`),z(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function V(e){return e.some(e=>e.ruleBehavior===`allow`&&(e.ruleValue.toolName===`Bash`||e.ruleValue.toolName.startsWith(`Bash(`)))}function H(){let e=[];return V(o(`projectSettings`))&&e.push(`.workmate/settings.json`),V(o(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function U(e){return!!e?.otelHeadersHelper}function W(){let e=[];return U(C(`projectSettings`))&&e.push(`.workmate/settings.json`),U(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function G(e){return!!e?.apiKeyHelper}function K(){let e=[];return G(C(`projectSettings`))&&e.push(`.workmate/settings.json`),G(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function q(e){return!!(e?.awsAuthRefresh||e?.awsCredentialExport)}function J(){let e=[];return q(C(`projectSettings`))&&e.push(`.workmate/settings.json`),q(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function Y(e){return!!e?.gcpAuthRefresh}function X(){let e=[];return Y(C(`projectSettings`))&&e.push(`.workmate/settings.json`),Y(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function Z(e){return e?.env?Object.keys(e.env).some(e=>!j.has(e.toUpperCase())):!1}function Q(){let e=[];return Z(C(`projectSettings`))&&e.push(`.workmate/settings.json`),Z(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}k();function $({onDone:e,commands:t}){let{servers:a}=n(`project`),o=Object.keys(a).length>0,s=B().length>0,c=H(),l=K().length>0,p=J().length>0,m=X().length>0,h=W().length>0,_=Q().length>0,v=t?.some(e=>e.type===`prompt`&&e.loadedFrom===`commands_DEPRECATED`&&(e.source===`projectSettings`||e.source===`localSettings`)&&e.allowedTools?.some(e=>e===`Bash`||e.startsWith(`Bash(`)))??!1,b=t?.some(e=>e.type===`prompt`&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`)&&(e.source===`projectSettings`||e.source===`localSettings`||e.source===`plugin`)&&e.allowedTools?.some(e=>e===`Bash`||e.startsWith(`Bash(`)))??!1,S=c.length>0||v||b,C=T(),[w,D]=L.useState(null);L.useEffect(()=>{if(w!==null){let e=w,t=setTimeout(()=>r(e));return()=>clearTimeout(t)}},[w]),L.useEffect(()=>{O(`tengu_trust_dialog_shown`,{isHomeDir:I()===y(),hasMcpServers:o,hasHooks:s,hasBashExecution:S,hasApiKeyHelper:l,hasAwsCommands:p,hasGcpCommands:m,hasOtelHeadersHelper:h,hasDangerousEnvVars:_})},[o,s,S,l,p,m,h,_]);function k(t){if(t===`exit`){D(1);return}let n=I()===y();O(`tengu_trust_dialog_accept`,{isHomeDir:n,hasMcpServers:o,hasHooks:s,hasBashExecution:S,hasApiKeyHelper:l,hasAwsCommands:p,hasGcpCommands:m,hasOtelHeadersHelper:h,hasDangerousEnvVars:_}),n?g(!0):E(e=>({...e,hasTrustDialogAccepted:!0})),e()}let A=M(()=>D(1));return f(`confirm:no`,()=>{D(0)},{context:`Confirmation`}),w===null?C?(setTimeout(e),null):(0,R.jsx)(F,{color:`warning`,titleColor:`warning`,title:`Accessing workspace:`,children:(0,R.jsxs)(u,{flexDirection:`column`,gap:1,paddingTop:1,children:[(0,R.jsx)(d,{bold:!0,children:x().cwd()}),(0,R.jsx)(d,{children:`Is this a project you trust? (Your own code, a well-known open source project, or work from your team).`}),(0,R.jsx)(d,{children:`Once trusted, Work Mate can read, edit, and run commands in this folder.`}),(0,R.jsx)(i,{options:[{label:`Yes, I trust this folder`,value:`enable_all`},{label:`No, exit`,value:`exit`}],onChange:e=>k(e),onCancel:()=>k(`exit`)}),(0,R.jsx)(d,{dimColor:!0,children:A.pending?(0,R.jsxs)(R.Fragment,{children:[`Press `,A.keyName,` again to exit`]}):(0,R.jsx)(R.Fragment,{children:`Enter to confirm · Esc to cancel`})})]})}):null}export{$ as TrustDialog};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$S as i,F as a,Gg as o,Hg as s,Kg as c,N as l,P as u,QS as d,Qw as f,tT as p}from"./loadAgentsDir-DXOkUcW3.js";import{I as m,P as h,ai as g,di as _,fi as v,t as y}from"./src-DL3w8VPk2.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as x,h as S,rn as C}from"./state-D5D6QpTX.js";import{n as w,t as T}from"./AddWorkspaceDirectory-9FcHMKgX.js";function E({message:e,args:t,onDone:n}){return(0,O.useEffect)(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,k.jsxs)(m,{flexDirection:`column`,children:[(0,k.jsxs)(h,{dimColor:!0,children:[r.pointer,` /add-dir `,t]}),(0,k.jsx)(d,{children:(0,k.jsx)(h,{children:e})})]})}async function D(e,t,n){let r=(n??``).trim(),i=t.getAppState(),o=async(n,r=!1)=>{let i={type:`addDirectories`,directories:[n],destination:r?`localSettings`:`session`},a=s(t.getAppState().toolPermissionContext,i);t.setAppState(e=>({...e,toolPermissionContext:a}));let o=S();o.includes(n)||C([...o,n]),f.refreshConfig();let l;if(r)try{c(i),l=`Added ${_.bold(n)} as a working directory and saved to local settings`}catch(e){l=`Added ${_.bold(n)} as a working directory. Failed to save to local settings: ${e instanceof Error?e.message:`Unknown error`}`}else l=`Added ${_.bold(n)} as a working directory for this session`;e(`${l} ${_.dim(`· /permissions to manage`)}`)};if(!r)return(0,k.jsx)(T,{permissionContext:i.toolPermissionContext,onAddDirectory:o,onCancel:()=>{e(`Did not add a working directory.`)}});let u=await a(r,i.toolPermissionContext);if(u.resultType!==`success`){let t=l(u);return(0,k.jsx)(E,{message:t,args:n??``,onDone:()=>e(t)})}return(0,k.jsx)(T,{directoryPath:u.absolutePath,permissionContext:i.toolPermissionContext,onAddDirectory:o,onCancel:()=>{e(`Did not add ${_.bold(u.absolutePath)} as a working directory.`)}})}var O,k;e((()=>{v(),n(),O=t(g(),1),x(),i(),w(),y(),o(),p(),u(),k=b()}))();export{D as call};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$S as i,F as a,Gg as o,Hg as s,Kg as c,N as l,P as u,QS as d,Qw as f,tT as p}from"./loadAgentsDir-DaNpxaO-.js";import{I as m,P as h,ai as g,di as _,fi as v,t as y}from"./src-DL3w8VPk2.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as x,h as S,rn as C}from"./state-D5D6QpTX.js";import{n as w,t as T}from"./AddWorkspaceDirectory-BYNvxNrD.js";function E({message:e,args:t,onDone:n}){return(0,O.useEffect)(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,k.jsxs)(m,{flexDirection:`column`,children:[(0,k.jsxs)(h,{dimColor:!0,children:[r.pointer,` /add-dir `,t]}),(0,k.jsx)(d,{children:(0,k.jsx)(h,{children:e})})]})}async function D(e,t,n){let r=(n??``).trim(),i=t.getAppState(),o=async(n,r=!1)=>{let i={type:`addDirectories`,directories:[n],destination:r?`localSettings`:`session`},a=s(t.getAppState().toolPermissionContext,i);t.setAppState(e=>({...e,toolPermissionContext:a}));let o=S();o.includes(n)||C([...o,n]),f.refreshConfig();let l;if(r)try{c(i),l=`Added ${_.bold(n)} as a working directory and saved to local settings`}catch(e){l=`Added ${_.bold(n)} as a working directory. Failed to save to local settings: ${e instanceof Error?e.message:`Unknown error`}`}else l=`Added ${_.bold(n)} as a working directory for this session`;e(`${l} ${_.dim(`· /permissions to manage`)}`)};if(!r)return(0,k.jsx)(T,{permissionContext:i.toolPermissionContext,onAddDirectory:o,onCancel:()=>{e(`Did not add a working directory.`)}});let u=await a(r,i.toolPermissionContext);if(u.resultType!==`success`){let t=l(u);return(0,k.jsx)(E,{message:t,args:n??``,onDone:()=>e(t)})}return(0,k.jsx)(T,{directoryPath:u.absolutePath,permissionContext:i.toolPermissionContext,onAddDirectory:o,onCancel:()=>{e(`Did not add ${_.bold(u.absolutePath)} as a working directory.`)}})}var O,k;e((()=>{v(),n(),O=t(g(),1),x(),i(),w(),y(),o(),p(),u(),k=b()}))();export{D as call};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{em as t,tm as n}from"./loadAgentsDir-DXOkUcW3.js";import{cn as r,sn as i}from"./settings-3xZ0fsvE.js";function a(e,t){let n=new Map;for(let e of t)n.set(e.agentType,e);let r=new Set,i=[];for(let t of e){let e=`${t.agentType}:${t.source}`;if(r.has(e))continue;r.add(e);let a=n.get(t.agentType),o=a&&a.source!==t.source?a.source:void 0;i.push({...t,overriddenBy:o})}return i}function o(e){let n=e.model||t();if(n)return n===`inherit`?`inherit`:n}function s(e){return i(e).toLowerCase()}function c(e,t){return e.agentType.localeCompare(t.agentType,void 0,{sensitivity:`base`})}var l,u=e((()=>{n(),r(),l=[{label:`User agents`,source:`userSettings`},{label:`Project agents`,source:`projectSettings`},{label:`Local agents`,source:`localSettings`},{label:`Managed agents`,source:`policySettings`},{label:`Plugin agents`,source:`plugin`},{label:`CLI arg agents`,source:`flagSettings`},{label:`Built-in agents`,source:`built-in`}]}));export{o as a,u as i,c as n,a as o,s as r,l as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{em as t,tm as n}from"./loadAgentsDir-DaNpxaO-.js";import{cn as r,sn as i}from"./settings-3xZ0fsvE.js";function a(e,t){let n=new Map;for(let e of t)n.set(e.agentType,e);let r=new Set,i=[];for(let t of e){let e=`${t.agentType}:${t.source}`;if(r.has(e))continue;r.add(e);let a=n.get(t.agentType),o=a&&a.source!==t.source?a.source:void 0;i.push({...t,overriddenBy:o})}return i}function o(e){let n=e.model||t();if(n)return n===`inherit`?`inherit`:n}function s(e){return i(e).toLowerCase()}function c(e,t){return e.agentType.localeCompare(t.agentType,void 0,{sensitivity:`base`})}var l,u=e((()=>{n(),r(),l=[{label:`User agents`,source:`userSettings`},{label:`Project agents`,source:`projectSettings`},{label:`Local agents`,source:`localSettings`},{label:`Managed agents`,source:`policySettings`},{label:`Plugin agents`,source:`plugin`},{label:`CLI arg agents`,source:`flagSettings`},{label:`Built-in agents`,source:`built-in`}]}));export{o as a,u as i,c as n,a as o,s as r,l as t};
@@ -1,2 +1,2 @@
1
- import{i as e,o as t,r as n}from"./loadAgentsDir-DXOkUcW3.js";import{n as r,t as i}from"./cwd-Nh5IZNKO.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./agentDisplay-D01ZlnVX.js";o(),t(),r();function d(e){let t=a(e),n=[e.agentType];return t&&n.push(t),e.memory&&n.push(`${e.memory} memory`),n.join(` · `)}async function f(){let{allAgents:t}=await e(i()),r=c(t,n(t)),a=[],o=0;for(let{label:e,source:t}of u){let n=r.filter(e=>e.source===t).sort(s);if(n.length!==0){a.push(`${e}:`);for(let e of n)if(e.overriddenBy){let t=l(e.overriddenBy);a.push(` (shadowed by ${t}) ${d(e)}`)}else a.push(` ${d(e)}`),o++;a.push(``)}}a.length===0?console.log(`No agents found.`):(console.log(`${o} active agents\n`),console.log(a.join(`
1
+ import{i as e,o as t,r as n}from"./loadAgentsDir-DaNpxaO-.js";import{n as r,t as i}from"./cwd-Nh5IZNKO.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./agentDisplay-BM4QG_RX.js";o(),t(),r();function d(e){let t=a(e),n=[e.agentType];return t&&n.push(t),e.memory&&n.push(`${e.memory} memory`),n.join(` · `)}async function f(){let{allAgents:t}=await e(i()),r=c(t,n(t)),a=[],o=0;for(let{label:e,source:t}of u){let n=r.filter(e=>e.source===t).sort(s);if(n.length!==0){a.push(`${e}:`);for(let e of n)if(e.overriddenBy){let t=l(e.overriddenBy);a.push(` (shadowed by ${t}) ${d(e)}`)}else a.push(` ${d(e)}`),o++;a.push(``)}}a.length===0?console.log(`No agents found.`):(console.log(`${o} active agents\n`),console.log(a.join(`
2
2
  `).trimEnd()))}export{f as agentsHandler};
@@ -1,4 +1,4 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$h as o,$m as s,$p as c,$u as l,CT as u,Dp as d,Fb as f,Gl as p,Gp as m,Hp as h,Ib as g,JS as _,J_ as v,Jf as ee,Jp as y,Ka as b,Kc as te,Kl as ne,Kp as re,La as ie,Lb as ae,Mu as oe,Op as x,Pb as se,Pu as ce,Q as le,Ql as ue,Qm as de,Qp as fe,Qu as pe,ST as me,Sa as he,Sp as ge,Um as _e,Up as ve,Vp as ye,Wl as be,Wm as xe,Wp as Se,X as Ce,Xf as we,Xh as Te,YS as Ee,Y_ as De,Yf as Oe,Zh as ke,Zl as Ae,ah as je,by as Me,c as Ne,cd as Pe,dh as Fe,fh as Ie,iS as Le,ih as Re,l as ze,ld as Be,nE as Ve,o as He,oh as Ue,qc as We,qf as Ge,ql as Ke,qp as qe,r as Je,rE as Ye,rS as Xe,rt as Ze,s as Qe,sh as $e,t as et,tE as tt,tm as nt,tt as rt,uC as S,vx as it,wp as at,yx as ot}from"./loadAgentsDir-DXOkUcW3.js";import{C as st,D as C,I as w,P as T,T as E,Wt as D,ai as O,di as ct,fi as lt,t as k,y as ut}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{n as dt,t as ft}from"./cwd-Nh5IZNKO.js";import{F as pt,R as mt,S as ht,U as gt,W as _t,Z as vt,x as yt}from"./debug-D58GQBDG.js";import{In as bt,Ln as xt,Yt as St,Z as Ct,Zt as wt,cn as Tt,it as Et,on as Dt,q as Ot,rt as kt}from"./settings-3xZ0fsvE.js";import{M as At,P as jt}from"./config-DRy1I12M.js";import{o as Mt,s as Nt}from"./log-CZ7ploQm.js";import{n as Pt,r as Ft}from"./analytics-DJobLaWP.js";import{C as It,v as Lt}from"./startupProfiler-CbzxVmbv.js";import{l as Rt,n as zt,o as Bt}from"./stringUtils-CKD8qDqx.js";import{_n as Vt,vn as Ht}from"./prompt-DEioJrx_.js";import{Q as Ut}from"./sessionState-DAcub-HK.js";import{a as Wt,i as Gt,n as Kt,o as qt,r as Jt,t as Yt}from"./agentDisplay-D01ZlnVX.js";import{n as Xt,t as Zt}from"./useExitOnCtrlCDWithKeybindings-D0uqGxGw.js";import{n as Qt,t as $t}from"./useMergedTools-rQ19rFvH.js";import{n as en,r as tn,t as nn}from"./promptEditor-eJzbtNn4.js";import{n as rn,t as an}from"./useMainLoopModel-BGPOmBkl.js";import{join as j}from"path";import{mkdir as on,open as sn,unlink as cn}from"fs/promises";var M,ln=e((()=>{M={FOLDER_NAME:`.workmate`,AGENTS_DIR:`agents`}}));function un(e,t,n,r,i,a,o){return`---
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$h as o,$m as s,$p as c,$u as l,CT as u,Dp as d,Fb as f,Gl as p,Gp as m,Hp as h,Ib as g,JS as _,J_ as v,Jf as ee,Jp as y,Ka as b,Kc as te,Kl as ne,Kp as re,La as ie,Lb as ae,Mu as oe,Op as x,Pb as se,Pu as ce,Q as le,Ql as ue,Qm as de,Qp as fe,Qu as pe,ST as me,Sa as he,Sp as ge,Um as _e,Up as ve,Vp as ye,Wl as be,Wm as xe,Wp as Se,X as Ce,Xf as we,Xh as Te,YS as Ee,Y_ as De,Yf as Oe,Zh as ke,Zl as Ae,ah as je,by as Me,c as Ne,cd as Pe,dh as Fe,fh as Ie,iS as Le,ih as Re,l as ze,ld as Be,nE as Ve,o as He,oh as Ue,qc as We,qf as Ge,ql as Ke,qp as qe,r as Je,rE as Ye,rS as Xe,rt as Ze,s as Qe,sh as $e,t as et,tE as tt,tm as nt,tt as rt,uC as S,vx as it,wp as at,yx as ot}from"./loadAgentsDir-DaNpxaO-.js";import{C as st,D as C,I as w,P as T,T as E,Wt as D,ai as O,di as ct,fi as lt,t as k,y as ut}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{n as dt,t as ft}from"./cwd-Nh5IZNKO.js";import{F as pt,R as mt,S as ht,U as gt,W as _t,Z as vt,x as yt}from"./debug-D58GQBDG.js";import{In as bt,Ln as xt,Yt as St,Z as Ct,Zt as wt,cn as Tt,it as Et,on as Dt,q as Ot,rt as kt}from"./settings-3xZ0fsvE.js";import{M as At,P as jt}from"./config-DRy1I12M.js";import{o as Mt,s as Nt}from"./log-CZ7ploQm.js";import{n as Pt,r as Ft}from"./analytics-DJobLaWP.js";import{C as It,v as Lt}from"./startupProfiler-CbzxVmbv.js";import{l as Rt,n as zt,o as Bt}from"./stringUtils-CKD8qDqx.js";import{_n as Vt,vn as Ht}from"./prompt-8u06WVES.js";import{Q as Ut}from"./sessionState-CQhbGfmh.js";import{a as Wt,i as Gt,n as Kt,o as qt,r as Jt,t as Yt}from"./agentDisplay-BM4QG_RX.js";import{n as Xt,t as Zt}from"./useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js";import{n as Qt,t as $t}from"./useMergedTools-Bb-INJa2.js";import{n as en,r as tn,t as nn}from"./promptEditor-Cr4w-4Bz.js";import{n as rn,t as an}from"./useMainLoopModel-CIG2cjS2.js";import{join as j}from"path";import{mkdir as on,open as sn,unlink as cn}from"fs/promises";var M,ln=e((()=>{M={FOLDER_NAME:`.workmate`,AGENTS_DIR:`agents`}}));function un(e,t,n,r,i,a,o){return`---
2
2
  name: ${e}
3
3
  description: "${t.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\\\n`)}"${n===void 0||n.length===1&&n[0]===`*`?``:`\ntools: ${n.join(`, `)}`}${a?`\nmodel: ${a}`:``}${i?`\ncolor: ${i}`:``}${o?`\nmemory: ${o}`:``}
4
4
  ---
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ox as t,jx as n}from"./loadAgentsDir-DXOkUcW3.js";import{h as r,l as i}from"./settings-3xZ0fsvE.js";function a(){let e=i(),n=[`user`,`project`,`local`].flatMap(e=>t(e).errors);return{settings:e.settings,errors:[...e.errors,...n]}}var o=e((()=>{n(),r()}));export{o as n,a as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ox as t,jx as n}from"./loadAgentsDir-DaNpxaO-.js";import{h as r,l as i}from"./settings-3xZ0fsvE.js";function a(){let e=i(),n=[`user`,`project`,`local`].flatMap(e=>t(e).errors);return{settings:e.settings,errors:[...e.errors,...n]}}var o=e((()=>{n(),r()}));export{o as n,a as t};
@@ -0,0 +1 @@
1
+ import{a as e,o as t}from"./api-DyUWfg3a.js";t();export{e as getOAuthHeaders};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{i as r,n as i,r as a,t as o}from"./lazySchema-DULtBUCI.js";import{C as s,P as c,R as l,U as u,c as d,i as f,x as p}from"./debug-D58GQBDG.js";import{h as m}from"./config-DRy1I12M.js";import{o as h,s as g}from"./log-CZ7ploQm.js";import{l as _,u as v}from"./oauth-D38aRTUb.js";import{Dr as y,Or as b,Pt as x,St as S,dn as C,fn as w}from"./model-Cxx3suBa.js";import{a as T,i as E}from"./detectRepository-CDOJ-M7h.js";import{randomUUID as D}from"crypto";function O(e){return t.isAxiosError(e)?!e.response||e.response.status>=500:!1}async function k(e,n){let r;for(let i=0;i<=R;i++)try{return await t.get(e,n)}catch(e){if(r=e,!O(e))throw e;if(i>=R)throw d(`Teleport request failed after ${i+1} attempts: ${c(e)}`),e;let t=L[i]??2e3;d(`Teleport request failed (attempt ${i+1}/${R+1}), retrying in ${t}ms: ${c(e)}`),await w(t)}throw r}async function A(){let e=S()?.accessToken;if(e===void 0)throw Error(`Work Mate web sessions require authentication with a Claude.ai account. API key authentication is not sufficient.`);let t=await y();if(!t)throw Error(`Unable to get organization UUID`);return{accessToken:e,orgUUID:t}}async function j(){let{accessToken:e,orgUUID:t}=await A(),n=`${_().BASE_API_URL}/v1/sessions`;try{let r=await k(n,{headers:{...M(e),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":t}});if(r.status!==200)throw Error(`Failed to fetch code sessions: ${r.statusText}`);return r.data.data.map(e=>{let t=e.session_context.sources.find(e=>e.type===`git_repository`),n=null;if(t?.url){let e=T(t.url);if(e){let[r,i]=e.split(`/`);r&&i&&(n={name:i,owner:{login:r},default_branch:t.revision||void 0})}}return{id:e.id,title:e.title||`Untitled`,description:``,status:e.session_status,repo:n,turns:[],created_at:e.created_at,updated_at:e.updated_at}})}catch(e){throw g(u(e)),e}}function M(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`}}async function N(e){let{accessToken:n,orgUUID:r}=await A(),i=`${_().BASE_API_URL}/v1/sessions/${e}`,a={...M(n),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":r},o=await t.get(i,{headers:a,timeout:15e3,validateStatus:e=>e<500});if(o.status!==200){let t=o.data?.error?.message;throw o.status===404?Error(`Session not found: ${e}`):o.status===401?Error(`Session expired.`):Error(t||`Failed to fetch session: ${o.status} ${o.statusText}`)}return o.data}function P(e){return(e.session_context.outcomes?.find(e=>e.type===`git_repository`))?.git_info?.branches[0]}async function F(e,n,r){try{let{accessToken:i,orgUUID:a}=await A(),o=`${_().BASE_API_URL}/v1/sessions/${e}/events`,c={...M(i),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":a},l={events:[{uuid:r?.uuid??D(),session_id:e,type:`user`,parent_tool_use_id:null,message:{role:`user`,content:n}}]};d(`[sendEventToRemoteSession] Sending event to session ${e}`);let u=await t.post(o,l,{headers:c,validateStatus:e=>e<500,timeout:3e4});return u.status===200||u.status===201?(d(`[sendEventToRemoteSession] Successfully sent event to session ${e}`),!0):(d(`[sendEventToRemoteSession] Failed with status ${u.status}: ${s(u.data)}`),!1)}catch(e){return d(`[sendEventToRemoteSession] Error: ${c(e)}`),!1}}async function I(e,n){try{let{accessToken:r,orgUUID:i}=await A(),a=`${_().BASE_API_URL}/v1/sessions/${e}`,o={...M(r),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":i};d(`[updateSessionTitle] Updating title for session ${e}: "${n}"`);let c=await t.patch(a,{title:n},{headers:o,validateStatus:e=>e<500});return c.status===200?(d(`[updateSessionTitle] Successfully updated title for session ${e}`),!0):(d(`[updateSessionTitle] Failed with status ${c.status}: ${s(c.data)}`),!1)}catch(e){return d(`[updateSessionTitle] Error: ${c(e)}`),!1}}var L,R,z=e((()=>{n(),v(),b(),a(),x(),m(),f(),E(),l(),o(),h(),C(),p(),L=[2e3,4e3,8e3,16e3],R=L.length,i(()=>r.object({id:r.string(),title:r.string(),description:r.string(),status:r.enum([`idle`,`working`,`waiting`,`completed`,`archived`,`cancelled`,`rejected`]),repo:r.object({name:r.string(),owner:r.object({login:r.string()}),default_branch:r.string().optional()}).nullable(),turns:r.array(r.string()),created_at:r.string(),updated_at:r.string()}))}));export{M as a,A as c,P as i,F as l,j as n,z as o,N as r,O as s,k as t,I as u};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{i as r,n as i,r as a,t as o}from"./lazySchema-DULtBUCI.js";import{C as s,P as c,R as l,U as u,c as d,i as f,x as p}from"./debug-D58GQBDG.js";import{h as m}from"./config-DRy1I12M.js";import{o as h,s as g}from"./log-CZ7ploQm.js";import{l as _,u as v}from"./oauth-D38aRTUb.js";import{Dr as y,Or as b,Pt as x,St as S,dn as C,fn as w}from"./model-Do0f476p.js";import{a as T,i as E}from"./detectRepository-CDOJ-M7h.js";import{randomUUID as D}from"crypto";function O(e){return t.isAxiosError(e)?!e.response||e.response.status>=500:!1}async function k(e,n){let r;for(let i=0;i<=R;i++)try{return await t.get(e,n)}catch(e){if(r=e,!O(e))throw e;if(i>=R)throw d(`Teleport request failed after ${i+1} attempts: ${c(e)}`),e;let t=L[i]??2e3;d(`Teleport request failed (attempt ${i+1}/${R+1}), retrying in ${t}ms: ${c(e)}`),await w(t)}throw r}async function A(){let e=S()?.accessToken;if(e===void 0)throw Error(`Work Mate web sessions require authentication with a Claude.ai account. API key authentication is not sufficient.`);let t=await y();if(!t)throw Error(`Unable to get organization UUID`);return{accessToken:e,orgUUID:t}}async function j(){let{accessToken:e,orgUUID:t}=await A(),n=`${_().BASE_API_URL}/v1/sessions`;try{let r=await k(n,{headers:{...M(e),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":t}});if(r.status!==200)throw Error(`Failed to fetch code sessions: ${r.statusText}`);return r.data.data.map(e=>{let t=e.session_context.sources.find(e=>e.type===`git_repository`),n=null;if(t?.url){let e=T(t.url);if(e){let[r,i]=e.split(`/`);r&&i&&(n={name:i,owner:{login:r},default_branch:t.revision||void 0})}}return{id:e.id,title:e.title||`Untitled`,description:``,status:e.session_status,repo:n,turns:[],created_at:e.created_at,updated_at:e.updated_at}})}catch(e){throw g(u(e)),e}}function M(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`}}async function N(e){let{accessToken:n,orgUUID:r}=await A(),i=`${_().BASE_API_URL}/v1/sessions/${e}`,a={...M(n),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":r},o=await t.get(i,{headers:a,timeout:15e3,validateStatus:e=>e<500});if(o.status!==200){let t=o.data?.error?.message;throw o.status===404?Error(`Session not found: ${e}`):o.status===401?Error(`Session expired.`):Error(t||`Failed to fetch session: ${o.status} ${o.statusText}`)}return o.data}function P(e){return(e.session_context.outcomes?.find(e=>e.type===`git_repository`))?.git_info?.branches[0]}async function F(e,n,r){try{let{accessToken:i,orgUUID:a}=await A(),o=`${_().BASE_API_URL}/v1/sessions/${e}/events`,c={...M(i),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":a},l={events:[{uuid:r?.uuid??D(),session_id:e,type:`user`,parent_tool_use_id:null,message:{role:`user`,content:n}}]};d(`[sendEventToRemoteSession] Sending event to session ${e}`);let u=await t.post(o,l,{headers:c,validateStatus:e=>e<500,timeout:3e4});return u.status===200||u.status===201?(d(`[sendEventToRemoteSession] Successfully sent event to session ${e}`),!0):(d(`[sendEventToRemoteSession] Failed with status ${u.status}: ${s(u.data)}`),!1)}catch(e){return d(`[sendEventToRemoteSession] Error: ${c(e)}`),!1}}async function I(e,n){try{let{accessToken:r,orgUUID:i}=await A(),a=`${_().BASE_API_URL}/v1/sessions/${e}`,o={...M(r),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":i};d(`[updateSessionTitle] Updating title for session ${e}: "${n}"`);let c=await t.patch(a,{title:n},{headers:o,validateStatus:e=>e<500});return c.status===200?(d(`[updateSessionTitle] Successfully updated title for session ${e}`),!0):(d(`[updateSessionTitle] Failed with status ${c.status}: ${s(c.data)}`),!1)}catch(e){return d(`[updateSessionTitle] Error: ${c(e)}`),!1}}var L,R,z=e((()=>{n(),v(),b(),a(),x(),m(),f(),E(),l(),o(),h(),C(),p(),L=[2e3,4e3,8e3,16e3],R=L.length,i(()=>r.object({id:r.string(),title:r.string(),description:r.string(),status:r.enum([`idle`,`working`,`waiting`,`completed`,`archived`,`cancelled`,`rejected`]),repo:r.object({name:r.string(),owner:r.object({login:r.string()}),default_branch:r.string().optional()}).nullable(),turns:r.array(r.string()),created_at:r.string(),updated_at:r.string()}))}));export{M as a,A as c,P as i,F as l,j as n,z as o,N as r,O as s,k as t,I as u};
@@ -1,4 +1,4 @@
1
- import{d as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{eS as o,nf as s,rf as c,tS as l}from"./loadAgentsDir-DXOkUcW3.js";import{C as ee,P as u,R as te,c as d,i as ne,x as f}from"./debug-D58GQBDG.js";import{h as p,t as m}from"./settings-3xZ0fsvE.js";import{c as h,h as g,y as _}from"./config-DRy1I12M.js";import{o as v,s as y}from"./log-CZ7ploQm.js";import{n as b,r as x}from"./analytics-DJobLaWP.js";import{l as S,u as C}from"./oauth-D38aRTUb.js";import{$r as re,Ar as w,Cr as ie,Er as ae,Ir as oe,Lr as se,Mr as ce,Nr as T,Or as E,Pr as D,Pt as O,Sr as k,St as A,Tn as j,Tr as M,Tt as N,Xn as P,Xt as F,_n as I,bn as L,cn as R,gn as z,gt as B,in as V,kt as H,on as U,pt as W,qn as G,sn as K,ti as le,un as ue,wr as de,xt as fe}from"./model-Cxx3suBa.js";import{n as pe,t as me}from"./userAgent-CJ5Rp9kc.js";import{F as q,T as he}from"./sessionState-DAcub-HK.js";import{d as ge,u as _e}from"./firstPartyEventLogger-CxUuXQhL.js";import{n as ve}from"./trustedDevice-Bb7O8_tj.js";import{i as ye,r as be}from"./grove--HtQL4QZ.js";import{t as xe}from"./remoteManagedSettings-6RAHPt_g.js";import{d as Se,n as Ce,t as we}from"./status-CGp4uRlH.js";import{createHash as Te,randomBytes as J}from"crypto";import{createServer as Ee}from"http";c(),O(),j(),g(),I(),ue(),_e();async function Y(){A.cache?.clear?.(),ve(),L(),R(),ge(),be.cache?.clear?.(),ye.cache?.clear?.(),await xe(),await s()}async function De({clearOnboarding:e=!1}){let{flushTelemetry:t}=await import(`./instrumentation-DpgB3GFx.js`);await t(),await V(),z().delete(),await Y(),_(t=>{let n={...t};return e&&(n.hasCompletedOnboarding=!1,n.subscriptionNoticeCount=0,n.hasAvailableSubscription=!1,n.customApiKeyResponses?.approved&&(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]})),n.oauthAccount=void 0,n})}t(),n(),te(),f(),ne(),b(),p(),le(),se(),E(),he(),a(),C(),g(),P(),v(),pe();async function Oe(){try{if(h().claudeCodeFirstTokenDate!==void 0)return;let e=G();if(e.error){y(Error(`Failed to get auth headers: ${e.error}`));return}let t=`${S().BASE_API_URL}/api/organization/claude_code_first_token_date`,n=(await i.get(t,{headers:{...e.headers,"User-Agent":me()},timeout:1e4})).data?.first_token_date??null;if(n!==null){let e=new Date(n).getTime();if(isNaN(e)){y(Error(`Received invalid first_token_date from API: ${n}`));return}}_(e=>({...e,claudeCodeFirstTokenDate:n}))}catch(e){y(e)}}o(),C(),v();var ke=class{constructor(e=`/callback`){r(this,`localServer`,void 0),r(this,`port`,0),r(this,`promiseResolver`,null),r(this,`promiseRejecter`,null),r(this,`expectedState`,null),r(this,`pendingResponse`,null),r(this,`callbackPath`,void 0),this.localServer=Ee(),this.callbackPath=e}async start(e){return new Promise((t,n)=>{this.localServer.once(`error`,e=>{n(Error(`Failed to start OAuth callback server: ${e.message}`))}),this.localServer.listen(e??0,`localhost`,()=>{let e=this.localServer.address();this.port=e.port,t(this.port)})})}getPort(){return this.port}hasPendingResponse(){return this.pendingResponse!==null}async waitForAuthorization(e,t){return new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r,this.expectedState=e,this.startLocalListener(t)})}handleSuccessRedirect(e,t){if(!this.pendingResponse)return;if(t){t(this.pendingResponse,e),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{custom_handler:!0});return}let n=T(e)?S().CLAUDEAI_SUCCESS_URL:S().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:n}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{})}handleErrorRedirect(){if(!this.pendingResponse)return;let e=S().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:e}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect_error`,{})}startLocalListener(e){this.localServer.on(`request`,this.handleRedirect.bind(this)),this.localServer.on(`error`,this.handleError.bind(this)),e()}handleRedirect(e,t){let n=new URL(e.url||``,`http://${e.headers.host||`localhost`}`);if(n.pathname!==this.callbackPath){t.writeHead(404),t.end();return}let r=n.searchParams.get(`code`)??void 0,i=n.searchParams.get(`state`)??void 0;this.validateAndRespond(r,i,t)}validateAndRespond(e,t,n){if(!e){n.writeHead(400),n.end(`Authorization code not found`),this.reject(Error(`No authorization code received`));return}if(t!==this.expectedState){n.writeHead(400),n.end(`Invalid state parameter`),this.reject(Error(`Invalid state parameter`));return}this.pendingResponse=n,this.resolve(e)}handleError(e){y(e),this.close(),this.reject(e)}resolve(e){this.promiseResolver&&(this.promiseResolver(e),this.promiseResolver=null,this.promiseRejecter=null)}reject(e){this.promiseRejecter&&(this.promiseRejecter(e),this.promiseResolver=null,this.promiseRejecter=null)}close(){this.pendingResponse&&this.handleErrorRedirect(),this.localServer&&(this.localServer.removeAllListeners(),this.localServer.close())}};function X(e){return e.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Z(){return X(J(32))}function Ae(e){let t=Te(`sha256`);return t.update(e),X(t.digest())}function je(){return X(J(32))}b(),E(),n();var Q=class{constructor(){r(this,`codeVerifier`,void 0),r(this,`authCodeListener`,null),r(this,`port`,null),r(this,`manualAuthCodeResolver`,null),this.codeVerifier=Z()}async startOAuthFlow(e,t){this.authCodeListener=new ke,this.port=await this.authCodeListener.start();let n=Ae(this.codeVerifier),r=je(),i={codeChallenge:n,state:r,port:this.port,loginWithClaudeAi:t?.loginWithClaudeAi,inferenceOnly:t?.inferenceOnly,orgUUID:t?.orgUUID,loginHint:t?.loginHint,loginMethod:t?.loginMethod},a=k({...i,isManual:!0}),o=k({...i,isManual:!1}),s=await this.waitForAuthorizationCode(r,async()=>{t?.skipBrowserOpen?await e(a,o):(await e(a),await l(o))}),c=this.authCodeListener?.hasPendingResponse()??!1;x(`tengu_oauth_auth_code_received`,{automatic:c});try{let e=await de(s,r,this.codeVerifier,this.port,!c,t?.expiresIn),n=await ae(e.access_token);if(c){let t=w(e.scope);this.authCodeListener?.handleSuccessRedirect(t)}return this.formatTokens(e,n.subscriptionType,n.rateLimitTier,n.rawProfile)}catch(e){throw c&&this.authCodeListener?.handleErrorRedirect(),e}finally{this.authCodeListener?.close()}}async waitForAuthorizationCode(e,t){return new Promise((n,r)=>{this.manualAuthCodeResolver=n,this.authCodeListener?.waitForAuthorization(e,t).then(e=>{this.manualAuthCodeResolver=null,n(e)}).catch(e=>{this.manualAuthCodeResolver=null,r(e)})})}handleManualAuthCodeInput(e){this.manualAuthCodeResolver&&(this.manualAuthCodeResolver(e.authorizationCode),this.manualAuthCodeResolver=null,this.authCodeListener?.close())}formatTokens(e,t,n,r){return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:Date.now()+e.expires_in*1e3,scopes:w(e.scope),subscriptionType:t,rateLimitTier:n,profile:r,tokenAccount:e.account?{uuid:e.account.uuid,emailAddress:e.account.email_address,organizationUuid:e.organization?.uuid}:void 0}}cleanup(){this.authCodeListener?.close(),this.manualAuthCodeResolver=null}};b(),E(),O(),g(),v(),Se();async function $(e){await De({clearOnboarding:!1});let t=e.profile??await oe(e.accessToken);t?D({accountUuid:t.account.uuid,emailAddress:t.account.email,organizationUuid:t.organization.uuid,displayName:t.account.display_name||void 0,hasExtraUsageEnabled:t.organization.has_extra_usage_enabled??void 0,billingType:t.organization.billing_type??void 0,subscriptionCreatedAt:t.organization.subscription_created_at??void 0,accountCreatedAt:t.account.created_at}):e.tokenAccount&&D({accountUuid:e.tokenAccount.uuid,emailAddress:e.tokenAccount.emailAddress,organizationUuid:e.tokenAccount.organizationUuid});let n=U(e);if(W(),n.warning&&x(`tengu_oauth_storage_warning`,{warning:n.warning}),await M(e.accessToken).catch(e=>d(String(e),{level:`error`})),T(e.scopes))await Oe().catch(e=>d(String(e),{level:`error`}));else if(!await ie(e.accessToken))throw Error(`Unable to create API key. The server accepted the request but did not return a key.`);await Y()}async function Me({email:e,sso:t,console:n,claudeai:r}){n&&r&&(process.stderr.write(`Error: --console and --claudeai cannot be used together.
1
+ import{d as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{eS as o,nf as s,rf as c,tS as l}from"./loadAgentsDir-DaNpxaO-.js";import{C as ee,P as u,R as te,c as d,i as ne,x as f}from"./debug-D58GQBDG.js";import{h as p,t as m}from"./settings-3xZ0fsvE.js";import{c as h,h as g,y as _}from"./config-DRy1I12M.js";import{o as v,s as y}from"./log-CZ7ploQm.js";import{n as b,r as x}from"./analytics-DJobLaWP.js";import{l as S,u as C}from"./oauth-D38aRTUb.js";import{$r as re,Ar as w,Cr as ie,Er as ae,Ir as oe,Lr as se,Mr as ce,Nr as T,Or as E,Pr as D,Pt as O,Sr as k,St as A,Tn as j,Tr as M,Tt as N,Xn as P,Xt as F,_n as I,bn as L,cn as R,gn as z,gt as B,in as V,kt as H,on as U,pt as W,qn as G,sn as K,ti as le,un as ue,wr as de,xt as fe}from"./model-Do0f476p.js";import{n as pe,t as me}from"./userAgent-i-oGzf40.js";import{F as q,T as he}from"./sessionState-CQhbGfmh.js";import{d as ge,u as _e}from"./firstPartyEventLogger-DqGSujCz.js";import{n as ve}from"./trustedDevice-CB6rNzl-.js";import{i as ye,r as be}from"./grove-CYE1Cfcz.js";import{t as xe}from"./remoteManagedSettings-BoOYHzYP.js";import{d as Se,n as Ce,t as we}from"./status-CFrLuGbf.js";import{createHash as Te,randomBytes as J}from"crypto";import{createServer as Ee}from"http";c(),O(),j(),g(),I(),ue(),_e();async function Y(){A.cache?.clear?.(),ve(),L(),R(),ge(),be.cache?.clear?.(),ye.cache?.clear?.(),await xe(),await s()}async function De({clearOnboarding:e=!1}){let{flushTelemetry:t}=await import(`./instrumentation-2HH15DPu.js`);await t(),await V(),z().delete(),await Y(),_(t=>{let n={...t};return e&&(n.hasCompletedOnboarding=!1,n.subscriptionNoticeCount=0,n.hasAvailableSubscription=!1,n.customApiKeyResponses?.approved&&(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]})),n.oauthAccount=void 0,n})}t(),n(),te(),f(),ne(),b(),p(),le(),se(),E(),he(),a(),C(),g(),P(),v(),pe();async function Oe(){try{if(h().claudeCodeFirstTokenDate!==void 0)return;let e=G();if(e.error){y(Error(`Failed to get auth headers: ${e.error}`));return}let t=`${S().BASE_API_URL}/api/organization/claude_code_first_token_date`,n=(await i.get(t,{headers:{...e.headers,"User-Agent":me()},timeout:1e4})).data?.first_token_date??null;if(n!==null){let e=new Date(n).getTime();if(isNaN(e)){y(Error(`Received invalid first_token_date from API: ${n}`));return}}_(e=>({...e,claudeCodeFirstTokenDate:n}))}catch(e){y(e)}}o(),C(),v();var ke=class{constructor(e=`/callback`){r(this,`localServer`,void 0),r(this,`port`,0),r(this,`promiseResolver`,null),r(this,`promiseRejecter`,null),r(this,`expectedState`,null),r(this,`pendingResponse`,null),r(this,`callbackPath`,void 0),this.localServer=Ee(),this.callbackPath=e}async start(e){return new Promise((t,n)=>{this.localServer.once(`error`,e=>{n(Error(`Failed to start OAuth callback server: ${e.message}`))}),this.localServer.listen(e??0,`localhost`,()=>{let e=this.localServer.address();this.port=e.port,t(this.port)})})}getPort(){return this.port}hasPendingResponse(){return this.pendingResponse!==null}async waitForAuthorization(e,t){return new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r,this.expectedState=e,this.startLocalListener(t)})}handleSuccessRedirect(e,t){if(!this.pendingResponse)return;if(t){t(this.pendingResponse,e),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{custom_handler:!0});return}let n=T(e)?S().CLAUDEAI_SUCCESS_URL:S().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:n}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{})}handleErrorRedirect(){if(!this.pendingResponse)return;let e=S().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:e}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect_error`,{})}startLocalListener(e){this.localServer.on(`request`,this.handleRedirect.bind(this)),this.localServer.on(`error`,this.handleError.bind(this)),e()}handleRedirect(e,t){let n=new URL(e.url||``,`http://${e.headers.host||`localhost`}`);if(n.pathname!==this.callbackPath){t.writeHead(404),t.end();return}let r=n.searchParams.get(`code`)??void 0,i=n.searchParams.get(`state`)??void 0;this.validateAndRespond(r,i,t)}validateAndRespond(e,t,n){if(!e){n.writeHead(400),n.end(`Authorization code not found`),this.reject(Error(`No authorization code received`));return}if(t!==this.expectedState){n.writeHead(400),n.end(`Invalid state parameter`),this.reject(Error(`Invalid state parameter`));return}this.pendingResponse=n,this.resolve(e)}handleError(e){y(e),this.close(),this.reject(e)}resolve(e){this.promiseResolver&&(this.promiseResolver(e),this.promiseResolver=null,this.promiseRejecter=null)}reject(e){this.promiseRejecter&&(this.promiseRejecter(e),this.promiseResolver=null,this.promiseRejecter=null)}close(){this.pendingResponse&&this.handleErrorRedirect(),this.localServer&&(this.localServer.removeAllListeners(),this.localServer.close())}};function X(e){return e.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Z(){return X(J(32))}function Ae(e){let t=Te(`sha256`);return t.update(e),X(t.digest())}function je(){return X(J(32))}b(),E(),n();var Q=class{constructor(){r(this,`codeVerifier`,void 0),r(this,`authCodeListener`,null),r(this,`port`,null),r(this,`manualAuthCodeResolver`,null),this.codeVerifier=Z()}async startOAuthFlow(e,t){this.authCodeListener=new ke,this.port=await this.authCodeListener.start();let n=Ae(this.codeVerifier),r=je(),i={codeChallenge:n,state:r,port:this.port,loginWithClaudeAi:t?.loginWithClaudeAi,inferenceOnly:t?.inferenceOnly,orgUUID:t?.orgUUID,loginHint:t?.loginHint,loginMethod:t?.loginMethod},a=k({...i,isManual:!0}),o=k({...i,isManual:!1}),s=await this.waitForAuthorizationCode(r,async()=>{t?.skipBrowserOpen?await e(a,o):(await e(a),await l(o))}),c=this.authCodeListener?.hasPendingResponse()??!1;x(`tengu_oauth_auth_code_received`,{automatic:c});try{let e=await de(s,r,this.codeVerifier,this.port,!c,t?.expiresIn),n=await ae(e.access_token);if(c){let t=w(e.scope);this.authCodeListener?.handleSuccessRedirect(t)}return this.formatTokens(e,n.subscriptionType,n.rateLimitTier,n.rawProfile)}catch(e){throw c&&this.authCodeListener?.handleErrorRedirect(),e}finally{this.authCodeListener?.close()}}async waitForAuthorizationCode(e,t){return new Promise((n,r)=>{this.manualAuthCodeResolver=n,this.authCodeListener?.waitForAuthorization(e,t).then(e=>{this.manualAuthCodeResolver=null,n(e)}).catch(e=>{this.manualAuthCodeResolver=null,r(e)})})}handleManualAuthCodeInput(e){this.manualAuthCodeResolver&&(this.manualAuthCodeResolver(e.authorizationCode),this.manualAuthCodeResolver=null,this.authCodeListener?.close())}formatTokens(e,t,n,r){return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:Date.now()+e.expires_in*1e3,scopes:w(e.scope),subscriptionType:t,rateLimitTier:n,profile:r,tokenAccount:e.account?{uuid:e.account.uuid,emailAddress:e.account.email_address,organizationUuid:e.organization?.uuid}:void 0}}cleanup(){this.authCodeListener?.close(),this.manualAuthCodeResolver=null}};b(),E(),O(),g(),v(),Se();async function $(e){await De({clearOnboarding:!1});let t=e.profile??await oe(e.accessToken);t?D({accountUuid:t.account.uuid,emailAddress:t.account.email,organizationUuid:t.organization.uuid,displayName:t.account.display_name||void 0,hasExtraUsageEnabled:t.organization.has_extra_usage_enabled??void 0,billingType:t.organization.billing_type??void 0,subscriptionCreatedAt:t.organization.subscription_created_at??void 0,accountCreatedAt:t.account.created_at}):e.tokenAccount&&D({accountUuid:e.tokenAccount.uuid,emailAddress:e.tokenAccount.emailAddress,organizationUuid:e.tokenAccount.organizationUuid});let n=U(e);if(W(),n.warning&&x(`tengu_oauth_storage_warning`,{warning:n.warning}),await M(e.accessToken).catch(e=>d(String(e),{level:`error`})),T(e.scopes))await Oe().catch(e=>d(String(e),{level:`error`}));else if(!await ie(e.accessToken))throw Error(`Unable to create API key. The server accepted the request but did not return a key.`);await Y()}async function Me({email:e,sso:t,console:n,claudeai:r}){n&&r&&(process.stderr.write(`Error: --console and --claudeai cannot be used together.
2
2
  `),process.exit(1));let i=m(),a=i.forceLoginMethod?i.forceLoginMethod===`claudeai`:!n,o=i.forceLoginOrgUUID,s=process.env.CLAUDE_CODE_OAUTH_REFRESH_TOKEN;if(s){let e=process.env.CLAUDE_CODE_OAUTH_SCOPES;e||(process.stderr.write(`CLAUDE_CODE_OAUTH_SCOPES is required when using CLAUDE_CODE_OAUTH_REFRESH_TOKEN.
3
3
  Set it to the space-separated scopes the refresh token was issued with
4
4
  (e.g. "user:inference" or "user:profile user:inference user:sessions:claude_code user:mcp_servers").
@@ -0,0 +1 @@
1
+ import{At as e,Pt as t,St as n,ct as r,pt as i}from"./model-Do0f476p.js";t();export{r as checkAndRefreshOAuthTokenIfNeeded,i as clearOAuthTokenCache,n as getClaudeAIOAuthTokens,e as handleOAuth401Error};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./auth-0rn1U4Eq.js";export{t as authLogin,e as authStatus};
@@ -0,0 +1 @@
1
+ import{t as e}from"./backgroundHousekeeping-km82qEh0.js";export{e as startBackgroundHousekeeping};
@@ -1,4 +1,4 @@
1
- import{i as e,o as t}from"./envUtils-DcaKZlRU.js";import{Bd as n,Cc as r,Fb as i,La as a,Pb as o,Q as s,Qf as c,SC as l,Sa as ee,St as u,Ta as d,X as f,bC as te,br as ne,by as p,cm as m,dt as h,ep as g,lr as _,wa as v,wc as re,zd as ie}from"./loadAgentsDir-DXOkUcW3.js";import{L as y,U as b,Ut as x}from"./state-D5D6QpTX.js";import{n as ae,t as oe}from"./cwd-Nh5IZNKO.js";import{R as S,U as C,c as w,f as T,i as E,u as D,x as O}from"./debug-D58GQBDG.js";import{d as k,h as A,v as j}from"./settings-3xZ0fsvE.js";import{S as M}from"./config-DRy1I12M.js";import{o as N,s as P,v as F,y as I}from"./log-CZ7ploQm.js";import{n as L,r as R}from"./analytics-DJobLaWP.js";import{_ as z,h as B}from"./model-Cxx3suBa.js";import{_n as V,vn as H}from"./prompt-DEioJrx_.js";import{Q as U}from"./sessionState-DAcub-HK.js";import{i as W,t as G}from"./nativeInstaller-CaXwRpoR.js";import{n as se,t as K}from"./allErrors-C_iHQOlK.js";import{r as ce}from"./magicDocs-rxv0rR8E.js";import{n as le,t as ue}from"./pluginAutoupdate-C2YbEHrP.js";import{n as de}from"./registerProtocol-Xsq4ldwg.js";import"os";import{join as q}from"path";import"crypto";t(),x(),ae(),O(),T(),E(),I(),A(),H(),z(),re(),ne(),ce(),f(),N(),S(),a(),p(),f(),i(),S(),N(),a(),p(),m();async function fe(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),i=n(oe(),`.workmate`,`skills`,e,`SKILL.md`),a;try{a=await r.readFile(i,`utf-8`)}catch{P(Error(`Failed to read skill file for improvement: ${i}`));return}let c=t.map(e=>`- ${e.section}: ${e.change}`).join(`
1
+ import{i as e,o as t}from"./envUtils-DcaKZlRU.js";import{Bd as n,Cc as r,Fb as i,La as a,Pb as o,Q as s,Qf as c,SC as l,Sa as ee,St as u,Ta as d,X as f,bC as te,br as ne,by as p,cm as m,dt as h,ep as g,lr as _,wa as v,wc as re,zd as ie}from"./loadAgentsDir-DaNpxaO-.js";import{L as y,U as b,Ut as x}from"./state-D5D6QpTX.js";import{n as ae,t as oe}from"./cwd-Nh5IZNKO.js";import{R as S,U as C,c as w,f as T,i as E,u as D,x as O}from"./debug-D58GQBDG.js";import{d as k,h as A,v as j}from"./settings-3xZ0fsvE.js";import{S as M}from"./config-DRy1I12M.js";import{o as N,s as P,v as F,y as I}from"./log-CZ7ploQm.js";import{n as L,r as R}from"./analytics-DJobLaWP.js";import{_ as z,h as B}from"./model-Do0f476p.js";import{_n as V,vn as H}from"./prompt-8u06WVES.js";import{Q as U}from"./sessionState-CQhbGfmh.js";import{i as W,t as G}from"./nativeInstaller-CymO8TNe.js";import{n as se,t as K}from"./allErrors-BkgB7JNK.js";import{r as ce}from"./magicDocs-CrTwULyJ.js";import{n as le,t as ue}from"./pluginAutoupdate-C2xTKLR_.js";import{n as de}from"./registerProtocol-C0IlPEoa.js";import"os";import{join as q}from"path";import"crypto";t(),x(),ae(),O(),T(),E(),I(),A(),H(),z(),re(),ne(),ce(),f(),N(),S(),a(),p(),f(),i(),S(),N(),a(),p(),m();async function fe(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),i=n(oe(),`.workmate`,`skills`,e,`SKILL.md`),a;try{a=await r.readFile(i,`utf-8`)}catch{P(Error(`Failed to read skill file for improvement: ${i}`));return}let c=t.map(e=>`- ${e.section}: ${e.change}`).join(`
2
2
  `),l=B(),u=await s({messages:[ee({content:`You are editing a skill definition file. Apply the following improvements to the skill.
3
3
 
4
4
  <current_skill_file>
@@ -14,4 +14,4 @@ Rules:
14
14
  - Preserve frontmatter (--- block) exactly as-is
15
15
  - Preserve the overall format and style
16
16
  - Do not remove existing content unless an improvement explicitly replaces it
17
- - Output the complete updated file inside <updated_file> tags`})],systemPrompt:U([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:o().signal,options:{getToolPermissionContext:async()=>V(),model:l,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),f=v(d(Array.isArray(u.message.content)?u.message.content:[]).trim(),`updated_file`);if(!f){P(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(i,f,`utf-8`)}catch(e){P(C(e))}}L(),g(),M(),N(),G(),n(),se(),l(),u();var pe=30;function J(){let e=((k()||{}).cleanupPeriodDays??pe)*24*60*60*1e3;return new Date(Date.now()-e)}function me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function he(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function Y(e,t,n){let r={messages:0,errors:0};try{let i=await D().readdir(e);for(let a of i)try{he(a.name)<t&&(await D().unlink(q(e,a.name)),n?r.messages++:r.errors++)}catch(e){P(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return r}async function ge(){let e=D(),t=J(),n=F.errors(),r=F.baseLogs(),i=await Y(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>q(r,e.name));for(let n of a)i=me(i,await Y(n,t,!0)),await Z(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return i}async function X(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Z(e,t){try{await t.rmdir(e)}catch{}}async function _e(){let e=J(),t={messages:0,errors:0},n=_(),r=D(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=q(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=q(i,n.name),o=q(a,te),s;try{s=await r.readdir(o)}catch{await Z(a,r);continue}for(let n of s)if(n.isFile())try{await X(q(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=q(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Z(i,r)}await Z(o,r),await Z(a,r)}await Z(i,r)}return t}async function Q(e,t,n=!0){let r=J(),i={messages:0,errors:0},a=D(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await X(q(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Z(e,a),i}function ve(){return Q(q(e(),`plans`),`.md`)}async function ye(){let t=J(),n={messages:0,errors:0},r=D();try{let i=q(e(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));await Promise.all(o.map(async e=>{try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}})),await Z(i,r)}catch(e){P(e)}return n}async function be(){let t=J(),n={messages:0,errors:0},r=D();try{let i=q(e(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));for(let e of o)try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}await Z(i,r)}catch(e){P(e)}return n}async function xe(){let t=J(),n={messages:0,errors:0},r=D(),i=q(e(),`debug`),a;try{a=await r.readdir(i)}catch{return n}for(let e of a)if(!(!e.isFile()||!e.name.endsWith(`.txt`)||e.name===`latest`))try{await X(q(i,e.name),t,r)&&n.messages++}catch{n.errors++}return n}async function Se(){let{errors:e}=K();if(e.length>0&&j(`cleanupPeriodDays`)){w(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await ge(),await _e(),await ve(),await ye(),await be(),await xe(),await c(),await ie(J());let t=await h(J());t>0&&R(`tengu_worktree_cleanup`,{removed:t})}x(),G(),le();var $=600*1e3;function Ce(){import(`./extractMemories-B_8wZpXA.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),r(),ue(),y()&&de();let e=!0;async function t(){if(y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Se()),y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await W()}setTimeout(t,$).unref()}export{fe as n,Ce as t};
17
+ - Output the complete updated file inside <updated_file> tags`})],systemPrompt:U([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:o().signal,options:{getToolPermissionContext:async()=>V(),model:l,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),f=v(d(Array.isArray(u.message.content)?u.message.content:[]).trim(),`updated_file`);if(!f){P(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(i,f,`utf-8`)}catch(e){P(C(e))}}L(),g(),M(),N(),G(),n(),se(),l(),u();var pe=30;function J(){let e=((k()||{}).cleanupPeriodDays??pe)*24*60*60*1e3;return new Date(Date.now()-e)}function me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function he(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function Y(e,t,n){let r={messages:0,errors:0};try{let i=await D().readdir(e);for(let a of i)try{he(a.name)<t&&(await D().unlink(q(e,a.name)),n?r.messages++:r.errors++)}catch(e){P(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return r}async function ge(){let e=D(),t=J(),n=F.errors(),r=F.baseLogs(),i=await Y(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>q(r,e.name));for(let n of a)i=me(i,await Y(n,t,!0)),await Z(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return i}async function X(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Z(e,t){try{await t.rmdir(e)}catch{}}async function _e(){let e=J(),t={messages:0,errors:0},n=_(),r=D(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=q(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=q(i,n.name),o=q(a,te),s;try{s=await r.readdir(o)}catch{await Z(a,r);continue}for(let n of s)if(n.isFile())try{await X(q(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=q(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Z(i,r)}await Z(o,r),await Z(a,r)}await Z(i,r)}return t}async function Q(e,t,n=!0){let r=J(),i={messages:0,errors:0},a=D(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await X(q(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Z(e,a),i}function ve(){return Q(q(e(),`plans`),`.md`)}async function ye(){let t=J(),n={messages:0,errors:0},r=D();try{let i=q(e(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));await Promise.all(o.map(async e=>{try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}})),await Z(i,r)}catch(e){P(e)}return n}async function be(){let t=J(),n={messages:0,errors:0},r=D();try{let i=q(e(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));for(let e of o)try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}await Z(i,r)}catch(e){P(e)}return n}async function xe(){let t=J(),n={messages:0,errors:0},r=D(),i=q(e(),`debug`),a;try{a=await r.readdir(i)}catch{return n}for(let e of a)if(!(!e.isFile()||!e.name.endsWith(`.txt`)||e.name===`latest`))try{await X(q(i,e.name),t,r)&&n.messages++}catch{n.errors++}return n}async function Se(){let{errors:e}=K();if(e.length>0&&j(`cleanupPeriodDays`)){w(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await ge(),await _e(),await ve(),await ye(),await be(),await xe(),await c(),await ie(J());let t=await h(J());t>0&&R(`tengu_worktree_cleanup`,{removed:t})}x(),G(),le();var $=600*1e3;function Ce(){import(`./extractMemories-CfmbvayQ.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),r(),ue(),y()&&de();let e=!0;async function t(){if(y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Se()),y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await W()}setTimeout(t,$).unref()}export{fe as n,Ce as t};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Er as t,br as n,cr as r,fi as i,gr as a,hr as o,oi as s}from"./loadAgentsDir-DXOkUcW3.js";import{$ as c,Ut as l,ft as u}from"./state-D5D6QpTX.js";import{C as d,x as f}from"./debug-D58GQBDG.js";import{c as p,s as m}from"./types-APu4OCXJ.js";import{n as h,r as g}from"./analytics-DJobLaWP.js";import{i as _,o as v}from"./stringUtils-CKD8qDqx.js";import{randomUUID as y}from"crypto";import{mkdir as b,readFile as x,writeFile as S}from"fs/promises";function C(e){let t=e?.message?.content;if(!t)return`Branched conversation`;let n=typeof t==`string`?t:t.find(e=>e.type===`text`)?.text;return n&&n.replace(/\s+/g,` `).trim().slice(0,100)||`Branched conversation`}async function w(e){let n=y(),i=u(),s=r(c()),l=a(n),f=o();await b(s,{recursive:!0,mode:448});let m;try{m=await x(f)}catch{throw Error(`No conversation to branch`)}if(m.length===0)throw Error(`No conversation to branch`);let h=p(m),g=h.filter(e=>t(e)&&!e.isSidechain),_=h.filter(e=>e.type===`content-replacement`&&e.sessionId===i).flatMap(e=>e.replacements);if(g.length===0)throw Error(`No messages to branch`);let v=null,C=[],w=[];for(let e of g){let t={...e,sessionId:n,parentUuid:v,isSidechain:!1,forkedFrom:{sessionId:i,messageUuid:e.uuid}},r={...e,sessionId:n};w.push(r),C.push(d(t)),e.type!==`progress`&&(v=e.uuid)}if(_.length>0){let e={type:`content-replacement`,sessionId:n,replacements:_};C.push(d(e))}return await S(l,`${C.join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Er as t,br as n,cr as r,fi as i,gr as a,hr as o,oi as s}from"./loadAgentsDir-DaNpxaO-.js";import{$ as c,Ut as l,ft as u}from"./state-D5D6QpTX.js";import{C as d,x as f}from"./debug-D58GQBDG.js";import{c as p,s as m}from"./types-APu4OCXJ.js";import{n as h,r as g}from"./analytics-DJobLaWP.js";import{i as _,o as v}from"./stringUtils-CKD8qDqx.js";import{randomUUID as y}from"crypto";import{mkdir as b,readFile as x,writeFile as S}from"fs/promises";function C(e){let t=e?.message?.content;if(!t)return`Branched conversation`;let n=typeof t==`string`?t:t.find(e=>e.type===`text`)?.text;return n&&n.replace(/\s+/g,` `).trim().slice(0,100)||`Branched conversation`}async function w(e){let n=y(),i=u(),s=r(c()),l=a(n),f=o();await b(s,{recursive:!0,mode:448});let m;try{m=await x(f)}catch{throw Error(`No conversation to branch`)}if(m.length===0)throw Error(`No conversation to branch`);let h=p(m),g=h.filter(e=>t(e)&&!e.isSidechain),_=h.filter(e=>e.type===`content-replacement`&&e.sessionId===i).flatMap(e=>e.replacements);if(g.length===0)throw Error(`No messages to branch`);let v=null,C=[],w=[];for(let e of g){let t={...e,sessionId:n,parentUuid:v,isSidechain:!1,forkedFrom:{sessionId:i,messageUuid:e.uuid}},r={...e,sessionId:n};w.push(r),C.push(d(t)),e.type!==`progress`&&(v=e.uuid)}if(_.length>0){let e={type:`content-replacement`,sessionId:n,replacements:_};C.push(d(e))}return await S(l,`${C.join(`
2
2
  `)}\n`,{encoding:`utf8`,mode:384}),{sessionId:n,title:e,forkPath:l,serializedMessages:w,contentReplacementRecords:_}}async function T(e){let t=`${e} (Branch)`;if((await i(t,{exact:!0})).length===0)return t;let n=await i(`${e} (Branch`),r=new Set([1]),a=RegExp(`^${_(e)} \\(Branch(?: (\\d+))?\\)$`);for(let e of n){let t=e.customTitle?.match(a);t&&(t[1]?r.add(parseInt(t[1],10)):r.add(1))}let o=2;for(;r.has(o);)o++;return`${e} (Branch ${o})`}async function E(e,t,n){let r=n?.trim()||void 0,i=u();try{let{sessionId:n,title:a,forkPath:o,serializedMessages:c,contentReplacementRecords:l}=await w(r),u=new Date,d=C(c.find(e=>e.type===`user`)),f=await T(a??d);await s(n,f,o),g(`tengu_conversation_forked`,{message_count:c.length,has_custom_title:!!a});let p={date:u.toISOString().split(`T`)[0],messages:c,fullPath:o,value:u.getTime(),created:u,modified:u,firstPrompt:d,messageCount:c.length,isSidechain:!1,sessionId:n,customTitle:f,contentReplacements:l},m=a?` "${a}"`:``,h=`Branched conversation${m}. You are now in the branch.${`\nTo resume the original: claude -r ${i}`}`;return t.resume?(await t.resume(n,p,`fork`),e(h,{display:`system`})):e(`Branched conversation${m}. Resume with: /resume ${n}`),null}catch(t){return e(`Failed to branch conversation: ${t instanceof Error?t.message:`Unknown error occurred`}`),null}}e((()=>{l(),h(),m(),n(),f(),v()}))();export{E as call,C as deriveFirstPrompt};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,u as n}from"./oauth-D38aRTUb.js";import{Pt as r,St as i}from"./model-Cxx3suBa.js";function a(){return process.env.CLAUDE_BRIDGE_OAUTH_TOKEN||void 0}function o(){return process.env.CLAUDE_BRIDGE_BASE_URL||void 0}function s(){return a()??i()?.accessToken}function c(){return o()??t().BASE_API_URL}function l(){return!!o()}var u=e((()=>{n(),r()}));export{u as a,a as i,c as n,l as o,o as r,s as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,u as n}from"./oauth-D38aRTUb.js";import{Pt as r,St as i}from"./model-Do0f476p.js";function a(){return process.env.CLAUDE_BRIDGE_OAUTH_TOKEN||void 0}function o(){return process.env.CLAUDE_BRIDGE_BASE_URL||void 0}function s(){return a()??i()?.accessToken}function c(){return o()??t().BASE_API_URL}function l(){return!!o()}var u=e((()=>{n(),r()}));export{u as a,a as i,c as n,l as o,o as r,s as t};
@@ -0,0 +1 @@
1
+ import{a as e,n as t,o as n,t as r}from"./bridgeConfig-C5L-7KaP.js";e();export{r as getBridgeAccessToken,t as getBridgeBaseUrl,n as isSelfHostedBridge};