@ai-accounts/vue-styled 0.2.2 → 0.3.0-alpha.2
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/dist/ai-accounts-vue-styled.cjs.js +1 -1
- package/dist/ai-accounts-vue-styled.js +1384 -209
- package/dist/components/AccountEditForm.vue.d.ts +20 -0
- package/dist/components/AccountEditForm.vue.d.ts.map +1 -0
- package/dist/components/AccountWizard.vue.d.ts +21 -23
- package/dist/components/AccountWizard.vue.d.ts.map +1 -1
- package/dist/components/BackendPicker.vue.d.ts +13 -0
- package/dist/components/BackendPicker.vue.d.ts.map +1 -0
- package/dist/components/LoginStream.vue.d.ts +10 -0
- package/dist/components/LoginStream.vue.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
|
@@ -1,142 +1,1240 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as oe, ref as v, openBlock as a, createElementBlock as n, createElementVNode as e, toDisplayString as o, createTextVNode as h, createCommentVNode as l, withModifiers as we, withDirectives as D, vModelDynamic as Xe, onMounted as Be, Fragment as F, renderList as se, unref as m, computed as S, watch as be, onUnmounted as Je, createVNode as $e, normalizeClass as V, vModelRadio as Ae, Transition as Qe, withCtx as Ze, vModelText as X, createBlock as et, vModelSelect as tt, vModelCheckbox as at, renderSlot as Le, reactive as nt } from "vue";
|
|
2
|
+
import { useBackendRegistry as Ee, useAiAccounts as Oe, useLoginSession as st, useOnboarding as ot } from "@ai-accounts/vue-headless";
|
|
3
|
+
const it = { class: "aia-login-stream" }, lt = {
|
|
4
4
|
key: 0,
|
|
5
|
-
class: "aia-
|
|
6
|
-
},
|
|
5
|
+
class: "aia-url-prompt"
|
|
6
|
+
}, ct = ["href"], ut = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "aia-code"
|
|
9
|
+
}, rt = ["type"], dt = {
|
|
10
|
+
key: 2,
|
|
11
|
+
class: "aia-stdout"
|
|
12
|
+
}, vt = {
|
|
13
|
+
key: 3,
|
|
14
|
+
class: "aia-error"
|
|
15
|
+
}, pt = /* @__PURE__ */ oe({
|
|
16
|
+
__name: "LoginStream",
|
|
17
|
+
props: {
|
|
18
|
+
session: {},
|
|
19
|
+
showStdout: { type: Boolean, default: !0 }
|
|
20
|
+
},
|
|
21
|
+
setup(y) {
|
|
22
|
+
const A = y, i = v("");
|
|
23
|
+
async function I() {
|
|
24
|
+
const c = i.value;
|
|
25
|
+
i.value = "", await A.session.respond(c);
|
|
26
|
+
}
|
|
27
|
+
return (c, p) => (a(), n("div", it, [
|
|
28
|
+
y.session.urlPrompt.value ? (a(), n("div", lt, [
|
|
29
|
+
p[3] || (p[3] = e("p", { class: "aia-label" }, "Open this URL to authenticate:", -1)),
|
|
30
|
+
e("a", {
|
|
31
|
+
href: y.session.urlPrompt.value.url,
|
|
32
|
+
target: "_blank",
|
|
33
|
+
rel: "noopener"
|
|
34
|
+
}, o(y.session.urlPrompt.value.url), 9, ct),
|
|
35
|
+
y.session.urlPrompt.value.user_code ? (a(), n("p", ut, [
|
|
36
|
+
p[2] || (p[2] = h(" Code: ", -1)),
|
|
37
|
+
e("code", null, o(y.session.urlPrompt.value.user_code), 1)
|
|
38
|
+
])) : l("", !0)
|
|
39
|
+
])) : l("", !0),
|
|
40
|
+
y.session.textPrompt.value ? (a(), n("form", {
|
|
41
|
+
key: 1,
|
|
42
|
+
class: "aia-text-prompt",
|
|
43
|
+
onSubmit: we(I, ["prevent"])
|
|
44
|
+
}, [
|
|
45
|
+
e("label", null, [
|
|
46
|
+
h(o(y.session.textPrompt.value.prompt) + " ", 1),
|
|
47
|
+
D(e("input", {
|
|
48
|
+
"onUpdate:modelValue": p[0] || (p[0] = (_) => i.value = _),
|
|
49
|
+
type: y.session.textPrompt.value.hidden ? "password" : "text",
|
|
50
|
+
autocomplete: "off"
|
|
51
|
+
}, null, 8, rt), [
|
|
52
|
+
[Xe, i.value]
|
|
53
|
+
])
|
|
54
|
+
]),
|
|
55
|
+
p[4] || (p[4] = e("button", { type: "submit" }, "Continue", -1))
|
|
56
|
+
], 32)) : l("", !0),
|
|
57
|
+
y.showStdout && y.session.stdoutLines.value.length > 0 ? (a(), n("pre", dt, o(y.session.stdoutLines.value.join("")), 1)) : l("", !0),
|
|
58
|
+
y.session.status.value === "failed" ? (a(), n("div", vt, [
|
|
59
|
+
e("strong", null, o(y.session.errorCode.value), 1),
|
|
60
|
+
e("p", null, o(y.session.errorMessage.value), 1)
|
|
61
|
+
])) : l("", !0),
|
|
62
|
+
y.session.status.value === "running" ? (a(), n("button", {
|
|
63
|
+
key: 4,
|
|
64
|
+
type: "button",
|
|
65
|
+
class: "aia-cancel",
|
|
66
|
+
onClick: p[1] || (p[1] = (_) => y.session.cancel())
|
|
67
|
+
}, " Cancel ")) : l("", !0)
|
|
68
|
+
]));
|
|
69
|
+
}
|
|
70
|
+
}), ie = (y, A) => {
|
|
71
|
+
const i = y.__vccOpts || y;
|
|
72
|
+
for (const [I, c] of A)
|
|
73
|
+
i[I] = c;
|
|
74
|
+
return i;
|
|
75
|
+
}, yt = /* @__PURE__ */ ie(pt, [["__scopeId", "data-v-133adf55"]]), _t = { class: "aia-backend-picker" }, kt = ["onClick"], bt = ["src", "alt"], ht = { class: "aia-backend-info" }, gt = {
|
|
76
|
+
key: 0,
|
|
77
|
+
class: "aia-installed"
|
|
78
|
+
}, mt = {
|
|
79
|
+
key: 1,
|
|
80
|
+
class: "aia-not-installed"
|
|
81
|
+
}, ft = /* @__PURE__ */ oe({
|
|
82
|
+
__name: "BackendPicker",
|
|
83
|
+
props: {
|
|
84
|
+
installStatus: {}
|
|
85
|
+
},
|
|
86
|
+
emits: ["pick"],
|
|
87
|
+
setup(y, { emit: A }) {
|
|
88
|
+
const i = y, I = A, c = Ee();
|
|
89
|
+
function p(_) {
|
|
90
|
+
return i.installStatus ? i.installStatus[_] : void 0;
|
|
91
|
+
}
|
|
92
|
+
return Be(async () => {
|
|
93
|
+
c.loaded.value || await c.load();
|
|
94
|
+
}), (_, P) => (a(), n("ul", _t, [
|
|
95
|
+
(a(!0), n(F, null, se(m(c).backends.value, (k) => (a(), n("li", {
|
|
96
|
+
key: k.kind
|
|
97
|
+
}, [
|
|
98
|
+
e("button", {
|
|
99
|
+
type: "button",
|
|
100
|
+
onClick: (d) => I("pick", k.kind)
|
|
101
|
+
}, [
|
|
102
|
+
k.icon_url ? (a(), n("img", {
|
|
103
|
+
key: 0,
|
|
104
|
+
src: k.icon_url,
|
|
105
|
+
alt: k.display_name
|
|
106
|
+
}, null, 8, bt)) : l("", !0),
|
|
107
|
+
e("div", ht, [
|
|
108
|
+
e("strong", null, o(k.display_name), 1),
|
|
109
|
+
p(k.kind) ? (a(), n(F, { key: 0 }, [
|
|
110
|
+
p(k.kind).installed ? (a(), n("span", gt, " installed" + o(p(k.kind).version ? " v" + p(k.kind).version : ""), 1)) : (a(), n("span", mt, "not detected"))
|
|
111
|
+
], 64)) : l("", !0)
|
|
112
|
+
])
|
|
113
|
+
], 8, kt)
|
|
114
|
+
]))), 128))
|
|
115
|
+
]));
|
|
116
|
+
}
|
|
117
|
+
}), wt = /* @__PURE__ */ ie(ft, [["__scopeId", "data-v-2500895f"]]), Ct = {
|
|
118
|
+
class: "wizard-container",
|
|
119
|
+
"data-tour": "account-wizard"
|
|
120
|
+
}, zt = { class: "wizard-header" }, xt = {
|
|
121
|
+
key: 0,
|
|
122
|
+
class: "wizard-step"
|
|
123
|
+
}, Wt = { class: "step-body" }, St = { class: "step-actions" }, It = {
|
|
124
|
+
key: 1,
|
|
125
|
+
class: "wizard-steps"
|
|
126
|
+
}, Pt = ["onClick"], $t = { class: "step-number" }, At = {
|
|
127
|
+
key: 0,
|
|
128
|
+
viewBox: "0 0 24 24",
|
|
129
|
+
fill: "none",
|
|
130
|
+
stroke: "currentColor",
|
|
131
|
+
"stroke-width": "3",
|
|
132
|
+
width: "12",
|
|
133
|
+
height: "12"
|
|
134
|
+
}, Lt = { class: "step-label" }, Bt = {
|
|
135
|
+
key: 2,
|
|
136
|
+
class: "wizard-step"
|
|
137
|
+
}, Et = { class: "step-body" }, Ot = { class: "step-question" }, Dt = { class: "radio-group" }, Kt = { class: "radio-card-content" }, Nt = { class: "radio-card-title" }, Ut = { class: "radio-card-desc" }, Rt = { class: "radio-card-content" }, Vt = { class: "radio-card-title" }, Ft = { class: "radio-card-desc" }, Mt = {
|
|
138
|
+
key: 0,
|
|
139
|
+
class: "account-fields"
|
|
140
|
+
}, Tt = { class: "form-group" }, Ht = { for: "wiz-name" }, qt = ["placeholder"], Gt = { class: "form-group" }, Yt = { for: "wiz-email" }, jt = ["placeholder"], Xt = { class: "step-actions" }, Jt = ["disabled"], Qt = {
|
|
141
|
+
key: 3,
|
|
142
|
+
class: "wizard-step"
|
|
143
|
+
}, Zt = { class: "step-body" }, ea = { class: "status-icon" }, ta = {
|
|
144
|
+
key: 0,
|
|
145
|
+
class: "spinner-sm"
|
|
146
|
+
}, aa = {
|
|
147
|
+
key: 1,
|
|
148
|
+
viewBox: "0 0 24 24",
|
|
149
|
+
fill: "none",
|
|
150
|
+
stroke: "currentColor",
|
|
151
|
+
"stroke-width": "2",
|
|
152
|
+
width: "20",
|
|
153
|
+
height: "20"
|
|
154
|
+
}, na = {
|
|
155
|
+
key: 2,
|
|
156
|
+
viewBox: "0 0 24 24",
|
|
157
|
+
fill: "none",
|
|
158
|
+
stroke: "currentColor",
|
|
159
|
+
"stroke-width": "2",
|
|
160
|
+
width: "20",
|
|
161
|
+
height: "20"
|
|
162
|
+
}, sa = { class: "status-info" }, oa = { class: "status-title" }, ia = {
|
|
163
|
+
key: 0,
|
|
164
|
+
class: "status-detail"
|
|
165
|
+
}, la = {
|
|
166
|
+
key: 1,
|
|
167
|
+
class: "status-detail"
|
|
168
|
+
}, ca = {
|
|
169
|
+
key: 1,
|
|
170
|
+
class: "spinner-sm"
|
|
171
|
+
}, ua = {
|
|
172
|
+
key: 0,
|
|
173
|
+
class: "error-text"
|
|
174
|
+
}, ra = {
|
|
175
|
+
key: 1,
|
|
176
|
+
class: "install-success-text"
|
|
177
|
+
}, da = {
|
|
178
|
+
key: 2,
|
|
179
|
+
class: "install-stderr"
|
|
180
|
+
}, va = {
|
|
181
|
+
key: 3,
|
|
182
|
+
class: "config-dir-section"
|
|
183
|
+
}, pa = { class: "config-dir-label" }, ya = { class: "config-dir-path" }, _a = ["disabled"], ka = {
|
|
184
|
+
key: 1,
|
|
185
|
+
class: "dir-created-badge"
|
|
186
|
+
}, ba = {
|
|
187
|
+
key: 0,
|
|
188
|
+
class: "error-text"
|
|
189
|
+
}, ha = { class: "config-path-edit" }, ga = {
|
|
190
|
+
key: 1,
|
|
191
|
+
class: "form-group compact"
|
|
192
|
+
}, ma = ["placeholder"], fa = {
|
|
193
|
+
key: 4,
|
|
194
|
+
class: "api-key-info"
|
|
195
|
+
}, wa = { class: "api-key-label" }, Ca = { class: "step-actions" }, za = {
|
|
196
|
+
key: 4,
|
|
197
|
+
class: "wizard-step"
|
|
198
|
+
}, xa = { class: "step-body" }, Wa = {
|
|
199
|
+
key: 0,
|
|
200
|
+
class: "login-status login-connecting"
|
|
201
|
+
}, Sa = {
|
|
202
|
+
key: 2,
|
|
203
|
+
class: "login-status login-completed"
|
|
204
|
+
}, Ia = { class: "login-status login-error" }, Pa = { class: "step-actions" }, $a = {
|
|
205
|
+
key: 5,
|
|
206
|
+
class: "wizard-step"
|
|
207
|
+
}, Aa = { class: "step-body" }, La = {
|
|
208
|
+
key: 0,
|
|
209
|
+
class: "cliproxy-install-block"
|
|
210
|
+
}, Ba = ["disabled"], Ea = {
|
|
211
|
+
key: 0,
|
|
212
|
+
class: "spinner-sm"
|
|
213
|
+
}, Oa = { key: 0 }, Da = {
|
|
214
|
+
key: 0,
|
|
215
|
+
class: "install-success-text"
|
|
216
|
+
}, Ka = { key: 1 }, Na = {
|
|
217
|
+
key: 0,
|
|
218
|
+
class: "install-stderr"
|
|
219
|
+
}, Ua = {
|
|
220
|
+
key: 1,
|
|
221
|
+
class: "proxy-step-body"
|
|
222
|
+
}, Ra = {
|
|
7
223
|
key: 1,
|
|
8
|
-
class: "
|
|
9
|
-
},
|
|
224
|
+
class: "proxy-running"
|
|
225
|
+
}, Va = {
|
|
226
|
+
key: 2,
|
|
227
|
+
class: "proxy-device-auth"
|
|
228
|
+
}, Fa = ["href"], Ma = {
|
|
229
|
+
key: 1,
|
|
230
|
+
class: "proxy-code"
|
|
231
|
+
}, Ta = { class: "callback-paste" }, Ha = { class: "callback-label" }, qa = {
|
|
232
|
+
key: 0,
|
|
233
|
+
class: "error-text"
|
|
234
|
+
}, Ga = {
|
|
10
235
|
key: 3,
|
|
11
|
-
class: "
|
|
12
|
-
},
|
|
236
|
+
class: "proxy-success"
|
|
237
|
+
}, Ya = {
|
|
13
238
|
key: 4,
|
|
14
|
-
class: "
|
|
15
|
-
},
|
|
239
|
+
class: "proxy-skipped"
|
|
240
|
+
}, ja = {
|
|
16
241
|
key: 5,
|
|
17
|
-
class: "
|
|
18
|
-
},
|
|
242
|
+
class: "proxy-error"
|
|
243
|
+
}, Xa = { class: "error-text" }, Ja = {
|
|
244
|
+
key: 2,
|
|
245
|
+
class: "proxy-loading"
|
|
246
|
+
}, Qa = { class: "step-actions" }, Za = {
|
|
247
|
+
key: 6,
|
|
248
|
+
class: "wizard-step"
|
|
249
|
+
}, en = { class: "step-body" }, tn = { class: "review-card" }, an = { class: "review-row" }, nn = { class: "review-label" }, sn = { class: "review-value" }, on = {
|
|
19
250
|
key: 0,
|
|
20
|
-
class: "
|
|
21
|
-
},
|
|
251
|
+
class: "review-row"
|
|
252
|
+
}, ln = { class: "review-label" }, cn = { class: "review-value" }, un = {
|
|
253
|
+
key: 1,
|
|
254
|
+
class: "review-row"
|
|
255
|
+
}, rn = { class: "review-label" }, dn = { class: "review-value" }, vn = {
|
|
256
|
+
key: 2,
|
|
257
|
+
class: "review-row"
|
|
258
|
+
}, pn = { class: "review-label" }, yn = { class: "review-value" }, _n = {
|
|
259
|
+
key: 0,
|
|
260
|
+
class: "form-group"
|
|
261
|
+
}, kn = { for: "wiz-plan" }, bn = { value: "" }, hn = ["value"], gn = { class: "form-group checkbox" }, mn = {
|
|
262
|
+
key: 1,
|
|
263
|
+
class: "error-text"
|
|
264
|
+
}, fn = { class: "step-actions" }, wn = ["disabled"], Cn = {
|
|
265
|
+
key: 0,
|
|
266
|
+
class: "spinner-sm"
|
|
267
|
+
}, zn = {
|
|
268
|
+
key: 7,
|
|
269
|
+
class: "wizard-step"
|
|
270
|
+
}, xn = { class: "step-body done-body" }, Wn = { class: "done-actions" }, Sn = /* @__PURE__ */ oe({
|
|
22
271
|
__name: "AccountWizard",
|
|
23
272
|
props: {
|
|
24
|
-
|
|
25
|
-
|
|
273
|
+
initialBackendKind: {},
|
|
274
|
+
backendName: {},
|
|
275
|
+
allowSkip: { type: Boolean }
|
|
26
276
|
},
|
|
27
|
-
emits: ["
|
|
28
|
-
setup(
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
277
|
+
emits: ["close", "saved", "skip", "addAnother", "done"],
|
|
278
|
+
setup(y, { emit: A }) {
|
|
279
|
+
const i = (s, t) => ({
|
|
280
|
+
"accountWizard.addAccount": "Add Account",
|
|
281
|
+
"accountWizard.stepSubscription": "Subscription",
|
|
282
|
+
"accountWizard.stepCliSetup": "CLI Setup",
|
|
283
|
+
"accountWizard.stepLogin": "Login",
|
|
284
|
+
"accountWizard.stepPlanSave": "Plan & Save",
|
|
285
|
+
"accountWizard.stepDone": "Done",
|
|
286
|
+
"accountWizard.yesHaveAccount": "Yes, I have an account",
|
|
287
|
+
"accountWizard.yesHaveAccountDesc": "I already have a subscription for this backend",
|
|
288
|
+
"accountWizard.noSkip": "Skip for now",
|
|
289
|
+
"accountWizard.noSkipDesc": "I will set this up later",
|
|
290
|
+
"accountWizard.accountName": "Account name",
|
|
291
|
+
"accountWizard.accountNamePlaceholder": "e.g., Personal, Work",
|
|
292
|
+
"accountWizard.email": "Email",
|
|
293
|
+
"accountWizard.emailPlaceholder": "name@example.com",
|
|
294
|
+
"accountWizard.emailHelp": "Optional — used to tag the account",
|
|
295
|
+
"accountWizard.cliInstalled": "CLI detected",
|
|
296
|
+
"accountWizard.cliNotInstalled": "CLI not detected",
|
|
297
|
+
"accountWizard.installCli": "Install CLI",
|
|
298
|
+
"accountWizard.configPath": "Config path",
|
|
299
|
+
"accountWizard.createDir": "Create",
|
|
300
|
+
"accountWizard.creating": "Creating...",
|
|
301
|
+
"accountWizard.configCreated": "Created",
|
|
302
|
+
"accountWizard.customizePath": "Customize path",
|
|
303
|
+
"accountWizard.apiKeyEnv": "API key env var",
|
|
304
|
+
"accountWizard.startingLogin": "Starting login session...",
|
|
305
|
+
"accountWizard.loginCompleted": "Login completed",
|
|
306
|
+
"accountWizard.tryAgain": "Try again",
|
|
307
|
+
"accountWizard.connectionLost": "Connection lost",
|
|
308
|
+
"accountWizard.send": "Send",
|
|
309
|
+
"accountWizard.waitingForResponse": "Waiting for response...",
|
|
310
|
+
"accountWizard.plan": "Plan",
|
|
311
|
+
"accountWizard.selectPlan": "Select a plan",
|
|
312
|
+
"accountWizard.setDefault": "Set as default account",
|
|
313
|
+
"accountWizard.saving": "Saving...",
|
|
314
|
+
"accountWizard.saveAccount": "Save account",
|
|
315
|
+
"accountWizard.accountCreated": "Account created!",
|
|
316
|
+
"accountWizard.addAnother": "Add another",
|
|
317
|
+
"accountWizard.doneNextBackend": "Done",
|
|
318
|
+
"accountWizard.continueBtn": "Continue",
|
|
319
|
+
"common.cancel": "Cancel",
|
|
320
|
+
"common.back": "Back",
|
|
321
|
+
"common.skip": "Skip"
|
|
322
|
+
})[s] ?? s, I = y, c = A, { client: p, emit: _ } = Oe(), P = Ee(), k = st(), d = v(I.initialBackendKind ?? ""), f = S(
|
|
323
|
+
() => d.value ? P.get(d.value) : void 0
|
|
324
|
+
), x = S(
|
|
325
|
+
() => {
|
|
326
|
+
var s;
|
|
327
|
+
return I.backendName || ((s = f.value) == null ? void 0 : s.display_name) || d.value || "Backend";
|
|
328
|
+
}
|
|
329
|
+
), b = v("subscription"), K = ["claude", "codex", "gemini"], J = S(
|
|
330
|
+
() => K.includes(
|
|
331
|
+
d.value ?? ""
|
|
332
|
+
)
|
|
333
|
+
), T = S(() => {
|
|
334
|
+
const s = ["subscription", "cli", "login"];
|
|
335
|
+
return J.value && s.push("proxy"), s.push("plan"), s;
|
|
336
|
+
}), H = S(
|
|
337
|
+
() => T.value.indexOf(b.value)
|
|
338
|
+
), he = S(() => ({
|
|
339
|
+
subscription: i("accountWizard.stepSubscription"),
|
|
340
|
+
cli: i("accountWizard.stepCliSetup"),
|
|
341
|
+
login: i("accountWizard.stepLogin"),
|
|
342
|
+
proxy: "API Proxy",
|
|
343
|
+
plan: i("accountWizard.stepPlanSave"),
|
|
344
|
+
done: i("accountWizard.stepDone")
|
|
345
|
+
}));
|
|
346
|
+
function L() {
|
|
347
|
+
const s = T.value, t = s.indexOf(b.value);
|
|
348
|
+
t >= 0 && t < s.length - 1 ? b.value = s[t + 1] : b.value === s[s.length - 1] && (b.value = "done");
|
|
349
|
+
}
|
|
350
|
+
function g() {
|
|
351
|
+
const s = T.value, t = s.indexOf(b.value);
|
|
352
|
+
t > 0 && (b.value = s[t - 1]);
|
|
353
|
+
}
|
|
354
|
+
const u = v(""), w = v(""), B = v(""), le = S(() => u.value !== "");
|
|
355
|
+
function C() {
|
|
356
|
+
if (u.value === "no") {
|
|
357
|
+
je();
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
L();
|
|
361
|
+
}
|
|
362
|
+
const z = v(""), R = v(!1);
|
|
363
|
+
function Q(s) {
|
|
364
|
+
return s.toLowerCase().replace(/\s+/g, "").replace(/[^a-z0-9]/g, "");
|
|
365
|
+
}
|
|
366
|
+
function ce() {
|
|
367
|
+
if (R.value) return;
|
|
368
|
+
const s = w.value.trim();
|
|
369
|
+
if (!s) {
|
|
370
|
+
z.value = "";
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
const t = Q(s), r = {
|
|
374
|
+
claude: ".claude",
|
|
375
|
+
codex: ".codex",
|
|
376
|
+
gemini: ".gemini",
|
|
377
|
+
opencode: ".opencode"
|
|
378
|
+
}, O = d.value || "", ke = r[O] || (O ? `.${O}` : ".backend");
|
|
379
|
+
z.value = `~/${ke}-${t}`;
|
|
380
|
+
}
|
|
381
|
+
const q = S(() => {
|
|
382
|
+
const s = w.value.trim();
|
|
383
|
+
if (!s) return "";
|
|
384
|
+
const t = {
|
|
385
|
+
claude: "ANTHROPIC",
|
|
386
|
+
codex: "OPENAI",
|
|
387
|
+
gemini: "GOOGLE",
|
|
388
|
+
opencode: "OPENCODE"
|
|
389
|
+
}, r = d.value || "", O = t[r] || (r ? r.toUpperCase() : "BACKEND"), ke = Q(s).replace(/-/g, "_").toUpperCase();
|
|
390
|
+
return `${O}_API_KEY_${ke}`;
|
|
391
|
+
}), G = v(!1), ue = v(""), ge = v(!1), re = v(!1), Ce = v(!1), de = v(!1), me = v(""), Y = v("");
|
|
392
|
+
async function ze() {
|
|
393
|
+
if (d.value) {
|
|
394
|
+
ge.value = !0;
|
|
395
|
+
try {
|
|
396
|
+
const s = P.get(d.value);
|
|
397
|
+
G.value = !!s, ue.value = "";
|
|
398
|
+
} catch (s) {
|
|
399
|
+
console.warn("[AccountWizard] CLI check failed:", s);
|
|
400
|
+
} finally {
|
|
401
|
+
ge.value = !1;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
const E = v(null);
|
|
406
|
+
async function De() {
|
|
407
|
+
if (d.value) {
|
|
408
|
+
re.value = !0, Y.value = "", E.value = null;
|
|
409
|
+
try {
|
|
410
|
+
const s = await p.installBackendCli(d.value);
|
|
411
|
+
E.value = s, s.success ? (G.value = !0, ue.value = "") : Y.value = s.stderr || s.stdout || "Installation failed";
|
|
412
|
+
} catch (s) {
|
|
413
|
+
Y.value = s instanceof Error ? s.message : String(s), E.value = {
|
|
414
|
+
kind: d.value,
|
|
415
|
+
success: !1,
|
|
416
|
+
display: "install failed",
|
|
417
|
+
stdout: "",
|
|
418
|
+
stderr: Y.value,
|
|
419
|
+
exit_code: -1,
|
|
420
|
+
binary_path: null
|
|
421
|
+
};
|
|
422
|
+
} finally {
|
|
423
|
+
re.value = !1;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
async function Ke() {
|
|
428
|
+
z.value && (de.value = !0);
|
|
429
|
+
}
|
|
430
|
+
Be(async () => {
|
|
431
|
+
P.loaded.value || await P.load(), ze(), _({ type: "wizard.opened", backendKind: d.value }), Fe();
|
|
432
|
+
}), be(z, () => {
|
|
433
|
+
de.value = !1, me.value = "";
|
|
434
|
+
});
|
|
435
|
+
const N = v("");
|
|
436
|
+
be(b, async (s) => {
|
|
437
|
+
s === "login" && k.status.value === "idle" && await xe();
|
|
438
|
+
}, { immediate: !0 });
|
|
439
|
+
async function xe() {
|
|
440
|
+
const s = f.value;
|
|
441
|
+
if (s)
|
|
442
|
+
try {
|
|
443
|
+
if (!N.value) {
|
|
444
|
+
const r = await p.createBackend({
|
|
445
|
+
kind: s.kind,
|
|
446
|
+
display_name: w.value.trim() || s.display_name,
|
|
447
|
+
config: We()
|
|
448
|
+
});
|
|
449
|
+
N.value = r.id;
|
|
450
|
+
}
|
|
451
|
+
const t = Ne(s);
|
|
452
|
+
_({
|
|
453
|
+
type: "wizard.step",
|
|
454
|
+
backendKind: s.kind,
|
|
455
|
+
step: "login.start"
|
|
456
|
+
}), await k.start(N.value, t, Ue(s));
|
|
457
|
+
} catch (t) {
|
|
458
|
+
console.warn("[AccountWizard] login failed:", t);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function Ne(s) {
|
|
462
|
+
const t = s.login_flows.map((r) => r.kind);
|
|
463
|
+
return t.includes("cli_browser") ? "cli_browser" : t.includes("oauth_device") ? "oauth_device" : "api_key";
|
|
464
|
+
}
|
|
465
|
+
function Ue(s) {
|
|
466
|
+
return {};
|
|
467
|
+
}
|
|
468
|
+
function We() {
|
|
469
|
+
return {
|
|
470
|
+
email: B.value.trim() || void 0,
|
|
471
|
+
config_path: z.value.trim() || void 0,
|
|
472
|
+
api_key_env: q.value || void 0
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
be(
|
|
476
|
+
() => k.status.value,
|
|
477
|
+
(s) => {
|
|
478
|
+
s === "complete" && b.value === "login" && L();
|
|
479
|
+
}
|
|
480
|
+
), Je(() => {
|
|
481
|
+
k.status.value === "running" && k.cancel().catch(() => {
|
|
482
|
+
});
|
|
483
|
+
});
|
|
484
|
+
const j = S(() => {
|
|
485
|
+
switch (k.status.value) {
|
|
486
|
+
case "running":
|
|
487
|
+
return k.urlPrompt.value || k.stdoutLines.value.length > 0 ? "streaming" : "connecting";
|
|
488
|
+
case "complete":
|
|
489
|
+
return "completed";
|
|
490
|
+
case "failed":
|
|
491
|
+
case "cancelled":
|
|
492
|
+
return "error";
|
|
493
|
+
default:
|
|
494
|
+
return "idle";
|
|
495
|
+
}
|
|
496
|
+
}), Re = S(() => k.errorMessage.value || "");
|
|
497
|
+
function Ve() {
|
|
498
|
+
k.status.value === "running" && k.cancel().catch(() => {
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
const Se = S(() => {
|
|
502
|
+
var s;
|
|
503
|
+
return ((s = f.value) == null ? void 0 : s.plan_options) ?? [];
|
|
504
|
+
}), ve = v(""), pe = v(!1), Z = v(!1), ye = v(""), W = v("idle"), $ = v(""), ee = v(""), _e = v(""), te = v(""), M = v(""), ae = v(!1), ne = v(!1), U = v(null), Ie = v(!1);
|
|
505
|
+
async function Fe() {
|
|
506
|
+
try {
|
|
507
|
+
const s = await p.cliproxyStatus();
|
|
508
|
+
ae.value = s.installed;
|
|
509
|
+
} catch (s) {
|
|
510
|
+
console.warn("[AccountWizard] cliproxy status check failed:", s), ae.value = !1;
|
|
511
|
+
} finally {
|
|
512
|
+
Ie.value = !0;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
async function Me() {
|
|
516
|
+
ne.value = !0, U.value = null;
|
|
517
|
+
try {
|
|
518
|
+
const s = await p.cliproxyInstall();
|
|
519
|
+
U.value = s, s.success && (ae.value = !0);
|
|
520
|
+
} catch (s) {
|
|
521
|
+
U.value = {
|
|
522
|
+
success: !1,
|
|
523
|
+
display: "install failed",
|
|
524
|
+
stdout: "",
|
|
525
|
+
stderr: s instanceof Error ? s.message : String(s),
|
|
526
|
+
binary_path: null
|
|
527
|
+
};
|
|
528
|
+
} finally {
|
|
529
|
+
ne.value = !1;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
function Pe() {
|
|
533
|
+
W.value = "idle", $.value = "", ee.value = "", _e.value = "", te.value = "", M.value = "";
|
|
534
|
+
}
|
|
535
|
+
async function Te() {
|
|
536
|
+
var s;
|
|
537
|
+
if (d.value) {
|
|
538
|
+
W.value = "running", $.value = `Registering ${x.value} account with API proxy…`, M.value = "";
|
|
539
|
+
try {
|
|
540
|
+
const t = await p.cliproxyLoginBegin(
|
|
541
|
+
d.value,
|
|
542
|
+
((s = z.value) == null ? void 0 : s.trim()) || void 0
|
|
543
|
+
);
|
|
544
|
+
$.value = t.message, t.status === "imported" ? W.value = "success" : t.status === "started" && t.oauth_url ? (W.value = "device_auth", ee.value = t.oauth_url, _e.value = t.device_code ?? "", t.device_code ? $.value = `Open the URL and enter code ${t.device_code}` : $.value = "Complete OAuth in the browser; paste the callback URL below if it fails to redirect") : t.status === "skipped" ? W.value = "skipped" : W.value = "error";
|
|
545
|
+
} catch (t) {
|
|
546
|
+
W.value = "error", $.value = t instanceof Error ? t.message : String(t);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
async function He() {
|
|
551
|
+
if (te.value.trim()) {
|
|
552
|
+
M.value = "";
|
|
553
|
+
try {
|
|
554
|
+
const s = await p.cliproxyCallbackForward(
|
|
555
|
+
te.value.trim()
|
|
556
|
+
);
|
|
557
|
+
s.status === "completed" ? (W.value = "success", $.value = "API proxy login completed") : M.value = s.message;
|
|
558
|
+
} catch (s) {
|
|
559
|
+
M.value = s instanceof Error ? s.message : String(s);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
async function qe() {
|
|
564
|
+
Z.value = !0, ye.value = "";
|
|
565
|
+
try {
|
|
566
|
+
const s = f.value;
|
|
567
|
+
if (!s) throw new Error("No backend metadata available");
|
|
568
|
+
const t = {
|
|
569
|
+
...We(),
|
|
570
|
+
plan: ve.value || void 0,
|
|
571
|
+
is_default: pe.value
|
|
572
|
+
};
|
|
573
|
+
if (N.value)
|
|
574
|
+
await p.updateBackend(N.value, {
|
|
575
|
+
display_name: w.value.trim() || s.display_name,
|
|
576
|
+
config: t
|
|
577
|
+
});
|
|
578
|
+
else {
|
|
579
|
+
const r = await p.createBackend({
|
|
580
|
+
kind: s.kind,
|
|
581
|
+
display_name: w.value.trim() || s.display_name,
|
|
582
|
+
config: t
|
|
583
|
+
});
|
|
584
|
+
N.value = r.id;
|
|
585
|
+
}
|
|
586
|
+
b.value = "done", c("saved"), _({
|
|
587
|
+
type: "wizard.account.created",
|
|
588
|
+
backendKind: s.kind,
|
|
589
|
+
accountId: N.value
|
|
590
|
+
}), _({
|
|
591
|
+
type: "wizard.step",
|
|
592
|
+
backendKind: s.kind,
|
|
593
|
+
step: "done"
|
|
594
|
+
});
|
|
595
|
+
} catch (s) {
|
|
596
|
+
ye.value = s instanceof Error ? s.message : "Failed to save account";
|
|
597
|
+
} finally {
|
|
598
|
+
Z.value = !1;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
function Ge() {
|
|
602
|
+
u.value = "", w.value = "", B.value = "", z.value = "", R.value = !1, ve.value = "", pe.value = !1, Ve(), N.value = "", de.value = !1, b.value = "subscription", c("addAnother"), d.value && _({ type: "wizard.step", backendKind: d.value, step: "add-another" });
|
|
603
|
+
}
|
|
604
|
+
function fe() {
|
|
605
|
+
d.value && _({ type: "wizard.closed", backendKind: d.value, reason: "cancel" }), c("close");
|
|
606
|
+
}
|
|
607
|
+
function Ye() {
|
|
608
|
+
d.value && _({ type: "wizard.closed", backendKind: d.value, reason: "done" }), c("done", { accountId: N.value });
|
|
609
|
+
}
|
|
610
|
+
function je() {
|
|
611
|
+
d.value && _({ type: "wizard.closed", backendKind: d.value, reason: "skip" }), c("skip");
|
|
612
|
+
}
|
|
613
|
+
return (s, t) => (a(), n("div", Ct, [
|
|
614
|
+
e("div", zt, [
|
|
615
|
+
e("h3", null, o(i("accountWizard.addAccount")), 1),
|
|
616
|
+
e("button", {
|
|
617
|
+
class: "wizard-close",
|
|
618
|
+
onClick: fe
|
|
619
|
+
}, "×")
|
|
620
|
+
]),
|
|
621
|
+
d.value ? b.value !== "done" ? (a(), n("div", It, [
|
|
622
|
+
(a(!0), n(F, null, se(T.value, (r, O) => (a(), n("div", {
|
|
623
|
+
key: r,
|
|
624
|
+
class: V(["step-indicator", {
|
|
625
|
+
active: b.value === r,
|
|
626
|
+
completed: H.value > O,
|
|
627
|
+
clickable: O < H.value
|
|
628
|
+
}]),
|
|
629
|
+
onClick: (ke) => O < H.value ? b.value = r : void 0
|
|
64
630
|
}, [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
631
|
+
e("span", $t, [
|
|
632
|
+
H.value > O ? (a(), n("svg", At, [...t[11] || (t[11] = [
|
|
633
|
+
e("polyline", { points: "20 6 9 17 4 12" }, null, -1)
|
|
634
|
+
])])) : (a(), n(F, { key: 1 }, [
|
|
635
|
+
h(o(O + 1), 1)
|
|
636
|
+
], 64))
|
|
637
|
+
]),
|
|
638
|
+
e("span", Lt, o(he.value[r]), 1)
|
|
639
|
+
], 10, Pt))), 128))
|
|
640
|
+
])) : l("", !0) : (a(), n("div", xt, [
|
|
641
|
+
e("div", Wt, [
|
|
642
|
+
t[10] || (t[10] = e("p", { class: "step-question" }, "Select a backend to connect:", -1)),
|
|
643
|
+
$e(wt, {
|
|
644
|
+
onPick: t[0] || (t[0] = (r) => {
|
|
645
|
+
d.value = r, ze();
|
|
646
|
+
})
|
|
647
|
+
})
|
|
648
|
+
]),
|
|
649
|
+
e("div", St, [
|
|
650
|
+
e("button", {
|
|
651
|
+
class: "btn btn-secondary",
|
|
652
|
+
onClick: fe
|
|
653
|
+
}, o(i("common.cancel")), 1)
|
|
654
|
+
])
|
|
655
|
+
])),
|
|
656
|
+
d.value && b.value === "subscription" ? (a(), n("div", Bt, [
|
|
657
|
+
e("div", Et, [
|
|
658
|
+
e("p", Ot, "Do you already have a " + o(x.value) + " account?", 1),
|
|
659
|
+
e("div", Dt, [
|
|
660
|
+
e("label", {
|
|
661
|
+
class: V(["radio-card", { selected: u.value === "yes" }])
|
|
662
|
+
}, [
|
|
663
|
+
D(e("input", {
|
|
664
|
+
type: "radio",
|
|
665
|
+
"onUpdate:modelValue": t[1] || (t[1] = (r) => u.value = r),
|
|
666
|
+
value: "yes"
|
|
667
|
+
}, null, 512), [
|
|
668
|
+
[Ae, u.value]
|
|
669
|
+
]),
|
|
670
|
+
e("div", Kt, [
|
|
671
|
+
e("span", Nt, o(i("accountWizard.yesHaveAccount")), 1),
|
|
672
|
+
e("span", Ut, o(i("accountWizard.yesHaveAccountDesc")), 1)
|
|
673
|
+
])
|
|
674
|
+
], 2),
|
|
675
|
+
e("label", {
|
|
676
|
+
class: V(["radio-card", { selected: u.value === "no" }])
|
|
677
|
+
}, [
|
|
678
|
+
D(e("input", {
|
|
679
|
+
type: "radio",
|
|
680
|
+
"onUpdate:modelValue": t[2] || (t[2] = (r) => u.value = r),
|
|
681
|
+
value: "no"
|
|
682
|
+
}, null, 512), [
|
|
683
|
+
[Ae, u.value]
|
|
684
|
+
]),
|
|
685
|
+
e("div", Rt, [
|
|
686
|
+
e("span", Vt, o(i("accountWizard.noSkip")), 1),
|
|
687
|
+
e("span", Ft, o(i("accountWizard.noSkipDesc")), 1)
|
|
688
|
+
])
|
|
689
|
+
], 2)
|
|
690
|
+
]),
|
|
691
|
+
$e(Qe, { name: "slide-down" }, {
|
|
692
|
+
default: Ze(() => [
|
|
693
|
+
u.value === "yes" ? (a(), n("div", Mt, [
|
|
694
|
+
e("div", Tt, [
|
|
695
|
+
e("label", Ht, [
|
|
696
|
+
h(o(i("accountWizard.accountName")) + " ", 1),
|
|
697
|
+
t[12] || (t[12] = e("span", { class: "optional" }, "(optional)", -1))
|
|
698
|
+
]),
|
|
699
|
+
D(e("input", {
|
|
700
|
+
id: "wiz-name",
|
|
701
|
+
"onUpdate:modelValue": t[3] || (t[3] = (r) => w.value = r),
|
|
702
|
+
type: "text",
|
|
703
|
+
placeholder: i("accountWizard.accountNamePlaceholder"),
|
|
704
|
+
autofocus: "",
|
|
705
|
+
onInput: ce
|
|
706
|
+
}, null, 40, qt), [
|
|
707
|
+
[X, w.value]
|
|
708
|
+
])
|
|
709
|
+
]),
|
|
710
|
+
e("div", Gt, [
|
|
711
|
+
e("label", Yt, o(i("accountWizard.email")), 1),
|
|
712
|
+
D(e("input", {
|
|
713
|
+
id: "wiz-email",
|
|
714
|
+
"onUpdate:modelValue": t[4] || (t[4] = (r) => B.value = r),
|
|
715
|
+
type: "email",
|
|
716
|
+
placeholder: i("accountWizard.emailPlaceholder")
|
|
717
|
+
}, null, 8, jt), [
|
|
718
|
+
[X, B.value]
|
|
719
|
+
]),
|
|
720
|
+
e("small", null, o(i("accountWizard.emailHelp")), 1)
|
|
721
|
+
])
|
|
722
|
+
])) : l("", !0)
|
|
723
|
+
]),
|
|
724
|
+
_: 1
|
|
725
|
+
})
|
|
726
|
+
]),
|
|
727
|
+
e("div", Xt, [
|
|
728
|
+
e("button", {
|
|
729
|
+
class: "btn btn-secondary",
|
|
730
|
+
onClick: fe
|
|
731
|
+
}, o(i("common.cancel")), 1),
|
|
732
|
+
e("button", {
|
|
733
|
+
class: V(["btn", u.value === "no" ? "btn-outline" : "btn-primary"]),
|
|
734
|
+
disabled: !le.value,
|
|
735
|
+
onClick: C
|
|
736
|
+
}, [
|
|
737
|
+
h(o(u.value === "no" ? i("accountWizard.noSkip") : i("accountWizard.continueBtn")) + " ", 1),
|
|
738
|
+
t[13] || (t[13] = e("svg", {
|
|
739
|
+
viewBox: "0 0 24 24",
|
|
740
|
+
fill: "none",
|
|
741
|
+
stroke: "currentColor",
|
|
742
|
+
"stroke-width": "2",
|
|
743
|
+
width: "14",
|
|
744
|
+
height: "14"
|
|
745
|
+
}, [
|
|
746
|
+
e("polyline", { points: "9 18 15 12 9 6" })
|
|
747
|
+
], -1))
|
|
748
|
+
], 10, Jt)
|
|
749
|
+
])
|
|
750
|
+
])) : l("", !0),
|
|
751
|
+
d.value && b.value === "cli" ? (a(), n("div", Qt, [
|
|
752
|
+
e("div", Zt, [
|
|
753
|
+
e("div", {
|
|
754
|
+
class: V(["status-card", G.value ? "status-ok" : "status-warn"])
|
|
755
|
+
}, [
|
|
756
|
+
e("div", ea, [
|
|
757
|
+
ge.value ? (a(), n("div", ta)) : G.value ? (a(), n("svg", aa, [...t[14] || (t[14] = [
|
|
758
|
+
e("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }, null, -1),
|
|
759
|
+
e("polyline", { points: "22 4 12 14.01 9 11.01" }, null, -1)
|
|
760
|
+
])])) : (a(), n("svg", na, [...t[15] || (t[15] = [
|
|
761
|
+
e("circle", {
|
|
762
|
+
cx: "12",
|
|
763
|
+
cy: "12",
|
|
764
|
+
r: "10"
|
|
765
|
+
}, null, -1),
|
|
766
|
+
e("line", {
|
|
767
|
+
x1: "12",
|
|
768
|
+
y1: "8",
|
|
769
|
+
x2: "12",
|
|
770
|
+
y2: "12"
|
|
771
|
+
}, null, -1),
|
|
772
|
+
e("line", {
|
|
773
|
+
x1: "12",
|
|
774
|
+
y1: "16",
|
|
775
|
+
x2: "12.01",
|
|
776
|
+
y2: "16"
|
|
777
|
+
}, null, -1)
|
|
778
|
+
])]))
|
|
779
|
+
]),
|
|
780
|
+
e("div", sa, [
|
|
781
|
+
e("span", oa, o(x.value) + " CLI", 1),
|
|
782
|
+
G.value ? (a(), n("span", ia, o(i("accountWizard.cliInstalled")) + o(ue.value ? ` (${ue.value})` : ""), 1)) : (a(), n("span", la, o(i("accountWizard.cliNotInstalled")), 1))
|
|
783
|
+
]),
|
|
784
|
+
!G.value && !re.value ? (a(), n("button", {
|
|
785
|
+
key: 0,
|
|
786
|
+
class: "btn btn-primary btn-sm",
|
|
787
|
+
onClick: De
|
|
788
|
+
}, o(i("accountWizard.installCli")), 1)) : l("", !0),
|
|
789
|
+
re.value ? (a(), n("div", ca)) : l("", !0)
|
|
790
|
+
], 2),
|
|
791
|
+
Y.value ? (a(), n("div", ua, o(Y.value), 1)) : l("", !0),
|
|
792
|
+
E.value && E.value.success ? (a(), n("div", ra, " Installed" + o(E.value.binary_path ? ` at ${E.value.binary_path}` : ""), 1)) : l("", !0),
|
|
793
|
+
E.value && !E.value.success && E.value.stderr ? (a(), n("pre", da, o(E.value.stderr), 1)) : l("", !0),
|
|
794
|
+
z.value ? (a(), n("div", va, [
|
|
795
|
+
e("div", pa, o(i("accountWizard.configPath")), 1),
|
|
796
|
+
e("div", ya, [
|
|
797
|
+
e("code", null, o(z.value), 1),
|
|
798
|
+
de.value ? (a(), n("span", ka, [
|
|
799
|
+
t[16] || (t[16] = e("svg", {
|
|
800
|
+
viewBox: "0 0 24 24",
|
|
801
|
+
fill: "none",
|
|
802
|
+
stroke: "currentColor",
|
|
803
|
+
"stroke-width": "2",
|
|
804
|
+
width: "12",
|
|
805
|
+
height: "12"
|
|
806
|
+
}, [
|
|
807
|
+
e("polyline", { points: "20 6 9 17 4 12" })
|
|
808
|
+
], -1)),
|
|
809
|
+
h(" " + o(i("accountWizard.configCreated")), 1)
|
|
810
|
+
])) : (a(), n("button", {
|
|
811
|
+
key: 0,
|
|
812
|
+
class: "btn btn-outline btn-sm",
|
|
813
|
+
disabled: Ce.value,
|
|
814
|
+
onClick: Ke
|
|
815
|
+
}, o(Ce.value ? i("accountWizard.creating") : i("accountWizard.createDir")), 9, _a))
|
|
816
|
+
]),
|
|
817
|
+
me.value ? (a(), n("div", ba, o(me.value), 1)) : l("", !0),
|
|
818
|
+
e("div", ha, [
|
|
819
|
+
R.value ? l("", !0) : (a(), n("button", {
|
|
820
|
+
key: 0,
|
|
821
|
+
class: "btn-link-sm",
|
|
822
|
+
onClick: t[5] || (t[5] = (r) => R.value = !0)
|
|
823
|
+
}, o(i("accountWizard.customizePath")), 1)),
|
|
824
|
+
R.value ? (a(), n("div", ga, [
|
|
825
|
+
D(e("input", {
|
|
826
|
+
"onUpdate:modelValue": t[6] || (t[6] = (r) => z.value = r),
|
|
827
|
+
type: "text",
|
|
828
|
+
placeholder: `e.g., ~/.${d.value}-personal`
|
|
829
|
+
}, null, 8, ma), [
|
|
830
|
+
[X, z.value]
|
|
831
|
+
])
|
|
832
|
+
])) : l("", !0)
|
|
75
833
|
])
|
|
834
|
+
])) : l("", !0),
|
|
835
|
+
q.value ? (a(), n("div", fa, [
|
|
836
|
+
e("span", wa, o(i("accountWizard.apiKeyEnv")), 1),
|
|
837
|
+
e("code", null, o(q.value), 1)
|
|
838
|
+
])) : l("", !0)
|
|
839
|
+
]),
|
|
840
|
+
e("div", Ca, [
|
|
841
|
+
e("button", {
|
|
842
|
+
class: "btn btn-secondary",
|
|
843
|
+
onClick: g
|
|
844
|
+
}, [
|
|
845
|
+
t[17] || (t[17] = e("svg", {
|
|
846
|
+
viewBox: "0 0 24 24",
|
|
847
|
+
fill: "none",
|
|
848
|
+
stroke: "currentColor",
|
|
849
|
+
"stroke-width": "2",
|
|
850
|
+
width: "14",
|
|
851
|
+
height: "14"
|
|
852
|
+
}, [
|
|
853
|
+
e("polyline", { points: "15 18 9 12 15 6" })
|
|
854
|
+
], -1)),
|
|
855
|
+
h(" " + o(i("common.back")), 1)
|
|
76
856
|
]),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
857
|
+
e("button", {
|
|
858
|
+
class: "btn btn-primary",
|
|
859
|
+
onClick: L
|
|
860
|
+
}, [
|
|
861
|
+
h(o(i("accountWizard.continueBtn")) + " ", 1),
|
|
862
|
+
t[18] || (t[18] = e("svg", {
|
|
863
|
+
viewBox: "0 0 24 24",
|
|
864
|
+
fill: "none",
|
|
865
|
+
stroke: "currentColor",
|
|
866
|
+
"stroke-width": "2",
|
|
867
|
+
width: "14",
|
|
868
|
+
height: "14"
|
|
869
|
+
}, [
|
|
870
|
+
e("polyline", { points: "9 18 15 12 9 6" })
|
|
871
|
+
], -1))
|
|
872
|
+
])
|
|
873
|
+
])
|
|
874
|
+
])) : l("", !0),
|
|
875
|
+
d.value && b.value === "login" ? (a(), n("div", za, [
|
|
876
|
+
e("div", xa, [
|
|
877
|
+
j.value === "idle" || j.value === "connecting" ? (a(), n("div", Wa, [
|
|
878
|
+
t[19] || (t[19] = e("div", { class: "spinner-sm" }, null, -1)),
|
|
879
|
+
e("span", null, o(i("accountWizard.startingLogin")), 1)
|
|
880
|
+
])) : j.value === "streaming" ? (a(), et(yt, {
|
|
881
|
+
key: 1,
|
|
882
|
+
session: m(k)
|
|
883
|
+
}, null, 8, ["session"])) : j.value === "completed" ? (a(), n("div", Sa, [
|
|
884
|
+
t[20] || (t[20] = e("svg", {
|
|
885
|
+
viewBox: "0 0 24 24",
|
|
886
|
+
fill: "none",
|
|
887
|
+
stroke: "currentColor",
|
|
888
|
+
"stroke-width": "2",
|
|
889
|
+
width: "20",
|
|
890
|
+
height: "20"
|
|
891
|
+
}, [
|
|
892
|
+
e("polyline", { points: "20 6 9 17 4 12" })
|
|
893
|
+
], -1)),
|
|
894
|
+
e("span", null, o(i("accountWizard.loginCompleted")), 1)
|
|
895
|
+
])) : j.value === "error" ? (a(), n(F, { key: 3 }, [
|
|
896
|
+
e("div", Ia, [
|
|
897
|
+
t[21] || (t[21] = e("svg", {
|
|
898
|
+
viewBox: "0 0 24 24",
|
|
899
|
+
fill: "none",
|
|
900
|
+
stroke: "currentColor",
|
|
901
|
+
"stroke-width": "2",
|
|
902
|
+
width: "16",
|
|
903
|
+
height: "16"
|
|
904
|
+
}, [
|
|
905
|
+
e("circle", {
|
|
906
|
+
cx: "12",
|
|
907
|
+
cy: "12",
|
|
908
|
+
r: "10"
|
|
909
|
+
}),
|
|
910
|
+
e("line", {
|
|
911
|
+
x1: "15",
|
|
912
|
+
y1: "9",
|
|
913
|
+
x2: "9",
|
|
914
|
+
y2: "15"
|
|
915
|
+
}),
|
|
916
|
+
e("line", {
|
|
917
|
+
x1: "9",
|
|
918
|
+
y1: "9",
|
|
919
|
+
x2: "15",
|
|
920
|
+
y2: "15"
|
|
921
|
+
})
|
|
922
|
+
], -1)),
|
|
923
|
+
e("span", null, o(Re.value), 1)
|
|
924
|
+
]),
|
|
925
|
+
e("button", {
|
|
926
|
+
class: "btn btn-secondary",
|
|
927
|
+
style: { "margin-top": "12px" },
|
|
928
|
+
onClick: xe
|
|
929
|
+
}, o(i("accountWizard.tryAgain")), 1)
|
|
930
|
+
], 64)) : l("", !0)
|
|
931
|
+
]),
|
|
932
|
+
e("div", Pa, [
|
|
933
|
+
e("button", {
|
|
934
|
+
class: "btn btn-secondary",
|
|
935
|
+
onClick: g
|
|
936
|
+
}, [
|
|
937
|
+
t[22] || (t[22] = e("svg", {
|
|
938
|
+
viewBox: "0 0 24 24",
|
|
939
|
+
fill: "none",
|
|
940
|
+
stroke: "currentColor",
|
|
941
|
+
"stroke-width": "2",
|
|
942
|
+
width: "14",
|
|
943
|
+
height: "14"
|
|
944
|
+
}, [
|
|
945
|
+
e("polyline", { points: "15 18 9 12 15 6" })
|
|
946
|
+
], -1)),
|
|
947
|
+
h(" " + o(i("common.back")), 1)
|
|
948
|
+
]),
|
|
949
|
+
e("button", {
|
|
950
|
+
class: "btn btn-primary",
|
|
951
|
+
onClick: L
|
|
952
|
+
}, [
|
|
953
|
+
h(o(j.value === "idle" ? i("common.skip") : i("accountWizard.continueBtn")) + " ", 1),
|
|
954
|
+
t[23] || (t[23] = e("svg", {
|
|
955
|
+
viewBox: "0 0 24 24",
|
|
956
|
+
fill: "none",
|
|
957
|
+
stroke: "currentColor",
|
|
958
|
+
"stroke-width": "2",
|
|
959
|
+
width: "14",
|
|
960
|
+
height: "14"
|
|
961
|
+
}, [
|
|
962
|
+
e("polyline", { points: "9 18 15 12 9 6" })
|
|
963
|
+
], -1))
|
|
964
|
+
])
|
|
965
|
+
])
|
|
966
|
+
])) : l("", !0),
|
|
967
|
+
d.value && b.value === "proxy" ? (a(), n("div", $a, [
|
|
968
|
+
e("div", Aa, [
|
|
969
|
+
Ie.value && !ae.value ? (a(), n("div", La, [
|
|
970
|
+
t[25] || (t[25] = e("p", { class: "step-description" }, " CLIProxyAPI is not installed. Install it to expose this account through an OpenAI-compatible endpoint for other tools. ", -1)),
|
|
971
|
+
e("button", {
|
|
972
|
+
class: "btn btn-primary",
|
|
973
|
+
disabled: ne.value,
|
|
974
|
+
onClick: Me
|
|
975
|
+
}, [
|
|
976
|
+
ne.value ? (a(), n("div", Ea)) : l("", !0),
|
|
977
|
+
h(" " + o(ne.value ? "Installing cliproxyapi…" : "Install CLIProxyAPI"), 1)
|
|
978
|
+
], 8, Ba),
|
|
979
|
+
U.value ? (a(), n("div", Oa, [
|
|
980
|
+
U.value.success ? (a(), n("p", Da, " Installed" + o(U.value.binary_path ? ` at ${U.value.binary_path}` : ""), 1)) : (a(), n("div", Ka, [
|
|
981
|
+
t[24] || (t[24] = e("p", { class: "error-text" }, "Install failed", -1)),
|
|
982
|
+
U.value.stderr ? (a(), n("pre", Na, o(U.value.stderr), 1)) : l("", !0)
|
|
983
|
+
]))
|
|
984
|
+
])) : l("", !0)
|
|
985
|
+
])) : ae.value ? (a(), n("div", Ua, [
|
|
986
|
+
t[31] || (t[31] = e("h4", { class: "proxy-heading" }, "Register with API proxy", -1)),
|
|
987
|
+
t[32] || (t[32] = e("p", { class: "step-description" }, " Optional: register this account with CLIProxyAPI so other tools can reach it through an OpenAI-compatible endpoint. ", -1)),
|
|
988
|
+
W.value === "idle" ? (a(), n("button", {
|
|
989
|
+
key: 0,
|
|
990
|
+
class: "btn btn-primary",
|
|
991
|
+
onClick: Te
|
|
992
|
+
}, " Start proxy registration ")) : l("", !0),
|
|
993
|
+
W.value === "running" ? (a(), n("div", Ra, [
|
|
994
|
+
t[26] || (t[26] = e("div", { class: "spinner-sm" }, null, -1)),
|
|
995
|
+
e("span", null, o($.value), 1)
|
|
996
|
+
])) : l("", !0),
|
|
997
|
+
W.value === "device_auth" ? (a(), n("div", Va, [
|
|
998
|
+
e("p", null, o($.value), 1),
|
|
999
|
+
ee.value ? (a(), n("a", {
|
|
1000
|
+
key: 0,
|
|
1001
|
+
href: ee.value,
|
|
1002
|
+
target: "_blank",
|
|
1003
|
+
rel: "noopener",
|
|
1004
|
+
class: "proxy-oauth-link"
|
|
1005
|
+
}, o(ee.value), 9, Fa)) : l("", !0),
|
|
1006
|
+
_e.value ? (a(), n("p", Ma, [
|
|
1007
|
+
t[27] || (t[27] = h(" Code: ", -1)),
|
|
1008
|
+
e("code", null, o(_e.value), 1)
|
|
1009
|
+
])) : l("", !0),
|
|
1010
|
+
e("div", Ta, [
|
|
1011
|
+
e("label", Ha, [
|
|
1012
|
+
t[28] || (t[28] = h(" If the redirect to localhost fails, paste the callback URL: ", -1)),
|
|
1013
|
+
D(e("input", {
|
|
1014
|
+
"onUpdate:modelValue": t[7] || (t[7] = (r) => te.value = r),
|
|
1015
|
+
type: "url",
|
|
1016
|
+
placeholder: "http://localhost:8085/callback?code=..."
|
|
1017
|
+
}, null, 512), [
|
|
1018
|
+
[X, te.value]
|
|
1019
|
+
])
|
|
1020
|
+
]),
|
|
1021
|
+
e("button", {
|
|
1022
|
+
class: "btn btn-outline btn-sm",
|
|
1023
|
+
onClick: He
|
|
1024
|
+
}, " Submit callback "),
|
|
1025
|
+
M.value ? (a(), n("p", qa, o(M.value), 1)) : l("", !0)
|
|
1026
|
+
])
|
|
1027
|
+
])) : l("", !0),
|
|
1028
|
+
W.value === "success" ? (a(), n("div", Ga, [
|
|
1029
|
+
t[29] || (t[29] = e("svg", {
|
|
1030
|
+
viewBox: "0 0 24 24",
|
|
1031
|
+
fill: "none",
|
|
1032
|
+
stroke: "currentColor",
|
|
1033
|
+
"stroke-width": "2",
|
|
1034
|
+
width: "20",
|
|
1035
|
+
height: "20"
|
|
1036
|
+
}, [
|
|
1037
|
+
e("polyline", { points: "20 6 9 17 4 12" })
|
|
1038
|
+
], -1)),
|
|
1039
|
+
e("strong", null, o($.value || "Registered successfully"), 1)
|
|
1040
|
+
])) : l("", !0),
|
|
1041
|
+
W.value === "skipped" ? (a(), n("div", Ya, [
|
|
1042
|
+
e("p", null, o($.value), 1),
|
|
1043
|
+
e("button", {
|
|
1044
|
+
class: "btn btn-outline btn-sm",
|
|
1045
|
+
onClick: Pe
|
|
1046
|
+
}, "Retry")
|
|
1047
|
+
])) : l("", !0),
|
|
1048
|
+
W.value === "error" ? (a(), n("div", ja, [
|
|
1049
|
+
e("p", Xa, [
|
|
1050
|
+
t[30] || (t[30] = e("strong", null, "Error:", -1)),
|
|
1051
|
+
h(" " + o($.value), 1)
|
|
1052
|
+
]),
|
|
1053
|
+
e("button", {
|
|
1054
|
+
class: "btn btn-outline btn-sm",
|
|
1055
|
+
onClick: Pe
|
|
1056
|
+
}, "Retry")
|
|
1057
|
+
])) : l("", !0)
|
|
1058
|
+
])) : (a(), n("div", Ja, [...t[33] || (t[33] = [
|
|
1059
|
+
e("div", { class: "spinner-sm" }, null, -1),
|
|
1060
|
+
e("span", null, "Checking CLIProxyAPI status…", -1)
|
|
1061
|
+
])]))
|
|
1062
|
+
]),
|
|
1063
|
+
e("div", Qa, [
|
|
1064
|
+
e("button", {
|
|
1065
|
+
class: "btn btn-secondary",
|
|
1066
|
+
onClick: g
|
|
1067
|
+
}, [
|
|
1068
|
+
t[34] || (t[34] = e("svg", {
|
|
1069
|
+
viewBox: "0 0 24 24",
|
|
1070
|
+
fill: "none",
|
|
1071
|
+
stroke: "currentColor",
|
|
1072
|
+
"stroke-width": "2",
|
|
1073
|
+
width: "14",
|
|
1074
|
+
height: "14"
|
|
1075
|
+
}, [
|
|
1076
|
+
e("polyline", { points: "15 18 9 12 15 6" })
|
|
1077
|
+
], -1)),
|
|
1078
|
+
h(" " + o(i("common.back")), 1)
|
|
1079
|
+
]),
|
|
1080
|
+
e("button", {
|
|
1081
|
+
class: "btn btn-primary",
|
|
1082
|
+
onClick: L
|
|
1083
|
+
}, [
|
|
1084
|
+
h(o(W.value === "success" ? i("accountWizard.continueBtn") : i("common.skip")) + " ", 1),
|
|
1085
|
+
t[35] || (t[35] = e("svg", {
|
|
1086
|
+
viewBox: "0 0 24 24",
|
|
1087
|
+
fill: "none",
|
|
1088
|
+
stroke: "currentColor",
|
|
1089
|
+
"stroke-width": "2",
|
|
1090
|
+
width: "14",
|
|
1091
|
+
height: "14"
|
|
1092
|
+
}, [
|
|
1093
|
+
e("polyline", { points: "9 18 15 12 9 6" })
|
|
1094
|
+
], -1))
|
|
1095
|
+
])
|
|
1096
|
+
])
|
|
1097
|
+
])) : l("", !0),
|
|
1098
|
+
d.value && b.value === "plan" ? (a(), n("div", Za, [
|
|
1099
|
+
e("div", en, [
|
|
1100
|
+
e("div", tn, [
|
|
1101
|
+
e("div", an, [
|
|
1102
|
+
e("span", nn, o(i("accountWizard.accountName")), 1),
|
|
1103
|
+
e("span", sn, o(w.value), 1)
|
|
1104
|
+
]),
|
|
1105
|
+
B.value ? (a(), n("div", on, [
|
|
1106
|
+
e("span", ln, o(i("accountWizard.email")), 1),
|
|
1107
|
+
e("span", cn, o(B.value), 1)
|
|
1108
|
+
])) : l("", !0),
|
|
1109
|
+
z.value ? (a(), n("div", un, [
|
|
1110
|
+
e("span", rn, o(i("accountWizard.configPath")), 1),
|
|
1111
|
+
e("code", dn, o(z.value), 1)
|
|
1112
|
+
])) : l("", !0),
|
|
1113
|
+
q.value ? (a(), n("div", vn, [
|
|
1114
|
+
e("span", pn, o(i("accountWizard.apiKeyEnv")), 1),
|
|
1115
|
+
e("code", yn, o(q.value), 1)
|
|
1116
|
+
])) : l("", !0)
|
|
1117
|
+
]),
|
|
1118
|
+
Se.value.length > 0 ? (a(), n("div", _n, [
|
|
1119
|
+
e("label", kn, o(i("accountWizard.plan")), 1),
|
|
1120
|
+
D(e("select", {
|
|
1121
|
+
id: "wiz-plan",
|
|
1122
|
+
"onUpdate:modelValue": t[8] || (t[8] = (r) => ve.value = r)
|
|
1123
|
+
}, [
|
|
1124
|
+
e("option", bn, o(i("accountWizard.selectPlan")), 1),
|
|
1125
|
+
(a(!0), n(F, null, se(Se.value, (r) => (a(), n("option", {
|
|
1126
|
+
key: r.id,
|
|
1127
|
+
value: r.id
|
|
1128
|
+
}, o(r.label), 9, hn))), 128))
|
|
1129
|
+
], 512), [
|
|
1130
|
+
[tt, ve.value]
|
|
1131
|
+
])
|
|
1132
|
+
])) : l("", !0),
|
|
1133
|
+
e("div", gn, [
|
|
1134
|
+
e("label", null, [
|
|
1135
|
+
D(e("input", {
|
|
1136
|
+
type: "checkbox",
|
|
1137
|
+
"onUpdate:modelValue": t[9] || (t[9] = (r) => pe.value = r)
|
|
1138
|
+
}, null, 512), [
|
|
1139
|
+
[at, pe.value]
|
|
1140
|
+
]),
|
|
1141
|
+
h(" " + o(i("accountWizard.setDefault")), 1)
|
|
1142
|
+
])
|
|
1143
|
+
]),
|
|
1144
|
+
ye.value ? (a(), n("div", mn, o(ye.value), 1)) : l("", !0)
|
|
1145
|
+
]),
|
|
1146
|
+
e("div", fn, [
|
|
1147
|
+
e("button", {
|
|
1148
|
+
class: "btn btn-secondary",
|
|
1149
|
+
onClick: g
|
|
1150
|
+
}, [
|
|
1151
|
+
t[36] || (t[36] = e("svg", {
|
|
1152
|
+
viewBox: "0 0 24 24",
|
|
1153
|
+
fill: "none",
|
|
1154
|
+
stroke: "currentColor",
|
|
1155
|
+
"stroke-width": "2",
|
|
1156
|
+
width: "14",
|
|
1157
|
+
height: "14"
|
|
1158
|
+
}, [
|
|
1159
|
+
e("polyline", { points: "15 18 9 12 15 6" })
|
|
1160
|
+
], -1)),
|
|
1161
|
+
h(" " + o(i("common.back")), 1)
|
|
1162
|
+
]),
|
|
1163
|
+
e("button", {
|
|
1164
|
+
class: "btn btn-primary",
|
|
1165
|
+
disabled: Z.value,
|
|
1166
|
+
onClick: qe
|
|
1167
|
+
}, [
|
|
1168
|
+
Z.value ? (a(), n("div", Cn)) : l("", !0),
|
|
1169
|
+
h(" " + o(Z.value ? i("accountWizard.saving") : i("accountWizard.saveAccount")), 1)
|
|
1170
|
+
], 8, wn)
|
|
1171
|
+
])
|
|
1172
|
+
])) : l("", !0),
|
|
1173
|
+
d.value && b.value === "done" ? (a(), n("div", zn, [
|
|
1174
|
+
e("div", xn, [
|
|
1175
|
+
t[37] || (t[37] = e("div", { class: "done-icon" }, [
|
|
1176
|
+
e("svg", {
|
|
1177
|
+
viewBox: "0 0 24 24",
|
|
1178
|
+
fill: "none",
|
|
1179
|
+
stroke: "currentColor",
|
|
1180
|
+
"stroke-width": "2",
|
|
1181
|
+
width: "40",
|
|
1182
|
+
height: "40"
|
|
1183
|
+
}, [
|
|
1184
|
+
e("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
|
|
1185
|
+
e("polyline", { points: "22 4 12 14.01 9 11.01" })
|
|
1186
|
+
])
|
|
1187
|
+
], -1)),
|
|
1188
|
+
e("h4", null, o(i("accountWizard.accountCreated")), 1),
|
|
1189
|
+
e("p", null, o(w.value) + " has been added to " + o(x.value) + ".", 1),
|
|
1190
|
+
e("div", Wn, [
|
|
1191
|
+
e("button", {
|
|
1192
|
+
class: "btn btn-outline",
|
|
1193
|
+
onClick: Ge
|
|
1194
|
+
}, o(i("accountWizard.addAnother")), 1),
|
|
1195
|
+
e("button", {
|
|
1196
|
+
class: "btn btn-primary",
|
|
1197
|
+
onClick: Ye
|
|
1198
|
+
}, o(i("accountWizard.doneNextBackend")), 1)
|
|
1199
|
+
])
|
|
1200
|
+
])
|
|
1201
|
+
])) : l("", !0)
|
|
1202
|
+
]));
|
|
100
1203
|
}
|
|
101
|
-
}),
|
|
102
|
-
const r = v.__vccOpts || v;
|
|
103
|
-
for (const [g, e] of k)
|
|
104
|
-
r[g] = e;
|
|
105
|
-
return r;
|
|
106
|
-
}, Fe = /* @__PURE__ */ W(se, [["__scopeId", "data-v-50cd8832"]]), de = { class: "aia-onboarding" }, le = { class: "aia-onboarding__header" }, re = {
|
|
1204
|
+
}), ts = /* @__PURE__ */ ie(Sn, [["__scopeId", "data-v-446a4d65"]]), In = { class: "aia-onboarding" }, Pn = { class: "aia-onboarding__header" }, $n = {
|
|
107
1205
|
key: 0,
|
|
108
1206
|
class: "aia-onboarding__welcome"
|
|
109
|
-
},
|
|
1207
|
+
}, An = {
|
|
110
1208
|
key: 1,
|
|
111
1209
|
class: "aia-onboarding__status"
|
|
112
|
-
},
|
|
1210
|
+
}, Ln = {
|
|
113
1211
|
key: 2,
|
|
114
1212
|
class: "aia-onboarding__kind-grid"
|
|
115
|
-
},
|
|
1213
|
+
}, Bn = ["disabled", "onClick"], En = { class: "aia-kind-card__name" }, On = {
|
|
116
1214
|
key: 0,
|
|
117
1215
|
class: "aia-kind-card__badge"
|
|
118
|
-
},
|
|
1216
|
+
}, Dn = {
|
|
119
1217
|
key: 1,
|
|
120
1218
|
class: "aia-kind-card__badge aia-kind-card__badge--missing"
|
|
121
|
-
},
|
|
1219
|
+
}, Kn = {
|
|
122
1220
|
key: 3,
|
|
123
1221
|
class: "aia-onboarding__login"
|
|
124
|
-
},
|
|
1222
|
+
}, Nn = { class: "aia-onboarding__tabs" }, Un = { class: "aia-label" }, Rn = {
|
|
125
1223
|
key: 1,
|
|
126
1224
|
class: "aia-onboarding__oauth-start"
|
|
127
|
-
},
|
|
1225
|
+
}, Vn = {
|
|
128
1226
|
key: 4,
|
|
129
1227
|
class: "aia-onboarding__oauth-challenge"
|
|
130
|
-
},
|
|
1228
|
+
}, Fn = ["href"], Mn = { class: "aia-code-display" }, Tn = {
|
|
131
1229
|
key: 5,
|
|
132
1230
|
class: "aia-onboarding__status"
|
|
133
|
-
},
|
|
1231
|
+
}, Hn = {
|
|
134
1232
|
key: 6,
|
|
135
1233
|
class: "aia-onboarding__success"
|
|
136
|
-
},
|
|
1234
|
+
}, qn = {
|
|
137
1235
|
key: 7,
|
|
138
1236
|
class: "aia-onboarding__error"
|
|
139
|
-
},
|
|
1237
|
+
}, Gn = /* @__PURE__ */ oe({
|
|
140
1238
|
__name: "OnboardingFlow",
|
|
141
1239
|
props: {
|
|
142
1240
|
client: {},
|
|
@@ -144,173 +1242,250 @@ const J = { class: "aia-wizard" }, Q = { class: "aia-wizard__header" }, X = {
|
|
|
144
1242
|
supportedFlowsByKind: {}
|
|
145
1243
|
},
|
|
146
1244
|
emits: ["done", "cancel"],
|
|
147
|
-
setup(
|
|
148
|
-
const
|
|
1245
|
+
setup(y, { emit: A }) {
|
|
1246
|
+
const i = y, I = A, c = ot({ client: i.client }), p = v(""), _ = v("api_key"), P = [
|
|
149
1247
|
{ id: "claude", display: "Claude" },
|
|
150
1248
|
{ id: "opencode", display: "OpenCode" },
|
|
151
1249
|
{ id: "gemini", display: "Gemini" },
|
|
152
1250
|
{ id: "codex", display: "Codex" }
|
|
153
|
-
],
|
|
1251
|
+
], k = {
|
|
154
1252
|
claude: ["api_key"],
|
|
155
1253
|
opencode: ["api_key"],
|
|
156
1254
|
gemini: ["api_key", "oauth_device"],
|
|
157
1255
|
codex: ["api_key", "oauth_device"]
|
|
158
|
-
},
|
|
159
|
-
() =>
|
|
160
|
-
),
|
|
161
|
-
const
|
|
162
|
-
return
|
|
1256
|
+
}, d = S(() => i.kinds ?? P), f = S(
|
|
1257
|
+
() => i.supportedFlowsByKind ?? k
|
|
1258
|
+
), x = S(() => {
|
|
1259
|
+
const g = c.selectedKind.value;
|
|
1260
|
+
return g ? f.value[g] ?? ["api_key"] : ["api_key"];
|
|
163
1261
|
});
|
|
164
|
-
async function
|
|
165
|
-
await
|
|
1262
|
+
async function b() {
|
|
1263
|
+
await c.start(), c.state.value !== "error" && await c.detect();
|
|
166
1264
|
}
|
|
167
|
-
async function
|
|
168
|
-
await
|
|
169
|
-
const
|
|
170
|
-
|
|
1265
|
+
async function K(g) {
|
|
1266
|
+
await c.pickKind(g);
|
|
1267
|
+
const u = x.value;
|
|
1268
|
+
_.value = u[0] ?? "api_key";
|
|
171
1269
|
}
|
|
172
|
-
async function
|
|
173
|
-
await
|
|
1270
|
+
async function J() {
|
|
1271
|
+
await c.submitApiKey(p.value);
|
|
174
1272
|
}
|
|
175
|
-
async function
|
|
176
|
-
await
|
|
1273
|
+
async function T() {
|
|
1274
|
+
await c.submitOauthDevice();
|
|
177
1275
|
}
|
|
178
|
-
|
|
179
|
-
() =>
|
|
180
|
-
(
|
|
181
|
-
|
|
1276
|
+
be(
|
|
1277
|
+
() => c.state.value,
|
|
1278
|
+
(g) => {
|
|
1279
|
+
g === "done" && c.createdBackendId.value && I("done", c.createdBackendId.value);
|
|
182
1280
|
},
|
|
183
1281
|
{ immediate: !1 }
|
|
184
1282
|
);
|
|
185
|
-
function
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
function
|
|
189
|
-
var
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
function
|
|
194
|
-
var
|
|
195
|
-
return (
|
|
196
|
-
}
|
|
197
|
-
return (
|
|
198
|
-
var
|
|
199
|
-
return
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
1283
|
+
function H() {
|
|
1284
|
+
c.reset();
|
|
1285
|
+
}
|
|
1286
|
+
function he() {
|
|
1287
|
+
var u;
|
|
1288
|
+
const g = (u = c.oauthChallenge.value) == null ? void 0 : u.user_code;
|
|
1289
|
+
g && typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(g);
|
|
1290
|
+
}
|
|
1291
|
+
function L(g) {
|
|
1292
|
+
var u, w;
|
|
1293
|
+
return (w = (u = c.kinds.value) == null ? void 0 : u.find((B) => B.id === g)) == null ? void 0 : w.detection;
|
|
1294
|
+
}
|
|
1295
|
+
return (g, u) => {
|
|
1296
|
+
var w, B, le;
|
|
1297
|
+
return a(), n("section", In, [
|
|
1298
|
+
e("header", Pn, [
|
|
1299
|
+
Le(g.$slots, "header", {}, () => [
|
|
1300
|
+
u[4] || (u[4] = e("h2", null, "Set up an AI backend", -1))
|
|
203
1301
|
], !0)
|
|
204
1302
|
]),
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
1303
|
+
m(c).state.value === "idle" ? (a(), n("div", $n, [
|
|
1304
|
+
u[5] || (u[5] = e("p", null, "Connect one of the supported AI CLIs to get started.", -1)),
|
|
1305
|
+
e("button", {
|
|
208
1306
|
type: "button",
|
|
209
1307
|
class: "aia-btn aia-btn--primary",
|
|
210
|
-
onClick:
|
|
1308
|
+
onClick: b
|
|
211
1309
|
}, " Get started ")
|
|
212
|
-
])) :
|
|
213
|
-
(
|
|
214
|
-
var
|
|
215
|
-
return
|
|
216
|
-
key:
|
|
1310
|
+
])) : m(c).state.value === "started" || m(c).state.value === "detecting" ? (a(), n("div", An, " Detecting installed CLIs… ")) : m(c).state.value === "picking_kind" ? (a(), n("div", Ln, [
|
|
1311
|
+
(a(!0), n(F, null, se(d.value, (C) => {
|
|
1312
|
+
var z, R, Q, ce;
|
|
1313
|
+
return a(), n("button", {
|
|
1314
|
+
key: C.id,
|
|
217
1315
|
type: "button",
|
|
218
|
-
class:
|
|
219
|
-
"aia-kind-card--installed": (
|
|
220
|
-
"aia-kind-card--missing":
|
|
1316
|
+
class: V(["aia-kind-card", {
|
|
1317
|
+
"aia-kind-card--installed": (z = L(C.id)) == null ? void 0 : z.installed,
|
|
1318
|
+
"aia-kind-card--missing": L(C.id) && !((R = L(C.id)) != null && R.installed)
|
|
221
1319
|
}]),
|
|
222
|
-
disabled: !((
|
|
223
|
-
onClick: (
|
|
1320
|
+
disabled: !((Q = L(C.id)) != null && Q.installed),
|
|
1321
|
+
onClick: (q) => K(C.id)
|
|
224
1322
|
}, [
|
|
225
|
-
|
|
226
|
-
(
|
|
227
|
-
], 10,
|
|
1323
|
+
e("span", En, o(C.display), 1),
|
|
1324
|
+
(ce = L(C.id)) != null && ce.installed ? (a(), n("span", On, " Installed ")) : (a(), n("span", Dn, " Not installed "))
|
|
1325
|
+
], 10, Bn);
|
|
228
1326
|
}), 128))
|
|
229
|
-
])) :
|
|
230
|
-
|
|
231
|
-
|
|
1327
|
+
])) : m(c).state.value === "entering_credential" ? (a(), n("div", Kn, [
|
|
1328
|
+
e("div", Nn, [
|
|
1329
|
+
x.value.includes("api_key") ? (a(), n("button", {
|
|
232
1330
|
key: 0,
|
|
233
1331
|
type: "button",
|
|
234
|
-
class:
|
|
235
|
-
onClick:
|
|
236
|
-
}, " API key ", 2)) :
|
|
237
|
-
|
|
1332
|
+
class: V(["aia-tab", { "aia-tab--active": _.value === "api_key" }]),
|
|
1333
|
+
onClick: u[0] || (u[0] = (C) => _.value = "api_key")
|
|
1334
|
+
}, " API key ", 2)) : l("", !0),
|
|
1335
|
+
x.value.includes("oauth_device") ? (a(), n("button", {
|
|
238
1336
|
key: 1,
|
|
239
1337
|
type: "button",
|
|
240
|
-
class:
|
|
241
|
-
onClick:
|
|
242
|
-
}, " Login with browser ", 2)) :
|
|
1338
|
+
class: V(["aia-tab", { "aia-tab--active": _.value === "oauth_device" }]),
|
|
1339
|
+
onClick: u[1] || (u[1] = (C) => _.value = "oauth_device")
|
|
1340
|
+
}, " Login with browser ", 2)) : l("", !0)
|
|
243
1341
|
]),
|
|
244
|
-
|
|
1342
|
+
_.value === "api_key" ? (a(), n("form", {
|
|
245
1343
|
key: 0,
|
|
246
1344
|
class: "aia-onboarding__form",
|
|
247
|
-
onSubmit:
|
|
1345
|
+
onSubmit: we(J, ["prevent"])
|
|
248
1346
|
}, [
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
"onUpdate:modelValue":
|
|
1347
|
+
e("label", Un, [
|
|
1348
|
+
u[6] || (u[6] = h(" API key ", -1)),
|
|
1349
|
+
D(e("input", {
|
|
1350
|
+
"onUpdate:modelValue": u[2] || (u[2] = (C) => p.value = C),
|
|
253
1351
|
type: "password",
|
|
254
1352
|
class: "aia-input",
|
|
255
1353
|
autocomplete: "off",
|
|
256
1354
|
required: ""
|
|
257
1355
|
}, null, 512), [
|
|
258
|
-
[
|
|
1356
|
+
[X, p.value]
|
|
259
1357
|
])
|
|
260
1358
|
]),
|
|
261
|
-
|
|
1359
|
+
u[7] || (u[7] = e("button", {
|
|
262
1360
|
type: "submit",
|
|
263
1361
|
class: "aia-btn aia-btn--primary"
|
|
264
1362
|
}, "Connect", -1))
|
|
265
|
-
], 32)) :
|
|
266
|
-
|
|
267
|
-
|
|
1363
|
+
], 32)) : _.value === "oauth_device" ? (a(), n("div", Rn, [
|
|
1364
|
+
u[8] || (u[8] = e("p", null, "You'll be shown a verification URL and code. Open it in your browser to sign in.", -1)),
|
|
1365
|
+
e("button", {
|
|
268
1366
|
type: "button",
|
|
269
1367
|
class: "aia-btn aia-btn--primary",
|
|
270
|
-
onClick:
|
|
1368
|
+
onClick: T
|
|
271
1369
|
}, " Start browser login ")
|
|
272
|
-
])) :
|
|
273
|
-
])) :
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
href: (
|
|
1370
|
+
])) : l("", !0)
|
|
1371
|
+
])) : m(c).state.value === "oauth_challenge" || m(c).state.value === "oauth_polling" ? (a(), n("div", Vn, [
|
|
1372
|
+
u[9] || (u[9] = e("p", null, "Open this URL in your browser and enter the code:", -1)),
|
|
1373
|
+
e("a", {
|
|
1374
|
+
href: (w = m(c).oauthChallenge.value) == null ? void 0 : w.verification_uri,
|
|
277
1375
|
target: "_blank",
|
|
278
1376
|
rel: "noopener noreferrer",
|
|
279
1377
|
class: "aia-onboarding__oauth-uri"
|
|
280
|
-
},
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
1378
|
+
}, o((B = m(c).oauthChallenge.value) == null ? void 0 : B.verification_uri), 9, Fn),
|
|
1379
|
+
e("div", Mn, [
|
|
1380
|
+
e("code", null, o((le = m(c).oauthChallenge.value) == null ? void 0 : le.user_code), 1),
|
|
1381
|
+
e("button", {
|
|
284
1382
|
type: "button",
|
|
285
1383
|
class: "aia-copy-btn",
|
|
286
|
-
onClick:
|
|
1384
|
+
onClick: he
|
|
287
1385
|
}, "Copy")
|
|
288
1386
|
]),
|
|
289
|
-
|
|
290
|
-
|
|
1387
|
+
u[10] || (u[10] = e("p", { class: "aia-onboarding__hint" }, "Waiting for you to complete sign-in…", -1)),
|
|
1388
|
+
e("button", {
|
|
291
1389
|
type: "button",
|
|
292
1390
|
class: "aia-btn",
|
|
293
|
-
onClick:
|
|
294
|
-
(...
|
|
1391
|
+
onClick: u[3] || (u[3] = //@ts-ignore
|
|
1392
|
+
(...C) => m(c).cancelOAuth && m(c).cancelOAuth(...C))
|
|
295
1393
|
}, "Cancel")
|
|
296
|
-
])) :
|
|
297
|
-
|
|
298
|
-
|
|
1394
|
+
])) : m(c).state.value === "validating" ? (a(), n("div", Tn, " Validating credential… ")) : m(c).state.value === "done" ? (a(), n("div", Hn, [
|
|
1395
|
+
Le(g.$slots, "success", {}, () => [
|
|
1396
|
+
u[11] || (u[11] = e("p", null, "✓ Connected successfully", -1))
|
|
299
1397
|
], !0)
|
|
300
|
-
])) :
|
|
301
|
-
|
|
302
|
-
|
|
1398
|
+
])) : m(c).state.value === "error" ? (a(), n("div", qn, [
|
|
1399
|
+
e("p", null, o(m(c).error.value), 1),
|
|
1400
|
+
e("button", {
|
|
303
1401
|
type: "button",
|
|
304
1402
|
class: "aia-btn",
|
|
305
|
-
onClick:
|
|
1403
|
+
onClick: H
|
|
306
1404
|
}, "Try again")
|
|
307
|
-
])) :
|
|
1405
|
+
])) : l("", !0)
|
|
308
1406
|
]);
|
|
309
1407
|
};
|
|
310
1408
|
}
|
|
311
|
-
}),
|
|
1409
|
+
}), as = /* @__PURE__ */ ie(Gn, [["__scopeId", "data-v-8c20d7e7"]]), Yn = ["value", "type", "onInput"], jn = { class: "aia-actions" }, Xn = ["disabled"], Jn = {
|
|
1410
|
+
key: 0,
|
|
1411
|
+
class: "aia-error"
|
|
1412
|
+
}, Qn = /* @__PURE__ */ oe({
|
|
1413
|
+
__name: "AccountEditForm",
|
|
1414
|
+
props: {
|
|
1415
|
+
account: {},
|
|
1416
|
+
metadata: {}
|
|
1417
|
+
},
|
|
1418
|
+
emits: ["saved", "cancel"],
|
|
1419
|
+
setup(y, { emit: A }) {
|
|
1420
|
+
const i = y, I = A, { client: c } = Oe(), p = nt({
|
|
1421
|
+
display_name: i.account.display_name,
|
|
1422
|
+
config: { ...i.account.config }
|
|
1423
|
+
}), _ = v(!1), P = v(null), k = S(
|
|
1424
|
+
() => {
|
|
1425
|
+
var f;
|
|
1426
|
+
return ((f = i.metadata.config_schema) == null ? void 0 : f.properties) ?? {};
|
|
1427
|
+
}
|
|
1428
|
+
);
|
|
1429
|
+
async function d() {
|
|
1430
|
+
_.value = !0, P.value = null;
|
|
1431
|
+
try {
|
|
1432
|
+
const f = await c.updateBackend(i.account.id, {
|
|
1433
|
+
display_name: p.display_name,
|
|
1434
|
+
config: p.config
|
|
1435
|
+
});
|
|
1436
|
+
I("saved", f);
|
|
1437
|
+
} catch (f) {
|
|
1438
|
+
P.value = f instanceof Error ? f.message : String(f);
|
|
1439
|
+
} finally {
|
|
1440
|
+
_.value = !1;
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
return (f, x) => (a(), n("form", {
|
|
1444
|
+
class: "aia-account-edit",
|
|
1445
|
+
onSubmit: we(d, ["prevent"])
|
|
1446
|
+
}, [
|
|
1447
|
+
e("label", null, [
|
|
1448
|
+
x[2] || (x[2] = h(" Display name ", -1)),
|
|
1449
|
+
D(e("input", {
|
|
1450
|
+
"onUpdate:modelValue": x[0] || (x[0] = (b) => p.display_name = b),
|
|
1451
|
+
type: "text",
|
|
1452
|
+
required: ""
|
|
1453
|
+
}, null, 512), [
|
|
1454
|
+
[X, p.display_name]
|
|
1455
|
+
])
|
|
1456
|
+
]),
|
|
1457
|
+
(a(!0), n(F, null, se(k.value, (b, K) => (a(), n("div", {
|
|
1458
|
+
key: K,
|
|
1459
|
+
class: "aia-field"
|
|
1460
|
+
}, [
|
|
1461
|
+
e("label", null, [
|
|
1462
|
+
h(o(K) + " ", 1),
|
|
1463
|
+
e("input", {
|
|
1464
|
+
value: p.config[K] ?? "",
|
|
1465
|
+
type: String(K).toLowerCase().includes("secret") || String(K).toLowerCase().includes("key") ? "password" : "text",
|
|
1466
|
+
onInput: (J) => p.config[K] = J.target.value
|
|
1467
|
+
}, null, 40, Yn)
|
|
1468
|
+
])
|
|
1469
|
+
]))), 128)),
|
|
1470
|
+
e("div", jn, [
|
|
1471
|
+
e("button", {
|
|
1472
|
+
type: "submit",
|
|
1473
|
+
disabled: _.value
|
|
1474
|
+
}, o(_.value ? "Saving…" : "Save"), 9, Xn),
|
|
1475
|
+
e("button", {
|
|
1476
|
+
type: "button",
|
|
1477
|
+
onClick: x[1] || (x[1] = (b) => I("cancel"))
|
|
1478
|
+
}, "Cancel")
|
|
1479
|
+
]),
|
|
1480
|
+
P.value ? (a(), n("p", Jn, o(P.value), 1)) : l("", !0)
|
|
1481
|
+
], 32));
|
|
1482
|
+
}
|
|
1483
|
+
}), ns = /* @__PURE__ */ ie(Qn, [["__scopeId", "data-v-56b7b8c3"]]), ss = "0.2.0";
|
|
312
1484
|
export {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
1485
|
+
ns as AccountEditForm,
|
|
1486
|
+
ts as AccountWizard,
|
|
1487
|
+
wt as BackendPicker,
|
|
1488
|
+
yt as LoginStream,
|
|
1489
|
+
as as OnboardingFlow,
|
|
1490
|
+
ss as version
|
|
316
1491
|
};
|