@readmagic/workmate 0.0.27 → 0.0.28
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-DqlPtsVK.js → AddWorkspaceDirectory-Bmgh8VS3.js} +1 -1
- package/dist/chunks/{AgentsMdExternalIncludesDialog-rJS5l6yk.js → AgentsMdExternalIncludesDialog-BJfHqScU.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-BjbUilCE.js +1 -0
- package/dist/chunks/{App-DzRQpRKr.js → App-COdpsR2w.js} +1 -1
- package/dist/chunks/{BackgroundTasksDialog-CBhSmdz_.js → BackgroundTasksDialog-WkoL4g5Q.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-zz-lnmJt.js → BypassPermissionsModeDialog-BT9yl0Qt.js} +1 -1
- package/dist/chunks/{CustomSelect-CYmc4vRh.js → CustomSelect-t4wXuXWH.js} +1 -1
- package/dist/chunks/{DiffDialog-CTUIAcEE.js → DiffDialog-CXZxnb7Y.js} +1 -1
- package/dist/chunks/Doctor-B6isid5K.js +1 -0
- package/dist/chunks/{Doctor-CLOYkPRR.js → Doctor-COj-tZBc.js} +1 -1
- package/dist/chunks/{ExitFlow-CATwJC4c.js → ExitFlow-CcMYH5iI.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-B-9Z58oD.js → InvalidConfigDialog-riLYEaUP.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-B4EWjbp7.js → InvalidSettingsDialog-BGXl3V1A.js} +1 -1
- package/dist/chunks/{KeybindingProviderSetup-Dzg77_Xn.js → KeybindingProviderSetup-syiDgtpB.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-CBY8nqdU.js → MCPConnectionManager-C7RmKzJh.js} +1 -1
- package/dist/chunks/{MCPToolListView-C7HT6rrl.js → MCPToolListView-CewNLJus.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-Dj_Fu5o-.js → McpParsingWarnings-Czze2JPd.js} +1 -1
- package/dist/chunks/{MessageSelector-Dw_ERK_Z.js → MessageSelector-Kc6JlnDX.js} +1 -1
- package/dist/chunks/{Messages-RBfRELKn.js → Messages-BvFYO4Zn.js} +1 -1
- package/dist/chunks/{Onboarding-BRSXxc2E.js → Onboarding-CD_Uv5h9.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-ChpyD9B7.js → PromptInputFooterSuggestions-CHXJsTtQ.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-CrTT8MKE.js → PromptInputHelpMenu-BZIVCV7V.js} +1 -1
- package/dist/chunks/{ProviderSetup-BEV95bnz.js → ProviderSetup-CwMvjmjh.js} +1 -1
- package/dist/chunks/{QueryEngine-BBBkZWu2.js → QueryEngine-DAwfp_ht.js} +1 -1
- package/dist/chunks/{REPL-BDnZnm__.js → REPL-CtFtb35A.js} +4 -4
- package/dist/chunks/REPL-tFT1FGQF.js +1 -0
- package/dist/chunks/{ResumeConversation-BuSqBrm1.js → ResumeConversation-CERzSBvg.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-ndh4aEwQ.js +1 -0
- package/dist/chunks/{Settings-DYKmPdbd.js → Settings-CPaqWNdP.js} +2 -2
- package/dist/chunks/{Spinner-DOI8qqZi.js → Spinner-C0qHjfIY.js} +1 -1
- package/dist/chunks/{TextInput-ZKU-x_FD.js → TextInput-ou7ZhpVY.js} +1 -1
- package/dist/chunks/{ThemePicker-B69oDgXN.js → ThemePicker-CVFWqSc7.js} +1 -1
- package/dist/chunks/{TrustDialog-BSG8Ibh8.js → TrustDialog-CGXv_LF4.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-BUYHEft4.js → ValidationErrorsList-CKeHoN2Z.js} +1 -1
- package/dist/chunks/{_baseEach-P0u1zIx6.js → _baseEach-BYhqv77g.js} +1 -1
- package/dist/chunks/{add-dir-C8RmmyQK.js → add-dir-BSizpuef.js} +1 -1
- package/dist/chunks/{agentDisplay-np7CH47m.js → agentDisplay-JKfYFD1m.js} +1 -1
- package/dist/chunks/{agents-DRQlR5M1.js → agents-BDTCH6YB.js} +1 -1
- package/dist/chunks/{agents-DedoH0Q4.js → agents-MEaV8P2G.js} +1 -1
- package/dist/chunks/{allErrors-DvcU0w0F.js → allErrors-Dhnf6rqg.js} +1 -1
- package/dist/chunks/{appleTerminalBackup-Bemd4RXh.js → appleTerminalBackup-CN8kS74J.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-Bu-zRFCx.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-BtEJ6TeC.js → backgroundHousekeeping-CsXlkIg3.js} +1 -1
- package/dist/chunks/{banner-CuoceXzz.js → banner-BKOzHotb.js} +1 -1
- package/dist/chunks/{branch-ClhlS7f8.js → branch-BllXcYwS.js} +1 -1
- package/dist/chunks/bridgeControl-aDnUrYZR.js +2 -0
- package/dist/chunks/{btw-B-FLxlx-.js → btw-DzaRBa6o.js} +1 -1
- package/dist/chunks/caches-CMF-MmR-.js +1 -0
- package/dist/chunks/{caches-Dn8yrJmL.js → caches-CW5YnYNS.js} +1 -1
- package/dist/chunks/channel-DVx21qde.js +1 -0
- package/dist/chunks/channel-Gw6skpUh.js +1 -0
- package/dist/chunks/{clear-BnWv0i65.js → clear-CDQs9_5P.js} +1 -1
- package/dist/chunks/commands-CfYMwgP7.js +1 -0
- package/dist/chunks/{compact-Banc-SNk.js → compact-6F2tuItE.js} +1 -1
- package/dist/chunks/config-BDkzWBnL.js +1 -0
- package/dist/chunks/{config-BDn2YIjC.js → config-Bio2EjUK.js} +1 -1
- package/dist/chunks/config-C_AEhZrn.js +1 -0
- package/dist/chunks/{context-BvDBAyJ9.js → context-TkdzCK3Y.js} +1 -1
- package/dist/chunks/{context-noninteractive-CuHHniJn.js → context-noninteractive-BcBo64vo.js} +1 -1
- package/dist/chunks/context-noninteractive-oFcnY1Er.js +1 -0
- package/dist/chunks/{conversation-Cjaftrrw.js → conversation-CYZyg1U1.js} +1 -1
- package/dist/chunks/conversation-DXzlRhNw.js +1 -0
- package/dist/chunks/{conversationRecovery-NL05oJb1.js → conversationRecovery-_hWC7JBO.js} +1 -1
- package/dist/chunks/{crossProjectResume-BzltC4NJ.js → crossProjectResume-CCo3iZrB.js} +1 -1
- package/dist/chunks/{diff--6gQCx_x.js → diff-BzVUPO4Z.js} +1 -1
- package/dist/chunks/doctor-B4jQbGQr.js +1 -0
- package/dist/chunks/{entry-DWYOrkFS.js → entry-333L52Lo.js} +1 -1
- package/dist/chunks/{exit-uKtXb5U3.js → exit-D5DYnRvR.js} +1 -1
- package/dist/chunks/{extraUsage-Dr0YXm1w.js → extraUsage-CmgRR-zH.js} +1 -1
- package/dist/chunks/extractMemories-CVUrBFMj.js +1 -0
- package/dist/chunks/fast-CRhW9zha.js +1 -0
- package/dist/chunks/{fast-C5-lNCQi.js → fast-D7oNjaZ3.js} +1 -1
- package/dist/chunks/{fetchModelList-9w1E4Ue8.js → fetchModelList-Cv1vWIpC.js} +1 -1
- package/dist/chunks/fetchModelList-DIa1HwAJ.js +1 -0
- package/dist/chunks/{fileSuggestions-BYD78vcF.js → fileSuggestions-DF3HTRKr.js} +1 -1
- package/dist/chunks/{gemini-BNBptTET.js → gemini-ou7_YyXc.js} +1 -1
- package/dist/chunks/{generateSessionName-CO2484aJ.js → generateSessionName-CeN9EZNY.js} +1 -1
- package/dist/chunks/{goal-j0wdadwM.js → goal-CCxo4Wyf.js} +1 -1
- package/dist/chunks/{grok-BpO1ZwK_.js → grok-BMmUcNbI.js} +1 -1
- package/dist/chunks/{help-DwhA0qQ6.js → help-CYtogTZk.js} +1 -1
- package/dist/chunks/{hooks-DG4_WdZ2.js → hooks-ByVkvodY.js} +1 -1
- package/dist/chunks/hooks-CBGUcyCs.js +1 -0
- package/dist/chunks/{install-BbmCNCuM.js → install-DIxyfdXG.js} +1 -1
- package/dist/chunks/{instrumentation-DpPmDyNF.js → instrumentation-BmHivmxs.js} +3 -3
- package/dist/chunks/{job-GcmX1ALd.js → job-D534P26R.js} +1 -1
- package/dist/chunks/{launchLocalMemory-CDgT5lst.js → launchLocalMemory-CWXLb3KF.js} +1 -1
- package/dist/chunks/{launchOnboarding-uQ_ux9sS.js → launchOnboarding-CocPmwzz.js} +1 -1
- package/dist/chunks/loadAgentsDir-Zw648oQO.js +1 -0
- package/dist/chunks/{loadAgentsDir-uuZYOgKn.js → loadAgentsDir-bmpKLPdG.js} +343 -343
- package/dist/chunks/{loadPluginHooks-QoVXsBjy.js → loadPluginHooks-BIfM53-_.js} +1 -1
- package/dist/chunks/{localSearch-yVCDrVrf.js → localSearch-Da8cVYoI.js} +1 -1
- package/dist/chunks/localSearch-Dbj8cXyO.js +1 -0
- package/dist/chunks/{logoUtils-B4wCDKs9.js → logoUtils-qNuBc2nI.js} +1 -1
- package/dist/chunks/{magicDocs-D53lV8b5.js → magicDocs-BsEiBLQl.js} +1 -1
- package/dist/chunks/{main-fy_XSXGj.js → main-B31aPMPP.js} +6 -6
- package/dist/chunks/managedEnv-DCGLDTP_.js +1 -0
- package/dist/chunks/{managedEnv-B8YWmM4A.js → managedEnv-EZ2IirNa.js} +1 -1
- package/dist/chunks/{mcp-DCl-Tz-C.js → mcp-BMeWtYCx.js} +1 -1
- package/dist/chunks/{mcp--LmEVBRg.js → mcp-CYbesbfl.js} +1 -1
- package/dist/chunks/{mcp-CZUVaPb3.js → mcp-Dd8TBfQQ.js} +1 -1
- package/dist/chunks/{memory-Bu5ku7y9.js → memory-DtQQGyPS.js} +1 -1
- package/dist/chunks/{mode-Bteqe2QG.js → mode-SM8doWgC.js} +1 -1
- package/dist/chunks/{model-CHDU5yqH.js → model-C2r-PaR4.js} +1 -1
- package/dist/chunks/{model-CcHyMyBv.js → model-Dd3x121y.js} +1 -1
- package/dist/chunks/{modelOptions-CJV1R3Jt.js → modelOptions-BQL4gbNk.js} +1 -1
- package/dist/chunks/{nativeInstaller-CIUYh1aD.js → nativeInstaller-DMkZdsof.js} +1 -1
- package/dist/chunks/{notifications-GLnjirCl.js → notifications-BwS1XsnZ.js} +1 -1
- package/dist/chunks/{onChangeAppState-CxGW2d-l.js → onChangeAppState-C9cYQJPF.js} +1 -1
- package/dist/chunks/{openai-BpGQT2Iv.js → openai-Bea4I2Od.js} +1 -1
- package/dist/chunks/{overlayContext-7wgLio1O.js → overlayContext-C5WPACKC.js} +1 -1
- package/dist/chunks/{partition-djFY9gGI.js → partition-CKgWl7p4.js} +1 -1
- package/dist/chunks/{permissions-DNedQyLg.js → permissions-Dv_PCfY0.js} +1 -1
- package/dist/chunks/{pidLock-CFUBtZck.js → pidLock-CqkC3-nD.js} +2 -2
- package/dist/chunks/{plan-DI0n7LIV.js → plan-Ce6wfjjI.js} +1 -1
- package/dist/chunks/{plugin-BQ8gRVYF.js → plugin-aK4tDrVg.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-CNrHb4RJ.js → pluginAutoupdate-ByokIVEs.js} +1 -1
- package/dist/chunks/{pluginBlocklist-CKCsgWdY.js → pluginBlocklist-ByRQaVPu.js} +1 -1
- package/dist/chunks/{pluginCliCommands-CACeyIwz.js → pluginCliCommands-Dyk4HYHs.js} +1 -1
- package/dist/chunks/{pluginFlagging-CUvkKGOB.js → pluginFlagging-B2ZX5_oB.js} +1 -1
- package/dist/chunks/{pluginOperations-Ca_T-HYn.js → pluginOperations-BCvJvfOC.js} +1 -1
- package/dist/chunks/{pluginStartupCheck-DftTiXct.js → pluginStartupCheck-QG0d95dE.js} +1 -1
- package/dist/chunks/pluginStartupCheck-o_TC7wIt.js +1 -0
- package/dist/chunks/{plugins-Divl-P-X.js → plugins-DzsTDNWJ.js} +1 -1
- package/dist/chunks/{print-DSHypGJa.js → print-dUT7E1g9.js} +2 -2
- package/dist/chunks/{processBashCommand-BLcFmbyG.js → processBashCommand-DtGCgTkF.js} +1 -1
- package/dist/chunks/{processSlashCommand-Caif46Gi.js → processSlashCommand-wXblpK2C.js} +1 -1
- package/dist/chunks/{projectOnboardingState-nTCycGCD.js → projectOnboardingState-D-_ijZnG.js} +1 -1
- package/dist/chunks/prompt-BdH2zk0S.js +1 -0
- package/dist/chunks/{prompt-BfXryFt-.js → prompt-BnDapYGL.js} +1 -1
- package/dist/chunks/prompt-D0TFER0A.js +1 -0
- package/dist/chunks/{protocolHandler-VigBkAQQ.js → protocolHandler-CJO3CRYW.js} +1 -1
- package/dist/chunks/{reconciler-B9XFdL4f.js → reconciler-C_HKsocm.js} +1 -1
- package/dist/chunks/{refresh-CBHbWTGg.js → refresh-Cm4jZzLa.js} +1 -1
- package/dist/chunks/{reject-CBxnwckZ.js → reject-Tug1RmkE.js} +1 -1
- package/dist/chunks/{reload-plugins-5eFWrQlL.js → reload-plugins-CL9LWzpq.js} +1 -1
- package/dist/chunks/{rename-Cw7cMerG.js → rename-OfKJSazJ.js} +1 -1
- package/dist/chunks/{resume-U2D0ybfU.js → resume-BZ42SpS2.js} +1 -1
- package/dist/chunks/{runtimeObserver-DOYlxx9H.js → runtimeObserver-BLq2guVy.js} +1 -1
- package/dist/chunks/{runtimeObserver-CWaYMJG8.js → runtimeObserver-DT5P2_XL.js} +2 -2
- package/dist/chunks/sandbox-adapter-982rx2cm.js +1 -0
- package/dist/chunks/{sandbox-toggle-BtiPyjT3.js → sandbox-toggle-DghmaJhK.js} +1 -1
- package/dist/chunks/searchExtraTools-B4N1bpy0.js +1 -0
- package/dist/chunks/{select-BuTJbu_Q.js → select-CaxQ-BVq.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-BqQ58T7e.js +1 -0
- package/dist/chunks/{sessionObserver-cfwD8pV8.js → sessionObserver-DBoZUvWL.js} +1 -1
- package/dist/chunks/sessionObserver-qYpA90El.js +1 -0
- package/dist/chunks/sessionStorage-CC0v4zMs.js +1 -0
- package/dist/chunks/{sessionTracing-DsdcOqvc.js → sessionTracing-5a7HDF4e.js} +1 -1
- package/dist/chunks/{setup-DR-KEmxL.js → setup-DVLnIlse.js} +2 -2
- package/dist/chunks/{shadowedRuleDetection-DiZUDzxU.js → shadowedRuleDetection-L3tnySui.js} +1 -1
- package/dist/chunks/{sideQuestion-CdgUarC2.js → sideQuestion-BJTVma-5.js} +1 -1
- package/dist/chunks/sinks-C9NdbjLo.js +1 -0
- package/dist/chunks/{sinks-Cy3NqVbk.js → sinks-CV0SWuZW.js} +1 -1
- package/dist/chunks/{skillChangeDetector-CVFCJcG7.js → skillChangeDetector-DlodgOyC.js} +1 -1
- package/dist/chunks/{skillGapStore-BJV8ZIB1.js → skillGapStore-Cposc03e.js} +2 -2
- package/dist/chunks/{skillLifecycle-iO_3s9Ff.js → skillLifecycle-RXQp0JU7.js} +2 -2
- package/dist/chunks/{skillSearchPanel-BL5gXTHU.js → skillSearchPanel-B2pjskqk.js} +2 -2
- package/dist/chunks/{skills-BEp3_RyT.js → skills-D2ZjMtv4.js} +1 -1
- package/dist/chunks/status-BcSkj9nE.js +1 -0
- package/dist/chunks/{statusNoticeHelpers-BoloSeXY.js → statusNoticeHelpers-DsrqBOQt.js} +1 -1
- package/dist/chunks/switcher-BietN6il.js +1 -0
- package/dist/chunks/{switcher-DSt2cVjA.js → switcher-rep86o4_.js} +1 -1
- package/dist/chunks/{tasks-DyBUXnQb.js → tasks-B4coTfrq.js} +1 -1
- package/dist/chunks/{templateJobs-BBnReWWj.js → templateJobs-C5ukh6H3.js} +1 -1
- package/dist/chunks/{terminalSetup-CDpFfqqV.js → terminalSetup-CaGbEVjB.js} +1 -1
- package/dist/chunks/{terminalSetup-DedaY1P7.js → terminalSetup-xe_P98fY.js} +1 -1
- package/dist/chunks/{theme-BZOy9Iqh.js → theme-7RmvErYJ.js} +1 -1
- package/dist/chunks/{tipRegistry-Cl5sdLRX.js → tipRegistry-BYpJZIjR.js} +1 -1
- package/dist/chunks/{toolEventObserver-ClwWmVbH.js → toolEventObserver-Dzwzi5Vi.js} +1 -1
- package/dist/chunks/{toolPool-DSTbgGmX.js → toolPool-BGfiNj6h.js} +1 -1
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-ClN4NJnB.js → useExitOnCtrlCDWithKeybindings-BT0nexZw.js} +1 -1
- package/dist/chunks/useMainLoopModel-QuE7VkgX.js +1 -0
- package/dist/chunks/{useManagePlugins-CxHz-gUP.js → useManagePlugins-pGaGzsEg.js} +1 -1
- package/dist/chunks/{useMergedTools-BUuWew0-.js → useMergedTools-BLsIT3R_.js} +1 -1
- package/dist/chunks/{useSearchInput-BIQN_-Hm.js → useSearchInput-j12K4wEo.js} +1 -1
- package/dist/chunks/{useSettingsErrors-BDJCLei_.js → useSettingsErrors-C8VIzdws.js} +1 -1
- package/dist/chunks/{util-BHr5l6Bx.js → util-CCEK8oze.js} +1 -1
- package/dist/chunks/{validatePlugin-fx1Y8vam.js → validatePlugin-CTVnWx9H.js} +1 -1
- package/dist/chunks/{vim-CYjMtnwH.js → vim-BlO9V5_5.js} +1 -1
- package/dist/chunks/worktree-BWL0vR4o.js +1 -0
- package/dist/chunks/wrapper-B-Q3Illb.js +1 -0
- package/dist/chunks/{wrapper-K8ZapJVu.js → wrapper-DVKxC5fR.js} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +2 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-CgSethgo.js +0 -1
- package/dist/chunks/Doctor-CiZNe_qx.js +0 -1
- package/dist/chunks/REPL-BHk0vZDf.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-CdWB9sO8.js +0 -1
- package/dist/chunks/backgroundHousekeeping-B56nFTzq.js +0 -1
- package/dist/chunks/caches-D7arwhaa.js +0 -1
- package/dist/chunks/commands-AcfFLgl5.js +0 -1
- package/dist/chunks/config-BhBcadjZ.js +0 -1
- package/dist/chunks/config-Bm5pVdCq.js +0 -1
- package/dist/chunks/context-noninteractive-BK2IDLSS.js +0 -1
- package/dist/chunks/conversation-B2dX3X4Z.js +0 -1
- package/dist/chunks/doctor-CQf8xPZH.js +0 -1
- package/dist/chunks/extractMemories-8yvMGZ1J.js +0 -1
- package/dist/chunks/fast-aNkj6WvB.js +0 -1
- package/dist/chunks/fetchModelList-D2quBF6M.js +0 -1
- package/dist/chunks/hooks-B5Wq-KxE.js +0 -1
- package/dist/chunks/loadAgentsDir-BBbIAiay.js +0 -1
- package/dist/chunks/localSearch-D6MhwvnR.js +0 -1
- package/dist/chunks/managedEnv-ulQBH73B.js +0 -1
- package/dist/chunks/pluginStartupCheck-Du9yx2P8.js +0 -1
- package/dist/chunks/prompt-BZmu5CeK.js +0 -1
- package/dist/chunks/prompt-Cogr_WZr.js +0 -1
- package/dist/chunks/sandbox-adapter-Df7Wpt77.js +0 -1
- package/dist/chunks/searchExtraTools-CbJVb_Zk.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-_mxyfQmn.js +0 -1
- package/dist/chunks/sessionObserver-BZVgzp3W.js +0 -1
- package/dist/chunks/sessionStorage-SC5RfnUP.js +0 -1
- package/dist/chunks/sinks-D41OiGE4.js +0 -1
- package/dist/chunks/status-6JMz8jmM.js +0 -1
- package/dist/chunks/switcher-95d4TrQH.js +0 -1
- package/dist/chunks/useMainLoopModel-Bgxpmn2Q.js +0 -1
- package/dist/chunks/worktree-CGu_58ue.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,l as t,o as n,s as r}from"./envUtils-QyzA_cFM.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{$n as o,$t as s,Gi as c,Hi as l,Ni as u,Pi as d,U as f,Ui as p,Vi as m,Wi as h,Xi as g,Zi as _,bn as v,ca as y,d as b,di as ee,dr as te,ea as x,en as S,et as ne,fi as C,gt as w,ia as T,lt as re,m as ie,nt as ae,oa as E,pr as D,qi as O,sa as k,ta as A,tr as oe,u as se,ui as j,vn as M}from"./settings-D4M13toi.js";import{A as ce,Ft as le,Hn as ue,Ht as de,Mn as fe,O as pe,Pt as me,W as he,at as N,nn as ge,on as P,vn as _e,yn as ve}from"./state-CXY-q5gr.js";import{$d as F,$h as I,$r as ye,A as be,AC as xe,Aa as Se,Ad as Ce,Ag as L,As as R,Av as z,B as we,Bd as Te,Bl as Ee,Bo as De,Bp as Oe,Bt as ke,Bv as Ae,C as je,Cc as Me,Cg as Ne,Ci as Pe,Cs as Fe,Cv as Ie,DC as Le,Da as Re,Dc as ze,Dg as Be,Di as Ve,Ep as He,Fl as Ue,Fo as We,Gf as Ge,Gn as Ke,Gp as qe,Gu as Je,Gv as Ye,HC as Xe,Ho as Ze,Hp as Qe,Ia as $e,Id as et,Il as tt,Io as nt,Iv as rt,Ji as it,Jp as at,KC as ot,Kp as st,Kv as ct,Ll as lt,Lo as ut,Lr as dt,Mg as ft,Mi as pt,Ml as mt,Ms as ht,NC as gt,Nd as _t,Ni as vt,Nv as yt,Oa as bt,Od as xt,Og as St,Ov as Ct,PC as wt,Pa as Tt,Pg as Et,Ps as Dt,Qh as Ot,Qp as kt,Qr as At,Rd as jt,Ro as Mt,Rs as Nt,Sc as Pt,Sf as Ft,Sn as It,Sv as Lt,Ti as Rt,Tp as zt,Uh as Bt,Uo as Vt,Up as Ht,Us as Ut,V as Wt,VC as Gt,Vl as Kt,Vo as qt,Vp as Jt,Vt as Yt,WC as Xt,Wh as Zt,Wo as Qt,Wp as $t,Ws as en,Wv as tn,Xd as nn,Xr as rn,Yn as an,Yp as on,Yr as sn,_c as cn,_i as ln,_n as un,_u as dn,_v as fn,aC as pn,af as mn,ag as hn,ao as gn,b as _n,bS as vn,bc as yn,bn,bv as xn,cp as Sn,cs as Cn,dC as wn,eg as Tn,f as En,fC as Dn,fh as On,fo as kn,gi as An,gr as jn,gu as Mn,gv as Nn,hc as Pn,hf as Fn,hi as B,ho as In,iC as Ln,i_ as Rn,ig as zn,jC as Bn,jl as Vn,js as Hn,kd as Un,kv as Wn,lC as Gn,ls as Kn,mc as qn,mi as Jn,mn as Yn,n_ as Xn,o as Zn,of as Qn,oo as $n,ph as er,qC as tr,qS as nr,qf as rr,qp as ir,qu as ar,qx as or,rC as sr,r_ as cr,s as lr,sC as ur,sf as dr,ss as fr,t_ as pr,uC as mr,uf as hr,uo as gr,us as _r,uw as vr,v as yr,vc as br,vn as xr,vv as Sr,w as Cr,wc as wr,wg as Tr,wv as Er,xc as Dr,xf as Or,xn as kr,xs as Ar,y as jr,yf as Mr,yn as Nr,zd as Pr,zo as Fr,zp as V,zs as Ir,zv as Lr}from"./loadAgentsDir-uuZYOgKn.js";import{n as Rr,t as zr}from"./cwd-DrEEb4f5.js";import{$ as Br,C as H,E as Vr,I as Hr,M as U,S as Ur,V as Wr,c as W,et as Gr,f as Kr,i as G,u as qr,x as Jr}from"./debug-2pVES-2G.js";import{C as Yr,E as Xr}from"./config-BDn2YIjC.js";import{i as Zr,n as Qr,o as K}from"./process-gEbdy6uY.js";import{H as $r,c as ei,i as ti,o as ni,q as ri,s as q}from"./log-L1kqxa_P.js";import{n as ii}from"./analytics-COpjZpvd.js";import{At as ai,D as oi,Mt as si,Pt as ci,f as li,g as ui,jt as di,k as fi,r as pi,s as mi,v as hi}from"./model-CcHyMyBv.js";import{at as gi,bn as _i,bt as vi,it as yi,tn as bi,vn as xi,xt as Si,yt as Ci}from"./prompt-BfXryFt-.js";import{n as wi,t as Ti}from"./sleep-xKMbXTJe.js";import{i as Ei,n as Di,r as Oi,t as ki}from"./reject-CBxnwckZ.js";import{t as Ai}from"./pluginBlocklist-CKCsgWdY.js";import{n as ji,t as Mi}from"./toolPool-DSTbgGmX.js";import{n as Ni}from"./conversationRecovery-NL05oJb1.js";import{a as Pi,i as Fi,n as Ii,r as Li}from"./QueryEngine-BBBkZWu2.js";import{n as Ri,r as zi}from"./sessionTitle-k4wpUS5l.js";import{n as Bi,r as Vi}from"./sideQuestion-CdgUarC2.js";import{n as Hi,r as Ui}from"./context-noninteractive-CuHHniJn.js";import{n as Wi,r as Gi}from"./modelOptions-CJV1R3Jt.js";import{a as Ki,o as qi,t as Ji}from"./skillChangeDetector-CVFCJcG7.js";import{n as Yi}from"./reconciler-B9XFdL4f.js";import{n as Xi,t as Zi}from"./refresh-CBHbWTGg.js";import{dirname as Qi,join as $i}from"path";import{randomUUID as J}from"crypto";import{readFile as ea,stat as ta}from"fs/promises";import{cwd as Y}from"process";u(),s();var na=S(()=>A({inputTokens:x(),outputTokens:x(),cacheReadInputTokens:x(),cacheCreationInputTokens:x(),webSearchRequests:x(),costUSD:x(),contextWindow:x(),maxOutputTokens:x()})),ra=S(()=>_(`json_schema`));S(()=>A({type:ra()}));var ia=S(()=>A({type:_(`json_schema`),schema:T(E(),y())}));S(()=>ia());var aa=S(()=>m([`user`,`project`,`org`,`temporary`,`oauth`]));S(()=>m([`local`,`user`,`project`]).describe(`Config scope for settings.`)),S(()=>_(`context-1m-2025-08-07`));var oa=S(()=>A({type:_(`adaptive`)}).describe(`Work Mate decides when and how much to think (Opus 4.6+).`)),sa=S(()=>A({type:_(`enabled`),budgetTokens:x().optional()}).describe(`Fixed thinking token budget (older models)`)),ca=S(()=>A({type:_(`disabled`)}).describe(`No extended thinking`));S(()=>k([oa(),sa(),ca()]).describe(`Controls Work Mate's thinking/reasoning behavior. When set, takes precedence over the deprecated maxThinkingTokens.`));var la=S(()=>A({type:_(`stdio`).optional(),command:E(),args:h(E()).optional(),env:T(E(),E()).optional()})),ua=S(()=>A({type:_(`sse`),url:E(),headers:T(E(),E()).optional()})),da=S(()=>A({type:_(`http`),url:E(),headers:T(E(),E()).optional()})),fa=S(()=>A({type:_(`sdk`),name:E()})),pa=S(()=>k([la(),ua(),da(),fa()])),ma=S(()=>A({type:_(`claudeai-proxy`),url:E(),id:E()})),ha=S(()=>k([pa(),ma()])),ga=S(()=>A({name:E().describe(`Server name as configured`),status:m([`connected`,`failed`,`needs-auth`,`pending`,`disabled`]).describe(`Current connection status`),serverInfo:A({name:E(),version:E()}).optional().describe(`Server information (available when connected)`),error:E().optional().describe(`Error message (available when status is 'failed')`),config:ha().optional().describe(`Server configuration (includes URL for HTTP/SSE servers)`),scope:E().optional().describe(`Configuration scope (e.g., project, user, local, claudeai, managed)`),tools:h(A({name:E(),description:E().optional(),annotations:A({readOnly:c().optional(),destructive:c().optional(),openWorld:c().optional()}).optional()})).optional().describe(`Tools provided by this server (available when connected)`),capabilities:A({experimental:T(E(),y()).optional()}).optional().describe(`@internal Server capabilities (available when connected). experimental['claude/channel'] is only present if the server's plugin is on the approved channels allowlist — use its presence to decide whether to show an Enable-channel prompt.`)}).describe(`Status information for an MCP server connection.`));S(()=>A({added:h(E()).describe(`Names of servers that were added`),removed:h(E()).describe(`Names of servers that were removed`),errors:T(E(),E()).describe(`Map of server names to error messages for servers that failed to connect`)}).describe(`Result of a setMcpServers operation.`));var _a=S(()=>m([`userSettings`,`projectSettings`,`localSettings`,`session`,`cliArg`])),va=S(()=>m([`allow`,`deny`,`ask`])),ya=S(()=>A({toolName:E(),ruleContent:E().optional()})),ba=S(()=>O(`type`,[A({type:_(`addRules`),rules:h(ya()),behavior:va(),destination:_a()}),A({type:_(`replaceRules`),rules:h(ya()),behavior:va(),destination:_a()}),A({type:_(`removeRules`),rules:h(ya()),behavior:va(),destination:_a()}),A({type:_(`setMode`),mode:g(()=>Sa()),destination:_a()}),A({type:_(`addDirectories`),directories:h(E()),destination:_a()}),A({type:_(`removeDirectories`),directories:h(E()),destination:_a()})])),xa=S(()=>m([`user_temporary`,`user_permanent`,`user_reject`]).describe(`Classification of this permission decision for telemetry. SDK hosts that prompt users (desktop apps, IDEs) should set this to reflect what actually happened: user_temporary for allow-once, user_permanent for always-allow (both the click and later cache hits), user_reject for deny. If unset, the CLI infers conservatively (temporary for allow, reject for deny). The vocabulary matches tool_decision OTel events (monitoring-usage docs).`));S(()=>k([A({behavior:_(`allow`),updatedInput:T(E(),y()).optional(),updatedPermissions:h(ba()).optional(),toolUseID:E().optional(),decisionClassification:xa().optional()}),A({behavior:_(`deny`),message:E(),interrupt:c().optional(),toolUseID:E().optional(),decisionClassification:xa().optional()})]));var Sa=S(()=>m([`default`,`acceptEdits`,`bypassPermissions`,`plan`,`dontAsk`,`auto`]).describe(`Permission mode for controlling how tool executions are handled. 'default' - Standard behavior, prompts for dangerous operations. 'acceptEdits' - Auto-accept file edit operations. 'bypassPermissions' - Bypass all permission checks (requires allowDangerouslySkipPermissions). 'plan' - Planning mode, no actual tool execution. 'dontAsk' - Don't prompt for permissions, deny if not pre-approved. 'auto' - Automatic mode (transcript classifier).`)),Ca=`PreToolUse.PostToolUse.PostToolUseFailure.Notification.UserPromptSubmit.SessionStart.SessionEnd.Stop.StopFailure.SubagentStart.SubagentStop.PreCompact.PostCompact.PermissionRequest.PermissionDenied.Setup.TeammateIdle.TaskCreated.TaskCompleted.Elicitation.ElicitationResult.ConfigChange.WorktreeCreate.WorktreeRemove.InstructionsLoaded.CwdChanged.FileChanged`.split(`.`),wa=S(()=>m(Ca)),X=S(()=>A({session_id:E(),transcript_path:E(),cwd:E(),permission_mode:E().optional(),agent_id:E().optional().describe(`Subagent identifier. Present only when the hook fires from within a subagent (e.g., a tool called by an AgentTool worker). Absent for the main thread, even in --agent sessions. Use this field (not agent_type) to distinguish subagent calls from main-thread calls.`),agent_type:E().optional().describe(`Agent type name (e.g., "general-purpose", "code-reviewer"). Present when the hook fires from within a subagent (alongside agent_id), or on the main thread of a session started with --agent (without agent_id).`)})),Ta=S(()=>X().and(A({hook_event_name:_(`PreToolUse`),tool_name:E(),tool_input:y(),tool_use_id:E()}))),Ea=S(()=>X().and(A({hook_event_name:_(`PermissionRequest`),tool_name:E(),tool_input:y(),permission_suggestions:h(ba()).optional()}))),Da=S(()=>X().and(A({hook_event_name:_(`PostToolUse`),tool_name:E(),tool_input:y(),tool_response:y(),tool_use_id:E()}))),Oa=S(()=>X().and(A({hook_event_name:_(`PostToolUseFailure`),tool_name:E(),tool_input:y(),tool_use_id:E(),error:E(),is_interrupt:c().optional()}))),ka=S(()=>X().and(A({hook_event_name:_(`PermissionDenied`),tool_name:E(),tool_input:y(),tool_use_id:E(),reason:E()}))),Aa=S(()=>X().and(A({hook_event_name:_(`Notification`),message:E(),title:E().optional(),notification_type:E()}))),ja=S(()=>X().and(A({hook_event_name:_(`UserPromptSubmit`),prompt:E()}))),Ma=S(()=>X().and(A({hook_event_name:_(`SessionStart`),source:m([`startup`,`resume`,`clear`,`compact`]),agent_type:E().optional(),model:E().optional()}))),Na=S(()=>X().and(A({hook_event_name:_(`Setup`),trigger:m([`init`,`maintenance`])}))),Pa=S(()=>X().and(A({hook_event_name:_(`Stop`),stop_hook_active:c(),last_assistant_message:E().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),Fa=S(()=>X().and(A({hook_event_name:_(`StopFailure`),error:No(),error_details:E().optional(),last_assistant_message:E().optional()}))),Ia=S(()=>X().and(A({hook_event_name:_(`SubagentStart`),agent_id:E(),agent_type:E()}))),La=S(()=>X().and(A({hook_event_name:_(`SubagentStop`),stop_hook_active:c(),agent_id:E(),agent_transcript_path:E(),agent_type:E(),last_assistant_message:E().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),Ra=S(()=>X().and(A({hook_event_name:_(`PreCompact`),trigger:m([`manual`,`auto`]),custom_instructions:E().nullable()}))),za=S(()=>X().and(A({hook_event_name:_(`PostCompact`),trigger:m([`manual`,`auto`]),compact_summary:E().describe(`The conversation summary produced by compaction`)}))),Ba=S(()=>X().and(A({hook_event_name:_(`TeammateIdle`),teammate_name:E(),team_name:E()}))),Va=S(()=>X().and(A({hook_event_name:_(`TaskCreated`),task_id:E(),task_subject:E(),task_description:E().optional(),teammate_name:E().optional(),team_name:E().optional()}))),Ha=S(()=>X().and(A({hook_event_name:_(`TaskCompleted`),task_id:E(),task_subject:E(),task_description:E().optional(),teammate_name:E().optional(),team_name:E().optional()}))),Ua=S(()=>X().and(A({hook_event_name:_(`Elicitation`),mcp_server_name:E(),message:E(),mode:m([`form`,`url`]).optional(),url:E().optional(),elicitation_id:E().optional(),requested_schema:T(E(),y()).optional()})).describe(`Hook input for the Elicitation event. Fired when an MCP server requests user input. Hooks can auto-respond (accept/decline) instead of showing the dialog.`)),Wa=S(()=>X().and(A({hook_event_name:_(`ElicitationResult`),mcp_server_name:E(),elicitation_id:E().optional(),mode:m([`form`,`url`]).optional(),action:m([`accept`,`decline`,`cancel`]),content:T(E(),y()).optional()})).describe(`Hook input for the ElicitationResult event. Fired after the user responds to an MCP elicitation. Hooks can observe or override the response before it is sent to the server.`)),Ga=[`user_settings`,`project_settings`,`local_settings`,`policy_settings`,`skills`],Ka=S(()=>X().and(A({hook_event_name:_(`ConfigChange`),source:m(Ga),file_path:E().optional()}))),qa=[`session_start`,`nested_traversal`,`path_glob_match`,`include`,`compact`],Ja=[`User`,`Project`,`Local`,`Managed`],Ya=S(()=>X().and(A({hook_event_name:_(`InstructionsLoaded`),file_path:E(),memory_type:m(Ja),load_reason:m(qa),globs:h(E()).optional(),trigger_file_path:E().optional(),parent_file_path:E().optional()}))),Xa=S(()=>X().and(A({hook_event_name:_(`WorktreeCreate`),name:E()}))),Za=S(()=>X().and(A({hook_event_name:_(`WorktreeRemove`),worktree_path:E()}))),Qa=S(()=>X().and(A({hook_event_name:_(`CwdChanged`),old_cwd:E(),new_cwd:E()}))),$a=S(()=>X().and(A({hook_event_name:_(`FileChanged`),file_path:E(),event:m([`change`,`add`,`unlink`])}))),eo=[`clear`,`resume`,`prompt_input_exit`,`other`,`bypass_permissions_disabled`],to=S(()=>m(eo)),no=S(()=>X().and(A({hook_event_name:_(`SessionEnd`),reason:to()}))),ro=S(()=>k([Ta(),Da(),Oa(),ka(),Aa(),ja(),Ma(),no(),Pa(),Fa(),Ia(),La(),Ra(),za(),Ea(),Na(),Ba(),Va(),Ha(),Ua(),Wa(),Ka(),Ya(),Xa(),Za(),Qa(),$a()])),io=S(()=>A({async:_(!0),asyncTimeout:x().optional()})),ao=S(()=>A({hookEventName:_(`PreToolUse`),permissionDecision:va().optional(),permissionDecisionReason:E().optional(),updatedInput:T(E(),y()).optional(),additionalContext:E().optional()})),oo=S(()=>A({hookEventName:_(`UserPromptSubmit`),additionalContext:E().optional()})),so=S(()=>A({hookEventName:_(`SessionStart`),additionalContext:E().optional(),initialUserMessage:E().optional(),watchPaths:h(E()).optional()})),co=S(()=>A({hookEventName:_(`Setup`),additionalContext:E().optional()})),lo=S(()=>A({hookEventName:_(`SubagentStart`),additionalContext:E().optional()})),uo=S(()=>A({hookEventName:_(`PostToolUse`),additionalContext:E().optional(),updatedMCPToolOutput:y().optional()})),fo=S(()=>A({hookEventName:_(`PostToolUseFailure`),additionalContext:E().optional()})),po=S(()=>A({hookEventName:_(`PermissionDenied`),retry:c().optional()})),mo=S(()=>A({hookEventName:_(`Notification`),additionalContext:E().optional()})),ho=S(()=>A({hookEventName:_(`PermissionRequest`),decision:k([A({behavior:_(`allow`),updatedInput:T(E(),y()).optional(),updatedPermissions:h(ba()).optional()}),A({behavior:_(`deny`),message:E().optional(),interrupt:c().optional()})])})),go=S(()=>A({hookEventName:_(`CwdChanged`),watchPaths:h(E()).optional()})),_o=S(()=>A({hookEventName:_(`FileChanged`),watchPaths:h(E()).optional()})),vo=S(()=>A({continue:c().optional(),suppressOutput:c().optional(),stopReason:E().optional(),decision:m([`approve`,`block`]).optional(),systemMessage:E().optional(),reason:E().optional(),hookSpecificOutput:k([ao(),oo(),so(),co(),lo(),uo(),fo(),po(),mo(),ho(),yo(),bo(),go(),_o(),xo()]).optional()})),yo=S(()=>A({hookEventName:_(`Elicitation`),action:m([`accept`,`decline`,`cancel`]).optional(),content:T(E(),y()).optional()}).describe(`Hook-specific output for the Elicitation event. Return this to programmatically accept or decline an MCP elicitation request.`)),bo=S(()=>A({hookEventName:_(`ElicitationResult`),action:m([`accept`,`decline`,`cancel`]).optional(),content:T(E(),y()).optional()}).describe(`Hook-specific output for the ElicitationResult event. Return this to override the action or content before the response is sent to the MCP server.`)),xo=S(()=>A({hookEventName:_(`WorktreeCreate`),worktreePath:E()}).describe(`Hook-specific output for the WorktreeCreate event. Provides the absolute path to the created worktree directory. Command hooks print the path on stdout instead.`));S(()=>k([io(),vo()]));var So=S(()=>A({key:E().describe(`Unique key for this option, returned in the response`),label:E().describe(`Display text for this option`),description:E().optional().describe(`Optional description shown below the label`)}));S(()=>A({prompt:E().describe(`Request ID. Presence of this key marks the line as a prompt request.`),message:E().describe(`The prompt message to display to the user`),options:h(So()).describe(`Available options for the user to choose from`)})),S(()=>A({prompt_response:E().describe(`The request ID from the corresponding prompt request`),selected:E().describe(`The key of the selected option`)}));var Co=S(()=>A({name:E().describe(`Skill name (without the leading slash)`),description:E().describe(`Description of what the skill does`),argumentHint:E().describe(`Hint for skill arguments (e.g., "<file>")`)}).describe(`Information about an available skill (invoked via /command syntax).`)),wo=S(()=>A({name:E().describe(`Agent type identifier (e.g., "Explore")`),description:E().describe(`Description of when to use this agent`),model:E().optional().describe(`Model alias this agent uses. If omitted, inherits the parent's model`)}).describe(`Information about an available subagent that can be invoked via the Task tool.`)),To=S(()=>A({value:E().describe(`Model identifier to use in API calls`),displayName:E().describe(`Human-readable display name`),description:E().describe(`Description of the model's capabilities`),supportsAdaptiveThinking:c().optional().describe(`Whether this model supports adaptive thinking (Work Mate decides when and how much to think)`),supportsFastMode:c().optional().describe(`Whether this model supports fast mode`),supportsAutoMode:c().optional().describe(`Whether this model supports auto mode`)}).describe(`Information about an available model.`)),Eo=S(()=>A({email:E().optional(),organization:E().optional(),subscriptionType:E().optional(),tokenSource:E().optional(),apiKeySource:E().optional(),apiProvider:m([`firstParty`,`bedrock`,`vertex`,`foundry`]).optional().describe(`Active API backend. Anthropic OAuth login only applies when "firstParty"; for 3P providers the other fields are absent and auth is external (AWS creds, gcloud ADC, etc.).`)}).describe(`Information about the logged in user's account.`)),Do=S(()=>k([E(),T(E(),pa())])),Oo=S(()=>A({description:E().describe(`Natural language description of when to use this agent`),tools:h(E()).optional().describe(`Array of allowed tool names. If omitted, inherits all tools from parent`),disallowedTools:h(E()).optional().describe(`Array of tool names to explicitly disallow for this agent`),prompt:E().describe(`The agent's system prompt`),model:E().optional().describe(`Model alias (e.g. 'sonnet', 'opus', 'haiku') or full model ID (e.g. 'claude-opus-4-5'). If omitted or 'inherit', uses the main model`),mcpServers:h(Do()).optional(),criticalSystemReminder_EXPERIMENTAL:E().optional().describe(`Experimental: Critical reminder added to system prompt`),skills:h(E()).optional().describe(`Array of skill names to preload into the agent context`),initialPrompt:E().optional().describe(`Auto-submitted as the first user turn when this agent is the main thread agent. Slash commands are processed. Prepended to any user-provided prompt.`),maxTurns:x().int().positive().optional().describe(`Maximum number of agentic turns (API round-trips) before stopping`),background:c().optional().describe(`Run this agent as a background task (non-blocking, fire-and-forget) when invoked`),memory:m([`user`,`project`,`local`]).optional().describe(`Scope for auto-loading agent memory files. 'user' - ~/.workmate/agent-memory/<agentType>/, 'project' - .workmate/agent-memory/<agentType>/, 'local' - .workmate/agent-memory-local/<agentType>/`),permissionMode:Sa().optional().describe(`Permission mode controlling how tool executions are handled`)}).describe(`Definition for a custom subagent that can be invoked via the Agent tool.`));S(()=>m([`user`,`project`,`local`]).describe(`Source for loading filesystem-based settings. 'user' - Global user settings (~/.workmate/settings.json). 'project' - Project settings (.workmate/settings.json). 'local' - Local settings (.workmate/settings.local.json).`)),S(()=>A({type:_(`local`).describe(`Plugin type. Currently only 'local' is supported`),path:E().describe(`Absolute or relative path to the plugin directory`)}).describe(`Configuration for loading a plugin.`)),S(()=>A({canRewind:c(),error:E().optional(),filesChanged:h(E()).optional(),insertions:x().optional(),deletions:x().optional()}).describe(`Result of a rewindFiles operation.`));var ko=S(()=>y()),Ao=S(()=>y()),jo=S(()=>y()),Z=S(()=>E()),Mo=S(()=>y()),No=S(()=>m([`authentication_failed`,`billing_error`,`rate_limit`,`invalid_request`,`server_error`,`unknown`,`max_output_tokens`])),Po=S(()=>k([_(`compacting`),l()])),Fo=S(()=>A({type:_(`user`),message:ko(),parent_tool_use_id:E().nullable(),isSynthetic:c().optional(),tool_use_result:y().optional(),priority:m([`now`,`next`,`later`]).optional(),timestamp:E().optional().describe(`ISO timestamp when the message was created on the originating process. Older emitters omit it; consumers should fall back to receive time.`)})),Io=S(()=>Fo().extend({uuid:Z().optional(),session_id:E().optional()})),Lo=S(()=>Fo().extend({uuid:Z(),session_id:E(),isReplay:_(!0)})),Ro=S(()=>A({status:m([`allowed`,`allowed_warning`,`rejected`]),resetsAt:x().optional(),rateLimitType:m([`five_hour`,`seven_day`,`seven_day_opus`,`seven_day_sonnet`,`overage`]).optional(),utilization:x().optional(),overageStatus:m([`allowed`,`allowed_warning`,`rejected`]).optional(),overageResetsAt:x().optional(),overageDisabledReason:m([`overage_not_provisioned`,`org_level_disabled`,`org_level_disabled_until`,`out_of_credits`,`seat_tier_level_disabled`,`member_level_disabled`,`seat_tier_zero_credit_limit`,`group_zero_credit_limit`,`member_zero_credit_limit`,`org_service_level_disabled`,`org_service_zero_credit_limit`,`no_limits_configured`,`unknown`]).optional(),isUsingOverage:c().optional(),surpassedThreshold:x().optional()}).describe(`Rate limit information for claude.ai subscription users.`)),zo=S(()=>A({type:_(`assistant`),message:Ao(),parent_tool_use_id:E().nullable(),error:No().optional(),uuid:Z(),session_id:E()})),Bo=S(()=>A({type:_(`rate_limit_event`),rate_limit_info:Ro(),uuid:Z(),session_id:E()}).describe(`Rate limit event emitted when rate limit info changes.`)),Vo=S(()=>A({type:_(`streamlined_text`),text:E().describe(`Text content preserved from the assistant message`),session_id:E(),uuid:Z()}).describe(`@internal Streamlined text message - replaces SDKAssistantMessage in streamlined output. Text content preserved, thinking and tool_use blocks removed.`)),Ho=S(()=>A({type:_(`streamlined_tool_use_summary`),tool_summary:E().describe(`Summary of tool calls (e.g., "Read 2 files, wrote 1 file")`),session_id:E(),uuid:Z()}).describe(`@internal Streamlined tool use summary - replaces tool_use blocks in streamlined output with a cumulative summary string.`)),Uo=S(()=>A({tool_name:E(),tool_use_id:E(),tool_input:T(E(),y())})),Wo=S(()=>A({type:_(`result`),subtype:_(`success`),duration_ms:x(),duration_api_ms:x(),is_error:c(),num_turns:x(),result:E(),stop_reason:E().nullable(),total_cost_usd:x(),usage:Mo(),modelUsage:T(E(),na()),permission_denials:h(Uo()),structured_output:y().optional(),fast_mode_state:ms().optional(),uuid:Z(),session_id:E()})),Go=S(()=>A({type:_(`result`),subtype:m([`error_during_execution`,`error_max_turns`,`error_max_budget_usd`,`error_max_structured_output_retries`]),duration_ms:x(),duration_api_ms:x(),is_error:c(),num_turns:x(),stop_reason:E().nullable(),total_cost_usd:x(),usage:Mo(),modelUsage:T(E(),na()),permission_denials:h(Uo()),errors:h(E()),fast_mode_state:ms().optional(),uuid:Z(),session_id:E()})),Ko=S(()=>k([Wo(),Go()])),qo=S(()=>A({type:_(`system`),subtype:_(`init`),agents:h(E()).optional(),apiKeySource:aa(),betas:h(E()).optional(),claude_code_version:E(),cwd:E(),tools:h(E()),mcp_servers:h(A({name:E(),status:E()})),model:E(),permissionMode:Sa(),slash_commands:h(E()),output_style:E(),skills:h(E()),plugins:h(A({name:E(),path:E(),source:E().optional().describe(`@internal Plugin source identifier in "name\\@marketplace" format. Sentinels: "name\\@inline" for --plugin-dir, "name\\@builtin" for built-in plugins.`)})),fast_mode_state:ms().optional(),uuid:Z(),session_id:E()})),Jo=S(()=>A({type:_(`stream_event`),event:jo(),parent_tool_use_id:E().nullable(),uuid:Z(),session_id:E()})),Yo=S(()=>A({type:_(`system`),subtype:_(`compact_boundary`),compact_metadata:A({trigger:m([`manual`,`auto`]),pre_tokens:x(),preserved_segment:A({head_uuid:Z(),anchor_uuid:Z(),tail_uuid:Z()}).optional().describe(`Relink info for messagesToKeep. Loaders splice the preserved segment at anchor_uuid (summary for suffix-preserving, boundary for prefix-preserving partial compact) so resume includes preserved content. Unset when compaction summarizes everything (no messagesToKeep).`)}),uuid:Z(),session_id:E()})),Xo=S(()=>A({type:_(`system`),subtype:_(`status`),status:Po(),permissionMode:Sa().optional(),uuid:Z(),session_id:E()})),Zo=S(()=>A({type:_(`system`),subtype:_(`post_turn_summary`),summarizes_uuid:E(),status_category:m([`blocked`,`waiting`,`completed`,`review_ready`,`failed`]),status_detail:E(),is_noteworthy:c(),title:E(),description:E(),recent_action:E(),needs_action:E(),artifact_urls:h(E()),uuid:Z(),session_id:E()}).describe(`@internal Background post-turn summary emitted after each assistant turn. summarizes_uuid points to the assistant message this summarizes.`)),Qo=S(()=>A({type:_(`system`),subtype:_(`api_retry`),attempt:x(),max_retries:x(),retry_delay_ms:x(),error_status:x().nullable(),error:No(),uuid:Z(),session_id:E()}).describe(`Emitted when an API request fails with a retryable error and will be retried after a delay. error_status is null for connection errors (e.g. timeouts) that had no HTTP response.`)),$o=S(()=>A({type:_(`system`),subtype:_(`local_command_output`),content:E(),uuid:Z(),session_id:E()}).describe(`Output from a local slash command (e.g. /voice, /cost). Displayed as assistant-style text in the transcript.`)),es=S(()=>A({type:_(`system`),subtype:_(`hook_started`),hook_id:E(),hook_name:E(),hook_event:E(),uuid:Z(),session_id:E()})),ts=S(()=>A({type:_(`system`),subtype:_(`hook_progress`),hook_id:E(),hook_name:E(),hook_event:E(),stdout:E(),stderr:E(),output:E(),uuid:Z(),session_id:E()})),ns=S(()=>A({type:_(`system`),subtype:_(`hook_response`),hook_id:E(),hook_name:E(),hook_event:E(),output:E(),stdout:E(),stderr:E(),exit_code:x().optional(),outcome:m([`success`,`error`,`cancelled`]),uuid:Z(),session_id:E()})),rs=S(()=>A({type:_(`tool_progress`),tool_use_id:E(),tool_name:E(),parent_tool_use_id:E().nullable(),elapsed_time_seconds:x(),task_id:E().optional(),uuid:Z(),session_id:E()})),is=S(()=>A({type:_(`auth_status`),isAuthenticating:c(),output:h(E()),error:E().optional(),uuid:Z(),session_id:E()})),as=S(()=>A({type:_(`system`),subtype:_(`files_persisted`),files:h(A({filename:E(),file_id:E()})),failed:h(A({filename:E(),error:E()})),processed_at:E(),uuid:Z(),session_id:E()})),os=S(()=>A({type:_(`system`),subtype:_(`task_notification`),task_id:E(),tool_use_id:E().optional(),status:m([`completed`,`failed`,`stopped`]),output_file:E(),summary:E(),usage:A({total_tokens:x(),tool_uses:x(),duration_ms:x()}).optional(),uuid:Z(),session_id:E()})),ss=S(()=>A({type:_(`system`),subtype:_(`task_started`),task_id:E(),tool_use_id:E().optional(),description:E(),task_type:E().optional(),workflow_name:E().optional().describe(`meta.name from the workflow script (e.g. 'spec'). Only set when task_type is 'local_workflow'.`),prompt:E().optional(),uuid:Z(),session_id:E()})),cs=S(()=>A({type:_(`system`),subtype:_(`session_state_changed`),state:m([`idle`,`running`,`requires_action`]),uuid:Z(),session_id:E()}).describe(`Mirrors notifySessionStateChanged. 'idle' fires after heldBackResult flushes and the bg-agent do-while exits — authoritative turn-over signal.`)),ls=S(()=>A({type:_(`system`),subtype:_(`task_progress`),task_id:E(),tool_use_id:E().optional(),description:E(),usage:A({total_tokens:x(),tool_uses:x(),duration_ms:x()}),last_tool_name:E().optional(),summary:E().optional(),uuid:Z(),session_id:E()})),us=S(()=>A({type:_(`tool_use_summary`),summary:E(),preceding_tool_use_ids:h(E()),uuid:Z(),session_id:E()})),ds=S(()=>A({type:_(`system`),subtype:_(`elicitation_complete`),mcp_server_name:E(),elicitation_id:E(),uuid:Z(),session_id:E()}).describe(`Emitted when an MCP server confirms that a URL-mode elicitation is complete.`)),fs=S(()=>A({type:_(`prompt_suggestion`),suggestion:E(),uuid:Z(),session_id:E()}).describe(`Predicted next user prompt, emitted after each turn when promptSuggestions is enabled.`));S(()=>A({sessionId:E().describe(`Unique session identifier (UUID).`),summary:E().describe(`Display title for the session: custom title, auto-generated summary, or first prompt.`),lastModified:x().describe(`Last modified time in milliseconds since epoch.`),fileSize:x().optional().describe(`File size in bytes. Only populated for local JSONL storage.`),customTitle:E().optional().describe(`User-set session title via /rename.`),firstPrompt:E().optional().describe(`First meaningful user prompt in the session.`),gitBranch:E().optional().describe(`Git branch at the end of the session.`),cwd:E().optional().describe(`Working directory for the session.`),tag:E().optional().describe(`User-set session tag.`),createdAt:x().optional().describe(`Creation time in milliseconds since epoch, extracted from the first entry's timestamp.`)}).describe(`Session metadata returned by listSessions and getSessionInfo.`));var ps=S(()=>k([zo(),Io(),Lo(),Ko(),qo(),Jo(),Yo(),Xo(),Qo(),$o(),es(),ts(),ns(),rs(),is(),os(),ss(),ls(),cs(),as(),us(),Bo(),ds(),fs()])),ms=S(()=>m([`off`,`cooldown`,`on`]).describe(`Fast mode state: off, in cooldown after rate limit, or actively enabled.`));u(),s();var hs=S(()=>y()),gs=S(()=>A({matcher:E().optional(),hookCallbackIds:h(E()),timeout:x().optional()}).describe(`Configuration for matching and routing hook callbacks.`)),_s=S(()=>A({subtype:_(`initialize`),hooks:T(wa(),h(gs())).optional(),sdkMcpServers:h(E()).optional(),jsonSchema:T(E(),y()).optional(),systemPrompt:E().optional(),appendSystemPrompt:E().optional(),agents:T(E(),Oo()).optional(),promptSuggestions:c().optional(),agentProgressSummaries:c().optional()}).describe(`Initializes the SDK session with hooks, MCP servers, and agent configuration.`));S(()=>A({commands:h(Co()),agents:h(wo()),output_style:E(),available_output_styles:h(E()),models:h(To()),account:Eo(),pid:x().optional().describe(`@internal CLI process PID for tmux socket isolation`),fast_mode_state:ms().optional()}).describe(`Response from session initialization with available commands, models, and account info.`));var vs=S(()=>A({subtype:_(`interrupt`)}).describe(`Interrupts the currently running conversation turn.`)),ys=S(()=>A({subtype:_(`can_use_tool`),tool_name:E(),input:T(E(),y()),permission_suggestions:h(ba()).optional(),blocked_path:E().optional(),decision_reason:E().optional(),title:E().optional(),display_name:E().optional(),tool_use_id:E(),agent_id:E().optional(),description:E().optional()}).describe(`Requests permission to use a tool with the given input.`)),bs=S(()=>A({subtype:_(`set_permission_mode`),mode:Sa()}).describe(`Sets the permission mode for tool execution handling.`)),xs=S(()=>A({subtype:_(`set_model`),model:E().optional()}).describe(`Sets the model to use for subsequent conversation turns.`)),Ss=S(()=>A({subtype:_(`set_max_thinking_tokens`),max_thinking_tokens:x().nullable()}).describe(`Sets the maximum number of thinking tokens for extended thinking.`)),Cs=S(()=>A({subtype:_(`mcp_status`)}).describe(`Requests the current status of all MCP server connections.`));S(()=>A({mcpServers:h(ga())}).describe(`Response containing the current status of all MCP server connections.`));var ws=S(()=>A({subtype:_(`get_context_usage`)}).describe(`Requests a breakdown of current context window usage by category.`)),Ts=S(()=>A({name:E(),tokens:x(),color:E(),isDeferred:c().optional()})),Es=S(()=>A({color:E(),isFilled:c(),categoryName:E(),tokens:x(),percentage:x(),squareFullness:x()}));S(()=>A({categories:h(Ts()),totalTokens:x(),maxTokens:x(),rawMaxTokens:x(),percentage:x(),gridRows:h(h(Es())),model:E(),memoryFiles:h(A({path:E(),type:E(),tokens:x()})),mcpTools:h(A({name:E(),serverName:E(),tokens:x(),isLoaded:c().optional()})),deferredBuiltinTools:h(A({name:E(),tokens:x(),isLoaded:c()})).optional(),systemTools:h(A({name:E(),tokens:x()})).optional(),systemPromptSections:h(A({name:E(),tokens:x()})).optional(),agents:h(A({agentType:E(),source:E(),tokens:x()})),slashCommands:A({totalCommands:x(),includedCommands:x(),tokens:x()}).optional(),skills:A({totalSkills:x(),includedSkills:x(),tokens:x(),skillFrontmatter:h(A({name:E(),source:E(),tokens:x()}))}).optional(),autoCompactThreshold:x().optional(),isAutoCompactEnabled:c(),messageBreakdown:A({toolCallTokens:x(),toolResultTokens:x(),attachmentTokens:x(),assistantMessageTokens:x(),userMessageTokens:x(),toolCallsByType:h(A({name:E(),callTokens:x(),resultTokens:x()})),attachmentsByType:h(A({name:E(),tokens:x()}))}).optional(),apiUsage:A({input_tokens:x(),output_tokens:x(),cache_creation_input_tokens:x(),cache_read_input_tokens:x()}).nullable()}).describe(`Breakdown of current context window usage by category (system prompt, tools, messages, etc.).`));var Ds=S(()=>A({subtype:_(`rewind_files`),user_message_id:E(),dry_run:c().optional()}).describe(`Rewinds file changes made since a specific user message.`));S(()=>A({canRewind:c(),error:E().optional(),filesChanged:h(E()).optional(),insertions:x().optional(),deletions:x().optional()}).describe(`Result of a rewindFiles operation.`));var Os=S(()=>A({subtype:_(`cancel_async_message`),message_uuid:E()}).describe(`Drops a pending async user message from the command queue by uuid. No-op if already dequeued for execution.`));S(()=>A({cancelled:c()}).describe(`Result of a cancel_async_message operation. cancelled=false means the message was not in the queue (already dequeued or never enqueued).`));var ks=S(()=>A({subtype:_(`seed_read_state`),path:E(),mtime:x()}).describe(`Seeds the readFileState cache with a path+mtime entry. Use when a prior Read was removed from context (e.g. by snip) so Edit validation would fail despite the client having observed the Read. The mtime lets the CLI detect if the file changed since the seeded Read — same staleness check as the normal path.`)),As=S(()=>A({subtype:_(`hook_callback`),callback_id:E(),input:ro(),tool_use_id:E().optional()}).describe(`Delivers a hook callback with its input data.`)),js=S(()=>A({subtype:_(`mcp_message`),server_name:E(),message:hs()}).describe(`Sends a JSON-RPC message to a specific MCP server.`)),Ms=S(()=>A({subtype:_(`mcp_set_servers`),servers:T(E(),pa())}).describe(`Replaces the set of dynamically managed MCP servers.`));S(()=>A({added:h(E()),removed:h(E()),errors:T(E(),E())}).describe(`Result of replacing the set of dynamically managed MCP servers.`));var Ns=S(()=>A({subtype:_(`reload_plugins`)}).describe(`Reloads plugins from disk and returns the refreshed session components.`));S(()=>A({commands:h(Co()),agents:h(wo()),plugins:h(A({name:E(),path:E(),source:E().optional()})),mcpServers:h(ga()),error_count:x()}).describe(`Refreshed commands, agents, plugins, and MCP server status after reload.`));var Ps=S(()=>A({subtype:_(`mcp_reconnect`),serverName:E()}).describe(`Reconnects a disconnected or failed MCP server.`)),Fs=S(()=>A({subtype:_(`mcp_toggle`),serverName:E(),enabled:c()}).describe(`Enables or disables an MCP server.`)),Is=S(()=>A({subtype:_(`stop_task`),task_id:E()}).describe(`Stops a running task.`)),Ls=S(()=>A({subtype:_(`apply_flag_settings`),settings:T(E(),y())}).describe(`Merges the provided settings into the flag settings layer, updating the active configuration.`)),Rs=S(()=>A({subtype:_(`get_settings`)}).describe(`Returns the effective merged settings and the raw per-source settings.`));S(()=>A({effective:T(E(),y()),sources:h(A({source:m([`userSettings`,`projectSettings`,`localSettings`,`flagSettings`,`policySettings`]),settings:T(E(),y())})).describe(`Ordered low-to-high priority — later entries override earlier ones.`),applied:A({model:E()}).optional().describe("Runtime-resolved values after env overrides, session state, and model-specific defaults are applied. Unlike `effective` (disk merge), these reflect what will actually be sent to the API.")}).describe(`Effective merged settings plus raw per-source settings in merge order.`));var zs=S(()=>A({subtype:_(`elicitation`),mcp_server_name:E(),message:E(),mode:m([`form`,`url`]).optional(),url:E().optional(),elicitation_id:E().optional(),requested_schema:T(E(),y()).optional()}).describe(`Requests the SDK consumer to handle an MCP elicitation (user input request).`)),Bs=S(()=>A({action:m([`accept`,`decline`,`cancel`]),content:T(E(),y()).optional()}).describe(`Response from the SDK consumer for an elicitation request.`)),Vs=S(()=>k([vs(),ys(),_s(),bs(),xs(),Ss(),Cs(),ws(),As(),js(),Ds(),Os(),ks(),Ms(),Ns(),Ps(),Fs(),Is(),Ls(),Rs(),zs()])),Hs=S(()=>A({type:_(`control_request`),request_id:E(),request:Vs()})),Us=S(()=>A({subtype:_(`success`),request_id:E(),response:T(E(),y()).optional()})),Ws=S(()=>A({subtype:_(`error`),request_id:E(),error:E(),pending_permission_requests:h(g(()=>Hs())).optional()})),Gs=S(()=>A({type:_(`control_response`),response:k([Us(),Ws()])})),Ks=S(()=>A({type:_(`control_cancel_request`),request_id:E()}).describe(`Cancels a currently open control request.`)),qs=S(()=>A({type:_(`keep_alive`)}).describe(`Keep-alive message to maintain WebSocket connection.`)),Js=S(()=>A({type:_(`update_environment_variables`),variables:T(E(),E())}).describe(`Updates environment variables at runtime.`));S(()=>k([ps(),Vo(),Ho(),Zo(),Gs(),Hs(),Ks(),qs()])),S(()=>k([Io(),Hs(),Gs(),qs(),Js()])),n(),i(),me(),Br(),Hr(),Jr(),Kr(),Qr(),j(),bn(),u(),G(),s(),ft(),kr(),S(()=>d.object({tool_name:d.string().describe(`The name of the tool requesting permission`),input:d.record(d.string(),d.unknown()).describe(`The input for the tool`),tool_use_id:d.string().optional().describe(`The unique tool use request ID`)}));var Ys=S(()=>d.enum([`user_temporary`,`user_permanent`,`user_reject`]).optional().catch(void 0)),Xs=S(()=>d.object({behavior:d.literal(`allow`),updatedInput:d.record(d.string(),d.unknown()),updatedPermissions:d.array(It()).optional().catch(e=>{W(`Malformed updatedPermissions from SDK host ignored: ${e.error.issues[0]?.message??`unknown`}`,{level:`warn`})}),toolUseID:d.string().optional(),decisionClassification:Ys()})),Zs=S(()=>d.object({behavior:d.literal(`deny`),message:d.string(),interrupt:d.boolean().optional(),toolUseID:d.string().optional(),decisionClassification:Ys()})),Qs=S(()=>d.union([Xs(),Zs()]));function $s(e,t,n,r){let i={type:`permissionPromptTool`,permissionPromptToolName:t.name,toolResult:e};if(e.behavior===`allow`){let t=e.updatedPermissions;t&&(r.setAppState(e=>({...e,toolPermissionContext:L(e.toolPermissionContext,t)})),Et(t));let a=Object.keys(e.updatedInput).length>0?e.updatedInput:n;return{...e,updatedInput:a,decisionReason:i}}else e.behavior===`deny`&&e.interrupt&&(W(`SDK permission prompt deny+interrupt: tool=${t.name} message=${e.message}`),r.abortController.abort());return{...e,decisionReason:i}}Rr(),ri(),ni(),D(),M(),w(),ae(),ie(),xi(),bi(),Xt(),Gn(),ur(),Ae(),z(),xn(),Tr(),Ht(),zt(),mt(),Pt(),Pn(),Kn(),Cn(),it(),pt(),An(),jn(),xr(),Yn(),Wt();var ec=/\u2028|\u2029/g;function tc(e){return e.replace(ec,e=>e===`\u2028`?`\\u2028`:`\\u2029`)}function nc(e){return tc(H(e))}G(),Jr(),u(),ft();var rc=`SandboxNetworkAccess`;function ic(e){if(e){if(e.type===`classifier`)return e.reason;switch(e.type){case`rule`:case`mode`:case`subcommandResults`:case`permissionPromptTool`:return;case`hook`:case`asyncAgent`:case`sandboxOverride`:case`workingDir`:case`safetyCheck`:case`other`:return e.reason}}}function ac(e,t,n,r){let i;try{i=e.getActivityDescription?.(t)??e.getToolUseSummary?.(t)??e.userFacingName(t)}catch{i=e.name}return{tool_name:e.name,action_description:i,tool_use_id:n,request_id:r,input:t}}var oc=1e3,sc=class{constructor(e,t){a(this,`input`,void 0),a(this,`replayUserMessages`,void 0),a(this,`structuredInput`,void 0),a(this,`pendingRequests`,new Map),a(this,`restoredWorkerState`,Promise.resolve(null)),a(this,`inputClosed`,!1),a(this,`unexpectedResponseCallback`,void 0),a(this,`resolvedToolUseIds`,new Set),a(this,`prependedLines`,[]),a(this,`onControlRequestSent`,void 0),a(this,`onControlRequestResolved`,void 0),a(this,`outbound`,new Dr),this.input=e,this.replayUserMessages=t,this.input=e,this.structuredInput=this.read()}trackResolvedToolUseId(e){let t=e.request;if(t.subtype===`can_use_tool`&&(this.resolvedToolUseIds.add(t.tool_use_id),this.resolvedToolUseIds.size>oc)){let e=this.resolvedToolUseIds.values().next().value;e!==void 0&&this.resolvedToolUseIds.delete(e)}}flushInternalEvents(){return Promise.resolve()}get internalEventsPending(){return 0}prependUserMessage(e){this.prependedLines.push(`${H({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})}\n`)}async*read(){let e=``,t=async function*(){for(;;){this.prependedLines.length>0&&(e=this.prependedLines.join(``)+e,this.prependedLines=[]);let t=e.indexOf(`
|
|
1
|
+
import{c as e,l as t,o as n,s as r}from"./envUtils-QyzA_cFM.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{$n as o,$t as s,Gi as c,Hi as l,Ni as u,Pi as d,U as f,Ui as p,Vi as m,Wi as h,Xi as g,Zi as _,bn as v,ca as y,d as b,di as ee,dr as te,ea as x,en as S,et as ne,fi as C,gt as w,ia as T,lt as re,m as ie,nt as ae,oa as E,pr as D,qi as O,sa as k,ta as A,tr as oe,u as se,ui as j,vn as M}from"./settings-D4M13toi.js";import{A as ce,Ft as le,Hn as ue,Ht as de,Mn as fe,O as pe,Pt as me,W as he,at as N,nn as ge,on as P,vn as _e,yn as ve}from"./state-CXY-q5gr.js";import{$d as F,$h as I,$r as ye,A as be,AC as xe,Aa as Se,Ad as Ce,Ag as L,As as R,Av as z,B as we,Bd as Te,Bl as Ee,Bo as De,Bp as Oe,Bt as ke,Bv as Ae,C as je,Cc as Me,Cg as Ne,Ci as Pe,Cs as Fe,Cv as Ie,DC as Le,Da as Re,Dc as ze,Dg as Be,Di as Ve,Ep as He,Fl as Ue,Fo as We,Gf as Ge,Gn as Ke,Gp as qe,Gu as Je,Gv as Ye,HC as Xe,Ho as Ze,Hp as Qe,Ia as $e,Id as et,Il as tt,Io as nt,Iv as rt,Ji as it,Jp as at,KC as ot,Kp as st,Kv as ct,Ll as lt,Lo as ut,Lr as dt,Mg as ft,Mi as pt,Ml as mt,Ms as ht,NC as gt,Nd as _t,Ni as vt,Nv as yt,Oa as bt,Od as xt,Og as St,Ov as Ct,PC as wt,Pa as Tt,Pg as Et,Ps as Dt,Qh as Ot,Qp as kt,Qr as At,Rd as jt,Ro as Mt,Rs as Nt,Sc as Pt,Sf as Ft,Sn as It,Sv as Lt,Ti as Rt,Tp as zt,Uh as Bt,Uo as Vt,Up as Ht,Us as Ut,V as Wt,VC as Gt,Vl as Kt,Vo as qt,Vp as Jt,Vt as Yt,WC as Xt,Wh as Zt,Wo as Qt,Wp as $t,Ws as en,Wv as tn,Xd as nn,Xr as rn,Yn as an,Yp as on,Yr as sn,_c as cn,_i as ln,_n as un,_u as dn,_v as fn,aC as pn,af as mn,ag as hn,ao as gn,b as _n,bS as vn,bc as yn,bn,bv as xn,cp as Sn,cs as Cn,dC as wn,eg as Tn,f as En,fC as Dn,fh as On,fo as kn,gi as An,gr as jn,gu as Mn,gv as Nn,hc as Pn,hf as Fn,hi as B,ho as In,iC as Ln,i_ as Rn,ig as zn,jC as Bn,jl as Vn,js as Hn,kd as Un,kv as Wn,lC as Gn,ls as Kn,mc as qn,mi as Jn,mn as Yn,n_ as Xn,o as Zn,of as Qn,oo as $n,ph as er,qC as tr,qS as nr,qf as rr,qp as ir,qu as ar,qx as or,rC as sr,r_ as cr,s as lr,sC as ur,sf as dr,ss as fr,t_ as pr,uC as mr,uf as hr,uo as gr,us as _r,uw as vr,v as yr,vc as br,vn as xr,vv as Sr,w as Cr,wc as wr,wg as Tr,wv as Er,xc as Dr,xf as Or,xn as kr,xs as Ar,y as jr,yf as Mr,yn as Nr,zd as Pr,zo as Fr,zp as V,zs as Ir,zv as Lr}from"./loadAgentsDir-bmpKLPdG.js";import{n as Rr,t as zr}from"./cwd-DrEEb4f5.js";import{$ as Br,C as H,E as Vr,I as Hr,M as U,S as Ur,V as Wr,c as W,et as Gr,f as Kr,i as G,u as qr,x as Jr}from"./debug-2pVES-2G.js";import{C as Yr,E as Xr}from"./config-Bio2EjUK.js";import{i as Zr,n as Qr,o as K}from"./process-gEbdy6uY.js";import{H as $r,c as ei,i as ti,o as ni,q as ri,s as q}from"./log-L1kqxa_P.js";import{n as ii}from"./analytics-COpjZpvd.js";import{At as ai,D as oi,Mt as si,Pt as ci,f as li,g as ui,jt as di,k as fi,r as pi,s as mi,v as hi}from"./model-Dd3x121y.js";import{at as gi,bn as _i,bt as vi,it as yi,tn as bi,vn as xi,xt as Si,yt as Ci}from"./prompt-BnDapYGL.js";import{n as wi,t as Ti}from"./sleep-xKMbXTJe.js";import{i as Ei,n as Di,r as Oi,t as ki}from"./reject-Tug1RmkE.js";import{t as Ai}from"./pluginBlocklist-ByRQaVPu.js";import{n as ji,t as Mi}from"./toolPool-BGfiNj6h.js";import{n as Ni}from"./conversationRecovery-_hWC7JBO.js";import{a as Pi,i as Fi,n as Ii,r as Li}from"./QueryEngine-DAwfp_ht.js";import{n as Ri,r as zi}from"./sessionTitle-k4wpUS5l.js";import{n as Bi,r as Vi}from"./sideQuestion-BJTVma-5.js";import{n as Hi,r as Ui}from"./context-noninteractive-BcBo64vo.js";import{n as Wi,r as Gi}from"./modelOptions-BQL4gbNk.js";import{a as Ki,o as qi,t as Ji}from"./skillChangeDetector-DlodgOyC.js";import{n as Yi}from"./reconciler-C_HKsocm.js";import{n as Xi,t as Zi}from"./refresh-Cm4jZzLa.js";import{dirname as Qi,join as $i}from"path";import{randomUUID as J}from"crypto";import{readFile as ea,stat as ta}from"fs/promises";import{cwd as Y}from"process";u(),s();var na=S(()=>A({inputTokens:x(),outputTokens:x(),cacheReadInputTokens:x(),cacheCreationInputTokens:x(),webSearchRequests:x(),costUSD:x(),contextWindow:x(),maxOutputTokens:x()})),ra=S(()=>_(`json_schema`));S(()=>A({type:ra()}));var ia=S(()=>A({type:_(`json_schema`),schema:T(E(),y())}));S(()=>ia());var aa=S(()=>m([`user`,`project`,`org`,`temporary`,`oauth`]));S(()=>m([`local`,`user`,`project`]).describe(`Config scope for settings.`)),S(()=>_(`context-1m-2025-08-07`));var oa=S(()=>A({type:_(`adaptive`)}).describe(`Work Mate decides when and how much to think (Opus 4.6+).`)),sa=S(()=>A({type:_(`enabled`),budgetTokens:x().optional()}).describe(`Fixed thinking token budget (older models)`)),ca=S(()=>A({type:_(`disabled`)}).describe(`No extended thinking`));S(()=>k([oa(),sa(),ca()]).describe(`Controls Work Mate's thinking/reasoning behavior. When set, takes precedence over the deprecated maxThinkingTokens.`));var la=S(()=>A({type:_(`stdio`).optional(),command:E(),args:h(E()).optional(),env:T(E(),E()).optional()})),ua=S(()=>A({type:_(`sse`),url:E(),headers:T(E(),E()).optional()})),da=S(()=>A({type:_(`http`),url:E(),headers:T(E(),E()).optional()})),fa=S(()=>A({type:_(`sdk`),name:E()})),pa=S(()=>k([la(),ua(),da(),fa()])),ma=S(()=>A({type:_(`claudeai-proxy`),url:E(),id:E()})),ha=S(()=>k([pa(),ma()])),ga=S(()=>A({name:E().describe(`Server name as configured`),status:m([`connected`,`failed`,`needs-auth`,`pending`,`disabled`]).describe(`Current connection status`),serverInfo:A({name:E(),version:E()}).optional().describe(`Server information (available when connected)`),error:E().optional().describe(`Error message (available when status is 'failed')`),config:ha().optional().describe(`Server configuration (includes URL for HTTP/SSE servers)`),scope:E().optional().describe(`Configuration scope (e.g., project, user, local, claudeai, managed)`),tools:h(A({name:E(),description:E().optional(),annotations:A({readOnly:c().optional(),destructive:c().optional(),openWorld:c().optional()}).optional()})).optional().describe(`Tools provided by this server (available when connected)`),capabilities:A({experimental:T(E(),y()).optional()}).optional().describe(`@internal Server capabilities (available when connected). experimental['claude/channel'] is only present if the server's plugin is on the approved channels allowlist — use its presence to decide whether to show an Enable-channel prompt.`)}).describe(`Status information for an MCP server connection.`));S(()=>A({added:h(E()).describe(`Names of servers that were added`),removed:h(E()).describe(`Names of servers that were removed`),errors:T(E(),E()).describe(`Map of server names to error messages for servers that failed to connect`)}).describe(`Result of a setMcpServers operation.`));var _a=S(()=>m([`userSettings`,`projectSettings`,`localSettings`,`session`,`cliArg`])),va=S(()=>m([`allow`,`deny`,`ask`])),ya=S(()=>A({toolName:E(),ruleContent:E().optional()})),ba=S(()=>O(`type`,[A({type:_(`addRules`),rules:h(ya()),behavior:va(),destination:_a()}),A({type:_(`replaceRules`),rules:h(ya()),behavior:va(),destination:_a()}),A({type:_(`removeRules`),rules:h(ya()),behavior:va(),destination:_a()}),A({type:_(`setMode`),mode:g(()=>Sa()),destination:_a()}),A({type:_(`addDirectories`),directories:h(E()),destination:_a()}),A({type:_(`removeDirectories`),directories:h(E()),destination:_a()})])),xa=S(()=>m([`user_temporary`,`user_permanent`,`user_reject`]).describe(`Classification of this permission decision for telemetry. SDK hosts that prompt users (desktop apps, IDEs) should set this to reflect what actually happened: user_temporary for allow-once, user_permanent for always-allow (both the click and later cache hits), user_reject for deny. If unset, the CLI infers conservatively (temporary for allow, reject for deny). The vocabulary matches tool_decision OTel events (monitoring-usage docs).`));S(()=>k([A({behavior:_(`allow`),updatedInput:T(E(),y()).optional(),updatedPermissions:h(ba()).optional(),toolUseID:E().optional(),decisionClassification:xa().optional()}),A({behavior:_(`deny`),message:E(),interrupt:c().optional(),toolUseID:E().optional(),decisionClassification:xa().optional()})]));var Sa=S(()=>m([`default`,`acceptEdits`,`bypassPermissions`,`plan`,`dontAsk`,`auto`]).describe(`Permission mode for controlling how tool executions are handled. 'default' - Standard behavior, prompts for dangerous operations. 'acceptEdits' - Auto-accept file edit operations. 'bypassPermissions' - Bypass all permission checks (requires allowDangerouslySkipPermissions). 'plan' - Planning mode, no actual tool execution. 'dontAsk' - Don't prompt for permissions, deny if not pre-approved. 'auto' - Automatic mode (transcript classifier).`)),Ca=`PreToolUse.PostToolUse.PostToolUseFailure.Notification.UserPromptSubmit.SessionStart.SessionEnd.Stop.StopFailure.SubagentStart.SubagentStop.PreCompact.PostCompact.PermissionRequest.PermissionDenied.Setup.TeammateIdle.TaskCreated.TaskCompleted.Elicitation.ElicitationResult.ConfigChange.WorktreeCreate.WorktreeRemove.InstructionsLoaded.CwdChanged.FileChanged`.split(`.`),wa=S(()=>m(Ca)),X=S(()=>A({session_id:E(),transcript_path:E(),cwd:E(),permission_mode:E().optional(),agent_id:E().optional().describe(`Subagent identifier. Present only when the hook fires from within a subagent (e.g., a tool called by an AgentTool worker). Absent for the main thread, even in --agent sessions. Use this field (not agent_type) to distinguish subagent calls from main-thread calls.`),agent_type:E().optional().describe(`Agent type name (e.g., "general-purpose", "code-reviewer"). Present when the hook fires from within a subagent (alongside agent_id), or on the main thread of a session started with --agent (without agent_id).`)})),Ta=S(()=>X().and(A({hook_event_name:_(`PreToolUse`),tool_name:E(),tool_input:y(),tool_use_id:E()}))),Ea=S(()=>X().and(A({hook_event_name:_(`PermissionRequest`),tool_name:E(),tool_input:y(),permission_suggestions:h(ba()).optional()}))),Da=S(()=>X().and(A({hook_event_name:_(`PostToolUse`),tool_name:E(),tool_input:y(),tool_response:y(),tool_use_id:E()}))),Oa=S(()=>X().and(A({hook_event_name:_(`PostToolUseFailure`),tool_name:E(),tool_input:y(),tool_use_id:E(),error:E(),is_interrupt:c().optional()}))),ka=S(()=>X().and(A({hook_event_name:_(`PermissionDenied`),tool_name:E(),tool_input:y(),tool_use_id:E(),reason:E()}))),Aa=S(()=>X().and(A({hook_event_name:_(`Notification`),message:E(),title:E().optional(),notification_type:E()}))),ja=S(()=>X().and(A({hook_event_name:_(`UserPromptSubmit`),prompt:E()}))),Ma=S(()=>X().and(A({hook_event_name:_(`SessionStart`),source:m([`startup`,`resume`,`clear`,`compact`]),agent_type:E().optional(),model:E().optional()}))),Na=S(()=>X().and(A({hook_event_name:_(`Setup`),trigger:m([`init`,`maintenance`])}))),Pa=S(()=>X().and(A({hook_event_name:_(`Stop`),stop_hook_active:c(),last_assistant_message:E().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),Fa=S(()=>X().and(A({hook_event_name:_(`StopFailure`),error:No(),error_details:E().optional(),last_assistant_message:E().optional()}))),Ia=S(()=>X().and(A({hook_event_name:_(`SubagentStart`),agent_id:E(),agent_type:E()}))),La=S(()=>X().and(A({hook_event_name:_(`SubagentStop`),stop_hook_active:c(),agent_id:E(),agent_transcript_path:E(),agent_type:E(),last_assistant_message:E().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),Ra=S(()=>X().and(A({hook_event_name:_(`PreCompact`),trigger:m([`manual`,`auto`]),custom_instructions:E().nullable()}))),za=S(()=>X().and(A({hook_event_name:_(`PostCompact`),trigger:m([`manual`,`auto`]),compact_summary:E().describe(`The conversation summary produced by compaction`)}))),Ba=S(()=>X().and(A({hook_event_name:_(`TeammateIdle`),teammate_name:E(),team_name:E()}))),Va=S(()=>X().and(A({hook_event_name:_(`TaskCreated`),task_id:E(),task_subject:E(),task_description:E().optional(),teammate_name:E().optional(),team_name:E().optional()}))),Ha=S(()=>X().and(A({hook_event_name:_(`TaskCompleted`),task_id:E(),task_subject:E(),task_description:E().optional(),teammate_name:E().optional(),team_name:E().optional()}))),Ua=S(()=>X().and(A({hook_event_name:_(`Elicitation`),mcp_server_name:E(),message:E(),mode:m([`form`,`url`]).optional(),url:E().optional(),elicitation_id:E().optional(),requested_schema:T(E(),y()).optional()})).describe(`Hook input for the Elicitation event. Fired when an MCP server requests user input. Hooks can auto-respond (accept/decline) instead of showing the dialog.`)),Wa=S(()=>X().and(A({hook_event_name:_(`ElicitationResult`),mcp_server_name:E(),elicitation_id:E().optional(),mode:m([`form`,`url`]).optional(),action:m([`accept`,`decline`,`cancel`]),content:T(E(),y()).optional()})).describe(`Hook input for the ElicitationResult event. Fired after the user responds to an MCP elicitation. Hooks can observe or override the response before it is sent to the server.`)),Ga=[`user_settings`,`project_settings`,`local_settings`,`policy_settings`,`skills`],Ka=S(()=>X().and(A({hook_event_name:_(`ConfigChange`),source:m(Ga),file_path:E().optional()}))),qa=[`session_start`,`nested_traversal`,`path_glob_match`,`include`,`compact`],Ja=[`User`,`Project`,`Local`,`Managed`],Ya=S(()=>X().and(A({hook_event_name:_(`InstructionsLoaded`),file_path:E(),memory_type:m(Ja),load_reason:m(qa),globs:h(E()).optional(),trigger_file_path:E().optional(),parent_file_path:E().optional()}))),Xa=S(()=>X().and(A({hook_event_name:_(`WorktreeCreate`),name:E()}))),Za=S(()=>X().and(A({hook_event_name:_(`WorktreeRemove`),worktree_path:E()}))),Qa=S(()=>X().and(A({hook_event_name:_(`CwdChanged`),old_cwd:E(),new_cwd:E()}))),$a=S(()=>X().and(A({hook_event_name:_(`FileChanged`),file_path:E(),event:m([`change`,`add`,`unlink`])}))),eo=[`clear`,`resume`,`prompt_input_exit`,`other`,`bypass_permissions_disabled`],to=S(()=>m(eo)),no=S(()=>X().and(A({hook_event_name:_(`SessionEnd`),reason:to()}))),ro=S(()=>k([Ta(),Da(),Oa(),ka(),Aa(),ja(),Ma(),no(),Pa(),Fa(),Ia(),La(),Ra(),za(),Ea(),Na(),Ba(),Va(),Ha(),Ua(),Wa(),Ka(),Ya(),Xa(),Za(),Qa(),$a()])),io=S(()=>A({async:_(!0),asyncTimeout:x().optional()})),ao=S(()=>A({hookEventName:_(`PreToolUse`),permissionDecision:va().optional(),permissionDecisionReason:E().optional(),updatedInput:T(E(),y()).optional(),additionalContext:E().optional()})),oo=S(()=>A({hookEventName:_(`UserPromptSubmit`),additionalContext:E().optional()})),so=S(()=>A({hookEventName:_(`SessionStart`),additionalContext:E().optional(),initialUserMessage:E().optional(),watchPaths:h(E()).optional()})),co=S(()=>A({hookEventName:_(`Setup`),additionalContext:E().optional()})),lo=S(()=>A({hookEventName:_(`SubagentStart`),additionalContext:E().optional()})),uo=S(()=>A({hookEventName:_(`PostToolUse`),additionalContext:E().optional(),updatedMCPToolOutput:y().optional()})),fo=S(()=>A({hookEventName:_(`PostToolUseFailure`),additionalContext:E().optional()})),po=S(()=>A({hookEventName:_(`PermissionDenied`),retry:c().optional()})),mo=S(()=>A({hookEventName:_(`Notification`),additionalContext:E().optional()})),ho=S(()=>A({hookEventName:_(`PermissionRequest`),decision:k([A({behavior:_(`allow`),updatedInput:T(E(),y()).optional(),updatedPermissions:h(ba()).optional()}),A({behavior:_(`deny`),message:E().optional(),interrupt:c().optional()})])})),go=S(()=>A({hookEventName:_(`CwdChanged`),watchPaths:h(E()).optional()})),_o=S(()=>A({hookEventName:_(`FileChanged`),watchPaths:h(E()).optional()})),vo=S(()=>A({continue:c().optional(),suppressOutput:c().optional(),stopReason:E().optional(),decision:m([`approve`,`block`]).optional(),systemMessage:E().optional(),reason:E().optional(),hookSpecificOutput:k([ao(),oo(),so(),co(),lo(),uo(),fo(),po(),mo(),ho(),yo(),bo(),go(),_o(),xo()]).optional()})),yo=S(()=>A({hookEventName:_(`Elicitation`),action:m([`accept`,`decline`,`cancel`]).optional(),content:T(E(),y()).optional()}).describe(`Hook-specific output for the Elicitation event. Return this to programmatically accept or decline an MCP elicitation request.`)),bo=S(()=>A({hookEventName:_(`ElicitationResult`),action:m([`accept`,`decline`,`cancel`]).optional(),content:T(E(),y()).optional()}).describe(`Hook-specific output for the ElicitationResult event. Return this to override the action or content before the response is sent to the MCP server.`)),xo=S(()=>A({hookEventName:_(`WorktreeCreate`),worktreePath:E()}).describe(`Hook-specific output for the WorktreeCreate event. Provides the absolute path to the created worktree directory. Command hooks print the path on stdout instead.`));S(()=>k([io(),vo()]));var So=S(()=>A({key:E().describe(`Unique key for this option, returned in the response`),label:E().describe(`Display text for this option`),description:E().optional().describe(`Optional description shown below the label`)}));S(()=>A({prompt:E().describe(`Request ID. Presence of this key marks the line as a prompt request.`),message:E().describe(`The prompt message to display to the user`),options:h(So()).describe(`Available options for the user to choose from`)})),S(()=>A({prompt_response:E().describe(`The request ID from the corresponding prompt request`),selected:E().describe(`The key of the selected option`)}));var Co=S(()=>A({name:E().describe(`Skill name (without the leading slash)`),description:E().describe(`Description of what the skill does`),argumentHint:E().describe(`Hint for skill arguments (e.g., "<file>")`)}).describe(`Information about an available skill (invoked via /command syntax).`)),wo=S(()=>A({name:E().describe(`Agent type identifier (e.g., "Explore")`),description:E().describe(`Description of when to use this agent`),model:E().optional().describe(`Model alias this agent uses. If omitted, inherits the parent's model`)}).describe(`Information about an available subagent that can be invoked via the Task tool.`)),To=S(()=>A({value:E().describe(`Model identifier to use in API calls`),displayName:E().describe(`Human-readable display name`),description:E().describe(`Description of the model's capabilities`),supportsAdaptiveThinking:c().optional().describe(`Whether this model supports adaptive thinking (Work Mate decides when and how much to think)`),supportsFastMode:c().optional().describe(`Whether this model supports fast mode`),supportsAutoMode:c().optional().describe(`Whether this model supports auto mode`)}).describe(`Information about an available model.`)),Eo=S(()=>A({email:E().optional(),organization:E().optional(),subscriptionType:E().optional(),tokenSource:E().optional(),apiKeySource:E().optional(),apiProvider:m([`firstParty`,`bedrock`,`vertex`,`foundry`]).optional().describe(`Active API backend. Anthropic OAuth login only applies when "firstParty"; for 3P providers the other fields are absent and auth is external (AWS creds, gcloud ADC, etc.).`)}).describe(`Information about the logged in user's account.`)),Do=S(()=>k([E(),T(E(),pa())])),Oo=S(()=>A({description:E().describe(`Natural language description of when to use this agent`),tools:h(E()).optional().describe(`Array of allowed tool names. If omitted, inherits all tools from parent`),disallowedTools:h(E()).optional().describe(`Array of tool names to explicitly disallow for this agent`),prompt:E().describe(`The agent's system prompt`),model:E().optional().describe(`Model alias (e.g. 'sonnet', 'opus', 'haiku') or full model ID (e.g. 'claude-opus-4-5'). If omitted or 'inherit', uses the main model`),mcpServers:h(Do()).optional(),criticalSystemReminder_EXPERIMENTAL:E().optional().describe(`Experimental: Critical reminder added to system prompt`),skills:h(E()).optional().describe(`Array of skill names to preload into the agent context`),initialPrompt:E().optional().describe(`Auto-submitted as the first user turn when this agent is the main thread agent. Slash commands are processed. Prepended to any user-provided prompt.`),maxTurns:x().int().positive().optional().describe(`Maximum number of agentic turns (API round-trips) before stopping`),background:c().optional().describe(`Run this agent as a background task (non-blocking, fire-and-forget) when invoked`),memory:m([`user`,`project`,`local`]).optional().describe(`Scope for auto-loading agent memory files. 'user' - ~/.workmate/agent-memory/<agentType>/, 'project' - .workmate/agent-memory/<agentType>/, 'local' - .workmate/agent-memory-local/<agentType>/`),permissionMode:Sa().optional().describe(`Permission mode controlling how tool executions are handled`)}).describe(`Definition for a custom subagent that can be invoked via the Agent tool.`));S(()=>m([`user`,`project`,`local`]).describe(`Source for loading filesystem-based settings. 'user' - Global user settings (~/.workmate/settings.json). 'project' - Project settings (.workmate/settings.json). 'local' - Local settings (.workmate/settings.local.json).`)),S(()=>A({type:_(`local`).describe(`Plugin type. Currently only 'local' is supported`),path:E().describe(`Absolute or relative path to the plugin directory`)}).describe(`Configuration for loading a plugin.`)),S(()=>A({canRewind:c(),error:E().optional(),filesChanged:h(E()).optional(),insertions:x().optional(),deletions:x().optional()}).describe(`Result of a rewindFiles operation.`));var ko=S(()=>y()),Ao=S(()=>y()),jo=S(()=>y()),Z=S(()=>E()),Mo=S(()=>y()),No=S(()=>m([`authentication_failed`,`billing_error`,`rate_limit`,`invalid_request`,`server_error`,`unknown`,`max_output_tokens`])),Po=S(()=>k([_(`compacting`),l()])),Fo=S(()=>A({type:_(`user`),message:ko(),parent_tool_use_id:E().nullable(),isSynthetic:c().optional(),tool_use_result:y().optional(),priority:m([`now`,`next`,`later`]).optional(),timestamp:E().optional().describe(`ISO timestamp when the message was created on the originating process. Older emitters omit it; consumers should fall back to receive time.`)})),Io=S(()=>Fo().extend({uuid:Z().optional(),session_id:E().optional()})),Lo=S(()=>Fo().extend({uuid:Z(),session_id:E(),isReplay:_(!0)})),Ro=S(()=>A({status:m([`allowed`,`allowed_warning`,`rejected`]),resetsAt:x().optional(),rateLimitType:m([`five_hour`,`seven_day`,`seven_day_opus`,`seven_day_sonnet`,`overage`]).optional(),utilization:x().optional(),overageStatus:m([`allowed`,`allowed_warning`,`rejected`]).optional(),overageResetsAt:x().optional(),overageDisabledReason:m([`overage_not_provisioned`,`org_level_disabled`,`org_level_disabled_until`,`out_of_credits`,`seat_tier_level_disabled`,`member_level_disabled`,`seat_tier_zero_credit_limit`,`group_zero_credit_limit`,`member_zero_credit_limit`,`org_service_level_disabled`,`org_service_zero_credit_limit`,`no_limits_configured`,`unknown`]).optional(),isUsingOverage:c().optional(),surpassedThreshold:x().optional()}).describe(`Rate limit information for claude.ai subscription users.`)),zo=S(()=>A({type:_(`assistant`),message:Ao(),parent_tool_use_id:E().nullable(),error:No().optional(),uuid:Z(),session_id:E()})),Bo=S(()=>A({type:_(`rate_limit_event`),rate_limit_info:Ro(),uuid:Z(),session_id:E()}).describe(`Rate limit event emitted when rate limit info changes.`)),Vo=S(()=>A({type:_(`streamlined_text`),text:E().describe(`Text content preserved from the assistant message`),session_id:E(),uuid:Z()}).describe(`@internal Streamlined text message - replaces SDKAssistantMessage in streamlined output. Text content preserved, thinking and tool_use blocks removed.`)),Ho=S(()=>A({type:_(`streamlined_tool_use_summary`),tool_summary:E().describe(`Summary of tool calls (e.g., "Read 2 files, wrote 1 file")`),session_id:E(),uuid:Z()}).describe(`@internal Streamlined tool use summary - replaces tool_use blocks in streamlined output with a cumulative summary string.`)),Uo=S(()=>A({tool_name:E(),tool_use_id:E(),tool_input:T(E(),y())})),Wo=S(()=>A({type:_(`result`),subtype:_(`success`),duration_ms:x(),duration_api_ms:x(),is_error:c(),num_turns:x(),result:E(),stop_reason:E().nullable(),total_cost_usd:x(),usage:Mo(),modelUsage:T(E(),na()),permission_denials:h(Uo()),structured_output:y().optional(),fast_mode_state:ms().optional(),uuid:Z(),session_id:E()})),Go=S(()=>A({type:_(`result`),subtype:m([`error_during_execution`,`error_max_turns`,`error_max_budget_usd`,`error_max_structured_output_retries`]),duration_ms:x(),duration_api_ms:x(),is_error:c(),num_turns:x(),stop_reason:E().nullable(),total_cost_usd:x(),usage:Mo(),modelUsage:T(E(),na()),permission_denials:h(Uo()),errors:h(E()),fast_mode_state:ms().optional(),uuid:Z(),session_id:E()})),Ko=S(()=>k([Wo(),Go()])),qo=S(()=>A({type:_(`system`),subtype:_(`init`),agents:h(E()).optional(),apiKeySource:aa(),betas:h(E()).optional(),claude_code_version:E(),cwd:E(),tools:h(E()),mcp_servers:h(A({name:E(),status:E()})),model:E(),permissionMode:Sa(),slash_commands:h(E()),output_style:E(),skills:h(E()),plugins:h(A({name:E(),path:E(),source:E().optional().describe(`@internal Plugin source identifier in "name\\@marketplace" format. Sentinels: "name\\@inline" for --plugin-dir, "name\\@builtin" for built-in plugins.`)})),fast_mode_state:ms().optional(),uuid:Z(),session_id:E()})),Jo=S(()=>A({type:_(`stream_event`),event:jo(),parent_tool_use_id:E().nullable(),uuid:Z(),session_id:E()})),Yo=S(()=>A({type:_(`system`),subtype:_(`compact_boundary`),compact_metadata:A({trigger:m([`manual`,`auto`]),pre_tokens:x(),preserved_segment:A({head_uuid:Z(),anchor_uuid:Z(),tail_uuid:Z()}).optional().describe(`Relink info for messagesToKeep. Loaders splice the preserved segment at anchor_uuid (summary for suffix-preserving, boundary for prefix-preserving partial compact) so resume includes preserved content. Unset when compaction summarizes everything (no messagesToKeep).`)}),uuid:Z(),session_id:E()})),Xo=S(()=>A({type:_(`system`),subtype:_(`status`),status:Po(),permissionMode:Sa().optional(),uuid:Z(),session_id:E()})),Zo=S(()=>A({type:_(`system`),subtype:_(`post_turn_summary`),summarizes_uuid:E(),status_category:m([`blocked`,`waiting`,`completed`,`review_ready`,`failed`]),status_detail:E(),is_noteworthy:c(),title:E(),description:E(),recent_action:E(),needs_action:E(),artifact_urls:h(E()),uuid:Z(),session_id:E()}).describe(`@internal Background post-turn summary emitted after each assistant turn. summarizes_uuid points to the assistant message this summarizes.`)),Qo=S(()=>A({type:_(`system`),subtype:_(`api_retry`),attempt:x(),max_retries:x(),retry_delay_ms:x(),error_status:x().nullable(),error:No(),uuid:Z(),session_id:E()}).describe(`Emitted when an API request fails with a retryable error and will be retried after a delay. error_status is null for connection errors (e.g. timeouts) that had no HTTP response.`)),$o=S(()=>A({type:_(`system`),subtype:_(`local_command_output`),content:E(),uuid:Z(),session_id:E()}).describe(`Output from a local slash command (e.g. /voice, /cost). Displayed as assistant-style text in the transcript.`)),es=S(()=>A({type:_(`system`),subtype:_(`hook_started`),hook_id:E(),hook_name:E(),hook_event:E(),uuid:Z(),session_id:E()})),ts=S(()=>A({type:_(`system`),subtype:_(`hook_progress`),hook_id:E(),hook_name:E(),hook_event:E(),stdout:E(),stderr:E(),output:E(),uuid:Z(),session_id:E()})),ns=S(()=>A({type:_(`system`),subtype:_(`hook_response`),hook_id:E(),hook_name:E(),hook_event:E(),output:E(),stdout:E(),stderr:E(),exit_code:x().optional(),outcome:m([`success`,`error`,`cancelled`]),uuid:Z(),session_id:E()})),rs=S(()=>A({type:_(`tool_progress`),tool_use_id:E(),tool_name:E(),parent_tool_use_id:E().nullable(),elapsed_time_seconds:x(),task_id:E().optional(),uuid:Z(),session_id:E()})),is=S(()=>A({type:_(`auth_status`),isAuthenticating:c(),output:h(E()),error:E().optional(),uuid:Z(),session_id:E()})),as=S(()=>A({type:_(`system`),subtype:_(`files_persisted`),files:h(A({filename:E(),file_id:E()})),failed:h(A({filename:E(),error:E()})),processed_at:E(),uuid:Z(),session_id:E()})),os=S(()=>A({type:_(`system`),subtype:_(`task_notification`),task_id:E(),tool_use_id:E().optional(),status:m([`completed`,`failed`,`stopped`]),output_file:E(),summary:E(),usage:A({total_tokens:x(),tool_uses:x(),duration_ms:x()}).optional(),uuid:Z(),session_id:E()})),ss=S(()=>A({type:_(`system`),subtype:_(`task_started`),task_id:E(),tool_use_id:E().optional(),description:E(),task_type:E().optional(),workflow_name:E().optional().describe(`meta.name from the workflow script (e.g. 'spec'). Only set when task_type is 'local_workflow'.`),prompt:E().optional(),uuid:Z(),session_id:E()})),cs=S(()=>A({type:_(`system`),subtype:_(`session_state_changed`),state:m([`idle`,`running`,`requires_action`]),uuid:Z(),session_id:E()}).describe(`Mirrors notifySessionStateChanged. 'idle' fires after heldBackResult flushes and the bg-agent do-while exits — authoritative turn-over signal.`)),ls=S(()=>A({type:_(`system`),subtype:_(`task_progress`),task_id:E(),tool_use_id:E().optional(),description:E(),usage:A({total_tokens:x(),tool_uses:x(),duration_ms:x()}),last_tool_name:E().optional(),summary:E().optional(),uuid:Z(),session_id:E()})),us=S(()=>A({type:_(`tool_use_summary`),summary:E(),preceding_tool_use_ids:h(E()),uuid:Z(),session_id:E()})),ds=S(()=>A({type:_(`system`),subtype:_(`elicitation_complete`),mcp_server_name:E(),elicitation_id:E(),uuid:Z(),session_id:E()}).describe(`Emitted when an MCP server confirms that a URL-mode elicitation is complete.`)),fs=S(()=>A({type:_(`prompt_suggestion`),suggestion:E(),uuid:Z(),session_id:E()}).describe(`Predicted next user prompt, emitted after each turn when promptSuggestions is enabled.`));S(()=>A({sessionId:E().describe(`Unique session identifier (UUID).`),summary:E().describe(`Display title for the session: custom title, auto-generated summary, or first prompt.`),lastModified:x().describe(`Last modified time in milliseconds since epoch.`),fileSize:x().optional().describe(`File size in bytes. Only populated for local JSONL storage.`),customTitle:E().optional().describe(`User-set session title via /rename.`),firstPrompt:E().optional().describe(`First meaningful user prompt in the session.`),gitBranch:E().optional().describe(`Git branch at the end of the session.`),cwd:E().optional().describe(`Working directory for the session.`),tag:E().optional().describe(`User-set session tag.`),createdAt:x().optional().describe(`Creation time in milliseconds since epoch, extracted from the first entry's timestamp.`)}).describe(`Session metadata returned by listSessions and getSessionInfo.`));var ps=S(()=>k([zo(),Io(),Lo(),Ko(),qo(),Jo(),Yo(),Xo(),Qo(),$o(),es(),ts(),ns(),rs(),is(),os(),ss(),ls(),cs(),as(),us(),Bo(),ds(),fs()])),ms=S(()=>m([`off`,`cooldown`,`on`]).describe(`Fast mode state: off, in cooldown after rate limit, or actively enabled.`));u(),s();var hs=S(()=>y()),gs=S(()=>A({matcher:E().optional(),hookCallbackIds:h(E()),timeout:x().optional()}).describe(`Configuration for matching and routing hook callbacks.`)),_s=S(()=>A({subtype:_(`initialize`),hooks:T(wa(),h(gs())).optional(),sdkMcpServers:h(E()).optional(),jsonSchema:T(E(),y()).optional(),systemPrompt:E().optional(),appendSystemPrompt:E().optional(),agents:T(E(),Oo()).optional(),promptSuggestions:c().optional(),agentProgressSummaries:c().optional()}).describe(`Initializes the SDK session with hooks, MCP servers, and agent configuration.`));S(()=>A({commands:h(Co()),agents:h(wo()),output_style:E(),available_output_styles:h(E()),models:h(To()),account:Eo(),pid:x().optional().describe(`@internal CLI process PID for tmux socket isolation`),fast_mode_state:ms().optional()}).describe(`Response from session initialization with available commands, models, and account info.`));var vs=S(()=>A({subtype:_(`interrupt`)}).describe(`Interrupts the currently running conversation turn.`)),ys=S(()=>A({subtype:_(`can_use_tool`),tool_name:E(),input:T(E(),y()),permission_suggestions:h(ba()).optional(),blocked_path:E().optional(),decision_reason:E().optional(),title:E().optional(),display_name:E().optional(),tool_use_id:E(),agent_id:E().optional(),description:E().optional()}).describe(`Requests permission to use a tool with the given input.`)),bs=S(()=>A({subtype:_(`set_permission_mode`),mode:Sa()}).describe(`Sets the permission mode for tool execution handling.`)),xs=S(()=>A({subtype:_(`set_model`),model:E().optional()}).describe(`Sets the model to use for subsequent conversation turns.`)),Ss=S(()=>A({subtype:_(`set_max_thinking_tokens`),max_thinking_tokens:x().nullable()}).describe(`Sets the maximum number of thinking tokens for extended thinking.`)),Cs=S(()=>A({subtype:_(`mcp_status`)}).describe(`Requests the current status of all MCP server connections.`));S(()=>A({mcpServers:h(ga())}).describe(`Response containing the current status of all MCP server connections.`));var ws=S(()=>A({subtype:_(`get_context_usage`)}).describe(`Requests a breakdown of current context window usage by category.`)),Ts=S(()=>A({name:E(),tokens:x(),color:E(),isDeferred:c().optional()})),Es=S(()=>A({color:E(),isFilled:c(),categoryName:E(),tokens:x(),percentage:x(),squareFullness:x()}));S(()=>A({categories:h(Ts()),totalTokens:x(),maxTokens:x(),rawMaxTokens:x(),percentage:x(),gridRows:h(h(Es())),model:E(),memoryFiles:h(A({path:E(),type:E(),tokens:x()})),mcpTools:h(A({name:E(),serverName:E(),tokens:x(),isLoaded:c().optional()})),deferredBuiltinTools:h(A({name:E(),tokens:x(),isLoaded:c()})).optional(),systemTools:h(A({name:E(),tokens:x()})).optional(),systemPromptSections:h(A({name:E(),tokens:x()})).optional(),agents:h(A({agentType:E(),source:E(),tokens:x()})),slashCommands:A({totalCommands:x(),includedCommands:x(),tokens:x()}).optional(),skills:A({totalSkills:x(),includedSkills:x(),tokens:x(),skillFrontmatter:h(A({name:E(),source:E(),tokens:x()}))}).optional(),autoCompactThreshold:x().optional(),isAutoCompactEnabled:c(),messageBreakdown:A({toolCallTokens:x(),toolResultTokens:x(),attachmentTokens:x(),assistantMessageTokens:x(),userMessageTokens:x(),toolCallsByType:h(A({name:E(),callTokens:x(),resultTokens:x()})),attachmentsByType:h(A({name:E(),tokens:x()}))}).optional(),apiUsage:A({input_tokens:x(),output_tokens:x(),cache_creation_input_tokens:x(),cache_read_input_tokens:x()}).nullable()}).describe(`Breakdown of current context window usage by category (system prompt, tools, messages, etc.).`));var Ds=S(()=>A({subtype:_(`rewind_files`),user_message_id:E(),dry_run:c().optional()}).describe(`Rewinds file changes made since a specific user message.`));S(()=>A({canRewind:c(),error:E().optional(),filesChanged:h(E()).optional(),insertions:x().optional(),deletions:x().optional()}).describe(`Result of a rewindFiles operation.`));var Os=S(()=>A({subtype:_(`cancel_async_message`),message_uuid:E()}).describe(`Drops a pending async user message from the command queue by uuid. No-op if already dequeued for execution.`));S(()=>A({cancelled:c()}).describe(`Result of a cancel_async_message operation. cancelled=false means the message was not in the queue (already dequeued or never enqueued).`));var ks=S(()=>A({subtype:_(`seed_read_state`),path:E(),mtime:x()}).describe(`Seeds the readFileState cache with a path+mtime entry. Use when a prior Read was removed from context (e.g. by snip) so Edit validation would fail despite the client having observed the Read. The mtime lets the CLI detect if the file changed since the seeded Read — same staleness check as the normal path.`)),As=S(()=>A({subtype:_(`hook_callback`),callback_id:E(),input:ro(),tool_use_id:E().optional()}).describe(`Delivers a hook callback with its input data.`)),js=S(()=>A({subtype:_(`mcp_message`),server_name:E(),message:hs()}).describe(`Sends a JSON-RPC message to a specific MCP server.`)),Ms=S(()=>A({subtype:_(`mcp_set_servers`),servers:T(E(),pa())}).describe(`Replaces the set of dynamically managed MCP servers.`));S(()=>A({added:h(E()),removed:h(E()),errors:T(E(),E())}).describe(`Result of replacing the set of dynamically managed MCP servers.`));var Ns=S(()=>A({subtype:_(`reload_plugins`)}).describe(`Reloads plugins from disk and returns the refreshed session components.`));S(()=>A({commands:h(Co()),agents:h(wo()),plugins:h(A({name:E(),path:E(),source:E().optional()})),mcpServers:h(ga()),error_count:x()}).describe(`Refreshed commands, agents, plugins, and MCP server status after reload.`));var Ps=S(()=>A({subtype:_(`mcp_reconnect`),serverName:E()}).describe(`Reconnects a disconnected or failed MCP server.`)),Fs=S(()=>A({subtype:_(`mcp_toggle`),serverName:E(),enabled:c()}).describe(`Enables or disables an MCP server.`)),Is=S(()=>A({subtype:_(`stop_task`),task_id:E()}).describe(`Stops a running task.`)),Ls=S(()=>A({subtype:_(`apply_flag_settings`),settings:T(E(),y())}).describe(`Merges the provided settings into the flag settings layer, updating the active configuration.`)),Rs=S(()=>A({subtype:_(`get_settings`)}).describe(`Returns the effective merged settings and the raw per-source settings.`));S(()=>A({effective:T(E(),y()),sources:h(A({source:m([`userSettings`,`projectSettings`,`localSettings`,`flagSettings`,`policySettings`]),settings:T(E(),y())})).describe(`Ordered low-to-high priority — later entries override earlier ones.`),applied:A({model:E()}).optional().describe("Runtime-resolved values after env overrides, session state, and model-specific defaults are applied. Unlike `effective` (disk merge), these reflect what will actually be sent to the API.")}).describe(`Effective merged settings plus raw per-source settings in merge order.`));var zs=S(()=>A({subtype:_(`elicitation`),mcp_server_name:E(),message:E(),mode:m([`form`,`url`]).optional(),url:E().optional(),elicitation_id:E().optional(),requested_schema:T(E(),y()).optional()}).describe(`Requests the SDK consumer to handle an MCP elicitation (user input request).`)),Bs=S(()=>A({action:m([`accept`,`decline`,`cancel`]),content:T(E(),y()).optional()}).describe(`Response from the SDK consumer for an elicitation request.`)),Vs=S(()=>k([vs(),ys(),_s(),bs(),xs(),Ss(),Cs(),ws(),As(),js(),Ds(),Os(),ks(),Ms(),Ns(),Ps(),Fs(),Is(),Ls(),Rs(),zs()])),Hs=S(()=>A({type:_(`control_request`),request_id:E(),request:Vs()})),Us=S(()=>A({subtype:_(`success`),request_id:E(),response:T(E(),y()).optional()})),Ws=S(()=>A({subtype:_(`error`),request_id:E(),error:E(),pending_permission_requests:h(g(()=>Hs())).optional()})),Gs=S(()=>A({type:_(`control_response`),response:k([Us(),Ws()])})),Ks=S(()=>A({type:_(`control_cancel_request`),request_id:E()}).describe(`Cancels a currently open control request.`)),qs=S(()=>A({type:_(`keep_alive`)}).describe(`Keep-alive message to maintain WebSocket connection.`)),Js=S(()=>A({type:_(`update_environment_variables`),variables:T(E(),E())}).describe(`Updates environment variables at runtime.`));S(()=>k([ps(),Vo(),Ho(),Zo(),Gs(),Hs(),Ks(),qs()])),S(()=>k([Io(),Hs(),Gs(),qs(),Js()])),n(),i(),me(),Br(),Hr(),Jr(),Kr(),Qr(),j(),bn(),u(),G(),s(),ft(),kr(),S(()=>d.object({tool_name:d.string().describe(`The name of the tool requesting permission`),input:d.record(d.string(),d.unknown()).describe(`The input for the tool`),tool_use_id:d.string().optional().describe(`The unique tool use request ID`)}));var Ys=S(()=>d.enum([`user_temporary`,`user_permanent`,`user_reject`]).optional().catch(void 0)),Xs=S(()=>d.object({behavior:d.literal(`allow`),updatedInput:d.record(d.string(),d.unknown()),updatedPermissions:d.array(It()).optional().catch(e=>{W(`Malformed updatedPermissions from SDK host ignored: ${e.error.issues[0]?.message??`unknown`}`,{level:`warn`})}),toolUseID:d.string().optional(),decisionClassification:Ys()})),Zs=S(()=>d.object({behavior:d.literal(`deny`),message:d.string(),interrupt:d.boolean().optional(),toolUseID:d.string().optional(),decisionClassification:Ys()})),Qs=S(()=>d.union([Xs(),Zs()]));function $s(e,t,n,r){let i={type:`permissionPromptTool`,permissionPromptToolName:t.name,toolResult:e};if(e.behavior===`allow`){let t=e.updatedPermissions;t&&(r.setAppState(e=>({...e,toolPermissionContext:L(e.toolPermissionContext,t)})),Et(t));let a=Object.keys(e.updatedInput).length>0?e.updatedInput:n;return{...e,updatedInput:a,decisionReason:i}}else e.behavior===`deny`&&e.interrupt&&(W(`SDK permission prompt deny+interrupt: tool=${t.name} message=${e.message}`),r.abortController.abort());return{...e,decisionReason:i}}Rr(),ri(),ni(),D(),M(),w(),ae(),ie(),xi(),bi(),Xt(),Gn(),ur(),Ae(),z(),xn(),Tr(),Ht(),zt(),mt(),Pt(),Pn(),Kn(),Cn(),it(),pt(),An(),jn(),xr(),Yn(),Wt();var ec=/\u2028|\u2029/g;function tc(e){return e.replace(ec,e=>e===`\u2028`?`\\u2028`:`\\u2029`)}function nc(e){return tc(H(e))}G(),Jr(),u(),ft();var rc=`SandboxNetworkAccess`;function ic(e){if(e){if(e.type===`classifier`)return e.reason;switch(e.type){case`rule`:case`mode`:case`subcommandResults`:case`permissionPromptTool`:return;case`hook`:case`asyncAgent`:case`sandboxOverride`:case`workingDir`:case`safetyCheck`:case`other`:return e.reason}}}function ac(e,t,n,r){let i;try{i=e.getActivityDescription?.(t)??e.getToolUseSummary?.(t)??e.userFacingName(t)}catch{i=e.name}return{tool_name:e.name,action_description:i,tool_use_id:n,request_id:r,input:t}}var oc=1e3,sc=class{constructor(e,t){a(this,`input`,void 0),a(this,`replayUserMessages`,void 0),a(this,`structuredInput`,void 0),a(this,`pendingRequests`,new Map),a(this,`restoredWorkerState`,Promise.resolve(null)),a(this,`inputClosed`,!1),a(this,`unexpectedResponseCallback`,void 0),a(this,`resolvedToolUseIds`,new Set),a(this,`prependedLines`,[]),a(this,`onControlRequestSent`,void 0),a(this,`onControlRequestResolved`,void 0),a(this,`outbound`,new Dr),this.input=e,this.replayUserMessages=t,this.input=e,this.structuredInput=this.read()}trackResolvedToolUseId(e){let t=e.request;if(t.subtype===`can_use_tool`&&(this.resolvedToolUseIds.add(t.tool_use_id),this.resolvedToolUseIds.size>oc)){let e=this.resolvedToolUseIds.values().next().value;e!==void 0&&this.resolvedToolUseIds.delete(e)}}flushInternalEvents(){return Promise.resolve()}get internalEventsPending(){return 0}prependUserMessage(e){this.prependedLines.push(`${H({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})}\n`)}async*read(){let e=``,t=async function*(){for(;;){this.prependedLines.length>0&&(e=this.prependedLines.join(``)+e,this.prependedLines=[]);let t=e.indexOf(`
|
|
2
2
|
`);if(t===-1)break;let n=e.slice(0,t);e=e.slice(t+1);let r=await this.processLine(n);r&&(ee(`info`,`cli_stdin_message_parsed`,{type:r.type}),yield r)}}.bind(this);yield*t();for await(let n of this.input)e+=n,yield*t();if(e){let t=await this.processLine(e);t&&(yield t)}this.inputClosed=!0;for(let e of this.pendingRequests.values())e.reject(Error(`Tool permission stream closed before response received`))}getPendingPermissionRequests(){return Array.from(this.pendingRequests.values()).map(e=>e.request).filter(e=>e.request.subtype===`can_use_tool`)}setUnexpectedResponseCallback(e){this.unexpectedResponseCallback=e}injectControlResponse(e){let t=e.response,n=t?.request_id;if(!n)return;let r=this.pendingRequests.get(n);if(r)if(this.trackResolvedToolUseId(r.request),this.pendingRequests.delete(n),this.write({type:`control_cancel_request`,request_id:n}),t.subtype===`error`)r.reject(Error(t.error));else{let e=t.response;if(r.schema)try{r.resolve(r.schema.parse(e))}catch(e){r.reject(e)}else r.resolve({})}}setOnControlRequestSent(e){this.onControlRequestSent=e}setOnControlRequestResolved(e){this.onControlRequestResolved=e}async processLine(e){if(e)try{let t=Ur(e);if(t.type===`keep_alive`)return;if(t.type===`update_environment_variables`){let e=t.variables??{},n=Object.keys(e);for(let[t,n]of Object.entries(e))process.env[t]=n;W(`[structuredIO] applied update_environment_variables: ${n.join(`, `)}`);return}if(t.type===`control_response`){let e=`uuid`in t&&typeof t.uuid==`string`?t.uuid:void 0;e&&$t(e,`completed`);let n=t.response,r=this.pendingRequests.get(n.request_id);if(!r){let e=(n.subtype===`success`?n.response:void 0)?.toolUseID;if(typeof e==`string`&&this.resolvedToolUseIds.has(e)){W(`Ignoring duplicate control_response for already-resolved toolUseID=${e} request_id=${n.request_id}`);return}this.unexpectedResponseCallback&&await this.unexpectedResponseCallback(t);return}if(this.trackResolvedToolUseId(r.request),this.pendingRequests.delete(n.request_id),r.request.request.subtype===`can_use_tool`&&this.onControlRequestResolved&&this.onControlRequestResolved(n.request_id),n.subtype===`error`){r.reject(Error(n.error??`Unknown error`));return}let i=n.response;if(r.schema)try{r.resolve(r.schema.parse(i))}catch(e){r.reject(e)}else r.resolve({});return this.replayUserMessages?t:void 0}if(t.type!==`user`&&t.type!==`control_request`&&t.type!==`assistant`&&t.type!==`system`){W(`Ignoring unknown message type: ${t.type}`,{level:`warn`});return}return t.type===`control_request`?(t.request||cc(`Error: Missing request on control_request`),t):(t.type===`assistant`||t.type===`system`||t.message?.role!==`user`&&cc(`Error: Expected message role 'user', got '${t.message?.role}'`),t)}catch(t){console.error(`Error parsing streaming input line: ${e}: ${t}`),process.exit(1)}}async write(e){K(`${nc(e)}\n`)}async sendRequest(e,t,n,r=J()){let i={type:`control_request`,request_id:r,request:e};if(this.inputClosed)throw Error(`Stream closed`);if(n?.aborted)throw Error(`Request aborted`);this.outbound.enqueue(i),e.subtype===`can_use_tool`&&this.onControlRequestSent&&this.onControlRequestSent(i);let a=()=>{this.outbound.enqueue({type:`control_cancel_request`,request_id:r});let e=this.pendingRequests.get(r);e&&(this.trackResolvedToolUseId(e.request),e.reject(new Vr))};n&&n.addEventListener(`abort`,a,{once:!0});try{return await new Promise((n,i)=>{this.pendingRequests.set(r,{request:{type:`control_request`,request_id:r,request:e},resolve:e=>{n(e)},reject:i,schema:t})})}finally{n&&n.removeEventListener(`abort`,a),this.pendingRequests.delete(r)}}createCanUseTool(e){return async(t,n,r,i,a,o)=>{let s=o??await we(t,n,r,i,a);if(s.behavior===`allow`||s.behavior===`deny`)return s;let c=new AbortController,l=r.abortController.signal,u=()=>c.abort();l.addEventListener(`abort`,u,{once:!0});try{let i=lc(t.name,a,n,r,s.suggestions).then(e=>({source:`hook`,decision:e})),o=J();e?.(ac(t,n,a,o));let l=this.sendRequest({subtype:`can_use_tool`,tool_name:t.name,input:n,permission_suggestions:s.suggestions,blocked_path:s.blockedPath,decision_reason:ic(s.decisionReason),tool_use_id:a,agent_id:r.agentId},Qs(),c.signal,o).then(e=>({source:`sdk`,result:e})),u=await Promise.race([i,l]);return u.source===`hook`?u.decision?(l.catch(()=>{}),c.abort(),u.decision):$s((await l).result,t,n,r):$s(u.result,t,n,r)}catch(e){return $s({behavior:`deny`,message:`Tool permission request failed: ${e}`,toolUseID:a},t,n,r)}finally{this.getPendingPermissionRequests().length===0&&tt(`running`),l.removeEventListener(`abort`,u)}}}createHookCallback(e,t){return{type:`callback`,timeout:t,callback:async(t,n,r)=>{try{return await this.sendRequest({subtype:`hook_callback`,callback_id:e,input:t,tool_use_id:n||void 0},Nr(),r)}catch(t){return console.error(`Error in hook callback ${e}:`,t),{}}}}}async handleElicitation(e,t,n,r,i,a,o){try{return await this.sendRequest({subtype:`elicitation`,mcp_server_name:e,message:t,mode:i,url:a,elicitation_id:o,requested_schema:n},Bs(),r)}catch{return{action:`cancel`}}}createSandboxAskCallback(){return async e=>{try{return(await this.sendRequest({subtype:`can_use_tool`,tool_name:rc,input:{host:e.host},tool_use_id:J(),description:`Allow network connection to ${e.host}?`},Qs())).behavior===`allow`}catch{return!1}}}async sendMcpMessage(e,t){return(await this.sendRequest({subtype:`mcp_message`,server_name:e,message:t},A({mcp_response:p()}))).mcp_response}};function cc(e){console.error(e),process.exit(1)}async function lc(e,t,n,r,i){let a=r.getAppState().toolPermissionContext.mode,o=Yt(e,t,n,r,a,i,r.abortController.signal);for await(let e of o)if(e.permissionRequestResult&&(e.permissionRequestResult.behavior===`allow`||e.permissionRequestResult.behavior===`deny`)){let t=e.permissionRequestResult;if(t.behavior===`allow`){let e=t.updatedInput||n,i=t.updatedPermissions??[];if(i.length>0){Et(i);let e=L(r.getAppState().toolPermissionContext,i);r.setAppState(t=>t.toolPermissionContext===e?t:{...t,toolPermissionContext:e})}return{behavior:`allow`,updatedInput:e,userModified:!1,decisionReason:{type:`hook`,hookName:`PermissionRequest`}}}else return{behavior:`deny`,message:t.message||`Permission denied by PermissionRequest hook`,decisionReason:{type:`hook`,hookName:`PermissionRequest`}}}}Ci(),f(),Si(),[...vi],G();var uc=`[stdout-guard]`,dc=!1,Q=``,$=null;function fc(e){if(e.length===0)return!0;try{return JSON.parse(e),!0}catch{return!1}}function pc(){dc||(dc=!0,$=process.stdout.write.bind(process.stdout),process.stdout.write=((e,t,n)=>{let r=typeof e==`string`?e:Buffer.from(e).toString(`utf-8`);Q+=r;let i,a=!0;for(;(i=Q.indexOf(`
|
|
3
3
|
`))!==-1;){let e=Q.slice(0,i);Q=Q.slice(i+1),fc(e)?a=$(`${e}\n`):(process.stderr.write(`${uc} ${e}\n`),W(`streamJsonStdoutGuard diverted non-JSON stdout line: ${e.slice(0,200)}`))}let o=typeof t==`function`?t:n;return o&&queueMicrotask(()=>o()),a}),Gr(async()=>{Q.length>0&&($&&fc(Q)?$(`${Q}\n`):process.stderr.write(`${uc} ${Q}\n`),Q=``),$&&(process.stdout.write=$,$=null),dc=!1}))}Yr(),wn(),vn(),gi(),Ye(),hr(),F(),ze(),Fe(),Ze(),gr(),Tt(),Zn(),Mi(),G(),Hr(),Rr(),Hr(),ni(),vr(),G();function mc(e){let t=process.env.WORKMATE_EXIT_AFTER_STOP_DELAY,n=t?parseInt(t,10):null,r=n&&!isNaN(n)&&n>0,i=null,a=0;return{start(){i&&(clearTimeout(i),i=null),r&&(a=Date.now(),i=setTimeout(()=>{let t=Date.now()-a;e()&&t>=n&&(W(`Exiting after ${n}ms of idle time`),B())},n))},stop(){i&&(clearTimeout(i),i=null)}}}ci(),fi(),li(),xe(),Oi(),ki(),sr(),pr(),Zt(),en(),Nt(),R(),bt(),_n(),zi(),Bi();function hc(e){if(e.toLowerCase().endsWith(`.jsonl`))return{sessionId:J(),ingressUrl:null,isUrl:!1,jsonlFile:e,isJsonlFile:!0};if(He(e))return{sessionId:e,ingressUrl:null,isUrl:!1,jsonlFile:null,isJsonlFile:!1};try{let t=new URL(e);return{sessionId:J(),ingressUrl:t.href,isUrl:!0,jsonlFile:null,isJsonlFile:!1}}catch{}return null}ai(),Be(),hn(),er(),kt(),at(),Jt(),Sn(),Mr(),et(),Je(),cn(),Ui(),Gi(),G(),Jr();async function gc(){try{let e=await ea(Fr(),`utf-8`),t=re().safeParse(Ur(e));return t.success?t.data:(W(`Invalid known_marketplaces.json in zip cache: ${t.error.message}`,{level:`error`}),{})}catch{return{}}}async function _c(e){await We(Fr(),H(e,null,2))}async function vc(e,t){let n=Mt();if(!n)return;let r=await yc(t);r!==null&&await We($i(n,ut(e)),r)}async function yc(e){let t=[$i(e,`.claude-plugin`,`marketplace.json`),$i(e,`marketplace.json`),e];for(let e of t)try{return await ea(e,`utf-8`)}catch{}return null}async function bc(){let e=await kn();for(let[t,n]of Object.entries(e))if(n.installLocation)try{await vc(t,n.installLocation)}catch(e){W(`Failed to save marketplace JSON for ${t}: ${e}`)}await _c({...await gc(),...e})}ii(),Br(),G(),j(),ni(),gr(),Ze();async function xc(){let e=Qt();W(`installPluginsForHeadless: starting${e?` (zip cache mode)`:``}`);let t=await In();t&&(gn(),Se(`headlessPluginInstall: seed marketplaces registered`)),e&&(await qr().mkdir(De()),await qr().mkdir(qt()));let n=Object.keys($n()).length,r={marketplaces_installed:0,delisted_count:0},i=t;try{if(n===0)W(`installPluginsForHeadless: no marketplaces declared`);else{let t=await C(`headless_marketplace_reconcile`,()=>Yi({skip:e?(e,t)=>!Vt(t):void 0,onProgress:e=>{e.type===`installed`?W(`installPluginsForHeadless: installed marketplace ${e.name}`):e.type===`failed`&&W(`installPluginsForHeadless: failed to install marketplace ${e.name}: ${e.error}`)}}),e=>({installed_count:e.installed.length,updated_count:e.updated.length,failed_count:e.failed.length,skipped_count:e.skipped.length}));t.skipped.length>0&&W(`installPluginsForHeadless: skipped ${t.skipped.length} marketplace(s) unsupported by zip cache: ${t.skipped.join(`, `)}`);let n=t.installed.length+t.updated.length;n>0&&(gn(),Se(`headlessPluginInstall: marketplaces reconciled`),i=!0),r.marketplaces_installed=n}e&&await bc();let t=await Ai();return r.delisted_count=t.length,t.length>0&&(i=!0),i&&Se(`headlessPluginInstall: plugins changed`),e&&Gr(nt),i}catch(e){return q(e),!1}}o(),ii(),G(),j(),Ht(),mt(),ni(),Qr(),zt(),An(),Br(),Rr(),Wt(),Yn(),it(),Jr(),Zi(),Tt(),fn(),Mn(),Ee(),Hr(),Ti();var Sc=1e4,Cc=new Set,wc=[];function Tc(e){if(Cc.has(e))return!1;if(Cc.add(e),wc.push(e),wc.length>Sc){let e=wc.splice(0,wc.length-Sc);for(let t of e)Cc.delete(t)}return!0}function Ec(e){return typeof e==`string`?[{type:`text`,text:e}]:e}function Dc(e){return e.length===1?e[0]:e.every(e=>typeof e==`string`)?e.join(`
|
|
4
4
|
`):e.flatMap(Ec)}function Oc(e,t){return t!==void 0&&t.mode===`prompt`&&t.workload===e.workload&&t.isMeta===e.isMeta}async function kc(e,n,r,i,a,o,s,c){if(mr.subscribe(e=>{Bt(e,r),gt()&&r(e=>{let t=e.settings,n=t.fastMode===!0&&!t.fastModePerSessionOptIn;return{...e,fastMode:n}})}),!ot()&&t(process.env.WORKMATE_PROACTIVE)&&Gt(`command`),typeof Bun<`u`&&setInterval(()=>{process.memoryUsage.rss()>350*1024*1024?Bun.gc(!0):Bun.gc(!1)},1e3).unref(),Oe(),V(`runHeadless_entry`),c.resumeSessionAt&&!c.resume){process.stderr.write(`Error: --resume-session-at requires --resume
|
|
@@ -8,6 +8,6 @@ import{c as e,l as t,o as n,s as r}from"./envUtils-QyzA_cFM.js";import{n as i,t
|
|
|
8
8
|
`),B(1);return}if(c.outputFormat===`stream-json`&&!c.verbose){process.stderr.write(`Error: When using --print, --output-format=stream-json requires --verbose
|
|
9
9
|
`),B(1);return}let v=wr(d.mcp.tools,d.toolPermissionContext),y=[...a,...v],b=Mc(c.sdkUrl?`stdio`:c.permissionPromptToolName,l,()=>n().mcp.tools,e=>{r(e=>({...e,attribution:{...e.attribution,permissionPromptCount:e.attribution.permissionPromptCount+1}})),tt(`requires_action`,e)});c.permissionPromptToolName&&(y=y.filter(e=>!_i(e,c.permissionPromptToolName))),Zr(),V(`after_loadInitialMessages`),await oi(),V(`after_modelStrings`);let ee=c.outputFormat===`json`&&c.verbose,te=[],x;V(`before_runHeadlessStreaming`);for await(let e of Ac(l,d.mcp.clients,[...i,...d.mcp.commands],y,f,b,o,n,r,s,c,p))c.outputFormat===`stream-json`&&c.verbose&&await l.write(e),e.type!==`control_response`&&e.type!==`control_request`&&e.type!==`control_cancel_request`&&!(e.type===`system`&&(e.subtype===`session_state_changed`||e.subtype===`task_notification`||e.subtype===`task_started`||e.subtype===`task_progress`||e.subtype===`post_turn_summary`))&&e.type!==`stream_event`&&e.type!==`keep_alive`&&e.type!==`streamlined_text`&&e.type!==`streamlined_tool_use_summary`&&e.type!==`prompt_suggestion`&&(ee&&te.push(e),x=e);switch(c.outputFormat){case`json`:if(x?.type!==`result`)throw Error(`No messages returned`);if(c.verbose){K(`${H(te)}\n`);break}K(`${H(x)}\n`);break;case`stream-json`:break;default:if(x?.type!==`result`)throw Error(`No messages returned`);switch(x.subtype){case`success`:K(x.result.endsWith(`
|
|
10
10
|
`)?x.result:`${x.result}\n`);break;case`error_during_execution`:K(`Execution error`);break;case`error_max_turns`:K(`Error: Reached max turns (${c.maxTurns}).\nTip: Increase the limit with --max-turns or continue in a new session.`);break;case`error_max_budget_usd`:K(`Error: Exceeded USD budget ($${c.maxBudgetUsd}).\nTip: Increase the limit with --max-budget-usd or start a new session to continue.`);break;case`error_max_structured_output_retries`:K(`Error: Failed to provide valid structured output after maximum retries.
|
|
11
|
-
Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(Qe(),Xr())try{let{drainPendingExtraction:e}=await import(`./extractMemories-8yvMGZ1J.js`);await e()}catch{}B(x?.type===`result`&&x?.is_error?1:0)}function Ac(n,i,a,o,s,c,l,u,d,f,p,m){let h=!1,g,_=!1,v=null,y,b=n.outbound;process.on(`SIGINT`,()=>{ee(`info`,`shutdown_signal`,{signal:`SIGINT`}),y&&!y.signal.aborted&&y.abort(),Jn(0)}),Gr(async()=>{let e={};for(let t of Nn(u()))dn(t)&&(e[t.type]=(e[t.type]??0)+1);ee(`info`,`run_state_at_shutdown`,{run_active:h,run_phase:g,worker_status:Vn(),internal_events_pending:n.internalEventsPending,bg_tasks:e})}),lt(e=>{(e==="default"||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&b.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:J(),session_id:N()})});let x={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},S=e=>{let t=Fi(e);t&&b.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:J(),session_id:N()})};Ir.add(S);let C=s,w=Ar(s,Y(),100),T=tn(100),re=process.env.WORKMATE_RESUME_INTERRUPTED_TURN;m&&m.kind!==`none`&&re&&(W(`[print.ts] Auto-resuming interrupted turn (kind: ${m.kind})`),Lc(C,m.message),Er({mode:`prompt`,value:m.message.message.content,uuid:J()}));let ie=Wi().map(e=>{let t=e.value===null?`default`:e.value,n=t==="default"?pi():hi(t),r=ar(n),i=wt(e.value),a=Ln(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsAdaptiveThinking:!0},...i&&{supportsFastMode:!0},...a&&{supportsAutoMode:!0}}}),ae=p.userSpecifiedModel;function E(e,t){let n=or(e,ui(t));C.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&b.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:N(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let D=[],O=[],k=new Set;function A(e){for(let t of e){if(t.type!==`connected`||k.has(t.name)||t.config.type===`sdk`)continue;let e=t.name;try{t.client.setRequestHandler(Ge,async(t,r)=>{ei(e,`Elicitation request received in print mode: ${H(t)}`);let i=t.params.mode===`url`?`url`:`form`,a=await Or(e,t.params,r.signal);if(a)return ei(e,`Elicitation resolved by hook: ${H(a)}`),a.action,a;let o=`url`in t.params?t.params.url:void 0,s=`requestedSchema`in t.params?t.params.requestedSchema:void 0,c=`elicitationId`in t.params?t.params.elicitationId:void 0,l=await n.handleElicitation(e,t.params.message,s,r.signal,i,o,c),u=await Ft(e,l,r.signal,i,c);return u.action,u}),t.client.setNotificationHandler(rr,t=>{let{elicitationId:n}=t.params;ei(e,`Elicitation completion notification: ${n}`),ke({message:`MCP server "${e}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),b.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:e,elicitation_id:n,uuid:J(),session_id:N()})}),k.add(e)}catch{}}}async function j(){let e=new Set(Object.keys(l)),t=new Set(D.map(e=>e.name)),r=Array.from(e).some(e=>!t.has(e)),i=Array.from(t).some(t=>!e.has(t)),a=D.some(e=>e.type===`pending`),o=D.some(e=>e.type===`failed`);if(r||i||a||o){for(let t of D)e.has(t.name)||t.type===`connected`&&await t.cleanup();let r=await Pr(l,(e,t)=>n.sendMcpMessage(e,t));D=r.clients,O=r.tools;let i=oe([...t,...e]);d(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(ne(t)))),...O]}})),St(D)}}j();let M={clients:[],tools:[],configs:{}},le=e=>{let t=Me(e.toolPermissionContext,e.mcp.tools),n=Dn(ji([...o,...O,...M.tools],t,e.toolPermissionContext.mode),`name`);p.permissionPromptToolName&&(n=n.filter(e=>!_i(e,p.permissionPromptToolName)));let r=ce();if(r&&!p.jsonSchema){let e=yi(r);`tool`in e&&(n=[...n,e.tool])}return n},ue=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function de(e){let t=async()=>{let t=new Set(D.map(e=>e.name)),n=await Hc(e,{configs:l,clients:D,tools:O},M,d);for(let e of Object.keys(l))delete l[e];if(Object.assign(l,n.newSdkState.configs),D=n.newSdkState.clients,O=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(D.map(e=>e.name)),n=oe([...t,...e]);d(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(ne(t)))),...O]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return ue=ue.then(t,t),ue}function me(){let e=u(),t=e.mcp.clients,n=Dn([...e.mcp.tools,...M.tools],`name`),r=new Set([...t.map(e=>e.name),...D.map(e=>e.name)]);return[...t,...D,...M.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?nn(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0;return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r}})}async function he(){try{await xc()&&await xe()}catch(e){q(e)}}let P=null;r()||(t(process.env.WORKMATE_SYNC_PLUGIN_INSTALL)?P=he():he());let ve=mc(()=>!h),F=a,I=f;async function be(){let{agentDefinitions:e}=await Xi(d);F=await Ve(Y());let t=I.filter(e=>e.source===`flagSettings`);I=[...e.allAgents,...t]}async function xe(){let{servers:e}=await Qn(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(l))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await de(t);r&&j(),W(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Se=Ji.subscribe(()=>{Pe(),Ve(Y()).then(e=>{F=e})}),Ce=()=>{setTimeout(()=>{!ot()||tr()||_||(async()=>{let e=await on({basePrompt:`<${$r}>${new Date().toLocaleTimeString()}</${$r}>`,currentDir:Y(),shouldCreate:()=>!_});if(_){await qe({commands:e});return}for(let t of e)Er({...t,uuid:J()});L()})().catch(e=>{q(e),W(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};rt(()=>{y&&Ct(`now`).length>0&&y.abort(`interrupt`)});let L=async()=>{if(h)return;if(h=!0,g=void 0,tt(`running`),ve.stop(),V(`run_entry`),await j(),V(`after_updateSdkMcp`),P){let e=parseInt(process.env.WORKMATE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=wi(e).then(()=>`timeout`);await Promise.race([P,t])===`timeout`&&q(Error(`WORKMATE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`))}else await P;P=null,await be();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-QoVXsBjy.js`);t()}let t=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=Lt(t);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Oc(r,yt(t));)i.push(Lt(t));let a=await st(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Dc(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(p.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&b.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:N(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=u(),l=[...s.mcp.clients,...D,...M.clients];A(l);let f=le(s);for(let e of o)$t(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,u=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,d=u.match(/<total_tokens>(\d+)<\/total_tokens>/),f=u.match(/<tool_uses>(\d+)<\/tool_uses>/),p=u.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&b.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:d&&f?{total_tokens:parseInt(d[1],10),tool_uses:parseInt(f[1],10),duration_ms:p?parseInt(p[1],10):0}:void 0,session_id:N(),uuid:J()})}let m=r.value,h=a.claimedCommands;if(x.abortController?.abort(),x.abortController=null,x.pendingSuggestion=null,x.pendingLastEmittedEntry=null,x.lastEmitted&&r.mode===`prompt`){let e=typeof m==`string`?m:m.find(e=>e.type===`text`)?.text;typeof e==`string`&&Hn(x.lastEmitted.text,e,x.lastEmitted.emittedAt,x.lastEmitted.promptId,x.lastEmitted.generationRequestId),x.lastEmitted=null}y=Lr(),V(`before_ask`),yn();let g=r,_=!1;try{if(await di(g.workload??p.workload,async()=>{for await(let e of Ii({commands:Dn([...F,...s.mcp.commands],`name`),prompt:m,promptUuid:g.uuid,isMeta:g.isMeta,cwd:Y(),tools:f,verbose:p.verbose,mcpClients:l,thinkingConfig:p.thinkingConfig,maxTurns:p.maxTurns,maxBudgetUsd:p.maxBudgetUsd,taskBudget:p.taskBudget,canUseTool:c,userSpecifiedModel:ae,fallbackModel:p.fallbackModel,jsonSchema:ce()??p.jsonSchema,mutableMessages:C,getReadFileCache:()=>T.size===0?w:ct(w,T),setReadFileCache:e=>{w=e;for(let[e,t]of T.entries()){let n=w.get(e);(!n||t.timestamp>n.timestamp)&&w.set(e,t)}T.clear()},customSystemPrompt:p.systemPrompt,appendSystemPrompt:p.appendSystemPrompt,getAppState:u,setAppState:d,abortController:y,replayUserMessages:p.replayUserMessages,includePartialMessages:p.includePartialMessages,handleElicitation:(e,t,r)=>n.handleElicitation(e,t.message,void 0,r,t.mode,t.url,`elicitationId`in t?t.elicitationId:void 0),agents:I,orphanedPermission:g.orphanedPermission,setSDKStatus:e=>{b.enqueue({type:`system`,subtype:`status`,status:e,session_id:N(),uuid:J()})}}))if(e.type===`result`){_=!!e.is_error;for(let e of Sr())b.enqueue(e);Nn(u()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&dn(e))?v=e:(v=null,b.enqueue(e))}else{for(let e of Sr())b.enqueue(e);b.enqueue(e)}}),_)await ir({commands:h,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:Y(),priority:`later`,workload:g.workload??p.workload});else{let e=await ir({commands:h,outcome:{type:`completed`},currentDir:Y(),priority:`later`,workload:g.workload??p.workload});for(let t of e)Er({...t,uuid:J()})}}catch(e){throw await ir({commands:h,outcome:{type:`failed`,error:e},currentDir:Y(),priority:`later`,workload:g.workload??p.workload}),e}for(let e of o)$t(e,`completed`);if(p.promptSuggestions&&!e(process.env.WORKMATE_ENABLE_PROMPT_SUGGESTION)){x.abortController?.abort();let e=new AbortController;x.abortController=e;let t=Ut();if(!t)ht(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await Dt(e,C,u,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:J(),session_id:N()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};v?(x.pendingSuggestion=r,x.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(x.lastEmitted=i,b.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){ht(`aborted`,void 0,void 0,`sdk`);return}q(Wr(e))}finally{x.inflightPromise===n.promise&&(x.inflightPromise=null)}})(),x.inflightPromise=n.promise}}Qe(),br(),Oe()}};do{for(let e of Sr())b.enqueue(e);g=`draining_commands`,await a(),i=!1;{let e=Nn(u()).some(e=>dn(e)),n=yt(t)!==void 0;(e||n)&&(i=!0,n||(g=`waiting_for_agents`,await wi(100)))}}while(i);v&&(b.enqueue(v),v=null,x.pendingSuggestion&&(b.enqueue(x.pendingSuggestion),x.pendingLastEmittedEntry&&(x.lastEmitted={...x.pendingLastEmittedEntry,emittedAt:Date.now()},x.pendingLastEmittedEntry=null),x.pendingSuggestion=null))}catch(e){try{await n.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:N(),total_cost_usd:0,usage:nr,modelUsage:{},permission_denials:[],uuid:J(),errors:[U(e),...ti().map(e=>e.error)]})}catch{}x.abortController?.abort(),B(1);return}finally{if(g=`finally_flush`,await n.flushInternalEvents(),g=`finally_post_flush`,!ln()){tt(`idle`);for(let e of Sr())b.enqueue(e)}h=!1,ve.start()}if(ot()&&!tr()&&yt(t)===void 0&&!_){Ce();return}if(yt(t)!==void 0){L();return}_&&(x.inflightPromise&&await Promise.race([x.inflightPromise,wi(5e3)]),x.abortController?.abort(),x.abortController=null,await fr(),Se(),Ir.delete(S),b.done())},R=(e,t)=>{b.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},z=(e,t)=>{b.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},we=new Set;return n.setUnexpectedResponseCallback(async e=>{await Bc({message:e,setAppState:d,handledToolUseIds:we,onEnqueued:()=>{L()}})}),(async()=>{let e=!1;ee(`info`,`cli_message_loop_started`);for await(let t of n.structuredInput){let r=`uuid`in t?t.uuid:void 0;if(r&&t.type!==`user`&&t.type!==`control_response`&&$t(r,`completed`),t.type===`control_request`){let r=t,o=r.request;if(r.request.subtype===`interrupt`)d(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),y&&y.abort(),x.abortController?.abort(),x.abortController=null,x.lastEmitted=null,x.pendingSuggestion=null,R(r);else if(o.subtype===`end_session`){W(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),y&&y.abort(),x.abortController?.abort(),x.abortController=null,x.lastEmitted=null,x.pendingSuggestion=null,R(r);break}else if(r.request.subtype===`initialize`){if(r.request.sdkMcpServers&&r.request.sdkMcpServers.length>0)for(let e of r.request.sdkMcpServers)l[e]={type:`sdk`,name:e};await Nc(r.request,r.request_id,e,b,a,ie,n,p,f,u),r.request.promptSuggestions&&d(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),r.request.agentProgressSummaries&&fe(!0),e=!0,Wn()&&L()}else if(r.request.subtype===`set_permission_mode`){let e=r.request;d(t=>({...t,toolPermissionContext:Fc(e,r.request_id,t.toolPermissionContext,b)}))}else if(r.request.subtype===`set_model`){let e=r.request.model??`default`,t=e==="default"?pi():e;ae=t,_e(t),Ue({model:t}),E(e,t),R(r)}else if(r.request.subtype===`set_max_thinking_tokens`)r.request.max_thinking_tokens===null?p.thinkingConfig=void 0:r.request.max_thinking_tokens===0?p.thinkingConfig={type:`disabled`}:p.thinkingConfig={type:`enabled`,budgetTokens:r.request.max_thinking_tokens},R(r);else if(r.request.subtype===`mcp_status`)R(r,{mcpServers:me()});else if(r.request.subtype===`get_context_usage`)try{let e=u(),t=await Hi({messages:C,getAppState:u,options:{mainLoopModel:mi(),tools:le(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:p.systemPrompt,appendSystemPrompt:p.appendSystemPrompt}});R(r,{...t})}catch(e){z(r,U(e))}else if(r.request.subtype===`mcp_message`){let e=r.request,t=D.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),R(r)}else if(r.request.subtype===`rewind_files`){let e=u(),t=await Pc(r.request.user_message_id,e,d,r.request.dry_run??!1);t.canRewind||r.request.dry_run?R(r,t):z(r,t.error??`Unexpected error`)}else if(r.request.subtype===`cancel_async_message`){let e=r.request.message_uuid,t=Ie(t=>t.uuid===e);R(r,{cancelled:t.length>0})}else if(r.request.subtype===`seed_read_state`){try{let e=te(r.request.path),t=Math.floor((await ta(e)).mtimeMs);if(t<=r.request.mtime){let n=await ea(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
|
|
11
|
+
Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(Qe(),Xr())try{let{drainPendingExtraction:e}=await import(`./extractMemories-CVUrBFMj.js`);await e()}catch{}B(x?.type===`result`&&x?.is_error?1:0)}function Ac(n,i,a,o,s,c,l,u,d,f,p,m){let h=!1,g,_=!1,v=null,y,b=n.outbound;process.on(`SIGINT`,()=>{ee(`info`,`shutdown_signal`,{signal:`SIGINT`}),y&&!y.signal.aborted&&y.abort(),Jn(0)}),Gr(async()=>{let e={};for(let t of Nn(u()))dn(t)&&(e[t.type]=(e[t.type]??0)+1);ee(`info`,`run_state_at_shutdown`,{run_active:h,run_phase:g,worker_status:Vn(),internal_events_pending:n.internalEventsPending,bg_tasks:e})}),lt(e=>{(e==="default"||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&b.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:J(),session_id:N()})});let x={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},S=e=>{let t=Fi(e);t&&b.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:J(),session_id:N()})};Ir.add(S);let C=s,w=Ar(s,Y(),100),T=tn(100),re=process.env.WORKMATE_RESUME_INTERRUPTED_TURN;m&&m.kind!==`none`&&re&&(W(`[print.ts] Auto-resuming interrupted turn (kind: ${m.kind})`),Lc(C,m.message),Er({mode:`prompt`,value:m.message.message.content,uuid:J()}));let ie=Wi().map(e=>{let t=e.value===null?`default`:e.value,n=t==="default"?pi():hi(t),r=ar(n),i=wt(e.value),a=Ln(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsAdaptiveThinking:!0},...i&&{supportsFastMode:!0},...a&&{supportsAutoMode:!0}}}),ae=p.userSpecifiedModel;function E(e,t){let n=or(e,ui(t));C.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&b.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:N(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let D=[],O=[],k=new Set;function A(e){for(let t of e){if(t.type!==`connected`||k.has(t.name)||t.config.type===`sdk`)continue;let e=t.name;try{t.client.setRequestHandler(Ge,async(t,r)=>{ei(e,`Elicitation request received in print mode: ${H(t)}`);let i=t.params.mode===`url`?`url`:`form`,a=await Or(e,t.params,r.signal);if(a)return ei(e,`Elicitation resolved by hook: ${H(a)}`),a.action,a;let o=`url`in t.params?t.params.url:void 0,s=`requestedSchema`in t.params?t.params.requestedSchema:void 0,c=`elicitationId`in t.params?t.params.elicitationId:void 0,l=await n.handleElicitation(e,t.params.message,s,r.signal,i,o,c),u=await Ft(e,l,r.signal,i,c);return u.action,u}),t.client.setNotificationHandler(rr,t=>{let{elicitationId:n}=t.params;ei(e,`Elicitation completion notification: ${n}`),ke({message:`MCP server "${e}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),b.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:e,elicitation_id:n,uuid:J(),session_id:N()})}),k.add(e)}catch{}}}async function j(){let e=new Set(Object.keys(l)),t=new Set(D.map(e=>e.name)),r=Array.from(e).some(e=>!t.has(e)),i=Array.from(t).some(t=>!e.has(t)),a=D.some(e=>e.type===`pending`),o=D.some(e=>e.type===`failed`);if(r||i||a||o){for(let t of D)e.has(t.name)||t.type===`connected`&&await t.cleanup();let r=await Pr(l,(e,t)=>n.sendMcpMessage(e,t));D=r.clients,O=r.tools;let i=oe([...t,...e]);d(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(ne(t)))),...O]}})),St(D)}}j();let M={clients:[],tools:[],configs:{}},le=e=>{let t=Me(e.toolPermissionContext,e.mcp.tools),n=Dn(ji([...o,...O,...M.tools],t,e.toolPermissionContext.mode),`name`);p.permissionPromptToolName&&(n=n.filter(e=>!_i(e,p.permissionPromptToolName)));let r=ce();if(r&&!p.jsonSchema){let e=yi(r);`tool`in e&&(n=[...n,e.tool])}return n},ue=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function de(e){let t=async()=>{let t=new Set(D.map(e=>e.name)),n=await Hc(e,{configs:l,clients:D,tools:O},M,d);for(let e of Object.keys(l))delete l[e];if(Object.assign(l,n.newSdkState.configs),D=n.newSdkState.clients,O=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(D.map(e=>e.name)),n=oe([...t,...e]);d(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(ne(t)))),...O]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return ue=ue.then(t,t),ue}function me(){let e=u(),t=e.mcp.clients,n=Dn([...e.mcp.tools,...M.tools],`name`),r=new Set([...t.map(e=>e.name),...D.map(e=>e.name)]);return[...t,...D,...M.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?nn(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0;return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r}})}async function he(){try{await xc()&&await xe()}catch(e){q(e)}}let P=null;r()||(t(process.env.WORKMATE_SYNC_PLUGIN_INSTALL)?P=he():he());let ve=mc(()=>!h),F=a,I=f;async function be(){let{agentDefinitions:e}=await Xi(d);F=await Ve(Y());let t=I.filter(e=>e.source===`flagSettings`);I=[...e.allAgents,...t]}async function xe(){let{servers:e}=await Qn(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(l))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await de(t);r&&j(),W(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Se=Ji.subscribe(()=>{Pe(),Ve(Y()).then(e=>{F=e})}),Ce=()=>{setTimeout(()=>{!ot()||tr()||_||(async()=>{let e=await on({basePrompt:`<${$r}>${new Date().toLocaleTimeString()}</${$r}>`,currentDir:Y(),shouldCreate:()=>!_});if(_){await qe({commands:e});return}for(let t of e)Er({...t,uuid:J()});L()})().catch(e=>{q(e),W(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};rt(()=>{y&&Ct(`now`).length>0&&y.abort(`interrupt`)});let L=async()=>{if(h)return;if(h=!0,g=void 0,tt(`running`),ve.stop(),V(`run_entry`),await j(),V(`after_updateSdkMcp`),P){let e=parseInt(process.env.WORKMATE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=wi(e).then(()=>`timeout`);await Promise.race([P,t])===`timeout`&&q(Error(`WORKMATE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`))}else await P;P=null,await be();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-BIfM53-_.js`);t()}let t=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=Lt(t);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Oc(r,yt(t));)i.push(Lt(t));let a=await st(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Dc(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(p.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&b.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:N(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=u(),l=[...s.mcp.clients,...D,...M.clients];A(l);let f=le(s);for(let e of o)$t(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,u=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,d=u.match(/<total_tokens>(\d+)<\/total_tokens>/),f=u.match(/<tool_uses>(\d+)<\/tool_uses>/),p=u.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&b.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:d&&f?{total_tokens:parseInt(d[1],10),tool_uses:parseInt(f[1],10),duration_ms:p?parseInt(p[1],10):0}:void 0,session_id:N(),uuid:J()})}let m=r.value,h=a.claimedCommands;if(x.abortController?.abort(),x.abortController=null,x.pendingSuggestion=null,x.pendingLastEmittedEntry=null,x.lastEmitted&&r.mode===`prompt`){let e=typeof m==`string`?m:m.find(e=>e.type===`text`)?.text;typeof e==`string`&&Hn(x.lastEmitted.text,e,x.lastEmitted.emittedAt,x.lastEmitted.promptId,x.lastEmitted.generationRequestId),x.lastEmitted=null}y=Lr(),V(`before_ask`),yn();let g=r,_=!1;try{if(await di(g.workload??p.workload,async()=>{for await(let e of Ii({commands:Dn([...F,...s.mcp.commands],`name`),prompt:m,promptUuid:g.uuid,isMeta:g.isMeta,cwd:Y(),tools:f,verbose:p.verbose,mcpClients:l,thinkingConfig:p.thinkingConfig,maxTurns:p.maxTurns,maxBudgetUsd:p.maxBudgetUsd,taskBudget:p.taskBudget,canUseTool:c,userSpecifiedModel:ae,fallbackModel:p.fallbackModel,jsonSchema:ce()??p.jsonSchema,mutableMessages:C,getReadFileCache:()=>T.size===0?w:ct(w,T),setReadFileCache:e=>{w=e;for(let[e,t]of T.entries()){let n=w.get(e);(!n||t.timestamp>n.timestamp)&&w.set(e,t)}T.clear()},customSystemPrompt:p.systemPrompt,appendSystemPrompt:p.appendSystemPrompt,getAppState:u,setAppState:d,abortController:y,replayUserMessages:p.replayUserMessages,includePartialMessages:p.includePartialMessages,handleElicitation:(e,t,r)=>n.handleElicitation(e,t.message,void 0,r,t.mode,t.url,`elicitationId`in t?t.elicitationId:void 0),agents:I,orphanedPermission:g.orphanedPermission,setSDKStatus:e=>{b.enqueue({type:`system`,subtype:`status`,status:e,session_id:N(),uuid:J()})}}))if(e.type===`result`){_=!!e.is_error;for(let e of Sr())b.enqueue(e);Nn(u()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&dn(e))?v=e:(v=null,b.enqueue(e))}else{for(let e of Sr())b.enqueue(e);b.enqueue(e)}}),_)await ir({commands:h,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:Y(),priority:`later`,workload:g.workload??p.workload});else{let e=await ir({commands:h,outcome:{type:`completed`},currentDir:Y(),priority:`later`,workload:g.workload??p.workload});for(let t of e)Er({...t,uuid:J()})}}catch(e){throw await ir({commands:h,outcome:{type:`failed`,error:e},currentDir:Y(),priority:`later`,workload:g.workload??p.workload}),e}for(let e of o)$t(e,`completed`);if(p.promptSuggestions&&!e(process.env.WORKMATE_ENABLE_PROMPT_SUGGESTION)){x.abortController?.abort();let e=new AbortController;x.abortController=e;let t=Ut();if(!t)ht(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await Dt(e,C,u,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:J(),session_id:N()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};v?(x.pendingSuggestion=r,x.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(x.lastEmitted=i,b.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){ht(`aborted`,void 0,void 0,`sdk`);return}q(Wr(e))}finally{x.inflightPromise===n.promise&&(x.inflightPromise=null)}})(),x.inflightPromise=n.promise}}Qe(),br(),Oe()}};do{for(let e of Sr())b.enqueue(e);g=`draining_commands`,await a(),i=!1;{let e=Nn(u()).some(e=>dn(e)),n=yt(t)!==void 0;(e||n)&&(i=!0,n||(g=`waiting_for_agents`,await wi(100)))}}while(i);v&&(b.enqueue(v),v=null,x.pendingSuggestion&&(b.enqueue(x.pendingSuggestion),x.pendingLastEmittedEntry&&(x.lastEmitted={...x.pendingLastEmittedEntry,emittedAt:Date.now()},x.pendingLastEmittedEntry=null),x.pendingSuggestion=null))}catch(e){try{await n.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:N(),total_cost_usd:0,usage:nr,modelUsage:{},permission_denials:[],uuid:J(),errors:[U(e),...ti().map(e=>e.error)]})}catch{}x.abortController?.abort(),B(1);return}finally{if(g=`finally_flush`,await n.flushInternalEvents(),g=`finally_post_flush`,!ln()){tt(`idle`);for(let e of Sr())b.enqueue(e)}h=!1,ve.start()}if(ot()&&!tr()&&yt(t)===void 0&&!_){Ce();return}if(yt(t)!==void 0){L();return}_&&(x.inflightPromise&&await Promise.race([x.inflightPromise,wi(5e3)]),x.abortController?.abort(),x.abortController=null,await fr(),Se(),Ir.delete(S),b.done())},R=(e,t)=>{b.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},z=(e,t)=>{b.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},we=new Set;return n.setUnexpectedResponseCallback(async e=>{await Bc({message:e,setAppState:d,handledToolUseIds:we,onEnqueued:()=>{L()}})}),(async()=>{let e=!1;ee(`info`,`cli_message_loop_started`);for await(let t of n.structuredInput){let r=`uuid`in t?t.uuid:void 0;if(r&&t.type!==`user`&&t.type!==`control_response`&&$t(r,`completed`),t.type===`control_request`){let r=t,o=r.request;if(r.request.subtype===`interrupt`)d(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),y&&y.abort(),x.abortController?.abort(),x.abortController=null,x.lastEmitted=null,x.pendingSuggestion=null,R(r);else if(o.subtype===`end_session`){W(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),y&&y.abort(),x.abortController?.abort(),x.abortController=null,x.lastEmitted=null,x.pendingSuggestion=null,R(r);break}else if(r.request.subtype===`initialize`){if(r.request.sdkMcpServers&&r.request.sdkMcpServers.length>0)for(let e of r.request.sdkMcpServers)l[e]={type:`sdk`,name:e};await Nc(r.request,r.request_id,e,b,a,ie,n,p,f,u),r.request.promptSuggestions&&d(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),r.request.agentProgressSummaries&&fe(!0),e=!0,Wn()&&L()}else if(r.request.subtype===`set_permission_mode`){let e=r.request;d(t=>({...t,toolPermissionContext:Fc(e,r.request_id,t.toolPermissionContext,b)}))}else if(r.request.subtype===`set_model`){let e=r.request.model??`default`,t=e==="default"?pi():e;ae=t,_e(t),Ue({model:t}),E(e,t),R(r)}else if(r.request.subtype===`set_max_thinking_tokens`)r.request.max_thinking_tokens===null?p.thinkingConfig=void 0:r.request.max_thinking_tokens===0?p.thinkingConfig={type:`disabled`}:p.thinkingConfig={type:`enabled`,budgetTokens:r.request.max_thinking_tokens},R(r);else if(r.request.subtype===`mcp_status`)R(r,{mcpServers:me()});else if(r.request.subtype===`get_context_usage`)try{let e=u(),t=await Hi({messages:C,getAppState:u,options:{mainLoopModel:mi(),tools:le(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:p.systemPrompt,appendSystemPrompt:p.appendSystemPrompt}});R(r,{...t})}catch(e){z(r,U(e))}else if(r.request.subtype===`mcp_message`){let e=r.request,t=D.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),R(r)}else if(r.request.subtype===`rewind_files`){let e=u(),t=await Pc(r.request.user_message_id,e,d,r.request.dry_run??!1);t.canRewind||r.request.dry_run?R(r,t):z(r,t.error??`Unexpected error`)}else if(r.request.subtype===`cancel_async_message`){let e=r.request.message_uuid,t=Ie(t=>t.uuid===e);R(r,{cancelled:t.length>0})}else if(r.request.subtype===`seed_read_state`){try{let e=te(r.request.path),t=Math.floor((await ta(e)).mtimeMs);if(t<=r.request.mtime){let n=await ea(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
|
|
12
12
|
`,`
|
|
13
13
|
`);T.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}R(r)}else if(r.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await de(r.request.servers);R(r,e),t&&j()}else if(r.request.subtype===`reload_plugins`)try{let e=await Xi(d),t=I.filter(e=>e.source===`flagSettings`);I=[...e.agentDefinitions.allAgents,...t];let n=[],[i,a,o]=await Promise.allSettled([Ve(Y()),xe(),$e()]);i.status===`fulfilled`?F=i.value:q(i.reason),a.status===`rejected`&&q(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):q(o.reason),R(r,{commands:F.filter(e=>e.userInvocable!==!1).map(e=>({name:vt(e),description:Rt(e),argumentHint:e.argumentHint||``})),agents:I.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:me(),error_count:e.error_count})}catch(e){z(r,U(e))}else if(r.request.subtype===`mcp_reconnect`){let e=u(),{serverName:t}=r.request;k.delete(t);let n=dr(t)??i.find(e=>e.name===t)?.config??D.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)z(r,`Server not found: ${t}`);else{let e=await jt(t,n),i=ne(t);if(d(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...Di(n.mcp.tools,e=>e.name?.startsWith(i)),...e.tools],commands:[...Di(n.mcp.commands,e=>Te(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:Ei(n.mcp.resources,t)}})),M={...M,clients:[...M.clients.filter(e=>e.name!==t),e.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(i)),...e.tools]},e.client.type===`connected`)A([e.client]),R(r);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;z(r,t)}}}else if(r.request.subtype===`mcp_toggle`){let e=u(),{serverName:t,enabled:n}=r.request;k.delete(t);let a=dr(t)??i.find(e=>e.name===t)?.config??D.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)z(r,`Server not found: ${t}`);else if(n){Fn(t,!0);let e=await jt(t,a),n=ne(t);if(d(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...Di(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...Di(r.mcp.commands,e=>Te(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:Ei(r.mcp.resources,t)}})),e.client.type===`connected`)A([e.client]),R(r);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;z(r,t)}}else{Fn(t,!1);let n=[...i,...D,...M.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await Un(t,a);let o=ne(t);d(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:Di(e.mcp.tools,e=>e.name?.startsWith(o)),commands:Di(e.mcp.commands,e=>Te(e,t)),resources:Ei(e.mcp.resources,t)}})),R(r)}}else if(r.request.subtype===`apply_flag_settings`){let e=mi(),t=pe()??{},n=r.request.settings,i={...t,...n};for(let e of Object.keys(i))i[e]===null&&delete i[e];ge(i),mr.notifyChange(`flagSettings`),`model`in n&&(n.model==null?_e(void 0):_e(String(n.model)));let a=mi();if(a!==e){ae=a;let e=n.model?String(n.model):`default`;Ue({model:a}),E(e,a)}R(r)}else if(r.request.subtype===`get_settings`){let e=mi();R(r,{...se(),applied:{model:e}})}else if(r.request.subtype===`stop_task`){let{task_id:e}=r.request;try{await Kt(e,{getAppState:u,setAppState:d}),R(r,{})}catch(e){z(r,U(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(y&&!y.signal.aborted?y:Lr()).signal;(async()=>{try{let i=await Ri(e,n);if(i&&t)try{ye(N(),i)}catch(e){q(e)}R(r,{title:i})}catch(e){z(r,U(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=Ut(),n=t?{...t,toolUseContext:{...t.toolUseContext,abortController:Lr()}}:await Pi({tools:le(u()),commands:F,mcpClients:[...u().mcp.clients,...D,...M.clients],messages:C,readFileState:w,getAppState:u,setAppState:d,customSystemPrompt:p.systemPrompt,appendSystemPrompt:p.appendSystemPrompt,thinkingConfig:p.thinkingConfig,agents:I}),i=await Vi({question:e,cacheSafeParams:n});R(r,{response:i.response})}catch(e){z(r,U(e))}})()}else r.request.subtype===`set_proactive`?(r.request.enabled?ot()||(Gt(`command`),Ce()):Xe(),R(r)):z(r,`Unsupported control request subtype: ${r.request.subtype}`);continue}else if(t.type===`control_response`){p.replayUserMessages&&b.enqueue(t);continue}else if(t.type===`keep_alive`)continue;else if(t.type===`update_environment_variables`)continue;else if(t.type===`assistant`||t.type===`system`){let e=Li([t]);C.push(...e),t.type===`assistant`&&p.replayUserMessages&&b.enqueue(t);continue}if(t.type!==`user`)continue;let o=t;if(e=!0,o.uuid){let e=N(),t=await Ke(e,o.uuid);if(t||Cc.has(o.uuid)){W(`Skipping duplicate user message: ${o.uuid}`),p.replayUserMessages&&(W(`Sending acknowledgment for duplicate user message: ${o.uuid}`),b.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&$t(o.uuid,`completed`);continue}Tc(o.uuid)}Er({mode:`prompt`,value:o.message.content,uuid:o.uuid,priority:o.priority}),d(e=>({...e,attribution:On(e.attribution,e=>{dt(e).catch(e=>{W(`Attribution: Failed to save snapshot: ${e}`)})})})),L()}_=!0,h||(x.inflightPromise&&await Promise.race([x.inflightPromise,wi(5e3)]),x.abortController?.abort(),x.abortController=null,await fr(),Se(),Ir.delete(S),b.done())})(),b}function jc(e){let t=async(n,r,i,a,o,s)=>{let c=s??await we(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=un(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,h=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!h.content||!Array.isArray(h.content)||!h.content[0]||h.content[0].type!==`text`||typeof h.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return $s(Qs().parse(v(h.content[0].text)),e,r,i)};return t}function Mc(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await we(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>_i(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),B(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),B(1),Error(t)}i=jc(r)}return i(t,r,a,o,s,c)}}async function Nc(e,t,n,r,i,a,o,s,c,l){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(s.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(s.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(s.promptSuggestions=e.promptSuggestions),e.agents){let t=En(e.agents,`flagSettings`);c.push(...t)}if(s.agent){let e=he()===s.agent,t=c.find(e=>e.agentType===s.agent);if(t&&!e){if(ve(t.agentType),!s.systemPrompt&&!lr(t)){let e=t.getSystemPrompt();e&&(s.systemPrompt=e)}!s.userSpecifiedModel&&t.model&&t.model!==`inherit`&&_e(hi(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let u=b()?.outputStyle||`default`,d=await Re(zr());if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});de(t)}e.jsonSchema&&P(e.jsonSchema);let f={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:vt(e),description:Rt(e),argumentHint:e.argumentHint||``})),agents:c.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:u,available_output_styles:Object.keys(d),models:a,account:{apiProvider:si()},pid:process.pid};if(gt()&&Bn()){let e=l();f.fast_mode_state=Le(s.userSpecifiedModel??null,e.fastMode)}r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:f}})}async function Pc(e,t,n,r){if(!I())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Ot(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await Tn(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await zn(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${U(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Fc(e,t,n,r){if(e.mode===`bypassPermissions`){if(Cr())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!je()){let e=jr();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${yr(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...be(n.mode,e.mode,n),mode:e.mode}}function Ic(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:N(),total_cost_usd:0,usage:nr,modelUsage:{},permission_denials:[],uuid:J(),errors:[e]};process.stdout.write(`${H(t)}\n`)}else process.stderr.write(`${e}\n`)}function Lc(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function Rc(e,t){let n=!le();if(t.continue)try{let r=await Ni(void 0,void 0);if(r)return t.forkSession||r.sessionId&&(ue(Ne(r.sessionId),r.fullPath?Qi(r.fullPath):null),n&&await sn()),qi(r,e),rn(t.forkSession?{...r,worktreeSession:void 0}:r),{messages:r.messages,turnInterruptionState:r.turnInterruptionState,agentSetting:r.agentSetting}}catch(e){return q(e),B(1),{messages:[]}}if(t.resume)try{let r=hc(typeof t.resume==`string`?t.resume:``);if(!r){let e=`Error: --resume requires a valid session ID when used with --print. Usage: wm -p --resume <session-id>`;return typeof t.resume==`string`&&(e+=`. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${t.resume}" is not a valid UUID`),Ic(e,t.outputFormat),B(1),{messages:[]}}let i=await Ni(r.sessionId,r.jsonlFile||void 0);if(!i||i.messages.length===0)return Ic(`No conversation found with session ID: ${r.sessionId}`,t.outputFormat),B(1),{messages:[]};if(t.resumeSessionAt){let e=i.messages.findIndex(e=>e.uuid===t.resumeSessionAt);if(e<0)return Ic(`No message found with message.uuid of: ${t.resumeSessionAt}`,t.outputFormat),B(1),{messages:[]};i.messages=e>=0?i.messages.slice(0,e+1):[]}return!t.forkSession&&i.sessionId&&(ue(Ne(i.sessionId),i.fullPath?Qi(i.fullPath):null),n&&await sn()),qi(i,e),rn(t.forkSession?{...i,worktreeSession:void 0}:i),{messages:i.messages,turnInterruptionState:i.turnInterruptionState,agentSetting:i.agentSetting}}catch(e){return q(e),Ic(e instanceof Error?`Failed to resume session: ${e.message}`:`Failed to resume session with --print mode`,t.outputFormat),B(1),{messages:[]}}return{messages:await(t.sessionStartHooksPromise??Xn(`startup`))}}function zc(e,t){let n;return n=typeof e==`string`?e.trim()===``?qn([]):qn([H({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})]):e,new sc(n,t.replayUserMessages)}async function Bc({message:e,setAppState:t,onEnqueued:n,handledToolUseIds:r}){let i=e.response;if(i?.subtype===`success`&&i.response?.toolUseID&&typeof i.response.toolUseID==`string`){let e=i.response,t=e.toolUseID;if(!t)return!1;if(W(`handleOrphanedPermissionResponse: received orphaned control_response for toolUseID=${t} request_id=${i.request_id}`),r.has(t))return W(`handleOrphanedPermissionResponse: skipping duplicate orphaned permission for toolUseID=${t} (already handled)`),!1;let a=await an(t);return a?(r.add(t),W(`handleOrphanedPermissionResponse: enqueuing orphaned permission for toolUseID=${t} messageID=${a.message.id}`),Er({mode:`orphaned-permission`,value:[],orphanedPermission:{permissionResult:e,assistantMessage:a}}),n?.(),!0):(W(`handleOrphanedPermissionResponse: no unresolved tool_use found for toolUseID=${t} (already resolved in transcript)`),!1)}return!1}function Vc(e){return{...e,scope:`dynamic`}}async function Hc(e,t,n,r){let{allowed:i,blocked:a}=mn(e),o={};for(let e of a)o[e]=`Blocked by enterprise policy (allowedMcpServers/deniedMcpServers)`;let s={},c={};for(let[e,t]of Object.entries(i))t.type===`sdk`?s[e]=t:c[e]=t;let l=new Set(Object.keys(t.configs)),u=new Set(Object.keys(s)),d=[],f=[],p={...t.configs},m=[...t.clients],h=[...t.tools];for(let e of l)if(!u.has(e)){let t=m.find(t=>t.name===e);t&&t.type===`connected`&&await t.cleanup(),m=m.filter(t=>t.name!==e);let n=`mcp__${e}__`;h=h.filter(e=>!e.name.startsWith(n)),delete p[e],f.push(e)}for(let[e,t]of Object.entries(s))if(!l.has(e)){p[e]=t;let n={type:`pending`,name:e,config:{...t,scope:`dynamic`}};m=[...m,n],d.push(e)}let g=await Uc(c,n,r);return{response:{added:[...d,...g.response.added],removed:[...f,...g.response.removed],errors:{...o,...g.response.errors}},newSdkState:{configs:p,clients:m,tools:h},newDynamicState:g.newState,sdkServersChanged:d.length>0||f.length>0}}async function Uc(e,t,n){let r=new Set(Object.keys(t.configs)),i=new Set(Object.keys(e)),a=[...r].filter(e=>!i.has(e)),o=[...i].filter(e=>!r.has(e)),s=[...r].filter(e=>i.has(e)).filter(n=>{let r=t.configs[n],i=e[n];return!r||!i||!xt(r,Vc(i))}),c=[],l=[],u={},d=[...t.clients],f=[...t.tools];for(let e of[...a,...s]){let n=d.find(t=>t.name===e),r=t.configs[e];if(n&&r){if(n.type===`connected`)try{await n.cleanup()}catch(e){q(e)}await Un(e,r)}let i=`mcp__${e}__`;f=f.filter(e=>!e.name.startsWith(i)),d=d.filter(t=>t.name!==e),a.includes(e)&&c.push(e)}for(let t of[...o,...s]){let n=e[t];if(!n)continue;let r=Vc(n);if(n.type===`sdk`){l.push(t);continue}try{let e=await Ce(t,r);if(d.push(e),e.type===`connected`){let t=await _t(e);f.push(...t)}else e.type===`failed`&&(u[t]=e.error||`Connection failed`);l.push(t)}catch(e){let n=Wr(e);u[t]=n.message,q(n)}}let p={};for(let t of i){let n=e[t];n&&(p[t]=Vc(n))}let m={clients:d,tools:f,configs:p};return n(e=>{let n=new Set([...Object.keys(t.configs),...Object.keys(p)]),r=e.mcp.tools.filter(e=>{for(let t of n)if(e.name.startsWith(`mcp__${t}__`))return!1;return!0}),i=e.mcp.clients.filter(e=>!n.has(e.name));return{...e,mcp:{...e.mcp,tools:[...r,...f],clients:[...i,...d]}}}),{response:{added:l,removed:c,errors:u},newState:m}}export{kc as runHeadless};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,t as n}from"./src-BX54x08P.js";import{t as r}from"./jsx-runtime-Bb4Xn-E0.js";import{m as i,t as a}from"./settings-D4M13toi.js";import{$x as o,Ac as s,Eg as c,Ji as l,Qu as u,Qx as d,Tg as f,Yx as p,Zu as m,_m as h,gm as g,kc as _,mb as v,nS as y,pb as b,vm as x,ym as S}from"./loadAgentsDir-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,t as n}from"./src-BX54x08P.js";import{t as r}from"./jsx-runtime-Bb4Xn-E0.js";import{m as i,t as a}from"./settings-D4M13toi.js";import{$x as o,Ac as s,Eg as c,Ji as l,Qu as u,Qx as d,Tg as f,Yx as p,Zu as m,_m as h,gm as g,kc as _,mb as v,nS as y,pb as b,vm as x,ym as S}from"./loadAgentsDir-bmpKLPdG.js";import{A as C,I as w,M as T}from"./debug-2pVES-2G.js";import{n as E}from"./analytics-COpjZpvd.js";import{St as D,xt as O}from"./prompt-BnDapYGL.js";import{randomUUID as k}from"crypto";n(),h(),u(),S();var A=r();function j({input:e,progress:n,verbose:r}){return(0,A.jsxs)(t,{flexDirection:`column`,marginTop:1,children:[(0,A.jsx)(m,{addMargin:!1,param:{text:`<bash-input>${e}</bash-input>`,type:`text`}}),n?(0,A.jsx)(x,{fullOutput:n.fullOutput,output:n.output,elapsedTimeSeconds:n.elapsedTimeSeconds,totalLines:n.totalLines,verbose:r}):g.renderToolUseProgressMessage?.([],{verbose:r,tools:[],terminalSize:void 0})]})}w(),E(),b(),l(),i();function M(){return a().defaultShell??`bash`}h(),O(),c();async function N(t,n,r,i,a){let c=D()&&M()===`powershell`,l=o({content:y({inputString:`<bash-input>${t}</bash-input>`,precedingInputBlocks:n})}),u;a({jsx:(0,A.jsx)(j,{input:t,progress:null,verbose:i.options.verbose}),shouldHidePromptInput:!1});try{let n={...i,setToolJSX:e=>{u=e?.jsx}},d=e=>{a({jsx:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(j,{input:t,progress:e.data,verbose:i.options.verbose}),u]}),shouldHidePromptInput:!1,showSpinner:!1})},m=null;c&&(m=(s(),e(_)).PowerShellTool);let h=m??g,y=(m?await m.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,d):await g.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,d)).data;if(!y)throw Error(`No result received from shell command`);let b=y.stderr,x=await v(h,{...y,stderr:``},k()),S=typeof x.content==`string`?x.content:f(y.stdout);return{messages:[p(),l,...r,o({content:`<bash-stdout>${S}</bash-stdout><bash-stderr>${f(b)}</bash-stderr>`})],shouldQuery:!1}}catch(e){return e instanceof C?e.interrupted?{messages:[p(),l,d({toolUse:!1}),...r],shouldQuery:!1}:{messages:[p(),l,...r,o({content:`<bash-stdout>${f(e.stdout)}</bash-stdout><bash-stderr>${f(e.stderr)}</bash-stderr>`})],shouldQuery:!1}:{messages:[p(),l,...r,o({content:`<bash-stderr>Command failed: ${f(T(e))}</bash-stderr>`})],shouldQuery:!1}}finally{a(null)}}export{N as processBashCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{At as t,kt as n}from"./settings-D4M13toi.js";import{An as r,Pt as i,at as a,t as o}from"./state-CXY-q5gr.js";import{$o as s,$x as c,Av as l,B as u,B_ as d,Bv as f,Ca as p,Cx as m,E as h,Ei as g,Fb as _,Gs as v,H_ as y,Hs as b,Ji as x,Kx as S,Mh as C,Mi as w,Nb as T,Ni as E,Pb as D,Qo as O,Qp as ee,Qx as te,Tp as ne,Tv as re,Tx as k,V as ie,Vx as ae,Ws as oe,Xp as se,Xx as ce,Yg as le,Yx as A,Zg as ue,Zp as de,_d as j,au as fe,b as pe,bd as me,bg as he,cu as ge,cv as M,dv as N,eS as P,eu as F,gc as I,gd as L,hc as _e,iS as ve,jh as ye,ji as be,la as xe,lu as Se,nS as R,nu as z,rS as Ce,ts as we,tu as Te,vd as Ee,wi as De,wp as Oe,wv as ke,wx as B,xg as Ae,xi as je,yd as Me,zv as Ne}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{At as t,kt as n}from"./settings-D4M13toi.js";import{An as r,Pt as i,at as a,t as o}from"./state-CXY-q5gr.js";import{$o as s,$x as c,Av as l,B as u,B_ as d,Bv as f,Ca as p,Cx as m,E as h,Ei as g,Fb as _,Gs as v,H_ as y,Hs as b,Ji as x,Kx as S,Mh as C,Mi as w,Nb as T,Ni as E,Pb as D,Qo as O,Qp as ee,Qx as te,Tp as ne,Tv as re,Tx as k,V as ie,Vx as ae,Ws as oe,Xp as se,Xx as ce,Yg as le,Yx as A,Zg as ue,Zp as de,_d as j,au as fe,b as pe,bd as me,bg as he,cu as ge,cv as M,dv as N,eS as P,eu as F,gc as I,gd as L,hc as _e,iS as ve,jh as ye,ji as be,la as xe,lu as Se,nS as R,nu as z,rS as Ce,ts as we,tu as Te,vd as Ee,wi as De,wp as Oe,wv as ke,wx as B,xg as Ae,xi as je,yd as Me,zv as Ne}from"./loadAgentsDir-bmpKLPdG.js";import{E as Pe,I as Fe,c as V,f as Ie,i as H,k as U,u as Le}from"./debug-2pVES-2G.js";import{D as W,O as G,o as Re,q as ze,s as K}from"./log-L1kqxa_P.js";import{n as Be}from"./analytics-COpjZpvd.js";import{At as Ve,kt as He}from"./model-Dd3x121y.js";import{n as Ue,t as We}from"./sleep-xKMbXTJe.js";import{E as Ge,T as Ke,w as qe}from"./sessionTracing-5a7HDF4e.js";import{randomUUID as q}from"crypto";function Je(e,n,r,i,a){let o=0;for(let s of t){let t=r[s];if(t)for(let r of t)for(let t of r.hooks){let c=t.once?()=>{V(`Removing one-shot hook for event ${s} in skill '${i}'`),me(e,n,s,t)}:void 0;Ee(e,n,s,r.matcher||``,t,c,a),o++}}o>0&&V(`Registered ${o} hooks from skill '${i}'`)}var Ye=e((()=>{n(),H(),Me()}));function Xe(e){let t=e.trim();if(!t.startsWith(`/`))return null;let n=t.slice(1).split(` `);if(!n[0])return null;let r=n[0],i=!1,a=1;n.length>1&&n[1]===`(MCP)`&&(r=`${r} (MCP)`,i=!0,a=2);let o=n.slice(a).join(` `);return{commandName:r,args:o,isMcp:i}}var Ze=e((()=>{}));function Qe(){return!1}function $e(){if(!Qe())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function J(e,t,n,r,i,a,o){let s=Oe(),l=e.pluginInfo?k(e.pluginInfo.repository).marketplace:void 0;e.name,{...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...l&&{_PROTO_marketplace_name:l},...z(e.pluginInfo)}};let{skillContent:u,modifiedGetAppState:d,baseAgent:f,promptMessages:p}=await v(e,t,n);V(`Executing forked slash command /${e.name} with agent ${f.agentType}`);let m=n.options.allowBackgroundForkedSlashCommands===!0;if(m&&$e(),m){let t=Ne(),r=E(e),i=He(),c=e=>re({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),l=async()=>{if(!o?.runId)return;let e=await se({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)ke(t)},u=async e=>{o?.runId&&await de({runId:o.runId,rootDir:o.rootDir,error:e instanceof Error?e.message:String(e)})};return(async()=>{let i=Date.now()+$;for(;Date.now()<i&&n.getAppState().mcp.clients.some(e=>e.type===`pending`);)await Ue(Q);let o=n.options.refreshTools?.()??n.options.tools,u=[];for await(let r of j({agentDefinition:f,promptMessages:p,toolUseContext:{...n,getAppState:d,abortController:t},canUseTool:a,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:o,override:{agentId:s}}))u.push(r);let m=b(u,`Command completed`);V(`Background forked command /${r} completed (agent ${s})`),c(`<scheduled-task-result command="/${r}">\n${m}\n</scheduled-task-result>`);try{await l()}catch(e){K(e)}})().catch(async e=>{K(e),c(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await u(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!o?.runId}}let h=[],g=[],_=`forked-command-${e.name}`,y=0,x=e=>(y++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:u,agentId:s},parentToolUseID:_,toolUseID:`${_}-${y}`,timestamp:new Date().toISOString(),uuid:q()}),S=()=>{i({jsx:Se(g,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};S();try{for await(let t of j({agentDefinition:f,promptMessages:p,toolUseContext:{...n,getAppState:d},canUseTool:a,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){h.push(t);let e=xe([t]);if(t.type===`assistant`){let r=M(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(g.push(x(t)),S())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(g.push(x(t)),S())}}}finally{i(null)}let C=b(h,`Command completed`);return V(`Forked slash command /${e.name} completed with agent ${s}`),{messages:[c({content:R({inputString:`/${E(e)} ${t}`.trim(),precedingInputBlocks:r})}),c({content:`<local-command-stdout>\n${C}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:C}}function et(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function tt(e,t,n,i,a,o,s,l,u,d){let f=Xe(e);if(!f){let e="Commands are in the form `/command [args]`";return{messages:[A(),...i,c({content:R({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:m,args:h,isMcp:g}=f,_=g?`mcp`:je().has(m)?m:`custom`;if(!be(m,a.options.commands)){let n=!1;try{await Le().stat(`/${m}`),n=!0}catch{}if(et(m)&&!n){let e=`Unknown skill: ${m}`;return{messages:[A(),...i,c({content:R({inputString:e,precedingInputBlocks:t})}),...h?[ce(`Args from unknown skill: ${h}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let a=q();return r(a),Ke(`user_prompt`,{prompt_length:String(e.length),prompt:Ge(e),"prompt.id":a}),{messages:[c({content:R({inputString:e,precedingInputBlocks:t}),uuid:s}),...i],shouldQuery:!0}}let{messages:v,shouldQuery:y,allowedTools:b,model:x,command:S,resultText:C,nextInput:w,submitNextInput:T,deferAutonomyCompletion:E}=await nt(m,h,o,a,t,n,l,u,s,d);if(v.length===0){let e={input:_};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:t,repository:n}=S.pluginInfo,{marketplace:r}=k(n),i=B(r);e._PROTO_plugin_name=t.name,r&&(e._PROTO_marketplace_name=r),e.plugin_repository=i?n:`third-party`,e.plugin_name=i?t.name:`third-party`,i&&t.version&&(e.plugin_version=t.version),Object.assign(e,z(S.pluginInfo))}return{...e},{messages:[],shouldQuery:!1,model:x,nextInput:w,submitNextInput:T,deferAutonomyCompletion:E}}if(v.length===2&&v[1].type===`user`&&typeof v[1].message.content==`string`&&v[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`),{messages:[A(),...v],shouldQuery:y,allowedTools:b,model:x};let D={input:_};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:e,repository:t}=S.pluginInfo,{marketplace:n}=k(t),r=B(n);D._PROTO_plugin_name=e.name,n&&(D._PROTO_marketplace_name=n),D.plugin_repository=r?t:`third-party`,D.plugin_name=r?e.name:`third-party`,r&&e.version&&(D.plugin_version=e.version),Object.assign(D,z(S.pluginInfo))}({...D});let O=v.length>0&&v[0]&&ae(v[0]);return{messages:y||v.every(p)||O?v:[A(),...v],shouldQuery:y,allowedTools:b,model:x,resultText:C,nextInput:w,submitNextInput:T,deferAutonomyCompletion:E}}async function nt(e,t,n,r,i,a,o,s,l,d){let f=g(e,r.options.commands);if(f.type===`prompt`&&f.userInvocable!==!1&&Te(e),f.userInvocable===!1)return{messages:[c({content:R({inputString:`/${e}`,precedingInputBlocks:i})}),c({content:`This skill can only be invoked by Work Mate, not directly by users. Ask Work Mate to use the "${e}" skill for you.`})],shouldQuery:!1,command:f};try{switch(f.type){case`local-jsx`:return new Promise(e=>{let a=!1,o=(n,r)=>{if(a=!0,r?.display===`skip`){e({messages:[],shouldQuery:!1,command:f,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput});return}let o=(r?.metaMessages??[]).map(e=>c({content:e,isMeta:!0})),s=C()&&typeof n==`string`&&n.endsWith(` dismissed`),l=r?.displayArgs??t;e({messages:r?.display===`system`?s?o:[S(Y(f,l)),S(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[c({content:R({inputString:Y(f,l),precedingInputBlocks:i})}),c(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${Ce}</local-command-stdout>`}),...o],shouldQuery:r?.shouldQuery??!1,command:f,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput})};f.load().then(e=>e.call(o,{...r,canUseTool:s},t)).then(t=>{if(t!=null){if(r.options.isNonInteractiveSession){e({messages:[],shouldQuery:!1,command:f});return}a||n({jsx:t,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0,isImmediate:f.immediate===!0})}}).catch(t=>{K(t),!a&&(a=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:f}))})});case`local`:{let e=c({content:R({inputString:Y(f,f.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=A(),i=await(await f.load()).call(t,r);if(i.type===`skip`)return{messages:[],shouldQuery:!1,command:f};if(i.type===`compact`){let t=[n,e,...i.displayText?[c({content:`<local-command-stdout>${i.displayText}</local-command-stdout>`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],r={...i.compactionResult,messagesToKeep:[...i.compactionResult.messagesToKeep??[],...t]};return y(),{messages:le(r),shouldQuery:!1,command:f}}return{messages:[e,S(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:f,resultText:i.value}}catch(t){return K(t),{messages:[e,S(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:f}}}case`prompt`:try{return f.context===`fork`?await J(f,t,r,i,n,s??u,d):await Z(f,t,r,i,a,l)}catch(e){return e instanceof Pe?{messages:[c({content:R({inputString:Y(f,t),precedingInputBlocks:i})}),te({toolUse:!1})],shouldQuery:!1,command:f}:{messages:[c({content:R({inputString:Y(f,t),precedingInputBlocks:i})}),c({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:f}}}}catch(e){if(e instanceof U)return{messages:[c({content:R({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:f};throw e}}function Y(e,t){return P(E(e),t)}function X(e,t=`loading`){return[`<${W}>${e}</${W}>`,`<${G}>${e}</${G}>`,`<skill-format>true</skill-format>`].join(`
|
|
2
2
|
`)}function rt(e,t){return[`<${W}>${e}</${W}>`,`<${G}>/${e}</${G}>`,t?`<command-args>${t}</command-args>`:null].filter(Boolean).join(`
|
|
3
3
|
`)}function it(e,t){return e.userInvocable===!1&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)?X(e.name,e.progressMessage):rt(e.name,t)}async function at(e,t,n,r,i=[]){let a=De(e,n);if(!a)throw new U(`Unknown command: ${e}`);if(a.type!==`prompt`)throw Error(`Unexpected ${a.type} command. Expected 'prompt' command. Use /${e} directly in the main conversation.`);return Z(a,t,r,[],i)}async function Z(e,t,n,r=[],i=[],l){let u=await e.getPromptForCommand(t,n),d=!D(`hooks`)||_(e.source);if(e.hooks&&d){let t=a();Je(n.setAppState,t,e.hooks,e.name,e.type===`prompt`?e.skillRoot:void 0)}let f=e.source?`${e.source}:${e.name}`:e.name,p=u.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
4
4
|
|
package/dist/chunks/{projectOnboardingState-nTCycGCD.js → projectOnboardingState-D-_ijZnG.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{In as r,Rn as i}from"./settings-D4M13toi.js";import{n as a,t as o}from"./cwd-DrEEb4f5.js";import{f as s,u as c}from"./debug-2pVES-2G.js";import{a as l,d as u,m as d}from"./config-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{In as r,Rn as i}from"./settings-D4M13toi.js";import{n as a,t as o}from"./cwd-DrEEb4f5.js";import{f as s,u as c}from"./debug-2pVES-2G.js";import{a as l,d as u,m as d}from"./config-Bio2EjUK.js";import{join as f}from"path";function p(){let e=c().existsSync(f(o(),`AGENTS.md`)),t=i(o());return[{key:`workspace`,text:`Ask Work Mate to create a new app or clone a repository`,isComplete:!1,isCompletable:!0,isEnabled:t},{key:`agentsmd`,text:`Run /init to create a AGENTS.md file with instructions for Work Mate`,isComplete:e,isCompletable:!0,isEnabled:!t}]}function m(){return p().filter(({isCompletable:e,isEnabled:t})=>e&&t).every(({isComplete:e})=>e)}function h(){l().hasCompletedProjectOnboarding||m()&&d(e=>({...e,hasCompletedProjectOnboarding:!0}))}function g(){d(e=>({...e,projectOnboardingSeenCount:e.projectOnboardingSeenCount+1}))}var _,v=e((()=>{n(),u(),a(),r(),s(),_=t(()=>{let e=l();return e.hasCompletedProjectOnboarding||e.projectOnboardingSeenCount>=4||process.env.IS_DEMO?!1:!m()})}));export{_ as a,h as i,g as n,v as r,p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Qb as e,ix as t}from"./loadAgentsDir-bmpKLPdG.js";t();export{e as clearPromptCache};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-DaDcL9Zw.js";import{l as a,o}from"./envUtils-QyzA_cFM.js";import{n as s,t as c}from"./defineProperty-C-QyHrDq.js";import{$t as l,G as u,H as d,K as f,Ni as p,U as m,W as h,X as g,ca as _,ea as v,en as y,oa as b,ta as x}from"./settings-D4M13toi.js";import{C as S,I as C,j as w,x as T}from"./debug-2pVES-2G.js";import{H as E,q as D}from"./log-L1kqxa_P.js";import{i as O,o as k}from"./bundledMode-D9omqD3L.js";import{f as A,s as j}from"./model-
|
|
1
|
+
import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-DaDcL9Zw.js";import{l as a,o}from"./envUtils-QyzA_cFM.js";import{n as s,t as c}from"./defineProperty-C-QyHrDq.js";import{$t as l,G as u,H as d,K as f,Ni as p,U as m,W as h,X as g,ca as _,ea as v,en as y,oa as b,ta as x}from"./settings-D4M13toi.js";import{C as S,I as C,j as w,x as T}from"./debug-2pVES-2G.js";import{H as E,q as D}from"./log-L1kqxa_P.js";import{i as O,o as k}from"./bundledMode-D9omqD3L.js";import{f as A,s as j}from"./model-Dd3x121y.js";import{join as M,parse as N,resolve as P,sep as ee}from"node:path";import{createHash as F}from"node:crypto";import{appendFile as I,mkdir as te,readFile as L,readdir as ne,rm as re,writeFile as ie}from"node:fs/promises";function ae(e,t){return{tool_use_id:e,type:`tool_result`,content:t}}function oe(e){return e.filter(e=>e.data?.type!==`hook_progress`)}function se(e,t){return e.name===t||(e.aliases?.includes(t)??!1)}function ce(e,t){return e.find(e=>se(e,t))}function le(e){return{...de,userFacingName:()=>e.name,...e}}var ue,de,fe=t((()=>{ue=()=>({mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!0}),de={isEnabled:()=>!0,isConcurrencySafe:e=>!1,isReadOnly:e=>!1,isDestructive:e=>!1,checkPermissions:(e,t)=>Promise.resolve({behavior:`allow`,updatedInput:e}),toAutoClassifierInput:e=>``,userFacingName:e=>``}})),pe,me,he,ge,_e=t((()=>{pe=`Edit`,me=`/.workmate/**`,he=`~/.workmate/**`,ge=`File has been unexpectedly modified. Read it again before attempting to write it.`}));function ve(e){let t=e.trim();if(!t)return null;if(t.endsWith(`-`)){let e=parseInt(t.slice(0,-1),10);return isNaN(e)||e<1?null:{firstPage:e,lastPage:1/0}}let n=t.indexOf(`-`);if(n===-1){let e=parseInt(t,10);return isNaN(e)||e<1?null:{firstPage:e,lastPage:e}}let r=parseInt(t.slice(0,n),10),i=parseInt(t.slice(n+1),10);return isNaN(r)||isNaN(i)||r<1||i<1||i<r?null:{firstPage:r,lastPage:i}}function ye(){return!j().toLowerCase().includes(`claude-3-haiku`)}function be(e){let t=e.startsWith(`.`)?e.slice(1):e;return xe.has(t.toLowerCase())}var xe,Se=t((()=>{A(),xe=new Set([`pdf`])})),R,Ce=t((()=>{R=`Bash`}));function we(e,t,n){return`Reads a file from the local filesystem. You can access any file directly by using this tool.
|
|
2
2
|
Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.
|
|
3
3
|
|
|
4
4
|
Usage:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t}from"./prompt-BnDapYGL.js";t();export{e as isDeferredTool};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,c as t,i as n,x as r}from"./debug-2pVES-2G.js";import{d as i,o as a}from"./config-
|
|
1
|
+
import{C as e,c as t,i as n,x as r}from"./debug-2pVES-2G.js";import{d as i,o as a}from"./config-Bio2EjUK.js";import{i as o,t as s}from"./execFileNoThrow-DXSEj8ZO.js";import{c,s as l}from"./bundledMode-D9omqD3L.js";import{n as u,t as d}from"./sanitization-DV-94a9Z.js";import{i as f,n as p,r as m}from"./banner-BKOzHotb.js";import{homedir as h}from"os";import{basename as g}from"path";import{spawn as _}from"child_process";d();var v=`claude-cli`;function y(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=31||n===127)return!0}return!1}var b=/^[\w.-]+\/[\w.-]+$/,x=5e3,S=4096;function C(e){let t=e.startsWith(`claude-cli://`)?e:e.startsWith(`claude-cli:`)?e.replace(`${v}:`,`${v}://`):null;if(!t)throw Error(`Invalid deep link: expected ${v}:// scheme, got "${e}"`);let n;try{n=new URL(t)}catch{throw Error(`Invalid deep link URL: "${e}"`)}if(n.hostname!==`open`)throw Error(`Unknown deep link action: "${n.hostname}"`);let r=n.searchParams.get(`cwd`)??void 0,i=n.searchParams.get(`repo`)??void 0,a=n.searchParams.get(`q`);if(r&&!r.startsWith(`/`)&&!/^[a-zA-Z]:[/\\]/.test(r))throw Error(`Invalid cwd in deep link: must be an absolute path, got "${r}"`);if(r&&y(r))throw Error(`Deep link cwd contains disallowed control characters`);if(r&&r.length>S)throw Error(`Deep link cwd exceeds ${S} characters (got ${r.length})`);if(i&&!b.test(i))throw Error(`Invalid repo in deep link: expected "owner/repo", got "${i}"`);let o;if(a&&a.trim().length>0){if(o=u(a.trim()),y(o))throw Error(`Deep link query contains disallowed control characters`);if(o.length>x)throw Error(`Deep link query exceeds ${x} characters (got ${o.length})`)}return{query:o,cwd:r,repo:i}}r(),n(),i(),o(),l();var w=[{name:`iTerm2`,bundleId:`com.googlecode.iterm2`,app:`iTerm`},{name:`Ghostty`,bundleId:`com.mitchellh.ghostty`,app:`Ghostty`},{name:`Kitty`,bundleId:`net.kovidgoyal.kitty`,app:`kitty`},{name:`Alacritty`,bundleId:`org.alacritty`,app:`Alacritty`},{name:`WezTerm`,bundleId:`com.github.wez.wezterm`,app:`WezTerm`},{name:`Terminal.app`,bundleId:`com.apple.Terminal`,app:`Terminal`}],T=[`ghostty`,`kitty`,`alacritty`,`wezterm`,`gnome-terminal`,`konsole`,`xfce4-terminal`,`mate-terminal`,`tilix`,`xterm`];async function E(){let e=a().deepLinkTerminal;if(e){let t=w.find(t=>t.app===e);if(t)return{name:t.name,command:t.app}}let t=process.env.TERM_PROGRAM;if(t){let e=t.replace(/\.app$/i,``).toLowerCase(),n=w.find(t=>t.app.toLowerCase()===e||t.name.toLowerCase()===e);if(n)return{name:n.name,command:n.app}}for(let e of w){let{code:t,stdout:n}=await s(`mdfind`,[`kMDItemCFBundleIdentifier == "${e.bundleId}"`],{timeout:5e3,useCwd:!1});if(t===0&&n.trim().length>0)return{name:e.name,command:e.app}}for(let e of w){let{code:t}=await s(`ls`,[`/Applications/${e.app}.app`],{timeout:1e3,useCwd:!1});if(t===0)return{name:e.name,command:e.app}}return{name:`Terminal.app`,command:`Terminal`}}async function D(){let e=process.env.TERMINAL;if(e){let t=await c(e);if(t)return{name:g(e),command:t}}let t=await c(`x-terminal-emulator`);if(t)return{name:`x-terminal-emulator`,command:t};for(let e of T){let t=await c(e);if(t)return{name:e,command:t}}return null}async function O(){let e=await c(`wt.exe`);if(e)return{name:`Windows Terminal`,command:e};let t=await c(`pwsh.exe`);if(t)return{name:`PowerShell`,command:t};let n=await c(`powershell.exe`);return n?{name:`PowerShell`,command:n}:{name:`Command Prompt`,command:`cmd.exe`}}async function k(){switch(process.platform){case`darwin`:return E();case`linux`:return D();case`win32`:return O();default:return null}}async function A(e,n){let r=await k();if(!r)return t(`No terminal emulator detected`,{level:`error`}),!1;t(`Launching in terminal: ${r.name} (${r.command})`);let i=[`--deep-link-origin`];switch(n.repo&&(i.push(`--deep-link-repo`,n.repo),n.lastFetchMs!==void 0&&i.push(`--deep-link-last-fetch`,String(n.lastFetchMs))),n.query&&i.push(`--prefill`,n.query),process.platform){case`darwin`:return j(r,e,i,n.cwd);case`linux`:return M(r,e,i,n.cwd);case`win32`:return N(r,e,i,n.cwd);default:return!1}}async function j(e,n,r,i){switch(e.command){case`iTerm`:{let{code:e}=await s(`osascript`,[`-e`,`tell application "iTerm"
|
|
2
2
|
if running then
|
|
3
3
|
create window with default profile
|
|
4
4
|
else
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{In as e,Rr as t,Vn as n,_t as r,gt as i,qr as a}from"./settings-D4M13toi.js";import{Pt as o,q as s}from"./state-CXY-q5gr.js";import{do as c,io as l,oo as u,uo as d}from"./loadAgentsDir-
|
|
1
|
+
import{In as e,Rr as t,Vn as n,_t as r,gt as i,qr as a}from"./settings-D4M13toi.js";import{Pt as o,q as s}from"./state-CXY-q5gr.js";import{do as c,io as l,oo as u,uo as d}from"./loadAgentsDir-bmpKLPdG.js";import{I as f,M as p,c as m,i as h}from"./debug-2pVES-2G.js";import{o as g,s as _}from"./log-L1kqxa_P.js";import{ht as v,mt as y}from"./model-Dd3x121y.js";import{isAbsolute as b,resolve as x}from"path";y(),o(),h(),f(),e(),a(),g(),d(),i();function S(e,t,n){let r=[],i=[],a=[];for(let[o,s]of Object.entries(e)){let e=t[o],c=w(s.source,n?.projectRoot);e?s.sourceIsFallback||v(c,e.source)?a.push(o):i.push({name:o,declaredSource:c,materializedSource:e.source}):r.push(o)}return{missing:r,sourceChanged:i,upToDate:a}}async function C(e){let t=u();if(Object.keys(t).length===0)return{installed:[],updated:[],failed:[],upToDate:[],skipped:[]};let i;try{i=await c()}catch(e){_(e),i={}}let a=S(t,i,{projectRoot:s()}),o=[...a.missing.map(e=>({name:e,source:w(t[e].source),action:`install`})),...a.sourceChanged.map(({name:e,declaredSource:t})=>({name:e,source:t,action:`update`}))],d=[],f=[];for(let t of o){if(e?.skip?.(t.name,t.source)){d.push(t.name);continue}if(t.action===`update`&&r(t.source)&&!await n(t.source.path)){m(`[reconcile] '${t.name}' declared path does not exist; keeping materialized entry`),d.push(t.name);continue}f.push(t)}if(f.length===0)return{installed:[],updated:[],failed:[],upToDate:a.upToDate,skipped:d};m(`[reconcile] ${f.length} marketplace(s): ${f.map(e=>`${e.name}(${e.action})`).join(`, `)}`);let h=[],g=[],v=[];for(let t=0;t<f.length;t++){let{name:n,source:r,action:i}=f[t];e?.onProgress?.({type:`installing`,name:n,action:i,index:t+1,total:f.length});try{let t=await l(r);i===`install`?h.push(n):g.push(n),e?.onProgress?.({type:`installed`,name:n,alreadyMaterialized:t.alreadyMaterialized})}catch(t){let r=p(t);v.push({name:n,error:r}),e?.onProgress?.({type:`failed`,name:n,error:r}),_(t)}}return{installed:h,updated:g,failed:v,upToDate:a.upToDate,skipped:d}}function w(e,n){if((e.source===`directory`||e.source===`file`)&&!b(e.path)){let r=n??s(),i=t(r);return{...e,path:x(i??r,e.path)}}return e}export{C as n,S as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Pt as t,q as n}from"./state-CXY-q5gr.js";import{Fa as r,Fm as i,Go as a,Hm as o,Km as s,Ko as c,Lm as l,Mo as u,No as d,Pa as f,Wm as p,_f as m,c_ as h,i as g,o as _,qm as v,s_ as y,vf as b}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Pt as t,q as n}from"./state-CXY-q5gr.js";import{Fa as r,Fm as i,Go as a,Hm as o,Km as s,Ko as c,Lm as l,Mo as u,No as d,Pa as f,Wm as p,_f as m,c_ as h,i as g,o as _,qm as v,s_ as y,vf as b}from"./loadAgentsDir-bmpKLPdG.js";import{I as x,M as S,c as C,i as w}from"./debug-2pVES-2G.js";import{o as T,s as E}from"./log-L1kqxa_P.js";async function D(e){C(`refreshActivePlugins: clearing all plugin caches`),u(),i();let t=await r(),[o,s]=await Promise.all([a(),g(n())]),{enabled:c,disabled:l,errors:d}=t,[f,m]=await Promise.all([Promise.all(c.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await b(e,d);return t&&(e.mcpServers=t),t?Object.keys(t).length:0})),Promise.all(c.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await v(e,d);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))]),_=f.reduce((e,t)=>e+t,0),y=m.reduce((e,t)=>e+t,0);e(e=>({...e,plugins:{...e.plugins,enabled:c,disabled:l,commands:o,errors:O(e.plugins.errors,d),needsRefresh:!1},agentDefinitions:s,mcp:{...e.mcp,pluginReconnectKey:e.mcp.pluginReconnectKey+1}})),p();let x=!1;try{await h()}catch(e){x=!0,E(e),C(`refreshActivePlugins: loadPluginHooks failed: ${S(e)}`)}let w=c.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return C(`refreshActivePlugins: ${c.length} enabled, ${o.length} commands, ${s.allAgents.length} agents, ${w} hooks, ${_} MCP, ${y} LSP`),{enabled_count:c.length,disabled_count:l.length,command_count:o.length,agent_count:s.allAgents.length,hook_count:w,mcp_count:_,lsp_count:y,error_count:d.length+ +!!x,agentDefinitions:s,pluginCommands:o}}function O(e,t){let n=e.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r=new Set(t.map(k));return[...n.filter(e=>!r.has(k(e))),...t]}function k(e){return e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`}var A=e((()=>{t(),o(),_(),w(),x(),T(),d(),c(),y(),s(),m(),l(),f()}));export{D as n,A as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,o as n}from"./isObject-C6qM3WEW.js";import{Di as r,Oi as i,ar as a,ir as o,nr as s,or as ee,rr as c,sr as l}from"./settings-D4M13toi.js";import{$r as u,Kr as te,Qr as d,_r as f,ai as p,ar as m,cr as ne,dr as h,fr as g,gr as re,ii as ie,ir as ae,lr as _,ni as v,pr as y,qr as b,ri as x,ur as S}from"./state-CXY-q5gr.js";import{Cw as C,Sw as w,_C as T,vC as E}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,o as n}from"./isObject-C6qM3WEW.js";import{Di as r,Oi as i,ar as a,ir as o,nr as s,or as ee,rr as c,sr as l}from"./settings-D4M13toi.js";import{$r as u,Kr as te,Qr as d,_r as f,ai as p,ar as m,cr as ne,dr as h,fr as g,gr as re,ii as ie,ir as ae,lr as _,ni as v,pr as y,qr as b,ri as x,ur as S}from"./state-CXY-q5gr.js";import{Cw as C,Sw as w,_C as T,vC as E}from"./loadAgentsDir-bmpKLPdG.js";import{D,O}from"./config-Bio2EjUK.js";import{n as k,t as A}from"./_baseSlice-D67_NpZ1.js";import{n as j,t as M}from"./_baseEach-BYhqv77g.js";function N(e){return x(e)||b(e)||!!(P&&e&&e[P])}var P,F=e((()=>{n(),te(),v(),P=t?t.isConcatSpreadable:void 0}));function I(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=N),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?I(s,t-1,n,r,i):ie(i,s):r||(i[i.length]=s)}return i}var L=e((()=>{p(),F()}));function R(e){return e!=null&&e.length?I(e,1):[]}var z=e((()=>{L()}));function B(e){return c(a(e,void 0,R),e+``)}var V=e((()=>{z(),o(),s()}));function H(e,t){var n=[];return M(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}var U=e((()=>{j()}));function W(e,t){return t.length<2?e:ne(e,A(t,0,-1))}var G=e((()=>{_(),k()}));function K(e){if(typeof e!=`function`)throw TypeError(q);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var q,J=e((()=>{q=`Expected a function`}));function oe(e,t){t=g(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=h(t[n]);if(i===`__proto__`&&!Y.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var a=W(e,t);return a==null||delete a[h(E(t))]}var Y,se=e((()=>{y(),T(),G(),S(),Y=Object.prototype.hasOwnProperty}));function ce(e){return l(e)?void 0:e}var le=e((()=>{ee()})),X,Z,Q,$,ue=e((()=>{f(),C(),se(),y(),i(),le(),V(),O(),X=1,Z=2,Q=4,$=B(function(e,t){var n={};if(e==null)return n;var i=!1;t=re(t,function(t){return t=g(t,e),i||(i=t.length>1),t}),r(e,D(e),n),i&&(n=w(n,X|Z|Q,ce));for(var a=t.length;a--;)oe(n,t[a]);return n})}));function de(e,t){return(x(e)?d:H)(e,K(ae(t,3)))}var fe=e((()=>{u(),U(),m(),v(),J()}));export{$ as i,de as n,ue as r,fe as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./stringUtils-Cs6E5f-B.js";import{n as r,t as i}from"./refresh-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./stringUtils-Cs6E5f-B.js";import{n as r,t as i}from"./refresh-Cm4jZzLa.js";function a(e,n){return`${e} ${t(e,n)}`}var o;e((()=>{i(),n(),o=async(e,t)=>{let n=await r(t.setAppState),i=`Reloaded: ${[a(n.enabled_count,`plugin`),a(n.command_count,`skill`),a(n.agent_count,`agent`),a(n.hook_count,`hook`),a(n.mcp_count,`plugin MCP server`),a(n.lsp_count,`plugin LSP server`)].join(` · `)}`;return n.error_count>0&&(i+=`\n${a(n.error_count,`error`)} during load. Run /doctor for details.`),{type:`text`,value:i}}}))();export{o as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Pt as t,at as n}from"./state-CXY-q5gr.js";import{Ji as r,Rx as i,Zr as a,ei as o,fr as s,gr as c}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Pt as t,at as n}from"./state-CXY-q5gr.js";import{Ji as r,Rx as i,Zr as a,ei as o,fr as s,gr as c}from"./loadAgentsDir-bmpKLPdG.js";import{n as l,t as u}from"./generateSessionName-CeN9EZNY.js";async function d(e,t,r){let c;if(!r||r.trim()===``){let n=await u(i(t.messages),t.abortController.signal);if(!n)return e(`Could not generate a name: no conversation context yet. Usage: /rename <name>`,{display:`system`}),null;c=n}else c=r.trim();let l=n(),d=s();return await o(l,c,d),await a(l,c,d),t.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:c}})),e(`Session renamed to: ${c}`,{display:`system`}),null}e((()=>{t(),r(),c(),l()}))();export{d as call};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{I as i,P as a,ai as o,di as s,dr as c,fi as l,ot as u,t as d}from"./src-BX54x08P.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as p,at as m,q as h}from"./state-CXY-q5gr.js";import{Ar as g,Ep as _,Or as v,Tp as y,Tr as b,Uy as x,Wy as S,bi as C,br as w,gr as T,lr as E,nr as D,oi as O,sb as k,vr as A,yi as j}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{I as i,P as a,ai as o,di as s,dr as c,fi as l,ot as u,t as d}from"./src-BX54x08P.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as p,at as m,q as h}from"./state-CXY-q5gr.js";import{Ar as g,Ep as _,Or as v,Tp as y,Tr as b,Uy as x,Wy as S,bi as C,br as w,gr as T,lr as E,nr as D,oi as O,sb as k,vr as A,yi as j}from"./loadAgentsDir-bmpKLPdG.js";import{o as M,s as N}from"./log-L1kqxa_P.js";import{r as P,t as F}from"./Spinner-C0qHjfIY.js";import{n as I,r as L}from"./modalContext-sU2lfR08.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./crossProjectResume-CCo3iZrB.js";function W(e){switch(e.resultType){case`sessionNotFound`:return`Session ${s.bold(e.arg)} was not found. Run ${s.bold(`/resume`)} without arguments to browse all sessions.`;case`multipleMatches`:return`Found ${e.count} sessions matching ${s.bold(e.arg)}. Run ${s.bold(`/resume`)} to pick one from the list.`}}function G({message:e,args:t,onDone:n}){return J.useEffect(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,Y.jsxs)(i,{flexDirection:`column`,children:[(0,Y.jsxs)(a,{dimColor:!0,children:[r.pointer,` /resume `,t]}),(0,Y.jsx)(x,{children:(0,Y.jsx)(a,{children:e})})]})}function K({onDone:e,onResume:t}){let[n,r]=J.useState([]),[o,s]=J.useState([]),[l,d]=J.useState(!0),[f,p]=J.useState(!1),[y,x]=J.useState(!1),{rows:S}=u(),C=L(),T=J.useCallback(async(t,n)=>{d(!0);try{let i=q(t?await b():await g(n),m());if(i.length===0){e(`No conversations found to resume`);return}r(i)}catch{e(`Failed to load conversations`)}finally{d(!1)}},[e]);J.useEffect(()=>{async function e(){let e=await j(h());s(e),T(!1,e)}e()},[T]);let D=J.useCallback(()=>{let e=!y;x(e),T(e,o)},[y,T,o]);async function O(n){let r=_(E(n));if(!r){e(`Failed to resume conversation`);return}let i=w(n)?await v(n):n,a=U(i,y);if(a.isCrossProject){if(a.isSameRepoWorktree){p(!0),t(r,i,`slash_command_picker`);return}let n=await c(a.command);n&&process.stdout.write(n),e([``,`This conversation is from a different directory.`,``,`To resume, run:`,` ${a.command}`,``,`(Command copied to clipboard)`,``].join(`
|
|
2
2
|
`),{display:`user`});return}p(!0),t(r,i,`slash_command_picker`)}function k(){e(`Resume cancelled`,{display:`system`})}return l?(0,Y.jsxs)(i,{children:[(0,Y.jsx)(F,{}),(0,Y.jsx)(a,{children:` Loading conversations…`})]}):f?(0,Y.jsxs)(i,{children:[(0,Y.jsx)(F,{}),(0,Y.jsx)(a,{children:` Resuming conversation…`})]}):(0,Y.jsx)(R,{logs:n,maxHeight:C?Math.floor(S/2):S-2,onCancel:k,onSelect:O,onLogsChanged:()=>T(y,o),showAllProjects:y,onToggleAllProjects:D,onAgenticSearch:H})}function q(e,t){return e.filter(e=>!e.isSidechain&&E(e)!==t)}var J,Y,X;e((()=>{l(),n(),J=t(o(),1),p(),V(),S(),P(),I(),k(),d(),z(),B(),C(),M(),T(),y(),Y=f(),X=async(e,t,n)=>{let r=async(n,r,i)=>{try{await t.resume?.(n,r,i),e(void 0,{display:`skip`})}catch(t){N(t),e(`Failed to resume: ${t.message}`)}},i=n?.trim();if(!i)return(0,Y.jsx)(K,{onDone:e,onResume:r},Date.now());let a=await g(await j(h()));if(a.length===0){let t=`No conversations found to resume.`;return(0,Y.jsx)(G,{message:t,args:i,onDone:()=>e(t)})}let o=_(i);if(o){let e=a.filter(e=>E(e)===o).sort((e,t)=>t.modified.getTime()-e.modified.getTime());if(e.length>0){let t=e[0];return r(o,w(t)?await v(t):t,`slash_command_session_id`),null}let t=await D(o);if(t)return r(o,t,`slash_command_session_id`),null}if(A()){let t=await O(i,{exact:!0});if(t.length===1){let e=t[0],n=E(e);if(n)return r(n,w(e)?await v(e):e,`slash_command_title`),null}if(t.length>1){let n=W({resultType:`multipleMatches`,arg:i,count:t.length});return(0,Y.jsx)(G,{message:n,args:i,onDone:()=>e(n)})}}let s=W({resultType:`sessionNotFound`,arg:i});return(0,Y.jsx)(G,{message:s,args:i,onDone:()=>e(s)})}}))();export{X as call,q as filterResumableSessions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./runtimeObserver-
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./runtimeObserver-DT5P2_XL.js";t();export{o as RUNTIME_SESSION_ID,n as getRuntimeTurn,i as initSkillLearning,e as resetRuntimeLLMBookkeeping,r as resetRuntimeObserverForTest,a as runSkillLearningPostSampling};
|