vite-plugin-aipanel 1.2.9 → 1.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +53 -35
  2. package/es/core/chrome-project.d.ts +15 -0
  3. package/es/core/chrome-project.mjs +13 -0
  4. package/es/core/mcp-chrome.d.ts +12 -8
  5. package/es/core/mcp-chrome.mjs +52 -10
  6. package/es/core/mcp-proxy.d.ts +14 -1
  7. package/es/core/mcp-proxy.mjs +49 -10
  8. package/es/core/mcp-tools.d.ts +54 -3
  9. package/es/core/mcp-tools.mjs +111 -659
  10. package/es/core/official-meta.d.ts +9 -0
  11. package/es/core/official-meta.mjs +62 -0
  12. package/es/core/official-tools.d.ts +7 -0
  13. package/es/core/official-tools.mjs +54 -0
  14. package/es/core/service.mjs +4 -5
  15. package/es/endpoints/context.mjs +2 -2
  16. package/es/endpoints/host-events.mjs +2 -3
  17. package/es/endpoints/index.d.ts +2 -2
  18. package/es/endpoints/index.mjs +2 -2
  19. package/es/endpoints/mcp.d.ts +2 -2
  20. package/es/endpoints/mcp.mjs +116 -87
  21. package/es/endpoints/sse.mjs +3 -3
  22. package/es/endpoints/vue-devtools.d.ts +5 -2
  23. package/es/endpoints/vue-devtools.mjs +3 -4
  24. package/es/index.mjs +21 -4
  25. package/lib/client.css +1 -1
  26. package/lib/client.js +2590 -2435
  27. package/lib/core/chrome-project.cjs +36 -0
  28. package/lib/core/chrome-project.d.ts +15 -0
  29. package/lib/core/mcp-chrome.cjs +64 -10
  30. package/lib/core/mcp-chrome.d.ts +12 -8
  31. package/lib/core/mcp-proxy.cjs +50 -10
  32. package/lib/core/mcp-proxy.d.ts +14 -1
  33. package/lib/core/mcp-tools.cjs +126 -660
  34. package/lib/core/mcp-tools.d.ts +54 -3
  35. package/lib/core/official-meta.cjs +85 -0
  36. package/lib/core/official-meta.d.ts +9 -0
  37. package/lib/core/official-tools.cjs +70 -0
  38. package/lib/core/official-tools.d.ts +7 -0
  39. package/lib/core/service.cjs +4 -5
  40. package/lib/endpoints/context.cjs +1 -1
  41. package/lib/endpoints/host-events.cjs +1 -2
  42. package/lib/endpoints/index.cjs +2 -2
  43. package/lib/endpoints/index.d.ts +2 -2
  44. package/lib/endpoints/mcp.cjs +114 -85
  45. package/lib/endpoints/mcp.d.ts +2 -2
  46. package/lib/endpoints/sse.cjs +2 -2
  47. package/lib/endpoints/vue-devtools.cjs +4 -5
  48. package/lib/endpoints/vue-devtools.d.ts +5 -2
  49. package/lib/index.cjs +22 -5
  50. package/package.json +10 -7
  51. package/es/utils/format-bridge.d.ts +0 -9
  52. package/es/utils/format-bridge.mjs +0 -87
  53. package/es/utils/system.d.ts +0 -3
  54. package/es/utils/system.mjs +0 -76
  55. package/lib/utils/format-bridge.cjs +0 -103
  56. package/lib/utils/format-bridge.d.ts +0 -9
  57. package/lib/utils/system.cjs +0 -110
  58. package/lib/utils/system.d.ts +0 -3
