@mortiseai/stem 0.0.25 → 0.0.26

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/daemon.mjs CHANGED
@@ -2240,7 +2240,7 @@ Prefer these manifest-derived commands over guessing flags from another test run
2240
2240
 
2241
2241
  BROWSER ROUTING FOR THIS TURN: This is a UI/frontend coding task with browser verification available from ${D.servers.join(", ")}. Browser tool schemas are deferred during locate/edit work to keep requests small; they activate automatically after focused static verification or when a completion claim needs runtime verification. If live inspection is genuinely needed earlier, use ToolSearch to activate the exact browser tools. Do not build an alternate browser driver through Bash. Before starting a local dev server, probe the exact intended URL once and reuse a working server. Reaching a generic root, about:blank, or an authentication redirect does not verify the changed UI; reach and inspect the target state, or report the blocker explicitly.`;return`
2242
2242
 
2243
- BROWSER ROUTING FOR THIS TURN: Browser interaction is part of the requested verification and MCP browser tools from ${D.servers.join(", ")} are available. Use those MCP tools for runtime page interaction: take a text snapshot, act on its uid, then inspect the resulting page state and console. Do not automate Chrome through Bash, AppleScript, a raw remote-debugging port, hand-written CDP, Playwright, or Puppeteer. Before starting a local dev server, probe the exact intended URL once and reuse a working server. A generic root, about:blank, or authentication redirect is not successful target-state verification. If list_pages returns no pages, that is an empty isolated browser profile, not a connection failure: call new_page for the intended local URL, then navigate/inspect it. If the app redirects to a local sign-in page, inspect that page so the local login-recovery flow can continue.`}return"\n\nBROWSER ROUTING FOR THIS TURN: The request needs browser interaction, but no browser MCP tool is present in the refreshed tool pool. Do not search for or build an alternative browser driver through Bash, AppleScript, raw CDP, Playwright, or Puppeteer. You may continue with static diagnosis and targeted tests, but the final response must explicitly say that runtime browser verification was unavailable and direct the user to run `/chrome connect`."}function oT0(D){if(!D||typeof D!=="object")return!1;let $=D.command;if(typeof $!=="string"||Rj1.test($))return!1;return Tj1.test($)}function kj1(D){return L7(D)&&Aj1.has(oO(D))}function Cj1(D){return L7(D)&&Lj1.has(oO(D))}function rT0(D){let $={...D.state},Z=D.blockerCode||null;if(kj1(D.toolName)){if($.actionSucceeded=!0,Z)$.blockerCode=Z,$.verified=!1;else if($.verified=D.toolVerified===!0,$.verified)$.blockerCode=null;if($.verified)$.inspectionSucceeded=!0;return $}if(!Cj1(D.toolName))return $;if($.inspectionSucceeded=!0,Z)$.blockerCode=Z,$.verified=!1;else if(oO(D.toolName)==="take_snapshot"&&($.actionSucceeded||D.filesChanged))$.blockerCode=null,$.verified=!0;return $}function Js(D){if(!D.route.intent||!D.filesChanged&&!D.browserActionSucceeded||D.browserVerified)return!1;if(typeof D.message!=="string"||!yj1.test(D.message))return!1;return D.route.available||!fj1.test(D.message)}function Xs(D,$){if($==="authentication-required")return"Browser verification reached an authentication page instead of the target UI. Do not keep retrying or claim success. Report that sign-in is required and ask the user to authenticate before runtime verification can continue.";if($==="blank-page")return"Browser verification is still on about:blank, so the target UI was not inspected. Navigate to the exact target URL and inspect its resulting page state, or report the navigation blocker explicitly.";if($==="web-server-starting")return"The local Web target refused the browser connection while its background server task was starting. Wait for that task to become ready, then inspect the original target URL; if the task exits, diagnose its startup output instead of claiming browser verification succeeded.";return D.available?"This UI change has not completed runtime browser verification. Use the available Chrome DevTools MCP tools to perform the interaction and inspect the resulting page/console before claiming it is fixed. If verification is blocked, report the blocker explicitly instead of claiming success.":"No browser MCP tool is available, so this UI change cannot be claimed as runtime-verified. Finish with an explicit 'static checks only; browser verification unavailable' disclosure and ask the user to run `/chrome connect`."}var hj1=/(?:批量|全量|整个仓库|所有文件|大规模|迁移|重构|batch|repository[- ]wide|all files|large[- ]scale|migration|refactor)/i,iT0={normal:{softIterations:8,maxIterations:24,softDurationMs:90000,maxDurationMs:300000,discoverySoftLimit:6},complex:{softIterations:16,maxIterations:40,softDurationMs:180000,maxDurationMs:600000,discoverySoftLimit:10},bulk:{softIterations:24,maxIterations:50,softDurationMs:300000,maxDurationMs:900000,discoverySoftLimit:16}};function sT0(D,$){let Z=Ik(D),Q=Zs(Z),Y=hj1.test(Z)?"bulk":$s(Z)?"complex":"normal";return aT0(Y,$,Y==="bulk"?"bulk-keyword":Q?"multi-target-change":Y==="complex"?"complex-signal":"normal")}function aT0(D,$,Z="normal"){let Q=iT0[D];return{...Q,maxIterations:$==="agent"?50:null,maxDurationMs:$==="agent"?Q.maxDurationMs:null,class:D,classificationReason:Z,mode:$}}function Pk(D,$){if(!$||iT0[$].discoverySoftLimit<=D.discoverySoftLimit)return D;return aT0($,D.mode,"retained-continuation")}function tT0(D){let $=D.mode==="fde"?"FDE":D.mode==="coding"?"Coding":"Agent",Z=D.capReason==="duration"?typeof D.maxDurationMs==="number"?`${Math.round(D.maxDurationMs/60000)}-minute wall-clock`:"wall-clock":typeof D.maxIterations==="number"?`${D.maxIterations}-iteration`:"iteration";return`[paused] ${$} mode reached this ${D.budgetClass} turn's recoverable ${Z} execution limit before the task finished. All progress is preserved. `+'Continue? Reply "continue" or "继续" to resume from the current context; send a new '+"request to stop here and change direction."}import{resolve as eT0}from"node:path";function $A0(D){if(!D.interactive)return null;if(D.mode!=="coding"&&D.mode!=="fde")return null;if(D.blockerCode==="authentication-required")return"authentication-required";if(D.blockerCode==="web-server-starting"&&D.hasRunningWebTask)return"web-server-starting";return null}function rO(D){if(!D)return;try{let $=new URL(D);return $.username="",$.password="",$.search="",$.hash="",$.toString()}catch{let $=D.split(/[?#]/,1)[0]?.trim();return $?$.slice(0,500):void 0}}var Mj1=/(?:\b(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?(?:dev|start|serve)\b|\bnpx\s+(?:next|vite|serve|http-server)\b|\bnext\s+dev\b|\bvite(?:\s|$)|\bastro\s+dev\b|\bnuxt\s+dev\b|webpack-dev-server|react-scripts\s+start|\bpython3?\s+-m\s+http\.server\b)/i,uj1=/(?:\bready\s+(?:in|on|at)\b|\blocal:\s*https?:\/\/|\blistening\s+(?:on|at)\b|\bserver\s+(?:is\s+)?(?:running|ready|started)\b|\bstarted\s+server\b|compiled successfully)/i;function ZA0(D){if(!D)return;try{let $=new URL(D);return $.port||($.protocol==="https:"?"443":"80")}catch{return}}function DA0(D){let $=new Set;for(let Z of D.matchAll(/https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])(?::(\d{1,5}))?/gi))$.add(Z[1]??(/^https:/i.test(Z[0])?"443":"80"));for(let Z of D.matchAll(/(?:--port(?:=|\s+)|(?:^|\s)-p\s+)(\d{1,5})(?=\s|$)/gi))$.add(Z[1]);for(let Z of D.matchAll(/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\]):(\d{1,5})/gi))$.add(Z[1]);for(let Z of D.matchAll(/(?:^|\s)(?:PORT|VITE_PORT|NEXT_PORT)=(\d{1,5})(?=\s|$)/gi))$.add(Z[1]);return $}function Sj1(D,$){try{return eT0(D)===eT0($)}catch{return D===$}}function QA0(D,$,Z){let Q=ZA0($),Y=[];for(let V of D){if(V.kind!=="local-shell"||V.state!=="running")continue;let B=V.lines.slice(-80).join(`
2243
+ BROWSER ROUTING FOR THIS TURN: Browser interaction is part of the requested verification and MCP browser tools from ${D.servers.join(", ")} are available. Use those MCP tools for runtime page interaction: take a text snapshot, act on its uid, then inspect the resulting page state and console. Do not automate Chrome through Bash, AppleScript, a raw remote-debugging port, hand-written CDP, Playwright, or Puppeteer. Before starting a local dev server, probe the exact intended URL once and reuse a working server. A generic root, about:blank, or authentication redirect is not successful target-state verification. If list_pages returns no pages, that is an empty isolated browser profile, not a connection failure: call new_page for the intended local URL, then navigate/inspect it. If the app redirects to a local sign-in page, inspect that page so the local login-recovery flow can continue.`}return"\n\nBROWSER ROUTING FOR THIS TURN: The request needs browser interaction, but no browser MCP tool is present in the refreshed tool pool. Do not search for or build an alternative browser driver through Bash, AppleScript, raw CDP, Playwright, or Puppeteer. You may continue with static diagnosis and targeted tests, but the final response must explicitly say that runtime browser verification was unavailable and direct the user to run `/chrome connect`."}function oT0(D){if(!D||typeof D!=="object")return!1;let $=D.command;if(typeof $!=="string"||Rj1.test($))return!1;return Tj1.test($)}function kj1(D){return L7(D)&&Aj1.has(oO(D))}function Cj1(D){return L7(D)&&Lj1.has(oO(D))}function rT0(D){let $={...D.state},Z=D.blockerCode||null;if(kj1(D.toolName)){if($.actionSucceeded=!0,Z)$.blockerCode=Z,$.verified=!1;else if($.verified=D.toolVerified===!0,$.verified)$.blockerCode=null;if($.verified)$.inspectionSucceeded=!0;return $}if(!Cj1(D.toolName))return $;if($.inspectionSucceeded=!0,Z)$.blockerCode=Z,$.verified=!1;else if(oO(D.toolName)==="take_snapshot"&&($.actionSucceeded||D.filesChanged))$.blockerCode=null,$.verified=!0;return $}function Js(D){if(!D.route.intent||!D.filesChanged&&!D.browserActionSucceeded||D.browserVerified)return!1;if(typeof D.message!=="string"||!yj1.test(D.message))return!1;return D.route.available||!fj1.test(D.message)}function Xs(D,$){if($==="authentication-required")return"Browser verification reached an authentication page instead of the target UI. Do not keep retrying or claim success. Report that sign-in is required and ask the user to authenticate before runtime verification can continue.";if($==="blank-page")return"Browser verification is still on about:blank, so the target UI was not inspected. Navigate to the exact target URL and inspect its resulting page state, or report the navigation blocker explicitly.";if($==="web-server-starting")return"The local Web target refused the browser connection while its background server task was starting. Wait for that task to become ready, then inspect the original target URL; if the task exits, diagnose its startup output instead of claiming browser verification succeeded.";return D.available?"This UI change has not completed runtime browser verification. Use the available Chrome DevTools MCP tools to perform the interaction and inspect the resulting page/console before claiming it is fixed. If verification is blocked, report the blocker explicitly instead of claiming success.":"No browser MCP tool is available, so this UI change cannot be claimed as runtime-verified. Finish with an explicit 'static checks only; browser verification unavailable' disclosure and ask the user to run `/chrome connect`."}var hj1=/(?:批量|全量|整个仓库|所有文件|大规模|迁移|重构|batch|repository[- ]wide|all files|large[- ]scale|migration|refactor)/i,iT0={normal:{softIterations:8,maxIterations:24,softDurationMs:90000,maxDurationMs:600000,discoverySoftLimit:6},complex:{softIterations:16,maxIterations:40,softDurationMs:180000,maxDurationMs:600000,discoverySoftLimit:10},bulk:{softIterations:24,maxIterations:50,softDurationMs:300000,maxDurationMs:900000,discoverySoftLimit:16}};function sT0(D,$){let Z=Ik(D),Q=Zs(Z),Y=hj1.test(Z)?"bulk":$s(Z)?"complex":"normal";return aT0(Y,$,Y==="bulk"?"bulk-keyword":Q?"multi-target-change":Y==="complex"?"complex-signal":"normal")}function aT0(D,$,Z="normal"){return{...iT0[D],maxIterations:null,maxDurationMs:null,class:D,classificationReason:Z,mode:$}}function Pk(D,$){if(!$||iT0[$].discoverySoftLimit<=D.discoverySoftLimit)return D;return aT0($,D.mode,"retained-continuation")}function tT0(D){let $=D.mode==="fde"?"FDE":D.mode==="coding"?"Coding":"Agent",Z=D.capReason==="duration"?typeof D.maxDurationMs==="number"?`${Math.round(D.maxDurationMs/60000)}-minute wall-clock`:"wall-clock":typeof D.maxIterations==="number"?`${D.maxIterations}-iteration`:"iteration";return`[paused] ${$} mode reached this ${D.budgetClass} turn's recoverable ${Z} execution limit before the task finished. All progress is preserved. `+'Continue? Reply "continue" or "继续" to resume from the current context; send a new '+"request to stop here and change direction."}import{resolve as eT0}from"node:path";function $A0(D){if(!D.interactive)return null;if(D.mode!=="coding"&&D.mode!=="fde")return null;if(D.blockerCode==="authentication-required")return"authentication-required";if(D.blockerCode==="web-server-starting"&&D.hasRunningWebTask)return"web-server-starting";return null}function rO(D){if(!D)return;try{let $=new URL(D);return $.username="",$.password="",$.search="",$.hash="",$.toString()}catch{let $=D.split(/[?#]/,1)[0]?.trim();return $?$.slice(0,500):void 0}}var Mj1=/(?:\b(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?(?:dev|start|serve)\b|\bnpx\s+(?:next|vite|serve|http-server)\b|\bnext\s+dev\b|\bvite(?:\s|$)|\bastro\s+dev\b|\bnuxt\s+dev\b|webpack-dev-server|react-scripts\s+start|\bpython3?\s+-m\s+http\.server\b)/i,uj1=/(?:\bready\s+(?:in|on|at)\b|\blocal:\s*https?:\/\/|\blistening\s+(?:on|at)\b|\bserver\s+(?:is\s+)?(?:running|ready|started)\b|\bstarted\s+server\b|compiled successfully)/i;function ZA0(D){if(!D)return;try{let $=new URL(D);return $.port||($.protocol==="https:"?"443":"80")}catch{return}}function DA0(D){let $=new Set;for(let Z of D.matchAll(/https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])(?::(\d{1,5}))?/gi))$.add(Z[1]??(/^https:/i.test(Z[0])?"443":"80"));for(let Z of D.matchAll(/(?:--port(?:=|\s+)|(?:^|\s)-p\s+)(\d{1,5})(?=\s|$)/gi))$.add(Z[1]);for(let Z of D.matchAll(/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\]):(\d{1,5})/gi))$.add(Z[1]);for(let Z of D.matchAll(/(?:^|\s)(?:PORT|VITE_PORT|NEXT_PORT)=(\d{1,5})(?=\s|$)/gi))$.add(Z[1]);return $}function Sj1(D,$){try{return eT0(D)===eT0($)}catch{return D===$}}function QA0(D,$,Z){let Q=ZA0($),Y=[];for(let V of D){if(V.kind!=="local-shell"||V.state!=="running")continue;let B=V.lines.slice(-80).join(`
2244
2244
  `),G=Mj1.test(V.command),z=new Set([...DA0(V.command),...DA0(B)]),j=!!Q&&z.has(Q);if(Q&&z.size>0&&!j)continue;if(!G&&!j)continue;let H=typeof V.metadata?.cwd==="string"?V.metadata.cwd:void 0,W=!!(Z&&H&&Sj1(Z,H));if(Z&&H&&!W&&!j)continue;let U=(G?4:0)+(j?10:0)+(W?5:H?0:1);Y.push({task:V,score:U,portSeen:j})}Y.sort((V,B)=>B.score-V.score||B.task.startedAtMs-V.task.startedAtMs);let J=Y[0];if(!J)return null;let X=Y[1];if(X&&X.score===J.score&&!J.portSeen&&!X.portSeen)return null;return J.task}function vj1(D,$){let Z=D.join(`
