vite-plugin-opencode-assistant 1.0.74 → 1.0.76
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/injector.mjs +6 -2
- package/es/core/proxy-server.mjs +19 -13
- package/es/endpoints/index.d.ts +1 -1
- package/es/endpoints/index.mjs +3 -2
- package/es/endpoints/logs.d.ts +0 -2
- package/es/endpoints/logs.mjs +4 -4
- package/es/endpoints/start.d.ts +2 -1
- package/es/endpoints/start.mjs +6 -2
- package/es/endpoints/types.d.ts +2 -0
- package/es/endpoints/warmup.mjs +2 -2
- package/es/endpoints/widget.mjs +1 -2
- package/es/env.d.ts +1 -0
- package/es/index.mjs +7 -1
- package/lib/client.js +3481 -3287
- package/lib/core/injector.cjs +1 -1
- package/lib/core/proxy-server.cjs +16 -12
- package/lib/endpoints/index.cjs +3 -2
- package/lib/endpoints/index.d.ts +1 -1
- package/lib/endpoints/logs.cjs +2 -5
- package/lib/endpoints/logs.d.ts +0 -2
- package/lib/endpoints/start.cjs +6 -2
- package/lib/endpoints/start.d.ts +2 -1
- package/lib/endpoints/types.d.ts +2 -0
- package/lib/endpoints/warmup.cjs +1 -1
- package/lib/endpoints/widget.cjs +2 -3
- package/lib/env.d.ts +1 -0
- package/lib/index.cjs +7 -1
- package/lib/style.css +1 -1
- package/package.json +8 -4
- package/es/client/App.vue.d.ts +0 -6
- package/es/client/App.vue.mjs +0 -394
- package/es/client/components/ChromeWarmupError-sfc.css +0 -1
- package/es/client/components/ChromeWarmupError.vue.d.ts +0 -19
- package/es/client/components/ChromeWarmupError.vue.mjs +0 -337
- package/es/client/components/LoadingContent.vue.d.ts +0 -5
- package/es/client/components/LoadingContent.vue.mjs +0 -39
- package/es/client/composables/index.d.ts +0 -10
- package/es/client/composables/index.mjs +0 -22
- package/es/client/composables/useContext.d.ts +0 -8
- package/es/client/composables/useContext.mjs +0 -63
- package/es/client/composables/useHotkey.d.ts +0 -12
- package/es/client/composables/useHotkey.mjs +0 -41
- package/es/client/composables/useOpencodeSSE.d.ts +0 -64
- package/es/client/composables/useOpencodeSSE.mjs +0 -29
- package/es/client/composables/useOpencodeSessionSSE.d.ts +0 -66
- package/es/client/composables/useOpencodeSessionSSE.mjs +0 -168
- package/es/client/composables/useSSE.d.ts +0 -87
- package/es/client/composables/useSSE.mjs +0 -118
- package/es/client/composables/useSelectedElements.d.ts +0 -19
- package/es/client/composables/useSelectedElements.mjs +0 -43
- package/es/client/composables/useServerSSE.d.ts +0 -53
- package/es/client/composables/useServerSSE.mjs +0 -36
- package/es/client/composables/useServiceStatus.d.ts +0 -11
- package/es/client/composables/useServiceStatus.mjs +0 -47
- package/es/client/composables/useSessions.d.ts +0 -45
- package/es/client/composables/useSessions.mjs +0 -147
- package/es/client/composables/useTheme.d.ts +0 -12
- package/es/client/composables/useTheme.mjs +0 -42
- package/es/client/index.d.ts +0 -1
- package/es/client/index.mjs +0 -32
- package/es/client/styles.css +0 -1
- package/lib/client/App.vue.cjs +0 -421
- package/lib/client/App.vue.d.ts +0 -6
- package/lib/client/components/ChromeWarmupError-sfc.css +0 -1
- package/lib/client/components/ChromeWarmupError.vue.cjs +0 -356
- package/lib/client/components/ChromeWarmupError.vue.d.ts +0 -19
- package/lib/client/components/LoadingContent.vue.cjs +0 -58
- package/lib/client/components/LoadingContent.vue.d.ts +0 -5
- package/lib/client/composables/index.cjs +0 -54
- package/lib/client/composables/index.d.ts +0 -10
- package/lib/client/composables/useContext.cjs +0 -86
- package/lib/client/composables/useContext.d.ts +0 -8
- package/lib/client/composables/useHotkey.cjs +0 -66
- package/lib/client/composables/useHotkey.d.ts +0 -12
- package/lib/client/composables/useOpencodeSSE.cjs +0 -52
- package/lib/client/composables/useOpencodeSSE.d.ts +0 -64
- package/lib/client/composables/useOpencodeSessionSSE.cjs +0 -187
- package/lib/client/composables/useOpencodeSessionSSE.d.ts +0 -66
- package/lib/client/composables/useSSE.cjs +0 -141
- package/lib/client/composables/useSSE.d.ts +0 -87
- package/lib/client/composables/useSelectedElements.cjs +0 -66
- package/lib/client/composables/useSelectedElements.d.ts +0 -19
- package/lib/client/composables/useServerSSE.cjs +0 -59
- package/lib/client/composables/useServerSSE.d.ts +0 -53
- package/lib/client/composables/useServiceStatus.cjs +0 -70
- package/lib/client/composables/useServiceStatus.d.ts +0 -11
- package/lib/client/composables/useSessions.cjs +0 -168
- package/lib/client/composables/useSessions.d.ts +0 -45
- package/lib/client/composables/useTheme.cjs +0 -65
- package/lib/client/composables/useTheme.d.ts +0 -12
- package/lib/client/index.cjs +0 -54
- package/lib/client/index.d.ts +0 -1
- package/lib/client/styles.css +0 -1
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import "./ChromeWarmupError-sfc.css";
|
|
2
|
-
import { defineComponent as _defineComponent } from "vue";
|
|
3
|
-
import { ref, computed, watch } from "vue";
|
|
4
|
-
import { ChromeMcpWarmupErrorType } from "@vite-plugin-opencode-assistant/shared";
|
|
5
|
-
const __vue_sfc__ = /* @__PURE__ */ _defineComponent({
|
|
6
|
-
__name: "ChromeWarmupError",
|
|
7
|
-
props: {
|
|
8
|
-
retrying: { type: Boolean, required: true },
|
|
9
|
-
errorType: { type: String, required: false },
|
|
10
|
-
errorMessage: { type: String, required: false },
|
|
11
|
-
models: { type: Array, required: false }
|
|
12
|
-
},
|
|
13
|
-
emits: ["retry"],
|
|
14
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
15
|
-
__expose();
|
|
16
|
-
const props = __props;
|
|
17
|
-
const emit = __emit;
|
|
18
|
-
const selectedModelValue = ref("");
|
|
19
|
-
watch(
|
|
20
|
-
() => props.models,
|
|
21
|
-
(models) => {
|
|
22
|
-
if (models && models.length > 0 && !selectedModelValue.value) {
|
|
23
|
-
selectedModelValue.value = `${models[0].providerID}:${models[0].modelID}`;
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
{ immediate: true }
|
|
27
|
-
);
|
|
28
|
-
const shouldShowModelSelector = computed(() => {
|
|
29
|
-
return props.errorType === ChromeMcpWarmupErrorType.AI_TIMEOUT || props.errorType === ChromeMcpWarmupErrorType.AI_RESPONSE_ERROR || props.errorType === ChromeMcpWarmupErrorType.UNKNOWN;
|
|
30
|
-
});
|
|
31
|
-
const hasModels = computed(() => props.models && props.models.length > 0);
|
|
32
|
-
const groupedModels = computed(() => {
|
|
33
|
-
if (!props.models) return {};
|
|
34
|
-
const groups = {};
|
|
35
|
-
for (const model of props.models) {
|
|
36
|
-
if (!groups[model.providerID]) {
|
|
37
|
-
groups[model.providerID] = [];
|
|
38
|
-
}
|
|
39
|
-
groups[model.providerID].push(model);
|
|
40
|
-
}
|
|
41
|
-
return groups;
|
|
42
|
-
});
|
|
43
|
-
const selectedModel = computed(() => {
|
|
44
|
-
var _a;
|
|
45
|
-
if (!selectedModelValue.value || !props.models) return ((_a = props.models) == null ? void 0 : _a[0]) || null;
|
|
46
|
-
const [providerID, modelID] = selectedModelValue.value.split(":");
|
|
47
|
-
return props.models.find((m) => m.providerID === providerID && m.modelID === modelID) || null;
|
|
48
|
-
});
|
|
49
|
-
const getProviderDisplayName = (providerID) => {
|
|
50
|
-
const knownProviders = {
|
|
51
|
-
anthropic: "Anthropic",
|
|
52
|
-
openai: "OpenAI",
|
|
53
|
-
google: "Google",
|
|
54
|
-
xai: "xAI",
|
|
55
|
-
opencode: "OpenCode",
|
|
56
|
-
opencode_go: "OpenCode Go"
|
|
57
|
-
};
|
|
58
|
-
return knownProviders[providerID] || providerID;
|
|
59
|
-
};
|
|
60
|
-
const getModelKey = (model) => `${model.providerID}:${model.modelID}`;
|
|
61
|
-
const handleRetry = () => {
|
|
62
|
-
if (shouldShowModelSelector.value && hasModels.value && selectedModel.value) {
|
|
63
|
-
emit("retry", {
|
|
64
|
-
providerID: selectedModel.value.providerID,
|
|
65
|
-
modelID: selectedModel.value.modelID
|
|
66
|
-
});
|
|
67
|
-
} else {
|
|
68
|
-
emit("retry");
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const __returned__ = { props, emit, selectedModelValue, shouldShowModelSelector, hasModels, groupedModels, selectedModel, getProviderDisplayName, getModelKey, handleRetry, get ChromeMcpWarmupErrorType() {
|
|
72
|
-
return ChromeMcpWarmupErrorType;
|
|
73
|
-
} };
|
|
74
|
-
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
75
|
-
return __returned__;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createTextVNode as _createTextVNode, Fragment as _Fragment, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, renderList as _renderList, vModelSelect as _vModelSelect, withDirectives as _withDirectives } from "vue";
|
|
79
|
-
const _hoisted_1 = { class: "opencode-chrome-warmup-failed" };
|
|
80
|
-
const _hoisted_2 = { class: "opencode-chrome-warmup-failed-text" };
|
|
81
|
-
const _hoisted_3 = {
|
|
82
|
-
key: 0,
|
|
83
|
-
style: { "margin-top": "12px", "font-weight": "500" }
|
|
84
|
-
};
|
|
85
|
-
const _hoisted_4 = { class: "opencode-chrome-warmup-failed-text" };
|
|
86
|
-
const _hoisted_5 = { class: "opencode-chrome-warmup-error-details" };
|
|
87
|
-
const _hoisted_6 = {
|
|
88
|
-
key: 0,
|
|
89
|
-
style: { "margin-top": "12px" }
|
|
90
|
-
};
|
|
91
|
-
const _hoisted_7 = { class: "opencode-chrome-warmup-failed-text" };
|
|
92
|
-
const _hoisted_8 = { key: 0 };
|
|
93
|
-
const _hoisted_9 = { key: 1 };
|
|
94
|
-
const _hoisted_10 = {
|
|
95
|
-
key: 2,
|
|
96
|
-
style: { "margin-top": "12px" }
|
|
97
|
-
};
|
|
98
|
-
const _hoisted_11 = {
|
|
99
|
-
key: 4,
|
|
100
|
-
class: "opencode-model-selector"
|
|
101
|
-
};
|
|
102
|
-
const _hoisted_12 = { class: "select-wrapper" };
|
|
103
|
-
const _hoisted_13 = ["disabled"];
|
|
104
|
-
const _hoisted_14 = ["label"];
|
|
105
|
-
const _hoisted_15 = ["value"];
|
|
106
|
-
const _hoisted_16 = ["disabled"];
|
|
107
|
-
const _hoisted_17 = {
|
|
108
|
-
key: 5,
|
|
109
|
-
class: "opencode-chrome-warmup-failed-actions"
|
|
110
|
-
};
|
|
111
|
-
const _hoisted_18 = ["disabled"];
|
|
112
|
-
function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
113
|
-
return _openBlock(), _createElementBlock("div", _hoisted_1, [
|
|
114
|
-
_cache[11] || (_cache[11] = _createElementVNode(
|
|
115
|
-
"div",
|
|
116
|
-
{ class: "opencode-chrome-warmup-failed-icon" },
|
|
117
|
-
[
|
|
118
|
-
_createElementVNode("svg", {
|
|
119
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
120
|
-
fill: "none",
|
|
121
|
-
viewBox: "0 0 24 24",
|
|
122
|
-
width: "48",
|
|
123
|
-
height: "48",
|
|
124
|
-
stroke: "currentColor",
|
|
125
|
-
"stroke-width": "1.5"
|
|
126
|
-
}, [
|
|
127
|
-
_createElementVNode("path", {
|
|
128
|
-
"stroke-linecap": "round",
|
|
129
|
-
"stroke-linejoin": "round",
|
|
130
|
-
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"
|
|
131
|
-
})
|
|
132
|
-
])
|
|
133
|
-
],
|
|
134
|
-
-1
|
|
135
|
-
/* CACHED */
|
|
136
|
-
)),
|
|
137
|
-
$props.errorType === $setup.ChromeMcpWarmupErrorType.CHROME_NOT_CONNECTED ? (_openBlock(), _createElementBlock(
|
|
138
|
-
_Fragment,
|
|
139
|
-
{ key: 0 },
|
|
140
|
-
[
|
|
141
|
-
_cache[2] || (_cache[2] = _createElementVNode(
|
|
142
|
-
"div",
|
|
143
|
-
{ class: "opencode-chrome-warmup-failed-title" },
|
|
144
|
-
"Chrome DevTools MCP \u8FDE\u63A5\u5931\u8D25",
|
|
145
|
-
-1
|
|
146
|
-
/* CACHED */
|
|
147
|
-
)),
|
|
148
|
-
_cache[3] || (_cache[3] = _createElementVNode(
|
|
149
|
-
"div",
|
|
150
|
-
{ class: "opencode-chrome-warmup-failed-text" },
|
|
151
|
-
[
|
|
152
|
-
_createElementVNode("p", null, "\u8BF7\u6309\u4EE5\u4E0B\u6B65\u9AA4\u5F00\u542F Chrome \u8FDC\u7A0B\u8C03\u8BD5\uFF1A"),
|
|
153
|
-
_createElementVNode("div", { class: "opencode-chrome-warmup-steps" }, [
|
|
154
|
-
_createElementVNode("div", null, [
|
|
155
|
-
_createTextVNode(" \u5728 Chrome \u5730\u5740\u680F\u8F93\u5165 "),
|
|
156
|
-
_createElementVNode("code", { class: "opencode-chrome-warmup-code" }, "chrome://inspect/#remote-debugging")
|
|
157
|
-
]),
|
|
158
|
-
_createElementVNode("div", null, "\u52FE\u9009 'Allow remote debugging for this browser instance' \u9009\u9879"),
|
|
159
|
-
_createElementVNode("div", null, "\u91CD\u65B0\u542F\u52A8\u6D4F\u89C8\u5668"),
|
|
160
|
-
_createElementVNode("div", null, "\u5B8C\u6210\u540E\u70B9\u51FB\u4E0B\u65B9\u6309\u94AE\u91CD\u8BD5")
|
|
161
|
-
])
|
|
162
|
-
],
|
|
163
|
-
-1
|
|
164
|
-
/* CACHED */
|
|
165
|
-
))
|
|
166
|
-
],
|
|
167
|
-
64
|
|
168
|
-
/* STABLE_FRAGMENT */
|
|
169
|
-
)) : $props.errorType === $setup.ChromeMcpWarmupErrorType.AI_TIMEOUT ? (_openBlock(), _createElementBlock(
|
|
170
|
-
_Fragment,
|
|
171
|
-
{ key: 1 },
|
|
172
|
-
[
|
|
173
|
-
_cache[6] || (_cache[6] = _createElementVNode(
|
|
174
|
-
"div",
|
|
175
|
-
{ class: "opencode-chrome-warmup-failed-title" },
|
|
176
|
-
"AI \u54CD\u5E94\u8D85\u65F6",
|
|
177
|
-
-1
|
|
178
|
-
/* CACHED */
|
|
179
|
-
)),
|
|
180
|
-
_createElementVNode("div", _hoisted_2, [
|
|
181
|
-
_cache[4] || (_cache[4] = _createElementVNode(
|
|
182
|
-
"p",
|
|
183
|
-
null,
|
|
184
|
-
"AI \u6A21\u578B\u54CD\u5E94\u8D85\u65F6\uFF0C\u53EF\u80FD\u7684\u539F\u56E0\uFF1A",
|
|
185
|
-
-1
|
|
186
|
-
/* CACHED */
|
|
187
|
-
)),
|
|
188
|
-
_cache[5] || (_cache[5] = _createElementVNode(
|
|
189
|
-
"div",
|
|
190
|
-
{ class: "opencode-chrome-warmup-steps" },
|
|
191
|
-
[
|
|
192
|
-
_createElementVNode("div", null, "\u5F53\u524D\u9009\u62E9\u7684 AI \u6A21\u578B\u670D\u52A1\u4E0D\u53EF\u7528\u6216\u54CD\u5E94\u7F13\u6162"),
|
|
193
|
-
_createElementVNode("div", null, "\u7F51\u7EDC\u8FDE\u63A5\u95EE\u9898"),
|
|
194
|
-
_createElementVNode("div", null, "\u6A21\u578B\u914D\u7F6E\u4E0D\u6B63\u786E")
|
|
195
|
-
],
|
|
196
|
-
-1
|
|
197
|
-
/* CACHED */
|
|
198
|
-
)),
|
|
199
|
-
$setup.hasModels ? (_openBlock(), _createElementBlock("p", _hoisted_3, "\u53EF\u9009\u62E9\u5176\u4ED6\u6A21\u578B\u91CD\u8BD5\uFF1A")) : _createCommentVNode("v-if", true)
|
|
200
|
-
])
|
|
201
|
-
],
|
|
202
|
-
64
|
|
203
|
-
/* STABLE_FRAGMENT */
|
|
204
|
-
)) : $props.errorType === $setup.ChromeMcpWarmupErrorType.AI_RESPONSE_ERROR ? (_openBlock(), _createElementBlock(
|
|
205
|
-
_Fragment,
|
|
206
|
-
{ key: 2 },
|
|
207
|
-
[
|
|
208
|
-
_cache[8] || (_cache[8] = _createElementVNode(
|
|
209
|
-
"div",
|
|
210
|
-
{ class: "opencode-chrome-warmup-failed-title" },
|
|
211
|
-
"AI \u54CD\u5E94\u9519\u8BEF",
|
|
212
|
-
-1
|
|
213
|
-
/* CACHED */
|
|
214
|
-
)),
|
|
215
|
-
_createElementVNode("div", _hoisted_4, [
|
|
216
|
-
_cache[7] || (_cache[7] = _createElementVNode(
|
|
217
|
-
"p",
|
|
218
|
-
null,
|
|
219
|
-
"AI \u6A21\u578B\u8FD4\u56DE\u4E86\u610F\u5916\u7684\u54CD\u5E94\uFF1A",
|
|
220
|
-
-1
|
|
221
|
-
/* CACHED */
|
|
222
|
-
)),
|
|
223
|
-
_createElementVNode(
|
|
224
|
-
"div",
|
|
225
|
-
_hoisted_5,
|
|
226
|
-
_toDisplayString($props.errorMessage || "\u672A\u77E5\u9519\u8BEF"),
|
|
227
|
-
1
|
|
228
|
-
/* TEXT */
|
|
229
|
-
),
|
|
230
|
-
$setup.hasModels ? (_openBlock(), _createElementBlock("p", _hoisted_6, "\u53EF\u9009\u62E9\u5176\u4ED6\u6A21\u578B\u91CD\u8BD5\uFF1A")) : _createCommentVNode("v-if", true)
|
|
231
|
-
])
|
|
232
|
-
],
|
|
233
|
-
64
|
|
234
|
-
/* STABLE_FRAGMENT */
|
|
235
|
-
)) : (_openBlock(), _createElementBlock(
|
|
236
|
-
_Fragment,
|
|
237
|
-
{ key: 3 },
|
|
238
|
-
[
|
|
239
|
-
_cache[9] || (_cache[9] = _createElementVNode(
|
|
240
|
-
"div",
|
|
241
|
-
{ class: "opencode-chrome-warmup-failed-title" },
|
|
242
|
-
"Chrome DevTools MCP \u8FDE\u63A5\u5931\u8D25",
|
|
243
|
-
-1
|
|
244
|
-
/* CACHED */
|
|
245
|
-
)),
|
|
246
|
-
_createElementVNode("div", _hoisted_7, [
|
|
247
|
-
$props.errorMessage ? (_openBlock(), _createElementBlock(
|
|
248
|
-
"p",
|
|
249
|
-
_hoisted_8,
|
|
250
|
-
_toDisplayString($props.errorMessage),
|
|
251
|
-
1
|
|
252
|
-
/* TEXT */
|
|
253
|
-
)) : (_openBlock(), _createElementBlock("p", _hoisted_9, "\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")),
|
|
254
|
-
$setup.hasModels ? (_openBlock(), _createElementBlock("p", _hoisted_10, "\u53EF\u9009\u62E9\u6A21\u578B\u91CD\u8BD5\uFF1A")) : _createCommentVNode("v-if", true)
|
|
255
|
-
])
|
|
256
|
-
],
|
|
257
|
-
64
|
|
258
|
-
/* STABLE_FRAGMENT */
|
|
259
|
-
)),
|
|
260
|
-
$setup.shouldShowModelSelector && $setup.hasModels ? (_openBlock(), _createElementBlock("div", _hoisted_11, [
|
|
261
|
-
_createElementVNode("div", _hoisted_12, [
|
|
262
|
-
_withDirectives(_createElementVNode("select", {
|
|
263
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.selectedModelValue = $event),
|
|
264
|
-
class: "native-select",
|
|
265
|
-
disabled: $props.retrying
|
|
266
|
-
}, [
|
|
267
|
-
(_openBlock(true), _createElementBlock(
|
|
268
|
-
_Fragment,
|
|
269
|
-
null,
|
|
270
|
-
_renderList($setup.groupedModels, (providerModels, provider) => {
|
|
271
|
-
return _openBlock(), _createElementBlock("optgroup", {
|
|
272
|
-
key: provider,
|
|
273
|
-
label: $setup.getProviderDisplayName(provider)
|
|
274
|
-
}, [
|
|
275
|
-
(_openBlock(true), _createElementBlock(
|
|
276
|
-
_Fragment,
|
|
277
|
-
null,
|
|
278
|
-
_renderList(providerModels, (model) => {
|
|
279
|
-
return _openBlock(), _createElementBlock("option", {
|
|
280
|
-
key: $setup.getModelKey(model),
|
|
281
|
-
value: $setup.getModelKey(model)
|
|
282
|
-
}, _toDisplayString(model.name || model.modelID), 9, _hoisted_15);
|
|
283
|
-
}),
|
|
284
|
-
128
|
|
285
|
-
/* KEYED_FRAGMENT */
|
|
286
|
-
))
|
|
287
|
-
], 8, _hoisted_14);
|
|
288
|
-
}),
|
|
289
|
-
128
|
|
290
|
-
/* KEYED_FRAGMENT */
|
|
291
|
-
))
|
|
292
|
-
], 8, _hoisted_13), [
|
|
293
|
-
[_vModelSelect, $setup.selectedModelValue]
|
|
294
|
-
]),
|
|
295
|
-
_cache[10] || (_cache[10] = _createElementVNode(
|
|
296
|
-
"span",
|
|
297
|
-
{ class: "select-arrow" },
|
|
298
|
-
[
|
|
299
|
-
_createElementVNode("svg", {
|
|
300
|
-
viewBox: "0 0 24 24",
|
|
301
|
-
width: "16",
|
|
302
|
-
height: "16",
|
|
303
|
-
fill: "none",
|
|
304
|
-
stroke: "currentColor",
|
|
305
|
-
"stroke-width": "2"
|
|
306
|
-
}, [
|
|
307
|
-
_createElementVNode("path", {
|
|
308
|
-
d: "M6 9l6 6 6-6",
|
|
309
|
-
"stroke-linecap": "round",
|
|
310
|
-
"stroke-linejoin": "round"
|
|
311
|
-
})
|
|
312
|
-
])
|
|
313
|
-
],
|
|
314
|
-
-1
|
|
315
|
-
/* CACHED */
|
|
316
|
-
))
|
|
317
|
-
]),
|
|
318
|
-
_createElementVNode("button", {
|
|
319
|
-
class: "retry-btn",
|
|
320
|
-
disabled: $props.retrying,
|
|
321
|
-
onClick: $setup.handleRetry
|
|
322
|
-
}, _toDisplayString($props.retrying ? "\u8FDE\u63A5\u4E2D..." : "\u91CD\u8BD5\u8FDE\u63A5"), 9, _hoisted_16)
|
|
323
|
-
])) : (_openBlock(), _createElementBlock("div", _hoisted_17, [
|
|
324
|
-
_createElementVNode("button", {
|
|
325
|
-
class: "opencode-chrome-warmup-failed-btn primary",
|
|
326
|
-
disabled: $props.retrying,
|
|
327
|
-
onClick: _cache[1] || (_cache[1] = ($event) => $setup.handleRetry())
|
|
328
|
-
}, _toDisplayString($props.retrying ? "\u8FDE\u63A5\u4E2D..." : "\u91CD\u8BD5\u8FDE\u63A5"), 9, _hoisted_18)
|
|
329
|
-
]))
|
|
330
|
-
]);
|
|
331
|
-
}
|
|
332
|
-
__vue_sfc__.render = __vue_render__;
|
|
333
|
-
__vue_sfc__.__scopeId = "data-v-06c8b833";
|
|
334
|
-
var ChromeWarmupError_vue_default = __vue_sfc__;
|
|
335
|
-
export {
|
|
336
|
-
ChromeWarmupError_vue_default as default
|
|
337
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
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;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { defineComponent as _defineComponent } from "vue";
|
|
2
|
-
const __vue_sfc__ = /* @__PURE__ */ _defineComponent({
|
|
3
|
-
__name: "LoadingContent",
|
|
4
|
-
props: {
|
|
5
|
-
loadingText: { type: String, required: true }
|
|
6
|
-
},
|
|
7
|
-
setup(__props, { expose: __expose }) {
|
|
8
|
-
__expose();
|
|
9
|
-
const __returned__ = {};
|
|
10
|
-
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
11
|
-
return __returned__;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
import { createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
15
|
-
const _hoisted_1 = { class: "opencode-custom-loading" };
|
|
16
|
-
const _hoisted_2 = { class: "opencode-loading-text" };
|
|
17
|
-
function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
18
|
-
return _openBlock(), _createElementBlock("div", _hoisted_1, [
|
|
19
|
-
_cache[0] || (_cache[0] = _createElementVNode(
|
|
20
|
-
"div",
|
|
21
|
-
{ class: "opencode-loading-spinner" },
|
|
22
|
-
null,
|
|
23
|
-
-1
|
|
24
|
-
/* CACHED */
|
|
25
|
-
)),
|
|
26
|
-
_createElementVNode(
|
|
27
|
-
"div",
|
|
28
|
-
_hoisted_2,
|
|
29
|
-
_toDisplayString($props.loadingText),
|
|
30
|
-
1
|
|
31
|
-
/* TEXT */
|
|
32
|
-
)
|
|
33
|
-
]);
|
|
34
|
-
}
|
|
35
|
-
__vue_sfc__.render = __vue_render__;
|
|
36
|
-
var LoadingContent_vue_default = __vue_sfc__;
|
|
37
|
-
export {
|
|
38
|
-
LoadingContent_vue_default as default
|
|
39
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { useSSE } from "./useSSE";
|
|
2
|
-
export { useServerSSE } from "./useServerSSE";
|
|
3
|
-
export { useOpencodeSSE } from "./useOpencodeSSE";
|
|
4
|
-
export { useOpencodeSessionSSE } from "./useOpencodeSessionSSE";
|
|
5
|
-
export { useHotkey } from "./useHotkey";
|
|
6
|
-
export { useSessions } from "./useSessions";
|
|
7
|
-
export { useTheme } from "./useTheme";
|
|
8
|
-
export { useSelectedElements } from "./useSelectedElements";
|
|
9
|
-
export { useServiceStatus } from "./useServiceStatus";
|
|
10
|
-
export { useContext } from "./useContext";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useSSE } from "./useSSE.mjs";
|
|
2
|
-
import { useServerSSE } from "./useServerSSE.mjs";
|
|
3
|
-
import { useOpencodeSSE } from "./useOpencodeSSE.mjs";
|
|
4
|
-
import { useOpencodeSessionSSE } from "./useOpencodeSessionSSE.mjs";
|
|
5
|
-
import { useHotkey } from "./useHotkey.mjs";
|
|
6
|
-
import { useSessions } from "./useSessions.mjs";
|
|
7
|
-
import { useTheme } from "./useTheme.mjs";
|
|
8
|
-
import { useSelectedElements } from "./useSelectedElements.mjs";
|
|
9
|
-
import { useServiceStatus } from "./useServiceStatus.mjs";
|
|
10
|
-
import { useContext } from "./useContext.mjs";
|
|
11
|
-
export {
|
|
12
|
-
useContext,
|
|
13
|
-
useHotkey,
|
|
14
|
-
useOpencodeSSE,
|
|
15
|
-
useOpencodeSessionSSE,
|
|
16
|
-
useSSE,
|
|
17
|
-
useSelectedElements,
|
|
18
|
-
useServerSSE,
|
|
19
|
-
useServiceStatus,
|
|
20
|
-
useSessions,
|
|
21
|
-
useTheme
|
|
22
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { onMounted, onUnmounted } from "vue";
|
|
2
|
-
function useContext(serviceStatus, selectedElements) {
|
|
3
|
-
let currentPageUrl = "";
|
|
4
|
-
let currentPageTitle = "";
|
|
5
|
-
const updateContext = (force = false) => {
|
|
6
|
-
if (serviceStatus.value === "idle") return;
|
|
7
|
-
const newUrl = window.location.href;
|
|
8
|
-
const newTitle = document.title;
|
|
9
|
-
if (force || newUrl !== currentPageUrl || newTitle !== currentPageTitle) {
|
|
10
|
-
currentPageUrl = newUrl;
|
|
11
|
-
currentPageTitle = newTitle;
|
|
12
|
-
fetch("/__opencode_context__", {
|
|
13
|
-
method: "POST",
|
|
14
|
-
headers: { "Content-Type": "application/json" },
|
|
15
|
-
body: JSON.stringify({
|
|
16
|
-
url: newUrl,
|
|
17
|
-
title: newTitle,
|
|
18
|
-
selectedElements: selectedElements.value
|
|
19
|
-
})
|
|
20
|
-
}).catch(() => {
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const scheduleContextUpdate = () => {
|
|
25
|
-
requestAnimationFrame(() => updateContext());
|
|
26
|
-
};
|
|
27
|
-
let titleObserver = null;
|
|
28
|
-
const originalPushState = history.pushState;
|
|
29
|
-
const originalReplaceState = history.replaceState;
|
|
30
|
-
onMounted(() => {
|
|
31
|
-
history.pushState = function(...args) {
|
|
32
|
-
originalPushState.apply(this, args);
|
|
33
|
-
scheduleContextUpdate();
|
|
34
|
-
};
|
|
35
|
-
history.replaceState = function(...args) {
|
|
36
|
-
originalReplaceState.apply(this, args);
|
|
37
|
-
scheduleContextUpdate();
|
|
38
|
-
};
|
|
39
|
-
window.addEventListener("popstate", scheduleContextUpdate);
|
|
40
|
-
window.addEventListener("hashchange", scheduleContextUpdate);
|
|
41
|
-
titleObserver = new MutationObserver(() => {
|
|
42
|
-
if (document.title !== currentPageTitle) updateContext();
|
|
43
|
-
});
|
|
44
|
-
if (document.head) {
|
|
45
|
-
titleObserver.observe(document.head, { childList: true, subtree: true });
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
onUnmounted(() => {
|
|
49
|
-
history.pushState = originalPushState;
|
|
50
|
-
history.replaceState = originalReplaceState;
|
|
51
|
-
window.removeEventListener("popstate", scheduleContextUpdate);
|
|
52
|
-
window.removeEventListener("hashchange", scheduleContextUpdate);
|
|
53
|
-
if (titleObserver) {
|
|
54
|
-
titleObserver.disconnect();
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
return {
|
|
58
|
-
updateContext
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
useContext
|
|
63
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
interface HotkeyConfig {
|
|
2
|
-
ctrl: boolean;
|
|
3
|
-
shift: boolean;
|
|
4
|
-
alt: boolean;
|
|
5
|
-
key: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function parseHotkey(hotkeyStr: string): HotkeyConfig;
|
|
8
|
-
export declare function matchHotkey(e: KeyboardEvent, hotkeyConfig: HotkeyConfig): boolean;
|
|
9
|
-
export declare function useHotkey(hotkeyStr: string, callback: (event: KeyboardEvent) => void): {
|
|
10
|
-
hotkeyConfig: HotkeyConfig;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { onMounted, onUnmounted } from "vue";
|
|
2
|
-
function parseHotkey(hotkeyStr) {
|
|
3
|
-
if (!hotkeyStr) return { ctrl: true, shift: false, alt: false, key: "k" };
|
|
4
|
-
const parts = hotkeyStr.toLowerCase().split("+");
|
|
5
|
-
const key = parts.pop();
|
|
6
|
-
return {
|
|
7
|
-
ctrl: parts.includes("ctrl") || parts.includes("meta"),
|
|
8
|
-
shift: parts.includes("shift"),
|
|
9
|
-
alt: parts.includes("alt"),
|
|
10
|
-
key: key || "k"
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
function matchHotkey(e, hotkeyConfig) {
|
|
14
|
-
const ctrlMatch = hotkeyConfig.ctrl ? e.ctrlKey || e.metaKey : !(e.ctrlKey || e.metaKey);
|
|
15
|
-
const shiftMatch = hotkeyConfig.shift ? e.shiftKey : !e.shiftKey;
|
|
16
|
-
const altMatch = hotkeyConfig.alt ? e.altKey : !e.altKey;
|
|
17
|
-
const keyMatch = e.key.toLowerCase() === hotkeyConfig.key.toLowerCase();
|
|
18
|
-
return ctrlMatch && shiftMatch && altMatch && keyMatch;
|
|
19
|
-
}
|
|
20
|
-
function useHotkey(hotkeyStr, callback) {
|
|
21
|
-
const hotkeyConfig = parseHotkey(hotkeyStr);
|
|
22
|
-
const handleKeydown = (e) => {
|
|
23
|
-
if (matchHotkey(e, hotkeyConfig)) {
|
|
24
|
-
callback(e);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
onMounted(() => {
|
|
28
|
-
document.addEventListener("keydown", handleKeydown);
|
|
29
|
-
});
|
|
30
|
-
onUnmounted(() => {
|
|
31
|
-
document.removeEventListener("keydown", handleKeydown);
|
|
32
|
-
});
|
|
33
|
-
return {
|
|
34
|
-
hotkeyConfig
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export {
|
|
38
|
-
matchHotkey,
|
|
39
|
-
parseHotkey,
|
|
40
|
-
useHotkey
|
|
41
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { type Ref } from "vue";
|
|
2
|
-
/**
|
|
3
|
-
* OpenCode SSE 事件 payload
|
|
4
|
-
*/
|
|
5
|
-
export interface OpencodeSSEPayload {
|
|
6
|
-
type: string;
|
|
7
|
-
properties: {
|
|
8
|
-
sessionID?: string;
|
|
9
|
-
status?: {
|
|
10
|
-
type: string;
|
|
11
|
-
};
|
|
12
|
-
info?: {
|
|
13
|
-
sessionID?: string;
|
|
14
|
-
role?: string;
|
|
15
|
-
time?: {
|
|
16
|
-
completed?: number;
|
|
17
|
-
created?: number;
|
|
18
|
-
updated?: number;
|
|
19
|
-
archived?: number;
|
|
20
|
-
compacting?: number;
|
|
21
|
-
};
|
|
22
|
-
title?: string;
|
|
23
|
-
id?: string;
|
|
24
|
-
summary?: {
|
|
25
|
-
additions?: number;
|
|
26
|
-
deletions?: number;
|
|
27
|
-
files?: number;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
[key: string]: unknown;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* OpenCode SSE 消息结构
|
|
35
|
-
*/
|
|
36
|
-
export interface OpencodeSSEMessage {
|
|
37
|
-
payload: OpencodeSSEPayload;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* OpenCode SSE 配置选项
|
|
41
|
-
*/
|
|
42
|
-
export interface OpencodeSSEOptions {
|
|
43
|
-
/** OpenCode proxy 基础 URL (例如: http://localhost:4098/xxx) */
|
|
44
|
-
proxyBaseUrl: string;
|
|
45
|
-
/** 是否启用 */
|
|
46
|
-
enabled?: Ref<boolean>;
|
|
47
|
-
/** 事件处理器 */
|
|
48
|
-
onEvent?: (payload: OpencodeSSEPayload) => void;
|
|
49
|
-
/** 连接成功回调 */
|
|
50
|
-
onConnected?: () => void;
|
|
51
|
-
/** 连接错误回调 */
|
|
52
|
-
onError?: (error: Error) => void;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* 监听 OpenCode SSE 事件
|
|
56
|
-
* 端点: /global/event (通过 proxy server)
|
|
57
|
-
* 只负责连接管理和消息分发,不包含业务逻辑
|
|
58
|
-
*/
|
|
59
|
-
export declare function useOpencodeSSE(options: OpencodeSSEOptions): {
|
|
60
|
-
status: Ref<import("./useSSE").SSEConnectionStatus, import("./useSSE").SSEConnectionStatus>;
|
|
61
|
-
isConnected: import("vue").ComputedRef<boolean>;
|
|
62
|
-
connect: () => void;
|
|
63
|
-
disconnect: () => void;
|
|
64
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useSSE } from "./useSSE.mjs";
|
|
2
|
-
function useOpencodeSSE(options) {
|
|
3
|
-
const { proxyBaseUrl, enabled, onEvent, onConnected, onError } = options;
|
|
4
|
-
const endpoint = `${proxyBaseUrl}/global/event`;
|
|
5
|
-
const { status, isConnected, connect, disconnect } = useSSE({
|
|
6
|
-
endpoint,
|
|
7
|
-
autoConnect: false,
|
|
8
|
-
enabled,
|
|
9
|
-
onMessage: (data) => {
|
|
10
|
-
const message = data;
|
|
11
|
-
const payload = message.payload;
|
|
12
|
-
if (!payload) return;
|
|
13
|
-
onEvent == null ? void 0 : onEvent(payload);
|
|
14
|
-
},
|
|
15
|
-
onConnected,
|
|
16
|
-
onError
|
|
17
|
-
});
|
|
18
|
-
return {
|
|
19
|
-
// 状态
|
|
20
|
-
status,
|
|
21
|
-
isConnected,
|
|
22
|
-
// 方法
|
|
23
|
-
connect,
|
|
24
|
-
disconnect
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export {
|
|
28
|
-
useOpencodeSSE
|
|
29
|
-
};
|