@@ -1,8 +1,13 @@
1
1
  /**
2
- * 自定义 DevTools 工具定义
3
- * 所有工具(除 chrome-devtools_list_pages)必须传入 pageId 参数,
4
- * 代理层校验 pageId 是否为项目页面后方可调用 chrome-devtools-mcp。
2
+ * Chrome DevTools 工具层的项目维度元数据与自定义工具。
3
+ *
4
+ * 模型可见的 chrome-devtools_* 工具 = 官方 chrome-devtools-mcp 工具的白名单子集
5
+ * (schema/描述运行时同步自官方 tools/list,见 official-tools.ts)+ 本项目自定义工具。
6
+ * 工具层限制(白名单、必填 pageId、仅项目页)由本文件 + endpoints/mcp.ts 的 tools/call 共同执行。
5
7
  */
8
+ /** 模型可见名前缀:官方短名 → chrome-devtools_<name> */
9
+ export declare const MCP_PREFIX = "chrome-devtools_";
10
+ export declare function displayToolName(short: string): string;
6
11
  export interface CustomTool {
7
12
  name: string;
8
13
  description: string;
@@ -12,4 +17,50 @@ export interface CustomTool {
12
17
  required?: string[];
13
18
  };
14
19
  }
20
+ /**
21
+ * 默认暴露的官方页面级工具 = 元数据规则推导(pageScoped && 无条件 && 分类安全),
22
+ * 具体由 officialDefaultShorts() 给出。
23
+ * 以下为 meta 无法从 pageScoped 推断、需要“按页面上下文使用/列表/新建”的产品全局特例(短名)。
24
+ */
25
+ export declare const OFFICIAL_GLOBAL_POLICY: readonly ["evaluate_script", "list_console_messages", "list_pages", "new_page"];
26
+ export type OfficialToolShortName = string;
27
+ /** 不需要 pageId 的官方工具(无目标页,由调用层特别处理) */
28
+ export declare const OFFICIAL_NO_PAGE_TOOLS: ReadonlySet<string>;
29
+ /** 目标页参数:pageId 必须在可操作范围(项目页或 allowOrigins 白名单页)内 */
30
+ export declare const PAGE_ID_PROP: {
31
+ readonly pageId: {
32
+ readonly type: "number";
33
+ readonly description: "The ID of a page within the operation scope (project pages or chromeMcp.project.allowOrigins pages) to operate on";
34
+ };
35
+ };
36
+ /** 往官方 schema 上统一追加必填 pageId(保持工具层项目限制) */
37
+ export declare function withPageIdSchema(schema: CustomTool["inputSchema"]): CustomTool["inputSchema"];
38
+ /**
39
+ * 追加到官方描述末尾的项目维度说明(英文,按工具特例)。
40
+ * 只填“调用层真正实现的语义与官方不一样”的工具,
41
+ * 避免描述过度承诺(如 navigate_page 目标 URL 未被调用层限制,不填“必须在项目内”)。
42
+ * 其余页面级工具的项目边界由必填 pageId 参数说明表达(PAGE_ID_PROP)。
43
+ */
44
+ export declare const PROJECT_DESCRIPTION_NOTES: Record<string, string>;
45
+ /** 自定义工具(官方无对应,工具层本地实现) */
15
46
  export declare const CUSTOM_TOOLS: CustomTool[];
