@readmagic/workmate 0.0.6 → 0.0.8
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-CwLtQld4.js +1 -0
- package/dist/chunks/App-Ba52HvYC.js +1 -0
- package/dist/chunks/{ApproveApiKey-Bsy8kr2a.js → ApproveApiKey-CEIfuUh0.js} +1 -1
- package/dist/chunks/ApproveApiKey-D2MLQu2P.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-IGDrkbWl.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-BKj_3Idm.js → BypassPermissionsModeDialog-GYhq--JR.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-BD-7yAZh.js → ClaudeMdExternalIncludesDialog-C-CTa-95.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-Catv6BCJ.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-BeQXqUtX.js +1 -0
- package/dist/chunks/{DiffDialog-C4XSSjvV.js → DiffDialog-AC5DSJrq.js} +6 -6
- package/dist/chunks/Doctor-B9Rxsoy0.js +1 -0
- package/dist/chunks/Doctor-lhUBhEy5.js +3 -0
- package/dist/chunks/{ExitFlow-BttnAv-O.js → ExitFlow-Cu8SoQHs.js} +2 -2
- package/dist/chunks/Grove-Bc4CofEj.js +11 -0
- package/dist/chunks/{HybridTransport-B8V6O6rM.js → HybridTransport-BJPOG2wl.js} +3 -3
- package/dist/chunks/{InvalidConfigDialog-CHzBSJDf.js → InvalidConfigDialog-BI13il58.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-BKenH3bD.js → InvalidSettingsDialog-CtOheV1K.js} +1 -1
- package/dist/chunks/MCPConnectionManager-ao-P3xSA.js +1 -0
- package/dist/chunks/MCPToolListView-dkofcJs4.js +1 -0
- package/dist/chunks/{McpParsingWarnings-Bj2-YL8o.js → McpParsingWarnings-BS4JoR5l.js} +1 -1
- package/dist/chunks/MessageSelector-B88b2ypw.js +3 -0
- package/dist/chunks/Messages-BPeI7lLV.js +11 -0
- package/dist/chunks/Onboarding-c2fQ8Io_.js +1 -0
- package/dist/chunks/{PromptInputFooterSuggestions-egs9VvUs.js → PromptInputFooterSuggestions-D1cH9sDX.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-SieM5NoY.js → PromptInputHelpMenu-DDD5WuK0.js} +1 -1
- package/dist/chunks/QueryEngine-Cv_meCam.js +1 -0
- package/dist/chunks/REPL-BXhAQOXb.js +139 -0
- package/dist/chunks/REPL-YqjLnr3A.js +1 -0
- package/dist/chunks/RemoteSessionManager-CT7T8BaR.js +2 -0
- package/dist/chunks/ResumeConversation-CIZCjms9.js +1 -0
- package/dist/chunks/{SSETransport-DtpMDekF.js → SSETransport-CrwbKuVt.js} +3 -3
- package/dist/chunks/SearchExtraToolsTool-Dx6093yw.js +1 -0
- package/dist/chunks/Settings-CyUm0AtU.js +2 -0
- package/dist/chunks/{TeleportProgress-rYaHIEfe.js → TeleportProgress-C3qyp5zy.js} +1 -1
- package/dist/chunks/TeleportRepoMismatchDialog-BV--nyYn.js +1 -0
- package/dist/chunks/TeleportResumeWrapper-Blo2cZg-.js +1 -0
- package/dist/chunks/ThemePicker-EQ6hPUeI.js +1 -0
- package/dist/chunks/TrustDialog-BukWGvHZ.js +1 -0
- package/dist/chunks/{ValidationErrorsList-B8pRiGuy.js → ValidationErrorsList-DokTJQwi.js} +1 -1
- package/dist/chunks/{WelcomeV2-DqnbSdIu.js → WelcomeV2-Ci9VwPYh.js} +1 -1
- package/dist/chunks/{add-dir-C2Hu3oE4.js → add-dir-DPQV0qml.js} +1 -1
- package/dist/chunks/{agentDisplay-XoDJhr03.js → agentDisplay-DBQYOaOh.js} +1 -1
- package/dist/chunks/agents-DmybpgDN.js +103 -0
- package/dist/chunks/{agents-C4QXeHIJ.js → agents-HlKk68Qc.js} +1 -1
- package/dist/chunks/allErrors-BPn_2TrB.js +1 -0
- package/dist/chunks/analytics-CkYUHW_U.js +1 -0
- package/dist/chunks/ant-DjdvlLOo.js +1 -0
- package/dist/chunks/api-AMgj1zf_.js +1 -0
- package/dist/chunks/api-CF5IVtj0.js +1 -0
- package/dist/chunks/{asciicast-CbAjUHT_.js → asciicast-BJNYO5sh.js} +1 -1
- package/dist/chunks/asciicast-CH6hdK0a.js +1 -0
- package/dist/chunks/auth-CNjDn1VY.js +15 -0
- package/dist/chunks/auth-CZzP483s.js +1 -0
- package/dist/chunks/auth-DDSBm_Yj.js +1 -0
- package/dist/chunks/{autoMode-BNukrVAB.js → autoMode-Cr0AhS1G.js} +5 -5
- package/dist/chunks/{autonomy-BEmI7WVW.js → autonomy-ARUQt-Lu.js} +1 -1
- package/dist/chunks/autonomy-D4xZLOdJ.js +15 -0
- package/dist/chunks/{autonomyPanel-fhge09AG.js → autonomyPanel-BQK9MoeB.js} +1 -1
- package/dist/chunks/backgroundHousekeeping--eBgphcg.js +17 -0
- package/dist/chunks/backgroundHousekeeping-VV1V_Y2Z.js +1 -0
- package/dist/chunks/{banner-CWkrK10u.js → banner-Ca7rki2V.js} +2 -2
- package/dist/chunks/bg-BK_9J6F6.js +1 -0
- package/dist/chunks/{bg-WnYN5ifx.js → bg-DxRHF1yn.js} +2 -2
- package/dist/chunks/{branch-Bpe-gocq.js → branch-BYq0zpzT.js} +1 -1
- package/dist/chunks/{break-cache-C_p7Kmx2.js → break-cache-BKvoMOZx.js} +2 -2
- package/dist/chunks/bridgeConfig-C82un7rJ.js +1 -0
- package/dist/chunks/{bridgeConfig-BhxRF2vm.js → bridgeConfig-jDEva6Eh.js} +1 -1
- package/dist/chunks/bridgeMessaging-YqYdl6ej.js +1 -0
- package/dist/chunks/bridgePointer-DIM0sj0x.js +1 -0
- package/dist/chunks/btw-CUV3nRrE.js +1 -0
- package/dist/chunks/caches-BZ59_En6.js +1 -0
- package/dist/chunks/caches-Cg-HtWKG.js +1 -0
- package/dist/chunks/capacityWake-CKOiRELo.js +3 -0
- package/dist/chunks/ccrClient-BC2q3k44.js +1 -0
- package/dist/chunks/{claudeDesktop-Cx31Ugjp.js → claudeDesktop-DQXL5bGm.js} +1 -1
- package/dist/chunks/{clear-B4d38ssF.js → clear-1etSJhdg.js} +1 -1
- package/dist/chunks/{cliLaunch-BkPAatcs.js → cliLaunch-CQjLYRzM.js} +1 -1
- package/dist/chunks/client-DQXvVKND.js +1 -0
- package/dist/chunks/client-DQwf_b9o.js +17 -0
- package/dist/chunks/client-DkgC-mFB.js +1 -0
- package/dist/chunks/color-CBsNbt1s.js +1 -0
- package/dist/chunks/commands-qM5z_Uld.js +1 -0
- package/dist/chunks/compact-BclJiRJe.js +2 -0
- package/dist/chunks/completionCache-BMHAktkM.js +1 -0
- package/dist/chunks/config-CE058cvr.js +3 -0
- package/dist/chunks/config-D81avYye.js +1 -0
- package/dist/chunks/config-DpOOllGk.js +1 -0
- package/dist/chunks/context-noninteractive-Ct_ttQfP.js +29 -0
- package/dist/chunks/context-noninteractive-DJb8H_hN.js +1 -0
- package/dist/chunks/context-sR9fJmXE.js +1 -0
- package/dist/chunks/conversation-D48Kt3ar.js +1 -0
- package/dist/chunks/conversation-fOFTa7k5.js +1 -0
- package/dist/chunks/{createSSHSession-BM-5pbv6.js → createSSHSession-BmHXA2me.js} +1 -1
- package/dist/chunks/createSession-C4rukWkv.js +1 -0
- package/dist/chunks/createSession-CSwlW2T2.js +1 -0
- package/dist/chunks/crossProjectResume-lDFB2ZcY.js +40 -0
- package/dist/chunks/cwd-5Xr-Qka6.js +1 -0
- package/dist/chunks/cwd-C5ce-7WB.js +1 -0
- package/dist/chunks/{daemon-YtZbMQtn.js → daemon-ZtpTZWgQ.js} +1 -1
- package/dist/chunks/{datadog-CpqEQbHa.js → datadog-BJn5ECIu.js} +1 -1
- package/dist/chunks/{debug-BrXObCdR.js → debug-RZ4NuXyS.js} +1 -1
- package/dist/chunks/debugUtils-D30M1cbN.js +1 -0
- package/dist/chunks/{detached-TYk4hMFj.js → detached-jrVP11oU.js} +1 -1
- package/dist/chunks/{detectRepository-BPr0VWNO.js → detectRepository-CFiHe6Rv.js} +1 -1
- package/dist/chunks/detectRepository-DqQvyj_a.js +1 -0
- package/dist/chunks/{diff-CVzOodeg.js → diff-BKiK3xHv.js} +1 -1
- package/dist/chunks/directoryCompletion-BagQcynj.js +1 -0
- package/dist/chunks/doctor-BEHYm34V.js +1 -0
- package/dist/chunks/{entry-DHVYCR26.js → entry-BzL1MFQG.js} +4 -4
- package/dist/chunks/esm-BLPbfHQd.js +1 -0
- package/dist/chunks/{execFileNoThrow-D244NytW.js → execFileNoThrow-CCX-JY8h.js} +1 -1
- package/dist/chunks/{execSyncWrapper-CCMQShK-.js → execSyncWrapper-dhRSYGFW.js} +1 -1
- package/dist/chunks/exit-DE2YiAhQ.js +1 -0
- package/dist/chunks/{lazySchema-DcIJE_0i.js → external-CEp-aPkt.js} +1 -1
- package/dist/chunks/extraUsage-Dw7AXiH7.js +1 -0
- package/dist/chunks/extractMemories-DxTUMiv3.js +1 -0
- package/dist/chunks/fast-CHmMkIpE.js +1 -0
- package/dist/chunks/fast-uQASHWqR.js +1 -0
- package/dist/chunks/fileSuggestions-Dyu2kQtE.js +3 -0
- package/dist/chunks/firstPartyEventLogger-D5ohKbIe.js +5 -0
- package/dist/chunks/firstPartyEventLogger-LsNY6yOt.js +1 -0
- package/dist/chunks/flushGate-Cnsu4HET.js +1 -0
- package/dist/chunks/gemini-Cudre91e.js +1 -0
- package/dist/chunks/{generateRecap-jGDLI_wU.js → generateRecap-CiFxXlmH.js} +1 -1
- package/dist/chunks/generateSessionName-DitoBxJT.js +1 -0
- package/dist/chunks/{genericProcessUtils-CdQTApYX.js → genericProcessUtils-DVfMHhfy.js} +1 -1
- package/dist/chunks/git-BerW9bId.js +6 -0
- package/dist/chunks/git-D6dOU2mT.js +1 -0
- package/dist/chunks/githubRepoPathMapping-DGr0kJ8D.js +1 -0
- package/dist/chunks/{goal-CFx4eRkf.js → goal-DuUayfDg.js} +3 -3
- package/dist/chunks/grok-tRbmZzEh.js +1 -0
- package/dist/chunks/grove-Cv19v6Sv.js +7 -0
- package/dist/chunks/help-DkqxbFDM.js +1 -0
- package/dist/chunks/{hooks-X6J03MnA.js → hooks-BZJTWD07.js} +2 -2
- package/dist/chunks/hooks-CsP42iOp.js +1 -0
- package/dist/chunks/initReplBridge-DdsSWVqN.js +1 -0
- package/dist/chunks/{install-D5YORIJL.js → install-BI---dv0.js} +1 -1
- package/dist/chunks/{instrumentation-Bw3CxPQf.js → instrumentation-CcWzhGfE.js} +4 -4
- package/dist/chunks/{job-DOWtcltx.js → job-B0ftcqPF.js} +1 -1
- package/dist/chunks/{jwtUtils-DE2GPUcx.js → jwtUtils-C0cE-1Ey.js} +1 -1
- package/dist/chunks/keybindings-DZU3vwo3.js +2 -0
- package/dist/chunks/language-DHhXLb_Y.js +1 -0
- package/dist/chunks/{language-C6Fq-XOZ.js → language-s-dLbdVz.js} +1 -1
- package/dist/chunks/launchLocalMemory-twLxpPvg.js +3 -0
- package/dist/chunks/{launchOnboarding-Cc6WwPX9.js → launchOnboarding-BWz2XSb9.js} +1 -1
- package/dist/chunks/lazySchema-B4D4qJVE.js +1 -0
- package/dist/chunks/{loadAgentsDir-D206qwP3.js → loadAgentsDir-ByO8eJqU.js} +1724 -1993
- package/dist/chunks/loadAgentsDir-CMNFLt7R.js +1 -0
- package/dist/chunks/loadPluginHooks-BPnxcgrL.js +1 -0
- package/dist/chunks/{localSearch-CzrbOklu.js → localSearch-CHHCH16D.js} +1 -1
- package/dist/chunks/localSearch-DzQODFap.js +1 -0
- package/dist/chunks/log-CZ0zYP_c.js +1 -0
- package/dist/chunks/logoV2Utils-CGUJ-5gY.js +1 -0
- package/dist/chunks/{magicDocs-DWjL2k7P.js → magicDocs-C5i5ruuU.js} +3 -3
- package/dist/chunks/{main-D862LI_d.js → main-BLD4QAQg.js} +2 -2
- package/dist/chunks/{main-BohPzJFF.js → main-D4Uk-WUs.js} +89 -86
- package/dist/chunks/managedEnv-C-9XSN14.js +1 -0
- package/dist/chunks/managedEnv-DLVRBaA9.js +1 -0
- package/dist/chunks/managedEnvConstants-BPwL2aWI.js +1 -0
- package/dist/chunks/{mappers-BDMZFgKx.js → mappers-CHRFic5q.js} +1 -1
- package/dist/chunks/mcp-BMVdGknC.js +1 -0
- package/dist/chunks/mcp-COS5RJFS.js +6 -0
- package/dist/chunks/mcp-tGsOW1GN.js +2 -0
- package/dist/chunks/memoize-B8hfb1JN.js +1 -0
- package/dist/chunks/memory-DR6poqeH.js +1 -0
- package/dist/chunks/{mode-CUkHFkju.js → mode-QV-NW1Wd.js} +2 -2
- package/dist/chunks/model-BF_4ebyl.js +1 -0
- package/dist/chunks/{model-BY3auM2c.js → model-BNU_ulDJ.js} +1 -1
- package/dist/chunks/model-CwO-g1RW.js +1 -0
- package/dist/chunks/nativeInstaller-B-lNJjM-.js +1 -0
- package/dist/chunks/observationStore-BpjlK0pG.js +3 -0
- package/dist/chunks/omit-DZCEXri5.js +1 -0
- package/dist/chunks/onChangeAppState-BmfM5g-D.js +1 -0
- package/dist/chunks/openai-DPH6rXOZ.js +10 -0
- package/dist/chunks/{panel-BSZGX6jN.js → panel-mD094ALT.js} +1 -1
- package/dist/chunks/{panelCall-BsVoL1uF.js → panelCall-SbffM7G4.js} +1 -1
- package/dist/chunks/parser-DrBC8nWp.js +1 -0
- package/dist/chunks/{parser-DFwaTGf7.js → parser-dbHRgXb8.js} +1 -1
- package/dist/chunks/partition-DKuAFJkc.js +1 -0
- package/dist/chunks/{path-D5U-tm91.js → path-Cv9QMBAX.js} +1 -1
- package/dist/chunks/permissions-ey-bfanE.js +3 -0
- package/dist/chunks/{pidLock-D5rUnDB-.js → pidLock-DJnS_38v.js} +2 -2
- package/dist/chunks/{pipeTransport-CqCnc-Ys.js → pipeTransport-DVOKR4c_.js} +1 -1
- package/dist/chunks/{plan-SYZ4DXR8.js → plan-Brg9XnRr.js} +1 -1
- package/dist/chunks/{platform-BrYefG_2.js → platform-DCXXznJg.js} +1 -1
- package/dist/chunks/plugin-CRwa39Y1.js +17 -0
- package/dist/chunks/pluginAutoupdate-D0LIP7cy.js +1 -0
- package/dist/chunks/{pluginBlocklist-C3H2afWG.js → pluginBlocklist-PwHHD3nj.js} +1 -1
- package/dist/chunks/pluginCliCommands-BJM5Bdpf.js +1 -0
- package/dist/chunks/pluginFlagging-pBxSselw.js +1 -0
- package/dist/chunks/pluginOperations-C7p_Qr2r.js +2 -0
- package/dist/chunks/pluginStartupCheck-C0HqhG6D.js +1 -0
- package/dist/chunks/pluginStartupCheck-Di4LjHXf.js +1 -0
- package/dist/chunks/{plugins-Dn6ceWrT.js → plugins-DUKNjLq6.js} +4 -4
- package/dist/chunks/pollConfig-BgpfHQPJ.js +1 -0
- package/dist/chunks/{poorMode-DhzFKpPl.js → poorMode-CYXmr_mU.js} +1 -1
- package/dist/chunks/poorMode-CejPNCp-.js +1 -0
- package/dist/chunks/print-gyTOCJzk.js +23 -0
- package/dist/chunks/processBashCommand-Cze9vCm6.js +1 -0
- package/dist/chunks/processSlashCommand-BRajh1v7.js +5 -0
- package/dist/chunks/prompt-B7joRiqj.js +139 -0
- package/dist/chunks/prompt-DqSMh2x9.js +1 -0
- package/dist/chunks/prompt-Eysh8Et_.js +1 -0
- package/dist/chunks/{promptEditor-DeMrXUir.js → promptEditor-R_acDAgI.js} +2 -2
- package/dist/chunks/{protocolHandler-BHxBy84Z.js → protocolHandler-RNKkhq91.js} +1 -1
- package/dist/chunks/{proxy-CRN7jYIi.js → proxy-BmtEnJ02.js} +1 -1
- package/dist/chunks/rcDebugLog-CARUIORE.js +1 -0
- package/dist/chunks/reconciler-BfkO6X2X.js +4 -0
- package/dist/chunks/refresh-C1X3sptR.js +1 -0
- package/dist/chunks/registerProtocol-DoKqmqu2.js +36 -0
- package/dist/chunks/{reload-plugins-B9IT9CFA.js → reload-plugins-C0osFcNh.js} +1 -1
- package/dist/chunks/remoteBridgeCore-Cddqv2WW.js +1 -0
- package/dist/chunks/remoteManagedSettings-B1mnRDmA.js +1 -0
- package/dist/chunks/rename-B3tf-YiD.js +1 -0
- package/dist/chunks/{renderOptions-BUJB9nAm.js → renderOptions-ChLwxtVu.js} +1 -1
- package/dist/chunks/replBridgeHandle-CNwNIijW.js +1 -0
- package/dist/chunks/{resume-y7MCTZHJ.js → resume-Be1G_GBL.js} +2 -2
- package/dist/chunks/ripgrep-C2PhTJDh.js +1 -0
- package/dist/chunks/{ripgrep-BXmXjAzA.js → ripgrep-gaT9Njwi.js} +1 -1
- package/dist/chunks/{runtimeObserver-BZcJ1FbH.js → runtimeObserver-CsIwinzh.js} +1 -1
- package/dist/chunks/runtimeObserver-Dbxxw4ls.js +10 -0
- package/dist/chunks/sandbox-adapter-C6GBuJPB.js +1 -0
- package/dist/chunks/sandbox-toggle-jEySONTW.js +1 -0
- package/dist/chunks/searchExtraTools-C_UTryh_.js +1 -0
- package/dist/chunks/session-DDI1Eb2x.js +2 -0
- package/dist/chunks/sessionFileAccessHooks-DfJ7Htfl.js +1 -0
- package/dist/chunks/sessionIdCompat-DMayYBrf.js +1 -0
- package/dist/chunks/sessionMemory-CQBxPkTQ.js +1 -0
- package/dist/chunks/sessionMemory-s0ALUHvc.js +1 -0
- package/dist/chunks/sessionMemoryUtils-xt7dTHGC.js +1 -0
- package/dist/chunks/sessionObserver-C2sYqWL3.js +1 -0
- package/dist/chunks/sessionObserver-DoYc0ZOP.js +20 -0
- package/dist/chunks/sessionState-CjNY991n.js +11 -0
- package/dist/chunks/sessionStorage-DqsY-7pi.js +1 -0
- package/dist/chunks/{sessionTitle-coed9IuJ.js → sessionTitle-B0OYf5nM.js} +3 -3
- package/dist/chunks/sessionTracing-CwsXt_uA.js +11 -0
- package/dist/chunks/settings-BWtOA9A7.js +1 -0
- package/dist/chunks/settings-hQDLwPVj.js +20 -0
- package/dist/chunks/settingsSync-DdFagwHV.js +1 -0
- package/dist/chunks/setup-DzC22EkN.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-D1wsAdpp.js → shadowedRuleDetection-C86PTj1m.js} +1 -1
- package/dist/chunks/{shellQuote-DkSy9MYE.js → shellQuote-BUVKMu_P.js} +1 -1
- package/dist/chunks/{sideQuestion-wSi38p81.js → sideQuestion-C780iYwd.js} +3 -3
- package/dist/chunks/sinks-5G_xhc1Q.js +1 -0
- package/dist/chunks/{sinks-C_Dl1p4K.js → sinks-Cftq7Es0.js} +2 -2
- package/dist/chunks/skillChangeDetector-plLveEbf.js +1 -0
- package/dist/chunks/skillGapStore-Dc1arohs.js +5 -0
- package/dist/chunks/skillLifecycle-DP6mY1Kp.js +8 -0
- package/dist/chunks/{skillSearchPanel-CErRnUwo.js → skillSearchPanel-CpLTImaL.js} +4 -4
- package/dist/chunks/{skills-CBKhfg_a.js → skills-zGYaYfFV.js} +1 -1
- package/dist/chunks/{src-D06Xyj4g.js → src-BN7QRYLl.js} +1 -1
- package/dist/chunks/startupProfiler-DCn_NxMH.js +3 -0
- package/dist/chunks/startupProfiler-JbpAkfNE.js +1 -0
- package/dist/chunks/{state-ix0xIunV.js → state-C2OSZkV1.js} +1 -1
- package/dist/chunks/state-DU9lRJ9x.js +1 -0
- package/dist/chunks/{stats-BY4dskVg.js → stats-Duk7_xjQ.js} +1 -1
- package/dist/chunks/{status-BnJIXtKl.js → status-CFw-FpZM.js} +2 -2
- package/dist/chunks/{status-DU-B4SMW.js → status-peiVB_2j.js} +1 -1
- package/dist/chunks/statusNoticeHelpers-B5U5c9PE.js +1 -0
- package/dist/chunks/{stringUtils-DGLPkqJ4.js → stringUtils-B6FudhoZ.js} +1 -1
- package/dist/chunks/switcher-BAMqSX7Z.js +1 -0
- package/dist/chunks/switcher-hgBgVzLb.js +1 -0
- package/dist/chunks/syncCache-Zl9kZRRl.js +1 -0
- package/dist/chunks/{tasks-CBVL005y.js → tasks-BxpyRhmD.js} +1 -1
- package/dist/chunks/teleport-CwxeD5vL.js +1 -0
- package/dist/chunks/{templateJobs-D6998LcG.js → templateJobs-DR5fKFiO.js} +1 -1
- package/dist/chunks/{terminalSetup-0SBdyKF5.js → terminalSetup-DgRBt-JJ.js} +1 -1
- package/dist/chunks/terminalSetup-DlaFWI81.js +33 -0
- package/dist/chunks/{theme-p0AooruD.js → theme-Bz6esfST.js} +1 -1
- package/dist/chunks/{tmux-BY7IdQ1f.js → tmux-DSU9tYIo.js} +1 -1
- package/dist/chunks/{toolEventObserver-DTccwC3c.js → toolEventObserver-BSekCkM2.js} +1 -1
- package/dist/chunks/toolPool-B7SIoDw5.js +1 -0
- package/dist/chunks/{trustedDevice-BTYoQCkC.js → trustedDevice-B0x9X0fb.js} +1 -1
- package/dist/chunks/trustedDevice-CjHQtVkO.js +1 -0
- package/dist/chunks/{types-C-MRCL8J.js → types-D7_37tP2.js} +2 -2
- package/dist/chunks/{udsClient-BuCtv7dN.js → udsClient-CHoMMH28.js} +1 -1
- package/dist/chunks/{up-BHkC97_C.js → up-B8wBSpLg.js} +1 -1
- package/dist/chunks/{updateCCB-DFL5Wt_I.js → updateCCB-D_kGQKPT.js} +1 -1
- package/dist/chunks/{upstreamproxy-DyR_eXO8.js → upstreamproxy-Hmq-n8fw.js} +1 -1
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-Cce612uS.js +1 -0
- package/dist/chunks/useMainLoopModel-BICP6_Fi.js +1 -0
- package/dist/chunks/useManagePlugins-DtbY_vPL.js +1 -0
- package/dist/chunks/useMergedTools-Ckx2IEhF.js +1 -0
- package/dist/chunks/{useSearchInput-D1Vr2Js1.js → useSearchInput-BAgljZUl.js} +1 -1
- package/dist/chunks/useSettingsErrors-CAJR_wpd.js +1 -0
- package/dist/chunks/userAgent-BxTG7IMk.js +1 -0
- package/dist/chunks/{util-BaDs-wL5.js → util-DDtmyq_r.js} +1 -1
- package/dist/chunks/validatePlugin-AHl-g4ct.js +1 -0
- package/dist/chunks/{vim-C-icQDz1.js → vim-kg-mRVbu.js} +1 -1
- package/dist/chunks/{which-CKQnSouy.js → which-CHLNJmtJ.js} +1 -1
- package/dist/chunks/windowsPaths-Pmx8LDR6.js +1 -0
- package/dist/chunks/{windowsPaths-DtapVxOo.js → windowsPaths-o62uq6LF.js} +1 -1
- package/dist/chunks/{workSecret-CNWiR2uQ.js → workSecret-DG9shvG0.js} +1 -1
- package/dist/chunks/workerRegistry-C7H_lsQX.js +6 -0
- package/dist/chunks/worktree-O2p-mJdF.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AddWorkspaceDirectory-ClHi-Dr6.js +0 -1
- package/dist/chunks/App-BP06lHmf.js +0 -1
- package/dist/chunks/ApproveApiKey-a2ZonQ3n.js +0 -1
- package/dist/chunks/AssistantSessionChooser-CcocKoTJ.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-DNeBhGCf.js +0 -2
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DFivNFuo.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-CS3zjEPF.js +0 -1
- package/dist/chunks/DesktopHandoff-BmPmCfT3.js +0 -1
- package/dist/chunks/Dialog-vfLXEPed.js +0 -1
- package/dist/chunks/Doctor-BhD-ZzZm.js +0 -1
- package/dist/chunks/Doctor-DEQe2q16.js +0 -3
- package/dist/chunks/Feedback-BaYA8-SU.js +0 -2
- package/dist/chunks/Grove-BJziCbZH.js +0 -11
- package/dist/chunks/Grove-sWm-oLBf.js +0 -1
- package/dist/chunks/ListItem-vfLXEPed.js +0 -1
- package/dist/chunks/MCPConnectionManager-CNh9dNlk.js +0 -1
- package/dist/chunks/MessageSelector-DdR6wJhh.js +0 -3
- package/dist/chunks/Messages-Ch6cboMV.js +0 -11
- package/dist/chunks/Onboarding-BrAJp0aL.js +0 -1
- package/dist/chunks/OverageCreditUpsell-Ds1cB7RC.js +0 -1
- package/dist/chunks/PluginSettings-CGqEzejq.js +0 -17
- package/dist/chunks/QueryEngine-CZZMl3PB.js +0 -1
- package/dist/chunks/REPL-CG2N7E4Q.js +0 -142
- package/dist/chunks/REPL-DvA910N_.js +0 -1
- package/dist/chunks/RemoteCallout-Cs-ro8_i.js +0 -1
- package/dist/chunks/RemoteSessionManager-B740Dp6m.js +0 -2
- package/dist/chunks/ResumeConversation-DzV2zmuX.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-C4uO-Zx3.js +0 -1
- package/dist/chunks/Settings-XKw6FI_m.js +0 -2
- package/dist/chunks/TeleportRepoMismatchDialog-DY97YZMB.js +0 -1
- package/dist/chunks/TeleportResumeWrapper-jaQzyTCh.js +0 -1
- package/dist/chunks/ThemePicker-BViWzLp3.js +0 -1
- package/dist/chunks/TrustDialog-DGJ_BisZ.js +0 -1
- package/dist/chunks/TungstenTool-Cb7gJvq4.js +0 -1
- package/dist/chunks/TungstenTool-CxMQVCuF.js +0 -1
- package/dist/chunks/agents-BIHTGDYh.js +0 -103
- package/dist/chunks/allErrors-1896uQA1.js +0 -1
- package/dist/chunks/analytics-BotDBGh0.js +0 -1
- package/dist/chunks/ant-B6k6cBts.js +0 -1
- package/dist/chunks/api-BsFW57_Q.js +0 -1
- package/dist/chunks/api-gqTA-D7n.js +0 -1
- package/dist/chunks/asciicast-BsWpcxrc.js +0 -1
- package/dist/chunks/assistant-C83quuNj.js +0 -1
- package/dist/chunks/assistant-DJ9hd4uC.js +0 -1
- package/dist/chunks/assistant-z2o4-UJe.js +0 -1
- package/dist/chunks/auth-8Vd3_U8t.js +0 -1
- package/dist/chunks/auth-BnSrKyJe.js +0 -15
- package/dist/chunks/auth-DRTjfnGy.js +0 -1
- package/dist/chunks/autonomy-DGcy5Rml.js +0 -15
- package/dist/chunks/backgroundHousekeeping-3i_d_WW5.js +0 -1
- package/dist/chunks/backgroundHousekeeping-BVMf_Tjn.js +0 -17
- package/dist/chunks/bg-B0iMGM9C.js +0 -1
- package/dist/chunks/bridge-D12Shbkj.js +0 -2
- package/dist/chunks/bridgeConfig-CqIQ_rvD.js +0 -1
- package/dist/chunks/bridgeEnabled-D0XC5kNh.js +0 -1
- package/dist/chunks/bridgeEnabled-SbB-6zdY.js +0 -1
- package/dist/chunks/bridgeMain-DHUpZFgL.js +0 -68
- package/dist/chunks/bridgeMain-DUbQjgCp.js +0 -1
- package/dist/chunks/bridgeMessaging-DHc5dOhB.js +0 -1
- package/dist/chunks/bridgePointer-MqLe5Asm.js +0 -1
- package/dist/chunks/browser-BmZuQom6.js +0 -1
- package/dist/chunks/btw-D9hMM5d2.js +0 -1
- package/dist/chunks/caches-CWzT7e6Y.js +0 -1
- package/dist/chunks/caches-UeVVM3T0.js +0 -3
- package/dist/chunks/capacityWake-CV_x9H8j.js +0 -1
- package/dist/chunks/ccrClient-Iza0L8Zw.js +0 -1
- package/dist/chunks/client-BzKQTXzF.js +0 -1
- package/dist/chunks/color-D8VOyoYl.js +0 -1
- package/dist/chunks/commands-DDamMmo4.js +0 -1
- package/dist/chunks/commitAttribution-CgohL8vD.js +0 -1
- package/dist/chunks/commitAttribution-ChAgixdj.js +0 -2
- package/dist/chunks/compact-IFHwxjZ9.js +0 -2
- package/dist/chunks/completionCache-MN3_MqK8.js +0 -4
- package/dist/chunks/completionCache-c4aiyZ_f.js +0 -1
- package/dist/chunks/config-DY5-_kk_.js +0 -1
- package/dist/chunks/config-DmomySWC.js +0 -3
- package/dist/chunks/config-WxgxrQoP.js +0 -1
- package/dist/chunks/context-Cl6BJ2vm.js +0 -1
- package/dist/chunks/context-noninteractive-9hELVC29.js +0 -54
- package/dist/chunks/context-noninteractive-Beij5MfU.js +0 -1
- package/dist/chunks/conversation-BBB91hEw.js +0 -1
- package/dist/chunks/conversation-BWVTM40Y.js +0 -1
- package/dist/chunks/createSession-CoQtL5Rj.js +0 -1
- package/dist/chunks/createSession-Cvl1Q50F.js +0 -1
- package/dist/chunks/cron-3LntnnhJ.js +0 -1
- package/dist/chunks/crossProjectResume-BasMLl2n.js +0 -40
- package/dist/chunks/cwd--nvsx73T.js +0 -1
- package/dist/chunks/cwd-CYmmnQVS.js +0 -1
- package/dist/chunks/debugUtils-NO5KtXqi.js +0 -1
- package/dist/chunks/desktop-B_L6T6jI.js +0 -1
- package/dist/chunks/detectRepository-BTPgN89l.js +0 -1
- package/dist/chunks/directoryCompletion-CW2ckkQg.js +0 -1
- package/dist/chunks/doctor-1L0TFuGw.js +0 -1
- package/dist/chunks/envLessBridgeConfig-CN0_44-p.js +0 -1
- package/dist/chunks/envLessBridgeConfig-Ck2-KMq0.js +0 -1
- package/dist/chunks/esm-D5q6s4l8.js +0 -1
- package/dist/chunks/exit-Bm1S_f3i.js +0 -1
- package/dist/chunks/extra-usage-UHAWtypK.js +0 -1
- package/dist/chunks/extra-usage-core-BFOolqoi.js +0 -1
- package/dist/chunks/extra-usage-noninteractive-cUGZy0en.js +0 -1
- package/dist/chunks/extra-usage-zDHVtWKZ.js +0 -1
- package/dist/chunks/extraUsage-Dq66zzqR.js +0 -1
- package/dist/chunks/extractMemories-BcaklA33.js +0 -1
- package/dist/chunks/fast-DALAHO3d.js +0 -1
- package/dist/chunks/fast-MS7WZpD8.js +0 -1
- package/dist/chunks/feedback-Fw4m28ZC.js +0 -1
- package/dist/chunks/file-DcZWPH2V.js +0 -12
- package/dist/chunks/fileStateCache-DDW5toIs.js +0 -1
- package/dist/chunks/files-Cz1-PK3r.js +0 -2
- package/dist/chunks/firstPartyEventLogger-CS9jVz6D.js +0 -1
- package/dist/chunks/firstPartyEventLogger-CoSUd0a1.js +0 -5
- package/dist/chunks/flushGate-De-yppeo.js +0 -1
- package/dist/chunks/gemini-BPziscyN.js +0 -1
- package/dist/chunks/generateSessionName-hDJ6HBJ1.js +0 -1
- package/dist/chunks/git-CbcnOf0E.js +0 -1
- package/dist/chunks/git-Do0wJvux.js +0 -6
- package/dist/chunks/githubRepoPathMapping-qAoiyj6P.js +0 -1
- package/dist/chunks/grok-Byblph7F.js +0 -1
- package/dist/chunks/grove-CpqjcGCb.js +0 -7
- package/dist/chunks/heapdump-C4kPlqGt.js +0 -5
- package/dist/chunks/help-B1h-faJ3.js +0 -1
- package/dist/chunks/hooks-DPLIIpAD.js +0 -1
- package/dist/chunks/hostGuard-BHI6Q8Mt.js +0 -1
- package/dist/chunks/inboundAttachments-BekVc0W-.js +0 -1
- package/dist/chunks/inboundAttachments-CUJE3KaU.js +0 -1
- package/dist/chunks/index.min-D75yiGLN.js +0 -1
- package/dist/chunks/initReplBridge-JQ-afRx9.js +0 -1
- package/dist/chunks/keybindings-BLw5J-Zj.js +0 -2
- package/dist/chunks/language-Cqw5gYJR.js +0 -1
- package/dist/chunks/launchAgentsPlatform-jWWf-Lk9.js +0 -1
- package/dist/chunks/launchCommand-1qkTCKpf.js +0 -1
- package/dist/chunks/launchLocalMemory-kHeD0I0y.js +0 -3
- package/dist/chunks/launchLocalVault-DLqkOjmb.js +0 -3
- package/dist/chunks/launchMemoryStores-Ct7AVXrO.js +0 -1
- package/dist/chunks/launchSchedule-ZyvuvjgU.js +0 -1
- package/dist/chunks/launchSkillStore-BejQnLog.js +0 -1
- package/dist/chunks/launchTeleport-8CuYUfIR.js +0 -3
- package/dist/chunks/launchVault-DIvIOuPh.js +0 -1
- package/dist/chunks/loadAgentsDir-TZjwTqdr.js +0 -1
- package/dist/chunks/loadPluginHooks-Ddhsyn0_.js +0 -1
- package/dist/chunks/localSearch-DrOAL6f4.js +0 -1
- package/dist/chunks/log-BMCygSzM.js +0 -1
- package/dist/chunks/logoV2Utils-8M56V7oN.js +0 -1
- package/dist/chunks/mcp-Bt1ITh-Z.js +0 -1
- package/dist/chunks/mcp-CwJ-AIpt.js +0 -6
- package/dist/chunks/mcp-W0LFoyFR.js +0 -2
- package/dist/chunks/memoize-B0zhbT8Z.js +0 -1
- package/dist/chunks/memory-3wV7m7UU.js +0 -1
- package/dist/chunks/model-CKkOnnnx.js +0 -1
- package/dist/chunks/model-DRXcJyU9.js +0 -1
- package/dist/chunks/nativeInstaller-CA5d6_G7.js +0 -1
- package/dist/chunks/observationStore-DzCdXq8U.js +0 -4
- package/dist/chunks/onChangeAppState-DBmy2Ow_.js +0 -1
- package/dist/chunks/openai-Cbomn0Ws.js +0 -10
- package/dist/chunks/output-style-BM3qAHLA.js +0 -1
- package/dist/chunks/overageCreditGrant-DsUrmeBh.js +0 -1
- package/dist/chunks/panel-Be-OxtqL.js +0 -1
- package/dist/chunks/parser-Bf6iasPV.js +0 -1
- package/dist/chunks/partition-BAakXjvj.js +0 -1
- package/dist/chunks/passes-CLRt7Cvm.js +0 -1
- package/dist/chunks/permissions-BVSFuwNP.js +0 -3
- package/dist/chunks/permissions-CeYKbtSC.js +0 -1
- package/dist/chunks/permissions-Cn_6f8CB.js +0 -1
- package/dist/chunks/plugin-Bfjzhmrk.js +0 -1
- package/dist/chunks/pluginAutoupdate-reO2PgtQ.js +0 -1
- package/dist/chunks/pluginCliCommands-lqdxdkQp.js +0 -1
- package/dist/chunks/pluginFlagging-D9HKAGBC.js +0 -1
- package/dist/chunks/pluginOperations-EN3EKLux.js +0 -2
- package/dist/chunks/pluginStartupCheck-BY73BMT2.js +0 -1
- package/dist/chunks/pluginStartupCheck-CwWOlveD.js +0 -1
- package/dist/chunks/policyLimits-CkTI5KEt.js +0 -1
- package/dist/chunks/pollConfig-DH2oCtFS.js +0 -1
- package/dist/chunks/poor-j-y-bv8o.js +0 -1
- package/dist/chunks/poorMode-V11s-3cf.js +0 -1
- package/dist/chunks/print-Db_VXmfO.js +0 -23
- package/dist/chunks/privacy-settings-DHMJREbb.js +0 -1
- package/dist/chunks/processBashCommand-BcM_fhV9.js +0 -1
- package/dist/chunks/processSlashCommand-DEVo3GPX.js +0 -5
- package/dist/chunks/prompt-BNHtszmZ.js +0 -139
- package/dist/chunks/prompt-CrX31AGm.js +0 -1
- package/dist/chunks/prompt-IAvMxKDl.js +0 -1
- package/dist/chunks/rate-limit-options-DIudL9fb.js +0 -1
- package/dist/chunks/rcDebugLog-CUy1_F23.js +0 -11
- package/dist/chunks/reconciler-BXpPyfSY.js +0 -4
- package/dist/chunks/referral-CUaIo_vT.js +0 -1
- package/dist/chunks/refresh-CuaVBIQ0.js +0 -1
- package/dist/chunks/registerProtocol-B7Fzdofu.js +0 -36
- package/dist/chunks/release-notes-fbfv2DC0.js +0 -4
- package/dist/chunks/releaseNotes-CxAHFLPl.js +0 -2
- package/dist/chunks/remote-env-BOklGlll.js +0 -1
- package/dist/chunks/remoteBridgeCore-j0bG1zjv.js +0 -1
- package/dist/chunks/remoteManagedSettings-Cq994lyc.js +0 -1
- package/dist/chunks/rename-Iev7wQsI.js +0 -1
- package/dist/chunks/ripgrep-BfIpz5uC.js +0 -1
- package/dist/chunks/runtimeObserver-CyzLASla.js +0 -10
- package/dist/chunks/sandbox-adapter-Cu1FYrkh.js +0 -1
- package/dist/chunks/sandbox-toggle-CWpBO228.js +0 -1
- package/dist/chunks/sanitization-DV-94a9Z.js +0 -1
- package/dist/chunks/searchExtraTools-BUOUds7p.js +0 -1
- package/dist/chunks/semver-BMRJYn3q.js +0 -1
- package/dist/chunks/session-DL4cA_8l.js +0 -2
- package/dist/chunks/sessionDiscovery-DAfNKqp1.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-2cgIIxPk.js +0 -1
- package/dist/chunks/sessionMemory-BS8_TbKj.js +0 -1
- package/dist/chunks/sessionMemory-D5fSHXvZ.js +0 -1
- package/dist/chunks/sessionMemoryUtils-BWUztNh6.js +0 -1
- package/dist/chunks/sessionObserver-ChfQtK2m.js +0 -1
- package/dist/chunks/sessionObserver-ShbCwJ8x.js +0 -20
- package/dist/chunks/sessionStorage-Cf5wmnyB.js +0 -1
- package/dist/chunks/sessionTracing-D9rUyiq0.js +0 -11
- package/dist/chunks/settings-BovzmwMP.js +0 -19
- package/dist/chunks/settingsSync-PqU9XGJq.js +0 -1
- package/dist/chunks/setup-B_FOvNpp.js +0 -3
- package/dist/chunks/sinks-BpcRrN_T.js +0 -1
- package/dist/chunks/skill-learning-B5tmc7EX.js +0 -5
- package/dist/chunks/skillChangeDetector-DNqohXxz.js +0 -1
- package/dist/chunks/skillGapStore-D-kQKVDZ.js +0 -1
- package/dist/chunks/skillGapStore-Df5BWAk5.js +0 -5
- package/dist/chunks/skillGenerator-DbcdpAkw.js +0 -8
- package/dist/chunks/skillLearning-C5cXZE6_.js +0 -1
- package/dist/chunks/skillLearning-ClRiDcJH.js +0 -1
- package/dist/chunks/skillPanel-LBd4E-MM.js +0 -28
- package/dist/chunks/slashCommandParsing-RQb_7Xzt.js +0 -1
- package/dist/chunks/startupProfiler-DIWVcO4e.js +0 -1
- package/dist/chunks/startupProfiler-xa3NmN7Z.js +0 -3
- package/dist/chunks/state-BOa-3Av3.js +0 -1
- package/dist/chunks/statusNoticeHelpers-CzTuGNuC.js +0 -1
- package/dist/chunks/stickers-D5teCKMN.js +0 -1
- package/dist/chunks/systemPromptSections-CR_AoPIX.js +0 -1
- package/dist/chunks/systemPromptSections-DN0HGVye.js +0 -1
- package/dist/chunks/tag-B-wVW9Aj.js +0 -11
- package/dist/chunks/teleport-dtqQXM4x.js +0 -1
- package/dist/chunks/terminalSetup-CuV-qU6v.js +0 -33
- package/dist/chunks/thinkback-Catprqs_.js +0 -1
- package/dist/chunks/thinkback-DI2NpvG-.js +0 -1
- package/dist/chunks/thinkback-play-CqrIRx2o.js +0 -1
- package/dist/chunks/toolEventObserver-DlH73w-S.js +0 -1
- package/dist/chunks/toolPool-B64V-jmK.js +0 -1
- package/dist/chunks/trustedDevice-CiwjT_Y6.js +0 -1
- package/dist/chunks/tui-C2yuCuOU.js +0 -6
- package/dist/chunks/types-Bh9S_JG5.js +0 -3
- package/dist/chunks/types-DHkZVzJe.js +0 -1
- package/dist/chunks/ultrareviewCommand-BDFUS3hf.js +0 -3
- package/dist/chunks/undercover-XYapZ_SS.js +0 -1
- package/dist/chunks/undercover-vuTpCnQJ.js +0 -31
- package/dist/chunks/upgrade-D5qwcaWQ.js +0 -1
- package/dist/chunks/upgrade-DIg3j929.js +0 -1
- package/dist/chunks/upload-B_yADHX9.js +0 -1
- package/dist/chunks/usage-C0SnnC-i.js +0 -1
- package/dist/chunks/usage-CYJKE8N6.js +0 -1
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-DKIqRraH.js +0 -1
- package/dist/chunks/useMainLoopModel-XetDUXd-.js +0 -1
- package/dist/chunks/useManagePlugins-B2KhKiu5.js +0 -1
- package/dist/chunks/useMergedTools-CKvwz_Zt.js +0 -1
- package/dist/chunks/useSettingsErrors-B7BXHchG.js +0 -1
- package/dist/chunks/validatePlugin-DtiYlXby.js +0 -1
- package/dist/chunks/windowsPaths-9pEkw0oV.js +0 -1
- package/dist/chunks/workerRegistry-ChqPPIaO.js +0 -1
- package/dist/chunks/worktree-DAn8ooa1.js +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{A as n,C as r,M as i,O as a,b as o,f as s,g as c,j as l,l as u,m as d,p as f,u as ee,w as p,y as m}from"./external-CEp-aPkt.js";import{i as h,n as g,r as _,t as v}from"./lazySchema-B4D4qJVE.js";import{$t as te,tt as y}from"./state-C2OSZkV1.js";import{Ch as ne,Dn as re,En as ie,F_ as b,G as ae,Gt as oe,L_ as x,M_ as S,On as se,Tn as ce,W as le,Yo as ue,Zo as de,_w as fe,gw as pe,ll as me,ns as he,ts as ge,ul as _e,wh as ve,yn as ye}from"./loadAgentsDir-ByO8eJqU.js";import{C as be,D as xe,F as Se,S as C,a as w,l as T,w as E,z as Ce}from"./debug-RZ4NuXyS.js";import{Cn as we,On as Te,vt as Ee,yt as De}from"./settings-hQDLwPVj.js";import{n as Oe,o as ke}from"./process-gEbdy6uY.js";import{O as Ae,k as je,m as Me,n as Ne}from"./git-BerW9bId.js";import{o as Pe,s as Fe}from"./log-CZ0zYP_c.js";import{ar as Ie,ir as Le}from"./model-CwO-g1RW.js";import{n as Re,o as ze}from"./sessionState-CjNY991n.js";import{t as Be}from"./controlMessageCompat-IFu4Gc1y.js";import{isAbsolute as Ve,resolve as He}from"path";import{randomUUID as D}from"crypto";_(),v();var O=g(()=>p({inputTokens:r(),outputTokens:r(),cacheReadInputTokens:r(),cacheCreationInputTokens:r(),webSearchRequests:r(),costUSD:r(),contextWindow:r(),maxOutputTokens:r()})),Ue=g(()=>o(`json_schema`));g(()=>p({type:Ue()}));var We=g(()=>p({type:o(`json_schema`),schema:a(n(),i())}));g(()=>We());var Ge=g(()=>u([`user`,`project`,`org`,`temporary`,`oauth`]));g(()=>u([`local`,`user`,`project`]).describe(`Config scope for settings.`)),g(()=>o(`context-1m-2025-08-07`));var Ke=g(()=>p({type:o(`adaptive`)}).describe(`Claude decides when and how much to think (Opus 4.6+).`)),qe=g(()=>p({type:o(`enabled`),budgetTokens:r().optional()}).describe(`Fixed thinking token budget (older models)`)),Je=g(()=>p({type:o(`disabled`)}).describe(`No extended thinking`));g(()=>l([Ke(),qe(),Je()]).describe(`Controls Claude's thinking/reasoning behavior. When set, takes precedence over the deprecated maxThinkingTokens.`));var Ye=g(()=>p({type:o(`stdio`).optional(),command:n(),args:f(n()).optional(),env:a(n(),n()).optional()})),Xe=g(()=>p({type:o(`sse`),url:n(),headers:a(n(),n()).optional()})),Ze=g(()=>p({type:o(`http`),url:n(),headers:a(n(),n()).optional()})),Qe=g(()=>p({type:o(`sdk`),name:n()})),k=g(()=>l([Ye(),Xe(),Ze(),Qe()])),$e=g(()=>p({type:o(`claudeai-proxy`),url:n(),id:n()})),et=g(()=>l([k(),$e()])),A=g(()=>p({name:n().describe(`Server name as configured`),status:u([`connected`,`failed`,`needs-auth`,`pending`,`disabled`]).describe(`Current connection status`),serverInfo:p({name:n(),version:n()}).optional().describe(`Server information (available when connected)`),error:n().optional().describe(`Error message (available when status is 'failed')`),config:et().optional().describe(`Server configuration (includes URL for HTTP/SSE servers)`),scope:n().optional().describe(`Configuration scope (e.g., project, user, local, claudeai, managed)`),tools:f(p({name:n(),description:n().optional(),annotations:p({readOnly:d().optional(),destructive:d().optional(),openWorld:d().optional()}).optional()})).optional().describe(`Tools provided by this server (available when connected)`),capabilities:p({experimental:a(n(),i()).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.`));g(()=>p({added:f(n()).describe(`Names of servers that were added`),removed:f(n()).describe(`Names of servers that were removed`),errors:a(n(),n()).describe(`Map of server names to error messages for servers that failed to connect`)}).describe(`Result of a setMcpServers operation.`));var j=g(()=>u([`userSettings`,`projectSettings`,`localSettings`,`session`,`cliArg`])),M=g(()=>u([`allow`,`deny`,`ask`])),N=g(()=>p({toolName:n(),ruleContent:n().optional()})),P=g(()=>c(`type`,[p({type:o(`addRules`),rules:f(N()),behavior:M(),destination:j()}),p({type:o(`replaceRules`),rules:f(N()),behavior:M(),destination:j()}),p({type:o(`removeRules`),rules:f(N()),behavior:M(),destination:j()}),p({type:o(`setMode`),mode:m(()=>I()),destination:j()}),p({type:o(`addDirectories`),directories:f(n()),destination:j()}),p({type:o(`removeDirectories`),directories:f(n()),destination:j()})])),F=g(()=>u([`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).`));g(()=>l([p({behavior:o(`allow`),updatedInput:a(n(),i()).optional(),updatedPermissions:f(P()).optional(),toolUseID:n().optional(),decisionClassification:F().optional()}),p({behavior:o(`deny`),message:n(),interrupt:d().optional(),toolUseID:n().optional(),decisionClassification:F().optional()})]));var I=g(()=>u([`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).`)),tt=`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(`.`),nt=g(()=>u(tt)),L=g(()=>p({session_id:n(),transcript_path:n(),cwd:n(),permission_mode:n().optional(),agent_id:n().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:n().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).`)})),rt=g(()=>L().and(p({hook_event_name:o(`PreToolUse`),tool_name:n(),tool_input:i(),tool_use_id:n()}))),it=g(()=>L().and(p({hook_event_name:o(`PermissionRequest`),tool_name:n(),tool_input:i(),permission_suggestions:f(P()).optional()}))),at=g(()=>L().and(p({hook_event_name:o(`PostToolUse`),tool_name:n(),tool_input:i(),tool_response:i(),tool_use_id:n()}))),ot=g(()=>L().and(p({hook_event_name:o(`PostToolUseFailure`),tool_name:n(),tool_input:i(),tool_use_id:n(),error:n(),is_interrupt:d().optional()}))),st=g(()=>L().and(p({hook_event_name:o(`PermissionDenied`),tool_name:n(),tool_input:i(),tool_use_id:n(),reason:n()}))),ct=g(()=>L().and(p({hook_event_name:o(`Notification`),message:n(),title:n().optional(),notification_type:n()}))),lt=g(()=>L().and(p({hook_event_name:o(`UserPromptSubmit`),prompt:n()}))),ut=g(()=>L().and(p({hook_event_name:o(`SessionStart`),source:u([`startup`,`resume`,`clear`,`compact`]),agent_type:n().optional(),model:n().optional()}))),dt=g(()=>L().and(p({hook_event_name:o(`Setup`),trigger:u([`init`,`maintenance`])}))),ft=g(()=>L().and(p({hook_event_name:o(`Stop`),stop_hook_active:d(),last_assistant_message:n().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),pt=g(()=>L().and(p({hook_event_name:o(`StopFailure`),error:H(),error_details:n().optional(),last_assistant_message:n().optional()}))),mt=g(()=>L().and(p({hook_event_name:o(`SubagentStart`),agent_id:n(),agent_type:n()}))),ht=g(()=>L().and(p({hook_event_name:o(`SubagentStop`),stop_hook_active:d(),agent_id:n(),agent_transcript_path:n(),agent_type:n(),last_assistant_message:n().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),gt=g(()=>L().and(p({hook_event_name:o(`PreCompact`),trigger:u([`manual`,`auto`]),custom_instructions:n().nullable()}))),_t=g(()=>L().and(p({hook_event_name:o(`PostCompact`),trigger:u([`manual`,`auto`]),compact_summary:n().describe(`The conversation summary produced by compaction`)}))),vt=g(()=>L().and(p({hook_event_name:o(`TeammateIdle`),teammate_name:n(),team_name:n()}))),yt=g(()=>L().and(p({hook_event_name:o(`TaskCreated`),task_id:n(),task_subject:n(),task_description:n().optional(),teammate_name:n().optional(),team_name:n().optional()}))),bt=g(()=>L().and(p({hook_event_name:o(`TaskCompleted`),task_id:n(),task_subject:n(),task_description:n().optional(),teammate_name:n().optional(),team_name:n().optional()}))),xt=g(()=>L().and(p({hook_event_name:o(`Elicitation`),mcp_server_name:n(),message:n(),mode:u([`form`,`url`]).optional(),url:n().optional(),elicitation_id:n().optional(),requested_schema:a(n(),i()).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.`)),St=g(()=>L().and(p({hook_event_name:o(`ElicitationResult`),mcp_server_name:n(),elicitation_id:n().optional(),mode:u([`form`,`url`]).optional(),action:u([`accept`,`decline`,`cancel`]),content:a(n(),i()).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.`)),Ct=[`user_settings`,`project_settings`,`local_settings`,`policy_settings`,`skills`],wt=g(()=>L().and(p({hook_event_name:o(`ConfigChange`),source:u(Ct),file_path:n().optional()}))),Tt=[`session_start`,`nested_traversal`,`path_glob_match`,`include`,`compact`],Et=[`User`,`Project`,`Local`,`Managed`],Dt=g(()=>L().and(p({hook_event_name:o(`InstructionsLoaded`),file_path:n(),memory_type:u(Et),load_reason:u(Tt),globs:f(n()).optional(),trigger_file_path:n().optional(),parent_file_path:n().optional()}))),Ot=g(()=>L().and(p({hook_event_name:o(`WorktreeCreate`),name:n()}))),kt=g(()=>L().and(p({hook_event_name:o(`WorktreeRemove`),worktree_path:n()}))),At=g(()=>L().and(p({hook_event_name:o(`CwdChanged`),old_cwd:n(),new_cwd:n()}))),jt=g(()=>L().and(p({hook_event_name:o(`FileChanged`),file_path:n(),event:u([`change`,`add`,`unlink`])}))),Mt=[`clear`,`resume`,`logout`,`prompt_input_exit`,`other`,`bypass_permissions_disabled`],Nt=g(()=>u(Mt)),Pt=g(()=>L().and(p({hook_event_name:o(`SessionEnd`),reason:Nt()}))),Ft=g(()=>l([rt(),at(),ot(),st(),ct(),lt(),ut(),Pt(),ft(),pt(),mt(),ht(),gt(),_t(),it(),dt(),vt(),yt(),bt(),xt(),St(),wt(),Dt(),Ot(),kt(),At(),jt()])),It=g(()=>p({async:o(!0),asyncTimeout:r().optional()})),Lt=g(()=>p({hookEventName:o(`PreToolUse`),permissionDecision:M().optional(),permissionDecisionReason:n().optional(),updatedInput:a(n(),i()).optional(),additionalContext:n().optional()})),Rt=g(()=>p({hookEventName:o(`UserPromptSubmit`),additionalContext:n().optional()})),zt=g(()=>p({hookEventName:o(`SessionStart`),additionalContext:n().optional(),initialUserMessage:n().optional(),watchPaths:f(n()).optional()})),Bt=g(()=>p({hookEventName:o(`Setup`),additionalContext:n().optional()})),Vt=g(()=>p({hookEventName:o(`SubagentStart`),additionalContext:n().optional()})),Ht=g(()=>p({hookEventName:o(`PostToolUse`),additionalContext:n().optional(),updatedMCPToolOutput:i().optional()})),Ut=g(()=>p({hookEventName:o(`PostToolUseFailure`),additionalContext:n().optional()})),Wt=g(()=>p({hookEventName:o(`PermissionDenied`),retry:d().optional()})),Gt=g(()=>p({hookEventName:o(`Notification`),additionalContext:n().optional()})),Kt=g(()=>p({hookEventName:o(`PermissionRequest`),decision:l([p({behavior:o(`allow`),updatedInput:a(n(),i()).optional(),updatedPermissions:f(P()).optional()}),p({behavior:o(`deny`),message:n().optional(),interrupt:d().optional()})])})),qt=g(()=>p({hookEventName:o(`CwdChanged`),watchPaths:f(n()).optional()})),Jt=g(()=>p({hookEventName:o(`FileChanged`),watchPaths:f(n()).optional()})),Yt=g(()=>p({continue:d().optional(),suppressOutput:d().optional(),stopReason:n().optional(),decision:u([`approve`,`block`]).optional(),systemMessage:n().optional(),reason:n().optional(),hookSpecificOutput:l([Lt(),Rt(),zt(),Bt(),Vt(),Ht(),Ut(),Wt(),Gt(),Kt(),Xt(),Zt(),qt(),Jt(),Qt()]).optional()})),Xt=g(()=>p({hookEventName:o(`Elicitation`),action:u([`accept`,`decline`,`cancel`]).optional(),content:a(n(),i()).optional()}).describe(`Hook-specific output for the Elicitation event. Return this to programmatically accept or decline an MCP elicitation request.`)),Zt=g(()=>p({hookEventName:o(`ElicitationResult`),action:u([`accept`,`decline`,`cancel`]).optional(),content:a(n(),i()).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.`)),Qt=g(()=>p({hookEventName:o(`WorktreeCreate`),worktreePath:n()}).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.`));g(()=>l([It(),Yt()]));var $t=g(()=>p({key:n().describe(`Unique key for this option, returned in the response`),label:n().describe(`Display text for this option`),description:n().optional().describe(`Optional description shown below the label`)}));g(()=>p({prompt:n().describe(`Request ID. Presence of this key marks the line as a prompt request.`),message:n().describe(`The prompt message to display to the user`),options:f($t()).describe(`Available options for the user to choose from`)})),g(()=>p({prompt_response:n().describe(`The request ID from the corresponding prompt request`),selected:n().describe(`The key of the selected option`)}));var R=g(()=>p({name:n().describe(`Skill name (without the leading slash)`),description:n().describe(`Description of what the skill does`),argumentHint:n().describe(`Hint for skill arguments (e.g., "<file>")`)}).describe(`Information about an available skill (invoked via /command syntax).`)),z=g(()=>p({name:n().describe(`Agent type identifier (e.g., "Explore")`),description:n().describe(`Description of when to use this agent`),model:n().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.`)),en=g(()=>p({value:n().describe(`Model identifier to use in API calls`),displayName:n().describe(`Human-readable display name`),description:n().describe(`Description of the model's capabilities`),supportsAdaptiveThinking:d().optional().describe(`Whether this model supports adaptive thinking (Claude decides when and how much to think)`),supportsFastMode:d().optional().describe(`Whether this model supports fast mode`),supportsAutoMode:d().optional().describe(`Whether this model supports auto mode`)}).describe(`Information about an available model.`)),tn=g(()=>p({email:n().optional(),organization:n().optional(),subscriptionType:n().optional(),tokenSource:n().optional(),apiKeySource:n().optional(),apiProvider:u([`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.`)),nn=g(()=>l([n(),a(n(),k())])),rn=g(()=>p({description:n().describe(`Natural language description of when to use this agent`),tools:f(n()).optional().describe(`Array of allowed tool names. If omitted, inherits all tools from parent`),disallowedTools:f(n()).optional().describe(`Array of tool names to explicitly disallow for this agent`),prompt:n().describe(`The agent's system prompt`),model:n().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:f(nn()).optional(),criticalSystemReminder_EXPERIMENTAL:n().optional().describe(`Experimental: Critical reminder added to system prompt`),skills:f(n()).optional().describe(`Array of skill names to preload into the agent context`),initialPrompt:n().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:r().int().positive().optional().describe(`Maximum number of agentic turns (API round-trips) before stopping`),background:d().optional().describe(`Run this agent as a background task (non-blocking, fire-and-forget) when invoked`),memory:u([`user`,`project`,`local`]).optional().describe(`Scope for auto-loading agent memory files. 'user' - ~/.claude/agent-memory/<agentType>/, 'project' - .claude/agent-memory/<agentType>/, 'local' - .claude/agent-memory-local/<agentType>/`),permissionMode:I().optional().describe(`Permission mode controlling how tool executions are handled`)}).describe(`Definition for a custom subagent that can be invoked via the Agent tool.`));g(()=>u([`user`,`project`,`local`]).describe(`Source for loading filesystem-based settings. 'user' - Global user settings (~/.claude/settings.json). 'project' - Project settings (.claude/settings.json). 'local' - Local settings (.claude/settings.local.json).`)),g(()=>p({type:o(`local`).describe(`Plugin type. Currently only 'local' is supported`),path:n().describe(`Absolute or relative path to the plugin directory`)}).describe(`Configuration for loading a plugin.`)),g(()=>p({canRewind:d(),error:n().optional(),filesChanged:f(n()).optional(),insertions:r().optional(),deletions:r().optional()}).describe(`Result of a rewindFiles operation.`));var an=g(()=>i()),on=g(()=>i()),sn=g(()=>i()),B=g(()=>n()),V=g(()=>i()),H=g(()=>u([`authentication_failed`,`billing_error`,`rate_limit`,`invalid_request`,`server_error`,`unknown`,`max_output_tokens`])),cn=g(()=>l([o(`compacting`),ee()])),U=g(()=>p({type:o(`user`),message:an(),parent_tool_use_id:n().nullable(),isSynthetic:d().optional(),tool_use_result:i().optional(),priority:u([`now`,`next`,`later`]).optional(),timestamp:n().optional().describe(`ISO timestamp when the message was created on the originating process. Older emitters omit it; consumers should fall back to receive time.`)})),W=g(()=>U().extend({uuid:B().optional(),session_id:n().optional()})),ln=g(()=>U().extend({uuid:B(),session_id:n(),isReplay:o(!0)})),un=g(()=>p({status:u([`allowed`,`allowed_warning`,`rejected`]),resetsAt:r().optional(),rateLimitType:u([`five_hour`,`seven_day`,`seven_day_opus`,`seven_day_sonnet`,`overage`]).optional(),utilization:r().optional(),overageStatus:u([`allowed`,`allowed_warning`,`rejected`]).optional(),overageResetsAt:r().optional(),overageDisabledReason:u([`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:d().optional(),surpassedThreshold:r().optional()}).describe(`Rate limit information for claude.ai subscription users.`)),dn=g(()=>p({type:o(`assistant`),message:on(),parent_tool_use_id:n().nullable(),error:H().optional(),uuid:B(),session_id:n()})),fn=g(()=>p({type:o(`rate_limit_event`),rate_limit_info:un(),uuid:B(),session_id:n()}).describe(`Rate limit event emitted when rate limit info changes.`)),pn=g(()=>p({type:o(`streamlined_text`),text:n().describe(`Text content preserved from the assistant message`),session_id:n(),uuid:B()}).describe(`@internal Streamlined text message - replaces SDKAssistantMessage in streamlined output. Text content preserved, thinking and tool_use blocks removed.`)),mn=g(()=>p({type:o(`streamlined_tool_use_summary`),tool_summary:n().describe(`Summary of tool calls (e.g., "Read 2 files, wrote 1 file")`),session_id:n(),uuid:B()}).describe(`@internal Streamlined tool use summary - replaces tool_use blocks in streamlined output with a cumulative summary string.`)),G=g(()=>p({tool_name:n(),tool_use_id:n(),tool_input:a(n(),i())})),hn=g(()=>p({type:o(`result`),subtype:o(`success`),duration_ms:r(),duration_api_ms:r(),is_error:d(),num_turns:r(),result:n(),stop_reason:n().nullable(),total_cost_usd:r(),usage:V(),modelUsage:a(n(),O()),permission_denials:f(G()),structured_output:i().optional(),fast_mode_state:K().optional(),uuid:B(),session_id:n()})),gn=g(()=>p({type:o(`result`),subtype:u([`error_during_execution`,`error_max_turns`,`error_max_budget_usd`,`error_max_structured_output_retries`]),duration_ms:r(),duration_api_ms:r(),is_error:d(),num_turns:r(),stop_reason:n().nullable(),total_cost_usd:r(),usage:V(),modelUsage:a(n(),O()),permission_denials:f(G()),errors:f(n()),fast_mode_state:K().optional(),uuid:B(),session_id:n()})),_n=g(()=>l([hn(),gn()])),vn=g(()=>p({type:o(`system`),subtype:o(`init`),agents:f(n()).optional(),apiKeySource:Ge(),betas:f(n()).optional(),claude_code_version:n(),cwd:n(),tools:f(n()),mcp_servers:f(p({name:n(),status:n()})),model:n(),permissionMode:I(),slash_commands:f(n()),output_style:n(),skills:f(n()),plugins:f(p({name:n(),path:n(),source:n().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:K().optional(),uuid:B(),session_id:n()})),yn=g(()=>p({type:o(`stream_event`),event:sn(),parent_tool_use_id:n().nullable(),uuid:B(),session_id:n()})),bn=g(()=>p({type:o(`system`),subtype:o(`compact_boundary`),compact_metadata:p({trigger:u([`manual`,`auto`]),pre_tokens:r(),preserved_segment:p({head_uuid:B(),anchor_uuid:B(),tail_uuid:B()}).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:B(),session_id:n()})),xn=g(()=>p({type:o(`system`),subtype:o(`status`),status:cn(),permissionMode:I().optional(),uuid:B(),session_id:n()})),Sn=g(()=>p({type:o(`system`),subtype:o(`post_turn_summary`),summarizes_uuid:n(),status_category:u([`blocked`,`waiting`,`completed`,`review_ready`,`failed`]),status_detail:n(),is_noteworthy:d(),title:n(),description:n(),recent_action:n(),needs_action:n(),artifact_urls:f(n()),uuid:B(),session_id:n()}).describe(`@internal Background post-turn summary emitted after each assistant turn. summarizes_uuid points to the assistant message this summarizes.`)),Cn=g(()=>p({type:o(`system`),subtype:o(`api_retry`),attempt:r(),max_retries:r(),retry_delay_ms:r(),error_status:r().nullable(),error:H(),uuid:B(),session_id:n()}).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.`)),wn=g(()=>p({type:o(`system`),subtype:o(`local_command_output`),content:n(),uuid:B(),session_id:n()}).describe(`Output from a local slash command (e.g. /voice, /cost). Displayed as assistant-style text in the transcript.`)),Tn=g(()=>p({type:o(`system`),subtype:o(`hook_started`),hook_id:n(),hook_name:n(),hook_event:n(),uuid:B(),session_id:n()})),En=g(()=>p({type:o(`system`),subtype:o(`hook_progress`),hook_id:n(),hook_name:n(),hook_event:n(),stdout:n(),stderr:n(),output:n(),uuid:B(),session_id:n()})),Dn=g(()=>p({type:o(`system`),subtype:o(`hook_response`),hook_id:n(),hook_name:n(),hook_event:n(),output:n(),stdout:n(),stderr:n(),exit_code:r().optional(),outcome:u([`success`,`error`,`cancelled`]),uuid:B(),session_id:n()})),On=g(()=>p({type:o(`tool_progress`),tool_use_id:n(),tool_name:n(),parent_tool_use_id:n().nullable(),elapsed_time_seconds:r(),task_id:n().optional(),uuid:B(),session_id:n()})),kn=g(()=>p({type:o(`auth_status`),isAuthenticating:d(),output:f(n()),error:n().optional(),uuid:B(),session_id:n()})),An=g(()=>p({type:o(`system`),subtype:o(`files_persisted`),files:f(p({filename:n(),file_id:n()})),failed:f(p({filename:n(),error:n()})),processed_at:n(),uuid:B(),session_id:n()})),jn=g(()=>p({type:o(`system`),subtype:o(`task_notification`),task_id:n(),tool_use_id:n().optional(),status:u([`completed`,`failed`,`stopped`]),output_file:n(),summary:n(),usage:p({total_tokens:r(),tool_uses:r(),duration_ms:r()}).optional(),uuid:B(),session_id:n()})),Mn=g(()=>p({type:o(`system`),subtype:o(`task_started`),task_id:n(),tool_use_id:n().optional(),description:n(),task_type:n().optional(),workflow_name:n().optional().describe(`meta.name from the workflow script (e.g. 'spec'). Only set when task_type is 'local_workflow'.`),prompt:n().optional(),uuid:B(),session_id:n()})),Nn=g(()=>p({type:o(`system`),subtype:o(`session_state_changed`),state:u([`idle`,`running`,`requires_action`]),uuid:B(),session_id:n()}).describe(`Mirrors notifySessionStateChanged. 'idle' fires after heldBackResult flushes and the bg-agent do-while exits — authoritative turn-over signal.`)),Pn=g(()=>p({type:o(`system`),subtype:o(`task_progress`),task_id:n(),tool_use_id:n().optional(),description:n(),usage:p({total_tokens:r(),tool_uses:r(),duration_ms:r()}),last_tool_name:n().optional(),summary:n().optional(),uuid:B(),session_id:n()})),Fn=g(()=>p({type:o(`tool_use_summary`),summary:n(),preceding_tool_use_ids:f(n()),uuid:B(),session_id:n()})),In=g(()=>p({type:o(`system`),subtype:o(`elicitation_complete`),mcp_server_name:n(),elicitation_id:n(),uuid:B(),session_id:n()}).describe(`Emitted when an MCP server confirms that a URL-mode elicitation is complete.`)),Ln=g(()=>p({type:o(`prompt_suggestion`),suggestion:n(),uuid:B(),session_id:n()}).describe(`Predicted next user prompt, emitted after each turn when promptSuggestions is enabled.`));g(()=>p({sessionId:n().describe(`Unique session identifier (UUID).`),summary:n().describe(`Display title for the session: custom title, auto-generated summary, or first prompt.`),lastModified:r().describe(`Last modified time in milliseconds since epoch.`),fileSize:r().optional().describe(`File size in bytes. Only populated for local JSONL storage.`),customTitle:n().optional().describe(`User-set session title via /rename.`),firstPrompt:n().optional().describe(`First meaningful user prompt in the session.`),gitBranch:n().optional().describe(`Git branch at the end of the session.`),cwd:n().optional().describe(`Working directory for the session.`),tag:n().optional().describe(`User-set session tag.`),createdAt:r().optional().describe(`Creation time in milliseconds since epoch, extracted from the first entry's timestamp.`)}).describe(`Session metadata returned by listSessions and getSessionInfo.`));var Rn=g(()=>l([dn(),W(),ln(),_n(),vn(),yn(),bn(),xn(),Cn(),wn(),Tn(),En(),Dn(),On(),kn(),jn(),Mn(),Pn(),Nn(),An(),Fn(),fn(),In(),Ln()])),K=g(()=>u([`off`,`cooldown`,`on`]).describe(`Fast mode state: off, in cooldown after rate limit, or actively enabled.`));_(),v();var zn=g(()=>i()),Bn=g(()=>p({matcher:n().optional(),hookCallbackIds:f(n()),timeout:r().optional()}).describe(`Configuration for matching and routing hook callbacks.`)),Vn=g(()=>p({subtype:o(`initialize`),hooks:a(nt(),f(Bn())).optional(),sdkMcpServers:f(n()).optional(),jsonSchema:a(n(),i()).optional(),systemPrompt:n().optional(),appendSystemPrompt:n().optional(),agents:a(n(),rn()).optional(),promptSuggestions:d().optional(),agentProgressSummaries:d().optional()}).describe(`Initializes the SDK session with hooks, MCP servers, and agent configuration.`));g(()=>p({commands:f(R()),agents:f(z()),output_style:n(),available_output_styles:f(n()),models:f(en()),account:tn(),pid:r().optional().describe(`@internal CLI process PID for tmux socket isolation`),fast_mode_state:K().optional()}).describe(`Response from session initialization with available commands, models, and account info.`));var Hn=g(()=>p({subtype:o(`interrupt`)}).describe(`Interrupts the currently running conversation turn.`)),Un=g(()=>p({subtype:o(`can_use_tool`),tool_name:n(),input:a(n(),i()),permission_suggestions:f(P()).optional(),blocked_path:n().optional(),decision_reason:n().optional(),title:n().optional(),display_name:n().optional(),tool_use_id:n(),agent_id:n().optional(),description:n().optional()}).describe(`Requests permission to use a tool with the given input.`)),Wn=g(()=>p({subtype:o(`set_permission_mode`),mode:I()}).describe(`Sets the permission mode for tool execution handling.`)),Gn=g(()=>p({subtype:o(`set_model`),model:n().optional()}).describe(`Sets the model to use for subsequent conversation turns.`)),Kn=g(()=>p({subtype:o(`set_max_thinking_tokens`),max_thinking_tokens:r().nullable()}).describe(`Sets the maximum number of thinking tokens for extended thinking.`)),qn=g(()=>p({subtype:o(`mcp_status`)}).describe(`Requests the current status of all MCP server connections.`));g(()=>p({mcpServers:f(A())}).describe(`Response containing the current status of all MCP server connections.`));var Jn=g(()=>p({subtype:o(`get_context_usage`)}).describe(`Requests a breakdown of current context window usage by category.`)),Yn=g(()=>p({name:n(),tokens:r(),color:n(),isDeferred:d().optional()})),Xn=g(()=>p({color:n(),isFilled:d(),categoryName:n(),tokens:r(),percentage:r(),squareFullness:r()}));g(()=>p({categories:f(Yn()),totalTokens:r(),maxTokens:r(),rawMaxTokens:r(),percentage:r(),gridRows:f(f(Xn())),model:n(),memoryFiles:f(p({path:n(),type:n(),tokens:r()})),mcpTools:f(p({name:n(),serverName:n(),tokens:r(),isLoaded:d().optional()})),deferredBuiltinTools:f(p({name:n(),tokens:r(),isLoaded:d()})).optional(),systemTools:f(p({name:n(),tokens:r()})).optional(),systemPromptSections:f(p({name:n(),tokens:r()})).optional(),agents:f(p({agentType:n(),source:n(),tokens:r()})),slashCommands:p({totalCommands:r(),includedCommands:r(),tokens:r()}).optional(),skills:p({totalSkills:r(),includedSkills:r(),tokens:r(),skillFrontmatter:f(p({name:n(),source:n(),tokens:r()}))}).optional(),autoCompactThreshold:r().optional(),isAutoCompactEnabled:d(),messageBreakdown:p({toolCallTokens:r(),toolResultTokens:r(),attachmentTokens:r(),assistantMessageTokens:r(),userMessageTokens:r(),toolCallsByType:f(p({name:n(),callTokens:r(),resultTokens:r()})),attachmentsByType:f(p({name:n(),tokens:r()}))}).optional(),apiUsage:p({input_tokens:r(),output_tokens:r(),cache_creation_input_tokens:r(),cache_read_input_tokens:r()}).nullable()}).describe(`Breakdown of current context window usage by category (system prompt, tools, messages, etc.).`));var Zn=g(()=>p({subtype:o(`rewind_files`),user_message_id:n(),dry_run:d().optional()}).describe(`Rewinds file changes made since a specific user message.`));g(()=>p({canRewind:d(),error:n().optional(),filesChanged:f(n()).optional(),insertions:r().optional(),deletions:r().optional()}).describe(`Result of a rewindFiles operation.`));var Qn=g(()=>p({subtype:o(`cancel_async_message`),message_uuid:n()}).describe(`Drops a pending async user message from the command queue by uuid. No-op if already dequeued for execution.`));g(()=>p({cancelled:d()}).describe(`Result of a cancel_async_message operation. cancelled=false means the message was not in the queue (already dequeued or never enqueued).`));var $n=g(()=>p({subtype:o(`seed_read_state`),path:n(),mtime:r()}).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.`)),er=g(()=>p({subtype:o(`hook_callback`),callback_id:n(),input:Ft(),tool_use_id:n().optional()}).describe(`Delivers a hook callback with its input data.`)),tr=g(()=>p({subtype:o(`mcp_message`),server_name:n(),message:zn()}).describe(`Sends a JSON-RPC message to a specific MCP server.`)),nr=g(()=>p({subtype:o(`mcp_set_servers`),servers:a(n(),k())}).describe(`Replaces the set of dynamically managed MCP servers.`));g(()=>p({added:f(n()),removed:f(n()),errors:a(n(),n())}).describe(`Result of replacing the set of dynamically managed MCP servers.`));var rr=g(()=>p({subtype:o(`reload_plugins`)}).describe(`Reloads plugins from disk and returns the refreshed session components.`));g(()=>p({commands:f(R()),agents:f(z()),plugins:f(p({name:n(),path:n(),source:n().optional()})),mcpServers:f(A()),error_count:r()}).describe(`Refreshed commands, agents, plugins, and MCP server status after reload.`));var ir=g(()=>p({subtype:o(`mcp_reconnect`),serverName:n()}).describe(`Reconnects a disconnected or failed MCP server.`)),ar=g(()=>p({subtype:o(`mcp_toggle`),serverName:n(),enabled:d()}).describe(`Enables or disables an MCP server.`)),or=g(()=>p({subtype:o(`stop_task`),task_id:n()}).describe(`Stops a running task.`)),sr=g(()=>p({subtype:o(`apply_flag_settings`),settings:a(n(),i())}).describe(`Merges the provided settings into the flag settings layer, updating the active configuration.`)),cr=g(()=>p({subtype:o(`get_settings`)}).describe(`Returns the effective merged settings and the raw per-source settings.`));g(()=>p({effective:a(n(),i()),sources:f(p({source:u([`userSettings`,`projectSettings`,`localSettings`,`flagSettings`,`policySettings`]),settings:a(n(),i())})).describe(`Ordered low-to-high priority — later entries override earlier ones.`),applied:p({model:n()}).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 lr=g(()=>p({subtype:o(`elicitation`),mcp_server_name:n(),message:n(),mode:u([`form`,`url`]).optional(),url:n().optional(),elicitation_id:n().optional(),requested_schema:a(n(),i()).optional()}).describe(`Requests the SDK consumer to handle an MCP elicitation (user input request).`)),ur=g(()=>p({action:u([`accept`,`decline`,`cancel`]),content:a(n(),i()).optional()}).describe(`Response from the SDK consumer for an elicitation request.`)),dr=g(()=>l([Hn(),Un(),Vn(),Wn(),Gn(),Kn(),qn(),Jn(),er(),tr(),Zn(),Qn(),$n(),nr(),rr(),ir(),ar(),or(),sr(),cr(),lr()])),q=g(()=>p({type:o(`control_request`),request_id:n(),request:dr()})),fr=g(()=>p({subtype:o(`success`),request_id:n(),response:a(n(),i()).optional()})),pr=g(()=>p({subtype:o(`error`),request_id:n(),error:n(),pending_permission_requests:f(m(()=>q())).optional()})),J=g(()=>p({type:o(`control_response`),response:l([fr(),pr()])})),mr=g(()=>p({type:o(`control_cancel_request`),request_id:n()}).describe(`Cancels a currently open control request.`)),Y=g(()=>p({type:o(`keep_alive`)}).describe(`Keep-alive message to maintain WebSocket connection.`)),hr=g(()=>p({type:o(`update_environment_variables`),variables:a(n(),n())}).describe(`Updates environment variables at runtime.`));g(()=>l([Rn(),pn(),mn(),Sn(),J(),q(),mr(),Y()])),g(()=>l([W(),q(),J(),Y(),hr()])),e(),te(),Ce(),C(),Oe(),Ae(),ie(),_(),w(),v(),b(),re(),g(()=>h.object({tool_name:h.string().describe(`The name of the tool requesting permission`),input:h.record(h.string(),h.unknown()).describe(`The input for the tool`),tool_use_id:h.string().optional().describe(`The unique tool use request ID`)}));var X=g(()=>h.enum([`user_temporary`,`user_permanent`,`user_reject`]).optional().catch(void 0)),gr=g(()=>h.object({behavior:h.literal(`allow`),updatedInput:h.record(h.string(),h.unknown()),updatedPermissions:h.array(se()).optional().catch(e=>{T(`Malformed updatedPermissions from SDK host ignored: ${e.error.issues[0]?.message??`unknown`}`,{level:`warn`})}),toolUseID:h.string().optional(),decisionClassification:X()})),_r=g(()=>h.object({behavior:h.literal(`deny`),message:h.string(),interrupt:h.boolean().optional(),toolUseID:h.string().optional(),decisionClassification:X()})),Z=g(()=>h.union([gr(),_r()]));function Q(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:S(e.toolPermissionContext,t)})),x(t));let a=Object.keys(e.updatedInput).length>0?e.updatedInput:n;return{...e,updatedInput:a,decisionReason:i}}else e.behavior===`deny`&&e.interrupt&&(T(`SDK permission prompt deny+interrupt: tool=${t.name} message=${e.message}`),r.abortController.abort());return{...e,decisionReason:i}}Pe(),we(),Ee(),ne(),Re(),_e(),ye(),ae();var vr=/\u2028|\u2029/g;function yr(e){return e.replace(vr,e=>e===`\u2028`?`\\u2028`:`\\u2029`)}function $(e){return yr(E(e))}w(),C(),_(),b();var br=`SandboxNetworkAccess`;function xr(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 Sr(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 Cr=1e3,wr=class{constructor(e,n){t(this,`input`,void 0),t(this,`replayUserMessages`,void 0),t(this,`structuredInput`,void 0),t(this,`pendingRequests`,new Map),t(this,`restoredWorkerState`,Promise.resolve(null)),t(this,`inputClosed`,!1),t(this,`unexpectedResponseCallback`,void 0),t(this,`resolvedToolUseIds`,new Set),t(this,`prependedLines`,[]),t(this,`onControlRequestSent`,void 0),t(this,`onControlRequestResolved`,void 0),t(this,`outbound`,new me),this.input=e,this.replayUserMessages=n,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>Cr)){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(E({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})+`
|
|
2
|
+
`)}async*read(){let e=``,t=async function*(){for(;;){this.prependedLines.length>0&&(e=this.prependedLines.join(``)+e,this.prependedLines=[]);let t=e.indexOf(`
|
|
3
|
+
`);if(t===-1)break;let n=e.slice(0,t);e=e.slice(t+1);let r=await this.processLine(n);r&&(je(`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=Be(be(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;T(`[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&&ve(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)){T(`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`){T(`Ignoring unknown message type: ${t.type}`,{level:`warn`});return}return t.type===`control_request`?(t.request||Tr(`Error: Missing request on control_request`),t):(t.type===`assistant`||t.type===`system`||t.message?.role!==`user`&&Tr(`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){ke($(e)+`
|
|
4
|
+
`)}async sendRequest(e,t,n,r=D()){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 xe))};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 le(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=Er(t.name,a,n,r,s.suggestions).then(e=>({source:`hook`,decision:e})),o=D();e?.(Sr(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:xr(s.decisionReason),tool_use_id:a,agent_id:r.agentId},Z(),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):Q((await l).result,t,n,r):Q(u.result,t,n,r)}catch(e){return Q({behavior:`deny`,message:`Tool permission request failed: ${e}`,toolUseID:a},t,n,r)}finally{this.getPendingPermissionRequests().length===0&&ze(`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},ce(),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},ur(),r)}catch{return{action:`cancel`}}}createSandboxAskCallback(){return async e=>{try{return(await this.sendRequest({subtype:`can_use_tool`,tool_name:br,input:{host:e.host},tool_use_id:D(),description:`Allow network connection to ${e.host}?`},Z())).behavior===`allow`}catch{return!1}}}async sendMcpMessage(e,t){return(await this.sendRequest({subtype:`mcp_message`,server_name:e,message:t},p({mcp_response:s()}))).mcp_response}};function Tr(e){console.error(e),process.exit(1)}async function Er(e,t,n,r,i){let a=r.getAppState().toolPermissionContext.mode,o=oe(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){x(i);let e=S(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`}}}}fe();function Dr(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)?Or(t):t,uuid:n}}function Or(e){return e.some(kr)?e.map(e=>{if(!kr(e))return e;let t=e.source,n=typeof t.mediaType==`string`&&t.mediaType?t.mediaType:pe(e.source.data);return{...e,source:{type:`base64`,media_type:n,data:e.source.data}}}):e}function kr(e){return e.type!==`image`||e.source?.type!==`base64`?!1:!e.source.media_type}Le(),w(),Ce(),Me(),ge();function Ar(e,t,n){let r=[],i=[],a=[];for(let[o,s]of Object.entries(e)){let e=t[o],c=Mr(s.source,n?.projectRoot);e?s.sourceIsFallback||Ie(c,e.source)?a.push(o):i.push({name:o,declaredSource:c,materializedSource:e.source}):r.push(o)}return{missing:r,sourceChanged:i,upToDate:a}}async function jr(e){let t=de();if(Object.keys(t).length===0)return{installed:[],updated:[],failed:[],upToDate:[],skipped:[]};let n;try{n=await he()}catch(e){Fe(e),n={}}let r=Ar(t,n,{projectRoot:y()}),i=[...r.missing.map(e=>({name:e,source:Mr(t[e].source),action:`install`})),...r.sourceChanged.map(({name:e,declaredSource:t})=>({name:e,source:t,action:`update`}))],a=[],o=[];for(let t of i){if(e?.skip?.(t.name,t.source)){a.push(t.name);continue}if(t.action===`update`&&De(t.source)&&!await Te(t.source.path)){T(`[reconcile] '${t.name}' declared path does not exist; keeping materialized entry`),a.push(t.name);continue}o.push(t)}if(o.length===0)return{installed:[],updated:[],failed:[],upToDate:r.upToDate,skipped:a};T(`[reconcile] ${o.length} marketplace(s): ${o.map(e=>`${e.name}(${e.action})`).join(`, `)}`);let s=[],c=[],l=[];for(let t=0;t<o.length;t++){let{name:n,source:r,action:i}=o[t];e?.onProgress?.({type:`installing`,name:n,action:i,index:t+1,total:o.length});try{let t=await ue(r);i===`install`?s.push(n):c.push(n),e?.onProgress?.({type:`installed`,name:n,alreadyMaterialized:t.alreadyMaterialized})}catch(t){let r=Se(t);l.push({name:n,error:r}),e?.onProgress?.({type:`failed`,name:n,error:r}),Fe(t)}}return{installed:s,updated:c,failed:l,upToDate:r.upToDate,skipped:a}}function Mr(e,t){if((e.source===`directory`||e.source===`file`)&&!Ve(e.path)){let n=t??y(),r=Ne(n);return{...e,path:He(r??n,e.path)}}return e}export{$ as a,wr as i,jr as n,Z as o,Dr as r,Q as s,Ar as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$t as t,tt as n}from"./state-C2OSZkV1.js";import{Cd as r,Cg as i,Cs as a,Do as o,Is as s,Ls as c,Oo as l,ew as u,fd as d,i as f,o as p,tw as m,ud as h,wd as g,wg as _,ws as v,xd as y,yd as b}from"./loadAgentsDir-ByO8eJqU.js";import{F as x,a as S,l as C,z as w}from"./debug-RZ4NuXyS.js";import{o as T,s as E}from"./log-CZ0zYP_c.js";async function D(e){C(`refreshActivePlugins: clearing all plugin caches`),a(),h();let t=await l(),[r,i]=await Promise.all([s(),f(n())]),{enabled:o,disabled:c,errors:u}=t,[d,p]=await Promise.all([Promise.all(o.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await m(e,u);return t&&(e.mcpServers=t),t?Object.keys(t).length:0})),Promise.all(o.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await g(e,u);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))]),v=d.reduce((e,t)=>e+t,0),b=p.reduce((e,t)=>e+t,0);e(e=>({...e,plugins:{...e.plugins,enabled:o,disabled:c,commands:r,errors:O(e.plugins.errors,u),needsRefresh:!1},agentDefinitions:i,mcp:{...e.mcp,pluginReconnectKey:e.mcp.pluginReconnectKey+1}})),y();let S=!1;try{await _()}catch(e){S=!0,E(e),C(`refreshActivePlugins: loadPluginHooks failed: ${x(e)}`)}let w=o.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return C(`refreshActivePlugins: ${o.length} enabled, ${r.length} commands, ${i.allAgents.length} agents, ${w} hooks, ${v} MCP, ${b} LSP`),{enabled_count:o.length,disabled_count:c.length,command_count:r.length,agent_count:i.allAgents.length,hook_count:w,mcp_count:v,lsp_count:b,error_count:u.length+ +!!S,agentDefinitions:i,pluginCommands:r}}function O(e,t){let n=e.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r=new Set(t.map(k));return[...n.filter(e=>!r.has(k(e))),...t]}function k(e){return e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`}var A=e((()=>{t(),b(),p(),S(),w(),T(),v(),c(),i(),r(),u(),d(),o()}));export{D as n,A as t};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{o as n}from"./envUtils-DSxRz_kt.js";import{I as r,a as i,l as a,z as o}from"./debug-RZ4NuXyS.js";import{g as s,n as c}from"./settings-hQDLwPVj.js";import{r as l,t as u}from"./execFileNoThrow-CCX-JY8h.js";import{n as d,t as f}from"./which-CHLNJmtJ.js";import{a as p,r as m,t as h}from"./xdg-DcF9ejUM.js";import*as g from"os";import*as _ from"path";import{promises as v}from"fs";function y(e){let t=e,n=``,r=0;for(;t!==n&&r<10;)n=t,t=t.normalize(`NFKC`),t=t.replace(/[\p{Cf}\p{Co}\p{Cn}]/gu,``),t=t.replace(/[\u200B-\u200F]/g,``).replace(/[\u202A-\u202E]/g,``).replace(/[\u2066-\u2069]/g,``).replace(/[\uFEFF]/g,``).replace(/[\uE000-\uF8FF]/g,``),r++;if(r>=10)throw Error(`Unicode sanitization reached maximum iterations (10) for input: ${e.slice(0,100)}`);return t}var b=e((()=>{}));function x(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=31||n===127)return!0}return!1}function S(e){let t=e.startsWith(`claude-cli://`)?e:e.startsWith(`claude-cli:`)?e.replace(`${C}:`,`${C}://`):null;if(!t)throw Error(`Invalid deep link: expected ${C}:// scheme, got "${e}"`);let n;try{n=new URL(t)}catch{throw Error(`Invalid deep link URL: "${e}"`)}if(n.hostname!==`open`)throw Error(`Unknown deep link action: "${n.hostname}"`);let r=n.searchParams.get(`cwd`)??void 0,i=n.searchParams.get(`repo`)??void 0,a=n.searchParams.get(`q`);if(r&&!r.startsWith(`/`)&&!/^[a-zA-Z]:[/\\]/.test(r))throw Error(`Invalid cwd in deep link: must be an absolute path, got "${r}"`);if(r&&x(r))throw Error(`Deep link cwd contains disallowed control characters`);if(r&&r.length>E)throw Error(`Deep link cwd exceeds ${E} characters (got ${r.length})`);if(i&&!w.test(i))throw Error(`Invalid repo in deep link: expected "owner/repo", got "${i}"`);let o;if(a&&a.trim().length>0){if(o=y(a.trim()),x(o))throw Error(`Deep link query contains disallowed control characters`);if(o.length>T)throw Error(`Deep link query exceeds ${T} characters (got ${o.length})`)}return{query:o,cwd:r,repo:i}}var C,w,T,E,D=e((()=>{b(),C=`claude-cli`,w=/^[\w.-]+\/[\w.-]+$/,T=5e3,E=4096})),O=t({MACOS_BUNDLE_ID:()=>z,ensureDeepLinkProtocolRegistered:()=>R,isProtocolHandlerCurrent:()=>L,registerProtocolHandler:()=>F});function k(){return _.join(m(),`applications`,V)}function A(e){return`Exec="${e}" --handle-uri %u`}function j(e){return`"${e}" --handle-uri "%1"`}async function M(e){let t=_.join(H,`Contents`);try{await v.rm(H,{recursive:!0})}catch(e){if(r(e)!==`ENOENT`)throw e}await v.mkdir(_.dirname(U),{recursive:!0});let n=`<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleIdentifier</key>
|
|
6
|
+
<string>${z}</string>
|
|
7
|
+
<key>CFBundleName</key>
|
|
8
|
+
<string>${B}</string>
|
|
9
|
+
<key>CFBundleExecutable</key>
|
|
10
|
+
<string>claude</string>
|
|
11
|
+
<key>CFBundleVersion</key>
|
|
12
|
+
<string>1.0</string>
|
|
13
|
+
<key>CFBundlePackageType</key>
|
|
14
|
+
<string>APPL</string>
|
|
15
|
+
<key>LSBackgroundOnly</key>
|
|
16
|
+
<true/>
|
|
17
|
+
<key>CFBundleURLTypes</key>
|
|
18
|
+
<array>
|
|
19
|
+
<dict>
|
|
20
|
+
<key>CFBundleURLName</key>
|
|
21
|
+
<string>Work Mate Deep Link</string>
|
|
22
|
+
<key>CFBundleURLSchemes</key>
|
|
23
|
+
<array>
|
|
24
|
+
<string>${C}</string>
|
|
25
|
+
</array>
|
|
26
|
+
</dict>
|
|
27
|
+
</array>
|
|
28
|
+
</dict>
|
|
29
|
+
</plist>`;await v.writeFile(_.join(t,`Info.plist`),n),await v.symlink(e,U),await u(`/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister`,[`-R`,H],{useCwd:!1}),a(`Registered ${C}:// protocol handler at ${H}`)}async function N(e){await v.mkdir(_.dirname(k()),{recursive:!0});let t=`[Desktop Entry]
|
|
30
|
+
Name=${B}
|
|
31
|
+
Comment=Handle ${C}:// deep links for Work Mate
|
|
32
|
+
${A(e)}
|
|
33
|
+
Type=Application
|
|
34
|
+
NoDisplay=true
|
|
35
|
+
MimeType=x-scheme-handler/${C};
|
|
36
|
+
`;await v.writeFile(k(),t);let n=await d(`xdg-mime`);if(n){let{code:e}=await u(n,[`default`,V,`x-scheme-handler/${C}`],{useCwd:!1});if(e!==0)throw Object.assign(Error(`xdg-mime exited with code ${e}`),{code:`XDG_MIME_FAILED`})}a(`Registered ${C}:// protocol handler at ${k()}`)}async function P(e){for(let t of[[`add`,W,`/ve`,`/d`,`URL:${B}`,`/f`],[`add`,W,`/v`,`URL Protocol`,`/d`,``,`/f`],[`add`,G,`/ve`,`/d`,j(e),`/f`]]){let{code:e}=await u(`reg`,t,{useCwd:!1});if(e!==0)throw Object.assign(Error(`reg add exited with code ${e}`),{code:`REG_FAILED`})}a(`Registered ${C}:// protocol handler in Windows registry`)}async function F(e){let t=e??await I();switch(process.platform){case`darwin`:await M(t);break;case`linux`:await N(t);break;case`win32`:await P(t);break;default:throw Error(`Unsupported platform: ${process.platform}`)}}async function I(){let e=process.platform===`win32`?`claude.exe`:`claude`,t=_.join(h(),e);try{return await v.realpath(t),t}catch{return process.execPath}}async function L(e){try{switch(process.platform){case`darwin`:return await v.readlink(U)===e;case`linux`:return(await v.readFile(k(),`utf8`)).includes(A(e));case`win32`:{let{stdout:t,code:n}=await u(`reg`,[`query`,G,`/ve`],{useCwd:!1});return n===0&&t.includes(j(e))}default:return!1}}catch{return!1}}async function R(){c().disableDeepLinkRegistration}var z,B,V,H,U,W,G,K=e((()=>{D(),i(),n(),o(),l(),s(),f(),p(),z=`com.anthropic.claude-code-url-handler`,B=`Claude Code URL Handler`,V=`claude-code-url-handler.desktop`,H=_.join(g.homedir(),`Applications`,`Claude Code URL Handler.app`),U=_.join(H,`Contents`,`MacOS`,`claude`),W=`HKEY_CURRENT_USER\\Software\\Classes\\${C}`,G=`${W}\\shell\\open\\command`}));export{S as a,D as i,K as n,O as r,z as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{o as t}from"./envUtils-DSxRz_kt.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{o as t}from"./envUtils-DSxRz_kt.js";import{$t as n}from"./state-C2OSZkV1.js";import{kE as r}from"./loadAgentsDir-ByO8eJqU.js";import{l as i,o as a}from"./stringUtils-B6FudhoZ.js";import{t as o}from"./settingsSync-DdFagwHV.js";import{n as s,t as c}from"./refresh-C1X3sptR.js";function l(e,t){return`${e} ${i(e,t)}`}var u;e((()=>{n(),o(),t(),c(),r(),a(),u=async(e,t)=>{let n=await s(t.setAppState),r=`Reloaded: ${[l(n.enabled_count,`plugin`),l(n.command_count,`skill`),l(n.agent_count,`agent`),l(n.hook_count,`hook`),l(n.mcp_count,`plugin MCP server`),l(n.lsp_count,`plugin LSP server`)].join(` · `)}`;return n.error_count>0&&(r+=`\n${l(n.error_count,`error`)} during load. Run /doctor for details.`),{type:`text`,value:r}}}))();export{u as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e,u as t}from"./envUtils-DSxRz_kt.js";import{n,t as r}from"./axios-DaWTGg7G.js";import{F as i,S as a,a as o,l as s,nt as c,rt as l,w as u,z as d}from"./debug-RZ4NuXyS.js";import{O as f,k as p}from"./git-BerW9bId.js";import{n as m,r as h}from"./analytics-CkYUHW_U.js";import{_n as g,vn as _}from"./model-CwO-g1RW.js";import{i as v,t as y}from"./sessionIdCompat-DMayYBrf.js";import{c as ee,n as b}from"./sessionState-CjNY991n.js";import{a as x,r as S}from"./bridgeConfig-jDEva6Eh.js";import{i as C,o as w,s as T}from"./debugUtils-D30M1cbN.js";import{a as te,r as E,t as ne}from"./flushGate-Cnsu4HET.js";import{a as D,c as O,i as re,n as ie,o as k,r as ae,s as oe,t as A}from"./bridgeMessaging-YqYdl6ej.js";import{t as j}from"./workSecret-DG9shvG0.js";import{i as M}from"./trustedDevice-B0x9X0fb.js";import{t as se}from"./jwtUtils-C0cE-1Ey.js";e(),c(),f(),m(),g(),y(),b(),r(),o(),d(),a(),w();var N=`2023-06-01`;function P(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":N}}async function ce(e,t,r,a,o){let c=`${e}/v1/code/sessions`,l;try{l=await n.post(c,{title:r,bridge:{},...o?.length?{tags:o}:{}},{headers:P(t),timeout:a,validateStatus:e=>e<500})}catch(e){return s(`[code-session] Session create request failed: ${i(e)}`),null}if(l.status!==200&&l.status!==201){let e=C(l.data);return s(`[code-session] Session create failed ${l.status}${e?`: ${e}`:``}`),null}let d=l.data;return!d||typeof d!=`object`||!(`session`in d)||!d.session||typeof d.session!=`object`||!(`id`in d.session)||typeof d.session.id!=`string`||!d.session.id.startsWith(`cse_`)?(s(`[code-session] No session.id (cse_*) in response: ${u(d).slice(0,200)}`),null):d.session.id}async function F(e,t,r,a,o){let c=`${t}/v1/code/sessions/${e}/bridge`,l=P(r);o&&(l[`X-Trusted-Device-Token`]=o);let d;try{d=await n.post(c,{},{headers:l,timeout:a,validateStatus:e=>e<500})}catch(e){return s(`[code-session] /bridge request failed: ${i(e)}`),null}if(d.status!==200){let e=C(d.data);return s(`[code-session] /bridge failed ${d.status}${e?`: ${e}`:``}`),null}let f=d.data;if(typeof f!=`object`||!f||!(`worker_jwt`in f)||typeof f.worker_jwt!=`string`||!(`expires_in`in f)||typeof f.expires_in!=`number`||!(`api_base_url`in f)||typeof f.api_base_url!=`string`||!(`worker_epoch`in f))return s(`[code-session] /bridge response malformed (need worker_jwt, expires_in, api_base_url, worker_epoch): ${u(f).slice(0,200)}`),null;let p=f.worker_epoch,m=typeof p==`string`?Number(p):p;return typeof m!=`number`||!Number.isFinite(m)||!Number.isSafeInteger(m)?(s(`[code-session] /bridge worker_epoch invalid: ${u(p)}`),null):{worker_jwt:f.worker_jwt,api_base_url:f.api_base_url,expires_in:f.expires_in,worker_epoch:m}}r(),w(),o(),d(),x();var I=`2023-06-01`;function L(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":I}}async function R(e){let{baseUrl:n,orgUUID:r,title:a,getAccessToken:o,onAuth401:c,toSDKMessages:u,initialHistoryCap:d,initialMessages:f,onInboundMessage:m,onUserMessage:g,onPermissionResponse:_,onInterrupt:v,onSetModel:y,onSetMaxThinkingTokens:b,onSetPermissionMode:x,onStateChange:S,outboundOnly:C,tags:w}=e,M=await te(),N=o();if(!N)return s(`[remote-bridge] No OAuth token`),null;let P=await z(()=>ce(n,N,a,M.http_timeout_ms,w),`createCodeSession`,M);if(!P)return S?.(`failed`,`Session creation failed — see debug log`),T(`v2_session_create_failed`,void 0,!0),null;let F=P;s(`[remote-bridge] Created session ${F}`),p(`info`,`bridge_repl_v2_session_created`);let I=await z(()=>B(F,n,N,M.http_timeout_ms),`fetchRemoteCredentials`,M);if(!I)return S?.(`failed`,`Remote credentials fetch failed — see debug log`),T(`v2_remote_creds_failed`,void 0,!0),V(F,n,N,r,M.http_timeout_ms),null;s(`[remote-bridge] Fetched bridge credentials (expires_in=${I.expires_in}s)`);let L=j(I.api_base_url,F);s(`[remote-bridge] v2 session URL: ${L}`);let R;try{R=await E({sessionUrl:L,ingressToken:I.worker_jwt,sessionId:F,epoch:I.worker_epoch,heartbeatIntervalMs:M.heartbeat_interval_ms,heartbeatJitterFraction:M.heartbeat_jitter_fraction,getAuthToken:()=>I.worker_jwt,outboundOnly:C})}catch(e){return s(`[remote-bridge] v2 transport setup failed: ${i(e)}`,{level:`error`}),S?.(`failed`,`Transport setup failed: ${i(e)}`),T(`v2_transport_setup_failed`,void 0,!0),V(F,n,N,r,M.http_timeout_ms),null}s(`[remote-bridge] v2 transport created (epoch=${I.worker_epoch})`),S?.(`ready`);let H=new A(M.uuid_dedup_buffer_size),U=new Set;if(f)for(let e of f)U.add(e.uuid),H.add(e.uuid);let le=new A(M.uuid_dedup_buffer_size),W=new ne,G=!1,K=!1,q=!1,J=!g,Y=`initial`,X;function Z(e){K||h(`tengu_bridge_repl_connect_timeout`,{v2:!0,elapsed_ms:M.connect_timeout_ms,cause:e})}ee(e=>{K||R.reportMetadata(e)},{replayCurrent:!0});let Q=se({refreshBufferMs:M.token_refresh_buffer_ms,getAccessToken:async()=>{let e=o();return c&&await c(e??``),o()??e},onRefresh:(e,t)=>{(async()=>{if(q||K){s(`[remote-bridge] Recovery already in flight, skipping proactive refresh`);return}q=!0;try{let r=await z(()=>B(e,n,t,M.http_timeout_ms),`fetchRemoteCredentials (proactive)`,M);if(!r||K)return;await ue(r,`proactive_refresh`),s(`[remote-bridge] Transport rebuilt (proactive refresh)`)}catch(e){s(`[remote-bridge] Proactive refresh rebuild failed: ${i(e)}`,{level:`error`}),p(`error`,`bridge_repl_v2_proactive_refresh_failed`),K||S?.(`failed`,`Refresh failed: ${i(e)}`)}finally{q=!1}})()},label:`remote`});Q.scheduleFromExpiresIn(F,I.expires_in);function $(){R.setOnConnect(()=>{if(clearTimeout(X),s(`[remote-bridge] v2 transport connected`),p(`info`,`bridge_repl_v2_transport_connected`),h(`tengu_bridge_repl_ws_connected`,{v2:!0,cause:Y}),!G&&f&&f.length>0){G=!0;let e=R;pe(f).catch(e=>s(`[remote-bridge] flushHistory failed: ${e}`)).finally(()=>{R!==e||K||q||(fe(),S?.(`connected`))})}else W.active||S?.(`connected`)}),R.setOnData(e=>{ae(e,H,le,m,_?e=>{R.reportState(`running`),_(e)}:void 0,e=>re(e,{transport:R,sessionId:F,onInterrupt:v,onSetModel:y,onSetMaxThinkingTokens:b,onSetPermissionMode:x,outboundOnly:C}))}),R.setOnClose(e=>{if(clearTimeout(X),!K){if(s(`[remote-bridge] v2 transport closed (code=${e})`),h(`tengu_bridge_repl_ws_closed`,{code:e,v2:!0}),e===401&&!q){de();return}S?.(`failed`,`Transport closed (code ${e})`)}})}async function ue(e,t){Y=t,W.start();try{let t=R.getLastSequenceNum();if(R.close(),R=await E({sessionUrl:j(e.api_base_url,F),ingressToken:e.worker_jwt,sessionId:F,epoch:e.worker_epoch,heartbeatIntervalMs:M.heartbeat_interval_ms,heartbeatJitterFraction:M.heartbeat_jitter_fraction,initialSequenceNum:t,getAuthToken:()=>e.worker_jwt,outboundOnly:C}),K){R.close();return}$(),R.connect(),X=setTimeout(Z,M.connect_timeout_ms,Y),Q.scheduleFromExpiresIn(F,e.expires_in),fe()}finally{W.drop()}}async function de(){if(!q){q=!0,S?.(`reconnecting`,`JWT expired — refreshing`),s(`[remote-bridge] 401 on SSE — attempting JWT refresh`);try{let e=o();c&&await c(e??``);let t=o()??e;if(!t||K){K||S?.(`failed`,`JWT refresh failed: no OAuth token`);return}let r=await z(()=>B(F,n,t,M.http_timeout_ms),`fetchRemoteCredentials (recovery)`,M);if(!r||K){K||S?.(`failed`,`JWT refresh failed after 401`);return}G=!1,await ue(r,`auth_401_recovery`),s(`[remote-bridge] Transport rebuilt after 401`)}catch(e){s(`[remote-bridge] 401 recovery failed: ${i(e)}`,{level:`error`}),p(`error`,`bridge_repl_v2_jwt_refresh_failed`),K||S?.(`failed`,`JWT refresh failed: ${i(e)}`)}finally{q=!1}}}$(),f&&f.length>0&&W.start(),R.connect(),X=setTimeout(Z,M.connect_timeout_ms,Y);function fe(){let e=W.end();if(e.length===0)return;for(let t of e)H.add(t.uuid);let t=u(e).map(e=>({...e,session_id:F}));O(e)&&R.reportState(`running`),s(`[remote-bridge] Drained ${e.length} queued message(s) after flush`),R.writeBatch(t)}async function pe(e){let t=e.filter(D),n=d>0&&t.length>d?t.slice(-d):t;n.length<t.length&&s(`[remote-bridge] Capped initial flush: ${t.length} -> ${n.length} (cap=${d})`);let r=u(n).map(e=>({...e,session_id:F}));if(r.length===0)return;let i=t.at(-1);i&&oe(i)&&R.reportState(`running`),s(`[remote-bridge] Flushing ${r.length} history events`),await R.writeBatch(r)}async function me(){if(K)return;K=!0,Q.cancelAll(),clearTimeout(X),W.drop(),R.reportState(`idle`);let e={...k(F),session_id:F};R.write(e);let t=o(),a=await V(F,n,t,r,M.teardown_archive_timeout_ms);if(a===401&&c)try{await c(t??``),t=o(),a=await V(F,n,t,r,M.teardown_archive_timeout_ms)}catch(e){s(`[remote-bridge] Teardown 401 retry threw: ${i(e)}`,{level:`error`})}R.close();let l=a===`no_token`?`skipped_no_token`:a===`timeout`||a===`error`?`network_error`:a>=500?`server_5xx`:a>=400?`server_4xx`:`ok`;s(`[remote-bridge] Torn down (archive=${a})`),p(`info`,`bridge_repl_v2_teardown`),h(`tengu_bridge_repl_teardown`,{v2:!0,archive_status:l,archive_ok:typeof a==`number`&&a<400,archive_http_status:typeof a==`number`?a:void 0,archive_timeout:a===`timeout`,archive_no_token:a===`no_token`})}let he=l(me);return h(`tengu_bridge_repl_started`,{has_initial_messages:!!(f&&f.length>0),v2:!0,expires_in_s:I.expires_in,inProtectedNamespace:t()}),{bridgeSessionId:F,environmentId:``,sessionIngressUrl:I.api_base_url,writeMessages(e){let t=e.filter(e=>D(e)&&!U.has(e.uuid)&&!H.has(e.uuid));if(t.length===0)return;if(!J)for(let e of t){let t=ie(e);if(t!==void 0&&g?.(t,F)){J=!0;break}}if(W.enqueue(...t)){s(`[remote-bridge] Queued ${t.length} message(s) during flush`);return}for(let e of t)H.add(e.uuid);let n=u(t).map(e=>({...e,session_id:F}));O(t)&&R.reportState(`running`),s(`[remote-bridge] Sending ${t.length} message(s)`),R.writeBatch(n)},writeSdkMessages(e){let t=e.filter(e=>!e.uuid||!H.has(e.uuid));if(t.length===0)return;for(let e of t)e.uuid&&H.add(e.uuid);let n=t.map(e=>({...e,session_id:F}));R.writeBatch(n)},sendControlRequest(e){if(q){s(`[remote-bridge] Dropping control_request during 401 recovery: ${e.request_id}`);return}let t={...e,session_id:F};e.request?.subtype===`can_use_tool`&&R.reportState(`requires_action`),R.write(t),s(`[remote-bridge] Sent control_request request_id=${e.request_id}`)},sendControlResponse(e){if(q){s(`[remote-bridge] Dropping control_response during 401 recovery`);return}let t={...e,session_id:F};R.reportState(`running`),R.write(t),s(`[remote-bridge] Sent control_response`)},sendControlCancelRequest(e){if(q){s(`[remote-bridge] Dropping control_cancel_request during 401 recovery: ${e}`);return}let t={type:`control_cancel_request`,request_id:e,session_id:F};R.reportState(`running`),R.write(t),s(`[remote-bridge] Sent control_cancel_request request_id=${e}`)},sendResult(){if(q){s(`[remote-bridge] Dropping result during 401 recovery`);return}R.reportState(`idle`);let e={...k(F),session_id:F};R.write(e),s(`[remote-bridge] Sent result`)},async teardown(){he(),await me()}}}async function z(e,t,n){let r=n.init_retry_max_attempts;for(let i=1;i<=r;i++){let a=await e();if(a!==null)return a;if(i<r){let e=n.init_retry_base_delay_ms*2**(i-1),a=e*n.init_retry_jitter_fraction*(2*Math.random()-1),o=Math.min(e+a,n.init_retry_max_delay_ms);s(`[remote-bridge] ${t} failed (attempt ${i}/${r}), retrying in ${Math.round(o)}ms`),await _(o)}}return null}async function B(e,t,n,r){let i=await F(e,t,n,r,M());return i?S()?{...i,api_base_url:t}:i:null}async function V(e,t,r,a,o){if(!r)return`no_token`;let c=v(e);try{let e=await n.post(`${t}/v1/sessions/${c}/archive`,{},{headers:{...L(r),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":a},timeout:o,validateStatus:()=>!0});return s(`[remote-bridge] Archive ${c} status=${e.status}`),e.status}catch(e){return s(`[remote-bridge] Archive failed: ${i(e)}`),n.isAxiosError(e)&&e.code===`ECONNABORTED`?`timeout`:`error`}}export{R as initEnvLessBridgeCore};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./axios-DaWTGg7G.js";import{A as n,M as r,O as i,w as a}from"./external-CEp-aPkt.js";import{n as o,r as s,t as c}from"./lazySchema-B4D4qJVE.js";import{AE as l,bb as ee,kE as te,xb as ne}from"./loadAgentsDir-ByO8eJqU.js";import{I as u,P as d,S as f,a as p,l as m,nt as h,rt as g,w as _,z as re}from"./debug-RZ4NuXyS.js";import{Bn as v,Gn as y,Hn as ie,N as b,P as x,Vn as S}from"./settings-hQDLwPVj.js";import{l as C,s as w,u as T}from"./oauth-BqJqV-2M.js";import{Bt as E,Ot as D,St as O,_n as k,mt as A,vn as j}from"./model-CwO-g1RW.js";import{n as M,t as N}from"./userAgent-BxTG7IMk.js";import{n as P,r as F,t as I}from"./syncCache-Zl9kZRRl.js";import{createHash as L}from"crypto";import{open as R,unlink as z}from"fs/promises";t(),s(),h(),re(),f(),p(),c(),T(),x(),M(),k(),E(),te(),ne();function ae(){return Promise.resolve({ok:!0})}function B(){return!0}ie(),I();var V=o(()=>a({uuid:n(),checksum:n(),settings:i(n(),r())})),H=1e4,U=5,W=3600*1e3,G=null,K=null,q=null,J=3e4;function oe(){K||P()&&(K=new Promise(e=>{q=e,setTimeout(()=>{q&&(m(`Remote settings: Loading promise timed out, resolving anyway`),q(),q=null)},J)}))}function se(){return`${C().BASE_API_URL}/api/claude_code/settings`}function Y(e){if(Array.isArray(e))return e.map(Y);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e).sort())t[n]=Y(e[n]);return t}return e}function ce(e){let t=_(Y(e));return`sha256:${L(`sha256`).update(t).digest(`hex`)}`}function le(){return P()}async function ue(){K&&await K}function de(){try{let{key:e}=O({skipRetrievingKeyFromApiKeyHelper:!0});if(e)return{headers:{"x-api-key":e}}}catch{}let e=D();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":w}}:{headers:{},error:`No authentication available`}}async function fe(e){let t=null;for(let n=1;n<=6;n++){if(t=await pe(e),t.success||t.skipRetry||n>U)return t;let r=ee(n);m(`Remote settings: Retry ${n}/${U} after ${r}ms`),await j(r)}return t}async function pe(t){try{await A();let n=de();if(n.error)return{success:!1,error:`Authentication required for remote settings`,skipRetry:!0};let r=se(),i={...n.headers,"User-Agent":N()};t&&(i[`If-None-Match`]=`"${t}"`);let a=await e.get(r,{headers:i,timeout:H,validateStatus:e=>e===200||e===204||e===304||e===404});if(a.status===304)return m(`Remote settings: Using cached settings (304)`),{success:!0,settings:null,checksum:t};if(a.status===204||a.status===404)return m(`Remote settings: No settings found (${a.status})`),{success:!0,settings:{},checksum:void 0};let o=V().safeParse(a.data);if(!o.success)return m(`Remote settings: Invalid response format - ${o.error.message}`),{success:!1,error:`Invalid remote settings format`};let s=b().safeParse(o.data.settings);return s.success?(m(`Remote settings: Fetched successfully`),{success:!0,settings:s.data,checksum:o.data.checksum}):(m(`Remote settings: Settings validation failed - ${s.error.message}`),{success:!1,error:`Invalid settings structure`})}catch(e){let{kind:t,status:n,message:r}=d(e);if(n===404)return{success:!0,settings:{},checksum:``};switch(t){case`auth`:return{success:!1,error:`Not authorized for remote settings`,skipRetry:!0};case`timeout`:return{success:!1,error:`Remote settings request timeout`};case`network`:return{success:!1,error:`Cannot connect to server`};default:return{success:!1,error:r}}}}async function me(e){try{let t=S(),n=await R(t,`w`,384);try{await n.writeFile(_(e,null,2),{encoding:`utf-8`}),await n.datasync()}finally{await n.close()}m(`Remote settings: Saved to ${t}`)}catch(e){m(`Remote settings: Failed to save - ${e instanceof Error?e.message:`unknown error`}`)}}async function X(){$(),F(),K=null,q=null;try{await z(S())}catch{}}async function Z(){if(!P())return null;let e=v(),t=e?ce(e):void 0;try{let n=await fe(t);if(!n.success)return e?(m(`Remote settings: Using stale cache after fetch failure`),y(e),e):null;if(n.settings===null&&e)return m(`Remote settings: Cache still valid (304 Not Modified)`),y(e),e;let r=n.settings||{};if(Object.keys(r).length>0)return B(await ae(e,r))?(y(r),await me(r),m(`Remote settings: Applied new settings successfully`),r):(m(`Remote settings: User rejected new settings, using cached settings`),e);y(r);try{await z(S()),m(`Remote settings: Deleted cached file (404 response)`)}catch(e){u(e)!==`ENOENT`&&m(`Remote settings: Failed to delete cached file - ${e instanceof Error?e.message:`unknown error`}`)}return r}catch{return e?(m(`Remote settings: Using stale cache after error`),y(e),e):null}}async function Q(){P()&&!K&&(K=new Promise(e=>{q=e})),v()&&q&&(q(),q=null);try{let e=await Z();P()&&_e(),e!==null&&l.notifyChange(`policySettings`)}finally{q&&(q(),q=null)}}async function he(){if(await X(),!P()){l.notifyChange(`policySettings`);return}await Z(),m(`Remote settings: Refreshed after auth change`),l.notifyChange(`policySettings`)}async function ge(){if(!P())return;let e=v(),t=e?_(e):null;try{await Z();let e=v();(e?_(e):null)!==t&&(m(`Remote settings: Changed during background poll`),l.notifyChange(`policySettings`))}catch{}}function _e(){G===null&&P()&&(G=setInterval(()=>{ge()},W),G.unref(),g(async()=>$()))}function $(){G!==null&&(clearInterval(G),G=null)}export{he as a,Q as i,oe as n,ue as o,le as r,X as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$t as t,mt as n}from"./state-C2OSZkV1.js";import{Er as r,Ga as i,eo as a,hi as o,jr as s,vi as c}from"./loadAgentsDir-ByO8eJqU.js";import{a as l,i as u,r as d}from"./bridgeConfig-jDEva6Eh.js";import{n as f,t as p}from"./generateSessionName-DitoBxJT.js";async function m(e,t,a){let s;if(!a||a.trim()===``){let n=await p(i(t.messages),t.abortController.signal);if(!n)return e(`Could not generate a name: no conversation context yet. Usage: /rename <name>`,{display:`system`}),null;s=n}else s=a.trim();let l=n(),f=r();await c(l,s,f);let m=t.getAppState().replBridgeSessionId;if(m){let e=u();import(`./createSession-CSwlW2T2.js`).then(({updateBridgeSessionTitle:t})=>t(m,s,{baseUrl:d(),getAccessToken:e?()=>e:void 0}).catch(()=>{}))}return await o(l,s,f),t.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:s}})),e(`Session renamed to: ${s}`,{display:`system`}),null}e((()=>{t(),l(),a(),s(),f()}))();export{m as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e,o as t}from"./envUtils-DSxRz_kt.js";import{o as n,s as r}from"./log-
|
|
1
|
+
import{l as e,o as t}from"./envUtils-DSxRz_kt.js";import{o as n,s as r}from"./log-CZ0zYP_c.js";import{ReadStream as i}from"tty";import{openSync as a}from"fs";t(),n();var o=null;function s(){if(o!==null)return o;if(process.stdin.isTTY){o=void 0;return}if(e(process.env.CI)){o=void 0;return}if(process.argv.includes(`mcp`)){o=void 0;return}if(process.platform===`win32`){o=void 0;return}try{let e=new i(a(`/dev/tty`,`r`));return e.isTTY=!0,o=e,o}catch(e){r(e),o=void 0;return}}function c(e=!1){let t=s(),n={exitOnCtrlC:e};return t&&(n.stdin=t),n}export{c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Mc as t}from"./loadAgentsDir-ByO8eJqU.js";function n(){return r}var r,i=e((()=>{t(),r=null}));export{i as n,n as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{I as i,P as a,di as o,dr as s,fi as c,ot as l,t as u,ui as d}from"./src-CDCSSo0U2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{
|
|
2
|
-
`),{display:`user`});return}p(!0),t(r,i,`slash_command_picker`)}function j(){e(`Resume cancelled`,{display:`system`})}return u?(0,Y.jsxs)(i,{children:[(0,Y.jsx)(
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{I as i,P as a,di as o,dr as s,fi as c,ot as l,t as u,ui as d}from"./src-CDCSSo0U2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{$t as p,mt as m,tt as h}from"./state-C2OSZkV1.js";import{Af as g,Cr as _,Cw as v,Fi as y,Fr as b,Kr as x,Nr as S,Pi as C,Sw as w,Vr as T,Wr as E,dp as D,gr as O,jr as k,kf as A,pp as j,wi as M,xw as N}from"./loadAgentsDir-ByO8eJqU.js";import{o as P,s as F}from"./log-CZ0zYP_c.js";import{n as I,r as L}from"./modalContext-DFjKLCB6.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./crossProjectResume-lDFB2ZcY.js";function W(e){switch(e.resultType){case`sessionNotFound`:return`Session ${d.bold(e.arg)} was not found. Run ${d.bold(`/resume`)} without arguments to browse all sessions.`;case`multipleMatches`:return`Found ${e.count} sessions matching ${d.bold(e.arg)}. Run ${d.bold(`/resume`)} to pick one from the list.`}}function G({message:e,args:t,onDone:n}){return J.useEffect(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,Y.jsxs)(i,{flexDirection:`column`,children:[(0,Y.jsxs)(a,{dimColor:!0,children:[r.pointer,` /resume `,t]}),(0,Y.jsx)(w,{children:(0,Y.jsx)(a,{children:e})})]})}function K({onDone:e,onResume:t}){let[n,r]=J.useState([]),[o,c]=J.useState([]),[u,d]=J.useState(!0),[f,p]=J.useState(!1),[v,y]=J.useState(!1),{rows:S}=l(),w=L(),O=J.useCallback(async(t,n)=>{d(!0);try{let i=q(t?await T():await x(n),m());if(i.length===0){e(`No conversations found to resume`);return}r(i)}catch{e(`Failed to load conversations`)}finally{d(!1)}},[e]);J.useEffect(()=>{async function e(){let e=await C(h());c(e),O(!1,e)}e()},[O]);let k=J.useCallback(()=>{let e=!v;y(e),O(e,o)},[v,O,o]);async function A(n){let r=g(_(n));if(!r){e(`Failed to resume conversation`);return}let i=b(n)?await E(n):n,a=U(i,v,o);if(a.isCrossProject){if(a.isSameRepoWorktree){p(!0),t(r,i,`slash_command_picker`);return}let n=await s(a.command);n&&process.stdout.write(n),e([``,`This conversation is from a different directory.`,``,`To resume, run:`,` ${a.command}`,``,`(Command copied to clipboard)`,``].join(`
|
|
2
|
+
`),{display:`user`});return}p(!0),t(r,i,`slash_command_picker`)}function j(){e(`Resume cancelled`,{display:`system`})}return u?(0,Y.jsxs)(i,{children:[(0,Y.jsx)(D,{}),(0,Y.jsx)(a,{children:` Loading conversations…`})]}):f?(0,Y.jsxs)(i,{children:[(0,Y.jsx)(D,{}),(0,Y.jsx)(a,{children:` Resuming conversation…`})]}):(0,Y.jsx)(R,{logs:n,maxHeight:w?Math.floor(S/2):S-2,onCancel:j,onSelect:A,onLogsChanged:()=>O(v,o),showAllProjects:v,onToggleAllProjects:k,onAgenticSearch:H})}function q(e,t){return e.filter(e=>!e.isSidechain&&_(e)!==t)}var J,Y,X;e((()=>{o(),n(),J=t(c(),1),p(),V(),v(),j(),I(),N(),u(),z(),B(),y(),P(),k(),A(),Y=f(),X=async(e,t,n)=>{let r=async(n,r,i)=>{try{await t.resume?.(n,r,i),e(void 0,{display:`skip`})}catch(t){F(t),e(`Failed to resume: ${t.message}`)}},i=n?.trim();if(!i)return(0,Y.jsx)(K,{onDone:e,onResume:r},Date.now());let a=await x(await C(h()));if(a.length===0){let t=`No conversations found to resume.`;return(0,Y.jsx)(G,{message:t,args:i,onDone:()=>e(t)})}let o=g(i);if(o){let e=a.filter(e=>_(e)===o).sort((e,t)=>t.modified.getTime()-e.modified.getTime());if(e.length>0){let t=e[0];return r(o,b(t)?await E(t):t,`slash_command_session_id`),null}let t=await O(o);if(t)return r(o,t,`slash_command_session_id`),null}if(S()){let t=await M(i,{exact:!0});if(t.length===1){let e=t[0],n=_(e);if(n)return r(n,b(e)?await E(e):e,`slash_command_title`),null}if(t.length>1){let n=W({resultType:`multipleMatches`,arg:i,count:t.length});return(0,Y.jsx)(G,{message:n,args:i,onDone:()=>e(n)})}}let s=W({resultType:`sessionNotFound`,arg:i});return(0,Y.jsx)(G,{message:s,args:i,onDone:()=>e(s)})}}))();export{X as call,q as filterResumableSessions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t}from"./ripgrep-gaT9Njwi.js";e();export{t as getRipgrepStatus};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,o as i}from"./envUtils-DSxRz_kt.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{a as s,l as c}from"./debug-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,o as i}from"./envUtils-DSxRz_kt.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{a as s,l as c}from"./debug-RZ4NuXyS.js";import{r as l,t as u}from"./execFileNoThrow-CCX-JY8h.js";import{o as d,s as f}from"./log-CZ0zYP_c.js";import{i as p,o as m}from"./platform-DCXXznJg.js";import{n as h,r as g}from"./analytics-CkYUHW_U.js";import{n as _,t as v}from"./bundledMode--fG1S62b.js";import{f as y,o as b,p as x,r as S}from"./stringUtils-B6FudhoZ.js";import{homedir as C}from"os";import*as w from"path";import{existsSync as T}from"fs";import{execFile as E,spawn as D}from"child_process";import{fileURLToPath as O}from"url";var k,A,j,M=e((()=>{k=O(import.meta.url),A=w.dirname(k),j=(()=>{let e=A.split(w.sep),t=e.lastIndexOf(`dist`);if(t!==-1)return e.slice(0,t+1).join(w.sep);let n=e.lastIndexOf(`src`);return n===-1?A:e.slice(0,n).join(w.sep)})()}));function N(e,t,n){let r=n??process.platform;return T(e)?{mode:`builtin`,command:e,args:[]}:(t===void 0?y(`rg`,[]).cmd:t??`rg`)===`rg`?{mode:`builtin`,command:e,args:[],note:`no ripgrep available on ${r}; install ripgrep via apt/pkg/brew`}:{mode:`system`,command:`rg`,args:[]}}function P(){let e=H();return{rgPath:e.command,rgArgs:e.args,argv0:e.argv0}}function F(e){return e.includes(`os error 11`)||e.includes(`Resource temporarily unavailable`)}function I(e,t,n,r,i=!1){let{rgPath:a,rgArgs:o,argv0:s}=P(),c=i?[`-j`,`1`]:[],l=[...o,...c,...e,t],u=p()===`wsl`?6e4:2e4,d=parseInt(process.env.CLAUDE_CODE_GLOB_TIMEOUT_SECONDS||``,10)||0,f=d>0?d*1e3:u;if(s){let e=D(a,l,{argv0:s,signal:n,windowsHide:!0}),t=``,i=``,o=!1,c=!1;e.stdout?.on(`data`,e=>{o||(t+=e.toString(),t.length>U&&(t=t.slice(0,U),o=!0))}),e.stderr?.on(`data`,e=>{c||(i+=e.toString(),i.length>U&&(i=i.slice(0,U),c=!0))});let u,d=setTimeout(()=>{process.platform===`win32`?e.kill():(e.kill(`SIGTERM`),u=setTimeout(e=>e.kill(`SIGKILL`),5e3,e))},f),p=!1;return e.on(`close`,(e,n)=>{if(!p)if(p=!0,clearTimeout(d),clearTimeout(u),e===0||e===1)r(null,t,i);else{let a=Error(`ripgrep exited with code ${e}`);a.code=e??void 0,a.signal=n??void 0,r(a,t,i)}}),e.on(`error`,e=>{p||(p=!0,clearTimeout(d),clearTimeout(u),r(e,t,i))}),e}return E(a,l,{maxBuffer:U,signal:n,timeout:f,killSignal:process.platform===`win32`?void 0:`SIGKILL`},r)}async function L(e,t,n){await B();let{rgPath:r,rgArgs:i,argv0:a}=P();return new Promise((o,s)=>{let c=D(r,[...i,...e,t],{argv0:a,signal:n,windowsHide:!0,stdio:[`ignore`,`pipe`,`ignore`]}),l=0;c.stdout?.on(`data`,e=>{l+=S(e,`
|
|
2
2
|
`)});let u=!1;c.on(`close`,e=>{u||(u=!0,e===0||e===1?o(l):s(Error(`rg --files exited ${e}`)))}),c.on(`error`,e=>{u||(u=!0,s(e))})})}async function R(e,t,n){return await B(),q().catch(e=>{f(e)}),new Promise((r,i)=>{let a=(o,s,l,u)=>{if(!o){r(s.trim().split(`
|
|
3
3
|
`).map(e=>e.replace(/\r$/,``)).filter(Boolean));return}if(o.code===1){r([]);return}if([`ENOENT`,`EACCES`,`EPERM`].includes(o.code)){i(o);return}if(!u&&F(l)){c(`rg EAGAIN error detected, retrying with single-threaded mode (-j 1)`),g(`tengu_ripgrep_eagain_retry`,{}),I(e,t,n,(e,t,n)=>{a(e,t,n,!0)},!0);return}let d=s&&s.trim().length>0,m=o.signal===`SIGTERM`||o.signal===`SIGKILL`||o.code===`ABORT_ERR`,h=o.code===`ERR_CHILD_PROCESS_STDIO_MAXBUFFER`,_=[];if(d&&(_=s.trim().split(`
|
|
4
4
|
`).map(e=>e.replace(/\r$/,``)).filter(Boolean),_.length>0&&(m||h)&&(_=_.slice(0,-1))),c(`rg error (signal=${o.signal}, code=${o.code}, stderr: ${l}), ${_.length} results`),o.code!==2&&o.code!==`ABORT_ERR`&&f(o),m&&_.length===0){i(new W(`Ripgrep search timed out after ${p()===`wsl`?60:20} seconds. The search may have matched files but did not complete in time. Try searching a more specific path or pattern.`,_));return}r(_)};I(e,t,n,(e,t,n)=>{a(e,t,n,!1)})})}function z(){let e=H();return{mode:e.mode,path:e.command,working:K?.working??null,note:K?.note??e.note}}async function B(){if(process.platform!==`darwin`||J)return;J=!0;let e=H();if(e.mode!==`builtin`)return;let t=e.command;if((await u(`codesign`,[`-vv`,`-d`,t],{preserveOutputOnError:!1})).stdout.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./runtimeObserver-
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./runtimeObserver-Dbxxw4ls.js";t();export{o as RUNTIME_SESSION_ID,n as getRuntimeTurn,i as initSkillLearning,e as resetRuntimeLLMBookkeeping,r as resetRuntimeObserverForTest,a as runSkillLearningPostSampling};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-DSxRz_kt.js";import{Yi as r,_h as i,vh as a,zi as o}from"./loadAgentsDir-ByO8eJqU.js";import{r as s,t as c}from"./featureCheck-HslM03dr.js";import{a as l,s as u}from"./projectContext-D9MDwJUF.js";import{a as d,c as ee,i as f,l as p,n as m,o as h,r as te,s as ne,u as g}from"./instinctParser-Dt-lqnDe.js";import{a as re,i as ie,n as _,o as v,r as y,t as ae}from"./observationStore-BpjlK0pG.js";import{a as oe,i as se,o as ce,r as le}from"./sessionObserver-DoYc0ZOP.js";import{a as ue,d as b,i as de,l as x,n as S,r as fe,s as C,t as pe,u as w}from"./skillLifecycle-DP6mY1Kp.js";import{join as T}from"node:path";import{existsSync as E}from"node:fs";import{randomBytes as me}from"node:crypto";import{mkdir as D,readFile as he,readdir as O,rename as ge,unlink as _e,writeFile as k}from"node:fs/promises";function A(e){let t=_(e),n=e?.project;return(e?.scope??n?.scope??`project`)===`global`||!n||n.projectId===`global`?T(t,`global`,`instincts`,`personal`):T(t,`projects`,n.projectId,`instincts`,`personal`)}async function j(e,t){let n=h(e);await D(A(t),{recursive:!0});let r=N(n.id,t),i=`${r}.${me(6).toString(`hex`)}.tmp`;return await k(i,ee(n)),await ge(i,r),n}async function M(e){let t=A(e),n=[];try{n=await O(t)}catch(e){if(e.code===`ENOENT`)return[];throw e}let r=[];for(let e of n.filter(e=>e.endsWith(`.json`))){let n=await he(T(t,e),`utf8`);r.push(ne(n))}return r.sort((e,t)=>e.id.localeCompare(t.id))}function ve(e,t){let n=P.then(()=>ye(e,t));return P=n.catch(()=>{}),n}async function ye(e,t){let n=await M(t),r=n.find(t=>t.id===e.id)??n.find(t=>t.trigger.toLowerCase()===e.trigger.toLowerCase()&&d(t,e)),i=new Date().toISOString();if(!r)return j(e,t);let a=d(r,e),o=a?-.1:Se(e.evidenceOutcome),s=m(r.confidence+o),c=be(r.status,s,a);return j(h({...r,confidence:s,evidence:[...r.evidence,...e.evidence],evidenceOutcome:e.evidenceOutcome??r.evidenceOutcome,observationIds:[...r.observationIds??[],...e.observationIds??[]],updatedAt:i,status:c}),t)}function be(e,t,n){return n&&t<.3?`conflict-hold`:e===`conflict-hold`&&t>=.5||e===`pending`&&t>=.8?`active`:e}async function xe(e){let t=await M(e),n=Date.now(),r=0;for(let i of t){if(i.status!==`pending`&&i.status!==`active`)continue;let t=Date.parse(i.updatedAt);if(Number.isNaN(t))continue;let a=Math.floor((n-t)/F);if(a<1)continue;let o=-.02*a,s=m(i.confidence+o);s!==i.confidence&&(await j(h({...i,confidence:s,updatedAt:new Date(n).toISOString()}),e),r+=1)}return r}function Se(e){return e===`failure`?-.05:.05}async function Ce(e,t){let n=await M(t),r=Date.now()-e*24*60*60*1e3,i=[];for(let e of n)e.status===`pending`&&Date.parse(e.updatedAt)<r&&(await _e(N(e.id,t)),i.push(e));return i}function N(e,t){return T(A(t),`${e}.json`)}var P,F,I=e((()=>{y(),f(),P=Promise.resolve(),F=10080*60*1e3}));function we(e,t){if(e.length===0)throw Error(`Cannot generate a command draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=w(t?.name??De(e)),i=Ae(e),a=t?.description??Oe(e),o=Ee(r,n,t),s=ke({name:r,description:a,confidence:i,instincts:e});return{name:r,description:a,scope:n,sourceInstinctIds:e.map(e=>e.id),confidence:Number(i.toFixed(2)),content:s,outputPath:o}}async function Te(e){await D(e.outputPath,{recursive:!0});let t=T(e.outputPath,`${e.name}.md`);return E(t)?t:(await k(t,e.content,`utf8`),o(),t)}function Ee(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?T(r?.cwd??process.cwd(),`.claude`,`commands`):r?.globalCommandsDir??T(t(),`commands`)}function De(e){return w([`learned`,...je(e,4)].join(`-`))||`learned-command`}function Oe(e){return(e[0]?.trigger??`Reuse the learned workflow`).replace(/\s+/g,` `).slice(0,120)}function ke(e){let{name:t,description:n,confidence:r,instincts:i}=e;return[`---`,`name: ${t}`,`description: ${JSON.stringify(n)}`,`origin: skill-learning`,`confidence: ${Number(r.toFixed(2))}`,`evolved_from: [${i.map(e=>JSON.stringify(e.id)).join(`, `)}]`,`---`,``,`# /${t}`,``,`## When to use`,``,i.map(e=>`- ${e.trigger}`).join(`
|
|
2
|
+
`),``,`## Steps`,``,i.map(e=>`- ${e.action}`).join(`
|
|
3
|
+
`),``,`## Evidence`,``,i.flatMap(e=>e.evidence.map(e=>`- ${e}`)).join(`
|
|
4
|
+
`),``].join(`
|
|
5
|
+
`)}function Ae(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function je(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`run`,`use`,`prefer`,`avoid`]),r=[];for(let i of e)for(let e of`${i.trigger} ${i.action}`.toLowerCase().split(/[^a-z0-9]+/))if(e.length>2&&!n.has(e)&&!r.includes(e)&&r.push(e),r.length>=t)return r;return r}var L=e((()=>{n(),r(),x()}));function Me(e,t){if(e.length===0)throw Error(`Cannot generate an agent draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=w(t?.name??Fe(e)),i=Re(e),a=t?.description??Ie(e),o=Pe(r,n,t),s=Le({name:r,description:a,confidence:i,instincts:e});return{name:r,description:a,scope:n,sourceInstinctIds:e.map(e=>e.id),confidence:Number(i.toFixed(2)),content:s,outputPath:o}}async function Ne(e){await D(e.outputPath,{recursive:!0});let t=T(e.outputPath,`${e.name}.md`);return E(t)?t:(await k(t,e.content,`utf8`),o(),t)}function Pe(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?T(r?.cwd??process.cwd(),`.claude`,`agents`):r?.globalAgentsDir??T(t(),`agents`)}function Fe(e){return w([`learned`,`agent`,...ze(e,4)].join(`-`))||`learned-agent`}function Ie(e){return(e[0]?.trigger??`Run the learned multi-step workflow`).replace(/\s+/g,` `).slice(0,120)}function Le(e){let{name:t,description:n,confidence:r,instincts:i}=e;return[`---`,`name: ${t}`,`description: ${JSON.stringify(n)}`,`origin: skill-learning`,`confidence: ${Number(r.toFixed(2))}`,`evolved_from: [${i.map(e=>JSON.stringify(e.id)).join(`, `)}]`,`---`,``,`You are the ${t} learned agent.`,``,`## Triggers`,``,i.map(e=>`- ${e.trigger}`).join(`
|
|
6
|
+
`),``,`## Playbook`,``,i.map(e=>`- ${e.action}`).join(`
|
|
7
|
+
`),``,`## Evidence`,``,i.flatMap(e=>e.evidence.map(e=>`- ${e}`)).slice(0,20).join(`
|
|
8
|
+
`),``].join(`
|
|
9
|
+
`)}function Re(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function ze(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`debug`,`investigate`,`research`]),r=[];for(let i of e)for(let e of`${i.trigger} ${i.action}`.toLowerCase().split(/[^a-z0-9]+/))if(e.length>2&&!n.has(e)&&!r.includes(e)&&r.push(e),r.length>=t)return r;return r}var R=e((()=>{n(),r(),x()}));function z(e){let t=new Map;for(let n of e){if(n.status!==`active`&&n.status!==`pending`)continue;let e=`${n.domain}:${Ue(n.trigger)}`,r=t.get(e)??[];r.push(n),t.set(e,r)}return Array.from(t.values()).filter(e=>e.length>=p().minClusterSize).map(e=>{let t=e.reduce((e,t)=>e+t.confidence,0)/e.length;return{target:Be(e),trigger:e[0]?.trigger??`learned pattern`,domain:e[0]?.domain??`project`,instincts:e,averageConfidence:Number(t.toFixed(2))}}).sort((e,t)=>t.averageConfidence-e.averageConfidence)}function Be(e){let t=Array.isArray(e)?e:e.instincts,n=t.map(e=>`${e.trigger} ${e.action}`).join(` `).toLowerCase();return/user asks|explicitly request|command|run /.test(n)?`command`:t.length>=4&&/(debug|investigate|research|multi-step)/.test(n)?`agent`:`skill`}function Ve(e,t){return z(e).filter(e=>e.target===`command`&&b(e.instincts)).map(e=>we(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function He(e,t){return z(e).filter(e=>e.target===`agent`&&b(e.instincts)).map(e=>Me(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function Ue(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,` `).split(/\s+/).filter(Boolean).slice(0,6).join(` `)}var We=e((()=>{x(),C(),L(),R(),g()}));function Ge(e){if(H.add(e),H.size>B){let e=H.size-V,t=H.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;H.delete(e.value)}}}function Ke(e,t=2,n=.8){let r=new Map;for(let t of e){if(t.scope!==`project`)continue;let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}return Array.from(r.entries()).flatMap(([e,r])=>{let i=Array.from(new Set(r.map(e=>e.projectId).filter(Boolean))),a=r.reduce((e,t)=>e+t.confidence,0)/r.length;return i.length>=t&&a>=n?[{instinctId:e,projectIds:i,averageConfidence:Number(a.toFixed(2))}]:[]})}async function qe(e={}){let t=e.minProjects??2,n=e.minConfidence??.8,r=await Je(e.rootDir),i=Ke(r,t,n),a=[];for(let t of i){if(H.has(t.instinctId))continue;let n=r.find(e=>e.id===t.instinctId);n&&(await j({...n,scope:`global`,projectId:void 0,projectName:void 0,confidence:t.averageConfidence,updatedAt:new Date().toISOString()},{rootDir:e.rootDir,scope:`global`,project:Ye(e.rootDir)}),Ge(t.instinctId),a.push(t))}return a}async function Je(e){let t=T(_(e?{rootDir:e}:void 0),`projects`);if(!E(t))return[];let n=await O(t,{withFileTypes:!0}),r=[];for(let i of n){if(!i.isDirectory())continue;let n=await M({rootDir:e,project:{projectId:i.name,projectName:i.name,scope:`project`,source:`git_root`,cwd:t,storageDir:T(t,i.name)},scope:`project`});r.push(...n)}return r}function Ye(e){let t=_(e?{rootDir:e}:void 0);return{projectId:`global`,projectName:`Global`,scope:`global`,source:`global`,cwd:t,storageDir:T(t,`global`)}}var B,V,H,Xe=e((()=>{I(),y(),B=256,V=192,H=new Set}));function U(){X=0,Z=0,Q.clear()}function Ze(){return J}function Qe(){if(!q){q=!0;try{ce()}catch{}a(W),$e().catch(()=>{})}}async function $e(){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE)return;let e={project:u(process.cwd())};await Promise.allSettled([xe(e),ie(e),Ce(30,e)])}function et(e){try{let t=_();return e.startsWith(t)}catch{return!1}}async function W(e){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE||!e.querySource?.startsWith(`repl_main_thread`)||e.toolUseContext.agentId)return;let t=process.cwd();if(et(t))return;let n=u(t),r={project:n};++J;let i=[];for(let t of rt(e.messages,n))i.push(await ae(t,r));let a=(await re(r)).filter(e=>e.source===`tool-hook`&&e.sessionId===`runtime-session`&&typeof e.timestamp==`string`&&e.timestamp>Y);i.push(...a);for(let e of a)e.timestamp>Y&&(Y=e.timestamp);if(i.length===0)return;let o=Date.now(),{llm:c}=p(),l=i.length>=5&&X<c.maxCallsPerSession&&o-Z>=c.cooldownMs,d;if(l)X++,Z=o,d=await se(i,{project:n});else{let{heuristicObserverBackend:e}=await import(`./sessionObserver-C2sYqWL3.js`),t=e.analyze(i,{project:n});d=Array.isArray(t)?t:await t}for(let e of d)await ve(te(e),r);await nt(r)}function tt(){J=0,Y=``,U()}async function nt(e){let n=await M(e),r=process.cwd(),i=[T(r,`.claude`,`skills`),T(t(),`skills`)],a=z(n).filter(e=>e.target===`skill`&&b(e.instincts));for(let e of a){let t=await ue(e.instincts,{cwd:r,scope:e.instincts[0]?.scope??`project`},i);if(t.action===`append-evidence`)continue;let n=t.draft;E(T(n.outputPath,`SKILL.md`))||await pe(fe(n,await S(`skill`,n,i)))}let o=Ve(n,{cwd:r});for(let e of o)(await S(`command`,e,[T(r,`.claude`,`commands`),T(t(),`commands`)])).length>0||await Te(e);let s=He(n,{cwd:r});for(let e of s)(await S(`agent`,e,[T(r,`.claude`,`agents`),T(t(),`agents`)])).length>0||await Ne(e);await qe()}function rt(e,t){let n=K,r={sessionId:n,projectId:t.projectId,projectName:t.projectName,cwd:t.cwd,timestamp:new Date().toISOString(),source:`hook`};return e.flatMap(e=>{let t=`${n}:${String(e.uuid)}`;if(Q.has(t))return[];if(Q.add(t),Q.size>$){let e=Q.size-ot,t=Q.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;Q.delete(e.value)}}if(e.type===`user`){let t=at(e.message?.content);if(t.length>0)return t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_complete`,toolName:e.toolName,toolOutput:e.output,outcome:e.isError?`failure`:`success`}));let n=G(e.message?.content);return n.trim()?[{...r,id:crypto.randomUUID(),event:`user_message`,messageText:n}]:[]}if(e.type===`assistant`){let t=it(e.message?.content),n=G(e.message?.content);return[...t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_start`,toolName:e.toolName,toolInput:e.input})),...n.trim()?[{...r,id:crypto.randomUUID(),event:`assistant_message`,messageText:n}]:[]]}return[]})}function G(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
|
|
10
|
+
`):``}function it(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_use`?[{toolName:String(t.name??`unknown_tool`),input:v(t.input)}]:[]}):[]}function at(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_result`?[{toolName:String(t.name??t.tool_name??`unknown_tool`),output:v(t.content),isError:t.is_error===!0}]:[]}):[]}var K,q,J,Y,X,Z,Q,$,ot,st=e((()=>{i(),g(),c(),y(),l(),le(),f(),oe(),I(),de(),We(),C(),x(),L(),R(),Xe(),n(),K=`runtime-session`,q=!1,J=0,Y=``,X=0,Z=0,Q=new Set,$=1e3,ot=500}));export{U as a,st as i,Ze as n,tt as o,Qe as r,W as s,K as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SE as e,TE as t}from"./loadAgentsDir-ByO8eJqU.js";t();export{e as SandboxManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as t,H as n,I as r,Lt as i,P as a,a as o,fi as s,j as c,n as l,r as u,t as d,x as f}from"./src-CDCSSo0U2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{$t as m,O as h}from"./state-C2OSZkV1.js";import{Bp as g,CE as _,OE as v,Pw as y,SE as b,TE as x,zp as S}from"./loadAgentsDir-ByO8eJqU.js";import{f as C,g as w,s as T}from"./settings-hQDLwPVj.js";import{i as E,o as D}from"./platform-DCXXznJg.js";import{relative as O}from"path";function k(){let e=b.isSandboxingEnabled(),t=b.checkDependencies(),n=t.warnings.length>0?(0,A.jsx)(r,{marginTop:1,flexDirection:`column`,children:t.warnings.map((e,t)=>(0,A.jsx)(a,{dimColor:!0,children:e},t))}):null;if(!e)return(0,A.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,A.jsx)(a,{color:`subtle`,children:`Sandbox is not enabled`}),n]});let i=b.getFsReadConfig(),o=b.getFsWriteConfig(),s=b.getNetworkRestrictionConfig(),c=b.getAllowUnixSockets(),l=b.getExcludedCommands(),u=b.getLinuxGlobPatternWarnings();return(0,A.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,A.jsxs)(r,{flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`permission`,children:`Excluded Commands:`}),(0,A.jsx)(a,{dimColor:!0,children:l.length>0?l.join(`, `):`None`})]}),i.denyOnly.length>0&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`permission`,children:`Filesystem Read Restrictions:`}),(0,A.jsxs)(a,{dimColor:!0,children:[`Denied: `,i.denyOnly.join(`, `)]}),i.allowWithinDeny&&i.allowWithinDeny.length>0&&(0,A.jsxs)(a,{dimColor:!0,children:[`Allowed within denied: `,i.allowWithinDeny.join(`, `)]})]}),o.allowOnly.length>0&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`permission`,children:`Filesystem Write Restrictions:`}),(0,A.jsxs)(a,{dimColor:!0,children:[`Allowed: `,o.allowOnly.join(`, `)]}),o.denyWithinAllow.length>0&&(0,A.jsxs)(a,{dimColor:!0,children:[`Denied within allowed: `,o.denyWithinAllow.join(`, `)]})]}),(s.allowedHosts&&s.allowedHosts.length>0||s.deniedHosts&&s.deniedHosts.length>0)&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsxs)(a,{bold:!0,color:`permission`,children:[`Network Restrictions`,v()?` (Managed)`:``,`:`]}),s.allowedHosts&&s.allowedHosts.length>0&&(0,A.jsxs)(a,{dimColor:!0,children:[`Allowed: `,s.allowedHosts.join(`, `)]}),s.deniedHosts&&s.deniedHosts.length>0&&(0,A.jsxs)(a,{dimColor:!0,children:[`Denied: `,s.deniedHosts.join(`, `)]})]}),c&&c.length>0&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`permission`,children:`Allowed Unix Sockets:`}),(0,A.jsx)(a,{dimColor:!0,children:c.join(`, `)})]}),u.length>0&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`warning`,children:`⚠ Warning: Glob patterns not fully supported on Linux`}),(0,A.jsxs)(a,{dimColor:!0,children:[`The following patterns will be ignored: `,u.slice(0,3).join(`, `),u.length>3&&` (${u.length-3} more)`]})]}),n]})}var A,j=e((()=>{s(),d(),x(),A=p()}));function M({depCheck:e}){let t=E()===`macos`,n=e.errors.some(e=>e.includes(`ripgrep`)),i=e.errors.some(e=>e.includes(`bwrap`)),o=e.errors.some(e=>e.includes(`socat`)),s=e.warnings.length>0,c=e.errors.filter(e=>!e.includes(`ripgrep`)&&!e.includes(`bwrap`)&&!e.includes(`socat`));return(0,N.jsxs)(r,{flexDirection:`column`,paddingY:1,gap:1,children:[t&&(0,N.jsx)(r,{flexDirection:`column`,children:(0,N.jsxs)(a,{children:[`seatbelt: `,(0,N.jsx)(a,{color:`success`,children:`built-in (macOS)`})]})}),(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{children:[`ripgrep (rg): `,n?(0,N.jsx)(a,{color:`error`,children:`not found`}):(0,N.jsx)(a,{color:`success`,children:`found`})]}),n&&(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· `,t?`brew install ripgrep`:`apt install ripgrep`]})]}),!t&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{children:[`bubblewrap (bwrap):`,` `,i?(0,N.jsx)(a,{color:`error`,children:`not installed`}):(0,N.jsx)(a,{color:`success`,children:`installed`})]}),i&&(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· apt install bubblewrap`]})]}),(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{children:[`socat: `,o?(0,N.jsx)(a,{color:`error`,children:`not installed`}):(0,N.jsx)(a,{color:`success`,children:`installed`})]}),o&&(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· apt install socat`]})]}),(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{children:[`seccomp filter:`,` `,s?(0,N.jsx)(a,{color:`warning`,children:`not installed`}):(0,N.jsx)(a,{color:`success`,children:`installed`}),s&&(0,N.jsx)(a,{dimColor:!0,children:` (required to block unix domain sockets)`})]}),s&&(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· npm install -g @anthropic-ai/sandbox-runtime`]}),(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· or copy vendor/seccomp/* from sandbox-runtime and set`]}),(0,N.jsxs)(a,{dimColor:!0,children:[` `,`sandbox.seccomp.bpfPath and applyPath in settings.json`]})]})]})]}),c.map(e=>(0,N.jsx)(a,{color:`error`,children:e},e))]})}var N,P=e((()=>{s(),d(),D(),N=p()}));function F({onComplete:e}){let t=b.isSandboxingEnabled(),n=b.areSandboxSettingsLockedByPolicy(),i=b.areUnsandboxedCommandsAllowed();return t?n?(0,L.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,L.jsx)(a,{color:`subtle`,children:`Override settings are managed by a higher-priority configuration and cannot be changed locally.`}),(0,L.jsx)(r,{marginTop:1,children:(0,L.jsxs)(a,{dimColor:!0,children:[`Current setting: `,i?`Allow unsandboxed fallback`:`Strict sandbox mode`]})})]}):(0,L.jsx)(I,{onComplete:e,currentMode:i?`open`:`closed`}):(0,L.jsx)(r,{flexDirection:`column`,paddingY:1,children:(0,L.jsx)(a,{color:`subtle`,children:`Sandbox is not enabled. Enable sandbox to configure override settings.`})})}function I({onComplete:e,currentMode:t}){let[s]=n(),{headerFocused:l,focusHeader:u}=o(),d=c(`success`,s)(`(current)`),f=[{label:t===`open`?`Allow unsandboxed fallback ${d}`:`Allow unsandboxed fallback`,value:`open`},{label:t===`closed`?`Strict sandbox mode ${d}`:`Strict sandbox mode`,value:`closed`}];async function p(t){let n=t;await b.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,L.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,L.jsx)(r,{marginBottom:1,children:(0,L.jsx)(a,{bold:!0,children:`Configure Overrides:`})}),(0,L.jsx)(S,{options:f,onChange:p,onCancel:()=>e(void 0,{display:`skip`}),onUpFromFirstItem:u,isDisabled:l}),(0,L.jsxs)(r,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,L.jsxs)(a,{dimColor:!0,children:[(0,L.jsx)(a,{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,L.jsxs)(a,{dimColor:!0,children:[(0,L.jsx)(a,{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,L.jsxs)(a,{dimColor:!0,children:[`Learn more:`,` `,(0,L.jsx)(i,{url:`https://code.claude.com/docs/en/sandboxing#configure-sandboxing`,children:`code.claude.com/docs/en/sandboxing#configure-sandboxing`})]})]})]})}var L,R=e((()=>{s(),d(),x(),g(),L=p()}));function z({onComplete:e,depCheck:r}){let[i]=n(),a=b.isSandboxingEnabled(),o=b.isAutoAllowBashIfSandboxedEnabled(),s=r.warnings.length>0,d=C().sandbox?.network?.allowAllUnixSockets,p=s&&!d,m=a?o?`auto-allow`:`regular`:`disabled`,h=c(`success`,i)(`(current)`),g=[{label:m===`auto-allow`?`Sandbox BashTool, with auto-allow ${h}`:`Sandbox BashTool, with auto-allow`,value:`auto-allow`},{label:m===`regular`?`Sandbox BashTool, with regular permissions ${h}`:`Sandbox BashTool, with regular permissions`,value:`regular`},{label:m===`disabled`?`No Sandbox ${h}`:`No Sandbox`,value:`disabled`}];async function _(t){switch(t){case`auto-allow`:await b.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),e(`✓ Sandbox enabled with auto-allow for bash commands`);break;case`regular`:await b.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),e(`✓ Sandbox enabled with regular bash permissions`);break;case`disabled`:await b.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),e(`○ Sandbox disabled`);break}}t({"confirm:no":()=>e(void 0,{display:`skip`})},{context:`Settings`});let v=(0,V.jsx)(l,{title:`Mode`,children:(0,V.jsx)(B,{showSocketWarning:p,options:g,onSelect:_,onComplete:e})},`mode`),y=(0,V.jsx)(l,{title:`Overrides`,children:(0,V.jsx)(F,{onComplete:e})},`overrides`),x=(0,V.jsx)(l,{title:`Config`,children:(0,V.jsx)(k,{})},`config`);return(0,V.jsx)(f,{color:`permission`,children:(0,V.jsx)(u,{title:`Sandbox:`,color:`permission`,defaultTab:`Mode`,children:r.errors.length>0?[(0,V.jsx)(l,{title:`Dependencies`,children:(0,V.jsx)(M,{depCheck:r})},`dependencies`)]:[v,...s?[(0,V.jsx)(l,{title:`Dependencies`,children:(0,V.jsx)(M,{depCheck:r})},`dependencies`)]:[],y,x]})})}function B({showSocketWarning:e,options:t,onSelect:n,onComplete:s}){let{headerFocused:c,focusHeader:l}=o();return(0,V.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[e&&(0,V.jsx)(r,{marginBottom:1,children:(0,V.jsx)(a,{color:`warning`,children:`Cannot block unix domain sockets (see Dependencies tab)`})}),(0,V.jsx)(r,{marginBottom:1,children:(0,V.jsx)(a,{bold:!0,children:`Configure Mode:`})}),(0,V.jsx)(S,{options:t,onChange:n,onCancel:()=>s(void 0,{display:`skip`}),onUpFromFirstItem:l,isDisabled:c}),(0,V.jsxs)(r,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,V.jsxs)(a,{dimColor:!0,children:[(0,V.jsx)(a,{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,V.jsxs)(a,{dimColor:!0,children:[`Learn more: `,(0,V.jsx)(i,{url:`https://code.claude.com/docs/en/sandboxing`,children:`code.claude.com/docs/en/sandboxing`})]})]})]})}var V,H=e((()=>{s(),d(),y(),x(),w(),g(),j(),P(),R(),V=p()}));async function U(e,t,n){let r=C().theme||`light`,i=E();if(!b.isSupportedPlatform()){let t=i===`wsl`?`Error: Sandboxing requires WSL2. WSL1 is not supported.`:`Error: Sandboxing is currently only supported on macOS, Linux, and WSL2.`;return e(c(`error`,r)(t)),null}let a=b.checkDependencies();if(!b.isPlatformInEnabledList())return e(c(`error`,r)(`Error: Sandboxing is disabled for this platform (${i}) via the enabledPlatforms setting.`)),null;if(b.areSandboxSettingsLockedByPolicy())return e(c(`error`,r)(`Error: Sandbox settings are overridden by a higher-priority configuration and cannot be changed locally.`)),null;let o=n?.trim()||``;if(!o)return(0,W.jsx)(z,{onComplete:e,depCheck:a});if(o){let t=o.split(` `)[0];if(t===`exclude`){let t=o.slice(8).trim();if(!t)return e(c(`error`,r)(`Error: Please provide a command pattern to exclude (e.g., /sandbox exclude "npm run test:*")`)),null;let n=t.replace(/^["']|["']$/g,``);_(n);let i=T(`localSettings`),a=i?O(h(),i):`.claude/settings.local.json`;return e(c(`success`,r)(`Added "${n}" to excluded commands in ${a}`)),null}else return e(c(`error`,r)(`Error: Unknown subcommand "${t}". Available subcommand: exclude`)),null}return null}var W;e((()=>{s(),m(),H(),d(),D(),x(),w(),W=p()}))();export{U as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ig as e,Rg as t}from"./loadAgentsDir-ByO8eJqU.js";e();export{t as isSearchExtraToolsEnabled};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,Wt as i,fi as a,t as o,x as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{Pw as l,_v as u,vv as d}from"./loadAgentsDir-ByO8eJqU.js";import{a as f,l as p}from"./debug-RZ4NuXyS.js";import{t as m}from"./lib-BlVGipXx.js";function h({onDone:e}){let t=d(e=>e.remoteSessionUrl),[a,o]=(0,_.useState)(``);if((0,_.useEffect)(()=>{if(!t)return;let e=t;async function n(){let t=await(0,g.toString)(e,{type:`utf8`,errorCorrectionLevel:`L`});o(t)}n().catch(e=>{p(`QR code generation failed`,e)})},[t]),i(`confirm:no`,e,{context:`Confirmation`}),!t)return(0,v.jsxs)(s,{children:[(0,v.jsx)(r,{color:`warning`,children:"Not in remote mode. Start with `claude --remote` to use this command."}),(0,v.jsx)(r,{dimColor:!0,children:`(press esc to close)`})]});let c=a.split(`
|
|
2
|
+
`).filter(e=>e.length>0),l=c.length===0;return(0,v.jsxs)(s,{children:[(0,v.jsx)(n,{marginBottom:1,children:(0,v.jsx)(r,{bold:!0,children:`Remote session`})}),l?(0,v.jsx)(r,{dimColor:!0,children:`Generating QR code…`}):c.map((e,t)=>(0,v.jsx)(r,{children:e},t)),(0,v.jsxs)(n,{marginTop:1,children:[(0,v.jsx)(r,{dimColor:!0,children:`Open in browser: `}),(0,v.jsx)(r,{color:`ide`,children:t})]}),(0,v.jsx)(n,{marginTop:1,children:(0,v.jsx)(r,{dimColor:!0,children:`(press esc to close)`})})]})}var g,_,v,y;e((()=>{g=m(),a(),_=t(a(),1),o(),l(),u(),f(),v=c(),y=async e=>(0,v.jsx)(h,{onDone:e})}))();export{y as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ca as e,oa as t}from"./loadAgentsDir-ByO8eJqU.js";t();export{e as registerSessionFileAccessHooks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";var n=t({setCseShimGate:()=>r,toCompatSessionId:()=>i,toInfraSessionId:()=>a});function r(e){o=e}function i(e){return!e.startsWith(`cse_`)||o&&!o()?e:`session_`+e.slice(4)}function a(e){return e.startsWith(`session_`)?`cse_`+e.slice(8):e}var o,s=e((()=>{}));export{a,i,n,r,s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{$t as r,B as i}from"./state-C2OSZkV1.js";import{$h as a,$y as o,Cc as s,Ec as c,Fn as l,Fy as u,In as d,Iy as f,Jh as p,Jy as m,La as h,Ln as ee,Oc as g,Py as _,Qa as v,Qh as y,Qy as b,Sc as x,Xy as S,Yg as te,_b as ne,_h as re,ab as ie,cb as ae,eb as oe,eg as se,eo as ce,gb as le,ib as C,la as ue,lt as de,nb as w,ob as T,qh as E,rb as D,sb as O,tb as k,ua as A,ut as j,vh as M,yb as N}from"./loadAgentsDir-ByO8eJqU.js";import{F as P,I as F,d as I,p as L,z as R}from"./debug-RZ4NuXyS.js";import{In as z,Ln as B}from"./settings-hQDLwPVj.js";import{n as V,r as H}from"./analytics-CkYUHW_U.js";import{di as fe,ui as pe}from"./model-CwO-g1RW.js";import{cn as U,dn as me}from"./prompt-B7joRiqj.js";import{gt as he}from"./sessionState-CjNY991n.js";import{writeFile as W}from"fs/promises";function ge(){return!1}function _e(){return{}}function ve(e,t){let n=0,r=t==null;for(let i of e){if(!r){i.uuid===t&&(r=!0);continue}if(i.type===`assistant`){let e=i.message.content;Array.isArray(e)&&(n+=z(e,e=>e.type===`tool_use`))}}return n}function G(e){let t=N(e);if(!w()){if(!o(t))return!1;ie()}let n=oe(t),r=ve(e,X)>=b(),i=v(e);if(n&&r||n&&!i){let t=e[e.length-1];return t?.uuid&&(X=t.uuid),!0}return!1}async function K(e){let t=I(),n=l();await t.mkdir(n,{mode:448});let r=d();try{await W(r,``,{encoding:`utf-8`,mode:384,flag:`wx`}),await W(r,await se(),{encoding:`utf-8`,mode:384})}catch(e){if(F(e)!==`EEXIST`)throw e}e.readFileState.delete(r);let i=await ue.call({file_path:r},e),a=``,o=i.data;return o.type===`text`&&(a=o.file.content),H(`tengu_session_memory_file_read`,{content_length:a.length}),{memoryPath:r,currentMemory:a}}function ye(){if(i())return;let e=p();process.env.USER_TYPE===`ant`&&H(`tengu_session_memory_init`,{auto_compact_enabled:e}),e&&M($)}async function q(e,t){if(e.length===0)return{success:!1,error:`No messages to summarize`};C();try{let n=s(t),{memoryPath:r,currentMemory:i}=await K(n),a=await y(i,r),{tools:o,mainLoopModel:c}=t.options,[l,d,f]=await Promise.all([de(o,c),u(),_()]),p=he(l);return await g({promptMessages:[h({content:a})],cacheSafeParams:{systemPrompt:p,userContext:d,systemContext:f,toolUseContext:n,forkContextMessages:e},canUseTool:J(r),querySource:`session_memory`,forkLabel:`session_memory_manual`,overrides:{readFileState:n.readFileState}}),H(`tengu_session_memory_manual_extraction`,{}),T(N(e)),Y(e),{success:!0,memoryPath:r}}catch(e){return{success:!1,error:P(e)}}finally{D()}}function J(e){return async(t,n)=>{if(t.name===`Edit`&&typeof n==`object`&&n&&`file_path`in n){let t=n.file_path;if(typeof t==`string`&&t===e)return{behavior:`allow`,updatedInput:n}}return{behavior:`deny`,message:`only ${U} on ${e} is allowed`,decisionReason:{type:`other`,reason:`only ${U} on ${e} is allowed`}}}}function Y(e){if(!v(e)){let t=e[e.length-1];t?.uuid&&O(t.uuid)}}var X,Z,Q,$,be=e((()=>{n(),r(),j(),f(),me(),A(),B(),c(),L(),re(),ce(),ee(),pe(),te(),ne(),V(),E(),a(),k(),R(),Z=t(()=>{let e=_e();ae({minimumMessageTokensToInit:e.minimumMessageTokensToInit&&e.minimumMessageTokensToInit>0?e.minimumMessageTokensToInit:m.minimumMessageTokensToInit,minimumTokensBetweenUpdate:e.minimumTokensBetweenUpdate&&e.minimumTokensBetweenUpdate>0?e.minimumTokensBetweenUpdate:m.minimumTokensBetweenUpdate,toolCallsBetweenUpdates:e.toolCallsBetweenUpdates&&e.toolCallsBetweenUpdates>0?e.toolCallsBetweenUpdates:m.toolCallsBetweenUpdates})}),Q=!1,$=fe(async function(e){let{messages:t,toolUseContext:n,querySource:r}=e;if(r!==`repl_main_thread`)return;{let{isPoorModeActive:e}=await import(`./poorMode-CejPNCp-.js`);if(e())return}if(!ge()){process.env.USER_TYPE===`ant`&&!Q&&(Q=!0,H(`tengu_session_memory_gate_disabled`,{}));return}if(Z(),!G(t))return;C();let i=s(n),{memoryPath:a,currentMemory:o}=await K(i);await g({promptMessages:[h({content:await y(o,a)})],cacheSafeParams:x(e),canUseTool:J(a),querySource:`session_memory`,forkLabel:`session_memory`,overrides:{readFileState:i.readFileState}});let c=t[t.length-1],l=c?le(c):void 0,u=S();H(`tengu_session_memory_extraction`,{input_tokens:l?.input_tokens,output_tokens:l?.output_tokens,cache_read_input_tokens:l?.cache_read_input_tokens??void 0,cache_creation_input_tokens:l?.cache_creation_input_tokens??void 0,config_min_message_tokens_to_init:u.minimumMessageTokensToInit,config_min_tokens_between_update:u.minimumTokensBetweenUpdate,config_tool_calls_between_updates:u.toolCallsBetweenUpdates}),T(N(t)),Y(t),D()})}));export{G as a,q as i,ye as n,be as r,J as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t}from"./sessionMemory-CQBxPkTQ.js";t();export{e as manuallyExtractSessionMemory};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Zy as e,tb as t}from"./loadAgentsDir-ByO8eJqU.js";t();export{e as getSessionMemoryContent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t}from"./sessionObserver-DoYc0ZOP.js";t();export{e as heuristicObserverBackend};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Yg as t,et as n,tt as r}from"./loadAgentsDir-ByO8eJqU.js";import{gt as i}from"./sessionState-CjNY991n.js";import{i as a,l as o,t as s,u as c}from"./instinctParser-Dt-lqnDe.js";function l(e){h.set(e.name,e),g||(g=e.name)}function u(e){if(!h.has(e))throw Error(`Observer backend "${e}" is not registered`);g=e}function d(){let e=g?h.get(g):void 0;if(!e)throw Error(`No observer backend is active — register one before analyzing observations`);return e}async function f(e,t){return Promise.resolve(d().analyze(e,t))}function p(){let e=process.env.SKILL_LEARNING_OBSERVER_BACKEND?.trim();return e&&h.has(e)?e:void 0}function m(){let e=p();return e&&u(e),d()}var h,g,_=e((()=>{h=new Map})),v,y=e((()=>{v=[`workflow`,`testing`,`debugging`,`code-style`,`security`,`git`,`project`]}));async function b(e,t){if(e.length===0)return[];if(Date.now()<L)return x(e,t);let n=e.slice(-30),a=S(n),s=P(o().llm.timeoutMs),c;try{let e=await r({systemPrompt:i([R]),userPrompt:a,signal:s,options:{querySource:`skill_learning_observer`,enablePromptCaching:!0,agents:[],isNonInteractiveSession:!0,hasAppendSystemPrompt:!1,mcpTools:[]}});I=0,c=T(e.message?.content)}catch{return I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),x(e,t)}let l=E(c,t,n);return l.length===0?(I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),x(e,t)):l}async function x(e,t){try{let{heuristicObserverBackend:n}=await import(`./sessionObserver-C2sYqWL3.js`),r=n.analyze(e,t);return Array.isArray(r)?r:await r}catch{return[]}}function S(e){return`Observations (chronological, newest last):\n${e.map((e,t)=>C(e,t)).join(`
|
|
2
|
+
`)}\n\nExtract up to ${F} atomic instincts. JSON array only.`}function C(e,t){let n=[`#${t+1}`,`event=${e.event}`];return e.toolName&&n.push(`tool=${e.toolName}`),e.outcome&&n.push(`outcome=${e.outcome}`),e.messageText&&n.push(`text=${JSON.stringify(w(e.messageText,200))}`),e.toolInput&&n.push(`in=${JSON.stringify(w(e.toolInput,120))}`),e.toolOutput&&n.push(`out=${JSON.stringify(w(e.toolOutput,120))}`),n.join(` | `)}function w(e,t){return e.length<=t?e:`${e.slice(0,t)}…`}function T(e){if(!Array.isArray(e))return``;let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;e.type===`text`&&typeof e.text==`string`&&t.push(e.text)}return t.join(``).trim()}function E(e,t,n){let r=D(e);if(!r)return[];let i;try{i=JSON.parse(r)}catch{return[]}if(!Array.isArray(i))return[];let a=n.map(e=>e.id),o=[];for(let e of i.slice(0,F)){let n=O(e,t,a);n&&o.push(n)}return o}function D(e){if(!e)return;let t=e.indexOf(`[`),n=e.lastIndexOf(`]`);if(!(t<0||n<=t))return e.slice(t,n+1)}function O(e,t,n){if(!e||typeof e!=`object`)return;let r=e,i=k(r.trigger,80),a=k(r.action,120);if(!i||!a)return;let o=N(r.evidence);if(o.length!==0)return{trigger:i,action:a,confidence:A(r.confidence),domain:j(r.domain),source:`session-observation`,scope:M(r.scope),projectId:t?.project?.projectId,projectName:t?.project?.projectName,evidence:o,observationIds:n}}function k(e,t){if(typeof e!=`string`)return;let n=e.trim();if(n)return n.length>t?n.slice(0,t):n}function A(e){return typeof e!=`number`||!Number.isFinite(e)?.5:e<0?0:e>1?1:e}function j(e){return typeof e==`string`&&v.includes(e)?e:`project`}function M(e){return e===`global`?`global`:`project`}function N(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(e&&(t.push(e.length>200?`${e.slice(0,200)}…`:e),t.length===3))break}return t}function P(e){return AbortSignal.timeout(e)}var F,I,L,R,z,B=e((()=>{n(),t(),c(),y(),F=3,I=0,L=0,R=`You analyse a short sequence of observations from a coding-assistant session (user messages, tool invocations with outcomes, assistant messages) and extract atomic, reusable "instincts" — behavioural patterns that would help the assistant act correctly in future similar situations.
|
|
3
|
+
|
|
4
|
+
Respond with ONLY a JSON array (no prose, no code fences, no commentary). Each item must match this schema:
|
|
5
|
+
|
|
6
|
+
{
|
|
7
|
+
"trigger": string, // <= 80 chars, short phrase describing WHEN the instinct applies
|
|
8
|
+
"action": string, // <= 120 chars, short phrase describing WHAT to do
|
|
9
|
+
"confidence": number, // 0..1 — how strongly these observations support the pattern
|
|
10
|
+
"domain": "workflow"|"testing"|"debugging"|"code-style"|"security"|"git"|"project",
|
|
11
|
+
"scope": "project"|"global",
|
|
12
|
+
"evidence": string[] // 1..3 short excerpts copied/paraphrased from the observations
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
Rules:
|
|
16
|
+
- Return [] if nothing clearly reusable. No guessing.
|
|
17
|
+
- At most 3 items, highest confidence first.
|
|
18
|
+
- confidence > 0.7 only when observations show the pattern in action (a correction followed by a successful retry, a repeated sequence, an explicit rule).
|
|
19
|
+
- Never include secrets, tokens, full file contents, or personally-identifying data.
|
|
20
|
+
- Scope "global" only when the pattern is obviously project-agnostic (generic testing, git hygiene); default to "project".`,z={name:`llm`,analyze(e,t){return b(e,t)}}}));function V(e,t){return[...H(e),...U(e),...W(e,t),...G(e)]}function H(e){return e.flatMap((t,n)=>{if(t.event!==`user_message`||!t.messageText)return[];let r=t.messageText.trim(),i=J(r);return i?[{...s(t),trigger:i.trigger,action:i.action,confidence:.7,domain:Y(r),source:`session-observation`,scope:`project`,evidence:[r],evidenceOutcome:K(e,n),observationIds:[t.id]}]:[]})}function U(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(r.event!==`tool_complete`||r.outcome!==`failure`)continue;let i=e.slice(n+1,n+6).find(e=>e.event===`tool_complete`&&e.outcome===`success`&&e.toolName===r.toolName);!i||!r.toolName||t.push({...s(r),trigger:`When ${r.toolName} fails during this project`,action:`Use the follow-up successful ${r.toolName} invocation as the resolution pattern before retrying blindly.`,confidence:.5,domain:`debugging`,source:`session-observation`,scope:`project`,evidence:[r.toolOutput??`${r.toolName} failed`,i.toolOutput??`${i.toolName} succeeded`],evidenceOutcome:`success`,observationIds:[r.id,i.id]})}return t}function W(e,t){let n=t?.minRepeatedSequenceCount??X,r=e.filter(e=>e.event===`tool_start`||e.event===`tool_complete`),i=r.map(e=>e.toolName??``),a=[`Grep`,`Read`,`Edit`],o=[],c=0;for(let e=0;e<=i.length-a.length;e++)a.every((t,n)=>i[e+n]===t)&&(c++,o.push(...r.slice(e,e+a.length).map(e=>e.id)));if(c<n)return[];let l=`Observed ${c} repeated Grep -> Read -> Edit workflow sequences.`,u=r.find(e=>o.includes(e.id)),d=o[o.length-1],f=r.find(e=>e.id===d),p=f?.event===`tool_complete`?f.outcome:void 0;return[{...s(u??e[0]),trigger:`When changing code in this project`,action:`Prefer the Grep -> Read -> Edit workflow: locate symbols, inspect context, then apply the smallest edit.`,confidence:c>=3?.65:.5,domain:`workflow`,source:`session-observation`,scope:`project`,evidence:[l],evidenceOutcome:q(p),observationIds:Array.from(new Set(o))}]}function G(e){return e.flatMap((t,n)=>{if(t.event!==`user_message`||!t.messageText)return[];let r=t.messageText.trim();return/(项目约定|规范|必须|convention|always|must)/i.test(r)?[{...s(t),trigger:`When working in this project`,action:`Follow the project convention: ${r}`,confidence:.4,domain:`project`,source:`session-observation`,scope:`project`,evidence:[r],evidenceOutcome:K(e,n),observationIds:[t.id]}]:[]})}function K(e,t){for(let n=t-1;n>=0;n--){let t=e[n];if(t.event===`tool_complete`)return q(t.outcome)}}function q(e){if(e===`success`||e===`failure`||e===`unknown`)return e}function J(e){let t=/(?:不要|别|不应(?:该)?|不要再)\s*(?<avoid>[^,,。.;;]+)[,,\s]*(?:用|使用|改用|应该用|要用)\s*(?<prefer>[^,,。.;;]+)/i,n=/(?:do not|don't|avoid)\s+(?<avoid>[^,.;]+)[,;\s]+(?:use|prefer)\s+(?<prefer>[^,.;]+)/i,r=/(?:你应该|应该先|must|should)\s*(?<prefer>[^,,。.;;]+)/i,i=e.match(t)??e.match(n);if(i?.groups){let e=i.groups.avoid.trim(),t=i.groups.prefer.trim();return{trigger:`When choosing between ${e} and ${t}`,action:`Prefer ${t}; avoid ${e}.`}}let a=e.match(r);return a?.groups?{trigger:`When this user gives a corrective instruction`,action:`Prefer this corrected action: ${a.groups.prefer.trim()}.`}:null}function Y(e){let t=e.toLowerCase();return/test|mock|testing-library|vitest|jest|bun test/.test(t)?`testing`:/git|commit|branch/.test(t)?`git`:/security|secret|token|password/.test(t)?`security`:/style|format|lint|naming/.test(t)?`code-style`:`project`}var X,Z,Q=e((()=>{a(),_(),B(),X=2,Z={name:`heuristic`,analyze(e,t){return V(e)}},l(Z),l(z)}));export{_ as a,f as i,Z as n,m as o,Q as r,V as t};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DSxRz_kt.js";import{t as i}from"./semver-DQo45qGo.js";import{$t as a,ar as o,ht as s,mt as c,z as l}from"./state-C2OSZkV1.js";import{F as u,a as d,d as f,l as p,nt as m,p as h,rt as g,z as _}from"./debug-RZ4NuXyS.js";import{O as ee,k as v}from"./git-BerW9bId.js";import{Bt as te,Dr as ne,Er as re,Or as ie,Tr as y}from"./model-CwO-g1RW.js";import{a as ae}from"./bridgeConfig-jDEva6Eh.js";import{randomUUID as b}from"crypto";var oe=e((()=>{})),se,ce=e((()=>{se={input_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,output_tokens:0,server_tool_use:{web_search_requests:0,web_fetch_requests:0},service_tier:`standard`,cache_creation:{ephemeral_1h_input_tokens:0,ephemeral_5m_input_tokens:0},inference_geo:``,iterations:[],speed:`standard`}})),le=e((()=>{}));function ue(e){return e}var de=e((()=>{})),fe=e((()=>{oe(),ce(),le(),de()}));function pe(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function me(e){if(process.env.OPENAI_MODEL)return process.env.OPENAI_MODEL;let t=e.replace(/\[1m\]$/,``),n=pe(t);if(n){let e=`OPENAI_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return he[t]??t}var he,ge=e((()=>{he={"claude-sonnet-4-20250514":`gpt-4o`,"claude-sonnet-4-5-20250929":`gpt-4o`,"claude-sonnet-4-6":`gpt-4o`,"claude-opus-4-20250514":`o3`,"claude-opus-4-1-20250805":`o3`,"claude-opus-4-5-20251101":`o3`,"claude-opus-4-6":`o3`,"claude-haiku-4-5-20251001":`gpt-4o-mini`,"claude-3-5-haiku-20241022":`gpt-4o-mini`,"claude-3-7-sonnet-20250219":`gpt-4o`,"claude-3-5-sonnet-20241022":`gpt-4o`}}));function _e(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function ve(){let e=process.env.GROK_MODEL_MAP;if(!e)return null;try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}return null}function ye(e){if(process.env.GROK_MODEL)return process.env.GROK_MODEL;let t=e.replace(/\[1m\]$/,``),n=_e(t),r=ve();if(r&&n&&r[n])return r[n];if(n){let e=`GROK_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return x[t]?x[t]:n&&be[n]?be[n]:t}var x,be,xe=e((()=>{x={"claude-sonnet-4-20250514":`grok-3-mini-fast`,"claude-sonnet-4-5-20250929":`grok-3-mini-fast`,"claude-sonnet-4-6":`grok-3-mini-fast`,"claude-opus-4-20250514":`grok-4.20-reasoning`,"claude-opus-4-1-20250805":`grok-4.20-reasoning`,"claude-opus-4-5-20251101":`grok-4.20-reasoning`,"claude-opus-4-6":`grok-4.20-reasoning`,"claude-haiku-4-5-20251001":`grok-3-mini-fast`,"claude-3-5-haiku-20241022":`grok-3-mini-fast`,"claude-3-7-sonnet-20250219":`grok-3-mini-fast`,"claude-3-5-sonnet-20241022":`grok-3-mini-fast`},be={opus:`grok-4.20-reasoning`,sonnet:`grok-3-mini-fast`,haiku:`grok-3-mini-fast`}}));function Se(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function Ce(e){if(process.env.GEMINI_MODEL)return process.env.GEMINI_MODEL;let t=e.replace(/\[1m\]$/i,``),n=Se(t);if(!n)return t;let r=`GEMINI_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i;let a=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,o=process.env[a];if(o)return o;throw Error(`Gemini provider requires GEMINI_MODEL or ${r} (or ${a} for backward compatibility) to be configured.`)}var we=e((()=>{})),Te,Ee=e((()=>{Te=`_geminiThoughtSignature`}));function De(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function Oe(e,t){let n=[],r=new Map;for(let t of e){if(t.type===`assistant`){let e=Me(t);e.parts.length>0&&n.push(e);let i=t.message.content;if(Array.isArray(i))for(let e of i)typeof e!=`string`&&e.type===`tool_use`&&r.set(e.id,e.name);continue}if(t.type===`user`){let e=Ae(t,r);e.parts.length>0&&n.push(e)}}let i=ke(t);return{contents:n,...i?{systemInstruction:{parts:[{text:i}]}}:{}}}function ke(e){return!e||e.length===0?``:e.filter(Boolean).join(`
|
|
2
|
+
|
|
3
|
+
`)}function Ae(e,t){let n=e.message.content;return typeof n==`string`?{role:`user`,parts:S(n)}:Array.isArray(n)?{role:`user`,parts:n.flatMap(e=>je(e,t))}:{role:`user`,parts:[]}}function je(e,t){if(typeof e==`string`)return S(e);if(e.type===`text`)return S(e.text);if(e.type===`tool_result`){let n=e;return[{functionResponse:{name:t.get(n.tool_use_id)??n.tool_use_id,response:Fe(n)}}]}if(e.type===`image`){let t=e.source;if(t?.type===`base64`&&typeof t.data==`string`)return[{inlineData:{mimeType:t.media_type||`image/png`,data:t.data}}];if(t?.type===`url`&&typeof t.url==`string`)return S(`[image: ${t.url}]`)}return[]}function Me(e){let t=e.message.content;if(typeof t==`string`)return{role:`model`,parts:S(t)};if(!Array.isArray(t))return{role:`model`,parts:[]};let n=[];for(let e of t){if(typeof e==`string`){n.push(...S(e));continue}if(e.type===`text`){n.push(...S(e.text,C(e)));continue}if(e.type===`thinking`){let t=Ne(e.thinking,e.signature);t&&n.push(t);continue}if(e.type===`tool_use`){let t=e;n.push({functionCall:{name:t.name,args:Pe(t.input)},...C(e)&&{thoughtSignature:C(e)}})}}return{role:`model`,parts:n}}function S(e,t){return typeof e!=`string`||e.length===0?[]:[{text:e,...t&&{thoughtSignature:t}}]}function Ne(e,t){if(!(typeof e!=`string`||e.length===0))return{text:e,thought:!0,...t&&{thoughtSignature:t}}}function Pe(e){if(typeof e==`string`){let t=De(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:t===null?{}:{value:t}}return e&&typeof e==`object`&&!Array.isArray(e)?e:e===void 0?{}:{value:e}}function Fe(e){let t=Ie(e.content);return t&&typeof t==`object`&&!Array.isArray(t)?e.is_error?{...t,is_error:!0}:t:{result:t,...e.is_error?{is_error:!0}:{}}}function Ie(e){if(typeof e==`string`)return De(e)??e;if(Array.isArray(e)){let t=e.map(e=>typeof e==`string`?e:e&&typeof e==`object`&&`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(`
|
|
4
|
+
`);return De(t)??t}return e??``}function C(e){let t=e[Te];return typeof t==`string`&&t.length>0?t:void 0}var Le=e((()=>{Ee()}));function Re(e){if(typeof e==`string`)return T.has(e)?e:void 0;if(Array.isArray(e)){let t=e.filter(e=>typeof e==`string`&&T.has(e)),n=Array.from(new Set(t));return n.length===0?void 0:n.length===1?n[0]:n}}function ze(e){if(e===null)return`null`;if(Array.isArray(e))return`array`;if(typeof e==`string`)return`string`;if(typeof e==`boolean`)return`boolean`;if(typeof e==`number`)return Number.isInteger(e)?`integer`:`number`;if(typeof e==`object`)return`object`}function Be(e){let t=e.map(ze).filter(e=>e!==void 0),n=Array.from(new Set(t));if(n.length!==0)return n.length===1?n[0]:n}function Ve(e){return e===void 0?[`null`]:Array.isArray(e)?e.includes(`null`)?e:[...e,`null`]:e===`null`?e:[e,`null`]}function He(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=Object.entries(e).map(([e,t])=>[e,w(t)]).filter(([,e])=>Object.keys(e).length>0);if(t.length!==0)return Object.fromEntries(t)}function Ue(e){if(!Array.isArray(e))return;let t=e.map(e=>w(e)).filter(e=>Object.keys(e).length>0);return t.length>0?t:void 0}function w(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t=e,n={},r=Re(t.type);t.const===void 0?Array.isArray(t.enum)&&t.enum.length>0&&(n.enum=t.enum,r=r??Be(t.enum)):(n.enum=[t.const],r=r??ze(t.const)),r||(t.properties&&typeof t.properties==`object`?r=`object`:(t.items!==void 0||t.prefixItems!==void 0)&&(r=`array`)),t.nullable===!0&&(r=Ve(r)),r&&(n.type=r),typeof t.title==`string`&&(n.title=t.title),typeof t.description==`string`&&(n.description=t.description),typeof t.format==`string`&&(n.format=t.format),typeof t.pattern==`string`&&(n.pattern=t.pattern),typeof t.minimum==`number`?n.minimum=t.minimum:typeof t.exclusiveMinimum==`number`&&(n.minimum=t.exclusiveMinimum),typeof t.maximum==`number`?n.maximum=t.maximum:typeof t.exclusiveMaximum==`number`&&(n.maximum=t.exclusiveMaximum),typeof t.minItems==`number`&&(n.minItems=t.minItems),typeof t.maxItems==`number`&&(n.maxItems=t.maxItems),typeof t.minLength==`number`&&(n.minLength=t.minLength),typeof t.maxLength==`number`&&(n.maxLength=t.maxLength),typeof t.minProperties==`number`&&(n.minProperties=t.minProperties),typeof t.maxProperties==`number`&&(n.maxProperties=t.maxProperties);let i=He(t.properties);if(i&&(n.properties=i,n.propertyOrdering=Object.keys(i)),Array.isArray(t.required)){let e=t.required.filter(e=>typeof e==`string`);e.length>0&&(n.required=e)}if(typeof t.additionalProperties==`boolean`)n.additionalProperties=t.additionalProperties;else{let e=w(t.additionalProperties);Object.keys(e).length>0&&(n.additionalProperties=e)}let a=w(t.items);Object.keys(a).length>0&&(n.items=a);let o=Ue(t.prefixItems);o&&(n.prefixItems=o);let s=Ue(t.anyOf??t.oneOf);return s&&(n.anyOf=s),n}function We(e){let t=w(e);return Object.keys(t).length>0?t:{type:`object`,properties:{}}}function Ge(e){let t=e.filter(e=>{let t=e.type;return e.type===`custom`||!(`type`in e)||t!==`server`}).map(e=>{let t=e;return{name:t.name||``,description:t.description||``,parametersJsonSchema:We(t.input_schema??{type:`object`,properties:{}})}});return t.length>0?[{functionDeclarations:t}]:[]}function Ke(e){if(!e||typeof e!=`object`)return;let t=e;switch(t.type){case`auto`:return{mode:`AUTO`};case`any`:return{mode:`ANY`};case`tool`:return{mode:`ANY`,allowedFunctionNames:typeof t.name==`string`?[t.name]:void 0};default:return}}var T,qe=e((()=>{T=new Set([`string`,`number`,`integer`,`boolean`,`object`,`array`,`null`])}));async function*Je(e,t){let n=`msg_${b().replace(/-/g,``).slice(0,24)}`,r=!1,i=!1,a=0,o=null,s=!1,c,l=0,u=0,d=0;for await(let i of e){let e=i.usageMetadata;e&&(l=e.promptTokenCount??l,u=(e.candidatesTokenCount??0)+(e.thoughtsTokenCount??0),d=e.cachedContentTokenCount??d),r||(r=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:l,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:d}}});let f=i.candidates?.[0],p=f?.content?.parts??[];for(let e of p){if(e.functionCall){o&&(yield{type:`content_block_stop`,index:o.index},o=null),s=!0;let t=a++;yield{type:`content_block_start`,index:t,content_block:{type:`tool_use`,id:`toolu_${b().replace(/-/g,``).slice(0,24)}`,name:e.functionCall.name||``,input:{}}},e.thoughtSignature&&(yield{type:`content_block_delta`,index:t,delta:{type:`signature_delta`,signature:e.thoughtSignature}}),e.functionCall.args&&Object.keys(e.functionCall.args).length>0&&(yield{type:`content_block_delta`,index:t,delta:{type:`input_json_delta`,partial_json:JSON.stringify(e.functionCall.args)}}),yield{type:`content_block_stop`,index:t};continue}let t=Ye(e);if(t){(!o||o.type!==t)&&(o&&(yield{type:`content_block_stop`,index:o.index}),o={index:a++,type:t},yield{type:`content_block_start`,index:o.index,content_block:t===`thinking`?{type:`thinking`,thinking:``,signature:``}:{type:`text`,text:``}}),e.text&&(yield{type:`content_block_delta`,index:o.index,delta:t===`thinking`?{type:`thinking_delta`,thinking:e.text}:{type:`text_delta`,text:e.text}}),e.thoughtSignature&&(yield{type:`content_block_delta`,index:o.index,delta:{type:`signature_delta`,signature:e.thoughtSignature}});continue}e.thoughtSignature&&o&&(yield{type:`content_block_delta`,index:o.index,delta:{type:`signature_delta`,signature:e.thoughtSignature}})}f?.finishReason&&(c=f.finishReason)}r&&(o&&(yield{type:`content_block_stop`,index:o.index}),i||(yield{type:`message_delta`,delta:{stop_reason:Xe(c,s),stop_sequence:null},usage:{input_tokens:l,output_tokens:u,cache_creation_input_tokens:0,cache_read_input_tokens:d}},yield{type:`message_stop`},i=!0))}function Ye(e){return typeof e.text==`string`?e.thought?`thinking`:`text`:null}function Xe(e,t){switch(e){case`MAX_TOKENS`:return`max_tokens`;default:return t?`tool_use`:`end_turn`}}var Ze=e((()=>{}));function E(e){if(!e||typeof e!=`object`)return null;let t=e,n=0;for(;t&&n<5;){if(t instanceof Error&&`code`in t&&typeof t.code==`string`){let e=t.code,n=rt.has(e);return{code:e,message:t.message,isSSLError:n}}if(t instanceof Error&&`cause`in t&&t.cause!==t)t=t.cause,n++;else break}return null}function Qe(e){let t=E(e);return t?.isSSLError?`SSL certificate error (${t.code}). If you are behind a corporate proxy or TLS-intercepting firewall, set NODE_EXTRA_CA_CERTS to your CA bundle path, or ask IT to allowlist *.anthropic.com. Run /doctor for details.`:null}function D(e){if(e.includes(`<!DOCTYPE html`)||e.includes(`<html`)){let t=e.match(/<title>([^<]+)<\/title>/);return t&&t[1]?t[1].trim():``}return e}function $e(e){let t=e.message;return t?D(t):``}function et(e){return typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null}function tt(e){if(!et(e))return null;let t=e.error,n=t?.error?.message;if(typeof n==`string`&&n.length>0){let e=D(n);if(e.length>0)return e}let r=t?.message;if(typeof r==`string`&&r.length>0){let e=D(r);if(e.length>0)return e}return null}function nt(e){let t=E(e);if(t){let{code:e,isSSLError:n}=t;if(e===`ETIMEDOUT`)return`Request timed out. Check your internet connection and proxy settings`;if(n)switch(e){case`UNABLE_TO_VERIFY_LEAF_SIGNATURE`:case`UNABLE_TO_GET_ISSUER_CERT`:case`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`:return`Unable to connect to API: SSL certificate verification failed. Check your proxy or corporate SSL certificates`;case`CERT_HAS_EXPIRED`:return`Unable to connect to API: SSL certificate has expired`;case`CERT_REVOKED`:return`Unable to connect to API: SSL certificate has been revoked`;case`DEPTH_ZERO_SELF_SIGNED_CERT`:case`SELF_SIGNED_CERT_IN_CHAIN`:return`Unable to connect to API: Self-signed certificate detected. Check your proxy or corporate SSL certificates`;case`ERR_TLS_CERT_ALTNAME_INVALID`:case`HOSTNAME_MISMATCH`:return`Unable to connect to API: SSL certificate hostname mismatch`;case`CERT_NOT_YET_VALID`:return`Unable to connect to API: SSL certificate is not yet valid`;default:return`Unable to connect to API: SSL error (${e})`}}if(e.message===`Connection error.`)return t?.code?`Unable to connect to API (${t.code})`:`Unable to connect to API. Check your internet connection`;if(!e.message)return tt(e)??`API error (status ${e.status??`unknown`})`;let n=$e(e);return n!==e.message&&n.length>0?n:e.message}var rt,it=e((()=>{rt=new Set([`UNABLE_TO_VERIFY_LEAF_SIGNATURE`,`UNABLE_TO_GET_ISSUER_CERT`,`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`,`CERT_SIGNATURE_FAILURE`,`CERT_NOT_YET_VALID`,`CERT_HAS_EXPIRED`,`CERT_REVOKED`,`CERT_REJECTED`,`CERT_UNTRUSTED`,`DEPTH_ZERO_SELF_SIGNED_CERT`,`SELF_SIGNED_CERT_IN_CHAIN`,`CERT_CHAIN_TOO_LONG`,`PATH_LENGTH_EXCEEDED`,`ERR_TLS_CERT_ALTNAME_INVALID`,`HOSTNAME_MISMATCH`,`ERR_TLS_HANDSHAKE_TIMEOUT`,`ERR_SSL_WRONG_VERSION_NUMBER`,`ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC`])}));function at(e,t,n){let r=[],i=ot(t);i&&r.push({role:`system`,content:i});for(let t of e)switch(t.type){case`user`:r.push(...st(t));break;case`assistant`:r.push(...lt(t));break;default:break}return r}function ot(e){return!e||e.length===0?``:e.filter(Boolean).join(`
|
|
5
|
+
|
|
6
|
+
`)}function st(e){let t=[],n=e.message.content;if(typeof n==`string`)t.push({role:`user`,content:n});else if(Array.isArray(n)){let e=[],r=[],i=[];for(let t of n)if(typeof t==`string`)e.push(t);else if(t.type===`text`)e.push(t.text);else if(t.type===`tool_result`)r.push(t);else if(t.type===`image`){let e=ut(t);e&&i.push(e)}for(let e of r)t.push(ct(e));if(i.length>0){let n=[];e.length>0&&n.push({type:`text`,text:e.join(`
|
|
7
|
+
`)}),n.push(...i),t.push({role:`user`,content:n})}else e.length>0&&t.push({role:`user`,content:e.join(`
|
|
8
|
+
`)})}return t}function ct(e){let t;return t=typeof e.content==`string`?e.content:Array.isArray(e.content)?e.content.map(e=>typeof e==`string`?e:`text`in e?e.text:``).filter(Boolean).join(`
|
|
9
|
+
`):``,{role:`tool`,tool_call_id:e.tool_use_id,content:t}}function lt(e){let t=e.message.content;if(typeof t==`string`)return[{role:`assistant`,content:t}];if(!Array.isArray(t))return[{role:`assistant`,content:``}];let n=[],r=[],i=[];for(let e of t)if(typeof e==`string`)n.push(e);else if(e.type===`text`)n.push(e.text);else if(e.type===`tool_use`){let t=e;r.push({id:t.id,type:`function`,function:{name:t.name,arguments:typeof t.input==`string`?t.input:JSON.stringify(t.input)}})}else if(e.type===`thinking`){let t=e.thinking;typeof t==`string`&&i.push(t)}return[{role:`assistant`,content:n.length>0?n.join(`
|
|
10
|
+
`):null,...r.length>0&&{tool_calls:r},...i.length>0&&{reasoning_content:i.join(`
|
|
11
|
+
`)}}]}function ut(e){let t=e.source;return t?t.type===`base64`&&typeof t.data==`string`?{type:`image_url`,image_url:{url:`data:${t.media_type||`image/png`};base64,${t.data}`}}:t.type===`url`&&typeof t.url==`string`?{type:`image_url`,image_url:{url:t.url}}:null:null}var dt=e((()=>{}));function ft(e){return e.filter(e=>{let t=e.type;return e.type===`custom`||!(`type`in e)||t!==`server`}).map(e=>{let t=e,n=t.name||``,r=t.description||``,i=t.input_schema;return{type:`function`,function:{name:n,description:r,parameters:O(i||{type:`object`,properties:{}})}}})}function O(e){if(!e||typeof e!=`object`)return e;let t={...e};`const`in t&&(t.enum=[t.const],delete t.const);for(let e of[`properties`,`definitions`,`$defs`,`patternProperties`]){let n=t[e];if(n&&typeof n==`object`){let r={};for(let[e,t]of Object.entries(n))r[e]=t&&typeof t==`object`?O(t):t;t[e]=r}}for(let e of[`items`,`additionalProperties`,`not`,`if`,`then`,`else`,`contains`,`propertyNames`]){let n=t[e];n&&typeof n==`object`&&!Array.isArray(n)&&(t[e]=O(n))}for(let e of[`anyOf`,`oneOf`,`allOf`]){let n=t[e];Array.isArray(n)&&(t[e]=n.map(e=>e&&typeof e==`object`?O(e):e))}return t}function pt(e){if(!e||typeof e!=`object`)return;let t=e;switch(t.type){case`auto`:return`auto`;case`any`:return`required`;case`tool`:return{type:`function`,function:{name:t.name}};default:return}}var mt=e((()=>{}));async function*ht(e,t){let n=`msg_${b().replace(/-/g,``).slice(0,24)}`,r=!1,i=-1,a=new Map,o=!1,s=!1,c=0,l=0,u=0,d=0,f=new Set,p=null,m=!1;for await(let h of e){let e=h.choices?.[0],g=e?.delta;if(h.usage){c=h.usage.prompt_tokens??c;let e=h.usage.prompt_tokens_details?.cached_tokens??d;l=Math.max(0,c-e),u=h.usage.completion_tokens??u,d=e}if(r||(r=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:l,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:d}}}),!g)continue;let _=g.reasoning_content;if(_!=null&&(o||(i++,o=!0,f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`thinking`,thinking:``,signature:``}}),_!==``&&(yield{type:`content_block_delta`,index:i,delta:{type:`thinking_delta`,thinking:_}})),g.content!=null&&g.content!==``&&(s||(o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),i++,s=!0,f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`text`,text:``}}),yield{type:`content_block_delta`,index:i,delta:{type:`text_delta`,text:g.content}}),g.tool_calls)for(let e of g.tool_calls){let t=e.index;if(!a.has(t)){o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),s&&(yield{type:`content_block_stop`,index:i},f.delete(i),s=!1),i++;let n=e.id||`toolu_${b().replace(/-/g,``).slice(0,24)}`,r=e.function?.name||``;a.set(t,{contentIndex:i,id:n,name:r,arguments:``}),f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`tool_use`,id:n,name:r,input:{}}}}let n=e.function?.arguments;n&&(a.get(t).arguments+=n,yield{type:`content_block_delta`,index:a.get(t).contentIndex,delta:{type:`input_json_delta`,partial_json:n}})}if(e?.finish_reason){o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),s&&(yield{type:`content_block_stop`,index:i},f.delete(i),s=!1);for(let[,e]of a)f.has(e.contentIndex)&&(yield{type:`content_block_stop`,index:e.contentIndex},f.delete(e.contentIndex));p=e.finish_reason,m=a.size>0}}for(let e of f)yield{type:`content_block_stop`,index:e};p!==null&&(yield{type:`message_delta`,delta:{stop_reason:p===`length`?`max_tokens`:m?`tool_use`:gt(p),stop_sequence:null},usage:{input_tokens:l,output_tokens:u,cache_read_input_tokens:d,cache_creation_input_tokens:0}},yield{type:`message_stop`})}function gt(e){switch(e){case`stop`:return`end_turn`;case`tool_calls`:return`tool_use`;case`length`:return`max_tokens`;case`content_filter`:return`end_turn`;default:return`end_turn`}}var _t=e((()=>{})),vt=e((()=>{fe(),ge(),xe(),we(),Le(),qe(),Ze(),Ee(),it(),dt(),mt(),_t()}));function k(){return A||(A=i()),A}function yt(e,t){return typeof Bun<`u`?Bun.semver.order(e,t)===1:k().gt(e,t,{loose:!0})}function bt(e,t){return typeof Bun<`u`?Bun.semver.order(e,t)>=0:k().gte(e,t,{loose:!0})}function xt(e,t){return typeof Bun<`u`?Bun.semver.order(e,t)===-1:k().lt(e,t,{loose:!0})}function St(e,t){return typeof Bun<`u`?Bun.semver.satisfies(e,t):k().satisfies(e,t,{loose:!0})}var A,Ct=e((()=>{}));function wt(){let e=s();if(e!==void 0)return e;let t=process.env.CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR;if(!t){let e=ie(process.env.CLAUDE_SESSION_INGRESS_TOKEN_FILE??y,`session ingress token`);return o(e),e}let n=parseInt(t,10);if(Number.isNaN(n))return p(`CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR must be a valid file descriptor number, got: ${t}`,{level:`error`}),o(null),null;try{let e=f(),t=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${n}`:`/proc/self/fd/${n}`,r=e.readFileSync(t,{encoding:`utf8`}).trim();return r?(p(`Successfully read token from file descriptor ${n}`),o(r),ne(y,r,`session ingress token`),r):(p(`File descriptor contained empty token`,{level:`error`}),o(null),null)}catch(e){p(`Failed to read token from file descriptor ${n}: ${u(e)}`,{level:`error`});let t=ie(process.env.CLAUDE_SESSION_INGRESS_TOKEN_FILE??y,`session ingress token`);return o(t),t}}function Tt(){return process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN||wt()}function Et(){let e=Tt();if(!e)return{};if(e.startsWith(`sk-ant-sid`)){let t={Cookie:`sessionKey=${e}`},n=process.env.CLAUDE_CODE_ORGANIZATION_UUID;return n&&(t[`X-Organization-Uuid`]=n),t}return{Authorization:`Bearer ${e}`}}function Dt(e){process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN=e}var Ot=e((()=>{a(),re(),d(),_(),h()}));function j(e){l()&&(M.length>=jt&&M.shift(),M.push(e))}function kt(){return M.length===0?[]:M.splice(0).map(e=>({...e,uuid:b(),session_id:c()}))}function At(e,t,n){j({type:`system`,subtype:`task_notification`,task_id:e,tool_use_id:n?.toolUseId,status:t,output_file:n?.outputFile??``,summary:n?.summary??``,usage:n?.usage})}var jt,M,Mt=e((()=>{a(),jt=1e3,M=[]})),Nt=t({activateProactive:()=>Pt,deactivateProactive:()=>Ft,getActivationSource:()=>Ut,getNextTickAt:()=>Ht,isContextBlocked:()=>Bt,isProactiveActive:()=>P,isProactivePaused:()=>It,pauseProactive:()=>Lt,resumeProactive:()=>Rt,setContextBlocked:()=>zt,setNextTickAt:()=>Vt,shouldTick:()=>Gt,subscribeToProactiveChanges:()=>Wt});function N(){for(let e of B)try{e()}catch{}}function P(){return F}function Pt(e){F||(F=!0,I=!1,L=!1,z=e,N())}function Ft(){F&&(F=!1,I=!1,L=!1,R=null,z=void 0,N())}function It(){return I}function Lt(){!F||I||(I=!0,R=null,N())}function Rt(){!F||!I||(I=!1,N())}function zt(e){L!==e&&(L=e,e&&(R=null),N())}function Bt(){return L}function Vt(e){R=e,N()}function Ht(){return!F||I||L?null:R}function Ut(){return z}function Wt(e){return B.add(e),()=>{B.delete(e)}}function Gt(){return F&&!I&&!L}var F,I,L,R,z,B,Kt=e((()=>{F=!1,I=!1,L=!1,R=null,B=new Set}));function qt(){V(),q=setInterval(()=>{v(`debug`,`session_keepalive_heartbeat`,{refcount:W}),n(process.env.CLAUDE_CODE_REMOTE_SEND_KEEPALIVES)&&U?.()},H)}function Jt(){V(),U!==null&&(J=setTimeout(()=>{v(`info`,`session_idle_30s`),J=null},H))}function V(){J!==null&&(clearTimeout(J),J=null)}function Yt(e){U=e,W>0&&q===null&&qt()}function Xt(){U=null,q!==null&&(clearInterval(q),q=null),V()}function Zt(){n(process.env.CLAUDE_CODE_REMOTE_SEND_KEEPALIVES)&&U?.()}function Qt(){return U!==null}function $t(e){W++,G.set(e,(G.get(e)??0)+1),W===1&&(K=Date.now(),U!==null&&q===null&&qt()),tn||(tn=!0,g(async()=>{v(`info`,`session_activity_at_shutdown`,{refcount:W,active:Object.fromEntries(G),oldest_activity_ms:W>0&&K!==null?Date.now()-K:null})}))}function en(e){W>0&&W--;let t=(G.get(e)??0)-1;t>0?G.set(e,t):G.delete(e),W===0&&q!==null&&(clearInterval(q),q=null,Jt())}var H,U,W,G,K,q,J,tn,nn=e((()=>{m(),ee(),r(),H=3e4,U=null,W=0,G=new Map,K=null,q=null,J=null,tn=!1}));function rn(){return!1}async function an(){return!1}function on(){return!1}function sn(){return!0}function cn(){return null}var ln=e((()=>{ae(),te(),r(),Ct()}));function un(e){xn=e}function dn(e,t){if(X=e,!e||!t?.replayCurrent)return;let n=gn();Object.keys(n).length!==0&&e(n)}function fn(e){Sn=e}function pn(e){return!e||e.enabled!==!0?null:{enabled:!0,phase:e.phase===`standby`||e.phase===`sleeping`?e.phase:null,next_tick_at:typeof e.next_tick_at==`number`?e.next_tick_at:null,sleep_until:typeof e.sleep_until==`number`?e.sleep_until:null}}function mn(e){return JSON.stringify(e)}function hn(e){let t={...$};for(let n of Object.keys(e)){let r=e[n];if(r===void 0){delete t[n];continue}t[n]=r}$=t}function gn(){let e={...$};return Q?e.automation_state={...Q}:`automation_state`in $&&(e.automation_state=$.automation_state??null),e}function _n(){return Cn}function vn(e,t){Cn=e,xn?.(e,t),e===`requires_action`&&t?(Z=!0,Y({pending_action:t})):Z&&(Z=!1,Y({pending_action:null})),e===`idle`&&Y({task_summary:null}),e!==`idle`&&yn(P()?{enabled:!0,phase:null,next_tick_at:null,sleep_until:null}:null),n(process.env.CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS)&&j({type:`system`,subtype:`session_state_changed`,state:e})}function Y(e){hn(e),X?.(e)}function yn(e){let t=pn(e);mn(t)!==mn(Q)&&(Q=t,hn({automation_state:t}),X?.({automation_state:t}))}function bn(e){Sn?.(e)}var xn,X,Sn,Z,Cn,Q,$,wn=e((()=>{Kt(),r(),Mt(),xn=null,X=null,Sn=null,Z=!1,Cn=`idle`,Q=null,$={}}));export{Qe as $,kt as A,Ct as B,Kt as C,Nt as D,It as E,Tt as F,_t as G,St as H,Ot as I,mt as J,pt as K,Dt as L,j as M,Mt as N,Vt as O,Et as P,nt as Q,yt as R,Xt as S,P as T,vt as U,xt as V,ht as W,dt as X,at as Y,E as Z,Qt as _,de as _t,Y as a,qe as at,$t as b,dn as c,Te as ct,ln as d,Ce as dt,it as et,rn as f,xe as ft,nn as g,ue as gt,on as h,me as ht,bn as i,Ge as it,At as j,Gt as k,un as l,Ee as lt,sn as m,ge as mt,wn as n,Ze as nt,vn as o,Oe as ot,an as p,ye as pt,ft as q,yn as r,Ke as rt,fn as s,Le as st,_n as t,Je as tt,cn as u,we as ut,Yt as v,se as vt,Bt as w,en as x,Zt as y,ce as yt,bt as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Rr as e,jr as t,si as n}from"./loadAgentsDir-ByO8eJqU.js";t();export{e as linkSessionToPR,n as recordTranscript};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
2
|
-
`);return n.length>S?n.slice(-1e3):n}async function x(e,t){let n=e.trim();if(!n)return null;try{let e=c((await
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{A as t,w as n}from"./external-CEp-aPkt.js";import{n as r,r as i,t as a}from"./lazySchema-B4D4qJVE.js";import{$t as o,z as s}from"./state-C2OSZkV1.js";import{Ba as c,Yg as l,eo as u,et as d,tt as f}from"./loadAgentsDir-ByO8eJqU.js";import{a as p,l as m}from"./debug-RZ4NuXyS.js";import{s as h,u as g}from"./types-D7_37tP2.js";import{n as _,r as v}from"./analytics-CkYUHW_U.js";import{gt as y}from"./sessionState-CjNY991n.js";function b(e){let t=[];for(let n of e){if(n.type!==`user`&&n.type!==`assistant`||`isMeta`in n&&n.isMeta||`origin`in n&&n.origin&&n.origin.kind!==`human`)continue;let e=n.message.content;if(typeof e==`string`)t.push(e);else if(Array.isArray(e))for(let n of e)`type`in n&&n.type===`text`&&`text`in n&&t.push(n.text)}let n=t.join(`
|
|
2
|
+
`);return n.length>S?n.slice(-1e3):n}async function x(e,t){let n=e.trim();if(!n)return null;try{let e=c((await f({systemPrompt:y([C]),userPrompt:n,outputFormat:{type:`json_schema`,schema:{type:`object`,properties:{title:{type:`string`}},required:[`title`],additionalProperties:!1}},signal:t,options:{querySource:`generate_session_title`,agents:[],isNonInteractiveSession:s(),hasAppendSystemPrompt:!1,mcpTools:[]}})).message.content),r=w().safeParse(g(e)),i=r.success&&r.data.title.trim()||null;return v(`tengu_session_title_generated`,{success:i!==null}),i}catch(e){return m(`generateSessionTitle failed: ${e}`,{level:`error`}),v(`tengu_session_title_generated`,{success:!1}),null}}var S,C,w,T=e((()=>{i(),o(),_(),d(),p(),h(),a(),u(),l(),S=1e3,C=`Generate a concise, sentence-case title (3-7 words) that captures the main topic or goal of this coding session. The title should be clear enough that the user recognizes the session in a list. Use sentence case: capitalize only the first word and proper nouns.
|
|
3
3
|
|
|
4
4
|
Return JSON with a single "title" field.
|
|
5
5
|
|
|
@@ -11,4 +11,4 @@ Good examples:
|
|
|
11
11
|
|
|
12
12
|
Bad (too vague): {"title": "Code changes"}
|
|
13
13
|
Bad (too long): {"title": "Investigate and fix the issue where the login button does not respond on mobile devices"}
|
|
14
|
-
Bad (wrong case): {"title": "Fix Login Button On Mobile"}`,w=r(()=>
|
|
14
|
+
Bad (wrong case): {"title": "Fix Login Button On Mobile"}`,w=r(()=>n({title:t()}))}));export{x as n,T as r,b as t};
|