vite-plugin-aipanel 1.2.12 → 1.2.14
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/es/core/service.d.ts +1 -1
- package/es/core/service.mjs +12 -4
- package/es/index.mjs +7 -0
- package/lib/client.js +1766 -1766
- package/lib/core/service.cjs +6 -3
- package/lib/core/service.d.ts +1 -1
- package/lib/index.cjs +7 -0
- package/package.json +5 -5
package/lib/core/service.cjs
CHANGED
|
@@ -63,15 +63,17 @@ class AIPanelService {
|
|
|
63
63
|
this.currentTask = { task, ...data };
|
|
64
64
|
this.sseClients.forEach((client) => {
|
|
65
65
|
try {
|
|
66
|
-
client.write(
|
|
66
|
+
client.write(
|
|
67
|
+
`data: ${JSON.stringify({ type: import_core.SSE_EVENT_TYPES.TASK_UPDATE, task, ...data })}
|
|
67
68
|
|
|
68
|
-
`
|
|
69
|
+
`
|
|
70
|
+
);
|
|
69
71
|
} catch (e) {
|
|
70
72
|
log.debug("Failed to send TASK_UPDATE event", { error: e });
|
|
71
73
|
}
|
|
72
74
|
});
|
|
73
75
|
}
|
|
74
|
-
async start(vitePort, corsOrigins, contextApiUrl, logsApiUrl, viteOrigin, mcp, vueDevtoolsApiUrl) {
|
|
76
|
+
async start(vitePort, viteHost, corsOrigins, contextApiUrl, logsApiUrl, viteOrigin, mcp, vueDevtoolsApiUrl) {
|
|
75
77
|
if (this.isStarted && this.webProcess) {
|
|
76
78
|
log.debug("Services already started, skipping");
|
|
77
79
|
return;
|
|
@@ -131,6 +133,7 @@ class AIPanelService {
|
|
|
131
133
|
cwd: this.workspaceRoot,
|
|
132
134
|
corsOrigins,
|
|
133
135
|
vitePort,
|
|
136
|
+
viteHost,
|
|
134
137
|
contextApiUrl,
|
|
135
138
|
logsApiUrl,
|
|
136
139
|
verbose: this.config.verbose,
|
package/lib/core/service.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare class AIPanelService {
|
|
|
34
34
|
/** 设置 Provider(由编排层动态加载后调用) */
|
|
35
35
|
setProvider(provider: WebProvider): void;
|
|
36
36
|
private sendTaskUpdate;
|
|
37
|
-
start(vitePort: number, corsOrigins: string[], contextApiUrl: string, logsApiUrl: string, viteOrigin: string, mcp: McpProxy, vueDevtoolsApiUrl?: string): Promise<void>;
|
|
37
|
+
start(vitePort: number, viteHost: string, corsOrigins: string[], contextApiUrl: string, logsApiUrl: string, viteOrigin: string, mcp: McpProxy, vueDevtoolsApiUrl?: string): Promise<void>;
|
|
38
38
|
/** 把一条 ProviderEvent 广播给所有 SSE 客户端(SESSION_EVENT 载荷) */
|
|
39
39
|
pushProviderEvent(event: ProviderEvent): void;
|
|
40
40
|
retryWarmupChromeMcp(): Promise<{
|
package/lib/index.cjs
CHANGED
|
@@ -99,6 +99,9 @@ function aipanelPlugin(options = {}) {
|
|
|
99
99
|
plugins.push(createAIPanelPlugin(options));
|
|
100
100
|
return plugins;
|
|
101
101
|
}
|
|
102
|
+
function normalizeViteHost(host, fallback) {
|
|
103
|
+
return typeof host === "string" && host && host !== "0.0.0.0" && host !== "::" && host !== "::1" ? host : fallback;
|
|
104
|
+
}
|
|
102
105
|
function createAIPanelPlugin(options = {}) {
|
|
103
106
|
const config = (0, import_core.resolvePluginConfig)(options);
|
|
104
107
|
(0, import_core.setVerbose)(config.verbose);
|
|
@@ -108,6 +111,7 @@ function createAIPanelPlugin(options = {}) {
|
|
|
108
111
|
let actualProxyPort = config.proxyPort ?? import_core.DEFAULT_PROXY_PORT;
|
|
109
112
|
let projectRoot = "";
|
|
110
113
|
let vueDevtoolsApiUrl = "";
|
|
114
|
+
let viteServerHost = "localhost";
|
|
111
115
|
const pageContext = { url: "", title: "" };
|
|
112
116
|
const DEFAULT_TAB = "default";
|
|
113
117
|
const pageContexts = /* @__PURE__ */ new Map([[DEFAULT_TAB, pageContext]]);
|
|
@@ -156,6 +160,7 @@ function createAIPanelPlugin(options = {}) {
|
|
|
156
160
|
async configureServer(server) {
|
|
157
161
|
const timer = log.timer("configureServer");
|
|
158
162
|
projectRoot = server.config.root;
|
|
163
|
+
viteServerHost = normalizeViteHost(server.config.server.host, config.hostname);
|
|
159
164
|
let viteOrigin = "";
|
|
160
165
|
(0, import_endpoints.setupMiddlewares)(
|
|
161
166
|
server,
|
|
@@ -298,6 +303,7 @@ function createAIPanelPlugin(options = {}) {
|
|
|
298
303
|
}
|
|
299
304
|
await service.start(
|
|
300
305
|
vitePort,
|
|
306
|
+
viteHost,
|
|
301
307
|
[viteOrigin],
|
|
302
308
|
contextApiUrl,
|
|
303
309
|
logsApiUrl,
|
|
@@ -371,6 +377,7 @@ ${SILENT_CONTEXT_SCRIPT}</body>`),
|
|
|
371
377
|
hotkey: config.hotkey,
|
|
372
378
|
proxyPort: actualProxyPort,
|
|
373
379
|
proxyHost: config.hostname,
|
|
380
|
+
viteHost: viteServerHost,
|
|
374
381
|
displayMode: config.displayMode === "extension" ? "extension-selector" : config.displayMode,
|
|
375
382
|
splitMode: config.splitMode,
|
|
376
383
|
serviceInstanceId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-aipanel",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
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",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"execa": "^9.6.1",
|
|
43
43
|
"typescript-language-server": "^5.3.0",
|
|
44
44
|
"unplugin-vue-inspector": "^3.0.0",
|
|
45
|
-
"@aipanel/core": "1.2.
|
|
46
|
-
"@aipanel/provider-opencode": "1.2.
|
|
45
|
+
"@aipanel/core": "1.2.14",
|
|
46
|
+
"@aipanel/provider-opencode": "1.2.14"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"vite": ">=5.0.0",
|
|
50
|
-
"@aipanel/provider-deepseek": "1.2.
|
|
50
|
+
"@aipanel/provider-deepseek": "1.2.14"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"@aipanel/provider-deepseek": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/picomatch": "^4.0.0",
|
|
59
59
|
"sharp": "^0.34.5",
|
|
60
|
-
"@aipanel/client": "1.2.
|
|
60
|
+
"@aipanel/client": "1.2.14"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "node scripts/sync-official-meta.mjs && pagoda-cli build && vite build -c vite.client.config.ts",
|