47
+ /** 官方声明了条件、且属于可开启范围的工具(由官方元数据派生,无手写) */
48
+ export declare function isOfficialExtraTool(short: string): boolean;
49
+ /** 由官方 conditions 推导所需 flag(experimentalX → --experimental-x,与官方 CLI 一致) */
50
+ export declare function extraToolFlag(short: string): string | undefined;
51
+ /** 可开启的二级工具名单(用于验证与提示) */
52
+ export declare function officialExtraCandidates(): string[];
53
+ /**
54
+ * 默认暴露的官方工具集:
55
+ * 页面级(pageScoped && 无 conditions && 分类安全)由官方元数据规则推导 + 全局特例 GLOBAL_POLICY。
56
+ */
57
+ export declare function officialDefaultShorts(): string[];
58
+ /** 配置工具面范围(默认为纯白名单) */
59
+ export declare function configureToolScope(extra?: readonly string[], deny?: readonly string[], warn?: (msg: string) => void): void;
60
+ /**
61
+ * 当前生效的官方白名单(短名,含 extra 减 deny)。
62
+ * deny 同时作用于默认面与 extra,保证 tools/list 暴露面与 isAllowedToolName 调用守卫一致。
63
+ */
64
+ export declare function currentOfficialShorts(): string[];
65
+ /** tools/call 白名单守卫(含 current_page 与动态 extra/deny) */
66
+ export declare function isAllowedToolName(name: string): boolean;
@@ -0,0 +1,85 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var official_meta_exports = {};
19
+ __export(official_meta_exports, {
20
+ OFFICIAL_TOOL_META: () => OFFICIAL_TOOL_META
21
+ });
22
+ module.exports = __toCommonJS(official_meta_exports);
23
+ const OFFICIAL_TOOL_META = [
24
+ { name: "click", category: "INPUT", readOnlyHint: false, pageScoped: true, conditions: [] },
25
+ { name: "click_at", category: "INPUT", readOnlyHint: false, pageScoped: true, conditions: ["experimentalVision"] },
26
+ { name: "close_heapsnapshot", category: "MEMORY", readOnlyHint: false, pageScoped: false, conditions: ["memoryDebugging"] },
27
+ { name: "close_page", category: "NAVIGATION", readOnlyHint: false, pageScoped: false, conditions: [] },
28
+ { name: "compare_heapsnapshots", category: "MEMORY", readOnlyHint: true, pageScoped: false, conditions: ["memoryDebugging"] },
29
+ { name: "drag", category: "INPUT", readOnlyHint: false, pageScoped: true, conditions: [] },
30
+ { name: "emulate", category: "EMULATION", readOnlyHint: false, pageScoped: true, conditions: [] },
31
+ { name: "evaluate_script", category: "DEBUGGING", readOnlyHint: false, pageScoped: false, conditions: [] },
32
+ { name: "execute_3p_developer_tool", category: "THIRD_PARTY", readOnlyHint: false, pageScoped: true, conditions: [] },
33
+ { name: "execute_webmcp_tool", category: "WEBMCP", readOnlyHint: false, pageScoped: true, conditions: [] },
34
+ { name: "fill", category: "INPUT", readOnlyHint: false, pageScoped: true, conditions: [] },
35
+ { name: "fill_form", category: "INPUT", readOnlyHint: false, pageScoped: true, conditions: [] },
36
+ { name: "get_console_message", category: "DEBUGGING", readOnlyHint: true, pageScoped: true, conditions: [] },
37
+ { name: "get_heapsnapshot_class_nodes", category: "MEMORY", readOnlyHint: true, pageScoped: false, conditions: ["memoryDebugging"] },
38
+ { name: "get_heapsnapshot_details", category: "MEMORY", readOnlyHint: true, pageScoped: false, conditions: ["memoryDebugging"] },
39
+ { name: "get_heapsnapshot_dominators", category: "MEMORY", readOnlyHint: true, pageScoped: false, conditions: ["memoryDebugging"] },
40
+ { name: "get_heapsnapshot_duplicate_strings", category: "MEMORY", readOnlyHint: true, pageScoped: false, conditions: ["memoryDebugging"] },
41
+ { name: "get_heapsnapshot_edges", category: "MEMORY", readOnlyHint: true, pageScoped: false, conditions: ["memoryDebugging"] },
42
+ { name: "get_heapsnapshot_object_details", category: "MEMORY", readOnlyHint: true, pageScoped: false, conditions: ["memoryDebugging"] },
43
+ { name: "get_heapsnapshot_retainers", category: "MEMORY", readOnlyHint: true, pageScoped: false, conditions: ["memoryDebugging"] },
44
+ { name: "get_heapsnapshot_retaining_paths", category: "MEMORY", readOnlyHint: true, pageScoped: false, conditions: ["memoryDebugging"] },
45
+ { name: "get_heapsnapshot_summary", category: "MEMORY", readOnlyHint: true, pageScoped: false, conditions: ["memoryDebugging"] },
46
+ { name: "get_network_request", category: "NETWORK", readOnlyHint: false, pageScoped: true, conditions: [] },
47
+ { name: "get_os_app_state", category: "PWA", readOnlyHint: true, pageScoped: false, conditions: [] },
48
+ { name: "get_tab_id", category: "NAVIGATION", readOnlyHint: true, pageScoped: true, conditions: ["experimentalInteropTools"] },
49
+ { name: "handle_dialog", category: "INPUT", readOnlyHint: false, pageScoped: true, conditions: [] },
50
+ { name: "hover", category: "INPUT", readOnlyHint: false, pageScoped: true, conditions: [] },
51
+ { name: "install_extension", category: "EXTENSIONS", readOnlyHint: false, pageScoped: false, conditions: [] },
52
+ { name: "install_pwa", category: "PWA", readOnlyHint: false, pageScoped: false, conditions: [] },
53
+ { name: "launch_pwa", category: "PWA", readOnlyHint: false, pageScoped: false, conditions: [] },
54
+ { name: "lighthouse_audit", category: "DEBUGGING", readOnlyHint: false, pageScoped: true, conditions: [] },
55
+ { name: "list_3p_developer_tools", category: "THIRD_PARTY", readOnlyHint: true, pageScoped: true, conditions: [] },
56
+ { name: "list_extensions", category: "EXTENSIONS", readOnlyHint: true, pageScoped: false, conditions: [] },
57
+ { name: "list_network_requests", category: "NETWORK", readOnlyHint: true, pageScoped: true, conditions: [] },
58
+ { name: "list_pages", category: "NAVIGATION", readOnlyHint: true, pageScoped: false, conditions: [] },
59
+ { name: "list_webmcp_tools", category: "WEBMCP", readOnlyHint: true, pageScoped: true, conditions: [] },
60
+ { name: "navigate_page", category: "NAVIGATION", readOnlyHint: false, pageScoped: true, conditions: [] },
61
+ { name: "new_page", category: "NAVIGATION", readOnlyHint: false, pageScoped: false, conditions: [] },
62
+ { name: "performance_analyze_insight", category: "PERFORMANCE", readOnlyHint: true, pageScoped: true, conditions: [] },
63
+ { name: "performance_start_trace", category: "PERFORMANCE", readOnlyHint: false, pageScoped: true, conditions: [] },
64
+ { name: "performance_stop_trace", category: "PERFORMANCE", readOnlyHint: false, pageScoped: true, conditions: [] },
65
+ { name: "press_key", category: "INPUT", readOnlyHint: false, pageScoped: true, conditions: [] },
66
+ { name: "query_heapsnapshot_objects", category: "MEMORY", readOnlyHint: true, pageScoped: false, conditions: ["memoryDebugging"] },
67
+ { name: "reload_extension", category: "EXTENSIONS", readOnlyHint: false, pageScoped: false, conditions: [] },
68
+ { name: "resize_page", category: "EMULATION", readOnlyHint: false, pageScoped: true, conditions: [] },
69
+ { name: "screencast_start", category: "DEBUGGING", readOnlyHint: false, pageScoped: true, conditions: ["experimentalScreencast"] },
70
+ { name: "screencast_stop", category: "DEBUGGING", readOnlyHint: false, pageScoped: true, conditions: ["experimentalScreencast"] },
71
+ { name: "select_page", category: "NAVIGATION", readOnlyHint: true, pageScoped: false, conditions: [] },
72
+ { name: "take_heapsnapshot", category: "MEMORY", readOnlyHint: false, pageScoped: true, conditions: [] },
73
+ { name: "take_screenshot", category: "DEBUGGING", readOnlyHint: false, pageScoped: true, conditions: [] },
74
+ { name: "take_snapshot", category: "DEBUGGING", readOnlyHint: false, pageScoped: true, conditions: [] },
75
+ { name: "trigger_extension_action", category: "EXTENSIONS", readOnlyHint: false, pageScoped: false, conditions: [] },
76
+ { name: "type_text", category: "INPUT", readOnlyHint: false, pageScoped: true, conditions: [] },
77
+ { name: "uninstall_extension", category: "EXTENSIONS", readOnlyHint: false, pageScoped: false, conditions: [] },
78
+ { name: "uninstall_pwa", category: "PWA", readOnlyHint: false, pageScoped: false, conditions: [] },
79
+ { name: "upload_file", category: "INPUT", readOnlyHint: false, pageScoped: true, conditions: [] },
80
+ { name: "wait_for", category: "NAVIGATION", readOnlyHint: true, pageScoped: true, conditions: [] }
81
+ ];
82
+ // Annotate the CommonJS export names for ESM import in node:
83
+ 0 && (module.exports = {
84
+ OFFICIAL_TOOL_META
85
+ });
@@ -0,0 +1,9 @@
1
+ /** AUTO-GENERATED by packages/vite/scripts/sync-official-meta.mjs (build) — 不手改;升级 chrome-devtools-mcp 后重跑构建即可。 */
2
+ export interface OfficialToolMeta {
3
+ name: string;
4
+ category: "INPUT" | "NAVIGATION" | "EMULATION" | "PERFORMANCE" | "NETWORK" | "DEBUGGING" | "EXTENSIONS" | "THIRD_PARTY" | "MEMORY" | "WEBMCP" | "PWA" | "";
5
+ readOnlyHint: boolean;
6
+ pageScoped: boolean;
7
+ conditions: string[];
8
+ }
9
+ export declare const OFFICIAL_TOOL_META: OfficialToolMeta[];
@@ -0,0 +1,70 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var official_tools_exports = {};
19
+ __export(official_tools_exports, {
20
+ getOfficialProjectTools: () => getOfficialProjectTools
21
+ });
22
+ module.exports = __toCommonJS(official_tools_exports);
23
+ var import_node = require("@aipanel/core/node");
24
+ var import_mcp_tools = require("./mcp-tools.cjs");
25
+ const log = (0, import_node.createLogger)("OfficialChromeTools");
26
+ let cached = null;
27
+ async function fetchOfficialEntries(mcp) {
28
+ const res = await mcp.call("tools/list", {});
29
+ const map = /* @__PURE__ */ new Map();
30
+ for (const t of res?.result?.tools ?? []) {
31
+ const raw = String(t?.name ?? "");
32
+ const short = raw.startsWith(import_mcp_tools.MCP_PREFIX) ? raw.slice(import_mcp_tools.MCP_PREFIX.length) : raw;
33
+ if (!short) continue;
34
+ const schema = t?.inputSchema ?? { type: "object", properties: {} };
35
+ map.set(short, { short, description: String(t?.description ?? ""), schema });
36
+ }
37
+ return map;
38
+ }
39
+ function ensureOfficialEntries(mcp) {
40
+ if (!cached) {
41
+ cached = fetchOfficialEntries(mcp).catch((e) => {
42
+ cached = null;
43
+ log.warn("Failed to fetch official chrome-devtools-mcp tools", {
44
+ error: e instanceof Error ? e.message : String(e)
45
+ });
46
+ throw e;
47
+ });
48
+ }
49
+ return cached;
50
+ }
51
+ async function getOfficialProjectTools(mcp) {
52
+ const map = await ensureOfficialEntries(mcp);
53
+ const tools = [];
54
+ for (const short of (0, import_mcp_tools.currentOfficialShorts)()) {
55
+ const entry = map.get(short);
56
+ if (!entry) {
57
+ log.warn("Requested official tool missing from server tools/list (skip)", { short });
58
+ continue;
59
+ }
60
+ const schema = import_mcp_tools.OFFICIAL_NO_PAGE_TOOLS.has(short) ? entry.schema : (0, import_mcp_tools.withPageIdSchema)(entry.schema);
61
+ const note = import_mcp_tools.PROJECT_DESCRIPTION_NOTES[short];
62
+ const description = note ? entry.description ? `${entry.description} ${note}` : note : entry.description;
63
+ tools.push({ name: (0, import_mcp_tools.displayToolName)(short), description, inputSchema: schema });
64
+ }
65
+ return tools;
66
+ }
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {
69
+ getOfficialProjectTools
70
+ });
@@ -0,0 +1,7 @@
1
+ import { type CustomTool } from "./mcp-tools";
2
+ import type { McpProxy } from "./mcp-proxy";
3
+ /**
4
+ * 项目白名单的官方工具集(英文 schema/描述,已追加 pageId)。
5
+ * 官方当前版本缺失某名时跳过(名称跟随官方,不本地复制)。
6
+ */
7
+ export declare function getOfficialProjectTools(mcp: McpProxy): Promise<CustomTool[]>;
@@ -25,7 +25,6 @@ module.exports = __toCommonJS(service_exports);
25
25
  var import_node_crypto = require("node:crypto");