2245
2245
  `),Q=ZA0($),Y=/(?:local:\s*|(?:running|ready|listening|started)[^\n]{0,80})https?:\/\//i.test(Z),J=Q==="80"||Q==="443"?`(?::${Q})?`:`:${Q}`,X=!!Q&&new RegExp(`https?:\\/\\/(?:localhost|127\\.0\\.0\\.1|0\\.0\\.0\\.0|\\[::1\\])${J}(?:[\\s/]|$)`,"i").test(Z);return uj1.test(Z)||Y||X?"ready":"waiting"}function YA0(D=0){return{cursor:Math.max(0,D),lines:[]}}function JA0(D,$,Z){if(!D)return{readiness:"failed",state:Z};let Q=Math.max(D.lines.length,D.lineCount??D.lines.length),Y=Math.max(0,Q-D.lines.length),J=Z.cursor>Q?Y:Z.cursor,X=Math.max(0,J-Y),V=D.lines.slice(X),B=[...Z.lines,...V].slice(-120),G={cursor:Q,lines:B};if(D.state!=="running")return{readiness:"failed",state:G};return{readiness:vj1(B,$),state:G}}function XA0(D,$=40,Z=6000){let Q=D.slice(-Math.max(1,$)).map((J)=>J.replace(/\x1B(?:[@-_]|\[[0-?]*[ -/]*[@-~])/g,"").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,"")).join(`
2246
2246
  `).trim(),Y=Math.max(128,Z);if(Q.length<=Y)return Q;return`[older output omitted]
@@ -2414,10 +2414,10 @@ ${D}`}]},Y=await Promise.race([pD(Q),new Promise((J,X)=>setTimeout(()=>X(Error(`
2414
2414
  `)};if(G.rawText&&G.rawText.trim())return{ok:!0,output:[...z,G.rawText.trim()].join(`
2415
2415
  `)};return{ok:!0,output:[...z,"No results found. Try a broader or differently-worded query."].join(`
