vite-plugin-aipanel 1.2.3 → 1.2.5

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.
@@ -86,9 +86,10 @@ class McpProxy {
86
86
  "--auto-connect",
87
87
  "--no-usage-statistics",
88
88
  "--no-performance-crux",
89
- // chrome-devtools-mcp >=1.8.0 的 pageIdRouting 按 pageId 路由页面级工具,默认开启。
90
- // 显式声明强制开启,代理层校验 pageId 后原样转发,由底层工具按 pageId 路由目标页面。
91
- "--page-id-routing"
89
+ // chrome-devtools-mcp >=1.8.0 默认开启 pageIdRouting(要求每个页面级工具都传 pageId)。
90
+ // 代理层已自行校验 pageId 并用 select_page 选中目标页面后再转发,故显式关闭,
91
+ // 避免底层工具 schema 强制必填 pageId 导致转发时的参数校验失败。
92
+ "--no-page-id-routing"
92
93
  ]);
93
94
  __privateSet(this, _idleTimeout, options.idleTimeout ?? 0);
94
95
  this.sessionId = import_node_crypto.default.randomUUID();
@@ -22,6 +22,7 @@ __export(context_exports, {
22
22
  module.exports = __toCommonJS(context_exports);
23
23
  var import_core = require("@aipanel/core");
24
24
  var import_node = require("@aipanel/core/node");
25
+ var import_core2 = require("@aipanel/core");
25
26
  const log = (0, import_node.createLogger)("Endpoints:Context");
26
27
  function setupContextEndpoint(server, ctx) {
27
28
  server.middlewares.use(import_core.CONTEXT_API_PATH, async (req, res) => {
@@ -78,13 +79,17 @@ function setupContextEndpoint(server, ctx) {
78
79
  const data = JSON.parse(body);
79
80
  const tabId = data.tabId != null ? String(data.tabId) : "default";
80
81
  const existing = ctx.getPageContext();
82
+ const selectedElements = data.selectedElements || [];
83
+ selectedElements.forEach((el) => {
84
+ if (el && typeof el === "object") (0, import_core2.ensureNodeId)(el);
85
+ });
81
86
  const newCtx = {
82
87
  url: data.url || "",
83
88
  title: data.title || "",
84
89
  sessionId: data.sessionId,
85
90
  tabId: data.tabId ?? existing.tabId,
86
91
  tabIndex: data.tabIndex ?? existing.tabIndex,
87
- selectedElements: data.selectedElements || []
92
+ selectedElements
88
93
  };
89
94
  ctx.setPageContext(tabId, newCtx);
90
95
  if (data.active) {
@@ -355,11 +355,14 @@ async function handleDevTool(res, id, mcp, mapped, args, projectOrigins, toolNam
355
355
  }
356
356
  }
357
357
  }
358
+ await mcp.callChromeDevTool("select_page", { pageId, bringToFront: false });
359
+ const forwardArgs = { ...args };
360
+ delete forwardArgs["pageId"];
358
361
  const forwardBody = JSON.stringify({
359
362
  jsonrpc: "2.0",
360
363
  id,
361
364
  method: "tools/call",
362
- params: { name: mapped, arguments: args }
365
+ params: { name: mapped, arguments: forwardArgs }
363
366
  });
364
367
  const responseText = await mcp.forward(forwardBody);
365
368
  log.debug("MCP response", { mapped, response: responseText.substring(0, 100) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-aipanel",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "Embed OpenCode Web UI in your Vite dev server for real-time code modification and preview",
5
5
  "type": "module",
6
6
  "main": "lib/index.cjs",
@@ -41,12 +41,12 @@
41
41
  "execa": "^9.6.1",
42
42
  "typescript-language-server": "^5.3.0",
43
43
  "unplugin-vue-inspector": "^3.0.0",
44
- "@aipanel/provider-opencode": "1.2.3",
45
- "@aipanel/core": "1.2.3"
44
+ "@aipanel/provider-opencode": "1.2.5",
45
+ "@aipanel/core": "1.2.5"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "vite": ">=5.0.0",
49
- "@aipanel/provider-deepseek": "1.2.3"
49
+ "@aipanel/provider-deepseek": "1.2.5"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "@aipanel/provider-deepseek": {
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "sharp": "^0.34.5",
58
- "@aipanel/client": "1.2.3"
58
+ "@aipanel/client": "1.2.5"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "pagoda-cli build && vite build -c vite.client.config.ts",