minecodex 2.0.51 → 2.0.52
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/features/composer-expand/src/injection-source.mjs +3 -3
- package/features/composer-expand/src/native.mjs +23 -1
- package/features/file-navigation/src/adapters/codex/modules.mjs +23 -2
- package/features/file-navigation/src/injection-source.mjs +3 -3
- package/features/images/src/adapters/codex/native-image-modules.mjs +11 -4
- package/features/images/src/adapters/codex/rspack-modules.mjs +148 -0
- package/features/images/src/library-prompt-source.mjs +3 -2
- package/features/markdown-reading/src/adapters/codex/links.mjs +10 -1
- package/features/markdown-reading/src/adapters/codex/rich-text.mjs +12 -0
- package/features/markdown-reading/src/injection-source.mjs +6 -4
- package/features/mermaid-diagrams/src/injection-source.mjs +4 -3
- package/features/model-slider/src/adapters/codex/controller.mjs +57 -2
- package/features/model-slider/src/frontend/install.mjs +49 -43
- package/features/session-status/src/session-status.mjs +9 -3
- package/features/sites/src/adapters/codex/renderer.mjs +2 -2
- package/package.json +1 -1
- package/packages/cli/src/control-server.mjs +4 -5
- package/packages/cli/src/npm-adapter.mjs +4 -4
- package/packages/codex-adapter/src/markdown/block-actions.mjs +4 -1
- package/packages/codex-adapter/src/markdown/editor-api.mjs +26 -1
- package/packages/codex-adapter/src/markdown/rspack.mjs +75 -0
- package/packages/codex-adapter/src/markdown/toc-native.mjs +4 -1
- package/packages/codex-adapter/src/renderer/modules.mjs +61 -0
- package/packages/plugin/assets/app.js +2 -2
- package/packages/plugin/assets/prompts.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var uz=Object.defineProperty;var Nr=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var At=(e,t)=>{for(var n in t)uz(e,n,{get:t[n],enumerable:!0})};function q$(e,t){return ST[e]?.[t==="zh-CN"?0:1]??(t==="zh-CN"?["Codex \u4E2D\u5BF9\u5E94\u529F\u80FD\u7684\u4F4D\u7F6E\u3002","\u8BF7\u53C2\u8003\u529F\u80FD\u8BF4\u660E\u3002","\u6548\u679C\u53D6\u51B3\u4E8E\u5F53\u524D\u7248\u672C\u4E0E\u9002\u7528\u9875\u9762\u3002"]:["The feature\u2019s location in Codex.","Refer to the feature description.","Availability depends on the version and current page."])}var ST,V$=Nr(()=>{ST={"model-slider":[["\u8F93\u5165\u6846\u7684\u6A21\u578B\u9009\u62E9\u533A\u57DF\u3002","\u6A21\u578B\u4E0E\u601D\u8003\u6863\u4F4D\u5206\u6563\uFF0C\u5207\u6362\u4E0D\u591F\u76F4\u63A5\u3002","\u6253\u5F00\u6A21\u578B\u7A97\u53E3\uFF0C\u9009\u62E9\u6A21\u578B\u4E0E\u601D\u8003\u6863\u4F4D\uFF1B\u6536\u85CF\u5E38\u7528\u6A21\u578B\u4EE5\u4FBF\u518D\u6B21\u9009\u62E9\u3002"],["The model selector beside the composer.","Switching models and reasoning levels takes extra steps.","Open the model panel, choose a model and reasoning level, and save favorites for quick access."]],notes:[["\u5B98\u65B9 Prompt \u9875\u9762\u4E0E\u8F93\u5165\u6846\u65C1\u7684 Quick Prompts\u3002","\u5E38\u7528\u63D0\u793A\u8BCD\u9700\u8981\u53CD\u590D\u67E5\u627E\u548C\u590D\u5236\u3002","\u6309\u5206\u7C7B\u7BA1\u7406\u63D0\u793A\u8BCD\uFF0C\u4ECE Quick Prompts \u586B\u5165\u5F53\u524D\u8F93\u5165\u6846\uFF1B\u586B\u5165\u540E\u7531\u4F60\u68C0\u67E5\u5E76\u53D1\u9001\u3002"],["The Prompt page and Quick Prompts beside the composer.","Reusable prompts are hard to find and copy repeatedly.","Organize prompts by category and insert one into the current composer. Review it before sending."]],"usage-meter":[["Codex \u4FA7\u680F\u7684\u989D\u5EA6\u73AF\u3002","\u67E5\u770B\u5269\u4F59\u989D\u5EA6\u9700\u8981\u6253\u5F00\u8D26\u53F7\u83DC\u5355\u3002","\u7528\u989D\u5EA6\u73AF\u67E5\u770B\u4F7F\u7528\u6BD4\u4F8B\uFF0C\u70B9\u51FB\u6253\u5F00\u7528\u91CF\u8BE6\u60C5\u3002"],["The usage ring in the Codex sidebar.","Checking remaining usage requires opening the account menu.","Read usage at a glance, then click for usage details."]],"session-status":[["\u5F53\u524D\u4F1A\u8BDD\u7684\u72B6\u6001\u533A\u57DF\u3002","\u4F1A\u8BDD\u7528\u91CF\u4E0E\u751F\u6210\u901F\u5EA6\u4E0D\u5BB9\u6613\u96C6\u4E2D\u67E5\u770B\u3002","\u67E5\u770B\u5F53\u524D\u4F1A\u8BDD\u7684\u7528\u91CF\u3001\u4E0A\u4E0B\u6587\u548C\u751F\u6210\u6307\u6807\uFF1B\u53EF\u7528\u9879\u76EE\u53D6\u51B3\u4E8E\u4F1A\u8BDD\u4E0E\u63D0\u4F9B\u65B9\u3002"],["The current conversation\u2019s status area.","Usage and generation metrics are spread across the interface.","Read session usage, context and generation metrics when supported by the session and provider."]],"markdown-reading":[["Codex \u7684 Markdown \u6587\u4EF6\u9884\u89C8\u3002","\u957F\u6587\u9605\u8BFB\u3001\u811A\u6CE8\u8DF3\u8F6C\u548C\u8868\u683C\u67E5\u770B\u4E0D\u591F\u65B9\u4FBF\u3002","\u5728\u6587\u4EF6\u9884\u89C8\u4E2D\u9605\u8BFB\u589E\u5F3A\u6392\u7248\uFF0C\u4F7F\u7528\u76EE\u5F55\u3001\u811A\u6CE8\u548C\u8868\u683C\u64CD\u4F5C\u3002"],["Markdown file previews in Codex.","Long documents, footnotes and tables take extra effort to read.","Read enhanced formatting and use the outline, footnote navigation and table actions."]],"mermaid-diagrams":[["Markdown \u6587\u4EF6\u9884\u89C8\u4E2D\u7684 Mermaid \u56FE\u8868\u3002","\u5B9E\u9A8C\u6027\u56FE\u8868\u6837\u5F0F\u4E0E\u4EA4\u4E92\u4ECD\u5728\u5B8C\u5584\uFF0C\u9ED8\u8BA4\u5173\u95ED\u3002","\u6309\u9700\u5F00\u542F\u56FE\u8868\u589E\u5F3A\uFF0C\u4F7F\u7528\u7F29\u653E\u548C PNG \u4E0B\u8F7D\uFF1B\u5173\u95ED\u540E\u4F7F\u7528 Codex \u539F\u751F\u56FE\u8868\u3002"],["Mermaid diagrams in Markdown file previews.","Enhanced diagram styles and interactions are experimental and off by default.","Opt in to diagram zoom and PNG download. Turn it off to use native Codex diagrams."]],"file-navigation":[["Codex \u6587\u4EF6\u9884\u89C8\u4E0A\u65B9\u7684\u8DEF\u5F84\u533A\u57DF\u3002","\u6D4F\u89C8\u76F8\u90BB\u76EE\u5F55\u548C\u6587\u4EF6\u9700\u8981\u989D\u5916\u8DF3\u8F6C\u3002","\u70B9\u51FB\u8DEF\u5F84\u5C55\u5F00\u5206\u5217\u76EE\u5F55\uFF0C\u9010\u7EA7\u6D4F\u89C8\u5E76\u6253\u5F00\u53E6\u4E00\u4E2A\u6587\u4EF6\u3002"],["The path above a file preview in Codex.","Browsing nearby files and folders takes extra navigation.","Open the path to browse cascading folder columns and choose another file."]],images:[["Codex Library \u7684\u56FE\u7247\u96C6\u5408\u4E0E\u56FE\u7247\u67E5\u770B\u5668\u3002","\u67E5\u627E\u56FE\u7247\u53CA\u5176\u63D0\u793A\u8BCD\u9700\u8981\u6765\u56DE\u5207\u6362\u3002","\u6D4F\u89C8\u56FE\u7247\u96C6\u5408\uFF0C\u6253\u5F00\u56FE\u7247\u67E5\u770B\u5927\u56FE\u53CA\u53EF\u8FFD\u6EAF\u7684\u63D0\u793A\u8BCD\u4FE1\u606F\u3002"],["Image collections in Codex Library and the image viewer.","Finding images and their prompts requires switching views.","Browse collections, open an image, and inspect available prompt provenance."]],sites:[["Codex \u4E2D\u7684 Sites \u9875\u9762\u3002","\u672C\u5730\u9879\u76EE\u4E0E\u5E38\u7528\u7F51\u5740\u5206\u6563\u5728\u4E0D\u540C\u4F4D\u7F6E\u3002","\u6536\u85CF\u7F51\u5740\u3001\u53D1\u73B0\u6B63\u5728\u8FD0\u884C\u7684\u672C\u5730\u7AD9\u70B9\uFF0C\u5E76\u4ECE Sites \u6253\u5F00\u3002"],["The Sites page in Codex.","Local projects and saved links are scattered.","Save URLs, discover running local sites, and open them from Sites."]],"composer-expand":[["Work \u4E0E Codex \u7684\u8F93\u5165\u6846\u53F3\u4E0A\u89D2\u3002","\u957F\u6307\u4EE4\u53D7\u8F93\u5165\u6846\u9AD8\u5EA6\u9650\u5236\uFF0C\u7F16\u8F91\u65F6\u9700\u8981\u53CD\u590D\u6EDA\u52A8\u3002","\u8F93\u5165\u591A\u884C\u6587\u5B57\u540E\u70B9\u51FB\u5C55\u5F00\uFF1B\u7F16\u8F91\u5B8C\u6210\u540E\u6536\u8D77\uFF0C\u8349\u7A3F\u4FDD\u6301\u4E0D\u53D8\u3002"],["The upper-right corner of the Work and Codex composer.","Long drafts need repeated scrolling in a compact editor.","Enter a multiline draft and click Expand. Collapse when finished; your draft stays in place."]],"quick-chat":[["Codex \u7684\u6D6E\u52A8 Quick Chat \u7A97\u53E3\u3002","\u4E34\u65F6\u63D0\u95EE\u65F6\u9700\u8981\u5207\u6362\u4E3B\u7A97\u53E3\uFF0C\u5386\u53F2\u4E0D\u6613\u7EE7\u7EED\u3002","\u4ECE\u4FA7\u680F\u6216\u5FEB\u6377\u952E\u6253\u5F00 Quick Chat\uFF0C\u53D1\u9001\u540E\u5C55\u5F00\uFF0C\u6062\u590D\u6700\u5C0F\u5316\u8F93\u5165\u6846\u5E76\u67E5\u770B\u5386\u53F2\u3002"],["The floating Quick Chat window.","Quick questions and continuing recent chats require window switching.","Open Quick Chat from the sidebar or shortcut, expand after sending, restore a minimized composer and browse history."]],"sidebar-focus":[["Codex \u5DE6\u4FA7\u680F\u7684\u5206\u7EC4\u6807\u9898\u3002","\u591A\u4E2A\u4FA7\u680F\u5206\u7EC4\u5C55\u5F00\u65F6\uFF0C\u5F53\u524D\u5206\u7EC4\u4E0D\u5BB9\u6613\u805A\u7126\u3002","\u70B9\u51FB\u5F53\u524D\u5206\u7EC4\uFF0C\u4E00\u952E\u6536\u8D77\u5176\u4ED6\u5206\u7EC4\uFF1B\u518D\u6B21\u70B9\u51FB\u6062\u590D\u5148\u524D\u7684\u5C55\u5F00\u72B6\u6001\u3002"],["Group headings in the Codex sidebar.","Several expanded groups make the current group harder to focus on.","Click a group to collapse other groups. Click again to restore their previous expanded state."]],"hide-upsell-banner":[["Codex \u7684\u989D\u5EA6\u63A8\u5E7F\u63D0\u793A\u533A\u57DF\u3002","\u63A8\u5E7F\u63D0\u793A\u5360\u7528\u65E5\u5E38\u64CD\u4F5C\u7A7A\u95F4\u3002","\u9690\u85CF\u989D\u5EA6\u63A8\u5E7F\u63D0\u793A\uFF0C\u4FDD\u7559\u771F\u5B9E\u989D\u5EA6\u4E0E\u8FD0\u884C\u9519\u8BEF\u53CD\u9988\u3002"],["Usage promotion banners in Codex.","Promotions take space during everyday tasks.","Hide usage promotions while retaining real usage and error feedback."]]}});function Z$(e,t){let n=t==="zh-CN",o=(A,K)=>n?A:K,r=new AbortController,i=(A,K,Q,re={})=>A.addEventListener(K,Q,{...re,signal:r.signal}),a=matchMedia("(hover: hover) and (pointer: fine)"),s=matchMedia("(prefers-reduced-motion: reduce)"),l=null,c=null,d=null,m,h,f,v=!1,y=0,k=!1,T=null,R,N=null,Z=!1,X=null,M=()=>R??=window.minecodexPreviewMedia!==void 0?Promise.resolve(window.minecodexPreviewMedia):fetch("/assets/previews/manifest.json").then(A=>A.ok?A.json():{}).then(A=>A&&typeof A=="object"?A:{}).catch(()=>({})),B=(A,K,Q)=>{let re=document.createElement(A);return re.className=K,Q&&(re.textContent=Q),re};async function De(A,K,Q,re){if(!window.minecodexMcpApp)return`/assets/previews/${Q}`;let be=(await window.minecodexMcpApp.readServerResource({uri:`resource://minecodex/previews/${A}/${K}`},{signal:re})).contents?.[0];if(!be?.blob)throw new Error("Preview resource unavailable");return`data:${be.mimeType};base64,${be.blob}`}function ie({restore:A=!1}={}){clearTimeout(m),clearTimeout(h),clearTimeout(f),y++,T?.abort(),T=null;let K=c,Q=l,re=d;c=null,l=null,d=null,v=!1,re&&(re.pause(),re.removeAttribute("src"),re.load());let le=Q?.querySelector(".preview-entry");le?.setAttribute("aria-expanded","false"),le?.removeAttribute("aria-controls"),Q?.classList.remove("is-previewing"),e.classList.remove("has-preview"),K?.remove(),A&&le?.isConnected&&(k=!0,le.focus({preventScroll:!0}),k=!1)}function fe(){if(!l||!c)return;let A=l.getBoundingClientRect(),K=Math.min(360,innerWidth-32);c.style.width=`${K}px`,c.style.maxHeight=`${Math.max(120,innerHeight-32)}px`;let Q=c.getBoundingClientRect().height,re,le;if(innerWidth-A.right>=K+24)re=A.right+8;else if(A.left>=K+24)re=A.left-K-8;else{re=Math.max(16,Math.min(A.left,innerWidth-K-16));let be=innerHeight-A.bottom-24,Oe=A.top-24;be>=Math.min(Q,180)?(c.style.maxHeight=`${be}px`,le=A.bottom+8):Oe>=Math.min(Q,180)?(c.style.maxHeight=`${Oe}px`,le=Math.max(16,A.top-Q-8)):(le=Math.max(16,A.top+l.querySelector(".plugin-topline").getBoundingClientRect().height+32),c.style.maxHeight=`${Math.max(100,innerHeight-le-16)}px`)}le??=Math.max(16,Math.min(A.top,innerHeight-Q-16)),Object.assign(c.style,{left:`${re}px`,top:`${le}px`,visibility:"visible"})}function et(){!v&&!N&&!Z&&(h=setTimeout(()=>ie(),100))}async function Nt(A,K,Q,re){let le=(await M())?.[A];if(re!==y||!c||!le)return;T=new AbortController;let be=T.signal,Oe,at,He=!1;Q.textContent=o("\u6B63\u5728\u52A0\u8F7D\u9884\u89C8\u2026","Loading preview\u2026");let pt=await Promise.all(["poster","video"].map(async jt=>{if(!le[jt])return null;try{return await De(A,jt,le[jt],be)}catch{return He=!0,null}}));if(re!==y)return;[Oe,at]=pt,Q.textContent=He?o("\u8D44\u6E90\u6682\u4E0D\u53EF\u7528 \xB7 \u8BF7\u53C2\u8003\u8BF4\u660E","Preview unavailable \xB7 See description"):o("\u6F14\u793A\u89C6\u9891\u51C6\u5907\u4E2D","Demo video coming soon");let ue=null;if(Oe&&(ue=B("img","preview-poster"),ue.alt=o("\u529F\u80FD\u9759\u6001\u9884\u89C8","Static feature preview"),ue.addEventListener("load",fe,{once:!0}),ue.addEventListener("error",()=>{ue.remove(),He=!0,d||(Q.textContent=o("\u8D44\u6E90\u6682\u4E0D\u53EF\u7528 \xB7 \u8BF7\u53C2\u8003\u8BF4\u660E","Preview unavailable \xB7 See description")),fe()},{once:!0}),ue.src=Oe,K.append(ue),Q.textContent=o("\u9759\u6001\u9884\u89C8","Static preview")),!at){fe();return}if(s.matches){fe();return}let ne=B("video","preview-video");d=ne,ne.muted=!0,ne.playsInline=!0,ne.preload="metadata",ne.hidden=!0;let zt=()=>{c.classList.remove("is-media-only"),ue&&(ue.hidden=!1)},zr=()=>{re===y&&(clearTimeout(f),ne.pause(),ne.removeAttribute("src"),ne.load(),ne.remove(),d=null,zt(),Q.textContent=ue?.isConnected?o("\u89C6\u9891\u6682\u4E0D\u53EF\u7528 \xB7 \u9759\u6001\u9884\u89C8","Video unavailable \xB7 Static preview"):o("\u89C6\u9891\u6682\u4E0D\u53EF\u7528 \xB7 \u8BF7\u53C2\u8003\u8BF4\u660E","Video unavailable \xB7 See description"),fe())};ne.addEventListener("error",zr,{once:!0}),ne.addEventListener("loadeddata",()=>{re===y&&fe()}),ne.addEventListener("play",()=>{re===y&&(ne.hidden=!1,ue&&(ue.hidden=!0),c.classList.add("is-media-only"),fe())});let Wt=async()=>{if(re===y)try{await ne.play()}catch{re===y&&d===ne&&ne.isConnected&&(ne.hidden=!0,zt(),Q.textContent=ue?.isConnected?o("\u9759\u6001\u9884\u89C8","Static preview"):o("\u6F14\u793A\u89C6\u9891\u51C6\u5907\u4E2D","Demo video coming soon"),fe())}};ne.addEventListener("ended",()=>{clearTimeout(f),f=setTimeout(()=>{re!==y||d!==ne||(ne.currentTime=0,Wt())},2e3)}),K.append(ne),Q.textContent=o("\u6B63\u5728\u52A0\u8F7D\u6F14\u793A\u2026","Loading demo\u2026"),ne.src=at,Wt(),fe()}function mt(A,K=!1){if(clearTimeout(m),clearTimeout(h),A===l){v||=K;return}ie(),Z=!1,l=A,v=K,c=B("section","feature-preview"),c.id="feature-preview",c.setAttribute("role","region");let Q=B("h3","preview-title",A.querySelector(".plugin-name").textContent);Q.id="feature-preview-title",c.setAttribute("aria-labelledby",Q.id);let re=B("button","button quiet preview-close",o("\u5173\u95ED","Close"));re.type="button",re.addEventListener("click",()=>ie({restore:v||c.contains(document.activeElement)}));let le=B("div","preview-heading");le.append(Q,re),c.append(le);let be=B("div","preview-media");c.append(be);let Oe=B("dl","preview-details"),at=[o("\u51FA\u73B0\u4F4D\u7F6E","Location"),o("\u89E3\u51B3\u95EE\u9898","Problem"),o("\u64CD\u4F5C\u4E0E\u6548\u679C","Action and result")];q$(A.dataset.featureId,t).forEach((ue,ne)=>{Oe.append(B("dt","",at[ne]),B("dd","",ue))});let He=B("p","preview-resource-state",o("\u6F14\u793A\u89C6\u9891\u51C6\u5907\u4E2D","Demo video coming soon"));c.append(Oe,He),c.addEventListener("pointerenter",()=>{Z=!0,clearTimeout(h)}),c.addEventListener("pointerleave",()=>{Z=!1,et()}),c.addEventListener("focusin",()=>{clearTimeout(h)}),c.addEventListener("focusout",ue=>{!c?.contains(ue.relatedTarget)&&!l?.contains(ue.relatedTarget)&&ie()}),document.querySelector(".dashboard-surface").append(c),A.classList.add("is-previewing"),e.classList.add("has-preview");let pt=A.querySelector(".preview-entry");pt.setAttribute("aria-expanded","true"),pt.setAttribute("aria-controls",c.id),fe(),Nt(A.dataset.featureId,be,He,y)}function Gt(A){let K=B("button","preview-entry");K.type="button",K.setAttribute("aria-expanded","false"),K.setAttribute("aria-label",`${o("\u67E5\u770B\u6548\u679C","See how it works")} \xB7 ${A.querySelector(".plugin-name").textContent||A.dataset.featureId}`),A.append(K),i(A,"pointerenter",()=>{a.matches&&(N=A,X=A,clearTimeout(m),clearTimeout(h),m=setTimeout(()=>{X=null,mt(A)},200))}),i(A,"pointerleave",()=>{N===A&&(N=null),X===A&&(clearTimeout(m),X=null),et()}),i(K,"focus",()=>{k||mt(A)}),i(K,"click",()=>mt(A,!0)),i(A,"focusout",Q=>{!A.contains(Q.relatedTarget)&&!c?.contains(Q.relatedTarget)&&document.documentElement.dataset.input==="keyboard"&&ie()})}i(document,"keydown",A=>{if(A.key==="Escape"&&l){A.preventDefault();let K=v||c.contains(document.activeElement);ie({restore:K})}}),i(document,"pointerdown",A=>{l&&!l.contains(A.target)&&!c.contains(A.target)&&ie()}),i(window,"scroll",A=>{c?.contains(A.target)||ie()},{capture:!0}),i(window,"resize",()=>ie()),i(document,"visibilitychange",()=>{document.hidden&&ie()}),i(window,"blur",()=>ie()),i(document.querySelector("#data-dialog"),"toggle",()=>ie()),i(document.querySelector("#language-menu"),"toggle",()=>ie()),i(window,"pagehide",()=>{ie(),r.abort()});function $t(A){ie(),t=A,n=t==="zh-CN";for(let K of e.querySelectorAll(".plugin-card"))K.querySelector(".preview-entry")?.setAttribute("aria-label",`${o("\u67E5\u770B\u6548\u679C","See how it works")} \xB7 ${K.querySelector(".plugin-name").textContent}`)}return{attach:Gt,close:ie,setLocale:$t}}var F$=Nr(()=>{V$()});function H$(e){return{minecodexVersion:e?.version??null,codexBuild:e?.renderer?.codexBuild??e?.runtime?.codex?.version??null,buildSource:e?.renderer?.buildSource??null,verification:"runtime-observation-only",targets:(e?.renderer?.targets??[]).map(t=>({targetId:t.targetId,checkedAt:t.checkedAt,reason:t.reason??null,tokens:t.tokens,capabilities:t.capabilities,plugins:(t.plugins??[]).map(n=>({featureId:n.featureId,installation:n.installation,state:n.state,reason:n.reason,checks:n.checks,tokens:n.tokens}))})),services:(e?.features??[]).map(t=>({featureId:t.id,state:t.state,failureCode:t.failure?.code??null}))}}var J$=Nr(()=>{});async function gn(e,t={}){let n=window.minecodexMcpApp;if(!n)return fetch(e,t);let o=t.method??"GET",r=await n.callServerTool({name:o==="GET"?"minecodex_read":"minecodex_write",arguments:{route:e,method:o,locale:new Headers(t.headers).get("Accept-Language")??document.documentElement.lang,...t.body?{body:JSON.parse(t.body)}:{}}});if(r.isError)throw new Error(r.content?.find(s=>s.type==="text")?.text??"MineCodex request failed");let{status:i,body:a}=r.structuredContent;return new Response(JSON.stringify(a),{status:i,headers:{"Content-Type":"application/json"}})}var jv=Nr(()=>{});var kT={};function W$(){document.querySelector("#brand-slogan").textContent=$e==="zh-CN"?"\u8BA9 Codex \u66F4\u987A\u624B\u3002":"Make Codex work better for you.",document.querySelector("#brand-description").textContent=$e==="zh-CN"?"\u6309\u9700\u5F00\u542F\u4EA4\u4E92\u589E\u5F3A\uFF0C\u8BA9\u65E5\u5E38\u4F7F\u7528\u66F4\u9AD8\u6548\u3002":"Enable the enhancements you need for a smoother daily workflow.";let e=document.querySelector("#language-button"),t=$e==="zh-CN"?"\u8BED\u8A00 \xB7 \u4E2D\u6587":"Language \xB7 English";e.setAttribute("aria-label",t),e.setAttribute("data-minecodex-tooltip",t),q.languageToggle.setAttribute("aria-label",$e==="zh-CN"?"\u8BED\u8A00":"Language"),document.querySelector("#language-menu").setAttribute("aria-label",$e==="zh-CN"?"\u8BED\u8A00":"Language");for(let n of q.languageButtons)n.setAttribute("aria-pressed",String(n.dataset.languageChoice===$e));q.restartTitle.textContent=oe.restartTitle,q.restartCopy.textContent=oe.restartCopy,q.restartButton.querySelector(".button-label").textContent=oe.restart,q.pluginsHeading.textContent=oe.plugins,q.errorTitle.textContent=oe.loadError,q.errorCopy.textContent=oe.loadErrorCopy,q.retryButton.textContent=oe.retry,q.versionLabel.textContent=oe.version,q.diagnosticsButton.textContent=oe.copyDiagnostics,q.updateButton.querySelector(".button-label").textContent=oe.checkUpdates}function bT(e){let t=e.state??(e.failure?"failed":e.healthy?"healthy":e.injected?"injected":e.applied?"launching":e.enabled?"restart-required":"stopped"),n=oe.states[t]??oe.states.stopped,o={healthy:"is-active",injected:"is-active",configured:"is-warning",failed:"is-failed",launching:"is-warning","restart-required":"is-warning",saved:"is-warning",stopped:"is-stopped"}[t]??"is-warning";return{label:e.failure?.message&&t==="failed"?`${n}: ${oe.failureDetail}`:n,className:o}}function Xe(e,t){let n=document.createElement(e);return t&&(n.className=t),n}function yT(e){let t=Xe("article","plugin-card");t.dataset.featureId=e.id;let n=Xe("div","plugin-icon");n.setAttribute("aria-hidden","true");let o=Xe("img");o.alt="",o.width=24,o.height=24,n.append(o);let r=Xe("div","plugin-copy"),i=Xe("div","plugin-title-line"),a=Xe("h3","plugin-name");i.append(a);let s=Xe("p","plugin-description");r.append(i,s);let l=Xe("div","plugin-topline"),c=Xe("label","switch"),d=Xe("input");d.type="checkbox",d.name=`feature-${e.id}`,d.setAttribute("role","switch"),d.setAttribute("aria-describedby",`description-${e.id} state-${e.id}`),s.id=`description-${e.id}`;let m=Xe("span","switch-track");m.setAttribute("aria-hidden","true"),c.append(d,m);let h=Xe("span","plugin-state"),f=Xe("span","status-dot");f.setAttribute("aria-hidden","true");let v=Xe("span","plugin-state-label");return v.id=`state-${e.id}`,h.append(f,v),l.append(n,c),t.append(l,r,h),Vi.attach(t),t}function Ud(e,t){for(let d of q.languageButtons)d.disabled=yt.size>0;let n=bT(t),o=e.querySelector('input[type="checkbox"]'),r=e.querySelector(".plugin-icon img"),i=e.querySelector(".plugin-name"),a=e.querySelector(".plugin-description"),s=e.querySelector(".plugin-state .status-dot"),l=e.querySelector(".plugin-state-label");e.dataset.featureId=t.id,r.src=t.iconUrl.startsWith("data:")?t.iconUrl:`${t.iconUrl}?v=resource-1`,i.textContent=t.label,a.textContent=t.description,o.checked=!!t.enabled,o.disabled=yt.has(t.id),o.setAttribute("aria-label",t.label),s.className=`status-dot ${n.className}`,l.textContent=n.label,e.querySelector(".preview-entry")?.setAttribute("aria-label",`${$e==="zh-CN"?"\u67E5\u770B\u6548\u679C":"See how it works"} \xB7 ${t.label}`)}function Y$(e){return[...q.pluginList.querySelectorAll("[data-feature-id]")].find(t=>t.dataset.featureId===e)??null}function _T(e){e=e.filter(n=>n.id!=="unread-inbox");for(let n of[...q.pluginList.children])n.dataset.featureId||n.remove();let t=new Set(e.map(({id:n})=>n));for(let[n,o]of e.entries()){let r=Y$(o.id);r||(r=yT(o));let i=q.pluginList.children[n];i!==r&&q.pluginList.insertBefore(r,i??null),Ud(r,o)}for(let n of[...q.pluginList.querySelectorAll("[data-feature-id]")])n.dataset.featureId&&!t.has(n.dataset.featureId)&&(n.classList.contains("is-previewing")&&Vi.close(),n.remove());q.pluginList.setAttribute("aria-busy","false")}function X$(){q.versionValue.textContent=Qe?.version??"\u2014",q.restartNotice.hidden=!Qe?.pendingRestart}function $T(){X$(),_T(Qe?.features??[])}function zT(e){let t=document.activeElement,n=t?.closest?.("[data-feature-id]");return!n||n.dataset.featureId!==e?null:{featureId:e,input:t.matches?.('input[type="checkbox"]')}}function K$(e){if(!e?.input)return;Y$(e.featureId)?.querySelector('input[type="checkbox"]')?.focus()}function Dd(e){clearTimeout(B$),q.toast.textContent=e,q.toast.hidden=!1,B$=setTimeout(()=>{q.toast.hidden=!0},4200)}function Av(e,t){Qe.features=Qe.features.map(n=>n.id===e?{...n,...t}:n)}async function Tc(){q.loadError.hidden=!0;try{let e=await gn("/api/status",{headers:{"Accept-Language":$e}});if(!e.ok)throw new Error(`HTTP ${e.status}`);let t=await e.json();yt.size&&Qe&&(t.features=t.features.map(n=>yt.has(n.id)?Qe.features.find(o=>o.id===n.id)??n:n)),Qe=t,q.pluginList.hidden=!1,$T()}catch{Vi.close(),q.pluginList.hidden=!0,q.loadError.hidden=!1}}function Fi(){let e=window.minecodexHostTheme?window.minecodexHostTheme==="dark":Q$.matches,t=Zi==="dark"||Zi!=="light"&&e;document.documentElement.dataset.theme=t?"dark":"light",q.themeToggle.setAttribute("aria-label",$e==="zh-CN"?"\u5916\u89C2":"Appearance");for(let n of q.themeButtons){n.dataset.themeChoice=t?"dark":"light",n.querySelector(".ui-icon").className=`ui-icon ${t?"moon":"sun"}-icon`;let o=t?oe.darkAppearance:oe.lightAppearance,r=t?oe.lightAppearance:oe.darkAppearance,i=$e==="zh-CN"?`${o} \xB7 \u5207\u6362\u4E3A${r}`:`${o} \xB7 Switch to ${r.toLowerCase()}`;n.setAttribute("aria-label",i),n.setAttribute("data-minecodex-tooltip",i)}}async function wT(e){if(Uv)return;if(Vi.close(),Zi=document.documentElement.dataset.theme==="dark"?"light":"dark",!window.minecodexMcpApp)try{localStorage.setItem("minecodex-appearance",Zi)}catch{}if(!document.startViewTransition||matchMedia("(prefers-reduced-motion: reduce)").matches){Fi();return}let t=e.getBoundingClientRect(),n=t.left+t.width/2,o=t.top+t.height/2,r=Math.hypot(Math.max(n,innerWidth-n),Math.max(o,innerHeight-o)),i=document.startViewTransition(Fi);Uv=i;try{await i.ready,document.documentElement.animate({clipPath:[`circle(0px at ${n}px ${o}px)`,`circle(${r}px at ${n}px ${o}px)`]},{duration:420,easing:"cubic-bezier(0.23, 1, 0.32, 1)",pseudoElement:"::view-transition-new(root)"}),await i.finished}catch{i.skipTransition()}finally{Uv=null}}var Mv,$e,G$,oe,q,Qe,B$,yt,Vi,Q$,Zi,Uv,Dv,ez=Nr(()=>{F$();J$();jv();try{Mv=localStorage.getItem("minecodex-language")}catch{}$e=["en","zh-CN"].includes(Mv)?Mv:navigator.language.toLowerCase().startsWith("zh")?"zh-CN":"en";document.documentElement.lang=$e;G$={en:{plugins:"Your extensions",restartTitle:"Restart Codex to apply changes",restartCopy:"Your plugin choices are saved. Restart when you are ready.",restart:"Restart Codex",restarting:"Restarting\u2026",saved:"Saved",saving:"Saving\u2026",states:{saved:"Saved \u2014 restart Codex to apply",configured:"Configured \u2014 starting in Codex\u2026",launching:"Launching in Codex\u2026",injected:"Active in Codex",healthy:"Active in Codex",checking:"Checking compatibility\u2026",partial:"Available in some windows",degraded:"Appearance needs an update",unavailable:"Temporarily unavailable \u2014 check for updates","not-applicable":"Not needed on this page",failed:"Couldn\u2019t start \u2014 try again",stopped:"Stopped","restart-required":"Restart required \u2014 restart Codex"},loadError:"Couldn\u2019t load MineCodex",loadErrorCopy:"Check that the background service is running.",retry:"Try again",version:"Version",darkAppearance:"Dark appearance",lightAppearance:"Light appearance",updateFailed:"Couldn\u2019t check for updates. Please try again.",copyDiagnostics:"Copy diagnostics",diagnosticsCopied:"Diagnostics copied",diagnosticsFailed:"Couldn\u2019t copy diagnostics. Please try again.",checkUpdates:"Check for updates",checkingUpdates:"Checking\u2026",current:"You\u2019re up to date.",updateAvailable:e=>`MineCodex ${e} is available. Run mcx update in Terminal.`,changeFailed:"The plugin setting could not be saved.",restartFailed:"MineCodex could not restart Codex. Please try again or copy diagnostics.",failureDetail:"This extension could not be confirmed. Copy diagnostics to help investigate."},"zh-CN":{plugins:"\u529F\u80FD\u6269\u5C55",restartTitle:"\u91CD\u542F Codex \u4EE5\u5E94\u7528\u66F4\u6539",restartCopy:"\u63D2\u4EF6\u9009\u62E9\u5DF2\u7ECF\u4FDD\u5B58\uFF0C\u53EF\u4EE5\u5728\u51C6\u5907\u597D\u540E\u7EDF\u4E00\u91CD\u542F\u3002",restart:"\u91CD\u542F Codex",restarting:"\u6B63\u5728\u91CD\u542F\u2026",saved:"\u5DF2\u4FDD\u5B58",saving:"\u6B63\u5728\u4FDD\u5B58\u2026",states:{saved:"\u5DF2\u4FDD\u5B58\u2014\u2014\u91CD\u542F Codex \u540E\u5E94\u7528",configured:"\u5DF2\u914D\u7F6E\u2014\u2014\u6B63\u5728 Codex \u4E2D\u542F\u52A8\u2026",launching:"\u6B63\u5728 Codex \u4E2D\u542F\u52A8\u2026",injected:"\u5DF2\u5728 Codex \u4E2D\u751F\u6548",healthy:"\u5DF2\u5728 Codex \u4E2D\u751F\u6548",checking:"\u6B63\u5728\u81EA\u68C0\u2026",partial:"\u90E8\u5206\u7A97\u53E3\u53EF\u7528",degraded:"\u5916\u89C2\u9002\u914D\u9700\u8981\u66F4\u65B0",unavailable:"\u6682\u4E0D\u53EF\u7528\u2014\u2014\u8BF7\u68C0\u67E5\u66F4\u65B0","not-applicable":"\u5F53\u524D\u9875\u9762\u4E0D\u9002\u7528",failed:"\u6682\u65F6\u65E0\u6CD5\u542F\u52A8\u2014\u2014\u8BF7\u91CD\u8BD5",stopped:"\u5DF2\u505C\u6B62","restart-required":"\u9700\u8981\u91CD\u542F\u2014\u2014\u8BF7\u91CD\u542F Codex"},loadError:"\u65E0\u6CD5\u52A0\u8F7D MineCodex",loadErrorCopy:"\u8BF7\u68C0\u67E5\u540E\u53F0\u670D\u52A1\u662F\u5426\u6B63\u5728\u8FD0\u884C\u3002",retry:"\u91CD\u8BD5",version:"\u7248\u672C",darkAppearance:"\u6DF1\u8272\u5916\u89C2",lightAppearance:"\u6D45\u8272\u5916\u89C2",updateFailed:"\u6682\u65F6\u65E0\u6CD5\u68C0\u67E5\u66F4\u65B0\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",copyDiagnostics:"\u590D\u5236\u8BCA\u65AD\u4FE1\u606F",diagnosticsCopied:"\u8BCA\u65AD\u4FE1\u606F\u5DF2\u590D\u5236",diagnosticsFailed:"\u6682\u65F6\u65E0\u6CD5\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\uFF0C\u8BF7\u91CD\u8BD5\u3002",checkUpdates:"\u68C0\u67E5\u66F4\u65B0",checkingUpdates:"\u6B63\u5728\u68C0\u67E5\u2026",current:"\u5F53\u524D\u5DF2\u662F\u6700\u65B0\u7248\u672C\u3002",updateAvailable:e=>`\u53D1\u73B0 MineCodex ${e}\uFF0C\u8BF7\u5728\u7EC8\u7AEF\u8FD0\u884C mcx update\u3002`,changeFailed:"\u63D2\u4EF6\u8BBE\u7F6E\u4FDD\u5B58\u5931\u8D25\u3002",restartFailed:"MineCodex \u65E0\u6CD5\u91CD\u542F Codex\u3002\u8BF7\u91CD\u8BD5\u6216\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\u534F\u52A9\u6392\u67E5\u3002",failureDetail:"\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u8FD9\u9879\u529F\u80FD\u7684\u72B6\u6001\uFF0C\u53EF\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\u534F\u52A9\u6392\u67E5\u3002"}},oe=G$[$e],q={restartNotice:document.querySelector("#restart-notice"),restartTitle:document.querySelector("#restart-title"),restartCopy:document.querySelector("#restart-copy"),restartButton:document.querySelector("#restart-button"),pluginsHeading:document.querySelector("#plugins-heading"),saveState:document.querySelector("#save-state"),pluginList:document.querySelector("#plugin-list"),loadError:document.querySelector("#load-error"),errorTitle:document.querySelector("#error-title"),errorCopy:document.querySelector("#error-copy"),retryButton:document.querySelector("#retry-button"),versionLabel:document.querySelector("#version-label"),versionValue:document.querySelector("#version-value"),languageToggle:document.querySelector(".language-toggle"),languageButtons:[...document.querySelectorAll("[data-language-choice]")],themeToggle:document.querySelector(".theme-toggle"),themeButtons:[...document.querySelectorAll("[data-theme-choice]")],updateResult:document.querySelector("#update-result"),updateButton:document.querySelector("#update-button"),diagnosticsButton:document.querySelector("#diagnostics-button"),toast:document.querySelector("#toast")},Qe=null,B$=null,yt=new Set,Vi=Z$(q.pluginList,$e);q.pluginList.addEventListener("change",async e=>{let t=e.target.closest('input[type="checkbox"]'),n=t?.closest("[data-feature-id]");if(!t||!n||!Qe)return;let o=n.dataset.featureId,r={...Qe.features.find(a=>a.id===o)},i=zT(o);yt.add(o),Av(o,{enabled:t.checked,state:"saved"}),Ud(n,Qe.features.find(a=>a.id===o)),q.saveState.textContent=oe.saving;try{let a=await gn(`/api/features/${encodeURIComponent(o)}`,{method:"PATCH",headers:{"Content-Type":"application/json","Accept-Language":$e},body:JSON.stringify({enabled:t.checked})});if(!a.ok)throw new Error(`HTTP ${a.status}`);let s=await a.json(),l=s.features?.find(d=>d.id===o);l&&Av(o,l),Qe.pendingRestart=s.pendingRestart,yt.delete(o);let c=l??Qe.features.find(d=>d.id===o);c&&Ud(n,c),X$(),K$(i),q.saveState.textContent=yt.size?oe.saving:oe.saved}catch{yt.delete(o),Av(o,r),Ud(n,r),q.saveState.textContent=yt.size?oe.saving:"",K$(i),Dd(oe.changeFailed)}});q.restartButton.addEventListener("click",async()=>{q.restartButton.disabled=!0,q.restartButton.querySelector(".button-label").textContent=oe.restarting;try{let e=await gn("/api/restart",{method:"POST",headers:{"Content-Type":"application/json","Accept-Language":$e},body:"{}"});if(!e.ok)throw new Error(`HTTP ${e.status}`);await Tc()}catch{Dd(oe.restartFailed)}finally{q.restartButton.disabled=!1,q.restartButton.querySelector(".button-label").textContent=oe.restart}});q.retryButton.addEventListener("click",()=>{q.pluginList.hidden=!1,Tc()});q.diagnosticsButton.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(JSON.stringify(H$(Qe),null,2)),Dd(oe.diagnosticsCopied)}catch{Dd(oe.diagnosticsFailed)}});setInterval(()=>{!document.hidden&&!yt.size&&Tc()},5e3);q.updateButton.addEventListener("click",async()=>{q.updateButton.disabled=!0,q.updateButton.querySelector(".button-label").textContent=oe.checkingUpdates,q.updateResult.hidden=!0;try{let e=await gn("/api/update");if(!e.ok)throw new Error(`HTTP ${e.status}`);let t=await e.json();q.updateResult.textContent=t.available?oe.updateAvailable(t.latest):oe.current,q.updateResult.hidden=!1}catch{q.updateResult.textContent=oe.updateFailed,q.updateResult.hidden=!1}finally{q.updateButton.disabled=!1,q.updateButton.querySelector(".button-label").textContent=oe.checkUpdates}});Q$=matchMedia("(prefers-color-scheme: dark)"),Zi=null;if(!window.minecodexMcpApp)try{Zi=localStorage.getItem("minecodex-appearance")}catch{}Uv=null;q.themeToggle.addEventListener("click",e=>{let t=e.target.closest("[data-theme-choice]");t&&wT(t)});q.languageToggle.addEventListener("click",e=>{let t=e.target.closest("[data-language-choice]");if(!t||yt.size||q.restartButton.disabled)return;let n=t.dataset.languageChoice;if(n!==$e){try{localStorage.setItem("minecodex-language",n)}catch{return}if(Vi.close(),!window.minecodexMcpApp){location.reload();return}$e=n,oe=G$[$e],document.documentElement.lang=$e,Vi.setLocale($e),document.querySelector("#language-menu").hidePopover(),W$(),Fi(),q.updateResult.hidden=!0,q.toast.hidden=!0,window.dispatchEvent(new Event("minecodex-language")),Tc()}});Q$.addEventListener("change",Fi);window.addEventListener("minecodex-host-theme",()=>{Zi=null,Fi()});document.addEventListener("keydown",()=>{document.documentElement.dataset.input="keyboard"});document.addEventListener("pointerdown",()=>{document.documentElement.dataset.input="pointer"});W$();Fi();Tc();Dv=document.querySelector("#language-menu");Dv.addEventListener("toggle",e=>{if(document.querySelector("#language-button").setAttribute("aria-expanded",String(e.newState==="open")),e.newState!=="open")return;let t=document.querySelector("#language-button").getBoundingClientRect();Dv.style.left=`${Math.max(8,Math.min(t.right-140,innerWidth-148))}px`,Dv.style.top=`${t.bottom+8}px`})});function tz(e){let t="data-minecodex-tooltip",n=document.createElement("div");n.id="minecodex-feature-tooltip",n.setAttribute("role","tooltip"),n.hidden=!0;let o=document.createElement("style");o.setAttribute("data-minecodex-ui-styles","tooltip"),o.textContent=`
|
|
1
|
+
var uz=Object.defineProperty;var Nr=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var At=(e,t)=>{for(var n in t)uz(e,n,{get:t[n],enumerable:!0})};function q$(e,t){return ST[e]?.[t==="zh-CN"?0:1]??(t==="zh-CN"?["Codex \u4E2D\u5BF9\u5E94\u529F\u80FD\u7684\u4F4D\u7F6E\u3002","\u8BF7\u53C2\u8003\u529F\u80FD\u8BF4\u660E\u3002","\u6548\u679C\u53D6\u51B3\u4E8E\u5F53\u524D\u7248\u672C\u4E0E\u9002\u7528\u9875\u9762\u3002"]:["The feature\u2019s location in Codex.","Refer to the feature description.","Availability depends on the version and current page."])}var ST,V$=Nr(()=>{ST={"model-slider":[["\u8F93\u5165\u6846\u7684\u6A21\u578B\u9009\u62E9\u533A\u57DF\u3002","\u6A21\u578B\u4E0E\u601D\u8003\u6863\u4F4D\u5206\u6563\uFF0C\u5207\u6362\u4E0D\u591F\u76F4\u63A5\u3002","\u6253\u5F00\u6A21\u578B\u7A97\u53E3\uFF0C\u9009\u62E9\u6A21\u578B\u4E0E\u601D\u8003\u6863\u4F4D\uFF1B\u6536\u85CF\u5E38\u7528\u6A21\u578B\u4EE5\u4FBF\u518D\u6B21\u9009\u62E9\u3002"],["The model selector beside the composer.","Switching models and reasoning levels takes extra steps.","Open the model panel, choose a model and reasoning level, and save favorites for quick access."]],notes:[["\u5B98\u65B9 Prompt \u9875\u9762\u4E0E\u8F93\u5165\u6846\u65C1\u7684 Quick Prompts\u3002","\u5E38\u7528\u63D0\u793A\u8BCD\u9700\u8981\u53CD\u590D\u67E5\u627E\u548C\u590D\u5236\u3002","\u6309\u5206\u7C7B\u7BA1\u7406\u63D0\u793A\u8BCD\uFF0C\u4ECE Quick Prompts \u586B\u5165\u5F53\u524D\u8F93\u5165\u6846\uFF1B\u586B\u5165\u540E\u7531\u4F60\u68C0\u67E5\u5E76\u53D1\u9001\u3002"],["The Prompt page and Quick Prompts beside the composer.","Reusable prompts are hard to find and copy repeatedly.","Organize prompts by category and insert one into the current composer. Review it before sending."]],"usage-meter":[["Codex \u4FA7\u680F\u7684\u989D\u5EA6\u73AF\u3002","\u67E5\u770B\u5269\u4F59\u989D\u5EA6\u9700\u8981\u6253\u5F00\u8D26\u53F7\u83DC\u5355\u3002","\u7528\u989D\u5EA6\u73AF\u67E5\u770B\u4F7F\u7528\u6BD4\u4F8B\uFF0C\u70B9\u51FB\u6253\u5F00\u7528\u91CF\u8BE6\u60C5\u3002"],["The usage ring in the Codex sidebar.","Checking remaining usage requires opening the account menu.","Read usage at a glance, then click for usage details."]],"session-status":[["\u5F53\u524D\u4F1A\u8BDD\u7684\u72B6\u6001\u533A\u57DF\u3002","\u4F1A\u8BDD\u7528\u91CF\u4E0E\u751F\u6210\u901F\u5EA6\u4E0D\u5BB9\u6613\u96C6\u4E2D\u67E5\u770B\u3002","\u67E5\u770B\u5F53\u524D\u4F1A\u8BDD\u7684\u7528\u91CF\u3001\u4E0A\u4E0B\u6587\u548C\u751F\u6210\u6307\u6807\uFF1B\u53EF\u7528\u9879\u76EE\u53D6\u51B3\u4E8E\u4F1A\u8BDD\u4E0E\u63D0\u4F9B\u65B9\u3002"],["The current conversation\u2019s status area.","Usage and generation metrics are spread across the interface.","Read session usage, context and generation metrics when supported by the session and provider."]],"markdown-reading":[["Codex \u7684 Markdown \u6587\u4EF6\u9884\u89C8\u3002","\u957F\u6587\u9605\u8BFB\u3001\u811A\u6CE8\u8DF3\u8F6C\u548C\u8868\u683C\u67E5\u770B\u4E0D\u591F\u65B9\u4FBF\u3002","\u5728\u6587\u4EF6\u9884\u89C8\u4E2D\u9605\u8BFB\u589E\u5F3A\u6392\u7248\uFF0C\u4F7F\u7528\u76EE\u5F55\u3001\u811A\u6CE8\u548C\u8868\u683C\u64CD\u4F5C\u3002"],["Markdown file previews in Codex.","Long documents, footnotes and tables take extra effort to read.","Read enhanced formatting and use the outline, footnote navigation and table actions."]],"mermaid-diagrams":[["Markdown \u6587\u4EF6\u9884\u89C8\u4E2D\u7684 Mermaid \u56FE\u8868\u3002","\u5B9E\u9A8C\u6027\u56FE\u8868\u6837\u5F0F\u4E0E\u4EA4\u4E92\u4ECD\u5728\u5B8C\u5584\uFF0C\u9ED8\u8BA4\u5173\u95ED\u3002","\u6309\u9700\u5F00\u542F\u56FE\u8868\u589E\u5F3A\uFF0C\u4F7F\u7528\u7F29\u653E\u548C PNG \u4E0B\u8F7D\uFF1B\u5173\u95ED\u540E\u4F7F\u7528 Codex \u539F\u751F\u56FE\u8868\u3002"],["Mermaid diagrams in Markdown file previews.","Enhanced diagram styles and interactions are experimental and off by default.","Opt in to diagram zoom and PNG download. Turn it off to use native Codex diagrams."]],"file-navigation":[["Codex \u6587\u4EF6\u9884\u89C8\u4E0A\u65B9\u7684\u8DEF\u5F84\u533A\u57DF\u3002","\u6D4F\u89C8\u76F8\u90BB\u76EE\u5F55\u548C\u6587\u4EF6\u9700\u8981\u989D\u5916\u8DF3\u8F6C\u3002","\u70B9\u51FB\u8DEF\u5F84\u5C55\u5F00\u5206\u5217\u76EE\u5F55\uFF0C\u9010\u7EA7\u6D4F\u89C8\u5E76\u6253\u5F00\u53E6\u4E00\u4E2A\u6587\u4EF6\u3002"],["The path above a file preview in Codex.","Browsing nearby files and folders takes extra navigation.","Open the path to browse cascading folder columns and choose another file."]],"files-auto-refresh":[["Codex Side Panel \u7684 Files \u76EE\u5F55\u5217\u8868\u3002","Agent \u6539\u53D8\u9879\u76EE\u6587\u4EF6\u540E\uFF0C\u9700\u8981\u53CD\u590D\u6536\u8D77\u3001\u5C55\u5F00\u624D\u80FD\u770B\u5230\u65B0\u5217\u8868\u3002","\u4FDD\u6301 Files \u6253\u5F00\uFF0C\u81EA\u52A8\u540C\u6B65\u6839\u76EE\u5F55\u548C\u5DF2\u5C55\u5F00\u76EE\u5F55\uFF1B\u4FDD\u7559\u5F53\u524D\u6587\u4EF6\u4E0E\u6D4F\u89C8\u4F4D\u7F6E\u3002"],["The Files tree in the Codex side panel.","File changes can require collapsing and reopening the tree.","Keep Files open to refresh the root and expanded folders while preserving the current file and browsing position."]],images:[["Codex Library \u7684\u56FE\u7247\u96C6\u5408\u4E0E\u56FE\u7247\u67E5\u770B\u5668\u3002","\u67E5\u627E\u56FE\u7247\u53CA\u5176\u63D0\u793A\u8BCD\u9700\u8981\u6765\u56DE\u5207\u6362\u3002","\u6D4F\u89C8\u56FE\u7247\u96C6\u5408\uFF0C\u6253\u5F00\u56FE\u7247\u67E5\u770B\u5927\u56FE\u53CA\u53EF\u8FFD\u6EAF\u7684\u63D0\u793A\u8BCD\u4FE1\u606F\u3002"],["Image collections in Codex Library and the image viewer.","Finding images and their prompts requires switching views.","Browse collections, open an image, and inspect available prompt provenance."]],sites:[["Codex \u4E2D\u7684 Sites \u9875\u9762\u3002","\u672C\u5730\u9879\u76EE\u4E0E\u5E38\u7528\u7F51\u5740\u5206\u6563\u5728\u4E0D\u540C\u4F4D\u7F6E\u3002","\u6536\u85CF\u7F51\u5740\u3001\u53D1\u73B0\u6B63\u5728\u8FD0\u884C\u7684\u672C\u5730\u7AD9\u70B9\uFF0C\u5E76\u4ECE Sites \u6253\u5F00\u3002"],["The Sites page in Codex.","Local projects and saved links are scattered.","Save URLs, discover running local sites, and open them from Sites."]],"composer-expand":[["Work \u4E0E Codex \u7684\u8F93\u5165\u6846\u53F3\u4E0A\u89D2\u3002","\u957F\u6307\u4EE4\u53D7\u8F93\u5165\u6846\u9AD8\u5EA6\u9650\u5236\uFF0C\u7F16\u8F91\u65F6\u9700\u8981\u53CD\u590D\u6EDA\u52A8\u3002","\u8F93\u5165\u591A\u884C\u6587\u5B57\u540E\u70B9\u51FB\u5C55\u5F00\uFF1B\u7F16\u8F91\u5B8C\u6210\u540E\u6536\u8D77\uFF0C\u8349\u7A3F\u4FDD\u6301\u4E0D\u53D8\u3002"],["The upper-right corner of the Work and Codex composer.","Long drafts need repeated scrolling in a compact editor.","Enter a multiline draft and click Expand. Collapse when finished; your draft stays in place."]],"quick-chat":[["Codex \u7684\u6D6E\u52A8 Quick Chat \u7A97\u53E3\u3002","\u4E34\u65F6\u63D0\u95EE\u65F6\u9700\u8981\u5207\u6362\u4E3B\u7A97\u53E3\uFF0C\u5386\u53F2\u4E0D\u6613\u7EE7\u7EED\u3002","\u4ECE\u4FA7\u680F\u6216\u5FEB\u6377\u952E\u6253\u5F00 Quick Chat\uFF0C\u53D1\u9001\u540E\u5C55\u5F00\uFF0C\u6062\u590D\u6700\u5C0F\u5316\u8F93\u5165\u6846\u5E76\u67E5\u770B\u5386\u53F2\u3002"],["The floating Quick Chat window.","Quick questions and continuing recent chats require window switching.","Open Quick Chat from the sidebar or shortcut, expand after sending, restore a minimized composer and browse history."]],"sidebar-focus":[["Codex \u5DE6\u4FA7\u680F\u7684\u5206\u7EC4\u6807\u9898\u3002","\u591A\u4E2A\u4FA7\u680F\u5206\u7EC4\u5C55\u5F00\u65F6\uFF0C\u5F53\u524D\u5206\u7EC4\u4E0D\u5BB9\u6613\u805A\u7126\u3002","\u70B9\u51FB\u5F53\u524D\u5206\u7EC4\uFF0C\u4E00\u952E\u6536\u8D77\u5176\u4ED6\u5206\u7EC4\uFF1B\u518D\u6B21\u70B9\u51FB\u6062\u590D\u5148\u524D\u7684\u5C55\u5F00\u72B6\u6001\u3002"],["Group headings in the Codex sidebar.","Several expanded groups make the current group harder to focus on.","Click a group to collapse other groups. Click again to restore their previous expanded state."]]}});function Z$(e,t){let n=t==="zh-CN",o=(A,K)=>n?A:K,r=new AbortController,i=(A,K,Q,re={})=>A.addEventListener(K,Q,{...re,signal:r.signal}),a=matchMedia("(hover: hover) and (pointer: fine)"),s=matchMedia("(prefers-reduced-motion: reduce)"),l=null,c=null,d=null,m,h,f,v=!1,y=0,k=!1,T=null,R,N=null,Z=!1,X=null,M=()=>R??=window.minecodexPreviewMedia!==void 0?Promise.resolve(window.minecodexPreviewMedia):fetch("/assets/previews/manifest.json").then(A=>A.ok?A.json():{}).then(A=>A&&typeof A=="object"?A:{}).catch(()=>({})),B=(A,K,Q)=>{let re=document.createElement(A);return re.className=K,Q&&(re.textContent=Q),re};async function De(A,K,Q,re){if(!window.minecodexMcpApp)return`/assets/previews/${Q}`;let be=(await window.minecodexMcpApp.readServerResource({uri:`resource://minecodex/previews/${A}/${K}`},{signal:re})).contents?.[0];if(!be?.blob)throw new Error("Preview resource unavailable");return`data:${be.mimeType};base64,${be.blob}`}function ie({restore:A=!1}={}){clearTimeout(m),clearTimeout(h),clearTimeout(f),y++,T?.abort(),T=null;let K=c,Q=l,re=d;c=null,l=null,d=null,v=!1,re&&(re.pause(),re.removeAttribute("src"),re.load());let le=Q?.querySelector(".preview-entry");le?.setAttribute("aria-expanded","false"),le?.removeAttribute("aria-controls"),Q?.classList.remove("is-previewing"),e.classList.remove("has-preview"),K?.remove(),A&&le?.isConnected&&(k=!0,le.focus({preventScroll:!0}),k=!1)}function fe(){if(!l||!c)return;let A=l.getBoundingClientRect(),K=Math.min(360,innerWidth-32);c.style.width=`${K}px`,c.style.maxHeight=`${Math.max(120,innerHeight-32)}px`;let Q=c.getBoundingClientRect().height,re,le;if(innerWidth-A.right>=K+24)re=A.right+8;else if(A.left>=K+24)re=A.left-K-8;else{re=Math.max(16,Math.min(A.left,innerWidth-K-16));let be=innerHeight-A.bottom-24,Oe=A.top-24;be>=Math.min(Q,180)?(c.style.maxHeight=`${be}px`,le=A.bottom+8):Oe>=Math.min(Q,180)?(c.style.maxHeight=`${Oe}px`,le=Math.max(16,A.top-Q-8)):(le=Math.max(16,A.top+l.querySelector(".plugin-topline").getBoundingClientRect().height+32),c.style.maxHeight=`${Math.max(100,innerHeight-le-16)}px`)}le??=Math.max(16,Math.min(A.top,innerHeight-Q-16)),Object.assign(c.style,{left:`${re}px`,top:`${le}px`,visibility:"visible"})}function et(){!v&&!N&&!Z&&(h=setTimeout(()=>ie(),100))}async function Nt(A,K,Q,re){let le=(await M())?.[A];if(re!==y||!c||!le)return;T=new AbortController;let be=T.signal,Oe,at,He=!1;Q.textContent=o("\u6B63\u5728\u52A0\u8F7D\u9884\u89C8\u2026","Loading preview\u2026");let pt=await Promise.all(["poster","video"].map(async jt=>{if(!le[jt])return null;try{return await De(A,jt,le[jt],be)}catch{return He=!0,null}}));if(re!==y)return;[Oe,at]=pt,Q.textContent=He?o("\u8D44\u6E90\u6682\u4E0D\u53EF\u7528 \xB7 \u8BF7\u53C2\u8003\u8BF4\u660E","Preview unavailable \xB7 See description"):o("\u6F14\u793A\u89C6\u9891\u51C6\u5907\u4E2D","Demo video coming soon");let ue=null;if(Oe&&(ue=B("img","preview-poster"),ue.alt=o("\u529F\u80FD\u9759\u6001\u9884\u89C8","Static feature preview"),ue.addEventListener("load",fe,{once:!0}),ue.addEventListener("error",()=>{ue.remove(),He=!0,d||(Q.textContent=o("\u8D44\u6E90\u6682\u4E0D\u53EF\u7528 \xB7 \u8BF7\u53C2\u8003\u8BF4\u660E","Preview unavailable \xB7 See description")),fe()},{once:!0}),ue.src=Oe,K.append(ue),Q.textContent=o("\u9759\u6001\u9884\u89C8","Static preview")),!at){fe();return}if(s.matches){fe();return}let ne=B("video","preview-video");d=ne,ne.muted=!0,ne.playsInline=!0,ne.preload="metadata",ne.hidden=!0;let zt=()=>{c.classList.remove("is-media-only"),ue&&(ue.hidden=!1)},zr=()=>{re===y&&(clearTimeout(f),ne.pause(),ne.removeAttribute("src"),ne.load(),ne.remove(),d=null,zt(),Q.textContent=ue?.isConnected?o("\u89C6\u9891\u6682\u4E0D\u53EF\u7528 \xB7 \u9759\u6001\u9884\u89C8","Video unavailable \xB7 Static preview"):o("\u89C6\u9891\u6682\u4E0D\u53EF\u7528 \xB7 \u8BF7\u53C2\u8003\u8BF4\u660E","Video unavailable \xB7 See description"),fe())};ne.addEventListener("error",zr,{once:!0}),ne.addEventListener("loadeddata",()=>{re===y&&fe()}),ne.addEventListener("play",()=>{re===y&&(ne.hidden=!1,ue&&(ue.hidden=!0),c.classList.add("is-media-only"),fe())});let Wt=async()=>{if(re===y)try{await ne.play()}catch{re===y&&d===ne&&ne.isConnected&&(ne.hidden=!0,zt(),Q.textContent=ue?.isConnected?o("\u9759\u6001\u9884\u89C8","Static preview"):o("\u6F14\u793A\u89C6\u9891\u51C6\u5907\u4E2D","Demo video coming soon"),fe())}};ne.addEventListener("ended",()=>{clearTimeout(f),f=setTimeout(()=>{re!==y||d!==ne||(ne.currentTime=0,Wt())},2e3)}),K.append(ne),Q.textContent=o("\u6B63\u5728\u52A0\u8F7D\u6F14\u793A\u2026","Loading demo\u2026"),ne.src=at,Wt(),fe()}function mt(A,K=!1){if(clearTimeout(m),clearTimeout(h),A===l){v||=K;return}ie(),Z=!1,l=A,v=K,c=B("section","feature-preview"),c.id="feature-preview",c.setAttribute("role","region");let Q=B("h3","preview-title",A.querySelector(".plugin-name").textContent);Q.id="feature-preview-title",c.setAttribute("aria-labelledby",Q.id);let re=B("button","button quiet preview-close",o("\u5173\u95ED","Close"));re.type="button",re.addEventListener("click",()=>ie({restore:v||c.contains(document.activeElement)}));let le=B("div","preview-heading");le.append(Q,re),c.append(le);let be=B("div","preview-media");c.append(be);let Oe=B("dl","preview-details"),at=[o("\u51FA\u73B0\u4F4D\u7F6E","Location"),o("\u89E3\u51B3\u95EE\u9898","Problem"),o("\u64CD\u4F5C\u4E0E\u6548\u679C","Action and result")];q$(A.dataset.featureId,t).forEach((ue,ne)=>{Oe.append(B("dt","",at[ne]),B("dd","",ue))});let He=B("p","preview-resource-state",o("\u6F14\u793A\u89C6\u9891\u51C6\u5907\u4E2D","Demo video coming soon"));c.append(Oe,He),c.addEventListener("pointerenter",()=>{Z=!0,clearTimeout(h)}),c.addEventListener("pointerleave",()=>{Z=!1,et()}),c.addEventListener("focusin",()=>{clearTimeout(h)}),c.addEventListener("focusout",ue=>{!c?.contains(ue.relatedTarget)&&!l?.contains(ue.relatedTarget)&&ie()}),document.querySelector(".dashboard-surface").append(c),A.classList.add("is-previewing"),e.classList.add("has-preview");let pt=A.querySelector(".preview-entry");pt.setAttribute("aria-expanded","true"),pt.setAttribute("aria-controls",c.id),fe(),Nt(A.dataset.featureId,be,He,y)}function Gt(A){let K=B("button","preview-entry");K.type="button",K.setAttribute("aria-expanded","false"),K.setAttribute("aria-label",`${o("\u67E5\u770B\u6548\u679C","See how it works")} \xB7 ${A.querySelector(".plugin-name").textContent||A.dataset.featureId}`),A.append(K),i(A,"pointerenter",()=>{a.matches&&(N=A,X=A,clearTimeout(m),clearTimeout(h),m=setTimeout(()=>{X=null,mt(A)},200))}),i(A,"pointerleave",()=>{N===A&&(N=null),X===A&&(clearTimeout(m),X=null),et()}),i(K,"focus",()=>{k||mt(A)}),i(K,"click",()=>mt(A,!0)),i(A,"focusout",Q=>{!A.contains(Q.relatedTarget)&&!c?.contains(Q.relatedTarget)&&document.documentElement.dataset.input==="keyboard"&&ie()})}i(document,"keydown",A=>{if(A.key==="Escape"&&l){A.preventDefault();let K=v||c.contains(document.activeElement);ie({restore:K})}}),i(document,"pointerdown",A=>{l&&!l.contains(A.target)&&!c.contains(A.target)&&ie()}),i(window,"scroll",A=>{c?.contains(A.target)||ie()},{capture:!0}),i(window,"resize",()=>ie()),i(document,"visibilitychange",()=>{document.hidden&&ie()}),i(window,"blur",()=>ie()),i(document.querySelector("#data-dialog"),"toggle",()=>ie()),i(document.querySelector("#language-menu"),"toggle",()=>ie()),i(window,"pagehide",()=>{ie(),r.abort()});function $t(A){ie(),t=A,n=t==="zh-CN";for(let K of e.querySelectorAll(".plugin-card"))K.querySelector(".preview-entry")?.setAttribute("aria-label",`${o("\u67E5\u770B\u6548\u679C","See how it works")} \xB7 ${K.querySelector(".plugin-name").textContent}`)}return{attach:Gt,close:ie,setLocale:$t}}var F$=Nr(()=>{V$()});function H$(e){return{minecodexVersion:e?.version??null,codexBuild:e?.renderer?.codexBuild??e?.runtime?.codex?.version??null,buildSource:e?.renderer?.buildSource??null,verification:"runtime-observation-only",targets:(e?.renderer?.targets??[]).map(t=>({targetId:t.targetId,checkedAt:t.checkedAt,reason:t.reason??null,tokens:t.tokens,capabilities:t.capabilities,plugins:(t.plugins??[]).map(n=>({featureId:n.featureId,installation:n.installation,state:n.state,reason:n.reason,checks:n.checks,tokens:n.tokens}))})),services:(e?.features??[]).map(t=>({featureId:t.id,state:t.state,failureCode:t.failure?.code??null}))}}var J$=Nr(()=>{});async function gn(e,t={}){let n=window.minecodexMcpApp;if(!n)return fetch(e,t);let o=t.method??"GET",r=await n.callServerTool({name:o==="GET"?"minecodex_read":"minecodex_write",arguments:{route:e,method:o,locale:new Headers(t.headers).get("Accept-Language")??document.documentElement.lang,...t.body?{body:JSON.parse(t.body)}:{}}});if(r.isError)throw new Error(r.content?.find(s=>s.type==="text")?.text??"MineCodex request failed");let{status:i,body:a}=r.structuredContent;return new Response(JSON.stringify(a),{status:i,headers:{"Content-Type":"application/json"}})}var jv=Nr(()=>{});var kT={};function W$(){document.querySelector("#brand-slogan").textContent=$e==="zh-CN"?"\u8BA9 Codex \u66F4\u987A\u624B\u3002":"Make Codex work better for you.",document.querySelector("#brand-description").textContent=$e==="zh-CN"?"\u6309\u9700\u5F00\u542F\u4EA4\u4E92\u589E\u5F3A\uFF0C\u8BA9\u65E5\u5E38\u4F7F\u7528\u66F4\u9AD8\u6548\u3002":"Enable the enhancements you need for a smoother daily workflow.";let e=document.querySelector("#language-button"),t=$e==="zh-CN"?"\u8BED\u8A00 \xB7 \u4E2D\u6587":"Language \xB7 English";e.setAttribute("aria-label",t),e.setAttribute("data-minecodex-tooltip",t),q.languageToggle.setAttribute("aria-label",$e==="zh-CN"?"\u8BED\u8A00":"Language"),document.querySelector("#language-menu").setAttribute("aria-label",$e==="zh-CN"?"\u8BED\u8A00":"Language");for(let n of q.languageButtons)n.setAttribute("aria-pressed",String(n.dataset.languageChoice===$e));q.restartTitle.textContent=oe.restartTitle,q.restartCopy.textContent=oe.restartCopy,q.restartButton.querySelector(".button-label").textContent=oe.restart,q.pluginsHeading.textContent=oe.plugins,q.errorTitle.textContent=oe.loadError,q.errorCopy.textContent=oe.loadErrorCopy,q.retryButton.textContent=oe.retry,q.versionLabel.textContent=oe.version,q.diagnosticsButton.textContent=oe.copyDiagnostics,q.updateButton.querySelector(".button-label").textContent=oe.checkUpdates}function bT(e){let t=e.state??(e.failure?"failed":e.healthy?"healthy":e.injected?"injected":e.applied?"launching":e.enabled?"restart-required":"stopped"),n=oe.states[t]??oe.states.stopped,o={healthy:"is-active",injected:"is-active",configured:"is-warning",failed:"is-failed",launching:"is-warning","restart-required":"is-warning",saved:"is-warning",stopped:"is-stopped"}[t]??"is-warning";return{label:e.failure?.message&&t==="failed"?`${n}: ${oe.failureDetail}`:n,className:o}}function Xe(e,t){let n=document.createElement(e);return t&&(n.className=t),n}function yT(e){let t=Xe("article","plugin-card");t.dataset.featureId=e.id;let n=Xe("div","plugin-icon");n.setAttribute("aria-hidden","true");let o=Xe("img");o.alt="",o.width=24,o.height=24,n.append(o);let r=Xe("div","plugin-copy"),i=Xe("div","plugin-title-line"),a=Xe("h3","plugin-name");i.append(a);let s=Xe("p","plugin-description");r.append(i,s);let l=Xe("div","plugin-topline"),c=Xe("label","switch"),d=Xe("input");d.type="checkbox",d.name=`feature-${e.id}`,d.setAttribute("role","switch"),d.setAttribute("aria-describedby",`description-${e.id} state-${e.id}`),s.id=`description-${e.id}`;let m=Xe("span","switch-track");m.setAttribute("aria-hidden","true"),c.append(d,m);let h=Xe("span","plugin-state"),f=Xe("span","status-dot");f.setAttribute("aria-hidden","true");let v=Xe("span","plugin-state-label");return v.id=`state-${e.id}`,h.append(f,v),l.append(n,c),t.append(l,r,h),Vi.attach(t),t}function Ud(e,t){for(let d of q.languageButtons)d.disabled=yt.size>0;let n=bT(t),o=e.querySelector('input[type="checkbox"]'),r=e.querySelector(".plugin-icon img"),i=e.querySelector(".plugin-name"),a=e.querySelector(".plugin-description"),s=e.querySelector(".plugin-state .status-dot"),l=e.querySelector(".plugin-state-label");e.dataset.featureId=t.id,r.src=t.iconUrl.startsWith("data:")?t.iconUrl:`${t.iconUrl}?v=resource-1`,i.textContent=t.label,a.textContent=t.description,o.checked=!!t.enabled,o.disabled=yt.has(t.id),o.setAttribute("aria-label",t.label),s.className=`status-dot ${n.className}`,l.textContent=n.label,e.querySelector(".preview-entry")?.setAttribute("aria-label",`${$e==="zh-CN"?"\u67E5\u770B\u6548\u679C":"See how it works"} \xB7 ${t.label}`)}function Y$(e){return[...q.pluginList.querySelectorAll("[data-feature-id]")].find(t=>t.dataset.featureId===e)??null}function _T(e){e=e.filter(n=>!["unread-inbox","hide-upsell-banner"].includes(n.id));for(let n of[...q.pluginList.children])n.dataset.featureId||n.remove();let t=new Set(e.map(({id:n})=>n));for(let[n,o]of e.entries()){let r=Y$(o.id);r||(r=yT(o));let i=q.pluginList.children[n];i!==r&&q.pluginList.insertBefore(r,i??null),Ud(r,o)}for(let n of[...q.pluginList.querySelectorAll("[data-feature-id]")])n.dataset.featureId&&!t.has(n.dataset.featureId)&&(n.classList.contains("is-previewing")&&Vi.close(),n.remove());q.pluginList.setAttribute("aria-busy","false")}function X$(){q.versionValue.textContent=Qe?.version??"\u2014",q.restartNotice.hidden=!Qe?.pendingRestart}function $T(){X$(),_T(Qe?.features??[])}function zT(e){let t=document.activeElement,n=t?.closest?.("[data-feature-id]");return!n||n.dataset.featureId!==e?null:{featureId:e,input:t.matches?.('input[type="checkbox"]')}}function K$(e){if(!e?.input)return;Y$(e.featureId)?.querySelector('input[type="checkbox"]')?.focus()}function Dd(e){clearTimeout(B$),q.toast.textContent=e,q.toast.hidden=!1,B$=setTimeout(()=>{q.toast.hidden=!0},4200)}function Av(e,t){Qe.features=Qe.features.map(n=>n.id===e?{...n,...t}:n)}async function Tc(){q.loadError.hidden=!0;try{let e=await gn("/api/status",{headers:{"Accept-Language":$e}});if(!e.ok)throw new Error(`HTTP ${e.status}`);let t=await e.json();yt.size&&Qe&&(t.features=t.features.map(n=>yt.has(n.id)?Qe.features.find(o=>o.id===n.id)??n:n)),Qe=t,q.pluginList.hidden=!1,$T()}catch{Vi.close(),q.pluginList.hidden=!0,q.loadError.hidden=!1}}function Fi(){let e=window.minecodexHostTheme?window.minecodexHostTheme==="dark":Q$.matches,t=Zi==="dark"||Zi!=="light"&&e;document.documentElement.dataset.theme=t?"dark":"light",q.themeToggle.setAttribute("aria-label",$e==="zh-CN"?"\u5916\u89C2":"Appearance");for(let n of q.themeButtons){n.dataset.themeChoice=t?"dark":"light",n.querySelector(".ui-icon").className=`ui-icon ${t?"moon":"sun"}-icon`;let o=t?oe.darkAppearance:oe.lightAppearance,r=t?oe.lightAppearance:oe.darkAppearance,i=$e==="zh-CN"?`${o} \xB7 \u5207\u6362\u4E3A${r}`:`${o} \xB7 Switch to ${r.toLowerCase()}`;n.setAttribute("aria-label",i),n.setAttribute("data-minecodex-tooltip",i)}}async function wT(e){if(Uv)return;if(Vi.close(),Zi=document.documentElement.dataset.theme==="dark"?"light":"dark",!window.minecodexMcpApp)try{localStorage.setItem("minecodex-appearance",Zi)}catch{}if(!document.startViewTransition||matchMedia("(prefers-reduced-motion: reduce)").matches){Fi();return}let t=e.getBoundingClientRect(),n=t.left+t.width/2,o=t.top+t.height/2,r=Math.hypot(Math.max(n,innerWidth-n),Math.max(o,innerHeight-o)),i=document.startViewTransition(Fi);Uv=i;try{await i.ready,document.documentElement.animate({clipPath:[`circle(0px at ${n}px ${o}px)`,`circle(${r}px at ${n}px ${o}px)`]},{duration:420,easing:"cubic-bezier(0.23, 1, 0.32, 1)",pseudoElement:"::view-transition-new(root)"}),await i.finished}catch{i.skipTransition()}finally{Uv=null}}var Mv,$e,G$,oe,q,Qe,B$,yt,Vi,Q$,Zi,Uv,Dv,ez=Nr(()=>{F$();J$();jv();try{Mv=localStorage.getItem("minecodex-language")}catch{}$e=["en","zh-CN"].includes(Mv)?Mv:navigator.language.toLowerCase().startsWith("zh")?"zh-CN":"en";document.documentElement.lang=$e;G$={en:{plugins:"Your extensions",restartTitle:"Restart Codex to apply changes",restartCopy:"Your plugin choices are saved. Restart when you are ready.",restart:"Restart Codex",restarting:"Restarting\u2026",saved:"Saved",saving:"Saving\u2026",states:{saved:"Saved \u2014 restart Codex to apply",configured:"Configured \u2014 starting in Codex\u2026",launching:"Launching in Codex\u2026",injected:"Active in Codex",healthy:"Active in Codex",checking:"Checking compatibility\u2026",partial:"Available in some windows",degraded:"Appearance needs an update",unavailable:"Temporarily unavailable \u2014 check for updates","not-applicable":"Not needed on this page",failed:"Couldn\u2019t start \u2014 try again",stopped:"Stopped","restart-required":"Restart required \u2014 restart Codex"},loadError:"Couldn\u2019t load MineCodex",loadErrorCopy:"Check that the background service is running.",retry:"Try again",version:"Version",darkAppearance:"Dark appearance",lightAppearance:"Light appearance",updateFailed:"Couldn\u2019t check for updates. Please try again.",copyDiagnostics:"Copy diagnostics",diagnosticsCopied:"Diagnostics copied",diagnosticsFailed:"Couldn\u2019t copy diagnostics. Please try again.",checkUpdates:"Check for updates",checkingUpdates:"Checking\u2026",current:"You\u2019re up to date.",updateAvailable:e=>`MineCodex ${e} is available. Run mcx update in Terminal.`,changeFailed:"The plugin setting could not be saved.",restartFailed:"MineCodex could not restart Codex. Please try again or copy diagnostics.",failureDetail:"This extension could not be confirmed. Copy diagnostics to help investigate."},"zh-CN":{plugins:"\u529F\u80FD\u6269\u5C55",restartTitle:"\u91CD\u542F Codex \u4EE5\u5E94\u7528\u66F4\u6539",restartCopy:"\u63D2\u4EF6\u9009\u62E9\u5DF2\u7ECF\u4FDD\u5B58\uFF0C\u53EF\u4EE5\u5728\u51C6\u5907\u597D\u540E\u7EDF\u4E00\u91CD\u542F\u3002",restart:"\u91CD\u542F Codex",restarting:"\u6B63\u5728\u91CD\u542F\u2026",saved:"\u5DF2\u4FDD\u5B58",saving:"\u6B63\u5728\u4FDD\u5B58\u2026",states:{saved:"\u5DF2\u4FDD\u5B58\u2014\u2014\u91CD\u542F Codex \u540E\u5E94\u7528",configured:"\u5DF2\u914D\u7F6E\u2014\u2014\u6B63\u5728 Codex \u4E2D\u542F\u52A8\u2026",launching:"\u6B63\u5728 Codex \u4E2D\u542F\u52A8\u2026",injected:"\u5DF2\u5728 Codex \u4E2D\u751F\u6548",healthy:"\u5DF2\u5728 Codex \u4E2D\u751F\u6548",checking:"\u6B63\u5728\u81EA\u68C0\u2026",partial:"\u90E8\u5206\u7A97\u53E3\u53EF\u7528",degraded:"\u5916\u89C2\u9002\u914D\u9700\u8981\u66F4\u65B0",unavailable:"\u6682\u4E0D\u53EF\u7528\u2014\u2014\u8BF7\u68C0\u67E5\u66F4\u65B0","not-applicable":"\u5F53\u524D\u9875\u9762\u4E0D\u9002\u7528",failed:"\u6682\u65F6\u65E0\u6CD5\u542F\u52A8\u2014\u2014\u8BF7\u91CD\u8BD5",stopped:"\u5DF2\u505C\u6B62","restart-required":"\u9700\u8981\u91CD\u542F\u2014\u2014\u8BF7\u91CD\u542F Codex"},loadError:"\u65E0\u6CD5\u52A0\u8F7D MineCodex",loadErrorCopy:"\u8BF7\u68C0\u67E5\u540E\u53F0\u670D\u52A1\u662F\u5426\u6B63\u5728\u8FD0\u884C\u3002",retry:"\u91CD\u8BD5",version:"\u7248\u672C",darkAppearance:"\u6DF1\u8272\u5916\u89C2",lightAppearance:"\u6D45\u8272\u5916\u89C2",updateFailed:"\u6682\u65F6\u65E0\u6CD5\u68C0\u67E5\u66F4\u65B0\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",copyDiagnostics:"\u590D\u5236\u8BCA\u65AD\u4FE1\u606F",diagnosticsCopied:"\u8BCA\u65AD\u4FE1\u606F\u5DF2\u590D\u5236",diagnosticsFailed:"\u6682\u65F6\u65E0\u6CD5\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\uFF0C\u8BF7\u91CD\u8BD5\u3002",checkUpdates:"\u68C0\u67E5\u66F4\u65B0",checkingUpdates:"\u6B63\u5728\u68C0\u67E5\u2026",current:"\u5F53\u524D\u5DF2\u662F\u6700\u65B0\u7248\u672C\u3002",updateAvailable:e=>`\u53D1\u73B0 MineCodex ${e}\uFF0C\u8BF7\u5728\u7EC8\u7AEF\u8FD0\u884C mcx update\u3002`,changeFailed:"\u63D2\u4EF6\u8BBE\u7F6E\u4FDD\u5B58\u5931\u8D25\u3002",restartFailed:"MineCodex \u65E0\u6CD5\u91CD\u542F Codex\u3002\u8BF7\u91CD\u8BD5\u6216\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\u534F\u52A9\u6392\u67E5\u3002",failureDetail:"\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u8FD9\u9879\u529F\u80FD\u7684\u72B6\u6001\uFF0C\u53EF\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\u534F\u52A9\u6392\u67E5\u3002"}},oe=G$[$e],q={restartNotice:document.querySelector("#restart-notice"),restartTitle:document.querySelector("#restart-title"),restartCopy:document.querySelector("#restart-copy"),restartButton:document.querySelector("#restart-button"),pluginsHeading:document.querySelector("#plugins-heading"),saveState:document.querySelector("#save-state"),pluginList:document.querySelector("#plugin-list"),loadError:document.querySelector("#load-error"),errorTitle:document.querySelector("#error-title"),errorCopy:document.querySelector("#error-copy"),retryButton:document.querySelector("#retry-button"),versionLabel:document.querySelector("#version-label"),versionValue:document.querySelector("#version-value"),languageToggle:document.querySelector(".language-toggle"),languageButtons:[...document.querySelectorAll("[data-language-choice]")],themeToggle:document.querySelector(".theme-toggle"),themeButtons:[...document.querySelectorAll("[data-theme-choice]")],updateResult:document.querySelector("#update-result"),updateButton:document.querySelector("#update-button"),diagnosticsButton:document.querySelector("#diagnostics-button"),toast:document.querySelector("#toast")},Qe=null,B$=null,yt=new Set,Vi=Z$(q.pluginList,$e);q.pluginList.addEventListener("change",async e=>{let t=e.target.closest('input[type="checkbox"]'),n=t?.closest("[data-feature-id]");if(!t||!n||!Qe)return;let o=n.dataset.featureId,r={...Qe.features.find(a=>a.id===o)},i=zT(o);yt.add(o),Av(o,{enabled:t.checked,state:"saved"}),Ud(n,Qe.features.find(a=>a.id===o)),q.saveState.textContent=oe.saving;try{let a=await gn(`/api/features/${encodeURIComponent(o)}`,{method:"PATCH",headers:{"Content-Type":"application/json","Accept-Language":$e},body:JSON.stringify({enabled:t.checked})});if(!a.ok)throw new Error(`HTTP ${a.status}`);let s=await a.json(),l=s.features?.find(d=>d.id===o);l&&Av(o,l),Qe.pendingRestart=s.pendingRestart,yt.delete(o);let c=l??Qe.features.find(d=>d.id===o);c&&Ud(n,c),X$(),K$(i),q.saveState.textContent=yt.size?oe.saving:oe.saved}catch{yt.delete(o),Av(o,r),Ud(n,r),q.saveState.textContent=yt.size?oe.saving:"",K$(i),Dd(oe.changeFailed)}});q.restartButton.addEventListener("click",async()=>{q.restartButton.disabled=!0,q.restartButton.querySelector(".button-label").textContent=oe.restarting;try{let e=await gn("/api/restart",{method:"POST",headers:{"Content-Type":"application/json","Accept-Language":$e},body:"{}"});if(!e.ok)throw new Error(`HTTP ${e.status}`);await Tc()}catch{Dd(oe.restartFailed)}finally{q.restartButton.disabled=!1,q.restartButton.querySelector(".button-label").textContent=oe.restart}});q.retryButton.addEventListener("click",()=>{q.pluginList.hidden=!1,Tc()});q.diagnosticsButton.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(JSON.stringify(H$(Qe),null,2)),Dd(oe.diagnosticsCopied)}catch{Dd(oe.diagnosticsFailed)}});setInterval(()=>{!document.hidden&&!yt.size&&Tc()},5e3);q.updateButton.addEventListener("click",async()=>{q.updateButton.disabled=!0,q.updateButton.querySelector(".button-label").textContent=oe.checkingUpdates,q.updateResult.hidden=!0;try{let e=await gn("/api/update");if(!e.ok)throw new Error(`HTTP ${e.status}`);let t=await e.json();q.updateResult.textContent=t.available?oe.updateAvailable(t.latest):oe.current,q.updateResult.hidden=!1}catch{q.updateResult.textContent=oe.updateFailed,q.updateResult.hidden=!1}finally{q.updateButton.disabled=!1,q.updateButton.querySelector(".button-label").textContent=oe.checkUpdates}});Q$=matchMedia("(prefers-color-scheme: dark)"),Zi=null;if(!window.minecodexMcpApp)try{Zi=localStorage.getItem("minecodex-appearance")}catch{}Uv=null;q.themeToggle.addEventListener("click",e=>{let t=e.target.closest("[data-theme-choice]");t&&wT(t)});q.languageToggle.addEventListener("click",e=>{let t=e.target.closest("[data-language-choice]");if(!t||yt.size||q.restartButton.disabled)return;let n=t.dataset.languageChoice;if(n!==$e){try{localStorage.setItem("minecodex-language",n)}catch{return}if(Vi.close(),!window.minecodexMcpApp){location.reload();return}$e=n,oe=G$[$e],document.documentElement.lang=$e,Vi.setLocale($e),document.querySelector("#language-menu").hidePopover(),W$(),Fi(),q.updateResult.hidden=!0,q.toast.hidden=!0,window.dispatchEvent(new Event("minecodex-language")),Tc()}});Q$.addEventListener("change",Fi);window.addEventListener("minecodex-host-theme",()=>{Zi=null,Fi()});document.addEventListener("keydown",()=>{document.documentElement.dataset.input="keyboard"});document.addEventListener("pointerdown",()=>{document.documentElement.dataset.input="pointer"});W$();Fi();Tc();Dv=document.querySelector("#language-menu");Dv.addEventListener("toggle",e=>{if(document.querySelector("#language-button").setAttribute("aria-expanded",String(e.newState==="open")),e.newState!=="open")return;let t=document.querySelector("#language-button").getBoundingClientRect();Dv.style.left=`${Math.max(8,Math.min(t.right-140,innerWidth-148))}px`,Dv.style.top=`${t.bottom+8}px`})});function tz(e){let t="data-minecodex-tooltip",n=document.createElement("div");n.id="minecodex-feature-tooltip",n.setAttribute("role","tooltip"),n.hidden=!0;let o=document.createElement("style");o.setAttribute("data-minecodex-ui-styles","tooltip"),o.textContent=`
|
|
2
2
|
[data-mcx-ui-tooltip] { position:fixed;z-index:2147483001;pointer-events:none;box-sizing:border-box;
|
|
3
3
|
padding:calc(var(--mcx-spacing) * 1.25) calc(var(--mcx-spacing) * 3);border:1px solid var(--mcx-color-border-tooltip);border-radius:var(--mcx-radius-2xl);corner-shape:var(--mcx-codex-corner-shape);
|
|
4
4
|
background:var(--mcx-color-background-tooltip);color:var(--mcx-color-text-tooltip);box-shadow:var(--mcx-shadow-tooltip);
|
|
@@ -104,7 +104,7 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
104
104
|
- omitted: host decides border`)}),hj=p.object({method:p.literal("ui/request-display-mode"),params:p.object({mode:Pc.describe("The display mode being requested.")})}),dT=p.object({mode:Pc.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),mT=p.union([p.literal("model"),p.literal("app")]).describe("Tool visibility scope - who can access the tool."),gj=p.object({resourceUri:p.string().optional(),visibility:p.array(mT).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
105
105
|
- "model": Tool visible to and callable by the agent
|
|
106
106
|
- "app": Tool callable by the app from this server only`),csp:p.never().optional(),permissions:p.never().optional()}),vj=p.object({mimeTypes:p.array(p.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),Sj=p.object({method:p.literal("ui/download-file"),params:p.object({contents:p.array(p.union([un,dn])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),bj=p.object({method:p.literal("ui/message"),params:p.object({role:p.literal("user").describe('Message role, currently only "user" is supported.'),content:p.array(Ct).describe("Message content blocks (text, image, etc.).")})}),yj=p.object({method:p.literal("ui/notifications/sandbox-resource-ready"),params:p.object({html:p.string().describe("HTML content to load into the inner iframe."),sandbox:p.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Ov.optional().describe("CSP configuration from resource metadata."),permissions:Nv.optional().describe("Sandbox permissions from resource metadata.")})}),pT=p.object({method:p.literal("ui/notifications/tool-result"),params:yr.describe("Standard MCP tool execution result.")}),L$=p.object({toolInfo:p.object({id:bt.optional().describe("JSON-RPC id of the tools/call request."),tool:br.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:WP.optional().describe("Current color theme preference."),styles:aT.optional().describe("Style configuration for theming the app."),displayMode:Pc.optional().describe("How the UI is currently displayed."),availableDisplayModes:p.array(Pc).optional().describe("Display modes the host supports."),containerDimensions:p.union([p.object({height:p.number().describe("Fixed container height in pixels.")}),p.object({maxHeight:p.union([p.number(),p.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(p.union([p.object({width:p.number().describe("Fixed container width in pixels.")}),p.object({maxWidth:p.union([p.number(),p.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
107
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:p.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:p.string().optional().describe("User's timezone in IANA format."),userAgent:p.string().optional().describe("Host application identifier."),platform:p.union([p.literal("web"),p.literal("desktop"),p.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:p.object({touch:p.boolean().optional().describe("Whether the device supports touch input."),hover:p.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:p.object({top:p.number().describe("Top safe area inset in pixels."),right:p.number().describe("Right safe area inset in pixels."),bottom:p.number().describe("Bottom safe area inset in pixels."),left:p.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),fT=p.object({method:p.literal("ui/notifications/host-context-changed"),params:L$.describe("Partial context update containing only changed fields.")}),_j=p.object({method:p.literal("ui/update-model-context"),params:p.object({content:p.array(Ct).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:p.record(p.string(),p.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),$j=p.object({method:p.literal("ui/initialize"),params:p.object({appInfo:Tt.describe("App identification (name and version)."),appCapabilities:uT.describe("Features and capabilities this app provides."),protocolVersion:p.string().describe("Protocol version this app supports.")})}),hT=p.object({protocolVersion:p.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Tt.describe("Host application identification and version."),hostCapabilities:lT.describe("Features and capabilities provided by the host."),hostContext:L$.describe("Rich context about the host environment.")}).passthrough(),gT={target:"draft-2020-12"};async function D$(e,t){let n=e["~standard"];if(n.jsonSchema)return n.jsonSchema[t](gT);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function M$(e,t,n=""){let o=await e["~standard"].validate(t);if(o.issues){let r=o.issues.map(i=>{let a=i.path?.map(s=>typeof s=="object"?s.key:s).join(".");return a?`${a}: ${i.message}`:i.message}).join("; ");throw Error(n+r)}return o.value}function vT(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var Ad=class e extends Pv{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new Tv;_methods=new Ev;setRequestHandler=(...t)=>{let[n,...o]=A$("request",t)??t;this._methods.claim(n,"setRequestHandler"),super.setRequestHandler.call(this,n,...o)};setNotificationHandler=(...t)=>{let[n,...o]=A$("notification",t)??t;this._methods.claim(n,"setNotificationHandler"),super.setNotificationHandler.call(this,n,...o)};removeRequestHandler=t=>{this._methods.release(t),super.removeRequestHandler(t)};removeNotificationHandler=t=>{this._methods.release(t),super.removeNotificationHandler(t)};replaceRequestHandler=(t,...n)=>{this._methods.replace(t),super.setRequestHandler.call(this,t,...n)};_assertInitialized(t){if(this._initializedSent)return;let n=`[ext-apps] App.${t}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(n);console.warn(`${n}. This will throw in a future release.`)}eventSchemas={toolinput:rT,toolinputpartial:nT,toolresult:pT,toolcancelled:iT,hostcontextchanged:fT};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(t,n){n&&this._assertHandlerTiming(t),this._ensureEventSlot(t),this._events.setHandler(t,n)}addEventListener(t,n){this._assertHandlerTiming(t),this._ensureEventSlot(t),this._events.addEventListener(t,n)}removeEventListener(t,n){this._events.removeEventListener(t,n)}_ensureEventSlot(t){if(this._registeredEvents.has(t))return;let n=this.eventSchemas[t];if(!n)throw Error(`Unknown event: ${String(t)}`);this.setNotificationHandler(n.shape.method.value,{params:n.shape.params},o=>{let r=o;t==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...r}),this._events.dispatch(t,r)}),this._registeredEvents.add(t)}getEventHandler(t){return this._events.getHandler(t)}warnIfRequestHandlerReplaced(t,n,o){n&&o&&console.warn(`[MCP Apps] ${t} handler replaced. Previous handler will no longer be called.`)}constructor(t,n={},o={autoResize:!0}){super(o),this._appInfo=t,this._appCapabilities=n,this.options=o,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),!o.allowUnsafeEval&&p.config({jitless:!0}),this.replaceRequestHandler("ping",r=>(console.log("Received ping:",r.params),{})),this.setEventHandler("hostcontextchanged",void 0)}buildContext(t){return t}registerAppCapabilities(t){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._appCapabilities=vT(this._appCapabilities,t)}registerTool(t,n,o){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=n.inputSchema!==void 0,s={title:n.title,description:n.description,inputSchema:n.inputSchema,outputSchema:n.outputSchema,annotations:n.annotations,_meta:n._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(l){Object.assign(this,l),i()},remove(){r._registeredTools[t]===s&&(delete r._registeredTools[t],i())},handler:async(l,c)=>{if(!s.enabled)throw Error(`Tool ${t} is disabled`);let d;if(a){let m=s.inputSchema,h=m?await M$(m,l??{},`Invalid input for tool ${t}: `):l??{};d=await o(h,c)}else d=await o(c);return s.outputSchema&&!d.isError&&(d.structuredContent=await M$(s.outputSchema,d.structuredContent,`Invalid output for tool ${t}: `)),d}};return this._registeredTools[t]=s,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),s}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(t,n)=>{let o=this._registeredTools[t.name];if(!o)throw Error(`Tool ${t.name} not found`);return o.handler(t.arguments,n)},this.onlisttools=async(t,n)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([o,r])=>r.enabled).map(async([o,r])=>{let i={name:o,title:r.title,description:r.description,inputSchema:r.inputSchema?await D$(r.inputSchema,"input"):{type:"object",properties:{}}};return r.outputSchema&&(i.outputSchema=await D$(r.outputSchema,"output")),r.annotations&&(i.annotations=r.annotations),r._meta&&(i._meta=r._meta),i}))}))}async sendToolListChanged(t={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:t})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(t){this.setEventHandler("toolinput",t)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(t){this.setEventHandler("toolinputpartial",t)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(t){this.setEventHandler("toolresult",t)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(t){this.setEventHandler("toolcancelled",t)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(t){this.setEventHandler("hostcontextchanged",t)}_onteardown;get onteardown(){return this._onteardown}set onteardown(t){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,t),this._onteardown=t,this.replaceRequestHandler("ui/resource-teardown",{params:sT.shape.params,result:cT},(n,o)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(n,o)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler("tools/call",(n,o)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(n.params,o)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(t){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,t),this._onlisttools=t,this.replaceRequestHandler("tools/list",(n,o)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(n.params,o)})}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${t})`);break}}assertRequestHandlerCapability(t){switch(t){case"tools/call":case"tools/list":if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${t})`);return;default:return}}assertNotificationCapability(t){}async callServerTool(t,n){if(this._assertInitialized("callServerTool"),typeof t=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${t}"). Did you mean: callServerTool({ name: "${t}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:t},{onprogress:()=>{},resetTimeoutOnProgress:!0,...n})}async readServerResource(t,n){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:t},n)}async listServerResources(t,n){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:t},n)}async createSamplingMessage(t,n){return this._assertInitialized("createSamplingMessage"),await this.request({method:"sampling/createMessage",params:t},n)}sendMessage(t,n){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:t},tT,n)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,n){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:t},Sr,n)}openLink(t,n){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:t},QP,n)}sendOpenLink=this.openLink;downloadFile(t,n){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:t},eT,n)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,n){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:t},dT,n)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,n=0,o=0,r=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let a=document.documentElement,s=a.style.height;a.style.height="max-content";let l=Math.ceil(a.getBoundingClientRect().height);a.style.height=s;let c=Math.ceil(window.innerWidth);(c!==n||l!==o)&&(n=c,o=l,this.sendSizeChanged({width:c,height:l}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(t=new Cv(window.parent,window.parent),n){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1;try{await super.connect(t);let o=await this.request({method:"ui/initialize",params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:KP}},hT,n);if(o===void 0)throw Error(`Server sent invalid initialize result: ${o}`);this._hostCapabilities=o.hostCapabilities,this._hostInfo=o.hostInfo,this._hostContext=o.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(o){throw this.close(),o}}};var Oc=new Ad({name:"MineCodex",version:"2.0.42"});Oc.ontoolresult=()=>{};await Oc.connect();window.minecodexMcpApp=Oc;function cz(e){Object.hasOwn(e??{},"theme")&&(window.minecodexHostTheme=e?.theme,window.dispatchEvent(new Event("minecodex-host-theme")))}Oc.addEventListener("hostcontextchanged",cz);cz(Oc.getHostContext());await Promise.resolve().then(()=>(ez(),kT));await Promise.resolve().then(()=>(sz(),TT));
|
|
107
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:p.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:p.string().optional().describe("User's timezone in IANA format."),userAgent:p.string().optional().describe("Host application identifier."),platform:p.union([p.literal("web"),p.literal("desktop"),p.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:p.object({touch:p.boolean().optional().describe("Whether the device supports touch input."),hover:p.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:p.object({top:p.number().describe("Top safe area inset in pixels."),right:p.number().describe("Right safe area inset in pixels."),bottom:p.number().describe("Bottom safe area inset in pixels."),left:p.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),fT=p.object({method:p.literal("ui/notifications/host-context-changed"),params:L$.describe("Partial context update containing only changed fields.")}),_j=p.object({method:p.literal("ui/update-model-context"),params:p.object({content:p.array(Ct).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:p.record(p.string(),p.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),$j=p.object({method:p.literal("ui/initialize"),params:p.object({appInfo:Tt.describe("App identification (name and version)."),appCapabilities:uT.describe("Features and capabilities this app provides."),protocolVersion:p.string().describe("Protocol version this app supports.")})}),hT=p.object({protocolVersion:p.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Tt.describe("Host application identification and version."),hostCapabilities:lT.describe("Features and capabilities provided by the host."),hostContext:L$.describe("Rich context about the host environment.")}).passthrough(),gT={target:"draft-2020-12"};async function D$(e,t){let n=e["~standard"];if(n.jsonSchema)return n.jsonSchema[t](gT);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function M$(e,t,n=""){let o=await e["~standard"].validate(t);if(o.issues){let r=o.issues.map(i=>{let a=i.path?.map(s=>typeof s=="object"?s.key:s).join(".");return a?`${a}: ${i.message}`:i.message}).join("; ");throw Error(n+r)}return o.value}function vT(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var Ad=class e extends Pv{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new Tv;_methods=new Ev;setRequestHandler=(...t)=>{let[n,...o]=A$("request",t)??t;this._methods.claim(n,"setRequestHandler"),super.setRequestHandler.call(this,n,...o)};setNotificationHandler=(...t)=>{let[n,...o]=A$("notification",t)??t;this._methods.claim(n,"setNotificationHandler"),super.setNotificationHandler.call(this,n,...o)};removeRequestHandler=t=>{this._methods.release(t),super.removeRequestHandler(t)};removeNotificationHandler=t=>{this._methods.release(t),super.removeNotificationHandler(t)};replaceRequestHandler=(t,...n)=>{this._methods.replace(t),super.setRequestHandler.call(this,t,...n)};_assertInitialized(t){if(this._initializedSent)return;let n=`[ext-apps] App.${t}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(n);console.warn(`${n}. This will throw in a future release.`)}eventSchemas={toolinput:rT,toolinputpartial:nT,toolresult:pT,toolcancelled:iT,hostcontextchanged:fT};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(t,n){n&&this._assertHandlerTiming(t),this._ensureEventSlot(t),this._events.setHandler(t,n)}addEventListener(t,n){this._assertHandlerTiming(t),this._ensureEventSlot(t),this._events.addEventListener(t,n)}removeEventListener(t,n){this._events.removeEventListener(t,n)}_ensureEventSlot(t){if(this._registeredEvents.has(t))return;let n=this.eventSchemas[t];if(!n)throw Error(`Unknown event: ${String(t)}`);this.setNotificationHandler(n.shape.method.value,{params:n.shape.params},o=>{let r=o;t==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...r}),this._events.dispatch(t,r)}),this._registeredEvents.add(t)}getEventHandler(t){return this._events.getHandler(t)}warnIfRequestHandlerReplaced(t,n,o){n&&o&&console.warn(`[MCP Apps] ${t} handler replaced. Previous handler will no longer be called.`)}constructor(t,n={},o={autoResize:!0}){super(o),this._appInfo=t,this._appCapabilities=n,this.options=o,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),!o.allowUnsafeEval&&p.config({jitless:!0}),this.replaceRequestHandler("ping",r=>(console.log("Received ping:",r.params),{})),this.setEventHandler("hostcontextchanged",void 0)}buildContext(t){return t}registerAppCapabilities(t){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._appCapabilities=vT(this._appCapabilities,t)}registerTool(t,n,o){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=n.inputSchema!==void 0,s={title:n.title,description:n.description,inputSchema:n.inputSchema,outputSchema:n.outputSchema,annotations:n.annotations,_meta:n._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(l){Object.assign(this,l),i()},remove(){r._registeredTools[t]===s&&(delete r._registeredTools[t],i())},handler:async(l,c)=>{if(!s.enabled)throw Error(`Tool ${t} is disabled`);let d;if(a){let m=s.inputSchema,h=m?await M$(m,l??{},`Invalid input for tool ${t}: `):l??{};d=await o(h,c)}else d=await o(c);return s.outputSchema&&!d.isError&&(d.structuredContent=await M$(s.outputSchema,d.structuredContent,`Invalid output for tool ${t}: `)),d}};return this._registeredTools[t]=s,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),s}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(t,n)=>{let o=this._registeredTools[t.name];if(!o)throw Error(`Tool ${t.name} not found`);return o.handler(t.arguments,n)},this.onlisttools=async(t,n)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([o,r])=>r.enabled).map(async([o,r])=>{let i={name:o,title:r.title,description:r.description,inputSchema:r.inputSchema?await D$(r.inputSchema,"input"):{type:"object",properties:{}}};return r.outputSchema&&(i.outputSchema=await D$(r.outputSchema,"output")),r.annotations&&(i.annotations=r.annotations),r._meta&&(i._meta=r._meta),i}))}))}async sendToolListChanged(t={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:t})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(t){this.setEventHandler("toolinput",t)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(t){this.setEventHandler("toolinputpartial",t)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(t){this.setEventHandler("toolresult",t)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(t){this.setEventHandler("toolcancelled",t)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(t){this.setEventHandler("hostcontextchanged",t)}_onteardown;get onteardown(){return this._onteardown}set onteardown(t){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,t),this._onteardown=t,this.replaceRequestHandler("ui/resource-teardown",{params:sT.shape.params,result:cT},(n,o)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(n,o)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler("tools/call",(n,o)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(n.params,o)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(t){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,t),this._onlisttools=t,this.replaceRequestHandler("tools/list",(n,o)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(n.params,o)})}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${t})`);break}}assertRequestHandlerCapability(t){switch(t){case"tools/call":case"tools/list":if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${t})`);return;default:return}}assertNotificationCapability(t){}async callServerTool(t,n){if(this._assertInitialized("callServerTool"),typeof t=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${t}"). Did you mean: callServerTool({ name: "${t}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:t},{onprogress:()=>{},resetTimeoutOnProgress:!0,...n})}async readServerResource(t,n){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:t},n)}async listServerResources(t,n){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:t},n)}async createSamplingMessage(t,n){return this._assertInitialized("createSamplingMessage"),await this.request({method:"sampling/createMessage",params:t},n)}sendMessage(t,n){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:t},tT,n)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,n){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:t},Sr,n)}openLink(t,n){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:t},QP,n)}sendOpenLink=this.openLink;downloadFile(t,n){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:t},eT,n)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,n){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:t},dT,n)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,n=0,o=0,r=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let a=document.documentElement,s=a.style.height;a.style.height="max-content";let l=Math.ceil(a.getBoundingClientRect().height);a.style.height=s;let c=Math.ceil(window.innerWidth);(c!==n||l!==o)&&(n=c,o=l,this.sendSizeChanged({width:c,height:l}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(t=new Cv(window.parent,window.parent),n){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1;try{await super.connect(t);let o=await this.request({method:"ui/initialize",params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:KP}},hT,n);if(o===void 0)throw Error(`Server sent invalid initialize result: ${o}`);this._hostCapabilities=o.hostCapabilities,this._hostInfo=o.hostInfo,this._hostContext=o.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(o){throw this.close(),o}}};var Oc=new Ad({name:"MineCodex",version:"2.0.52"});Oc.ontoolresult=()=>{};await Oc.connect();window.minecodexMcpApp=Oc;function cz(e){Object.hasOwn(e??{},"theme")&&(window.minecodexHostTheme=e?.theme,window.dispatchEvent(new Event("minecodex-host-theme")))}Oc.addEventListener("hostcontextchanged",cz);cz(Oc.getHostContext());await Promise.resolve().then(()=>(ez(),kT));await Promise.resolve().then(()=>(sz(),TT));
|
|
108
108
|
/*! Bundled license information:
|
|
109
109
|
|
|
110
110
|
@modelcontextprotocol/client/dist/src-WCy6ifGf.mjs:
|
|
@@ -426,7 +426,7 @@ ${U.body}`.toLocaleLowerCase().includes(y)));if(!k.length){g.append(jn(!!y));ret
|
|
|
426
426
|
font-family:var(--mcx-font-sans-default);font-size:var(--mcx-text-sm);line-height:18px;
|
|
427
427
|
font-weight:var(--mcx-tooltip-compact-font-weight);letter-spacing:var(--mcx-tracking-tooltip);user-select:none; }
|
|
428
428
|
`,document.head.append(o);function r(m){return m.setAttribute("data-mcx-ui-tooltip",""),m}r(i),i.style.cssText=`zoom:var(--codex-window-zoom,1);max-width:min(320px,calc(100vw - 16px));
|
|
429
|
-
text-align:center;overflow-wrap:anywhere;`;let n=null,a,s,c=-1/0;function l(){if(clearTimeout(a),cancelAnimationFrame(s),n){let m=(n.getAttribute("aria-describedby")||"").split(/\s+/).filter(A=>A&&A!==i.id);m.length?n.setAttribute("aria-describedby",m.join(" ")):n.removeAttribute("aria-describedby")}i.hidden||(c=Date.now()),n=null,i.hidden=!0}function d(){if(!n?.isConnected||!n.getClientRects().length||n.getAttribute("aria-expanded")==="true")return l();let m=Number.parseFloat(getComputedStyle(i).zoom)||1,A=n.getBoundingClientRect(),x=i.offsetWidth,C=i.offsetHeight,M=n.getAttribute("data-minecodex-tooltip-side")||(n.closest("[data-app-navigation-rail]")?"right":getComputedStyle(n).getPropertyValue("--side-tooltip").trim()||"top"),T=2/m,Q=(A.left+A.width/2)/m-x/2,re=M==="bottom"?A.bottom/m+T:A.top/m-C-T;M==="right"||M==="left"?(Q=M==="right"?A.right/m+T:A.left/m-x-T,re=(A.top+A.height/2)/m-C/2,Q+x>innerWidth/m-8?Q=A.left/m-x-T:Q<8&&(Q=A.right/m+T)):re<8?re=A.bottom/m+T:re+C>innerHeight/m-8&&(re=A.top/m-C-T),i.style.left=`${Math.max(8,Math.min(Q,innerWidth/m-x-8))}px`,i.style.top=`${Math.max(8,Math.min(re,innerHeight/m-C-8))}px`,s=requestAnimationFrame(d)}function f(m,A=!1){!m||m===n||(l(),!(m.getAttribute("aria-expanded")==="true"||!m.getAttribute(t))&&(n=m,a=setTimeout(()=>{if(!n?.isConnected)return l();i.isConnected||document.body.append(i);let x=getComputedStyle(n);for(let M of["--radius-2xl","--codex-corner-shape","--color-background-tooltip","--color-text-tooltip","--color-border-tooltip","--shadow-tooltip","--tooltip-compact-font-weight","--tracking-tooltip","--spacing","--text-sm","--font-sans-default"]){let T=x.getPropertyValue(M).trim();T?i.style.setProperty(M,T):i.style.removeProperty(M)}i.textContent=n.getAttribute(t),i.hidden=!1;let C=(n.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean);n.setAttribute("aria-describedby",[...new Set([...C,i.id])].join(" ")),d()},A||Date.now()-c<300?0:200)))}let h=m=>m.target instanceof Element?m.target.closest(`[${t}]`):null;return document.addEventListener("pointerover",m=>f(h(m)),{signal:e}),document.addEventListener("pointerout",m=>{n&&!n.contains(m.relatedTarget)&&l()},{signal:e}),document.addEventListener("focusin",m=>f(h(m),!0),{signal:e}),document.addEventListener("focusout",l,{signal:e}),document.addEventListener("pointerdown",l,{signal:e,capture:!0}),document.addEventListener("keydown",m=>{m.key==="Escape"&&l()},{signal:e}),window.addEventListener("blur",l,{signal:e}),e.addEventListener("abort",()=>{l(),i.remove(),o.remove()},{once:!0}),{tooltipSurface:r}}var Mo=new vd({name:"Prompt",version:"2.0.
|
|
429
|
+
text-align:center;overflow-wrap:anywhere;`;let n=null,a,s,c=-1/0;function l(){if(clearTimeout(a),cancelAnimationFrame(s),n){let m=(n.getAttribute("aria-describedby")||"").split(/\s+/).filter(A=>A&&A!==i.id);m.length?n.setAttribute("aria-describedby",m.join(" ")):n.removeAttribute("aria-describedby")}i.hidden||(c=Date.now()),n=null,i.hidden=!0}function d(){if(!n?.isConnected||!n.getClientRects().length||n.getAttribute("aria-expanded")==="true")return l();let m=Number.parseFloat(getComputedStyle(i).zoom)||1,A=n.getBoundingClientRect(),x=i.offsetWidth,C=i.offsetHeight,M=n.getAttribute("data-minecodex-tooltip-side")||(n.closest("[data-app-navigation-rail]")?"right":getComputedStyle(n).getPropertyValue("--side-tooltip").trim()||"top"),T=2/m,Q=(A.left+A.width/2)/m-x/2,re=M==="bottom"?A.bottom/m+T:A.top/m-C-T;M==="right"||M==="left"?(Q=M==="right"?A.right/m+T:A.left/m-x-T,re=(A.top+A.height/2)/m-C/2,Q+x>innerWidth/m-8?Q=A.left/m-x-T:Q<8&&(Q=A.right/m+T)):re<8?re=A.bottom/m+T:re+C>innerHeight/m-8&&(re=A.top/m-C-T),i.style.left=`${Math.max(8,Math.min(Q,innerWidth/m-x-8))}px`,i.style.top=`${Math.max(8,Math.min(re,innerHeight/m-C-8))}px`,s=requestAnimationFrame(d)}function f(m,A=!1){!m||m===n||(l(),!(m.getAttribute("aria-expanded")==="true"||!m.getAttribute(t))&&(n=m,a=setTimeout(()=>{if(!n?.isConnected)return l();i.isConnected||document.body.append(i);let x=getComputedStyle(n);for(let M of["--radius-2xl","--codex-corner-shape","--color-background-tooltip","--color-text-tooltip","--color-border-tooltip","--shadow-tooltip","--tooltip-compact-font-weight","--tracking-tooltip","--spacing","--text-sm","--font-sans-default"]){let T=x.getPropertyValue(M).trim();T?i.style.setProperty(M,T):i.style.removeProperty(M)}i.textContent=n.getAttribute(t),i.hidden=!1;let C=(n.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean);n.setAttribute("aria-describedby",[...new Set([...C,i.id])].join(" ")),d()},A||Date.now()-c<300?0:200)))}let h=m=>m.target instanceof Element?m.target.closest(`[${t}]`):null;return document.addEventListener("pointerover",m=>f(h(m)),{signal:e}),document.addEventListener("pointerout",m=>{n&&!n.contains(m.relatedTarget)&&l()},{signal:e}),document.addEventListener("focusin",m=>f(h(m),!0),{signal:e}),document.addEventListener("focusout",l,{signal:e}),document.addEventListener("pointerdown",l,{signal:e,capture:!0}),document.addEventListener("keydown",m=>{m.key==="Escape"&&l()},{signal:e}),window.addEventListener("blur",l,{signal:e}),e.addEventListener("abort",()=>{l(),i.remove(),o.remove()},{once:!0}),{tooltipSurface:r}}var Mo=new vd({name:"Prompt",version:"2.0.52"});Mo.ontoolresult=()=>{};await Mo.connect();uv(Mo.getHostContext());Mo.addEventListener("hostcontextchanged",uv);var bx=new AbortController,Ad=bx.signal,bi={};for(let e of[hx,gx,vx,Ax,yx])Object.assign(bi,e(Ad,bi));bi.page=e=>(bi.surface(e,"page"),bi.layer(e,"page"));bi.releasePage=()=>{};var j_=dx(Ad,{management:!0,ui:bi,resources:{icons:mx,previews:px,styles:fx},insertPrompt:e=>new Promise((t,i)=>{let o=new MessageChannel,r,n=s=>{clearTimeout(r),o.port1.close(),Ad.removeEventListener("abort",a),s?i(s):t()},a=()=>n(new Error("Prompt page closed"));Ad.addEventListener("abort",a,{once:!0}),r=setTimeout(()=>n(new Error("No available input in the focused window")),4500),o.port1.onmessage=({data:s})=>n(s.ok?null:new Error(s.error)),window.top.postMessage({type:"minecodex:insert-prompt",promptId:e,expiresAt:Date.now()+4e3},"*",[o.port2])}),requestHostAction:async(e,t)=>{let i=await Mo.callServerTool({name:t.method&&t.method!=="GET"?"minecodex_prompts_write":"minecodex_prompts_read",arguments:t});if(i.isError)throw new Error(i.content?.find(o=>o.type==="text")?.text??"Prompts request failed");return i.structuredContent.result}});Mo.onteardown=async()=>(bx.abort(),j_(),{});
|
|
430
430
|
/*! Bundled license information:
|
|
431
431
|
|
|
432
432
|
@modelcontextprotocol/client/dist/src-WCy6ifGf.mjs:
|