@hostclubeos/miraos 0.0.4-beta → 0.0.6-beta

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.
Files changed (113) hide show
  1. package/bundled/bug-hunter/SKILL.md +7 -0
  2. package/chunks/{acpAgent-F4OT4AQQ.js → acpAgent-OGBFWA5R.js} +2 -2
  3. package/chunks/{chunk-BX3KM7OK.js → chunk-2PB6TEZU.js} +1 -1
  4. package/chunks/{chunk-7LXU4NUI.js → chunk-34YXJ3CX.js} +1 -1
  5. package/chunks/{chunk-WDLXS4A3.js → chunk-3GA3NTAV.js} +3 -3
  6. package/chunks/{chunk-4TJKJ2LG.js → chunk-5JKJSIIP.js} +1 -1
  7. package/chunks/{chunk-FUIRLSNA.js → chunk-7JT2V4AW.js} +1 -1
  8. package/chunks/{chunk-C24YTZET.js → chunk-BB2C4HKQ.js} +1 -1
  9. package/chunks/{chunk-AXBNQS6C.js → chunk-F2XELUO3.js} +1 -1
  10. package/chunks/{chunk-BZMSTSKY.js → chunk-GPI53DWB.js} +1 -1
  11. package/chunks/{chunk-AYU4PDSQ.js → chunk-HHSHBOT7.js} +2 -2
  12. package/chunks/{chunk-TIWH3MUJ.js → chunk-HMID4D72.js} +1 -1
  13. package/chunks/{chunk-JM46SKXF.js → chunk-IC2WDA6V.js} +1 -1
  14. package/chunks/{chunk-HPGUQCRQ.js → chunk-JRPR5IME.js} +1 -1
  15. package/chunks/{chunk-ECNTMKHI.js → chunk-ORVQPZMQ.js} +1 -1
  16. package/chunks/{chunk-5SJFYZQJ.js → chunk-RGVXNWZA.js} +1 -1
  17. package/chunks/{chunk-LISKSG7B.js → chunk-SHLTP6ZB.js} +1 -1
  18. package/chunks/{chunk-D3QZNIFB.js → chunk-SOCXRMZM.js} +4 -4
  19. package/chunks/{chunk-PUPIORBU.js → chunk-TI7J4HX2.js} +1 -1
  20. package/chunks/{chunk-CKBEAZAV.js → chunk-VGPV5AVJ.js} +1 -1
  21. package/chunks/{chunk-33G7MOU6.js → chunk-Y3BCVTFB.js} +1 -1
  22. package/chunks/{chunk-4XV2522J.js → chunk-YVORE4W4.js} +1 -1
  23. package/chunks/{daemon-status-provider-NBPLE4JN.js → daemon-status-provider-FCQ4YYAY.js} +1 -1
  24. package/chunks/{fast-path-66F2TWKE.js → fast-path-ZBD7IYQM.js} +1 -1
  25. package/chunks/{llm-LZ3HARC2.js → llm-DQNQEAFW.js} +3 -3
  26. package/chunks/{local-6KBSW7N2.js → local-ZRC4XZCJ.js} +1 -1
  27. package/chunks/{managed-local-serve-2N3IAB3D.js → managed-local-serve-B2KOLPB5.js} +1 -1
  28. package/chunks/{managed-runtime-bootstrap-M4P43K7W.js → managed-runtime-bootstrap-MREL5UC2.js} +1 -1
  29. package/chunks/{managed-runtime-ssh-worker-WWZ7SJ7U.js → managed-runtime-ssh-worker-GUKAZFAJ.js} +1 -1
  30. package/chunks/{memory-D62BXIJW.js → memory-ZYPCFYPF.js} +1 -1
  31. package/chunks/{nonInteractiveCli-Z4A7THMG.js → nonInteractiveCli-JG6PKBAD.js} +1 -1
  32. package/chunks/{review-LM7KW6Y5.js → review-N3VFZQMI.js} +1 -1
  33. package/chunks/{run-qwen-serve-77UZS4JA.js → run-qwen-serve-4MZRQFXK.js} +1 -1
  34. package/chunks/{serve-RHO7RZ45.js → serve-EQN6QAXF.js} +1 -1
  35. package/chunks/{server-5HEOZG3T.js → server-CCEHAI25.js} +1 -1
  36. package/chunks/{session-RT7VH6GE.js → session-HNUJSV5A.js} +1 -1
  37. package/chunks/{start-opentui-ui-I2XXWTJS.js → start-opentui-ui-6MCAEWAW.js} +1 -1
  38. package/chunks/{startInteractiveUI-774LJIJD.js → startInteractiveUI-657JWOTK.js} +1 -1
  39. package/chunks/{validateNonInterActiveAuth-633WYCVH.js → validateNonInterActiveAuth-CP5WFNAE.js} +1 -1
  40. package/chunks/{version-77KBVA2F.js → version-SIM74L5K.js} +1 -1
  41. package/cli.js +1 -1
  42. package/export-transcript-document.js +1 -1
  43. package/package.json +3 -3
  44. package/web-shell/assets/{PierreFilePreview-DEhWK46v.js → PierreFilePreview-Dkt6iPte.js} +1 -1
  45. package/web-shell/assets/SpreadsheetPreview-I4yiL7q3.js +1 -0
  46. package/web-shell/assets/{WorkspaceFileBrowser-64vDYikf.js → WorkspaceFileBrowser-Du9bMpNo.js} +1 -1
  47. package/web-shell/assets/{abnfDiagram-VCTEODGH-C2WWURam.js → abnfDiagram-VCTEODGH-CGY1lCxS.js} +1 -1
  48. package/web-shell/assets/{agents-route-j5ba59xn.js → agents-route-kcQ3YUNc.js} +1 -1
  49. package/web-shell/assets/{arc-Bkr_-GVn.js → arc-BUMNyJDV.js} +1 -1
  50. package/web-shell/assets/{architectureDiagram-5GKGNRK7-D_v_wDDW.js → architectureDiagram-5GKGNRK7-CEfXhEKD.js} +1 -1
  51. package/web-shell/assets/{blockDiagram-NRAW4CY4-Csxc3YNo.js → blockDiagram-NRAW4CY4-BH8hjvlX.js} +1 -1
  52. package/web-shell/assets/{c4Diagram-UCG6FXSJ-PXryoJCB.js → c4Diagram-UCG6FXSJ-Dfl946ex.js} +1 -1
  53. package/web-shell/assets/channel-CoZByzPk.js +1 -0
  54. package/web-shell/assets/{chunk-2Q5K7J3B-DwK5UBHI.js → chunk-2Q5K7J3B-CBvGm-pD.js} +1 -1
  55. package/web-shell/assets/{chunk-5VM5RSS4-BC1hvD6_.js → chunk-5VM5RSS4-k06tGOfl.js} +1 -1
  56. package/web-shell/assets/{chunk-F27PBJKO-iFe0IxfJ.js → chunk-F27PBJKO-Dv4S4vSq.js} +1 -1
  57. package/web-shell/assets/{chunk-G27WJ6UU-ROSuKRxI.js → chunk-G27WJ6UU-7LY0yu3f.js} +1 -1
  58. package/web-shell/assets/{chunk-JWPE2WC7-CYHS6PxA.js → chunk-JWPE2WC7-B-CgVEuJ.js} +1 -1
  59. package/web-shell/assets/{chunk-LCL6LL3I-D5bFMqCy.js → chunk-LCL6LL3I-D0TrWx1f.js} +1 -1
  60. package/web-shell/assets/{chunk-POPQ4Y6H-BJh77MGv.js → chunk-POPQ4Y6H-B97ZANlR.js} +1 -1
  61. package/web-shell/assets/{chunk-SVP7TREG-Cs81aYft.js → chunk-SVP7TREG-2CO_3G76.js} +1 -1
  62. package/web-shell/assets/{chunk-XXDRQBXY-DqDbN44E.js → chunk-XXDRQBXY-CFbSHjzz.js} +1 -1
  63. package/web-shell/assets/classDiagram-DTDB5LWJ-BgKRvG5r.js +1 -0
  64. package/web-shell/assets/classDiagram-v2-JRS7N3AN-BgKRvG5r.js +1 -0
  65. package/web-shell/assets/{cose-bilkent-JH36ORCC-DhjrwADJ.js → cose-bilkent-JH36ORCC-K-uc8eFw.js} +1 -1
  66. package/web-shell/assets/{cynefin-OW5HDTMX-Dh7t-_3M.js → cynefin-OW5HDTMX-Cb0lt2G3.js} +1 -1
  67. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-5J4kto0C.js → cynefinDiagram-5FMLGOSQ-DWkqpFuH.js} +1 -1
  68. package/web-shell/assets/{dagre-3AP2YEHR-28AdbIcl.js → dagre-3AP2YEHR-Cs8gu3Q4.js} +1 -1
  69. package/web-shell/assets/{diagram-S7CK7UJ4-DmksuoIf.js → diagram-S7CK7UJ4-DlMLXUgK.js} +1 -1
  70. package/web-shell/assets/{diagram-UQ7AKVKN-DUjgQ8Fg.js → diagram-UQ7AKVKN-68PPYL92.js} +1 -1
  71. package/web-shell/assets/{diagram-VSXAHHWV-DUe_FpG-.js → diagram-VSXAHHWV-CxIdRSbx.js} +1 -1
  72. package/web-shell/assets/{diagram-VX7I27RA-CJJ70teK.js → diagram-VX7I27RA-G3C0kWVW.js} +1 -1
  73. package/web-shell/assets/{diagram-Z3DM3KII-BgABlJO4.js → diagram-Z3DM3KII-CwEuAgyS.js} +1 -1
  74. package/web-shell/assets/{docx-preview-BMBWboRx.js → docx-preview-3XzkP9iR.js} +1 -1
  75. package/web-shell/assets/{ebnfDiagram-PWID7BFC-B3nK_Lh7.js → ebnfDiagram-PWID7BFC-DLeMX1Ka.js} +1 -1
  76. package/web-shell/assets/{erDiagram-SSCWMZ5O-DCTdCWlu.js → erDiagram-SSCWMZ5O-CoQLSOGk.js} +1 -1
  77. package/web-shell/assets/{flowDiagram-A5DVABFB-CPxk2UUl.js → flowDiagram-A5DVABFB-BXUV-Qml.js} +1 -1
  78. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-WZzMAKht.js → ganttDiagram-EL5Y4UJY-sWi6Lowi.js} +1 -1
  79. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-DKcO5ugU.js → gitGraphDiagram-WWUBYQGX-Dsh4-kB4.js} +1 -1
  80. package/web-shell/assets/{index-CkRLMu1y.js → index-CrSq-SfJ.js} +6 -6
  81. package/web-shell/assets/{index-Dbm3-Fps.js → index-DjwWlZt0.js} +1 -1
  82. package/web-shell/assets/{infoDiagram-RXCK75RN-CJX5DzdL.js → infoDiagram-RXCK75RN-JZ6nFIgB.js} +1 -1
  83. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-fF0Id5B6.js → ishikawaDiagram-5VMMS53U-qJj-sQFs.js} +1 -1
  84. package/web-shell/assets/{journeyDiagram-EYS64GPL-BOAezBVe.js → journeyDiagram-EYS64GPL-Ck0jv8SO.js} +1 -1
  85. package/web-shell/assets/{kanban-definition-3QL26DDD-DdNBof9J.js → kanban-definition-3QL26DDD-Ck6_Ydmt.js} +1 -1
  86. package/web-shell/assets/{layout-CXX3l5w0.js → layout-yLaSulE8.js} +1 -1
  87. package/web-shell/assets/{linear-Dnaccp-S.js → linear-CXw5rE6U.js} +1 -1
  88. package/web-shell/assets/{mermaid.core-BzdC3B6T.js → mermaid.core-6WQsyLcq.js} +6 -6
  89. package/web-shell/assets/{mindmap-definition-FBJOCRG2-D-gMUzLw.js → mindmap-definition-FBJOCRG2-BDAmAz8h.js} +1 -1
  90. package/web-shell/assets/{pegDiagram-XKGWAZYB-B9n1WVZq.js → pegDiagram-XKGWAZYB-Rvn5mpol.js} +1 -1
  91. package/web-shell/assets/{pieDiagram-E7YTZNPT-ok49U0zT.js → pieDiagram-E7YTZNPT-DHw4avFL.js} +1 -1
  92. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-DJKha-v3.js → quadrantDiagram-AXDQQJYC-vch6jDK-.js} +1 -1
  93. package/web-shell/assets/{railroadDiagram-O6MQD6OU-DjL4pl7y.js → railroadDiagram-O6MQD6OU-DfVCzYpO.js} +1 -1
  94. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-BpmmRw3A.js → requirementDiagram-EFPCY7ZU-BQAnwpSv.js} +1 -1
  95. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-KpteHB8X.js → sankeyDiagram-P5KCCOFB-fJuxdbbi.js} +1 -1
  96. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-COMghCpA.js → sequenceDiagram-WJ2MYXX4-B3TtvHJp.js} +1 -1
  97. package/web-shell/assets/{sizeCapture-X5ZJPWSS-5fEwJD-n.js → sizeCapture-X5ZJPWSS-DlJmbcZd.js} +1 -1
  98. package/web-shell/assets/{stateDiagram-HBIQ2CUA-CnC7oXvs.js → stateDiagram-HBIQ2CUA--0kiPvGS.js} +1 -1
  99. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-Dw-ppcvp.js +1 -0
  100. package/web-shell/assets/{swimlanes-XN3QIQJK-bVlhZdve.js → swimlanes-XN3QIQJK-CAytfKbo.js} +1 -1
  101. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-B36XZQuh.js +8 -0
  102. package/web-shell/assets/{timeline-definition-24CTP7MA-CBvYgMu5.js → timeline-definition-24CTP7MA-C-BUmwu6.js} +1 -1
  103. package/web-shell/assets/{vennDiagram-4TSXK5OY-CUTYvV1j.js → vennDiagram-4TSXK5OY-W_dgEGv2.js} +1 -1
  104. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-Djl4gxCB.js → wardleyDiagram-VM6X3IG4-ikAv1QJ9.js} +1 -1
  105. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-BcJZtI2X.js → xychartDiagram-S5SC5T6Z-BmY9Ily6.js} +1 -1
  106. package/web-shell/index.html +1 -1
  107. package/web-shell/sw.js +1 -1
  108. package/web-shell/assets/SpreadsheetPreview-C-GgIuPX.js +0 -1
  109. package/web-shell/assets/channel-6Pj4KPAs.js +0 -1
  110. package/web-shell/assets/classDiagram-DTDB5LWJ-BaTUuuB8.js +0 -1
  111. package/web-shell/assets/classDiagram-v2-JRS7N3AN-BaTUuuB8.js +0 -1
  112. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-V_cfZFBL.js +0 -1
  113. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-25wVg0WL.js +0 -8
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{appEvents}from"./chunk-WDLXS4A3.js";import{assembleMcpServers,getPendingGatedMcpServers,getPromptableMcpServers}from"./chunk-SHKSVOTG.js";import{getMCPServerStatus}from"./chunk-MJEL7DIE.js";import{require_fast_deep_equal}from"./chunk-7LLG2W7I.js";import{createDebugLogger}from"./chunk-46KPDLFH.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var import_fast_deep_equal=__toESM(require_fast_deep_equal(),1);var debugLogger=createDebugLogger("MCP_HOT_RELOAD");var modelProvidersDebugLogger=createDebugLogger("MODEL_PROVIDERS_HOT_RELOAD");function mcpServersEqual(a,b){return(0,import_fast_deep_equal.default)(a??{},b??{})}__name(mcpServersEqual,"mcpServersEqual");function mcpGatingEqual(a,b){const norm=__name(xs=>[...xs??[]].sort(),"norm");const allowedEqual=a.allowed===void 0===(b.allowed===void 0)&&(0,import_fast_deep_equal.default)(norm(a.allowed),norm(b.allowed));return(0,import_fast_deep_equal.default)(norm(a.excluded),norm(b.excluded))&&allowedEqual&&(0,import_fast_deep_equal.default)(norm(a.pending),norm(b.pending))}__name(mcpGatingEqual,"mcpGatingEqual");function recomputeMcpGating(settings,assembled,cwd,bootAllowed,isYolo){const settingsAllowed=settings.merged.mcp?.allowed?.filter(Boolean);const excluded=settings.merged.mcp?.excluded?.filter(Boolean);let allowed=settingsAllowed;if(bootAllowed){allowed=settingsAllowed?settingsAllowed.filter(n=>bootAllowed.includes(n)):[...bootAllowed]}return{allowed,excluded:excluded&&excluded.length>0?excluded:void 0,pending:isYolo?void 0:getPendingGatedMcpServers(assembled,cwd)}}__name(recomputeMcpGating,"recomputeMcpGating");function registerMcpHotReload(watcher,settings,config,topTierMcpServers){debugLogger.debug("registered MCP hot-reload listener on SettingsWatcher");return watcher.addChangeListener(async events=>{debugLogger.debug(`settings change fired (${events.length} event(s)): ${events.map(e=>`${e.scope}:${e.changeType}`).join(", ")}`);const cwd=config.getTargetDir();const next=config.getBareMode()||config.isSafeMode()?{...topTierMcpServers}:assembleMcpServers(settings.merged.mcpServers,cwd,topTierMcpServers);const isYolo=config.getApprovalMode()==="yolo";const bootAllowed=config.getCliAllowedMcpServerNames();const nextGating=config.getBareMode()||config.isSafeMode()?{allowed:bootAllowed?[...bootAllowed]:void 0}:recomputeMcpGating(settings,next,cwd,bootAllowed,isYolo);const prevServers=config.getSettingsMcpServers();const prevGating=config.getMcpGating();debugLogger.debug(`assembled servers: prev=[${Object.keys(prevServers??{}).join(", ")}] next=[${Object.keys(next).join(", ")}]`);debugLogger.debug(`gating next: excluded=[${(nextGating.excluded??[]).join(", ")}] allowed=[${(nextGating.allowed??[]).join(", ")}] pending=[${(nextGating.pending??[]).join(", ")}]`);const serversChanged=!mcpServersEqual(prevServers,next);const gatingChanged=!mcpGatingEqual(prevGating,nextGating);if(!serversChanged&&!gatingChanged){debugLogger.debug("no MCP-relevant change (servers + gating unchanged) \u2014 skipping reconcile");return}debugLogger.debug(`MCP-relevant change detected (serversChanged=${serversChanged} gatingChanged=${gatingChanged}) \u2014 reconciling`);const promptable=getPromptableMcpServers(next,cwd);config.setExcludedMcpServers(nextGating.excluded??[]);config.setAllowedMcpServers(nextGating.allowed);config.setPendingMcpServers(nextGating.pending);try{await config.reinitializeMcpServers(next);const finalStatuses=Object.keys(next).map(name=>`${name}=${getMCPServerStatus(name)}`).join(", ");debugLogger.debug(`reinitializeMcpServers resolved; final statuses=[${finalStatuses}]`)}catch(err){debugLogger.error(`reinitializeMcpServers threw: ${err instanceof Error?err.stack??err.message:String(err)}`);appEvents.emit("log-error","Failed to reload MCP server settings; existing MCP state may be unchanged. Run with --debug for details.")}if(!isYolo&&promptable.length>0){debugLogger.debug(`gated servers awaiting approval \u2192 emitting ${"mcp-pending-approval-changed"}: [${promptable.join(", ")}]`);appEvents.emit("mcp-pending-approval-changed")}})}__name(registerMcpHotReload,"registerMcpHotReload");function registerModelProvidersHotReload(watcher,settings,config){modelProvidersDebugLogger.debug("registered modelProviders hot-reload listener on SettingsWatcher");let refreshAuthRetryPending=false;const reconcile=__name(async()=>{const next=settings.merged.modelProviders;const providersUnchanged=(0,import_fast_deep_equal.default)(config.getModelProvidersConfig()??{},next??{});if(providersUnchanged&&!refreshAuthRetryPending){return}if(!providersUnchanged){modelProvidersDebugLogger.debug("modelProviders changed \u2014 reloading model registry");try{config.reloadModelProvidersConfig(next)}catch(err){modelProvidersDebugLogger.error(`reloadModelProvidersConfig threw: ${err instanceof Error?err.stack??err.message:String(err)}`);return}}const authType=config.getAuthType();if(!authType){return}try{await config.refreshAuth(authType,true);refreshAuthRetryPending=false}catch(err){const alreadyPending=refreshAuthRetryPending;refreshAuthRetryPending=true;modelProvidersDebugLogger.error(`refreshAuth after modelProviders reload threw: ${err instanceof Error?err.stack??err.message:String(err)}`);if(!alreadyPending){appEvents.emit("log-error",`Model provider settings reloaded, but re-authenticating the active model failed: ${err instanceof Error?err.message:String(err)}. Select a model with /model or restart to apply the change.`)}}},"reconcile");void reconcile();return watcher.addChangeListener(reconcile)}__name(registerModelProvidersHotReload,"registerModelProvidersHotReload");export{recomputeMcpGating,registerMcpHotReload,registerModelProvidersHotReload};
3
+ import{appEvents}from"./chunk-3GA3NTAV.js";import{assembleMcpServers,getPendingGatedMcpServers,getPromptableMcpServers}from"./chunk-SHKSVOTG.js";import{getMCPServerStatus}from"./chunk-MJEL7DIE.js";import{require_fast_deep_equal}from"./chunk-7LLG2W7I.js";import{createDebugLogger}from"./chunk-46KPDLFH.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var import_fast_deep_equal=__toESM(require_fast_deep_equal(),1);var debugLogger=createDebugLogger("MCP_HOT_RELOAD");var modelProvidersDebugLogger=createDebugLogger("MODEL_PROVIDERS_HOT_RELOAD");function mcpServersEqual(a,b){return(0,import_fast_deep_equal.default)(a??{},b??{})}__name(mcpServersEqual,"mcpServersEqual");function mcpGatingEqual(a,b){const norm=__name(xs=>[...xs??[]].sort(),"norm");const allowedEqual=a.allowed===void 0===(b.allowed===void 0)&&(0,import_fast_deep_equal.default)(norm(a.allowed),norm(b.allowed));return(0,import_fast_deep_equal.default)(norm(a.excluded),norm(b.excluded))&&allowedEqual&&(0,import_fast_deep_equal.default)(norm(a.pending),norm(b.pending))}__name(mcpGatingEqual,"mcpGatingEqual");function recomputeMcpGating(settings,assembled,cwd,bootAllowed,isYolo){const settingsAllowed=settings.merged.mcp?.allowed?.filter(Boolean);const excluded=settings.merged.mcp?.excluded?.filter(Boolean);let allowed=settingsAllowed;if(bootAllowed){allowed=settingsAllowed?settingsAllowed.filter(n=>bootAllowed.includes(n)):[...bootAllowed]}return{allowed,excluded:excluded&&excluded.length>0?excluded:void 0,pending:isYolo?void 0:getPendingGatedMcpServers(assembled,cwd)}}__name(recomputeMcpGating,"recomputeMcpGating");function registerMcpHotReload(watcher,settings,config,topTierMcpServers){debugLogger.debug("registered MCP hot-reload listener on SettingsWatcher");return watcher.addChangeListener(async events=>{debugLogger.debug(`settings change fired (${events.length} event(s)): ${events.map(e=>`${e.scope}:${e.changeType}`).join(", ")}`);const cwd=config.getTargetDir();const next=config.getBareMode()||config.isSafeMode()?{...topTierMcpServers}:assembleMcpServers(settings.merged.mcpServers,cwd,topTierMcpServers);const isYolo=config.getApprovalMode()==="yolo";const bootAllowed=config.getCliAllowedMcpServerNames();const nextGating=config.getBareMode()||config.isSafeMode()?{allowed:bootAllowed?[...bootAllowed]:void 0}:recomputeMcpGating(settings,next,cwd,bootAllowed,isYolo);const prevServers=config.getSettingsMcpServers();const prevGating=config.getMcpGating();debugLogger.debug(`assembled servers: prev=[${Object.keys(prevServers??{}).join(", ")}] next=[${Object.keys(next).join(", ")}]`);debugLogger.debug(`gating next: excluded=[${(nextGating.excluded??[]).join(", ")}] allowed=[${(nextGating.allowed??[]).join(", ")}] pending=[${(nextGating.pending??[]).join(", ")}]`);const serversChanged=!mcpServersEqual(prevServers,next);const gatingChanged=!mcpGatingEqual(prevGating,nextGating);if(!serversChanged&&!gatingChanged){debugLogger.debug("no MCP-relevant change (servers + gating unchanged) \u2014 skipping reconcile");return}debugLogger.debug(`MCP-relevant change detected (serversChanged=${serversChanged} gatingChanged=${gatingChanged}) \u2014 reconciling`);const promptable=getPromptableMcpServers(next,cwd);config.setExcludedMcpServers(nextGating.excluded??[]);config.setAllowedMcpServers(nextGating.allowed);config.setPendingMcpServers(nextGating.pending);try{await config.reinitializeMcpServers(next);const finalStatuses=Object.keys(next).map(name=>`${name}=${getMCPServerStatus(name)}`).join(", ");debugLogger.debug(`reinitializeMcpServers resolved; final statuses=[${finalStatuses}]`)}catch(err){debugLogger.error(`reinitializeMcpServers threw: ${err instanceof Error?err.stack??err.message:String(err)}`);appEvents.emit("log-error","Failed to reload MCP server settings; existing MCP state may be unchanged. Run with --debug for details.")}if(!isYolo&&promptable.length>0){debugLogger.debug(`gated servers awaiting approval \u2192 emitting ${"mcp-pending-approval-changed"}: [${promptable.join(", ")}]`);appEvents.emit("mcp-pending-approval-changed")}})}__name(registerMcpHotReload,"registerMcpHotReload");function registerModelProvidersHotReload(watcher,settings,config){modelProvidersDebugLogger.debug("registered modelProviders hot-reload listener on SettingsWatcher");let refreshAuthRetryPending=false;const reconcile=__name(async()=>{const next=settings.merged.modelProviders;const providersUnchanged=(0,import_fast_deep_equal.default)(config.getModelProvidersConfig()??{},next??{});if(providersUnchanged&&!refreshAuthRetryPending){return}if(!providersUnchanged){modelProvidersDebugLogger.debug("modelProviders changed \u2014 reloading model registry");try{config.reloadModelProvidersConfig(next)}catch(err){modelProvidersDebugLogger.error(`reloadModelProvidersConfig threw: ${err instanceof Error?err.stack??err.message:String(err)}`);return}}const authType=config.getAuthType();if(!authType){return}try{await config.refreshAuth(authType,true);refreshAuthRetryPending=false}catch(err){const alreadyPending=refreshAuthRetryPending;refreshAuthRetryPending=true;modelProvidersDebugLogger.error(`refreshAuth after modelProviders reload threw: ${err instanceof Error?err.stack??err.message:String(err)}`);if(!alreadyPending){appEvents.emit("log-error",`Model provider settings reloaded, but re-authenticating the active model failed: ${err instanceof Error?err.message:String(err)}. Select a model with /model or restart to apply the change.`)}}},"reconcile");void reconcile();return watcher.addChangeListener(reconcile)}__name(registerModelProvidersHotReload,"registerModelProvidersHotReload");export{recomputeMcpGating,registerMcpHotReload,registerModelProvidersHotReload};
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2025 Qwen
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{getPackageJson}from"./chunk-6KMPLONS.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();async function getCliVersion(){const pkgJson=await getPackageJson();return"0.0.4-beta"}__name(getCliVersion,"getCliVersion");function formatVersionLabel(version){return/^\d/.test(version)?`v${version}`:version}__name(formatVersionLabel,"formatVersionLabel");export{getCliVersion,formatVersionLabel};
3
+ import{getPackageJson}from"./chunk-6KMPLONS.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();async function getCliVersion(){const pkgJson=await getPackageJson();return"0.0.6-beta"}__name(getCliVersion,"getCliVersion");function formatVersionLabel(version){return/^\d/.test(version)?`v${version}`:version}__name(formatVersionLabel,"formatVersionLabel");export{getCliVersion,formatVersionLabel};
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2025 Google LLC
@@ -1,3 +1,3 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{createDaemonStatusProvider}from"./chunk-5SJFYZQJ.js";import"./chunk-BZMSTSKY.js";import"./chunk-JM46SKXF.js";import"./chunk-YBIENZ5E.js";import"./chunk-EXVVGGII.js";import"./chunk-L42NTHIT.js";import"./chunk-JDHMSERR.js";import"./chunk-OFWAMIMB.js";import"./chunk-IFPLGH5C.js";import"./chunk-QDSIJTQB.js";import"./chunk-3Y4UVTLL.js";import"./chunk-2QYDBHYZ.js";import"./chunk-YCAEGUZI.js";import"./chunk-BVUZGX6E.js";import"./chunk-CVMEBFLL.js";import"./chunk-L5UULTGF.js";import"./chunk-3KZHPZVZ.js";import"./chunk-CFTFKWPW.js";import"./chunk-NIEO2TBE.js";import"./chunk-7JDZEB77.js";import"./chunk-3MBYQYPC.js";import"./chunk-QS2ZMQIS.js";import"./chunk-S7IKHQ6I.js";import"./chunk-4XV2522J.js";import"./chunk-6KMPLONS.js";import"./chunk-TV5T4EZP.js";import"./chunk-MD3ZEOBX.js";import"./chunk-YLTVHXPO.js";import"./chunk-QPYXXB22.js";import"./chunk-DVN6DAWO.js";import"./chunk-46VUDNCL.js";import"./chunk-UNDRWCST.js";import"./chunk-KK6SQPYG.js";import"./chunk-TWJ4XBED.js";import"./chunk-4WYKHP7Q.js";import"./chunk-UNJYVYTC.js";import"./chunk-MUNBJIEX.js";import"./chunk-54CHQYA3.js";import"./chunk-4WMR7RZB.js";import"./chunk-HSN5QUS7.js";import"./chunk-KMAE5NUB.js";import"./chunk-ZOWMHZWO.js";import"./chunk-XWYUQMLN.js";import"./chunk-RKDS7A4H.js";import"./chunk-W6IOHGWW.js";import"./chunk-SXO35MFJ.js";import"./chunk-UGDAT4C4.js";import"./chunk-DECUAM3U.js";import"./chunk-MSAAQ2I7.js";import"./chunk-YU67VCCO.js";import"./chunk-PFKTTUGS.js";import"./chunk-R2EHHA2C.js";import"./chunk-MSIXO7NT.js";import"./chunk-ZIXAINJY.js";import"./chunk-HMCTSPVJ.js";import"./chunk-PHIPLV2I.js";import"./chunk-HW7ZRPZU.js";import"./chunk-A6G5TAIF.js";import"./chunk-I7KO7V6B.js";import"./chunk-FIXDX63I.js";import"./chunk-T7CHK6C2.js";import"./chunk-KZSUHQLD.js";import"./chunk-BTHQHTOB.js";import"./chunk-QVPT37XZ.js";import"./chunk-B5ZFH363.js";import"./chunk-DXUYBMFK.js";import"./chunk-BWTFZBMG.js";import"./chunk-HA7ADBWO.js";import"./chunk-I44IFX3I.js";import"./chunk-PSKT6KWO.js";import"./chunk-UJSVTVKB.js";import"./chunk-UHJUDWBV.js";import"./chunk-BG67XABA.js";import"./chunk-DNYXZVBT.js";import"./chunk-VMRQ6FA2.js";import"./chunk-OMBCQ6CU.js";import"./chunk-JB3XRNK7.js";import"./chunk-NVXFGZ4Z.js";import"./chunk-CV2UAEZA.js";import"./chunk-6RGS6DOB.js";import"./chunk-7Z2ZH5CW.js";import"./chunk-PNF77EBK.js";import"./chunk-YSZPZI2U.js";import"./chunk-QTJPOTU5.js";import"./chunk-G5PYYZMM.js";import"./chunk-TASTRW4D.js";import"./chunk-D7XCQWP2.js";import"./chunk-AE5OMKRY.js";import"./chunk-IUVB7EIZ.js";import"./chunk-2BASBY3Z.js";import"./chunk-KYK53GFP.js";import"./chunk-T5XGTSQU.js";import"./chunk-JIQVUYBI.js";import"./chunk-THN4FBQ7.js";import"./chunk-JZK2WGXA.js";import"./chunk-MPHSE7M4.js";import"./chunk-S2ZKZXHX.js";import"./chunk-NNRKBCOC.js";import"./chunk-QL74SOQ5.js";import"./chunk-AV674UXZ.js";import"./chunk-KVSDMMDD.js";import"./chunk-744VRMDB.js";import"./chunk-EW3EVEYN.js";import"./chunk-IC42HQCH.js";import"./chunk-7UK4WJWS.js";import"./chunk-YIW3H46P.js";import"./chunk-6EDEOERB.js";import"./chunk-OV2J3OED.js";import"./chunk-AIGBQN6R.js";import"./chunk-4GNHXVJZ.js";import"./chunk-4ZRCV3JY.js";import"./chunk-NCBA52SB.js";import"./chunk-QTCO5I4C.js";import"./chunk-YGLM5XPP.js";import"./chunk-WGNF7FPC.js";import"./chunk-4NPYOXJO.js";import"./chunk-MWGB5RCF.js";import"./chunk-NTRFETZB.js";import"./chunk-C6KSOOGV.js";import"./chunk-2W7KMUTJ.js";import"./chunk-33P4RB6G.js";import"./chunk-RQHIWFQL.js";import"./chunk-BSFNCIBS.js";import"./chunk-DLFX4M6C.js";import"./chunk-VFB6Q74I.js";import"./chunk-NSZJIBK7.js";import"./chunk-PWRX5WNL.js";import"./chunk-3MG44MZK.js";import"./chunk-476F6QIM.js";import"./chunk-W2ZVZ6LS.js";import"./chunk-KP77CL5U.js";import"./chunk-AGEDDL7Z.js";import"./chunk-MJEL7DIE.js";import"./chunk-KNXXVHVG.js";import"./chunk-JEV36CS7.js";import"./chunk-W5NWIGKO.js";import"./chunk-CQGP2BAW.js";import"./chunk-PWOQASXT.js";import"./chunk-FCQWRGW5.js";import"./chunk-6JHMYZNS.js";import"./chunk-Z6AR5XE5.js";import"./chunk-JWTMTDHE.js";import"./chunk-6QJWBGMS.js";import"./chunk-5PWKCDV6.js";import"./chunk-2GF3E5MI.js";import"./chunk-GJPZ5CKS.js";import"./chunk-UEWEDD5Y.js";import"./chunk-AJ75BPTA.js";import"./chunk-IDHSLPPU.js";import"./chunk-AIAYQAPA.js";import"./chunk-EV2CXPMN.js";import"./chunk-E5XJBLSO.js";import"./chunk-4ZBZL23U.js";import"./chunk-2NJJHZ52.js";import"./chunk-X64RXJQQ.js";import"./chunk-Q6UAOTP3.js";import"./chunk-BODSGVSR.js";import"./chunk-XMANRGPK.js";import"./chunk-JJAEIBSV.js";import"./chunk-KQX4H2D3.js";import"./chunk-BIOVWBME.js";import"./chunk-SW54YEPK.js";import"./chunk-7DOOXUDG.js";import"./chunk-RP57XAJ2.js";import"./chunk-HETUGUHE.js";import"./chunk-4DIWAQ5G.js";import"./chunk-EW6HVTD5.js";import"./chunk-DBRQGEEI.js";import"./chunk-DMM5LJWL.js";import"./chunk-ZQMVXHGH.js";import"./chunk-4WFJ5OPA.js";import"./chunk-Y2OCBVI6.js";import"./chunk-TL3SF2GA.js";import"./chunk-LPUWZZK2.js";import"./chunk-LWVCLDHV.js";import"./chunk-JOJLS3IB.js";import"./chunk-D6CEQ2GY.js";import"./chunk-TM6ZCBR7.js";import"./chunk-I6S7NGX3.js";import"./chunk-SBZFGYYS.js";import"./chunk-H7OS7XH3.js";import"./chunk-7LLG2W7I.js";import"./chunk-46KPDLFH.js";import"./chunk-I4H7NUVP.js";import"./chunk-5VB4YX3Z.js";import"./chunk-2ZK2FGZQ.js";import"./chunk-E7MYPQGV.js";import"./chunk-2UOMCYQG.js";import"./chunk-I7L2TX4M.js";import"./chunk-MK3OONRA.js";import"./chunk-COGTQ5KZ.js";import"./chunk-VKDAXTCZ.js";import"./chunk-KBWJGX7I.js";export{createDaemonStatusProvider};
3
+ import{createDaemonStatusProvider}from"./chunk-RGVXNWZA.js";import"./chunk-GPI53DWB.js";import"./chunk-IC2WDA6V.js";import"./chunk-YBIENZ5E.js";import"./chunk-EXVVGGII.js";import"./chunk-L42NTHIT.js";import"./chunk-JDHMSERR.js";import"./chunk-OFWAMIMB.js";import"./chunk-IFPLGH5C.js";import"./chunk-QDSIJTQB.js";import"./chunk-3Y4UVTLL.js";import"./chunk-2QYDBHYZ.js";import"./chunk-YCAEGUZI.js";import"./chunk-BVUZGX6E.js";import"./chunk-CVMEBFLL.js";import"./chunk-L5UULTGF.js";import"./chunk-3KZHPZVZ.js";import"./chunk-CFTFKWPW.js";import"./chunk-NIEO2TBE.js";import"./chunk-7JDZEB77.js";import"./chunk-3MBYQYPC.js";import"./chunk-QS2ZMQIS.js";import"./chunk-S7IKHQ6I.js";import"./chunk-YVORE4W4.js";import"./chunk-6KMPLONS.js";import"./chunk-TV5T4EZP.js";import"./chunk-MD3ZEOBX.js";import"./chunk-YLTVHXPO.js";import"./chunk-QPYXXB22.js";import"./chunk-DVN6DAWO.js";import"./chunk-46VUDNCL.js";import"./chunk-UNDRWCST.js";import"./chunk-KK6SQPYG.js";import"./chunk-TWJ4XBED.js";import"./chunk-4WYKHP7Q.js";import"./chunk-UNJYVYTC.js";import"./chunk-MUNBJIEX.js";import"./chunk-54CHQYA3.js";import"./chunk-4WMR7RZB.js";import"./chunk-HSN5QUS7.js";import"./chunk-KMAE5NUB.js";import"./chunk-ZOWMHZWO.js";import"./chunk-XWYUQMLN.js";import"./chunk-RKDS7A4H.js";import"./chunk-W6IOHGWW.js";import"./chunk-SXO35MFJ.js";import"./chunk-UGDAT4C4.js";import"./chunk-DECUAM3U.js";import"./chunk-MSAAQ2I7.js";import"./chunk-YU67VCCO.js";import"./chunk-PFKTTUGS.js";import"./chunk-R2EHHA2C.js";import"./chunk-MSIXO7NT.js";import"./chunk-ZIXAINJY.js";import"./chunk-HMCTSPVJ.js";import"./chunk-PHIPLV2I.js";import"./chunk-HW7ZRPZU.js";import"./chunk-A6G5TAIF.js";import"./chunk-I7KO7V6B.js";import"./chunk-FIXDX63I.js";import"./chunk-T7CHK6C2.js";import"./chunk-KZSUHQLD.js";import"./chunk-BTHQHTOB.js";import"./chunk-QVPT37XZ.js";import"./chunk-B5ZFH363.js";import"./chunk-DXUYBMFK.js";import"./chunk-BWTFZBMG.js";import"./chunk-HA7ADBWO.js";import"./chunk-I44IFX3I.js";import"./chunk-PSKT6KWO.js";import"./chunk-UJSVTVKB.js";import"./chunk-UHJUDWBV.js";import"./chunk-BG67XABA.js";import"./chunk-DNYXZVBT.js";import"./chunk-VMRQ6FA2.js";import"./chunk-OMBCQ6CU.js";import"./chunk-JB3XRNK7.js";import"./chunk-NVXFGZ4Z.js";import"./chunk-CV2UAEZA.js";import"./chunk-6RGS6DOB.js";import"./chunk-7Z2ZH5CW.js";import"./chunk-PNF77EBK.js";import"./chunk-YSZPZI2U.js";import"./chunk-QTJPOTU5.js";import"./chunk-G5PYYZMM.js";import"./chunk-TASTRW4D.js";import"./chunk-D7XCQWP2.js";import"./chunk-AE5OMKRY.js";import"./chunk-IUVB7EIZ.js";import"./chunk-2BASBY3Z.js";import"./chunk-KYK53GFP.js";import"./chunk-T5XGTSQU.js";import"./chunk-JIQVUYBI.js";import"./chunk-THN4FBQ7.js";import"./chunk-JZK2WGXA.js";import"./chunk-MPHSE7M4.js";import"./chunk-S2ZKZXHX.js";import"./chunk-NNRKBCOC.js";import"./chunk-QL74SOQ5.js";import"./chunk-AV674UXZ.js";import"./chunk-KVSDMMDD.js";import"./chunk-744VRMDB.js";import"./chunk-EW3EVEYN.js";import"./chunk-IC42HQCH.js";import"./chunk-7UK4WJWS.js";import"./chunk-YIW3H46P.js";import"./chunk-6EDEOERB.js";import"./chunk-OV2J3OED.js";import"./chunk-AIGBQN6R.js";import"./chunk-4GNHXVJZ.js";import"./chunk-4ZRCV3JY.js";import"./chunk-NCBA52SB.js";import"./chunk-QTCO5I4C.js";import"./chunk-YGLM5XPP.js";import"./chunk-WGNF7FPC.js";import"./chunk-4NPYOXJO.js";import"./chunk-MWGB5RCF.js";import"./chunk-NTRFETZB.js";import"./chunk-C6KSOOGV.js";import"./chunk-2W7KMUTJ.js";import"./chunk-33P4RB6G.js";import"./chunk-RQHIWFQL.js";import"./chunk-BSFNCIBS.js";import"./chunk-DLFX4M6C.js";import"./chunk-VFB6Q74I.js";import"./chunk-NSZJIBK7.js";import"./chunk-PWRX5WNL.js";import"./chunk-3MG44MZK.js";import"./chunk-476F6QIM.js";import"./chunk-W2ZVZ6LS.js";import"./chunk-KP77CL5U.js";import"./chunk-AGEDDL7Z.js";import"./chunk-MJEL7DIE.js";import"./chunk-KNXXVHVG.js";import"./chunk-JEV36CS7.js";import"./chunk-W5NWIGKO.js";import"./chunk-CQGP2BAW.js";import"./chunk-PWOQASXT.js";import"./chunk-FCQWRGW5.js";import"./chunk-6JHMYZNS.js";import"./chunk-Z6AR5XE5.js";import"./chunk-JWTMTDHE.js";import"./chunk-6QJWBGMS.js";import"./chunk-5PWKCDV6.js";import"./chunk-2GF3E5MI.js";import"./chunk-GJPZ5CKS.js";import"./chunk-UEWEDD5Y.js";import"./chunk-AJ75BPTA.js";import"./chunk-IDHSLPPU.js";import"./chunk-AIAYQAPA.js";import"./chunk-EV2CXPMN.js";import"./chunk-E5XJBLSO.js";import"./chunk-4ZBZL23U.js";import"./chunk-2NJJHZ52.js";import"./chunk-X64RXJQQ.js";import"./chunk-Q6UAOTP3.js";import"./chunk-BODSGVSR.js";import"./chunk-XMANRGPK.js";import"./chunk-JJAEIBSV.js";import"./chunk-KQX4H2D3.js";import"./chunk-BIOVWBME.js";import"./chunk-SW54YEPK.js";import"./chunk-7DOOXUDG.js";import"./chunk-RP57XAJ2.js";import"./chunk-HETUGUHE.js";import"./chunk-4DIWAQ5G.js";import"./chunk-EW6HVTD5.js";import"./chunk-DBRQGEEI.js";import"./chunk-DMM5LJWL.js";import"./chunk-ZQMVXHGH.js";import"./chunk-4WFJ5OPA.js";import"./chunk-Y2OCBVI6.js";import"./chunk-TL3SF2GA.js";import"./chunk-LPUWZZK2.js";import"./chunk-LWVCLDHV.js";import"./chunk-JOJLS3IB.js";import"./chunk-D6CEQ2GY.js";import"./chunk-TM6ZCBR7.js";import"./chunk-I6S7NGX3.js";import"./chunk-SBZFGYYS.js";import"./chunk-H7OS7XH3.js";import"./chunk-7LLG2W7I.js";import"./chunk-46KPDLFH.js";import"./chunk-I4H7NUVP.js";import"./chunk-5VB4YX3Z.js";import"./chunk-2ZK2FGZQ.js";import"./chunk-E7MYPQGV.js";import"./chunk-2UOMCYQG.js";import"./chunk-I7L2TX4M.js";import"./chunk-MK3OONRA.js";import"./chunk-COGTQ5KZ.js";import"./chunk-VKDAXTCZ.js";import"./chunk-KBWJGX7I.js";export{createDaemonStatusProvider};
@@ -1,7 +1,7 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
3
  import{RUNTIME_STARTUP_CANCELLED_MESSAGE}from"./chunk-UKMS3RLB.js";import{getHeadlessYoloSafetyWarning}from"./chunk-Z57KDB5F.js";import{MAX_COMPACTED_REPLAY_MAX_BYTES,normalizeMaxRingBytes}from"./chunk-OFWAMIMB.js";import{isValidMemoryBudgetMb,memoryBudgetRangeError}from"./chunk-2QYDBHYZ.js";import{InvalidExecutionSandboxConfigError,assertExecutionSandboxSupported}from"./chunk-EKRCICRK.js";import"./chunk-ERGT5BD3.js";import{normalizeServeFastPathArgv}from"./chunk-X7QN6R6K.js";import"./chunk-E7MYPQGV.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var HELP_AND_VERSION_FLAGS=new Set(["--help","-h","--version","-v"]);var MCP_BUDGET_WARN_FRACTION=.75;var NUMBER_OPTIONS=new Map([["port","port"],["maxSessions","max-sessions"],["maxTotalSessions","max-total-sessions"],["maxPendingPromptsPerSession","max-pending-prompts-per-session"],["maxConnections","max-connections"],["eventRingSize","event-ring-size"],["eventRingMaxBytes","event-ring-max-bytes"],["compactedReplayMaxBytes","compacted-replay-max-bytes"],["maxJournalEvents","max-journal-events"],["maxJournalBytes","max-journal-bytes"],["mcp-client-budget","mcp-client-budget"],["memoryBudgetMb","memory-budget-mb"],["promptDeadlineMs","prompt-deadline-ms"],["writerIdleTimeoutMs","writer-idle-timeout-ms"],["channelIdleTimeoutMs","channel-idle-timeout-ms"],["initializeTimeoutMs","initialize-timeout-ms"],["sessionRestoreTimeoutMs","session-restore-timeout-ms"],["sessionReapIntervalMs","session-reap-interval-ms"],["sessionIdleTimeoutMs","session-idle-timeout-ms"],["sessionPromptSettledCloseGraceMs","session-prompt-settled-close-grace-ms"],["permissionResponseTimeoutMs","permission-response-timeout-ms"],["rateLimitPrompt","rate-limit-prompt"],["rateLimitMutation","rate-limit-mutation"],["rateLimitRead","rate-limit-read"],["rateLimitWindowMs","rate-limit-window-ms"]]);var NUMBER_OPTION_BY_FLAG=invertOptionMap(NUMBER_OPTIONS);var STRING_OPTION_BY_FLAG=new Map([["hostname","hostname"],["token","token"],["workspace","workspace"],["conversations-dir","conversationsDir"],["memory-project-scope","memoryProjectScope"],["tls-cert","tlsCert"],["tls-key","tlsKey"]]);var BOOLEAN_OPTION_BY_FLAG=new Map([["require-auth","requireAuth"],["enable-session-shell","enableSessionShell"],["web","serveWebShell"],["open","open"],["open-with-auth","open-with-auth"],["token-qr","tokenQr"],["http-bridge","http-bridge"],["allow-private-auth-base-url","allowPrivateAuthBaseUrl"],["experimental-lsp","experimentalLsp"],["restore-ask-user-question","restoreAskUserQuestion"],["rate-limit","rateLimit"]]);function invertOptionMap(source){const out=new Map;for(const[target,flag]of source){out.set(flag,target)}return out}__name(invertOptionMap,"invertOptionMap");function readOptionValue(argv,index,inlineValue){if(inlineValue!==void 0){return{value:inlineValue,nextIndex:index}}const value=argv[index+1];if(value===void 0||value.startsWith("-")){return null}return{value,nextIndex:index+1}}__name(readOptionValue,"readOptionValue");function parseNumber(value){if(value.trim()==="")return null;const parsed=Number(value);return Number.isNaN(parsed)?null:parsed}__name(parseNumber,"parseNumber");function parseBooleanValue(value){if(value==="true")return true;if(value==="false")return false;return null}__name(parseBooleanValue,"parseBooleanValue");function parsePositiveIntegerEnv(raw){if(raw===void 0||raw==="")return void 0;const trimmed=raw?.trim();if(!trimmed||!/^\d+$/.test(trimmed))return Number.NaN;const parsed=Number(trimmed);return Number.isSafeInteger(parsed)&&parsed>0?parsed:Number.NaN}__name(parsePositiveIntegerEnv,"parsePositiveIntegerEnv");function isTruthyEnv(value){return value==="1"||value==="true"}__name(isTruthyEnv,"isTruthyEnv");function writeStderrLine(line){process.stderr.write(line.endsWith("\n")?line:`${line}