26
26
  var import_core = require("@aipanel/core");
27
27
  var import_node = require("@aipanel/core/node");
28
- var import_system = require("../utils/system.cjs");
29
28
  var import_proxy_server = require("./proxy-server.cjs");
30
29
  const log = (0, import_node.createLogger)("Service");
31
30
  class AIPanelService {
@@ -64,7 +63,7 @@ class AIPanelService {
64
63
  this.currentTask = { task, ...data };
65
64
  this.sseClients.forEach((client) => {
66
65
  try {
67
- client.write(`data: ${JSON.stringify({ type: "TASK_UPDATE", task, ...data })}
66
+ client.write(`data: ${JSON.stringify({ type: import_core.SSE_EVENT_TYPES.TASK_UPDATE, task, ...data })}
68
67
 
69
68
  `);
70
69
  } catch (e) {
@@ -119,7 +118,7 @@ class AIPanelService {
119
118
  log.debug(`Using port ${this.actualWebPort}`);
120
119
  }
121
120
  timer.checkpoint("Port allocated");
122
- this.workspaceRoot = (0, import_system.findGitRoot)(process.cwd());
121
+ this.workspaceRoot = (0, import_node.findGitRoot)(process.cwd());
123
122
  log.debug(`Using workspace root: ${this.workspaceRoot}`);
124
123
  this.sendTaskUpdate("preparing_runtime");
125
124
  this.sendTaskUpdate("starting_web");
@@ -145,7 +144,7 @@ class AIPanelService {
145
144
  webAuthCookie = startResult.webAuthCookie;
146
145
  log.debug(`Waiting for Web UI to become ready at ${webUrl}...`);
147
146
  this.sendTaskUpdate("waiting_web_ready");
148
- await (0, import_system.waitForServer)(webUrl, import_core.SERVER_START_TIMEOUT, this.webProcess ?? void 0);
147
+ await (0, import_node.waitForServer)(webUrl, import_core.SERVER_START_TIMEOUT, this.webProcess ?? void 0);
149
148
  if (this.webProcess?.exitCode !== null && this.webProcess?.exitCode !== void 0) {
150
149
  throw new Error(`Web process exited with code ${this.webProcess.exitCode}`);
151
150
  }
@@ -251,7 +250,7 @@ class AIPanelService {
251
250
  pushProviderEvent(event) {
252
251
  this.sseClients.forEach((client) => {
253
252
  try {
254
- client.write(`data: ${JSON.stringify({ type: "SESSION_EVENT", event })}
253
+ client.write(`data: ${JSON.stringify({ type: import_core.SSE_EVENT_TYPES.SESSION_EVENT, event })}
255
254
 
256
255
  `);
257
256
  } catch (e) {
@@ -50,7 +50,7 @@ function setupContextEndpoint(server, ctx) {
50
50
  let sentCount = 0;
51
51
  ctx.sseClients.forEach((client) => {
52
52
  try {
53
- client.write(`data: ${JSON.stringify({ type: "CLEAR_ELEMENTS" })}
53
+ client.write(`data: ${JSON.stringify({ type: import_core.SSE_EVENT_TYPES.CLEAR_ELEMENTS })}
54
54
 
55
55
  `);
56
56
  sentCount++;
@@ -22,7 +22,6 @@ __export(host_events_exports, {
22
22
  module.exports = __toCommonJS(host_events_exports);
23
23
  var import_core = require("@aipanel/core");
24
24
  var import_node = require("@aipanel/core/node");
25
- const log = (0, import_node.createLogger)("Endpoints:HostEvents");
26
25
  function setupHostEventsEndpoint(server, ctx) {
27
26
  server.middlewares.use(import_core.HOST_EVENTS_API_PATH, async (req, res) => {
28
27
  const reqCtx = new import_node.RequestContext(req.method || "GET", import_core.HOST_EVENTS_API_PATH);
@@ -84,7 +83,7 @@ function setupHostEventsEndpoint(server, ctx) {
84
83
  function isProviderEvent(value) {
85
84
  if (typeof value !== "object" || value === null) return false;
86
85
  const v = value;
87
- if (v.type === "session.status" || v.type === "thinking") {
86
+ if (v.type === "session.status" || v.type === "thinking" || v.type === "session.pending" || v.type === "session.subagents") {
88
87
  return typeof v.sessionId === "string" && v.sessionId.length > 0;
89
88
  }
90
89
  if (v.type === "session.updated") {
@@ -36,7 +36,7 @@ var import_mcp = require("./mcp.cjs");
36
36
  var import_vue_devtools = require("./vue-devtools.cjs");
37
37
  var import_core = require("@aipanel/core");
38
38
  __reExport(endpoints_exports, require("./types.cjs"), module.exports);
39
- function setupMiddlewares(server, ctx, mcp, logFiles) {
39
+ function setupMiddlewares(server, ctx, mcp, logFiles, chromeProject) {
40
40
  (0, import_widget.setupWidgetEndpoints)(server, ctx);
41
41
  (0, import_context.setupContextEndpoint)(server, ctx);
42
42
  (0, import_start.setupStartEndpoint)(server, ctx);
@@ -46,7 +46,7 @@ function setupMiddlewares(server, ctx, mcp, logFiles) {
46
46
  (0, import_warmup.setupWarmupEndpoint)(server, ctx);
47
47
  (0, import_logs.setupLogsEndpoint)(server);
48
48
  if (mcp) {
49
- (0, import_mcp.setupMcpEndpoint)(server, mcp, () => ctx.getPageContext(), logFiles ?? []);
49
+ (0, import_mcp.setupMcpEndpoint)(server, mcp, () => ctx.getPageContext(), logFiles ?? [], chromeProject);
50
50
  (0, import_vue_devtools.setupVueDevtoolsEndpoint)(server, mcp);
51
51
  }
52
52
  }
@@ -3,7 +3,7 @@ import type { EndpointContext } from "./types";
3
3
  import { MCP_API_PATH } from "./mcp";
4
4
  import { VUE_DEVTOOLS_API_PATH } from "./vue-devtools";
5
5
  import type { McpProxy } from "../core/mcp-proxy";
6
- import { LOGS_API_PATH, type LogFileConfig } from "@aipanel/core";
6
+ import { LOGS_API_PATH, type ChromeProjectOptions, type LogFileConfig } from "@aipanel/core";
7
7
  export * from "./types";
8
8
  export { LOGS_API_PATH, MCP_API_PATH, VUE_DEVTOOLS_API_PATH };
9
- export declare function setupMiddlewares(server: ViteDevServer, ctx: EndpointContext, mcp?: McpProxy, logFiles?: LogFileConfig[]): void;
9
+ export declare function setupMiddlewares(server: ViteDevServer, ctx: EndpointContext, mcp?: McpProxy, logFiles?: LogFileConfig[], chromeProject?: ChromeProjectOptions): void;