minecodex 2.0.18 → 2.0.19

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.
@@ -421,7 +421,9 @@ elements.updateButton.addEventListener("click", async () => {
421
421
 
422
422
  const systemTheme = matchMedia("(prefers-color-scheme: dark)");
423
423
  let selectedTheme = null;
424
- try { selectedTheme = localStorage.getItem("minecodex-appearance"); } catch { /* 存储不可用时仍允许本次切换。 */ }
424
+ if (!window.minecodexMcpApp) {
425
+ try { selectedTheme = localStorage.getItem("minecodex-appearance"); } catch { /* 存储不可用时仍允许本次切换。 */ }
426
+ }
425
427
  function applyTheme() {
426
428
  const hostDark = window.minecodexHostTheme ? window.minecodexHostTheme === "dark" : systemTheme.matches;
427
429
  const dark = selectedTheme === "dark" || (selectedTheme !== "light" && hostDark);
@@ -436,7 +438,9 @@ elements.themeToggle.addEventListener("click", (event) => {
436
438
  const button = event.target.closest("[data-theme-choice]");
437
439
  if (!button) return;
438
440
  selectedTheme = button.dataset.themeChoice;
439
- try { localStorage.setItem("minecodex-appearance", selectedTheme); } catch { /* 保留内存中的选择。 */ }
441
+ if (!window.minecodexMcpApp) {
442
+ try { localStorage.setItem("minecodex-appearance", selectedTheme); } catch { /* 保留内存中的选择。 */ }
443
+ }
440
444
  applyTheme();
441
445
  });
442
446
  elements.languageToggle.addEventListener("click", (event) => {
@@ -449,7 +453,10 @@ elements.languageToggle.addEventListener("click", (event) => {
449
453
  location.reload();
450
454
  });
451
455
  systemTheme.addEventListener("change", applyTheme);
452
- window.addEventListener("minecodex-host-theme", applyTheme);
456
+ window.addEventListener("minecodex-host-theme", () => {
457
+ selectedTheme = null;
458
+ applyTheme();
459
+ });
453
460
  document.addEventListener("keydown", () => { document.documentElement.dataset.input = "keyboard"; });
454
461
  document.addEventListener("pointerdown", () => { document.documentElement.dataset.input = "pointer"; });
455
462
  applyStaticCopy();
@@ -12,6 +12,7 @@
12
12
  <script type="module" src="/assets/data-transfer.js"></script>
13
13
  </head>
14
14
  <body>
15
+ <div class="dashboard-surface">
15
16
  <canvas id="agent-world" aria-hidden="true"></canvas>
16
17
  <main class="shell">
17
18
  <header class="page-header">
@@ -87,5 +88,6 @@
87
88
  <input id="data-file" type="file" accept=".json,.mcx.json,application/json" hidden>
88
89
  </dialog>
89
90
  <div id="toast" class="toast" hidden role="status" aria-live="polite"></div>
91
+ </div>
90
92
  </body>
91
93
  </html>
@@ -65,13 +65,18 @@ body {
65
65
  min-width: 320px;
66
66
  min-height: 100vh;
67
67
  margin: 0;
68
+ color: var(--ink);
69
+ font-size: 14px;
70
+ -webkit-font-smoothing: antialiased;
71
+ }
72
+
73
+ /* 官方页面强制设置 body 背景;内容面拥有控制台自身的明暗色板。 */
74
+ .dashboard-surface {
75
+ min-height: 100vh;
68
76
  background-color: var(--canvas);
69
77
  background-image: radial-gradient(ellipse at 50% 0%, var(--accent-soft), transparent 75%);
70
78
  background-repeat: no-repeat;
71
79
  background-attachment: fixed;
72
- color: var(--ink);
73
- font-size: 14px;
74
- -webkit-font-smoothing: antialiased;
75
80
  }
76
81
 
77
82
  #agent-world { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
@@ -34,7 +34,7 @@ export function installPromptInsertion(signal, {codex, api, insertText}) {
34
34
  async function receive(event) {
35
35
  if (event.data?.type !== 'minecodex:insert-prompt' || typeof event.data.promptId !== 'string') return;
36
36
  const port = event.ports?.[0];
37
- const source = codex.mcpAppSource(event.source,{server:'minecodex',pluginId:'minecodex@minecodex-local',resourceUri:'ui://minecodex/prompts.html'});
37
+ const source = codex.mcpAppSource(event.source,{server:'minecodex',pluginId:'minecodex@minecodex-local',resourceUri:/^ui:\/\/minecodex\/(?:\d+\.\d+\.\d+\/)?prompts\.html$/});
38
38
  if (!source || !port) return;
39
39
  if (busy || !document.hasFocus()) {port.postMessage({error:'Input changed before insertion'});port.close();return;}
40
40
  busy = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minecodex",
3
- "version": "2.0.18",
3
+ "version": "2.0.19",
4
4
  "description": "Lightweight, local-first plugins for the Codex desktop app.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -89,7 +89,9 @@ export function createCodexEnvironment() {
89
89
  }
90
90
  if (!matches) continue;
91
91
  const view = props(frame, value => value.view?.resourceUri != null)?.view;
92
- if (view?.resourceUri === resourceUri && (view.server === server || view.pluginId === pluginId))
92
+ const matchesResource = typeof resourceUri === 'string' ? view?.resourceUri === resourceUri
93
+ : typeof view?.resourceUri === 'string' && resourceUri.test(view.resourceUri);
94
+ if (matchesResource && (view.server === server || view.pluginId === pluginId))
93
95
  return {connected:() => frame.isConnected};
94
96
  }
95
97
  return null;