4
- `)}__name(writeStderrLine,"writeStderrLine");function setServeOption(options,key,value){options[key]=value}__name(setServeOption,"setServeOption");function getRateLimitValidationError(options){for(const[name,value]of[["--rate-limit-prompt",options.rateLimitPrompt],["--rate-limit-mutation",options.rateLimitMutation],["--rate-limit-read",options.rateLimitRead]]){if(value!==void 0&&(!Number.isFinite(value)||!Number.isInteger(value)||value<=0)){return`qwen serve: ${name} must be a positive integer.`}}if(options.rateLimitWindowMs!==void 0&&(!Number.isFinite(options.rateLimitWindowMs)||!Number.isInteger(options.rateLimitWindowMs)||options.rateLimitWindowMs<1e3)){return"qwen serve: --rate-limit-window-ms must be an integer >= 1000."}return null}__name(getRateLimitValidationError,"getRateLimitValidationError");function getServeFastPathValidationError(parsed){const mcpClientBudget=parsed.options.mcpClientBudget;if(mcpClientBudget!==void 0&&(!Number.isFinite(mcpClientBudget)||!Number.isInteger(mcpClientBudget)||mcpClientBudget<=0)){return"qwen serve: --mcp-client-budget must be a positive integer."}if(parsed.options.mcpBudgetMode==="enforce"&&mcpClientBudget===void 0){return"qwen serve: --mcp-budget-mode=enforce requires --mcp-client-budget=N."}const maxPendingPromptsPerSession=parsed.options.maxPendingPromptsPerSession;if(maxPendingPromptsPerSession!==void 0&&maxPendingPromptsPerSession!==Number.POSITIVE_INFINITY&&(!Number.isFinite(maxPendingPromptsPerSession)||!Number.isInteger(maxPendingPromptsPerSession)||maxPendingPromptsPerSession<0)){return"qwen serve: --max-pending-prompts-per-session must be a non-negative integer (0 / Infinity = unlimited)."}try{normalizeMaxRingBytes(parsed.options.eventRingMaxBytes)}catch(error){return`qwen serve: ${error instanceof Error?error.message:String(error)}`}const compactedReplayMaxBytes=parsed.options.compactedReplayMaxBytes;if(compactedReplayMaxBytes!==void 0&&(!Number.isSafeInteger(compactedReplayMaxBytes)||compactedReplayMaxBytes<1||compactedReplayMaxBytes>MAX_COMPACTED_REPLAY_MAX_BYTES)){return`qwen serve: --compacted-replay-max-bytes must be a positive safe integer in [1, ${MAX_COMPACTED_REPLAY_MAX_BYTES}].`}const maxJournalEvents=parsed.options.maxJournalEvents;if(maxJournalEvents!==void 0&&(!Number.isSafeInteger(maxJournalEvents)||maxJournalEvents<1)){return"qwen serve: --max-journal-events must be a positive safe integer."}const maxJournalBytes=parsed.options.maxJournalBytes;if(maxJournalBytes!==void 0&&(!Number.isSafeInteger(maxJournalBytes)||maxJournalBytes<1)){return"qwen serve: --max-journal-bytes must be a positive safe integer."}const memoryBudgetMb=parsed.options.memoryBudgetMb;if(memoryBudgetMb!==void 0&&!isValidMemoryBudgetMb(memoryBudgetMb)){return memoryBudgetRangeError()}return null}__name(getServeFastPathValidationError,"getServeFastPathValidationError");function blockForever(){return new Promise(()=>{})}__name(blockForever,"blockForever");async function waitForServeRuntimeOrExit(handle){try{await handle.runtimeReady}catch(err){if(err instanceof Error&&err.message===RUNTIME_STARTUP_CANCELLED_MESSAGE){return}writeStderrLine(`qwen serve: runtime startup failed after listener was ready: ${err instanceof Error?err.message:String(err)}`);await handle.close().catch(()=>void 0);process.exit(1)}}__name(waitForServeRuntimeOrExit,"waitForServeRuntimeOrExit");function applyRateLimitEnvDefaults(options,env){if(options.rateLimit===void 0&&isTruthyEnv(env["QWEN_SERVE_RATE_LIMIT"])){options.rateLimit=true}if(options.rateLimit){options.rateLimitPrompt??=parsePositiveIntegerEnv(env["QWEN_SERVE_RATE_LIMIT_PROMPT"]);options.rateLimitMutation??=parsePositiveIntegerEnv(env["QWEN_SERVE_RATE_LIMIT_MUTATION"]);options.rateLimitRead??=parsePositiveIntegerEnv(env["QWEN_SERVE_RATE_LIMIT_READ"]);options.rateLimitWindowMs??=parsePositiveIntegerEnv(env["QWEN_SERVE_RATE_LIMIT_WINDOW_MS"])}}__name(applyRateLimitEnvDefaults,"applyRateLimitEnvDefaults");function discardRateLimitTuningWhenDisabled(options){if(options.rateLimit===true)return;delete options.rateLimitPrompt;delete options.rateLimitMutation;delete options.rateLimitRead;delete options.rateLimitWindowMs}__name(discardRateLimitTuningWhenDisabled,"discardRateLimitTuningWhenDisabled");async function bootstrapServeFastPathEnvironment(workspace){const{loadServeFastPathEnvironment,loadServeFastPathSettings,preResolveServeFastPathHomeEnvOverrides}=await import("./fast-path-settings-QGSXJF45.js");preResolveServeFastPathHomeEnvOverrides();const workspaceDir=workspace??process.cwd();const settings=loadServeFastPathSettings(workspaceDir);loadServeFastPathEnvironment(settings,workspaceDir);return settings}__name(bootstrapServeFastPathEnvironment,"bootstrapServeFastPathEnvironment");function parseServeFastPathArgs(rawArgv,env=process.env){const argv=normalizeServeFastPathArgv(rawArgv);if(argv[0]!=="serve")return{kind:"fallback"};if(argv.some(arg=>HELP_AND_VERSION_FLAGS.has(arg))){return{kind:"fallback"}}const options={hostname:"127.0.0.1",mode:"http-bridge",port:4170};let open=false;let openWithAuth=false;let httpBridge=true;let mcpBudgetModeRaw;let mcpClientBudget;let explicitRateLimit;for(let i=1;i<argv.length;i++){const arg=argv[i];if(arg==="--")return{kind:"fallback"};if(!arg.startsWith("--"))return{kind:"fallback"};const withoutPrefix=arg.slice(2);const equalsIndex=withoutPrefix.indexOf("=");const rawFlag=equalsIndex===-1?withoutPrefix:withoutPrefix.slice(0,equalsIndex);const inlineValue=equalsIndex===-1?void 0:withoutPrefix.slice(equalsIndex+1);const negated=rawFlag.startsWith("no-");const flag=negated?rawFlag.slice(3):rawFlag;const booleanTarget=BOOLEAN_OPTION_BY_FLAG.get(flag);if(booleanTarget){let value=!negated;if(inlineValue!==void 0){const parsed=parseBooleanValue(inlineValue);if(parsed===null||negated)return{kind:"fallback"};value=parsed}if(booleanTarget==="open"){open=value}else if(booleanTarget==="open-with-auth"){openWithAuth=value}else if(booleanTarget==="http-bridge"){httpBridge=value}else{setServeOption(options,booleanTarget,value);if(booleanTarget==="rateLimit"){explicitRateLimit=value}}continue}if(negated)return{kind:"fallback"};const numberTarget=NUMBER_OPTION_BY_FLAG.get(flag);if(numberTarget){const read=readOptionValue(argv,i,inlineValue);if(!read)return{kind:"fallback"};i=read.nextIndex;const value=parseNumber(read.value);if(value===null)return{kind:"fallback"};if(numberTarget==="mcp-client-budget"){mcpClientBudget=value}else{setServeOption(options,numberTarget,value)}continue}const stringTarget=STRING_OPTION_BY_FLAG.get(flag);if(stringTarget){const read=readOptionValue(argv,i,inlineValue);if(!read)return{kind:"fallback"};i=read.nextIndex;if((stringTarget==="workspace"||stringTarget==="conversationsDir")&&(options[stringTarget]!==void 0||read.value==="")){return{kind:"fallback"}}setServeOption(options,stringTarget,read.value);continue}if(flag==="memory-pressure-mode"){const read=readOptionValue(argv,i,inlineValue);if(!read)return{kind:"fallback"};i=read.nextIndex;if(read.value!=="off"&&read.value!=="observe"){return{kind:"fallback"}}options.memoryPressureMode=read.value;continue}if(flag==="child-heap-mode"){const read=readOptionValue(argv,i,inlineValue);if(!read)return{kind:"fallback"};i=read.nextIndex;if(read.value!=="off"&&read.value!=="observe"&&read.value!=="admit"&&read.value!=="enforce"){return{kind:"fallback"}}options.childHeapMode=read.value;continue}if(flag==="mcp-budget-mode"){const read=readOptionValue(argv,i,inlineValue);if(!read)return{kind:"fallback"};i=read.nextIndex;mcpBudgetModeRaw=read.value;continue}if(flag==="allow-origin"){const read=readOptionValue(argv,i,inlineValue);if(!read)return{kind:"fallback"};i=read.nextIndex;options.allowOrigins=[...options.allowOrigins??[],read.value];continue}return{kind:"fallback"}}if(mcpBudgetModeRaw!==void 0&&mcpBudgetModeRaw!=="enforce"&&mcpBudgetModeRaw!=="warn"&&mcpBudgetModeRaw!=="off"){return{kind:"fallback"}}if(options.memoryProjectScope!==void 0&&options.memoryProjectScope!=="git-root"&&options.memoryProjectScope!=="workspace"){return{kind:"fallback"}}const mcpBudgetMode=mcpBudgetModeRaw??(mcpClientBudget!==void 0?"warn":"off");if(mcpClientBudget!==void 0)options.mcpClientBudget=mcpClientBudget;options.mcpBudgetMode=mcpBudgetMode;if(explicitRateLimit!==void 0){options.rateLimit=explicitRateLimit}applyRateLimitEnvDefaults(options,env);return{kind:"serve",open:open||openWithAuth,openWithAuth,httpBridge,options}}__name(parseServeFastPathArgs,"parseServeFastPathArgs");async function maybeOpenWebShellBrowser(handle,open,openWithAuth){if(!open)return;try{await handle.runtimeReady}catch{return}const{maybeOpenWebShellBrowser:openBrowser}=await import("./serve-RHO7RZ45.js");await openBrowser(handle,true,openWithAuth)}__name(maybeOpenWebShellBrowser,"maybeOpenWebShellBrowser");function emitHeadlessYoloWarning(settings){if(!settings)return;const warning=getHeadlessYoloSafetyWarning({getApprovalMode:__name(()=>settings.tools?.approvalMode,"getApprovalMode"),getSandbox:__name(()=>settings.tools?.sandbox,"getSandbox"),getShellExecutionSandbox:__name(()=>settings.tools?.executionSandbox,"getShellExecutionSandbox")});if(warning){writeStderrLine(warning)}}__name(emitHeadlessYoloWarning,"emitHeadlessYoloWarning");function writeServeWarnings(parsed){if(!parsed.httpBridge){writeStderrLine("qwen serve: --no-http-bridge (native mode) is not yet implemented; falling back to http-bridge.")}if(parsed.options.token){writeStderrLine("qwen serve: --token is visible in the process command line; prefer the QWEN_SERVER_TOKEN env var for any non-trivial deployment.")}const mcpClientBudget=parsed.options.mcpClientBudget;if(mcpClientBudget!==void 0){const resolvedMcpMode=parsed.options.mcpBudgetMode??"warn";writeStderrLine(`qwen serve: --mcp-client-budget=${mcpClientBudget} mode=${resolvedMcpMode}`+(resolvedMcpMode==="enforce"?" (servers past the cap will be refused at discovery)":resolvedMcpMode==="warn"?` (warnings at >=${Math.ceil(mcpClientBudget*MCP_BUDGET_WARN_FRACTION)}, no refusal)`:""))}}__name(writeServeWarnings,"writeServeWarnings");async function tryRunServeFastPath(rawArgv=process.argv.slice(2)){const parsed=parseServeFastPathArgs(rawArgv);if(parsed.kind==="fallback")return false;const validationError=getServeFastPathValidationError(parsed)||(parsed.options.rateLimit===true?getRateLimitValidationError(parsed.options):null);if(validationError){writeStderrLine(validationError);process.exit(1)}let settings;try{settings=await bootstrapServeFastPathEnvironment(parsed.options.workspace)}catch(err){if(err instanceof InvalidExecutionSandboxConfigError)throw err;writeStderrLine(`qwen serve: fast-path bootstrap failed, falling back to full startup: ${err instanceof Error?err.message:String(err)}`);return false}assertExecutionSandboxSupported(settings??{},"serve / ACP / web terminals");applyRateLimitEnvDefaults(parsed.options,process.env);discardRateLimitTuningWhenDisabled(parsed.options);const rateLimitError=getRateLimitValidationError(parsed.options);if(rateLimitError){writeStderrLine(rateLimitError);process.exit(1)}writeServeWarnings(parsed);if(parsed.openWithAuth){try{const{applyOpenWithAuth}=await import("./open-with-auth-Z6WKB2OO.js");applyOpenWithAuth(parsed.options)}catch(err){writeStderrLine(`qwen serve: ${err instanceof Error?err.message:String(err)}`);process.exit(1)}}const{runQwenServe}=await import("./run-qwen-serve-77UZS4JA.js");let handle;try{handle=await runQwenServe(parsed.options,{updateRestartArgv:rawArgv,...settings?{bootSettings:settings}:{},resolveOnListen:true,deferRuntimeUntilFirstHealth:!parsed.open});try{emitHeadlessYoloWarning(settings)}catch{}await maybeOpenWebShellBrowser(handle,parsed.open,parsed.openWithAuth)}catch(err){writeStderrLine(`qwen serve: ${err instanceof Error?err.message:String(err)}`);process.exit(1)}await waitForServeRuntimeOrExit(handle);await blockForever();return true}__name(tryRunServeFastPath,"tryRunServeFastPath");export{bootstrapServeFastPathEnvironment,parseServeFastPathArgs,tryRunServeFastPath,waitForServeRuntimeOrExit};
4
+ `)}__name(writeStderrLine,"writeStderrLine");function setServeOption(options,key,value){options[key]=value}__name(setServeOption,"setServeOption");function getRateLimitValidationError(options){for(const[name,value]of[["--rate-limit-prompt",options.rateLimitPrompt],["--rate-limit-mutation",options.rateLimitMutation],["--rate-limit-read",options.rateLimitRead]]){if(value!==void 0&&(!Number.isFinite(value)||!Number.isInteger(value)||value<=0)){return`qwen serve: ${name} must be a positive integer.`}}if(options.rateLimitWindowMs!==void 0&&(!Number.isFinite(options.rateLimitWindowMs)||!Number.isInteger(options.rateLimitWindowMs)||options.rateLimitWindowMs<1e3)){return"qwen serve: --rate-limit-window-ms must be an integer >= 1000."}return null}__name(getRateLimitValidationError,"getRateLimitValidationError");function getServeFastPathValidationError(parsed){const mcpClientBudget=parsed.options.mcpClientBudget;if(mcpClientBudget!==void 0&&(!Number.isFinite(mcpClientBudget)||!Number.isInteger(mcpClientBudget)||mcpClientBudget<=0)){return"qwen serve: --mcp-client-budget must be a positive integer."}if(parsed.options.mcpBudgetMode==="enforce"&&mcpClientBudget===void 0){return"qwen serve: --mcp-budget-mode=enforce requires --mcp-client-budget=N."}const maxPendingPromptsPerSession=parsed.options.maxPendingPromptsPerSession;if(maxPendingPromptsPerSession!==void 0&&maxPendingPromptsPerSession!==Number.POSITIVE_INFINITY&&(!Number.isFinite(maxPendingPromptsPerSession)||!Number.isInteger(maxPendingPromptsPerSession)||maxPendingPromptsPerSession<0)){return"qwen serve: --max-pending-prompts-per-session must be a non-negative integer (0 / Infinity = unlimited)."}try{normalizeMaxRingBytes(parsed.options.eventRingMaxBytes)}catch(error){return`qwen serve: ${error instanceof Error?error.message:String(error)}`}const compactedReplayMaxBytes=parsed.options.compactedReplayMaxBytes;if(compactedReplayMaxBytes!==void 0&&(!Number.isSafeInteger(compactedReplayMaxBytes)||compactedReplayMaxBytes<1||compactedReplayMaxBytes>MAX_COMPACTED_REPLAY_MAX_BYTES)){return`qwen serve: --compacted-replay-max-bytes must be a positive safe integer in [1, ${MAX_COMPACTED_REPLAY_MAX_BYTES}].`}const maxJournalEvents=parsed.options.maxJournalEvents;if(maxJournalEvents!==void 0&&(!Number.isSafeInteger(maxJournalEvents)||maxJournalEvents<1)){return"qwen serve: --max-journal-events must be a positive safe integer."}const maxJournalBytes=parsed.options.maxJournalBytes;if(maxJournalBytes!==void 0&&(!Number.isSafeInteger(maxJournalBytes)||maxJournalBytes<1)){return"qwen serve: --max-journal-bytes must be a positive safe integer."}const memoryBudgetMb=parsed.options.memoryBudgetMb;if(memoryBudgetMb!==void 0&&!isValidMemoryBudgetMb(memoryBudgetMb)){return memoryBudgetRangeError()}return null}__name(getServeFastPathValidationError,"getServeFastPathValidationError");function blockForever(){return new Promise(()=>{})}__name(blockForever,"blockForever");async function waitForServeRuntimeOrExit(handle){try{await handle.runtimeReady}catch(err){if(err instanceof Error&&err.message===RUNTIME_STARTUP_CANCELLED_MESSAGE){return}writeStderrLine(`qwen serve: runtime startup failed after listener was ready: ${err instanceof Error?err.message:String(err)}`);await handle.close().catch(()=>void 0);process.exit(1)}}__name(waitForServeRuntimeOrExit,"waitForServeRuntimeOrExit");function applyRateLimitEnvDefaults(options,env){if(options.rateLimit===void 0&&isTruthyEnv(env["QWEN_SERVE_RATE_LIMIT"])){options.rateLimit=true}if(options.rateLimit){options.rateLimitPrompt??=parsePositiveIntegerEnv(env["QWEN_SERVE_RATE_LIMIT_PROMPT"]);options.rateLimitMutation??=parsePositiveIntegerEnv(env["QWEN_SERVE_RATE_LIMIT_MUTATION"]);options.rateLimitRead??=parsePositiveIntegerEnv(env["QWEN_SERVE_RATE_LIMIT_READ"]);options.rateLimitWindowMs??=parsePositiveIntegerEnv(env["QWEN_SERVE_RATE_LIMIT_WINDOW_MS"])}}__name(applyRateLimitEnvDefaults,"applyRateLimitEnvDefaults");function discardRateLimitTuningWhenDisabled(options){if(options.rateLimit===true)return;delete options.rateLimitPrompt;delete options.rateLimitMutation;delete options.rateLimitRead;delete options.rateLimitWindowMs}__name(discardRateLimitTuningWhenDisabled,"discardRateLimitTuningWhenDisabled");async function bootstrapServeFastPathEnvironment(workspace){const{loadServeFastPathEnvironment,loadServeFastPathSettings,preResolveServeFastPathHomeEnvOverrides}=await import("./fast-path-settings-QGSXJF45.js");preResolveServeFastPathHomeEnvOverrides();const workspaceDir=workspace??process.cwd();const settings=loadServeFastPathSettings(workspaceDir);loadServeFastPathEnvironment(settings,workspaceDir);return settings}__name(bootstrapServeFastPathEnvironment,"bootstrapServeFastPathEnvironment");function parseServeFastPathArgs(rawArgv,env=process.env){const argv=normalizeServeFastPathArgv(rawArgv);if(argv[0]!=="serve")return{kind:"fallback"};if(argv.some(arg=>HELP_AND_VERSION_FLAGS.has(arg))){return{kind:"fallback"}}const options={hostname:"127.0.0.1",mode:"http-bridge",port:4170};let open=false;let openWithAuth=false;let httpBridge=true;let mcpBudgetModeRaw;let mcpClientBudget;let explicitRateLimit;for(let i=1;i<argv.length;i++){const arg=argv[i];if(arg==="--")return{kind:"fallback"};if(!arg.startsWith("--"))return{kind:"fallback"};const withoutPrefix=arg.slice(2);const equalsIndex=withoutPrefix.indexOf("=");const rawFlag=equalsIndex===-1?withoutPrefix:withoutPrefix.slice(0,equalsIndex);const inlineValue=equalsIndex===-1?void 0:withoutPrefix.slice(equalsIndex+1);const negated=rawFlag.startsWith("no-");const flag=negated?rawFlag.slice(3):rawFlag;const booleanTarget=BOOLEAN_OPTION_BY_FLAG.get(flag);if(booleanTarget){let value=!negated;if(inlineValue!==void 0){const parsed=parseBooleanValue(inlineValue);if(parsed===null||negated)return{kind:"fallback"};value=parsed}if(booleanTarget==="open"){open=value}else if(booleanTarget==="open-with-auth"){openWithAuth=value}else if(booleanTarget==="http-bridge"){httpBridge=value}else{setServeOption(options,booleanTarget,value);if(booleanTarget==="rateLimit"){explicitRateLimit=value}}continue}if(negated)return{kind:"fallback"};const numberTarget=NUMBER_OPTION_BY_FLAG.get(flag);if(numberTarget){const read=readOptionValue(argv,i,inlineValue);if(!read)return{kind:"fallback"};i=read.nextIndex;const value=parseNumber(read.value);if(value===null)return{kind:"fallback"};if(numberTarget==="mcp-client-budget"){mcpClientBudget=value}else{setServeOption(options,numberTarget,value)}continue}const stringTarget=STRING_OPTION_BY_FLAG.get(flag);if(stringTarget){const read=readOptionValue(argv,i,inlineValue);if(!read)return{kind:"fallback"};i=read.nextIndex;if((stringTarget==="workspace"||stringTarget==="conversationsDir")&&(options[stringTarget]!==void 0||read.value==="")){return{kind:"fallback"}}setServeOption(options,stringTarget,read.value);continue}if(flag==="memory-pressure-mode"){const read=readOptionValue(argv,i,inlineValue);if(!read)return{kind:"fallback"};i=read.nextIndex;if(read.value!=="off"&&read.value!=="observe"){return{kind:"fallback"}}options.memoryPressureMode=read.value;continue}if(flag==="child-heap-mode"){const read=readOptionValue(argv,i,inlineValue);if(!read)return{kind:"fallback"};i=read.nextIndex;if(read.value!=="off"&&read.value!=="observe"&&read.value!=="admit"&&read.value!=="enforce"){return{kind:"fallback"}}options.childHeapMode=read.value;continue}if(flag==="mcp-budget-mode"){const read=readOptionValue(argv,i,inlineValue);if(!read)return{kind:"fallback"};i=read.nextIndex;mcpBudgetModeRaw=read.value;continue}if(flag==="allow-origin"){const read=readOptionValue(argv,i,inlineValue);if(!read)return{kind:"fallback"};i=read.nextIndex;options.allowOrigins=[...options.allowOrigins??[],read.value];continue}return{kind:"fallback"}}if(mcpBudgetModeRaw!==void 0&&mcpBudgetModeRaw!=="enforce"&&mcpBudgetModeRaw!=="warn"&&mcpBudgetModeRaw!=="off"){return{kind:"fallback"}}if(options.memoryProjectScope!==void 0&&options.memoryProjectScope!=="git-root"&&options.memoryProjectScope!=="workspace"){return{kind:"fallback"}}const mcpBudgetMode=mcpBudgetModeRaw??(mcpClientBudget!==void 0?"warn":"off");if(mcpClientBudget!==void 0)options.mcpClientBudget=mcpClientBudget;options.mcpBudgetMode=mcpBudgetMode;if(explicitRateLimit!==void 0){options.rateLimit=explicitRateLimit}applyRateLimitEnvDefaults(options,env);return{kind:"serve",open:open||openWithAuth,openWithAuth,httpBridge,options}}__name(parseServeFastPathArgs,"parseServeFastPathArgs");async function maybeOpenWebShellBrowser(handle,open,openWithAuth){if(!open)return;try{await handle.runtimeReady}catch{return}const{maybeOpenWebShellBrowser:openBrowser}=await import("./serve-EQN6QAXF.js");await openBrowser(handle,true,openWithAuth)}__name(maybeOpenWebShellBrowser,"maybeOpenWebShellBrowser");function emitHeadlessYoloWarning(settings){if(!settings)return;const warning=getHeadlessYoloSafetyWarning({getApprovalMode:__name(()=>settings.tools?.approvalMode,"getApprovalMode"),getSandbox:__name(()=>settings.tools?.sandbox,"getSandbox"),getShellExecutionSandbox:__name(()=>settings.tools?.executionSandbox,"getShellExecutionSandbox")});if(warning){writeStderrLine(warning)}}__name(emitHeadlessYoloWarning,"emitHeadlessYoloWarning");function writeServeWarnings(parsed){if(!parsed.httpBridge){writeStderrLine("qwen serve: --no-http-bridge (native mode) is not yet implemented; falling back to http-bridge.")}if(parsed.options.token){writeStderrLine("qwen serve: --token is visible in the process command line; prefer the QWEN_SERVER_TOKEN env var for any non-trivial deployment.")}const mcpClientBudget=parsed.options.mcpClientBudget;if(mcpClientBudget!==void 0){const resolvedMcpMode=parsed.options.mcpBudgetMode??"warn";writeStderrLine(`qwen serve: --mcp-client-budget=${mcpClientBudget} mode=${resolvedMcpMode}`+(resolvedMcpMode==="enforce"?" (servers past the cap will be refused at discovery)":resolvedMcpMode==="warn"?` (warnings at >=${Math.ceil(mcpClientBudget*MCP_BUDGET_WARN_FRACTION)}, no refusal)`:""))}}__name(writeServeWarnings,"writeServeWarnings");async function tryRunServeFastPath(rawArgv=process.argv.slice(2)){const parsed=parseServeFastPathArgs(rawArgv);if(parsed.kind==="fallback")return false;const validationError=getServeFastPathValidationError(parsed)||(parsed.options.rateLimit===true?getRateLimitValidationError(parsed.options):null);if(validationError){writeStderrLine(validationError);process.exit(1)}let settings;try{settings=await bootstrapServeFastPathEnvironment(parsed.options.workspace)}catch(err){if(err instanceof InvalidExecutionSandboxConfigError)throw err;writeStderrLine(`qwen serve: fast-path bootstrap failed, falling back to full startup: ${err instanceof Error?err.message:String(err)}`);return false}assertExecutionSandboxSupported(settings??{},"serve / ACP / web terminals");applyRateLimitEnvDefaults(parsed.options,process.env);discardRateLimitTuningWhenDisabled(parsed.options);const rateLimitError=getRateLimitValidationError(parsed.options);if(rateLimitError){writeStderrLine(rateLimitError);process.exit(1)}writeServeWarnings(parsed);if(parsed.openWithAuth){try{const{applyOpenWithAuth}=await import("./open-with-auth-Z6WKB2OO.js");applyOpenWithAuth(parsed.options)}catch(err){writeStderrLine(`qwen serve: ${err instanceof Error?err.message:String(err)}`);process.exit(1)}}const{runQwenServe}=await import("./run-qwen-serve-4MZRQFXK.js");let handle;try{handle=await runQwenServe(parsed.options,{updateRestartArgv:rawArgv,...settings?{bootSettings:settings}:{},resolveOnListen:true,deferRuntimeUntilFirstHealth:!parsed.open});try{emitHeadlessYoloWarning(settings)}catch{}await maybeOpenWebShellBrowser(handle,parsed.open,parsed.openWithAuth)}catch(err){writeStderrLine(`qwen serve: ${err instanceof Error?err.message:String(err)}`);process.exit(1)}await waitForServeRuntimeOrExit(handle);await blockForever();return true}__name(tryRunServeFastPath,"tryRunServeFastPath");export{bootstrapServeFastPathEnvironment,parseServeFastPathArgs,tryRunServeFastPath,waitForServeRuntimeOrExit};
5
5
  /**
6
6
  * @license
7
7
  * Copyright 2025 Qwen Team