@readmagic/workmate 0.0.14 → 0.0.16
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.
- package/dist/chunks/AddWorkspaceDirectory-DAtfMH4o.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-D58Vn3SK.js → AgentsMdExternalIncludesDialog-BTYgjY5c.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-C6VH6JG6.js +1 -0
- package/dist/chunks/{App-CeC-2dzL.js → App-HF0bvxi_.js} +1 -1
- package/dist/chunks/ApproveApiKey-B7mKgSqY.js +1 -0
- package/dist/chunks/{ApproveApiKey-DFpddLyp.js → ApproveApiKey-BBFLw2B7.js} +1 -1
- package/dist/chunks/{BackgroundTasksDialog-9ruzl1jm.js → BackgroundTasksDialog-Coc0ecUd.js} +1 -1
- package/dist/chunks/BypassPermissionsModeDialog--Gx9ARd4.js +1 -0
- package/dist/chunks/{DiffDialog-LTdtTqsC.js → DiffDialog-tlINuFS1.js} +1 -1
- package/dist/chunks/Doctor-BJf49FWX.js +1 -0
- package/dist/chunks/{Doctor-Yvrzcrvx.js → Doctor-Wh7z6CnF.js} +2 -2
- package/dist/chunks/ExitFlow-B1zHTqQt.js +2 -0
- package/dist/chunks/Grove-1Kf7xxIV.js +11 -0
- package/dist/chunks/{HybridTransport-CEWG9ZRi.js → HybridTransport-DWqWUZCH.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-Ue3kJUPJ.js → InvalidConfigDialog-OZPFQSnC.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-BO2AOTVf.js → InvalidSettingsDialog-BNCm-eyC.js} +1 -1
- package/dist/chunks/MCPConnectionManager-7H84oi5n.js +1 -0
- package/dist/chunks/MCPToolListView-CVgtg3Iq.js +1 -0
- package/dist/chunks/{McpParsingWarnings-BsCDFWci.js → McpParsingWarnings-CN8f449l.js} +1 -1
- package/dist/chunks/{MessageSelector-DY5K0NHd.js → MessageSelector-B9j6zZ5w.js} +1 -1
- package/dist/chunks/Messages-yz1m39eI.js +10 -0
- package/dist/chunks/{Onboarding-w0-VVsDz.js → Onboarding-bFbgae8m.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-OEXx0Abp.js → PromptInputFooterSuggestions-CE_yVun1.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-TPWuGwAy.js +1 -0
- package/dist/chunks/QueryEngine-CRobcENE.js +1 -0
- package/dist/chunks/REPL-BhCC0JP6.js +1 -0
- package/dist/chunks/REPL-C33mMf_q.js +128 -0
- package/dist/chunks/RemoteSessionManager-BjVD918g.js +2 -0
- package/dist/chunks/{ResumeConversation-BbNrpSFB.js → ResumeConversation-CXd8d8po.js} +1 -1
- package/dist/chunks/{SSETransport-CLiI2qnD.js → SSETransport-BSilVN9e.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-DoiCI2uJ.js +1 -0
- package/dist/chunks/Settings-ClcLl0C1.js +2 -0
- package/dist/chunks/{TeleportProgress-IB--CbqZ.js → TeleportProgress-DonJUoPc.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-KjdlS_gA.js → TeleportRepoMismatchDialog-ByOuSVVz.js} +1 -1
- package/dist/chunks/TeleportResumeWrapper-BBtELwF1.js +1 -0
- package/dist/chunks/{ThemePicker-BrD_T7xF.js → ThemePicker-1QQJFOEv.js} +1 -1
- package/dist/chunks/{TrustDialog-L0rvvpit.js → TrustDialog-DwJ9L_u4.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-QZvtUrAy.js → ValidationErrorsList-Cuq6W2yc.js} +1 -1
- package/dist/chunks/{add-dir-CpWXReCi.js → add-dir-DOKdPFT2.js} +1 -1
- package/dist/chunks/{agentDisplay-CrQvGkTT.js → agentDisplay-TX1bh-lX.js} +1 -1
- package/dist/chunks/{agents-C99yMsVF.js → agents-C58tRxpi.js} +1 -1
- package/dist/chunks/agents-CbRjX9Pj.js +101 -0
- package/dist/chunks/{allErrors-uyOMiF9U.js → allErrors-DRiW7i6Y.js} +1 -1
- package/dist/chunks/api-C8uOHD-v.js +1 -0
- package/dist/chunks/{api-C5I2xwgd.js → api-CazVavfB.js} +1 -1
- package/dist/chunks/auth-BL238vgr.js +1 -0
- package/dist/chunks/auth-CfrCl9BZ.js +10 -0
- package/dist/chunks/auth-D3GkU6d7.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-CjD8bACB.js → backgroundHousekeeping-CPLlaWcV.js} +2 -2
- package/dist/chunks/backgroundHousekeeping-Du2tN2WE.js +1 -0
- package/dist/chunks/{branch-BOWBZo5K.js → branch-pAa0oBaj.js} +1 -1
- package/dist/chunks/{bridgeConfig-CgAVrQfz.js → bridgeConfig-DnFfCpGd.js} +1 -1
- package/dist/chunks/bridgeConfig-joBqeK0j.js +1 -0
- package/dist/chunks/{bridgeMessaging-cOFtbkf_.js → bridgeMessaging-B_hnuUHb.js} +1 -1
- package/dist/chunks/bridgeStatusUtil-Dwz4YHNA.js +1 -0
- package/dist/chunks/{btw-B0UmiVKl.js → btw-CkVkYeRr.js} +1 -1
- package/dist/chunks/{caches-wN3JyvNE.js → caches-BLQUkrIG.js} +1 -1
- package/dist/chunks/caches-DsFl83sh.js +1 -0
- package/dist/chunks/{ccrClient-wtUIz75R.js → ccrClient-AfdUbWzY.js} +1 -1
- package/dist/chunks/claudeDesktop-CB3UCt7U.js +1 -0
- package/dist/chunks/{clear-CNzBoL7O.js → clear-Ac3qYi_-.js} +1 -1
- package/dist/chunks/client-BX0r6K3I.js +1 -0
- package/dist/chunks/client-Bb2eZnuq.js +1 -0
- package/dist/chunks/client-DNEVh6Wu.js +1 -0
- package/dist/chunks/client-Pap_HyZZ.js +1 -0
- package/dist/chunks/client-zhozU2ws.js +1 -0
- package/dist/chunks/commands-BKLsl6gK.js +1 -0
- package/dist/chunks/{compact-Bj8mdDYN.js → compact-CXuDr5qM.js} +1 -1
- package/dist/chunks/{config-BkbL2e5Q.js → config-BSkuQZNf.js} +1 -1
- package/dist/chunks/{config-WMxn2jLl.js → config-D78R57VA.js} +1 -1
- package/dist/chunks/config-DrY1SvhQ.js +1 -0
- package/dist/chunks/{context-DB1Ar85E.js → context-C2plOqH4.js} +1 -1
- package/dist/chunks/context-noninteractive-DpVlZ-wP.js +1 -0
- package/dist/chunks/{context-noninteractive-CqnJTDcI.js → context-noninteractive-fVQtwEkw.js} +1 -1
- package/dist/chunks/conversation-C0yysXds.js +1 -0
- package/dist/chunks/{conversation-DOgBzrm0.js → conversation-DQpS6nvg.js} +1 -1
- package/dist/chunks/{createSSHSession-Cf2tOgK_.js → createSSHSession-CfyFuJMH.js} +1 -1
- package/dist/chunks/createSession-CmBawnsh.js +1 -0
- package/dist/chunks/{createSession-DD5YaQKM.js → createSession-qk9C66lK.js} +1 -1
- package/dist/chunks/{crossProjectResume-CkiPQYYE.js → crossProjectResume-DY1ZBO5P.js} +1 -1
- package/dist/chunks/{datadog-DcLf1QpG.js → datadog-Cr0VKbct.js} +1 -1
- package/dist/chunks/{diff-dfXWiuLA.js → diff-BNjcCXDr.js} +1 -1
- package/dist/chunks/{directoryCompletion-BtlRKLzw.js → directoryCompletion-i2oWpaUe.js} +1 -1
- package/dist/chunks/doctor-BkCtT7H1.js +1 -0
- package/dist/chunks/{entry-wISucmYc.js → entry-o9IZPS4g.js} +3 -3
- package/dist/chunks/{esm-CrJVXrKW.js → esm-BI3tFLyy.js} +1 -1
- package/dist/chunks/exit-Dlyj7nY8.js +1 -0
- package/dist/chunks/extraUsage-5Ueiyw6W.js +1 -0
- package/dist/chunks/extractMemories-DnTBWFOW.js +1 -0
- package/dist/chunks/fast-B3fRp1xO.js +1 -0
- package/dist/chunks/fast-ClOKONyD.js +1 -0
- package/dist/chunks/fetchModelList-B8KG79EK.js +1 -0
- package/dist/chunks/fetchModelList-gh_jFYai.js +1 -0
- package/dist/chunks/{fileSuggestions-Dy2BUZzd.js → fileSuggestions-DK7W8kLF.js} +1 -1
- package/dist/chunks/{firstPartyEventLogger-D4yuDP-n.js → firstPartyEventLogger-BMnXb9cv.js} +2 -2
- package/dist/chunks/firstPartyEventLogger-YYOb8aIo.js +1 -0
- package/dist/chunks/{flushGate-B6ecrC4j.js → flushGate-n4kK6H1U.js} +1 -1
- package/dist/chunks/{gemini-BC-BxZmj.js → gemini-C8-QHnsC.js} +1 -1
- package/dist/chunks/{generateSessionName-JTR8nPYD.js → generateSessionName-C8DnAVaa.js} +1 -1
- package/dist/chunks/{githubRepoPathMapping-Bk4FZrng.js → githubRepoPathMapping-Px3_GeD1.js} +1 -1
- package/dist/chunks/{goal-B09SOyra.js → goal-DMmzlZOF.js} +1 -1
- package/dist/chunks/grok-LLjpAwP_.js +1 -0
- package/dist/chunks/{grove-DsAIY-rZ.js → grove-CQBCzeHf.js} +1 -1
- package/dist/chunks/help-JH7WzjZP.js +1 -0
- package/dist/chunks/hooks-COhKt_pF.js +1 -0
- package/dist/chunks/{hooks-BI4NY5IC.js → hooks-DD2jpRfx.js} +7 -7
- package/dist/chunks/initReplBridge-BDaN0hpY.js +1 -0
- package/dist/chunks/install-CD4or0vj.js +1 -0
- package/dist/chunks/{instrumentation-5cSwEKaF.js → instrumentation-n-otwpYf.js} +4 -4
- package/dist/chunks/{job-rW1mEYtm.js → job-B-pEWgXI.js} +1 -1
- package/dist/chunks/keybindings-qed9q9tx.js +1 -0
- package/dist/chunks/{launchLocalMemory-CPucX8Xj.js → launchLocalMemory-cBovdGMT.js} +1 -1
- package/dist/chunks/{launchOnboarding--GCJWeeS.js → launchOnboarding-B__wtt7p.js} +1 -1
- package/dist/chunks/{loadAgentsDir-JrGMJN05.js → loadAgentsDir-PPiD2Mfq.js} +574 -574
- package/dist/chunks/loadAgentsDir-qvqrTVuS.js +1 -0
- package/dist/chunks/{loadPluginHooks-C4zrlV0u.js → loadPluginHooks-DUCuU3_8.js} +1 -1
- package/dist/chunks/localSearch-CDk_stXJ.js +1 -0
- package/dist/chunks/{localSearch-C-stDP9C.js → localSearch-Cvs9WfoX.js} +1 -1
- package/dist/chunks/{logoV2Utils-J2Sqfube.js → logoV2Utils-Bkj74dtY.js} +1 -1
- package/dist/chunks/{magicDocs-Dpe3YhyL.js → magicDocs-3U6peChg.js} +2 -2
- package/dist/chunks/main-DkjxhBIC.js +356 -0
- package/dist/chunks/{managedEnv-C8SisyLk.js → managedEnv-BUrzwaD3.js} +1 -1
- package/dist/chunks/managedEnv-XOUMOtEF.js +1 -0
- package/dist/chunks/{mappers-CMJorgSL.js → mappers-ZGgwqDOK.js} +1 -1
- package/dist/chunks/mcp-COZxwgJZ.js +6 -0
- package/dist/chunks/{mcp-SuAh71Ht.js → mcp-CdyNeNzh.js} +1 -1
- package/dist/chunks/{mcp-_tBxhPV-.js → mcp-CysOyBIn.js} +1 -1
- package/dist/chunks/{memory-DK8bOrUr.js → memory-B5h2TTSS.js} +1 -1
- package/dist/chunks/{mode-BhfhEpnW.js → mode-D3yY1fdK.js} +1 -1
- package/dist/chunks/model-Bz4JHoU0.js +1 -0
- package/dist/chunks/model-g6XBcNAG.js +1 -0
- package/dist/chunks/model-sviY1inu.js +1 -0
- package/dist/chunks/modelOptions-DYQqTLPi.js +1 -0
- package/dist/chunks/{nativeInstaller-xxyUjXbl.js → nativeInstaller-N1xiUpCP.js} +1 -1
- package/dist/chunks/{omit-od_CYp5o.js → omit-BOILu8jW.js} +1 -1
- package/dist/chunks/{onChangeAppState-CqTb0yEa.js → onChangeAppState-COFFZAXb.js} +1 -1
- package/dist/chunks/{openai-qW8mATAs.js → openai-BHM5kEFo.js} +2 -2
- package/dist/chunks/openai-CR3CcjCE.js +17 -0
- package/dist/chunks/{partition-CYoWXLNU.js → partition-C1SFDk_L.js} +1 -1
- package/dist/chunks/{permissions--iKUbWBw.js → permissions-uy_NFbfy.js} +3 -3
- package/dist/chunks/{pidLock-BR4hzYgp.js → pidLock-DuMVSwnN.js} +2 -2
- package/dist/chunks/{plan-DiHCGXhM.js → plan-DF9YSB5M.js} +1 -1
- package/dist/chunks/{plugin-BeC4D7XF.js → plugin-GRPzqgTr.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-Bj-CrFuO.js → pluginAutoupdate-AMD-FvKB.js} +1 -1
- package/dist/chunks/{pluginBlocklist-DzOs-RS1.js → pluginBlocklist-DNxkAxH6.js} +1 -1
- package/dist/chunks/{pluginCliCommands-DwIGn58t.js → pluginCliCommands-BFoR1ZXx.js} +1 -1
- package/dist/chunks/{pluginFlagging-BzuymJuf.js → pluginFlagging-CW2IZWSI.js} +1 -1
- package/dist/chunks/{pluginOperations-CP1v-nu0.js → pluginOperations-DlWE0idP.js} +1 -1
- package/dist/chunks/{pluginStartupCheck-BUeBiYVq.js → pluginStartupCheck-AQGV0DCS.js} +1 -1
- package/dist/chunks/pluginStartupCheck-DWpquqxx.js +1 -0
- package/dist/chunks/{plugins-D1N31THW.js → plugins-CwUSTE4E.js} +1 -1
- package/dist/chunks/poorMode-DD88nPJ4.js +1 -0
- package/dist/chunks/{poorMode-D4L_-yWS.js → poorMode-wm2WkPF0.js} +1 -1
- package/dist/chunks/print-9wR_ijrL.js +14 -0
- package/dist/chunks/{processBashCommand-BGCIqxc9.js → processBashCommand-Deqwq1IE.js} +1 -1
- package/dist/chunks/{processSlashCommand-qR_j1DE8.js → processSlashCommand-U9LJ4Keq.js} +2 -2
- package/dist/chunks/prompt-BBeDQXIs.js +1 -0
- package/dist/chunks/{prompt-DnPppVz8.js → prompt-CQmEvnKN.js} +1 -1
- package/dist/chunks/prompt-CXhdqgB7.js +1 -0
- package/dist/chunks/{promptEditor-Cilc9N3L.js → promptEditor-Bf72KNF-.js} +1 -1
- package/dist/chunks/{protocolHandler-DdbiucQa.js → protocolHandler--eQQuSyx.js} +1 -1
- package/dist/chunks/{reconciler-Bte4gdP-.js → reconciler-Css9bs07.js} +1 -1
- package/dist/chunks/{refresh-MiZ0acBm.js → refresh-B87z39Zs.js} +1 -1
- package/dist/chunks/{registerProtocol-Bpte9dly.js → registerProtocol-DrWIX3Lb.js} +1 -1
- package/dist/chunks/{reload-plugins-GdqFZblC.js → reload-plugins-BpmUIkfm.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-CAl3_H-O.js → remoteBridgeCore-BCLIIygk.js} +1 -1
- package/dist/chunks/{remoteManagedSettings-BcLJLEr7.js → remoteManagedSettings-Ahgn2e80.js} +1 -1
- package/dist/chunks/{rename-BDo5qIK0.js → rename-BUt3PliQ.js} +1 -1
- package/dist/chunks/{resume-Bbweh2hA.js → resume-uZI9p_FE.js} +1 -1
- package/dist/chunks/ripgrep-Di-2j8Ws.js +1 -0
- package/dist/chunks/{ripgrep-X5m4gJ-3.js → ripgrep-DsLUmulz.js} +1 -1
- package/dist/chunks/{runtimeObserver-CxXxUcrm.js → runtimeObserver-AKOWfdZ_.js} +1 -1
- package/dist/chunks/{runtimeObserver-Hjbo43xj.js → runtimeObserver-By59MZKJ.js} +2 -2
- package/dist/chunks/sandbox-adapter-D4Uho1vF.js +1 -0
- package/dist/chunks/sandbox-toggle-BdvylnWS.js +1 -0
- package/dist/chunks/searchExtraTools-BHMkqGBf.js +1 -0
- package/dist/chunks/{session-CkuTMD_4.js → session-Tm2-rzBY.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-BaWZ8sqn.js +1 -0
- package/dist/chunks/{sessionObserver-CvQ6oyoj.js → sessionObserver-BAr8AWeL.js} +1 -1
- package/dist/chunks/sessionObserver-KB1UL_n2.js +1 -0
- package/dist/chunks/{sessionState-C2REgUrs.js → sessionState-BTFowSpR.js} +2 -2
- package/dist/chunks/sessionStorage-D6nlmaI-.js +1 -0
- package/dist/chunks/{sessionTitle-2IWcNB8H.js → sessionTitle-SCqmSDYM.js} +1 -1
- package/dist/chunks/{sessionTracing-Bm7hQKHA.js → sessionTracing-CvY4udYI.js} +1 -1
- package/dist/chunks/settings-BgHApyGL.js +1 -0
- package/dist/chunks/{settings-aUygByiZ.js → settings-CvhsRFaT.js} +1 -1
- package/dist/chunks/{settingsSync-DgzCU1BZ.js → settingsSync-nxeaGM2-.js} +1 -1
- package/dist/chunks/setup-D4FPeBnM.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-CWCQ5dZ0.js → shadowedRuleDetection-Co8m1q1D.js} +1 -1
- package/dist/chunks/{sideQuestion-BoW-xYkh.js → sideQuestion-4TJYn-Az.js} +1 -1
- package/dist/chunks/{sinks-ZHKfs6gv.js → sinks-Bb2i50kz.js} +1 -1
- package/dist/chunks/sinks-D1opmy_x.js +1 -0
- package/dist/chunks/skillChangeDetector-BU9AFG0i.js +1 -0
- package/dist/chunks/{skillGapStore-CCNeSjIb.js → skillGapStore-BcVP3ZUb.js} +2 -2
- package/dist/chunks/{skillLifecycle-wU4JDNYQ.js → skillLifecycle-CG2XmS8f.js} +2 -2
- package/dist/chunks/{skillSearchPanel-Cxr1QQn4.js → skillSearchPanel-DOJmUBXB.js} +4 -4
- package/dist/chunks/{skills-BghnKnNo.js → skills-DIgCWvzX.js} +1 -1
- package/dist/chunks/{stats-unp6R0Ah.js → stats-Dq-5qizS.js} +1 -1
- package/dist/chunks/status-Ber2xOXc.js +2 -0
- package/dist/chunks/status-CVcXPoOZ.js +1 -0
- package/dist/chunks/{statusNoticeHelpers-Dm1aiibR.js → statusNoticeHelpers-CYkrPUpN.js} +1 -1
- package/dist/chunks/{switcher-BUNSEJ-7.js → switcher-BIP3rbQn.js} +1 -1
- package/dist/chunks/switcher-zbG6T9dN.js +1 -0
- package/dist/chunks/syncCache-AMQMQ_HR.js +1 -0
- package/dist/chunks/{tasks-BjFot03S.js → tasks-BKERIO4G.js} +1 -1
- package/dist/chunks/{teleport-Dj2Kvbmx.js → teleport-DOXbf2sQ.js} +1 -1
- package/dist/chunks/{templateJobs-CY7GNRo5.js → templateJobs-dg2F45ZJ.js} +1 -1
- package/dist/chunks/{terminalSetup-Ty8T8ePM.js → terminalSetup-DDvQ0K5e.js} +1 -1
- package/dist/chunks/{terminalSetup-CpMNk6dc.js → terminalSetup-JJiXmszo.js} +1 -1
- package/dist/chunks/{theme-c6grxWNn.js → theme-BGxytGjA.js} +1 -1
- package/dist/chunks/{toolEventObserver-D7WbjgFR.js → toolEventObserver-CJhg_p3P.js} +1 -1
- package/dist/chunks/toolPool-C0d7Bznl.js +1 -0
- package/dist/chunks/{trustedDevice-BF78PNK8.js → trustedDevice-BtXHXu-T.js} +1 -1
- package/dist/chunks/trustedDevice-hw3iq84W.js +1 -0
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-qLfN0tc-.js → useExitOnCtrlCDWithKeybindings-C9orgrub.js} +1 -1
- package/dist/chunks/useMainLoopModel-BigVcn2T.js +1 -0
- package/dist/chunks/{useManagePlugins-E0Qzj-ws.js → useManagePlugins-Bt-DYAnX.js} +1 -1
- package/dist/chunks/{useMergedTools-B7iYaNwM.js → useMergedTools-CZeQBdky.js} +1 -1
- package/dist/chunks/{useSearchInput-CsxiM9i0.js → useSearchInput-DdKrVHJS.js} +1 -1
- package/dist/chunks/{useSettingsErrors-DdVTahNa.js → useSettingsErrors-BR9Wws7D.js} +1 -1
- package/dist/chunks/{userAgent-BggRZ-ZE.js → userAgent-DUt0q-Vl.js} +1 -1
- package/dist/chunks/{util-Xdy1nOjj.js → util-h-Hmdke_.js} +1 -1
- package/dist/chunks/validatePlugin-mWVKNtJa.js +1 -0
- package/dist/chunks/{vim-cFcxfuac.js → vim-s-wmybpU.js} +1 -1
- package/dist/chunks/{workerRegistry-GrD7IAVQ.js → workerRegistry-dlfqtySm.js} +2 -2
- package/dist/chunks/worktree-IxcFe7g-.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AddWorkspaceDirectory-m2d3nOQJ.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-BRXGkHO4.js +0 -1
- package/dist/chunks/ApproveApiKey-NXTWIAMj.js +0 -1
- package/dist/chunks/BypassPermissionsModeDialog-C4QGpcBT.js +0 -1
- package/dist/chunks/Doctor-DmiDH-lg.js +0 -1
- package/dist/chunks/ExitFlow-DH0L3tyY.js +0 -2
- package/dist/chunks/Grove-BhhnrFX9.js +0 -11
- package/dist/chunks/MCPConnectionManager-Ciy9y9VV.js +0 -1
- package/dist/chunks/MCPToolListView-Ddmu2UcL.js +0 -1
- package/dist/chunks/Messages-LD6ZO301.js +0 -10
- package/dist/chunks/PromptInputHelpMenu-DyaUsvNx.js +0 -1
- package/dist/chunks/QueryEngine-sH-KjJIq.js +0 -1
- package/dist/chunks/REPL-BMH_RItw.js +0 -128
- package/dist/chunks/REPL-DkPd3vk5.js +0 -1
- package/dist/chunks/RemoteSessionManager-DJhrR1dz.js +0 -2
- package/dist/chunks/SearchExtraToolsTool-DupzA6Vm.js +0 -1
- package/dist/chunks/Settings-B1EI5LOU.js +0 -2
- package/dist/chunks/TeleportResumeWrapper-DnHTI39O.js +0 -1
- package/dist/chunks/agents-BYQO6DbG.js +0 -101
- package/dist/chunks/api-j0iE1mkR.js +0 -1
- package/dist/chunks/auth-BYCRa_mb.js +0 -10
- package/dist/chunks/auth-C9FUZzpW.js +0 -1
- package/dist/chunks/auth-DwPrlTHv.js +0 -1
- package/dist/chunks/backgroundHousekeeping-BxcVB3By.js +0 -1
- package/dist/chunks/bridgeConfig-Bxs5dqjH.js +0 -1
- package/dist/chunks/bridgeStatusUtil-BQF0AJDO.js +0 -1
- package/dist/chunks/caches-C9--b9a7.js +0 -1
- package/dist/chunks/claudeDesktop-DPIJpc1V.js +0 -1
- package/dist/chunks/client-B7WkO81L.js +0 -17
- package/dist/chunks/client-BCzhAEd0.js +0 -1
- package/dist/chunks/client-Dr9AYB-r.js +0 -1
- package/dist/chunks/commands-DTB0Qzd5.js +0 -1
- package/dist/chunks/config-B1kYcRIP.js +0 -1
- package/dist/chunks/context-noninteractive-Bno2Xsmp.js +0 -1
- package/dist/chunks/conversation-hNXWaswI.js +0 -1
- package/dist/chunks/createSession-BZx-2UIB.js +0 -1
- package/dist/chunks/doctor-aKE2bG5C.js +0 -1
- package/dist/chunks/exit-pjN4EJHV.js +0 -1
- package/dist/chunks/extraUsage-CwDhpClH.js +0 -1
- package/dist/chunks/extractMemories-WmPLOLUT.js +0 -1
- package/dist/chunks/fast-BVABmasw.js +0 -1
- package/dist/chunks/fast-Cuj3bfFm.js +0 -1
- package/dist/chunks/firstPartyEventLogger-CabA8fu0.js +0 -1
- package/dist/chunks/grok-BBo3jGfP.js +0 -1
- package/dist/chunks/help-CELr6oJZ.js +0 -1
- package/dist/chunks/hooks-9rkDD2iw.js +0 -1
- package/dist/chunks/initReplBridge-BYrL6ou1.js +0 -1
- package/dist/chunks/install-Dn3_M1Ui.js +0 -1
- package/dist/chunks/keybindings-B5kUoxvg.js +0 -1
- package/dist/chunks/loadAgentsDir-D-a1uUb5.js +0 -1
- package/dist/chunks/localSearch-hOERAH9v.js +0 -1
- package/dist/chunks/main-C_PDzJdv.js +0 -356
- package/dist/chunks/managedEnv-AEhH_HUs.js +0 -1
- package/dist/chunks/mcp-B2mJmWKt.js +0 -6
- package/dist/chunks/model-BCM7RpVk.js +0 -1
- package/dist/chunks/model-BWR43D3c.js +0 -1
- package/dist/chunks/model-CmDF8O9G.js +0 -1
- package/dist/chunks/modelOptions-DEQat7lU.js +0 -1
- package/dist/chunks/pluginStartupCheck-BGN6Je6d.js +0 -1
- package/dist/chunks/poorMode-XDBnxTiF.js +0 -1
- package/dist/chunks/print-DaJi1wF_.js +0 -14
- package/dist/chunks/prompt-B0gADAvI.js +0 -1
- package/dist/chunks/prompt-DqyEtC_I2.js +0 -1
- package/dist/chunks/ripgrep-DrpZ79Pp.js +0 -1
- package/dist/chunks/sandbox-adapter-DQ_fJSIo.js +0 -1
- package/dist/chunks/sandbox-toggle-DmNSThQK.js +0 -1
- package/dist/chunks/searchExtraTools-C7b2x2p_.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-CQvGAbvL.js +0 -1
- package/dist/chunks/sessionObserver-BoQY7nOa.js +0 -1
- package/dist/chunks/sessionStorage-BeaEgnaa.js +0 -1
- package/dist/chunks/settings-Da6ax5aI.js +0 -1
- package/dist/chunks/setup-CvaG4nl5.js +0 -3
- package/dist/chunks/sinks-B_ehGpvp.js +0 -1
- package/dist/chunks/skillChangeDetector-C-HWR_8v.js +0 -1
- package/dist/chunks/status-BraYBx4N.js +0 -2
- package/dist/chunks/status-DwyWiaVc.js +0 -1
- package/dist/chunks/switcher-DDUnWU_4.js +0 -1
- package/dist/chunks/syncCache-1s9xV8WV.js +0 -1
- package/dist/chunks/toolPool-O5nkEFb1.js +0 -1
- package/dist/chunks/trustedDevice-D_z7bAQh.js +0 -1
- package/dist/chunks/updateCCB-ts7Joyve.js +0 -5
- package/dist/chunks/useMainLoopModel-DkjG_ikT.js +0 -1
- package/dist/chunks/validatePlugin-Be5aSSnP.js +0 -1
- package/dist/chunks/worktree-V7xiUAtl.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./managedEnv-C8SisyLk.js";e();export{t as applyConfigEnvironmentVariables};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Bx as n,Cx as r,Dp as i,Ex as a,Gb as o,Ix as s,Jb as c,Kb as l,Mx as u,Nx as d,Op as f,Ou as ee,Qb as p,Sx as m,Tb as te,Xb as ne,Xh as re,Yh as h,Zd as g,bE as _,dx as v,ed as ie,fx as y,jb as ae,jx as b,kb as oe,ku as se,qb as x,td as S,xE as C}from"./loadAgentsDir-JrGMJN05.js";import{D as w,H as T,I as E,P as D,T as O,ai as k,j as A,kn as j,t as M,y as N}from"./src-DL3w8VPk2.js";import{t as P}from"./jsx-runtime-Bb4Xn-E0.js";import{R as F,V as I}from"./debug-BQj6h99Q.js";import{c as L,h as R,o as z,v as B}from"./config-BkbL2e5Q.js";import{n as V,o as ce}from"./process-gEbdy6uY.js";import{i as H,o as U}from"./platform-DVeTi9mp.js";import{s as W,u as G}from"./types-BomO8WUz.js";import{n as le,r as K}from"./analytics-DJobLaWP.js";import{l as q,o as ue}from"./stringUtils-BjnclTLB.js";import{n as J,t as Y}from"./exit-s9XGerrH.js";import{stat as de}from"fs/promises";import{cwd as fe}from"process";_();var X=e(k(),1);t(),V(),M(),s(),ue(),f(),S();var Z=P();function pe({servers:e,scope:t,onDone:n}){let r=Object.keys(e),[o,s]=(0,X.useState)({});(0,X.useEffect)(()=>{b().then(({servers:e})=>s(e))},[]);let c=r.filter(e=>o[e]!==void 0);async function l(n){let r=0;for(let i of n){let n=e[i];if(n){let e=i;if(o[e]!==void 0){let t=1;for(;o[`${i}_${t}`]!==void 0;)t++;e=`${i}_${t}`}await a(e,n,t),r++}}d(r)}let[u]=T(),d=(0,X.useCallback)(e=>{ce(e>0?`\n${A(`success`,u)(`Successfully imported ${e} MCP ${q(e,`server`)} to ${t} config.`)}\n`:`
|
|
2
|
-
No servers were imported.`),n(),g()},[u,t,n]),f=(0,X.useCallback)(()=>{d(0)},[d]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{title:`Import MCP Servers from Claude Desktop`,subtitle:`Found ${r.length} MCP ${q(r.length,`server`)} in Claude Desktop.`,color:`success`,onCancel:f,hideInputGuide:!0,children:[c.length>0&&(0,Z.jsx)(D,{color:`warning`,children:`Note: Some servers already exist with the same name. If selected, they will be imported with a numbered suffix.`}),(0,Z.jsx)(D,{children:`Please select the servers you want to import:`}),(0,Z.jsx)(ie,{options:r.map(e=>({label:`${e}${c.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:r.filter(e=>!c.includes(e)),onSubmit:l,onCancel:f,hideIndexes:!0})]}),(0,Z.jsx)(E,{paddingX:1,children:(0,Z.jsx)(D,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(O,{children:[(0,Z.jsx)(w,{shortcut:`Space`,action:`select`}),(0,Z.jsx)(w,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}M(),se(),le(),c(),ae(),s(),r(),re(),R(),F(),t(),W(),U();async function Q(e,t){try{let n=await te(e,t);return n.type===`connected`?`✓ Connected`:n.type===`needs-auth`?`! Needs authentication`:`✗ Failed to connect`}catch{return`✗ Connection error`}}async function me({debug:e,verbose:t}){let n=fe();K(`tengu_mcp_start`,{});try{await de(n)}catch(e){throw I(e)&&Y(`Error: Directory ${n} does not exist`),e}try{let{setup:r}=await import(`./setup-CvaG4nl5.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-SuAh71Ht.js`);await i(n,e??!1,t??!1)}catch(e){Y(`Error: Failed to start MCP server: ${e}`)}}async function he(e,t){let r=u(e),i=()=>{r&&(r.type===`sse`||r.type===`http`)&&(l(e,r),o(e,r))};try{if(t.scope){let r=y(t.scope);K(`tengu_mcp_delete`,{name:e,scope:r}),await n(e,r),i(),process.stdout.write(`Removed MCP server ${e} from ${r} config\n`),J(`File modified: ${v(r)}`)}let r=z(),a=L(),{servers:o}=d(`project`),s=!!o[e],c=[];if(r.mcpServers?.[e]&&c.push(`local`),s&&c.push(`project`),a.mcpServers?.[e]&&c.push(`user`),c.length===0)Y(`No MCP server found with name: "${e}"`);else if(c.length===1){let t=c[0];K(`tengu_mcp_delete`,{name:e,scope:t}),await n(e,t),i(),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),J(`File modified: ${v(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),c.forEach(e=>{process.stderr.write(` - ${m(e)} (${v(e)})\n`)}),process.stderr.write(`
|
|
3
|
-
To remove from a specific scope, use:
|
|
4
|
-
`),c.forEach(t=>{process.stderr.write(` claude mcp remove "${e}" -s ${t}\n`)}),Y()}catch(e){Y(e.message)}}async function ge(){K(`tengu_mcp_list`,{});let{servers:e}=await b();if(Object.keys(e).length===0)console.log("No MCP servers configured. Use `claude mcp add` to add a server.");else{console.log(`Checking MCP server health...
|
|
5
|
-
`);let t=await C(Object.entries(e),async([e,t])=>({name:e,server:t,status:await Q(e,t)}),{concurrency:oe()});for(let{name:e,server:n,status:r}of t)if(n.type===`sse`)console.log(`${e}: ${n.url} (SSE) - ${r}`);else if(n.type===`http`)console.log(`${e}: ${n.url} (HTTP) - ${r}`);else if(n.type===`claudeai-proxy`)console.log(`${e}: ${n.url} - ${r}`);else if(!n.type||n.type===`stdio`){let t=n,i=Array.isArray(t.args)?t.args:[];console.log(`${e}: ${t.command} ${i.join(` `)} - ${r}`)}}await g(0)}async function $(e){K(`tengu_mcp_get`,{name:e});let t=u(e);t||Y(`No MCP server found with name: ${e}`),console.log(`${e}:`),console.log(` Scope: ${m(t.scope)}`);let n=await Q(e,t);if(console.log(` Status: ${n}`),t.type===`sse`){if(console.log(` Type: sse`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),x(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`http`){if(console.log(` Type: http`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),x(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`stdio`){console.log(` Type: stdio`),console.log(` Command: ${t.command}`);let e=Array.isArray(t.args)?t.args:[];if(console.log(` Args: ${e.join(` `)}`),t.env){console.log(` Environment:`);for(let[e,n]of Object.entries(t.env))console.log(` ${e}=${n}`)}}console.log(`\nTo remove this server, run: claude mcp remove "${e}" -s ${t.scope}`),await g(0)}async function _e(e,t,n){try{let r=y(n.scope),i=G(t),o=n.clientSecret&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&`oauth`in i&&i.oauth&&typeof i.oauth==`object`&&`clientId`in i.oauth?await ne():void 0;await a(e,i,r);let s=i&&typeof i==`object`&&`type`in i?String(i.type||`stdio`):`stdio`;o&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&p(e,{type:i.type,url:i.url},o),K(`tengu_mcp_add`,{scope:r,source:`json`,type:s}),J(`Added ${s} MCP server ${e} to ${r} config`)}catch(e){Y(e.message)}}async function ve(e){try{let t=y(e.scope);K(`tengu_mcp_add`,{scope:t,platform:H(),source:`desktop`});let{readClaudeDesktopMcpServers:n}=await import(`./claudeDesktop-DPIJpc1V.js`),r=await n();Object.keys(r).length===0&&J(`No MCP servers found in Claude Desktop configuration or configuration file does not exist.`);let{unmount:i}=await j((0,Z.jsx)(h,{children:(0,Z.jsx)(ee,{children:(0,Z.jsx)(pe,{servers:r,scope:t,onDone:()=>{i()}})})}),{exitOnCtrlC:!0})}catch(e){Y(e.message)}}async function ye(){K(`tengu_mcp_reset_mcpjson_choices`,{}),B(e=>({...e,enabledMcpjsonServers:[],disabledMcpjsonServers:[],enableAllProjectMcpServers:!1})),J(`All project-scoped (.mcp.json) server approvals and rejections have been reset.
|
|
6
|
-
You will be prompted for approval next time you start Work Mate.`)}export{ve as mcpAddFromDesktopHandler,_e as mcpAddJsonHandler,$ as mcpGetHandler,ge as mcpListHandler,he as mcpRemoveHandler,ye as mcpResetChoicesHandler,me as mcpServeHandler};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$h as n,Kw as r,Xh as i,Zh as a,bp as o,qw as s,xp as c,yp as l}from"./loadAgentsDir-JrGMJN05.js";import{ai as u,di as d,fi as f}from"./src-DL3w8VPk2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{D as m,E as h,q as g}from"./log-BlJ7CcKG.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{F as y,K as b,M as x,N as S,P as C,_ as w,b as T,et as E,it as D,rt as O,s as k,tt as A,w as j}from"./model-CmDF8O9G.js";import{i as M,n as N,r as P,t as F}from"./extraUsage-CwDhpClH.js";function I({onDone:e}){let t=a(e=>e.mainLoopModel),r=a(e=>e.mainLoopModelForSession),i=a(e=>e.fastMode),o=n();function s(){v(`tengu_model_command_menu`,{action:`cancel`});let n=H(t);e(`Kept model as ${d.bold(n)}`,{display:`system`})}function c(n){v(`tengu_model_command_menu`,{action:n,from_model:t,to_model:n}),o(e=>({...e,mainLoopModel:n,mainLoopModelForSession:null}));let r=`Set model to ${d.bold(H(n))}`,a;O()&&(b(),!D(n)&&i?(o(e=>({...e,fastMode:!1})),a=!1):D(n)&&A()&&i&&(r+=` · Fast mode ON`,a=!0)),N(n,a===!0,T())&&(r+=` · Billed as extra usage`),a===!1&&(r+=` · Fast mode OFF`),e(r)}return(0,W.jsx)(P,{initial:t,sessionModel:r,onSelect:c,onCancel:s,isStandaloneCommand:!0,showFastModeNotice:O()&&i&&D(t)&&A()})}function L({args:e,onDone:t}){let r=a(e=>e.fastMode),i=n(),o=e==="default"?null:e;return U.useEffect(()=>{async function e(){if(o&&!S(o)){t(`Model '${o}' is not available. Your organization restricts model selection.`,{display:`system`});return}if(o&&z(o)){t(`Opus 4.7 with 1M context is not available for your account. Learn more: https://code.workmate.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(o&&B(o)){t(`Sonnet 4.6 with 1M context is not available for your account. Learn more: https://code.workmate.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(!o){n(null);return}if(R(o)){n(o);return}try{let{valid:e,error:r}=await s(o);e?n(o):t(r||`Model '${o}' not found`,{display:`system`})}catch(e){t(`Failed to validate model: ${e.message}`,{display:`system`})}}function n(e){i(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null}));let n=`Set model to ${d.bold(H(e))}`,a;O()&&(b(),!D(e)&&r?(i(e=>({...e,fastMode:!1})),a=!1):D(e)&&r&&(n+=` · Fast mode ON`,a=!0)),N(e,a===!0,T())&&(n+=` · Billed as extra usage`),a===!1&&(n+=` · Fast mode OFF`),t(n)}e()},[o,t,i]),null}function R(e){return C.includes(e.toLowerCase().trim())}function z(e){let t=e.toLowerCase();return!l()&&!T()&&t.includes(`opus`)&&t.includes(`[1m]`)}function B(e){let t=e.toLowerCase();return!o()&&(t.includes(`sonnet[1m]`)||t.includes(`sonnet-4-6[1m]`))}function V({onDone:e}){let t=a(e=>e.mainLoopModel),n=a(e=>e.mainLoopModelForSession),r=H(t);return e(n?`Current model: ${d.bold(H(n))} (session override from plan mode)\nBase model: ${r}`:`Current model: ${r}`),null}function H(e){let t=j(e??k());return e===null?`${t} (default)`:t}var U,W,G;e((()=>{f(),U=t(u(),1),M(),g(),_(),i(),F(),E(),y(),c(),w(),x(),r(),W=p(),G=async(e,t,n)=>{if(n=n?.trim()||``,m.includes(n))return v(`tengu_model_command_inline_help`,{args:n}),(0,W.jsx)(V,{onDone:e});if(h.includes(n)){e(`Run /model to open the model selection menu, or /model [modelName] to set the model.`,{display:`system`});return}return n?(v(`tengu_model_command_inline`,{args:n}),(0,W.jsx)(L,{args:n,onDone:e})):(0,W.jsx)(I,{onDone:e})}}))();export{G as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,u as t}from"./model-CmDF8O9G.js";e();export{t as getMainLoopModel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t,r as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./memoize-BK3gG5ob.js";import{d as a,i as o,l as s,o as c,r as ee,s as l,t as u}from"./envUtils-DcaKZlRU.js";import{n as te,t as d}from"./defineProperty-C-QyHrDq.js";import{n as f,t as p}from"./axios-DaWTGg7G.js";import{di as ne,fi as re}from"./src-DL3w8VPk2.js";import{A as ie,C as ae,p as oe,w as se}from"./external-CEp-aPkt.js";import{n as ce,r as le,t as ue}from"./lazySchema-B4D4qJVE.js";import{$ as de,In as fe,Ir as pe,J as me,Lr as he,Wt as m,Z as ge,Zt as _e,dt as ve,lr as ye,pt as be,sn as xe,ur as Se,vn as Ce,y as we,z as h,zn as Te}from"./state-BPFYBqm1.js";import{B as Ee,C as De,F as Oe,G as ke,P as g,R as Ae,S as je,T as Me,W as Ne,c as _,f as Pe,i as v,o as Fe,s as Ie,u as Le,x as Re}from"./debug-BQj6h99Q.js";import{Wt as ze,c as y,f as b,g as x,n as Be,x as Ve}from"./settings-aUygByiZ.js";import{C as He,S as Ue,c as S,h as We,n as C,y as w}from"./config-BkbL2e5Q.js";import{a as Ge,c as Ke,i as qe,o as Je,r as Ye,s as Xe,t as Ze}from"./execFileNoThrow-DYm1GeGn.js";import{d as Qe,f as $e,o as et,s as T}from"./log-BlJ7CcKG.js";import{r as tt,t as nt}from"./memoize-_2f7NWDv.js";import{s as rt,u as it}from"./types-BomO8WUz.js";import{n as at,r as E}from"./analytics-DJobLaWP.js";import{l as D,n as ot,r as st,s as ct,t as lt,u as O}from"./oauth-D38aRTUb.js";import{n as ut,t as dt}from"./bundledMode--fG1S62b.js";import{n as ft,o as pt}from"./stringUtils-BjnclTLB.js";import{a as mt,i as ht,l as gt}from"./proxy-C0j74LqT.js";import{userInfo as _t}from"os";import{join as vt}from"path";import{chmodSync as yt,mkdirSync as bt,readFileSync as xt,writeFileSync as St}from"fs";import{createHash as Ct,randomUUID as wt}from"crypto";import{mkdir as Tt,stat as Et,writeFile as Dt}from"fs/promises";import{exec as Ot,execFile as kt}from"child_process";import{AsyncLocalStorage as At}from"async_hooks";function k(e=Be()){let t=e.modelType;return t===`openai`?`openai`:t===`gemini`?`gemini`:t===`grok`?`grok`:s(process.env.CLAUDE_CODE_USE_BEDROCK)?`bedrock`:s(process.env.CLAUDE_CODE_USE_VERTEX)?`vertex`:s(process.env.CLAUDE_CODE_USE_FOUNDRY)?`foundry`:s(process.env.CLAUDE_CODE_USE_OPENAI)?`openai`:s(process.env.CLAUDE_CODE_USE_GEMINI)?`gemini`:s(process.env.CLAUDE_CODE_USE_GROK)?`grok`:`firstParty`}function jt(){return k()}function Mt(){let e=process.env.ANTHROPIC_BASE_URL;if(!e)return!0;try{return new URL(e).host===`api.anthropic.com`}catch{return!1}}var A=e((()=>{x(),c()}));function Nt(){return Ft.getStore()?.workload}function Pt(e,t){return Ft.run({workload:e},t)}var Ft,It=e((()=>{Ft=new At}));function Lt(e){let t=[],n=!1;async function r(){if(!n&&t.length!==0){for(n=!0;t.length>0;){let{args:n,resolve:r,reject:i,context:a}=t.shift();try{r(await e.apply(a,n))}catch(e){i(e)}}n=!1,t.length>0&&r()}}return function(...e){return new Promise((n,i)=>{t.push({args:e,resolve:n,reject:i,context:this}),r()})}}var Rt=e((()=>{}));function zt(e,t){return e.find(e=>e.includes(t))??null}async function Bt(){let{BedrockClient:e}=await import(`./dist-es-yHGBqhBe.js`),t=u(),n=s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await ht(),...n&&{requestHandler:new(await(import(`./dist-es-C7vygWzp.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-gUzZ_7Vf.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await U();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}async function Vt(){let{BedrockRuntimeClient:e}=await import(`./dist-es-Gt_DpXlP.js`),t=u(),n=s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await ht(),...n&&{requestHandler:new(await(import(`./dist-es-C7vygWzp.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-gUzZ_7Vf.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await U();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}function Ht(e){return e.startsWith(`anthropic.`)}function Ut(e){if(!e.startsWith(`arn:`))return e;let t=e.lastIndexOf(`/`);return t===-1?e:e.substring(t+1)}function Wt(e){let t=Ut(e);for(let e of Jt)if(t.startsWith(`${e}.anthropic.`))return e}function Gt(e,t){let n=Wt(e);return n?e.replace(`${n}.`,`${t}.`):Ht(e)?`${t}.${e}`:e}var Kt,qt,Jt,Yt=e((()=>{i(),G(),c(),et(),gt(),Kt=r(async()=>{let[e,{ListInferenceProfilesCommand:t}]=await Promise.all([Bt(),import(`./dist-es-yHGBqhBe.js`)]),n=[],r;try{do{let i=new t({...r&&{nextToken:r},typeEquals:`SYSTEM_DEFINED`}),a=await e.send(i);a.inferenceProfileSummaries&&n.push(...a.inferenceProfileSummaries),r=a.nextToken}while(r);return n.filter(e=>e.inferenceProfileId?.includes(`anthropic`)).map(e=>e.inferenceProfileId).filter(Boolean)}catch(e){throw T(e),e}}),qt=r(async e=>{try{let[t,{GetInferenceProfileCommand:n}]=await Promise.all([Bt(),import(`./dist-es-yHGBqhBe.js`)]),r=new n({inferenceProfileIdentifier:e}),i=await t.send(r);if(!i.models||i.models.length===0)return null;let a=i.models[0];if(!a?.modelArn)return null;let o=a.modelArn.lastIndexOf(`/`);return o>=0?a.modelArn.substring(o+1):a.modelArn}catch(e){return T(e),null}}),Jt=[`us`,`eu`,`apac`,`global`]})),Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,dn=e((()=>{Xt={firstParty:`claude-3-7-sonnet-20250219`,bedrock:`us.anthropic.claude-3-7-sonnet-20250219-v1:0`,vertex:`claude-3-7-sonnet@20250219`,foundry:`claude-3-7-sonnet`,openai:`claude-3-7-sonnet-20250219`,gemini:`claude-3-7-sonnet-20250219`,grok:`claude-3-7-sonnet-20250219`},Zt={firstParty:`claude-3-5-sonnet-20241022`,bedrock:`anthropic.claude-3-5-sonnet-20241022-v2:0`,vertex:`claude-3-5-sonnet-v2@20241022`,foundry:`claude-3-5-sonnet`,openai:`claude-3-5-sonnet-20241022`,gemini:`claude-3-5-sonnet-20241022`,grok:`claude-3-5-sonnet-20241022`},Qt={firstParty:`claude-3-5-haiku-20241022`,bedrock:`us.anthropic.claude-3-5-haiku-20241022-v1:0`,vertex:`claude-3-5-haiku@20241022`,foundry:`claude-3-5-haiku`,openai:`claude-3-5-haiku-20241022`,gemini:`claude-3-5-haiku-20241022`,grok:`claude-3-5-haiku-20241022`},$t={firstParty:`claude-haiku-4-5-20251001`,bedrock:`us.anthropic.claude-haiku-4-5-20251001-v1:0`,vertex:`claude-haiku-4-5@20251001`,foundry:`claude-haiku-4-5`,openai:`claude-haiku-4-5-20251001`,gemini:`claude-haiku-4-5-20251001`,grok:`claude-haiku-4-5-20251001`},en={firstParty:`claude-sonnet-4-20250514`,bedrock:`us.anthropic.claude-sonnet-4-20250514-v1:0`,vertex:`claude-sonnet-4@20250514`,foundry:`claude-sonnet-4`,openai:`claude-sonnet-4-20250514`,gemini:`claude-sonnet-4-20250514`,grok:`claude-sonnet-4-20250514`},tn={firstParty:`claude-sonnet-4-5-20250929`,bedrock:`us.anthropic.claude-sonnet-4-5-20250929-v1:0`,vertex:`claude-sonnet-4-5@20250929`,foundry:`claude-sonnet-4-5`,openai:`claude-sonnet-4-5-20250929`,gemini:`claude-sonnet-4-5-20250929`,grok:`claude-sonnet-4-5-20250929`},nn={firstParty:`claude-opus-4-20250514`,bedrock:`us.anthropic.claude-opus-4-20250514-v1:0`,vertex:`claude-opus-4@20250514`,foundry:`claude-opus-4`,openai:`claude-opus-4-20250514`,gemini:`claude-opus-4-20250514`,grok:`claude-opus-4-20250514`},rn={firstParty:`claude-opus-4-1-20250805`,bedrock:`us.anthropic.claude-opus-4-1-20250805-v1:0`,vertex:`claude-opus-4-1@20250805`,foundry:`claude-opus-4-1`,openai:`claude-opus-4-1-20250805`,gemini:`claude-opus-4-1-20250805`,grok:`claude-opus-4-1-20250805`},an={firstParty:`claude-opus-4-5-20251101`,bedrock:`us.anthropic.claude-opus-4-5-20251101-v1:0`,vertex:`claude-opus-4-5@20251101`,foundry:`claude-opus-4-5`,openai:`claude-opus-4-5-20251101`,gemini:`claude-opus-4-5-20251101`,grok:`claude-opus-4-5-20251101`},on={firstParty:`claude-opus-4-6`,bedrock:`us.anthropic.claude-opus-4-6-v1`,vertex:`claude-opus-4-6`,foundry:`claude-opus-4-6`,openai:`claude-opus-4-6`,gemini:`claude-opus-4-6`,grok:`claude-opus-4-6`},sn={firstParty:`claude-opus-4-7`,bedrock:`us.anthropic.claude-opus-4-7-v1`,vertex:`claude-opus-4-7`,foundry:`claude-opus-4-7`,openai:`claude-opus-4-7`,gemini:`claude-opus-4-7`,grok:`claude-opus-4-7`},cn={firstParty:`claude-sonnet-4-6`,bedrock:`us.anthropic.claude-sonnet-4-6`,vertex:`claude-sonnet-4-6`,foundry:`claude-sonnet-4-6`,openai:`claude-sonnet-4-6`,gemini:`claude-sonnet-4-6`,grok:`claude-sonnet-4-6`},ln={haiku35:Qt,haiku45:$t,sonnet35:Zt,sonnet37:Xt,sonnet40:en,sonnet45:tn,sonnet46:cn,opus40:nn,opus41:rn,opus45:an,opus46:on,opus47:sn},Object.values(ln).map(e=>e.firstParty),un=Object.fromEntries(Object.entries(ln).map(([e,t])=>[t.firstParty,e]))}));function fn(e){let t={};for(let n of vn)t[n]=ln[n][e];return t}async function pn(){let e=fn(`bedrock`),t;try{t=await Kt()}catch(t){return T(t),e}if(!t?.length)return e;let n={};for(let r of vn){let i=ln[r].firstParty;n[r]=zt(t,i)||e[r]}return n}function mn(e){let t=Be().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=un[e];t&&r&&(n[t]=r)}return n}function hn(e){let t;try{t=Be().modelOverrides}catch{return e}if(!t)return e;for(let[n,r]of Object.entries(t))if(r===e)return n;return e}function gn(){if(ge()===null){if(k()!==`bedrock`){fe(fn(k()));return}yn()}}function j(){let e=ge();return e===null?(gn(),mn(fn(k()))):mn(e)}async function _n(){if(ge()===null){if(k()!==`bedrock`){fe(fn(k()));return}await yn()}}var vn,yn,bn=e((()=>{m(),et(),Rt(),x(),Yt(),dn(),A(),vn=Object.keys(ln),yn=Lt(async()=>{if(ge()===null)try{fe(await pn())}catch(e){T(e)}})}));async function xn(){let e=S().oauthAccount?.accountUuid,t=ea();if(!e||!t)return;let n=`${D().BASE_API_URL}/api/claude_cli_profile`;try{return(await f.get(n,{headers:{"x-api-key":t,"anthropic-beta":ct},params:{account_uuid:e},timeout:1e4})).data}catch(e){T(e)}}async function Sn(e){let t=`${D().BASE_API_URL}/api/oauth/profile`;try{return(await f.get(t,{headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},timeout:1e4})).data}catch(e){T(e)}}var Cn=e((()=>{p(),O(),G(),We(),et()}));function wn(e){return!!e?.includes(ot)}function Tn(e){return e?.split(` `).filter(Boolean)??[]}function En({codeChallenge:e,state:t,port:n,isManual:r,loginWithClaudeAi:i,inferenceOnly:a,orgUUID:o,loginHint:s,loginMethod:c}){let ee=i?D().CLAUDE_AI_AUTHORIZE_URL:D().CONSOLE_AUTHORIZE_URL,l=new URL(ee);l.searchParams.append(`code`,`true`),l.searchParams.append(`client_id`,D().CLIENT_ID),l.searchParams.append(`response_type`,`code`),l.searchParams.append(`redirect_uri`,r?D().MANUAL_REDIRECT_URL:`http://localhost:${n}/callback`);let u=a?[ot]:lt;return l.searchParams.append(`scope`,u.join(` `)),l.searchParams.append(`code_challenge`,e),l.searchParams.append(`code_challenge_method`,`S256`),l.searchParams.append(`state`,t),o&&l.searchParams.append(`orgUUID`,o),s&&l.searchParams.append(`login_hint`,s),c&&l.searchParams.append(`login_method`,c),l.toString()}async function Dn(e,t,n,r,i=!1,a){let o={grant_type:`authorization_code`,code:e,redirect_uri:i?D().MANUAL_REDIRECT_URL:`http://localhost:${r}/callback`,client_id:D().CLIENT_ID,code_verifier:n,state:t};a!==void 0&&(o.expires_in=a);let s=await f.post(D().TOKEN_URL,o,{headers:{"Content-Type":`application/json`},timeout:15e3});if(s.status!==200)throw Error(s.status===401?`Authentication failed: Invalid authorization code`:`Token exchange failed (${s.status}): ${s.statusText}`);return E(`tengu_oauth_token_exchange_success`,{}),s.data}async function On(e,{scopes:t}={}){let n={grant_type:`refresh_token`,refresh_token:e,client_id:D().CLIENT_ID,scope:(t?.length?t:st).join(` `)};try{let t=await f.post(D().TOKEN_URL,n,{headers:{"Content-Type":`application/json`},timeout:15e3});if(t.status!==200)throw Error(`Token refresh failed: ${t.statusText}`);let r=t.data,{access_token:i,refresh_token:a=e,expires_in:o}=r,s=Date.now()+o*1e3,c=Tn(r.scope);E(`tengu_oauth_token_refresh_success`,{});let ee=S(),l=W(),u=ee.oauthAccount?.billingType!==void 0&&ee.oauthAccount?.accountCreatedAt!==void 0&&ee.oauthAccount?.subscriptionCreatedAt!==void 0&&l?.subscriptionType!=null&&l?.rateLimitTier!=null?null:await Mn(i);if(u&&ee.oauthAccount){let e={};u.displayName!==void 0&&(e.displayName=u.displayName),typeof u.hasExtraUsageEnabled==`boolean`&&(e.hasExtraUsageEnabled=u.hasExtraUsageEnabled),u.billingType!==null&&(e.billingType=u.billingType),u.accountCreatedAt!==void 0&&(e.accountCreatedAt=u.accountCreatedAt),u.subscriptionCreatedAt!==void 0&&(e.subscriptionCreatedAt=u.subscriptionCreatedAt),Object.keys(e).length>0&&w(t=>({...t,oauthAccount:t.oauthAccount?{...t.oauthAccount,...e}:t.oauthAccount}))}return{accessToken:i,refreshToken:a,expiresAt:s,scopes:c,subscriptionType:u?.subscriptionType??l?.subscriptionType??null,rateLimitTier:u?.rateLimitTier??l?.rateLimitTier??null,profile:u?.rawProfile,tokenAccount:r.account?{uuid:r.account.uuid,emailAddress:r.account.email_address,organizationUuid:r.organization?.uuid}:void 0}}catch(e){let t=f.isAxiosError(e)&&e.response?.data?JSON.stringify(e.response.data):void 0;throw E(`tengu_oauth_token_refresh_failure`,{error:e.message,...t&&{responseBody:t}}),e}}async function kn(e){let t=await f.get(D().ROLES_URL,{headers:{Authorization:`Bearer ${e}`}});if(t.status!==200)throw Error(`Failed to fetch user roles: ${t.statusText}`);let n=t.data;if(!S().oauthAccount)throw Error(`OAuth account information not found in config`);w(e=>({...e,oauthAccount:e.oauthAccount?{...e.oauthAccount,organizationRole:n.organization_role,workspaceRole:n.workspace_role,organizationName:n.organization_name}:e.oauthAccount})),E(`tengu_oauth_roles_stored`,{org_role:n.organization_role})}async function An(e){try{let t=await f.post(D().API_KEY_URL,null,{headers:{Authorization:`Bearer ${e}`}}),n=t.data?.raw_key;return n?(await ka(n),E(`tengu_oauth_api_key`,{status:`success`,statusCode:t.status}),n):null}catch(e){throw E(`tengu_oauth_api_key`,{status:`failure`,error:e instanceof Error?e.message:String(e)}),e}}function jn(e){return e!==null&&Date.now()+300*1e3>=e}async function Mn(e){let t=await Sn(e),n=t?.organization?.organization_type,r=null;switch(n){case`claude_max`:r=`max`;break;case`claude_pro`:r=`pro`;break;case`claude_enterprise`:r=`enterprise`;break;case`claude_team`:r=`team`;break;default:r=null;break}let i={subscriptionType:r,rateLimitTier:t?.organization?.rate_limit_tier??null,hasExtraUsageEnabled:t?.organization?.has_extra_usage_enabled??null,billingType:t?.organization?.billing_type??null};return t?.account?.display_name&&(i.displayName=t.account.display_name),t?.account?.created_at&&(i.accountCreatedAt=t.account.created_at),t?.organization?.subscription_created_at&&(i.subscriptionCreatedAt=t.organization.subscription_created_at),E(`tengu_oauth_profile_fetch_success`,{}),{...i,rawProfile:t}}async function Nn(){let e=S().oauthAccount?.organizationUuid;if(e)return e;let t=W()?.accessToken;return t===void 0||!Va()?null:(await Sn(t))?.organization?.uuid||null}async function Pn(){let e=process.env.CLAUDE_CODE_ACCOUNT_UUID,t=process.env.CLAUDE_CODE_USER_EMAIL,n=process.env.CLAUDE_CODE_ORGANIZATION_UUID,r=!!(e&&t&&n);e&&t&&n&&(S().oauthAccount||Fn({accountUuid:e,emailAddress:t,organizationUuid:n})),await za();let i=S();if(i.oauthAccount&&i.oauthAccount.billingType!==void 0&&i.oauthAccount.accountCreatedAt!==void 0&&i.oauthAccount.subscriptionCreatedAt!==void 0||!R()||!Va())return!1;let a=W();if(a?.accessToken){let e=await Sn(a.accessToken);if(e)return r&&_(`OAuth profile fetch succeeded, overriding env var account info`,{level:`info`}),Fn({accountUuid:e.account.uuid,emailAddress:e.account.email,organizationUuid:e.organization.uuid,displayName:e.account.display_name||void 0,hasExtraUsageEnabled:e.organization.has_extra_usage_enabled??!1,billingType:e.organization.billing_type??void 0,accountCreatedAt:e.account.created_at,subscriptionCreatedAt:e.organization.subscription_created_at??void 0}),!0}return!1}function Fn({accountUuid:e,emailAddress:t,organizationUuid:n,displayName:r,hasExtraUsageEnabled:i,billingType:a,accountCreatedAt:o,subscriptionCreatedAt:s}){let c={accountUuid:e,emailAddress:t,organizationUuid:n,hasExtraUsageEnabled:i,billingType:a,accountCreatedAt:o,subscriptionCreatedAt:s};r&&(c.displayName=r),w(e=>e.oauthAccount?.accountUuid===c.accountUuid&&e.oauthAccount?.emailAddress===c.emailAddress&&e.oauthAccount?.organizationUuid===c.organizationUuid&&e.oauthAccount?.displayName===c.displayName&&e.oauthAccount?.hasExtraUsageEnabled===c.hasExtraUsageEnabled&&e.oauthAccount?.billingType===c.billingType&&e.oauthAccount?.accountCreatedAt===c.accountCreatedAt&&e.oauthAccount?.subscriptionCreatedAt===c.subscriptionCreatedAt?e:{...e,oauthAccount:c})}var In=e((()=>{p(),at(),O(),G(),We(),v(),Cn()}));function Ln(e,t,n){if(s(process.env.CLAUDE_CODE_REMOTE))try{bt(Hn,{recursive:!0,mode:448}),St(e,t,{encoding:`utf8`,mode:384}),_(`Persisted ${n} to ${e} for subprocess access`)}catch(e){_(`Failed to persist ${n} to disk (non-fatal): ${g(e)}`,{level:`error`})}}function Rn(e,t){try{let n=Le().readFileSync(e,{encoding:`utf8`}).trim();return n?(_(`Read ${t} from well-known file ${e}`),n):null}catch(n){return Ee(n)||_(`Failed to read ${t} from ${e}: ${g(n)}`,{level:`debug`}),null}}function zn({envVar:e,wellKnownPath:t,label:n,getCached:r,setCached:i}){let a=r();if(a!==void 0)return a;let o=process.env[e];if(!o){let e=Rn(t,n);return i(e),e}let s=parseInt(o,10);if(Number.isNaN(s))return _(`${e} must be a valid file descriptor number, got: ${o}`,{level:`error`}),i(null),null;try{let e=Le(),r=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${s}`:`/proc/self/fd/${s}`,a=e.readFileSync(r,{encoding:`utf8`}).trim();return a?(_(`Successfully read ${n} from file descriptor ${s}`),i(a),Ln(t,a,n),a):(_(`File descriptor contained empty ${n}`,{level:`error`}),i(null),null)}catch(e){_(`Failed to read ${n} from file descriptor ${s}: ${g(e)}`,{level:`error`});let r=Rn(t,n);return i(r),r}}function Bn(){return zn({envVar:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,wellKnownPath:Un,label:`OAuth token`,getCached:de,setCached:Te})}function Vn(){return zn({envVar:`CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR`,wellKnownPath:Wn,label:`API key`,getCached:we,setCached:xe})}var Hn,Un,Wn,Gn,Kn=e((()=>{m(),v(),c(),Ae(),Pe(),Hn=`/home/claude/.workmate/remote`,Un=`${Hn}/.oauth_token`,Wn=`${Hn}/.api_key`,Gn=`${Hn}/.session_ingress_token`}));function M(e=``){let t=o(),n=process.env.WORKMATE_CONFIG_DIR?`-${Ct(`sha256`).update(t).digest(`hex`).substring(0,8)}`:``;return`Claude Code${D().OAUTH_FILE_SUFFIX}${e}${n}`}function qn(){try{return process.env.USER||_t().username}catch{return`claude-code-user`}}function N(){P.cache={data:null,cachedAt:0},P.generation++,P.readInFlight=null}function Jn(e){if(P.cache.cachedAt!==0)return;let t=null;if(e)try{t=JSON.parse(e)}catch{return}P.cache={data:t,cachedAt:Date.now()}}var Yn,P,Xn=e((()=>{O(),c(),Yn=`-credentials`,P={cache:{data:null,cachedAt:0},generation:0,readInFlight:null}}));async function Zn(){if(process.platform===`darwin`&&(await Je(`security delete-generic-password -a $USER -s "${M()}"`,{shell:!0,reject:!1})).exitCode!==0)throw Error(`Failed to delete keychain entry`)}function Qn(e){return e.slice(-20)}var $n=e((()=>{Ke(),Xn()}));function er(e){return e?.name===`CredentialsProviderError`}function tr(e){if(!e||typeof e!=`object`)return!1;let t=e;if(!t.Credentials||typeof t.Credentials!=`object`)return!1;let n=t.Credentials;return typeof n.AccessKeyId==`string`&&typeof n.SecretAccessKey==`string`&&typeof n.SessionToken==`string`&&n.AccessKeyId.length>0&&n.SecretAccessKey.length>0&&n.SessionToken.length>0}async function nr(){let{STSClient:e,GetCallerIdentityCommand:t}=await import(`./dist-es-C-OjW2Ao.js`);await new e().send(new t({}))}async function rr(){try{_(`Clearing AWS credential provider cache`);let{fromIni:e}=await import(`./dist-es-CIULjvtA2.js`);await e({ignoreCache:!0})(),_(`AWS credential provider cache refreshed`)}catch{_(`Failed to clear AWS credential cache (this is expected if no credentials are configured)`)}}var ir=e((()=>{v()})),ar,or=e((()=>{Se(),te(),ar=class e{constructor(){d(this,`status`,{isAuthenticating:!1,output:[]}),d(this,`changed`,ye()),d(this,`subscribe`,this.changed.subscribe)}static getInstance(){return e.instance||(e.instance=new e),e.instance}getStatus(){return{...this.status,output:[...this.status.output]}}startAuthentication(){this.status={isAuthenticating:!0,output:[]},this.changed.emit(this.getStatus())}addOutput(e){this.status.output.push(e),this.changed.emit(this.getStatus())}setError(e){this.status.error=e,this.changed.emit(this.getStatus())}endAuthentication(e){e?this.status={isAuthenticating:!1,output:[]}:this.status.isAuthenticating=!1,this.changed.emit(this.getStatus())}static reset(){e.instance&&(e.instance.changed.clear(),e.instance=null)}},d(ar,`instance`,null)})),sr,cr,lr,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,br=e((()=>{sr=`claude-code-20250219`,cr=`interleaved-thinking-2025-05-14`,lr=`context-1m-2025-08-07`,ur=`context-management-2025-06-27`,dr=`structured-outputs-2025-12-15`,fr=`tool-search-tool-2025-10-19`,pr=`task-budgets-2026-03-13`,mr=`prompt-caching-scope-2026-01-05`,hr=`fast-mode-2026-02-01`,gr=`redact-thinking-2026-02-12`,_r=`advisor-tool-2026-03-01`,vr=new Set([cr,lr,fr]),yr=new Set([sr,cr,ur])}));function xr(e,t){return pe(e,t)}var Sr=e((()=>{he()}));function Cr(){let e=process.env.CLAUDE_AGENT_SDK_VERSION?`, agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`:``,t=process.env.CLAUDE_AGENT_SDK_CLIENT_APP?`, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`:``,n=Nt(),r=n?`, workload/${n}`:``;return`claude-cli/0.0.14 (external, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function wr(){let e=[];return process.env.CLAUDE_CODE_ENTRYPOINT&&e.push(process.env.CLAUDE_CODE_ENTRYPOINT),process.env.CLAUDE_AGENT_SDK_VERSION&&e.push(`agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`),process.env.CLAUDE_AGENT_SDK_CLIENT_APP&&e.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`),`workmate/0.0.14${e.length>0?` (${e.join(`, `)})`:``}`}function Tr(){if(R()){let e=W();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":ct}}:{headers:{},error:`No OAuth token available`}}let e=ea();return e?{headers:{"x-api-key":e}}:{headers:{},error:`No API key available`}}async function Er(e,t){try{return await e()}catch(n){if(!f.isAxiosError(n))throw n;let r=n.response?.status;if(!(r===401||t?.also403Revoked&&r===403&&typeof n.response?.data==`string`&&n.response.data.includes(`OAuth token has been revoked`)))throw n;let i=W()?.accessToken;if(!i)throw n;return await Ia(i),await e()}}var Dr=e((()=>{p(),O(),G(),It()}));function Or(){return{error:(e,...t)=>console.error(`[SDK ERROR]`,e,...t),warn:(e,...t)=>console.error(`[SDK WARN]`,e,...t),info:(e,...t)=>console.error(`[SDK INFO]`,e,...t),debug:(e,...t)=>console.error(`[SDK DEBUG]`,e,...t)}}async function kr({apiKey:e,maxRetries:n,model:r,fetchOverride:i,source:a}){let o=process.env.CLAUDE_CODE_CONTAINER_ID,c=process.env.CLAUDE_CODE_REMOTE_SESSION_ID,l=process.env.CLAUDE_AGENT_SDK_CLIENT_APP,te=jr(),d={"x-app":`cli`,"User-Agent":Cr(),"X-Claude-Code-Session-Id":be(),...te,...o?{"x-claude-remote-container-id":o}:{},...c?{"x-claude-remote-session-id":c}:{},...l?{"x-client-app":l}:{},...process.env.ANTHROPIC_AUTH_NONCE?{"x-auth-nonce":process.env.ANTHROPIC_AUTH_NONCE}:{}};_(`[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: ${!!process.env.ANTHROPIC_CUSTOM_HEADERS}, has Authorization header: ${!!te.Authorization}`),s(process.env.CLAUDE_CODE_ADDITIONAL_PROTECTION)&&(d[`x-anthropic-additional-protection`]=`true`),_(`[API:auth] OAuth token check starting`),await za(),_(`[API:auth] OAuth token check complete`),R()||await Ar(d,h());let f=Mr(i,a),p={defaultHeaders:d,maxRetries:n,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:mt({forAnthropicAPI:!0}),...f&&{fetch:f}};if(s(process.env.CLAUDE_CODE_USE_BEDROCK)){let{BedrockClient:e}=await import(`./bedrockClient-DxE_mHFI.js`),t=r===Ns()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:u(),n={...p,awsRegion:t,...s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...Fe()&&{logger:Or()}};if(process.env.AWS_BEARER_TOKEN_BEDROCK)n.skipAuth=!0,n.defaultHeaders={...n.defaultHeaders,Authorization:`Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`};else if(!s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)){let e=await U();e&&(n.awsAccessKey=e.accessKeyId,n.awsSecretKey=e.secretAccessKey,n.awsSessionToken=e.sessionToken)}return new e(n)}if(s(process.env.CLAUDE_CODE_USE_FOUNDRY)){let{AnthropicFoundry:e}=await import(`./foundry-sdk-BdeF2aBu.js`),t;if(!process.env.ANTHROPIC_FOUNDRY_API_KEY)if(s(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH))t=()=>Promise.resolve(``);else{let{DefaultAzureCredential:e,getBearerTokenProvider:n}=await import(`./esm-CGx9qY3q.js`);t=n(new e,`https://cognitiveservices.azure.com/.default`)}return new e({...p,...t&&{azureADTokenProvider:t},...Fe()&&{logger:Or()}})}if(s(process.env.CLAUDE_CODE_USE_VERTEX)){s(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)||await mo();let[{AnthropicVertex:e},{GoogleAuth:n}]=await Promise.all([import(`./vertex-sdk-DjXcZ2J7.js`),import(`./src-CiJCsqUl.js`).then(e=>t(e.default,1))]),i=process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project,a=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials,o=s(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)?{getClient:()=>({getRequestHeaders:()=>({})})}:new n({scopes:[`https://www.googleapis.com/auth/cloud-platform`],...i||a?{}:{projectId:process.env.ANTHROPIC_VERTEX_PROJECT_ID}});return new e({...p,region:ee(r),googleAuth:o,...Fe()&&{logger:Or()}})}return new ke({apiKey:R()?null:e||ea(),authToken:R()?W()?.accessToken:void 0,...p,...Fe()&&{logger:Or()}})}async function Ar(e,t){let n=process.env.ANTHROPIC_AUTH_TOKEN||await ua(t);n&&(e.Authorization=`Bearer ${n}`)}function jr(){let e={},t=process.env.ANTHROPIC_CUSTOM_HEADERS;if(!t)return e;let n=t.split(/\n|\r\n/);for(let t of n){if(!t.trim())continue;let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n).trim(),i=t.slice(n+1).trim();r&&(e[r]=i)}return e}function Mr(e,t){let n=e??globalThis.fetch,r=k()===`firstParty`&&Mt();return(e,i)=>{let a=new Headers(i?.headers);r&&!a.has(`x-client-request-id`)&&a.set(Nr,wt());try{let n=e instanceof Request?e.url:String(e),r=a.get(Nr);_(`[API REQUEST] ${new URL(n).pathname}${r?` ${Nr}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var Nr,Pr=e((()=>{Ne(),G(),Dr(),$(),A(),gt(),m(),v(),c(),Nr=`x-client-request-id`}));function Fr(){return vt(o(),`cache`)}function Ir(){return vt(Fr(),`model-capabilities.json`)}function Lr(){return!(k()!==`firstParty`||!Mt())}function Rr(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function zr(e){if(!Lr())return;let t=Ur(Ir());if(!t||t.length===0)return;let n=e.toLowerCase();return t.find(e=>e.id.toLowerCase()===n)||t.find(e=>n.includes(e.id.toLowerCase()))}async function Br(){if(Lr()&&!$e())try{let e=await kr({maxRetries:1}),t=R()?[ct]:void 0,n=[];for await(let r of e.models.list({betas:t})){let e=Vr().safeParse(r);e.success&&n.push(e.data)}if(n.length===0)return;let r=Ir(),i=Rr(n);if(xr(Ur(r),i)){_(`[modelCapabilities] cache unchanged, skipping write`);return}await Tt(Fr(),{recursive:!0}),await Dt(r,De({models:i,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),Ur.cache.delete(r),_(`[modelCapabilities] cached ${i.length} models`)}catch(e){_(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var Vr,Hr,Ur,Wr=e((()=>{Sr(),i(),le(),O(),Pr(),G(),v(),c(),rt(),ue(),Qe(),Re(),A(),Vr=ce(()=>se({id:ie(),max_input_tokens:ae().optional(),max_tokens:ae().optional()}).strip()),Hr=ce(()=>se({models:oe(Vr()),timestamp:ae()})),Ur=r(e=>{try{let t=xt(e,`utf-8`),n=Hr().safeParse(it(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function Gr(){return s(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function F(e){return!Gr()&&/\[1m\]/i.test(e)}function Kr(e){if(Gr())return!1;let t=Z(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function qr(e,t){if(F(e))return 1e6;let n=zr(e);return n?.max_input_tokens&&n.max_input_tokens>=1e5?n.max_input_tokens>2e5&&Gr()?Qr:n.max_input_tokens:t?.includes(`context-1m-2025-08-07`)&&Kr(e)||Jr(e)?1e6:Qr}function Jr(e){return Gr()||F(e)||!Z(e).includes(`sonnet-4-6`)?!1:S().clientDataCache?.coral_reef_sonnet===`true`}function Yr(e,t){if(!e)return{used:null,remaining:null};let n=e.input_tokens+e.cache_creation_input_tokens+e.cache_read_input_tokens;if(n===0)return{used:null,remaining:null};let r=Math.round(n/t*100),i=Math.min(100,Math.max(0,r));return{used:i,remaining:100-i}}function Xr(e){let t,n,r=Z(e);r.includes(`opus-4-7`)||r.includes(`opus-4-6`)?(t=64e3,n=128e3):r.includes(`sonnet-4-6`)?(t=32e3,n=128e3):r.includes(`opus-4-5`)||r.includes(`sonnet-4`)||r.includes(`haiku-4`)?(t=32e3,n=64e3):r.includes(`opus-4-1`)||r.includes(`opus-4`)?(t=32e3,n=32e3):r.includes(`claude-3-opus`)?(t=4096,n=4096):r.includes(`claude-3-sonnet`)?(t=8192,n=8192):r.includes(`claude-3-haiku`)?(t=4096,n=4096):r.includes(`3-5-sonnet`)||r.includes(`3-5-haiku`)?(t=8192,n=8192):r.includes(`3-7-sonnet`)?(t=32e3,n=64e3):(t=ei,n=ti);let i=zr(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function Zr(e){return Xr(e).upperLimit-1}var Qr,$r,ei,ti,ni,ri=e((()=>{br(),We(),c(),$(),Wr(),Qr=2e5,$r=2e4,ei=32e3,ti=64e3,ni=8e3})),ii,ai,oi,si=e((()=>{i(),A(),ii=[{modelEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],ai=[{modelEnvVar:`OPENAI_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],oi=r((e,t)=>{if(k()===`firstParty`)return;let n=e.toLowerCase(),r=k()===`openai`?ai:ii;for(let e of r){let r=process.env[e.modelEnvVar],i=process.env[e.capabilitiesEnvVar];if(!(!r||i===void 0)&&n===r.toLowerCase())return i.toLowerCase().split(`,`).map(e=>e.trim()).includes(t)}},(e,t)=>`${e.toLowerCase()}:${t}`)}));function ci(e){let t=[],n=[];for(let r of e)vi.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function li(e){if(!e||e.length===0)return;if(R()){console.warn(`Warning: Custom betas are only available for API key users. Ignoring provided betas.`);return}let{allowed:t,disallowed:n}=ci(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${vi.join(`, `)}`);return t.length>0?t:void 0}function ui(e){let t=oi(e,`interleaved_thinking`);if(t!==void 0)return t;let n=Z(e),r=k();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function di(e){let t=Z(e),n=k();return n===`foundry`?!0:n===`firstParty`?!t.includes(`claude-3-`):t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function fi(e){let t=Z(e),n=k();return n!==`firstParty`&&n!==`foundry`?!1:t.includes(`claude-sonnet-4-6`)||t.includes(`claude-sonnet-4-5`)||t.includes(`claude-opus-4-1`)||t.includes(`claude-opus-4-5`)||t.includes(`claude-opus-4-6`)||t.includes(`claude-opus-4-7`)||t.includes(`claude-haiku-4-5`)}function pi(e){return!0}function mi(){return(k()===`firstParty`||k()===`foundry`)&&!s(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&Mt()}function hi(){return k()===`firstParty`&&!s(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function gi(e,t){let n=[...bi(e)];t?.isAgenticQuery&&(n.includes(`claude-code-20250219`)||n.push(sr));let r=ve();return!r||r.length===0?n:[...n,...r.filter(e=>!n.includes(e))]}function _i(){yi.cache?.clear?.(),bi.cache?.clear?.(),xi.cache?.clear?.()}var vi,yi,bi,xi,Si=e((()=>{i(),m(),br(),O(),G(),ri(),c(),$(),si(),A(),x(),vi=[lr],yi=r(e=>{let t=[],n=Z(e).includes(`haiku`);k();let r=mi();n||t.push(sr),R()&&t.push(ct),F(e)&&t.push(lr),!s(process.env.DISABLE_INTERLEAVED_THINKING)&&ui(e)&&t.push(cr),r&&ui(e)&&!h()&&Be().showThinkingSummaries!==!0&&t.push(gr);let i=s(process.env.USE_API_CONTEXT_MANAGEMENT)||di(e),a=di(e);return mi()&&(i||a)&&t.push(ur),r&&fi(e),r&&t.push(mr),process.env.ANTHROPIC_BETAS&&t.push(...process.env.ANTHROPIC_BETAS.split(`,`).map(e=>e.trim()).filter(Boolean)),t}),bi=r(e=>{let t=yi(e);return k()===`bedrock`?t.filter(e=>!vr.has(e)):t}),xi=r(e=>yi(e).filter(e=>vr.has(e)))}));function Ci(e,t){return{name:`${e.name}-with-${t.name}-fallback`,read(){return e.read()??(t.read()||{})},async readAsync(){return await e.readAsync()??(await t.readAsync()||{})},update(n){let r=e.read(),i=e.update(n);if(i.success)return r===null&&t.delete(),i;let a=t.update(n);return a.success?(r!==null&&e.delete(),{success:!0,warning:a.warning}):{success:!1}},delete(){let n=e.delete(),r=t.delete();return n||r}}}var wi=e((()=>{}));async function Ti(){try{let e=M(Yn),{stdout:t,code:n}=await Ze(`security`,[`find-generic-password`,`-a`,qn(),`-w`,`-s`,e],{useCwd:!1,preserveOutputOnError:!1});if(n===0&&t)return je(t.trim())}catch{}return null}function Ei(){if(ki!==void 0)return ki;if(process.platform!==`darwin`)return ki=!1,!1;try{ki=Xe(`security`,[`show-keychain-info`],{reject:!1,stdio:[`ignore`,`pipe`,`pipe`]}).exitCode===36}catch{ki=!1}return ki}var Di,Oi,ki,Ai=e((()=>{Ke(),v(),Ye(),Ge(),Re(),Xn(),Di=4032,Oi={name:`keychain`,read(){let e=P.cache;if(Date.now()-e.cachedAt<3e4)return e.data;try{let e=M(Yn),t=qe(`security find-generic-password -a "${qn()}" -w -s "${e}"`);if(t){let e=je(t);return P.cache={data:e,cachedAt:Date.now()},e}}catch{}return e.data===null?(P.cache={data:null,cachedAt:Date.now()},null):(_(`[keychain] read failed; serving stale cache`,{level:`warn`}),P.cache={data:e.data,cachedAt:Date.now()},e.data)},async readAsync(){let e=P.cache;if(Date.now()-e.cachedAt<3e4)return e.data;if(P.readInFlight)return P.readInFlight;let t=P.generation,n=Ti().then(n=>{if(t===P.generation){n===null&&e.data!==null&&_(`[keychain] readAsync failed; serving stale cache`,{level:`warn`});let t=n??e.data;return P.cache={data:t,cachedAt:Date.now()},P.readInFlight=null,t}return n});return P.readInFlight=n,n},update(e){N();try{let t=M(Yn),n=qn(),r=De(e),i=Buffer.from(r,`utf-8`).toString(`hex`),a=`add-generic-password -U -a "${n}" -s "${t}" -X "${i}"\n`,o;return a.length<=Di?o=Xe(`security`,[`-i`],{input:a,stdio:[`pipe`,`pipe`,`pipe`],reject:!1}):(_(`Keychain payload (${r.length}B JSON) exceeds security -i stdin limit; using argv`,{level:`warn`}),o=Xe(`security`,[`add-generic-password`,`-U`,`-a`,n,`-s`,t,`-X`,i],{stdio:[`ignore`,`pipe`,`pipe`],reject:!1})),o.exitCode===0?(P.cache={data:e,cachedAt:Date.now()},{success:!0}):{success:!1}}catch{return{success:!1}}},delete(){N();try{let e=M(Yn);return qe(`security delete-generic-password -a "${qn()}" -s "${e}"`),!0}catch{return!1}}}}));function ji(){let e=o();return{storageDir:e,storagePath:vt(e,`.credentials.json`)}}var Mi,Ni=e((()=>{c(),Ae(),Pe(),Re(),Mi={name:`plaintext`,read(){let{storagePath:e}=ji();try{return je(Le().readFileSync(e,{encoding:`utf8`}))}catch{return null}},async readAsync(){let{storagePath:e}=ji();try{return je(await Le().readFile(e,{encoding:`utf8`}))}catch{return null}},update(e){try{let{storageDir:t,storagePath:n}=ji();try{Le().mkdirSync(t)}catch(e){if(Oe(e)!==`EEXIST`)throw e}return Me(n,De(e),{encoding:`utf8`,flush:!1}),yt(n,384),{success:!0,warning:`Warning: Storing credentials in plaintext.`}}catch{return{success:!1}}},delete(){let{storagePath:e}=ji();try{return Le().unlinkSync(e),!0}catch(e){return Oe(e)===`ENOENT`}}}}));function Pi(){return process.platform===`darwin`?Ci(Oi,Mi):Mi}var Fi=e((()=>{wi(),Ai(),Ni()}));function Ii(e){return new Promise(t=>{kt(`security`,[`find-generic-password`,`-a`,qn(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:Vi},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function Li(){if(process.platform!==`darwin`||Ui||l())return;let e=Ii(M(Yn)),t=Ii(M());Ui=Promise.all([e,t]).then(([e,t])=>{e.timedOut||Jn(e.stdout),t.timedOut||(Hi={stdout:t.stdout})})}async function Ri(){Ui&&await Ui}function zi(){return Hi}function Bi(){Hi=null}var Vi,Hi,Ui,Wi=e((()=>{c(),Xn(),Vi=1e4,Hi=null,Ui=null}));function Gi(e,t,n){return new Promise((r,i)=>{if(t?.aborted){n?.throwOnAbort||n?.abortError?i(n.abortError?.()??Error(`aborted`)):r();return}let a=setTimeout((e,t,n)=>{e?.removeEventListener(`abort`,t),n()},e,t,o,r);function o(){clearTimeout(a),n?.throwOnAbort||n?.abortError?i(n.abortError?.()??Error(`aborted`)):r()}t?.addEventListener(`abort`,o,{once:!0}),n?.unref&&a.unref()})}var Ki=e((()=>{}));function qi(){return Yi}function Ji(){Yi.clear()}var Yi,Xi=e((()=>{Yi=new Map})),Zi=n({calculateApiKeyHelperTTL:()=>ca,checkAndRefreshOAuthTokenIfNeeded:()=>za,checkGcpCredentialsValid:()=>Sa,clearApiKeyHelperCache:()=>ma,clearAwsCredentialsCache:()=>ya,clearGcpCredentialsCache:()=>Ta,clearOAuthTokenCache:()=>Pa,getAccountInformation:()=>ao,getAnthropicApiKey:()=>ea,getAnthropicApiKeyWithSource:()=>na,getApiKeyFromApiKeyHelper:()=>ua,getApiKeyFromApiKeyHelperCached:()=>pa,getApiKeyFromConfigOrMacOSKeychain:()=>ho,getApiKeyHelperElapsedMs:()=>la,getAuthTokenSource:()=>$i,getClaudeAIOAuthTokens:()=>W,getClaudeAIOAuthTokensAsync:()=>Ra,getConfiguredApiKeyHelper:()=>L,getOauthAccountInfo:()=>Ua,getOtelHeadersFromHelper:()=>no,getRateLimitTier:()=>Za,getSubscriptionName:()=>Qa,getSubscriptionType:()=>z,handleOAuth401Error:()=>Ia,hasAnthropicApiKeyAuth:()=>ta,hasOpusAccess:()=>Ga,hasProfileScope:()=>Va,is1PApiCustomer:()=>Ha,isAnthropicAuthEnabled:()=>I,isAwsAuthRefreshFromProjectSettings:()=>aa,isAwsCredentialExportFromProjectSettings:()=>sa,isClaudeAISubscriber:()=>R,isConsumerSubscriber:()=>io,isCustomApiKeyApproved:()=>Aa,isEnterpriseSubscriber:()=>Ya,isGcpAuthRefreshFromProjectSettings:()=>xa,isMaxSubscriber:()=>Ka,isOtelHeadersHelperFromProjectOrLocalSettings:()=>to,isOverageProvisioningAllowed:()=>Wa,isProSubscriber:()=>Xa,isTeamPremiumSubscriber:()=>Ja,isTeamSubscriber:()=>qa,isUsing3PServices:()=>$a,prefetchApiKeyFromApiKeyHelperIfSafe:()=>ha,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>Da,prefetchGcpCredentialsIfSafe:()=>Ea,refreshAndGetAwsCredentials:()=>U,refreshAwsAuth:()=>_a,refreshGcpAuth:()=>wa,refreshGcpCredentialsIfNeeded:()=>mo,removeApiKey:()=>ja,saveApiKey:()=>ka,saveOAuthTokensIfNeeded:()=>Na,validateForceLoginOrg:()=>oo});function Qi(){return s(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function I(){if(l())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let e=b()||{},t=s(process.env.CLAUDE_CODE_USE_BEDROCK)||s(process.env.CLAUDE_CODE_USE_VERTEX)||s(process.env.CLAUDE_CODE_USE_FOUNDRY)||e.modelType===`openai`||e.modelType===`gemini`||!!process.env.OPENAI_BASE_URL||!!process.env.GEMINI_BASE_URL,n=e.apiKeyHelper,r=process.env.ANTHROPIC_AUTH_TOKEN||n||process.env.CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR,{source:i}=na({skipRetrievingKeyFromApiKeyHelper:!0}),a=i===`ANTHROPIC_API_KEY`||i===`apiKeyHelper`;return!(t||r&&!Qi()||a&&!Qi())}function $i(){if(l())return L()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!Qi())return{source:`ANTHROPIC_AUTH_TOKEN`,hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:`CLAUDE_CODE_OAUTH_TOKEN`,hasToken:!0};if(Bn())return process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR?{source:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,hasToken:!0}:{source:`CCR_OAUTH_TOKEN_FILE`,hasToken:!0};if(L()&&!Qi())return{source:`apiKeyHelper`,hasToken:!0};let e=W();return wn(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function ea(){let{key:e}=na();return e}function ta(){let{key:e,source:t}=na({skipRetrievingKeyFromApiKeyHelper:!0});return e!==null&&t!==`none`}function na(e={}){if(l())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:L()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:pa(),source:`apiKeyHelper`}:{key:null,source:`none`};let t=a()?void 0:process.env.ANTHROPIC_API_KEY;if(_e()&&t)return{key:t,source:`ANTHROPIC_API_KEY`};if(s(process.env.CI)){let e=Vn();if(e)return{key:e,source:`ANTHROPIC_API_KEY`};if(!t&&!process.env.CLAUDE_CODE_OAUTH_TOKEN&&!process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR)throw Error(`ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN env var is required`);return t?{key:t,source:`ANTHROPIC_API_KEY`}:{key:null,source:`none`}}if(t&&S().customApiKeyResponses?.approved?.includes(Qn(t)))return{key:t,source:`ANTHROPIC_API_KEY`};let n=Vn();return n?{key:n,source:`ANTHROPIC_API_KEY`}:L()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:pa(),source:`apiKeyHelper`}:ho()||{key:null,source:`none`}}function L(){return l()?y(`flagSettings`)?.apiKeyHelper:(b()||{}).apiKeyHelper}function ra(){let e=L();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function ia(){return(b()||{}).awsAuthRefresh}function aa(){let e=ia();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function oa(){return(b()||{}).awsCredentialExport}function sa(){let e=oa();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function ca(){let e=process.env.CLAUDE_CODE_API_KEY_HELPER_TTL_MS;if(e){let t=parseInt(e,10);if(!Number.isNaN(t)&&t>=0)return t;_(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${e}`,{level:`error`})}return so}function la(){let e=V?.startedAt;return e?Date.now()-e:0}async function ua(e){if(!L())return null;let t=ca();return B?(Date.now()-B.timestamp<t||V||(V={promise:da(e,!1,H),startedAt:null}),B.value):(V||(V={promise:da(e,!0,H),startedAt:Date.now()}),V.promise)}async function da(e,t,n){try{let t=await fa(e);return n===H&&t!==null&&(B={value:t,timestamp:Date.now()}),t}catch(e){if(n!==H)return` `;let r=e instanceof Error?e.message:String(e);return console.error(ne.red(`apiKeyHelper failed: ${r}`)),_(`Error getting API key from apiKeyHelper: ${r}`,{level:`error`}),!t&&B&&B.value!==` `?(B={...B,timestamp:Date.now()},B.value):(B={value:` `,timestamp:Date.now()},` `)}finally{n===H&&(V=null)}}async function fa(e){let t=L();if(!t)return null;if(ra()&&!C()&&!e)return Ie(`apiKeyHelper invoked before trust check`,Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in .`)),E(`tengu_apiKeyHelper_missing_trust11`,{}),null;let n=await Je(t,{shell:!0,timeout:600*1e3,reject:!1});if(n.failed){let e=n.timedOut?`timed out`:`exited ${n.exitCode}`,t=n.stderr?.trim();throw Error(t?`${e}: ${t}`:e)}let r=n.stdout?.trim();if(!r)throw Error(`did not return a value`);return r}function pa(){return B?.value??null}function ma(){H++,B=null,V=null}function ha(e){ra()&&!C()||ua(e)}async function ga(){let e=ia();if(!e)return!1;if(aa()&&!C()&&!h())return Ie(`awsAuthRefresh invoked before trust check`,Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),E(`tengu_awsAuthRefresh_missing_trust`,{}),!1;try{return _(`Fetching AWS caller identity for AWS auth refresh command`),await nr(),_(`Fetched AWS caller identity, skipping AWS auth refresh command`),!1}catch{return _a(e)}}function _a(e){_(`Running AWS auth refresh command`);let t=ar.getInstance();return t.startAuthentication(),new Promise(n=>{let r=Ot(e,{timeout:lo});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),_(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),_(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)_(`AWS auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?ne.red(`AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):ne.red(`Error running awsAuthRefresh (in settings or ~/.workmate.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}async function va(){let e=oa();if(!e)return null;if(sa()&&!C()&&!h())return Ie(`awsCredentialExport invoked before trust check`,Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in .`)),E(`tengu_awsCredentialExport_missing_trust`,{}),null;try{return _(`Fetching AWS caller identity for credential export command`),await nr(),_(`Fetched AWS caller identity, skipping AWS credential export command`),null}catch{try{_(`Running AWS credential export command`);let t=await Je(e,{shell:!0,reject:!1});if(t.exitCode!==0||!t.stdout)throw Error(`awsCredentialExport did not return a valid value`);let n=je(t.stdout.trim());if(!tr(n))throw Error(`awsCredentialExport did not return valid AWS STS output structure`);return _(`AWS credentials retrieved from awsCredentialExport`),{accessKeyId:n.Credentials.AccessKeyId,secretAccessKey:n.Credentials.SecretAccessKey,sessionToken:n.Credentials.SessionToken}}catch(e){let t=ne.red(`Error getting AWS credentials from awsCredentialExport (in settings or ~/.workmate.json):`);return e instanceof Error?console.error(t,e.message):console.error(t,e),null}}}function ya(){U.cache.clear()}function ba(){return(b()||{}).gcpAuthRefresh}function xa(){let e=ba();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function Sa(){try{let{GoogleAuth:e}=await import(`./src-CiJCsqUl.js`).then(e=>t(e.default,1)),n=new e({scopes:[`https://www.googleapis.com/auth/cloud-platform`]}),r=(async()=>{await(await n.getClient()).getAccessToken()})(),i=Gi(uo).then(()=>{throw new So(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function Ca(){let e=ba();if(!e)return!1;if(xa()&&!C()&&!h())return Ie(`gcpAuthRefresh invoked before trust check`,Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),E(`tengu_gcpAuthRefresh_missing_trust`,{}),!1;try{if(_(`Checking GCP credentials validity for auth refresh`),await Sa())return _(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return wa(e)}function wa(e){_(`Running GCP auth refresh command`);let t=ar.getInstance();return t.startAuthentication(),new Promise(n=>{let r=Ot(e,{timeout:po});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),_(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),_(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)_(`GCP auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?ne.red(`GCP auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):ne.red(`Error running gcpAuthRefresh (in settings or ~/.workmate.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}function Ta(){mo.cache.clear()}function Ea(){ba()&&(xa()&&!C()&&!h()||mo())}function Da(){let e=ia(),t=oa();!e&&!t||(aa()||sa())&&!C()&&!h()||(U(),j())}function Oa(e){return/^[a-zA-Z0-9-_]+$/.test(e)}async function ka(e){if(!Oa(e))throw Error(`Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.`);await Ma();let t=!1;if(process.platform===`darwin`)try{let n=M();await Je(`security`,[`-i`],{input:`add-generic-password -U -a "${qn()}" -s "${n}" -X "${Buffer.from(e,`utf-8`).toString(`hex`)}"\n`,reject:!1}),E(`tengu_api_key_saved_to_keychain`,{}),t=!0}catch(e){T(e),E(`tengu_api_key_keychain_error`,{error:g(e)}),E(`tengu_api_key_saved_to_config`,{})}else E(`tengu_api_key_saved_to_config`,{});let n=Qn(e);w(r=>{let i=r.customApiKeyResponses?.approved??[];return{...r,primaryApiKey:t?r.primaryApiKey:e,customApiKeyResponses:{...r.customApiKeyResponses,approved:i.includes(n)?i:[...i,n],rejected:r.customApiKeyResponses?.rejected??[]}}}),ho.cache.clear?.(),Bi()}function Aa(e){let t=S(),n=Qn(e);return t.customApiKeyResponses?.approved?.includes(n)??!1}async function ja(){await Ma(),w(e=>({...e,primaryApiKey:void 0})),ho.cache.clear?.(),Bi()}async function Ma(){try{await Zn()}catch(e){T(e)}}function Na(e){if(!wn(e.scopes))return E(`tengu_oauth_tokens_not_claude_ai`,{}),{success:!0};if(!e.refreshToken||!e.expiresAt)return E(`tengu_oauth_tokens_inference_only`,{}),{success:!0};let t=Pi(),n=t.name;try{let r=t.read()||{},i=r.claudeAiOauth;r.claudeAiOauth={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:e.expiresAt,scopes:e.scopes,subscriptionType:e.subscriptionType??i?.subscriptionType??null,rateLimitTier:e.rateLimitTier??i?.rateLimitTier??null};let a=t.update(r);return a.success?E(`tengu_oauth_tokens_saved`,{storageBackend:n}):E(`tengu_oauth_tokens_save_failed`,{storageBackend:n}),W.cache?.clear?.(),_i(),Ji(),a}catch(e){return T(e),E(`tengu_oauth_tokens_save_exception`,{storageBackend:n,error:g(e)}),{success:!1,warning:`Failed to save OAuth tokens`}}}function Pa(){W.cache?.clear?.(),N()}async function Fa(){try{let{mtimeMs:e}=await Et(vt(o(),`.credentials.json`));e!==go&&(go=e,Pa())}catch{W.cache?.clear?.()}}function Ia(e){let t=_o.get(e);if(t)return t;let n=La(e).finally(()=>{_o.delete(e)});return _o.set(e,n),n}async function La(e){Pa();let t=await Ra();return t?.refreshToken?t.accessToken===e?za(0,!0):(E(`tengu_oauth_401_recovered_from_keychain`,{}),!0):!1}async function Ra(){if(l())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||Bn())return W();try{let e=(await Pi().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return T(e),null}}function za(e=0,t=!1){return e===0&&!t?vo||(vo=Ba(e,t).finally(()=>{vo=null}),vo):Ba(e,t)}async function Ba(e,t){await Fa();let n=W();if(!t&&(!n?.refreshToken||!jn(n.expiresAt))||!n?.refreshToken||!wn(n.scopes))return!1;W.cache?.clear?.(),N();let r=await Ra();if(!r?.refreshToken||!jn(r.expiresAt))return!1;let i=o();await Tt(i,{recursive:!0});let a;try{E(`tengu_oauth_token_refresh_lock_acquiring`,{}),a=await He(i),E(`tengu_oauth_token_refresh_lock_acquired`,{})}catch(n){return n.code===`ELOCKED`?e<5?(E(`tengu_oauth_token_refresh_lock_retry`,{retryCount:e+1}),await Gi(1e3+Math.random()*1e3),Ba(e+1,t)):(E(`tengu_oauth_token_refresh_lock_retry_limit_reached`,{maxRetries:5}),!1):(T(n),E(`tengu_oauth_token_refresh_lock_error`,{error:g(n)}),!1)}try{W.cache?.clear?.(),N();let e=await Ra();return!e?.refreshToken||!jn(e.expiresAt)?(E(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(E(`tengu_oauth_token_refresh_starting`,{}),Na(await On(e.refreshToken,{scopes:wn(e.scopes)?void 0:e.scopes})),W.cache?.clear?.(),N(),!0)}catch(e){T(e),W.cache?.clear?.(),N();let t=await Ra();return t&&!jn(t.expiresAt)?(E(`tengu_oauth_token_refresh_race_recovered`,{}),!0):!1}finally{E(`tengu_oauth_token_refresh_lock_releasing`,{}),await a(),E(`tengu_oauth_token_refresh_lock_released`,{})}}function R(){return I()?wn(W()?.scopes):!1}function Va(){return W()?.scopes?.includes(`user:profile`)??!1}function Ha(){return!(s(process.env.CLAUDE_CODE_USE_BEDROCK)||s(process.env.CLAUDE_CODE_USE_VERTEX)||s(process.env.CLAUDE_CODE_USE_FOUNDRY)||R())}function Ua(){return I()?S().oauthAccount:void 0}function Wa(){let e=Ua()?.billingType;return!(!R()||!e||e!==`stripe_subscription`&&e!==`stripe_subscription_contracted`&&e!==`apple_subscription`&&e!==`google_play_subscription`)}function Ga(){let e=z();return e===`max`||e===`enterprise`||e===`team`||e===`pro`||e===null}function z(){if(!I())return null;let e=W();return e?e.subscriptionType??null:null}function Ka(){return z()===`max`}function qa(){return z()===`team`}function Ja(){return z()===`team`&&Za()===`default_claude_max_5x`}function Ya(){return z()===`enterprise`}function Xa(){return z()===`pro`}function Za(){if(!I())return null;let e=W();return e?e.rateLimitTier??null:null}function Qa(){switch(z()){case`enterprise`:return`Claude Enterprise`;case`team`:return`Claude Team`;case`max`:return`Claude Max`;case`pro`:return`Claude Pro`;default:return`Claude API`}}function $a(){return!!(s(process.env.CLAUDE_CODE_USE_BEDROCK)||s(process.env.CLAUDE_CODE_USE_VERTEX)||s(process.env.CLAUDE_CODE_USE_FOUNDRY)||s(process.env.CLAUDE_CODE_USE_OPENAI)||s(process.env.CLAUDE_CODE_USE_GEMINI)||s(process.env.CLAUDE_CODE_USE_GROK))}function eo(){return(b()||{}).otelHeadersHelper}function to(){let e=eo();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function no(){let e=eo();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||xo.toString(),10);if(yo&&Date.now()-bo<t)return yo;if(to()&&!C())return{};try{let t=qe(e,{timeout:3e4})?.toString().trim();if(!t)throw Error(`otelHeadersHelper did not return a valid value`);let n=je(t);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`otelHeadersHelper must return a JSON object with string key-value pairs`);for(let[e,t]of Object.entries(n))if(typeof t!=`string`)throw Error(`otelHeadersHelper returned non-string value for key "${e}": ${typeof t}`);return yo=n,bo=Date.now(),yo}catch(e){throw T(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${g(e)}`)),e}}function ro(e){return e===`max`||e===`pro`}function io(){let e=z();return R()&&e!==null&&ro(e)}function ao(){if(k()!==`firstParty`)return;let{source:e}=$i(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:R()?t.subscription=Qa():t.tokenSource=e;let{key:n,source:r}=na();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=Ua()?.organizationName;e&&(t.organization=e)}let i=Ua()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}async function oo(){if(process.env.ANTHROPIC_UNIX_SOCKET||!I())return{valid:!0};let e=y(`policySettings`)?.forceLoginOrgUUID;if(!e)return{valid:!0};await za();let t=W();if(!t)return{valid:!0};let{source:n}=$i(),r=n===`CLAUDE_CODE_OAUTH_TOKEN`||n===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,i=await Sn(t.accessToken);if(!i)return{valid:!1,message:`Unable to verify organization for the current authentication token.\nThis machine requires organization ${e} but the profile could not be fetched.\nThis may be a network error, or the token may lack the user:profile scope required for\nverification.\nTry again, or obtain a full-scope token.`};let a=i.organization.uuid;return a===e?{valid:!0}:r?{valid:!1,message:`The ${n===`CLAUDE_CODE_OAUTH_TOKEN`?`CLAUDE_CODE_OAUTH_TOKEN`:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`} environment variable provides a token for a\ndifferent organization than required by this machine's managed settings.\n\nRequired organization: ${e}\nToken organization: ${a}\n\nRemove the environment variable or obtain a token for the correct organization.`}:{valid:!1,message:`Your authentication token belongs to organization ${a},\nbut this machine requires organization ${e}.\n\nAuthentication token belongs to the wrong organization.`}}var so,B,V,H,co,lo,U,uo,fo,po,mo,ho,W,go,_o,vo,yo,bo,xo,So,G=e((()=>{re(),Ke(),i(),O(),at(),bn(),A(),m(),In(),Cn(),Kn(),$n(),ir(),or(),Si(),We(),v(),c(),Ae(),Ye(),Ue(),et(),nt(),Fi(),Wi(),Xn(),x(),Ki(),Re(),Xi(),so=300*1e3,B=null,V=null,H=0,co=3600*1e3,lo=180*1e3,U=tt(async()=>{let e=await ga(),t=await va();return(e||t)&&await rr(),t},co),uo=5e3,fo=3600*1e3,po=180*1e3,mo=tt(async()=>await Ca(),fo),ho=r(()=>{if(l())return null;if(process.platform===`darwin`){let e=zi();if(e){if(e.stdout)return{key:e.stdout,source:`/login managed key`}}else{let e=M();try{let t=qe(`security find-generic-password -a $USER -w -s "${e}"`);if(t)return{key:t,source:`/login managed key`}}catch(e){T(e)}}}let e=S();return e.primaryApiKey?{key:e.primaryApiKey,source:`/login managed key`}:null}),W=r(()=>{if(l())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{accessToken:process.env.CLAUDE_CODE_OAUTH_TOKEN,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};let e=Bn();if(e)return{accessToken:e,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};try{let e=Pi().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return T(e),null}}),go=0,_o=new Map,vo=null,yo=null,bo=0,xo=1740*1e3,So=class extends Error{}}));function K(){return!s(process.env.CLAUDE_CODE_DISABLE_FAST_MODE)}function Co(){return K()?To()===null:!1}function wo(e,t){switch(e){case`free`:return t===`oauth`?`Fast mode requires a paid subscription`:`Fast mode unavailable during evaluation. Please purchase credits.`;case`preference`:return`Fast mode has been disabled by your organization`;case`extra_usage_disabled`:return`Fast mode requires extra usage billing · enable it at claude.ai/settings/usage`;case`network_error`:return`Fast mode unavailable due to network connectivity issues`;case`unknown`:return`Fast mode is currently unavailable`}}function To(){if(!K())return`Fast mode is not available`;if(ut(),h()&&_e()&&!y(`flagSettings`)?.fastMode){let e=`Fast mode is not available in the Agent SDK`;return _(`Fast mode unavailable: ${e}`),e}if(k()!==`firstParty`){let e=`Fast mode is not available on Bedrock, Vertex, or Foundry`;return _(`Fast mode unavailable: ${e}`),e}if(J.status===`disabled`){if((J.reason===`network_error`||J.reason===`unknown`)&&s(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS))return null;let e=W()===null?`api-key`:`oauth`,t=wo(J.reason,e);return _(`Fast mode unavailable: ${t}`),t}return null}function Eo(){return`opus${Js()?`[1m]`:``}`}function Do(e){if(!K()||!Co()||!Oo(e))return!1;let t=Be();return!t.fastModePerSessionOptIn&&t.fastMode===!0}function Oo(e){if(!K())return!1;let t=Q(e??Us());return t.toLowerCase().includes(`opus-4-7`)||t.toLowerCase().includes(`opus-4-6`)}function ko(){return q.status===`cooldown`&&Date.now()>=q.resetAt&&(K()&&!Ho&&(_(`Fast mode cooldown expired, re-enabling fast mode`),Ho=!0,Wo.emit()),q={status:`active`}),q}function Ao(e,t){if(!K())return;q={status:`cooldown`,resetAt:e,reason:t},Ho=!1;let n=e-Date.now();_(`Fast mode cooldown triggered (${t}), duration ${Math.round(n/1e3)}s`),E(`tengu_fast_mode_fallback_triggered`,{cooldown_duration_ms:n,cooldown_reason:t}),Uo.emit(e,t)}function jo(){q={status:`active`}}function Mo(){J.status!==`disabled`&&(J={status:`disabled`,reason:`preference`},Ve(`userSettings`,{fastMode:void 0}),w(e=>({...e,penguinModeOrgEnabled:!1})),Yo.emit(!1))}function No(e){switch(e){case`out_of_credits`:return`Fast mode disabled · extra usage credits exhausted`;case`org_level_disabled`:case`org_service_level_disabled`:return`Fast mode disabled · extra usage disabled by your organization`;case`org_level_disabled_until`:return`Fast mode disabled · extra usage spending cap reached`;case`member_level_disabled`:return`Fast mode disabled · extra usage disabled for your account`;case`seat_tier_level_disabled`:case`seat_tier_zero_credit_limit`:case`member_zero_credit_limit`:return`Fast mode disabled · extra usage not available for your plan`;case`overage_not_provisioned`:case`no_limits_configured`:return`Fast mode requires extra usage billing · enable it at claude.ai/settings/usage`;default:return`Fast mode disabled · extra usage not available`}}function Po(e){return e===`org_level_disabled_until`||e===`out_of_credits`}function Fo(e){let t=No(e);_(`Fast mode overage rejection: ${e??`unknown`} — ${t}`),E(`tengu_fast_mode_overage_rejected`,{overage_disabled_reason:e??`unknown`}),Po(e)||(Ve(`userSettings`,{fastMode:void 0}),w(e=>({...e,penguinModeOrgEnabled:!1}))),qo.emit(t)}function Io(){return ko().status===`cooldown`}function Lo(e,t){let n=K()&&Co()&&!!t&&Oo(e);return n&&Io()?`cooldown`:n?`on`:`off`}async function Ro(e){let t=`${D().BASE_API_URL}/api/claude_code_penguin_mode`,n=`accessToken`in e?{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":ct}:{"x-api-key":e.apiKey};return(await f.get(t,{headers:n})).data}function zo(){K()&&J.status===`pending`&&(J=S().penguinModeOrgEnabled===!0?{status:`enabled`}:{status:`disabled`,reason:`unknown`})}async function Bo(){if($e()||!K())return;if($o)return _(`Fast mode prefetch in progress, returning in-flight promise`),$o;let e=ea();if(!(W()?.accessToken&&Va())&&!e){J=S().penguinModeOrgEnabled===!0?{status:`enabled`}:{status:`disabled`,reason:`preference`};return}let t=Date.now();if(t-Qo<Zo){_(`Skipping fast mode prefetch, fetched recently`);return}Qo=t;let n=async()=>{let t=W(),n=t?.accessToken&&Va()?{accessToken:t.accessToken}:e?{apiKey:e}:null;if(!n)throw Error(`No auth available`);return Ro(n)};async function r(){try{let e;try{e=await n()}catch(t){if(f.isAxiosError(t)&&(t.response?.status===401||t.response?.status===403&&typeof t.response?.data==`string`&&t.response.data.includes(`OAuth token has been revoked`))){let r=W()?.accessToken;if(r)await Ia(r),e=await n();else throw t}else throw t}let t=J.status===`pending`?S().penguinModeOrgEnabled:J.status===`enabled`;J=e.enabled?{status:`enabled`}:{status:`disabled`,reason:e.disabled_reason??`preference`},t!==e.enabled&&(e.enabled||Ve(`userSettings`,{fastMode:void 0}),w(t=>({...t,penguinModeOrgEnabled:e.enabled})),Yo.emit(e.enabled)),_(`Org fast mode: ${e.enabled?`enabled`:`disabled (${e.disabled_reason??`preference`})`}`)}catch(e){J=S().penguinModeOrgEnabled===!0?{status:`enabled`}:{status:`disabled`,reason:`network_error`},_(`Failed to fetch org fast mode status, defaulting to ${J.status===`enabled`?`enabled (cached)`:`disabled (network_error)`}: ${e}`,{level:`error`}),E(`tengu_org_penguin_mode_fetch_failed`,{})}finally{$o=null}}return $o=r(),$o}var Vo,q,Ho,Uo,Wo,Go,Ko,qo,Jo,J,Yo,Xo,Zo,Qo,$o,es=e((()=>{p(),O(),m(),at(),G(),dt(),We(),v(),c(),$(),A(),Qe(),x(),Se(),Vo=`Opus 4.7`,q={status:`active`},Ho=!1,Uo=ye(),Wo=ye(),Go=Uo.subscribe,Ko=Wo.subscribe,qo=ye(),Jo=qo.subscribe,J={status:`pending`},Yo=ye(),Xo=Yo.subscribe,Zo=3e4,Qo=0,$o=null}));function ts(e){return K()&&e?ds:us}function ns(e,t){return t.input_tokens/1e6*e.inputTokens+t.output_tokens/1e6*e.outputTokens+(t.cache_read_input_tokens??0)/1e6*e.promptCacheReadTokens+(t.cache_creation_input_tokens??0)/1e6*e.promptCacheWriteTokens+(t.server_tool_use?.web_search_requests??0)*e.webSearchRequests}function rs(e,t){let n=Z(e);return n===X(on.firstParty)?ts(t.speed===`fast`):hs[n]||(is(e,n),hs[Z(Us())]??ms)}function is(e,t){E(`tengu_unknown_model_cost`,{model:e,shortName:t}),Ce()}function as(e,t){return ns(rs(e,t),t)}function os(e,t){return as(e,{input_tokens:t.inputTokens,output_tokens:t.outputTokens,cache_read_input_tokens:t.cacheReadInputTokens,cache_creation_input_tokens:t.cacheCreationInputTokens})}function ss(e){return Number.isInteger(e)?`$${e}`:`$${e.toFixed(2)}`}function cs(e){return`${ss(e.inputTokens)}/${ss(e.outputTokens)} per Mtok`}var Y,ls,us,ds,fs,ps,ms,hs,gs=e((()=>{at(),m(),es(),dn(),$(),Y={inputTokens:3,outputTokens:15,promptCacheWriteTokens:3.75,promptCacheReadTokens:.3,webSearchRequests:.01},ls={inputTokens:15,outputTokens:75,promptCacheWriteTokens:18.75,promptCacheReadTokens:1.5,webSearchRequests:.01},us={inputTokens:5,outputTokens:25,promptCacheWriteTokens:6.25,promptCacheReadTokens:.5,webSearchRequests:.01},ds={inputTokens:30,outputTokens:150,promptCacheWriteTokens:37.5,promptCacheReadTokens:3,webSearchRequests:.01},fs={inputTokens:.8,outputTokens:4,promptCacheWriteTokens:1,promptCacheReadTokens:.08,webSearchRequests:.01},ps={inputTokens:1,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:.1,webSearchRequests:.01},ms=us,hs={[X(Qt.firstParty)]:fs,[X($t.firstParty)]:ps,[X(Zt.firstParty)]:Y,[X(Xt.firstParty)]:Y,[X(en.firstParty)]:Y,[X(tn.firstParty)]:Y,[X(cn.firstParty)]:Y,[X(nn.firstParty)]:ls,[X(rn.firstParty)]:ls,[X(an.firstParty)]:us,[X(on.firstParty)]:us}}));function _s(e){return ys.includes(e)}function vs(e){return bs.includes(e)}var ys,bs,xs=e((()=>{ys=[`sonnet`,`opus`,`haiku`,`best`,`sonnet[1m]`,`opus[1m]`,`opusplan`],bs=[`sonnet`,`opus`,`haiku`]}));function Ss(e,t){return e.includes(t)?!0:_s(e)?Q(e).toLowerCase().includes(t):!1}function Cs(e,t){return e.startsWith(t)?e.length===t.length||e[t.length]===`-`:!1}function ws(e,t){let n=_s(e)?Q(e).toLowerCase():e;return!!(Cs(n,t)||!t.startsWith(`claude-`)&&Cs(n,`claude-${t}`))}function Ts(e,t){for(let n of t){if(vs(n))continue;let t=n.indexOf(e);if(t===-1)continue;let r=t+e.length;if(r===n.length||n[r]===`-`)return!0}return!1}function Es(e){let{availableModels:t}=b()||{};if(!t)return!0;if(t.length===0)return!1;let n=hn(e).trim().toLowerCase(),r=t.map(e=>e.trim().toLowerCase());if(r.includes(n)&&(!vs(n)||!Ts(n,r)))return!0;for(let e of r)if(vs(e)&&!Ts(e,r)&&Ss(n,e))return!0;if(_s(n)){let e=Q(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!vs(e)&&_s(e)&&Q(e).toLowerCase()===n)return!0;for(let e of r)if(!vs(e)&&!_s(e)&&ws(n,e))return!0;return!1}var Ds=e((()=>{x(),xs(),$(),bn()}));function Os(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}var ks,As,js,Ms=e((()=>{ks=`gpt-5.5`,As=`gpt-5.4-mini`,js=[{value:`gpt-5.5`,label:`GPT-5.5`,description:`Frontier model for complex coding, research, and real-world work`},{value:`gpt-5.4`,label:`GPT-5.4`,description:`Strong model for everyday coding`},{value:`gpt-5.4-mini`,label:`GPT-5.4-Mini`,description:`Small, fast, and cost-efficient model for simpler coding tasks`},{value:`gpt-5.3-codex`,label:`GPT-5.3-Codex`,description:`Coding-optimized model`},{value:`gpt-5.3-codex-spark`,label:`GPT-5.3-Codex-Spark`,description:`Ultra-fast coding model`},{value:`gpt-5.2`,label:`GPT-5.2`,description:`Optimized for professional work and long-running agents`}]}));function Ns(){let e=k();return e===`openai`&&Os()?process.env.OPENAI_SMALL_FAST_MODEL??`gpt-5.4-mini`:e===`openai`&&process.env.OPENAI_SMALL_FAST_MODEL?process.env.OPENAI_SMALL_FAST_MODEL:e===`gemini`&&process.env.GEMINI_SMALL_FAST_MODEL?process.env.GEMINI_SMALL_FAST_MODEL:process.env.ANTHROPIC_SMALL_FAST_MODEL||Vs()}function Ps(e){return e===j().opus40||e===j().opus41||e===j().opus45||e===j().opus46||e===j().opus47}function Fs(){let e,t=me();if(t!==void 0)e=t;else{let t=b()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!Es(e)))return e}function Is(){let e=Fs();return e==null?Ws():Q(e)}function Ls(){return zs()}function Rs(){let e=k();if(e===`openai`)return process.env.OPENAI_MODEL;if(e===`gemini`)return process.env.GEMINI_MODEL;if(e===`grok`)return process.env.GROK_MODEL}function zs(){let e=k();return e===`openai`&&Os()?ks:e===`openai`&&process.env.OPENAI_DEFAULT_OPUS_MODEL?process.env.OPENAI_DEFAULT_OPUS_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_OPUS_MODEL?process.env.GEMINI_DEFAULT_OPUS_MODEL:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL?process.env.ANTHROPIC_DEFAULT_OPUS_MODEL:Rs()||j().opus47}function Bs(){let e=k();return e===`openai`&&Os()?ks:e===`openai`&&process.env.OPENAI_DEFAULT_SONNET_MODEL?process.env.OPENAI_DEFAULT_SONNET_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_SONNET_MODEL?process.env.GEMINI_DEFAULT_SONNET_MODEL:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL?process.env.ANTHROPIC_DEFAULT_SONNET_MODEL:Rs()||(e===`firstParty`?j().sonnet46:j().sonnet45)}function Vs(){let e=k();return e===`openai`&&Os()?As:e===`openai`&&process.env.OPENAI_DEFAULT_HAIKU_MODEL?process.env.OPENAI_DEFAULT_HAIKU_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_HAIKU_MODEL?process.env.GEMINI_DEFAULT_HAIKU_MODEL:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL?process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL:Rs()||j().haiku45}function Hs(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return Fs()===`opusplan`&&t===`plan`&&!r?zs():Fs()===`haiku`&&t===`plan`?Bs():n}function Us(){return Ka()||Ja()?zs()+(Js()?`[1m]`:``):Bs()}function Ws(){return Q(Us())}function X(e){if(e=e.toLowerCase(),e.includes(`claude-opus-4-7`))return`claude-opus-4-7`;if(e.includes(`claude-opus-4-6`))return`claude-opus-4-6`;if(e.includes(`claude-opus-4-5`))return`claude-opus-4-5`;if(e.includes(`claude-opus-4-1`))return`claude-opus-4-1`;if(e.includes(`claude-opus-4`))return`claude-opus-4`;if(e.includes(`claude-sonnet-4-6`))return`claude-sonnet-4-6`;if(e.includes(`claude-sonnet-4-5`))return`claude-sonnet-4-5`;if(e.includes(`claude-sonnet-4`))return`claude-sonnet-4`;if(e.includes(`claude-haiku-4-5`))return`claude-haiku-4-5`;if(e.includes(`claude-3-7-sonnet`))return`claude-3-7-sonnet`;if(e.includes(`claude-3-5-sonnet`))return`claude-3-5-sonnet`;if(e.includes(`claude-3-5-haiku`))return`claude-3-5-haiku`;if(e.includes(`claude-3-opus`))return`claude-3-opus`;if(e.includes(`claude-3-sonnet`))return`claude-3-sonnet`;if(e.includes(`claude-3-haiku`))return`claude-3-haiku`;let t=e.match(/(claude-(\d+-\d+-)?\w+)/);return t?.[1]?t[1]:e}function Z(e){return X(hn(e))}function Gs(e=!1){return Ka()||Ja()?Js()?`Opus 4.7 with 1M context · Most capable for complex work${e?qs(!0):``}`:`Opus 4.7 · Most capable for complex work${e?qs(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function Ks(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:Zs(Q(e))}function qs(e){if(k()!==`firstParty`)return``;let t=cs(ts(e));return` ·${e?` (↯)`:``} ${t}`}function Js(){return!(Gr()||Xa()||k()!==`firstParty`||!Mt()||R()&&z()===null)}function Ys(e){return e===`opusplan`?`Opus Plan`:_s(e)?ft(e):Zs(e)}function Xs(e){switch(e){case j().opus47:return`Opus 4.7`;case`${j().opus47}[1m]`:return`Opus 4.7 (1M context)`;case j().opus46:return`Opus 4.6`;case`${j().opus46}[1m]`:return`Opus 4.6 (1M context)`;case j().opus45:return`Opus 4.5`;case j().opus41:return`Opus 4.1`;case j().opus40:return`Opus 4`;case`${j().sonnet46}[1m]`:return`Sonnet 4.6 (1M context)`;case j().sonnet46:return`Sonnet 4.6`;case`${j().sonnet45}[1m]`:return`Sonnet 4.5 (1M context)`;case j().sonnet45:return`Sonnet 4.5`;case j().sonnet40:return`Sonnet 4`;case`${j().sonnet40}[1m]`:return`Sonnet 4 (1M context)`;case j().sonnet37:return`Sonnet 3.7`;case j().sonnet35:return`Sonnet 3.5`;case j().haiku45:return`Haiku 4.5`;case j().haiku35:return`Haiku 3.5`;default:return null}}function Zs(e){return Xs(e)||e}function Q(e){let t=e.trim(),n=t.toLowerCase(),r=F(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(_s(i))switch(i){case`opusplan`:return Bs()+(r?`[1m]`:``);case`sonnet`:return Bs()+(r?`[1m]`:``);case`haiku`:return Vs()+(r?`[1m]`:``);case`opus`:return zs()+(r?`[1m]`:``);case`best`:return Ls();default:}return k()===`firstParty`&&$s(i)&&ec()?zs()+(r?`[1m]`:``):r?`${t.replace(/\[1m\]$/i,``).trim()}[1m]`:t}function Qs(e,t){return F(e)||!F(t)?e:Kr(Q(e))?`${e}[1m]`:e}function $s(e){return ic.includes(e)}function ec(){return!s(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function tc(e){if(e===null)return R()?`Default (${Gs()})`:`Default (${Ws()})`;let t=Q(e);return e===t?t:`${e} (${t})`}function nc(e){if(k()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=Z(e);if(n.includes(`claude-opus-4-7`))return t?`Opus 4.7 (with 1M context)`:`Opus 4.7`;if(n.includes(`claude-opus-4-6`))return t?`Opus 4.6 (with 1M context)`:`Opus 4.6`;if(n.includes(`claude-opus-4-5`))return`Opus 4.5`;if(n.includes(`claude-opus-4-1`))return`Opus 4.1`;if(n.includes(`claude-opus-4`))return`Opus 4`;if(n.includes(`claude-sonnet-4-6`))return t?`Sonnet 4.6 (with 1M context)`:`Sonnet 4.6`;if(n.includes(`claude-sonnet-4-5`))return t?`Sonnet 4.5 (with 1M context)`:`Sonnet 4.5`;if(n.includes(`claude-sonnet-4`))return t?`Sonnet 4 (with 1M context)`:`Sonnet 4`;if(n.includes(`claude-3-7-sonnet`))return`Claude 3.7 Sonnet`;if(n.includes(`claude-3-5-sonnet`))return`Claude 3.5 Sonnet`;if(n.includes(`claude-haiku-4-5`))return`Haiku 4.5`;if(n.includes(`claude-3-5-haiku`))return`Claude 3.5 Haiku`}function rc(e){return e.replace(/\[(1|2)m\]/gi,``)}var ic,$=e((()=>{m(),G(),ri(),c(),bn(),gs(),x(),A(),ze(),Ds(),xs(),pt(),Ms(),ic=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));export{Mo as $,Tr as $n,Rt as $r,Xa as $t,Ms as A,bi as An,Dn as Ar,L as At,os as B,Yr as Bn,Fn as Br,G as Bt,Q as C,Fi as Cn,Xn as Cr,ua as Ct,Qs as D,li as Dn,Rn as Dr,$i as Dt,Ys as E,_i as En,Ln as Er,la as Et,xs as F,hi as Fn,jn as Fr,z as Ft,Vo as G,F as Gn,j as Gr,R as Gt,cs as H,Zr as Hn,Sn as Hr,I as Ht,fs as I,oi as In,Tn as Ir,Ia as It,ko as J,Wr as Jn,Vt as Jr,Ya as Jt,jo as K,ri as Kn,bn as Kr,io as Kt,ps as L,si as Ln,Pn as Lr,ta as Lt,Ds as M,pi as Mn,Mn as Mr,no as Mt,Es as N,fi as Nn,Nn as Nr,Za as Nt,ks as O,xi as On,En as Or,W as Ot,ys as P,mi as Pn,In as Pr,Qa as Pt,Fo as Q,Pr as Qn,Ht as Qr,Wa as Qt,Y as R,ni as Rn,On as Rr,Ga as Rt,rc as S,Pi as Sn,N as Sr,na as St,Zs as T,Ei as Tn,Kn as Tr,ho as Tt,ts as U,Xr as Un,Cn as Ur,aa as Ut,as as V,qr as Vn,xn as Vr,Ha as Vt,gs as W,Jr as Wn,_n as Wr,sa as Wt,To as X,Nr as Xn,qt as Xr,Ka as Xt,Lo as Y,Br as Yn,Wt as Yr,xa as Yt,Do as Z,kr as Zn,Yt as Zr,to as Zt,$ as _,Ki as _n,or as _r,ya as _t,Vs as a,jt as ai,Ea as an,xr as ar,Ko as at,Js as b,Wi as bn,$n as br,ao as bt,zs as c,wa as cn,ur as cr,Xo as ct,nc as d,ka as dn,gr as dr,Ao as dt,Lt as ei,Ja as en,wr as er,es as et,qs as f,Na as fn,dr as fr,Zi as ft,Fs as g,Xi as gn,ar as gr,ma as gt,Ns as h,qi as hn,br as hr,Sa as ht,Gs as i,k as ii,Da as in,Sr as ir,Oo as it,Os as j,Si as jn,kn as jr,Ua as jt,js as k,gi as kn,An as kr,Ra as kt,Bs as l,mo as ln,hr as lr,Bo as lt,Hs as m,Ji as mn,yr as mr,za as mt,Ls as n,It as ni,$a as nn,Dr as nr,Io as nt,Ws as o,A as oi,U as on,_r as or,Go as ot,Xs as p,oo as pn,pr,ca as pt,Eo as q,Gr as qn,Gt as qr,Aa as qt,Z as r,Pt as ri,ha as rn,Er as rr,K as rt,Us as s,Mt as si,_a as sn,lr as sr,Jo as st,X as t,Nt as ti,qa as tn,Cr as tr,Co as tt,Is as u,ja as un,mr as ur,zo as ut,ec as v,Gi as vn,ir as vr,Ta as vt,Ks as w,Ai as wn,Gn as wr,pa as wt,tc as x,Li as xn,Qn as xr,ea as xt,Ps as y,Ri as yn,er as yr,Pa as yt,hs as z,$r as zn,wn as zr,Va as zt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{bp as t,xp as n,yp as r}from"./loadAgentsDir-JrGMJN05.js";import{F as i,Wt as a}from"./state-BPFYBqm1.js";import{f as o,g as ee}from"./settings-aUygByiZ.js";import{c as te,h as ne}from"./config-BkbL2e5Q.js";import{A as s,Bt as c,Gn as l,Gr as u,Gt as d,H as f,I as p,Kn as m,Kr as h,L as g,M as _,N as v,O as y,R as b,W as re,Xt as ie,_ as ae,a as x,b as S,c as oe,d as C,en as w,f as T,g as E,i as D,ii as O,j as k,k as A,l as j,oi as M,r as N,s as P,w as F}from"./model-CmDF8O9G.js";function I(e=!1){if(d())return{value:null,label:`Default (recommended)`,description:D(e)};let t=O()!==`firstParty`;return{value:null,label:`Default (recommended)`,description:`Use the default model (currently ${F(P())})${t?``:` · ${f(b)}`}`}}function L(){let e=O()!==`firstParty`,t=O(),n=t===`openai`?process.env.OPENAI_DEFAULT_SONNET_MODEL:t===`gemini`?process.env.GEMINI_DEFAULT_SONNET_MODEL:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL;if(e&&n){let e=l(n),r=t===`openai`?process.env.OPENAI_DEFAULT_SONNET_MODEL_NAME:t===`gemini`?process.env.GEMINI_DEFAULT_SONNET_MODEL_NAME:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL_NAME,i=t===`openai`?process.env.OPENAI_DEFAULT_SONNET_MODEL_DESCRIPTION:t===`gemini`?process.env.GEMINI_DEFAULT_SONNET_MODEL_DESCRIPTION:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION;return{value:`sonnet`,label:r??n,description:i??`Custom Sonnet model${e?` (1M context)`:``}`,descriptionForModel:`${i??`Custom Sonnet model${e?` with 1M context`:``}`} (${n})`}}}function R(){let e=O()!==`firstParty`;return{value:e?u().sonnet46:`sonnet`,label:`Sonnet`,description:`Sonnet 4.6 · Best for everyday tasks${e?``:` · ${f(b)}`}`,descriptionForModel:`Sonnet 4.6 - best for everyday tasks. Generally recommended for most coding tasks`}}function se(){let e=O()!==`firstParty`,t=O(),n=t===`openai`?process.env.OPENAI_DEFAULT_OPUS_MODEL:t===`gemini`?process.env.GEMINI_DEFAULT_OPUS_MODEL:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL;if(e&&n){let e=l(n),r=t===`openai`?process.env.OPENAI_DEFAULT_OPUS_MODEL_NAME:t===`gemini`?process.env.GEMINI_DEFAULT_OPUS_MODEL_NAME:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL_NAME,i=t===`openai`?process.env.OPENAI_DEFAULT_OPUS_MODEL_DESCRIPTION:t===`gemini`?process.env.GEMINI_DEFAULT_OPUS_MODEL_DESCRIPTION:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION;return{value:`opus`,label:r??n,description:i??`Custom Opus model${e?` (1M context)`:``}`,descriptionForModel:`${i??`Custom Opus model${e?` with 1M context`:``}`} (${n})`}}}function z(e=!1){return{value:O()===`firstParty`?`opus`:u().opus47,label:`Opus 4.7`,description:`Opus 4.7 · Most capable for complex work${T(e)}`,descriptionForModel:`Opus 4.7 - most capable for complex work`}}function B(){let e=O()!==`firstParty`;return{value:e?`${u().sonnet46}[1m]`:`sonnet[1m]`,label:`Sonnet (1M context)`,description:`Sonnet 4.6 for long sessions${e?``:` · ${f(b)}`}`,descriptionForModel:`Sonnet 4.6 with 1M context window - for long sessions with large codebases`}}function V(e=!1){return{value:O()===`firstParty`?`opus[1m]`:`${u().opus47}[1m]`,label:`Opus 4.7 (1M context)`,description:`Opus 4.7 with 1M context${T(e)}`,descriptionForModel:`Opus 4.7 with 1M context window - for long sessions with large codebases`}}function H(e=!1){return{value:`${u().opus46}[1m]`,label:`Opus 4.6 (1M context)`,description:`Opus 4.6 with 1M context${T(e)}`,descriptionForModel:`Opus 4.6 with 1M context window - for long sessions with large codebases`}}function U(){let e=O()!==`firstParty`,t=O(),n=t===`openai`?process.env.OPENAI_DEFAULT_HAIKU_MODEL:t===`gemini`?process.env.GEMINI_DEFAULT_HAIKU_MODEL:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL;if(e&&n){let e=t===`openai`?process.env.OPENAI_DEFAULT_HAIKU_MODEL_NAME:t===`gemini`?process.env.GEMINI_DEFAULT_HAIKU_MODEL_NAME:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME,r=t===`openai`?process.env.OPENAI_DEFAULT_HAIKU_MODEL_DESCRIPTION:t===`gemini`?process.env.GEMINI_DEFAULT_HAIKU_MODEL_DESCRIPTION:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION;return{value:`haiku`,label:e??n,description:r??`Custom Haiku model`,descriptionForModel:`${r??`Custom Haiku model`} (${n})`}}}function W(){return{value:`haiku`,label:`Haiku`,description:`Haiku 4.5 · Fastest for quick answers${O()===`firstParty`?` · ${f(g)}`:``}`,descriptionForModel:`Haiku 4.5 - fastest for quick answers. Lower cost but less capable than Sonnet 4.6.`}}function G(){return{value:`haiku`,label:`Haiku`,description:`Haiku 3.5 for simple tasks${O()===`firstParty`?` · ${f(p)}`:``}`,descriptionForModel:`Haiku 3.5 - faster and lower cost, but less capable than Sonnet. Use for simple tasks.`}}function K(){return x()===u().haiku45?W():G()}function q(e=!1){return{value:`opus`,label:`Opus 4.7`,description:`Opus 4.7 · Most capable for complex work${e?T(!0):``}`}}function J(){let e=O()!==`firstParty`;return{value:`sonnet[1m]`,label:`Sonnet (1M context)`,description:`Sonnet 4.6 with 1M context${d()?` · Billed as extra usage`:``}${e?``:` · ${f(b)}`}`}}function ce(e=!1){return{value:`opus[1m]`,label:`Opus 4.7 (1M context)`,description:`Opus 4.7 with 1M context${d()?` · Billed as extra usage`:``}${T(e)}`}}function Y(e=!1){let t=O()!==`firstParty`;return{value:t?`${u().opus47}[1m]`:`opus[1m]`,label:`Opus 4.7 (1M context)`,description:`Opus 4.7 with 1M context · Most capable for complex work${!t&&e?T(e):``}`,descriptionForModel:`Opus 4.7 with 1M context - most capable for complex work`}}function le(){return{value:`opusplan`,label:`Opus Plan Mode`,description:`Use Opus 4.7 in plan mode, Sonnet 4.6 otherwise`}}function ue(){return[{value:null,label:`Default (recommended)`,description:`Use the default ChatGPT Codex model (currently ${y})`,descriptionForModel:`Default ChatGPT Codex model (currently ${y})`},...A.map(e=>({value:e.value,label:e.label,description:e.description,descriptionForModel:`${e.description} (${e.value})`}))]}function de(e=!1){if(O()===`openai`&&k())return ue();if(d()){if(ie()||w()){let n=[I(e)];return n.push(H(e)),n.push(Q),t()&&n.push(J()),n.push($),n}let n=[I(e)];return S()?n.push(Y(e)):(n.push(q(e)),r()&&n.push(ce(e))),n.push(H(e)),t()&&n.push(J()),n.push($),n}if(O()===`firstParty`){let n=[I(e)];return S()?n.push(Y(e)):(n.push(z(e)),r()&&n.push(V(e))),n.push(H(e)),t()&&n.push(B()),n.push(W()),n}let n=[I(e)],i=L();i===void 0?(n.push(R()),t()&&n.push(B())):n.push(i);let a=se();a===void 0?(n.push(V(e)),n.push(H(e))):n.push(a);let o=U();return o===void 0?n.push(K()):n.push(o),n}function fe(e){let t=N(e);if(t.includes(`claude-sonnet-4-6`)||t.includes(`claude-sonnet-4-5`)||t.includes(`claude-sonnet-4-`)||t.includes(`claude-3-7-sonnet`)||t.includes(`claude-3-5-sonnet`)){let e=C(j());if(e)return{alias:`Sonnet`,currentVersionName:e}}if(t.includes(`claude-opus-4`)){let e=C(oe());if(e)return{alias:`Opus`,currentVersionName:e}}if(t.includes(`claude-haiku`)||t.includes(`claude-3-5-haiku`)){let e=C(x());if(e)return{alias:`Haiku`,currentVersionName:e}}return null}function X(e){let t=C(e);if(!t)return null;let n=fe(e);return n?t===n.currentVersionName?{value:e,label:t,description:e}:{value:e,label:t,description:`Newer version available · select ${n.alias} for ${n.currentVersionName}`}:{value:e,label:t,description:e}}function pe(e=!1){let t=de(e),n=process.env.ANTHROPIC_CUSTOM_MODEL_OPTION;n&&!t.some(e=>e.value===n)&&t.push({value:n,label:process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_NAME??n,description:process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION??`Custom model (${n})`});for(let e of te().additionalModelOptionsCache??[])t.some(t=>t.value===e.value)||t.push(e);let r=null,a=E(),o=i();if(a==null?o!==null&&(r=o):r=a,r===null||t.some(e=>e.value===r))return Z(t);if(r===`opusplan`)return Z([...t,le()]);if(r===`opus`&&O()===`firstParty`)return Z([...t,q(e)]);if(r===`opus[1m]`&&O()===`firstParty`)return Z([...t,Y(e)]);{let e=X(r);return e?t.push(e):t.push({value:r,label:r,description:`Custom model`}),Z(t)}}function Z(e){return(o()||{}).availableModels?e.filter(e=>e.value===null||e.value!==null&&v(e.value)):e}var Q,$,me=e((()=>{a(),c(),h(),re(),ee(),n(),M(),_(),ae(),m(),ne(),s(),Q={value:`sonnet`,label:`Sonnet`,description:`Sonnet 4.6 · Best for everyday tasks`},$={value:`haiku`,label:`Haiku`,description:`Haiku 4.5 · Fastest for quick answers`}}));export{me as n,pe as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./pluginStartupCheck-BUeBiYVq.js";e();export{t as getPluginEditableScopes};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./poorMode-D4L_-yWS.js";t();export{e as isPoorModeActive};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,l as n,o as r,s as i}from"./envUtils-DcaKZlRU.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{n as s,t as c}from"./axios-DaWTGg7G.js";import{$d as l,$l as u,$y as d,A as f,Ai as p,Ax as m,B as h,Bb as g,Bc as ee,Bg as _,Bt as te,C as ne,Cn as re,Cx as v,Di as y,Fb as b,Fc as x,Gg as ie,Gs as ae,Gv as oe,Hc as se,If as S,Ig as ce,Io as le,Ix as ue,Jb as de,Jn as fe,Jv as pe,KS as me,Kv as he,La as C,Lb as ge,Lc as _e,Lf as ve,Lg as ye,Li as be,Lv as xe,Lx as Se,Mi as Ce,Mo as w,Ms as we,Mx as Te,Nb as Ee,Ns as T,Ob as De,Pb as Oe,Pc as ke,Ps as Ae,Qd as E,Qn as je,Qy as Me,Rb as Ne,Rc as Pe,Ro as Fe,Rv as Ie,ST as D,Sb as Le,Sn as Re,Tb as ze,Th as Be,Tu as O,Uc as Ve,Ug as He,Ur as Ue,V as We,Vc as Ge,Vg as Ke,Vo as qe,Vt as Je,Vx as Ye,Wc as k,Xp as A,Xv as Xe,Yb as Ze,Yv as Qe,Zb as $e,Zd as et,Zp as tt,_T as nt,__ as rt,_i as it,_m as at,aT as ot,af as st,ai as ct,b as lt,bg as ut,bm as dt,bn as ft,br as pt,bx as mt,cT as ht,cc as gt,co as _t,cs as vt,dS as yt,dm as bt,ds as xt,eb as St,ec as Ct,ef as wt,eg as Tt,eu as Et,f as Dt,fS as Ot,fT as kt,fm as At,fs as jt,g_ as Mt,ga as Nt,gi as Pt,gm as Ft,gs as It,h_ as Lt,hg as Rt,hm as zt,hn as Bt,hs as Vt,ic as Ht,ii as Ut,io as Wt,jS as Gt,jb as Kt,jo as qt,js as Jt,jx as Yt,kS as Xt,lc as Zt,lp as Qt,ls as $t,ly as en,m_ as tn,mg as nn,mm as rn,ms as an,nc as on,ni as sn,no as cn,nw as ln,ny as un,o as dn,oE as fn,oy as pn,pT as mn,pg as hn,pm as gn,ps as _n,qc as vn,qg as yn,qs as bn,rf as xn,rw as Sn,ry as Cn,s as wn,sp as Tn,ss as En,tc as Dn,tg as On,ti as kn,to as An,ty as jn,um as Mn,uo as Nn,us as Pn,ux as Fn,v as In,vT as Ln,vm as Rn,vr as zn,w as Bn,wb as Vn,wh as Hn,wm as Un,wn as Wn,wu as Gn,xT as Kn,xm as qn,xn as Jn,xu as Yn,y as Xn,yg as Zn,ym as Qn,yn as $n,yr as er,zb as tr,zi as nr}from"./loadAgentsDir-JrGMJN05.js";import{A as j,C as M,M as N,O as P,b as F,f as rr,g as ir,j as I,l as L,m as R,p as z,u as ar,w as B,y as or}from"./external-CEp-aPkt.js";import{i as V,n as H,r as sr,t as cr}from"./lazySchema-B4D4qJVE.js";import{$t as lr,Gt as ur,M as dr,Mn as fr,Nn as pr,P as mr,Wt as hr,Y as gr,hn as _r,or as vr,pt as U,qn as yr,yn as br}from"./state-BPFYBqm1.js";import{n as xr,t as Sr}from"./cwd-Besi3Os3.js";import{C as Cr,E as wr,P as W,R as Tr,S as Er,U as Dr,a as Or,c as G,f as kr,i as Ar,nt as jr,tt as Mr,u as Nr,x as Pr}from"./debug-BQj6h99Q.js";import{Bn as Fr,G as Ir,Rn as Lr,cr as Rr,d as zr,dt as Br,f as Vr,g as Hr,it as Ur,nt as Wr,or as Gr,vt as Kr}from"./settings-aUygByiZ.js";import{F as qr,M as Jr}from"./config-BkbL2e5Q.js";import{i as Yr,n as Xr,o as K}from"./process-gEbdy6uY.js";import{A as Zr,O as Qr,k as $r}from"./git-DplvjXEY.js";import{H as ei,c as ti,i as ni,o as ri,q as ii,s as q}from"./log-BlJ7CcKG.js";import{s as ai,u as oi}from"./types-BomO8WUz.js";import{n as si,r as J}from"./analytics-DJobLaWP.js";import{Bt as ci,C as li,Kr as ui,Mn as di,Wr as fi,Y as pi,_ as mi,_n as hi,_r as gi,bt as _i,et as vi,gr as yi,ii as bi,it as xi,jn as Si,ni as Ci,o as wi,oi as Ti,ri as Ei,rt as Di,tt as Oi,u as ki,vn as Ai,x as ji}from"./model-CmDF8O9G.js";import{_t as Mi,at as Ni,it as Pi,nn as Fi,vt as Ii,xn as Li,yn as Ri,yt as zi}from"./prompt-DnPppVz8.js";import{C as Bi,S as Vi,T as Hi,_ as Ui,a as Wi,at as Gi,b as Ki,c as qi,ct as Ji,et as Yi,l as Xi,n as Zi,nt as Qi,o as $i,rt as ea,s as ta,st as na,t as ra}from"./sessionState-C2REgUrs.js";import{n as ia,t as aa}from"./omit-od_CYp5o.js";import{a as oa,n as sa,t as ca}from"./bridgeConfig-CgAVrQfz.js";import{i as la,n as ua,s as da}from"./mappers-CMJorgSL.js";import{n as fa,r as pa}from"./sessionTitle-2IWcNB8H.js";import{t as ma}from"./pollConfig-BgpfHQPJ.js";import{t as ha}from"./controlMessageCompat-IFu4Gc1y.js";import{n as ga,t as _a}from"./ccrClient-wtUIz75R.js";import{n as va,t as ya}from"./HybridTransport-CEWG9ZRi.js";import{n as ba,t as xa}from"./SSETransport-CLiI2qnD.js";import{a as Sa,n as Ca}from"./grove-DsAIY-rZ.js";import{o as wa}from"./remoteManagedSettings-BcLJLEr7.js";import{i as Ta,r as Ea}from"./auth-BYCRa_mb.js";import{t as Da}from"./pluginBlocklist-DzOs-RS1.js";import{t as Oa}from"./settingsSync-DgzCU1BZ.js";import{n as ka,t as Aa}from"./toolPool-O5nkEFb1.js";import{t as ja}from"./onChangeAppState-CqTb0yEa.js";import{n as Ma,r as Na}from"./QueryEngine-sH-KjJIq.js";import{r as Pa}from"./bridgeStatusUtil-BQF0AJDO.js";import{n as Fa,r as Ia}from"./sideQuestion-BoW-xYkh.js";import{n as La,r as Ra}from"./context-noninteractive-CqnJTDcI.js";import{n as za,t as Ba}from"./modelOptions-DEQat7lU.js";import{a as Va,o as Ha,t as Ua}from"./skillChangeDetector-C-HWR_8v.js";import{n as Wa}from"./reconciler-Bte4gdP-.js";import{n as Ga,t as Ka}from"./refresh-MiZ0acBm.js";import{basename as qa,dirname as Ja,join as Ya}from"path";import{PassThrough as Xa}from"stream";import{randomUUID as Y}from"crypto";import{mkdir as Za,readFile as Qa,stat as $a,writeFile as eo}from"fs/promises";import{URL as to}from"url";import{cwd as X}from"process";r(),a(),c(),hr(),Mr(),Tr(),Pr(),kr(),Xr(),Ar(),Qr(),ii(),ri(),Lr(),ai(),Hr(),Ti(),ui(),gi(),Si(),hi(),ci(),mi(),Oa(),sr(),cr();var no=H(()=>B({inputTokens:M(),outputTokens:M(),cacheReadInputTokens:M(),cacheCreationInputTokens:M(),webSearchRequests:M(),costUSD:M(),contextWindow:M(),maxOutputTokens:M()})),ro=H(()=>F(`json_schema`));H(()=>B({type:ro()}));var io=H(()=>B({type:F(`json_schema`),schema:P(j(),N())}));H(()=>io());var ao=H(()=>L([`user`,`project`,`org`,`temporary`,`oauth`]));H(()=>L([`local`,`user`,`project`]).describe(`Config scope for settings.`)),H(()=>F(`context-1m-2025-08-07`));var oo=H(()=>B({type:F(`adaptive`)}).describe(`Claude decides when and how much to think (Opus 4.6+).`)),so=H(()=>B({type:F(`enabled`),budgetTokens:M().optional()}).describe(`Fixed thinking token budget (older models)`)),co=H(()=>B({type:F(`disabled`)}).describe(`No extended thinking`));H(()=>I([oo(),so(),co()]).describe(`Controls Claude's thinking/reasoning behavior. When set, takes precedence over the deprecated maxThinkingTokens.`));var lo=H(()=>B({type:F(`stdio`).optional(),command:j(),args:z(j()).optional(),env:P(j(),j()).optional()})),uo=H(()=>B({type:F(`sse`),url:j(),headers:P(j(),j()).optional()})),fo=H(()=>B({type:F(`http`),url:j(),headers:P(j(),j()).optional()})),po=H(()=>B({type:F(`sdk`),name:j()})),mo=H(()=>I([lo(),uo(),fo(),po()])),ho=H(()=>B({type:F(`claudeai-proxy`),url:j(),id:j()})),go=H(()=>I([mo(),ho()])),_o=H(()=>B({name:j().describe(`Server name as configured`),status:L([`connected`,`failed`,`needs-auth`,`pending`,`disabled`]).describe(`Current connection status`),serverInfo:B({name:j(),version:j()}).optional().describe(`Server information (available when connected)`),error:j().optional().describe(`Error message (available when status is 'failed')`),config:go().optional().describe(`Server configuration (includes URL for HTTP/SSE servers)`),scope:j().optional().describe(`Configuration scope (e.g., project, user, local, claudeai, managed)`),tools:z(B({name:j(),description:j().optional(),annotations:B({readOnly:R().optional(),destructive:R().optional(),openWorld:R().optional()}).optional()})).optional().describe(`Tools provided by this server (available when connected)`),capabilities:B({experimental:P(j(),N()).optional()}).optional().describe(`@internal Server capabilities (available when connected). experimental['claude/channel'] is only present if the server's plugin is on the approved channels allowlist — use its presence to decide whether to show an Enable-channel prompt.`)}).describe(`Status information for an MCP server connection.`));H(()=>B({added:z(j()).describe(`Names of servers that were added`),removed:z(j()).describe(`Names of servers that were removed`),errors:P(j(),j()).describe(`Map of server names to error messages for servers that failed to connect`)}).describe(`Result of a setMcpServers operation.`));var vo=H(()=>L([`userSettings`,`projectSettings`,`localSettings`,`session`,`cliArg`])),yo=H(()=>L([`allow`,`deny`,`ask`])),bo=H(()=>B({toolName:j(),ruleContent:j().optional()})),xo=H(()=>ir(`type`,[B({type:F(`addRules`),rules:z(bo()),behavior:yo(),destination:vo()}),B({type:F(`replaceRules`),rules:z(bo()),behavior:yo(),destination:vo()}),B({type:F(`removeRules`),rules:z(bo()),behavior:yo(),destination:vo()}),B({type:F(`setMode`),mode:or(()=>Co()),destination:vo()}),B({type:F(`addDirectories`),directories:z(j()),destination:vo()}),B({type:F(`removeDirectories`),directories:z(j()),destination:vo()})])),So=H(()=>L([`user_temporary`,`user_permanent`,`user_reject`]).describe(`Classification of this permission decision for telemetry. SDK hosts that prompt users (desktop apps, IDEs) should set this to reflect what actually happened: user_temporary for allow-once, user_permanent for always-allow (both the click and later cache hits), user_reject for deny. If unset, the CLI infers conservatively (temporary for allow, reject for deny). The vocabulary matches tool_decision OTel events (monitoring-usage docs).`));H(()=>I([B({behavior:F(`allow`),updatedInput:P(j(),N()).optional(),updatedPermissions:z(xo()).optional(),toolUseID:j().optional(),decisionClassification:So().optional()}),B({behavior:F(`deny`),message:j(),interrupt:R().optional(),toolUseID:j().optional(),decisionClassification:So().optional()})]));var Co=H(()=>L([`default`,`acceptEdits`,`bypassPermissions`,`plan`,`dontAsk`,`auto`]).describe(`Permission mode for controlling how tool executions are handled. 'default' - Standard behavior, prompts for dangerous operations. 'acceptEdits' - Auto-accept file edit operations. 'bypassPermissions' - Bypass all permission checks (requires allowDangerouslySkipPermissions). 'plan' - Planning mode, no actual tool execution. 'dontAsk' - Don't prompt for permissions, deny if not pre-approved. 'auto' - Automatic mode (transcript classifier).`)),wo=`PreToolUse.PostToolUse.PostToolUseFailure.Notification.UserPromptSubmit.SessionStart.SessionEnd.Stop.StopFailure.SubagentStart.SubagentStop.PreCompact.PostCompact.PermissionRequest.PermissionDenied.Setup.TeammateIdle.TaskCreated.TaskCompleted.Elicitation.ElicitationResult.ConfigChange.WorktreeCreate.WorktreeRemove.InstructionsLoaded.CwdChanged.FileChanged`.split(`.`),To=H(()=>L(wo)),Z=H(()=>B({session_id:j(),transcript_path:j(),cwd:j(),permission_mode:j().optional(),agent_id:j().optional().describe(`Subagent identifier. Present only when the hook fires from within a subagent (e.g., a tool called by an AgentTool worker). Absent for the main thread, even in --agent sessions. Use this field (not agent_type) to distinguish subagent calls from main-thread calls.`),agent_type:j().optional().describe(`Agent type name (e.g., "general-purpose", "code-reviewer"). Present when the hook fires from within a subagent (alongside agent_id), or on the main thread of a session started with --agent (without agent_id).`)})),Eo=H(()=>Z().and(B({hook_event_name:F(`PreToolUse`),tool_name:j(),tool_input:N(),tool_use_id:j()}))),Do=H(()=>Z().and(B({hook_event_name:F(`PermissionRequest`),tool_name:j(),tool_input:N(),permission_suggestions:z(xo()).optional()}))),Oo=H(()=>Z().and(B({hook_event_name:F(`PostToolUse`),tool_name:j(),tool_input:N(),tool_response:N(),tool_use_id:j()}))),ko=H(()=>Z().and(B({hook_event_name:F(`PostToolUseFailure`),tool_name:j(),tool_input:N(),tool_use_id:j(),error:j(),is_interrupt:R().optional()}))),Ao=H(()=>Z().and(B({hook_event_name:F(`PermissionDenied`),tool_name:j(),tool_input:N(),tool_use_id:j(),reason:j()}))),jo=H(()=>Z().and(B({hook_event_name:F(`Notification`),message:j(),title:j().optional(),notification_type:j()}))),Mo=H(()=>Z().and(B({hook_event_name:F(`UserPromptSubmit`),prompt:j()}))),No=H(()=>Z().and(B({hook_event_name:F(`SessionStart`),source:L([`startup`,`resume`,`clear`,`compact`]),agent_type:j().optional(),model:j().optional()}))),Po=H(()=>Z().and(B({hook_event_name:F(`Setup`),trigger:L([`init`,`maintenance`])}))),Fo=H(()=>Z().and(B({hook_event_name:F(`Stop`),stop_hook_active:R(),last_assistant_message:j().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),Io=H(()=>Z().and(B({hook_event_name:F(`StopFailure`),error:Ns(),error_details:j().optional(),last_assistant_message:j().optional()}))),Lo=H(()=>Z().and(B({hook_event_name:F(`SubagentStart`),agent_id:j(),agent_type:j()}))),Ro=H(()=>Z().and(B({hook_event_name:F(`SubagentStop`),stop_hook_active:R(),agent_id:j(),agent_transcript_path:j(),agent_type:j(),last_assistant_message:j().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),zo=H(()=>Z().and(B({hook_event_name:F(`PreCompact`),trigger:L([`manual`,`auto`]),custom_instructions:j().nullable()}))),Bo=H(()=>Z().and(B({hook_event_name:F(`PostCompact`),trigger:L([`manual`,`auto`]),compact_summary:j().describe(`The conversation summary produced by compaction`)}))),Vo=H(()=>Z().and(B({hook_event_name:F(`TeammateIdle`),teammate_name:j(),team_name:j()}))),Ho=H(()=>Z().and(B({hook_event_name:F(`TaskCreated`),task_id:j(),task_subject:j(),task_description:j().optional(),teammate_name:j().optional(),team_name:j().optional()}))),Uo=H(()=>Z().and(B({hook_event_name:F(`TaskCompleted`),task_id:j(),task_subject:j(),task_description:j().optional(),teammate_name:j().optional(),team_name:j().optional()}))),Wo=H(()=>Z().and(B({hook_event_name:F(`Elicitation`),mcp_server_name:j(),message:j(),mode:L([`form`,`url`]).optional(),url:j().optional(),elicitation_id:j().optional(),requested_schema:P(j(),N()).optional()})).describe(`Hook input for the Elicitation event. Fired when an MCP server requests user input. Hooks can auto-respond (accept/decline) instead of showing the dialog.`)),Go=H(()=>Z().and(B({hook_event_name:F(`ElicitationResult`),mcp_server_name:j(),elicitation_id:j().optional(),mode:L([`form`,`url`]).optional(),action:L([`accept`,`decline`,`cancel`]),content:P(j(),N()).optional()})).describe(`Hook input for the ElicitationResult event. Fired after the user responds to an MCP elicitation. Hooks can observe or override the response before it is sent to the server.`)),Ko=[`user_settings`,`project_settings`,`local_settings`,`policy_settings`,`skills`],qo=H(()=>Z().and(B({hook_event_name:F(`ConfigChange`),source:L(Ko),file_path:j().optional()}))),Jo=[`session_start`,`nested_traversal`,`path_glob_match`,`include`,`compact`],Yo=[`User`,`Project`,`Local`,`Managed`],Xo=H(()=>Z().and(B({hook_event_name:F(`InstructionsLoaded`),file_path:j(),memory_type:L(Yo),load_reason:L(Jo),globs:z(j()).optional(),trigger_file_path:j().optional(),parent_file_path:j().optional()}))),Zo=H(()=>Z().and(B({hook_event_name:F(`WorktreeCreate`),name:j()}))),Qo=H(()=>Z().and(B({hook_event_name:F(`WorktreeRemove`),worktree_path:j()}))),$o=H(()=>Z().and(B({hook_event_name:F(`CwdChanged`),old_cwd:j(),new_cwd:j()}))),es=H(()=>Z().and(B({hook_event_name:F(`FileChanged`),file_path:j(),event:L([`change`,`add`,`unlink`])}))),ts=[`clear`,`resume`,`logout`,`prompt_input_exit`,`other`,`bypass_permissions_disabled`],ns=H(()=>L(ts)),rs=H(()=>Z().and(B({hook_event_name:F(`SessionEnd`),reason:ns()}))),is=H(()=>I([Eo(),Oo(),ko(),Ao(),jo(),Mo(),No(),rs(),Fo(),Io(),Lo(),Ro(),zo(),Bo(),Do(),Po(),Vo(),Ho(),Uo(),Wo(),Go(),qo(),Xo(),Zo(),Qo(),$o(),es()])),as=H(()=>B({async:F(!0),asyncTimeout:M().optional()})),os=H(()=>B({hookEventName:F(`PreToolUse`),permissionDecision:yo().optional(),permissionDecisionReason:j().optional(),updatedInput:P(j(),N()).optional(),additionalContext:j().optional()})),ss=H(()=>B({hookEventName:F(`UserPromptSubmit`),additionalContext:j().optional()})),cs=H(()=>B({hookEventName:F(`SessionStart`),additionalContext:j().optional(),initialUserMessage:j().optional(),watchPaths:z(j()).optional()})),ls=H(()=>B({hookEventName:F(`Setup`),additionalContext:j().optional()})),us=H(()=>B({hookEventName:F(`SubagentStart`),additionalContext:j().optional()})),ds=H(()=>B({hookEventName:F(`PostToolUse`),additionalContext:j().optional(),updatedMCPToolOutput:N().optional()})),fs=H(()=>B({hookEventName:F(`PostToolUseFailure`),additionalContext:j().optional()})),ps=H(()=>B({hookEventName:F(`PermissionDenied`),retry:R().optional()})),ms=H(()=>B({hookEventName:F(`Notification`),additionalContext:j().optional()})),hs=H(()=>B({hookEventName:F(`PermissionRequest`),decision:I([B({behavior:F(`allow`),updatedInput:P(j(),N()).optional(),updatedPermissions:z(xo()).optional()}),B({behavior:F(`deny`),message:j().optional(),interrupt:R().optional()})])})),gs=H(()=>B({hookEventName:F(`CwdChanged`),watchPaths:z(j()).optional()})),_s=H(()=>B({hookEventName:F(`FileChanged`),watchPaths:z(j()).optional()})),vs=H(()=>B({continue:R().optional(),suppressOutput:R().optional(),stopReason:j().optional(),decision:L([`approve`,`block`]).optional(),systemMessage:j().optional(),reason:j().optional(),hookSpecificOutput:I([os(),ss(),cs(),ls(),us(),ds(),fs(),ps(),ms(),hs(),ys(),bs(),gs(),_s(),xs()]).optional()})),ys=H(()=>B({hookEventName:F(`Elicitation`),action:L([`accept`,`decline`,`cancel`]).optional(),content:P(j(),N()).optional()}).describe(`Hook-specific output for the Elicitation event. Return this to programmatically accept or decline an MCP elicitation request.`)),bs=H(()=>B({hookEventName:F(`ElicitationResult`),action:L([`accept`,`decline`,`cancel`]).optional(),content:P(j(),N()).optional()}).describe(`Hook-specific output for the ElicitationResult event. Return this to override the action or content before the response is sent to the MCP server.`)),xs=H(()=>B({hookEventName:F(`WorktreeCreate`),worktreePath:j()}).describe(`Hook-specific output for the WorktreeCreate event. Provides the absolute path to the created worktree directory. Command hooks print the path on stdout instead.`));H(()=>I([as(),vs()]));var Ss=H(()=>B({key:j().describe(`Unique key for this option, returned in the response`),label:j().describe(`Display text for this option`),description:j().optional().describe(`Optional description shown below the label`)}));H(()=>B({prompt:j().describe(`Request ID. Presence of this key marks the line as a prompt request.`),message:j().describe(`The prompt message to display to the user`),options:z(Ss()).describe(`Available options for the user to choose from`)})),H(()=>B({prompt_response:j().describe(`The request ID from the corresponding prompt request`),selected:j().describe(`The key of the selected option`)}));var Cs=H(()=>B({name:j().describe(`Skill name (without the leading slash)`),description:j().describe(`Description of what the skill does`),argumentHint:j().describe(`Hint for skill arguments (e.g., "<file>")`)}).describe(`Information about an available skill (invoked via /command syntax).`)),ws=H(()=>B({name:j().describe(`Agent type identifier (e.g., "Explore")`),description:j().describe(`Description of when to use this agent`),model:j().optional().describe(`Model alias this agent uses. If omitted, inherits the parent's model`)}).describe(`Information about an available subagent that can be invoked via the Task tool.`)),Ts=H(()=>B({value:j().describe(`Model identifier to use in API calls`),displayName:j().describe(`Human-readable display name`),description:j().describe(`Description of the model's capabilities`),supportsAdaptiveThinking:R().optional().describe(`Whether this model supports adaptive thinking (Claude decides when and how much to think)`),supportsFastMode:R().optional().describe(`Whether this model supports fast mode`),supportsAutoMode:R().optional().describe(`Whether this model supports auto mode`)}).describe(`Information about an available model.`)),Es=H(()=>B({email:j().optional(),organization:j().optional(),subscriptionType:j().optional(),tokenSource:j().optional(),apiKeySource:j().optional(),apiProvider:L([`firstParty`,`bedrock`,`vertex`,`foundry`]).optional().describe(`Active API backend. Anthropic OAuth login only applies when "firstParty"; for 3P providers the other fields are absent and auth is external (AWS creds, gcloud ADC, etc.).`)}).describe(`Information about the logged in user's account.`)),Ds=H(()=>I([j(),P(j(),mo())])),Os=H(()=>B({description:j().describe(`Natural language description of when to use this agent`),tools:z(j()).optional().describe(`Array of allowed tool names. If omitted, inherits all tools from parent`),disallowedTools:z(j()).optional().describe(`Array of tool names to explicitly disallow for this agent`),prompt:j().describe(`The agent's system prompt`),model:j().optional().describe(`Model alias (e.g. 'sonnet', 'opus', 'haiku') or full model ID (e.g. 'claude-opus-4-5'). If omitted or 'inherit', uses the main model`),mcpServers:z(Ds()).optional(),criticalSystemReminder_EXPERIMENTAL:j().optional().describe(`Experimental: Critical reminder added to system prompt`),skills:z(j()).optional().describe(`Array of skill names to preload into the agent context`),initialPrompt:j().optional().describe(`Auto-submitted as the first user turn when this agent is the main thread agent. Slash commands are processed. Prepended to any user-provided prompt.`),maxTurns:M().int().positive().optional().describe(`Maximum number of agentic turns (API round-trips) before stopping`),background:R().optional().describe(`Run this agent as a background task (non-blocking, fire-and-forget) when invoked`),memory:L([`user`,`project`,`local`]).optional().describe(`Scope for auto-loading agent memory files. 'user' - ~/.workmate/agent-memory/<agentType>/, 'project' - .workmate/agent-memory/<agentType>/, 'local' - .workmate/agent-memory-local/<agentType>/`),permissionMode:Co().optional().describe(`Permission mode controlling how tool executions are handled`)}).describe(`Definition for a custom subagent that can be invoked via the Agent tool.`));H(()=>L([`user`,`project`,`local`]).describe(`Source for loading filesystem-based settings. 'user' - Global user settings (~/.workmate/settings.json). 'project' - Project settings (.workmate/settings.json). 'local' - Local settings (.workmate/settings.local.json).`)),H(()=>B({type:F(`local`).describe(`Plugin type. Currently only 'local' is supported`),path:j().describe(`Absolute or relative path to the plugin directory`)}).describe(`Configuration for loading a plugin.`)),H(()=>B({canRewind:R(),error:j().optional(),filesChanged:z(j()).optional(),insertions:M().optional(),deletions:M().optional()}).describe(`Result of a rewindFiles operation.`));var ks=H(()=>N()),As=H(()=>N()),js=H(()=>N()),Q=H(()=>j()),Ms=H(()=>N()),Ns=H(()=>L([`authentication_failed`,`billing_error`,`rate_limit`,`invalid_request`,`server_error`,`unknown`,`max_output_tokens`])),Ps=H(()=>I([F(`compacting`),ar()])),Fs=H(()=>B({type:F(`user`),message:ks(),parent_tool_use_id:j().nullable(),isSynthetic:R().optional(),tool_use_result:N().optional(),priority:L([`now`,`next`,`later`]).optional(),timestamp:j().optional().describe(`ISO timestamp when the message was created on the originating process. Older emitters omit it; consumers should fall back to receive time.`)})),Is=H(()=>Fs().extend({uuid:Q().optional(),session_id:j().optional()})),Ls=H(()=>Fs().extend({uuid:Q(),session_id:j(),isReplay:F(!0)})),Rs=H(()=>B({status:L([`allowed`,`allowed_warning`,`rejected`]),resetsAt:M().optional(),rateLimitType:L([`five_hour`,`seven_day`,`seven_day_opus`,`seven_day_sonnet`,`overage`]).optional(),utilization:M().optional(),overageStatus:L([`allowed`,`allowed_warning`,`rejected`]).optional(),overageResetsAt:M().optional(),overageDisabledReason:L([`overage_not_provisioned`,`org_level_disabled`,`org_level_disabled_until`,`out_of_credits`,`seat_tier_level_disabled`,`member_level_disabled`,`seat_tier_zero_credit_limit`,`group_zero_credit_limit`,`member_zero_credit_limit`,`org_service_level_disabled`,`org_service_zero_credit_limit`,`no_limits_configured`,`unknown`]).optional(),isUsingOverage:R().optional(),surpassedThreshold:M().optional()}).describe(`Rate limit information for claude.ai subscription users.`)),zs=H(()=>B({type:F(`assistant`),message:As(),parent_tool_use_id:j().nullable(),error:Ns().optional(),uuid:Q(),session_id:j()})),Bs=H(()=>B({type:F(`rate_limit_event`),rate_limit_info:Rs(),uuid:Q(),session_id:j()}).describe(`Rate limit event emitted when rate limit info changes.`)),Vs=H(()=>B({type:F(`streamlined_text`),text:j().describe(`Text content preserved from the assistant message`),session_id:j(),uuid:Q()}).describe(`@internal Streamlined text message - replaces SDKAssistantMessage in streamlined output. Text content preserved, thinking and tool_use blocks removed.`)),Hs=H(()=>B({type:F(`streamlined_tool_use_summary`),tool_summary:j().describe(`Summary of tool calls (e.g., "Read 2 files, wrote 1 file")`),session_id:j(),uuid:Q()}).describe(`@internal Streamlined tool use summary - replaces tool_use blocks in streamlined output with a cumulative summary string.`)),Us=H(()=>B({tool_name:j(),tool_use_id:j(),tool_input:P(j(),N())})),Ws=H(()=>B({type:F(`result`),subtype:F(`success`),duration_ms:M(),duration_api_ms:M(),is_error:R(),num_turns:M(),result:j(),stop_reason:j().nullable(),total_cost_usd:M(),usage:Ms(),modelUsage:P(j(),no()),permission_denials:z(Us()),structured_output:N().optional(),fast_mode_state:mc().optional(),uuid:Q(),session_id:j()})),Gs=H(()=>B({type:F(`result`),subtype:L([`error_during_execution`,`error_max_turns`,`error_max_budget_usd`,`error_max_structured_output_retries`]),duration_ms:M(),duration_api_ms:M(),is_error:R(),num_turns:M(),stop_reason:j().nullable(),total_cost_usd:M(),usage:Ms(),modelUsage:P(j(),no()),permission_denials:z(Us()),errors:z(j()),fast_mode_state:mc().optional(),uuid:Q(),session_id:j()})),Ks=H(()=>I([Ws(),Gs()])),qs=H(()=>B({type:F(`system`),subtype:F(`init`),agents:z(j()).optional(),apiKeySource:ao(),betas:z(j()).optional(),claude_code_version:j(),cwd:j(),tools:z(j()),mcp_servers:z(B({name:j(),status:j()})),model:j(),permissionMode:Co(),slash_commands:z(j()),output_style:j(),skills:z(j()),plugins:z(B({name:j(),path:j(),source:j().optional().describe(`@internal Plugin source identifier in "name\\@marketplace" format. Sentinels: "name\\@inline" for --plugin-dir, "name\\@builtin" for built-in plugins.`)})),fast_mode_state:mc().optional(),uuid:Q(),session_id:j()})),Js=H(()=>B({type:F(`stream_event`),event:js(),parent_tool_use_id:j().nullable(),uuid:Q(),session_id:j()})),Ys=H(()=>B({type:F(`system`),subtype:F(`compact_boundary`),compact_metadata:B({trigger:L([`manual`,`auto`]),pre_tokens:M(),preserved_segment:B({head_uuid:Q(),anchor_uuid:Q(),tail_uuid:Q()}).optional().describe(`Relink info for messagesToKeep. Loaders splice the preserved segment at anchor_uuid (summary for suffix-preserving, boundary for prefix-preserving partial compact) so resume includes preserved content. Unset when compaction summarizes everything (no messagesToKeep).`)}),uuid:Q(),session_id:j()})),Xs=H(()=>B({type:F(`system`),subtype:F(`status`),status:Ps(),permissionMode:Co().optional(),uuid:Q(),session_id:j()})),Zs=H(()=>B({type:F(`system`),subtype:F(`post_turn_summary`),summarizes_uuid:j(),status_category:L([`blocked`,`waiting`,`completed`,`review_ready`,`failed`]),status_detail:j(),is_noteworthy:R(),title:j(),description:j(),recent_action:j(),needs_action:j(),artifact_urls:z(j()),uuid:Q(),session_id:j()}).describe(`@internal Background post-turn summary emitted after each assistant turn. summarizes_uuid points to the assistant message this summarizes.`)),Qs=H(()=>B({type:F(`system`),subtype:F(`api_retry`),attempt:M(),max_retries:M(),retry_delay_ms:M(),error_status:M().nullable(),error:Ns(),uuid:Q(),session_id:j()}).describe(`Emitted when an API request fails with a retryable error and will be retried after a delay. error_status is null for connection errors (e.g. timeouts) that had no HTTP response.`)),$s=H(()=>B({type:F(`system`),subtype:F(`local_command_output`),content:j(),uuid:Q(),session_id:j()}).describe(`Output from a local slash command (e.g. /voice, /cost). Displayed as assistant-style text in the transcript.`)),ec=H(()=>B({type:F(`system`),subtype:F(`hook_started`),hook_id:j(),hook_name:j(),hook_event:j(),uuid:Q(),session_id:j()})),tc=H(()=>B({type:F(`system`),subtype:F(`hook_progress`),hook_id:j(),hook_name:j(),hook_event:j(),stdout:j(),stderr:j(),output:j(),uuid:Q(),session_id:j()})),nc=H(()=>B({type:F(`system`),subtype:F(`hook_response`),hook_id:j(),hook_name:j(),hook_event:j(),output:j(),stdout:j(),stderr:j(),exit_code:M().optional(),outcome:L([`success`,`error`,`cancelled`]),uuid:Q(),session_id:j()})),rc=H(()=>B({type:F(`tool_progress`),tool_use_id:j(),tool_name:j(),parent_tool_use_id:j().nullable(),elapsed_time_seconds:M(),task_id:j().optional(),uuid:Q(),session_id:j()})),ic=H(()=>B({type:F(`auth_status`),isAuthenticating:R(),output:z(j()),error:j().optional(),uuid:Q(),session_id:j()})),ac=H(()=>B({type:F(`system`),subtype:F(`files_persisted`),files:z(B({filename:j(),file_id:j()})),failed:z(B({filename:j(),error:j()})),processed_at:j(),uuid:Q(),session_id:j()})),oc=H(()=>B({type:F(`system`),subtype:F(`task_notification`),task_id:j(),tool_use_id:j().optional(),status:L([`completed`,`failed`,`stopped`]),output_file:j(),summary:j(),usage:B({total_tokens:M(),tool_uses:M(),duration_ms:M()}).optional(),uuid:Q(),session_id:j()})),sc=H(()=>B({type:F(`system`),subtype:F(`task_started`),task_id:j(),tool_use_id:j().optional(),description:j(),task_type:j().optional(),workflow_name:j().optional().describe(`meta.name from the workflow script (e.g. 'spec'). Only set when task_type is 'local_workflow'.`),prompt:j().optional(),uuid:Q(),session_id:j()})),cc=H(()=>B({type:F(`system`),subtype:F(`session_state_changed`),state:L([`idle`,`running`,`requires_action`]),uuid:Q(),session_id:j()}).describe(`Mirrors notifySessionStateChanged. 'idle' fires after heldBackResult flushes and the bg-agent do-while exits — authoritative turn-over signal.`)),lc=H(()=>B({type:F(`system`),subtype:F(`task_progress`),task_id:j(),tool_use_id:j().optional(),description:j(),usage:B({total_tokens:M(),tool_uses:M(),duration_ms:M()}),last_tool_name:j().optional(),summary:j().optional(),uuid:Q(),session_id:j()})),uc=H(()=>B({type:F(`tool_use_summary`),summary:j(),preceding_tool_use_ids:z(j()),uuid:Q(),session_id:j()})),dc=H(()=>B({type:F(`system`),subtype:F(`elicitation_complete`),mcp_server_name:j(),elicitation_id:j(),uuid:Q(),session_id:j()}).describe(`Emitted when an MCP server confirms that a URL-mode elicitation is complete.`)),fc=H(()=>B({type:F(`prompt_suggestion`),suggestion:j(),uuid:Q(),session_id:j()}).describe(`Predicted next user prompt, emitted after each turn when promptSuggestions is enabled.`));H(()=>B({sessionId:j().describe(`Unique session identifier (UUID).`),summary:j().describe(`Display title for the session: custom title, auto-generated summary, or first prompt.`),lastModified:M().describe(`Last modified time in milliseconds since epoch.`),fileSize:M().optional().describe(`File size in bytes. Only populated for local JSONL storage.`),customTitle:j().optional().describe(`User-set session title via /rename.`),firstPrompt:j().optional().describe(`First meaningful user prompt in the session.`),gitBranch:j().optional().describe(`Git branch at the end of the session.`),cwd:j().optional().describe(`Working directory for the session.`),tag:j().optional().describe(`User-set session tag.`),createdAt:M().optional().describe(`Creation time in milliseconds since epoch, extracted from the first entry's timestamp.`)}).describe(`Session metadata returned by listSessions and getSessionInfo.`));var pc=H(()=>I([zs(),Is(),Ls(),Ks(),qs(),Js(),Ys(),Xs(),Qs(),$s(),ec(),tc(),nc(),rc(),ic(),oc(),sc(),lc(),cc(),ac(),uc(),Bs(),dc(),fc()])),mc=H(()=>L([`off`,`cooldown`,`on`]).describe(`Fast mode state: off, in cooldown after rate limit, or actively enabled.`));sr(),cr();var hc=H(()=>N()),gc=H(()=>B({matcher:j().optional(),hookCallbackIds:z(j()),timeout:M().optional()}).describe(`Configuration for matching and routing hook callbacks.`)),_c=H(()=>B({subtype:F(`initialize`),hooks:P(To(),z(gc())).optional(),sdkMcpServers:z(j()).optional(),jsonSchema:P(j(),N()).optional(),systemPrompt:j().optional(),appendSystemPrompt:j().optional(),agents:P(j(),Os()).optional(),promptSuggestions:R().optional(),agentProgressSummaries:R().optional()}).describe(`Initializes the SDK session with hooks, MCP servers, and agent configuration.`));H(()=>B({commands:z(Cs()),agents:z(ws()),output_style:j(),available_output_styles:z(j()),models:z(Ts()),account:Es(),pid:M().optional().describe(`@internal CLI process PID for tmux socket isolation`),fast_mode_state:mc().optional()}).describe(`Response from session initialization with available commands, models, and account info.`));var vc=H(()=>B({subtype:F(`interrupt`)}).describe(`Interrupts the currently running conversation turn.`)),yc=H(()=>B({subtype:F(`can_use_tool`),tool_name:j(),input:P(j(),N()),permission_suggestions:z(xo()).optional(),blocked_path:j().optional(),decision_reason:j().optional(),title:j().optional(),display_name:j().optional(),tool_use_id:j(),agent_id:j().optional(),description:j().optional()}).describe(`Requests permission to use a tool with the given input.`)),bc=H(()=>B({subtype:F(`set_permission_mode`),mode:Co()}).describe(`Sets the permission mode for tool execution handling.`)),xc=H(()=>B({subtype:F(`set_model`),model:j().optional()}).describe(`Sets the model to use for subsequent conversation turns.`)),Sc=H(()=>B({subtype:F(`set_max_thinking_tokens`),max_thinking_tokens:M().nullable()}).describe(`Sets the maximum number of thinking tokens for extended thinking.`)),Cc=H(()=>B({subtype:F(`mcp_status`)}).describe(`Requests the current status of all MCP server connections.`));H(()=>B({mcpServers:z(_o())}).describe(`Response containing the current status of all MCP server connections.`));var wc=H(()=>B({subtype:F(`get_context_usage`)}).describe(`Requests a breakdown of current context window usage by category.`)),Tc=H(()=>B({name:j(),tokens:M(),color:j(),isDeferred:R().optional()})),Ec=H(()=>B({color:j(),isFilled:R(),categoryName:j(),tokens:M(),percentage:M(),squareFullness:M()}));H(()=>B({categories:z(Tc()),totalTokens:M(),maxTokens:M(),rawMaxTokens:M(),percentage:M(),gridRows:z(z(Ec())),model:j(),memoryFiles:z(B({path:j(),type:j(),tokens:M()})),mcpTools:z(B({name:j(),serverName:j(),tokens:M(),isLoaded:R().optional()})),deferredBuiltinTools:z(B({name:j(),tokens:M(),isLoaded:R()})).optional(),systemTools:z(B({name:j(),tokens:M()})).optional(),systemPromptSections:z(B({name:j(),tokens:M()})).optional(),agents:z(B({agentType:j(),source:j(),tokens:M()})),slashCommands:B({totalCommands:M(),includedCommands:M(),tokens:M()}).optional(),skills:B({totalSkills:M(),includedSkills:M(),tokens:M(),skillFrontmatter:z(B({name:j(),source:j(),tokens:M()}))}).optional(),autoCompactThreshold:M().optional(),isAutoCompactEnabled:R(),messageBreakdown:B({toolCallTokens:M(),toolResultTokens:M(),attachmentTokens:M(),assistantMessageTokens:M(),userMessageTokens:M(),toolCallsByType:z(B({name:j(),callTokens:M(),resultTokens:M()})),attachmentsByType:z(B({name:j(),tokens:M()}))}).optional(),apiUsage:B({input_tokens:M(),output_tokens:M(),cache_creation_input_tokens:M(),cache_read_input_tokens:M()}).nullable()}).describe(`Breakdown of current context window usage by category (system prompt, tools, messages, etc.).`));var Dc=H(()=>B({subtype:F(`rewind_files`),user_message_id:j(),dry_run:R().optional()}).describe(`Rewinds file changes made since a specific user message.`));H(()=>B({canRewind:R(),error:j().optional(),filesChanged:z(j()).optional(),insertions:M().optional(),deletions:M().optional()}).describe(`Result of a rewindFiles operation.`));var Oc=H(()=>B({subtype:F(`cancel_async_message`),message_uuid:j()}).describe(`Drops a pending async user message from the command queue by uuid. No-op if already dequeued for execution.`));H(()=>B({cancelled:R()}).describe(`Result of a cancel_async_message operation. cancelled=false means the message was not in the queue (already dequeued or never enqueued).`));var kc=H(()=>B({subtype:F(`seed_read_state`),path:j(),mtime:M()}).describe(`Seeds the readFileState cache with a path+mtime entry. Use when a prior Read was removed from context (e.g. by snip) so Edit validation would fail despite the client having observed the Read. The mtime lets the CLI detect if the file changed since the seeded Read — same staleness check as the normal path.`)),Ac=H(()=>B({subtype:F(`hook_callback`),callback_id:j(),input:is(),tool_use_id:j().optional()}).describe(`Delivers a hook callback with its input data.`)),jc=H(()=>B({subtype:F(`mcp_message`),server_name:j(),message:hc()}).describe(`Sends a JSON-RPC message to a specific MCP server.`)),Mc=H(()=>B({subtype:F(`mcp_set_servers`),servers:P(j(),mo())}).describe(`Replaces the set of dynamically managed MCP servers.`));H(()=>B({added:z(j()),removed:z(j()),errors:P(j(),j())}).describe(`Result of replacing the set of dynamically managed MCP servers.`));var Nc=H(()=>B({subtype:F(`reload_plugins`)}).describe(`Reloads plugins from disk and returns the refreshed session components.`));H(()=>B({commands:z(Cs()),agents:z(ws()),plugins:z(B({name:j(),path:j(),source:j().optional()})),mcpServers:z(_o()),error_count:M()}).describe(`Refreshed commands, agents, plugins, and MCP server status after reload.`));var Pc=H(()=>B({subtype:F(`mcp_reconnect`),serverName:j()}).describe(`Reconnects a disconnected or failed MCP server.`)),Fc=H(()=>B({subtype:F(`mcp_toggle`),serverName:j(),enabled:R()}).describe(`Enables or disables an MCP server.`)),Ic=H(()=>B({subtype:F(`stop_task`),task_id:j()}).describe(`Stops a running task.`)),Lc=H(()=>B({subtype:F(`apply_flag_settings`),settings:P(j(),N())}).describe(`Merges the provided settings into the flag settings layer, updating the active configuration.`)),Rc=H(()=>B({subtype:F(`get_settings`)}).describe(`Returns the effective merged settings and the raw per-source settings.`));H(()=>B({effective:P(j(),N()),sources:z(B({source:L([`userSettings`,`projectSettings`,`localSettings`,`flagSettings`,`policySettings`]),settings:P(j(),N())})).describe(`Ordered low-to-high priority — later entries override earlier ones.`),applied:B({model:j()}).optional().describe("Runtime-resolved values after env overrides, session state, and model-specific defaults are applied. Unlike `effective` (disk merge), these reflect what will actually be sent to the API.")}).describe(`Effective merged settings plus raw per-source settings in merge order.`));var zc=H(()=>B({subtype:F(`elicitation`),mcp_server_name:j(),message:j(),mode:L([`form`,`url`]).optional(),url:j().optional(),elicitation_id:j().optional(),requested_schema:P(j(),N()).optional()}).describe(`Requests the SDK consumer to handle an MCP elicitation (user input request).`)),Bc=H(()=>B({action:L([`accept`,`decline`,`cancel`]),content:P(j(),N()).optional()}).describe(`Response from the SDK consumer for an elicitation request.`)),Vc=H(()=>I([vc(),yc(),_c(),bc(),xc(),Sc(),Cc(),wc(),Ac(),jc(),Dc(),Oc(),kc(),Mc(),Nc(),Pc(),Fc(),Ic(),Lc(),Rc(),zc()])),Hc=H(()=>B({type:F(`control_request`),request_id:j(),request:Vc()})),Uc=H(()=>B({subtype:F(`success`),request_id:j(),response:P(j(),N()).optional()})),Wc=H(()=>B({subtype:F(`error`),request_id:j(),error:j(),pending_permission_requests:z(or(()=>Hc())).optional()})),Gc=H(()=>B({type:F(`control_response`),response:I([Uc(),Wc()])})),Kc=H(()=>B({type:F(`control_cancel_request`),request_id:j()}).describe(`Cancels a currently open control request.`)),qc=H(()=>B({type:F(`keep_alive`)}).describe(`Keep-alive message to maintain WebSocket connection.`)),Jc=H(()=>B({type:F(`update_environment_variables`),variables:P(j(),j())}).describe(`Updates environment variables at runtime.`));H(()=>I([pc(),Vs(),Hs(),Zs(),Gc(),Hc(),Kc(),qc()])),H(()=>I([Is(),Hc(),Gc(),qc(),Jc()])),Re(),sr(),cr(),ie(),re(),H(()=>V.object({tool_name:V.string().describe(`The name of the tool requesting permission`),input:V.record(V.string(),V.unknown()).describe(`The input for the tool`),tool_use_id:V.string().optional().describe(`The unique tool use request ID`)}));var Yc=H(()=>V.enum([`user_temporary`,`user_permanent`,`user_reject`]).optional().catch(void 0)),Xc=H(()=>V.object({behavior:V.literal(`allow`),updatedInput:V.record(V.string(),V.unknown()),updatedPermissions:V.array(Wn()).optional().catch(e=>{G(`Malformed updatedPermissions from SDK host ignored: ${e.error.issues[0]?.message??`unknown`}`,{level:`warn`})}),toolUseID:V.string().optional(),decisionClassification:Yc()})),Zc=H(()=>V.object({behavior:V.literal(`deny`),message:V.string(),interrupt:V.boolean().optional(),toolUseID:V.string().optional(),decisionClassification:Yc()})),Qc=H(()=>V.union([Xc(),Zc()]));function $c(e,t,n,r){let i={type:`permissionPromptTool`,permissionPromptToolName:t.name,toolResult:e};if(e.behavior===`allow`){let t=e.updatedPermissions;t&&(r.setAppState(e=>({...e,toolPermissionContext:He(e.toolPermissionContext,t)})),yn(t));let a=Object.keys(e.updatedInput).length>0?e.updatedInput:n;return{...e,updatedInput:a,decisionReason:i}}else e.behavior===`deny`&&e.interrupt&&(G(`SDK permission prompt deny+interrupt: tool=${t.name} message=${e.message}`),r.abortController.abort());return{...e,decisionReason:i}}xr(),Rr(),Kr(),Ur(),Ri(),Fi(),Gi(),kt(),ht(),g(),Cn(),Ki(),ye(),rn(),A(),l(),Zi(),se(),x(),T(),we(),cn(),C(),be(),pt(),ft(),Bt(),We();var el=/\u2028|\u2029/g;function tl(e){return e.replace(el,e=>e===`\u2028`?`\\u2028`:`\\u2029`)}function nl(e){return tl(Cr(e))}Ar(),Pr(),sr(),ie();var rl=`SandboxNetworkAccess`;function il(e){if(e){if(e.type===`classifier`)return e.reason;switch(e.type){case`rule`:case`mode`:case`subcommandResults`:case`permissionPromptTool`:return;case`hook`:case`asyncAgent`:case`sandboxOverride`:case`workingDir`:case`safetyCheck`:case`other`:return e.reason}}}function al(e,t,n,r){let i;try{i=e.getActivityDescription?.(t)??e.getToolUseSummary?.(t)??e.userFacingName(t)}catch{i=e.name}return{tool_name:e.name,action_description:i,tool_use_id:n,request_id:r,input:t}}var ol=1e3,sl=class{constructor(e,t){o(this,`input`,void 0),o(this,`replayUserMessages`,void 0),o(this,`structuredInput`,void 0),o(this,`pendingRequests`,new Map),o(this,`restoredWorkerState`,Promise.resolve(null)),o(this,`inputClosed`,!1),o(this,`unexpectedResponseCallback`,void 0),o(this,`resolvedToolUseIds`,new Set),o(this,`prependedLines`,[]),o(this,`onControlRequestSent`,void 0),o(this,`onControlRequestResolved`,void 0),o(this,`outbound`,new Ge),this.input=e,this.replayUserMessages=t,this.input=e,this.structuredInput=this.read()}trackResolvedToolUseId(e){let t=e.request;if(t.subtype===`can_use_tool`&&(this.resolvedToolUseIds.add(t.tool_use_id),this.resolvedToolUseIds.size>ol)){let e=this.resolvedToolUseIds.values().next().value;e!==void 0&&this.resolvedToolUseIds.delete(e)}}flushInternalEvents(){return Promise.resolve()}get internalEventsPending(){return 0}prependUserMessage(e){this.prependedLines.push(`${Cr({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})}\n`)}async*read(){let e=``,t=async function*(){for(;;){this.prependedLines.length>0&&(e=this.prependedLines.join(``)+e,this.prependedLines=[]);let t=e.indexOf(`
|
|
2
|
-
`);if(t===-1)break;let n=e.slice(0,t);e=e.slice(t+1);let r=await this.processLine(n);r&&($r(`info`,`cli_stdin_message_parsed`,{type:r.type}),yield r)}}.bind(this);yield*t();for await(let n of this.input)e+=n,yield*t();if(e){let t=await this.processLine(e);t&&(yield t)}this.inputClosed=!0;for(let e of this.pendingRequests.values())e.reject(Error(`Tool permission stream closed before response received`))}getPendingPermissionRequests(){return Array.from(this.pendingRequests.values()).map(e=>e.request).filter(e=>e.request.subtype===`can_use_tool`)}setUnexpectedResponseCallback(e){this.unexpectedResponseCallback=e}injectControlResponse(e){let t=e.response,n=t?.request_id;if(!n)return;let r=this.pendingRequests.get(n);if(r)if(this.trackResolvedToolUseId(r.request),this.pendingRequests.delete(n),this.write({type:`control_cancel_request`,request_id:n}),t.subtype===`error`)r.reject(Error(t.error));else{let e=t.response;if(r.schema)try{r.resolve(r.schema.parse(e))}catch(e){r.reject(e)}else r.resolve({})}}setOnControlRequestSent(e){this.onControlRequestSent=e}setOnControlRequestResolved(e){this.onControlRequestResolved=e}async processLine(e){if(e)try{let t=ha(Er(e));if(t.type===`keep_alive`)return;if(t.type===`update_environment_variables`){let e=t.variables??{},n=Object.keys(e);for(let[t,n]of Object.entries(e))process.env[t]=n;G(`[structuredIO] applied update_environment_variables: ${n.join(`, `)}`);return}if(t.type===`control_response`){let e=`uuid`in t&&typeof t.uuid==`string`?t.uuid:void 0;e&&zt(e,`completed`);let n=t.response,r=this.pendingRequests.get(n.request_id);if(!r){let e=(n.subtype===`success`?n.response:void 0)?.toolUseID;if(typeof e==`string`&&this.resolvedToolUseIds.has(e)){G(`Ignoring duplicate control_response for already-resolved toolUseID=${e} request_id=${n.request_id}`);return}this.unexpectedResponseCallback&&await this.unexpectedResponseCallback(t);return}if(this.trackResolvedToolUseId(r.request),this.pendingRequests.delete(n.request_id),r.request.request.subtype===`can_use_tool`&&this.onControlRequestResolved&&this.onControlRequestResolved(n.request_id),n.subtype===`error`){r.reject(Error(n.error??`Unknown error`));return}let i=n.response;if(r.schema)try{r.resolve(r.schema.parse(i))}catch(e){r.reject(e)}else r.resolve({});return this.replayUserMessages?t:void 0}if(t.type!==`user`&&t.type!==`control_request`&&t.type!==`assistant`&&t.type!==`system`){G(`Ignoring unknown message type: ${t.type}`,{level:`warn`});return}return t.type===`control_request`?(t.request||cl(`Error: Missing request on control_request`),t):(t.type===`assistant`||t.type===`system`||t.message?.role!==`user`&&cl(`Error: Expected message role 'user', got '${t.message?.role}'`),t)}catch(t){console.error(`Error parsing streaming input line: ${e}: ${t}`),process.exit(1)}}async write(e){K(`${nl(e)}\n`)}async sendRequest(e,t,n,r=Y()){let i={type:`control_request`,request_id:r,request:e};if(this.inputClosed)throw Error(`Stream closed`);if(n?.aborted)throw Error(`Request aborted`);this.outbound.enqueue(i),e.subtype===`can_use_tool`&&this.onControlRequestSent&&this.onControlRequestSent(i);let a=()=>{this.outbound.enqueue({type:`control_cancel_request`,request_id:r});let e=this.pendingRequests.get(r);e&&(this.trackResolvedToolUseId(e.request),e.reject(new wr))};n&&n.addEventListener(`abort`,a,{once:!0});try{return await new Promise((n,i)=>{this.pendingRequests.set(r,{request:{type:`control_request`,request_id:r,request:e},resolve:e=>{n(e)},reject:i,schema:t})})}finally{n&&n.removeEventListener(`abort`,a),this.pendingRequests.delete(r)}}createCanUseTool(e){return async(t,n,r,i,a,o)=>{let s=o??await h(t,n,r,i,a);if(s.behavior===`allow`||s.behavior===`deny`)return s;let c=new AbortController,l=r.abortController.signal,u=()=>c.abort();l.addEventListener(`abort`,u,{once:!0});try{let i=ll(t.name,a,n,r,s.suggestions).then(e=>({source:`hook`,decision:e})),o=Y();e?.(al(t,n,a,o));let l=this.sendRequest({subtype:`can_use_tool`,tool_name:t.name,input:n,permission_suggestions:s.suggestions,blocked_path:s.blockedPath,decision_reason:il(s.decisionReason),tool_use_id:a,agent_id:r.agentId},Qc(),c.signal,o).then(e=>({source:`sdk`,result:e})),u=await Promise.race([i,l]);return u.source===`hook`?u.decision?(l.catch(()=>{}),c.abort(),u.decision):$c((await l).result,t,n,r):$c(u.result,t,n,r)}catch(e){return $c({behavior:`deny`,message:`Tool permission request failed: ${e}`,toolUseID:a},t,n,r)}finally{this.getPendingPermissionRequests().length===0&&$i(`running`),l.removeEventListener(`abort`,u)}}}createHookCallback(e,t){return{type:`callback`,timeout:t,callback:async(t,n,r)=>{try{return await this.sendRequest({subtype:`hook_callback`,callback_id:e,input:t,tool_use_id:n||void 0},Jn(),r)}catch(t){return console.error(`Error in hook callback ${e}:`,t),{}}}}}async handleElicitation(e,t,n,r,i,a,o){try{return await this.sendRequest({subtype:`elicitation`,mcp_server_name:e,message:t,mode:i,url:a,elicitation_id:o,requested_schema:n},Bc(),r)}catch{return{action:`cancel`}}}createSandboxAskCallback(){return async e=>{try{return(await this.sendRequest({subtype:`can_use_tool`,tool_name:rl,input:{host:e.host},tool_use_id:Y(),description:`Allow network connection to ${e.host}?`},Qc())).behavior===`allow`}catch{return!1}}}async sendMcpMessage(e,t){return(await this.sendRequest({subtype:`mcp_message`,server_name:e,message:t},B({mcp_response:rr()}))).mcp_response}};function cl(e){console.error(e),process.exit(1)}async function ll(e,t,n,r,i){let a=r.getAppState().toolPermissionContext.mode,o=Je(e,t,n,r,a,i,r.abortController.signal);for await(let e of o)if(e.permissionRequestResult&&(e.permissionRequestResult.behavior===`allow`||e.permissionRequestResult.behavior===`deny`)){let t=e.permissionRequestResult;if(t.behavior===`allow`){let e=t.updatedInput||n,i=t.updatedPermissions??[];if(i.length>0){yn(i);let e=He(r.getAppState().toolPermissionContext,i);r.setAppState(t=>t.toolPermissionContext===e?t:{...t,toolPermissionContext:e})}return{behavior:`allow`,updatedInput:e,userModified:!1,decisionReason:{type:`hook`,hookName:`PermissionRequest`}}}else return{behavior:`deny`,message:t.message||`Permission denied by PermissionRequest hook`,decisionReason:{type:`hook`,hookName:`PermissionRequest`}}}}Bi(),ba();function ul(e,t={},r,i){if(n(process.env.CLAUDE_CODE_USE_CCR_V2)){let n=new to(e.href);return n.protocol===`wss:`?n.protocol=`https:`:n.protocol===`ws:`&&(n.protocol=`http:`),n.pathname=`${n.pathname.replace(/\/$/,``)}/worker/events/stream`,new xa(n,t,r,i)}if(e.protocol===`ws:`||e.protocol===`wss:`)return n(process.env.CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2)?new ya(e,t,r,i):new va(e,t,r,i);throw Error(`Unsupported protocol: ${e.protocol}`)}rn(),Ar(),Qr(),r(),Tr(),Xr(),Zi(),ba(),a();var dl=class extends sl{constructor(e,t,r){let i=new Xa({encoding:`utf8`});super(i,r),o(this,`url`,void 0),o(this,`transport`,void 0),o(this,`inputStream`,void 0),o(this,`isBridge`,!1),o(this,`isDebug`,!1),o(this,`ccrClient`,null),o(this,`keepAliveTimer`,null),this.inputStream=i,this.url=new to(e);let a={},s=Vi();s?a.Authorization=`Bearer ${s}`:G(`[remote-io] No session ingress token available`,{level:`error`});let c=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;c&&(a[`x-environment-runner-version`]=c);let l=()=>{let e={},t=Vi();t&&(e.Authorization=`Bearer ${t}`);let n=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;return n&&(e[`x-environment-runner-version`]=n),e};if(this.transport=ul(this.url,a,U(),l),this.isBridge=process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`,this.isDebug=Or(),this.transport.setOnData(e=>{this.inputStream.write(e),this.isBridge&&this.isDebug&&K(e.endsWith(`
|
|
3
|
-
`)?e:`${e}\n`)}),this.transport.setOnClose(()=>{this.inputStream.end()}),n(process.env.CLAUDE_CODE_USE_CCR_V2)){if(!(this.transport instanceof xa))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new _a(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{$r(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof ga?e.reason:`unknown`}),q(Error(`CCRClient initialization failed: ${W(e)}`)),et(1,`other`)}),jr(async()=>this.ccrClient?.close()),it((e,t,n)=>this.ccrClient.writeInternalEvent(e,t,n)),Pt(()=>this.ccrClient.readInternalEvents(),()=>this.ccrClient.readSubagentInternalEvents());let t={started:`processing`,completed:`processed`};Ft((e,n)=>{this.ccrClient?.reportDelivery(e,t[n])}),Xi((e,t)=>{this.ccrClient?.reportState(e,t)}),qi(e=>{this.ccrClient?.reportMetadata(e)},{replayCurrent:!0})}this.transport.connect();let u=ma().session_keepalive_interval_v2_ms;if(this.isBridge&&u>0&&(this.keepAliveTimer=setInterval(()=>{G(`[remote-io] keep_alive sent`),this.write({type:`keep_alive`}).catch(e=>{G(`[remote-io] keep_alive write failed: ${W(e)}`)})},u),this.keepAliveTimer.unref?.()),jr(async()=>this.close()),t){let e=this.inputStream;(async()=>{for await(let n of t)e.write(`${String(n).replace(/\n$/,``)}\n`)})()}}flushInternalEvents(){return this.ccrClient?.flushInternalEvents()??Promise.resolve()}get internalEventsPending(){return this.ccrClient?.internalEventsPending??0}async write(e){this.ccrClient?await this.ccrClient.writeEvent(e):await this.transport.write(e),this.isBridge&&(e.type===`control_request`||this.isDebug)&&K(`${nl(e)}\n`)}close(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=null),this.transport.close(),this.inputStream.end()}};Mi(),Ir(),zi(),[...Ii],Mr(),Ar();var fl=`[stdout-guard]`,pl=!1,$=``,ml=null;function hl(e){if(e.length===0)return!0;try{return JSON.parse(e),!0}catch{return!1}}function gl(){pl||(pl=!0,ml=process.stdout.write.bind(process.stdout),process.stdout.write=((e,t,n)=>{let r=typeof e==`string`?e:Buffer.from(e).toString(`utf-8`);$+=r;let i,a=!0;for(;(i=$.indexOf(`
|
|
4
|
-
`))!==-1;){let e=$.slice(0,i);$=$.slice(i+1),hl(e)?a=ml(`${e}\n`):(process.stderr.write(`${fl} ${e}\n`),G(`streamJsonStdoutGuard diverted non-JSON stdout line: ${e.slice(0,200)}`))}let o=typeof t==`function`?t:n;return o&&queueMicrotask(()=>o()),a}),jr(async()=>{$.length>0&&(ml&&hl($)?ml(`${$}\n`):process.stderr.write(`${fl} ${$}\n`),$=``),ml&&(process.stdout.write=ml,ml=null),pl=!1}))}Jr(),nt(),Hi(),ue(),v(),d(),Ni(),tn(),_(),ut(),Gn(),vn(),bn(),an(),le(),_t(),dn(),Aa(),Yn(),Tr(),ri(),Bi(),fn(),Ar(),l();function _l(e){let t=process.env.CLAUDE_CODE_EXIT_AFTER_STOP_DELAY,n=t?parseInt(t,10):null,r=n&&!isNaN(n)&&n>0,i=null,a=0;return{start(){i&&(clearTimeout(i),i=null),r&&(a=Date.now(),i=setTimeout(()=>{let t=Date.now()-a;e()&&t>=n&&(G(`Exiting after ${n}ms of idle time`),E())},n))},stop(){i&&(clearTimeout(i),i=null)}}}aa(),Kn(),Ot(),xn(),Sn();function vl(e){if(e.type!==`user`)return;let t=e.message?.content;if(!t||Array.isArray(t)&&t.length===0)return;let n=`uuid`in e&&typeof e.uuid==`string`?e.uuid:void 0;return{content:Array.isArray(t)?yl(t):t,uuid:n}}function yl(e){return e.some(bl)?e.map(e=>{if(!bl(e))return e;let t=e.source,n=typeof t.mediaType==`string`&&t.mediaType?t.mediaType:ln(e.source.data);return{...e,source:{type:`base64`,media_type:n,data:e.source.data}}}):e}function bl(e){return e.type!==`image`||e.source?.type!==`base64`?!1:!e.source.media_type}sr(),hr(),Ar(),r(),cr(),oa();var xl=3e4;function Sl(e){G(`[bridge:inbound-attach] ${e}`)}var Cl=H(()=>B({file_uuid:j(),file_name:j()})),wl=H(()=>z(Cl()));function Tl(e){if(typeof e!=`object`||!e||!(`file_attachments`in e))return[];let t=wl().safeParse(e.file_attachments);return t.success?t.data:[]}function El(e){return qa(e).replace(/[^a-zA-Z0-9._-]/g,`_`)||`attachment`}function Dl(){return Ya(t(),`uploads`,U())}async function Ol(e){let t=ca();if(!t){Sl(`skip: no oauth token`);return}let n;try{let r=`${sa()}/api/oauth/files/${encodeURIComponent(e.file_uuid)}/content`,i=await s.get(r,{headers:{Authorization:`Bearer ${t}`},responseType:`arraybuffer`,timeout:xl,validateStatus:()=>!0});if(i.status!==200){Sl(`fetch ${e.file_uuid} failed: status=${i.status}`);return}n=Buffer.from(i.data)}catch(t){Sl(`fetch ${e.file_uuid} threw: ${t}`);return}let r=El(e.file_name),i=(e.file_uuid.slice(0,8)||Y().slice(0,8)).replace(/[^a-zA-Z0-9_-]/g,`_`),a=Dl(),o=Ya(a,`${i}-${r}`);try{await Za(a,{recursive:!0}),await eo(o,n)}catch(e){Sl(`write ${o} failed: ${e}`);return}return Sl(`resolved ${e.file_uuid} → ${o} (${n.length} bytes)`),o}async function kl(e){if(e.length===0)return``;Sl(`resolving ${e.length} attachment(s)`);let t=(await Promise.all(e.map(Ol))).filter(e=>e!==void 0);return t.length===0?``:`${t.map(e=>`@"${e}"`).join(` `)} `}function Al(e,t){if(!t)return e;if(typeof e==`string`)return t+e;let n=e.findLastIndex(e=>e.type===`text`);if(n!==-1){let r=e[n];if(r.type===`text`)return[...e.slice(0,n),{...r,text:t+r.text},...e.slice(n+1)]}return[...e,{type:`text`,text:t.trimEnd()}]}async function jl(e,t){let n=Tl(e);return n.length===0?t:Al(t,await kl(n))}vi(),xe(),On(),Zt(),Ct(),lt(),pa(),Fa();function Ml(e){if(e.toLowerCase().endsWith(`.jsonl`))return{sessionId:Y(),ingressUrl:null,isUrl:!1,jsonlFile:e,isJsonlFile:!0};if(tt(e))return{sessionId:e,ingressUrl:null,isUrl:!1,jsonlFile:null,isJsonlFile:!1};try{let t=new URL(e);return{sessionId:Y(),ingressUrl:t.href,isUrl:!0,jsonlFile:null,isJsonlFile:!1}}catch{}return null}Ci(),me(),de(),b(),Kt(),Be(),Un(),dt(),At(),Tn(),_e(),ua(),Ra(),za(),Ar(),Pr();async function Nl(){try{let e=await Qa(xt(),`utf-8`),t=Br().safeParse(Er(e));return t.success?t.data:(G(`Invalid known_marketplaces.json in zip cache: ${t.error.message}`,{level:`error`}),{})}catch{return{}}}async function Pl(e){await En(xt(),Cr(e,null,2))}async function Fl(e,t){let n=Pn();if(!n)return;let r=await Il(t);r!==null&&await En(Ya(n,$t(e)),r)}async function Il(e){let t=[Ya(e,`.claude-plugin`,`marketplace.json`),Ya(e,`marketplace.json`),e];for(let e of t)try{return await Qa(e,`utf-8`)}catch{}return null}async function Ll(){let e=await Fe();for(let[t,n]of Object.entries(e))if(n.installLocation)try{await Fl(t,n.installLocation)}catch(e){G(`Failed to save marketplace JSON for ${t}: ${e}`)}await Pl({...await Nl(),...e})}si(),Mr(),Ar(),Qr(),ri(),le(),an();async function Rl(){let e=It();G(`installPluginsForHeadless: starting${e?` (zip cache mode)`:``}`);let t=await qe();t&&(qt(),Wt(`headlessPluginInstall: seed marketplaces registered`)),e&&(await Nr().mkdir(jt()),await Nr().mkdir(_n()));let n=Object.keys(w()).length,r={marketplaces_installed:0,delisted_count:0},i=t;try{if(n===0)G(`installPluginsForHeadless: no marketplaces declared`);else{let t=await Zr(`headless_marketplace_reconcile`,()=>Wa({skip:e?(e,t)=>!Vt(t):void 0,onProgress:e=>{e.type===`installed`?G(`installPluginsForHeadless: installed marketplace ${e.name}`):e.type===`failed`&&G(`installPluginsForHeadless: failed to install marketplace ${e.name}: ${e.error}`)}}),e=>({installed_count:e.installed.length,updated_count:e.updated.length,failed_count:e.failed.length,skipped_count:e.skipped.length}));t.skipped.length>0&&G(`installPluginsForHeadless: skipped ${t.skipped.length} marketplace(s) unsupported by zip cache: ${t.skipped.join(`, `)}`);let n=t.installed.length+t.updated.length;n>0&&(qt(),Wt(`headlessPluginInstall: marketplaces reconciled`),i=!0),r.marketplaces_installed=n}e&&await Ll();let t=await Da();return r.delisted_count=t.length,t.length>0&&(i=!0),i&&Wt(`headlessPluginInstall: plugins changed`),e&&jr(vt),i}catch(e){return q(e),!1}finally{J(`tengu_headless_plugin_install`,r)}}si(),Ar(),Qr(),rn(),Zi(),ri(),Xr(),A(),l(),Mr(),xr(),We(),hr(),pt(),Bt(),C(),Pr(),r(),Ka(),_t(),he(),S(),u(),Tr();var zl=1e4,Bl=new Set,Vl=[];function Hl(e){if(Bl.has(e))return!1;if(Bl.add(e),Vl.push(e),Vl.length>zl){let e=Vl.splice(0,Vl.length-zl);for(let t of e)Bl.delete(t)}return!0}function Ul(e){return typeof e==`string`?[{type:`text`,text:e}]:e}function Wl(e){return e.length===1?e[0]:e.every(e=>typeof e==`string`)?e.join(`
|
|
5
|
-
`):e.flatMap(Ul)}function Gl(e,t){return t!==void 0&&t.mode===`prompt`&&t.workload===e.workload&&t.isMeta===e.isMeta}async function Kl(e,t,r,i,a,o,s,c){if(mn.subscribe(e=>{Tt(e,r),Di()&&r(e=>{let t=e.settings,n=t.fastMode===!0&&!t.fastModePerSessionOptIn;return{...e,fastMode:n}})}),!na()&&n(process.env.CLAUDE_CODE_PROACTIVE)&&Qi(`command`),typeof Bun<`u`&&setInterval(()=>{process.memoryUsage.rss()>350*1024*1024?Bun.gc(!0):Bun.gc(!1)},1e3).unref(),bt(),Mn(`runHeadless_entry`),await Sa()&&await Ca(),Mn(`after_grove_check`),c.resumeSessionAt&&!c.resume){process.stderr.write(`Error: --resume-session-at requires --resume
|
|
6
|
-
`),E(1);return}if(c.rewindFiles&&!c.resume){process.stderr.write(`Error: --rewind-files requires --resume
|
|
7
|
-
`),E(1);return}if(c.rewindFiles&&e){process.stderr.write(`Error: --rewind-files is a standalone operation and cannot be used with a prompt
|
|
8
|
-
`),E(1);return}let l=nu(e,c);c.outputFormat===`stream-json`&&gl();let u=ot.getSandboxUnavailableReason();if(u){if(ot.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${u}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),E(1);return}process.stderr.write(`\n⚠ Sandbox disabled: ${u}\n Commands will run WITHOUT sandboxing. Network and filesystem restrictions will NOT be enforced.\n\n`)}else if(ot.isSandboxingEnabled())try{await ot.initialize(l.createSandboxAskCallback())}catch(e){process.stderr.write(`\n❌ Sandbox Error: ${W(e)}\n`),E(1,`other`);return}c.outputFormat===`stream-json`&&c.verbose&&Ae(e=>{let t=(()=>{switch(e.type){case`started`:return{type:`system`,subtype:`hook_started`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,uuid:Y(),session_id:U()};case`progress`:return{type:`system`,subtype:`hook_progress`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,stdout:e.stdout,stderr:e.stderr,output:e.output,uuid:Y(),session_id:U()};case`response`:return{type:`system`,subtype:`hook_response`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,output:e.output,stdout:e.stdout,stderr:e.stderr,exit_code:e.exitCode,outcome:e.outcome,uuid:Y(),session_id:U()}}})();l.write(t)}),c.setupTrigger&&await Mt(c.setupTrigger),Mn(`before_loadInitialMessages`);let d=t(),{messages:f,turnInterruptionState:p,agentSetting:m}=await tu(r,{continue:c.continue,teleport:c.teleport,resume:c.resume,resumeSessionAt:c.resumeSessionAt,forkSession:c.forkSession,outputFormat:c.outputFormat,sessionStartHooksPromise:c.sessionStartHooksPromise,restoredWorkerState:l.restoredWorkerState}),h=rt();if(h&&l.prependUserMessage(h),!c.agent&&!gr()&&m){let{agentDefinition:e}=Va(m,void 0,{activeAgents:s,allAgents:s});if(e){if(r(t=>({...t,agent:e.agentType})),!c.systemPrompt&&!wn(e)){let t=e.getSystemPrompt();t&&(c.systemPrompt=t)}Ut(e.agentType)}}if(f.length===0&&process.exitCode!==void 0)return;if(c.rewindFiles){if(f.find(e=>e.uuid===c.rewindFiles)?.type!==`user`){process.stderr.write(`Error: --rewind-files requires a user message UUID, but ${c.rewindFiles} is not a user message in this session\n`),E(1);return}let e=t(),n=await Zl(c.rewindFiles,e,r,!1);if(!n.canRewind){process.stderr.write(`Error: ${n.error||`Unexpected error`}\n`),E(1);return}process.stdout.write(`Files rewound to state at message ${c.rewindFiles}\n`),E(0);return}let g=typeof c.resume==`string`&&(!!tt(c.resume)||c.resume.endsWith(`.jsonl`)),ee=!!c.sdkUrl;if(!e&&!g&&!ee){process.stderr.write(`Error: Input must be provided either through stdin or as a prompt argument when using --print
|
|
9
|
-
`),E(1);return}if(c.outputFormat===`stream-json`&&!c.verbose){process.stderr.write(`Error: When using --print, --output-format=stream-json requires --verbose
|
|
10
|
-
`),E(1);return}let _=k(d.mcp.tools,d.toolPermissionContext),te=[...a,..._],ne=Yl(c.sdkUrl?`stdio`:c.permissionPromptToolName,l,()=>t().mcp.tools,e=>{r(e=>({...e,attribution:{...e.attribution,permissionPromptCount:e.attribution.permissionPromptCount+1}})),$i(`requires_action`,e)});c.permissionPromptToolName&&(te=te.filter(e=>!Li(e,c.permissionPromptToolName))),Yr(),Mn(`after_loadInitialMessages`),await fi(),Mn(`after_modelStrings`);let re=c.outputFormat===`json`&&c.verbose,v=[],y;Mn(`before_runHeadlessStreaming`);for await(let e of ql(l,d.mcp.clients,[...i,...d.mcp.commands],te,f,ne,o,t,r,s,c,p))c.outputFormat===`stream-json`&&c.verbose&&await l.write(e),e.type!==`control_response`&&e.type!==`control_request`&&e.type!==`control_cancel_request`&&!(e.type===`system`&&(e.subtype===`session_state_changed`||e.subtype===`task_notification`||e.subtype===`task_started`||e.subtype===`task_progress`||e.subtype===`post_turn_summary`))&&e.type!==`stream_event`&&e.type!==`keep_alive`&&e.type!==`streamlined_text`&&e.type!==`streamlined_tool_use_summary`&&e.type!==`prompt_suggestion`&&(re&&v.push(e),y=e);switch(c.outputFormat){case`json`:if(y?.type!==`result`)throw Error(`No messages returned`);if(c.verbose){K(`${Cr(v)}\n`);break}K(`${Cr(y)}\n`);break;case`stream-json`:break;default:if(y?.type!==`result`)throw Error(`No messages returned`);switch(y.subtype){case`success`:K(y.result.endsWith(`
|
|
11
|
-
`)?y.result:`${y.result}\n`);break;case`error_during_execution`:K(`Execution error`);break;case`error_max_turns`:K(`Error: Reached max turns (${c.maxTurns}).\nTip: Increase the limit with --max-turns or continue in a new session.`);break;case`error_max_budget_usd`:K(`Error: Exceeded USD budget ($${c.maxBudgetUsd}).\nTip: Increase the limit with --max-budget-usd or start a new session to continue.`);break;case`error_max_structured_output_retries`:K(`Error: Failed to provide valid structured output after maximum retries.
|
|
12
|
-
Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(gn(),qr())try{let{drainPendingExtraction:e}=await import(`./extractMemories-WmPLOLUT.js`);await e()}catch{}E(y?.type===`result`&&y?.is_error?1:0)}function ql(t,r,a,o,s,c,l,u,d,f,m,h){let g=!1,_,ne=!1,re=null,v,b=t.outbound;process.on(`SIGINT`,()=>{$r(`info`,`shutdown_signal`,{signal:`SIGINT`}),v&&!v.signal.aborted&&v.abort(),et(0)}),jr(async()=>{let e={};for(let t of oe(u()))ve(t)&&(e[t.type]=(e[t.type]??0)+1);$r(`info`,`run_state_at_shutdown`,{run_active:g,run_phase:_,worker_status:ra(),internal_events_pending:t.internalEventsPending,bg_tasks:e})}),ta(e=>{(e==="default"||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&b.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:Y(),session_id:U()})});let x={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},ie;m.enableAuthStatus&&(ie=yi.getInstance().subscribe(e=>{b.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:U()})}));let se=e=>{let t=da(e);t&&b.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:Y(),session_id:U()})};Ie.add(se);let S=s,ce=ae(s,X(),100),le=Me(100),ue=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;h&&h.kind!==`none`&&ue&&(G(`[print.ts] Auto-resuming interrupted turn (kind: ${h.kind})`),eu(S,h.message),Xe({mode:`prompt`,value:h.message.message.content,uuid:Y()}));let de=Ba().map(e=>{let t=e.value===null?`default`:e.value,n=t==="default"?wi():li(t),r=Qt(n),i=xi(e.value),a=di(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsAdaptiveThinking:!0},...i&&{supportsFastMode:!0},...a&&{supportsAutoMode:!0}}}),me=m.userSpecifiedModel;function he(e,t){let n=Nt(e,ji(t));S.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&b.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:U(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let C=[],_e=[],ye=new Set;function be(e){for(let n of e){if(n.type!==`connected`||ye.has(n.name)||n.config.type===`sdk`)continue;let e=n.name;try{n.client.setRequestHandler(Xt,async(n,r)=>{ti(e,`Elicitation request received in print mode: ${Cr(n)}`);let i=n.params.mode===`url`?`url`:`form`;J(`tengu_mcp_elicitation_shown`,{mode:i});let a=await ge(e,n.params,r.signal);if(a)return ti(e,`Elicitation resolved by hook: ${Cr(a)}`),J(`tengu_mcp_elicitation_response`,{mode:i,action:a.action}),a;let o=`url`in n.params?n.params.url:void 0,s=`requestedSchema`in n.params?n.params.requestedSchema:void 0,c=`elicitationId`in n.params?n.params.elicitationId:void 0,l=await t.handleElicitation(e,n.params.message,s,r.signal,i,o,c),u=await Ne(e,l,r.signal,i,c);return J(`tengu_mcp_elicitation_response`,{mode:i,action:u.action}),u}),n.client.setNotificationHandler(Gt,t=>{let{elicitationId:n}=t.params;ti(e,`Elicitation completion notification: ${n}`),te({message:`MCP server "${e}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),b.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:e,elicitation_id:n,uuid:Y(),session_id:U()})}),ye.add(e)}catch{}}}async function xe(){let e=new Set(Object.keys(l)),n=new Set(C.map(e=>e.name)),r=Array.from(e).some(e=>!n.has(e)),i=Array.from(n).some(t=>!e.has(t)),a=C.some(e=>e.type===`pending`),o=C.some(e=>e.type===`failed`);if(r||i||a||o){for(let t of C)e.has(t.name)||t.type===`connected`&&await t.cleanup();let r=await Oe(l,(e,n)=>t.sendMcpMessage(e,n));C=r.clients,_e=r.tools;let i=Fr([...n,...e]);d(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(Wr(t)))),..._e]}})),Ke(C)}}xe();let w={clients:[],tools:[],configs:{}},we=e=>{let t=Ve(e.toolPermissionContext,e.mcp.tools),n=Ln(ka([...o,..._e,...w.tools],t,e.toolPermissionContext.mode),`name`);m.permissionPromptToolName&&(n=n.filter(e=>!Li(e,m.permissionPromptToolName)));let r=mr();if(r&&!m.jsonSchema){let e=Pi(r);`tool`in e&&(n=[...n,e.tool])}return n},T=null,De=0;function ke(){if(!T)return;let e=Math.min(De,S.length),t=S.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);De=S.length,t.length>0&&T.writeMessages(t)}let Ae=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function je(e){let t=async()=>{let t=new Set(C.map(e=>e.name)),n=await au(e,{configs:l,clients:C,tools:_e},w,d);for(let e of Object.keys(l))delete l[e];if(Object.assign(l,n.newSdkState.configs),C=n.newSdkState.clients,_e=n.newSdkState.tools,w=n.newDynamicState,n.sdkServersChanged){let e=new Set(C.map(e=>e.name)),n=Fr([...t,...e]);d(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(Wr(t)))),..._e]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return Ae=Ae.then(t,t),Ae}function Fe(){let e=u(),t=e.mcp.clients,n=Ln([...e.mcp.tools,...w.tools],`name`),r=new Set([...t.map(e=>e.name),...C.map(e=>e.name)]);return[...t,...C,...w.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers,oauth:e.config.oauth};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?mt(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0;return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r}})}async function Le(){try{await Promise.all([Promise.resolve(),Zr(`headless_managed_settings_wait`,()=>wa())]),await Rl()&&await We()}catch(e){q(e)}}let Re=null;i()||(n(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?Re=Le():Le());let ze=_l(()=>!g),Be=a,O=f;async function He(){let{agentDefinitions:e}=await Ga(d);Be=await Ce(X());let t=O.filter(e=>e.source===`flagSettings`);O=[...e.allAgents,...t]}async function We(){let{servers:e}=await Yt(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(l))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await je(t);r&&xe(),G(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Ge=Ua.subscribe(()=>{y(),Ce(X()).then(e=>{Be=e})}),qe=()=>{setTimeout(()=>{!na()||Ji()||ne||(async()=>{let e=await qn({basePrompt:`<${ei}>${new Date().toLocaleTimeString()}</${ei}>`,currentDir:X(),shouldCreate:()=>!ne});if(ne){await at({commands:e});return}for(let t of e)Xe({...t,uuid:Y()});Je()})().catch(e=>{q(e),G(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};en(()=>{v&&jn(`now`).length>0&&v.abort(`interrupt`)});let Je=async()=>{if(g)return;if(g=!0,_=void 0,$i(`running`),ze.stop(),Mn(`run_entry`),await xe(),Mn(`after_updateSdkMcp`),Re){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=Ai(e).then(()=>`timeout`);await Promise.race([Re,t])===`timeout`&&(q(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),J(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await Re;Re=null,await He();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-C4zrlV0u.js`);t()}let n=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=pe(n);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Gl(r,pn(n));)i.push(pe(n));let a=await Rn(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Wl(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(m.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&b.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:U(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=u(),l=[...s.mcp.clients,...C,...w.clients];be(l);let f=we(s);for(let e of o)zt(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,u=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,d=u.match(/<total_tokens>(\d+)<\/total_tokens>/),f=u.match(/<tool_uses>(\d+)<\/tool_uses>/),p=u.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&b.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:d&&f?{total_tokens:parseInt(d[1],10),tool_uses:parseInt(f[1],10),duration_ms:p?parseInt(p[1],10):0}:void 0,session_id:U(),uuid:Y()})}let p=r.value,h=a.claimedCommands;if(t instanceof dl&&r.mode===`prompt`&&J(`tengu_bridge_message_received`,{is_repl:!1}),x.abortController?.abort(),x.abortController=null,x.pendingSuggestion=null,x.pendingLastEmittedEntry=null,x.lastEmitted&&r.mode===`prompt`){let e=typeof p==`string`?p:p.find(e=>e.type===`text`)?.text;typeof e==`string`&&Dn(x.lastEmitted.text,e,x.lastEmitted.emittedAt,x.lastEmitted.promptId,x.lastEmitted.generationRequestId),x.lastEmitted=null}v=tr(),Mn(`before_ask`),ee();let g=r,_=!1;try{if(await Ei(g.workload??m.workload,async()=>{for await(let e of Ma({commands:Ln([...Be,...s.mcp.commands],`name`),prompt:p,promptUuid:g.uuid,isMeta:g.isMeta,cwd:X(),tools:f,verbose:m.verbose,mcpClients:l,thinkingConfig:m.thinkingConfig,maxTurns:m.maxTurns,maxBudgetUsd:m.maxBudgetUsd,taskBudget:m.taskBudget,canUseTool:c,userSpecifiedModel:me,fallbackModel:m.fallbackModel,jsonSchema:mr()??m.jsonSchema,mutableMessages:S,getReadFileCache:()=>le.size===0?ce:St(ce,le),setReadFileCache:e=>{ce=e;for(let[e,t]of le.entries()){let n=ce.get(e);(!n||t.timestamp>n.timestamp)&&ce.set(e,t)}le.clear()},customSystemPrompt:m.systemPrompt,appendSystemPrompt:m.appendSystemPrompt,getAppState:u,setAppState:d,abortController:v,replayUserMessages:m.replayUserMessages,includePartialMessages:m.includePartialMessages,handleElicitation:(e,n,r)=>t.handleElicitation(e,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:O,orphanedPermission:g.orphanedPermission,setSDKStatus:e=>{b.enqueue({type:`system`,subtype:`status`,status:e,session_id:U(),uuid:Y()})}}))if(ke(),e.type===`result`){_=!!e.is_error;for(let e of Ui())b.enqueue(e);oe(u()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&ve(e))?re=e:(re=null,b.enqueue(e))}else{for(let e of Ui())b.enqueue(e);b.enqueue(e)}}),_)await Qn({commands:h,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:X(),priority:`later`,workload:g.workload??m.workload});else{let e=await Qn({commands:h,outcome:{type:`completed`},currentDir:X(),priority:`later`,workload:g.workload??m.workload});for(let t of e)Xe({...t,uuid:Y()})}}catch(e){throw await Qn({commands:h,outcome:{type:`failed`,error:e},currentDir:X(),priority:`later`,workload:g.workload??m.workload}),e}for(let e of o)zt(e,`completed`);if(ke(),T?.sendResult(),m.promptSuggestions&&!e(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){x.abortController?.abort();let e=new AbortController;x.abortController=e;let t=gt();if(!t)on(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await Ht(e,S,u,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:Y(),session_id:U()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};re?(x.pendingSuggestion=r,x.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(x.lastEmitted=i,b.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){on(`aborted`,void 0,void 0,`sdk`);return}q(Dr(e))}finally{x.inflightPromise===n.promise&&(x.inflightPromise=null)}})(),x.inflightPromise=n.promise}}gn(),Pe(),bt()}};do{for(let e of Ui())b.enqueue(e);_=`draining_commands`,await a(),i=!1;{let e=oe(u()).some(e=>ve(e)),t=pn(n)!==void 0;(e||t)&&(i=!0,t||(_=`waiting_for_agents`,await Ai(100)))}}while(i);re&&(b.enqueue(re),re=null,x.pendingSuggestion&&(b.enqueue(x.pendingSuggestion),x.pendingLastEmittedEntry&&(x.lastEmitted={...x.pendingLastEmittedEntry,emittedAt:Date.now()},x.pendingLastEmittedEntry=null),x.pendingSuggestion=null))}catch(e){try{await t.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:U(),total_cost_usd:0,usage:Yi,modelUsage:{},permission_denials:[],uuid:Y(),errors:[W(e),...ni().map(e=>e.error)]})}catch{}x.abortController?.abort(),E(1);return}finally{if(_=`finally_flush`,await t.flushInternalEvents(),_=`finally_post_flush`,!wt()){$i(`idle`);for(let e of Ui())b.enqueue(e)}g=!1,ze.start()}if(na()&&!Ji()&&pn(n)===void 0&&!ne){qe();return}if(pn(n)!==void 0){Je();return}ne&&(x.inflightPromise&&await Promise.race([x.inflightPromise,Ai(5e3)]),x.abortController?.abort(),x.abortController=null,await Jt(),Ge(),ie?.(),Ie.delete(se),b.done())},k=(e,t)=>{b.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},A=(e,t)=>{b.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},tt=new Set;t.setUnexpectedResponseCallback(async e=>{await ru({message:e,setAppState:d,handledToolUseIds:tt,onEnqueued:()=>{Je()}})});let nt=new Map,rt=new Map,it=new Set,ot=new Map,st=null;return(async()=>{let e=!1;$r(`info`,`cli_message_loop_started`);for await(let n of t.structuredInput){let i=`uuid`in n?n.uuid:void 0;if(i&&n.type!==`user`&&n.type!==`control_response`&&zt(i,`completed`),n.type===`control_request`){let i=n,o=i.request;if(i.request.subtype===`interrupt`)d(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),v&&v.abort(),x.abortController?.abort(),x.abortController=null,x.lastEmitted=null,x.pendingSuggestion=null,k(i);else if(o.subtype===`end_session`){G(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),v&&v.abort(),x.abortController?.abort(),x.abortController=null,x.lastEmitted=null,x.pendingSuggestion=null,k(i);break}else if(i.request.subtype===`initialize`){if(i.request.sdkMcpServers&&i.request.sdkMcpServers.length>0)for(let e of i.request.sdkMcpServers)l[e]={type:`sdk`,name:e};await Xl(i.request,i.request_id,e,b,a,de,t,!!m.enableAuthStatus,m,f,u),i.request.promptSuggestions&&d(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),i.request.agentProgressSummaries&&yr(!0),e=!0,un()&&Je()}else if(i.request.subtype===`set_permission_mode`){let e=i.request;d(t=>({...t,toolPermissionContext:Ql(e,i.request_id,t.toolPermissionContext,b)}))}else if(i.request.subtype===`set_model`){let e=i.request.model??`default`,t=e==="default"?wi():e;me=t,fr(t),Wi({model:t}),he(e,t),k(i)}else if(i.request.subtype===`set_max_thinking_tokens`)i.request.max_thinking_tokens===null?m.thinkingConfig=void 0:i.request.max_thinking_tokens===0?m.thinkingConfig={type:`disabled`}:m.thinkingConfig={type:`enabled`,budgetTokens:i.request.max_thinking_tokens},k(i);else if(i.request.subtype===`mcp_status`)k(i,{mcpServers:Fe()});else if(i.request.subtype===`get_context_usage`)try{let e=u(),t=await La({messages:S,getAppState:u,options:{mainLoopModel:ki(),tools:we(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:m.systemPrompt,appendSystemPrompt:m.appendSystemPrompt}});k(i,{...t})}catch(e){A(i,W(e))}else if(i.request.subtype===`mcp_message`){let e=i.request,t=C.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),k(i)}else if(i.request.subtype===`rewind_files`){let e=u(),t=await Zl(i.request.user_message_id,e,d,i.request.dry_run??!1);t.canRewind||i.request.dry_run?k(i,t):A(i,t.error??`Unexpected error`)}else if(i.request.subtype===`cancel_async_message`){let e=i.request.message_uuid,t=Qe(t=>t.uuid===e);k(i,{cancelled:t.length>0})}else if(i.request.subtype===`seed_read_state`){try{let e=Gr(i.request.path),t=Math.floor((await $a(e)).mtimeMs);if(t<=i.request.mtime){let n=await Qa(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
|
|
13
|
-
`,`
|
|
14
|
-
`);le.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}k(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await je(i.request.servers);k(i,e),t&&xe()}else if(i.request.subtype===`reload_plugins`)try{let e=await Ga(d),t=O.filter(e=>e.source===`flagSettings`);O=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([Ce(X()),We(),Nn()]);r.status===`fulfilled`?Be=r.value:q(r.reason),a.status===`rejected`&&q(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):q(o.reason),k(i,{commands:Be.filter(e=>e.userInvocable!==!1).map(e=>({name:nr(e),description:p(e),argumentHint:e.argumentHint||``})),agents:O.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:Fe(),error_count:e.error_count})}catch(e){A(i,W(e))}else if(i.request.subtype===`mcp_reconnect`){let e=u(),{serverName:t}=i.request;ye.delete(t);let n=Te(t)??r.find(e=>e.name===t)?.config??C.find(e=>e.name===t)?.config??w.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)A(i,`Server not found: ${t}`);else{let e=await Ee(t,n),r=Wr(t);if(d(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...D(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...D(n.mcp.commands,e=>Fn(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:ia(n.mcp.resources,t)}})),w={...w,clients:[...w.clients.filter(e=>e.name!==t),e.client],tools:[...w.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`)be([e.client]),k(i);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;A(i,t)}}}else if(i.request.subtype===`mcp_toggle`){let e=u(),{serverName:t,enabled:n}=i.request;ye.delete(t);let a=Te(t)??r.find(e=>e.name===t)?.config??C.find(e=>e.name===t)?.config??w.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)A(i,`Server not found: ${t}`);else if(n){Ye(t,!0);let e=await Ee(t,a),n=Wr(t);if(d(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...D(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...D(r.mcp.commands,e=>Fn(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:ia(r.mcp.resources,t)}})),e.client.type===`connected`)be([e.client]),k(i);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;A(i,t)}}else{Ye(t,!1);let n=[...r,...C,...w.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await Vn(t,a);let o=Wr(t);d(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:D(e.mcp.tools,e=>e.name?.startsWith(o)),commands:D(e.mcp.commands,e=>Fn(e,t)),resources:ia(e.mcp.resources,t)}})),k(i)}}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=u(),n=Te(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)A(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)A(i,`Server type "${n.type}" does not support OAuth authentication`);else try{nt.get(e)?.abort();let t=new AbortController;nt.set(e,t);let r,a=new Promise(e=>{r=e}),o=Ze(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{rt.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?k(i,{authUrl:s,requiresUserAction:!0}):k(i,{requiresUserAction:!1}),ot.set(e,o),o.then(async()=>{if(Se(e)||it.has(e))return;let t=await Ee(e,n),r=Wr(e);d(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...D(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...D(n.mcp.commands,t=>Fn(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:ia(n.mcp.resources,e)}})),w={...w,clients:[...w.clients.filter(t=>t.name!==e),t.client],tools:[...w.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{G(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{nt.get(e)===t&&(nt.delete(e),rt.delete(e),it.delete(e),ot.delete(e))})}catch(e){A(i,W(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=rt.get(e);if(n){let r=!1;try{let e=new URL(t);r=e.searchParams.has(`code`)||e.searchParams.has(`error`)}catch{}if(!r)A(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{it.add(e),n(t);let r=ot.get(e);if(r)try{await r,k(i)}catch(e){A(i,e instanceof Error?e.message:`OAuth authentication failed`)}else k(i)}}else A(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;st?.service.cleanup(),J(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new Ta,n,r=new Promise(e=>{n=e}),a=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await Ea(t),J(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),st?.service===t&&(st=null)});st={service:t,flow:a},a.catch(e=>G(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,a.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);k(i,{manualUrl:e,automaticUrl:t})}catch(e){A(i,W(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!st)A(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&st.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=st;e.then(()=>{let e=_i();k(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:bi()}})},e=>A(i,W(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=u(),n=Te(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)A(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)A(i,`Cannot clear auth for server type "${n.type}"`);else{await $e(e,n);let t=await Ee(e,n),r=Wr(e);d(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...D(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...D(n.mcp.commands,t=>Fn(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:ia(n.mcp.resources,e)}})),k(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=ki(),t=dr()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];_r(r),mn.notifyChange(`flagSettings`),`model`in n&&(n.model==null?fr(void 0):fr(String(n.model)));let a=ki();if(a!==e){me=a;let e=n.model?String(n.model):`default`;Wi({model:a}),he(e,a)}k(i)}else if(i.request.subtype===`get_settings`){let e=ki();k(i,{...zr(),applied:{model:e}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await Et(e,{getAppState:u,setAppState:d}),k(i,{})}catch(e){A(i,W(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(v&&!v.signal.aborted?v:tr()).signal;(async()=>{try{let r=await fa(e,n);if(r&&t)try{ct(U(),r)}catch(e){q(e)}k(i,{title:r})}catch(e){A(i,W(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=gt(),n=t?{...t,toolUseContext:{...t.toolUseContext,abortController:tr()}}:await Na({tools:we(u()),commands:Be,mcpClients:[...u().mcp.clients,...C,...w.clients],messages:S,readFileState:ce,getAppState:u,setAppState:d,customSystemPrompt:m.systemPrompt,appendSystemPrompt:m.appendSystemPrompt,thinkingConfig:m.thinkingConfig,agents:O}),r=await Ia({question:e,cacheSafeParams:n});k(i,{response:r.response})}catch(e){A(i,W(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?na()||(Qi(`command`),qe()):ea(),k(i);else if(o.subtype===`remote_control`)if(o.enabled)if(T)k(i,{session_url:yt(T.bridgeSessionId,T.sessionIngressUrl),connect_url:Pa(T.environmentId,T.sessionIngressUrl),environment_id:T.environmentId});else{let e;try{let{initReplBridge:n}=await import(`./initReplBridge-BYrL6ou1.js`),r=await n({onInboundMessage(e){let t=vl(e);if(!t)return;let{content:n,uuid:r}=t;Xe({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),Je()},onPermissionResponse(e){t.injectControlResponse(e)},onInterrupt(){v?.abort()},onSetModel(e){let t=e==="default"?wi():e;me=t,fr(t)},onSetMaxThinkingTokens(e){e===null?m.thinkingConfig=void 0:e===0?m.thinkingConfig={type:`disabled`}:m.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(t,n){t===`failed`&&(e=n),G(`[bridge:sdk] State change: ${t}${n?` — ${n}`:``}`),b.enqueue({type:`system`,subtype:`bridge_state`,state:t,detail:n,uuid:Y(),session_id:U()})},initialMessages:S.length>0?S:void 0});r?(T=r,De=S.length,t.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),t.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),k(i,{session_url:yt(r.bridgeSessionId,r.sessionIngressUrl),connect_url:Pa(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):A(i,e??`Remote Control initialization failed`)}catch(e){A(i,W(e))}}else T&&(t.setOnControlRequestSent(void 0),t.setOnControlRequestResolved(void 0),await T.teardown(),T=null),k(i);else A(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){m.replayUserMessages&&b.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=la([n]);S.push(...e),n.type===`assistant`&&m.replayUserMessages&&b.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(e=!0,o.uuid){let e=U(),t=await fe(e,o.uuid);if(t||Bl.has(o.uuid)){G(`Skipping duplicate user message: ${o.uuid}`),m.replayUserMessages&&(G(`Sending acknowledgment for duplicate user message: ${o.uuid}`),b.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&zt(o.uuid,`completed`);continue}Hl(o.uuid)}Xe({mode:`prompt`,value:await jl(o,o.message.content),uuid:o.uuid,priority:o.priority}),d(e=>({...e,attribution:Hn(e.attribution,e=>{Ue(e).catch(e=>{G(`Attribution: Failed to save snapshot: ${e}`)})})})),Je()}ne=!0,g||(x.inflightPromise&&await Promise.race([x.inflightPromise,Ai(5e3)]),x.abortController?.abort(),x.abortController=null,await Jt(),Ge(),ie?.(),Ie.delete(se),b.done())})(),b}function Jl(e){let t=async(n,r,i,a,o,s)=>{let c=s??await h(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=$n(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,g=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!g.content||!Array.isArray(g.content)||!g.content[0]||g.content[0].type!==`text`||typeof g.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return $c(Qc().parse(oi(g.content[0].text)),e,r,i)};return t}function Yl(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await h(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>Li(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),E(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),E(1),Error(t)}i=Jl(r)}return i(t,r,a,o,s,c)}}async function Xl(e,t,n,r,i,a,o,s,c,l,u){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(c.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(c.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(c.promptSuggestions=e.promptSuggestions),e.agents){let t=Dt(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=gr()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(pr(t.agentType),!c.systemPrompt&&!wn(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&fr(li(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let d=Vr()?.outputStyle||`default`,f=await An(Sr()),m=_i();if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});lr(t)}e.jsonSchema&&br(e.jsonSchema);let h={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:nr(e),description:p(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:d,available_output_styles:Object.keys(f),models:a,account:{email:m?.email,organization:m?.organization,subscriptionType:m?.subscription,tokenSource:m?.tokenSource,apiKeySource:m?.apiKeySource,apiProvider:bi()},pid:process.pid};if(Di()&&Oi()){let e=u();h.fast_mode_state=pi(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:h}}),s){let e=yi.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:U()})}}async function Zl(e,t,n,r){if(!nn())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!hn(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await Rt(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await Zn(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${W(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Ql(e,t,n,r){if(e.mode===`bypassPermissions`){if(Bn())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!ne()){let e=Xn();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${In(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...f(n.mode,e.mode,n),mode:e.mode}}function $l(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:U(),total_cost_usd:0,usage:Yi,modelUsage:{},permission_denials:[],uuid:Y(),errors:[e]};process.stdout.write(`${Cr(t)}\n`)}else process.stderr.write(`${e}\n`)}function eu(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function tu(e,t){let r=!ur();if(t.continue)try{J(`tengu_continue_print`,{});let n=await O(void 0,void 0);if(n)return t.forkSession||n.sessionId&&(vr(ce(n.sessionId),n.fullPath?Ja(n.fullPath):null),r&&await kn()),Ha(n,e),sn(t.forkSession?{...n,worktreeSession:void 0}:n),{messages:n.messages,turnInterruptionState:n.turnInterruptionState,agentSetting:n.agentSetting}}catch(e){return q(e),E(1),{messages:[]}}if(t.teleport)try{if(!st(`allow_remote_sessions`))throw Error(`Remote sessions are disabled by your organization's policy.`);if(J(`tengu_teleport_print`,{}),typeof t.teleport!=`string`)throw Error(`No session ID provided for teleport`);let{checkOutTeleportedSessionBranch:e,processMessagesForTeleportResume:n,teleportResumeCodeSession:r,validateGitState:i}=await import(`./teleport-Dj2Kvbmx.js`);await i();let a=await r(t.teleport),{branchError:o}=await e(a.branch);return{messages:n(a.log,o)}}catch(e){return q(e),E(1),{messages:[]}}if(t.resume)try{J(`tengu_resume_print`,{});let i=Ml(typeof t.resume==`string`?t.resume:``);if(!i){let e=`Error: --resume requires a valid session ID when used with --print. Usage: claude -p --resume <session-id>`;return typeof t.resume==`string`&&(e+=`. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${t.resume}" is not a valid UUID`),$l(e,t.outputFormat),E(1),{messages:[]}}if(n(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,n]=await Promise.all([zn(i.sessionId),t.restoredWorkerState]);n&&(e(ja(n)),typeof n.model==`string`&&fr(n.model))}else i.isUrl&&i.ingressUrl&&n(process.env.ENABLE_SESSION_PERSISTENCE)&&await er(i.sessionId,i.ingressUrl);let a=await O(i.sessionId,i.jsonlFile||void 0);if(!a||a.messages.length===0)return i.isUrl||n(process.env.CLAUDE_CODE_USE_CCR_V2)?{messages:await(t.sessionStartHooksPromise??Lt(`startup`))}:($l(`No conversation found with session ID: ${i.sessionId}`,t.outputFormat),E(1),{messages:[]});if(t.resumeSessionAt){let e=a.messages.findIndex(e=>e.uuid===t.resumeSessionAt);if(e<0)return $l(`No message found with message.uuid of: ${t.resumeSessionAt}`,t.outputFormat),E(1),{messages:[]};a.messages=e>=0?a.messages.slice(0,e+1):[]}return!t.forkSession&&a.sessionId&&(vr(ce(a.sessionId),a.fullPath?Ja(a.fullPath):null),r&&await kn()),Ha(a,e),sn(t.forkSession?{...a,worktreeSession:void 0}:a),{messages:a.messages,turnInterruptionState:a.turnInterruptionState,agentSetting:a.agentSetting}}catch(e){return q(e),$l(e instanceof Error?`Failed to resume session: ${e.message}`:`Failed to resume session with --print mode`,t.outputFormat),E(1),{messages:[]}}return{messages:await(t.sessionStartHooksPromise??Lt(`startup`))}}function nu(e,t){let n;return n=typeof e==`string`?e.trim()===``?ke([]):ke([Cr({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})]):e,t.sdkUrl?new dl(t.sdkUrl,n,t.replayUserMessages):new sl(n,t.replayUserMessages)}async function ru({message:e,setAppState:t,onEnqueued:n,handledToolUseIds:r}){let i=e.response;if(i?.subtype===`success`&&i.response?.toolUseID&&typeof i.response.toolUseID==`string`){let e=i.response,t=e.toolUseID;if(!t)return!1;if(G(`handleOrphanedPermissionResponse: received orphaned control_response for toolUseID=${t} request_id=${i.request_id}`),r.has(t))return G(`handleOrphanedPermissionResponse: skipping duplicate orphaned permission for toolUseID=${t} (already handled)`),!1;let a=await je(t);return a?(r.add(t),G(`handleOrphanedPermissionResponse: enqueuing orphaned permission for toolUseID=${t} messageID=${a.message.id}`),Xe({mode:`orphaned-permission`,value:[],orphanedPermission:{permissionResult:e,assistantMessage:a}}),n?.(),!0):(G(`handleOrphanedPermissionResponse: no unresolved tool_use found for toolUseID=${t} (already resolved in transcript)`),!1)}return!1}function iu(e){return{...e,scope:`dynamic`}}async function au(e,t,n,r){let{allowed:i,blocked:a}=m(e),o={};for(let e of a)o[e]=`Blocked by enterprise policy (allowedMcpServers/deniedMcpServers)`;let s={},c={};for(let[e,t]of Object.entries(i))t.type===`sdk`?s[e]=t:c[e]=t;let l=new Set(Object.keys(t.configs)),u=new Set(Object.keys(s)),d=[],f=[],p={...t.configs},h=[...t.clients],g=[...t.tools];for(let e of l)if(!u.has(e)){let t=h.find(t=>t.name===e);t&&t.type===`connected`&&await t.cleanup(),h=h.filter(t=>t.name!==e);let n=`mcp__${e}__`;g=g.filter(e=>!e.name.startsWith(n)),delete p[e],f.push(e)}for(let[e,t]of Object.entries(s))if(!l.has(e)){p[e]=t;let n={type:`pending`,name:e,config:{...t,scope:`dynamic`}};h=[...h,n],d.push(e)}let ee=await ou(c,n,r);return{response:{added:[...d,...ee.response.added],removed:[...f,...ee.response.removed],errors:{...o,...ee.response.errors}},newSdkState:{configs:p,clients:h,tools:g},newDynamicState:ee.newState,sdkServersChanged:d.length>0||f.length>0}}async function ou(e,t,n){let r=new Set(Object.keys(t.configs)),i=new Set(Object.keys(e)),a=[...r].filter(e=>!i.has(e)),o=[...i].filter(e=>!r.has(e)),s=[...r].filter(e=>i.has(e)).filter(n=>{let r=t.configs[n],i=e[n];return!r||!i||!Le(r,iu(i))}),c=[],l=[],u={},d=[...t.clients],f=[...t.tools];for(let e of[...a,...s]){let n=d.find(t=>t.name===e),r=t.configs[e];if(n&&r){if(n.type===`connected`)try{await n.cleanup()}catch(e){q(e)}await Vn(e,r)}let i=`mcp__${e}__`;f=f.filter(e=>!e.name.startsWith(i)),d=d.filter(t=>t.name!==e),a.includes(e)&&c.push(e)}for(let t of[...o,...s]){let n=e[t];if(!n)continue;let r=iu(n);if(n.type===`sdk`){l.push(t);continue}try{let e=await ze(t,r);if(d.push(e),e.type===`connected`){let t=await De(e);f.push(...t)}else e.type===`failed`&&(u[t]=e.error||`Connection failed`);l.push(t)}catch(e){let n=Dr(e);u[t]=n.message,q(n)}}let p={};for(let t of i){let n=e[t];n&&(p[t]=iu(n))}let m={clients:d,tools:f,configs:p};return n(e=>{let n=new Set([...Object.keys(t.configs),...Object.keys(p)]),r=e.mcp.tools.filter(e=>{for(let t of n)if(e.name.startsWith(`mcp__${t}__`))return!1;return!0}),i=e.mcp.clients.filter(e=>!n.has(e.name));return{...e,mcp:{...e.mcp,tools:[...r,...f],clients:[...i,...d]}}}),{response:{added:l,removed:c,errors:u},newState:m}}export{Kl as runHeadless};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t}from"./prompt-DnPppVz8.js";t();export{e as isDeferredTool};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{cw as e,mw as t}from"./loadAgentsDir-JrGMJN05.js";t();export{e as clearPromptCache};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t}from"./ripgrep-X5m4gJ-3.js";e();export{t as getRipgrepStatus};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aT as e,cT as t}from"./loadAgentsDir-JrGMJN05.js";t();export{e as SandboxManager};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$u as t,Qu as n,aT as r,cT as i,dT as a,hC as o,oT as s}from"./loadAgentsDir-JrGMJN05.js";import{Gt as c,H as l,I as u,Lt as d,P as f,a as p,j as m,n as h,r as g,t as _,x as v}from"./src-DL3w8VPk2.js";import{t as y}from"./jsx-runtime-Bb4Xn-E0.js";import{O as b,Wt as x}from"./state-BPFYBqm1.js";import{f as S,g as C,s as w}from"./settings-aUygByiZ.js";import{i as T,o as E}from"./platform-DVeTi9mp.js";import{relative as D}from"path";function O(){let e=r.isSandboxingEnabled(),t=r.checkDependencies(),n=t.warnings.length>0?(0,k.jsx)(u,{marginTop:1,flexDirection:`column`,children:t.warnings.map((e,t)=>(0,k.jsx)(f,{dimColor:!0,children:e},t))}):null;if(!e)return(0,k.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,k.jsx)(f,{color:`subtle`,children:`Sandbox is not enabled`}),n]});let i=r.getFsReadConfig(),o=r.getFsWriteConfig(),s=r.getNetworkRestrictionConfig(),c=r.getAllowUnixSockets(),l=r.getExcludedCommands(),d=r.getLinuxGlobPatternWarnings();return(0,k.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,k.jsxs)(u,{flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`permission`,children:`Excluded Commands:`}),(0,k.jsx)(f,{dimColor:!0,children:l.length>0?l.join(`, `):`None`})]}),i.denyOnly.length>0&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`permission`,children:`Filesystem Read Restrictions:`}),(0,k.jsxs)(f,{dimColor:!0,children:[`Denied: `,i.denyOnly.join(`, `)]}),i.allowWithinDeny&&i.allowWithinDeny.length>0&&(0,k.jsxs)(f,{dimColor:!0,children:[`Allowed within denied: `,i.allowWithinDeny.join(`, `)]})]}),o.allowOnly.length>0&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`permission`,children:`Filesystem Write Restrictions:`}),(0,k.jsxs)(f,{dimColor:!0,children:[`Allowed: `,o.allowOnly.join(`, `)]}),o.denyWithinAllow.length>0&&(0,k.jsxs)(f,{dimColor:!0,children:[`Denied within allowed: `,o.denyWithinAllow.join(`, `)]})]}),(s.allowedHosts&&s.allowedHosts.length>0||s.deniedHosts&&s.deniedHosts.length>0)&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsxs)(f,{bold:!0,color:`permission`,children:[`Network Restrictions`,a()?` (Managed)`:``,`:`]}),s.allowedHosts&&s.allowedHosts.length>0&&(0,k.jsxs)(f,{dimColor:!0,children:[`Allowed: `,s.allowedHosts.join(`, `)]}),s.deniedHosts&&s.deniedHosts.length>0&&(0,k.jsxs)(f,{dimColor:!0,children:[`Denied: `,s.deniedHosts.join(`, `)]})]}),c&&c.length>0&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`permission`,children:`Allowed Unix Sockets:`}),(0,k.jsx)(f,{dimColor:!0,children:c.join(`, `)})]}),d.length>0&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`warning`,children:`⚠ Warning: Glob patterns not fully supported on Linux`}),(0,k.jsxs)(f,{dimColor:!0,children:[`The following patterns will be ignored: `,d.slice(0,3).join(`, `),d.length>3&&` (${d.length-3} more)`]})]}),n]})}var k,A=e((()=>{_(),i(),k=y()}));function j({depCheck:e}){let t=T()===`macos`,n=e.errors.some(e=>e.includes(`ripgrep`)),r=e.errors.some(e=>e.includes(`bwrap`)),i=e.errors.some(e=>e.includes(`socat`)),a=e.warnings.length>0,o=e.errors.filter(e=>!e.includes(`ripgrep`)&&!e.includes(`bwrap`)&&!e.includes(`socat`));return(0,M.jsxs)(u,{flexDirection:`column`,paddingY:1,gap:1,children:[t&&(0,M.jsx)(u,{flexDirection:`column`,children:(0,M.jsxs)(f,{children:[`seatbelt: `,(0,M.jsx)(f,{color:`success`,children:`built-in (macOS)`})]})}),(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{children:[`ripgrep (rg): `,n?(0,M.jsx)(f,{color:`error`,children:`not found`}):(0,M.jsx)(f,{color:`success`,children:`found`})]}),n&&(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· `,t?`brew install ripgrep`:`apt install ripgrep`]})]}),!t&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{children:[`bubblewrap (bwrap):`,` `,r?(0,M.jsx)(f,{color:`error`,children:`not installed`}):(0,M.jsx)(f,{color:`success`,children:`installed`})]}),r&&(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· apt install bubblewrap`]})]}),(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{children:[`socat: `,i?(0,M.jsx)(f,{color:`error`,children:`not installed`}):(0,M.jsx)(f,{color:`success`,children:`installed`})]}),i&&(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· apt install socat`]})]}),(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{children:[`seccomp filter:`,` `,a?(0,M.jsx)(f,{color:`warning`,children:`not installed`}):(0,M.jsx)(f,{color:`success`,children:`installed`}),a&&(0,M.jsx)(f,{dimColor:!0,children:` (required to block unix domain sockets)`})]}),a&&(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· npm install -g @anthropic-ai/sandbox-runtime`]}),(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· or copy vendor/seccomp/* from sandbox-runtime and set`]}),(0,M.jsxs)(f,{dimColor:!0,children:[` `,`sandbox.seccomp.bpfPath and applyPath in settings.json`]})]})]})]}),o.map(e=>(0,M.jsx)(f,{color:`error`,children:e},e))]})}var M,N=e((()=>{_(),E(),M=y()}));function P({onComplete:e}){let t=r.isSandboxingEnabled(),n=r.areSandboxSettingsLockedByPolicy(),i=r.areUnsandboxedCommandsAllowed();return t?n?(0,I.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,I.jsx)(f,{color:`subtle`,children:`Override settings are managed by a higher-priority configuration and cannot be changed locally.`}),(0,I.jsx)(u,{marginTop:1,children:(0,I.jsxs)(f,{dimColor:!0,children:[`Current setting: `,i?`Allow unsandboxed fallback`:`Strict sandbox mode`]})})]}):(0,I.jsx)(F,{onComplete:e,currentMode:i?`open`:`closed`}):(0,I.jsx)(u,{flexDirection:`column`,paddingY:1,children:(0,I.jsx)(f,{color:`subtle`,children:`Sandbox is not enabled. Enable sandbox to configure override settings.`})})}function F({onComplete:e,currentMode:t}){let[i]=l(),{headerFocused:a,focusHeader:o}=p(),s=m(`success`,i)(`(current)`),c=[{label:t===`open`?`Allow unsandboxed fallback ${s}`:`Allow unsandboxed fallback`,value:`open`},{label:t===`closed`?`Strict sandbox mode ${s}`:`Strict sandbox mode`,value:`closed`}];async function h(t){let n=t;await r.setSandboxSettings({allowUnsandboxedCommands:n===`open`}),e(n===`open`?`✓ Unsandboxed fallback allowed - commands can run outside sandbox when necessary`:"✓ Strict sandbox mode - all commands must run in sandbox or be excluded via the `excludedCommands` option")}return(0,I.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,I.jsx)(u,{marginBottom:1,children:(0,I.jsx)(f,{bold:!0,children:`Configure Overrides:`})}),(0,I.jsx)(n,{options:c,onChange:h,onCancel:()=>e(void 0,{display:`skip`}),onUpFromFirstItem:o,isDisabled:a}),(0,I.jsxs)(u,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,I.jsxs)(f,{dimColor:!0,children:[(0,I.jsx)(f,{bold:!0,dimColor:!0,children:`Allow unsandboxed fallback:`}),` `,`When a command fails due to sandbox restrictions, Claude can retry with dangerouslyDisableSandbox to run outside the sandbox (falling back to default permissions).`]}),(0,I.jsxs)(f,{dimColor:!0,children:[(0,I.jsx)(f,{bold:!0,dimColor:!0,children:`Strict sandbox mode:`}),` `,`All bash commands invoked by the model must run in the sandbox unless they are explicitly listed in excludedCommands.`]}),(0,I.jsxs)(f,{dimColor:!0,children:[`Learn more:`,` `,(0,I.jsx)(d,{url:`https://code.workmate.com/docs/en/sandboxing#configure-sandboxing`,children:`code.workmate.com/docs/en/sandboxing#configure-sandboxing`})]})]})]})}var I,L=e((()=>{_(),i(),t(),I=y()}));function R({onComplete:e,depCheck:t}){let[n]=l(),i=r.isSandboxingEnabled(),a=r.isAutoAllowBashIfSandboxedEnabled(),o=t.warnings.length>0,s=S().sandbox?.network?.allowAllUnixSockets,u=o&&!s,d=i?a?`auto-allow`:`regular`:`disabled`,f=m(`success`,n)(`(current)`),p=[{label:d===`auto-allow`?`Sandbox BashTool, with auto-allow ${f}`:`Sandbox BashTool, with auto-allow`,value:`auto-allow`},{label:d===`regular`?`Sandbox BashTool, with regular permissions ${f}`:`Sandbox BashTool, with regular permissions`,value:`regular`},{label:d===`disabled`?`No Sandbox ${f}`:`No Sandbox`,value:`disabled`}];async function _(t){switch(t){case`auto-allow`:await r.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),e(`✓ Sandbox enabled with auto-allow for bash commands`);break;case`regular`:await r.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),e(`✓ Sandbox enabled with regular bash permissions`);break;case`disabled`:await r.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),e(`○ Sandbox disabled`);break}}c({"confirm:no":()=>e(void 0,{display:`skip`})},{context:`Settings`});let y=(0,B.jsx)(h,{title:`Mode`,children:(0,B.jsx)(z,{showSocketWarning:u,options:p,onSelect:_,onComplete:e})},`mode`),b=(0,B.jsx)(h,{title:`Overrides`,children:(0,B.jsx)(P,{onComplete:e})},`overrides`),x=(0,B.jsx)(h,{title:`Config`,children:(0,B.jsx)(O,{})},`config`);return(0,B.jsx)(v,{color:`permission`,children:(0,B.jsx)(g,{title:`Sandbox:`,color:`permission`,defaultTab:`Mode`,children:t.errors.length>0?[(0,B.jsx)(h,{title:`Dependencies`,children:(0,B.jsx)(j,{depCheck:t})},`dependencies`)]:[y,...o?[(0,B.jsx)(h,{title:`Dependencies`,children:(0,B.jsx)(j,{depCheck:t})},`dependencies`)]:[],b,x]})})}function z({showSocketWarning:e,options:t,onSelect:r,onComplete:i}){let{headerFocused:a,focusHeader:o}=p();return(0,B.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[e&&(0,B.jsx)(u,{marginBottom:1,children:(0,B.jsx)(f,{color:`warning`,children:`Cannot block unix domain sockets (see Dependencies tab)`})}),(0,B.jsx)(u,{marginBottom:1,children:(0,B.jsx)(f,{bold:!0,children:`Configure Mode:`})}),(0,B.jsx)(n,{options:t,onChange:r,onCancel:()=>i(void 0,{display:`skip`}),onUpFromFirstItem:o,isDisabled:a}),(0,B.jsxs)(u,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,B.jsxs)(f,{dimColor:!0,children:[(0,B.jsx)(f,{bold:!0,dimColor:!0,children:`Auto-allow mode:`}),` `,`Commands will try to run in the sandbox automatically, and attempts to run outside of the sandbox fallback to regular permissions. Explicit ask/deny rules are always respected.`]}),(0,B.jsxs)(f,{dimColor:!0,children:[`Learn more:`,` `,(0,B.jsx)(d,{url:`https://code.workmate.com/docs/en/sandboxing`,children:`code.workmate.com/docs/en/sandboxing`})]})]})]})}var B,V=e((()=>{_(),o(),i(),C(),t(),A(),N(),L(),B=y()}));async function H(e,t,n){let i=S().theme||`light`,a=T();if(!r.isSupportedPlatform()){let t=a===`wsl`?`Error: Sandboxing requires WSL2. WSL1 is not supported.`:`Error: Sandboxing is currently only supported on macOS, Linux, and WSL2.`;return e(m(`error`,i)(t)),null}let o=r.checkDependencies();if(!r.isPlatformInEnabledList())return e(m(`error`,i)(`Error: Sandboxing is disabled for this platform (${a}) via the enabledPlatforms setting.`)),null;if(r.areSandboxSettingsLockedByPolicy())return e(m(`error`,i)(`Error: Sandbox settings are overridden by a higher-priority configuration and cannot be changed locally.`)),null;let c=n?.trim()||``;if(!c)return(0,U.jsx)(R,{onComplete:e,depCheck:o});if(c){let t=c.split(` `)[0];if(t===`exclude`){let t=c.slice(8).trim();if(!t)return e(m(`error`,i)(`Error: Please provide a command pattern to exclude (e.g., /sandbox exclude "npm run test:*")`)),null;let n=t.replace(/^["']|["']$/g,``);s(n);let r=w(`localSettings`),a=r?D(b(),r):`.workmate/settings.local.json`;return e(m(`success`,i)(`Added "${n}" to excluded commands in ${a}`)),null}else return e(m(`error`,i)(`Error: Unknown subcommand "${t}". Available subcommand: exclude`)),null}return null}var U;e((()=>{x(),V(),_(),E(),i(),C(),U=y()}))();export{H as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{F_ as e,N_ as t}from"./loadAgentsDir-JrGMJN05.js";t();export{e as isSearchExtraToolsEnabled};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{nh as e,rh as t}from"./loadAgentsDir-JrGMJN05.js";e();export{t as registerSessionFileAccessHooks};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./sessionObserver-CvQ6oyoj.js";t();export{e as heuristicObserverBackend};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Dr as e,Xr as t,br as n}from"./loadAgentsDir-JrGMJN05.js";n();export{e as linkSessionToPR,t as recordTranscript};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,g as t,x as n}from"./settings-aUygByiZ.js";t();export{e as getSettingsForSource,n as updateSettingsForSource};
|