@readmagic/workmate 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AddWorkspaceDirectory-DcVnvL_u.js → AddWorkspaceDirectory-DAtfMH4o.js} +1 -1
- package/dist/chunks/{AgentsMdExternalIncludesDialog-D6DopTxc.js → AgentsMdExternalIncludesDialog-BTYgjY5c.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-C6VH6JG6.js +1 -0
- package/dist/chunks/{App-BoI5EJry.js → App-HF0bvxi_.js} +1 -1
- package/dist/chunks/ApproveApiKey-B7mKgSqY.js +1 -0
- package/dist/chunks/{ApproveApiKey-BjlQDcMx.js → ApproveApiKey-BBFLw2B7.js} +1 -1
- package/dist/chunks/{BackgroundTasksDialog-ClSMkcGp.js → BackgroundTasksDialog-Coc0ecUd.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-KCZv-PXl.js → BypassPermissionsModeDialog--Gx9ARd4.js} +1 -1
- package/dist/chunks/{DiffDialog-BGBkuVIn.js → DiffDialog-tlINuFS1.js} +1 -1
- package/dist/chunks/Doctor-BJf49FWX.js +1 -0
- package/dist/chunks/{Doctor-CI04juFO.js → Doctor-Wh7z6CnF.js} +2 -2
- package/dist/chunks/ExitFlow-B1zHTqQt.js +2 -0
- package/dist/chunks/{Grove-B-M3DWD3.js → Grove-1Kf7xxIV.js} +1 -1
- package/dist/chunks/{HybridTransport-n5jji6SI.js → HybridTransport-DWqWUZCH.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-By-j6fHE.js → InvalidConfigDialog-OZPFQSnC.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-C_reeMzL.js → InvalidSettingsDialog-BNCm-eyC.js} +1 -1
- package/dist/chunks/MCPConnectionManager-7H84oi5n.js +1 -0
- package/dist/chunks/{MCPToolListView-jw0tITfc.js → MCPToolListView-CVgtg3Iq.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-BeZ3Bn8N.js → McpParsingWarnings-CN8f449l.js} +1 -1
- package/dist/chunks/{MessageSelector-Ci6N-gCw.js → MessageSelector-B9j6zZ5w.js} +1 -1
- package/dist/chunks/Messages-yz1m39eI.js +10 -0
- package/dist/chunks/{Onboarding-DDkVEq-G.js → Onboarding-bFbgae8m.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-BlhZuQ5F.js → PromptInputFooterSuggestions-CE_yVun1.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-TPWuGwAy.js +1 -0
- package/dist/chunks/QueryEngine-CRobcENE.js +1 -0
- package/dist/chunks/REPL-BhCC0JP6.js +1 -0
- package/dist/chunks/REPL-C33mMf_q.js +128 -0
- package/dist/chunks/{RemoteSessionManager-mWVrdNfS.js → RemoteSessionManager-BjVD918g.js} +2 -2
- package/dist/chunks/{ResumeConversation-BzTn_1jS.js → ResumeConversation-CXd8d8po.js} +1 -1
- package/dist/chunks/{SSETransport-D86IVNn1.js → SSETransport-BSilVN9e.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-DoiCI2uJ.js +1 -0
- package/dist/chunks/Settings-ClcLl0C1.js +2 -0
- package/dist/chunks/{TeleportProgress-CW8mLRy2.js → TeleportProgress-DonJUoPc.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-DZD32R-l.js → TeleportRepoMismatchDialog-ByOuSVVz.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-BhuUE1aq.js → TeleportResumeWrapper-BBtELwF1.js} +1 -1
- package/dist/chunks/{ThemePicker-ByQZgIbH.js → ThemePicker-1QQJFOEv.js} +1 -1
- package/dist/chunks/{TrustDialog-BzwibD_8.js → TrustDialog-DwJ9L_u4.js} +1 -1
- package/dist/chunks/{add-dir-BQ-ljgk6.js → add-dir-DOKdPFT2.js} +1 -1
- package/dist/chunks/{agentDisplay-tRprY4gB.js → agentDisplay-TX1bh-lX.js} +1 -1
- package/dist/chunks/{agents-Dq4BCf0H.js → agents-C58tRxpi.js} +1 -1
- package/dist/chunks/{agents-DMyQUXwl.js → agents-CbRjX9Pj.js} +6 -6
- package/dist/chunks/{allErrors-CQWZ6BPw.js → allErrors-DRiW7i6Y.js} +1 -1
- package/dist/chunks/api-C8uOHD-v.js +1 -0
- package/dist/chunks/{api-ClAyS7cQ.js → api-CazVavfB.js} +1 -1
- package/dist/chunks/auth-BL238vgr.js +1 -0
- package/dist/chunks/auth-CfrCl9BZ.js +10 -0
- package/dist/chunks/auth-D3GkU6d7.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-rzQFJiND.js → backgroundHousekeeping-CPLlaWcV.js} +2 -2
- package/dist/chunks/backgroundHousekeeping-Du2tN2WE.js +1 -0
- package/dist/chunks/{branch-BWbCrXBJ.js → branch-pAa0oBaj.js} +1 -1
- package/dist/chunks/{bridgeConfig-CPHAyzdg.js → bridgeConfig-DnFfCpGd.js} +1 -1
- package/dist/chunks/bridgeConfig-joBqeK0j.js +1 -0
- package/dist/chunks/{bridgeMessaging-vR7uQXB9.js → bridgeMessaging-B_hnuUHb.js} +1 -1
- package/dist/chunks/{bridgeStatusUtil-CHTx7XwJ.js → bridgeStatusUtil-Dwz4YHNA.js} +1 -1
- package/dist/chunks/{btw-IGcgP-Qq.js → btw-CkVkYeRr.js} +1 -1
- package/dist/chunks/{caches-FP8mGB4k.js → caches-BLQUkrIG.js} +1 -1
- package/dist/chunks/caches-DsFl83sh.js +1 -0
- package/dist/chunks/{ccrClient--8aPutWE.js → ccrClient-AfdUbWzY.js} +1 -1
- package/dist/chunks/{clear-CF-FZwpe.js → clear-Ac3qYi_-.js} +1 -1
- package/dist/chunks/client-BX0r6K3I.js +1 -0
- package/dist/chunks/client-Bb2eZnuq.js +1 -0
- package/dist/chunks/client-DNEVh6Wu.js +1 -0
- package/dist/chunks/client-Pap_HyZZ.js +1 -0
- package/dist/chunks/client-zhozU2ws.js +1 -0
- package/dist/chunks/commands-BKLsl6gK.js +1 -0
- package/dist/chunks/{compact-BrJGpEFZ.js → compact-CXuDr5qM.js} +1 -1
- package/dist/chunks/config-DrY1SvhQ.js +1 -0
- package/dist/chunks/{context-DADnwl4t.js → context-C2plOqH4.js} +1 -1
- package/dist/chunks/context-noninteractive-DpVlZ-wP.js +1 -0
- package/dist/chunks/{context-noninteractive-kACWzgS1.js → context-noninteractive-fVQtwEkw.js} +1 -1
- package/dist/chunks/conversation-C0yysXds.js +1 -0
- package/dist/chunks/{conversation-C8w1DtXk.js → conversation-DQpS6nvg.js} +1 -1
- package/dist/chunks/{createSSHSession-B71Plec6.js → createSSHSession-CfyFuJMH.js} +1 -1
- package/dist/chunks/createSession-CmBawnsh.js +1 -0
- package/dist/chunks/{createSession-BJeDECzt.js → createSession-qk9C66lK.js} +1 -1
- package/dist/chunks/{crossProjectResume-B1I6YzXr.js → crossProjectResume-DY1ZBO5P.js} +1 -1
- package/dist/chunks/{datadog-C9uqPA6N.js → datadog-Cr0VKbct.js} +1 -1
- package/dist/chunks/{diff-CzChvQyK.js → diff-BNjcCXDr.js} +1 -1
- package/dist/chunks/doctor-BkCtT7H1.js +1 -0
- package/dist/chunks/{entry-BoL8sy1Y.js → entry-o9IZPS4g.js} +2 -2
- package/dist/chunks/{esm-DtcV71xh.js → esm-BI3tFLyy.js} +1 -1
- package/dist/chunks/exit-Dlyj7nY8.js +1 -0
- package/dist/chunks/extraUsage-5Ueiyw6W.js +1 -0
- package/dist/chunks/extractMemories-DnTBWFOW.js +1 -0
- package/dist/chunks/fast-B3fRp1xO.js +1 -0
- package/dist/chunks/fast-ClOKONyD.js +1 -0
- package/dist/chunks/fetchModelList-B8KG79EK.js +1 -0
- package/dist/chunks/fetchModelList-gh_jFYai.js +1 -0
- package/dist/chunks/{fileSuggestions-DU7gmksK.js → fileSuggestions-DK7W8kLF.js} +1 -1
- package/dist/chunks/{firstPartyEventLogger-7pAyUdbp.js → firstPartyEventLogger-BMnXb9cv.js} +2 -2
- package/dist/chunks/firstPartyEventLogger-YYOb8aIo.js +1 -0
- package/dist/chunks/{flushGate-4DfYr-Ru.js → flushGate-n4kK6H1U.js} +1 -1
- package/dist/chunks/{gemini-Cll4fVQn.js → gemini-C8-QHnsC.js} +1 -1
- package/dist/chunks/{generateSessionName-BgGMwpps.js → generateSessionName-C8DnAVaa.js} +1 -1
- package/dist/chunks/{goal-D4E2WQVn.js → goal-DMmzlZOF.js} +1 -1
- package/dist/chunks/grok-LLjpAwP_.js +1 -0
- package/dist/chunks/{grove-Bck1zFaD.js → grove-CQBCzeHf.js} +1 -1
- package/dist/chunks/{help-DJp61Job.js → help-JH7WzjZP.js} +1 -1
- package/dist/chunks/hooks-COhKt_pF.js +1 -0
- package/dist/chunks/{hooks-CJ17byYD.js → hooks-DD2jpRfx.js} +1 -1
- package/dist/chunks/initReplBridge-BDaN0hpY.js +1 -0
- package/dist/chunks/{install-Dd5fw0cA.js → install-CD4or0vj.js} +1 -1
- package/dist/chunks/{instrumentation-jsPu6qqs.js → instrumentation-n-otwpYf.js} +4 -4
- package/dist/chunks/{job-BHhkQbvu.js → job-B-pEWgXI.js} +1 -1
- package/dist/chunks/keybindings-qed9q9tx.js +1 -0
- package/dist/chunks/{launchLocalMemory-DsaijVcO.js → launchLocalMemory-cBovdGMT.js} +1 -1
- package/dist/chunks/{launchOnboarding-DHOylaqn.js → launchOnboarding-B__wtt7p.js} +1 -1
- package/dist/chunks/{loadAgentsDir-CwEfQDOw.js → loadAgentsDir-PPiD2Mfq.js} +569 -569
- package/dist/chunks/loadAgentsDir-qvqrTVuS.js +1 -0
- package/dist/chunks/{loadPluginHooks-C-Yk5KlI.js → loadPluginHooks-DUCuU3_8.js} +1 -1
- package/dist/chunks/localSearch-CDk_stXJ.js +1 -0
- package/dist/chunks/{localSearch-BEnlgSB7.js → localSearch-Cvs9WfoX.js} +1 -1
- package/dist/chunks/{logoV2Utils-DG9GwFjl.js → logoV2Utils-Bkj74dtY.js} +1 -1
- package/dist/chunks/{magicDocs-qGHR3Cqh.js → magicDocs-3U6peChg.js} +2 -2
- package/dist/chunks/{main-CBVQ8bRm.js → main-DkjxhBIC.js} +26 -26
- package/dist/chunks/{managedEnv-3MbOWrVs.js → managedEnv-BUrzwaD3.js} +1 -1
- package/dist/chunks/managedEnv-XOUMOtEF.js +1 -0
- package/dist/chunks/{mappers-CdY45PDA.js → mappers-ZGgwqDOK.js} +1 -1
- package/dist/chunks/{mcp-DvY_FibT.js → mcp-COZxwgJZ.js} +3 -3
- package/dist/chunks/{mcp-DI8pGrqi.js → mcp-CdyNeNzh.js} +1 -1
- package/dist/chunks/{mcp-BA8XQ6h1.js → mcp-CysOyBIn.js} +1 -1
- package/dist/chunks/{memory-C2U7CCmM.js → memory-B5h2TTSS.js} +1 -1
- package/dist/chunks/{mode-ByV6NqmB.js → mode-D3yY1fdK.js} +1 -1
- package/dist/chunks/model-Bz4JHoU0.js +1 -0
- package/dist/chunks/model-g6XBcNAG.js +1 -0
- package/dist/chunks/{model-CeG-iOKF.js → model-sviY1inu.js} +1 -1
- package/dist/chunks/modelOptions-DYQqTLPi.js +1 -0
- package/dist/chunks/{nativeInstaller-CXFD8LDV.js → nativeInstaller-N1xiUpCP.js} +1 -1
- package/dist/chunks/{omit-B65XeX8r.js → omit-BOILu8jW.js} +1 -1
- package/dist/chunks/{onChangeAppState-EtUxsgYz.js → onChangeAppState-COFFZAXb.js} +1 -1
- package/dist/chunks/{openai-Dx5mvMjY.js → openai-BHM5kEFo.js} +2 -2
- package/dist/chunks/openai-CR3CcjCE.js +17 -0
- package/dist/chunks/{partition-8vZDG3rY.js → partition-C1SFDk_L.js} +1 -1
- package/dist/chunks/{permissions-CJUBfBTr.js → permissions-uy_NFbfy.js} +2 -2
- package/dist/chunks/{pidLock-tjm2n1Nd.js → pidLock-DuMVSwnN.js} +2 -2
- package/dist/chunks/{plan-eFur8bdH.js → plan-DF9YSB5M.js} +1 -1
- package/dist/chunks/{plugin-fYLRLdOY.js → plugin-GRPzqgTr.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-B4w7SSYc.js → pluginAutoupdate-AMD-FvKB.js} +1 -1
- package/dist/chunks/{pluginBlocklist-CMwb7gmY.js → pluginBlocklist-DNxkAxH6.js} +1 -1
- package/dist/chunks/{pluginCliCommands-3YCj7Y3Q.js → pluginCliCommands-BFoR1ZXx.js} +1 -1
- package/dist/chunks/{pluginFlagging-srvq9H7p.js → pluginFlagging-CW2IZWSI.js} +1 -1
- package/dist/chunks/{pluginOperations-C7BCR7pw.js → pluginOperations-DlWE0idP.js} +1 -1
- package/dist/chunks/{pluginStartupCheck-BLc0U7W7.js → pluginStartupCheck-AQGV0DCS.js} +1 -1
- package/dist/chunks/pluginStartupCheck-DWpquqxx.js +1 -0
- package/dist/chunks/{plugins-CPtmmDDi.js → plugins-CwUSTE4E.js} +1 -1
- package/dist/chunks/print-9wR_ijrL.js +14 -0
- package/dist/chunks/{processBashCommand-C9-FonuX.js → processBashCommand-Deqwq1IE.js} +1 -1
- package/dist/chunks/{processSlashCommand-Bi8_1MRC.js → processSlashCommand-U9LJ4Keq.js} +2 -2
- package/dist/chunks/prompt-BBeDQXIs.js +1 -0
- package/dist/chunks/{prompt-Bm2EEG4F.js → prompt-CQmEvnKN.js} +1 -1
- package/dist/chunks/prompt-CXhdqgB7.js +1 -0
- package/dist/chunks/{promptEditor-DQ9fpdQD.js → promptEditor-Bf72KNF-.js} +1 -1
- package/dist/chunks/{reconciler-DgQ4y1Vn.js → reconciler-Css9bs07.js} +1 -1
- package/dist/chunks/{refresh-CayVRWUY.js → refresh-B87z39Zs.js} +1 -1
- package/dist/chunks/{reload-plugins-6xcH3dLg.js → reload-plugins-BpmUIkfm.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-BnZYGaMH.js → remoteBridgeCore-BCLIIygk.js} +1 -1
- package/dist/chunks/{remoteManagedSettings-CfFmrRze.js → remoteManagedSettings-Ahgn2e80.js} +1 -1
- package/dist/chunks/{rename-mDtCTbnD.js → rename-BUt3PliQ.js} +1 -1
- package/dist/chunks/{resume-DRvz4QFs.js → resume-uZI9p_FE.js} +1 -1
- package/dist/chunks/{runtimeObserver-Ba6SM-sI.js → runtimeObserver-AKOWfdZ_.js} +1 -1
- package/dist/chunks/{runtimeObserver-Dt5sGJVb.js → runtimeObserver-By59MZKJ.js} +2 -2
- package/dist/chunks/sandbox-adapter-D4Uho1vF.js +1 -0
- package/dist/chunks/{sandbox-toggle-DKcw3SbO.js → sandbox-toggle-BdvylnWS.js} +1 -1
- package/dist/chunks/searchExtraTools-BHMkqGBf.js +1 -0
- package/dist/chunks/{session-COVyD8UU.js → session-Tm2-rzBY.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-BaWZ8sqn.js +1 -0
- package/dist/chunks/{sessionObserver-iAgSetlC.js → sessionObserver-BAr8AWeL.js} +1 -1
- package/dist/chunks/sessionObserver-KB1UL_n2.js +1 -0
- package/dist/chunks/{sessionState-zhvcDpb2.js → sessionState-BTFowSpR.js} +2 -2
- package/dist/chunks/sessionStorage-D6nlmaI-.js +1 -0
- package/dist/chunks/{sessionTitle-QPRly1tZ.js → sessionTitle-SCqmSDYM.js} +1 -1
- package/dist/chunks/{sessionTracing-C4uqAdud.js → sessionTracing-CvY4udYI.js} +1 -1
- package/dist/chunks/{settingsSync-BGo6dHJo.js → settingsSync-nxeaGM2-.js} +1 -1
- package/dist/chunks/setup-D4FPeBnM.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-CzRAzcC1.js → shadowedRuleDetection-Co8m1q1D.js} +1 -1
- package/dist/chunks/{sideQuestion-oIYrx5ar.js → sideQuestion-4TJYn-Az.js} +1 -1
- package/dist/chunks/{sinks-Bje3hCkR.js → sinks-Bb2i50kz.js} +1 -1
- package/dist/chunks/sinks-D1opmy_x.js +1 -0
- package/dist/chunks/skillChangeDetector-BU9AFG0i.js +1 -0
- package/dist/chunks/{skillGapStore-CJjt3IW7.js → skillGapStore-BcVP3ZUb.js} +2 -2
- package/dist/chunks/{skillLifecycle-BsgH84vl.js → skillLifecycle-CG2XmS8f.js} +2 -2
- package/dist/chunks/{skillSearchPanel-CneXymsb.js → skillSearchPanel-DOJmUBXB.js} +4 -4
- package/dist/chunks/{skills-DZRBy7vT.js → skills-DIgCWvzX.js} +1 -1
- package/dist/chunks/{status-BP_R8051.js → status-Ber2xOXc.js} +2 -2
- package/dist/chunks/status-CVcXPoOZ.js +1 -0
- package/dist/chunks/{statusNoticeHelpers-ODrnrLAZ.js → statusNoticeHelpers-CYkrPUpN.js} +1 -1
- package/dist/chunks/{switcher-BkGOeIzI.js → switcher-BIP3rbQn.js} +1 -1
- package/dist/chunks/switcher-zbG6T9dN.js +1 -0
- package/dist/chunks/syncCache-AMQMQ_HR.js +1 -0
- package/dist/chunks/{tasks-CIUuwrX4.js → tasks-BKERIO4G.js} +1 -1
- package/dist/chunks/{teleport-IzyDplC7.js → teleport-DOXbf2sQ.js} +1 -1
- package/dist/chunks/{templateJobs-De57J461.js → templateJobs-dg2F45ZJ.js} +1 -1
- package/dist/chunks/{theme-Nwii7354.js → theme-BGxytGjA.js} +1 -1
- package/dist/chunks/{toolEventObserver-Cq-uBb0-.js → toolEventObserver-CJhg_p3P.js} +1 -1
- package/dist/chunks/toolPool-C0d7Bznl.js +1 -0
- package/dist/chunks/{trustedDevice-DWZxDUxS.js → trustedDevice-BtXHXu-T.js} +1 -1
- package/dist/chunks/trustedDevice-hw3iq84W.js +1 -0
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-D48aDPG9.js → useExitOnCtrlCDWithKeybindings-C9orgrub.js} +1 -1
- package/dist/chunks/useMainLoopModel-BigVcn2T.js +1 -0
- package/dist/chunks/{useManagePlugins-EqoQELMT.js → useManagePlugins-Bt-DYAnX.js} +1 -1
- package/dist/chunks/{useMergedTools-BJ4L9QSK.js → useMergedTools-CZeQBdky.js} +1 -1
- package/dist/chunks/{useSearchInput-DkVER3cm.js → useSearchInput-DdKrVHJS.js} +1 -1
- package/dist/chunks/{useSettingsErrors-D3MlQ1GF.js → useSettingsErrors-BR9Wws7D.js} +1 -1
- package/dist/chunks/{userAgent-aoe_xVAb.js → userAgent-DUt0q-Vl.js} +1 -1
- package/dist/chunks/{util-g-5UX5gH.js → util-h-Hmdke_.js} +1 -1
- package/dist/chunks/{validatePlugin-CSE8zjZn.js → validatePlugin-mWVKNtJa.js} +1 -1
- package/dist/chunks/{workerRegistry-DGwy0YHB.js → workerRegistry-dlfqtySm.js} +2 -2
- package/dist/chunks/worktree-IxcFe7g-.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-0Qdg3Rh7.js +0 -1
- package/dist/chunks/ApproveApiKey-PWFcscjY.js +0 -1
- package/dist/chunks/Doctor-DCrqcW68.js +0 -1
- package/dist/chunks/ExitFlow-qrCDVA9i.js +0 -2
- package/dist/chunks/MCPConnectionManager-BNG7iSlw.js +0 -1
- package/dist/chunks/Messages-D6CRTH2m.js +0 -10
- package/dist/chunks/PromptInputHelpMenu-kKyPIMau.js +0 -1
- package/dist/chunks/QueryEngine-DXpS0Ytq.js +0 -1
- package/dist/chunks/REPL-D1BCm7cR.js +0 -128
- package/dist/chunks/REPL-JQgCrSEv.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-BXIja1MR.js +0 -1
- package/dist/chunks/Settings-D_i8HzEW.js +0 -2
- package/dist/chunks/api-CpD5jeKe.js +0 -1
- package/dist/chunks/auth-CWAvPfX7.js +0 -10
- package/dist/chunks/auth-DG5bkWDc.js +0 -1
- package/dist/chunks/auth-DuHfQBuH.js +0 -1
- package/dist/chunks/backgroundHousekeeping-kf_v7Vfr.js +0 -1
- package/dist/chunks/bridgeConfig-CABsoOum.js +0 -1
- package/dist/chunks/caches-Dj1YhqrG.js +0 -1
- package/dist/chunks/client-B7WkO81L.js +0 -17
- package/dist/chunks/client-BCzhAEd0.js +0 -1
- package/dist/chunks/client-BU7upHOb.js +0 -1
- package/dist/chunks/commands-Cr1p7OPH.js +0 -1
- package/dist/chunks/config-BohF3_IV.js +0 -1
- package/dist/chunks/context-noninteractive-BAbzwNxu.js +0 -1
- package/dist/chunks/conversation-Ds7zRD0x.js +0 -1
- package/dist/chunks/createSession-Bozo4Bu8.js +0 -1
- package/dist/chunks/doctor-DdvdGkNX.js +0 -1
- package/dist/chunks/exit-Af27f74w.js +0 -1
- package/dist/chunks/extraUsage-DsFwXMAj.js +0 -1
- package/dist/chunks/extractMemories-B1KbTMY0.js +0 -1
- package/dist/chunks/fast-BGU8p2uY.js +0 -1
- package/dist/chunks/fast-CuUjONVV.js +0 -1
- package/dist/chunks/firstPartyEventLogger-sMeCTEUW.js +0 -1
- package/dist/chunks/grok-HF1PHxXb.js +0 -1
- package/dist/chunks/hooks-CjR3Eq0Z.js +0 -1
- package/dist/chunks/initReplBridge-D09JEKHt.js +0 -1
- package/dist/chunks/keybindings-Ch5lzNB8.js +0 -1
- package/dist/chunks/loadAgentsDir-8FioUEwX.js +0 -1
- package/dist/chunks/localSearch-LcgRjjl3.js +0 -1
- package/dist/chunks/managedEnv-B4YV3A_y.js +0 -1
- package/dist/chunks/model-C73ETGu9.js +0 -1
- package/dist/chunks/model-CVG_RRTy.js +0 -1
- package/dist/chunks/modelOptions-A5jrCUBp.js +0 -1
- package/dist/chunks/pluginStartupCheck-nzVDPI1k.js +0 -1
- package/dist/chunks/print-BCud0ukQ.js +0 -14
- package/dist/chunks/prompt-CX_v9F3s.js +0 -1
- package/dist/chunks/prompt-V0WQJrkO2.js +0 -1
- package/dist/chunks/sandbox-adapter-Cmrd6tBj.js +0 -1
- package/dist/chunks/searchExtraTools-DIgC0CFB.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-yAPDTrbm.js +0 -1
- package/dist/chunks/sessionObserver-BizdPx8P.js +0 -1
- package/dist/chunks/sessionStorage-LMY409Ji.js +0 -1
- package/dist/chunks/setup-Bjw5VS6x.js +0 -3
- package/dist/chunks/sinks-FaljTZ-c.js +0 -1
- package/dist/chunks/skillChangeDetector-v6mAYzXX.js +0 -1
- package/dist/chunks/status-CZYD3NGb.js +0 -1
- package/dist/chunks/switcher-DwKN9daN.js +0 -1
- package/dist/chunks/syncCache-CpmpvjfC.js +0 -1
- package/dist/chunks/toolPool-BBU4ll_p.js +0 -1
- package/dist/chunks/trustedDevice-BKzkA7fq.js +0 -1
- package/dist/chunks/useMainLoopModel-89eUU13X.js +0 -1
- package/dist/chunks/worktree-jjuORs7p.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DcaKZlRU.js";import{Di as r,Li as i,cm as a,lm as o}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DcaKZlRU.js";import{Di as r,Li as i,cm as a,lm as o}from"./loadAgentsDir-PPiD2Mfq.js";import{n as s,t as c}from"./featureCheck-D6FjD-nt.js";import{a as l,s as u}from"./projectContext-BN2ZWzOG.js";import{a as d,c as ee,i as f,l as p,n as m,o as h,r as te,s as ne,u as g}from"./instinctParser-Dt-lqnDe.js";import{a as re,i as ie,n as _,o as v,r as y,t as ae}from"./observationStore-D0rm3GhP.js";import{a as oe,i as se,o as ce,r as le}from"./sessionObserver-BAr8AWeL.js";import{a as ue,d as b,i as de,l as x,n as S,r as fe,s as C,t as pe,u as w}from"./skillLifecycle-CG2XmS8f.js";import{join as T}from"node:path";import{existsSync as E}from"node:fs";import{randomBytes as me}from"node:crypto";import{mkdir as D,readFile as he,readdir as O,rename as ge,unlink as _e,writeFile as k}from"node:fs/promises";function A(e){let t=_(e),n=e?.project;return(e?.scope??n?.scope??`project`)===`global`||!n||n.projectId===`global`?T(t,`global`,`instincts`,`personal`):T(t,`projects`,n.projectId,`instincts`,`personal`)}async function j(e,t){let n=h(e);await D(A(t),{recursive:!0});let r=N(n.id,t),i=`${r}.${me(6).toString(`hex`)}.tmp`;return await k(i,ee(n)),await ge(i,r),n}async function M(e){let t=A(e),n=[];try{n=await O(t)}catch(e){if(e.code===`ENOENT`)return[];throw e}let r=[];for(let e of n.filter(e=>e.endsWith(`.json`))){let n=await he(T(t,e),`utf8`);r.push(ne(n))}return r.sort((e,t)=>e.id.localeCompare(t.id))}function ve(e,t){let n=P.then(()=>ye(e,t));return P=n.catch(()=>{}),n}async function ye(e,t){let n=await M(t),r=n.find(t=>t.id===e.id)??n.find(t=>t.trigger.toLowerCase()===e.trigger.toLowerCase()&&d(t,e)),i=new Date().toISOString();if(!r)return j(e,t);let a=d(r,e),o=a?-.1:Se(e.evidenceOutcome),s=m(r.confidence+o),c=be(r.status,s,a);return j(h({...r,confidence:s,evidence:[...r.evidence,...e.evidence],evidenceOutcome:e.evidenceOutcome??r.evidenceOutcome,observationIds:[...r.observationIds??[],...e.observationIds??[]],updatedAt:i,status:c}),t)}function be(e,t,n){return n&&t<.3?`conflict-hold`:e===`conflict-hold`&&t>=.5||e===`pending`&&t>=.8?`active`:e}async function xe(e){let t=await M(e),n=Date.now(),r=0;for(let i of t){if(i.status!==`pending`&&i.status!==`active`)continue;let t=Date.parse(i.updatedAt);if(Number.isNaN(t))continue;let a=Math.floor((n-t)/F);if(a<1)continue;let o=-.02*a,s=m(i.confidence+o);s!==i.confidence&&(await j(h({...i,confidence:s,updatedAt:new Date(n).toISOString()}),e),r+=1)}return r}function Se(e){return e===`failure`?-.05:.05}async function Ce(e,t){let n=await M(t),r=Date.now()-e*24*60*60*1e3,i=[];for(let e of n)e.status===`pending`&&Date.parse(e.updatedAt)<r&&(await _e(N(e.id,t)),i.push(e));return i}function N(e,t){return T(A(t),`${e}.json`)}var P,F,I=e((()=>{y(),f(),P=Promise.resolve(),F=10080*60*1e3}));function we(e,t){if(e.length===0)throw Error(`Cannot generate a command draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=w(t?.name??De(e)),i=Ae(e),a=t?.description??Oe(e),o=Ee(r,n,t),s=ke({name:r,description:a,confidence:i,instincts:e});return{name:r,description:a,scope:n,sourceInstinctIds:e.map(e=>e.id),confidence:Number(i.toFixed(2)),content:s,outputPath:o}}async function Te(e){await D(e.outputPath,{recursive:!0});let t=T(e.outputPath,`${e.name}.md`);return E(t)?t:(await k(t,e.content,`utf8`),r(),t)}function Ee(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?T(r?.cwd??process.cwd(),`.workmate`,`commands`):r?.globalCommandsDir??T(t(),`commands`)}function De(e){return w([`learned`,...je(e,4)].join(`-`))||`learned-command`}function Oe(e){return(e[0]?.trigger??`Reuse the learned workflow`).replace(/\s+/g,` `).slice(0,120)}function ke(e){let{name:t,description:n,confidence:r,instincts:i}=e;return[`---`,`name: ${t}`,`description: ${JSON.stringify(n)}`,`origin: skill-learning`,`confidence: ${Number(r.toFixed(2))}`,`evolved_from: [${i.map(e=>JSON.stringify(e.id)).join(`, `)}]`,`---`,``,`# /${t}`,``,`## When to use`,``,i.map(e=>`- ${e.trigger}`).join(`
|
|
2
2
|
`),``,`## Steps`,``,i.map(e=>`- ${e.action}`).join(`
|
|
3
3
|
`),``,`## Evidence`,``,i.flatMap(e=>e.evidence.map(e=>`- ${e}`)).join(`
|
|
4
4
|
`),``].join(`
|
|
@@ -6,5 +6,5 @@ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./e
|
|
|
6
6
|
`),``,`## Playbook`,``,i.map(e=>`- ${e.action}`).join(`
|
|
7
7
|
`),``,`## Evidence`,``,i.flatMap(e=>e.evidence.map(e=>`- ${e}`)).slice(0,20).join(`
|
|
8
8
|
`),``].join(`
|
|
9
|
-
`)}function Re(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function ze(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`debug`,`investigate`,`research`]),r=[];for(let i of e)for(let e of`${i.trigger} ${i.action}`.toLowerCase().split(/[^a-z0-9]+/))if(e.length>2&&!n.has(e)&&!r.includes(e)&&r.push(e),r.length>=t)return r;return r}var R=e((()=>{n(),i(),x()}));function z(e){let t=new Map;for(let n of e){if(n.status!==`active`&&n.status!==`pending`)continue;let e=`${n.domain}:${Ue(n.trigger)}`,r=t.get(e)??[];r.push(n),t.set(e,r)}return Array.from(t.values()).filter(e=>e.length>=p().minClusterSize).map(e=>{let t=e.reduce((e,t)=>e+t.confidence,0)/e.length;return{target:Be(e),trigger:e[0]?.trigger??`learned pattern`,domain:e[0]?.domain??`project`,instincts:e,averageConfidence:Number(t.toFixed(2))}}).sort((e,t)=>t.averageConfidence-e.averageConfidence)}function Be(e){let t=Array.isArray(e)?e:e.instincts,n=t.map(e=>`${e.trigger} ${e.action}`).join(` `).toLowerCase();return/user asks|explicitly request|command|run /.test(n)?`command`:t.length>=4&&/(debug|investigate|research|multi-step)/.test(n)?`agent`:`skill`}function Ve(e,t){return z(e).filter(e=>e.target===`command`&&b(e.instincts)).map(e=>we(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function He(e,t){return z(e).filter(e=>e.target===`agent`&&b(e.instincts)).map(e=>Me(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function Ue(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,` `).split(/\s+/).filter(Boolean).slice(0,6).join(` `)}var We=e((()=>{x(),C(),L(),R(),g()}));function Ge(e){if(H.add(e),H.size>B){let e=H.size-V,t=H.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;H.delete(e.value)}}}function Ke(e,t=2,n=.8){let r=new Map;for(let t of e){if(t.scope!==`project`)continue;let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}return Array.from(r.entries()).flatMap(([e,r])=>{let i=Array.from(new Set(r.map(e=>e.projectId).filter(Boolean))),a=r.reduce((e,t)=>e+t.confidence,0)/r.length;return i.length>=t&&a>=n?[{instinctId:e,projectIds:i,averageConfidence:Number(a.toFixed(2))}]:[]})}async function qe(e={}){let t=e.minProjects??2,n=e.minConfidence??.8,r=await Je(e.rootDir),i=Ke(r,t,n),a=[];for(let t of i){if(H.has(t.instinctId))continue;let n=r.find(e=>e.id===t.instinctId);n&&(await j({...n,scope:`global`,projectId:void 0,projectName:void 0,confidence:t.averageConfidence,updatedAt:new Date().toISOString()},{rootDir:e.rootDir,scope:`global`,project:Ye(e.rootDir)}),Ge(t.instinctId),a.push(t))}return a}async function Je(e){let t=T(_(e?{rootDir:e}:void 0),`projects`);if(!E(t))return[];let n=await O(t,{withFileTypes:!0}),r=[];for(let i of n){if(!i.isDirectory())continue;let n=await M({rootDir:e,project:{projectId:i.name,projectName:i.name,scope:`project`,source:`git_root`,cwd:t,storageDir:T(t,i.name)},scope:`project`});r.push(...n)}return r}function Ye(e){let t=_(e?{rootDir:e}:void 0);return{projectId:`global`,projectName:`Global`,scope:`global`,source:`global`,cwd:t,storageDir:T(t,`global`)}}var B,V,H,Xe=e((()=>{I(),y(),B=256,V=192,H=new Set}));function U(){X=0,Z=0,Q.clear()}function Ze(){return J}function Qe(){if(!q){q=!0;try{ce()}catch{}o(W),$e().catch(()=>{})}}async function $e(){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE)return;let e={project:u(process.cwd())};await Promise.allSettled([xe(e),ie(e),Ce(30,e)])}function et(e){try{let t=_();return e.startsWith(t)}catch{return!1}}async function W(e){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE||!e.querySource?.startsWith(`repl_main_thread`)||e.toolUseContext.agentId)return;let t=process.cwd();if(et(t))return;let n=u(t),r={project:n};++J;let i=[];for(let t of rt(e.messages,n))i.push(await ae(t,r));let a=(await re(r)).filter(e=>e.source===`tool-hook`&&e.sessionId===`runtime-session`&&typeof e.timestamp==`string`&&e.timestamp>Y);i.push(...a);for(let e of a)e.timestamp>Y&&(Y=e.timestamp);if(i.length===0)return;let o=Date.now(),{llm:c}=p(),l=i.length>=5&&X<c.maxCallsPerSession&&o-Z>=c.cooldownMs,d;if(l)X++,Z=o,d=await se(i,{project:n});else{let{heuristicObserverBackend:e}=await import(`./sessionObserver-
|
|
9
|
+
`)}function Re(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function ze(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`debug`,`investigate`,`research`]),r=[];for(let i of e)for(let e of`${i.trigger} ${i.action}`.toLowerCase().split(/[^a-z0-9]+/))if(e.length>2&&!n.has(e)&&!r.includes(e)&&r.push(e),r.length>=t)return r;return r}var R=e((()=>{n(),i(),x()}));function z(e){let t=new Map;for(let n of e){if(n.status!==`active`&&n.status!==`pending`)continue;let e=`${n.domain}:${Ue(n.trigger)}`,r=t.get(e)??[];r.push(n),t.set(e,r)}return Array.from(t.values()).filter(e=>e.length>=p().minClusterSize).map(e=>{let t=e.reduce((e,t)=>e+t.confidence,0)/e.length;return{target:Be(e),trigger:e[0]?.trigger??`learned pattern`,domain:e[0]?.domain??`project`,instincts:e,averageConfidence:Number(t.toFixed(2))}}).sort((e,t)=>t.averageConfidence-e.averageConfidence)}function Be(e){let t=Array.isArray(e)?e:e.instincts,n=t.map(e=>`${e.trigger} ${e.action}`).join(` `).toLowerCase();return/user asks|explicitly request|command|run /.test(n)?`command`:t.length>=4&&/(debug|investigate|research|multi-step)/.test(n)?`agent`:`skill`}function Ve(e,t){return z(e).filter(e=>e.target===`command`&&b(e.instincts)).map(e=>we(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function He(e,t){return z(e).filter(e=>e.target===`agent`&&b(e.instincts)).map(e=>Me(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function Ue(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,` `).split(/\s+/).filter(Boolean).slice(0,6).join(` `)}var We=e((()=>{x(),C(),L(),R(),g()}));function Ge(e){if(H.add(e),H.size>B){let e=H.size-V,t=H.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;H.delete(e.value)}}}function Ke(e,t=2,n=.8){let r=new Map;for(let t of e){if(t.scope!==`project`)continue;let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}return Array.from(r.entries()).flatMap(([e,r])=>{let i=Array.from(new Set(r.map(e=>e.projectId).filter(Boolean))),a=r.reduce((e,t)=>e+t.confidence,0)/r.length;return i.length>=t&&a>=n?[{instinctId:e,projectIds:i,averageConfidence:Number(a.toFixed(2))}]:[]})}async function qe(e={}){let t=e.minProjects??2,n=e.minConfidence??.8,r=await Je(e.rootDir),i=Ke(r,t,n),a=[];for(let t of i){if(H.has(t.instinctId))continue;let n=r.find(e=>e.id===t.instinctId);n&&(await j({...n,scope:`global`,projectId:void 0,projectName:void 0,confidence:t.averageConfidence,updatedAt:new Date().toISOString()},{rootDir:e.rootDir,scope:`global`,project:Ye(e.rootDir)}),Ge(t.instinctId),a.push(t))}return a}async function Je(e){let t=T(_(e?{rootDir:e}:void 0),`projects`);if(!E(t))return[];let n=await O(t,{withFileTypes:!0}),r=[];for(let i of n){if(!i.isDirectory())continue;let n=await M({rootDir:e,project:{projectId:i.name,projectName:i.name,scope:`project`,source:`git_root`,cwd:t,storageDir:T(t,i.name)},scope:`project`});r.push(...n)}return r}function Ye(e){let t=_(e?{rootDir:e}:void 0);return{projectId:`global`,projectName:`Global`,scope:`global`,source:`global`,cwd:t,storageDir:T(t,`global`)}}var B,V,H,Xe=e((()=>{I(),y(),B=256,V=192,H=new Set}));function U(){X=0,Z=0,Q.clear()}function Ze(){return J}function Qe(){if(!q){q=!0;try{ce()}catch{}o(W),$e().catch(()=>{})}}async function $e(){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE)return;let e={project:u(process.cwd())};await Promise.allSettled([xe(e),ie(e),Ce(30,e)])}function et(e){try{let t=_();return e.startsWith(t)}catch{return!1}}async function W(e){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE||!e.querySource?.startsWith(`repl_main_thread`)||e.toolUseContext.agentId)return;let t=process.cwd();if(et(t))return;let n=u(t),r={project:n};++J;let i=[];for(let t of rt(e.messages,n))i.push(await ae(t,r));let a=(await re(r)).filter(e=>e.source===`tool-hook`&&e.sessionId===`runtime-session`&&typeof e.timestamp==`string`&&e.timestamp>Y);i.push(...a);for(let e of a)e.timestamp>Y&&(Y=e.timestamp);if(i.length===0)return;let o=Date.now(),{llm:c}=p(),l=i.length>=5&&X<c.maxCallsPerSession&&o-Z>=c.cooldownMs,d;if(l)X++,Z=o,d=await se(i,{project:n});else{let{heuristicObserverBackend:e}=await import(`./sessionObserver-KB1UL_n2.js`),t=e.analyze(i,{project:n});d=Array.isArray(t)?t:await t}for(let e of d)await ve(te(e),r);await nt(r)}function tt(){J=0,Y=``,U()}async function nt(e){let n=await M(e),r=process.cwd(),i=[T(r,`.workmate`,`skills`),T(t(),`skills`)],a=z(n).filter(e=>e.target===`skill`&&b(e.instincts));for(let e of a){let t=await ue(e.instincts,{cwd:r,scope:e.instincts[0]?.scope??`project`},i);if(t.action===`append-evidence`)continue;let n=t.draft;E(T(n.outputPath,`SKILL.md`))||await pe(fe(n,await S(`skill`,n,i)))}let o=Ve(n,{cwd:r});for(let e of o)(await S(`command`,e,[T(r,`.workmate`,`commands`),T(t(),`commands`)])).length>0||await Te(e);let s=He(n,{cwd:r});for(let e of s)(await S(`agent`,e,[T(r,`.workmate`,`agents`),T(t(),`agents`)])).length>0||await Ne(e);await qe()}function rt(e,t){let n=K,r={sessionId:n,projectId:t.projectId,projectName:t.projectName,cwd:t.cwd,timestamp:new Date().toISOString(),source:`hook`};return e.flatMap(e=>{let t=`${n}:${String(e.uuid)}`;if(Q.has(t))return[];if(Q.add(t),Q.size>$){let e=Q.size-ot,t=Q.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;Q.delete(e.value)}}if(e.type===`user`){let t=at(e.message?.content);if(t.length>0)return t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_complete`,toolName:e.toolName,toolOutput:e.output,outcome:e.isError?`failure`:`success`}));let n=G(e.message?.content);return n.trim()?[{...r,id:crypto.randomUUID(),event:`user_message`,messageText:n}]:[]}if(e.type===`assistant`){let t=it(e.message?.content),n=G(e.message?.content);return[...t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_start`,toolName:e.toolName,toolInput:e.input})),...n.trim()?[{...r,id:crypto.randomUUID(),event:`assistant_message`,messageText:n}]:[]]}return[]})}function G(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
|
|
10
10
|
`):``}function it(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_use`?[{toolName:String(t.name??`unknown_tool`),input:v(t.input)}]:[]}):[]}function at(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_result`?[{toolName:String(t.name??t.tool_name??`unknown_tool`),output:v(t.content),isError:t.is_error===!0}]:[]}):[]}var K,q,J,Y,X,Z,Q,$,ot,st=e((()=>{a(),g(),c(),y(),l(),le(),f(),oe(),I(),de(),We(),C(),x(),L(),R(),Xe(),n(),K=`runtime-session`,q=!1,J=0,Y=``,X=0,Z=0,Q=new Set,$=1e3,ot=500}));export{U as a,st as i,Ze as n,tt as o,Qe as r,W as s,K as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{oT as e,rT as t}from"./loadAgentsDir-PPiD2Mfq.js";e();export{t as SandboxManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$u as t,Qu as n,aT as r,cT as i,dT as a,hC as o,oT as s}from"./loadAgentsDir-CwEfQDOw.js";import{Gt as c,H as l,I as u,Lt as d,P as f,a as p,j as m,n as h,r as g,t as _,x as v}from"./src-DL3w8VPk2.js";import{t as y}from"./jsx-runtime-Bb4Xn-E0.js";import{O as b,Wt as x}from"./state-BPFYBqm1.js";import{f as S,g as C,s as w}from"./settings-CvhsRFaT.js";import{i as T,o as E}from"./platform-DVeTi9mp.js";import{relative as D}from"path";function O(){let e=r.isSandboxingEnabled(),t=r.checkDependencies(),n=t.warnings.length>0?(0,k.jsx)(u,{marginTop:1,flexDirection:`column`,children:t.warnings.map((e,t)=>(0,k.jsx)(f,{dimColor:!0,children:e},t))}):null;if(!e)return(0,k.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,k.jsx)(f,{color:`subtle`,children:`Sandbox is not enabled`}),n]});let i=r.getFsReadConfig(),o=r.getFsWriteConfig(),s=r.getNetworkRestrictionConfig(),c=r.getAllowUnixSockets(),l=r.getExcludedCommands(),d=r.getLinuxGlobPatternWarnings();return(0,k.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,k.jsxs)(u,{flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`permission`,children:`Excluded Commands:`}),(0,k.jsx)(f,{dimColor:!0,children:l.length>0?l.join(`, `):`None`})]}),i.denyOnly.length>0&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`permission`,children:`Filesystem Read Restrictions:`}),(0,k.jsxs)(f,{dimColor:!0,children:[`Denied: `,i.denyOnly.join(`, `)]}),i.allowWithinDeny&&i.allowWithinDeny.length>0&&(0,k.jsxs)(f,{dimColor:!0,children:[`Allowed within denied: `,i.allowWithinDeny.join(`, `)]})]}),o.allowOnly.length>0&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`permission`,children:`Filesystem Write Restrictions:`}),(0,k.jsxs)(f,{dimColor:!0,children:[`Allowed: `,o.allowOnly.join(`, `)]}),o.denyWithinAllow.length>0&&(0,k.jsxs)(f,{dimColor:!0,children:[`Denied within allowed: `,o.denyWithinAllow.join(`, `)]})]}),(s.allowedHosts&&s.allowedHosts.length>0||s.deniedHosts&&s.deniedHosts.length>0)&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsxs)(f,{bold:!0,color:`permission`,children:[`Network Restrictions`,a()?` (Managed)`:``,`:`]}),s.allowedHosts&&s.allowedHosts.length>0&&(0,k.jsxs)(f,{dimColor:!0,children:[`Allowed: `,s.allowedHosts.join(`, `)]}),s.deniedHosts&&s.deniedHosts.length>0&&(0,k.jsxs)(f,{dimColor:!0,children:[`Denied: `,s.deniedHosts.join(`, `)]})]}),c&&c.length>0&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`permission`,children:`Allowed Unix Sockets:`}),(0,k.jsx)(f,{dimColor:!0,children:c.join(`, `)})]}),d.length>0&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`warning`,children:`⚠ Warning: Glob patterns not fully supported on Linux`}),(0,k.jsxs)(f,{dimColor:!0,children:[`The following patterns will be ignored: `,d.slice(0,3).join(`, `),d.length>3&&` (${d.length-3} more)`]})]}),n]})}var k,A=e((()=>{_(),i(),k=y()}));function j({depCheck:e}){let t=T()===`macos`,n=e.errors.some(e=>e.includes(`ripgrep`)),r=e.errors.some(e=>e.includes(`bwrap`)),i=e.errors.some(e=>e.includes(`socat`)),a=e.warnings.length>0,o=e.errors.filter(e=>!e.includes(`ripgrep`)&&!e.includes(`bwrap`)&&!e.includes(`socat`));return(0,M.jsxs)(u,{flexDirection:`column`,paddingY:1,gap:1,children:[t&&(0,M.jsx)(u,{flexDirection:`column`,children:(0,M.jsxs)(f,{children:[`seatbelt: `,(0,M.jsx)(f,{color:`success`,children:`built-in (macOS)`})]})}),(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{children:[`ripgrep (rg): `,n?(0,M.jsx)(f,{color:`error`,children:`not found`}):(0,M.jsx)(f,{color:`success`,children:`found`})]}),n&&(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· `,t?`brew install ripgrep`:`apt install ripgrep`]})]}),!t&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{children:[`bubblewrap (bwrap):`,` `,r?(0,M.jsx)(f,{color:`error`,children:`not installed`}):(0,M.jsx)(f,{color:`success`,children:`installed`})]}),r&&(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· apt install bubblewrap`]})]}),(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{children:[`socat: `,i?(0,M.jsx)(f,{color:`error`,children:`not installed`}):(0,M.jsx)(f,{color:`success`,children:`installed`})]}),i&&(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· apt install socat`]})]}),(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{children:[`seccomp filter:`,` `,a?(0,M.jsx)(f,{color:`warning`,children:`not installed`}):(0,M.jsx)(f,{color:`success`,children:`installed`}),a&&(0,M.jsx)(f,{dimColor:!0,children:` (required to block unix domain sockets)`})]}),a&&(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· npm install -g @anthropic-ai/sandbox-runtime`]}),(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· or copy vendor/seccomp/* from sandbox-runtime and set`]}),(0,M.jsxs)(f,{dimColor:!0,children:[` `,`sandbox.seccomp.bpfPath and applyPath in settings.json`]})]})]})]}),o.map(e=>(0,M.jsx)(f,{color:`error`,children:e},e))]})}var M,N=e((()=>{_(),E(),M=y()}));function P({onComplete:e}){let t=r.isSandboxingEnabled(),n=r.areSandboxSettingsLockedByPolicy(),i=r.areUnsandboxedCommandsAllowed();return t?n?(0,I.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,I.jsx)(f,{color:`subtle`,children:`Override settings are managed by a higher-priority configuration and cannot be changed locally.`}),(0,I.jsx)(u,{marginTop:1,children:(0,I.jsxs)(f,{dimColor:!0,children:[`Current setting: `,i?`Allow unsandboxed fallback`:`Strict sandbox mode`]})})]}):(0,I.jsx)(F,{onComplete:e,currentMode:i?`open`:`closed`}):(0,I.jsx)(u,{flexDirection:`column`,paddingY:1,children:(0,I.jsx)(f,{color:`subtle`,children:`Sandbox is not enabled. Enable sandbox to configure override settings.`})})}function F({onComplete:e,currentMode:t}){let[i]=l(),{headerFocused:a,focusHeader:o}=p(),s=m(`success`,i)(`(current)`),c=[{label:t===`open`?`Allow unsandboxed fallback ${s}`:`Allow unsandboxed fallback`,value:`open`},{label:t===`closed`?`Strict sandbox mode ${s}`:`Strict sandbox mode`,value:`closed`}];async function h(t){let n=t;await r.setSandboxSettings({allowUnsandboxedCommands:n===`open`}),e(n===`open`?`✓ Unsandboxed fallback allowed - commands can run outside sandbox when necessary`:"✓ Strict sandbox mode - all commands must run in sandbox or be excluded via the `excludedCommands` option")}return(0,I.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,I.jsx)(u,{marginBottom:1,children:(0,I.jsx)(f,{bold:!0,children:`Configure Overrides:`})}),(0,I.jsx)(n,{options:c,onChange:h,onCancel:()=>e(void 0,{display:`skip`}),onUpFromFirstItem:o,isDisabled:a}),(0,I.jsxs)(u,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,I.jsxs)(f,{dimColor:!0,children:[(0,I.jsx)(f,{bold:!0,dimColor:!0,children:`Allow unsandboxed fallback:`}),` `,`When a command fails due to sandbox restrictions, Work Mate can retry with dangerouslyDisableSandbox to run outside the sandbox (falling back to default permissions).`]}),(0,I.jsxs)(f,{dimColor:!0,children:[(0,I.jsx)(f,{bold:!0,dimColor:!0,children:`Strict sandbox mode:`}),` `,`All bash commands invoked by the model must run in the sandbox unless they are explicitly listed in excludedCommands.`]}),(0,I.jsxs)(f,{dimColor:!0,children:[`Learn more:`,` `,(0,I.jsx)(d,{url:`https://code.workmate.com/docs/en/sandboxing#configure-sandboxing`,children:`code.workmate.com/docs/en/sandboxing#configure-sandboxing`})]})]})]})}var I,L=e((()=>{_(),i(),t(),I=y()}));function R({onComplete:e,depCheck:t}){let[n]=l(),i=r.isSandboxingEnabled(),a=r.isAutoAllowBashIfSandboxedEnabled(),o=t.warnings.length>0,s=S().sandbox?.network?.allowAllUnixSockets,u=o&&!s,d=i?a?`auto-allow`:`regular`:`disabled`,f=m(`success`,n)(`(current)`),p=[{label:d===`auto-allow`?`Sandbox BashTool, with auto-allow ${f}`:`Sandbox BashTool, with auto-allow`,value:`auto-allow`},{label:d===`regular`?`Sandbox BashTool, with regular permissions ${f}`:`Sandbox BashTool, with regular permissions`,value:`regular`},{label:d===`disabled`?`No Sandbox ${f}`:`No Sandbox`,value:`disabled`}];async function _(t){switch(t){case`auto-allow`:await r.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),e(`✓ Sandbox enabled with auto-allow for bash commands`);break;case`regular`:await r.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),e(`✓ Sandbox enabled with regular bash permissions`);break;case`disabled`:await r.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),e(`○ Sandbox disabled`);break}}c({"confirm:no":()=>e(void 0,{display:`skip`})},{context:`Settings`});let y=(0,B.jsx)(h,{title:`Mode`,children:(0,B.jsx)(z,{showSocketWarning:u,options:p,onSelect:_,onComplete:e})},`mode`),b=(0,B.jsx)(h,{title:`Overrides`,children:(0,B.jsx)(P,{onComplete:e})},`overrides`),x=(0,B.jsx)(h,{title:`Config`,children:(0,B.jsx)(O,{})},`config`);return(0,B.jsx)(v,{color:`permission`,children:(0,B.jsx)(g,{title:`Sandbox:`,color:`permission`,defaultTab:`Mode`,children:t.errors.length>0?[(0,B.jsx)(h,{title:`Dependencies`,children:(0,B.jsx)(j,{depCheck:t})},`dependencies`)]:[y,...o?[(0,B.jsx)(h,{title:`Dependencies`,children:(0,B.jsx)(j,{depCheck:t})},`dependencies`)]:[],b,x]})})}function z({showSocketWarning:e,options:t,onSelect:r,onComplete:i}){let{headerFocused:a,focusHeader:o}=p();return(0,B.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[e&&(0,B.jsx)(u,{marginBottom:1,children:(0,B.jsx)(f,{color:`warning`,children:`Cannot block unix domain sockets (see Dependencies tab)`})}),(0,B.jsx)(u,{marginBottom:1,children:(0,B.jsx)(f,{bold:!0,children:`Configure Mode:`})}),(0,B.jsx)(n,{options:t,onChange:r,onCancel:()=>i(void 0,{display:`skip`}),onUpFromFirstItem:o,isDisabled:a}),(0,B.jsxs)(u,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,B.jsxs)(f,{dimColor:!0,children:[(0,B.jsx)(f,{bold:!0,dimColor:!0,children:`Auto-allow mode:`}),` `,`Commands will try to run in the sandbox automatically, and attempts to run outside of the sandbox fallback to regular permissions. Explicit ask/deny rules are always respected.`]}),(0,B.jsxs)(f,{dimColor:!0,children:[`Learn more:`,` `,(0,B.jsx)(d,{url:`https://code.workmate.com/docs/en/sandboxing`,children:`code.workmate.com/docs/en/sandboxing`})]})]})]})}var B,V=e((()=>{_(),o(),i(),C(),t(),A(),N(),L(),B=y()}));async function H(e,t,n){let i=S().theme||`light`,a=T();if(!r.isSupportedPlatform()){let t=a===`wsl`?`Error: Sandboxing requires WSL2. WSL1 is not supported.`:`Error: Sandboxing is currently only supported on macOS, Linux, and WSL2.`;return e(m(`error`,i)(t)),null}let o=r.checkDependencies();if(!r.isPlatformInEnabledList())return e(m(`error`,i)(`Error: Sandboxing is disabled for this platform (${a}) via the enabledPlatforms setting.`)),null;if(r.areSandboxSettingsLockedByPolicy())return e(m(`error`,i)(`Error: Sandbox settings are overridden by a higher-priority configuration and cannot be changed locally.`)),null;let c=n?.trim()||``;if(!c)return(0,U.jsx)(R,{onComplete:e,depCheck:o});if(c){let t=c.split(` `)[0];if(t===`exclude`){let t=c.slice(8).trim();if(!t)return e(m(`error`,i)(`Error: Please provide a command pattern to exclude (e.g., /sandbox exclude "npm run test:*")`)),null;let n=t.replace(/^["']|["']$/g,``);s(n);let r=w(`localSettings`),a=r?D(b(),r):`.workmate/settings.local.json`;return e(m(`success`,i)(`Added "${n}" to excluded commands in ${a}`)),null}else return e(m(`error`,i)(`Error: Unknown subcommand "${t}". Available subcommand: exclude`)),null}return null}var U;e((()=>{x(),V(),_(),E(),i(),C(),U=y()}))();export{H as call};
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$u as t,Qu as n,hC as r,iT as i,lT as a,oT as o,rT as s}from"./loadAgentsDir-PPiD2Mfq.js";import{Gt as c,H as l,I as u,Lt as d,P as f,a as p,j as m,n as h,r as g,t as _,x as v}from"./src-DL3w8VPk2.js";import{t as y}from"./jsx-runtime-Bb4Xn-E0.js";import{O as b,Wt as x}from"./state-BPFYBqm1.js";import{f as S,g as C,s as w}from"./settings-CvhsRFaT.js";import{i as T,o as E}from"./platform-DVeTi9mp.js";import{relative as D}from"path";function O(){let e=s.isSandboxingEnabled(),t=s.checkDependencies(),n=t.warnings.length>0?(0,k.jsx)(u,{marginTop:1,flexDirection:`column`,children:t.warnings.map((e,t)=>(0,k.jsx)(f,{dimColor:!0,children:e},t))}):null;if(!e)return(0,k.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,k.jsx)(f,{color:`subtle`,children:`Sandbox is not enabled`}),n]});let r=s.getFsReadConfig(),i=s.getFsWriteConfig(),o=s.getNetworkRestrictionConfig(),c=s.getAllowUnixSockets(),l=s.getExcludedCommands(),d=s.getLinuxGlobPatternWarnings();return(0,k.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,k.jsxs)(u,{flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`permission`,children:`Excluded Commands:`}),(0,k.jsx)(f,{dimColor:!0,children:l.length>0?l.join(`, `):`None`})]}),r.denyOnly.length>0&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`permission`,children:`Filesystem Read Restrictions:`}),(0,k.jsxs)(f,{dimColor:!0,children:[`Denied: `,r.denyOnly.join(`, `)]}),r.allowWithinDeny&&r.allowWithinDeny.length>0&&(0,k.jsxs)(f,{dimColor:!0,children:[`Allowed within denied: `,r.allowWithinDeny.join(`, `)]})]}),i.allowOnly.length>0&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`permission`,children:`Filesystem Write Restrictions:`}),(0,k.jsxs)(f,{dimColor:!0,children:[`Allowed: `,i.allowOnly.join(`, `)]}),i.denyWithinAllow.length>0&&(0,k.jsxs)(f,{dimColor:!0,children:[`Denied within allowed: `,i.denyWithinAllow.join(`, `)]})]}),(o.allowedHosts&&o.allowedHosts.length>0||o.deniedHosts&&o.deniedHosts.length>0)&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsxs)(f,{bold:!0,color:`permission`,children:[`Network Restrictions`,a()?` (Managed)`:``,`:`]}),o.allowedHosts&&o.allowedHosts.length>0&&(0,k.jsxs)(f,{dimColor:!0,children:[`Allowed: `,o.allowedHosts.join(`, `)]}),o.deniedHosts&&o.deniedHosts.length>0&&(0,k.jsxs)(f,{dimColor:!0,children:[`Denied: `,o.deniedHosts.join(`, `)]})]}),c&&c.length>0&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`permission`,children:`Allowed Unix Sockets:`}),(0,k.jsx)(f,{dimColor:!0,children:c.join(`, `)})]}),d.length>0&&(0,k.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(f,{bold:!0,color:`warning`,children:`⚠ Warning: Glob patterns not fully supported on Linux`}),(0,k.jsxs)(f,{dimColor:!0,children:[`The following patterns will be ignored: `,d.slice(0,3).join(`, `),d.length>3&&` (${d.length-3} more)`]})]}),n]})}var k,A=e((()=>{_(),o(),k=y()}));function j({depCheck:e}){let t=T()===`macos`,n=e.errors.some(e=>e.includes(`ripgrep`)),r=e.errors.some(e=>e.includes(`bwrap`)),i=e.errors.some(e=>e.includes(`socat`)),a=e.warnings.length>0,o=e.errors.filter(e=>!e.includes(`ripgrep`)&&!e.includes(`bwrap`)&&!e.includes(`socat`));return(0,M.jsxs)(u,{flexDirection:`column`,paddingY:1,gap:1,children:[t&&(0,M.jsx)(u,{flexDirection:`column`,children:(0,M.jsxs)(f,{children:[`seatbelt: `,(0,M.jsx)(f,{color:`success`,children:`built-in (macOS)`})]})}),(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{children:[`ripgrep (rg): `,n?(0,M.jsx)(f,{color:`error`,children:`not found`}):(0,M.jsx)(f,{color:`success`,children:`found`})]}),n&&(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· `,t?`brew install ripgrep`:`apt install ripgrep`]})]}),!t&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{children:[`bubblewrap (bwrap):`,` `,r?(0,M.jsx)(f,{color:`error`,children:`not installed`}):(0,M.jsx)(f,{color:`success`,children:`installed`})]}),r&&(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· apt install bubblewrap`]})]}),(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{children:[`socat: `,i?(0,M.jsx)(f,{color:`error`,children:`not installed`}):(0,M.jsx)(f,{color:`success`,children:`installed`})]}),i&&(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· apt install socat`]})]}),(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{children:[`seccomp filter:`,` `,a?(0,M.jsx)(f,{color:`warning`,children:`not installed`}):(0,M.jsx)(f,{color:`success`,children:`installed`}),a&&(0,M.jsx)(f,{dimColor:!0,children:` (required to block unix domain sockets)`})]}),a&&(0,M.jsxs)(u,{flexDirection:`column`,children:[(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· npm install -g @anthropic-ai/sandbox-runtime`]}),(0,M.jsxs)(f,{dimColor:!0,children:[` `,`· or copy vendor/seccomp/* from sandbox-runtime and set`]}),(0,M.jsxs)(f,{dimColor:!0,children:[` `,`sandbox.seccomp.bpfPath and applyPath in settings.json`]})]})]})]}),o.map(e=>(0,M.jsx)(f,{color:`error`,children:e},e))]})}var M,N=e((()=>{_(),E(),M=y()}));function P({onComplete:e}){let t=s.isSandboxingEnabled(),n=s.areSandboxSettingsLockedByPolicy(),r=s.areUnsandboxedCommandsAllowed();return t?n?(0,I.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,I.jsx)(f,{color:`subtle`,children:`Override settings are managed by a higher-priority configuration and cannot be changed locally.`}),(0,I.jsx)(u,{marginTop:1,children:(0,I.jsxs)(f,{dimColor:!0,children:[`Current setting: `,r?`Allow unsandboxed fallback`:`Strict sandbox mode`]})})]}):(0,I.jsx)(F,{onComplete:e,currentMode:r?`open`:`closed`}):(0,I.jsx)(u,{flexDirection:`column`,paddingY:1,children:(0,I.jsx)(f,{color:`subtle`,children:`Sandbox is not enabled. Enable sandbox to configure override settings.`})})}function F({onComplete:e,currentMode:t}){let[r]=l(),{headerFocused:i,focusHeader:a}=p(),o=m(`success`,r)(`(current)`),c=[{label:t===`open`?`Allow unsandboxed fallback ${o}`:`Allow unsandboxed fallback`,value:`open`},{label:t===`closed`?`Strict sandbox mode ${o}`:`Strict sandbox mode`,value:`closed`}];async function h(t){let n=t;await s.setSandboxSettings({allowUnsandboxedCommands:n===`open`}),e(n===`open`?`✓ Unsandboxed fallback allowed - commands can run outside sandbox when necessary`:"✓ Strict sandbox mode - all commands must run in sandbox or be excluded via the `excludedCommands` option")}return(0,I.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,I.jsx)(u,{marginBottom:1,children:(0,I.jsx)(f,{bold:!0,children:`Configure Overrides:`})}),(0,I.jsx)(n,{options:c,onChange:h,onCancel:()=>e(void 0,{display:`skip`}),onUpFromFirstItem:a,isDisabled:i}),(0,I.jsxs)(u,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,I.jsxs)(f,{dimColor:!0,children:[(0,I.jsx)(f,{bold:!0,dimColor:!0,children:`Allow unsandboxed fallback:`}),` `,`When a command fails due to sandbox restrictions, Work Mate can retry with dangerouslyDisableSandbox to run outside the sandbox (falling back to default permissions).`]}),(0,I.jsxs)(f,{dimColor:!0,children:[(0,I.jsx)(f,{bold:!0,dimColor:!0,children:`Strict sandbox mode:`}),` `,`All bash commands invoked by the model must run in the sandbox unless they are explicitly listed in excludedCommands.`]}),(0,I.jsxs)(f,{dimColor:!0,children:[`Learn more:`,` `,(0,I.jsx)(d,{url:`https://code.workmate.com/docs/en/sandboxing#configure-sandboxing`,children:`code.workmate.com/docs/en/sandboxing#configure-sandboxing`})]})]})]})}var I,L=e((()=>{_(),o(),t(),I=y()}));function R({onComplete:e,depCheck:t}){let[n]=l(),r=s.isSandboxingEnabled(),i=s.isAutoAllowBashIfSandboxedEnabled(),a=t.warnings.length>0,o=S().sandbox?.network?.allowAllUnixSockets,u=a&&!o,d=r?i?`auto-allow`:`regular`:`disabled`,f=m(`success`,n)(`(current)`),p=[{label:d===`auto-allow`?`Sandbox BashTool, with auto-allow ${f}`:`Sandbox BashTool, with auto-allow`,value:`auto-allow`},{label:d===`regular`?`Sandbox BashTool, with regular permissions ${f}`:`Sandbox BashTool, with regular permissions`,value:`regular`},{label:d===`disabled`?`No Sandbox ${f}`:`No Sandbox`,value:`disabled`}];async function _(t){switch(t){case`auto-allow`:await s.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),e(`✓ Sandbox enabled with auto-allow for bash commands`);break;case`regular`:await s.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),e(`✓ Sandbox enabled with regular bash permissions`);break;case`disabled`:await s.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),e(`○ Sandbox disabled`);break}}c({"confirm:no":()=>e(void 0,{display:`skip`})},{context:`Settings`});let y=(0,B.jsx)(h,{title:`Mode`,children:(0,B.jsx)(z,{showSocketWarning:u,options:p,onSelect:_,onComplete:e})},`mode`),b=(0,B.jsx)(h,{title:`Overrides`,children:(0,B.jsx)(P,{onComplete:e})},`overrides`),x=(0,B.jsx)(h,{title:`Config`,children:(0,B.jsx)(O,{})},`config`);return(0,B.jsx)(v,{color:`permission`,children:(0,B.jsx)(g,{title:`Sandbox:`,color:`permission`,defaultTab:`Mode`,children:t.errors.length>0?[(0,B.jsx)(h,{title:`Dependencies`,children:(0,B.jsx)(j,{depCheck:t})},`dependencies`)]:[y,...a?[(0,B.jsx)(h,{title:`Dependencies`,children:(0,B.jsx)(j,{depCheck:t})},`dependencies`)]:[],b,x]})})}function z({showSocketWarning:e,options:t,onSelect:r,onComplete:i}){let{headerFocused:a,focusHeader:o}=p();return(0,B.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[e&&(0,B.jsx)(u,{marginBottom:1,children:(0,B.jsx)(f,{color:`warning`,children:`Cannot block unix domain sockets (see Dependencies tab)`})}),(0,B.jsx)(u,{marginBottom:1,children:(0,B.jsx)(f,{bold:!0,children:`Configure Mode:`})}),(0,B.jsx)(n,{options:t,onChange:r,onCancel:()=>i(void 0,{display:`skip`}),onUpFromFirstItem:o,isDisabled:a}),(0,B.jsxs)(u,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,B.jsxs)(f,{dimColor:!0,children:[(0,B.jsx)(f,{bold:!0,dimColor:!0,children:`Auto-allow mode:`}),` `,`Commands will try to run in the sandbox automatically, and attempts to run outside of the sandbox fallback to regular permissions. Explicit ask/deny rules are always respected.`]}),(0,B.jsxs)(f,{dimColor:!0,children:[`Learn more:`,` `,(0,B.jsx)(d,{url:`https://code.workmate.com/docs/en/sandboxing`,children:`code.workmate.com/docs/en/sandboxing`})]})]})]})}var B,V=e((()=>{_(),r(),o(),C(),t(),A(),N(),L(),B=y()}));async function H(e,t,n){let r=S().theme||`light`,a=T();if(!s.isSupportedPlatform()){let t=a===`wsl`?`Error: Sandboxing requires WSL2. WSL1 is not supported.`:`Error: Sandboxing is currently only supported on macOS, Linux, and WSL2.`;return e(m(`error`,r)(t)),null}let o=s.checkDependencies();if(!s.isPlatformInEnabledList())return e(m(`error`,r)(`Error: Sandboxing is disabled for this platform (${a}) via the enabledPlatforms setting.`)),null;if(s.areSandboxSettingsLockedByPolicy())return e(m(`error`,r)(`Error: Sandbox settings are overridden by a higher-priority configuration and cannot be changed locally.`)),null;let c=n?.trim()||``;if(!c)return(0,U.jsx)(R,{onComplete:e,depCheck:o});if(c){let t=c.split(` `)[0];if(t===`exclude`){let t=c.slice(8).trim();if(!t)return e(m(`error`,r)(`Error: Please provide a command pattern to exclude (e.g., /sandbox exclude "npm run test:*")`)),null;let n=t.replace(/^["']|["']$/g,``);i(n);let a=w(`localSettings`),o=a?D(b(),a):`.workmate/settings.local.json`;return e(m(`success`,r)(`Added "${n}" to excluded commands in ${o}`)),null}else return e(m(`error`,r)(`Error: Unknown subcommand "${t}". Available subcommand: exclude`)),null}return null}var U;e((()=>{x(),V(),_(),E(),o(),C(),U=y()}))();export{H as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F_ as e,N_ as t}from"./loadAgentsDir-PPiD2Mfq.js";t();export{e as isSearchExtraToolsEnabled};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Xh as n,Zh as r,hC as i}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Xh as n,Zh as r,hC as i}from"./loadAgentsDir-PPiD2Mfq.js";import{I as a,P as o,Wt as s,ai as c,t as l,x as u}from"./src-DL3w8VPk2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{c as f,i as p}from"./debug-BQj6h99Q.js";import{t as m}from"./lib-BlVGipXx.js";function h({onDone:e}){let t=r(e=>e.remoteSessionUrl),[n,i]=(0,_.useState)(``);if((0,_.useEffect)(()=>{if(!t)return;let e=t;async function n(){let t=await(0,g.toString)(e,{type:`utf8`,errorCorrectionLevel:`L`});i(t)}n().catch(e=>{f(`QR code generation failed`,e)})},[t]),s(`confirm:no`,e,{context:`Confirmation`}),!t)return(0,v.jsxs)(u,{children:[(0,v.jsx)(o,{color:`warning`,children:"Not in remote mode. Start with `claude --remote` to use this command."}),(0,v.jsx)(o,{dimColor:!0,children:`(press esc to close)`})]});let c=n.split(`
|
|
2
2
|
`).filter(e=>e.length>0),l=c.length===0;return(0,v.jsxs)(u,{children:[(0,v.jsx)(a,{marginBottom:1,children:(0,v.jsx)(o,{bold:!0,children:`Remote session`})}),l?(0,v.jsx)(o,{dimColor:!0,children:`Generating QR code…`}):c.map((e,t)=>(0,v.jsx)(o,{children:e},t)),(0,v.jsxs)(a,{marginTop:1,children:[(0,v.jsx)(o,{dimColor:!0,children:`Open in browser: `}),(0,v.jsx)(o,{color:`ide`,children:t})]}),(0,v.jsx)(a,{marginTop:1,children:(0,v.jsx)(o,{dimColor:!0,children:`(press esc to close)`})})]})}var g,_,v,y;e((()=>{g=m(),_=t(c(),1),l(),i(),n(),p(),v=d(),y=async e=>(0,v.jsx)(h,{onDone:e})}))();export{y as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{nh as e,rh as t}from"./loadAgentsDir-PPiD2Mfq.js";e();export{t as registerSessionFileAccessHooks};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{X as t,Z as n,by as r}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{X as t,Z as n,by as r}from"./loadAgentsDir-PPiD2Mfq.js";import{Q as i}from"./sessionState-BTFowSpR.js";import{i as a,l as o,t as s,u as c}from"./instinctParser-Dt-lqnDe.js";function l(e){h.set(e.name,e),g||(g=e.name)}function u(e){if(!h.has(e))throw Error(`Observer backend "${e}" is not registered`);g=e}function d(){let e=g?h.get(g):void 0;if(!e)throw Error(`No observer backend is active — register one before analyzing observations`);return e}async function f(e,t){return Promise.resolve(d().analyze(e,t))}function p(){let e=process.env.SKILL_LEARNING_OBSERVER_BACKEND?.trim();return e&&h.has(e)?e:void 0}function m(){let e=p();return e&&u(e),d()}var h,g,_=e((()=>{h=new Map})),v,y=e((()=>{v=[`workflow`,`testing`,`debugging`,`code-style`,`security`,`git`,`project`]}));async function b(e,t){if(e.length===0)return[];if(Date.now()<L)return x(e,t);let r=e.slice(-30),a=S(r),s=P(o().llm.timeoutMs),c;try{let e=await n({systemPrompt:i([R]),userPrompt:a,signal:s,options:{querySource:`skill_learning_observer`,enablePromptCaching:!0,agents:[],isNonInteractiveSession:!0,hasAppendSystemPrompt:!1,mcpTools:[]}});I=0,c=T(e.message?.content)}catch{return I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),x(e,t)}let l=E(c,t,r);return l.length===0?(I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),x(e,t)):l}async function x(e,t){try{let{heuristicObserverBackend:n}=await import(`./sessionObserver-KB1UL_n2.js`),r=n.analyze(e,t);return Array.isArray(r)?r:await r}catch{return[]}}function S(e){return`Observations (chronological, newest last):\n${e.map((e,t)=>C(e,t)).join(`
|
|
2
2
|
`)}\n\nExtract up to ${F} atomic instincts. JSON array only.`}function C(e,t){let n=[`#${t+1}`,`event=${e.event}`];return e.toolName&&n.push(`tool=${e.toolName}`),e.outcome&&n.push(`outcome=${e.outcome}`),e.messageText&&n.push(`text=${JSON.stringify(w(e.messageText,200))}`),e.toolInput&&n.push(`in=${JSON.stringify(w(e.toolInput,120))}`),e.toolOutput&&n.push(`out=${JSON.stringify(w(e.toolOutput,120))}`),n.join(` | `)}function w(e,t){return e.length<=t?e:`${e.slice(0,t)}…`}function T(e){if(!Array.isArray(e))return``;let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;e.type===`text`&&typeof e.text==`string`&&t.push(e.text)}return t.join(``).trim()}function E(e,t,n){let r=D(e);if(!r)return[];let i;try{i=JSON.parse(r)}catch{return[]}if(!Array.isArray(i))return[];let a=n.map(e=>e.id),o=[];for(let e of i.slice(0,F)){let n=O(e,t,a);n&&o.push(n)}return o}function D(e){if(!e)return;let t=e.indexOf(`[`),n=e.lastIndexOf(`]`);if(!(t<0||n<=t))return e.slice(t,n+1)}function O(e,t,n){if(!e||typeof e!=`object`)return;let r=e,i=k(r.trigger,80),a=k(r.action,120);if(!i||!a)return;let o=N(r.evidence);if(o.length!==0)return{trigger:i,action:a,confidence:A(r.confidence),domain:j(r.domain),source:`session-observation`,scope:M(r.scope),projectId:t?.project?.projectId,projectName:t?.project?.projectName,evidence:o,observationIds:n}}function k(e,t){if(typeof e!=`string`)return;let n=e.trim();if(n)return n.length>t?n.slice(0,t):n}function A(e){return typeof e!=`number`||!Number.isFinite(e)?.5:e<0?0:e>1?1:e}function j(e){return typeof e==`string`&&v.includes(e)?e:`project`}function M(e){return e===`global`?`global`:`project`}function N(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(e&&(t.push(e.length>200?`${e.slice(0,200)}…`:e),t.length===3))break}return t}function P(e){return AbortSignal.timeout(e)}var F,I,L,R,z,B=e((()=>{t(),r(),c(),y(),F=3,I=0,L=0,R=`You analyse a short sequence of observations from a coding-assistant session (user messages, tool invocations with outcomes, assistant messages) and extract atomic, reusable "instincts" — behavioural patterns that would help the assistant act correctly in future similar situations.
|
|
3
3
|
|
|
4
4
|
Respond with ONLY a JSON array (no prose, no code fences, no commentary). Each item must match this schema:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t}from"./sessionObserver-BAr8AWeL.js";t();export{e as heuristicObserverBackend};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DcaKZlRU.js";import{t as i}from"./semver-DQo45qGo.js";import{Wt as a,Xn as o,mt as s,pt as c,z as l}from"./state-BPFYBqm1.js";import{P as u,R as d,c as f,f as p,i as m,nt as h,tt as g,u as _}from"./debug-BQj6h99Q.js";import{O as ee,k as v}from"./git-DplvjXEY.js";import{
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DcaKZlRU.js";import{t as i}from"./semver-DQo45qGo.js";import{Wt as a,Xn as o,mt as s,pt as c,z as l}from"./state-BPFYBqm1.js";import{P as u,R as d,c as f,f as p,i as m,nt as h,tt as g,u as _}from"./debug-BQj6h99Q.js";import{O as ee,k as v}from"./git-DplvjXEY.js";import{br as te,vr as y,xr as ne,yr as re}from"./model-sviY1inu.js";import{randomUUID as b}from"crypto";function x(){return S||(S=i()),S}function ie(e,t){return typeof Bun<`u`?Bun.semver.order(e,t)===1:x().gt(e,t,{loose:!0})}function ae(e,t){return typeof Bun<`u`?Bun.semver.order(e,t)>=0:x().gte(e,t,{loose:!0})}function oe(e,t){return typeof Bun<`u`?Bun.semver.order(e,t)===-1:x().lt(e,t,{loose:!0})}function se(e,t){return typeof Bun<`u`?Bun.semver.satisfies(e,t):x().satisfies(e,t,{loose:!0})}var S,ce=e((()=>{})),le=t({activateProactive:()=>ue,deactivateProactive:()=>de,getActivationSource:()=>ye,getNextTickAt:()=>ve,isContextBlocked:()=>ge,isProactiveActive:()=>w,isProactivePaused:()=>fe,pauseProactive:()=>pe,resumeProactive:()=>me,setContextBlocked:()=>he,setNextTickAt:()=>_e,shouldTick:()=>xe,subscribeToProactiveChanges:()=>be});function C(){for(let e of k)try{e()}catch{}}function w(){return T}function ue(e){T||(T=!0,E=!1,D=!1,Se=e,C())}function de(){T&&(T=!1,E=!1,D=!1,O=null,Se=void 0,C())}function fe(){return E}function pe(){!T||E||(E=!0,O=null,C())}function me(){!T||!E||(E=!1,C())}function he(e){D!==e&&(D=e,e&&(O=null),C())}function ge(){return D}function _e(e){O=e,C()}function ve(){return!T||E||D?null:O}function ye(){return Se}function be(e){return k.add(e),()=>{k.delete(e)}}function xe(){return T&&!E&&!D}var T,E,D,O,Se,k,Ce=e((()=>{T=!1,E=!1,D=!1,O=null,k=new Set})),we=e((()=>{})),Te,Ee=e((()=>{Te={input_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,output_tokens:0,server_tool_use:{web_search_requests:0,web_fetch_requests:0},service_tier:`standard`,cache_creation:{ephemeral_1h_input_tokens:0,ephemeral_5m_input_tokens:0},inference_geo:``,iterations:[],speed:`standard`}})),De=e((()=>{}));function Oe(e){return e}var ke=e((()=>{})),Ae=e((()=>{we(),Ee(),De(),ke()}));function je(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function Me(e){if(process.env.OPENAI_MODEL)return process.env.OPENAI_MODEL;let t=e.replace(/\[1m\]$/,``),n=je(t);if(n){let e=`OPENAI_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return Ne[t]??t}var Ne,Pe=e((()=>{Ne={"claude-sonnet-4-20250514":`gpt-4o`,"claude-sonnet-4-5-20250929":`gpt-4o`,"claude-sonnet-4-6":`gpt-4o`,"claude-opus-4-20250514":`o3`,"claude-opus-4-1-20250805":`o3`,"claude-opus-4-5-20251101":`o3`,"claude-opus-4-6":`o3`,"claude-haiku-4-5-20251001":`gpt-4o-mini`,"claude-3-5-haiku-20241022":`gpt-4o-mini`,"claude-3-7-sonnet-20250219":`gpt-4o`,"claude-3-5-sonnet-20241022":`gpt-4o`}}));function Fe(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function Ie(){let e=process.env.GROK_MODEL_MAP;if(!e)return null;try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}return null}function Le(e){if(process.env.GROK_MODEL)return process.env.GROK_MODEL;let t=e.replace(/\[1m\]$/,``),n=Fe(t),r=Ie();if(r&&n&&r[n])return r[n];if(n){let e=`GROK_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return Re[t]?Re[t]:n&&ze[n]?ze[n]:t}var Re,ze,Be=e((()=>{Re={"claude-sonnet-4-20250514":`grok-3-mini-fast`,"claude-sonnet-4-5-20250929":`grok-3-mini-fast`,"claude-sonnet-4-6":`grok-3-mini-fast`,"claude-opus-4-20250514":`grok-4.20-reasoning`,"claude-opus-4-1-20250805":`grok-4.20-reasoning`,"claude-opus-4-5-20251101":`grok-4.20-reasoning`,"claude-opus-4-6":`grok-4.20-reasoning`,"claude-haiku-4-5-20251001":`grok-3-mini-fast`,"claude-3-5-haiku-20241022":`grok-3-mini-fast`,"claude-3-7-sonnet-20250219":`grok-3-mini-fast`,"claude-3-5-sonnet-20241022":`grok-3-mini-fast`},ze={opus:`grok-4.20-reasoning`,sonnet:`grok-3-mini-fast`,haiku:`grok-3-mini-fast`}}));function Ve(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function He(e){if(process.env.GEMINI_MODEL)return process.env.GEMINI_MODEL;let t=e.replace(/\[1m\]$/i,``),n=Ve(t);if(!n)return t;let r=`GEMINI_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i;let a=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,o=process.env[a];if(o)return o;throw Error(`Gemini provider requires GEMINI_MODEL or ${r} (or ${a} for backward compatibility) to be configured.`)}var Ue=e((()=>{})),We,A=e((()=>{We=`_geminiThoughtSignature`}));function j(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function Ge(e,t){let n=[],r=new Map;for(let t of e){if(t.type===`assistant`){let e=Ye(t);e.parts.length>0&&n.push(e);let i=t.message.content;if(Array.isArray(i))for(let e of i)typeof e!=`string`&&e.type===`tool_use`&&r.set(e.id,e.name);continue}if(t.type===`user`){let e=qe(t,r);e.parts.length>0&&n.push(e)}}let i=Ke(t);return{contents:n,...i?{systemInstruction:{parts:[{text:i}]}}:{}}}function Ke(e){return!e||e.length===0?``:e.filter(Boolean).join(`
|
|
2
2
|
|
|
3
3
|
`)}function qe(e,t){let n=e.message.content;return typeof n==`string`?{role:`user`,parts:M(n)}:Array.isArray(n)?{role:`user`,parts:n.flatMap(e=>Je(e,t))}:{role:`user`,parts:[]}}function Je(e,t){if(typeof e==`string`)return M(e);if(e.type===`text`)return M(e.text);if(e.type===`tool_result`){let n=e;return[{functionResponse:{name:t.get(n.tool_use_id)??n.tool_use_id,response:Qe(n)}}]}if(e.type===`image`){let t=e.source;if(t?.type===`base64`&&typeof t.data==`string`)return[{inlineData:{mimeType:t.media_type||`image/png`,data:t.data}}];if(t?.type===`url`&&typeof t.url==`string`)return M(`[image: ${t.url}]`)}return[]}function Ye(e){let t=e.message.content;if(typeof t==`string`)return{role:`model`,parts:M(t)};if(!Array.isArray(t))return{role:`model`,parts:[]};let n=[];for(let e of t){if(typeof e==`string`){n.push(...M(e));continue}if(e.type===`text`){n.push(...M(e.text,N(e)));continue}if(e.type===`thinking`){let t=Xe(e.thinking,e.signature);t&&n.push(t);continue}if(e.type===`tool_use`){let t=e;n.push({functionCall:{name:t.name,args:Ze(t.input)},...N(e)&&{thoughtSignature:N(e)}})}}return{role:`model`,parts:n}}function M(e,t){return typeof e!=`string`||e.length===0?[]:[{text:e,...t&&{thoughtSignature:t}}]}function Xe(e,t){if(!(typeof e!=`string`||e.length===0))return{text:e,thought:!0,...t&&{thoughtSignature:t}}}function Ze(e){if(typeof e==`string`){let t=j(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:t===null?{}:{value:t}}return e&&typeof e==`object`&&!Array.isArray(e)?e:e===void 0?{}:{value:e}}function Qe(e){let t=$e(e.content);return t&&typeof t==`object`&&!Array.isArray(t)?e.is_error?{...t,is_error:!0}:t:{result:t,...e.is_error?{is_error:!0}:{}}}function $e(e){if(typeof e==`string`)return j(e)??e;if(Array.isArray(e)){let t=e.map(e=>typeof e==`string`?e:e&&typeof e==`object`&&`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(`
|
|
4
4
|
`);return j(t)??t}return e??``}function N(e){let t=e[We];return typeof t==`string`&&t.length>0?t:void 0}var et=e((()=>{A()}));function tt(e){if(typeof e==`string`)return F.has(e)?e:void 0;if(Array.isArray(e)){let t=e.filter(e=>typeof e==`string`&&F.has(e)),n=Array.from(new Set(t));return n.length===0?void 0:n.length===1?n[0]:n}}function nt(e){if(e===null)return`null`;if(Array.isArray(e))return`array`;if(typeof e==`string`)return`string`;if(typeof e==`boolean`)return`boolean`;if(typeof e==`number`)return Number.isInteger(e)?`integer`:`number`;if(typeof e==`object`)return`object`}function rt(e){let t=e.map(nt).filter(e=>e!==void 0),n=Array.from(new Set(t));if(n.length!==0)return n.length===1?n[0]:n}function it(e){return e===void 0?[`null`]:Array.isArray(e)?e.includes(`null`)?e:[...e,`null`]:e===`null`?e:[e,`null`]}function at(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=Object.entries(e).map(([e,t])=>[e,P(t)]).filter(([,e])=>Object.keys(e).length>0);if(t.length!==0)return Object.fromEntries(t)}function ot(e){if(!Array.isArray(e))return;let t=e.map(e=>P(e)).filter(e=>Object.keys(e).length>0);return t.length>0?t:void 0}function P(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t=e,n={},r=tt(t.type);t.const===void 0?Array.isArray(t.enum)&&t.enum.length>0&&(n.enum=t.enum,r=r??rt(t.enum)):(n.enum=[t.const],r=r??nt(t.const)),r||(t.properties&&typeof t.properties==`object`?r=`object`:(t.items!==void 0||t.prefixItems!==void 0)&&(r=`array`)),t.nullable===!0&&(r=it(r)),r&&(n.type=r),typeof t.title==`string`&&(n.title=t.title),typeof t.description==`string`&&(n.description=t.description),typeof t.format==`string`&&(n.format=t.format),typeof t.pattern==`string`&&(n.pattern=t.pattern),typeof t.minimum==`number`?n.minimum=t.minimum:typeof t.exclusiveMinimum==`number`&&(n.minimum=t.exclusiveMinimum),typeof t.maximum==`number`?n.maximum=t.maximum:typeof t.exclusiveMaximum==`number`&&(n.maximum=t.exclusiveMaximum),typeof t.minItems==`number`&&(n.minItems=t.minItems),typeof t.maxItems==`number`&&(n.maxItems=t.maxItems),typeof t.minLength==`number`&&(n.minLength=t.minLength),typeof t.maxLength==`number`&&(n.maxLength=t.maxLength),typeof t.minProperties==`number`&&(n.minProperties=t.minProperties),typeof t.maxProperties==`number`&&(n.maxProperties=t.maxProperties);let i=at(t.properties);if(i&&(n.properties=i,n.propertyOrdering=Object.keys(i)),Array.isArray(t.required)){let e=t.required.filter(e=>typeof e==`string`);e.length>0&&(n.required=e)}if(typeof t.additionalProperties==`boolean`)n.additionalProperties=t.additionalProperties;else{let e=P(t.additionalProperties);Object.keys(e).length>0&&(n.additionalProperties=e)}let a=P(t.items);Object.keys(a).length>0&&(n.items=a);let o=ot(t.prefixItems);o&&(n.prefixItems=o);let s=ot(t.anyOf??t.oneOf);return s&&(n.anyOf=s),n}function st(e){let t=P(e);return Object.keys(t).length>0?t:{type:`object`,properties:{}}}function ct(e){let t=e.filter(e=>{let t=e.type;return e.type===`custom`||!(`type`in e)||t!==`server`}).map(e=>{let t=e;return{name:t.name||``,description:t.description||``,parametersJsonSchema:st(t.input_schema??{type:`object`,properties:{}})}});return t.length>0?[{functionDeclarations:t}]:[]}function lt(e){if(!e||typeof e!=`object`)return;let t=e;switch(t.type){case`auto`:return{mode:`AUTO`};case`any`:return{mode:`ANY`};case`tool`:return{mode:`ANY`,allowedFunctionNames:typeof t.name==`string`?[t.name]:void 0};default:return}}var F,ut=e((()=>{F=new Set([`string`,`number`,`integer`,`boolean`,`object`,`array`,`null`])}));async function*dt(e,t){let n=`msg_${b().replace(/-/g,``).slice(0,24)}`,r=!1,i=!1,a=0,o=null,s=!1,c,l=0,u=0,d=0;for await(let i of e){let e=i.usageMetadata;e&&(l=e.promptTokenCount??l,u=(e.candidatesTokenCount??0)+(e.thoughtsTokenCount??0),d=e.cachedContentTokenCount??d),r||(r=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:l,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:d}}});let f=i.candidates?.[0],p=f?.content?.parts??[];for(let e of p){if(e.functionCall){o&&(yield{type:`content_block_stop`,index:o.index},o=null),s=!0;let t=a++;yield{type:`content_block_start`,index:t,content_block:{type:`tool_use`,id:`toolu_${b().replace(/-/g,``).slice(0,24)}`,name:e.functionCall.name||``,input:{}}},e.thoughtSignature&&(yield{type:`content_block_delta`,index:t,delta:{type:`signature_delta`,signature:e.thoughtSignature}}),e.functionCall.args&&Object.keys(e.functionCall.args).length>0&&(yield{type:`content_block_delta`,index:t,delta:{type:`input_json_delta`,partial_json:JSON.stringify(e.functionCall.args)}}),yield{type:`content_block_stop`,index:t};continue}let t=ft(e);if(t){(!o||o.type!==t)&&(o&&(yield{type:`content_block_stop`,index:o.index}),o={index:a++,type:t},yield{type:`content_block_start`,index:o.index,content_block:t===`thinking`?{type:`thinking`,thinking:``,signature:``}:{type:`text`,text:``}}),e.text&&(yield{type:`content_block_delta`,index:o.index,delta:t===`thinking`?{type:`thinking_delta`,thinking:e.text}:{type:`text_delta`,text:e.text}}),e.thoughtSignature&&(yield{type:`content_block_delta`,index:o.index,delta:{type:`signature_delta`,signature:e.thoughtSignature}});continue}e.thoughtSignature&&o&&(yield{type:`content_block_delta`,index:o.index,delta:{type:`signature_delta`,signature:e.thoughtSignature}})}f?.finishReason&&(c=f.finishReason)}r&&(o&&(yield{type:`content_block_stop`,index:o.index}),i||(yield{type:`message_delta`,delta:{stop_reason:pt(c,s),stop_sequence:null},usage:{input_tokens:l,output_tokens:u,cache_creation_input_tokens:0,cache_read_input_tokens:d}},yield{type:`message_stop`},i=!0))}function ft(e){return typeof e.text==`string`?e.thought?`thinking`:`text`:null}function pt(e,t){switch(e){case`MAX_TOKENS`:return`max_tokens`;default:return t?`tool_use`:`end_turn`}}var mt=e((()=>{}));function I(e){if(!e||typeof e!=`object`)return null;let t=e,n=0;for(;t&&n<5;){if(t instanceof Error&&`code`in t&&typeof t.code==`string`){let e=t.code,n=bt.has(e);return{code:e,message:t.message,isSSLError:n}}if(t instanceof Error&&`cause`in t&&t.cause!==t)t=t.cause,n++;else break}return null}function ht(e){let t=I(e);return t?.isSSLError?`SSL certificate error (${t.code}). If you are behind a corporate proxy or TLS-intercepting firewall, set NODE_EXTRA_CA_CERTS to your CA bundle path, or ask IT to allowlist *.anthropic.com. Run /doctor for details.`:null}function L(e){if(e.includes(`<!DOCTYPE html`)||e.includes(`<html`)){let t=e.match(/<title>([^<]+)<\/title>/);return t?.[1]?t[1].trim():``}return e}function gt(e){let t=e.message;return t?L(t):``}function _t(e){return typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null}function vt(e){if(!_t(e))return null;let t=e.error,n=t?.error?.message;if(typeof n==`string`&&n.length>0){let e=L(n);if(e.length>0)return e}let r=t?.message;if(typeof r==`string`&&r.length>0){let e=L(r);if(e.length>0)return e}return null}function yt(e){let t=I(e);if(t){let{code:e,isSSLError:n}=t;if(e===`ETIMEDOUT`)return`Request timed out. Check your internet connection and proxy settings`;if(n)switch(e){case`UNABLE_TO_VERIFY_LEAF_SIGNATURE`:case`UNABLE_TO_GET_ISSUER_CERT`:case`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`:return`Unable to connect to API: SSL certificate verification failed. Check your proxy or corporate SSL certificates`;case`CERT_HAS_EXPIRED`:return`Unable to connect to API: SSL certificate has expired`;case`CERT_REVOKED`:return`Unable to connect to API: SSL certificate has been revoked`;case`DEPTH_ZERO_SELF_SIGNED_CERT`:case`SELF_SIGNED_CERT_IN_CHAIN`:return`Unable to connect to API: Self-signed certificate detected. Check your proxy or corporate SSL certificates`;case`ERR_TLS_CERT_ALTNAME_INVALID`:case`HOSTNAME_MISMATCH`:return`Unable to connect to API: SSL certificate hostname mismatch`;case`CERT_NOT_YET_VALID`:return`Unable to connect to API: SSL certificate is not yet valid`;default:return`Unable to connect to API: SSL error (${e})`}}if(e.message===`Connection error.`)return t?.code?`Unable to connect to API (${t.code})`:`Unable to connect to API. Check your internet connection`;if(!e.message)return vt(e)??`API error (status ${e.status??`unknown`})`;let n=gt(e);return n!==e.message&&n.length>0?n:e.message}var bt,xt=e((()=>{bt=new Set([`UNABLE_TO_VERIFY_LEAF_SIGNATURE`,`UNABLE_TO_GET_ISSUER_CERT`,`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`,`CERT_SIGNATURE_FAILURE`,`CERT_NOT_YET_VALID`,`CERT_HAS_EXPIRED`,`CERT_REVOKED`,`CERT_REJECTED`,`CERT_UNTRUSTED`,`DEPTH_ZERO_SELF_SIGNED_CERT`,`SELF_SIGNED_CERT_IN_CHAIN`,`CERT_CHAIN_TOO_LONG`,`PATH_LENGTH_EXCEEDED`,`ERR_TLS_CERT_ALTNAME_INVALID`,`HOSTNAME_MISMATCH`,`ERR_TLS_HANDSHAKE_TIMEOUT`,`ERR_SSL_WRONG_VERSION_NUMBER`,`ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC`])}));function St(e,t,n){let r=[],i=Ct(t);i&&r.push({role:`system`,content:i});for(let t of e)switch(t.type){case`user`:r.push(...wt(t));break;case`assistant`:r.push(...Et(t));break;default:break}return r}function Ct(e){return!e||e.length===0?``:e.filter(Boolean).join(`
|
|
@@ -8,4 +8,4 @@ import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}f
|
|
|
8
8
|
`)})}return t}function Tt(e){let t;return t=typeof e.content==`string`?e.content:Array.isArray(e.content)?e.content.map(e=>typeof e==`string`?e:`text`in e?e.text:``).filter(Boolean).join(`
|
|
9
9
|
`):``,{role:`tool`,tool_call_id:e.tool_use_id,content:t}}function Et(e){let t=e.message.content;if(typeof t==`string`)return[{role:`assistant`,content:t}];if(!Array.isArray(t))return[{role:`assistant`,content:``}];let n=[],r=[],i=[];for(let e of t)if(typeof e==`string`)n.push(e);else if(e.type===`text`)n.push(e.text);else if(e.type===`tool_use`){let t=e;r.push({id:t.id,type:`function`,function:{name:t.name,arguments:typeof t.input==`string`?t.input:JSON.stringify(t.input)}})}else if(e.type===`thinking`){let t=e.thinking;typeof t==`string`&&i.push(t)}return[{role:`assistant`,content:n.length>0?n.join(`
|
|
10
10
|
`):null,...r.length>0&&{tool_calls:r},...i.length>0&&{reasoning_content:i.join(`
|
|
11
|
-
`)}}]}function Dt(e){let t=e.source;return t?t.type===`base64`&&typeof t.data==`string`?{type:`image_url`,image_url:{url:`data:${t.media_type||`image/png`};base64,${t.data}`}}:t.type===`url`&&typeof t.url==`string`?{type:`image_url`,image_url:{url:t.url}}:null:null}var Ot=e((()=>{}));function kt(e){return e.filter(e=>{let t=e.type;return e.type===`custom`||!(`type`in e)||t!==`server`}).map(e=>{let t=e,n=t.name||``,r=t.description||``,i=t.input_schema;return{type:`function`,function:{name:n,description:r,parameters:R(i||{type:`object`,properties:{}})}}})}function R(e){if(!e||typeof e!=`object`)return e;let t={...e};`const`in t&&(t.enum=[t.const],delete t.const);for(let e of[`properties`,`definitions`,`$defs`,`patternProperties`]){let n=t[e];if(n&&typeof n==`object`){let r={};for(let[e,t]of Object.entries(n))r[e]=t&&typeof t==`object`?R(t):t;t[e]=r}}for(let e of[`items`,`additionalProperties`,`not`,`if`,`then`,`else`,`contains`,`propertyNames`]){let n=t[e];n&&typeof n==`object`&&!Array.isArray(n)&&(t[e]=R(n))}for(let e of[`anyOf`,`oneOf`,`allOf`]){let n=t[e];Array.isArray(n)&&(t[e]=n.map(e=>e&&typeof e==`object`?R(e):e))}return t}function At(e){if(!e||typeof e!=`object`)return;let t=e;switch(t.type){case`auto`:return`auto`;case`any`:return`required`;case`tool`:return{type:`function`,function:{name:t.name}};default:return}}var jt=e((()=>{}));async function*Mt(e,t){let n=`msg_${b().replace(/-/g,``).slice(0,24)}`,r=!1,i=-1,a=new Map,o=!1,s=!1,c=0,l=0,u=0,d=0,f=new Set,p=null,m=!1;for await(let h of e){let e=h.choices?.[0],g=e?.delta;if(h.usage){c=h.usage.prompt_tokens??c;let e=h.usage.prompt_tokens_details?.cached_tokens??d;l=Math.max(0,c-e),u=h.usage.completion_tokens??u,d=e}if(r||(r=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:l,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:d}}}),!g)continue;let _=g.reasoning_content;if(_!=null&&(o||(i++,o=!0,f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`thinking`,thinking:``,signature:``}}),_!==``&&(yield{type:`content_block_delta`,index:i,delta:{type:`thinking_delta`,thinking:_}})),g.content!=null&&g.content!==``&&(s||(o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),i++,s=!0,f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`text`,text:``}}),yield{type:`content_block_delta`,index:i,delta:{type:`text_delta`,text:g.content}}),g.tool_calls)for(let e of g.tool_calls){let t=e.index;if(!a.has(t)){o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),s&&(yield{type:`content_block_stop`,index:i},f.delete(i),s=!1),i++;let n=e.id||`toolu_${b().replace(/-/g,``).slice(0,24)}`,r=e.function?.name||``;a.set(t,{contentIndex:i,id:n,name:r,arguments:``}),f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`tool_use`,id:n,name:r,input:{}}}}let n=e.function?.arguments;n&&(a.get(t).arguments+=n,yield{type:`content_block_delta`,index:a.get(t).contentIndex,delta:{type:`input_json_delta`,partial_json:n}})}if(e?.finish_reason){o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),s&&(yield{type:`content_block_stop`,index:i},f.delete(i),s=!1);for(let[,e]of a)f.has(e.contentIndex)&&(yield{type:`content_block_stop`,index:e.contentIndex},f.delete(e.contentIndex));p=e.finish_reason,m=a.size>0}}for(let e of f)yield{type:`content_block_stop`,index:e};p!==null&&(yield{type:`message_delta`,delta:{stop_reason:p===`length`?`max_tokens`:m?`tool_use`:Nt(p),stop_sequence:null},usage:{input_tokens:l,output_tokens:u,cache_read_input_tokens:d,cache_creation_input_tokens:0}},yield{type:`message_stop`})}function Nt(e){switch(e){case`stop`:return`end_turn`;case`tool_calls`:return`tool_use`;case`length`:return`max_tokens`;case`content_filter`:return`end_turn`;default:return`end_turn`}}var Pt=e((()=>{})),Ft=e((()=>{Ae(),Pe(),Be(),Ue(),et(),ut(),mt(),A(),xt(),Ot(),jt(),Pt()}));function It(){let e=s();if(e!==void 0)return e;let t=process.env.CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR;if(!t){let e=
|
|
11
|
+
`)}}]}function Dt(e){let t=e.source;return t?t.type===`base64`&&typeof t.data==`string`?{type:`image_url`,image_url:{url:`data:${t.media_type||`image/png`};base64,${t.data}`}}:t.type===`url`&&typeof t.url==`string`?{type:`image_url`,image_url:{url:t.url}}:null:null}var Ot=e((()=>{}));function kt(e){return e.filter(e=>{let t=e.type;return e.type===`custom`||!(`type`in e)||t!==`server`}).map(e=>{let t=e,n=t.name||``,r=t.description||``,i=t.input_schema;return{type:`function`,function:{name:n,description:r,parameters:R(i||{type:`object`,properties:{}})}}})}function R(e){if(!e||typeof e!=`object`)return e;let t={...e};`const`in t&&(t.enum=[t.const],delete t.const);for(let e of[`properties`,`definitions`,`$defs`,`patternProperties`]){let n=t[e];if(n&&typeof n==`object`){let r={};for(let[e,t]of Object.entries(n))r[e]=t&&typeof t==`object`?R(t):t;t[e]=r}}for(let e of[`items`,`additionalProperties`,`not`,`if`,`then`,`else`,`contains`,`propertyNames`]){let n=t[e];n&&typeof n==`object`&&!Array.isArray(n)&&(t[e]=R(n))}for(let e of[`anyOf`,`oneOf`,`allOf`]){let n=t[e];Array.isArray(n)&&(t[e]=n.map(e=>e&&typeof e==`object`?R(e):e))}return t}function At(e){if(!e||typeof e!=`object`)return;let t=e;switch(t.type){case`auto`:return`auto`;case`any`:return`required`;case`tool`:return{type:`function`,function:{name:t.name}};default:return}}var jt=e((()=>{}));async function*Mt(e,t){let n=`msg_${b().replace(/-/g,``).slice(0,24)}`,r=!1,i=-1,a=new Map,o=!1,s=!1,c=0,l=0,u=0,d=0,f=new Set,p=null,m=!1;for await(let h of e){let e=h.choices?.[0],g=e?.delta;if(h.usage){c=h.usage.prompt_tokens??c;let e=h.usage.prompt_tokens_details?.cached_tokens??d;l=Math.max(0,c-e),u=h.usage.completion_tokens??u,d=e}if(r||(r=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:l,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:d}}}),!g)continue;let _=g.reasoning_content;if(_!=null&&(o||(i++,o=!0,f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`thinking`,thinking:``,signature:``}}),_!==``&&(yield{type:`content_block_delta`,index:i,delta:{type:`thinking_delta`,thinking:_}})),g.content!=null&&g.content!==``&&(s||(o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),i++,s=!0,f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`text`,text:``}}),yield{type:`content_block_delta`,index:i,delta:{type:`text_delta`,text:g.content}}),g.tool_calls)for(let e of g.tool_calls){let t=e.index;if(!a.has(t)){o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),s&&(yield{type:`content_block_stop`,index:i},f.delete(i),s=!1),i++;let n=e.id||`toolu_${b().replace(/-/g,``).slice(0,24)}`,r=e.function?.name||``;a.set(t,{contentIndex:i,id:n,name:r,arguments:``}),f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`tool_use`,id:n,name:r,input:{}}}}let n=e.function?.arguments;n&&(a.get(t).arguments+=n,yield{type:`content_block_delta`,index:a.get(t).contentIndex,delta:{type:`input_json_delta`,partial_json:n}})}if(e?.finish_reason){o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),s&&(yield{type:`content_block_stop`,index:i},f.delete(i),s=!1);for(let[,e]of a)f.has(e.contentIndex)&&(yield{type:`content_block_stop`,index:e.contentIndex},f.delete(e.contentIndex));p=e.finish_reason,m=a.size>0}}for(let e of f)yield{type:`content_block_stop`,index:e};p!==null&&(yield{type:`message_delta`,delta:{stop_reason:p===`length`?`max_tokens`:m?`tool_use`:Nt(p),stop_sequence:null},usage:{input_tokens:l,output_tokens:u,cache_read_input_tokens:d,cache_creation_input_tokens:0}},yield{type:`message_stop`})}function Nt(e){switch(e){case`stop`:return`end_turn`;case`tool_calls`:return`tool_use`;case`length`:return`max_tokens`;case`content_filter`:return`end_turn`;default:return`end_turn`}}var Pt=e((()=>{})),Ft=e((()=>{Ae(),Pe(),Be(),Ue(),et(),ut(),mt(),A(),xt(),Ot(),jt(),Pt()}));function It(){let e=s();if(e!==void 0)return e;let t=process.env.CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR;if(!t){let e=ne(process.env.CLAUDE_SESSION_INGRESS_TOKEN_FILE??y,`session ingress token`);return o(e),e}let n=parseInt(t,10);if(Number.isNaN(n))return f(`CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR must be a valid file descriptor number, got: ${t}`,{level:`error`}),o(null),null;try{let e=_(),t=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${n}`:`/proc/self/fd/${n}`,r=e.readFileSync(t,{encoding:`utf8`}).trim();return r?(f(`Successfully read token from file descriptor ${n}`),o(r),te(y,r,`session ingress token`),r):(f(`File descriptor contained empty token`,{level:`error`}),o(null),null)}catch(e){f(`Failed to read token from file descriptor ${n}: ${u(e)}`,{level:`error`});let t=ne(process.env.CLAUDE_SESSION_INGRESS_TOKEN_FILE??y,`session ingress token`);return o(t),t}}function Lt(){return process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN||It()}function Rt(){let e=Lt();if(!e)return{};if(e.startsWith(`sk-ant-sid`)){let t={Cookie:`sessionKey=${e}`},n=process.env.CLAUDE_CODE_ORGANIZATION_UUID;return n&&(t[`X-Organization-Uuid`]=n),t}return{Authorization:`Bearer ${e}`}}function zt(e){process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN=e}var Bt=e((()=>{a(),re(),m(),d(),p()}));function z(e){l()&&(B.length>=Ut&&B.shift(),B.push(e))}function Vt(){return B.length===0?[]:B.splice(0).map(e=>({...e,uuid:b(),session_id:c()}))}function Ht(e,t,n){z({type:`system`,subtype:`task_notification`,task_id:e,tool_use_id:n?.toolUseId,status:t,output_file:n?.outputFile??``,summary:n?.summary??``,usage:n?.usage})}var Ut,B,Wt=e((()=>{a(),Ut=1e3,B=[]}));function Gt(){V(),q=setInterval(()=>{v(`debug`,`session_keepalive_heartbeat`,{refcount:W}),n(process.env.CLAUDE_CODE_REMOTE_SEND_KEEPALIVES)&&U?.()},H)}function Kt(){V(),U!==null&&(J=setTimeout(()=>{v(`info`,`session_idle_30s`),J=null},H))}function V(){J!==null&&(clearTimeout(J),J=null)}function qt(e){U=e,W>0&&q===null&&Gt()}function Jt(){U=null,q!==null&&(clearInterval(q),q=null),V()}function Yt(){n(process.env.CLAUDE_CODE_REMOTE_SEND_KEEPALIVES)&&U?.()}function Xt(){return U!==null}function Zt(e){W++,G.set(e,(G.get(e)??0)+1),W===1&&(K=Date.now(),U!==null&&q===null&&Gt()),$t||($t=!0,h(async()=>{v(`info`,`session_activity_at_shutdown`,{refcount:W,active:Object.fromEntries(G),oldest_activity_ms:W>0&&K!==null?Date.now()-K:null})}))}function Qt(e){W>0&&W--;let t=(G.get(e)??0)-1;t>0?G.set(e,t):G.delete(e),W===0&&q!==null&&(clearInterval(q),q=null,Kt())}var H,U,W,G,K,q,J,$t,en=e((()=>{g(),ee(),r(),H=3e4,U=null,W=0,G=new Map,K=null,q=null,J=null,$t=!1}));function tn(e){pn=e}function nn(e,t){if(X=e,!e||!t?.replayCurrent)return;let n=cn();Object.keys(n).length!==0&&e(n)}function rn(e){mn=e}function an(e){return e?.enabled===!0?{enabled:!0,phase:e.phase===`standby`||e.phase===`sleeping`?e.phase:null,next_tick_at:typeof e.next_tick_at==`number`?e.next_tick_at:null,sleep_until:typeof e.sleep_until==`number`?e.sleep_until:null}:null}function on(e){return JSON.stringify(e)}function sn(e){let t={...$};for(let n of Object.keys(e)){let r=e[n];if(r===void 0){delete t[n];continue}t[n]=r}$=t}function cn(){let e={...$};return Q?e.automation_state={...Q}:`automation_state`in $&&(e.automation_state=$.automation_state??null),e}function ln(){return hn}function un(e,t){hn=e,pn?.(e,t),e===`requires_action`&&t?(Z=!0,Y({pending_action:t})):Z&&(Z=!1,Y({pending_action:null})),e===`idle`&&Y({task_summary:null}),e!==`idle`&&dn(w()?{enabled:!0,phase:null,next_tick_at:null,sleep_until:null}:null),n(process.env.CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS)&&z({type:`system`,subtype:`session_state_changed`,state:e})}function Y(e){sn(e),X?.(e)}function dn(e){let t=an(e);on(t)!==on(Q)&&(Q=t,sn({automation_state:t}),X?.({automation_state:t}))}function fn(e){mn?.(e)}var pn,X,mn,Z,hn,Q,$,gn=e((()=>{Ce(),r(),Wt(),pn=null,X=null,mn=null,Z=!1,hn=`idle`,Q=null,$={}}));export{ke as $,jt as A,ct as B,Bt as C,Pt as D,Mt as E,ht as F,A as G,Ge as H,xt as I,Be as J,Ue as K,dt as L,Ot as M,I as N,At as O,yt as P,Oe as Q,mt as R,Lt as S,Ft as T,et as U,ut as V,We as W,Pe as X,Le as Y,Me as Z,Vt as _,ae as _t,Y as a,Ce as at,Wt as b,se as bt,nn as c,fe as ct,Xt as d,me as dt,Te as et,qt as f,he as ft,Jt as g,ie as gt,Qt as h,be as ht,fn as i,ve as it,St as j,kt as k,tn as l,pe as lt,Zt as m,xe as mt,gn as n,ue as nt,un as o,ge as ot,Yt as p,_e as pt,He as q,dn as r,de as rt,rn as s,w as st,ln as t,Ee as tt,en as u,le as ut,Ht as v,ce as vt,zt as w,Rt as x,z as y,oe as yt,lt as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Dr as e,Xr as t,br as n}from"./loadAgentsDir-PPiD2Mfq.js";n();export{e as linkSessionToPR,t as recordTranscript};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{La as t,Ta as n,X as r,Z as i,by as a}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{La as t,Ta as n,X as r,Z as i,by as a}from"./loadAgentsDir-PPiD2Mfq.js";import{A as o,w as s}from"./external-CEp-aPkt.js";import{n as c,r as l,t as u}from"./lazySchema-B4D4qJVE.js";import{Wt as d,z as f}from"./state-BPFYBqm1.js";import{c as p,i as m}from"./debug-BQj6h99Q.js";import{s as h,u as g}from"./types-BomO8WUz.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{Q as y}from"./sessionState-BTFowSpR.js";function b(e){let t=[];for(let n of e){if(n.type!==`user`&&n.type!==`assistant`||`isMeta`in n&&n.isMeta||`origin`in n&&n.origin&&n.origin.kind!==`human`)continue;let e=n.message.content;if(typeof e==`string`)t.push(e);else if(Array.isArray(e))for(let n of e)`type`in n&&n.type===`text`&&`text`in n&&t.push(n.text)}let n=t.join(`
|
|
2
2
|
`);return n.length>S?n.slice(-1e3):n}async function x(e,t){let r=e.trim();if(!r)return null;try{let e=n((await i({systemPrompt:y([C]),userPrompt:r,outputFormat:{type:`json_schema`,schema:{type:`object`,properties:{title:{type:`string`}},required:[`title`],additionalProperties:!1}},signal:t,options:{querySource:`generate_session_title`,agents:[],isNonInteractiveSession:f(),hasAppendSystemPrompt:!1,mcpTools:[]}})).message.content),a=w().safeParse(g(e)),o=a.success&&a.data.title.trim()||null;return v(`tengu_session_title_generated`,{success:o!==null}),o}catch(e){return p(`generateSessionTitle failed: ${e}`,{level:`error`}),v(`tengu_session_title_generated`,{success:!1}),null}}var S,C,w,T=e((()=>{l(),d(),_(),r(),m(),h(),u(),t(),a(),S=1e3,C=`Generate a concise, sentence-case title (3-7 words) that captures the main topic or goal of this coding session. The title should be clear enough that the user recognizes the session in a list. Use sentence case: capitalize only the first word and proper nouns.
|
|
3
3
|
|
|
4
4
|
Return JSON with a single "title" field.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DcaKZlRU.js";import{i as r,l as i,n as a}from"./esm-lWlUmoUA.js";import{A as o,Wt as s,pt as c,st as l,z as u}from"./state-BPFYBqm1.js";import{C as d,R as f,S as p,c as m,i as h,x as g}from"./debug-BQj6h99Q.js";import{d as _,h as ee}from"./config-BSkuQZNf.js";import{i as te,t as ne}from"./hash-Tu-My5Vp.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DcaKZlRU.js";import{i as r,l as i,n as a}from"./esm-lWlUmoUA.js";import{A as o,Wt as s,pt as c,st as l,z as u}from"./state-BPFYBqm1.js";import{C as d,R as f,S as p,c as m,i as h,x as g}from"./debug-BQj6h99Q.js";import{d as _,h as ee}from"./config-BSkuQZNf.js";import{i as te,t as ne}from"./hash-Tu-My5Vp.js";import{Pt as re,Tt as ie}from"./model-sviY1inu.js";import{et as ae,ft as oe,rt as se,ut as ce}from"./esm-BI3tFLyy.js";import"path";import"fs";import{createHash as le}from"crypto";import"fs/promises";import{AsyncLocalStorage as ue}from"async_hooks";function de(e){let t=BigInt(58),n=Array(y).fill(v[0]),r=y-1,i=e;for(;i>0n;){let e=Number(i%t);n[r]=v[e],i/=t,r--}return n.join(``)}function fe(e){let t=e.replace(/-/g,``);if(t.length!==32)throw Error(`Invalid UUID hex length: ${t.length}`);return BigInt(`0x${t}`)}function pe(e,t){let n=fe(t);return`${e}_${me}${de(n)}`}var v,me,y,he=e((()=>{v=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,me=`01`,y=22}));function b(e){let n=ge[e],r=process.env[e];return r===void 0?n:t(r)}function x(){let e=_(),t=c(),n={"user.id":e};b(`OTEL_METRICS_INCLUDE_SESSION_ID`)&&(n[`session.id`]=t),b(`OTEL_METRICS_INCLUDE_VERSION`)&&(n[`app.version`]=`0.0.16`);let r=ie();if(r){let e=r.organizationUuid,t=r.emailAddress,i=r.accountUuid;e&&(n[`organization.id`]=e),t&&(n[`user.email`]=t),i&&b(`OTEL_METRICS_INCLUDE_ACCOUNT_UUID`)&&(n[`user.account_uuid`]=i,n[`user.account_id`]=process.env.CLAUDE_CODE_ACCOUNT_TAGGED_ID||pe(`user`,i))}return ce.terminal&&(n[`terminal.type`]=ce.terminal),n}var ge,S=e((()=>{s(),re(),ee(),oe(),n(),he(),ge={OTEL_METRICS_INCLUDE_SESSION_ID:!0,OTEL_METRICS_INCLUDE_VERSION:!1,OTEL_METRICS_INCLUDE_ACCOUNT_UUID:!0}}));function _e(){return t(process.env.OTEL_LOG_USER_PROMPTS)}function ve(e){return _e()?e:`<REDACTED>`}async function C(e,t={}){let n=o();if(!n){w||(w=!0,m(`[3P telemetry] Event dropped (no event logger initialized): ${e}`,{level:`warn`}));return}let r={...x(),"event.name":e,"event.timestamp":new Date().toISOString(),"event.sequence":ye++},i=l();i&&(r[`prompt.id`]=i);let a=process.env.CLAUDE_CODE_WORKSPACE_HOST_PATHS;a&&(r[`workspace.host_paths`]=a.split(`|`));for(let[e,n]of Object.entries(t))n!==void 0&&(r[e]=n);n.emit({body:`claude_code.${e}`,attributes:r})}var ye,w,T=e((()=>{s(),h(),n(),S(),ye=0,w=!1}));function be(){A.clear(),j.clear()}function E(){return t(process.env.ENABLE_BETA_TRACING_DETAILED)&&process.env.BETA_TRACING_ENDPOINT&&u()||!1}function D(e,t=ke){return e.length<=t?{content:e,truncated:!1}:{content:e.slice(0,t)+`
|
|
2
2
|
|
|
3
3
|
[TRUNCATED - Content exceeds 60KB limit]`,truncated:!0}}function O(e){return le(`sha256`).update(e).digest(`hex`).slice(0,12)}function xe(e){return`sp_${O(e)}`}function Se(e){return`msg_${O(d(e.message.content))}`}function k(e){let t=e.trim().match(Ae);return t?.[1]?t[1].trim():null}function Ce(e){let t=[],n=[];for(let r of e){let e=r.message.content;if(typeof e==`string`){let r=k(e);r?n.push(r):t.push(`[USER]\n${e}`)}else if(Array.isArray(e)){for(let r of e)if(r.type===`text`){let e=k(r.text);e?n.push(e):t.push(`[USER]\n${r.text}`)}else if(r.type===`tool_result`){let e=typeof r.content==`string`?r.content:d(r.content),i=k(e);i?n.push(i):t.push(`[TOOL RESULT: ${r.tool_use_id}]\n${e}`)}}}return{contextParts:t,systemReminders:n}}function we(e,t){if(!E())return;let{content:n,truncated:r}=D(`[USER PROMPT]\n${t}`);e.setAttributes({new_context:n,...r&&{new_context_truncated:!0,new_context_original_length:t.length}})}function Te(e,t,n){if(E()){if(t?.systemPrompt){let n=xe(t.systemPrompt),r=t.systemPrompt.slice(0,500);if(e.setAttribute(`system_prompt_hash`,n),e.setAttribute(`system_prompt_preview`,r),e.setAttribute(`system_prompt_length`,t.systemPrompt.length),!A.has(n)){A.add(n);let{content:e,truncated:r}=D(t.systemPrompt);C(`system_prompt`,{system_prompt_hash:n,system_prompt:e,system_prompt_length:String(t.systemPrompt.length),...r&&{system_prompt_truncated:`true`}})}}if(t?.tools)try{let n=p(t.tools).map(e=>{let t=d(e),n=O(t);return{name:typeof e.name==`string`?e.name:`unknown`,hash:n,json:t}});e.setAttribute(`tools`,d(n.map(({name:e,hash:t})=>({name:e,hash:t})))),e.setAttribute(`tools_count`,n.length);for(let{name:e,hash:t,json:r}of n)if(!A.has(`tool_${t}`)){A.add(`tool_${t}`);let{content:n,truncated:i}=D(r);C(`tool`,{tool_name:se(e),tool_hash:t,tool:n,...i&&{tool_truncated:`true`}})}}catch{e.setAttribute(`tools_parse_error`,!0)}if(n&&n.length>0&&t?.querySource){let r=t.querySource,i=j.get(r),a=0;if(i)for(let e=0;e<n.length;e++){let t=n[e];if(t&&Se(t)===i){a=e+1;break}}let o=n.slice(a).filter(e=>e.type===`user`);if(o.length>0){let{contextParts:t,systemReminders:i}=Ce(o);if(t.length>0){let n=t.join(`
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ky as t,jv as n}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ky as t,jv as n}from"./loadAgentsDir-PPiD2Mfq.js";import{A as r,C as i,O as a,w as o}from"./external-CEp-aPkt.js";import{n as s,r as c,t as l}from"./lazySchema-B4D4qJVE.js";import{Wt as u}from"./state-BPFYBqm1.js";import{R as d}from"./debug-BQj6h99Q.js";import{g as f}from"./settings-CvhsRFaT.js";import{h as p}from"./config-BSkuQZNf.js";import{O as m,m as h}from"./git-DplvjXEY.js";import{u as g}from"./oauth-D38aRTUb.js";import{Pt as _,ti as v}from"./model-sviY1inu.js";import"path";import"fs/promises";var y,b=e((()=>{c(),l(),y=s(()=>o({entries:a(r(),r())})),s(()=>o({userId:r(),version:i(),lastModified:r(),checksum:r(),content:y()}))})),x=e((()=>{u(),g(),_(),t(),p(),m(),d(),h(),v(),f(),n(),b()}));export{x as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e,t}from"./memoize-BK3gG5ob.js";import{l as n,o as r,s as i}from"./envUtils-DcaKZlRU.js";import{$S as a,At as o,Dm as s,Dv as c,Em as l,Ev as u,FC as d,Fa as f,HC as p,Ig as ee,Ky as m,La as h,Lg as g,Li as te,Mi as ne,Mm as re,Mn as ie,Nm as ae,Nn as oe,PC as _,QT as se,RC as ce,Sa as le,St as ue,UC as de,VC as fe,Vy as pe,Y_ as me,_v as he,ac as ge,br as v,by as y,cm as b,cv as x,dc as S,di as C,dv as w,eC as T,eE as E,fv as D,gt as O,gv as k,hn as A,ht as j,hv as M,jm as N,jn as P,kv as F,lc as I,lm as L,lv as _e,mn as ve,mv as ye,oc as be,ot as xe,pv as Se,sv as R,uv as Ce,vt as z,vv as we,yv as Te,zC as Ee}from"./loadAgentsDir-PPiD2Mfq.js";import{di as B,fi as De}from"./src-DL3w8VPk2.js";import{B as Oe,Bn as ke,Hn as Ae,Wt as V,it as je,or as Me,pt as Ne,z as H}from"./state-BPFYBqm1.js";import{n as Pe,t as U}from"./cwd-Besi3Os3.js";import{F as Fe,P as Ie,R as W,f as G,u as Le}from"./debug-BQj6h99Q.js";import{Kt as Re,Ln as ze,Rn as Be,Yt as Ve}from"./settings-CvhsRFaT.js";import{h as He,o as Ue}from"./config-BSkuQZNf.js";import{O as We,k as K,l as Ge,m as Ke,n as qe,r as Je}from"./git-DplvjXEY.js";import{o as Ye,s as Xe}from"./log-BlJ7CcKG.js";import{n as q,r as J}from"./analytics-DJobLaWP.js";import{n as Ze,r as Y}from"./startupProfiler-2sjXZkIP.js";import{Jr as Qe,Pt as $e,Yr as et,Zt as tt}from"./model-sviY1inu.js";import{dn as X,mn as nt}from"./prompt-CQmEvnKN.js";import{h as rt,l as it,p as at,u as ot}from"./terminalSetup-JJiXmszo.js";import{ft as st,ut as Z}from"./esm-BI3tFLyy.js";import{c as ct,t as lt}from"./nativeInstaller-N1xiUpCP.js";import{l as ut,s as dt}from"./logoV2Utils-Bkj74dtY.js";import{i as ft,r as pt}from"./runtimeObserver-By59MZKJ.js";import{t as mt}from"./sinks-Bb2i50kz.js";import{writeFile as Q}from"fs/promises";r(),De(),Pe(),We(),Ye(),Ke(),Ve(),He(),$e(),E(),p(),ce(),_(),g(),te(),v(),A(),t(),V(),xe(),me(),nt(),T(),Be(),I(),G(),b(),h(),oe(),Qe(),y(),c(),q(),l(),re(),D(),W();function ht(){return!1}function gt(){return{}}var $;function _t(e,t){let n=0,r=t==null;for(let i of e){if(!r){i.uuid===t&&(r=!0);continue}if(i.type===`assistant`){let e=i.message.content;Array.isArray(e)&&(n+=ze(e,e=>e.type===`tool_use`))}}return n}function vt(e){let t=F(e);if(!Se()){if(!Ce(t))return!1;k()}let n=w(t),r=_t(e,$)>=_e(),i=f(e);if(n&&r||n&&!i){let t=e[e.length-1];return t?.uuid&&($=t.uuid),!0}return!1}async function yt(e){let t=Le(),n=P();await t.mkdir(n,{mode:448});let r=ie();try{await Q(r,``,{encoding:`utf-8`,mode:384,flag:`wx`}),await Q(r,await ae(),{encoding:`utf-8`,mode:384})}catch(e){if(Fe(e)!==`EEXIST`)throw e}e.readFileState.delete(r);let i=await a.call({file_path:r},e),o=``,s=i.data;return s.type===`text`&&(o=s.file.content),J(`tengu_session_memory_file_read`,{content_length:o.length}),{memoryPath:r,currentMemory:o}}var bt=e(()=>{let e=gt();Te({minimumMessageTokensToInit:e.minimumMessageTokensToInit&&e.minimumMessageTokensToInit>0?e.minimumMessageTokensToInit:R.minimumMessageTokensToInit,minimumTokensBetweenUpdate:e.minimumTokensBetweenUpdate&&e.minimumTokensBetweenUpdate>0?e.minimumTokensBetweenUpdate:R.minimumTokensBetweenUpdate,toolCallsBetweenUpdates:e.toolCallsBetweenUpdates&&e.toolCallsBetweenUpdates>0?e.toolCallsBetweenUpdates:R.toolCallsBetweenUpdates})}),xt=et(async e=>{let{messages:t,toolUseContext:n,querySource:r}=e;if(r!==`repl_main_thread`||!ht()||(bt(),!vt(t)))return;M();let i=be(n),{memoryPath:a,currentMemory:o}=await yt(i);await S({promptMessages:[le({content:await N(o,a)})],cacheSafeParams:ge(e),canUseTool:Ct(a),querySource:`session_memory`,forkLabel:`session_memory`,overrides:{readFileState:i.readFileState}});let s=t[t.length-1],c=s?u(s):void 0,l=x();J(`tengu_session_memory_extraction`,{input_tokens:c?.input_tokens,output_tokens:c?.output_tokens,cache_read_input_tokens:c?.cache_read_input_tokens??void 0,cache_creation_input_tokens:c?.cache_creation_input_tokens??void 0,config_min_message_tokens_to_init:l.minimumMessageTokensToInit,config_min_tokens_between_update:l.minimumTokensBetweenUpdate,config_tool_calls_between_updates:l.toolCallsBetweenUpdates}),he(F(t)),wt(t),ye()});function St(){Oe()||s()&&L(xt)}function Ct(e){return async(t,n)=>{if(t.name===`Edit`&&typeof n==`object`&&n&&`file_path`in n){let t=n.file_path;if(typeof t==`string`&&t===e)return{behavior:`allow`,updatedInput:n}}return{behavior:`deny`,message:`only ${X} on ${e} is allowed`,decisionReason:{type:`other`,reason:`only ${X} on ${e} is allowed`}}}}function wt(e){if(!f(e)){let t=e[e.length-1];t?.uuid&&we(t.uuid)}}q(),V(),ft(),ot(),m(),st(),W(),ut(),lt(),at(),Ze(),ue();async function Tt(e,t,r,a,s,c,l,u,f){K(`info`,`setup_started`);let p=process.version.match(/^v(\d+)\./)?.[1];if((!p||parseInt(p,10)<18)&&(console.error(B.bold.red(`Error: Work Mate requires Node.js version 18 or higher.`)),process.exit(1)),l&&Me(ee(l)),!H())try{let e=await it();e.status===`restored`?console.log(B.yellow(`Detected an interrupted Terminal.app setup. Your original settings have been restored. You may need to restart Terminal.app for the changes to take effect.`)):e.status===`failed`&&console.error(B.red(`Failed to restore Terminal.app settings. Please manually restore your original settings with: defaults import com.apple.Terminal ${e.backupPath}.`))}catch(e){Xe(e)}d(e);let m=Date.now();if(fe(),K(`info`,`setup_hooks_captured`,{duration_ms:Date.now()-m}),Ee(e),a){let t=ve(),n=await Ge();!t&&!n&&(process.stderr.write(B.red(`Error: Can only use --worktree in a git repository, but ${B.bold(e)} is not a git repository. Configure a WorktreeCreate hook in settings.json to use --worktree with other VCS systems.\n`)),process.exit(1));let r=u?`pr-${u}`:s??se(),i;if(n){let e=qe(U());e||(process.stderr.write(B.red(`Error: Could not determine the main git repository root.
|
|
2
|
+
`)),process.exit(1)),e!==(Je(U())??U())&&(K(`info`,`worktree_resolved_to_main_repo`),process.chdir(e),d(e)),i=c?z(e,o(r)):void 0}else i=c?z(U(),o(r)):void 0;let a;try{a=await O(Ne(),r,i,u?{prNumber:u}:void 0)}catch(e){process.stderr.write(B.red(`Error creating worktree: ${Ie(e)}\n`)),process.exit(1)}if(J(`tengu_worktree_created`,{tmux_enabled:c}),c&&i){let e=await j(i,a.worktreePath);e.created?console.log(B.green(`Created tmux session: ${B.bold(i)}\nTo attach: ${B.bold(`tmux attach -t ${i}`)}`)):console.error(B.yellow(`Warning: Failed to create tmux session: ${e.error}`))}process.chdir(a.worktreePath),d(a.worktreePath),ke(U()),Ae(U()),C(a),pe(),de()}K(`info`,`setup_background_jobs_starting`),i()||(St(),pt()),ct(),K(`info`,`setup_background_jobs_launched`),Y(`setup_before_prefetch`),K(`info`,`setup_prefetch_starting`);let h=H()&&n(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)||i();if(h||ne(je()),import(`./loadPluginHooks-DUCuU3_8.js`).then(e=>{h||(e.loadPluginHooks(),e.setupPluginHookHotReload())}),i()||import(`./sessionFileAccessHooks-BaWZ8sqn.js`).then(e=>e.registerSessionFileAccessHooks()),mt(),J(`tengu_started`,{}),tt(H()),Y(`setup_after_prefetch`),!i()&&rt()&&await dt(),t===`bypassPermissions`||r){if(process.platform!==`win32`&&typeof process.getuid==`function`&&process.getuid()===0&&process.env.IS_SANDBOX!==`1`&&!n(process.env.CLAUDE_CODE_BUBBLEWRAP))if(process.stdin.isTTY){console.error(B.bold.red(`WARNING: Running as root/sudo with bypass permissions mode is dangerous.`)),console.error(B.yellow(`Bypass mode skips ALL permission checks. Combined with root, any command (rm -rf /, chmod, dd) executes without review.`));let e=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout}),t=await new Promise(t=>{e.question(`
|
|
3
|
+
I understand the risks. Continue? [y/N] `,t)});e.close(),t.trim().toLowerCase()!==`y`&&(console.error(`Aborted.`),process.exit(1))}else console.error(`--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons`),process.exit(1);if(process.env.CLAUDE_CODE_ENTRYPOINT!==`local-agent`&&process.env.CLAUDE_CODE_ENTRYPOINT!==`claude-desktop`){let[e,t]=await Promise.all([Z.getIsDocker(),Re.hasInternetAccess()]),n=Z.getIsBubblewrapSandbox(),r=process.env.IS_SANDBOX===`1`;(!(e||n||r)||t)&&(console.error(`--dangerously-skip-permissions can only be used in Docker/sandbox containers with no internet access but got Docker: ${e}, Bubblewrap: ${n}, IS_SANDBOX: ${r}, hasInternet: ${t}`),process.exit(1))}}let g=Ue();g.lastCost!==void 0&&g.lastDuration!==void 0&&J(`tengu_exit`,{last_session_cost:g.lastCost,last_session_api_duration:g.lastAPIDuration,last_session_tool_duration:g.lastToolDuration,last_session_duration:g.lastDuration,last_session_lines_added:g.lastLinesAdded,last_session_lines_removed:g.lastLinesRemoved,last_session_total_input_tokens:g.lastTotalInputTokens,last_session_total_output_tokens:g.lastTotalOutputTokens,last_session_total_cache_creation_input_tokens:g.lastTotalCacheCreationInputTokens,last_session_total_cache_read_input_tokens:g.lastTotalCacheReadInputTokens,last_session_fps_average:g.lastFpsAverage,last_session_fps_low_1_pct:g.lastFpsLow1Pct,last_session_id:g.lastSessionId,...g.lastSessionMetrics})}export{Tt as setup};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,L as n,R as r,V as i,z as a}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,L as n,R as r,V as i,z as a}from"./loadAgentsDir-PPiD2Mfq.js";import{an as o}from"./prompt-CQmEvnKN.js";function s(e){return e===`projectSettings`||e===`policySettings`||e===`command`}function c(e){return t(e)}function l(e,t,n){let r=c(t.source),i=c(n.source),a=t.ruleValue.toolName;return e===`deny`?`Remove the "${a}" deny rule from ${r}, or remove the specific allow rule from ${i}`:`Remove the "${a}" ask rule from ${r}, or remove the specific allow rule from ${i}`}function u(e,t,n){let{toolName:r,ruleContent:i}=e.ruleValue;if(i===void 0)return{shadowed:!1};let a=t.find(e=>e.ruleValue.toolName===r&&e.ruleValue.ruleContent===void 0);return!a||r===`Bash`&&n.sandboxAutoAllowEnabled&&!s(a.source)?{shadowed:!1}:{shadowed:!0,shadowedBy:a,shadowType:`ask`}}function d(e,t){let{toolName:n,ruleContent:r}=e.ruleValue;if(r===void 0)return{shadowed:!1};let i=t.find(e=>e.ruleValue.toolName===n&&e.ruleValue.ruleContent===void 0);return i?{shadowed:!0,shadowedBy:i,shadowType:`deny`}:{shadowed:!1}}function f(e,t){let i=[],o=n(e),s=r(e),f=a(e);for(let e of o){let n=d(e,f);if(n.shadowed){let t=c(n.shadowedBy.source);i.push({rule:e,reason:`Blocked by "${n.shadowedBy.ruleValue.toolName}" deny rule (from ${t})`,shadowedBy:n.shadowedBy,shadowType:`deny`,fix:l(`deny`,n.shadowedBy,e)});continue}let r=u(e,s,t);if(r.shadowed){let t=c(r.shadowedBy.source);i.push({rule:e,reason:`Shadowed by "${r.shadowedBy.ruleValue.toolName}" ask rule (from ${t})`,shadowedBy:r.shadowedBy,shadowType:`ask`,fix:l(`ask`,r.shadowedBy,e)})}}return i}var p=e((()=>{o(),i()}));export{p as n,f as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{La as t,Sa as n,Ta as r,dc as i,lc as a}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{La as t,Sa as n,Ta as r,dc as i,lc as a}from"./loadAgentsDir-PPiD2Mfq.js";import{P as o,T as s}from"./sessionState-BTFowSpR.js";function c(e){let t=[],n=e.matchAll(d);for(let e of n)e.index!==void 0&&t.push({word:e[0],start:e.index,end:e.index+e[0].length});return t}async function l({question:e,cacheSafeParams:t}){let r=await i({promptMessages:[n({content:`<system-reminder>This is a side question from the user. You must answer this question directly in a single response.
|
|
2
2
|
|
|
3
3
|
IMPORTANT CONTEXT:
|
|
4
4
|
- You are a separate, lightweight agent spawned to answer this one question
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./axios-DaWTGg7G.js";import{Wt as n,pt as r}from"./state-BPFYBqm1.js";import{C as i,at as a,c as o,f as s,i as c,it as l,nt as u,tt as d,u as f,x as p}from"./debug-BQj6h99Q.js";import{o as m,r as h,t as g,v as _,y as v}from"./log-BlJ7CcKG.js";import{i as y,n as b,t as x}from"./analytics-DJobLaWP.js";import{a as S,n as C,o as w}from"./firstPartyEventLogger-
|
|
1
|
+
import{n as e,t}from"./axios-DaWTGg7G.js";import{Wt as n,pt as r}from"./state-BPFYBqm1.js";import{C as i,at as a,c as o,f as s,i as c,it as l,nt as u,tt as d,u as f,x as p}from"./debug-BQj6h99Q.js";import{o as m,r as h,t as g,v as _,y as v}from"./log-BlJ7CcKG.js";import{i as y,n as b,t as x}from"./analytics-DJobLaWP.js";import{a as S,n as C,o as w}from"./firstPartyEventLogger-BMnXb9cv.js";import{r as T,t as E}from"./datadog-Cr0VKbct.js";import{dirname as D,join as O}from"path";t(),n(),a(),v(),d(),c(),s(),m(),p();var k=h(new Date);function A(){return O(_.errors(),`${k}.jsonl`)}function j(e){return O(_.mcpLogs(e),`${k}.jsonl`)}function M(e){let t=l(e);return{write(e){t.write(`${i(e)}\n`)},flush:t.flush,dispose:t.dispose}}var N=new Map;function P(e){let t=N.get(e);if(!t){let n=D(e);t=M({writeFn:t=>{try{f().appendFileSync(e,t)}catch{f().mkdirSync(n),f().appendFileSync(e,t)}},flushIntervalMs:1e3,maxBufferSize:50}),N.set(e,t),u(async()=>t?.dispose())}return t}function F(e,t){let n={timestamp:new Date().toISOString(),...t,cwd:f().cwd(),userType:process.env.USER_TYPE,sessionId:r(),version:`0.0.16`};P(e).write(n)}function I(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e;if(typeof t.message==`string`)return t.message;if(typeof t.error==`object`&&t.error&&`message`in t.error&&typeof t.error.message==`string`)return t.error.message}}function L(t){let n=t.stack||t.message,r=``;if(e.isAxiosError(t)&&t.config?.url){let e=[`url=${t.config.url}`];t.response?.status!==void 0&&e.push(`status=${t.response.status}`);let n=I(t.response?.data);n&&e.push(`body=${n}`),r=`[${e.join(`,`)}] `}o(`${t.name}: ${r}${n}`,{level:`error`}),F(A(),{error:`${r}${n}`})}function R(e,t){o(`MCP server "${e}" ${t}`,{level:`error`});let n=j(e),i={error:t instanceof Error?t.stack||t.message:String(t),timestamp:new Date().toISOString(),sessionId:r(),cwd:f().cwd()};P(n).write(i)}function z(e,t){o(`MCP server "${e}": ${t}`);let n=j(e),i={debug:t,timestamp:new Date().toISOString(),sessionId:r(),cwd:f().cwd()};P(n).write(i)}function B(){g({logError:L,logMCPError:R,logMCPDebug:z,getErrorsPath:A,getMCPLogsPath:j}),o(`Error log sink initialized`)}E(),C(),b();function V(){return!1}function H(e,t){let n=w(e);if(n===0)return;let r=n===null?t:{...t,sample_rate:n};V()&&T(e,y(r)),S(e,r)}function U(e,t){return H(e,t),Promise.resolve()}function W(){x({logEvent:H,logEventAsync:U})}function G(){B(),W()}export{G as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./sinks-Bb2i50kz.js";export{e as initSinks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$T as e,Di as t,Ds as n,Ei as r,FC as i,GT as a,Ig as ee,KT as o,Ky as te,Lg as ne,Li as s,Nt as re,Ny as ie,Os as ae,Ot as c,PC as l,Py as oe,QS as se,Rn as u,St as d,Th as f,Vy as p,Wr as m,Xi as ce,Yi as h,ZS as le,Zi as ue,a_ as de,bc as fe,bg as pe,br as me,ci as he,di as g,eE as ge,eh as _e,fn as ve,hc as _,hn as v,i_ as y,ni as b,qi as x,th as S,ti as C,vg as w,yt as T}from"./loadAgentsDir-PPiD2Mfq.js";import{Bn as E,J as D,Mn as O,Nn as k,Wt as A,h as j,lr as M,or as N,pt as P,ur as F}from"./state-BPFYBqm1.js";import{n as ye,t as I}from"./cwd-Besi3Os3.js";import{c as L,f as be,i as R,nt as xe,tt as Se,u as Ce}from"./debug-BQj6h99Q.js";import{n as we,r as Te}from"./analytics-DJobLaWP.js";import{C as Ee,_ as De}from"./model-sviY1inu.js";import{Gt as Oe}from"./prompt-CQmEvnKN.js";import*as z from"path";import{dirname as ke}from"path";A(),de(),ie(),Oe(),ne(),te(),f(),_(),ye(),R(),pe(),De(),ge(),l(),me(),le(),S(),d();function Ae(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.type!==`assistant`)continue;let r=n.message.content.find(e=>e.type===`tool_use`&&e.name===`TodoWrite`);if(r?.type!==`tool_use`)continue;let i=r.input;if(typeof i!=`object`||!i)return[];let a=_e().safeParse(i.todos);return a.success?a.data:[]}return[]}function je(e,t){if(e.fileHistorySnapshots&&e.fileHistorySnapshots.length>0&&w(e.fileHistorySnapshots,e=>{t(t=>({...t,fileHistory:e}))}),!se()&&e.messages&&e.messages.length>0){let n=Ae(e.messages);if(n.length>0){let e=P();t(t=>({...t,todos:{...t.todos,[e]:n}}))}}}function B(e,t){if(!(!e&&!t))return{name:e??``,color:t==="default"?void 0:t}}function V(e,t,n){if(t)return{agentDefinition:t,agentType:void 0};if(!e)return k(void 0),{agentDefinition:void 0,agentType:void 0};let r=n.activeAgents.find(t=>t.agentType===e);return r?(k(r.agentType),!D()&&r.model&&r.model!==`inherit`&&O(Ee(r.model)),{agentDefinition:r,agentType:r.agentType}):(L(`Resumed session had agent "${e}" but it is no longer available. Using default behavior.`),k(void 0),{agentDefinition:void 0,agentType:void 0})}function H(t){let n=T();if(n){g(n);return}if(t){try{process.chdir(t.worktreePath)}catch{g(null);return}i(t.worktreePath),E(I()),c(t),p(),y(),e.cache.clear?.()}}function Me(){let t=T();if(t){c(null),p(),y(),e.cache.clear?.();try{process.chdir(t.originalCwd)}catch{return}i(t.originalCwd),E(I())}}async function Ne(e,t,n){if(t.forkSession)e.contentReplacements?.length&&await m(e.contentReplacements);else{let n=t.sessionIdOverride??e.sessionId;n&&(N(ee(n),t.transcriptPath?ke(t.transcriptPath):null),await C(),oe(n))}b(t.forkSession?{...e,worktreeSession:void 0}:e),t.forkSession||(H(e.worktreeSession),u());let{agentDefinition:r,agentType:i}=V(e.agentSetting,n.mainThreadAgentDefinition,n.agentDefinitions);he(`normal`),t.includeAttribution;let a=B(e.agentName,e.agentColor);fe(e.agentName);let o=n.agentDefinitions;return{messages:e.messages,fileHistorySnapshots:e.fileHistorySnapshots,contentReplacements:e.contentReplacements,agentName:e.agentName,agentColor:e.agentColor==="default"?void 0:e.agentColor,restoredAgentDef:r,initialState:{...n.initialState,...i&&{agent:i},...a&&{standaloneAgentContext:a},agentDefinitions:o}}}o(),A(),s(),we(),ce(),n(),Se(),R(),be(),v(),F();var Pe=1e3,Fe=500,Ie=300,Le=2e3,Re=typeof Bun<`u`,U=null,W=null,G=new Set,K=!1,q=!1,J=!1,Y=null,X=M(),Z=null;async function ze(){if(K||q)return;K=!0,J||(J=!0,ue(()=>{r(),X.emit()}));let e=await Ve();e.length!==0&&(L(`Watching for changes in skill/command directories: ${e.join(`, `)}...`),U=a.watch(e,{persistent:!0,ignoreInitial:!0,depth:2,awaitWriteFinish:{stabilityThreshold:Z?.stabilityThreshold??Pe,pollInterval:Z?.pollInterval??Fe},ignored:(e,t)=>t&&!t.isFile()&&!t.isDirectory()?!0:e.split(z.sep).some(e=>e===`.git`),ignorePermissionErrors:!0,usePolling:Re,interval:Z?.chokidarInterval??Le,atomic:!0}),U.on(`add`,$),U.on(`change`,$),U.on(`unlink`,$),Y=xe(async()=>{await Q()}))}function Q(){q=!0,Y&&(Y(),Y=null);let e=Promise.resolve();return U&&(e=U.close(),U=null),W&&(clearTimeout(W),W=null),G.clear(),X.clear(),e}var Be=X.subscribe;async function Ve(){let e=Ce(),t=[],n=h(`userSettings`,`skills`);if(n)try{await e.stat(n),t.push(n)}catch{}let r=h(`userSettings`,`commands`);if(r)try{await e.stat(r),t.push(r)}catch{}let i=h(`projectSettings`,`skills`);if(i)try{let n=z.resolve(i);await e.stat(n),t.push(n)}catch{}let a=h(`projectSettings`,`commands`);if(a)try{let n=z.resolve(a);await e.stat(n),t.push(n)}catch{}for(let n of j()){let r=z.join(n,`.workmate`,`skills`);try{await e.stat(r),t.push(r)}catch{}}return t}function $(e){L(`Detected skill change: ${e}`),Te(`tengu_skill_file_changed`,{source:`chokidar`}),He(e)}function He(e){G.add(e),W&&clearTimeout(W),W=setTimeout(async()=>{W=null;let e=[...G];if(G.clear(),ve(await re(`skills`,e[0]))){L(`ConfigChange hook blocked skill reload (${e.length} paths)`);return}x(),t(),ae(),X.emit()},Z?.reloadDebounce??Ie)}async function Ue(e){U&&(await U.close(),U=null),W&&(clearTimeout(W),W=null),G.clear(),X.clear(),K=!1,q=!1,Z=e??null}var We={initialize:ze,dispose:Q,subscribe:Be,resetForTesting:Ue};export{V as a,Ne as i,B as n,je as o,Me as r,H as s,We as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,n,s as r}from"./projectContext-BN2ZWzOG.js";import{i,r as a}from"./instinctParser-Dt-lqnDe.js";import{c as o,o as s,s as c}from"./skillLifecycle-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,n,s as r}from"./projectContext-BN2ZWzOG.js";import{i,r as a}from"./instinctParser-Dt-lqnDe.js";import{c as o,o as s,s as c}from"./skillLifecycle-CG2XmS8f.js";import{dirname as l,join as u}from"node:path";import{existsSync as d}from"node:fs";import{createHash as f}from"node:crypto";import{mkdir as p,readFile as m,rename as h,writeFile as g}from"node:fs/promises";async function _(e){let t=e.prompt.trim();if(!t)throw Error(`Cannot record an empty skill gap`);let n=e.project??r(e.cwd),i=await A(n,e.rootDir),a=F(t),o=new Date().toISOString(),s=i.gaps[a],c={key:a,prompt:t,count:(s?.count??0)+1,draftHits:s?.draftHits??0,draftHitSessions:s?.draftHitSessions??[],status:s?.status??`pending`,sessionId:e.sessionId??`unknown-session`,cwd:e.cwd??n.cwd,projectId:n.projectId,projectName:n.projectName,recommendations:(e.recommendations??[]).slice(0,5).map(e=>({name:e.name,description:e.description,score:e.score})),createdAt:s?.createdAt??o,updatedAt:o,draft:s?.draft,active:s?.active};return c.status===`rejected`?(i.gaps[a]=c,await N(n,i,e.rootDir),c):(!c.draft&&C(c)&&(c.draft=await T(c,n),c.status=`draft`,await z()),c.draft&&!c.active&&w(c)&&(c.active=await E(c,n),c.status=`active`,await z()),i.gaps[a]=c,await N(n,i,e.rootDir),c)}async function v(e=r(),t){let n=await A(e,t);return Object.values(n.gaps).sort((e,t)=>e.key.localeCompare(t.key))}async function y(e,t=r(),n){let i=await A(t,n);for(let t of Object.values(i.gaps))if(t.draft?.skillPath===e)return t.key}async function b(e,t=r(),n,i=`unknown-session`){let a=await A(t,n),o=a.gaps[e];if(!o?.draft||o.active)return o;let s=o.draftHitSessions??[];if(s.includes(i))return o;let c=new Date().toISOString(),l={...o,draftHits:o.draftHits+1,draftHitSessions:[...s,i],updatedAt:c};return w(l)&&(l.active=await E(l,t),l.status=`active`,await z()),a.gaps[e]=l,await N(t,a,n),l}async function x(e,t=r(),n){let i=await A(t,n),a=i.gaps[e];if(!a)return;if(a.status===`rejected`||a.draft)return a;let o={...a,draft:await T(a,t),status:`draft`,updatedAt:new Date().toISOString()};return i.gaps[e]=o,await N(t,i,n),await z(),o}async function S(e,t=r(),n){let i=await A(t,n),a=i.gaps[e];if(!a)return;let o={...a,status:`rejected`,updatedAt:new Date().toISOString()};return i.gaps[e]=o,await N(t,i,n),o}function C(e){return e.count>=B}function w(e){return e.draft?e.count>=V||e.draftHits>=H:!1}async function T(e,t){let n=D(e,`pending`),r=u(t.projectRoot??t.cwd,`.workmate`,`skills`,`.drafts`),i=s([n],{cwd:t.projectRoot??t.cwd,outputRoot:r,scope:`project`,name:`draft-${I(e.prompt)}`,description:`Draft learned skill candidate. Promote after repeated evidence or explicit user correction.`}),a=u(i.outputPath,`SKILL.md`);return d(a)||await o({...i,content:i.content+`
|
|
2
2
|
## Promotion Rule
|
|
3
3
|
|
|
4
4
|
Do not move this draft into active skills until the same gap repeats or the user explicitly confirms this should become reusable.
|
|
5
|
-
`}),{type:`draft`,name:i.name,skillPath:a}}async function E(e,t){let n=s([D(e,`active`)],{cwd:t.projectRoot??t.cwd,scope:`project`,name:I(e.prompt),description:O(e.prompt)}),r=u(n.outputPath,`SKILL.md`);return d(r)||await o(n),{type:`active`,name:n.name,skillPath:r}}function D(e,t){return a({trigger:`When the user asks for ${L(e.prompt,120)}`,action:O(e.prompt),confidence:t===`active`?.82:.55,domain:k(e.prompt),source:`session-observation`,scope:`project`,projectId:e.projectId,projectName:e.projectName,evidence:[`Skill gap prompt: ${L(e.prompt,180)}`,`No high-confidence active skill was auto-loaded.`,`Observed ${e.count} time(s).`],status:t})}function O(e){return/feature\s*\(|feature flag|flag_name|stub|no-op|noop|最小实现/i.test(e)?`Audit feature flags by scanning feature() call sites, excluding generated/dependency noise, classifying each candidate as stub, shell, MVP, or thin-toggle, and writing an evidence-backed document.`:/skill|技能|学习|进化|evolve|learning/i.test(e)?`Run skill discovery first; auto-load only high-confidence matching skills; record a skill gap when none match; promote repeated or corrected gaps into learned skills.`:/test|测试|stub|调用链|参数/i.test(e)?`Infer tests from existing files, parameters, exports, and call chains before simplifying mocks or inventing behavior.`:`Reuse the workflow learned from this prompt: ${L(e,180)}.`}function k(e){let t=e.toLowerCase();return/test|测试|stub|fixture|断言/.test(t)?`testing`:/error|bug|fix|失败|错误|修复|debug/.test(t)?`debugging`:/security|安全|漏洞|secret|token/.test(t)?`security`:/git|commit|branch|pr\b/.test(t)?`git`:/style|lint|format|命名|规范/.test(t)?`code-style`:`workflow`}async function A(e,t){let n=P(e,t),r;try{r=await m(n,`utf8`)}catch(e){if(e.code===`ENOENT`)return{version:1,gaps:{}};throw e}try{return j(JSON.parse(r))}catch{let e=`${n}.corrupt-${Date.now()}`;try{await g(e,r,`utf8`)}catch{}return{version:1,gaps:{}}}}function j(e){let t={};for(let[n,r]of Object.entries(e.gaps??{})){let e=r,i=typeof e.draftHits==`number`&&Number.isFinite(e.draftHits)?e.draftHits:0,a=typeof e.count==`number`?e.count:1,o=M(e.status),s=!!e.draft,c=!!e.active,l=o;l===`draft`&&a<B&&!s&&(l=`pending`),l===`active`&&!c&&(l=s?`draft`:`pending`);let u=Array.isArray(e.draftHitSessions)?e.draftHitSessions.filter(e=>typeof e==`string`):[];t[n]={...r,count:a,draftHits:i,draftHitSessions:u,status:l}}return{version:1,gaps:t}}function M(e){return e===`pending`||e===`draft`||e===`active`||e===`rejected`?e:`pending`}async function N(e,t,n){let r=P(e,n);await p(l(r),{recursive:!0});let i=`${r}.tmp-${process.pid}-${Date.now()}`;await g(i,`${JSON.stringify(t,null,2)}\n`,`utf8`),await h(i,r)}function P(e,t){return u(t?e.projectId===`global`?u(t,`global`):u(t,`projects`,e.projectId):n(e.projectId),`skill-gaps.json`)}function F(e){return`${I(e)}-${R(e).slice(0,8)}`}function I(e){let t=e.replaceAll(`技能`,` skill `).replaceAll(`学习`,` learning `).replaceAll(`进化`,` evolution `).replaceAll(`测试`,` testing `).replaceAll(`最小实现`,` minimal implementation `).toLowerCase(),n=new Set([`the`,`and`,`for`,`with`,`this`,`that`,`user`,`about`,`feature`,`flag`,`name`]);return((t.match(/[a-z0-9][a-z0-9_-]{2,}/g)??[]).filter(e=>!n.has(e)).slice(0,5).join(`-`)||`learned-gap`).slice(0,54).replace(/-+$/g,``)}function L(e,t){return e.replace(/\s+/g,` `).trim().slice(0,t)}function R(e){return f(`sha1`).update(e).digest(`hex`)}async function z(){try{let{clearCommandsCache:e}=await import(`./commands-
|
|
5
|
+
`}),{type:`draft`,name:i.name,skillPath:a}}async function E(e,t){let n=s([D(e,`active`)],{cwd:t.projectRoot??t.cwd,scope:`project`,name:I(e.prompt),description:O(e.prompt)}),r=u(n.outputPath,`SKILL.md`);return d(r)||await o(n),{type:`active`,name:n.name,skillPath:r}}function D(e,t){return a({trigger:`When the user asks for ${L(e.prompt,120)}`,action:O(e.prompt),confidence:t===`active`?.82:.55,domain:k(e.prompt),source:`session-observation`,scope:`project`,projectId:e.projectId,projectName:e.projectName,evidence:[`Skill gap prompt: ${L(e.prompt,180)}`,`No high-confidence active skill was auto-loaded.`,`Observed ${e.count} time(s).`],status:t})}function O(e){return/feature\s*\(|feature flag|flag_name|stub|no-op|noop|最小实现/i.test(e)?`Audit feature flags by scanning feature() call sites, excluding generated/dependency noise, classifying each candidate as stub, shell, MVP, or thin-toggle, and writing an evidence-backed document.`:/skill|技能|学习|进化|evolve|learning/i.test(e)?`Run skill discovery first; auto-load only high-confidence matching skills; record a skill gap when none match; promote repeated or corrected gaps into learned skills.`:/test|测试|stub|调用链|参数/i.test(e)?`Infer tests from existing files, parameters, exports, and call chains before simplifying mocks or inventing behavior.`:`Reuse the workflow learned from this prompt: ${L(e,180)}.`}function k(e){let t=e.toLowerCase();return/test|测试|stub|fixture|断言/.test(t)?`testing`:/error|bug|fix|失败|错误|修复|debug/.test(t)?`debugging`:/security|安全|漏洞|secret|token/.test(t)?`security`:/git|commit|branch|pr\b/.test(t)?`git`:/style|lint|format|命名|规范/.test(t)?`code-style`:`workflow`}async function A(e,t){let n=P(e,t),r;try{r=await m(n,`utf8`)}catch(e){if(e.code===`ENOENT`)return{version:1,gaps:{}};throw e}try{return j(JSON.parse(r))}catch{let e=`${n}.corrupt-${Date.now()}`;try{await g(e,r,`utf8`)}catch{}return{version:1,gaps:{}}}}function j(e){let t={};for(let[n,r]of Object.entries(e.gaps??{})){let e=r,i=typeof e.draftHits==`number`&&Number.isFinite(e.draftHits)?e.draftHits:0,a=typeof e.count==`number`?e.count:1,o=M(e.status),s=!!e.draft,c=!!e.active,l=o;l===`draft`&&a<B&&!s&&(l=`pending`),l===`active`&&!c&&(l=s?`draft`:`pending`);let u=Array.isArray(e.draftHitSessions)?e.draftHitSessions.filter(e=>typeof e==`string`):[];t[n]={...r,count:a,draftHits:i,draftHitSessions:u,status:l}}return{version:1,gaps:t}}function M(e){return e===`pending`||e===`draft`||e===`active`||e===`rejected`?e:`pending`}async function N(e,t,n){let r=P(e,n);await p(l(r),{recursive:!0});let i=`${r}.tmp-${process.pid}-${Date.now()}`;await g(i,`${JSON.stringify(t,null,2)}\n`,`utf8`),await h(i,r)}function P(e,t){return u(t?e.projectId===`global`?u(t,`global`):u(t,`projects`,e.projectId):n(e.projectId),`skill-gaps.json`)}function F(e){return`${I(e)}-${R(e).slice(0,8)}`}function I(e){let t=e.replaceAll(`技能`,` skill `).replaceAll(`学习`,` learning `).replaceAll(`进化`,` evolution `).replaceAll(`测试`,` testing `).replaceAll(`最小实现`,` minimal implementation `).toLowerCase(),n=new Set([`the`,`and`,`for`,`with`,`this`,`that`,`user`,`about`,`feature`,`flag`,`name`]);return((t.match(/[a-z0-9][a-z0-9_-]{2,}/g)??[]).filter(e=>!n.has(e)).slice(0,5).join(`-`)||`learned-gap`).slice(0,54).replace(/-+$/g,``)}function L(e,t){return e.replace(/\s+/g,` `).trim().slice(0,t)}function R(e){return f(`sha1`).update(e).digest(`hex`)}async function z(){try{let{clearCommandsCache:e}=await import(`./commands-BKLsl6gK.js`);e()}catch{}}var B,V,H;e((()=>{i(),t(),c(),B=2,V=4,H=2}))();export{y as findGapKeyByDraftPath,x as promoteGapToDraft,v as readSkillGaps,b as recordDraftHit,_ as recordSkillGap,S as rejectSkillGap,w as shouldPromoteToActive,C as shouldPromoteToDraft};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DcaKZlRU.js";import{o as r,t as i}from"./localSearch-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DcaKZlRU.js";import{o as r,t as i}from"./localSearch-Cvs9WfoX.js";import{l as a,u as o}from"./instinctParser-Dt-lqnDe.js";import{basename as s,dirname as c,join as l}from"node:path";import{existsSync as u}from"node:fs";import{mkdir as d,readFile as f,readdir as p,rename as m,rm as ee,writeFile as h}from"node:fs/promises";function g(e){return e.length!==0&&e.reduce((e,t)=>e+t.confidence,0)/e.length>=a().minConfidence}function te(e){let t=e[0]?.domain??`project`,n=b[t],r=new Set;for(let t of e){for(let e of`${t.trigger} ${t.action}`.toLowerCase().split(/[^a-z0-9]+/))if(y(e)&&r.add(e),r.size>=5)break;if(r.size>=5)break}let i=_([n,...r].join(`-`));return v(i)?`${n}-learned-pattern`:i}function _(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,64).replace(/-$/g,``)||`learned-skill`}function v(e){return x.has(e)}function y(e){return e.length>2&&![`when`,`with`,`this`,`that`,`user`,`project`,`prefer`,`avoid`,`use`,`using`,`the`,`and`,`for`].includes(e)}var b,x,S=e((()=>{o(),b={workflow:`workflow`,testing:`testing`,debugging:`debugging`,"code-style":`style`,security:`security`,git:`git`,project:`project`},x=new Set([`learned-skill`,`better-skill`,`new-skill`,`project-skill`,`workflow-skill`])}));function C(e,t){if(e.length===0)throw Error(`Cannot generate a skill draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=t?.name?_(t.name):E(e),i=e.reduce((e,t)=>e+t.confidence,0)/e.length,a=t?.description??D(e),o=re(r,n,t),s=O({name:r,description:a,confidence:i,instincts:e});return{name:r,description:a,scope:n,sourceInstinctIds:e.map(e=>e.id),confidence:Number(i.toFixed(2)),content:s,outputPath:o}}async function w(e,t,n){let r=C(e,t),i=await P(`skill`,r,n);for(let t of i){let n=ie(r,t);if(n>=.8)return{action:`append-evidence`,target:t,overlap:n,appendedPath:await ne(t,e)}}return{action:`create`,draft:r}}async function ne(e,t){let n=await f(e.path,`utf8`).catch(()=>e.content);if(Buffer.byteLength(n,`utf8`)>=M)return e.path;let r=t.flatMap(e=>e.evidence.map(e=>`- ${e}`)),a=r.slice(0,A);a.length<r.length&&a.push(`- [... ${r.length-a.length} more evidence entries omitted]`);let o=[``,`## Learned evidence (${new Date().toISOString()})`,``,...a,``].join(`
|
|
2
2
|
`),s=n.endsWith(`
|
|
3
|
-
`)?n+o:`${n}\n${o}`,c=Buffer.byteLength(s,`utf8`)>M?s.slice(0,M):s;return await h(e.path,c,`utf8`),i(),e.path}async function T(e){await d(e.outputPath,{recursive:!0});let t=l(e.outputPath,`SKILL.md`);await h(t,e.content,`utf8`),i();try{let{clearCommandsCache:e}=await import(`./commands-
|
|
3
|
+
`)?n+o:`${n}\n${o}`,c=Buffer.byteLength(s,`utf8`)>M?s.slice(0,M):s;return await h(e.path,c,`utf8`),i(),e.path}async function T(e){await d(e.outputPath,{recursive:!0});let t=l(e.outputPath,`SKILL.md`);await h(t,e.content,`utf8`),i();try{let{clearCommandsCache:e}=await import(`./commands-BKLsl6gK.js`);e()}catch{}return t}function re(e,n,r){return r?.outputRoot?l(r.outputRoot,e):n===`project`?l(r?.cwd??process.cwd(),`.workmate`,`skills`,e):l(r?.globalSkillsDir??l(t(),`skills`),e)}function E(e){return te(e)}function D(e){let t=(e[0]?.action??`Apply a learned project pattern`).replace(/\s+/g,` `).slice(0,120);return t.length>0?t:`Apply learned project patterns`}function O(e){let{name:t,description:n,confidence:r,instincts:i}=e;return[`---`,`name: ${t}`,`description: ${JSON.stringify(n)}`,`origin: skill-learning`,`confidence: ${Number(r.toFixed(2))}`,`evolved_from: [${i.map(e=>JSON.stringify(e.id)).join(`, `)}]`,`---`,``,`# ${k(t)}`,``,`## Trigger`,``,i.map(e=>`- ${e.trigger}`).join(`
|
|
4
4
|
`),``,`## Action`,``,i.map(e=>`- ${e.action}`).join(`
|
|
5
5
|
`),``,`## Evidence`,``,i.flatMap(e=>e.evidence.map(e=>`- ${e}`)).slice(0,j).join(`
|
|
6
6
|
`),``].join(`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
2
|
-
`)}async function m(){if(
|
|
3
|
-
`)}async function h(){return
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{MT as n,ad as r,jT as i,nd as a}from"./loadAgentsDir-PPiD2Mfq.js";import{I as o,P as s,ai as c,hn as l,t as u,y as d}from"./src-DL3w8VPk2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";function p(){return[`Skill Search (自动技能匹配)`,`Status: ${n()?`enabled`:`disabled`}`,``,`When enabled, relevant skills are automatically matched and`,`injected into conversation context each turn.`].join(`
|
|
2
|
+
`)}async function m(){if(n()&&process.env.SKILL_SEARCH_ENABLED!==`0`)return`Skill Search: already enabled`;process.env.SKILL_SEARCH_ENABLED=`1`;let e=[`Skill Search: enabled (SKILL_SEARCH_ENABLED=1)`];try{let{clearSkillIndexCache:t}=await import(`./localSearch-CDk_stXJ.js`);t(),e.push(`Skill index cache: cleared (will rebuild on next search)`)}catch{e.push(`Skill index cache: clear skipped`)}return e.join(`
|
|
3
|
+
`)}async function h(){return n()?(process.env.SKILL_SEARCH_ENABLED=`0`,`Skill Search: disabled (SKILL_SEARCH_ENABLED=0)`):`Skill Search: already disabled`}function g({onDone:e}){r(`skill-search-panel`);let[t,n]=(0,v.useState)(0),i=(0,v.useMemo)(()=>[{label:`Status`,description:`显示自动 skill 匹配是否已启用`,run:()=>Promise.resolve(p())},{label:`Start`,description:`为本次会话启用自动 skill 匹配`,run:m},{label:`Stop`,description:`为本次会话禁用自动 skill 匹配`,run:h},{label:`About`,description:`自动 skill 匹配的工作原理`,run:()=>Promise.resolve(x)}],[]),a=()=>{let n=i[t];n&&n.run().then(t=>{e(t,{display:`system`})})};return l((e,t)=>{if(t.upArrow){n(e=>Math.max(0,e-1));return}if(t.downArrow){n(e=>Math.min(i.length-1,e+1));return}t.return&&a()}),(0,y.jsx)(d,{title:`Skill Search`,subtitle:`${i.length} actions`,onCancel:()=>e(`Skill search panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,y.jsxs)(o,{flexDirection:`column`,children:[i.map((e,n)=>(0,y.jsxs)(o,{flexDirection:`row`,children:[(0,y.jsx)(s,{children:`${n===t?`›`:` `} ${e.label}`.padEnd(b)}),(0,y.jsx)(s,{dimColor:!0,children:e.description})]},e.label)),(0,y.jsx)(o,{marginTop:1,children:(0,y.jsx)(s,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function _(e,t,n){let r=n?.trim()??``;return r===`start`?(e(await m(),{display:`system`}),null):r===`stop`?(e(await h(),{display:`system`}),null):r===`about`?(e(x,{display:`system`}),null):r===`status`?(e(p(),{display:`system`}),null):(0,y.jsx)(g,{onDone:e})}var v,y,b,x;e((()=>{v=t(c(),1),u(),a(),i(),y=f(),b=28,x=`# Skill Search (自动技能匹配)
|
|
4
4
|
|
|
5
5
|
Skill Search 控制对话中的自动技能匹配功能。
|
|
6
6
|
|
|
@@ -17,5 +17,5 @@ Skill Search 控制对话中的自动技能匹配功能。
|
|
|
17
17
|
- /skill-search stop — 禁用自动匹配
|
|
18
18
|
- /skill-search status — 查看当前状态
|
|
19
19
|
|
|
20
|
-
当前状态: ${
|
|
20
|
+
当前状态: ${n()?`已启用`:`未启用`}
|
|
21
21
|
`}))();export{_ as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Dp as n,Ji as r,Li as i,Op as a,Xi as o,zi as s}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Dp as n,Ji as r,Li as i,Op as a,Xi as o,zi as s}from"./loadAgentsDir-PPiD2Mfq.js";import{I as c,P as l,ai as u,h as d,t as f,y as p}from"./src-DL3w8VPk2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{ln as h,sn as g}from"./settings-CvhsRFaT.js";import{_,v}from"./startupProfiler-2sjXZkIP.js";import{l as y,o as b}from"./stringUtils-BjnclTLB.js";function x(e,t){let n=t.trim();if(n===``)return e.slice();let r=n.toLowerCase().split(/\s+/);return e.filter(e=>{let t=`${e.name} ${e.description}`.toLowerCase();return r.every(e=>t.includes(e))})}var S=e((()=>{}));function C(e){return e===`plugin`?`plugin`:e===`mcp`?`mcp`:g(e)}function w({onExit:e,commands:t}){let[i,a]=(0,T.useState)(``),o=(0,T.useMemo)(()=>t.filter(e=>e.type===`prompt`&&(e.loadedFrom===`skills`||e.loadedFrom===`commands_DEPRECATED`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)),[t]),u=(0,T.useMemo)(()=>x(o.map(e=>({...e,name:s(e),description:e.description??``})),i),[o,i]),f=(0,T.useMemo)(()=>{let e={policySettings:[],userSettings:[],projectSettings:[],localSettings:[],flagSettings:[],plugin:[],mcp:[]};for(let t of u){let n=t.source;n in e&&e[n].push(t)}for(let t of Object.values(e))t.sort((e,t)=>s(e).localeCompare(s(t)));return e},[u]),m=()=>{e(`Skills dialog dismissed`,{display:`system`})};if(o.length===0)return(0,E.jsxs)(p,{title:`Skills`,subtitle:`No skills found`,onCancel:m,hideInputGuide:!0,children:[(0,E.jsx)(l,{dimColor:!0,children:`Create skills in .workmate/skills/ or ~/.workmate/skills/`}),(0,E.jsx)(l,{dimColor:!0,italic:!0,children:(0,E.jsx)(n,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`close`})})]});let h=e=>{switch(e){case`projectSettings`:case`localSettings`:return{label:`local`,color:`yellow`};case`userSettings`:return{label:`global`,color:`cyan`};case`policySettings`:return{label:`managed`,color:`magenta`};default:return}},g=(e,t)=>{let n=`~${_(r(e))}`,i=e.source===`plugin`?e.pluginInfo?.pluginManifest.name:void 0,a=h(e.source);return(0,E.jsxs)(c,{children:[(0,E.jsx)(l,{color:t?`suggestion`:void 0,children:s(e)}),a&&(0,E.jsxs)(l,{color:a.color,children:[` [`,a.label,`]`]}),(0,E.jsxs)(l,{dimColor:!0,children:[i?` · ${i}`:``,` · `,C(e.source),` · `,n,` tokens`]})]})};return(0,E.jsx)(d,{title:`Skills`,placeholder:`Type to filter skills…`,items:(0,T.useMemo)(()=>D.flatMap(e=>f[e]),[f]),getKey:e=>`${e.name}-${e.source}`,visibleCount:12,direction:`down`,onQueryChange:a,onSelect:t=>{e(`/${s(t)}`,{display:`user`})},onCancel:m,emptyMessage:e=>e.trim()?`No skills matching "${e.trim()}"`:`No skills found`,matchLabel:i.trim()===``?`${o.length} ${y(o.length,`skill`)}`:`${u.length}/${o.length} ${y(o.length,`skill`)}`,selectAction:`invoke skill`,renderItem:(e,t)=>g(e,t)})}var T,E,D,O=e((()=>{T=t(u(),1),i(),f(),o(),v(),h(),b(),a(),S(),E=m(),D=[`projectSettings`,`localSettings`,`userSettings`,`flagSettings`,`policySettings`,`plugin`,`mcp`]}));async function k(e,t){return(0,A.jsx)(w,{onExit:e,commands:t.options.commands})}var A;e((()=>{O(),A=m()}))();export{k as call};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,n,o as r,t as i}from"./envUtils-DcaKZlRU.js";import{n as a,t as o}from"./figures-5ThXQEtq.js";import{By as s,Ky as c,Uy as l,Wy as ee,_b as u,fb as d,lb as f,ob as p}from"./loadAgentsDir-
|
|
2
|
-
`,`Please restart your IDE and try again.`]})}];if(t.installed)return r&&r.type===`connected`?t.installedVersion===r.serverInfo?.version?[{label:`IDE`,value:`Connected to ${e} ${i} version ${t.installedVersion}`}]:[{label:`IDE`,value:`Connected to ${e} ${i} version ${t.installedVersion} (server version: ${r.serverInfo?.version})`}]:[{label:`IDE`,value:`Installed ${e} ${i}`}]}else if(r){let e=p(r)??`IDE`;return r.type===`connected`?[{label:`IDE`,value:`Connected to ${e} extension`}]:[{label:`IDE`,value:`${_(`error`,n)(o.cross)} Not connected to ${e}`}]}return[]}function X(e=[],t){let n=e.filter(e=>e.name!==`ide`);if(!n.length)return[];let r={connected:0,pending:0,needsAuth:0,failed:0};for(let e of n)e.type===`connected`?r.connected++:e.type===`pending`?r.pending++:e.type===`needs-auth`?r.needsAuth++:r.failed++;let i=[];return r.connected&&i.push(_(`success`,t)(`${r.connected} connected`)),r.needsAuth&&i.push(_(`warning`,t)(`${r.needsAuth} need auth`)),r.pending&&i.push(_(`inactive`,t)(`${r.pending} pending`)),r.failed&&i.push(_(`error`,t)(`${r.failed} failed`)),[{label:`MCP servers`,value:`${i.join(`, `)} ${_(`inactive`,t)(`· /mcp`)}`}]}async function Z(){let e=l(await ee()),t=[];return e.forEach(e=>{let n=O(e.path);t.push(`Large ${n} will impact performance (${k(e.content.length)} chars > ${k(s)})`)}),t}function Q(){return[{label:`Setting sources`,value:w().filter(e=>{let t=S(e);return t!==null&&Object.keys(t).length>0}).map(e=>{if(e===`policySettings`){let e=b();if(e===null)return null;switch(e){case`remote`:return`Enterprise managed settings (remote)`;case`plist`:return`Enterprise managed settings (plist)`;case`hklm`:return`Enterprise managed settings (HKLM)`;case`file`:{let{hasBase:e,hasDropIns:t}=E();return e&&t?`Enterprise managed settings (file + drop-ins)`:t?`Enterprise managed settings (drop-ins)`:`Enterprise managed settings (file)`}case`hkcu`:return`Enterprise managed settings (HKCU)`}}return x(e)}).filter(e=>e!==null)}]}async function ne(){return(await W()).map(e=>e.message)}async function re(){let e=await U(),t=[],{errors:n}=q();if(n.length>0){let e=Array.from(new Set(n.map(e=>e.file))).join(`, `);t.push(`Found invalid settings files: ${e}. They will be ignored.`)}return e.warnings.forEach(e=>{t.push(e.issue)}),e.hasUpdatePermissions===!1&&t.push(`No write permissions for auto-updates (requires sudo)`),t}function ie(){let e=
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,n,o as r,t as i}from"./envUtils-DcaKZlRU.js";import{n as a,t as o}from"./figures-5ThXQEtq.js";import{By as s,Ky as c,Uy as l,Wy as ee,_b as u,fb as d,lb as f,ob as p}from"./loadAgentsDir-PPiD2Mfq.js";import{P as m,di as h,fi as g,j as _,t as v}from"./src-DL3w8VPk2.js";import{t as y}from"./jsx-runtime-Bb4Xn-E0.js";import{a as b,an as x,c as S,g as C,in as w,ln as T,r as E,wn as D,xn as O}from"./settings-CvhsRFaT.js";import{f as k,v as A}from"./startupProfiler-2sjXZkIP.js";import{$r as j,Pt as M,_ as N,i as te,mt as P,ti as F,x as I,zt as L}from"./model-sviY1inu.js";import{h as R,l as z,o as B,p as V}from"./proxy-C0j74LqT.js";import{g as H,h as U}from"./pidLock-DuMVSwnN.js";import{n as W,t as G}from"./nativeInstaller-N1xiUpCP.js";import{n as K,t as q}from"./allErrors-DRiW7i6Y.js";function J(){return[]}function Y(e,t=null,n){let r=e?.find(e=>e.name===`ide`);if(t){let e=u(t.ideType),i=d(t.ideType)?`plugin`:`extension`;if(t.error)return[{label:`IDE`,value:(0,$.jsxs)(m,{children:[_(`error`,n)(o.cross),` Error installing `,e,` `,i,`:`,` `,t.error,`
|
|
2
|
+
`,`Please restart your IDE and try again.`]})}];if(t.installed)return r&&r.type===`connected`?t.installedVersion===r.serverInfo?.version?[{label:`IDE`,value:`Connected to ${e} ${i} version ${t.installedVersion}`}]:[{label:`IDE`,value:`Connected to ${e} ${i} version ${t.installedVersion} (server version: ${r.serverInfo?.version})`}]:[{label:`IDE`,value:`Installed ${e} ${i}`}]}else if(r){let e=p(r)??`IDE`;return r.type===`connected`?[{label:`IDE`,value:`Connected to ${e} extension`}]:[{label:`IDE`,value:`${_(`error`,n)(o.cross)} Not connected to ${e}`}]}return[]}function X(e=[],t){let n=e.filter(e=>e.name!==`ide`);if(!n.length)return[];let r={connected:0,pending:0,needsAuth:0,failed:0};for(let e of n)e.type===`connected`?r.connected++:e.type===`pending`?r.pending++:e.type===`needs-auth`?r.needsAuth++:r.failed++;let i=[];return r.connected&&i.push(_(`success`,t)(`${r.connected} connected`)),r.needsAuth&&i.push(_(`warning`,t)(`${r.needsAuth} need auth`)),r.pending&&i.push(_(`inactive`,t)(`${r.pending} pending`)),r.failed&&i.push(_(`error`,t)(`${r.failed} failed`)),[{label:`MCP servers`,value:`${i.join(`, `)} ${_(`inactive`,t)(`· /mcp`)}`}]}async function Z(){let e=l(await ee()),t=[];return e.forEach(e=>{let n=O(e.path);t.push(`Large ${n} will impact performance (${k(e.content.length)} chars > ${k(s)})`)}),t}function Q(){return[{label:`Setting sources`,value:w().filter(e=>{let t=S(e);return t!==null&&Object.keys(t).length>0}).map(e=>{if(e===`policySettings`){let e=b();if(e===null)return null;switch(e){case`remote`:return`Enterprise managed settings (remote)`;case`plist`:return`Enterprise managed settings (plist)`;case`hklm`:return`Enterprise managed settings (HKLM)`;case`file`:{let{hasBase:e,hasDropIns:t}=E();return e&&t?`Enterprise managed settings (file + drop-ins)`:t?`Enterprise managed settings (drop-ins)`:`Enterprise managed settings (file)`}case`hkcu`:return`Enterprise managed settings (HKCU)`}}return x(e)}).filter(e=>e!==null)}]}async function ne(){return(await W()).map(e=>e.message)}async function re(){let e=await U(),t=[],{errors:n}=q();if(n.length>0){let e=Array.from(new Set(n.map(e=>e.file))).join(`, `);t.push(`Found invalid settings files: ${e}. They will be ignored.`)}return e.warnings.forEach(e=>{t.push(e.issue)}),e.hasUpdatePermissions===!1&&t.push(`No write permissions for auto-updates (requires sudo)`),t}function ie(){let e=P();if(!e)return[];let t=[];return e.subscription&&t.push({label:`Login method`,value:`${e.subscription} Account`}),e.tokenSource&&t.push({label:`Auth token`,value:e.tokenSource}),e.apiKeySource&&t.push({label:`API key`,value:e.apiKeySource}),e.organization&&!process.env.IS_DEMO&&t.push({label:`Organization`,value:e.organization}),e.email&&!process.env.IS_DEMO&&t.push({label:`Email`,value:e.email}),t}function ae(){let e=j(),r=[];if(e!==`firstParty`){let t={bedrock:`AWS Bedrock`,vertex:`Google Vertex AI`,foundry:`Microsoft Foundry`,gemini:`Gemini API`,grok:`Grok API`,openai:`OpenAI API`}[e];r.push({label:`API provider`,value:t})}if(e===`firstParty`){let e=process.env.ANTHROPIC_BASE_URL;e&&r.push({label:`API base URL`,value:e})}else if(e===`bedrock`){let e=process.env.BEDROCK_BASE_URL;e&&r.push({label:`Bedrock base URL`,value:e}),r.push({label:`AWS region`,value:i()}),t(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&r.push({value:`AWS auth skipped`})}else if(e===`vertex`){let e=process.env.VERTEX_BASE_URL;e&&r.push({label:`Vertex base URL`,value:e});let i=process.env.ANTHROPIC_VERTEX_PROJECT_ID;i&&r.push({label:`GCP project`,value:i}),r.push({label:`Default region`,value:n()}),t(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)&&r.push({value:`GCP auth skipped`})}else if(e===`foundry`){let e=process.env.ANTHROPIC_FOUNDRY_BASE_URL;e&&r.push({label:`Microsoft Foundry base URL`,value:e});let n=process.env.ANTHROPIC_FOUNDRY_RESOURCE;n&&r.push({label:`Microsoft Foundry resource`,value:n}),t(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH)&&r.push({value:`Microsoft Foundry auth skipped`})}else if(e===`gemini`){let e=process.env.GEMINI_BASE_URL||`https://generativelanguage.googleapis.com/v1beta`;r.push({label:`Gemini base URL`,value:e})}else if(e===`grok`){let e=process.env.GROK_BASE_URL;r.push({label:`Grok base URL`,value:e})}else if(e===`openai`){let e=process.env.OPENAI_BASE_URL;r.push({label:`OpenAI base URL`,value:e})}let a=B();a&&r.push({label:`Proxy`,value:a});let o=V();return process.env.NODE_EXTRA_CA_CERTS&&r.push({label:`Additional CA cert(s)`,value:process.env.NODE_EXTRA_CA_CERTS}),o&&(o.cert&&process.env.CLAUDE_CODE_CLIENT_CERT&&r.push({label:`mTLS client cert`,value:process.env.CLAUDE_CODE_CLIENT_CERT}),o.key&&process.env.CLAUDE_CODE_CLIENT_KEY&&r.push({label:`mTLS client key`,value:process.env.CLAUDE_CODE_CLIENT_KEY})),r}function oe(e){let t=I(e);if(e===null&&L()){let e=te();t=`${h.bold(`Default`)} ${e}`}return t}var $,se=e((()=>{g(),a(),v(),M(),c(),H(),r(),D(),A(),f(),N(),F(),R(),G(),z(),K(),T(),C(),$=y()}));export{re as a,J as c,se as d,ne as i,Q as l,ie as n,X as o,Y as r,Z as s,ae as t,oe as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Settings-ClcLl0C1.js";async function i(e,t){return(0,a.jsx)(r,{onClose:e,context:t,defaultTab:`Status`})}var a;e((()=>{n(),a=t()}))();export{i as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$i as t,Qi as n}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$i as t,Qi as n}from"./loadAgentsDir-PPiD2Mfq.js";function r(e){return e?e.activeAgents.filter(e=>e.source!==`built-in`).reduce((e,n)=>e+t(`${n.agentType}: ${n.whenToUse}`),0):0}var i,a=e((()=>{n(),i=15e3}));export{r as n,a as r,i as t};
|