2416
2416
  `)}}B0();class i_ extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case OV.TOOL_WEB_SEARCH_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWebSearchLogic",{receiver:$,input:Z},()=>zy0(Z)),Y=new ya;k0(Y,Q),this.sendActionEvent(HV.TOOL_WEB_SEARCH_RESULT,Y,$)}}i_=F([y(!0,HV),C(!0,OV),L()],i_);class UV extends x{}UV.TOOL_WIKI_INDEX_RESULT="tool_wiki_index_result",F([A(!0,"tool_wiki_index_result","MaiCliServerToolWikiIndexLogicActionModel"),O("design:type",Object)],UV,"TOOL_WIKI_INDEX_RESULT",void 0),UV=F([f()],UV);class ha extends k{ok;data;error}class NV extends M{}NV.TOOL_WIKI_INDEX_INVOKE="tool_wiki_index_invoke",F([b(!0,!0,"tool_wiki_index_invoke"),O("design:type",Object)],NV,"TOOL_WIKI_INDEX_INVOKE",void 0),NV=F([h()],NV);B0();class s_ extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case NV.TOOL_WIKI_INDEX_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWikiIndexLogic",{receiver:$,input:Z},()=>SY0(Z)),Y=N8(Q),J=new ha;k0(J,Y),this.sendActionEvent(UV.TOOL_WIKI_INDEX_RESULT,J,$)}}s_=F([y(!0,UV),C(!0,NV),L()],s_);class qV extends x{}qV.TOOL_WIKI_INGEST_PREP_RESULT="tool_wiki_ingest_prep_result",F([A(!0,"tool_wiki_ingest_prep_result","MaiCliServerToolWikiIngestPrepLogicActionModel"),O("design:type",Object)],qV,"TOOL_WIKI_INGEST_PREP_RESULT",void 0),qV=F([f()],qV);class Ma extends k{ok;data;error}class EV extends M{}EV.TOOL_WIKI_INGEST_PREP_INVOKE="tool_wiki_ingest_prep_invoke",F([b(!0,!0,"tool_wiki_ingest_prep_invoke"),O("design:type",Object)],EV,"TOOL_WIKI_INGEST_PREP_INVOKE",void 0),EV=F([h()],EV);B0();class a_ extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case EV.TOOL_WIKI_INGEST_PREP_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWikiIngestPrepLogic",{receiver:$,input:Z},()=>mY0(Z)),Y=N8(Q),J=new Ma;k0(J,Y),this.sendActionEvent(qV.TOOL_WIKI_INGEST_PREP_RESULT,J,$)}}a_=F([y(!0,qV),C(!0,EV),L()],a_);class KV extends x{}KV.TOOL_WIKI_LINT_RESULT="tool_wiki_lint_result",F([A(!0,"tool_wiki_lint_result","MaiCliServerToolWikiLintLogicActionModel"),O("design:type",Object)],KV,"TOOL_WIKI_LINT_RESULT",void 0),KV=F([f()],KV);class ua extends k{ok;data;error}class IV extends M{}IV.TOOL_WIKI_LINT_INVOKE="tool_wiki_lint_invoke",F([b(!0,!0,"tool_wiki_lint_invoke"),O("design:type",Object)],IV,"TOOL_WIKI_LINT_INVOKE",void 0),IV=F([h()],IV);B0();class t_ extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case IV.TOOL_WIKI_LINT_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWikiLintLogic",{receiver:$,input:Z},()=>hY0(Z)),Y=N8(Q),J=new ua;k0(J,Y),this.sendActionEvent(KV.TOOL_WIKI_LINT_RESULT,J,$)}}t_=F([y(!0,KV),C(!0,IV),L()],t_);class PV extends x{}PV.TOOL_WIKI_REVIEW_RESULT="tool_wiki_review_result",F([A(!0,"tool_wiki_review_result","MaiCliServerToolWikiReviewLogicActionModel"),O("design:type",Object)],PV,"TOOL_WIKI_REVIEW_RESULT",void 0),PV=F([f()],PV);class Sa extends k{ok;data;error}class wV extends M{}wV.TOOL_WIKI_REVIEW_INVOKE="tool_wiki_review_invoke",F([b(!0,!0,"tool_wiki_review_invoke"),O("design:type",Object)],wV,"TOOL_WIKI_REVIEW_INVOKE",void 0),wV=F([h()],wV);B0();class e_ extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case wV.TOOL_WIKI_REVIEW_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWikiReviewLogic",{receiver:$,input:Z},()=>cY0(Z)),Y=N8(Q),J=new Sa;k0(J,Y),this.sendActionEvent(PV.TOOL_WIKI_REVIEW_RESULT,J,$)}}e_=F([y(!0,PV),C(!0,wV),L()],e_);class _V extends x{}_V.TOOL_WIKI_SEARCH_RESULT="tool_wiki_search_result",F([A(!0,"tool_wiki_search_result","MaiCliServerToolWikiSearchLogicActionModel"),O("design:type",Object)],_V,"TOOL_WIKI_SEARCH_RESULT",void 0),_V=F([f()],_V);class va extends k{ok;data;error}class bV extends M{}bV.TOOL_WIKI_SEARCH_INVOKE="tool_wiki_search_invoke",F([b(!0,!0,"tool_wiki_search_invoke"),O("design:type",Object)],bV,"TOOL_WIKI_SEARCH_INVOKE",void 0),bV=F([h()],bV);B0();class Db extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case bV.TOOL_WIKI_SEARCH_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWikiSearchLogic",{receiver:$,input:Z},()=>DQ0(Z)),Y=N8(Q),J=new va;k0(J,Y),this.sendActionEvent(_V.TOOL_WIKI_SEARCH_RESULT,J,$)}}Db=F([y(!0,_V),C(!0,bV),L()],Db);class RV extends x{}RV.TOOL_ONTOLOGY_SCHEMA_RESULT="tool_ontology_schema_result",F([A(!0,"tool_ontology_schema_result","MaiCliServerToolOntologySchemaLogicActionModel"),O("design:type",Object)],RV,"TOOL_ONTOLOGY_SCHEMA_RESULT",void 0),RV=F([f()],RV);class ga extends k{ok;data;error}class TV extends M{}TV.TOOL_ONTOLOGY_SCHEMA_INVOKE="tool_ontology_schema_invoke",F([b(!0,!0,"tool_ontology_schema_invoke"),O("design:type",Object)],TV,"TOOL_ONTOLOGY_SCHEMA_INVOKE",void 0),TV=F([h()],TV);B0();class $b extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case TV.TOOL_ONTOLOGY_SCHEMA_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolOntologySchemaLogic",{receiver:$,input:Z},()=>vQ0(Z)),Y=N8(Q),J=new ga;k0(J,Y),this.sendActionEvent(RV.TOOL_ONTOLOGY_SCHEMA_RESULT,J,$)}}$b=F([y(!0,RV),C(!0,TV),L()],$b);class AV extends x{}AV.TOOL_ONTOLOGY_GRAPH_RESULT="tool_ontology_graph_result",F([A(!0,"tool_ontology_graph_result","MaiCliServerToolOntologyGraphLogicActionModel"),O("design:type",Object)],AV,"TOOL_ONTOLOGY_GRAPH_RESULT",void 0),AV=F([f()],AV);class ma extends k{ok;data;error}class LV extends M{}LV.TOOL_ONTOLOGY_GRAPH_INVOKE="tool_ontology_graph_invoke",F([b(!0,!0,"tool_ontology_graph_invoke"),O("design:type",Object)],LV,"TOOL_ONTOLOGY_GRAPH_INVOKE",void 0),LV=F([h()],LV);B0();class Zb extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case LV.TOOL_ONTOLOGY_GRAPH_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolOntologyGraphLogic",{receiver:$,input:Z},()=>pQ0(Z)),Y=N8(Q),J=new ma;k0(J,Y),this.sendActionEvent(AV.TOOL_ONTOLOGY_GRAPH_RESULT,J,$)}}Zb=F([y(!0,AV),C(!0,LV),L()],Zb);class yV extends x{}yV.TOOL_ONTOLOGY_PROPOSE_RESULT="tool_ontology_propose_result",F([A(!0,"tool_ontology_propose_result","MaiCliServerToolOntologyProposeLogicActionModel"),O("design:type",Object)],yV,"TOOL_ONTOLOGY_PROPOSE_RESULT",void 0),yV=F([f()],yV);class pa extends k{ok;data;error}class fV extends M{}fV.TOOL_ONTOLOGY_PROPOSE_INVOKE="tool_ontology_propose_invoke",F([b(!0,!0,"tool_ontology_propose_invoke"),O("design:type",Object)],fV,"TOOL_ONTOLOGY_PROPOSE_INVOKE",void 0),fV=F([h()],fV);B0();class Qb extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case fV.TOOL_ONTOLOGY_PROPOSE_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolOntologyProposeLogic",{receiver:$,input:Z},()=>dQ0(Z)),Y=N8(Q),J=new pa;k0(J,Y),this.sendActionEvent(yV.TOOL_ONTOLOGY_PROPOSE_RESULT,J,$)}}Qb=F([y(!0,yV),C(!0,fV),L()],Qb);class xV extends x{}xV.TOOL_ONTOLOGY_VALIDATE_RESULT="tool_ontology_validate_result",F([A(!0,"tool_ontology_validate_result","MaiCliServerToolOntologyValidateLogicActionModel"),O("design:type",Object)],xV,"TOOL_ONTOLOGY_VALIDATE_RESULT",void 0),xV=F([f()],xV);class la extends k{ok;data;error}class kV extends M{}kV.TOOL_ONTOLOGY_VALIDATE_INVOKE="tool_ontology_validate_invoke",F([b(!0,!0,"tool_ontology_validate_invoke"),O("design:type",Object)],kV,"TOOL_ONTOLOGY_VALIDATE_INVOKE",void 0),kV=F([h()],kV);B0();class Yb extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case kV.TOOL_ONTOLOGY_VALIDATE_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolOntologyValidateLogic",{receiver:$,input:Z},()=>rQ0(Z)),Y=N8(Q),J=new la;k0(J,Y),this.sendActionEvent(xV.TOOL_ONTOLOGY_VALIDATE_RESULT,J,$)}}Yb=F([y(!0,xV),C(!0,kV),L()],Yb);class CV extends x{}CV.TOOL_GUC_SCORE_RESULT="tool_guc_score_result",F([A(!0,"tool_guc_score_result","MaiCliServerToolGucScoreLogicActionModel"),O("design:type",Object)],CV,"TOOL_GUC_SCORE_RESULT",void 0),CV=F([f()],CV);class ca extends k{ok;data;error}class hV extends M{}hV.TOOL_GUC_SCORE_INVOKE="tool_guc_score_invoke",F([b(!0,!0,"tool_guc_score_invoke"),O("design:type",Object)],hV,"TOOL_GUC_SCORE_INVOKE",void 0),hV=F([h()],hV);B0();class Jb extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case hV.TOOL_GUC_SCORE_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolGucScoreLogic",{receiver:$,input:Z},()=>xY0(Z)),Y=N8(Q),J=new ca;k0(J,Y),this.sendActionEvent(CV.TOOL_GUC_SCORE_RESULT,J,$)}}Jb=F([y(!0,CV),C(!0,hV),L()],Jb);class MV extends x{}MV.TOOL_WORKFLOW_RESULT="tool_workflow_result",F([A(!0,"tool_workflow_result","MaiCliServerToolWorkflowLogicActionModel"),O("design:type",Object)],MV,"TOOL_WORKFLOW_RESULT",void 0),MV=F([f()],MV);class da extends k{ok;data;error}class uV extends M{}uV.TOOL_WORKFLOW_INVOKE="tool_workflow_invoke",F([b(!0,!0,"tool_workflow_invoke"),O("design:type",Object)],uV,"TOOL_WORKFLOW_INVOKE",void 0),uV=F([h()],uV);B0();class Xb extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case uV.TOOL_WORKFLOW_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWorkflowLogic",{receiver:$,input:Z},()=>LO(Z)),Y=new da;k0(Y,Q),this.sendActionEvent(MV.TOOL_WORKFLOW_RESULT,Y,$)}}Xb=F([y(!0,MV),C(!0,uV),L()],Xb);var jy0={MaiCliServerToolAdvisorLogic:cw,MaiCliServerToolAgentLogic:dw,MaiCliServerToolAskUserQuestionLogic:nw,MaiCliServerToolAskUserTextLogic:ow,MaiCliServerToolBashLogic:rw,MaiCliServerToolBriefLogic:iw,MaiCliServerToolConfigLogic:sw,MaiCliServerToolCtxInspectLogic:aw,MaiCliServerToolDiscoverSkillsLogic:tw,MaiCliServerToolEnterPlanModeLogic:ew,MaiCliServerToolEnterWorktreeLogic:D_,MaiCliServerToolExitPlanModeLogic:$_,MaiCliServerToolExitWorktreeLogic:Q_,MaiCliServerToolFileEditLogic:Y_,MaiCliServerToolFileReadLogic:J_,MaiCliServerToolFileWriteLogic:X_,MaiCliServerToolGlobLogic:V_,MaiCliServerToolGrepLogic:B_,MaiCliServerToolListMcpResourcesLogic:G_,MaiCliServerToolListPeersLogic:F_,MaiCliServerToolLoopCancelLogic:z_,MaiCliServerToolLspLogic:j_,MaiCliServerToolMcpAuthLogic:W_,MaiCliServerToolMcpLogic:H_,MaiCliServerToolMonitorLogic:O_,MaiCliServerToolNotebookEditLogic:U_,MaiCliServerToolOverflowTestLogic:N_,MaiCliServerToolPowerShellLogic:q_,MaiCliServerToolPushNotificationLogic:E_,MaiCliServerToolReadMcpResourceLogic:K_,MaiCliServerToolRemoteTriggerLogic:I_,MaiCliServerToolReplLogic:P_,MaiCliServerToolReviewArtifactLogic:w_,MaiCliServerToolScheduleCronLogic:__,MaiCliServerToolSendMessageLogic:b_,MaiCliServerToolSendUserFileLogic:R_,MaiCliServerToolSkillLogic:T_,MaiCliServerToolSleepLogic:A_,MaiCliServerToolSnipLogic:L_,MaiCliServerToolSubscribePrLogic:y_,MaiCliServerToolSuggestBackgroundPrLogic:f_,MaiCliServerToolSyntheticOutputLogic:x_,MaiCliServerToolTaskCreateLogic:k_,MaiCliServerToolTaskGetLogic:C_,MaiCliServerToolTaskListLogic:h_,MaiCliServerToolTaskOutputLogic:M_,MaiCliServerToolTaskStopLogic:u_,MaiCliServerToolTaskUpdateLogic:S_,MaiCliServerToolTeamCreateLogic:v_,MaiCliServerToolTeamDeleteLogic:g_,MaiCliServerToolTerminalCaptureLogic:m_,MaiCliServerToolTodoWriteLogic:p_,MaiCliServerToolTaskContractLogic:l_,MaiCliServerToolToolSearchLogic:c_,MaiCliServerToolTungstenLogic:d_,MaiCliServerToolVerifyPlanExecutionLogic:n_,MaiCliServerToolWebBrowserLogic:o_,MaiCliServerToolWebFetchLogic:r_,MaiCliServerToolWebSearchLogic:i_,MaiCliServerToolWikiIndexLogic:s_,MaiCliServerToolWikiIngestPrepLogic:a_,MaiCliServerToolWikiLintLogic:t_,MaiCliServerToolWikiReviewLogic:e_,MaiCliServerToolWikiSearchLogic:Db,MaiCliServerToolOntologySchemaLogic:$b,MaiCliServerToolOntologyGraphLogic:Zb,MaiCliServerToolOntologyProposeLogic:Qb,MaiCliServerToolOntologyValidateLogic:Yb,MaiCliServerToolGucScoreLogic:Jb,MaiCliServerToolWorkflowLogic:Xb},Wy0={MaiCliServerToolAdvisorLogicActionKeys:XX,MaiCliServerToolAgentLogicActionKeys:BX,MaiCliServerToolAskUserQuestionLogicActionKeys:FX,MaiCliServerToolAskUserTextLogicActionKeys:jX,MaiCliServerToolBashLogicActionKeys:HX,MaiCliServerToolBriefLogicActionKeys:UX,MaiCliServerToolConfigLogicActionKeys:qX,MaiCliServerToolCtxInspectLogicActionKeys:KX,MaiCliServerToolDiscoverSkillsLogicActionKeys:PX,MaiCliServerToolEnterPlanModeLogicActionKeys:_X,MaiCliServerToolEnterWorktreeLogicActionKeys:RX,MaiCliServerToolExitPlanModeLogicActionKeys:AX,MaiCliServerToolExitWorktreeLogicActionKeys:yX,MaiCliServerToolFileEditLogicActionKeys:xX,MaiCliServerToolFileReadLogicActionKeys:CX,MaiCliServerToolFileWriteLogicActionKeys:MX,MaiCliServerToolGlobLogicActionKeys:SX,MaiCliServerToolGrepLogicActionKeys:gX,MaiCliServerToolListMcpResourcesLogicActionKeys:pX,MaiCliServerToolListPeersLogicActionKeys:cX,MaiCliServerToolLoopCancelLogicActionKeys:nX,MaiCliServerToolLspLogicActionKeys:rX,MaiCliServerToolMcpAuthLogicActionKeys:sX,MaiCliServerToolMcpLogicActionKeys:tX,MaiCliServerToolMonitorLogicActionKeys:D2,MaiCliServerToolNotebookEditLogicActionKeys:Z2,MaiCliServerToolOverflowTestLogicActionKeys:Y2,MaiCliServerToolPowerShellLogicActionKeys:X2,MaiCliServerToolPushNotificationLogicActionKeys:B2,MaiCliServerToolReadMcpResourceLogicActionKeys:F2,MaiCliServerToolRemoteTriggerLogicActionKeys:j2,MaiCliServerToolReplLogicActionKeys:H2,MaiCliServerToolReviewArtifactLogicActionKeys:U2,MaiCliServerToolScheduleCronLogicActionKeys:q2,MaiCliServerToolSendMessageLogicActionKeys:K2,MaiCliServerToolSendUserFileLogicActionKeys:P2,MaiCliServerToolSkillLogicActionKeys:_2,MaiCliServerToolSleepLogicActionKeys:R2,MaiCliServerToolSnipLogicActionKeys:A2,MaiCliServerToolSubscribePrLogicActionKeys:y2,MaiCliServerToolSuggestBackgroundPrLogicActionKeys:x2,MaiCliServerToolSyntheticOutputLogicActionKeys:C2,MaiCliServerToolTaskCreateLogicActionKeys:M2,MaiCliServerToolTaskGetLogicActionKeys:S2,MaiCliServerToolTaskListLogicActionKeys:g2,MaiCliServerToolTaskOutputLogicActionKeys:p2,MaiCliServerToolTaskStopLogicActionKeys:c2,MaiCliServerToolTaskUpdateLogicActionKeys:n2,MaiCliServerToolTeamCreateLogicActionKeys:r2,MaiCliServerToolTeamDeleteLogicActionKeys:s2,MaiCliServerToolTerminalCaptureLogicActionKeys:t2,MaiCliServerToolTodoWriteLogicActionKeys:DV,MaiCliServerToolTaskContractLogicActionKeys:ZV,MaiCliServerToolToolSearchLogicActionKeys:YV,MaiCliServerToolTungstenLogicActionKeys:XV,MaiCliServerToolVerifyPlanExecutionLogicActionKeys:BV,MaiCliServerToolWebBrowserLogicActionKeys:FV,MaiCliServerToolWebFetchLogicActionKeys:jV,MaiCliServerToolWebSearchLogicActionKeys:HV,MaiCliServerToolWikiIndexLogicActionKeys:UV,MaiCliServerToolWikiIngestPrepLogicActionKeys:qV,MaiCliServerToolWikiLintLogicActionKeys:KV,MaiCliServerToolWikiReviewLogicActionKeys:PV,MaiCliServerToolWikiSearchLogicActionKeys:_V,MaiCliServerToolOntologySchemaLogicActionKeys:RV,MaiCliServerToolOntologyGraphLogicActionKeys:AV,MaiCliServerToolOntologyProposeLogicActionKeys:yV,MaiCliServerToolOntologyValidateLogicActionKeys:xV,MaiCliServerToolGucScoreLogicActionKeys:CV,MaiCliServerToolWorkflowLogicActionKeys:MV},Hy0={MaiCliServerToolAdvisorLogicStateKeys:VX,MaiCliServerToolAgentLogicStateKeys:GX,MaiCliServerToolAskUserQuestionLogicStateKeys:zX,MaiCliServerToolAskUserTextLogicStateKeys:WX,MaiCliServerToolBashLogicStateKeys:OX,MaiCliServerToolBriefLogicStateKeys:NX,MaiCliServerToolConfigLogicStateKeys:EX,MaiCliServerToolCtxInspectLogicStateKeys:IX,MaiCliServerToolDiscoverSkillsLogicStateKeys:wX,MaiCliServerToolEnterPlanModeLogicStateKeys:bX,MaiCliServerToolEnterWorktreeLogicStateKeys:TX,MaiCliServerToolExitPlanModeLogicStateKeys:LX,MaiCliServerToolExitWorktreeLogicStateKeys:fX,MaiCliServerToolFileEditLogicStateKeys:kX,MaiCliServerToolFileReadLogicStateKeys:hX,MaiCliServerToolFileWriteLogicStateKeys:uX,MaiCliServerToolGlobLogicStateKeys:vX,MaiCliServerToolGrepLogicStateKeys:mX,MaiCliServerToolListMcpResourcesLogicStateKeys:lX,MaiCliServerToolListPeersLogicStateKeys:dX,MaiCliServerToolLoopCancelLogicStateKeys:oX,MaiCliServerToolLspLogicStateKeys:iX,MaiCliServerToolMcpAuthLogicStateKeys:aX,MaiCliServerToolMcpLogicStateKeys:eX,MaiCliServerToolMonitorLogicStateKeys:$2,MaiCliServerToolNotebookEditLogicStateKeys:Q2,MaiCliServerToolOverflowTestLogicStateKeys:J2,MaiCliServerToolPowerShellLogicStateKeys:V2,MaiCliServerToolPushNotificationLogicStateKeys:G2,MaiCliServerToolReadMcpResourceLogicStateKeys:z2,MaiCliServerToolRemoteTriggerLogicStateKeys:W2,MaiCliServerToolReplLogicStateKeys:O2,MaiCliServerToolReviewArtifactLogicStateKeys:N2,MaiCliServerToolScheduleCronLogicStateKeys:E2,MaiCliServerToolSendMessageLogicStateKeys:I2,MaiCliServerToolSendUserFileLogicStateKeys:w2,MaiCliServerToolSkillLogicStateKeys:b2,MaiCliServerToolSleepLogicStateKeys:T2,MaiCliServerToolSnipLogicStateKeys:L2,MaiCliServerToolSubscribePrLogicStateKeys:f2,MaiCliServerToolSuggestBackgroundPrLogicStateKeys:k2,MaiCliServerToolSyntheticOutputLogicStateKeys:h2,MaiCliServerToolTaskCreateLogicStateKeys:u2,MaiCliServerToolTaskGetLogicStateKeys:v2,MaiCliServerToolTaskListLogicStateKeys:m2,MaiCliServerToolTaskOutputLogicStateKeys:l2,MaiCliServerToolTaskStopLogicStateKeys:d2,MaiCliServerToolTaskUpdateLogicStateKeys:o2,MaiCliServerToolTeamCreateLogicStateKeys:i2,MaiCliServerToolTeamDeleteLogicStateKeys:a2,MaiCliServerToolTerminalCaptureLogicStateKeys:e2,MaiCliServerToolTodoWriteLogicStateKeys:$V,MaiCliServerToolTaskContractLogicStateKeys:QV,MaiCliServerToolToolSearchLogicStateKeys:JV,MaiCliServerToolTungstenLogicStateKeys:VV,MaiCliServerToolVerifyPlanExecutionLogicStateKeys:GV,MaiCliServerToolWebBrowserLogicStateKeys:zV,MaiCliServerToolWebFetchLogicStateKeys:WV,MaiCliServerToolWebSearchLogicStateKeys:OV,MaiCliServerToolWikiIndexLogicStateKeys:NV,MaiCliServerToolWikiIngestPrepLogicStateKeys:EV,MaiCliServerToolWikiLintLogicStateKeys:IV,MaiCliServerToolWikiReviewLogicStateKeys:wV,MaiCliServerToolWikiSearchLogicStateKeys:bV,MaiCliServerToolOntologySchemaLogicStateKeys:TV,MaiCliServerToolOntologyGraphLogicStateKeys:LV,MaiCliServerToolOntologyProposeLogicStateKeys:fV,MaiCliServerToolOntologyValidateLogicStateKeys:kV,MaiCliServerToolGucScoreLogicStateKeys:hV,MaiCliServerToolWorkflowLogicStateKeys:uV};class SV extends x{}SV.SHELL_DOCTOR_SCREEN_RESULT="shell_doctor_screen_result",F([A(!0,"shell_doctor_screen_result","MscCliShellDoctorScreenLogicActionModel"),O("design:type",Object)],SV,"SHELL_DOCTOR_SCREEN_RESULT",void 0),SV=F([f()],SV);class na extends k{ok;data;error}class vV extends M{}vV.SHELL_DOCTOR_SCREEN_INVOKE="shell_doctor_screen_invoke",F([b(!0,!0,"shell_doctor_screen_invoke"),O("design:type",Object)],vV,"SHELL_DOCTOR_SCREEN_INVOKE",void 0),vV=F([h()],vV);class Vb extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case vV.SHELL_DOCTOR_SCREEN_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}handleInvoke(D,$){let Z=new na;Z.ok=!0,this.sendActionEvent(SV.SHELL_DOCTOR_SCREEN_RESULT,Z,$)}}Vb=F([y(!0,SV),C(!0,vV),L()],Vb);class gV extends x{}gV.SHELL_RESUME_SCREEN_RESULT="shell_resume_screen_result",F([A(!0,"shell_resume_screen_result","MscCliShellResumeScreenLogicActionModel"),O("design:type",Object)],gV,"SHELL_RESUME_SCREEN_RESULT",void 0),gV=F([f()],gV);class oa extends k{ok;data;error}class mV extends M{}mV.SHELL_RESUME_SCREEN_INVOKE="shell_resume_screen_invoke",F([b(!0,!0,"shell_resume_screen_invoke"),O("design:type",Object)],mV,"SHELL_RESUME_SCREEN_INVOKE",void 0),mV=F([h()],mV);class Bb extends T{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case mV.SHELL_RESUME_SCREEN_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}handleInvoke(D,$){let Z=new oa;Z.ok=!0,this.sendActionEvent(gV.SHELL_RESUME_SCREEN_RESULT,Z,$)}}Bb=F([y(!0,gV),C(!0,mV),L()],Bb);class ra extends AD{handleActionEvent(D){super.handleActionEvent(D)}}class ia extends AD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class sa extends AD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class aa extends AD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class ta extends AD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class ea extends AD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class Dt extends AD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class $t extends AD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class Zt extends AD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class Qt extends AD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class Yt{_dsl={mai_cli_server_dsl:Q10,cli_doctor_screen_dsl:Y10,cli_resume_screen_dsl:J10};_view={};_logic={...xA0,...Yb0,...jy0,...Rb0,...Nb0,...SA0,...Gb0,...oA0,...h_0,MscCliShellDoctorScreenLogic:Vb,MscCliShellResumeScreenLogic:Bb};_workflow={MaiCliServerRouterWorkflow:ra,MaiCliServerCoreWorkflow:ia,MaiCliServerToolWorkflow:sa,MaiCliServerServiceWorkflow:aa,MaiCliServerCommandWorkflow:ta,MaiCliServerRemoteWorkflow:ea,MaiCliServerSwarmWorkflow:Dt,MaiCliServerExtensionWorkflow:$t,CliDoctorScreenWorkflow:Zt,CliResumeScreenWorkflow:Qt};_actionKeys={...kA0,...Jb0,...Wy0,...Tb0,...qb0,...vA0,...Fb0,...rA0,...M_0,MscCliShellDoctorScreenLogicActionKeys:SV,MscCliShellResumeScreenLogicActionKeys:gV};_stateKeys={...CA0,...Xb0,...Hy0,...Ab0,...Eb0,...gA0,...zb0,...iA0,...u_0,MscCliShellDoctorScreenLogicStateKeys:vV,MscCliShellResumeScreenLogicStateKeys:mV};_sidecar={};appId(){return"stem"}view(D){return this._view[D]}logic(D){return this._logic[D]}workflow(D){return this._workflow[D]}dsl(D){return this._dsl[D]}actionKeys(D){return this._actionKeys[D]}stateKeys(D){return this._stateKeys[D]}sidecar(D){return this._sidecar[D]}}var Jt=process.env.NEXT_PUBLIC_MSC_LOG_OPEN==="true";function oH1(D){if(D===null||D===void 0)return null;if(typeof D==="string")return D;try{return JSON.stringify(D)}catch{return null}}function Xt(D){if(D==="???")console.warn("[MscLog] tag is missing, caller stack:",Error().stack)}function Vt(D,$,Z){let Q=oH1(Z);if(Q!==null)return`${D} ${$}
