vite-plugin-opencode-assistant 1.0.15 → 1.0.16
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/client/App.vue.d.ts +6 -0
- package/es/client/App.vue.js +300 -0
- package/es/client/components/ChromeWarmupError-sfc.css +1 -0
- package/es/client/components/ChromeWarmupError.vue.d.ts +11 -0
- package/es/client/components/ChromeWarmupError.vue.js +196 -0
- package/es/client/components/LoadingContent.vue.d.ts +5 -0
- package/es/client/components/LoadingContent.vue.js +39 -0
- package/es/client/composables/useContext.d.ts +8 -0
- package/es/client/composables/useContext.js +63 -0
- package/es/client/composables/useHotkey.d.ts +12 -0
- package/es/client/composables/useHotkey.js +41 -0
- package/es/client/composables/useSSE.d.ts +20 -0
- package/es/client/composables/useSSE.js +61 -0
- package/es/client/composables/useSelectedElements.d.ts +19 -0
- package/es/client/composables/useSelectedElements.js +43 -0
- package/es/client/composables/useServiceStatus.d.ts +13 -0
- package/es/client/composables/useServiceStatus.js +53 -0
- package/es/client/composables/useSessions.d.ts +26 -0
- package/es/client/composables/useSessions.js +127 -0
- package/es/client/composables/useTheme.d.ts +12 -0
- package/es/client/composables/useTheme.js +42 -0
- package/es/client/index.d.ts +1 -1
- package/es/client/index.js +5 -675
- package/es/client/styles.css +1 -0
- package/es/core/api.d.ts +18 -6
- package/es/core/api.js +324 -69
- package/es/core/proxy-server.js +127 -2
- package/es/core/service.d.ts +9 -2
- package/es/core/service.js +35 -31
- package/es/endpoints/index.js +1 -1
- package/es/endpoints/sse.js +0 -3
- package/es/endpoints/start.d.ts +1 -2
- package/es/endpoints/start.js +2 -2
- package/es/endpoints/types.d.ts +5 -2
- package/es/endpoints/warmup.js +15 -3
- package/es/index.js +8 -12
- package/es/utils/system.d.ts +1 -0
- package/es/utils/system.js +28 -0
- package/lib/client/App.vue.d.ts +6 -0
- package/lib/client/App.vue.js +329 -0
- package/lib/client/components/ChromeWarmupError-sfc.css +1 -0
- package/lib/client/components/ChromeWarmupError.vue.d.ts +11 -0
- package/lib/client/components/ChromeWarmupError.vue.js +215 -0
- package/lib/client/components/LoadingContent.vue.d.ts +5 -0
- package/lib/client/components/LoadingContent.vue.js +58 -0
- package/lib/client/composables/useContext.d.ts +8 -0
- package/lib/client/composables/useContext.js +86 -0
- package/lib/client/composables/useHotkey.d.ts +12 -0
- package/lib/client/composables/useHotkey.js +66 -0
- package/lib/client/composables/useSSE.d.ts +20 -0
- package/lib/client/composables/useSSE.js +84 -0
- package/lib/client/composables/useSelectedElements.d.ts +19 -0
- package/lib/client/composables/useSelectedElements.js +66 -0
- package/lib/client/composables/useServiceStatus.d.ts +13 -0
- package/lib/client/composables/useServiceStatus.js +76 -0
- package/lib/client/composables/useSessions.d.ts +26 -0
- package/lib/client/composables/useSessions.js +148 -0
- package/lib/client/composables/useTheme.d.ts +12 -0
- package/lib/client/composables/useTheme.js +65 -0
- package/lib/client/index.d.ts +1 -1
- package/lib/client/index.js +22 -667
- package/lib/client/styles.css +1 -0
- package/lib/client.js +2988 -2973
- package/lib/core/api.d.ts +18 -6
- package/lib/core/api.js +321 -74
- package/lib/core/proxy-server.js +127 -2
- package/lib/core/service.d.ts +9 -2
- package/lib/core/service.js +31 -30
- package/lib/endpoints/index.js +1 -1
- package/lib/endpoints/sse.js +0 -3
- package/lib/endpoints/start.d.ts +1 -2
- package/lib/endpoints/start.js +2 -2
- package/lib/endpoints/types.d.ts +5 -2
- package/lib/endpoints/warmup.js +15 -3
- package/lib/index.js +8 -12
- package/lib/style.css +1 -1
- package/lib/utils/system.d.ts +1 -0
- package/lib/utils/system.js +29 -0
- package/package.json +4 -4
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var __async = (__this, __arguments, generator) => {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
var fulfilled = (value) => {
|
|
31
|
+
try {
|
|
32
|
+
step(generator.next(value));
|
|
33
|
+
} catch (e) {
|
|
34
|
+
reject(e);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var rejected = (value) => {
|
|
38
|
+
try {
|
|
39
|
+
step(generator.throw(value));
|
|
40
|
+
} catch (e) {
|
|
41
|
+
reject(e);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
45
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
var App_vue_exports = {};
|
|
49
|
+
__export(App_vue_exports, {
|
|
50
|
+
default: () => App_vue_default
|
|
51
|
+
});
|
|
52
|
+
module.exports = __toCommonJS(App_vue_exports);
|
|
53
|
+
var import_vue = require("vue");
|
|
54
|
+
var import_vue2 = require("vue");
|
|
55
|
+
var import_components = require("@vite-plugin-opencode-assistant/components");
|
|
56
|
+
var import_useHotkey = require("./composables/useHotkey");
|
|
57
|
+
var import_useSSE = require("./composables/useSSE");
|
|
58
|
+
var import_useSessions = require("./composables/useSessions");
|
|
59
|
+
var import_useTheme = require("./composables/useTheme");
|
|
60
|
+
var import_useSelectedElements = require("./composables/useSelectedElements");
|
|
61
|
+
var import_useServiceStatus = require("./composables/useServiceStatus");
|
|
62
|
+
var import_useContext = require("./composables/useContext");
|
|
63
|
+
var import_LoadingContent_vue = __toESM(require("./components/LoadingContent.vue.js"));
|
|
64
|
+
var import_ChromeWarmupError_vue = __toESM(require("./components/ChromeWarmupError.vue.js"));
|
|
65
|
+
var import_vue3 = require("vue");
|
|
66
|
+
const __vue_sfc__ = /* @__PURE__ */ (0, import_vue.defineComponent)({
|
|
67
|
+
__name: "App",
|
|
68
|
+
props: {
|
|
69
|
+
config: { type: Object, required: true }
|
|
70
|
+
},
|
|
71
|
+
setup(__props, { expose: __expose }) {
|
|
72
|
+
__expose();
|
|
73
|
+
const props = __props;
|
|
74
|
+
const open = (0, import_vue2.ref)(false);
|
|
75
|
+
const selectMode = (0, import_vue2.ref)(false);
|
|
76
|
+
const sessionListCollapsed = (0, import_vue2.ref)(true);
|
|
77
|
+
const loading = (0, import_vue2.ref)(false);
|
|
78
|
+
const widgetRef = (0, import_vue2.ref)(null);
|
|
79
|
+
const retryingWarmup = (0, import_vue2.ref)(false);
|
|
80
|
+
const {
|
|
81
|
+
position = "bottom-right",
|
|
82
|
+
theme: initialTheme = "auto",
|
|
83
|
+
open: autoOpen = false,
|
|
84
|
+
hotkey = "ctrl+k"
|
|
85
|
+
} = props.config;
|
|
86
|
+
const widgetPosition = position;
|
|
87
|
+
const widgetTheme = initialTheme;
|
|
88
|
+
const showNotification = (msg) => {
|
|
89
|
+
var _a, _b;
|
|
90
|
+
(_b = (_a = widgetRef.value) == null ? void 0 : _a.showNotification) == null ? void 0 : _b.call(_a, msg);
|
|
91
|
+
};
|
|
92
|
+
const {
|
|
93
|
+
serviceStatus,
|
|
94
|
+
chromeMcpFailed,
|
|
95
|
+
chromeMcpErrorType,
|
|
96
|
+
chromeMcpErrorMessage,
|
|
97
|
+
thinking,
|
|
98
|
+
loadingText,
|
|
99
|
+
updateStatusFromTask,
|
|
100
|
+
setStarting,
|
|
101
|
+
setThinking
|
|
102
|
+
} = (0, import_useServiceStatus.useServiceStatus)();
|
|
103
|
+
const {
|
|
104
|
+
selectedElements,
|
|
105
|
+
addElement,
|
|
106
|
+
removeElement,
|
|
107
|
+
clearElements
|
|
108
|
+
} = (0, import_useSelectedElements.useSelectedElements)();
|
|
109
|
+
const {
|
|
110
|
+
theme,
|
|
111
|
+
sendThemeToIframe
|
|
112
|
+
} = (0, import_useTheme.useTheme)(widgetTheme, widgetRef);
|
|
113
|
+
const {
|
|
114
|
+
sessions,
|
|
115
|
+
loadingSessionList,
|
|
116
|
+
currentSessionId,
|
|
117
|
+
iframeSrc,
|
|
118
|
+
iframeLoading,
|
|
119
|
+
loadSessions,
|
|
120
|
+
createSession,
|
|
121
|
+
deleteSession,
|
|
122
|
+
selectSession
|
|
123
|
+
} = (0, import_useSessions.useSessions)(showNotification);
|
|
124
|
+
const { updateContext } = (0, import_useContext.useContext)(serviceStatus, selectedElements);
|
|
125
|
+
const showSessionListSkeleton = (0, import_vue2.computed)(() => serviceStatus.value === "starting");
|
|
126
|
+
const computedLoading = (0, import_vue2.computed)(() => {
|
|
127
|
+
return serviceStatus.value === "starting" || iframeLoading.value;
|
|
128
|
+
});
|
|
129
|
+
const retryWarmup = () => __async(null, null, function* () {
|
|
130
|
+
retryingWarmup.value = true;
|
|
131
|
+
try {
|
|
132
|
+
const res = yield fetch("/__opencode_warmup__", { method: "POST" });
|
|
133
|
+
const data = yield res.json();
|
|
134
|
+
if (data.success) {
|
|
135
|
+
chromeMcpFailed.value = false;
|
|
136
|
+
serviceStatus.value = "ready";
|
|
137
|
+
showNotification("Chrome DevTools MCP \u8FDE\u63A5\u6210\u529F");
|
|
138
|
+
} else {
|
|
139
|
+
if (data.errorType === "AI_TIMEOUT") {
|
|
140
|
+
showNotification("AI \u54CD\u5E94\u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5 OpenCode AI \u6A21\u578B\u914D\u7F6E");
|
|
141
|
+
} else if (data.errorType === "AI_RESPONSE_ERROR") {
|
|
142
|
+
showNotification("AI \u54CD\u5E94\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 OpenCode AI \u6A21\u578B\u914D\u7F6E");
|
|
143
|
+
} else if (data.errorType === "CHROME_NOT_CONNECTED") {
|
|
144
|
+
showNotification("Chrome \u8FDC\u7A0B\u8C03\u8BD5\u672A\u5F00\u542F\uFF0C\u8BF7\u6309\u7167\u63D0\u793A\u64CD\u4F5C");
|
|
145
|
+
} else {
|
|
146
|
+
showNotification(data.error || "\u91CD\u8BD5\u5931\u8D25\uFF0C\u8BF7\u786E\u8BA4 Chrome \u8FDC\u7A0B\u8C03\u8BD5\u5DF2\u5F00\u542F");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
} catch (e) {
|
|
150
|
+
console.error("[OpenCode] Retry warmup failed:", e);
|
|
151
|
+
showNotification("\u91CD\u8BD5\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");
|
|
152
|
+
} finally {
|
|
153
|
+
retryingWarmup.value = false;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
const { setupSSE } = (0, import_useSSE.useSSE)(
|
|
157
|
+
(data) => {
|
|
158
|
+
if (data.isStarted !== void 0 && data.isStarted && serviceStatus.value === "idle") {
|
|
159
|
+
setStarting();
|
|
160
|
+
}
|
|
161
|
+
if (data.task) {
|
|
162
|
+
updateStatusFromTask(data.task, data.errorType, data.errorMessage);
|
|
163
|
+
}
|
|
164
|
+
if (serviceStatus.value !== "idle") {
|
|
165
|
+
loadSessions();
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
(data) => {
|
|
169
|
+
updateStatusFromTask(data.task, data.errorType, data.errorMessage);
|
|
170
|
+
},
|
|
171
|
+
() => clearElements(),
|
|
172
|
+
() => updateContext(true)
|
|
173
|
+
);
|
|
174
|
+
const ensureServicesStarted = () => __async(null, null, function* () {
|
|
175
|
+
if (serviceStatus.value !== "idle") return true;
|
|
176
|
+
try {
|
|
177
|
+
const res = yield fetch("/__opencode_start__");
|
|
178
|
+
const data = yield res.json();
|
|
179
|
+
if (data.success) {
|
|
180
|
+
setStarting();
|
|
181
|
+
setupSSE();
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
} catch (e) {
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
});
|
|
188
|
+
(0, import_useHotkey.useHotkey)(hotkey, (e) => {
|
|
189
|
+
e.preventDefault();
|
|
190
|
+
handleToggle(!open.value);
|
|
191
|
+
});
|
|
192
|
+
(0, import_useHotkey.useHotkey)("ctrl+p", (e) => {
|
|
193
|
+
e.preventDefault();
|
|
194
|
+
const win = window;
|
|
195
|
+
if (win.__VUE_INSPECTOR__) {
|
|
196
|
+
selectMode.value = !selectMode.value;
|
|
197
|
+
} else {
|
|
198
|
+
showNotification("Vue Inspector \u672A\u52A0\u8F7D\uFF0C\u65E0\u6CD5\u4F7F\u7528\u5143\u7D20\u9009\u62E9\u529F\u80FD");
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
(0, import_vue2.onMounted)(() => {
|
|
202
|
+
if (serviceStatus.value !== "idle") {
|
|
203
|
+
loadSessions();
|
|
204
|
+
setupSSE();
|
|
205
|
+
updateContext(true);
|
|
206
|
+
}
|
|
207
|
+
if (autoOpen && serviceStatus.value !== "idle") {
|
|
208
|
+
setTimeout(() => {
|
|
209
|
+
open.value = true;
|
|
210
|
+
}, 1e3);
|
|
211
|
+
}
|
|
212
|
+
const handleIframeMessage = (event) => {
|
|
213
|
+
var _a, _b;
|
|
214
|
+
if (((_a = event.data) == null ? void 0 : _a.type) === "OPENCODE_THINKING_STATE") {
|
|
215
|
+
setThinking(event.data.thinking);
|
|
216
|
+
}
|
|
217
|
+
if (((_b = event.data) == null ? void 0 : _b.type) === "OPENCODE_READY") {
|
|
218
|
+
sendThemeToIframe();
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
window.addEventListener("message", handleIframeMessage);
|
|
222
|
+
});
|
|
223
|
+
const handleToggle = (val) => __async(null, null, function* () {
|
|
224
|
+
if (serviceStatus.value === "idle" && val) {
|
|
225
|
+
loading.value = true;
|
|
226
|
+
const started = yield ensureServicesStarted();
|
|
227
|
+
loading.value = false;
|
|
228
|
+
if (!started) {
|
|
229
|
+
showNotification("\u670D\u52A1\u542F\u52A8\u5931\u8D25");
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
open.value = val;
|
|
234
|
+
if (val) updateContext();
|
|
235
|
+
if (val) {
|
|
236
|
+
iframeLoading.value = false;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
const handleSelectNode = (element) => {
|
|
240
|
+
const added = addElement(element);
|
|
241
|
+
if (added) {
|
|
242
|
+
showNotification(`\u5DF2\u9009\u4E2D\u5143\u7D20 (${selectedElements.value.length}\u4E2A)`);
|
|
243
|
+
updateContext(true);
|
|
244
|
+
} else {
|
|
245
|
+
showNotification("\u8BE5\u5143\u7D20\u5DF2\u9009\u4E2D");
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
const handleClearSelected = () => {
|
|
249
|
+
clearElements();
|
|
250
|
+
updateContext(true);
|
|
251
|
+
showNotification("\u5DF2\u6E05\u9664\u6240\u6709\u9009\u4E2D\u5143\u7D20");
|
|
252
|
+
};
|
|
253
|
+
const handleSelectModeChange = (val) => {
|
|
254
|
+
selectMode.value = val;
|
|
255
|
+
if (!val && !open.value) {
|
|
256
|
+
open.value = true;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
const handleSessionListCollapsedChange = (val) => {
|
|
260
|
+
sessionListCollapsed.value = val;
|
|
261
|
+
};
|
|
262
|
+
const handleThemeChange = (val) => {
|
|
263
|
+
theme.value = val;
|
|
264
|
+
};
|
|
265
|
+
const handleRemoveSelectedNode = ({ index }) => {
|
|
266
|
+
removeElement(index);
|
|
267
|
+
updateContext(true);
|
|
268
|
+
};
|
|
269
|
+
const handleFrameLoaded = () => {
|
|
270
|
+
iframeLoading.value = false;
|
|
271
|
+
};
|
|
272
|
+
const __returned__ = { props, open, selectMode, sessionListCollapsed, loading, widgetRef, retryingWarmup, position, initialTheme, autoOpen, hotkey, widgetPosition, widgetTheme, showNotification, serviceStatus, chromeMcpFailed, chromeMcpErrorType, chromeMcpErrorMessage, thinking, loadingText, updateStatusFromTask, setStarting, setThinking, selectedElements, addElement, removeElement, clearElements, theme, sendThemeToIframe, sessions, loadingSessionList, currentSessionId, iframeSrc, iframeLoading, loadSessions, createSession, deleteSession, selectSession, updateContext, showSessionListSkeleton, computedLoading, retryWarmup, setupSSE, ensureServicesStarted, handleToggle, handleSelectNode, handleClearSelected, handleSelectModeChange, handleSessionListCollapsedChange, handleThemeChange, handleRemoveSelectedNode, handleFrameLoaded, get OpenCodeWidget() {
|
|
273
|
+
return import_components.OpenCodeWidget;
|
|
274
|
+
}, LoadingContent: import_LoadingContent_vue.default, ChromeWarmupError: import_ChromeWarmupError_vue.default };
|
|
275
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
276
|
+
return __returned__;
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
280
|
+
return (0, import_vue3.openBlock)(), (0, import_vue3.createBlock)($setup["OpenCodeWidget"], {
|
|
281
|
+
ref: "widgetRef",
|
|
282
|
+
position: $setup.widgetPosition,
|
|
283
|
+
theme: $setup.theme,
|
|
284
|
+
open: $setup.open,
|
|
285
|
+
"select-mode": $setup.selectMode,
|
|
286
|
+
"session-list-collapsed": $setup.sessionListCollapsed,
|
|
287
|
+
"frame-loading": $setup.computedLoading,
|
|
288
|
+
"loading-session-list": $setup.loadingSessionList,
|
|
289
|
+
"show-session-list-skeleton": $setup.showSessionListSkeleton,
|
|
290
|
+
"show-error": $setup.chromeMcpFailed,
|
|
291
|
+
"iframe-src": $setup.iframeSrc,
|
|
292
|
+
"current-session-id": $setup.currentSessionId,
|
|
293
|
+
sessions: $setup.sessions,
|
|
294
|
+
"session-key": "id",
|
|
295
|
+
"selected-elements": $setup.selectedElements,
|
|
296
|
+
"hotkey-label": $setup.hotkey,
|
|
297
|
+
thinking: $setup.thinking,
|
|
298
|
+
"onUpdate:open": $setup.handleToggle,
|
|
299
|
+
"onUpdate:selectMode": $setup.handleSelectModeChange,
|
|
300
|
+
"onUpdate:sessionListCollapsed": $setup.handleSessionListCollapsedChange,
|
|
301
|
+
"onUpdate:theme": $setup.handleThemeChange,
|
|
302
|
+
onToggleTheme: $setup.handleThemeChange,
|
|
303
|
+
onCreateSession: $setup.createSession,
|
|
304
|
+
onDeleteSession: $setup.deleteSession,
|
|
305
|
+
onSelectSession: $setup.selectSession,
|
|
306
|
+
onClickSelectedNode: $setup.handleSelectNode,
|
|
307
|
+
onClearSelectedNodes: $setup.handleClearSelected,
|
|
308
|
+
onRemoveSelectedNode: $setup.handleRemoveSelectedNode,
|
|
309
|
+
onEmptyAction: $setup.createSession,
|
|
310
|
+
onFrameLoaded: $setup.handleFrameLoaded
|
|
311
|
+
}, {
|
|
312
|
+
loading: (0, import_vue3.withCtx)(() => [
|
|
313
|
+
(0, import_vue3.createVNode)($setup["LoadingContent"], { "loading-text": $setup.loadingText }, null, 8, ["loading-text"])
|
|
314
|
+
]),
|
|
315
|
+
error: (0, import_vue3.withCtx)(() => [
|
|
316
|
+
$setup.chromeMcpFailed ? ((0, import_vue3.openBlock)(), (0, import_vue3.createBlock)($setup["ChromeWarmupError"], {
|
|
317
|
+
key: 0,
|
|
318
|
+
retrying: $setup.retryingWarmup,
|
|
319
|
+
"error-type": $setup.chromeMcpErrorType,
|
|
320
|
+
"error-message": $setup.chromeMcpErrorMessage,
|
|
321
|
+
onRetry: $setup.retryWarmup
|
|
322
|
+
}, null, 8, ["retrying", "error-type", "error-message"])) : (0, import_vue3.createCommentVNode)("v-if", true)
|
|
323
|
+
]),
|
|
324
|
+
_: 1
|
|
325
|
+
/* STABLE */
|
|
326
|
+
}, 8, ["position", "theme", "open", "select-mode", "session-list-collapsed", "frame-loading", "loading-session-list", "show-session-list-skeleton", "show-error", "iframe-src", "current-session-id", "sessions", "selected-elements", "hotkey-label", "thinking", "onCreateSession", "onDeleteSession", "onSelectSession", "onEmptyAction"]);
|
|
327
|
+
}
|
|
328
|
+
__vue_sfc__.render = __vue_render__;
|
|
329
|
+
var App_vue_default = __vue_sfc__;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.opencode-chrome-warmup-error-details[data-v-798041da]{margin-top:8px;padding:12px;background:var(--oc-bg-tertiary);border-radius:6px;font-family:Monaco,Menlo,Ubuntu Mono,monospace;font-size:12px;color:var(--oc-text-secondary);max-height:120px;overflow-y:auto;word-break:break-word}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
retrying: boolean;
|
|
3
|
+
errorType?: string;
|
|
4
|
+
errorMessage?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
retry: () => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
onRetry?: (() => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,215 @@
|
|
|
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 ChromeWarmupError_vue_exports = {};
|
|
19
|
+
__export(ChromeWarmupError_vue_exports, {
|
|
20
|
+
default: () => ChromeWarmupError_vue_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(ChromeWarmupError_vue_exports);
|
|
23
|
+
var import_ChromeWarmupError_sfc = require("./ChromeWarmupError-sfc.css");
|
|
24
|
+
var import_vue = require("vue");
|
|
25
|
+
var import_shared = require("@vite-plugin-opencode-assistant/shared");
|
|
26
|
+
var import_vue2 = require("vue");
|
|
27
|
+
const __vue_sfc__ = /* @__PURE__ */ (0, import_vue.defineComponent)({
|
|
28
|
+
__name: "ChromeWarmupError",
|
|
29
|
+
props: {
|
|
30
|
+
retrying: { type: Boolean, required: true },
|
|
31
|
+
errorType: { type: String, required: false },
|
|
32
|
+
errorMessage: { type: String, required: false }
|
|
33
|
+
},
|
|
34
|
+
emits: ["retry"],
|
|
35
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
36
|
+
__expose();
|
|
37
|
+
const emit = __emit;
|
|
38
|
+
const __returned__ = { emit, get ChromeMcpWarmupErrorType() {
|
|
39
|
+
return import_shared.ChromeMcpWarmupErrorType;
|
|
40
|
+
} };
|
|
41
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
42
|
+
return __returned__;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const _hoisted_1 = { class: "opencode-chrome-warmup-failed" };
|
|
46
|
+
const _hoisted_2 = { class: "opencode-chrome-warmup-failed-text" };
|
|
47
|
+
const _hoisted_3 = { class: "opencode-chrome-warmup-error-details" };
|
|
48
|
+
const _hoisted_4 = { class: "opencode-chrome-warmup-failed-text" };
|
|
49
|
+
const _hoisted_5 = { key: 0 };
|
|
50
|
+
const _hoisted_6 = { key: 1 };
|
|
51
|
+
const _hoisted_7 = { class: "opencode-chrome-warmup-failed-actions" };
|
|
52
|
+
const _hoisted_8 = ["disabled"];
|
|
53
|
+
function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
54
|
+
return (0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)("div", _hoisted_1, [
|
|
55
|
+
_cache[9] || (_cache[9] = (0, import_vue2.createElementVNode)(
|
|
56
|
+
"div",
|
|
57
|
+
{ class: "opencode-chrome-warmup-failed-icon" },
|
|
58
|
+
[
|
|
59
|
+
(0, import_vue2.createElementVNode)("svg", {
|
|
60
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
61
|
+
fill: "none",
|
|
62
|
+
viewBox: "0 0 24 24",
|
|
63
|
+
width: "48",
|
|
64
|
+
height: "48",
|
|
65
|
+
stroke: "currentColor",
|
|
66
|
+
"stroke-width": "1.5"
|
|
67
|
+
}, [
|
|
68
|
+
(0, import_vue2.createElementVNode)("path", {
|
|
69
|
+
"stroke-linecap": "round",
|
|
70
|
+
"stroke-linejoin": "round",
|
|
71
|
+
d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"
|
|
72
|
+
})
|
|
73
|
+
])
|
|
74
|
+
],
|
|
75
|
+
-1
|
|
76
|
+
/* CACHED */
|
|
77
|
+
)),
|
|
78
|
+
(0, import_vue2.createCommentVNode)(" Chrome \u8FDC\u7A0B\u8C03\u8BD5\u672A\u5F00\u542F "),
|
|
79
|
+
$props.errorType === $setup.ChromeMcpWarmupErrorType.CHROME_NOT_CONNECTED ? ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)(
|
|
80
|
+
import_vue2.Fragment,
|
|
81
|
+
{ key: 0 },
|
|
82
|
+
[
|
|
83
|
+
_cache[1] || (_cache[1] = (0, import_vue2.createElementVNode)(
|
|
84
|
+
"div",
|
|
85
|
+
{ class: "opencode-chrome-warmup-failed-title" },
|
|
86
|
+
"Chrome DevTools MCP \u8FDE\u63A5\u5931\u8D25",
|
|
87
|
+
-1
|
|
88
|
+
/* CACHED */
|
|
89
|
+
)),
|
|
90
|
+
_cache[2] || (_cache[2] = (0, import_vue2.createElementVNode)(
|
|
91
|
+
"div",
|
|
92
|
+
{ class: "opencode-chrome-warmup-failed-text" },
|
|
93
|
+
[
|
|
94
|
+
(0, import_vue2.createElementVNode)("p", null, "\u8BF7\u6309\u4EE5\u4E0B\u6B65\u9AA4\u5F00\u542F Chrome \u8FDC\u7A0B\u8C03\u8BD5\uFF1A"),
|
|
95
|
+
(0, import_vue2.createElementVNode)("ol", { class: "opencode-chrome-warmup-steps" }, [
|
|
96
|
+
(0, import_vue2.createElementVNode)("li", null, [
|
|
97
|
+
(0, import_vue2.createTextVNode)(" \u5728 Chrome \u5730\u5740\u680F\u8F93\u5165 "),
|
|
98
|
+
(0, import_vue2.createElementVNode)("code", { class: "opencode-chrome-warmup-code" }, "chrome://inspect/#remote-debugging")
|
|
99
|
+
]),
|
|
100
|
+
(0, import_vue2.createElementVNode)("li", null, "\u52FE\u9009 'Allow remote debugging for this browser instance' \u9009\u9879"),
|
|
101
|
+
(0, import_vue2.createElementVNode)("li", null, "\u91CD\u65B0\u542F\u52A8\u6D4F\u89C8\u5668"),
|
|
102
|
+
(0, import_vue2.createElementVNode)("li", null, "\u5B8C\u6210\u540E\u70B9\u51FB\u4E0B\u65B9\u6309\u94AE\u91CD\u8BD5")
|
|
103
|
+
])
|
|
104
|
+
],
|
|
105
|
+
-1
|
|
106
|
+
/* CACHED */
|
|
107
|
+
))
|
|
108
|
+
],
|
|
109
|
+
64
|
|
110
|
+
/* STABLE_FRAGMENT */
|
|
111
|
+
)) : $props.errorType === $setup.ChromeMcpWarmupErrorType.AI_TIMEOUT ? ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)(
|
|
112
|
+
import_vue2.Fragment,
|
|
113
|
+
{ key: 1 },
|
|
114
|
+
[
|
|
115
|
+
(0, import_vue2.createCommentVNode)(" AI \u54CD\u5E94\u8D85\u65F6 "),
|
|
116
|
+
_cache[3] || (_cache[3] = (0, import_vue2.createElementVNode)(
|
|
117
|
+
"div",
|
|
118
|
+
{ class: "opencode-chrome-warmup-failed-title" },
|
|
119
|
+
"AI \u54CD\u5E94\u8D85\u65F6",
|
|
120
|
+
-1
|
|
121
|
+
/* CACHED */
|
|
122
|
+
)),
|
|
123
|
+
_cache[4] || (_cache[4] = (0, import_vue2.createElementVNode)(
|
|
124
|
+
"div",
|
|
125
|
+
{ class: "opencode-chrome-warmup-failed-text" },
|
|
126
|
+
[
|
|
127
|
+
(0, import_vue2.createElementVNode)("p", null, "AI \u6A21\u578B\u54CD\u5E94\u8D85\u65F6\uFF0C\u53EF\u80FD\u7684\u539F\u56E0\uFF1A"),
|
|
128
|
+
(0, import_vue2.createElementVNode)("ol", { class: "opencode-chrome-warmup-steps" }, [
|
|
129
|
+
(0, import_vue2.createElementVNode)("li", null, "OpenCode AI \u6A21\u578B\u672A\u6B63\u786E\u914D\u7F6E"),
|
|
130
|
+
(0, import_vue2.createElementVNode)("li", null, "AI \u6A21\u578B\u670D\u52A1\u4E0D\u53EF\u7528\u6216\u54CD\u5E94\u7F13\u6162"),
|
|
131
|
+
(0, import_vue2.createElementVNode)("li", null, "\u7F51\u7EDC\u8FDE\u63A5\u95EE\u9898")
|
|
132
|
+
]),
|
|
133
|
+
(0, import_vue2.createElementVNode)("p", { style: { "margin-top": "12px", "font-weight": "500" } }, "\u8BF7\u68C0\u67E5 OpenCode \u914D\u7F6E\u6587\u4EF6\u4E2D\u7684 AI \u6A21\u578B\u8BBE\u7F6E")
|
|
134
|
+
],
|
|
135
|
+
-1
|
|
136
|
+
/* CACHED */
|
|
137
|
+
))
|
|
138
|
+
],
|
|
139
|
+
64
|
|
140
|
+
/* STABLE_FRAGMENT */
|
|
141
|
+
)) : $props.errorType === $setup.ChromeMcpWarmupErrorType.AI_RESPONSE_ERROR ? ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)(
|
|
142
|
+
import_vue2.Fragment,
|
|
143
|
+
{ key: 2 },
|
|
144
|
+
[
|
|
145
|
+
(0, import_vue2.createCommentVNode)(" AI \u54CD\u5E94\u9519\u8BEF "),
|
|
146
|
+
_cache[7] || (_cache[7] = (0, import_vue2.createElementVNode)(
|
|
147
|
+
"div",
|
|
148
|
+
{ class: "opencode-chrome-warmup-failed-title" },
|
|
149
|
+
"AI \u54CD\u5E94\u9519\u8BEF",
|
|
150
|
+
-1
|
|
151
|
+
/* CACHED */
|
|
152
|
+
)),
|
|
153
|
+
(0, import_vue2.createElementVNode)("div", _hoisted_2, [
|
|
154
|
+
_cache[5] || (_cache[5] = (0, import_vue2.createElementVNode)(
|
|
155
|
+
"p",
|
|
156
|
+
null,
|
|
157
|
+
"AI \u6A21\u578B\u8FD4\u56DE\u4E86\u610F\u5916\u7684\u54CD\u5E94\uFF1A",
|
|
158
|
+
-1
|
|
159
|
+
/* CACHED */
|
|
160
|
+
)),
|
|
161
|
+
(0, import_vue2.createElementVNode)(
|
|
162
|
+
"div",
|
|
163
|
+
_hoisted_3,
|
|
164
|
+
(0, import_vue2.toDisplayString)($props.errorMessage || "\u672A\u77E5\u9519\u8BEF"),
|
|
165
|
+
1
|
|
166
|
+
/* TEXT */
|
|
167
|
+
),
|
|
168
|
+
_cache[6] || (_cache[6] = (0, import_vue2.createElementVNode)(
|
|
169
|
+
"p",
|
|
170
|
+
{ style: { "margin-top": "12px" } },
|
|
171
|
+
"\u8BF7\u68C0\u67E5 OpenCode AI \u6A21\u578B\u914D\u7F6E\u662F\u5426\u6B63\u786E",
|
|
172
|
+
-1
|
|
173
|
+
/* CACHED */
|
|
174
|
+
))
|
|
175
|
+
])
|
|
176
|
+
],
|
|
177
|
+
64
|
|
178
|
+
/* STABLE_FRAGMENT */
|
|
179
|
+
)) : ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)(
|
|
180
|
+
import_vue2.Fragment,
|
|
181
|
+
{ key: 3 },
|
|
182
|
+
[
|
|
183
|
+
(0, import_vue2.createCommentVNode)(" \u5176\u4ED6\u9519\u8BEF "),
|
|
184
|
+
_cache[8] || (_cache[8] = (0, import_vue2.createElementVNode)(
|
|
185
|
+
"div",
|
|
186
|
+
{ class: "opencode-chrome-warmup-failed-title" },
|
|
187
|
+
"Chrome DevTools MCP \u8FDE\u63A5\u5931\u8D25",
|
|
188
|
+
-1
|
|
189
|
+
/* CACHED */
|
|
190
|
+
)),
|
|
191
|
+
(0, import_vue2.createElementVNode)("div", _hoisted_4, [
|
|
192
|
+
$props.errorMessage ? ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)(
|
|
193
|
+
"p",
|
|
194
|
+
_hoisted_5,
|
|
195
|
+
(0, import_vue2.toDisplayString)($props.errorMessage),
|
|
196
|
+
1
|
|
197
|
+
/* TEXT */
|
|
198
|
+
)) : ((0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)("p", _hoisted_6, "\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"))
|
|
199
|
+
])
|
|
200
|
+
],
|
|
201
|
+
64
|
|
202
|
+
/* STABLE_FRAGMENT */
|
|
203
|
+
)),
|
|
204
|
+
(0, import_vue2.createElementVNode)("div", _hoisted_7, [
|
|
205
|
+
(0, import_vue2.createElementVNode)("button", {
|
|
206
|
+
class: "opencode-chrome-warmup-failed-btn primary",
|
|
207
|
+
disabled: $props.retrying,
|
|
208
|
+
onClick: _cache[0] || (_cache[0] = ($event) => $setup.emit("retry"))
|
|
209
|
+
}, (0, import_vue2.toDisplayString)($props.retrying ? "\u8FDE\u63A5\u4E2D..." : "\u91CD\u8BD5\u8FDE\u63A5"), 9, _hoisted_8)
|
|
210
|
+
])
|
|
211
|
+
]);
|
|
212
|
+
}
|
|
213
|
+
__vue_sfc__.render = __vue_render__;
|
|
214
|
+
__vue_sfc__.__scopeId = "data-v-798041da";
|
|
215
|
+
var ChromeWarmupError_vue_default = __vue_sfc__;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
loadingText: string;
|
|
3
|
+
};
|
|
4
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,58 @@
|
|
|
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 LoadingContent_vue_exports = {};
|
|
19
|
+
__export(LoadingContent_vue_exports, {
|
|
20
|
+
default: () => LoadingContent_vue_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(LoadingContent_vue_exports);
|
|
23
|
+
var import_vue = require("vue");
|
|
24
|
+
var import_vue2 = require("vue");
|
|
25
|
+
const __vue_sfc__ = /* @__PURE__ */ (0, import_vue.defineComponent)({
|
|
26
|
+
__name: "LoadingContent",
|
|
27
|
+
props: {
|
|
28
|
+
loadingText: { type: String, required: true }
|
|
29
|
+
},
|
|
30
|
+
setup(__props, { expose: __expose }) {
|
|
31
|
+
__expose();
|
|
32
|
+
const __returned__ = {};
|
|
33
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
34
|
+
return __returned__;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const _hoisted_1 = { class: "opencode-custom-loading" };
|
|
38
|
+
const _hoisted_2 = { class: "opencode-loading-text" };
|
|
39
|
+
function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
40
|
+
return (0, import_vue2.openBlock)(), (0, import_vue2.createElementBlock)("div", _hoisted_1, [
|
|
41
|
+
_cache[0] || (_cache[0] = (0, import_vue2.createElementVNode)(
|
|
42
|
+
"div",
|
|
43
|
+
{ class: "opencode-loading-spinner" },
|
|
44
|
+
null,
|
|
45
|
+
-1
|
|
46
|
+
/* CACHED */
|
|
47
|
+
)),
|
|
48
|
+
(0, import_vue2.createElementVNode)(
|
|
49
|
+
"div",
|
|
50
|
+
_hoisted_2,
|
|
51
|
+
(0, import_vue2.toDisplayString)($props.loadingText),
|
|
52
|
+
1
|
|
53
|
+
/* TEXT */
|
|
54
|
+
)
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
__vue_sfc__.render = __vue_render__;
|
|
58
|
+
var LoadingContent_vue_default = __vue_sfc__;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OpenCodeSelectedElement, ServiceStatus } from "@vite-plugin-opencode-assistant/shared";
|
|
2
|
+
export declare function useContext(serviceStatus: {
|
|
3
|
+
value: ServiceStatus;
|
|
4
|
+
}, selectedElements: {
|
|
5
|
+
value: OpenCodeSelectedElement[];
|
|
6
|
+
}): {
|
|
7
|
+
updateContext: (force?: boolean) => void;
|
|
8
|
+
};
|