@readmagic/workmate 0.0.8 → 0.0.9
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-qFZy3FOD.js +1 -0
- package/dist/chunks/App-DW4elk6E.js +1 -0
- package/dist/chunks/ApproveApiKey-D05WywHU.js +1 -0
- package/dist/chunks/ApproveApiKey-DHAbdwkC.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-QgFwoaaC.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-BuRFF1fQ.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-CDrArsSX.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DpecRCAt.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-D1MYL1dJ.js +1 -0
- package/dist/chunks/DiffDialog-BIcwpgSr.js +6 -0
- package/dist/chunks/Doctor-D160J8Ad.js +3 -0
- package/dist/chunks/Doctor-VhJi2cmL.js +1 -0
- package/dist/chunks/ExitFlow-CoWHhKHJ.js +2 -0
- package/dist/chunks/Grove-BmirUB6V.js +11 -0
- package/dist/chunks/{HybridTransport-BJPOG2wl.js → HybridTransport-BVmSUHf0.js} +1 -1
- package/dist/chunks/InvalidConfigDialog-WRywkKeS.js +1 -0
- package/dist/chunks/InvalidSettingsDialog-C4n3A72C.js +1 -0
- package/dist/chunks/MCPConnectionManager-DPFe4hPh.js +1 -0
- package/dist/chunks/MCPToolListView-BPmE0C2o.js +1 -0
- package/dist/chunks/McpParsingWarnings-CH4yyMAL.js +1 -0
- package/dist/chunks/MessageSelector-kOn2GaU-.js +3 -0
- package/dist/chunks/Messages-4EnHFeh1.js +11 -0
- package/dist/chunks/Onboarding-BboWs1pp.js +1 -0
- package/dist/chunks/{PermissionDialog-0ya1CU5k.js → PermissionDialog-Cb3z8OUP.js} +1 -1
- package/dist/chunks/{PressEnterToContinue-Dl9Hg9Mf.js → PressEnterToContinue-Dq0Imo9c.js} +1 -1
- package/dist/chunks/PromptInputFooterSuggestions-BpC9COmh.js +1 -0
- package/dist/chunks/PromptInputHelpMenu-BvcAzbSi.js +1 -0
- package/dist/chunks/QueryEngine-J6ElcO16.js +1 -0
- package/dist/chunks/REPL-DBjbAJsm.js +133 -0
- package/dist/chunks/REPL-oBemMXvp.js +1 -0
- package/dist/chunks/RemoteSessionManager-CoIyFKKa.js +2 -0
- package/dist/chunks/ResumeConversation-wBG8OD9P.js +1 -0
- package/dist/chunks/{SSETransport-CrwbKuVt.js → SSETransport-1KBBUikF.js} +1 -1
- package/dist/chunks/{SearchBox-vfLXEPed.js → SearchBox-C9vUA4IM.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-BugrzImr.js +1 -0
- package/dist/chunks/Settings-DptKuJE7.js +2 -0
- package/dist/chunks/TeleportProgress-BmgPAZAi.js +1 -0
- package/dist/chunks/TeleportRepoMismatchDialog-sgxNOeM_.js +1 -0
- package/dist/chunks/TeleportResumeWrapper-GptvrUdv.js +1 -0
- package/dist/chunks/ThemePicker-gAMqqD1P.js +1 -0
- package/dist/chunks/{TrustDialog-BukWGvHZ.js → TrustDialog-CWt-4Evl.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-DokTJQwi.js → ValidationErrorsList-De3kzHtz.js} +1 -1
- package/dist/chunks/{WelcomeV2-Ci9VwPYh.js → WelcomeV2-BWF-cJOu.js} +1 -1
- package/dist/chunks/add-dir-DBVT1cEK.js +1 -0
- package/dist/chunks/{agentDisplay-DBQYOaOh.js → agentDisplay-5gnCQwUY.js} +1 -1
- package/dist/chunks/{agents-HlKk68Qc.js → agents-Bz1MLp4A.js} +1 -1
- package/dist/chunks/agents-CnwTOlqO.js +103 -0
- package/dist/chunks/allErrors-DYw_q14e.js +1 -0
- package/dist/chunks/analytics-DJobLaWP.js +1 -0
- package/dist/chunks/api-DXDXTFGa.js +1 -0
- package/dist/chunks/{api-CF5IVtj0.js → api-DzccRM_z.js} +1 -1
- package/dist/chunks/auth-Cjnyy10u.js +15 -0
- package/dist/chunks/auth-CnLb6RWc.js +1 -0
- package/dist/chunks/auth-D-SGHS0K.js +1 -0
- package/dist/chunks/{autoMode-Cr0AhS1G.js → autoMode-CQ5nqP9c.js} +4 -4
- package/dist/chunks/{autonomy-ARUQt-Lu.js → autonomy-CPUCe-YU.js} +1 -1
- package/dist/chunks/autonomy-dSJl0hN1.js +15 -0
- package/dist/chunks/{autonomyPanel-BQK9MoeB.js → autonomyPanel-Ccr9ilei.js} +1 -1
- package/dist/chunks/backgroundHousekeeping--cs5crp7.js +17 -0
- package/dist/chunks/backgroundHousekeeping-CcbHitKC.js +1 -0
- package/dist/chunks/{banner-Ca7rki2V.js → banner-BJZNMppT.js} +1 -1
- package/dist/chunks/bg-DWloqGwk.js +1 -0
- package/dist/chunks/{bg-DxRHF1yn.js → bg-w3Vlsm3Y.js} +2 -2
- package/dist/chunks/branch-CG0AKS1J.js +3 -0
- package/dist/chunks/{break-cache-BKvoMOZx.js → break-cache-DXV0brco.js} +2 -2
- package/dist/chunks/bridgeConfig-Dmc1ZDev.js +1 -0
- package/dist/chunks/{bridgeConfig-jDEva6Eh.js → bridgeConfig-vORehbGG.js} +1 -1
- package/dist/chunks/{bridgeMessaging-YqYdl6ej.js → bridgeMessaging-DlczTV9X.js} +1 -1
- package/dist/chunks/{bridgePointer-DIM0sj0x.js → bridgePointer-D4W9GpWw.js} +1 -1
- package/dist/chunks/btw-DDUC_t0w.js +1 -0
- package/dist/chunks/caches-1IFb6_M_.js +1 -0
- package/dist/chunks/caches-CB8MHqy2.js +1 -0
- package/dist/chunks/{capacityWake-CKOiRELo.js → capacityWake-L7b1mMft.js} +1 -1
- package/dist/chunks/{ccrClient-BC2q3k44.js → ccrClient-CG6HTv_n.js} +1 -1
- package/dist/chunks/{claudeDesktop-DQXL5bGm.js → claudeDesktop-CAmnheYx.js} +1 -1
- package/dist/chunks/{clear-1etSJhdg.js → clear-DdWexxbM.js} +1 -1
- package/dist/chunks/{cliLaunch-CQjLYRzM.js → cliLaunch-BWWOgBFh.js} +1 -1
- package/dist/chunks/{client-DQwf_b9o.js → client-CoXtVRzi.js} +1 -1
- package/dist/chunks/client-Crrwkw7g.js +1 -0
- package/dist/chunks/client-D8hKghba.js +1 -0
- package/dist/chunks/color-Cuq0c6xy.js +1 -0
- package/dist/chunks/commands-D3sESsTp.js +1 -0
- package/dist/chunks/compact-DIpwuBDq.js +2 -0
- package/dist/chunks/config-CVvUNkj2.js +1 -0
- package/dist/chunks/config-D4G8_MqJ.js +3 -0
- package/dist/chunks/config-q9D4hFiK.js +1 -0
- package/dist/chunks/context-BWcfhhDj.js +1 -0
- package/dist/chunks/context-noninteractive-Bwt9A3XD.js +1 -0
- package/dist/chunks/{context-noninteractive-Ct_ttQfP.js → context-noninteractive-c7jGVWHQ.js} +2 -2
- package/dist/chunks/conversation-Bjo_8kia.js +1 -0
- package/dist/chunks/conversation-DrHZIQX2.js +1 -0
- package/dist/chunks/{createSSHSession-BmHXA2me.js → createSSHSession-DP7B8yvb.js} +1 -1
- package/dist/chunks/{createSession-C4rukWkv.js → createSession-CPo6GBSb.js} +1 -1
- package/dist/chunks/createSession-DnykRoia.js +1 -0
- package/dist/chunks/crossProjectResume-D2A-qjgP.js +40 -0
- package/dist/chunks/cwd--q1ONL7P.js +1 -0
- package/dist/chunks/{cwd-C5ce-7WB.js → cwd-L4wygFqJ.js} +1 -1
- package/dist/chunks/{daemon-ZtpTZWgQ.js → daemon-D2vFIVOz.js} +1 -1
- package/dist/chunks/datadog-DrmHyl3_.js +1 -0
- package/dist/chunks/{debug-RZ4NuXyS.js → debug-BdqxZ7rV.js} +4 -4
- package/dist/chunks/{debugUtils-D30M1cbN.js → debugUtils-CezNYZ-4.js} +1 -1
- package/dist/chunks/{detached-jrVP11oU.js → detached-CkPpYMJj.js} +1 -1
- package/dist/chunks/detectRepository-DA1Q_Skc.js +1 -0
- package/dist/chunks/{detectRepository-CFiHe6Rv.js → detectRepository-DvxoaPlk.js} +1 -1
- package/dist/chunks/{diff-BKiK3xHv.js → diff-DHzz9WAp.js} +1 -1
- package/dist/chunks/directoryCompletion-D5AvL7TF.js +1 -0
- package/dist/chunks/doctor-PWqB46xd.js +1 -0
- package/dist/chunks/entry-4JtoJONR.js +14 -0
- package/dist/chunks/envUtils-BDhHQY0-.js +1 -0
- package/dist/chunks/{esm-BLPbfHQd.js → esm-DcIr7tVd.js} +1 -1
- package/dist/chunks/{execFileNoThrow-CCX-JY8h.js → execFileNoThrow-5SylUnAI.js} +1 -1
- package/dist/chunks/{execSyncWrapper-dhRSYGFW.js → execSyncWrapper-DKuxVTaf.js} +1 -1
- package/dist/chunks/exit-OW9g7b9A.js +1 -0
- package/dist/chunks/extraUsage-Dt5mw35U.js +1 -0
- package/dist/chunks/extractMemories-1VlmCGwa.js +1 -0
- package/dist/chunks/fast-ClYQcEv5.js +1 -0
- package/dist/chunks/fast-CrvLdpy3.js +1 -0
- package/dist/chunks/fileSuggestions-fNxREjpe.js +3 -0
- package/dist/chunks/firstPartyEventLogger-BBXEQUf0.js +1 -0
- package/dist/chunks/firstPartyEventLogger-DhEPWcit.js +5 -0
- package/dist/chunks/{flushGate-Cnsu4HET.js → flushGate-ch-Tvwjj.js} +1 -1
- package/dist/chunks/{fpsMetrics-Cf_hdtiJ.js → fpsMetrics-DffAomdg.js} +1 -1
- package/dist/chunks/{gemini-Cudre91e.js → gemini-fZ0VPU2A.js} +1 -1
- package/dist/chunks/generateRecap-BIBVlB__.js +1 -0
- package/dist/chunks/generateSessionName-nZj_VvKZ.js +1 -0
- package/dist/chunks/{genericProcessUtils-DVfMHhfy.js → genericProcessUtils-BmDSLcMf.js} +1 -1
- package/dist/chunks/{git-BerW9bId.js → git-B9uvt96d.js} +1 -1
- package/dist/chunks/git-BfS5Hk4S.js +1 -0
- package/dist/chunks/githubRepoPathMapping-Cqx3pSfc.js +1 -0
- package/dist/chunks/goal-IasZVqKh.js +3 -0
- package/dist/chunks/grok-Dk3LyzMa.js +1 -0
- package/dist/chunks/grove-BE4fQ6tG.js +7 -0
- package/dist/chunks/help-D2-v9Ug9.js +1 -0
- package/dist/chunks/{hooks-BZJTWD07.js → hooks-BrKy5XWQ.js} +2 -2
- package/dist/chunks/hooks-DGd02IKF.js +1 -0
- package/dist/chunks/initReplBridge-RhCAlmHE.js +1 -0
- package/dist/chunks/{install-BI---dv0.js → install-CVGZ55wV.js} +1 -1
- package/dist/chunks/{instrumentation-CcWzhGfE.js → instrumentation-BmWotlxR.js} +4 -4
- package/dist/chunks/{job-B0ftcqPF.js → job-DEXxW_Zo.js} +1 -1
- package/dist/chunks/{jwtUtils-C0cE-1Ey.js → jwtUtils-C9sdGhvT.js} +1 -1
- package/dist/chunks/keybindings-BRdSOSUD.js +2 -0
- package/dist/chunks/language-C0cIpKE2.js +1 -0
- package/dist/chunks/{language-s-dLbdVz.js → language-CxThoWRC.js} +1 -1
- package/dist/chunks/launchLocalMemory-CLSSVFoj.js +3 -0
- package/dist/chunks/launchOnboarding-BkJfKviO.js +8 -0
- package/dist/chunks/loadAgentsDir-8UprzS4w.js +1 -0
- package/dist/chunks/{loadAgentsDir-ByO8eJqU.js → loadAgentsDir-CKSb56Gp.js} +673 -759
- package/dist/chunks/loadPluginHooks-LbaURHVH.js +1 -0
- package/dist/chunks/{localSearch-CHHCH16D.js → localSearch-CPOnyi8I.js} +1 -1
- package/dist/chunks/localSearch-DNjbr4S9.js +1 -0
- package/dist/chunks/{log-CZ0zYP_c.js → log-CTFl4qpD.js} +1 -1
- package/dist/chunks/logoV2Utils-we1sfJvf.js +1 -0
- package/dist/chunks/{magicDocs-C5i5ruuU.js → magicDocs-DmKlTQvK.js} +3 -3
- package/dist/chunks/main-BIiwW4mM.js +605 -0
- package/dist/chunks/{main-BLD4QAQg.js → main-ClXu1ilx.js} +2 -2
- package/dist/chunks/{managedEnv-C-9XSN14.js → managedEnv-Cl7YbYzf.js} +1 -1
- package/dist/chunks/managedEnv-CpiiQx_v.js +1 -0
- package/dist/chunks/{mappers-CHRFic5q.js → mappers-xQC-Z4-h.js} +1 -1
- package/dist/chunks/mcp-B_m1XBDt.js +6 -0
- package/dist/chunks/mcp-BiyfH9Sd.js +1 -0
- package/dist/chunks/mcp-BjlaPUWX.js +2 -0
- package/dist/chunks/{memoize-B8hfb1JN.js → memoize-FJv2HV1u.js} +1 -1
- package/dist/chunks/memory-LN8f_p2b.js +1 -0
- package/dist/chunks/{modalContext-DFjKLCB6.js → modalContext-CUThy6Ph.js} +1 -1
- package/dist/chunks/mode-lYTs0XHs.js +2 -0
- package/dist/chunks/model-C2e73CJD.js +1 -0
- package/dist/chunks/model-CvmS-Esk.js +1 -0
- package/dist/chunks/model-DJ8mFfuR.js +1 -0
- package/dist/chunks/modelOptions-efCGKnXT.js +1 -0
- package/dist/chunks/nativeInstaller-DQIFwdat.js +1 -0
- package/dist/chunks/oauth-BN2I0_jl.js +1 -0
- package/dist/chunks/oauth-C9VBDB0Y.js +1 -0
- package/dist/chunks/omit-CLPZGevl.js +1 -0
- package/dist/chunks/onChangeAppState-DhBO34OK.js +1 -0
- package/dist/chunks/{openai-DPH6rXOZ.js → openai-DJLYqiRl.js} +2 -2
- package/dist/chunks/{panel-mD094ALT.js → panel-q0_iT9cg.js} +1 -1
- package/dist/chunks/panelCall-sum-3zvi.js +1 -0
- package/dist/chunks/parser-BcdhBGx0.js +1 -0
- package/dist/chunks/{parser-dbHRgXb8.js → parser-BdCj2GrE.js} +1 -1
- package/dist/chunks/partition-CpfoVrg1.js +1 -0
- package/dist/chunks/permissions-DTb9wkAP.js +3 -0
- package/dist/chunks/pidLock-BR5M6RQw.js +3 -0
- package/dist/chunks/{pipeTransport-DVOKR4c_.js → pipeTransport-B3TIkTAp.js} +1 -1
- package/dist/chunks/plan-BeoIjNPv.js +1 -0
- package/dist/chunks/{platform-DCXXznJg.js → platform-D6IMiyqT.js} +1 -1
- package/dist/chunks/plugin-D_dHjTud.js +17 -0
- package/dist/chunks/pluginAutoupdate-BHKlOOXI.js +1 -0
- package/dist/chunks/pluginBlocklist-D93Hd1GF.js +1 -0
- package/dist/chunks/pluginCliCommands-vv0wNt4O.js +1 -0
- package/dist/chunks/{pluginFlagging-pBxSselw.js → pluginFlagging-CxuRF2Vc.js} +1 -1
- package/dist/chunks/pluginOperations-BTq4AjYB.js +2 -0
- package/dist/chunks/{pluginStartupCheck-Di4LjHXf.js → pluginStartupCheck-B6leNWq9.js} +1 -1
- package/dist/chunks/pluginStartupCheck-DBOCHUHQ.js +1 -0
- package/dist/chunks/plugins-pmipe7kE.js +4 -0
- package/dist/chunks/{poorMode-CYXmr_mU.js → poorMode-BxsyllUK.js} +1 -1
- package/dist/chunks/poorMode-iV1NwC5L.js +1 -0
- package/dist/chunks/print-CAUvczBM.js +23 -0
- package/dist/chunks/processBashCommand-CdeQg_c6.js +1 -0
- package/dist/chunks/processSlashCommand-CbkshIC6.js +5 -0
- package/dist/chunks/{projectContext-D9MDwJUF.js → projectContext-CIxul6vA.js} +1 -1
- package/dist/chunks/{projectContext-BaDZBAoK.js → projectContext-RUMJB798.js} +1 -1
- package/dist/chunks/prompt-CybUvG8G.js +139 -0
- package/dist/chunks/prompt-RBn4JdEg.js +1 -0
- package/dist/chunks/prompt-Rb8zXlDo.js +1 -0
- package/dist/chunks/promptEditor-0Ug93P2I.js +4 -0
- package/dist/chunks/{protocolHandler-RNKkhq91.js → protocolHandler-ClfbHTjI.js} +1 -1
- package/dist/chunks/{proxy-BmtEnJ02.js → proxy-Blq4W6Ox.js} +1 -1
- package/dist/chunks/reconciler-Drq3HSkj.js +4 -0
- package/dist/chunks/refresh-D8TLHO_T.js +1 -0
- package/dist/chunks/{registerProtocol-DoKqmqu2.js → registerProtocol-3_ozAuDK.js} +1 -1
- package/dist/chunks/reload-plugins-Dn1ibOiI.js +1 -0
- package/dist/chunks/{remoteBridgeCore-Cddqv2WW.js → remoteBridgeCore-Dpg6Se9C.js} +1 -1
- package/dist/chunks/remoteManagedSettings-CCrq-qL-.js +1 -0
- package/dist/chunks/rename-CKsSc7Z3.js +1 -0
- package/dist/chunks/{renderOptions-ChLwxtVu.js → renderOptions-CLcco6fc.js} +1 -1
- package/dist/chunks/replBridgeHandle-DNC797_T.js +1 -0
- package/dist/chunks/resume-B1a5gLVR.js +2 -0
- package/dist/chunks/ripgrep-BisRODQ2.js +1 -0
- package/dist/chunks/{ripgrep-gaT9Njwi.js → ripgrep-DkL2S7-I.js} +1 -1
- package/dist/chunks/{runtimeObserver-CsIwinzh.js → runtimeObserver-B0xfyLiA.js} +1 -1
- package/dist/chunks/{runtimeObserver-Dbxxw4ls.js → runtimeObserver-DonWCJOx.js} +4 -4
- package/dist/chunks/sandbox-adapter-BnBOSkKJ.js +1 -0
- package/dist/chunks/sandbox-toggle-CSdnHWp-.js +1 -0
- package/dist/chunks/searchExtraTools-DbgfnQkH.js +1 -0
- package/dist/chunks/session-BbQlh2S5.js +2 -0
- package/dist/chunks/sessionFileAccessHooks-Xfr1NiXG.js +1 -0
- package/dist/chunks/sessionMemory-7UOFdp29.js +1 -0
- package/dist/chunks/sessionMemory-fAzgAS7Q.js +1 -0
- package/dist/chunks/sessionMemoryUtils-DVjFw5Bd.js +1 -0
- package/dist/chunks/sessionObserver-Cl26OdaW.js +1 -0
- package/dist/chunks/{sessionObserver-DoYc0ZOP.js → sessionObserver-XV6N0XER.js} +2 -2
- package/dist/chunks/{sessionState-CjNY991n.js → sessionState-BvECKycx.js} +1 -1
- package/dist/chunks/sessionStorage-DSj9yZkl.js +1 -0
- package/dist/chunks/{sessionStoragePortable-Cx6JQ5Ye.js → sessionStoragePortable-JZnGwqUM.js} +1 -1
- package/dist/chunks/sessionTitle-E1FvsKM9.js +14 -0
- package/dist/chunks/sessionTracing-ClGQ08jM.js +11 -0
- package/dist/chunks/settings-B-R9ZJNY.js +1 -0
- package/dist/chunks/settings-Xbq6AaD-.js +20 -0
- package/dist/chunks/settingsSync-NCN0a4sc.js +1 -0
- package/dist/chunks/setup-uZ0dSekt.js +3 -0
- package/dist/chunks/shadowedRuleDetection-B9iSx6mB.js +1 -0
- package/dist/chunks/{shellQuote-BUVKMu_P.js → shellQuote-Bth6IZgX.js} +1 -1
- package/dist/chunks/{sideQuestion-C780iYwd.js → sideQuestion-D2dPToW8.js} +3 -3
- package/dist/chunks/sinks-C7q46rvE.js +2 -0
- package/dist/chunks/sinks-D3bXeHlQ.js +1 -0
- package/dist/chunks/skillChangeDetector-C1EJ7rUL.js +1 -0
- package/dist/chunks/{skillGapStore-Dc1arohs.js → skillGapStore-DylpOKJ6.js} +2 -2
- package/dist/chunks/{skillLifecycle-DP6mY1Kp.js → skillLifecycle-GK-8eyyn.js} +2 -2
- package/dist/chunks/{skillSearchPanel-CpLTImaL.js → skillSearchPanel-mpaC62y4.js} +4 -4
- package/dist/chunks/skills-t6krW8GZ.js +1 -0
- package/dist/chunks/{src-CDCSSo0U2.js → src-P_wYS_NJ2.js} +1 -1
- package/dist/chunks/{src-CST_jFnT.js → src-r6ZFgWPx2.js} +1 -1
- package/dist/chunks/startupProfiler-BaiXZ9tr.js +1 -0
- package/dist/chunks/{startupProfiler-DCn_NxMH.js → startupProfiler-jeId9f2i.js} +2 -2
- package/dist/chunks/state-B4HwLt8i.js +1 -0
- package/dist/chunks/{state-Cn_m2NOf.js → state-BAGmpVBn.js} +1 -1
- package/dist/chunks/state-Bs5xweDL.js +1 -0
- package/dist/chunks/{staticRender-BIxpgNUq.js → staticRender-DrU6eWoq.js} +1 -1
- package/dist/chunks/{stats-Duk7_xjQ.js → stats-BJBhl-Lc.js} +1 -1
- package/dist/chunks/{status-peiVB_2j.js → status-BtsnKNVY.js} +1 -1
- package/dist/chunks/status-nZQEar7T.js +2 -0
- package/dist/chunks/{statusNoticeHelpers-B5U5c9PE.js → statusNoticeHelpers-DMqRGFOh.js} +1 -1
- package/dist/chunks/{stringUtils-B6FudhoZ.js → stringUtils-CbS6OkmE.js} +1 -1
- package/dist/chunks/subprocessEnv-CZkA9Cdp.js +1 -0
- package/dist/chunks/{subprocessEnv-vrwzMgKn.js → subprocessEnv-Ci8VV_bi.js} +1 -1
- package/dist/chunks/{switcher-BAMqSX7Z.js → switcher-77h2J5HC.js} +1 -1
- package/dist/chunks/switcher-B2CYzCC_.js +1 -0
- package/dist/chunks/{syncCache-Zl9kZRRl.js → syncCache-By_-buUC.js} +1 -1
- package/dist/chunks/tasks-BNrdmF9p.js +1 -0
- package/dist/chunks/teleport-mdnhIZBj.js +1 -0
- package/dist/chunks/{templateJobs-DR5fKFiO.js → templateJobs-Dkv4I9c1.js} +1 -1
- package/dist/chunks/{terminalSetup-DgRBt-JJ.js → terminalSetup-DQopnSPR.js} +1 -1
- package/dist/chunks/terminalSetup-DTGm1Eo2.js +33 -0
- package/dist/chunks/{theme-Bz6esfST.js → theme-BjpBVRf5.js} +1 -1
- package/dist/chunks/{tmux-DSU9tYIo.js → tmux-CMRiI6CD.js} +1 -1
- package/dist/chunks/{toolEventObserver-BSekCkM2.js → toolEventObserver-D-sNBvOe.js} +1 -1
- package/dist/chunks/toolPool-Di30gn_Y.js +1 -0
- package/dist/chunks/trustedDevice-CupLMpO8.js +1 -0
- package/dist/chunks/{trustedDevice-B0x9X0fb.js → trustedDevice-j1u2TG5U.js} +1 -1
- package/dist/chunks/{types-D7_37tP2.js → types-DWRxAH0E.js} +1 -1
- package/dist/chunks/{udsClient-CHoMMH28.js → udsClient-Cm3HqYUu.js} +1 -1
- package/dist/chunks/{updateCCB-D_kGQKPT.js → updateCCB-BlUAU2Vp.js} +8 -8
- package/dist/chunks/{upstreamproxy-Hmq-n8fw.js → upstreamproxy-DDVMwoRi.js} +1 -1
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-D2FvHieH.js +1 -0
- package/dist/chunks/useMainLoopModel-ylPQNj7Z.js +1 -0
- package/dist/chunks/useManagePlugins-BbWJNLe8.js +1 -0
- package/dist/chunks/useMergedTools-B-Z9XQ6U.js +1 -0
- package/dist/chunks/useSearchInput-C6d6nt9S.js +1 -0
- package/dist/chunks/useSettingsErrors-DKh4rkGi.js +1 -0
- package/dist/chunks/{userAgent-BxTG7IMk.js → userAgent-Ng_TTjWr.js} +1 -1
- package/dist/chunks/util-D-X8i5Z2.js +1 -0
- package/dist/chunks/validatePlugin-DSw08u76.js +1 -0
- package/dist/chunks/vim-3mUqsEJm.js +1 -0
- package/dist/chunks/{which-CHLNJmtJ.js → which-DznMOwny.js} +1 -1
- package/dist/chunks/windowsPaths-1mgenSWa.js +1 -0
- package/dist/chunks/{windowsPaths-o62uq6LF.js → windowsPaths-BVztIhXM.js} +1 -1
- package/dist/chunks/{workSecret-DG9shvG0.js → workSecret-DtiFreRl.js} +1 -1
- package/dist/chunks/workerRegistry-DdOYjLm3.js +6 -0
- package/dist/chunks/worktree-BX1ULzrw.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AddWorkspaceDirectory-CwLtQld4.js +0 -1
- package/dist/chunks/App-Ba52HvYC.js +0 -1
- package/dist/chunks/ApproveApiKey-CEIfuUh0.js +0 -1
- package/dist/chunks/ApproveApiKey-D2MLQu2P.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-IGDrkbWl.js +0 -2
- package/dist/chunks/BypassPermissionsModeDialog-GYhq--JR.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-C-CTa-95.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-Catv6BCJ.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-BeQXqUtX.js +0 -1
- package/dist/chunks/DiffDialog-AC5DSJrq.js +0 -6
- package/dist/chunks/Doctor-B9Rxsoy0.js +0 -1
- package/dist/chunks/Doctor-lhUBhEy5.js +0 -3
- package/dist/chunks/ExitFlow-Cu8SoQHs.js +0 -2
- package/dist/chunks/Grove-Bc4CofEj.js +0 -11
- package/dist/chunks/InvalidConfigDialog-BI13il58.js +0 -1
- package/dist/chunks/InvalidSettingsDialog-CtOheV1K.js +0 -1
- package/dist/chunks/MCPConnectionManager-ao-P3xSA.js +0 -1
- package/dist/chunks/MCPToolListView-dkofcJs4.js +0 -1
- package/dist/chunks/McpParsingWarnings-BS4JoR5l.js +0 -1
- package/dist/chunks/MessageSelector-B88b2ypw.js +0 -3
- package/dist/chunks/Messages-BPeI7lLV.js +0 -11
- package/dist/chunks/Onboarding-c2fQ8Io_.js +0 -1
- package/dist/chunks/PromptInputFooterSuggestions-D1cH9sDX.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-DDD5WuK0.js +0 -1
- package/dist/chunks/QueryEngine-Cv_meCam.js +0 -1
- package/dist/chunks/REPL-BXhAQOXb.js +0 -139
- package/dist/chunks/REPL-YqjLnr3A.js +0 -1
- package/dist/chunks/RemoteSessionManager-CT7T8BaR.js +0 -2
- package/dist/chunks/ResumeConversation-CIZCjms9.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-Dx6093yw.js +0 -1
- package/dist/chunks/Settings-CyUm0AtU.js +0 -2
- package/dist/chunks/TeleportProgress-C3qyp5zy.js +0 -1
- package/dist/chunks/TeleportRepoMismatchDialog-BV--nyYn.js +0 -1
- package/dist/chunks/TeleportResumeWrapper-Blo2cZg-.js +0 -1
- package/dist/chunks/ThemePicker-EQ6hPUeI.js +0 -1
- package/dist/chunks/add-dir-DPQV0qml.js +0 -1
- package/dist/chunks/agents-DmybpgDN.js +0 -103
- package/dist/chunks/allErrors-BPn_2TrB.js +0 -1
- package/dist/chunks/analytics-CkYUHW_U.js +0 -1
- package/dist/chunks/ant-DjdvlLOo.js +0 -1
- package/dist/chunks/api-AMgj1zf_.js +0 -1
- package/dist/chunks/asciicast-BJNYO5sh.js +0 -4
- package/dist/chunks/asciicast-CH6hdK0a.js +0 -1
- package/dist/chunks/auth-CNjDn1VY.js +0 -15
- package/dist/chunks/auth-CZzP483s.js +0 -1
- package/dist/chunks/auth-DDSBm_Yj.js +0 -1
- package/dist/chunks/autonomy-D4xZLOdJ.js +0 -15
- package/dist/chunks/backgroundHousekeeping--eBgphcg.js +0 -17
- package/dist/chunks/backgroundHousekeeping-VV1V_Y2Z.js +0 -1
- package/dist/chunks/bg-BK_9J6F6.js +0 -1
- package/dist/chunks/branch-BYq0zpzT.js +0 -3
- package/dist/chunks/bridgeConfig-C82un7rJ.js +0 -1
- package/dist/chunks/btw-CUV3nRrE.js +0 -1
- package/dist/chunks/caches-BZ59_En6.js +0 -1
- package/dist/chunks/caches-Cg-HtWKG.js +0 -1
- package/dist/chunks/client-DQXvVKND.js +0 -1
- package/dist/chunks/client-DkgC-mFB.js +0 -1
- package/dist/chunks/color-CBsNbt1s.js +0 -1
- package/dist/chunks/commands-qM5z_Uld.js +0 -1
- package/dist/chunks/compact-BclJiRJe.js +0 -2
- package/dist/chunks/completionCache-BMHAktkM.js +0 -1
- package/dist/chunks/config-CE058cvr.js +0 -3
- package/dist/chunks/config-D81avYye.js +0 -1
- package/dist/chunks/config-DpOOllGk.js +0 -1
- package/dist/chunks/context-noninteractive-DJb8H_hN.js +0 -1
- package/dist/chunks/context-sR9fJmXE.js +0 -1
- package/dist/chunks/conversation-D48Kt3ar.js +0 -1
- package/dist/chunks/conversation-fOFTa7k5.js +0 -1
- package/dist/chunks/createSession-CSwlW2T2.js +0 -1
- package/dist/chunks/crossProjectResume-lDFB2ZcY.js +0 -40
- package/dist/chunks/cwd-5Xr-Qka6.js +0 -1
- package/dist/chunks/datadog-BJn5ECIu.js +0 -1
- package/dist/chunks/detectRepository-DqQvyj_a.js +0 -1
- package/dist/chunks/directoryCompletion-BagQcynj.js +0 -1
- package/dist/chunks/doctor-BEHYm34V.js +0 -1
- package/dist/chunks/entry-BzL1MFQG.js +0 -14
- package/dist/chunks/envUtils-DSxRz_kt.js +0 -1
- package/dist/chunks/eventLoopStallDetector-Cg_RXU1q.js +0 -1
- package/dist/chunks/exit-DE2YiAhQ.js +0 -1
- package/dist/chunks/extraUsage-Dw7AXiH7.js +0 -1
- package/dist/chunks/extractMemories-DxTUMiv3.js +0 -1
- package/dist/chunks/fast-CHmMkIpE.js +0 -1
- package/dist/chunks/fast-uQASHWqR.js +0 -1
- package/dist/chunks/fileSuggestions-Dyu2kQtE.js +0 -3
- package/dist/chunks/firstPartyEventLogger-D5ohKbIe.js +0 -5
- package/dist/chunks/firstPartyEventLogger-LsNY6yOt.js +0 -1
- package/dist/chunks/generateRecap-CiFxXlmH.js +0 -1
- package/dist/chunks/generateSessionName-DitoBxJT.js +0 -1
- package/dist/chunks/git-D6dOU2mT.js +0 -1
- package/dist/chunks/githubRepoPathMapping-DGr0kJ8D.js +0 -1
- package/dist/chunks/goal-DuUayfDg.js +0 -3
- package/dist/chunks/grok-tRbmZzEh.js +0 -1
- package/dist/chunks/grove-Cv19v6Sv.js +0 -7
- package/dist/chunks/help-DkqxbFDM.js +0 -1
- package/dist/chunks/hooks-CsP42iOp.js +0 -1
- package/dist/chunks/initReplBridge-DdsSWVqN.js +0 -1
- package/dist/chunks/keybindings-DZU3vwo3.js +0 -2
- package/dist/chunks/language-DHhXLb_Y.js +0 -1
- package/dist/chunks/launchLocalMemory-twLxpPvg.js +0 -3
- package/dist/chunks/launchOnboarding-BWz2XSb9.js +0 -8
- package/dist/chunks/lib-rQZENxQg.js +0 -8
- package/dist/chunks/loadAgentsDir-CMNFLt7R.js +0 -1
- package/dist/chunks/loadPluginHooks-BPnxcgrL.js +0 -1
- package/dist/chunks/localSearch-DzQODFap.js +0 -1
- package/dist/chunks/logoV2Utils-CGUJ-5gY.js +0 -1
- package/dist/chunks/main-D4Uk-WUs.js +0 -862
- package/dist/chunks/managedEnv-DLVRBaA9.js +0 -1
- package/dist/chunks/mcp-BMVdGknC.js +0 -1
- package/dist/chunks/mcp-COS5RJFS.js +0 -6
- package/dist/chunks/mcp-tGsOW1GN.js +0 -2
- package/dist/chunks/memory-DR6poqeH.js +0 -1
- package/dist/chunks/mode-QV-NW1Wd.js +0 -2
- package/dist/chunks/model-BF_4ebyl.js +0 -1
- package/dist/chunks/model-BNU_ulDJ.js +0 -1
- package/dist/chunks/model-CwO-g1RW.js +0 -1
- package/dist/chunks/nativeInstaller-B-lNJjM-.js +0 -1
- package/dist/chunks/oauth-BqJqV-2M.js +0 -1
- package/dist/chunks/oauth-C8X_p8Gc.js +0 -1
- package/dist/chunks/omit-DZCEXri5.js +0 -1
- package/dist/chunks/onChangeAppState-BmfM5g-D.js +0 -1
- package/dist/chunks/p-map-B1EeBuI8.js +0 -1
- package/dist/chunks/p-map-HKDr3iDo.js +0 -1
- package/dist/chunks/panelCall-SbffM7G4.js +0 -1
- package/dist/chunks/parser-DrBC8nWp.js +0 -1
- package/dist/chunks/partition-DKuAFJkc.js +0 -1
- package/dist/chunks/path-Cv9QMBAX.js +0 -1
- package/dist/chunks/permissions-ey-bfanE.js +0 -3
- package/dist/chunks/pidLock-DJnS_38v.js +0 -3
- package/dist/chunks/plan-Brg9XnRr.js +0 -1
- package/dist/chunks/plugin-CRwa39Y1.js +0 -17
- package/dist/chunks/pluginAutoupdate-D0LIP7cy.js +0 -1
- package/dist/chunks/pluginBlocklist-PwHHD3nj.js +0 -1
- package/dist/chunks/pluginCliCommands-BJM5Bdpf.js +0 -1
- package/dist/chunks/pluginOperations-C7p_Qr2r.js +0 -2
- package/dist/chunks/pluginStartupCheck-C0HqhG6D.js +0 -1
- package/dist/chunks/plugins-DUKNjLq6.js +0 -4
- package/dist/chunks/poorMode-CejPNCp-.js +0 -1
- package/dist/chunks/print-gyTOCJzk.js +0 -23
- package/dist/chunks/processBashCommand-Cze9vCm6.js +0 -1
- package/dist/chunks/processSlashCommand-BRajh1v7.js +0 -5
- package/dist/chunks/prompt-B7joRiqj.js +0 -139
- package/dist/chunks/prompt-DqSMh2x9.js +0 -1
- package/dist/chunks/prompt-Eysh8Et_.js +0 -1
- package/dist/chunks/promptEditor-R_acDAgI.js +0 -4
- package/dist/chunks/reconciler-BfkO6X2X.js +0 -4
- package/dist/chunks/refresh-C1X3sptR.js +0 -1
- package/dist/chunks/reload-plugins-C0osFcNh.js +0 -1
- package/dist/chunks/remoteManagedSettings-B1mnRDmA.js +0 -1
- package/dist/chunks/rename-B3tf-YiD.js +0 -1
- package/dist/chunks/replBridgeHandle-CNwNIijW.js +0 -1
- package/dist/chunks/resume-Be1G_GBL.js +0 -2
- package/dist/chunks/ripgrep-C2PhTJDh.js +0 -1
- package/dist/chunks/rollback-BPWRKlIZ.js +0 -11
- package/dist/chunks/sandbox-adapter-C6GBuJPB.js +0 -1
- package/dist/chunks/sandbox-toggle-jEySONTW.js +0 -1
- package/dist/chunks/sdkHeapDumpMonitor-WdXUV7DV.js +0 -1
- package/dist/chunks/searchExtraTools-C_UTryh_.js +0 -1
- package/dist/chunks/session-DDI1Eb2x.js +0 -2
- package/dist/chunks/sessionDataUploader-CaCjwsA2.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-DfJ7Htfl.js +0 -1
- package/dist/chunks/sessionMemory-CQBxPkTQ.js +0 -1
- package/dist/chunks/sessionMemory-s0ALUHvc.js +0 -1
- package/dist/chunks/sessionMemoryUtils-xt7dTHGC.js +0 -1
- package/dist/chunks/sessionObserver-C2sYqWL3.js +0 -1
- package/dist/chunks/sessionStorage-DqsY-7pi.js +0 -1
- package/dist/chunks/sessionTitle-B0OYf5nM.js +0 -14
- package/dist/chunks/sessionTracing-CwsXt_uA.js +0 -11
- package/dist/chunks/settings-BWtOA9A7.js +0 -1
- package/dist/chunks/settings-hQDLwPVj.js +0 -20
- package/dist/chunks/settingsSync-DdFagwHV.js +0 -1
- package/dist/chunks/setup-DzC22EkN.js +0 -3
- package/dist/chunks/shadowedRuleDetection-C86PTj1m.js +0 -1
- package/dist/chunks/sinks-5G_xhc1Q.js +0 -1
- package/dist/chunks/sinks-Cftq7Es0.js +0 -2
- package/dist/chunks/skillChangeDetector-plLveEbf.js +0 -1
- package/dist/chunks/skills-zGYaYfFV.js +0 -1
- package/dist/chunks/startupProfiler-JbpAkfNE.js +0 -1
- package/dist/chunks/state-C2OSZkV1.js +0 -1
- package/dist/chunks/state-DU9lRJ9x.js +0 -1
- package/dist/chunks/status-CFw-FpZM.js +0 -2
- package/dist/chunks/subprocessEnv-BSQSomcK.js +0 -1
- package/dist/chunks/switcher-hgBgVzLb.js +0 -1
- package/dist/chunks/tasks-BxpyRhmD.js +0 -1
- package/dist/chunks/teleport-CwxeD5vL.js +0 -1
- package/dist/chunks/terminalSetup-DlaFWI81.js +0 -33
- package/dist/chunks/toolPool-B7SIoDw5.js +0 -1
- package/dist/chunks/trustedDevice-CjHQtVkO.js +0 -1
- package/dist/chunks/up-B8wBSpLg.js +0 -12
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-Cce612uS.js +0 -1
- package/dist/chunks/useMainLoopModel-BICP6_Fi.js +0 -1
- package/dist/chunks/useManagePlugins-DtbY_vPL.js +0 -1
- package/dist/chunks/useMergedTools-Ckx2IEhF.js +0 -1
- package/dist/chunks/useSearchInput-BAgljZUl.js +0 -1
- package/dist/chunks/useSettingsErrors-CAJR_wpd.js +0 -1
- package/dist/chunks/util-DDtmyq_r.js +0 -1
- package/dist/chunks/validatePlugin-AHl-g4ct.js +0 -1
- package/dist/chunks/vim-kg-mRVbu.js +0 -1
- package/dist/chunks/windowsPaths-Pmx8LDR6.js +0 -1
- package/dist/chunks/workerRegistry-C7H_lsQX.js +0 -6
- package/dist/chunks/worktree-O2p-mJdF.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$o as t,GE as n,Ro as r,XE as i,YE as a,jo as o}from"./loadAgentsDir-CKSb56Gp.js";import{n as s}from"./cwd-L4wygFqJ.js";import{a as c,l}from"./debug-BdqxZ7rV.js";import{c as u,g as d,vt as f}from"./settings-Xbq6AaD-.js";import{o as p}from"./log-CTFl4qpD.js";import"path";function m(){let e=new Map,t=a();for(let[n,r]of Object.entries(t))n.includes(`@`)&&(r===!0?e.set(n,`flag`):r===!1&&e.delete(n));for(let{scope:n,source:r}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let i=u(r);if(i?.enabledPlugins)for(let[a,o]of Object.entries(i.enabledPlugins))a.includes(`@`)&&(a in t&&t[a]!==o&&l(`Plugin ${a} from --add-dir (${t[a]}) overridden by ${r} (${o})`),o===!0?e.set(a,n):o===!1&&e.delete(a))}return l(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}var h=e((()=>{s(),c(),p(),d(),i(),r(),t(),n(),o(),f()}));export{h as n,m as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./pluginStartupCheck-B6leNWq9.js";e();export{t as getPluginEditableScopes};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{n as e,t}from"./figures-5ThXQEtq.js";import{$o as n,Eo as r,GE as i,Ho as a,JE as o,KC as s,Ro as c,Ss as l,To as u,Wo as d,_s as f,as as p,ds as m,eD as h,es as g,ns as _,qC as v,qE as y,qo as b,rs as x,ss as S,tD as C,xs as w,ys as T}from"./loadAgentsDir-CKSb56Gp.js";import{Kt as ee,or as E}from"./state-Bs5xweDL.js";import{F as D,S as te,w as O,z as k}from"./debug-BdqxZ7rV.js";import{o as ne,s as A}from"./log-CTFl4qpD.js";import{n as j,r as M}from"./analytics-DJobLaWP.js";import{l as N,o as P}from"./stringUtils-CbS6OkmE.js";import{n as F,t as I}from"./exit-BOhGfSlm.js";import{n as L,s as R,t as z}from"./pluginOperations-BTq4AjYB.js";import{a as B,i as V,n as H,o as U,r as W,t as G}from"./pluginCliCommands-vv0wNt4O.js";import{a as K,c as re,i as q,n as J,r as Y,s as X,t as ie}from"./validatePlugin-DSw08u76.js";import{basename as ae,dirname as Z}from"path";e(),ee(),j(),R(),C(),k(),ne(),l(),re(),c(),f(),n(),s(),q(),i(),u(),ie(),te(),P();function Q(e,n){A(e),I(`${t.cross} Failed to ${n}: ${D(e)}`)}function $(e){e.errors.length>0&&(console.log(`${t.cross} Found ${e.errors.length} ${N(e.errors.length,`error`)}:\n`),e.errors.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``)),e.warnings.length>0&&(console.log(`${t.warning} Found ${e.warnings.length} ${N(e.warnings.length,`warning`)}:\n`),e.warnings.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``))}async function oe(e,n){n.cowork&&E(!0);try{let n=await J(e);console.log(`Validating ${n.fileType} manifest: ${n.filePath}\n`),$(n);let r=[];if(n.fileType===`plugin`){let e=Z(n.filePath);if(ae(e)===`.claude-plugin`){r=await Y(Z(e));for(let e of r)console.log(`Validating ${e.fileType}: ${e.filePath}\n`),$(e)}}let i=n.success&&r.every(e=>e.success),a=n.warnings.length>0||r.some(e=>e.warnings.length>0);i?F(a?`${t.tick} Validation passed with warnings`:`${t.tick} Validation passed`):(console.log(`${t.cross} Validation failed`),process.exit(1))}catch(e){A(e),console.error(`${t.cross} Unexpected error during validation: ${D(e)}`),process.exit(2)}}async function se(e){e.cowork&&E(!0),M(`tengu_plugin_list_command`,{});let n=d(),{getPluginEditableScopes:i}=await import(`./pluginStartupCheck-DBOCHUHQ.js`),o=i(),s=Object.keys(n.plugins),{enabled:c,disabled:l,errors:u}=await r(),f=[...c,...l],p=f.filter(e=>e.source.endsWith(`@inline`)),_=u.filter(e=>e.source.endsWith(`@inline`)||e.source.startsWith(`inline[`));if(e.json){let t=new Map(f.map(e=>[e.source,e])),r=[];for(let e of s.sort()){let i=n.plugins[e];if(!i||i.length===0)continue;let a=y(e).name,s=u.filter(t=>t.source===e||`plugin`in t&&t.plugin===a).map(h);for(let n of i){let i=t.get(e),a;if(i){let e=i.mcpServers||await v(i);e&&Object.keys(e).length>0&&(a=e)}r.push({id:e,version:n.version||`unknown`,scope:n.scope,enabled:o.has(e),installPath:n.installPath,installedAt:n.installedAt,lastUpdated:n.lastUpdated,projectPath:n.projectPath,mcpServers:a,errors:s.length>0?s:void 0})}}for(let e of p){let t=e.mcpServers||await v(e),n=_.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name).map(h);r.push({id:e.source,version:e.manifest.version??`unknown`,scope:`session`,enabled:e.enabled!==!1,installPath:e.path,mcpServers:t&&Object.keys(t).length>0?t:void 0,errors:n.length>0?n:void 0})}for(let e of _.filter(e=>e.source.startsWith(`inline[`)))r.push({id:e.source,version:`unknown`,scope:`session`,enabled:!1,installPath:`path`in e?e.path:``,errors:[h(e)]});if(e.available){let e=[];try{let[t,n]=await Promise.all([g(),X()]),{marketplaces:r}=await T(t);for(let{name:t,data:i}of r)if(i)for(let r of i.plugins){let i=m(r.name,t);a(i)||e.push({pluginId:i,name:r.name,description:r.description,marketplaceName:t,version:r.version,source:r.source,installCount:n?.get(i)})}}catch{}F(O({installed:r,available:e},null,2))}else F(O(r,null,2))}s.length===0&&p.length===0&&_.length===0&&F("No plugins installed. Use `claude plugin install` to install a plugin."),s.length>0&&console.log(`Installed plugins:
|
|
2
|
+
`);for(let e of s.sort()){let r=n.plugins[e];if(!r||r.length===0)continue;let i=y(e).name,a=u.filter(t=>t.source===e||`plugin`in t&&t.plugin===i);for(let n of r){let r=o.has(e),i=a.length>0?`${t.cross} failed to load`:r?`${t.tick} enabled`:`${t.cross} disabled`,s=n.version||`unknown`,c=n.scope;console.log(` ${t.pointer} ${e}`),console.log(` Version: ${s}`),console.log(` Scope: ${c}`),console.log(` Status: ${i}`);for(let e of a)console.log(` Error: ${h(e)}`);console.log(``)}}if(p.length>0||_.length>0){console.log(`Session-only plugins (--plugin-dir):
|
|
3
|
+
`);for(let e of p){let n=_.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name),r=n.length>0?`${t.cross} loaded with errors`:`${t.tick} loaded`;console.log(` ${t.pointer} ${e.source}`),console.log(` Version: ${e.manifest.version??`unknown`}`),console.log(` Path: ${e.path}`),console.log(` Status: ${r}`);for(let e of n)console.log(` Error: ${h(e)}`);console.log(``)}for(let e of _.filter(e=>e.source.startsWith(`inline[`)))console.log(` ${t.pointer} ${e.source}: ${t.cross} ${h(e)}\n`)}F()}async function ce(e,n){n.cowork&&E(!0);try{let r=await K(e);r||I(`${t.cross} Invalid marketplace source format. Try: owner/repo, https://..., or ./path`),`error`in r&&I(`${t.cross} ${r.error}`);let i=n.scope??`user`;i!==`user`&&i!==`project`&&i!==`local`&&I(`${t.cross} Invalid scope '${i}'. Use: user, project, or local`);let a=o(i),s=r;n.sparse&&n.sparse.length>0&&(s.source===`github`||s.source===`git`?s={...s,sparsePaths:n.sparse}:I(`${t.cross} --sparse is only supported for github and git marketplace sources (got: ${s.source})`)),console.log(`Adding marketplace...`);let{name:c,alreadyMaterialized:l,resolvedSource:u}=await b(s,e=>{console.log(e)});S(c,{source:u},a),w();let d=s.source;s.source===`github`&&(d=s.repo),M(`tengu_marketplace_added`,{source_type:d}),F(l?`${t.tick} Marketplace '${c}' already on disk — declared in ${i} settings`:`${t.tick} Successfully added marketplace: ${c} (declared in ${i} settings)`)}catch(e){Q(e,`add marketplace`)}}async function le(e){e.cowork&&E(!0);try{let n=await g(),r=Object.keys(n);e.json&&F(O(r.sort().map(e=>{let t=n[e],r=t?.source;return{name:e,source:r?.source,...r?.source===`github`&&{repo:r.repo},...r?.source===`git`&&{url:r.url},...r?.source===`url`&&{url:r.url},...r?.source===`directory`&&{path:r.path},...r?.source===`file`&&{path:r.path},installLocation:t?.installLocation}}),null,2)),r.length===0&&F(`No marketplaces configured`),console.log(`Configured marketplaces:
|
|
4
|
+
`),r.forEach(e=>{let r=n[e];if(console.log(` ${t.pointer} ${e}`),r?.source){let e=r.source;e.source===`github`?console.log(` Source: GitHub (${e.repo})`):e.source===`git`?console.log(` Source: Git (${e.url})`):e.source===`url`?console.log(` Source: URL (${e.url})`):e.source===`directory`?console.log(` Source: Directory (${e.path})`):e.source===`file`&&console.log(` Source: File (${e.path})`)}console.log(``)}),F()}catch(e){Q(e,`list marketplaces`)}}async function ue(e,n){n.cowork&&E(!0);try{await p(e),w(),M(`tengu_marketplace_removed`,{marketplace_name:e}),F(`${t.tick} Successfully removed marketplace: ${e}`)}catch(e){Q(e,`remove marketplace`)}}async function de(e,n){n.cowork&&E(!0);try{if(e)console.log(`Updating marketplace: ${e}...`),await x(e,e=>{console.log(e)}),w(),M(`tengu_marketplace_updated`,{marketplace_name:e}),F(`${t.tick} Successfully updated marketplace: ${e}`);else{let e=await g(),n=Object.keys(e);n.length===0&&F(`No marketplaces configured`),console.log(`Updating ${n.length} marketplace(s)...`),await _(),w(),M(`tengu_marketplace_updated_all`,{count:n.length}),F(`${t.tick} Successfully updated ${n.length} marketplace(s)`)}}catch(e){Q(e,`update marketplace(s)`)}}async function fe(e,t){t.cowork&&E(!0);let n=t.scope||`user`;t.cowork&&n!==`user`&&I(`--cowork can only be used with user scope`),z.includes(n)||I(`Invalid scope: ${n}. Must be one of: ${z.join(`, `)}.`);let{name:r,marketplace:i}=y(e);M(`tengu_plugin_install_command`,{_PROTO_plugin_name:r,...i&&{_PROTO_marketplace_name:i},scope:n}),await V(e,n)}async function pe(e,t){t.cowork&&E(!0);let n=t.scope||`user`;t.cowork&&n!==`user`&&I(`--cowork can only be used with user scope`),z.includes(n)||I(`Invalid scope: ${n}. Must be one of: ${z.join(`, `)}.`);let{name:r,marketplace:i}=y(e);M(`tengu_plugin_uninstall_command`,{_PROTO_plugin_name:r,...i&&{_PROTO_marketplace_name:i},scope:n}),await B(e,n,t.keepData)}async function me(e,t){t.cowork&&E(!0);let n;t.scope&&(z.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${z.join(`, `)}`),n=t.scope),t.cowork&&n!==void 0&&n!==`user`&&I(`--cowork can only be used with user scope`),t.cowork&&n===void 0&&(n=`user`);let{name:r,marketplace:i}=y(e);M(`tengu_plugin_enable_command`,{_PROTO_plugin_name:r,...i&&{_PROTO_marketplace_name:i},scope:n??`auto`}),await W(e,n)}async function he(e,t){if(t.all&&e&&I(`Cannot use --all with a specific plugin`),!t.all&&!e&&I(`Please specify a plugin name or use --all to disable all plugins`),t.cowork&&E(!0),t.all){t.scope&&I(`Cannot use --scope with --all`),M(`tengu_plugin_disable_command`,{}),await G();return}let n;t.scope&&(z.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${z.join(`, `)}`),n=t.scope),t.cowork&&n!==void 0&&n!==`user`&&I(`--cowork can only be used with user scope`),t.cowork&&n===void 0&&(n=`user`);let{name:r,marketplace:i}=y(e);M(`tengu_plugin_disable_command`,{_PROTO_plugin_name:r,...i&&{_PROTO_marketplace_name:i},scope:n??`auto`}),await H(e,n)}async function ge(e,t){t.cowork&&E(!0);let{name:n,marketplace:r}=y(e);M(`tengu_plugin_update_command`,{_PROTO_plugin_name:n,...r&&{_PROTO_marketplace_name:r}});let i=`user`;t.scope&&(L.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${L.join(`, `)}`),i=t.scope),t.cowork&&i!==`user`&&I(`--cowork can only be used with user scope`),await U(e,i)}export{ce as marketplaceAddHandler,le as marketplaceListHandler,ue as marketplaceRemoveHandler,de as marketplaceUpdateHandler,he as pluginDisableHandler,me as pluginEnableHandler,fe as pluginInstallHandler,se as pluginListHandler,pe as pluginUninstallHandler,ge as pluginUpdateHandler,oe as pluginValidateHandler};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{g as n,n as r,x as i}from"./settings-
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{g as n,n as r,x as i}from"./settings-Xbq6AaD-.js";var a=t({isPoorModeActive:()=>o,setPoorMode:()=>s});function o(){return c===null&&(c=r().poorMode===!0),c}function s(e){c=e,i(`userSettings`,{poorMode:e||void 0})}var c,l=e((()=>{n(),c=null}));export{s as i,o as n,a as r,l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./poorMode-BxsyllUK.js";t();export{e as isPoorModeActive};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,n as r,o as i,s as a}from"./envUtils-BDhHQY0-.js";import{n as o,t as s}from"./defineProperty-C-QyHrDq.js";import{n as c,t as l}from"./axios-DaWTGg7G.js";import{$c as u,$o as d,$r as f,AS as p,Aa as m,Ar as h,As as g,Au as _,C as v,CE as y,CS as ee,CT as b,Cc as x,Cf as S,Cn as C,D as te,DC as ne,DS as re,Db as ie,Di as ae,Do as oe,Ds as w,Du as T,E,EC as se,Es as ce,Fb as le,GS as ue,Gs as de,Gv as fe,Hb as pe,Ht as me,Hx as he,Ib as ge,Ji as D,Jo as O,Js as _e,Ks as ve,Kv as ye,LC as be,MC as k,Ms as xe,N as A,NC as Se,Ns as Ce,OS as we,Ob as Te,Oi as Ee,Or as De,Os as Oe,Pb as ke,Qa as Ae,Ri as je,Sc as Me,Sn as Ne,TS as Pe,Tb as Fe,Th as j,To as M,Ts as Ie,U as Le,Ui as Re,Ux as ze,Vi as Be,W as Ve,WS as N,Wv as P,Wx as He,Xi as Ue,Xm as F,Xv as We,Ym as Ge,Yo as Ke,Yp as qe,Zp as Je,Zv as Ye,_b as Xe,_h as Ze,_y as I,aE as Qe,ac as $e,al as et,au as tt,b as nt,bE as rt,bh as it,cD as at,cE as ot,cT as st,cg as ct,cl as lt,dD as ut,df as L,dh as dt,di as ft,dv as pt,el as mt,f as ht,fD as gt,fE as _t,fS as vt,ff as yt,fh as bt,fi as xt,fl as St,gC as Ct,gb as wt,gc as Tt,gh as Et,gi as Dt,hS as Ot,hc as kt,hh as At,hi as jt,is as Mt,js as Nt,ju as Pt,kC as Ft,kS as It,kb as Lt,kr as Rt,ks as zt,lD as Bt,ld as Vt,lg as Ht,lh as R,ll as Ut,mS as Wt,mc as Gt,mh as Kt,my as qt,nl as Jt,np as Yt,o as Xt,oC as Zt,oT as Qt,od as $t,ou as en,pE as tn,pf as nn,ph as rn,py as an,qS as on,qs as sn,rl as cn,rp as ln,rr as un,s as dn,sc as fn,sg as pn,sr as mn,ts as hn,uf as gn,ug as _n,uh as vn,uv as yn,vS as bn,vc as xn,vh as Sn,vn as Cn,vo as wn,vy as Tn,wE as z,wS as En,wb as Dn,ws as On,x as kn,xS as An,xf as jn,xo as Mn,yC as Nn,yE as Pn,yh as Fn,yo as In,zT as Ln,zb as Rn}from"./loadAgentsDir-CKSb56Gp.js";import{A as zn,p as Bn,w as Vn}from"./external-CEp-aPkt.js";import{n as Hn,r as Un,t as Wn}from"./lazySchema-B4D4qJVE.js";import{Fn as Gn,Kt as Kn,M as qn,P as Jn,Pn as Yn,X as Xn,Yn as Zn,_n as Qn,lr as $n,mt as B,qt as er,tn as tr,xn as nr}from"./state-Bs5xweDL.js";import{n as rr,t as ir}from"./cwd-L4wygFqJ.js";import{C as ar,F as V,S as or,W as sr,a as H,d as cr,l as U,nt as lr,o as ur,p as dr,rt as fr,w as W,z as pr}from"./debug-BdqxZ7rV.js";import{G as mr,Ln as hr,ar as gr,d as _r,dt as vr,f as yr,g as br,it as xr,nt as G,sr as Sr,vt as Cr,zn as wr}from"./settings-Xbq6AaD-.js";import{F as Tr,M as Er}from"./config-D4G8_MqJ.js";import{i as Dr,n as Or,o as K}from"./process-gEbdy6uY.js";import{A as kr,O as Ar,k as jr}from"./git-B9uvt96d.js";import{J as Mr,U as Nr,c as Pr,i as Fr,o as Ir,s as q}from"./log-CTFl4qpD.js";import{s as Lr,u as Rr}from"./types-DWRxAH0E.js";import{n as zr,r as J}from"./analytics-DJobLaWP.js";import{Bt as Br,C as Vr,Gr as Hr,Mn as Ur,Y as Wr,_ as Gr,_n as Kr,_r as qr,ai as Jr,bt as Yr,et as Xr,ii as Zr,it as Qr,jn as $r,o as ei,qr as ti,ri as ni,rt as ri,si as ii,tt as ai,u as oi,vn as si,vr as ci,x as li}from"./model-C2e73CJD.js";import{Kt as ui,at as di,bn as fi,en as pi,ht as mi,mt as hi,ot as gi,xn as _i}from"./prompt-CybUvG8G.js";import{A as vi,C as yi,D as bi,F as xi,I as Si,N as Ci,U as wi,a as Ti,c as Ei,l as Di,n as Oi,o as ki,s as Ai,t as ji,vt as Mi}from"./sessionState-BvECKycx.js";import{n as Ni,t as Pi}from"./omit-CLPZGevl.js";import{a as Fi,n as Ii,t as Li}from"./bridgeConfig-vORehbGG.js";import{i as Ri,n as zi,s as Bi}from"./mappers-xQC-Z4-h.js";import{n as Vi,r as Hi}from"./sessionTitle-E1FvsKM9.js";import{t as Ui}from"./pollConfig-BgpfHQPJ.js";import{n as Wi,t as Gi}from"./ccrClient-CG6HTv_n.js";import{n as Ki,t as qi}from"./HybridTransport-BVmSUHf0.js";import{n as Ji,t as Yi}from"./SSETransport-1KBBUikF.js";import{a as Xi,n as Zi}from"./grove-BE4fQ6tG.js";import{o as Qi}from"./remoteManagedSettings-CCrq-qL-.js";import{i as $i,r as ea}from"./auth-Cjnyy10u.js";import{t as ta}from"./pluginBlocklist-D93Hd1GF.js";import{t as na}from"./onChangeAppState-DhBO34OK.js";import{t as ra}from"./settingsSync-NCN0a4sc.js";import{a as ia,i as aa,n as oa,o as sa,r as ca,s as la}from"./reconciler-Drq3HSkj.js";import{n as ua,t as da}from"./toolPool-Di30gn_Y.js";import{n as fa,r as pa}from"./QueryEngine-J6ElcO16.js";import{n as ma,r as ha}from"./sideQuestion-D2dPToW8.js";import{n as ga,r as _a}from"./context-noninteractive-c7jGVWHQ.js";import{n as va,t as ya}from"./modelOptions-efCGKnXT.js";import{a as ba,o as xa,t as Sa}from"./skillChangeDetector-C1EJ7rUL.js";import{n as Ca,t as wa}from"./refresh-D8TLHO_T.js";import{basename as Ta,dirname as Ea,join as Da}from"path";import{PassThrough as Oa}from"stream";import{randomUUID as Y}from"crypto";import{mkdir as ka,readFile as Aa,stat as ja,writeFile as Ma}from"fs/promises";import{URL as Na}from"url";import{cwd as X}from"process";o(),l(),Un(),Kn(),rr(),lr(),pr(),or(),dr(),Or(),H(),Ar(),Mr(),Ir(),Sr(),hr(),Lr(),br(),ii(),fi(),ti(),ci(),$r(),Kr(),Br(),Gr(),pi(),Si(),Ci(),qt(),rn(),Ge(),yt(),Oi(),In(),Ae(),D(),h(),ra(),i(),Ji();function Pa(e,t={},r,i){if(n(process.env.CLAUDE_CODE_USE_CCR_V2)){let n=new Na(e.href);return n.protocol===`wss:`?n.protocol=`https:`:n.protocol===`ws:`&&(n.protocol=`http:`),n.pathname=n.pathname.replace(/\/$/,``)+`/worker/events/stream`,new Yi(n,t,r,i)}if(e.protocol===`ws:`||e.protocol===`wss:`)return n(process.env.CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2)?new qi(e,t,r,i):new Ki(e,t,r,i);throw Error(`Unsupported protocol: ${e.protocol}`)}i(),Ji();var Fa=class extends aa{constructor(e,t,r){let i=new Oa({encoding:`utf8`});super(i,r),s(this,`url`,void 0),s(this,`transport`,void 0),s(this,`inputStream`,void 0),s(this,`isBridge`,!1),s(this,`isDebug`,!1),s(this,`ccrClient`,null),s(this,`keepAliveTimer`,null),this.inputStream=i,this.url=new Na(e);let a={},o=xi();o?a.Authorization=`Bearer ${o}`:U(`[remote-io] No session ingress token available`,{level:`error`});let c=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;c&&(a[`x-environment-runner-version`]=c);let l=()=>{let e={},t=xi();t&&(e.Authorization=`Bearer ${t}`);let n=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;return n&&(e[`x-environment-runner-version`]=n),e};if(this.transport=Pa(this.url,a,B(),l),this.isBridge=process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`,this.isDebug=ur(),this.transport.setOnData(e=>{this.inputStream.write(e),this.isBridge&&this.isDebug&&K(e.endsWith(`
|
|
2
|
+
`)?e:e+`
|
|
3
|
+
`)}),this.transport.setOnClose(()=>{this.inputStream.end()}),n(process.env.CLAUDE_CODE_USE_CCR_V2)){if(!(this.transport instanceof Yi))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new Gi(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{jr(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof Wi?e.reason:`unknown`}),q(Error(`CCRClient initialization failed: ${V(e)}`)),gn(1,`other`)}),fr(async()=>this.ccrClient?.close()),Ee((e,t,n)=>this.ccrClient.writeInternalEvent(e,t,n)),ae(()=>this.ccrClient.readInternalEvents(),()=>this.ccrClient.readSubagentInternalEvents());let t={started:`processing`,completed:`processed`};At((e,n)=>{this.ccrClient?.reportDelivery(e,t[n])}),Di((e,t)=>{this.ccrClient?.reportState(e,t)}),Ei(e=>{this.ccrClient?.reportMetadata(e)},{replayCurrent:!0})}this.transport.connect();let u=Ui().session_keepalive_interval_v2_ms;if(this.isBridge&&u>0&&(this.keepAliveTimer=setInterval(()=>{U(`[remote-io] keep_alive sent`),this.write({type:`keep_alive`}).catch(e=>{U(`[remote-io] keep_alive write failed: ${V(e)}`)})},u),this.keepAliveTimer.unref?.()),fr(async()=>this.close()),t){let e=this.inputStream;(async()=>{for await(let n of t)e.write(String(n).replace(/\n$/,``)+`
|
|
4
|
+
`)})()}}flushInternalEvents(){return this.ccrClient?.flushInternalEvents()??Promise.resolve()}get internalEventsPending(){return this.ccrClient?.internalEventsPending??0}async write(e){this.ccrClient?await this.ccrClient.writeEvent(e):await this.transport.write(e),this.isBridge&&(e.type===`control_request`||this.isDebug)&&K(ia(e)+`
|
|
5
|
+
`)}close(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=null),this.transport.close(),this.inputStream.end()}};ui(),mr(),mi(),[...hi],lr(),H();var Ia=`[stdout-guard]`,La=!1,Z=``,Q=null;function Ra(e){if(e.length===0)return!0;try{return JSON.parse(e),!0}catch{return!1}}function za(){La||(La=!0,Q=process.stdout.write.bind(process.stdout),process.stdout.write=function(e,t,n){let r=typeof e==`string`?e:Buffer.from(e).toString(`utf-8`);Z+=r;let i,a=!0;for(;(i=Z.indexOf(`
|
|
6
|
+
`))!==-1;){let e=Z.slice(0,i);Z=Z.slice(i+1),Ra(e)?a=Q(e+`
|
|
7
|
+
`):(process.stderr.write(`${Ia} ${e}\n`),U(`streamJsonStdoutGuard diverted non-JSON stdout line: ${e.slice(0,200)}`))}let o=typeof t==`function`?t:n;return o&&queueMicrotask(()=>o()),a},fr(async()=>{Z.length>0&&(Q&&Ra(Z)?Q(Z+`
|
|
8
|
+
`):process.stderr.write(`${Ia} ${Z}\n`),Z=``),Q&&(process.stdout.write=Q,Q=null),La=!1}))}Wn(),Cr(),xr(),Er(),wi(),Pn(),_t(),ot(),k(),Nn(),p(),ze(),ge(),gi(),I(),Ye(),pn(),_(),St(),mt(),fn(),sn(),ve(),Nt(),d(),M(),C(),Cn(),Ve(),Xt(),da(),T(),pr(),Ir(),Si(),Ln(),H(),yt();function Ba(e){let t=process.env.CLAUDE_CODE_EXIT_AFTER_STOP_DELAY,n=t?parseInt(t,10):null,r=n&&!isNaN(n)&&n>0,i=null,a=0;return{start(){i&&(clearTimeout(i),i=null),r&&(a=Date.now(),i=setTimeout(()=>{let t=Date.now()-a;e()&&t>=n&&(U(`Exiting after ${n}ms of idle time`),L())},n))},stop(){i&&(clearTimeout(i),i=null)}}}gt(),Pi(),y(),jn(),Vt(),Kn(),H(),i(),Fi();var Va=3e4;function Ha(e){U(`[bridge:inbound-attach] ${e}`)}var Ua=Hn(()=>Vn({file_uuid:zn(),file_name:zn()})),Wa=Hn(()=>Bn(Ua()));function Ga(e){if(typeof e!=`object`||!e||!(`file_attachments`in e))return[];let t=Wa().safeParse(e.file_attachments);return t.success?t.data:[]}function Ka(e){return Ta(e).replace(/[^a-zA-Z0-9._-]/g,`_`)||`attachment`}function qa(){return Da(r(),`uploads`,B())}async function Ja(e){let t=Li();if(!t){Ha(`skip: no oauth token`);return}let n;try{let r=`${Ii()}/api/oauth/files/${encodeURIComponent(e.file_uuid)}/content`,i=await c.get(r,{headers:{Authorization:`Bearer ${t}`},responseType:`arraybuffer`,timeout:Va,validateStatus:()=>!0});if(i.status!==200){Ha(`fetch ${e.file_uuid} failed: status=${i.status}`);return}n=Buffer.from(i.data)}catch(t){Ha(`fetch ${e.file_uuid} threw: ${t}`);return}let r=Ka(e.file_name),i=(e.file_uuid.slice(0,8)||Y().slice(0,8)).replace(/[^a-zA-Z0-9_-]/g,`_`),a=qa(),o=Da(a,`${i}-${r}`);try{await ka(a,{recursive:!0}),await Ma(o,n)}catch(e){Ha(`write ${o} failed: ${e}`);return}return Ha(`resolved ${e.file_uuid} → ${o} (${n.length} bytes)`),o}async function Ya(e){if(e.length===0)return``;Ha(`resolving ${e.length} attachment(s)`);let t=(await Promise.all(e.map(Ja))).filter(e=>e!==void 0);return t.length===0?``:t.map(e=>`@"${e}"`).join(` `)+` `}function Xa(e,t){if(!t)return e;if(typeof e==`string`)return t+e;let n=e.findLastIndex(e=>e.type===`text`);if(n!==-1){let r=e[n];if(r.type===`text`)return[...e.slice(0,n),{...r,text:t+r.text},...e.slice(n+1)]}return[...e,{type:`text`,text:t.trimEnd()}]}async function Za(e,t){let n=Ga(e);return n.length===0?t:Xa(t,await Ya(n))}Xr(),wt(),pt(),x(),Gt(),v(),Hi(),ma();function Qa(e){if(e.toLowerCase().endsWith(`.jsonl`))return{sessionId:Y(),ingressUrl:null,isUrl:!1,jsonlFile:e,isJsonlFile:!0};if(F(e))return{sessionId:e,ingressUrl:null,isUrl:!1,jsonlFile:null,isJsonlFile:!1};try{let t=new URL(e);return{sessionId:Y(),ingressUrl:t.href,isUrl:!0,jsonlFile:null,isJsonlFile:!1}}catch{}return null}ni(),Bt(),b(),N(),Pe(),An(),j(),Fn(),dt(),qe(),Jt(),zi(),_a(),va(),H();async function $a(){try{let e=await Aa(Oe(),`utf-8`),t=vr().safeParse(ar(e));return t.success?t.data:(U(`Invalid known_marketplaces.json in zip cache: ${t.error.message}`,{level:`error`}),{})}catch{return{}}}async function eo(e){await On(Oe(),W(e,null,2))}async function to(e,t){let n=w();if(!n)return;let r=await no(t);r!==null&&await On(Da(n,ce(e)),r)}async function no(e){let t=[Da(e,`.claude-plugin`,`marketplace.json`),Da(e,`marketplace.json`),e];for(let e of t)try{return await Aa(e,`utf-8`)}catch{}return null}async function ro(){let e=await hn();for(let[t,n]of Object.entries(e))if(n.installLocation)try{await to(t,n.installLocation)}catch(e){U(`Failed to save marketplace JSON for ${t}: ${e}`)}await eo({...await $a(),...e})}zr(),lr(),H(),Ar(),Ir(),d(),Nt();async function io(){let e=Ce();U(`installPluginsForHeadless: starting${e?` (zip cache mode)`:``}`);let t=await Mt();t&&(O(),Mn(`headlessPluginInstall: seed marketplaces registered`)),e&&(await cr().mkdir(zt()),await cr().mkdir(g()));let n=Object.keys(Ke()).length,r={marketplaces_installed:0,delisted_count:0},i=t;try{if(n===0)U(`installPluginsForHeadless: no marketplaces declared`);else{let t=await kr(`headless_marketplace_reconcile`,()=>oa({skip:e?(e,t)=>!xe(t):void 0,onProgress:e=>{e.type===`installed`?U(`installPluginsForHeadless: installed marketplace ${e.name}`):e.type===`failed`&&U(`installPluginsForHeadless: failed to install marketplace ${e.name}: ${e.error}`)}}),e=>({installed_count:e.installed.length,updated_count:e.updated.length,failed_count:e.failed.length,skipped_count:e.skipped.length}));t.skipped.length>0&&U(`installPluginsForHeadless: skipped ${t.skipped.length} marketplace(s) unsupported by zip cache: ${t.skipped.join(`, `)}`);let n=t.installed.length+t.updated.length;n>0&&(O(),Mn(`headlessPluginInstall: marketplaces reconciled`),i=!0),r.marketplaces_installed=n}e&&await ro();let t=await ta();return r.delisted_count=t.length,t.length>0&&(i=!0),i&&Mn(`headlessPluginInstall: plugins changed`),e&&fr(Ie),i}catch(e){return q(e),!1}finally{J(`tengu_headless_plugin_install`,r)}}zr(),H(),Ar(),rn(),Oi(),Ir(),Or(),Ge(),yt(),lr(),rr(),Kn(),h(),Ae(),or(),i(),wa(),M(),Fe(),Yt(),tt(),pr();var $=(yi(),e(bi)),ao=1e4,oo=new Set,so=[];function co(e){if(oo.has(e))return!1;if(oo.add(e),so.push(e),so.length>ao){let e=so.splice(0,so.length-ao);for(let t of e)oo.delete(t)}return!0}function lo(e){return typeof e==`string`?[{type:`text`,text:e}]:e}function uo(e){return e.length===1?e[0]:e.every(e=>typeof e==`string`)?e.join(`
|
|
9
|
+
`):e.flatMap(lo)}function fo(e,t){return t!==void 0&&t.mode===`prompt`&&t.workload===e.workload&&t.isMeta===e.isMeta}async function po(e,t,r,i,a,o,s,c){if(tn.subscribe(e=>{yn(e,r),ri()&&r(e=>{let t=e.settings,n=t.fastMode===!0&&!t.fastModePerSessionOptIn;return{...e,fastMode:n}})}),$&&!$.isProactiveActive()&&n(process.env.CLAUDE_CODE_PROACTIVE)&&$.activateProactive(`command`),typeof Bun<`u`&&setInterval(()=>{process.memoryUsage.rss()>350*1024*1024?Bun.gc(!0):Bun.gc(!1)},1e3).unref(),vn(),R(`runHeadless_entry`),await Xi()&&await Zi(),R(`after_grove_check`),c.resumeSessionAt&&!c.resume){process.stderr.write(`Error: --resume-session-at requires --resume
|
|
10
|
+
`),L(1);return}if(c.rewindFiles&&!c.resume){process.stderr.write(`Error: --rewind-files requires --resume
|
|
11
|
+
`),L(1);return}if(c.rewindFiles&&e){process.stderr.write(`Error: --rewind-files is a standalone operation and cannot be used with a prompt
|
|
12
|
+
`),L(1);return}let l=Co(e,c);c.outputFormat===`stream-json`&&za();let u=Qe.getSandboxUnavailableReason();if(u){if(Qe.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${u}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),L(1);return}process.stderr.write(`\n⚠ Sandbox disabled: ${u}\n Commands will run WITHOUT sandboxing. Network and filesystem restrictions will NOT be enforced.\n\n`)}else if(Qe.isSandboxingEnabled())try{await Qe.initialize(l.createSandboxAskCallback())}catch(e){process.stderr.write(`\n❌ Sandbox Error: ${V(e)}\n`),L(1,`other`);return}c.outputFormat===`stream-json`&&c.verbose&&_e(e=>{let t=(()=>{switch(e.type){case`started`:return{type:`system`,subtype:`hook_started`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,uuid:Y(),session_id:B()};case`progress`:return{type:`system`,subtype:`hook_progress`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,stdout:e.stdout,stderr:e.stderr,output:e.output,uuid:Y(),session_id:B()};case`response`:return{type:`system`,subtype:`hook_response`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,output:e.output,stdout:e.stdout,stderr:e.stderr,exit_code:e.exitCode,outcome:e.outcome,uuid:Y(),session_id:B()}}})();l.write(t)}),c.setupTrigger&&await Ht(c.setupTrigger),R(`before_loadInitialMessages`);let d=t(),{messages:f,turnInterruptionState:p,agentSetting:m}=await So(r,{continue:c.continue,teleport:c.teleport,resume:c.resume,resumeSessionAt:c.resumeSessionAt,forkSession:c.forkSession,outputFormat:c.outputFormat,sessionStartHooksPromise:c.sessionStartHooksPromise,restoredWorkerState:l.restoredWorkerState}),h=_n();if(h&&l.prependUserMessage(h),!c.agent&&!Xn()&&m){let{agentDefinition:e}=ba(m,void 0,{activeAgents:s,allAgents:s});if(e){if(r(t=>({...t,agent:e.agentType})),!c.systemPrompt&&!dn(e)){let t=e.getSystemPrompt();t&&(c.systemPrompt=t)}jt(e.agentType)}}if(f.length===0&&process.exitCode!==void 0)return;if(c.rewindFiles){let e=f.find(e=>e.uuid===c.rewindFiles);if(!e||e.type!==`user`){process.stderr.write(`Error: --rewind-files requires a user message UUID, but ${c.rewindFiles} is not a user message in this session\n`),L(1);return}let n=t(),i=await vo(c.rewindFiles,n,r,!1);if(!i.canRewind){process.stderr.write(`Error: ${i.error||`Unexpected error`}\n`),L(1);return}process.stdout.write(`Files rewound to state at message ${c.rewindFiles}\n`),L(0);return}let g=typeof c.resume==`string`&&(!!F(c.resume)||c.resume.endsWith(`.jsonl`)),_=!!c.sdkUrl;if(!e&&!g&&!_){process.stderr.write(`Error: Input must be provided either through stdin or as a prompt argument when using --print
|
|
13
|
+
`),L(1);return}if(c.outputFormat===`stream-json`&&!c.verbose){process.stderr.write(`Error: When using --print, --output-format=stream-json requires --verbose
|
|
14
|
+
`),L(1);return}let v=Ut(d.mcp.tools,d.toolPermissionContext),y=[...a,...v],ee=go(c.sdkUrl?`stdio`:c.permissionPromptToolName,l,()=>t().mcp.tools,e=>{r(e=>({...e,attribution:{...e.attribution,permissionPromptCount:e.attribution.permissionPromptCount+1}})),ki(`requires_action`,e)});c.permissionPromptToolName&&(y=y.filter(e=>!_i(e,c.permissionPromptToolName))),Dr(),R(`after_loadInitialMessages`),await Hr(),R(`after_modelStrings`);let b=c.outputFormat===`json`&&c.verbose,x=[],S;R(`before_runHeadlessStreaming`);for await(let e of mo(l,d.mcp.clients,[...i,...d.mcp.commands],y,f,ee,o,t,r,s,c,p))c.outputFormat===`stream-json`&&c.verbose&&await l.write(e),e.type!==`control_response`&&e.type!==`control_request`&&e.type!==`control_cancel_request`&&!(e.type===`system`&&(e.subtype===`session_state_changed`||e.subtype===`task_notification`||e.subtype===`task_started`||e.subtype===`task_progress`||e.subtype===`post_turn_summary`))&&e.type!==`stream_event`&&e.type!==`keep_alive`&&e.type!==`streamlined_text`&&e.type!==`streamlined_tool_use_summary`&&e.type!==`prompt_suggestion`&&(b&&x.push(e),S=e);switch(c.outputFormat){case`json`:if(!S||S.type!==`result`)throw Error(`No messages returned`);if(c.verbose){K(W(x)+`
|
|
15
|
+
`);break}K(W(S)+`
|
|
16
|
+
`);break;case`stream-json`:break;default:if(!S||S.type!==`result`)throw Error(`No messages returned`);switch(S.subtype){case`success`:K(S.result.endsWith(`
|
|
17
|
+
`)?S.result:S.result+`
|
|
18
|
+
`);break;case`error_during_execution`:K(`Execution error`);break;case`error_max_turns`:K(`Error: Reached max turns (${c.maxTurns}).\nTip: Increase the limit with --max-turns or continue in a new session.`);break;case`error_max_budget_usd`:K(`Error: Exceeded USD budget ($${c.maxBudgetUsd}).\nTip: Increase the limit with --max-budget-usd or start a new session to continue.`);break;case`error_max_structured_output_retries`:K(`Error: Failed to provide valid structured output after maximum retries.
|
|
19
|
+
Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(bt(),Tr())try{let{drainPendingExtraction:e}=await import(`./extractMemories-1VlmCGwa.js`);await e()}catch{}L(S?.type===`result`&&S?.is_error?1:0)}function mo(e,r,i,o,s,c,l,u,d,p,h,g){let _=!1,v,y=!1,b=null,x,S=e.outbound;process.on(`SIGINT`,()=>{jr(`info`,`shutdown_signal`,{signal:`SIGINT`}),x&&!x.signal.aborted&&x.abort(),gn(0)}),fr(async()=>{let t={};for(let e of Dn(u()))ln(e)&&(t[e.type]=(t[e.type]??0)+1);jr(`info`,`run_state_at_shutdown`,{run_active:_,run_phase:v,worker_status:ji(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),Ai(e=>{(e==="default"||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&S.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:Y(),session_id:B()})});let C={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},te;h.enableAuthStatus&&(te=qr.getInstance().subscribe(e=>{S.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:B()})}));let ae=e=>{let t=Bi(e);t&&S.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:Y(),session_id:B()})};Xe.add(ae);let w=s,T=$e(s,X(),100),E=he(100),se=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;g&&g.kind!==`none`&&se&&(U(`[print.ts] Auto-resuming interrupted turn (kind: ${g.kind})`),xo(w,g.message),Lt({mode:`prompt`,value:g.message.message.content,uuid:Y()}));let ce=ya().map(e=>{let t=e.value===null?`default`:e.value,n=t==="default"?ei():Vr(t),r=Je(n),i=Qr(e.value),a=Ur(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsAdaptiveThinking:!0},...i&&{supportsFastMode:!0},...a&&{supportsAutoMode:!0}}}),fe=h.userSpecifiedModel;function ge(e,t){let n=m(e,li(t));w.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&S.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:B(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let D=[],O=[],_e=new Set;function ve(t){for(let n of t){if(n.type!==`connected`||_e.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(Qt,async(n,r)=>{Pr(t,`Elicitation request received in print mode: ${W(n)}`);let i=n.params.mode===`url`?`url`:`form`;J(`tengu_mcp_elicitation_shown`,{mode:i});let a=await re(t,n.params,r.signal);if(a)return Pr(t,`Elicitation resolved by hook: ${W(a)}`),J(`tengu_mcp_elicitation_response`,{mode:i,action:a.action}),a;let o=`url`in n.params?n.params.url:void 0,s=`requestedSchema`in n.params?n.params.requestedSchema:void 0,c=`elicitationId`in n.params?n.params.elicitationId:void 0,l=await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),u=await we(t,l,r.signal,i,c);return J(`tengu_mcp_elicitation_response`,{mode:i,action:u.action}),u}),n.client.setNotificationHandler(st,e=>{let{elicitationId:n}=e.params;Pr(t,`Elicitation completion notification: ${n}`),me({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),S.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:Y(),session_id:B()})}),_e.add(t)}catch{}}}async function ye(){let t=new Set(Object.keys(l)),n=new Set(D.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=D.some(e=>e.type===`pending`),o=D.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of D)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await En(l,(t,n)=>e.sendMcpMessage(t,n));D=r.clients,O=r.tools;let i=wr([...n,...t]);d(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(G(t)))),...O]}})),Tn(D)}}ye();let k={clients:[],tools:[],configs:{}},xe=e=>{let t=lt(e.toolPermissionContext,e.mcp.tools),n=rt(ua([...o,...O,...k.tools],t,e.toolPermissionContext.mode),`name`);h.permissionPromptToolName&&(n=n.filter(e=>!_i(e,h.permissionPromptToolName)));let r=Jn();if(r&&!h.jsonSchema){let e=di(r);`tool`in e&&(n=[...n,e.tool])}return n},A=null,Ce=0;function Ee(){if(!A)return;let e=Math.min(Ce,w.length),t=w.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);Ce=w.length,t.length>0&&A.writeMessages(t)}let De=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Oe(e){let t=async()=>{let t=new Set(D.map(e=>e.name)),n=await Eo(e,{configs:l,clients:D,tools:O},k,d);for(let e of Object.keys(l))delete l[e];if(Object.assign(l,n.newSdkState.configs),D=n.newSdkState.clients,O=n.newSdkState.tools,k=n.newDynamicState,n.sdkServersChanged){let e=new Set(D.map(e=>e.name)),n=wr([...t,...e]);d(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(G(t)))),...O]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return De=De.then(t,t),De}function Ae(){let e=u(),t=e.mcp.clients,n=rt([...e.mcp.tools,...k.tools],`name`),r=new Set([...t.map(e=>e.name),...D.map(e=>e.name)]);return[...t,...D,...k.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers,oauth:e.config.oauth};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?Ct(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0;return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r}})}async function Ne(){try{await Promise.all([Promise.resolve(),kr(`headless_managed_settings_wait`,()=>Qi())]),await io()&&await Le()}catch(e){q(e)}}let Pe=null;a()||(n(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?Pe=Ne():Ne());let Fe=Ba(()=>!_),j=i,M=p;async function Ie(){let{agentDefinitions:e}=await Ca(d);j=await Re(X());let t=M.filter(e=>e.source===`flagSettings`);M=[...e.allAgents,...t]}async function Le(){let{servers:e}=await ne(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(l))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Oe(t);r&&ye(),U(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let ze=Sa.subscribe(()=>{je(),Re(X()).then(e=>{j=e})}),Ve=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||y||(async()=>{let e=await it({basePrompt:`<${Nr}>${new Date().toLocaleTimeString()}</${Nr}>`,currentDir:X(),shouldCreate:()=>!y});if(y){await Et({commands:e});return}for(let t of e)Lt({...t,uuid:Y()});N()})().catch(e=>{q(e),U(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};pe(()=>{x&&ke(`now`).length>0&&x.abort(`interrupt`)});let N=async()=>{if(_)return;if(_=!0,v=void 0,ki(`running`),Fe.stop(),R(`run_entry`),await ye(),R(`after_updateSdkMcp`),Pe){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=si(e).then(()=>`timeout`);await Promise.race([Pe,t])===`timeout`&&(q(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),J(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await Pe;Pe=null,await Ie();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-LbaURHVH.js`);t()}let n=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=ie(n);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;fo(r,Rn(n));)i.push(ie(n));let a=await Ze(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:uo(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(h.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&S.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:B(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=u(),l=[...s.mcp.clients,...D,...k.clients];ve(l);let f=xe(s);for(let e of o)Kt(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,u=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,d=u.match(/<total_tokens>(\d+)<\/total_tokens>/),f=u.match(/<tool_uses>(\d+)<\/tool_uses>/),p=u.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&S.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:d&&f?{total_tokens:parseInt(d[1],10),tool_uses:parseInt(f[1],10),duration_ms:p?parseInt(p[1],10):0}:void 0,session_id:B(),uuid:Y()})}let p=r.value,m=a.claimedCommands;if(e instanceof Fa&&r.mode===`prompt`&&J(`tengu_bridge_message_received`,{is_repl:!1}),C.abortController?.abort(),C.abortController=null,C.pendingSuggestion=null,C.pendingLastEmittedEntry=null,C.lastEmitted&&r.mode===`prompt`){let e=typeof p==`string`?p:p.find(e=>e.type===`text`)?.text;typeof e==`string`&&kt(C.lastEmitted.text,e,C.lastEmitted.emittedAt,C.lastEmitted.promptId,C.lastEmitted.generationRequestId),C.lastEmitted=null}x=It(),R(`before_ask`),et();let g=r,_=!1;try{if(await Zr(g.workload??h.workload,async()=>{for await(let t of fa({commands:rt([...j,...s.mcp.commands],`name`),prompt:p,promptUuid:g.uuid,isMeta:g.isMeta,cwd:X(),tools:f,verbose:h.verbose,mcpClients:l,thinkingConfig:h.thinkingConfig,maxTurns:h.maxTurns,maxBudgetUsd:h.maxBudgetUsd,taskBudget:h.taskBudget,canUseTool:c,userSpecifiedModel:fe,fallbackModel:h.fallbackModel,jsonSchema:Jn()??h.jsonSchema,mutableMessages:w,getReadFileCache:()=>E.size===0?T:He(T,E),setReadFileCache:e=>{T=e;for(let[e,t]of E.entries()){let n=T.get(e);(!n||t.timestamp>n.timestamp)&&T.set(e,t)}E.clear()},customSystemPrompt:h.systemPrompt,appendSystemPrompt:h.appendSystemPrompt,getAppState:u,setAppState:d,abortController:x,replayUserMessages:h.replayUserMessages,includePartialMessages:h.includePartialMessages,handleElicitation:(t,n,r)=>e.handleElicitation(t,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:M,orphanedPermission:g.orphanedPermission,setSDKStatus:e=>{S.enqueue({type:`system`,subtype:`status`,status:e,session_id:B(),uuid:Y()})}}))if(Ee(),t.type===`result`){_=!!t.is_error;for(let e of vi())S.enqueue(e);Dn(u()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&ln(e))?b=t:(b=null,S.enqueue(t))}else{for(let e of vi())S.enqueue(e);S.enqueue(t)}}),_)await Sn({commands:m,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:X(),priority:`later`,workload:g.workload??h.workload});else{let e=await Sn({commands:m,outcome:{type:`completed`},currentDir:X(),priority:`later`,workload:g.workload??h.workload});for(let t of e)Lt({...t,uuid:Y()})}}catch(e){throw await Sn({commands:m,outcome:{type:`failed`,error:e},currentDir:X(),priority:`later`,workload:g.workload??h.workload}),e}for(let e of o)Kt(e,`completed`);if(Ee(),A?.sendResult(),h.promptSuggestions&&!t(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){C.abortController?.abort();let e=new AbortController;C.abortController=e;let t=Me();if(!t)Tt(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await xn(e,w,u,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:Y(),session_id:B()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};b?(C.pendingSuggestion=r,C.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(C.lastEmitted=i,S.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){Tt(`aborted`,void 0,void 0,`sdk`);return}q(sr(e))}finally{C.inflightPromise===n.promise&&(C.inflightPromise=null)}})(),C.inflightPromise=n.promise}}bt(),cn(),vn()}};do{for(let e of vi())S.enqueue(e);v=`draining_commands`,await a(),i=!1;{let e=Dn(u()).some(e=>ln(e)),t=Rn(n)!==void 0;(e||t)&&(i=!0,t||(v=`waiting_for_agents`,await si(100)))}}while(i);b&&(S.enqueue(b),b=null,C.pendingSuggestion&&(S.enqueue(C.pendingSuggestion),C.pendingLastEmittedEntry&&(C.lastEmitted={...C.pendingLastEmittedEntry,emittedAt:Date.now()},C.pendingLastEmittedEntry=null),C.pendingSuggestion=null))}catch(t){try{await e.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:B(),total_cost_usd:0,usage:Mi,modelUsage:{},permission_denials:[],uuid:Y(),errors:[V(t),...Fr().map(e=>e.error)]})}catch{}C.abortController?.abort(),L(1);return}finally{if(v=`finally_flush`,await e.flushInternalEvents(),v=`finally_post_flush`,!nn()){ki(`idle`);for(let e of vi())S.enqueue(e)}_=!1,Fe.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&Rn(n)===void 0&&!y){Ve();return}if(Rn(n)!==void 0){N();return}y&&(C.inflightPromise&&await Promise.race([C.inflightPromise,si(5e3)]),C.abortController?.abort(),C.abortController=null,await de(),ze(),te?.(),Xe.delete(ae),S.done())},P=function(e,t){S.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},F=function(e,t){S.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},We=new Set;e.setUnexpectedResponseCallback(async e=>{await wo({message:e,setAppState:d,handledToolUseIds:We,onEnqueued:()=>{N()}})});let Ge=new Map,Ke=new Map,qe=new Set,Ye=new Map,I=null;return(async()=>{let t=!1;jr(`info`,`cli_message_loop_started`);for await(let n of e.structuredInput){let a=`uuid`in n?n.uuid:void 0;if(a&&n.type!==`user`&&n.type!==`control_response`&&Kt(a,`completed`),n.type===`control_request`){let a=n,o=a.request;if(a.request.subtype===`interrupt`)d(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),x&&x.abort(),C.abortController?.abort(),C.abortController=null,C.lastEmitted=null,C.pendingSuggestion=null,P(a);else if(o.subtype===`end_session`){U(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),x&&x.abort(),C.abortController?.abort(),C.abortController=null,C.lastEmitted=null,C.pendingSuggestion=null,P(a);break}else if(a.request.subtype===`initialize`){if(a.request.sdkMcpServers&&a.request.sdkMcpServers.length>0)for(let e of a.request.sdkMcpServers)l[e]={type:`sdk`,name:e};await _o(a.request,a.request_id,t,S,i,ce,e,!!h.enableAuthStatus,h,p,u),a.request.promptSuggestions&&d(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),a.request.agentProgressSummaries&&Zn(!0),t=!0,le()&&N()}else if(a.request.subtype===`set_permission_mode`){let e=a.request;d(t=>({...t,toolPermissionContext:yo(e,a.request_id,t.toolPermissionContext,S)}))}else if(a.request.subtype===`set_model`){let e=a.request.model??`default`,t=e==="default"?ei():e;fe=t,Yn(t),Ti({model:t}),ge(e,t),P(a)}else if(a.request.subtype===`set_max_thinking_tokens`)a.request.max_thinking_tokens===null?h.thinkingConfig=void 0:a.request.max_thinking_tokens===0?h.thinkingConfig={type:`disabled`}:h.thinkingConfig={type:`enabled`,budgetTokens:a.request.max_thinking_tokens},P(a);else if(a.request.subtype===`mcp_status`)P(a,{mcpServers:Ae()});else if(a.request.subtype===`get_context_usage`)try{let e=u(),t=await ga({messages:w,getAppState:u,options:{mainLoopModel:oi(),tools:xe(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:h.systemPrompt,appendSystemPrompt:h.appendSystemPrompt}});P(a,{...t})}catch(e){F(a,V(e))}else if(a.request.subtype===`mcp_message`){let e=a.request,t=D.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),P(a)}else if(a.request.subtype===`rewind_files`){let e=u(),t=await vo(a.request.user_message_id,e,d,a.request.dry_run??!1);t.canRewind||a.request.dry_run?P(a,t):F(a,t.error??`Unexpected error`)}else if(a.request.subtype===`cancel_async_message`){let e=a.request.message_uuid,t=Te(t=>t.uuid===e);P(a,{cancelled:t.length>0})}else if(a.request.subtype===`seed_read_state`){try{let e=gr(a.request.path),t=Math.floor((await ja(e)).mtimeMs);if(t<=a.request.mtime){let n=await Aa(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
|
|
20
|
+
`,`
|
|
21
|
+
`);E.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}P(a)}else if(a.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Oe(a.request.servers);P(a,e),t&&ye()}else if(a.request.subtype===`reload_plugins`)try{let e=await Ca(d),t=M.filter(e=>e.source===`flagSettings`);M=[...e.agentDefinitions.allAgents,...t];let n=[],[r,i,o]=await Promise.allSettled([Re(X()),Le(),oe()]);r.status===`fulfilled`?j=r.value:q(r.reason),i.status===`rejected`&&q(i.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):q(o.reason),P(a,{commands:j.filter(e=>e.userInvocable!==!1).map(e=>({name:Ue(e),description:Be(e),argumentHint:e.argumentHint||``})),agents:M.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:Ae(),error_count:e.error_count})}catch(e){F(a,V(e))}else if(a.request.subtype===`mcp_reconnect`){let e=u(),{serverName:t}=a.request;_e.delete(t);let n=Ft(t)??r.find(e=>e.name===t)?.config??D.find(e=>e.name===t)?.config??k.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)F(a,`Server not found: ${t}`);else{let e=await ee(t,n),r=G(t);if(d(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...z(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...z(n.mcp.commands,e=>Zt(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:Ni(n.mcp.resources,t)}})),k={...k,clients:[...k.clients.filter(e=>e.name!==t),e.client],tools:[...k.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`)ve([e.client]),P(a);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;F(a,t)}}}else if(a.request.subtype===`mcp_toggle`){let e=u(),{serverName:t,enabled:n}=a.request;_e.delete(t);let i=Ft(t)??r.find(e=>e.name===t)?.config??D.find(e=>e.name===t)?.config??k.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!i)F(a,`Server not found: ${t}`);else if(n){be(t,!0);let e=await ee(t,i),n=G(t);if(d(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...z(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...z(r.mcp.commands,e=>Zt(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:Ni(r.mcp.resources,t)}})),e.client.type===`connected`)ve([e.client]),P(a);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;F(a,t)}}else{be(t,!1);let n=[...r,...D,...k.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await Wt(t,i);let o=G(t);d(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:i}:e),tools:z(e.mcp.tools,e=>e.name?.startsWith(o)),commands:z(e.mcp.commands,e=>Zt(e,t)),resources:Ni(e.mcp.resources,t)}})),P(a)}}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=u(),n=Ft(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)F(a,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)F(a,`Server type "${n.type}" does not support OAuth authentication`);else try{Ge.get(e)?.abort();let t=new AbortController;Ge.set(e,t);let r,i=new Promise(e=>{r=e}),o=ue(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{Ke.set(e,t)}}),s=await Promise.race([i,o.then(()=>null)]);s?P(a,{authUrl:s,requiresUserAction:!0}):P(a,{requiresUserAction:!1}),Ye.set(e,o),o.then(async()=>{if(Se(e)||qe.has(e))return;let t=await ee(e,n),r=G(e);d(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...z(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...z(n.mcp.commands,t=>Zt(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:Ni(n.mcp.resources,e)}})),k={...k,clients:[...k.clients.filter(t=>t.name!==e),t.client],tools:[...k.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{U(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Ge.get(e)===t&&(Ge.delete(e),Ke.delete(e),qe.delete(e),Ye.delete(e))})}catch(e){F(a,V(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=Ke.get(e);if(n){let r=!1;try{let e=new URL(t);r=e.searchParams.has(`code`)||e.searchParams.has(`error`)}catch{}if(!r)F(a,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{qe.add(e),n(t);let r=Ye.get(e);if(r)try{await r,P(a)}catch(e){F(a,e instanceof Error?e.message:`OAuth authentication failed`)}else P(a)}}else F(a,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;I?.service.cleanup(),J(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new $i,n,r=new Promise(e=>{n=e}),i=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await ea(t),J(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),I?.service===t&&(I=null)});I={service:t,flow:i},i.catch(e=>U(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,i.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);P(a,{manualUrl:e,automaticUrl:t})}catch(e){F(a,V(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!I)F(a,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&I.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=I;e.then(()=>{let e=Yr();P(a,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:Jr()}})},e=>F(a,V(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=u(),n=Ft(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)F(a,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)F(a,`Cannot clear auth for server type "${n.type}"`);else{await on(e,n);let t=await ee(e,n),r=G(e);d(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...z(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...z(n.mcp.commands,t=>Zt(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:Ni(n.mcp.resources,e)}})),P(a,{})}}else if(a.request.subtype===`apply_flag_settings`){let e=oi(),t=qn()??{},n=a.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];Qn(r),tn.notifyChange(`flagSettings`),`model`in n&&(n.model==null?Yn(void 0):Yn(String(n.model)));let i=oi();if(i!==e){fe=i;let e=n.model?String(n.model):`default`;Ti({model:i}),ge(e,i)}P(a)}else if(a.request.subtype===`get_settings`){let e=oi();P(a,{..._r(),applied:{model:e}})}else if(a.request.subtype===`stop_task`){let{task_id:e}=a.request;try{await en(e,{getAppState:u,setAppState:d}),P(a,{})}catch(e){F(a,V(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(x&&!x.signal.aborted?x:It()).signal;(async()=>{try{let r=await Vi(e,n);if(r&&t)try{Dt(B(),r)}catch(e){q(e)}P(a,{title:r})}catch(e){F(a,V(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=Me(),n=t?{...t,toolUseContext:{...t.toolUseContext,abortController:It()}}:await pa({tools:xe(u()),commands:j,mcpClients:[...u().mcp.clients,...D,...k.clients],messages:w,readFileState:T,getAppState:u,setAppState:d,customSystemPrompt:h.systemPrompt,appendSystemPrompt:h.appendSystemPrompt,thinkingConfig:h.thinkingConfig,agents:M}),r=await ha({question:e,cacheSafeParams:n});P(a,{response:r.response})}catch(e){F(a,V(e))}})()}else if(a.request.subtype===`set_proactive`)a.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),Ve()):$.deactivateProactive(),P(a);else if(o.subtype===`remote_control`)if(o.enabled)if(A)P(a,{session_url:ut(A.bridgeSessionId,A.sessionIngressUrl),connect_url:$t(A.environmentId,A.sessionIngressUrl),environment_id:A.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-RhCAlmHE.js`),r=await n({onInboundMessage(e){let t=ca(e);if(!t)return;let{content:n,uuid:r}=t;Lt({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),N()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){x?.abort()},onSetModel(e){let t=e==="default"?ei():e;fe=t,Yn(t)},onSetMaxThinkingTokens(e){e===null?h.thinkingConfig=void 0:e===0?h.thinkingConfig={type:`disabled`}:h.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),U(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),S.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:Y(),session_id:B()})},initialMessages:w.length>0?w:void 0});r?(A=r,Ce=w.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),P(a,{session_url:ut(r.bridgeSessionId,r.sessionIngressUrl),connect_url:$t(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):F(a,t??`Remote Control initialization failed`)}catch(e){F(a,V(e))}}else A&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await A.teardown(),A=null),P(a);else F(a,`Unsupported control request subtype: ${a.request.subtype}`);continue}else if(n.type===`control_response`){h.replayUserMessages&&S.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=Ri([n]);w.push(...e),n.type===`assistant`&&h.replayUserMessages&&S.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=B(),t=await un(e,o.uuid);if(t||oo.has(o.uuid)){U(`Skipping duplicate user message: ${o.uuid}`),h.replayUserMessages&&(U(`Sending acknowledgment for duplicate user message: ${o.uuid}`),S.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&Kt(o.uuid,`completed`);continue}co(o.uuid)}Lt({mode:`prompt`,value:await Za(o,o.message.content),uuid:o.uuid,priority:o.priority}),d(e=>({...e,attribution:at(e.attribution,e=>{f(e).catch(e=>{U(`Attribution: Failed to save snapshot: ${e}`)})})})),N()}y=!0,_||(C.inflightPromise&&await Promise.race([C.inflightPromise,si(5e3)]),C.abortController?.abort(),C.abortController=null,await de(),ze(),te?.(),Xe.delete(ae),S.done())})(),S}function ho(e){let t=async(n,r,i,a,o,s)=>{let c=s??await Le(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=Ne(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,h=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!h.content||!Array.isArray(h.content)||!h.content[0]||h.content[0].type!==`text`||typeof h.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return la(sa().parse(Rr(h.content[0].text)),e,r,i)};return t}function go(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await Le(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>_i(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),L(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),L(1),Error(t)}i=ho(r)}return i(t,r,a,o,s,c)}}async function _o(e,t,n,r,i,a,o,s,c,l,u){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(c.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(c.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(c.promptSuggestions=e.promptSuggestions),e.agents){let t=ht(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=Xn()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(Gn(t.agentType),!c.systemPrompt&&!dn(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&Yn(Vr(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let d=yr()?.outputStyle||`default`,f=await wn(ir()),p=Yr();if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});tr(t)}e.jsonSchema&&nr(e.jsonSchema);let m={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:Ue(e),description:Be(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:d,available_output_styles:Object.keys(f),models:a,account:{email:p?.email,organization:p?.organization,subscriptionType:p?.subscription,tokenSource:p?.tokenSource,apiKeySource:p?.apiKeySource,apiProvider:Jr()},pid:process.pid};if(ri()&&ai()){let e=u();m.fast_mode_state=Wr(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:m}}),s){let e=qr.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:B()})}}async function vo(e,t,n,r){if(!fe())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!P(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await ye(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await We(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${V(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function yo(e,t,n,r){if(e.mode===`bypassPermissions`){if(te())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!E()){let e=kn();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${nt(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...A(n.mode,e.mode,n),mode:e.mode}}function bo(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:B(),total_cost_usd:0,usage:Mi,modelUsage:{},permission_denials:[],uuid:Y(),errors:[e]};process.stdout.write(W(t)+`
|
|
22
|
+
`)}else process.stderr.write(e+`
|
|
23
|
+
`)}function xo(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function So(e,t){let r=!er();if(t.continue)try{J(`tengu_continue_print`,{});let n=await Pt(void 0,void 0);if(n)return t.forkSession||n.sessionId&&($n(an(n.sessionId),n.fullPath?Ea(n.fullPath):null),r&&await ft()),xa(n,e),xt(t.forkSession?{...n,worktreeSession:void 0}:n),{messages:n.messages,turnInterruptionState:n.turnInterruptionState,agentSetting:n.agentSetting}}catch(e){return q(e),L(1),{messages:[]}}if(t.teleport)try{if(!S(`allow_remote_sessions`))throw Error(`Remote sessions are disabled by your organization's policy.`);if(J(`tengu_teleport_print`,{}),typeof t.teleport!=`string`)throw Error(`No session ID provided for teleport`);let{checkOutTeleportedSessionBranch:e,processMessagesForTeleportResume:n,teleportResumeCodeSession:r,validateGitState:i}=await import(`./teleport-mdnhIZBj.js`);await i();let a=await r(t.teleport),{branchError:o}=await e(a.branch);return{messages:n(a.log,o)}}catch(e){return q(e),L(1),{messages:[]}}if(t.resume)try{J(`tengu_resume_print`,{});let i=Qa(typeof t.resume==`string`?t.resume:``);if(!i){let e=`Error: --resume requires a valid session ID when used with --print. Usage: claude -p --resume <session-id>`;return typeof t.resume==`string`&&(e+=`. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${t.resume}" is not a valid UUID`),bo(e,t.outputFormat),L(1),{messages:[]}}if(n(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,n]=await Promise.all([De(i.sessionId),t.restoredWorkerState]);n&&(e(na(n)),typeof n.model==`string`&&Yn(n.model))}else i.isUrl&&i.ingressUrl&&n(process.env.ENABLE_SESSION_PERSISTENCE)&&await Rt(i.sessionId,i.ingressUrl);let a=await Pt(i.sessionId,i.jsonlFile||void 0);if(!a||a.messages.length===0)return i.isUrl||n(process.env.CLAUDE_CODE_USE_CCR_V2)?{messages:await(t.sessionStartHooksPromise??ct(`startup`))}:(bo(`No conversation found with session ID: ${i.sessionId}`,t.outputFormat),L(1),{messages:[]});if(t.resumeSessionAt){let e=a.messages.findIndex(e=>e.uuid===t.resumeSessionAt);if(e<0)return bo(`No message found with message.uuid of: ${t.resumeSessionAt}`,t.outputFormat),L(1),{messages:[]};a.messages=e>=0?a.messages.slice(0,e+1):[]}return!t.forkSession&&a.sessionId&&($n(an(a.sessionId),a.fullPath?Ea(a.fullPath):null),r&&await ft()),xa(a,e),xt(t.forkSession?{...a,worktreeSession:void 0}:a),{messages:a.messages,turnInterruptionState:a.turnInterruptionState,agentSetting:a.agentSetting}}catch(e){return q(e),bo(e instanceof Error?`Failed to resume session: ${e.message}`:`Failed to resume session with --print mode`,t.outputFormat),L(1),{messages:[]}}return{messages:await(t.sessionStartHooksPromise??ct(`startup`))}}function Co(e,t){let n;return n=typeof e==`string`?e.trim()===``?u([]):u([W({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})]):e,t.sdkUrl?new Fa(t.sdkUrl,n,t.replayUserMessages):new aa(n,t.replayUserMessages)}async function wo({message:e,setAppState:t,onEnqueued:n,handledToolUseIds:r}){let i=e.response;if(i?.subtype===`success`&&i.response?.toolUseID&&typeof i.response.toolUseID==`string`){let e=i.response,t=e.toolUseID;if(!t)return!1;if(U(`handleOrphanedPermissionResponse: received orphaned control_response for toolUseID=${t} request_id=${i.request_id}`),r.has(t))return U(`handleOrphanedPermissionResponse: skipping duplicate orphaned permission for toolUseID=${t} (already handled)`),!1;let a=await mn(t);return a?(r.add(t),U(`handleOrphanedPermissionResponse: enqueuing orphaned permission for toolUseID=${t} messageID=${a.message.id}`),Lt({mode:`orphaned-permission`,value:[],orphanedPermission:{permissionResult:e,assistantMessage:a}}),n?.(),!0):(U(`handleOrphanedPermissionResponse: no unresolved tool_use found for toolUseID=${t} (already resolved in transcript)`),!1)}return!1}function To(e){return{...e,scope:`dynamic`}}async function Eo(e,t,n,r){let{allowed:i,blocked:a}=se(e),o={};for(let e of a)o[e]=`Blocked by enterprise policy (allowedMcpServers/deniedMcpServers)`;let s={},c={};for(let[e,t]of Object.entries(i))t.type===`sdk`?s[e]=t:c[e]=t;let l=new Set(Object.keys(t.configs)),u=new Set(Object.keys(s)),d=[],f=[],p={...t.configs},m=[...t.clients],h=[...t.tools];for(let e of l)if(!u.has(e)){let t=m.find(t=>t.name===e);t&&t.type===`connected`&&await t.cleanup(),m=m.filter(t=>t.name!==e);let n=`mcp__${e}__`;h=h.filter(e=>!e.name.startsWith(n)),delete p[e],f.push(e)}for(let[e,t]of Object.entries(s))if(!l.has(e)){p[e]=t;let n={type:`pending`,name:e,config:{...t,scope:`dynamic`}};m=[...m,n],d.push(e)}let g=await Do(c,n,r);return{response:{added:[...d,...g.response.added],removed:[...f,...g.response.removed],errors:{...o,...g.response.errors}},newSdkState:{configs:p,clients:m,tools:h},newDynamicState:g.newState,sdkServersChanged:d.length>0||f.length>0}}async function Do(e,t,n){let r=new Set(Object.keys(t.configs)),i=new Set(Object.keys(e)),a=[...r].filter(e=>!i.has(e)),o=[...i].filter(e=>!r.has(e)),s=[...r].filter(e=>i.has(e)).filter(n=>{let r=t.configs[n],i=e[n];return!r||!i||!vt(r,To(i))}),c=[],l=[],u={},d=[...t.clients],f=[...t.tools];for(let e of[...a,...s]){let n=d.find(t=>t.name===e),r=t.configs[e];if(n&&r){if(n.type===`connected`)try{await n.cleanup()}catch(e){q(e)}await Wt(e,r)}let i=`mcp__${e}__`;f=f.filter(e=>!e.name.startsWith(i)),d=d.filter(t=>t.name!==e),a.includes(e)&&c.push(e)}for(let t of[...o,...s]){let n=e[t];if(!n)continue;let r=To(n);if(n.type===`sdk`){l.push(t);continue}try{let e=await Ot(t,r);if(d.push(e),e.type===`connected`){let t=await bn(e);f.push(...t)}else e.type===`failed`&&(u[t]=e.error||`Connection failed`);l.push(t)}catch(e){let n=sr(e);u[t]=n.message,q(n)}}let p={};for(let t of i){let n=e[t];n&&(p[t]=To(n))}let m={clients:d,tools:f,configs:p};return n(e=>{let n=new Set([...Object.keys(t.configs),...Object.keys(p)]),r=e.mcp.tools.filter(e=>{for(let t of n)if(e.name.startsWith(`mcp__${t}__`))return!1;return!0}),i=e.mcp.clients.filter(e=>!n.has(e.name));return{...e,mcp:{...e.mcp,tools:[...r,...f],clients:[...i,...d]}}}),{response:{added:l,removed:c,errors:u},newState:m}}export{po as runHeadless};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{FS as t,Fa as n,IS as r,Ia as i,Jg as a,Ma as o,Qa as s,a_ as c,co as l,gy as u,hy as d,i_ as f,im as p,n_ as m,qg as h,r_ as g,rm as _}from"./loadAgentsDir-CKSb56Gp.js";import{I as v,fi as y,t as b}from"./src-P_wYS_NJ2.js";import{t as x}from"./jsx-runtime-Bb4Xn-E0.js";import{F as S,j as C,z as w}from"./debug-BdqxZ7rV.js";import{g as T,n as E}from"./settings-Xbq6AaD-.js";import{n as D,r as O}from"./analytics-DJobLaWP.js";import{gt as k,ht as A}from"./prompt-CybUvG8G.js";import{randomUUID as j}from"crypto";y(),b(),g(),p(),c();var M=x();function N({input:e,progress:t,verbose:n}){return(0,M.jsxs)(v,{flexDirection:`column`,marginTop:1,children:[(0,M.jsx)(_,{addMargin:!1,param:{text:`<bash-input>${e}</bash-input>`,type:`text`}}),t?(0,M.jsx)(f,{fullOutput:t.fullOutput,output:t.output,elapsedTimeSeconds:t.elapsedTimeSeconds,totalLines:t.totalLines,verbose:n}):m.renderToolUseProgressMessage?.([],{verbose:n,tools:[],terminalSize:void 0})]})}w(),D(),t(),s(),T();function P(){return E().defaultShell??`bash`}g(),A(),u();async function F(t,s,c,u,f){let p=k()&&P()===`powershell`;O(`tengu_input_bash`,{powershell:p});let g=i({content:l({inputString:`<bash-input>${t}</bash-input>`,precedingInputBlocks:s})}),_;f({jsx:(0,M.jsx)(N,{input:t,progress:null,verbose:u.options.verbose}),shouldHidePromptInput:!1});try{let n={...u,setToolJSX:e=>{_=e?.jsx}},s=e=>{f({jsx:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{input:t,progress:e.data,verbose:u.options.verbose}),_]}),shouldHidePromptInput:!1,showSpinner:!1})},l=null;p&&(l=(a(),e(h)).PowerShellTool);let v=l??m,y=(l?await l.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,s):await m.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,s)).data;if(!y)throw Error(`No result received from shell command`);let b=y.stderr,x=await r(v,{...y,stderr:``},j()),S=typeof x.content==`string`?x.content:d(y.stdout);return{messages:[o(),g,...c,i({content:`<bash-stdout>${S}</bash-stdout><bash-stderr>${d(b)}</bash-stderr>`})],shouldQuery:!1}}catch(e){return e instanceof C?e.interrupted?{messages:[o(),g,n({toolUse:!1}),...c],shouldQuery:!1}:{messages:[o(),g,...c,i({content:`<bash-stdout>${d(e.stdout)}</bash-stdout><bash-stderr>${d(e.stderr)}</bash-stderr>`})],shouldQuery:!1}:{messages:[o(),g,...c,i({content:`<bash-stderr>Command failed: ${d(S(e))}</bash-stderr>`})],shouldQuery:!1}}finally{f(null)}}export{F as processBashCommand};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$_ as t,$a as n,AS as r,Ab as i,Ba as a,Bf as o,Bi as s,C as c,Cc as l,Cm as u,Fa as d,GE as f,Gf as p,HC as m,Hf as h,Hi as g,Ia as _,Ib as v,Ii as y,Jf as b,Ji as x,Jm as S,KE as C,Ma as w,Na as T,Qa as E,Rs as D,Sh as O,Th as k,Tm as A,U as j,UC as M,Vf as ee,Vs as te,W as ne,WC as re,Xi as N,Yf as ie,Ym as ae,bm as P,co as F,el as oe,ev as se,jy as ce,k as le,kS as ue,ka as I,kb as de,ky as fe,nD as pe,ob as me,oo as he,qE as L,qi as R,rD as ge,rb as _e,rg as ve,ro as ye,tg as be,tl as xe,wc as Se,wm as Ce,xc as z,xh as we,ym as Te,zs as Ee}from"./loadAgentsDir-CKSb56Gp.js";import{Kt as De,mt as Oe,qn as ke,t as Ae}from"./state-Bs5xweDL.js";import{A as B,D as je,a as V,d as Me,l as H,p as Ne,z as Pe}from"./debug-BdqxZ7rV.js";import{Dt as Fe,Ot as Ie}from"./settings-Xbq6AaD-.js";import{J as Le,T as U,o as Re,s as W,w as G}from"./log-CTFl4qpD.js";import{n as ze,r as K}from"./analytics-DJobLaWP.js";import{_n as Be,ni as Ve,ri as He,vn as Ue}from"./model-C2e73CJD.js";import{ct as We,ot as Ge}from"./esm-DcIr7tVd.js";import{E as Ke,T as qe,w as Je}from"./sessionTracing-ClGQ08jM.js";import{randomUUID as q}from"crypto";function Ye(e,t,n,r,i){let a=0;for(let o of Fe){let s=n[o];if(s)for(let n of s)for(let s of n.hooks){let c=s.once?()=>{H(`Removing one-shot hook for event ${o} in skill '${r}'`),A(e,t,o,s)}:void 0;u(e,t,o,n.matcher||``,s,c,i),a++}}a>0&&H(`Registered ${a} hooks from skill '${r}'`)}var Xe=e((()=>{Ie(),V(),Ce()}));function Ze(e){let t=e.trim();if(!t.startsWith(`/`))return null;let n=t.slice(1).split(` `);if(!n[0])return null;let r=n[0],i=!1,a=1;n.length>1&&n[1]===`(MCP)`&&(r+=` (MCP)`,i=!0,a=2);let o=n.slice(a).join(` `);return{commandName:r,args:o,isMcp:i}}var Qe=e((()=>{}));function $e(){return!1}function J(){if(!$e())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function et(e,t,n,r,a,o,s){let c=S(),l=e.pluginInfo?L(e.pluginInfo.repository).marketplace:void 0;K(`tengu_slash_command_forked`,{command_name:e.name,invocation_trigger:`user-slash`,...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...l&&{_PROTO_marketplace_name:l},...h(e.pluginInfo)}});let{skillContent:u,modifiedGetAppState:d,baseAgent:f,promptMessages:p}=await Se(e,t,n);H(`Executing forked slash command /${e.name} with agent ${f.agentType}`);let m=await n.getAppState(),g=n.options.allowBackgroundForkedSlashCommands===!0;g&&J();let v=!1;if(m.kairosEnabled&&g&&(v=!0),v){let t=ue(),r=N(e),a=Ve(),l=e=>i({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:a}),u=async()=>{if(!s?.runId)return;let e=await we({runId:s.runId,rootDir:s.rootDir,priority:`later`,workload:a});for(let t of e)de(t)},m=async e=>{s?.runId&&await O({runId:s.runId,rootDir:s.rootDir,error:e instanceof Error?e.message:String(e)})};return(async()=>{let i=Date.now()+$;for(;Date.now()<i&&n.getAppState().mcp.clients.some(e=>e.type===`pending`);)await Ue(Q);let a=n.options.refreshTools?.()??n.options.tools,s=[];for await(let r of P({agentDefinition:f,promptMessages:p,toolUseContext:{...n,getAppState:d,abortController:t},canUseTool:o,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:a,override:{agentId:c}}))s.push(r);let m=z(s,`Command completed`);H(`Background forked command /${r} completed (agent ${c})`),l(`<scheduled-task-result command="/${r}">\n${m}\n</scheduled-task-result>`);try{await u()}catch(e){W(e)}})().catch(async e=>{W(e),l(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await m(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!s?.runId}}let y=[],b=[],x=`forked-command-${e.name}`,C=0,w=e=>(C++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:u,agentId:c},parentToolUseID:x,toolUseID:`${x}-${C}`,timestamp:new Date().toISOString(),uuid:q()}),T=()=>{a({jsx:ie(b,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};T();try{for await(let t of P({agentDefinition:f,promptMessages:p,toolUseContext:{...n,getAppState:d},canUseTool:o,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){y.push(t);let e=he([t]);if(t.type===`assistant`){let r=_e(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(b.push(w(t)),T())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(b.push(w(t)),T())}}}finally{a(null)}let E=z(y,`Command completed`);return H(`Forked slash command /${e.name} completed with agent ${c}`),{messages:[_({content:F({inputString:`/${N(e)} ${t}`.trim(),precedingInputBlocks:r})}),_({content:`<local-command-stdout>\n${E}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:E}}function tt(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function nt(e,t,r,i,a,o,s,c,l,u){let d=Ze(e);if(!d){K(`tengu_input_slash_missing`,{});let e="Commands are in the form `/command [args]`";return{messages:[w(),...i,_({content:F({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:f,args:p,isMcp:m}=d,g=m?`mcp`:y().has(f)?f:`custom`;if(!R(f,a.options.commands)){let n=!1;try{await Me().stat(`/${f}`),n=!0}catch{}if(tt(f)&&!n){K(`tengu_input_slash_invalid`,{input:f});let e=`Unknown skill: ${f}`;return{messages:[w(),...i,_({content:F({inputString:e,precedingInputBlocks:t})}),...p?[T(`Args from unknown skill: ${p}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let r=q();return ke(r),K(`tengu_input_prompt`,{}),qe(`user_prompt`,{prompt_length:String(e.length),prompt:Ke(e),"prompt.id":r}),{messages:[_({content:F({inputString:e,precedingInputBlocks:t}),uuid:s}),...i],shouldQuery:!0}}let{messages:v,shouldQuery:b,allowedTools:x,model:S,command:E,resultText:D,nextInput:O,submitNextInput:k,deferAutonomyCompletion:A}=await rt(f,p,o,a,t,r,c,l,s,u);if(v.length===0){let e={input:g};if(E.type===`prompt`&&E.pluginInfo){let{pluginManifest:t,repository:n}=E.pluginInfo,{marketplace:r}=L(n),i=C(r);e._PROTO_plugin_name=t.name,r&&(e._PROTO_marketplace_name=r),e.plugin_repository=i?n:`third-party`,e.plugin_name=i?t.name:`third-party`,i&&t.version&&(e.plugin_version=t.version),Object.assign(e,h(E.pluginInfo))}return K(`tengu_input_command`,{...e,invocation_trigger:`user-slash`}),{messages:[],shouldQuery:!1,model:S,nextInput:O,submitNextInput:k,deferAutonomyCompletion:A}}if(v.length===2&&v[1].type===`user`&&typeof v[1].message.content==`string`&&v[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`)||K(`tengu_input_slash_invalid`,{input:f}),{messages:[w(),...v],shouldQuery:b,allowedTools:x,model:S};let j={input:g};if(E.type===`prompt`&&E.pluginInfo){let{pluginManifest:e,repository:t}=E.pluginInfo,{marketplace:n}=L(t),r=C(n);j._PROTO_plugin_name=e.name,n&&(j._PROTO_marketplace_name=n),j.plugin_repository=r?t:`third-party`,j.plugin_name=r?e.name:`third-party`,r&&e.version&&(j.plugin_version=e.version),Object.assign(j,h(E.pluginInfo))}K(`tengu_input_command`,{...j,invocation_trigger:`user-slash`});let M=v.length>0&&v[0]&&n(v[0]);return{messages:b||v.every(ye)||M?v:[w(),...v],shouldQuery:b,allowedTools:x,model:S,resultText:D,nextInput:O,submitNextInput:k,deferAutonomyCompletion:A}}async function rt(e,t,n,r,i,a,o,s,c,l){let u=g(e,r.options.commands);if(u.type===`prompt`&&u.userInvocable!==!1&&ee(e),u.userInvocable===!1)return{messages:[_({content:F({inputString:`/${e}`,precedingInputBlocks:i})}),_({content:`This skill can only be invoked by Claude, not directly by users. Ask Claude to use the "${e}" skill for you.`})],shouldQuery:!1,command:u};try{switch(u.type){case`local-jsx`:return new Promise(e=>{let a=!1,o=(n,r)=>{if(a=!0,r?.display===`skip`){e({messages:[],shouldQuery:!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput});return}let o=(r?.metaMessages??[]).map(e=>_({content:e,isMeta:!0})),s=se()&&typeof n==`string`&&n.endsWith(` dismissed`),c=r?.displayArgs??t;e({messages:r?.display===`system`?s?o:[I(Y(u,c)),I(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[_({content:F({inputString:Y(u,c),precedingInputBlocks:i})}),_(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${pe}</local-command-stdout>`}),...o],shouldQuery:r?.shouldQuery??!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput})};u.load().then(e=>e.call(o,{...r,canUseTool:s},t)).then(t=>{if(t!=null){if(r.options.isNonInteractiveSession){e({messages:[],shouldQuery:!1,command:u});return}a||n({jsx:t,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0,isImmediate:u.immediate===!0})}}).catch(t=>{W(t),!a&&(a=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:u}))})});case`local`:{let e=_({content:F({inputString:Y(u,u.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=w(),i=await(await u.load()).call(t,r);if(i.type===`skip`)return{messages:[],shouldQuery:!1,command:u};if(i.type===`compact`){let t=[n,e,...i.displayText?[_({content:`<local-command-stdout>${i.displayText}</local-command-stdout>`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],r={...i.compactionResult,messagesToKeep:[...i.compactionResult.messagesToKeep??[],...t]};return ce(),{messages:be(r),shouldQuery:!1,command:u}}return{messages:[e,I(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:u,resultText:i.value}}catch(t){return W(t),{messages:[e,I(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:u}}}case`prompt`:try{return u.context===`fork`?await et(u,t,r,i,n,s??j,l):await Z(u,t,r,i,a,c)}catch(e){return e instanceof je?{messages:[_({content:F({inputString:Y(u,t),precedingInputBlocks:i})}),d({toolUse:!1})],shouldQuery:!1,command:u}:{messages:[_({content:F({inputString:Y(u,t),precedingInputBlocks:i})}),_({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:u}}}}catch(e){if(e instanceof B)return{messages:[_({content:F({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:u};throw e}}function Y(e,t){return a(N(e),t)}function X(e,t=`loading`){return[`<${G}>${e}</${G}>`,`<${U}>${e}</${U}>`,`<skill-format>true</skill-format>`].join(`
|
|
2
|
+
`)}function it(e,t){return[`<${G}>${e}</${G}>`,`<${U}>/${e}</${U}>`,t?`<command-args>${t}</command-args>`:null].filter(Boolean).join(`
|
|
3
|
+
`)}function at(e,t){return e.userInvocable===!1&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)?X(e.name,e.progressMessage):it(e.name,t)}async function ot(e,t,n,r,i=[]){let a=s(e,n);if(!a)throw new B(`Unknown command: ${e}`);if(a.type!==`prompt`)throw Error(`Unexpected ${a.type} command. Expected 'prompt' command. Use /${e} directly in the main conversation.`);return Z(a,t,r,[],i)}async function Z(e,t,n,r=[],i=[],a){let o=await e.getPromptForCommand(t,n),s=!M(`hooks`)||re(e.source);if(e.hooks&&s){let t=Oe();Ye(n.setAppState,t,e.hooks,e.name,e.type===`prompt`?e.skillRoot:void 0)}let c=e.source?`${e.source}:${e.name}`:e.name,l=o.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
4
|
+
|
|
5
|
+
`);Ae(e.name,c,l,Ge()?.agentId??null);let u=at(e,t),d=le(e.allowedTools??[]),f=i.length>0||r.length>0?[...i,...r,...o]:o,p=await xe(Ee(o.filter(e=>e.type===`text`).map(e=>e.text).join(` `),n,null,[],n.messages,`repl_main_thread`,{skipSkillDiscovery:!0}));return{messages:[_({content:u,uuid:a}),_({content:f,isMeta:!0}),...p,D({type:`command_permissions`,allowedTools:d,model:e.model})],shouldQuery:!0,allowedTools:d,model:e.model,command:e}}var Q,$;e((()=>{De(),x(),ge(),Le(),ze(),ve(),fe(),Te(),b(),r(),We(),te(),V(),Pe(),l(),Ne(),t(),oe(),Xe(),Re(),v(),E(),c(),ne(),f(),m(),Qe(),Be(),o(),Je(),p(),me(),ae(),k(),He(),Q=200,$=1e4}))();export{X as formatSkillLoadingMetadata,ot as processPromptSlashCommand,nt as processSlashCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-BDhHQY0-.js";import{basename as r,join as i,resolve as a}from"path";import{existsSync as o,mkdirSync as s,readFileSync as c,realpathSync as l,writeFileSync as u}from"fs";import{createHash as d}from"crypto";import{execFileSync as f}from"child_process";function p(){return i(t(),`skill-learning`)}function m(){return i(p(),`projects.json`)}function h(e){return e===j?i(p(),`global`):i(p(),`projects`,e)}function g(e){return i(h(e),`project.json`)}function _(e,t){if(F.has(e)&&F.delete(e),F.set(e,t),F.size>N){let e=F.size-P,t=F.keys();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;F.delete(e.value)}}}function v(e=process.cwd()){let t=F.get(e);if(t){F.delete(e),F.set(e,t);let n=Date.now();return n-L>I&&(L=n,S(t)),t}let n=b(e);return _(e,n),S(n),L=Date.now(),n}function y(){let e=C(m());return Object.values(e.projects).sort((e,t)=>e.projectName.localeCompare(t.projectName))}function b(e){let t=process.env.CLAUDE_PROJECT_DIR?.trim();if(t){let n=E(t);return x({source:`claude_project_dir`,scope:`project`,cwd:e,projectRoot:n,identity:`claude-project-dir:${n}`,projectName:r(n)||`project`})}let n=T([`remote`,`get-url`,`origin`],e);if(n){let t=T([`rev-parse`,`--show-toplevel`],e),r=D(n);return x({source:`git_remote`,scope:`project`,cwd:e,projectRoot:E(t||e),gitRemote:r,identity:`git-remote:${r}`,projectName:O(r)})}let i=T([`rev-parse`,`--show-toplevel`],e);if(i){let t=E(i);return x({source:`git_root`,scope:`project`,cwd:e,projectRoot:t,identity:`git-root:${t}`,projectName:r(t)||`project`})}return x({source:`global`,scope:`global`,cwd:e,projectRoot:void 0,identity:`global`,projectName:M})}function x(e){let t=e.scope===`global`?j:k(e.identity);return{projectId:t,projectName:e.projectName,scope:e.scope,source:e.source,cwd:E(e.cwd),projectRoot:e.projectRoot,gitRemote:e.gitRemote,storageDir:h(t)}}function S(e){let t=new Date().toISOString(),n=m(),r=C(n),i=r.projects[e.projectId],a={...e,firstSeenAt:i?.firstSeenAt??t,lastSeenAt:t};r.projects[e.projectId]=a,r.updatedAt=t,s(e.storageDir,{recursive:!0}),s(p(),{recursive:!0}),w(n,r),w(g(e.projectId),a)}function C(e){if(!o(e))return{version:A,updatedAt:new Date(0).toISOString(),projects:{}};try{let t=JSON.parse(c(e,`utf8`));if(t.version===A&&typeof t.projects==`object`&&t.projects)return{version:A,updatedAt:typeof t.updatedAt==`string`?t.updatedAt:new Date(0).toISOString(),projects:t.projects}}catch{}return{version:A,updatedAt:new Date(0).toISOString(),projects:{}}}function w(e,t){u(e,`${JSON.stringify(t,null,2)}\n`,`utf8`)}function T(e,t){try{return f(`git`,[`-C`,t,...e],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim()||null}catch{return null}}function E(e){let t=a(e);try{return l.native(t).normalize(`NFC`)}catch{return t.normalize(`NFC`)}}function D(e){let t=e.trim().replace(/\\/g,`/`);return t=t.replace(/\.git$/i,``),t=t.replace(/\/+$/g,``),t.toLowerCase()}function O(e){return e.match(/[:/]([^/:]+?)(?:\.git)?$/)?.[1]||`project`}function k(e){return`project-${d(`sha256`).update(e).digest(`hex`).slice(0,16)}`}var A,j,M,N,P,F,I,L,R=e((()=>{n(),A=1,j=`global`,M=`Global`,N=32,P=24,F=new Map,I=300*1e3,L=0}));export{R as a,p as i,h as n,y as o,m as r,v as s,g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./projectContext-
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./projectContext-CIxul6vA.js";e();export{o as getProjectContextPath,n as getProjectStorageDir,i as getProjectsRegistryPath,t as getSkillLearningRootDir,r as listKnownProjects,a as resolveProjectContext};
|