2417
- ${Q}`;return`${D} ${$}`}function rH1(D,$,Z="???"){if(Jt)Xt(Z),console.log(Vt(`[MscInfo | ${Z}]`,D,$))}function iH1(D,$,Z="???"){if(Jt)Xt(Z),console.warn(Vt(`[MscWarn | ${Z}]`,D,$))}function sH1(D,$,Z="???"){if(Jt)Xt(Z),console.error(Vt(`[MscError | ${Z}]`,D,$))}var Rk={infoLog:rH1,warnLog:iH1,errorLog:sH1};function aH1(D,$,Z){Rk.infoLog($,Z,D)}function tH1(D,$,Z){Rk.warnLog($,Z,D)}function eH1(D,$,Z){Rk.errorLog($,Z,D)}var sO={trackInfo:aH1,trackWarn:tH1,trackError:eH1};class Bt{dsl;debug;mscInstance;requestCount=0;constructor(D,$){if(this.debug=$,!m8.isRegistryMscEnv())m8.registryMscEnv(new Yt);this.handleContainerDsl(D)}handleContainerDsl(D){let $=m8.MscEnv().dsl(D);if($)$(),this.dsl=D}handlerCreateContainer(D){if(!this.mscInstance&&this.dsl)this.mscInstance=new L00(this.debug).dls(this.dsl).observer({handleActionEvent($){D.onActionEvent($)},handleStateEvent($){D.onStateEvent($)},handleLifecycleEvent($){D.onLifecycleEvent($)},handleErrorEvent($){D.onErrorEvent($)}}).build(),this.mscInstance.install()}handleDestroyContainer(){try{if(this.mscInstance)this.mscInstance.uninstall(),this.mscInstance=null}catch(D){sO.trackError("MscCliContainer",`handleDestroyContainer error: ${D}`)}}handleContainerStateEvent(D){if(this.requestCount++,this.requestCount%1000===0){let $=process.memoryUsage();sO.trackInfo("MscCliContainer",`[MemProbe] dsl=${this.dsl} req#${this.requestCount} heapUsed=${($.heapUsed/1024/1024).toFixed(1)}MB heapTotal=${($.heapTotal/1024/1024).toFixed(1)}MB external=${($.external/1024/1024).toFixed(1)}MB`)}if(this.mscInstance)this.mscInstance.sendState(D)}}class Gt{listeners=new Set;addListener(D){this.listeners.add(D)}removeListener(D){this.listeners.delete(D)}onActionEvent(D){this.listeners.forEach(($)=>$.onActionEvent(D))}onStateEvent(D){this.listeners.forEach(($)=>$.onStateEvent(D))}onLifecycleEvent(D){this.listeners.forEach(($)=>$.onLifecycleEvent(D))}onErrorEvent(D){this.listeners.forEach(($)=>$.onErrorEvent(D))}}var DO1=600000;class A${static _instanceKey=Symbol.for("MscCliManager");static getInstance(){let D=globalThis;if(!D[A$._instanceKey])D[A$._instanceKey]=new A$;return D[A$._instanceKey]}constructor(){}entries=new Map;reuseCount=new Map;getServerContainer(D){let $=this.entries.get(D);if($){let Z=(this.reuseCount.get(D)??0)+1;if(this.reuseCount.set(D,Z),Z%1000===0)sO.trackInfo("MscCliManager",`MscCliContainer Reuse #${Z} for dsl: ${D}, tag: ${$.tag}`)}else{let Z=Date.now().toString();sO.trackInfo("MscCliManager",`MscCliContainer Create for dsl: ${D}, tag: ${Z}`);let Q=new Bt(D),Y=new Gt,J=new Map,X={onActionEvent(V){let B=J.get(V.getReceiver());if(B){if(B.timing.t3=Date.now(),B.timer)clearTimeout(B.timer);J.delete(V.getReceiver());let G=V.getModel();B.resolve({receiver:V.getReceiver(),model:G,tag:Z,timing:B.timing})}},onErrorEvent(V){let B=J.get(V.getReceiver());if(B){if(B.timing.t3=Date.now(),B.timer)clearTimeout(B.timer);J.delete(V.getReceiver()),B.reject({receiver:V.getReceiver(),error:V.getMessage(),tag:Z,timing:B.timing})}},onLifecycleEvent(V){},onStateEvent(V){}};Y.addListener(X),Q.handlerCreateContainer(Y),$={container:Q,listener:Y,pendingRequests:J,tag:Z},this.entries.set(D,$)}return $}warmupContainer(D){this.getServerContainer(D)}handleContainerEvent(D,$,Z=DO1){let Q=Date.now(),{container:Y,pendingRequests:J}=this.getServerContainer(D),X=Date.now();if(J.has($.sender))return Promise.reject({error:`request ${$.sender} is already in progress`});return new Promise((V,B)=>{let G=setTimeout(()=>{J.delete($.sender),B({error:`request ${$.sender} timed out after ${Z}ms`})},Z),z={t0:Q,t1:X,t2:0,t3:0},j=Date.now();z.t2=j,J.set($.sender,{resolve:V,reject:B,timer:G,timing:z}),Y.handleContainerStateEvent($)})}bumpRequestTimer(D,$,Z){let Q=this.entries.get(D);if(!Q)return!1;let Y=Q.pendingRequests.get($);if(!Y)return!1;if(Y.timer)clearTimeout(Y.timer);if(Z===null)return Y.timer=null,!0;return Y.timer=setTimeout(()=>{Q.pendingRequests.delete($),Y.reject({error:`request ${$} idle for ${Z}ms`})},Z),!0}handleContainerDestroy(D){let $=this.entries.get(D);if($){for(let[,Z]of $.pendingRequests){if(Z.timer)clearTimeout(Z.timer);Z.reject({error:`container destroyed for dsl: ${D}`})}$.pendingRequests.clear(),$.container.handleDestroyContainer(),this.entries.delete(D)}}}vD();vD();j7();import{mkdirSync as $O1}from"node:fs";import{join as ZO1}from"node:path";function Oy0(D=process.env.CALLER_DIR||process.cwd()){if(!rz())return;let $=[d8(D),ZO1(x8(),"projects"),...nC.map((Z)=>oC(Z,D))];for(let Z of $)try{$O1(Z,{recursive:!0})}catch{}}var Tk="mai_cli_server_dsl";function QO1(){process.stdout.write(JSON.stringify({ok:!0,app:"stem",mode:"daemon",dsl:Tk,version:{VERSION:"0.0.25",PACKAGE_URL:"@mortiseai/stem",NATIVE_PACKAGE_URL:"@mortiseai/stem",BUILD_TIME:"2026-09-03T11:23:51.892Z",FEEDBACK_CHANNEL:"npm",MSC_ENGINE_VERSION:"0.0.3"}.VERSION},null,2)+`
2417
+ ${Q}`;return`${D} ${$}`}function rH1(D,$,Z="???"){if(Jt)Xt(Z),console.log(Vt(`[MscInfo | ${Z}]`,D,$))}function iH1(D,$,Z="???"){if(Jt)Xt(Z),console.warn(Vt(`[MscWarn | ${Z}]`,D,$))}function sH1(D,$,Z="???"){if(Jt)Xt(Z),console.error(Vt(`[MscError | ${Z}]`,D,$))}var Rk={infoLog:rH1,warnLog:iH1,errorLog:sH1};function aH1(D,$,Z){Rk.infoLog($,Z,D)}function tH1(D,$,Z){Rk.warnLog($,Z,D)}function eH1(D,$,Z){Rk.errorLog($,Z,D)}var sO={trackInfo:aH1,trackWarn:tH1,trackError:eH1};class Bt{dsl;debug;mscInstance;requestCount=0;constructor(D,$){if(this.debug=$,!m8.isRegistryMscEnv())m8.registryMscEnv(new Yt);this.handleContainerDsl(D)}handleContainerDsl(D){let $=m8.MscEnv().dsl(D);if($)$(),this.dsl=D}handlerCreateContainer(D){if(!this.mscInstance&&this.dsl)this.mscInstance=new L00(this.debug).dls(this.dsl).observer({handleActionEvent($){D.onActionEvent($)},handleStateEvent($){D.onStateEvent($)},handleLifecycleEvent($){D.onLifecycleEvent($)},handleErrorEvent($){D.onErrorEvent($)}}).build(),this.mscInstance.install()}handleDestroyContainer(){try{if(this.mscInstance)this.mscInstance.uninstall(),this.mscInstance=null}catch(D){sO.trackError("MscCliContainer",`handleDestroyContainer error: ${D}`)}}handleContainerStateEvent(D){if(this.requestCount++,this.requestCount%1000===0){let $=process.memoryUsage();sO.trackInfo("MscCliContainer",`[MemProbe] dsl=${this.dsl} req#${this.requestCount} heapUsed=${($.heapUsed/1024/1024).toFixed(1)}MB heapTotal=${($.heapTotal/1024/1024).toFixed(1)}MB external=${($.external/1024/1024).toFixed(1)}MB`)}if(this.mscInstance)this.mscInstance.sendState(D)}}class Gt{listeners=new Set;addListener(D){this.listeners.add(D)}removeListener(D){this.listeners.delete(D)}onActionEvent(D){this.listeners.forEach(($)=>$.onActionEvent(D))}onStateEvent(D){this.listeners.forEach(($)=>$.onStateEvent(D))}onLifecycleEvent(D){this.listeners.forEach(($)=>$.onLifecycleEvent(D))}onErrorEvent(D){this.listeners.forEach(($)=>$.onErrorEvent(D))}}var DO1=600000;class A${static _instanceKey=Symbol.for("MscCliManager");static getInstance(){let D=globalThis;if(!D[A$._instanceKey])D[A$._instanceKey]=new A$;return D[A$._instanceKey]}constructor(){}entries=new Map;reuseCount=new Map;getServerContainer(D){let $=this.entries.get(D);if($){let Z=(this.reuseCount.get(D)??0)+1;if(this.reuseCount.set(D,Z),Z%1000===0)sO.trackInfo("MscCliManager",`MscCliContainer Reuse #${Z} for dsl: ${D}, tag: ${$.tag}`)}else{let Z=Date.now().toString();sO.trackInfo("MscCliManager",`MscCliContainer Create for dsl: ${D}, tag: ${Z}`);let Q=new Bt(D),Y=new Gt,J=new Map,X={onActionEvent(V){let B=J.get(V.getReceiver());if(B){if(B.timing.t3=Date.now(),B.timer)clearTimeout(B.timer);J.delete(V.getReceiver());let G=V.getModel();B.resolve({receiver:V.getReceiver(),model:G,tag:Z,timing:B.timing})}},onErrorEvent(V){let B=J.get(V.getReceiver());if(B){if(B.timing.t3=Date.now(),B.timer)clearTimeout(B.timer);J.delete(V.getReceiver()),B.reject({receiver:V.getReceiver(),error:V.getMessage(),tag:Z,timing:B.timing})}},onLifecycleEvent(V){},onStateEvent(V){}};Y.addListener(X),Q.handlerCreateContainer(Y),$={container:Q,listener:Y,pendingRequests:J,tag:Z},this.entries.set(D,$)}return $}warmupContainer(D){this.getServerContainer(D)}handleContainerEvent(D,$,Z=DO1){let Q=Date.now(),{container:Y,pendingRequests:J}=this.getServerContainer(D),X=Date.now();if(J.has($.sender))return Promise.reject({error:`request ${$.sender} is already in progress`});return new Promise((V,B)=>{let G=setTimeout(()=>{J.delete($.sender),B({error:`request ${$.sender} timed out after ${Z}ms`})},Z),z={t0:Q,t1:X,t2:0,t3:0},j=Date.now();z.t2=j,J.set($.sender,{resolve:V,reject:B,timer:G,timing:z}),Y.handleContainerStateEvent($)})}bumpRequestTimer(D,$,Z){let Q=this.entries.get(D);if(!Q)return!1;let Y=Q.pendingRequests.get($);if(!Y)return!1;if(Y.timer)clearTimeout(Y.timer);if(Z===null)return Y.timer=null,!0;return Y.timer=setTimeout(()=>{Q.pendingRequests.delete($),Y.reject({error:`request ${$} idle for ${Z}ms`})},Z),!0}handleContainerDestroy(D){let $=this.entries.get(D);if($){for(let[,Z]of $.pendingRequests){if(Z.timer)clearTimeout(Z.timer);Z.reject({error:`container destroyed for dsl: ${D}`})}$.pendingRequests.clear(),$.container.handleDestroyContainer(),this.entries.delete(D)}}}vD();vD();j7();import{mkdirSync as $O1}from"node:fs";import{join as ZO1}from"node:path";function Oy0(D=process.env.CALLER_DIR||process.cwd()){if(!rz())return;let $=[d8(D),ZO1(x8(),"projects"),...nC.map((Z)=>oC(Z,D))];for(let Z of $)try{$O1(Z,{recursive:!0})}catch{}}var Tk="mai_cli_server_dsl";function QO1(){process.stdout.write(JSON.stringify({ok:!0,app:"stem",mode:"daemon",dsl:Tk,version:{VERSION:"0.0.26",PACKAGE_URL:"@mortiseai/stem",NATIVE_PACKAGE_URL:"@mortiseai/stem",BUILD_TIME:"2026-09-04T01:29:23.107Z",FEEDBACK_CHANNEL:"npm",MSC_ENGINE_VERSION:"0.0.3"}.VERSION},null,2)+`
2418
2418
  `)}function YO1(){let D=($)=>{try{A$.getInstance().handleContainerDestroy(Tk)}finally{process.stderr.write(q("daemon.stopped",{signal:$})+`
2419
2419
  `),process.exit($==="SIGTERM"?143:130)}};process.on("SIGTERM",()=>D("SIGTERM")),process.on("SIGINT",()=>D("SIGINT"))}function JO1(D=process.argv.slice(2)){let{locale:$,cleanedArgv:Z}=SC(D);F10($);let{cleanedArgv:Q}=Nb(Z);if(process.env.STEM_TENANT_INVALID!==void 0)process.stderr.write((process.env.STEM_TENANT_INVALID_NPM?q("errors.invalidTenantNpmForm"):q("errors.invalidTenant",{code:process.env.STEM_TENANT_INVALID,rule:String(Eb)}))+`
2420
2420
  `),process.exit(1);let{cleanedArgv:Y}=qb(Q);if(process.env.STEM_USER_INVALID!==void 0)process.stderr.write(q("errors.invalidUser",{code:process.env.STEM_USER_INVALID,rule:String(Eb)})+`
2421
2421
  `),process.exit(1);D=Y;let J=D[0]??"run";if(J==="status"){QO1();return}if(J!=="run")process.stderr.write(q("daemon.unknownCommand",{command:J})+`
2422
- `),process.exit(1);Oy0(),A$.getInstance().warmupContainer(Tk),YO1(),process.stderr.write(q("daemon.running",{dsl:Tk,version:{VERSION:"0.0.25",PACKAGE_URL:"@mortiseai/stem",NATIVE_PACKAGE_URL:"@mortiseai/stem",BUILD_TIME:"2026-09-03T11:23:51.892Z",FEEDBACK_CHANNEL:"npm",MSC_ENGINE_VERSION:"0.0.3"}.VERSION})+`
2422
+ `),process.exit(1);Oy0(),A$.getInstance().warmupContainer(Tk),YO1(),process.stderr.write(q("daemon.running",{dsl:Tk,version:{VERSION:"0.0.26",PACKAGE_URL:"@mortiseai/stem",NATIVE_PACKAGE_URL:"@mortiseai/stem",BUILD_TIME:"2026-09-04T01:29:23.107Z",FEEDBACK_CHANNEL:"npm",MSC_ENGINE_VERSION:"0.0.3"}.VERSION})+`
2423
2423
  `),setInterval(()=>{},1073741824)}JO1();export{JO1 as startDaemon};
package/dist/mcp.mjs CHANGED
@@ -2240,7 +2240,7 @@ Prefer these manifest-derived commands over guessing flags from another test run
2240
2240
 
2241
2241
  BROWSER ROUTING FOR THIS TURN: This is a UI/frontend coding task with browser verification available from ${D.servers.join(", ")}. Browser tool schemas are deferred during locate/edit work to keep requests small; they activate automatically after focused static verification or when a completion claim needs runtime verification. If live inspection is genuinely needed earlier, use ToolSearch to activate the exact browser tools. Do not build an alternate browser driver through Bash. Before starting a local dev server, probe the exact intended URL once and reuse a working server. Reaching a generic root, about:blank, or an authentication redirect does not verify the changed UI; reach and inspect the target state, or report the blocker explicitly.`;return`
2242
2242
 
2243
- BROWSER ROUTING FOR THIS TURN: Browser interaction is part of the requested verification and MCP browser tools from ${D.servers.join(", ")} are available. Use those MCP tools for runtime page interaction: take a text snapshot, act on its uid, then inspect the resulting page state and console. Do not automate Chrome through Bash, AppleScript, a raw remote-debugging port, hand-written CDP, Playwright, or Puppeteer. Before starting a local dev server, probe the exact intended URL once and reuse a working server. A generic root, about:blank, or authentication redirect is not successful target-state verification. If list_pages returns no pages, that is an empty isolated browser profile, not a connection failure: call new_page for the intended local URL, then navigate/inspect it. If the app redirects to a local sign-in page, inspect that page so the local login-recovery flow can continue.`}return"\n\nBROWSER ROUTING FOR THIS TURN: The request needs browser interaction, but no browser MCP tool is present in the refreshed tool pool. Do not search for or build an alternative browser driver through Bash, AppleScript, raw CDP, Playwright, or Puppeteer. You may continue with static diagnosis and targeted tests, but the final response must explicitly say that runtime browser verification was unavailable and direct the user to run `/chrome connect`."}function $A0(D){if(!D||typeof D!=="object")return!1;let $=D.command;if(typeof $!=="string"||fj1.test($))return!1;return xj1.test($)}function Sj1(D){return y7(D)&&kj1.has(sO(D))}function vj1(D){return y7(D)&&Cj1.has(sO(D))}function ZA0(D){let $={...D.state},Z=D.blockerCode||null;if(Sj1(D.toolName)){if($.actionSucceeded=!0,Z)$.blockerCode=Z,$.verified=!1;else if($.verified=D.toolVerified===!0,$.verified)$.blockerCode=null;if($.verified)$.inspectionSucceeded=!0;return $}if(!vj1(D.toolName))return $;if($.inspectionSucceeded=!0,Z)$.blockerCode=Z,$.verified=!1;else if(sO(D.toolName)==="take_snapshot"&&($.actionSucceeded||D.filesChanged))$.blockerCode=null,$.verified=!0;return $}function qs(D){if(!D.route.intent||!D.filesChanged&&!D.browserActionSucceeded||D.browserVerified)return!1;if(typeof D.message!=="string"||!hj1.test(D.message))return!1;return D.route.available||!Mj1.test(D.message)}function Es(D,$){if($==="authentication-required")return"Browser verification reached an authentication page instead of the target UI. Do not keep retrying or claim success. Report that sign-in is required and ask the user to authenticate before runtime verification can continue.";if($==="blank-page")return"Browser verification is still on about:blank, so the target UI was not inspected. Navigate to the exact target URL and inspect its resulting page state, or report the navigation blocker explicitly.";if($==="web-server-starting")return"The local Web target refused the browser connection while its background server task was starting. Wait for that task to become ready, then inspect the original target URL; if the task exits, diagnose its startup output instead of claiming browser verification succeeded.";return D.available?"This UI change has not completed runtime browser verification. Use the available Chrome DevTools MCP tools to perform the interaction and inspect the resulting page/console before claiming it is fixed. If verification is blocked, report the blocker explicitly instead of claiming success.":"No browser MCP tool is available, so this UI change cannot be claimed as runtime-verified. Finish with an explicit 'static checks only; browser verification unavailable' disclosure and ask the user to run `/chrome connect`."}var gj1=/(?:批量|全量|整个仓库|所有文件|大规模|迁移|重构|batch|repository[- ]wide|all files|large[- ]scale|migration|refactor)/i,QA0={normal:{softIterations:8,maxIterations:24,softDurationMs:90000,maxDurationMs:300000,discoverySoftLimit:6},complex:{softIterations:16,maxIterations:40,softDurationMs:180000,maxDurationMs:600000,discoverySoftLimit:10},bulk:{softIterations:24,maxIterations:50,softDurationMs:300000,maxDurationMs:900000,discoverySoftLimit:16}};function YA0(D,$){let Z=Ck(D),Q=Os(Z),Y=gj1.test(Z)?"bulk":Hs(Z)?"complex":"normal";return JA0(Y,$,Y==="bulk"?"bulk-keyword":Q?"multi-target-change":Y==="complex"?"complex-signal":"normal")}function JA0(D,$,Z="normal"){let Q=QA0[D];return{...Q,maxIterations:$==="agent"?50:null,maxDurationMs:$==="agent"?Q.maxDurationMs:null,class:D,classificationReason:Z,mode:$}}function hk(D,$){if(!$||QA0[$].discoverySoftLimit<=D.discoverySoftLimit)return D;return JA0($,D.mode,"retained-continuation")}function XA0(D){let $=D.mode==="fde"?"FDE":D.mode==="coding"?"Coding":"Agent",Z=D.capReason==="duration"?typeof D.maxDurationMs==="number"?`${Math.round(D.maxDurationMs/60000)}-minute wall-clock`:"wall-clock":typeof D.maxIterations==="number"?`${D.maxIterations}-iteration`:"iteration";return`[paused] ${$} mode reached this ${D.budgetClass} turn's recoverable ${Z} execution limit before the task finished. All progress is preserved. `+'Continue? Reply "continue" or "继续" to resume from the current context; send a new '+"request to stop here and change direction."}import{resolve as VA0}from"node:path";function GA0(D){if(!D.interactive)return null;if(D.mode!=="coding"&&D.mode!=="fde")return null;if(D.blockerCode==="authentication-required")return"authentication-required";if(D.blockerCode==="web-server-starting"&&D.hasRunningWebTask)return"web-server-starting";return null}function aO(D){if(!D)return;try{let $=new URL(D);return $.username="",$.password="",$.search="",$.hash="",$.toString()}catch{let $=D.split(/[?#]/,1)[0]?.trim();return $?$.slice(0,500):void 0}}var mj1=/(?:\b(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?(?:dev|start|serve)\b|\bnpx\s+(?:next|vite|serve|http-server)\b|\bnext\s+dev\b|\bvite(?:\s|$)|\bastro\s+dev\b|\bnuxt\s+dev\b|webpack-dev-server|react-scripts\s+start|\bpython3?\s+-m\s+http\.server\b)/i,pj1=/(?:\bready\s+(?:in|on|at)\b|\blocal:\s*https?:\/\/|\blistening\s+(?:on|at)\b|\bserver\s+(?:is\s+)?(?:running|ready|started)\b|\bstarted\s+server\b|compiled successfully)/i;function FA0(D){if(!D)return;try{let $=new URL(D);return $.port||($.protocol==="https:"?"443":"80")}catch{return}}function BA0(D){let $=new Set;for(let Z of D.matchAll(/https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])(?::(\d{1,5}))?/gi))$.add(Z[1]??(/^https:/i.test(Z[0])?"443":"80"));for(let Z of D.matchAll(/(?:--port(?:=|\s+)|(?:^|\s)-p\s+)(\d{1,5})(?=\s|$)/gi))$.add(Z[1]);for(let Z of D.matchAll(/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\]):(\d{1,5})/gi))$.add(Z[1]);for(let Z of D.matchAll(/(?:^|\s)(?:PORT|VITE_PORT|NEXT_PORT)=(\d{1,5})(?=\s|$)/gi))$.add(Z[1]);return $}function lj1(D,$){try{return VA0(D)===VA0($)}catch{return D===$}}function zA0(D,$,Z){let Q=FA0($),Y=[];for(let V of D){if(V.kind!=="local-shell"||V.state!=="running")continue;let B=V.lines.slice(-80).join(`
2243
+ BROWSER ROUTING FOR THIS TURN: Browser interaction is part of the requested verification and MCP browser tools from ${D.servers.join(", ")} are available. Use those MCP tools for runtime page interaction: take a text snapshot, act on its uid, then inspect the resulting page state and console. Do not automate Chrome through Bash, AppleScript, a raw remote-debugging port, hand-written CDP, Playwright, or Puppeteer. Before starting a local dev server, probe the exact intended URL once and reuse a working server. A generic root, about:blank, or authentication redirect is not successful target-state verification. If list_pages returns no pages, that is an empty isolated browser profile, not a connection failure: call new_page for the intended local URL, then navigate/inspect it. If the app redirects to a local sign-in page, inspect that page so the local login-recovery flow can continue.`}return"\n\nBROWSER ROUTING FOR THIS TURN: The request needs browser interaction, but no browser MCP tool is present in the refreshed tool pool. Do not search for or build an alternative browser driver through Bash, AppleScript, raw CDP, Playwright, or Puppeteer. You may continue with static diagnosis and targeted tests, but the final response must explicitly say that runtime browser verification was unavailable and direct the user to run `/chrome connect`."}function $A0(D){if(!D||typeof D!=="object")return!1;let $=D.command;if(typeof $!=="string"||fj1.test($))return!1;return xj1.test($)}function Sj1(D){return y7(D)&&kj1.has(sO(D))}function vj1(D){return y7(D)&&Cj1.has(sO(D))}function ZA0(D){let $={...D.state},Z=D.blockerCode||null;if(Sj1(D.toolName)){if($.actionSucceeded=!0,Z)$.blockerCode=Z,$.verified=!1;else if($.verified=D.toolVerified===!0,$.verified)$.blockerCode=null;if($.verified)$.inspectionSucceeded=!0;return $}if(!vj1(D.toolName))return $;if($.inspectionSucceeded=!0,Z)$.blockerCode=Z,$.verified=!1;else if(sO(D.toolName)==="take_snapshot"&&($.actionSucceeded||D.filesChanged))$.blockerCode=null,$.verified=!0;return $}function qs(D){if(!D.route.intent||!D.filesChanged&&!D.browserActionSucceeded||D.browserVerified)return!1;if(typeof D.message!=="string"||!hj1.test(D.message))return!1;return D.route.available||!Mj1.test(D.message)}function Es(D,$){if($==="authentication-required")return"Browser verification reached an authentication page instead of the target UI. Do not keep retrying or claim success. Report that sign-in is required and ask the user to authenticate before runtime verification can continue.";if($==="blank-page")return"Browser verification is still on about:blank, so the target UI was not inspected. Navigate to the exact target URL and inspect its resulting page state, or report the navigation blocker explicitly.";if($==="web-server-starting")return"The local Web target refused the browser connection while its background server task was starting. Wait for that task to become ready, then inspect the original target URL; if the task exits, diagnose its startup output instead of claiming browser verification succeeded.";return D.available?"This UI change has not completed runtime browser verification. Use the available Chrome DevTools MCP tools to perform the interaction and inspect the resulting page/console before claiming it is fixed. If verification is blocked, report the blocker explicitly instead of claiming success.":"No browser MCP tool is available, so this UI change cannot be claimed as runtime-verified. Finish with an explicit 'static checks only; browser verification unavailable' disclosure and ask the user to run `/chrome connect`."}var gj1=/(?:批量|全量|整个仓库|所有文件|大规模|迁移|重构|batch|repository[- ]wide|all files|large[- ]scale|migration|refactor)/i,QA0={normal:{softIterations:8,maxIterations:24,softDurationMs:90000,maxDurationMs:600000,discoverySoftLimit:6},complex:{softIterations:16,maxIterations:40,softDurationMs:180000,maxDurationMs:600000,discoverySoftLimit:10},bulk:{softIterations:24,maxIterations:50,softDurationMs:300000,maxDurationMs:900000,discoverySoftLimit:16}};function YA0(D,$){let Z=Ck(D),Q=Os(Z),Y=gj1.test(Z)?"bulk":Hs(Z)?"complex":"normal";return JA0(Y,$,Y==="bulk"?"bulk-keyword":Q?"multi-target-change":Y==="complex"?"complex-signal":"normal")}function JA0(D,$,Z="normal"){return{...QA0[D],maxIterations:null,maxDurationMs:null,class:D,classificationReason:Z,mode:$}}function hk(D,$){if(!$||QA0[$].discoverySoftLimit<=D.discoverySoftLimit)return D;return JA0($,D.mode,"retained-continuation")}function XA0(D){let $=D.mode==="fde"?"FDE":D.mode==="coding"?"Coding":"Agent",Z=D.capReason==="duration"?typeof D.maxDurationMs==="number"?`${Math.round(D.maxDurationMs/60000)}-minute wall-clock`:"wall-clock":typeof D.maxIterations==="number"?`${D.maxIterations}-iteration`:"iteration";return`[paused] ${$} mode reached this ${D.budgetClass} turn's recoverable ${Z} execution limit before the task finished. All progress is preserved. `+'Continue? Reply "continue" or "继续" to resume from the current context; send a new '+"request to stop here and change direction."}import{resolve as VA0}from"node:path";function GA0(D){if(!D.interactive)return null;if(D.mode!=="coding"&&D.mode!=="fde")return null;if(D.blockerCode==="authentication-required")return"authentication-required";if(D.blockerCode==="web-server-starting"&&D.hasRunningWebTask)return"web-server-starting";return null}function aO(D){if(!D)return;try{let $=new URL(D);return $.username="",$.password="",$.search="",$.hash="",$.toString()}catch{let $=D.split(/[?#]/,1)[0]?.trim();return $?$.slice(0,500):void 0}}var mj1=/(?:\b(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?(?:dev|start|serve)\b|\bnpx\s+(?:next|vite|serve|http-server)\b|\bnext\s+dev\b|\bvite(?:\s|$)|\bastro\s+dev\b|\bnuxt\s+dev\b|webpack-dev-server|react-scripts\s+start|\bpython3?\s+-m\s+http\.server\b)/i,pj1=/(?:\bready\s+(?:in|on|at)\b|\blocal:\s*https?:\/\/|\blistening\s+(?:on|at)\b|\bserver\s+(?:is\s+)?(?:running|ready|started)\b|\bstarted\s+server\b|compiled successfully)/i;function FA0(D){if(!D)return;try{let $=new URL(D);return $.port||($.protocol==="https:"?"443":"80")}catch{return}}function BA0(D){let $=new Set;for(let Z of D.matchAll(/https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])(?::(\d{1,5}))?/gi))$.add(Z[1]??(/^https:/i.test(Z[0])?"443":"80"));for(let Z of D.matchAll(/(?:--port(?:=|\s+)|(?:^|\s)-p\s+)(\d{1,5})(?=\s|$)/gi))$.add(Z[1]);for(let Z of D.matchAll(/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\]):(\d{1,5})/gi))$.add(Z[1]);for(let Z of D.matchAll(/(?:^|\s)(?:PORT|VITE_PORT|NEXT_PORT)=(\d{1,5})(?=\s|$)/gi))$.add(Z[1]);return $}function lj1(D,$){try{return VA0(D)===VA0($)}catch{return D===$}}function zA0(D,$,Z){let Q=FA0($),Y=[];for(let V of D){if(V.kind!=="local-shell"||V.state!=="running")continue;let B=V.lines.slice(-80).join(`
2244
2244
  `),G=mj1.test(V.command),z=new Set([...BA0(V.command),...BA0(B)]),j=!!Q&&z.has(Q);if(Q&&z.size>0&&!j)continue;if(!G&&!j)continue;let H=typeof V.metadata?.cwd==="string"?V.metadata.cwd:void 0,W=!!(Z&&H&&lj1(Z,H));if(Z&&H&&!W&&!j)continue;let U=(G?4:0)+(j?10:0)+(W?5:H?0:1);Y.push({task:V,score:U,portSeen:j})}Y.sort((V,B)=>B.score-V.score||B.task.startedAtMs-V.task.startedAtMs);let J=Y[0];if(!J)return null;let X=Y[1];if(X&&X.score===J.score&&!J.portSeen&&!X.portSeen)return null;return J.task}function cj1(D,$){let Z=D.join(`
2245
2245
  `),Q=FA0($),Y=/(?:local:\s*|(?:running|ready|listening|started)[^\n]{0,80})https?:\/\//i.test(Z),J=Q==="80"||Q==="443"?`(?::${Q})?`:`:${Q}`,X=!!Q&&new RegExp(`https?:\\/\\/(?:localhost|127\\.0\\.0\\.1|0\\.0\\.0\\.0|\\[::1\\])${J}(?:[\\s/]|$)`,"i").test(Z);return pj1.test(Z)||Y||X?"ready":"waiting"}function jA0(D=0){return{cursor:Math.max(0,D),lines:[]}}function WA0(D,$,Z){if(!D)return{readiness:"failed",state:Z};let Q=Math.max(D.lines.length,D.lineCount??D.lines.length),Y=Math.max(0,Q-D.lines.length),J=Z.cursor>Q?Y:Z.cursor,X=Math.max(0,J-Y),V=D.lines.slice(X),B=[...Z.lines,...V].slice(-120),G={cursor:Q,lines:B};if(D.state!=="running")return{readiness:"failed",state:G};return{readiness:cj1(B,$),state:G}}function HA0(D,$=40,Z=6000){let Q=D.slice(-Math.max(1,$)).map((J)=>J.replace(/\x1B(?:[@-_]|\[[0-?]*[ -/]*[@-~])/g,"").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,"")).join(`
2246
2246
  `).trim(),Y=Math.max(128,Z);if(Q.length<=Y)return Q;return`[older output omitted]
@@ -2416,4 +2416,4 @@ ${D}`}]},Y=await Promise.race([pD(Q),new Promise((J,X)=>setTimeout(()=>X(Error(`
2416
2416
  `)}}B0();class Yb extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case HV.TOOL_WEB_SEARCH_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWebSearchLogic",{receiver:$,input:Z},()=>Ey0(Z)),Y=new la;k0(Y,Q),this.sendActionEvent(WV.TOOL_WEB_SEARCH_RESULT,Y,$)}}Yb=F([y(!0,WV),C(!0,HV),L()],Yb);class OV extends x{}OV.TOOL_WIKI_INDEX_RESULT="tool_wiki_index_result",F([A(!0,"tool_wiki_index_result","MaiCliServerToolWikiIndexLogicActionModel"),O("design:type",Object)],OV,"TOOL_WIKI_INDEX_RESULT",void 0),OV=F([f()],OV);class ra extends k{ok;data;error}class UV extends M{}UV.TOOL_WIKI_INDEX_INVOKE="tool_wiki_index_invoke",F([b(!0,!0,"tool_wiki_index_invoke"),O("design:type",Object)],UV,"TOOL_WIKI_INDEX_INVOKE",void 0),UV=F([h()],UV);B0();class Jb extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case UV.TOOL_WIKI_INDEX_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWikiIndexLogic",{receiver:$,input:Z},()=>sB0(Z)),Y=N8(Q),J=new ra;k0(J,Y),this.sendActionEvent(OV.TOOL_WIKI_INDEX_RESULT,J,$)}}Jb=F([y(!0,OV),C(!0,UV),L()],Jb);class NV extends x{}NV.TOOL_WIKI_INGEST_PREP_RESULT="tool_wiki_ingest_prep_result",F([A(!0,"tool_wiki_ingest_prep_result","MaiCliServerToolWikiIngestPrepLogicActionModel"),O("design:type",Object)],NV,"TOOL_WIKI_INGEST_PREP_RESULT",void 0),NV=F([f()],NV);class ia extends k{ok;data;error}class qV extends M{}qV.TOOL_WIKI_INGEST_PREP_INVOKE="tool_wiki_ingest_prep_invoke",F([b(!0,!0,"tool_wiki_ingest_prep_invoke"),O("design:type",Object)],qV,"TOOL_WIKI_INGEST_PREP_INVOKE",void 0),qV=F([h()],qV);B0();class Xb extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case qV.TOOL_WIKI_INGEST_PREP_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWikiIngestPrepLogic",{receiver:$,input:Z},()=>eB0(Z)),Y=N8(Q),J=new ia;k0(J,Y),this.sendActionEvent(NV.TOOL_WIKI_INGEST_PREP_RESULT,J,$)}}Xb=F([y(!0,NV),C(!0,qV),L()],Xb);class EV extends x{}EV.TOOL_WIKI_LINT_RESULT="tool_wiki_lint_result",F([A(!0,"tool_wiki_lint_result","MaiCliServerToolWikiLintLogicActionModel"),O("design:type",Object)],EV,"TOOL_WIKI_LINT_RESULT",void 0),EV=F([f()],EV);class sa extends k{ok;data;error}class KV extends M{}KV.TOOL_WIKI_LINT_INVOKE="tool_wiki_lint_invoke",F([b(!0,!0,"tool_wiki_lint_invoke"),O("design:type",Object)],KV,"TOOL_WIKI_LINT_INVOKE",void 0),KV=F([h()],KV);B0();class Vb extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case KV.TOOL_WIKI_LINT_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWikiLintLogic",{receiver:$,input:Z},()=>oB0(Z)),Y=N8(Q),J=new sa;k0(J,Y),this.sendActionEvent(EV.TOOL_WIKI_LINT_RESULT,J,$)}}Vb=F([y(!0,EV),C(!0,KV),L()],Vb);class IV extends x{}IV.TOOL_WIKI_REVIEW_RESULT="tool_wiki_review_result",F([A(!0,"tool_wiki_review_result","MaiCliServerToolWikiReviewLogicActionModel"),O("design:type",Object)],IV,"TOOL_WIKI_REVIEW_RESULT",void 0),IV=F([f()],IV);class aa extends k{ok;data;error}class PV extends M{}PV.TOOL_WIKI_REVIEW_INVOKE="tool_wiki_review_invoke",F([b(!0,!0,"tool_wiki_review_invoke"),O("design:type",Object)],PV,"TOOL_WIKI_REVIEW_INVOKE",void 0),PV=F([h()],PV);B0();class Bb extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case PV.TOOL_WIKI_REVIEW_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWikiReviewLogic",{receiver:$,input:Z},()=>ZG0(Z)),Y=N8(Q),J=new aa;k0(J,Y),this.sendActionEvent(IV.TOOL_WIKI_REVIEW_RESULT,J,$)}}Bb=F([y(!0,IV),C(!0,PV),L()],Bb);class wV extends x{}wV.TOOL_WIKI_SEARCH_RESULT="tool_wiki_search_result",F([A(!0,"tool_wiki_search_result","MaiCliServerToolWikiSearchLogicActionModel"),O("design:type",Object)],wV,"TOOL_WIKI_SEARCH_RESULT",void 0),wV=F([f()],wV);class ta extends k{ok;data;error}class _V extends M{}_V.TOOL_WIKI_SEARCH_INVOKE="tool_wiki_search_invoke",F([b(!0,!0,"tool_wiki_search_invoke"),O("design:type",Object)],_V,"TOOL_WIKI_SEARCH_INVOKE",void 0),_V=F([h()],_V);B0();class Gb extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case _V.TOOL_WIKI_SEARCH_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWikiSearchLogic",{receiver:$,input:Z},()=>jV0(Z)),Y=N8(Q),J=new ta;k0(J,Y),this.sendActionEvent(wV.TOOL_WIKI_SEARCH_RESULT,J,$)}}Gb=F([y(!0,wV),C(!0,_V),L()],Gb);class bV extends x{}bV.TOOL_ONTOLOGY_SCHEMA_RESULT="tool_ontology_schema_result",F([A(!0,"tool_ontology_schema_result","MaiCliServerToolOntologySchemaLogicActionModel"),O("design:type",Object)],bV,"TOOL_ONTOLOGY_SCHEMA_RESULT",void 0),bV=F([f()],bV);class ea extends k{ok;data;error}class TV extends M{}TV.TOOL_ONTOLOGY_SCHEMA_INVOKE="tool_ontology_schema_invoke",F([b(!0,!0,"tool_ontology_schema_invoke"),O("design:type",Object)],TV,"TOOL_ONTOLOGY_SCHEMA_INVOKE",void 0),TV=F([h()],TV);B0();class Fb extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case TV.TOOL_ONTOLOGY_SCHEMA_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolOntologySchemaLogic",{receiver:$,input:Z},()=>aV0(Z)),Y=N8(Q),J=new ea;k0(J,Y),this.sendActionEvent(bV.TOOL_ONTOLOGY_SCHEMA_RESULT,J,$)}}Fb=F([y(!0,bV),C(!0,TV),L()],Fb);class RV extends x{}RV.TOOL_ONTOLOGY_GRAPH_RESULT="tool_ontology_graph_result",F([A(!0,"tool_ontology_graph_result","MaiCliServerToolOntologyGraphLogicActionModel"),O("design:type",Object)],RV,"TOOL_ONTOLOGY_GRAPH_RESULT",void 0),RV=F([f()],RV);class Dt extends k{ok;data;error}class AV extends M{}AV.TOOL_ONTOLOGY_GRAPH_INVOKE="tool_ontology_graph_invoke",F([b(!0,!0,"tool_ontology_graph_invoke"),O("design:type",Object)],AV,"TOOL_ONTOLOGY_GRAPH_INVOKE",void 0),AV=F([h()],AV);B0();class zb extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case AV.TOOL_ONTOLOGY_GRAPH_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolOntologyGraphLogic",{receiver:$,input:Z},()=>DB0(Z)),Y=N8(Q),J=new Dt;k0(J,Y),this.sendActionEvent(RV.TOOL_ONTOLOGY_GRAPH_RESULT,J,$)}}zb=F([y(!0,RV),C(!0,AV),L()],zb);class LV extends x{}LV.TOOL_ONTOLOGY_PROPOSE_RESULT="tool_ontology_propose_result",F([A(!0,"tool_ontology_propose_result","MaiCliServerToolOntologyProposeLogicActionModel"),O("design:type",Object)],LV,"TOOL_ONTOLOGY_PROPOSE_RESULT",void 0),LV=F([f()],LV);class $t extends k{ok;data;error}class yV extends M{}yV.TOOL_ONTOLOGY_PROPOSE_INVOKE="tool_ontology_propose_invoke",F([b(!0,!0,"tool_ontology_propose_invoke"),O("design:type",Object)],yV,"TOOL_ONTOLOGY_PROPOSE_INVOKE",void 0),yV=F([h()],yV);B0();class jb extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case yV.TOOL_ONTOLOGY_PROPOSE_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolOntologyProposeLogic",{receiver:$,input:Z},()=>QB0(Z)),Y=N8(Q),J=new $t;k0(J,Y),this.sendActionEvent(LV.TOOL_ONTOLOGY_PROPOSE_RESULT,J,$)}}jb=F([y(!0,LV),C(!0,yV),L()],jb);class fV extends x{}fV.TOOL_ONTOLOGY_VALIDATE_RESULT="tool_ontology_validate_result",F([A(!0,"tool_ontology_validate_result","MaiCliServerToolOntologyValidateLogicActionModel"),O("design:type",Object)],fV,"TOOL_ONTOLOGY_VALIDATE_RESULT",void 0),fV=F([f()],fV);class Zt extends k{ok;data;error}class xV extends M{}xV.TOOL_ONTOLOGY_VALIDATE_INVOKE="tool_ontology_validate_invoke",F([b(!0,!0,"tool_ontology_validate_invoke"),O("design:type",Object)],xV,"TOOL_ONTOLOGY_VALIDATE_INVOKE",void 0),xV=F([h()],xV);B0();class Wb extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case xV.TOOL_ONTOLOGY_VALIDATE_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolOntologyValidateLogic",{receiver:$,input:Z},()=>XB0(Z)),Y=N8(Q),J=new Zt;k0(J,Y),this.sendActionEvent(fV.TOOL_ONTOLOGY_VALIDATE_RESULT,J,$)}}Wb=F([y(!0,fV),C(!0,xV),L()],Wb);class kV extends x{}kV.TOOL_GUC_SCORE_RESULT="tool_guc_score_result",F([A(!0,"tool_guc_score_result","MaiCliServerToolGucScoreLogicActionModel"),O("design:type",Object)],kV,"TOOL_GUC_SCORE_RESULT",void 0),kV=F([f()],kV);class Qt extends k{ok;data;error}class CV extends M{}CV.TOOL_GUC_SCORE_INVOKE="tool_guc_score_invoke",F([b(!0,!0,"tool_guc_score_invoke"),O("design:type",Object)],CV,"TOOL_GUC_SCORE_INVOKE",void 0),CV=F([h()],CV);B0();class Hb extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case CV.TOOL_GUC_SCORE_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolGucScoreLogic",{receiver:$,input:Z},()=>cB0(Z)),Y=N8(Q),J=new Qt;k0(J,Y),this.sendActionEvent(kV.TOOL_GUC_SCORE_RESULT,J,$)}}Hb=F([y(!0,kV),C(!0,CV),L()],Hb);class hV extends x{}hV.TOOL_WORKFLOW_RESULT="tool_workflow_result",F([A(!0,"tool_workflow_result","MaiCliServerToolWorkflowLogicActionModel"),O("design:type",Object)],hV,"TOOL_WORKFLOW_RESULT",void 0),hV=F([f()],hV);class Yt extends k{ok;data;error}class MV extends M{}MV.TOOL_WORKFLOW_INVOKE="tool_workflow_invoke",F([b(!0,!0,"tool_workflow_invoke"),O("design:type",Object)],MV,"TOOL_WORKFLOW_INVOKE",void 0),MV=F([h()],MV);B0();class Ob extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case MV.TOOL_WORKFLOW_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}async handleInvoke(D,$){let Z=D?.payload??D??{},Q=await x0("MaiCliServerToolWorkflowLogic",{receiver:$,input:Z},()=>xO(Z)),Y=new Yt;k0(Y,Q),this.sendActionEvent(hV.TOOL_WORKFLOW_RESULT,Y,$)}}Ob=F([y(!0,hV),C(!0,MV),L()],Ob);var Ky0={MaiCliServerToolAdvisorLogic:ew,MaiCliServerToolAgentLogic:D_,MaiCliServerToolAskUserQuestionLogic:$_,MaiCliServerToolAskUserTextLogic:Z_,MaiCliServerToolBashLogic:Q_,MaiCliServerToolBriefLogic:Y_,MaiCliServerToolConfigLogic:J_,MaiCliServerToolCtxInspectLogic:X_,MaiCliServerToolDiscoverSkillsLogic:V_,MaiCliServerToolEnterPlanModeLogic:B_,MaiCliServerToolEnterWorktreeLogic:G_,MaiCliServerToolExitPlanModeLogic:F_,MaiCliServerToolExitWorktreeLogic:j_,MaiCliServerToolFileEditLogic:W_,MaiCliServerToolFileReadLogic:H_,MaiCliServerToolFileWriteLogic:O_,MaiCliServerToolGlobLogic:U_,MaiCliServerToolGrepLogic:N_,MaiCliServerToolListMcpResourcesLogic:q_,MaiCliServerToolListPeersLogic:E_,MaiCliServerToolLoopCancelLogic:K_,MaiCliServerToolLspLogic:I_,MaiCliServerToolMcpAuthLogic:P_,MaiCliServerToolMcpLogic:w_,MaiCliServerToolMonitorLogic:__,MaiCliServerToolNotebookEditLogic:b_,MaiCliServerToolOverflowTestLogic:T_,MaiCliServerToolPowerShellLogic:R_,MaiCliServerToolPushNotificationLogic:A_,MaiCliServerToolReadMcpResourceLogic:L_,MaiCliServerToolRemoteTriggerLogic:y_,MaiCliServerToolReplLogic:f_,MaiCliServerToolReviewArtifactLogic:x_,MaiCliServerToolScheduleCronLogic:k_,MaiCliServerToolSendMessageLogic:C_,MaiCliServerToolSendUserFileLogic:h_,MaiCliServerToolSkillLogic:M_,MaiCliServerToolSleepLogic:u_,MaiCliServerToolSnipLogic:S_,MaiCliServerToolSubscribePrLogic:v_,MaiCliServerToolSuggestBackgroundPrLogic:g_,MaiCliServerToolSyntheticOutputLogic:m_,MaiCliServerToolTaskCreateLogic:p_,MaiCliServerToolTaskGetLogic:l_,MaiCliServerToolTaskListLogic:c_,MaiCliServerToolTaskOutputLogic:d_,MaiCliServerToolTaskStopLogic:n_,MaiCliServerToolTaskUpdateLogic:o_,MaiCliServerToolTeamCreateLogic:r_,MaiCliServerToolTeamDeleteLogic:i_,MaiCliServerToolTerminalCaptureLogic:s_,MaiCliServerToolTodoWriteLogic:a_,MaiCliServerToolTaskContractLogic:t_,MaiCliServerToolToolSearchLogic:e_,MaiCliServerToolTungstenLogic:Db,MaiCliServerToolVerifyPlanExecutionLogic:$b,MaiCliServerToolWebBrowserLogic:Zb,MaiCliServerToolWebFetchLogic:Qb,MaiCliServerToolWebSearchLogic:Yb,MaiCliServerToolWikiIndexLogic:Jb,MaiCliServerToolWikiIngestPrepLogic:Xb,MaiCliServerToolWikiLintLogic:Vb,MaiCliServerToolWikiReviewLogic:Bb,MaiCliServerToolWikiSearchLogic:Gb,MaiCliServerToolOntologySchemaLogic:Fb,MaiCliServerToolOntologyGraphLogic:zb,MaiCliServerToolOntologyProposeLogic:jb,MaiCliServerToolOntologyValidateLogic:Wb,MaiCliServerToolGucScoreLogic:Hb,MaiCliServerToolWorkflowLogic:Ob},Iy0={MaiCliServerToolAdvisorLogicActionKeys:JX,MaiCliServerToolAgentLogicActionKeys:VX,MaiCliServerToolAskUserQuestionLogicActionKeys:GX,MaiCliServerToolAskUserTextLogicActionKeys:zX,MaiCliServerToolBashLogicActionKeys:WX,MaiCliServerToolBriefLogicActionKeys:OX,MaiCliServerToolConfigLogicActionKeys:NX,MaiCliServerToolCtxInspectLogicActionKeys:EX,MaiCliServerToolDiscoverSkillsLogicActionKeys:IX,MaiCliServerToolEnterPlanModeLogicActionKeys:wX,MaiCliServerToolEnterWorktreeLogicActionKeys:bX,MaiCliServerToolExitPlanModeLogicActionKeys:RX,MaiCliServerToolExitWorktreeLogicActionKeys:LX,MaiCliServerToolFileEditLogicActionKeys:fX,MaiCliServerToolFileReadLogicActionKeys:kX,MaiCliServerToolFileWriteLogicActionKeys:hX,MaiCliServerToolGlobLogicActionKeys:uX,MaiCliServerToolGrepLogicActionKeys:vX,MaiCliServerToolListMcpResourcesLogicActionKeys:mX,MaiCliServerToolListPeersLogicActionKeys:lX,MaiCliServerToolLoopCancelLogicActionKeys:dX,MaiCliServerToolLspLogicActionKeys:oX,MaiCliServerToolMcpAuthLogicActionKeys:iX,MaiCliServerToolMcpLogicActionKeys:aX,MaiCliServerToolMonitorLogicActionKeys:eX,MaiCliServerToolNotebookEditLogicActionKeys:$2,MaiCliServerToolOverflowTestLogicActionKeys:Q2,MaiCliServerToolPowerShellLogicActionKeys:J2,MaiCliServerToolPushNotificationLogicActionKeys:V2,MaiCliServerToolReadMcpResourceLogicActionKeys:G2,MaiCliServerToolRemoteTriggerLogicActionKeys:z2,MaiCliServerToolReplLogicActionKeys:W2,MaiCliServerToolReviewArtifactLogicActionKeys:O2,MaiCliServerToolScheduleCronLogicActionKeys:N2,MaiCliServerToolSendMessageLogicActionKeys:E2,MaiCliServerToolSendUserFileLogicActionKeys:I2,MaiCliServerToolSkillLogicActionKeys:w2,MaiCliServerToolSleepLogicActionKeys:b2,MaiCliServerToolSnipLogicActionKeys:R2,MaiCliServerToolSubscribePrLogicActionKeys:L2,MaiCliServerToolSuggestBackgroundPrLogicActionKeys:f2,MaiCliServerToolSyntheticOutputLogicActionKeys:k2,MaiCliServerToolTaskCreateLogicActionKeys:h2,MaiCliServerToolTaskGetLogicActionKeys:u2,MaiCliServerToolTaskListLogicActionKeys:v2,MaiCliServerToolTaskOutputLogicActionKeys:m2,MaiCliServerToolTaskStopLogicActionKeys:l2,MaiCliServerToolTaskUpdateLogicActionKeys:d2,MaiCliServerToolTeamCreateLogicActionKeys:o2,MaiCliServerToolTeamDeleteLogicActionKeys:i2,MaiCliServerToolTerminalCaptureLogicActionKeys:a2,MaiCliServerToolTodoWriteLogicActionKeys:e2,MaiCliServerToolTaskContractLogicActionKeys:$V,MaiCliServerToolToolSearchLogicActionKeys:QV,MaiCliServerToolTungstenLogicActionKeys:JV,MaiCliServerToolVerifyPlanExecutionLogicActionKeys:VV,MaiCliServerToolWebBrowserLogicActionKeys:GV,MaiCliServerToolWebFetchLogicActionKeys:zV,MaiCliServerToolWebSearchLogicActionKeys:WV,MaiCliServerToolWikiIndexLogicActionKeys:OV,MaiCliServerToolWikiIngestPrepLogicActionKeys:NV,MaiCliServerToolWikiLintLogicActionKeys:EV,MaiCliServerToolWikiReviewLogicActionKeys:IV,MaiCliServerToolWikiSearchLogicActionKeys:wV,MaiCliServerToolOntologySchemaLogicActionKeys:bV,MaiCliServerToolOntologyGraphLogicActionKeys:RV,MaiCliServerToolOntologyProposeLogicActionKeys:LV,MaiCliServerToolOntologyValidateLogicActionKeys:fV,MaiCliServerToolGucScoreLogicActionKeys:kV,MaiCliServerToolWorkflowLogicActionKeys:hV},Py0={MaiCliServerToolAdvisorLogicStateKeys:XX,MaiCliServerToolAgentLogicStateKeys:BX,MaiCliServerToolAskUserQuestionLogicStateKeys:FX,MaiCliServerToolAskUserTextLogicStateKeys:jX,MaiCliServerToolBashLogicStateKeys:HX,MaiCliServerToolBriefLogicStateKeys:UX,MaiCliServerToolConfigLogicStateKeys:qX,MaiCliServerToolCtxInspectLogicStateKeys:KX,MaiCliServerToolDiscoverSkillsLogicStateKeys:PX,MaiCliServerToolEnterPlanModeLogicStateKeys:_X,MaiCliServerToolEnterWorktreeLogicStateKeys:TX,MaiCliServerToolExitPlanModeLogicStateKeys:AX,MaiCliServerToolExitWorktreeLogicStateKeys:yX,MaiCliServerToolFileEditLogicStateKeys:xX,MaiCliServerToolFileReadLogicStateKeys:CX,MaiCliServerToolFileWriteLogicStateKeys:MX,MaiCliServerToolGlobLogicStateKeys:SX,MaiCliServerToolGrepLogicStateKeys:gX,MaiCliServerToolListMcpResourcesLogicStateKeys:pX,MaiCliServerToolListPeersLogicStateKeys:cX,MaiCliServerToolLoopCancelLogicStateKeys:nX,MaiCliServerToolLspLogicStateKeys:rX,MaiCliServerToolMcpAuthLogicStateKeys:sX,MaiCliServerToolMcpLogicStateKeys:tX,MaiCliServerToolMonitorLogicStateKeys:D2,MaiCliServerToolNotebookEditLogicStateKeys:Z2,MaiCliServerToolOverflowTestLogicStateKeys:Y2,MaiCliServerToolPowerShellLogicStateKeys:X2,MaiCliServerToolPushNotificationLogicStateKeys:B2,MaiCliServerToolReadMcpResourceLogicStateKeys:F2,MaiCliServerToolRemoteTriggerLogicStateKeys:j2,MaiCliServerToolReplLogicStateKeys:H2,MaiCliServerToolReviewArtifactLogicStateKeys:U2,MaiCliServerToolScheduleCronLogicStateKeys:q2,MaiCliServerToolSendMessageLogicStateKeys:K2,MaiCliServerToolSendUserFileLogicStateKeys:P2,MaiCliServerToolSkillLogicStateKeys:_2,MaiCliServerToolSleepLogicStateKeys:T2,MaiCliServerToolSnipLogicStateKeys:A2,MaiCliServerToolSubscribePrLogicStateKeys:y2,MaiCliServerToolSuggestBackgroundPrLogicStateKeys:x2,MaiCliServerToolSyntheticOutputLogicStateKeys:C2,MaiCliServerToolTaskCreateLogicStateKeys:M2,MaiCliServerToolTaskGetLogicStateKeys:S2,MaiCliServerToolTaskListLogicStateKeys:g2,MaiCliServerToolTaskOutputLogicStateKeys:p2,MaiCliServerToolTaskStopLogicStateKeys:c2,MaiCliServerToolTaskUpdateLogicStateKeys:n2,MaiCliServerToolTeamCreateLogicStateKeys:r2,MaiCliServerToolTeamDeleteLogicStateKeys:s2,MaiCliServerToolTerminalCaptureLogicStateKeys:t2,MaiCliServerToolTodoWriteLogicStateKeys:DV,MaiCliServerToolTaskContractLogicStateKeys:ZV,MaiCliServerToolToolSearchLogicStateKeys:YV,MaiCliServerToolTungstenLogicStateKeys:XV,MaiCliServerToolVerifyPlanExecutionLogicStateKeys:BV,MaiCliServerToolWebBrowserLogicStateKeys:FV,MaiCliServerToolWebFetchLogicStateKeys:jV,MaiCliServerToolWebSearchLogicStateKeys:HV,MaiCliServerToolWikiIndexLogicStateKeys:UV,MaiCliServerToolWikiIngestPrepLogicStateKeys:qV,MaiCliServerToolWikiLintLogicStateKeys:KV,MaiCliServerToolWikiReviewLogicStateKeys:PV,MaiCliServerToolWikiSearchLogicStateKeys:_V,MaiCliServerToolOntologySchemaLogicStateKeys:TV,MaiCliServerToolOntologyGraphLogicStateKeys:AV,MaiCliServerToolOntologyProposeLogicStateKeys:yV,MaiCliServerToolOntologyValidateLogicStateKeys:xV,MaiCliServerToolGucScoreLogicStateKeys:CV,MaiCliServerToolWorkflowLogicStateKeys:MV};class uV extends x{}uV.SHELL_DOCTOR_SCREEN_RESULT="shell_doctor_screen_result",F([A(!0,"shell_doctor_screen_result","MscCliShellDoctorScreenLogicActionModel"),O("design:type",Object)],uV,"SHELL_DOCTOR_SCREEN_RESULT",void 0),uV=F([f()],uV);class Jt extends k{ok;data;error}class SV extends M{}SV.SHELL_DOCTOR_SCREEN_INVOKE="shell_doctor_screen_invoke",F([b(!0,!0,"shell_doctor_screen_invoke"),O("design:type",Object)],SV,"SHELL_DOCTOR_SCREEN_INVOKE",void 0),SV=F([h()],SV);class Ub extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case SV.SHELL_DOCTOR_SCREEN_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}handleInvoke(D,$){let Z=new Jt;Z.ok=!0,this.sendActionEvent(uV.SHELL_DOCTOR_SCREEN_RESULT,Z,$)}}Ub=F([y(!0,uV),C(!0,SV),L()],Ub);class vV extends x{}vV.SHELL_RESUME_SCREEN_RESULT="shell_resume_screen_result",F([A(!0,"shell_resume_screen_result","MscCliShellResumeScreenLogicActionModel"),O("design:type",Object)],vV,"SHELL_RESUME_SCREEN_RESULT",void 0),vV=F([f()],vV);class Xt extends k{ok;data;error}class gV extends M{}gV.SHELL_RESUME_SCREEN_INVOKE="shell_resume_screen_invoke",F([b(!0,!0,"shell_resume_screen_invoke"),O("design:type",Object)],gV,"SHELL_RESUME_SCREEN_INVOKE",void 0),gV=F([h()],gV);class Nb extends R{onAttach(){super.onAttach()}onInstall(){super.onInstall()}onDetach(){super.onDetach()}handleStateEvent(D){switch(D.getMessage()){case gV.SHELL_RESUME_SCREEN_INVOKE:this.handleInvoke(D.getModel(),D.getSender());break;default:super.handleStateEvent(D);break}}handleInvoke(D,$){let Z=new Xt;Z.ok=!0,this.sendActionEvent(vV.SHELL_RESUME_SCREEN_RESULT,Z,$)}}Nb=F([y(!0,vV),C(!0,gV),L()],Nb);class Vt extends LD{handleActionEvent(D){super.handleActionEvent(D)}}class Bt extends LD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class Gt extends LD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class Ft extends LD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class zt extends LD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class jt extends LD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class Wt extends LD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class Ht extends LD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class Ot extends LD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class Ut extends LD{handleActionEvent(D){switch(D.getSender()){default:super.handleActionEvent(D);break}}}class Nt{_dsl={mai_cli_server_dsl:O90,cli_doctor_screen_dsl:U90,cli_resume_screen_dsl:N90};_view={};_logic={...gA0,...jb0,...Ky0,...Cb0,...bb0,...nA0,...Nb0,...$L0,...l_0,MscCliShellDoctorScreenLogic:Ub,MscCliShellResumeScreenLogic:Nb};_workflow={MaiCliServerRouterWorkflow:Vt,MaiCliServerCoreWorkflow:Bt,MaiCliServerToolWorkflow:Gt,MaiCliServerServiceWorkflow:Ft,MaiCliServerCommandWorkflow:zt,MaiCliServerRemoteWorkflow:jt,MaiCliServerSwarmWorkflow:Wt,MaiCliServerExtensionWorkflow:Ht,CliDoctorScreenWorkflow:Ot,CliResumeScreenWorkflow:Ut};_actionKeys={...mA0,...Wb0,...Iy0,...hb0,...Tb0,...oA0,...qb0,...ZL0,...c_0,MscCliShellDoctorScreenLogicActionKeys:uV,MscCliShellResumeScreenLogicActionKeys:vV};_stateKeys={...pA0,...Hb0,...Py0,...Mb0,...Rb0,...rA0,...Eb0,...QL0,...d_0,MscCliShellDoctorScreenLogicStateKeys:SV,MscCliShellResumeScreenLogicStateKeys:gV};_sidecar={};appId(){return"stem"}view(D){return this._view[D]}logic(D){return this._logic[D]}workflow(D){return this._workflow[D]}dsl(D){return this._dsl[D]}actionKeys(D){return this._actionKeys[D]}stateKeys(D){return this._stateKeys[D]}sidecar(D){return this._sidecar[D]}}var qt=process.env.NEXT_PUBLIC_MSC_LOG_OPEN==="true";function tH1(D){if(D===null||D===void 0)return null;if(typeof D==="string")return D;try{return JSON.stringify(D)}catch{return null}}function Et(D){if(D==="???")console.warn("[MscLog] tag is missing, caller stack:",Error().stack)}function Kt(D,$,Z){let Q=tH1(Z);if(Q!==null)return`${D} ${$}
2417
2417
  ${Q}`;return`${D} ${$}`}function eH1(D,$,Z="???"){if(qt)Et(Z),console.log(Kt(`[MscInfo | ${Z}]`,D,$))}function DO1(D,$,Z="???"){if(qt)Et(Z),console.warn(Kt(`[MscWarn | ${Z}]`,D,$))}function $O1(D,$,Z="???"){if(qt)Et(Z),console.error(Kt(`[MscError | ${Z}]`,D,$))}var vk={infoLog:eH1,warnLog:DO1,errorLog:$O1};function ZO1(D,$,Z){vk.infoLog($,Z,D)}function QO1(D,$,Z){vk.warnLog($,Z,D)}function YO1(D,$,Z){vk.errorLog($,Z,D)}var eO={trackInfo:ZO1,trackWarn:QO1,trackError:YO1};class It{dsl;debug;mscInstance;requestCount=0;constructor(D,$){if(this.debug=$,!p8.isRegistryMscEnv())p8.registryMscEnv(new Nt);this.handleContainerDsl(D)}handleContainerDsl(D){let $=p8.MscEnv().dsl(D);if($)$(),this.dsl=D}handlerCreateContainer(D){if(!this.mscInstance&&this.dsl)this.mscInstance=new p70(this.debug).dls(this.dsl).observer({handleActionEvent($){D.onActionEvent($)},handleStateEvent($){D.onStateEvent($)},handleLifecycleEvent($){D.onLifecycleEvent($)},handleErrorEvent($){D.onErrorEvent($)}}).build(),this.mscInstance.install()}handleDestroyContainer(){try{if(this.mscInstance)this.mscInstance.uninstall(),this.mscInstance=null}catch(D){eO.trackError("MscCliContainer",`handleDestroyContainer error: ${D}`)}}handleContainerStateEvent(D){if(this.requestCount++,this.requestCount%1000===0){let $=process.memoryUsage();eO.trackInfo("MscCliContainer",`[MemProbe] dsl=${this.dsl} req#${this.requestCount} heapUsed=${($.heapUsed/1024/1024).toFixed(1)}MB heapTotal=${($.heapTotal/1024/1024).toFixed(1)}MB external=${($.external/1024/1024).toFixed(1)}MB`)}if(this.mscInstance)this.mscInstance.sendState(D)}}class Pt{listeners=new Set;addListener(D){this.listeners.add(D)}removeListener(D){this.listeners.delete(D)}onActionEvent(D){this.listeners.forEach(($)=>$.onActionEvent(D))}onStateEvent(D){this.listeners.forEach(($)=>$.onStateEvent(D))}onLifecycleEvent(D){this.listeners.forEach(($)=>$.onLifecycleEvent(D))}onErrorEvent(D){this.listeners.forEach(($)=>$.onErrorEvent(D))}}var JO1=600000;class fB{static _instanceKey=Symbol.for("MscCliManager");static getInstance(){let D=globalThis;if(!D[fB._instanceKey])D[fB._instanceKey]=new fB;return D[fB._instanceKey]}constructor(){}entries=new Map;reuseCount=new Map;getServerContainer(D){let $=this.entries.get(D);if($){let Z=(this.reuseCount.get(D)??0)+1;if(this.reuseCount.set(D,Z),Z%1000===0)eO.trackInfo("MscCliManager",`MscCliContainer Reuse #${Z} for dsl: ${D}, tag: ${$.tag}`)}else{let Z=Date.now().toString();eO.trackInfo("MscCliManager",`MscCliContainer Create for dsl: ${D}, tag: ${Z}`);let Q=new It(D),Y=new Pt,J=new Map,X={onActionEvent(V){let B=J.get(V.getReceiver());if(B){if(B.timing.t3=Date.now(),B.timer)clearTimeout(B.timer);J.delete(V.getReceiver());let G=V.getModel();B.resolve({receiver:V.getReceiver(),model:G,tag:Z,timing:B.timing})}},onErrorEvent(V){let B=J.get(V.getReceiver());if(B){if(B.timing.t3=Date.now(),B.timer)clearTimeout(B.timer);J.delete(V.getReceiver()),B.reject({receiver:V.getReceiver(),error:V.getMessage(),tag:Z,timing:B.timing})}},onLifecycleEvent(V){},onStateEvent(V){}};Y.addListener(X),Q.handlerCreateContainer(Y),$={container:Q,listener:Y,pendingRequests:J,tag:Z},this.entries.set(D,$)}return $}warmupContainer(D){this.getServerContainer(D)}handleContainerEvent(D,$,Z=JO1){let Q=Date.now(),{container:Y,pendingRequests:J}=this.getServerContainer(D),X=Date.now();if(J.has($.sender))return Promise.reject({error:`request ${$.sender} is already in progress`});return new Promise((V,B)=>{let G=setTimeout(()=>{J.delete($.sender),B({error:`request ${$.sender} timed out after ${Z}ms`})},Z),z={t0:Q,t1:X,t2:0,t3:0},j=Date.now();z.t2=j,J.set($.sender,{resolve:V,reject:B,timer:G,timing:z}),Y.handleContainerStateEvent($)})}bumpRequestTimer(D,$,Z){let Q=this.entries.get(D);if(!Q)return!1;let Y=Q.pendingRequests.get($);if(!Y)return!1;if(Y.timer)clearTimeout(Y.timer);if(Z===null)return Y.timer=null,!0;return Y.timer=setTimeout(()=>{Q.pendingRequests.delete($),Y.reject({error:`request ${$} idle for ${Z}ms`})},Z),!0}handleContainerDestroy(D){let $=this.entries.get(D);if($){for(let[,Z]of $.pendingRequests){if(Z.timer)clearTimeout(Z.timer);Z.reject({error:`container destroyed for dsl: ${D}`})}$.pendingRequests.clear(),$.container.handleDestroyContainer(),this.entries.delete(D)}}}vD();vD();O7();import{mkdirSync as XO1}from"node:fs";import{join as VO1}from"node:path";function wy0(D=process.env.CALLER_DIR||process.cwd()){if(!ez())return;let $=[d8(D),VO1(x8(),"projects"),...SM.map((Z)=>vM(Z,D))];for(let Z of $)try{XO1(Z,{recursive:!0})}catch{}}var _y0="mai_cli_server_dsl";function GO1(){let D=new Map;for(let $ of FR()){let Z=$.name.replace(/^MaiCliServerTool/,"").replace(/Logic$/,"").replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase(),Q=`tool_${Z}`,Y={logicName:$.name,stateKey:`${Q}_invoke`,toolName:Q};D.set(Q,Y),D.set(Z,Y)}return D}function FO1(D){return{name:D.toolName,description:q("mcp.toolDescription",{logicName:D.logicName}),inputSchema:{type:"object",additionalProperties:!0}}}function by0(D){if(typeof D==="string")return D;return JSON.stringify(D??null,null,2)}async function zO1(){let{locale:D}=yM(process.argv.slice(2));if(P90(D),process.env.STEM_TENANT_INVALID!==void 0)process.stderr.write((process.env.STEM_TENANT_INVALID_NPM?q("errors.invalidTenantNpmForm"):q("errors.invalidTenant",{code:process.env.STEM_TENANT_INVALID,rule:String(Tb)}))+`
2418
2418
  `),process.exit(1);if(process.env.STEM_USER_INVALID!==void 0)process.stderr.write(q("errors.invalidUser",{code:process.env.STEM_USER_INVALID,rule:String(Tb)})+`
2419
- `),process.exit(1);wy0();let $=GO1(),Z=fB.getInstance();Z.warmupContainer(_y0);let Q=new Th({name:"stem/msc",version:{VERSION:"0.0.25",PACKAGE_URL:"@mortiseai/stem",NATIVE_PACKAGE_URL:"@mortiseai/stem",BUILD_TIME:"2026-09-03T11:23:51.892Z",FEEDBACK_CHANNEL:"npm",MSC_ENGINE_VERSION:"0.0.3"}.VERSION},{capabilities:{tools:{}}});Q.setRequestHandler(jC,async()=>({tools:[...new Map([...$.values()].map((Y)=>[Y.toolName,Y])).values()].map(FO1)})),Q.setRequestHandler(EU,async({params:Y})=>{let J=$.get(Y.name);if(!J)return{isError:!0,content:[{type:"text",text:q("mcp.unknownTool",{name:Y.name})}]};try{let X=await Z.handleContainerEvent(_y0,{sender:BO1(),receiver:J.logicName,message:J.stateKey,model:{payload:Y.arguments??{}}});return{content:[{type:"text",text:by0(X.model)}]}}catch(X){return{isError:!0,content:[{type:"text",text:X instanceof Error?X.message:by0(X)}]}}}),await Q.connect(new Rh)}await zO1();export{zO1 as startMcpServer};
2419
+ `),process.exit(1);wy0();let $=GO1(),Z=fB.getInstance();Z.warmupContainer(_y0);let Q=new Th({name:"stem/msc",version:{VERSION:"0.0.26",PACKAGE_URL:"@mortiseai/stem",NATIVE_PACKAGE_URL:"@mortiseai/stem",BUILD_TIME:"2026-09-04T01:29:23.107Z",FEEDBACK_CHANNEL:"npm",MSC_ENGINE_VERSION:"0.0.3"}.VERSION},{capabilities:{tools:{}}});Q.setRequestHandler(jC,async()=>({tools:[...new Map([...$.values()].map((Y)=>[Y.toolName,Y])).values()].map(FO1)})),Q.setRequestHandler(EU,async({params:Y})=>{let J=$.get(Y.name);if(!J)return{isError:!0,content:[{type:"text",text:q("mcp.unknownTool",{name:Y.name})}]};try{let X=await Z.handleContainerEvent(_y0,{sender:BO1(),receiver:J.logicName,message:J.stateKey,model:{payload:Y.arguments??{}}});return{content:[{type:"text",text:by0(X.model)}]}}catch(X){return{isError:!0,content:[{type:"text",text:X instanceof Error?X.message:by0(X)}]}}}),await Q.connect(new Rh)}await zO1();export{zO1 as startMcpServer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mortiseai/stem",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "MortiseAI Stem CLI, built on MSC Engine",
5
5
  "license": "Apache-2.0",
6
6
  "author": "MortiseAI <developer.mai@outlook.com>",