@dexto/tui 1.8.1 → 1.8.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/components/overlays/ConnectOverlay.cjs +423 -0
- package/dist/components/overlays/ConnectOverlay.d.ts +21 -0
- package/dist/components/overlays/ConnectOverlay.d.ts.map +1 -0
- package/dist/components/overlays/ConnectOverlay.js +412 -0
- package/dist/containers/OverlayContainer.cjs +58 -0
- package/dist/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/containers/OverlayContainer.js +58 -0
- package/dist/interactive-commands/auth/index.cjs +9 -0
- package/dist/interactive-commands/auth/index.d.ts +1 -0
- package/dist/interactive-commands/auth/index.d.ts.map +1 -1
- package/dist/interactive-commands/auth/index.js +8 -0
- package/dist/interactive-commands/commands.cjs +3 -1
- package/dist/interactive-commands/commands.d.ts.map +1 -1
- package/dist/interactive-commands/commands.js +4 -2
- package/dist/state/types.d.ts +1 -1
- package/dist/state/types.d.ts.map +1 -1
- package/dist/utils/commandOverlays.cjs +1 -0
- package/dist/utils/commandOverlays.d.ts.map +1 -1
- package/dist/utils/commandOverlays.js +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var ConnectOverlay_exports = {};
|
|
30
|
+
__export(ConnectOverlay_exports, {
|
|
31
|
+
default: () => ConnectOverlay_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(ConnectOverlay_exports);
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_ink = require("ink");
|
|
37
|
+
var import_open = __toESM(require("open"), 1);
|
|
38
|
+
var import_BaseSelector = require("../base/BaseSelector.js");
|
|
39
|
+
var import_agent_management = require("@dexto/agent-management");
|
|
40
|
+
var import_llm = require("@dexto/llm");
|
|
41
|
+
var import_host = require("../../host/index.js");
|
|
42
|
+
function methodHint(method, profile, defaultProfileId) {
|
|
43
|
+
const parts = [
|
|
44
|
+
profile ? profile.id === defaultProfileId ? "Connected (default)" : "Connected" : void 0,
|
|
45
|
+
method.hint
|
|
46
|
+
].filter((part) => Boolean(part));
|
|
47
|
+
return parts.length ? parts.join(" - ") : void 0;
|
|
48
|
+
}
|
|
49
|
+
function maskSecret(secret) {
|
|
50
|
+
if (secret.length <= 8) {
|
|
51
|
+
return "*".repeat(secret.length);
|
|
52
|
+
}
|
|
53
|
+
return `${secret.slice(0, 4)}${"*".repeat(Math.min(secret.length - 8, 24))}${secret.slice(-4)}`;
|
|
54
|
+
}
|
|
55
|
+
function toLlmProvider(providerId) {
|
|
56
|
+
const provider = import_llm.LLM_PROVIDERS.find((candidate) => candidate === providerId);
|
|
57
|
+
if (!provider) {
|
|
58
|
+
throw new Error(`API-key auth is not implemented for provider: ${providerId}`);
|
|
59
|
+
}
|
|
60
|
+
return provider;
|
|
61
|
+
}
|
|
62
|
+
const ConnectOverlay = (0, import_react.forwardRef)(
|
|
63
|
+
function ConnectOverlay2({ isVisible, onDone }, ref) {
|
|
64
|
+
const selectorRef = (0, import_react.useRef)(null);
|
|
65
|
+
const loginCancelRef = (0, import_react.useRef)(null);
|
|
66
|
+
const [step, setStep] = (0, import_react.useState)("provider");
|
|
67
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react.useState)(0);
|
|
68
|
+
const [provider, setProvider] = (0, import_react.useState)(null);
|
|
69
|
+
const [method, setMethod] = (0, import_react.useState)(null);
|
|
70
|
+
const [profiles, setProfiles] = (0, import_react.useState)([]);
|
|
71
|
+
const [defaultProfileId, setDefaultProfileId] = (0, import_react.useState)(null);
|
|
72
|
+
const [apiKey, setApiKey] = (0, import_react.useState)("");
|
|
73
|
+
const [status, setStatus] = (0, import_react.useState)("Choose a provider to connect.");
|
|
74
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
75
|
+
const currentProfileId = provider && method ? (0, import_agent_management.getModelAuthProfileId)(provider.providerId, method.id) : null;
|
|
76
|
+
const existingProfile = currentProfileId ? profiles.find((profile) => profile.id === currentProfileId) ?? null : null;
|
|
77
|
+
const close = (0, import_react.useCallback)(
|
|
78
|
+
(outcome) => {
|
|
79
|
+
void loginCancelRef.current?.();
|
|
80
|
+
loginCancelRef.current = null;
|
|
81
|
+
onDone(outcome);
|
|
82
|
+
},
|
|
83
|
+
[onDone]
|
|
84
|
+
);
|
|
85
|
+
const handleActionError = (0, import_react.useCallback)((err) => {
|
|
86
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
87
|
+
setStep("error");
|
|
88
|
+
}, []);
|
|
89
|
+
(0, import_react.useEffect)(() => {
|
|
90
|
+
if (!isVisible) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
setStep("provider");
|
|
94
|
+
setSelectedIndex(0);
|
|
95
|
+
setProvider(null);
|
|
96
|
+
setMethod(null);
|
|
97
|
+
setProfiles([]);
|
|
98
|
+
setDefaultProfileId(null);
|
|
99
|
+
setApiKey("");
|
|
100
|
+
setStatus("Choose a provider to connect.");
|
|
101
|
+
setError(null);
|
|
102
|
+
}, [isVisible]);
|
|
103
|
+
const providerOptions = (0, import_react.useMemo)(
|
|
104
|
+
() => (0, import_agent_management.getProviderAuthDefinitions)().map((item) => ({
|
|
105
|
+
value: item.providerId,
|
|
106
|
+
label: item.label,
|
|
107
|
+
hint: `${item.methods.length} method${item.methods.length === 1 ? "" : "s"}`
|
|
108
|
+
})),
|
|
109
|
+
[]
|
|
110
|
+
);
|
|
111
|
+
const methodOptions = (0, import_react.useMemo)(() => {
|
|
112
|
+
if (!provider) {
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
return provider.methods.map((item) => {
|
|
116
|
+
const profile = profiles.find(
|
|
117
|
+
(candidate) => candidate.id === (0, import_agent_management.getModelAuthProfileId)(provider.providerId, item.id)
|
|
118
|
+
);
|
|
119
|
+
return {
|
|
120
|
+
value: item.id,
|
|
121
|
+
label: item.label,
|
|
122
|
+
hint: methodHint(item, profile, defaultProfileId)
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
}, [defaultProfileId, profiles, provider]);
|
|
126
|
+
const existingActionOptions = (0, import_react.useMemo)(() => {
|
|
127
|
+
if (!existingProfile) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
return [
|
|
131
|
+
{
|
|
132
|
+
value: "use",
|
|
133
|
+
label: existingProfile.id === defaultProfileId ? "Keep as default" : "Use existing",
|
|
134
|
+
hint: existingProfile.id === defaultProfileId ? "No changes" : "Set this method as provider default"
|
|
135
|
+
},
|
|
136
|
+
{ value: "replace", label: "Replace credentials", hint: "Reconnect this method" },
|
|
137
|
+
{
|
|
138
|
+
value: "delete",
|
|
139
|
+
label: "Delete credentials",
|
|
140
|
+
...existingProfile.id === defaultProfileId ? { hint: "Also clears default" } : {}
|
|
141
|
+
}
|
|
142
|
+
];
|
|
143
|
+
}, [defaultProfileId, existingProfile]);
|
|
144
|
+
const activeItems = step === "provider" ? providerOptions : step === "method" ? methodOptions : step === "existing-action" ? existingActionOptions : [];
|
|
145
|
+
const loadProvider = (0, import_react.useCallback)(async (nextProvider) => {
|
|
146
|
+
setProvider(nextProvider);
|
|
147
|
+
setMethod(null);
|
|
148
|
+
setStatus(`Loading saved ${nextProvider.label} profiles...`);
|
|
149
|
+
const [savedProfiles, savedDefaultProfileId] = await Promise.all([
|
|
150
|
+
(0, import_agent_management.listSavedModelAuthProfiles)(nextProvider.providerId),
|
|
151
|
+
(0, import_agent_management.getDefaultModelAuthProfileIdForProvider)(nextProvider.providerId)
|
|
152
|
+
]);
|
|
153
|
+
setProfiles(savedProfiles);
|
|
154
|
+
setDefaultProfileId(savedDefaultProfileId);
|
|
155
|
+
setSelectedIndex(0);
|
|
156
|
+
setStatus(`Choose how to connect ${nextProvider.label}.`);
|
|
157
|
+
setStep("method");
|
|
158
|
+
}, []);
|
|
159
|
+
const saveApiKey = (0, import_react.useCallback)(async () => {
|
|
160
|
+
if (!provider || !method) {
|
|
161
|
+
close({ outcome: "cancelled" });
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const trimmed = apiKey.trim();
|
|
165
|
+
if (!trimmed) {
|
|
166
|
+
setError("API key is required");
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const llmProvider = toLlmProvider(provider.providerId);
|
|
170
|
+
if (!(0, import_host.isValidApiKeyFormat)(trimmed, llmProvider)) {
|
|
171
|
+
setError(`${provider.label} API key format is invalid`);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
setError(null);
|
|
175
|
+
try {
|
|
176
|
+
setStatus(`Saving ${provider.label} API key...`);
|
|
177
|
+
await (0, import_agent_management.saveProviderApiKey)(llmProvider, trimmed, process.cwd());
|
|
178
|
+
await (0, import_host.applyLayeredEnvironmentLoading)();
|
|
179
|
+
await (0, import_agent_management.saveApiKeyModelAuthProfile)(llmProvider);
|
|
180
|
+
await (0, import_agent_management.markModelAuthProviderConnected)(provider.providerId);
|
|
181
|
+
close({
|
|
182
|
+
outcome: "success",
|
|
183
|
+
providerId: provider.providerId,
|
|
184
|
+
message: `Connected ${provider.label} (${method.label})`
|
|
185
|
+
});
|
|
186
|
+
} catch (err) {
|
|
187
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
188
|
+
}
|
|
189
|
+
}, [apiKey, close, method, provider]);
|
|
190
|
+
const connectOAuth = (0, import_react.useCallback)(
|
|
191
|
+
async (nextProvider, nextMethod) => {
|
|
192
|
+
setStep("oauth-progress");
|
|
193
|
+
setStatus(`Starting ${nextMethod.label}...`);
|
|
194
|
+
let timeout = null;
|
|
195
|
+
try {
|
|
196
|
+
const login = await (0, import_agent_management.startModelAuthBrowserLogin)({
|
|
197
|
+
providerId: nextProvider.providerId,
|
|
198
|
+
methodId: nextMethod.id
|
|
199
|
+
});
|
|
200
|
+
loginCancelRef.current = login.cancel;
|
|
201
|
+
setStatus(`Opening browser for ${nextMethod.label}...`);
|
|
202
|
+
await (0, import_open.default)(login.authUrl).catch(() => void 0);
|
|
203
|
+
setStatus("Waiting for browser authorization...");
|
|
204
|
+
await Promise.race([
|
|
205
|
+
login.waitForProfile(),
|
|
206
|
+
new Promise((_, reject) => {
|
|
207
|
+
timeout = setTimeout(
|
|
208
|
+
() => reject(new Error(`${nextMethod.label} timed out`)),
|
|
209
|
+
5 * 60 * 1e3
|
|
210
|
+
);
|
|
211
|
+
})
|
|
212
|
+
]);
|
|
213
|
+
await (0, import_agent_management.markModelAuthProviderConnected)(nextProvider.providerId);
|
|
214
|
+
close({
|
|
215
|
+
outcome: "success",
|
|
216
|
+
providerId: nextProvider.providerId,
|
|
217
|
+
message: `Connected ${nextProvider.label} (${nextMethod.label})`
|
|
218
|
+
});
|
|
219
|
+
} catch (err) {
|
|
220
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
221
|
+
setStep("error");
|
|
222
|
+
} finally {
|
|
223
|
+
if (timeout) {
|
|
224
|
+
clearTimeout(timeout);
|
|
225
|
+
}
|
|
226
|
+
await loginCancelRef.current?.();
|
|
227
|
+
loginCancelRef.current = null;
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
[close]
|
|
231
|
+
);
|
|
232
|
+
const startConnect = (0, import_react.useCallback)(async () => {
|
|
233
|
+
if (!provider || !method) {
|
|
234
|
+
close({ outcome: "cancelled" });
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (method.kind === "api_key") {
|
|
238
|
+
setApiKey("");
|
|
239
|
+
setError(null);
|
|
240
|
+
setStatus(`Enter your ${provider.label} API key.`);
|
|
241
|
+
setStep("api-key");
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (method.kind === "oauth") {
|
|
245
|
+
await connectOAuth(provider, method);
|
|
246
|
+
}
|
|
247
|
+
}, [close, connectOAuth, method, provider]);
|
|
248
|
+
const handleSelect = (0, import_react.useCallback)(
|
|
249
|
+
async (option) => {
|
|
250
|
+
if (step === "provider") {
|
|
251
|
+
const nextProvider = (0, import_agent_management.getProviderAuthDefinitions)().find(
|
|
252
|
+
(candidate) => candidate.providerId === option.value
|
|
253
|
+
);
|
|
254
|
+
if (nextProvider) {
|
|
255
|
+
await loadProvider(nextProvider);
|
|
256
|
+
}
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
if (step === "method" && provider) {
|
|
260
|
+
const nextMethod = provider.methods.find(
|
|
261
|
+
(candidate) => candidate.id === option.value
|
|
262
|
+
);
|
|
263
|
+
if (nextMethod) {
|
|
264
|
+
setMethod(nextMethod);
|
|
265
|
+
const profileId = (0, import_agent_management.getModelAuthProfileId)(provider.providerId, nextMethod.id);
|
|
266
|
+
if (profiles.some((item) => item.id === profileId)) {
|
|
267
|
+
setStatus(`Manage ${provider.label} ${nextMethod.label}.`);
|
|
268
|
+
setStep("existing-action");
|
|
269
|
+
setSelectedIndex(0);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
if (nextMethod.kind === "api_key") {
|
|
273
|
+
setApiKey("");
|
|
274
|
+
setError(null);
|
|
275
|
+
setStatus(`Enter your ${provider.label} API key.`);
|
|
276
|
+
setStep("api-key");
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (nextMethod.kind === "oauth") {
|
|
280
|
+
await connectOAuth(provider, nextMethod);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (step === "existing-action" && provider && method && currentProfileId) {
|
|
286
|
+
if (option.value === "use") {
|
|
287
|
+
await (0, import_agent_management.setDefaultModelAuthProfile)({
|
|
288
|
+
providerId: provider.providerId,
|
|
289
|
+
profileId: currentProfileId
|
|
290
|
+
});
|
|
291
|
+
close({
|
|
292
|
+
outcome: "success",
|
|
293
|
+
providerId: provider.providerId,
|
|
294
|
+
message: `Using ${provider.label} ${method.label}`
|
|
295
|
+
});
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
if (option.value === "replace") {
|
|
299
|
+
await startConnect();
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (option.value === "delete") {
|
|
303
|
+
setStatus(`Press Enter to delete ${provider.label} ${method.label}.`);
|
|
304
|
+
setStep("delete-confirm");
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
[
|
|
309
|
+
close,
|
|
310
|
+
connectOAuth,
|
|
311
|
+
currentProfileId,
|
|
312
|
+
loadProvider,
|
|
313
|
+
method,
|
|
314
|
+
profiles,
|
|
315
|
+
provider,
|
|
316
|
+
startConnect,
|
|
317
|
+
step
|
|
318
|
+
]
|
|
319
|
+
);
|
|
320
|
+
(0, import_react.useImperativeHandle)(
|
|
321
|
+
ref,
|
|
322
|
+
() => ({
|
|
323
|
+
handleInput: (input, key) => {
|
|
324
|
+
if (!isVisible) return false;
|
|
325
|
+
if (step === "api-key") {
|
|
326
|
+
if (key.escape) {
|
|
327
|
+
close({ outcome: "cancelled" });
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
if (key.return) {
|
|
331
|
+
void saveApiKey().catch(handleActionError);
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
334
|
+
if (key.backspace || key.delete) {
|
|
335
|
+
setApiKey((prev) => prev.slice(0, -1));
|
|
336
|
+
setError(null);
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
if (input && !key.ctrl && !key.meta) {
|
|
340
|
+
setApiKey((prev) => prev + input);
|
|
341
|
+
setError(null);
|
|
342
|
+
return true;
|
|
343
|
+
}
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
if (step === "delete-confirm") {
|
|
347
|
+
if (key.escape) {
|
|
348
|
+
close({ outcome: "cancelled" });
|
|
349
|
+
return true;
|
|
350
|
+
}
|
|
351
|
+
if (key.return && provider && method && currentProfileId) {
|
|
352
|
+
void (0, import_agent_management.deleteModelAuthProfile)(currentProfileId).then(
|
|
353
|
+
() => close({
|
|
354
|
+
outcome: "success",
|
|
355
|
+
providerId: provider.providerId,
|
|
356
|
+
message: `Deleted ${provider.label} ${method.label}`
|
|
357
|
+
})
|
|
358
|
+
).catch(handleActionError);
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
if (step === "oauth-progress") {
|
|
364
|
+
if (key.escape) {
|
|
365
|
+
close({ outcome: "cancelled" });
|
|
366
|
+
}
|
|
367
|
+
return true;
|
|
368
|
+
}
|
|
369
|
+
if (step === "error") {
|
|
370
|
+
if (key.escape || key.return) {
|
|
371
|
+
close({ outcome: "closed" });
|
|
372
|
+
}
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
return selectorRef.current?.handleInput(input, key) ?? false;
|
|
376
|
+
}
|
|
377
|
+
}),
|
|
378
|
+
[
|
|
379
|
+
close,
|
|
380
|
+
currentProfileId,
|
|
381
|
+
handleActionError,
|
|
382
|
+
isVisible,
|
|
383
|
+
method,
|
|
384
|
+
provider,
|
|
385
|
+
saveApiKey,
|
|
386
|
+
step
|
|
387
|
+
]
|
|
388
|
+
);
|
|
389
|
+
if (!isVisible) return null;
|
|
390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
|
|
391
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Box, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { bold: true, color: "cyan", children: "Connect Model Provider" }) }),
|
|
392
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: error ? "red" : "gray", children: error ?? status }),
|
|
393
|
+
step === "api-key" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Box, { flexDirection: "column", marginTop: 1, children: [
|
|
394
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { children: maskSecret(apiKey) }),
|
|
395
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: "gray", children: "Enter save \u2022 Esc cancel" })
|
|
396
|
+
] }) : step === "delete-confirm" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Box, { flexDirection: "column", marginTop: 1, children: [
|
|
397
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: "red", children: "This removes saved credentials for this method." }),
|
|
398
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: "gray", children: "Enter delete \u2022 Esc cancel" })
|
|
399
|
+
] }) : step === "oauth-progress" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Box, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: "gray", children: "Esc cancel" }) }) : step === "error" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Box, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Text, { color: "gray", children: "Enter close \u2022 Esc close" }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Box, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
400
|
+
import_BaseSelector.BaseSelector,
|
|
401
|
+
{
|
|
402
|
+
ref: selectorRef,
|
|
403
|
+
items: activeItems,
|
|
404
|
+
isVisible: true,
|
|
405
|
+
selectedIndex,
|
|
406
|
+
onSelectIndex: setSelectedIndex,
|
|
407
|
+
onSelect: (item) => void handleSelect(item).catch(handleActionError),
|
|
408
|
+
onClose: () => close({ outcome: "cancelled" }),
|
|
409
|
+
title: step === "provider" ? "Providers" : step === "method" ? `${provider?.label ?? "Provider"} methods` : "Existing profile",
|
|
410
|
+
formatItem: (item, selected) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Text, { ...selected ? { color: "cyan" } : {}, children: [
|
|
411
|
+
selected ? "\u203A " : " ",
|
|
412
|
+
item.label,
|
|
413
|
+
item.hint ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ink.Text, { color: "gray", children: [
|
|
414
|
+
" \u2014 ",
|
|
415
|
+
item.hint
|
|
416
|
+
] }) : null
|
|
417
|
+
] })
|
|
418
|
+
}
|
|
419
|
+
) })
|
|
420
|
+
] });
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
var ConnectOverlay_default = ConnectOverlay;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Key } from '../../hooks/useInputOrchestrator.js';
|
|
3
|
+
export type ConnectOverlayOutcome = {
|
|
4
|
+
outcome: 'success';
|
|
5
|
+
providerId: string;
|
|
6
|
+
message: string;
|
|
7
|
+
} | {
|
|
8
|
+
outcome: 'cancelled';
|
|
9
|
+
} | {
|
|
10
|
+
outcome: 'closed';
|
|
11
|
+
};
|
|
12
|
+
export interface ConnectOverlayProps {
|
|
13
|
+
isVisible: boolean;
|
|
14
|
+
onDone: (outcome: ConnectOverlayOutcome) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface ConnectOverlayHandle {
|
|
17
|
+
handleInput: (input: string, key: Key) => boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const ConnectOverlay: React.ForwardRefExoticComponent<ConnectOverlayProps & React.RefAttributes<ConnectOverlayHandle>>;
|
|
20
|
+
export default ConnectOverlay;
|
|
21
|
+
//# sourceMappingURL=ConnectOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/overlays/ConnectOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAmC/D,MAAM,MAAM,qBAAqB,GAC3B;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,GACxB;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE5B,MAAM,WAAW,mBAAmB;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACpD;AAED,MAAM,WAAW,oBAAoB;IACjC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;CACrD;AAiCD,QAAA,MAAM,cAAc,kGAsbnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
forwardRef,
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useImperativeHandle,
|
|
7
|
+
useMemo,
|
|
8
|
+
useRef,
|
|
9
|
+
useState
|
|
10
|
+
} from "react";
|
|
11
|
+
import { Box, Text } from "ink";
|
|
12
|
+
import open from "open";
|
|
13
|
+
import { BaseSelector } from "../base/BaseSelector.js";
|
|
14
|
+
import {
|
|
15
|
+
deleteModelAuthProfile,
|
|
16
|
+
getDefaultModelAuthProfileIdForProvider,
|
|
17
|
+
getModelAuthProfileId,
|
|
18
|
+
getProviderAuthDefinitions,
|
|
19
|
+
listSavedModelAuthProfiles,
|
|
20
|
+
markModelAuthProviderConnected,
|
|
21
|
+
saveApiKeyModelAuthProfile,
|
|
22
|
+
saveProviderApiKey,
|
|
23
|
+
setDefaultModelAuthProfile,
|
|
24
|
+
startModelAuthBrowserLogin
|
|
25
|
+
} from "@dexto/agent-management";
|
|
26
|
+
import { LLM_PROVIDERS } from "@dexto/llm";
|
|
27
|
+
import { applyLayeredEnvironmentLoading, isValidApiKeyFormat } from "../../host/index.js";
|
|
28
|
+
function methodHint(method, profile, defaultProfileId) {
|
|
29
|
+
const parts = [
|
|
30
|
+
profile ? profile.id === defaultProfileId ? "Connected (default)" : "Connected" : void 0,
|
|
31
|
+
method.hint
|
|
32
|
+
].filter((part) => Boolean(part));
|
|
33
|
+
return parts.length ? parts.join(" - ") : void 0;
|
|
34
|
+
}
|
|
35
|
+
function maskSecret(secret) {
|
|
36
|
+
if (secret.length <= 8) {
|
|
37
|
+
return "*".repeat(secret.length);
|
|
38
|
+
}
|
|
39
|
+
return `${secret.slice(0, 4)}${"*".repeat(Math.min(secret.length - 8, 24))}${secret.slice(-4)}`;
|
|
40
|
+
}
|
|
41
|
+
function toLlmProvider(providerId) {
|
|
42
|
+
const provider = LLM_PROVIDERS.find((candidate) => candidate === providerId);
|
|
43
|
+
if (!provider) {
|
|
44
|
+
throw new Error(`API-key auth is not implemented for provider: ${providerId}`);
|
|
45
|
+
}
|
|
46
|
+
return provider;
|
|
47
|
+
}
|
|
48
|
+
const ConnectOverlay = forwardRef(
|
|
49
|
+
function ConnectOverlay2({ isVisible, onDone }, ref) {
|
|
50
|
+
const selectorRef = useRef(null);
|
|
51
|
+
const loginCancelRef = useRef(null);
|
|
52
|
+
const [step, setStep] = useState("provider");
|
|
53
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
54
|
+
const [provider, setProvider] = useState(null);
|
|
55
|
+
const [method, setMethod] = useState(null);
|
|
56
|
+
const [profiles, setProfiles] = useState([]);
|
|
57
|
+
const [defaultProfileId, setDefaultProfileId] = useState(null);
|
|
58
|
+
const [apiKey, setApiKey] = useState("");
|
|
59
|
+
const [status, setStatus] = useState("Choose a provider to connect.");
|
|
60
|
+
const [error, setError] = useState(null);
|
|
61
|
+
const currentProfileId = provider && method ? getModelAuthProfileId(provider.providerId, method.id) : null;
|
|
62
|
+
const existingProfile = currentProfileId ? profiles.find((profile) => profile.id === currentProfileId) ?? null : null;
|
|
63
|
+
const close = useCallback(
|
|
64
|
+
(outcome) => {
|
|
65
|
+
void loginCancelRef.current?.();
|
|
66
|
+
loginCancelRef.current = null;
|
|
67
|
+
onDone(outcome);
|
|
68
|
+
},
|
|
69
|
+
[onDone]
|
|
70
|
+
);
|
|
71
|
+
const handleActionError = useCallback((err) => {
|
|
72
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
73
|
+
setStep("error");
|
|
74
|
+
}, []);
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (!isVisible) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
setStep("provider");
|
|
80
|
+
setSelectedIndex(0);
|
|
81
|
+
setProvider(null);
|
|
82
|
+
setMethod(null);
|
|
83
|
+
setProfiles([]);
|
|
84
|
+
setDefaultProfileId(null);
|
|
85
|
+
setApiKey("");
|
|
86
|
+
setStatus("Choose a provider to connect.");
|
|
87
|
+
setError(null);
|
|
88
|
+
}, [isVisible]);
|
|
89
|
+
const providerOptions = useMemo(
|
|
90
|
+
() => getProviderAuthDefinitions().map((item) => ({
|
|
91
|
+
value: item.providerId,
|
|
92
|
+
label: item.label,
|
|
93
|
+
hint: `${item.methods.length} method${item.methods.length === 1 ? "" : "s"}`
|
|
94
|
+
})),
|
|
95
|
+
[]
|
|
96
|
+
);
|
|
97
|
+
const methodOptions = useMemo(() => {
|
|
98
|
+
if (!provider) {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
return provider.methods.map((item) => {
|
|
102
|
+
const profile = profiles.find(
|
|
103
|
+
(candidate) => candidate.id === getModelAuthProfileId(provider.providerId, item.id)
|
|
104
|
+
);
|
|
105
|
+
return {
|
|
106
|
+
value: item.id,
|
|
107
|
+
label: item.label,
|
|
108
|
+
hint: methodHint(item, profile, defaultProfileId)
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
}, [defaultProfileId, profiles, provider]);
|
|
112
|
+
const existingActionOptions = useMemo(() => {
|
|
113
|
+
if (!existingProfile) {
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
return [
|
|
117
|
+
{
|
|
118
|
+
value: "use",
|
|
119
|
+
label: existingProfile.id === defaultProfileId ? "Keep as default" : "Use existing",
|
|
120
|
+
hint: existingProfile.id === defaultProfileId ? "No changes" : "Set this method as provider default"
|
|
121
|
+
},
|
|
122
|
+
{ value: "replace", label: "Replace credentials", hint: "Reconnect this method" },
|
|
123
|
+
{
|
|
124
|
+
value: "delete",
|
|
125
|
+
label: "Delete credentials",
|
|
126
|
+
...existingProfile.id === defaultProfileId ? { hint: "Also clears default" } : {}
|
|
127
|
+
}
|
|
128
|
+
];
|
|
129
|
+
}, [defaultProfileId, existingProfile]);
|
|
130
|
+
const activeItems = step === "provider" ? providerOptions : step === "method" ? methodOptions : step === "existing-action" ? existingActionOptions : [];
|
|
131
|
+
const loadProvider = useCallback(async (nextProvider) => {
|
|
132
|
+
setProvider(nextProvider);
|
|
133
|
+
setMethod(null);
|
|
134
|
+
setStatus(`Loading saved ${nextProvider.label} profiles...`);
|
|
135
|
+
const [savedProfiles, savedDefaultProfileId] = await Promise.all([
|
|
136
|
+
listSavedModelAuthProfiles(nextProvider.providerId),
|
|
137
|
+
getDefaultModelAuthProfileIdForProvider(nextProvider.providerId)
|
|
138
|
+
]);
|
|
139
|
+
setProfiles(savedProfiles);
|
|
140
|
+
setDefaultProfileId(savedDefaultProfileId);
|
|
141
|
+
setSelectedIndex(0);
|
|
142
|
+
setStatus(`Choose how to connect ${nextProvider.label}.`);
|
|
143
|
+
setStep("method");
|
|
144
|
+
}, []);
|
|
145
|
+
const saveApiKey = useCallback(async () => {
|
|
146
|
+
if (!provider || !method) {
|
|
147
|
+
close({ outcome: "cancelled" });
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const trimmed = apiKey.trim();
|
|
151
|
+
if (!trimmed) {
|
|
152
|
+
setError("API key is required");
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const llmProvider = toLlmProvider(provider.providerId);
|
|
156
|
+
if (!isValidApiKeyFormat(trimmed, llmProvider)) {
|
|
157
|
+
setError(`${provider.label} API key format is invalid`);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
setError(null);
|
|
161
|
+
try {
|
|
162
|
+
setStatus(`Saving ${provider.label} API key...`);
|
|
163
|
+
await saveProviderApiKey(llmProvider, trimmed, process.cwd());
|
|
164
|
+
await applyLayeredEnvironmentLoading();
|
|
165
|
+
await saveApiKeyModelAuthProfile(llmProvider);
|
|
166
|
+
await markModelAuthProviderConnected(provider.providerId);
|
|
167
|
+
close({
|
|
168
|
+
outcome: "success",
|
|
169
|
+
providerId: provider.providerId,
|
|
170
|
+
message: `Connected ${provider.label} (${method.label})`
|
|
171
|
+
});
|
|
172
|
+
} catch (err) {
|
|
173
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
174
|
+
}
|
|
175
|
+
}, [apiKey, close, method, provider]);
|
|
176
|
+
const connectOAuth = useCallback(
|
|
177
|
+
async (nextProvider, nextMethod) => {
|
|
178
|
+
setStep("oauth-progress");
|
|
179
|
+
setStatus(`Starting ${nextMethod.label}...`);
|
|
180
|
+
let timeout = null;
|
|
181
|
+
try {
|
|
182
|
+
const login = await startModelAuthBrowserLogin({
|
|
183
|
+
providerId: nextProvider.providerId,
|
|
184
|
+
methodId: nextMethod.id
|
|
185
|
+
});
|
|
186
|
+
loginCancelRef.current = login.cancel;
|
|
187
|
+
setStatus(`Opening browser for ${nextMethod.label}...`);
|
|
188
|
+
await open(login.authUrl).catch(() => void 0);
|
|
189
|
+
setStatus("Waiting for browser authorization...");
|
|
190
|
+
await Promise.race([
|
|
191
|
+
login.waitForProfile(),
|
|
192
|
+
new Promise((_, reject) => {
|
|
193
|
+
timeout = setTimeout(
|
|
194
|
+
() => reject(new Error(`${nextMethod.label} timed out`)),
|
|
195
|
+
5 * 60 * 1e3
|
|
196
|
+
);
|
|
197
|
+
})
|
|
198
|
+
]);
|
|
199
|
+
await markModelAuthProviderConnected(nextProvider.providerId);
|
|
200
|
+
close({
|
|
201
|
+
outcome: "success",
|
|
202
|
+
providerId: nextProvider.providerId,
|
|
203
|
+
message: `Connected ${nextProvider.label} (${nextMethod.label})`
|
|
204
|
+
});
|
|
205
|
+
} catch (err) {
|
|
206
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
207
|
+
setStep("error");
|
|
208
|
+
} finally {
|
|
209
|
+
if (timeout) {
|
|
210
|
+
clearTimeout(timeout);
|
|
211
|
+
}
|
|
212
|
+
await loginCancelRef.current?.();
|
|
213
|
+
loginCancelRef.current = null;
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
[close]
|
|
217
|
+
);
|
|
218
|
+
const startConnect = useCallback(async () => {
|
|
219
|
+
if (!provider || !method) {
|
|
220
|
+
close({ outcome: "cancelled" });
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (method.kind === "api_key") {
|
|
224
|
+
setApiKey("");
|
|
225
|
+
setError(null);
|
|
226
|
+
setStatus(`Enter your ${provider.label} API key.`);
|
|
227
|
+
setStep("api-key");
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (method.kind === "oauth") {
|
|
231
|
+
await connectOAuth(provider, method);
|
|
232
|
+
}
|
|
233
|
+
}, [close, connectOAuth, method, provider]);
|
|
234
|
+
const handleSelect = useCallback(
|
|
235
|
+
async (option) => {
|
|
236
|
+
if (step === "provider") {
|
|
237
|
+
const nextProvider = getProviderAuthDefinitions().find(
|
|
238
|
+
(candidate) => candidate.providerId === option.value
|
|
239
|
+
);
|
|
240
|
+
if (nextProvider) {
|
|
241
|
+
await loadProvider(nextProvider);
|
|
242
|
+
}
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (step === "method" && provider) {
|
|
246
|
+
const nextMethod = provider.methods.find(
|
|
247
|
+
(candidate) => candidate.id === option.value
|
|
248
|
+
);
|
|
249
|
+
if (nextMethod) {
|
|
250
|
+
setMethod(nextMethod);
|
|
251
|
+
const profileId = getModelAuthProfileId(provider.providerId, nextMethod.id);
|
|
252
|
+
if (profiles.some((item) => item.id === profileId)) {
|
|
253
|
+
setStatus(`Manage ${provider.label} ${nextMethod.label}.`);
|
|
254
|
+
setStep("existing-action");
|
|
255
|
+
setSelectedIndex(0);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
if (nextMethod.kind === "api_key") {
|
|
259
|
+
setApiKey("");
|
|
260
|
+
setError(null);
|
|
261
|
+
setStatus(`Enter your ${provider.label} API key.`);
|
|
262
|
+
setStep("api-key");
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
if (nextMethod.kind === "oauth") {
|
|
266
|
+
await connectOAuth(provider, nextMethod);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (step === "existing-action" && provider && method && currentProfileId) {
|
|
272
|
+
if (option.value === "use") {
|
|
273
|
+
await setDefaultModelAuthProfile({
|
|
274
|
+
providerId: provider.providerId,
|
|
275
|
+
profileId: currentProfileId
|
|
276
|
+
});
|
|
277
|
+
close({
|
|
278
|
+
outcome: "success",
|
|
279
|
+
providerId: provider.providerId,
|
|
280
|
+
message: `Using ${provider.label} ${method.label}`
|
|
281
|
+
});
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (option.value === "replace") {
|
|
285
|
+
await startConnect();
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if (option.value === "delete") {
|
|
289
|
+
setStatus(`Press Enter to delete ${provider.label} ${method.label}.`);
|
|
290
|
+
setStep("delete-confirm");
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
[
|
|
295
|
+
close,
|
|
296
|
+
connectOAuth,
|
|
297
|
+
currentProfileId,
|
|
298
|
+
loadProvider,
|
|
299
|
+
method,
|
|
300
|
+
profiles,
|
|
301
|
+
provider,
|
|
302
|
+
startConnect,
|
|
303
|
+
step
|
|
304
|
+
]
|
|
305
|
+
);
|
|
306
|
+
useImperativeHandle(
|
|
307
|
+
ref,
|
|
308
|
+
() => ({
|
|
309
|
+
handleInput: (input, key) => {
|
|
310
|
+
if (!isVisible) return false;
|
|
311
|
+
if (step === "api-key") {
|
|
312
|
+
if (key.escape) {
|
|
313
|
+
close({ outcome: "cancelled" });
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
if (key.return) {
|
|
317
|
+
void saveApiKey().catch(handleActionError);
|
|
318
|
+
return true;
|
|
319
|
+
}
|
|
320
|
+
if (key.backspace || key.delete) {
|
|
321
|
+
setApiKey((prev) => prev.slice(0, -1));
|
|
322
|
+
setError(null);
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
if (input && !key.ctrl && !key.meta) {
|
|
326
|
+
setApiKey((prev) => prev + input);
|
|
327
|
+
setError(null);
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
if (step === "delete-confirm") {
|
|
333
|
+
if (key.escape) {
|
|
334
|
+
close({ outcome: "cancelled" });
|
|
335
|
+
return true;
|
|
336
|
+
}
|
|
337
|
+
if (key.return && provider && method && currentProfileId) {
|
|
338
|
+
void deleteModelAuthProfile(currentProfileId).then(
|
|
339
|
+
() => close({
|
|
340
|
+
outcome: "success",
|
|
341
|
+
providerId: provider.providerId,
|
|
342
|
+
message: `Deleted ${provider.label} ${method.label}`
|
|
343
|
+
})
|
|
344
|
+
).catch(handleActionError);
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
if (step === "oauth-progress") {
|
|
350
|
+
if (key.escape) {
|
|
351
|
+
close({ outcome: "cancelled" });
|
|
352
|
+
}
|
|
353
|
+
return true;
|
|
354
|
+
}
|
|
355
|
+
if (step === "error") {
|
|
356
|
+
if (key.escape || key.return) {
|
|
357
|
+
close({ outcome: "closed" });
|
|
358
|
+
}
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
return selectorRef.current?.handleInput(input, key) ?? false;
|
|
362
|
+
}
|
|
363
|
+
}),
|
|
364
|
+
[
|
|
365
|
+
close,
|
|
366
|
+
currentProfileId,
|
|
367
|
+
handleActionError,
|
|
368
|
+
isVisible,
|
|
369
|
+
method,
|
|
370
|
+
provider,
|
|
371
|
+
saveApiKey,
|
|
372
|
+
step
|
|
373
|
+
]
|
|
374
|
+
);
|
|
375
|
+
if (!isVisible) return null;
|
|
376
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
|
|
377
|
+
/* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsx(Text, { bold: true, color: "cyan", children: "Connect Model Provider" }) }),
|
|
378
|
+
/* @__PURE__ */ jsx(Text, { color: error ? "red" : "gray", children: error ?? status }),
|
|
379
|
+
step === "api-key" ? /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
|
|
380
|
+
/* @__PURE__ */ jsx(Text, { children: maskSecret(apiKey) }),
|
|
381
|
+
/* @__PURE__ */ jsx(Text, { color: "gray", children: "Enter save \u2022 Esc cancel" })
|
|
382
|
+
] }) : step === "delete-confirm" ? /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
|
|
383
|
+
/* @__PURE__ */ jsx(Text, { color: "red", children: "This removes saved credentials for this method." }),
|
|
384
|
+
/* @__PURE__ */ jsx(Text, { color: "gray", children: "Enter delete \u2022 Esc cancel" })
|
|
385
|
+
] }) : step === "oauth-progress" ? /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { color: "gray", children: "Esc cancel" }) }) : step === "error" ? /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { color: "gray", children: "Enter close \u2022 Esc close" }) }) : /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(
|
|
386
|
+
BaseSelector,
|
|
387
|
+
{
|
|
388
|
+
ref: selectorRef,
|
|
389
|
+
items: activeItems,
|
|
390
|
+
isVisible: true,
|
|
391
|
+
selectedIndex,
|
|
392
|
+
onSelectIndex: setSelectedIndex,
|
|
393
|
+
onSelect: (item) => void handleSelect(item).catch(handleActionError),
|
|
394
|
+
onClose: () => close({ outcome: "cancelled" }),
|
|
395
|
+
title: step === "provider" ? "Providers" : step === "method" ? `${provider?.label ?? "Provider"} methods` : "Existing profile",
|
|
396
|
+
formatItem: (item, selected) => /* @__PURE__ */ jsxs(Text, { ...selected ? { color: "cyan" } : {}, children: [
|
|
397
|
+
selected ? "\u203A " : " ",
|
|
398
|
+
item.label,
|
|
399
|
+
item.hint ? /* @__PURE__ */ jsxs(Text, { color: "gray", children: [
|
|
400
|
+
" \u2014 ",
|
|
401
|
+
item.hint
|
|
402
|
+
] }) : null
|
|
403
|
+
] })
|
|
404
|
+
}
|
|
405
|
+
) })
|
|
406
|
+
] });
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
var ConnectOverlay_default = ConnectOverlay;
|
|
410
|
+
export {
|
|
411
|
+
ConnectOverlay_default as default
|
|
412
|
+
};
|
|
@@ -76,6 +76,7 @@ var import_MarketplaceBrowser = __toESM(require("../components/overlays/Marketpl
|
|
|
76
76
|
var import_MarketplaceAddPrompt = __toESM(require("../components/overlays/MarketplaceAddPrompt.js"), 1);
|
|
77
77
|
var import_LoginOverlay = __toESM(require("../components/overlays/LoginOverlay.js"), 1);
|
|
78
78
|
var import_LogoutOverlay = __toESM(require("../components/overlays/LogoutOverlay.js"), 1);
|
|
79
|
+
var import_ConnectOverlay = __toESM(require("../components/overlays/ConnectOverlay.js"), 1);
|
|
79
80
|
var import_llm = require("@dexto/llm");
|
|
80
81
|
var import_core2 = require("@dexto/core");
|
|
81
82
|
var import_messageFormatting = require("../utils/messageFormatting.js");
|
|
@@ -149,6 +150,7 @@ const OverlayContainer = (0, import_react.forwardRef)(
|
|
|
149
150
|
const apiKeyInputRef = (0, import_react.useRef)(null);
|
|
150
151
|
const loginOverlayRef = (0, import_react.useRef)(null);
|
|
151
152
|
const logoutOverlayRef = (0, import_react.useRef)(null);
|
|
153
|
+
const connectOverlayRef = (0, import_react.useRef)(null);
|
|
152
154
|
const searchOverlayRef = (0, import_react.useRef)(null);
|
|
153
155
|
const promptListRef = (0, import_react.useRef)(null);
|
|
154
156
|
const promptAddChoiceRef = (0, import_react.useRef)(null);
|
|
@@ -235,6 +237,8 @@ const OverlayContainer = (0, import_react.forwardRef)(
|
|
|
235
237
|
return loginOverlayRef.current?.handleInput(inputStr, key) ?? false;
|
|
236
238
|
case "logout":
|
|
237
239
|
return logoutOverlayRef.current?.handleInput(inputStr, key) ?? false;
|
|
240
|
+
case "connect":
|
|
241
|
+
return connectOverlayRef.current?.handleInput(inputStr, key) ?? false;
|
|
238
242
|
case "search":
|
|
239
243
|
return searchOverlayRef.current?.handleInput(inputStr, key) ?? false;
|
|
240
244
|
case "prompt-list":
|
|
@@ -1200,6 +1204,52 @@ ${result.context}`,
|
|
|
1200
1204
|
},
|
|
1201
1205
|
[handleClose, setMessages]
|
|
1202
1206
|
);
|
|
1207
|
+
const handleConnectDone = (0, import_react.useCallback)(
|
|
1208
|
+
async (outcome) => {
|
|
1209
|
+
handleClose();
|
|
1210
|
+
if (outcome.outcome === "closed") {
|
|
1211
|
+
return;
|
|
1212
|
+
}
|
|
1213
|
+
setMessages((prev) => [
|
|
1214
|
+
...prev,
|
|
1215
|
+
{
|
|
1216
|
+
id: (0, import_idGenerator.generateMessageId)("system"),
|
|
1217
|
+
role: "system",
|
|
1218
|
+
content: outcome.outcome === "success" ? `\u2705 ${outcome.message}` : "Model provider connection cancelled.",
|
|
1219
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
1220
|
+
}
|
|
1221
|
+
]);
|
|
1222
|
+
if (outcome.outcome !== "success") {
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
const currentConfig = agent.getCurrentLLMConfig(session.id || void 0);
|
|
1226
|
+
if (currentConfig.provider !== outcome.providerId) {
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
try {
|
|
1230
|
+
await agent.switchLLM(
|
|
1231
|
+
{
|
|
1232
|
+
provider: currentConfig.provider,
|
|
1233
|
+
model: currentConfig.model,
|
|
1234
|
+
...currentConfig.baseURL ? { baseURL: currentConfig.baseURL } : {},
|
|
1235
|
+
...currentConfig.reasoning ? { reasoning: currentConfig.reasoning } : {}
|
|
1236
|
+
},
|
|
1237
|
+
session.id || void 0
|
|
1238
|
+
);
|
|
1239
|
+
} catch (error) {
|
|
1240
|
+
setMessages((prev) => [
|
|
1241
|
+
...prev,
|
|
1242
|
+
{
|
|
1243
|
+
id: (0, import_idGenerator.generateMessageId)("error"),
|
|
1244
|
+
role: "system",
|
|
1245
|
+
content: `Failed to apply model provider connection: ${error instanceof Error ? error.message : String(error)}`,
|
|
1246
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
1247
|
+
}
|
|
1248
|
+
]);
|
|
1249
|
+
}
|
|
1250
|
+
},
|
|
1251
|
+
[agent, handleClose, session.id, setMessages]
|
|
1252
|
+
);
|
|
1203
1253
|
const handleLogLevelSelect = (0, import_react.useCallback)(
|
|
1204
1254
|
(level) => {
|
|
1205
1255
|
setUi((prev) => ({ ...prev, activeOverlay: "none", mcpWizardServerType: null }));
|
|
@@ -2452,6 +2502,14 @@ Use /${data.name} to run it.`,
|
|
|
2452
2502
|
onDone: handleLogoutDone
|
|
2453
2503
|
}
|
|
2454
2504
|
) }),
|
|
2505
|
+
ui.activeOverlay === "connect" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ink.Box, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2506
|
+
import_ConnectOverlay.default,
|
|
2507
|
+
{
|
|
2508
|
+
ref: connectOverlayRef,
|
|
2509
|
+
isVisible: true,
|
|
2510
|
+
onDone: handleConnectDone
|
|
2511
|
+
}
|
|
2512
|
+
) }),
|
|
2455
2513
|
ui.activeOverlay === "api-key-input" && ui.pendingModelSwitch && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2456
2514
|
import_ApiKeyInput.default,
|
|
2457
2515
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayContainer.d.ts","sourceRoot":"","sources":["../../src/containers/OverlayContainer.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAyE,MAAM,OAAO,CAAC;AAI9F,OAAO,KAAK,EAAE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KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACrD,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/D,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC7D,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1E,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;IAC1E,KAAK,EAAE,eAAe,CAAC;IACvB,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,UAAU,CAAC;IACnB,mDAAmD;IACnD,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,8EAA8E;IAC9E,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,4EAA4E;IAC5E,qBAAqB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,sGAi/F5B,CAAC"}
|
|
@@ -56,6 +56,7 @@ import MarketplaceBrowser from "../components/overlays/MarketplaceBrowser.js";
|
|
|
56
56
|
import MarketplaceAddPrompt from "../components/overlays/MarketplaceAddPrompt.js";
|
|
57
57
|
import LoginOverlay from "../components/overlays/LoginOverlay.js";
|
|
58
58
|
import LogoutOverlay from "../components/overlays/LogoutOverlay.js";
|
|
59
|
+
import ConnectOverlay from "../components/overlays/ConnectOverlay.js";
|
|
59
60
|
import { LLM_PROVIDERS, getModelDisplayName, getReasoningProfile } from "@dexto/llm";
|
|
60
61
|
import { DextoValidationError, LLMErrorCode } from "@dexto/core";
|
|
61
62
|
import { createUserMessage, convertHistoryToUIMessages } from "../utils/messageFormatting.js";
|
|
@@ -129,6 +130,7 @@ const OverlayContainer = forwardRef(
|
|
|
129
130
|
const apiKeyInputRef = useRef(null);
|
|
130
131
|
const loginOverlayRef = useRef(null);
|
|
131
132
|
const logoutOverlayRef = useRef(null);
|
|
133
|
+
const connectOverlayRef = useRef(null);
|
|
132
134
|
const searchOverlayRef = useRef(null);
|
|
133
135
|
const promptListRef = useRef(null);
|
|
134
136
|
const promptAddChoiceRef = useRef(null);
|
|
@@ -215,6 +217,8 @@ const OverlayContainer = forwardRef(
|
|
|
215
217
|
return loginOverlayRef.current?.handleInput(inputStr, key) ?? false;
|
|
216
218
|
case "logout":
|
|
217
219
|
return logoutOverlayRef.current?.handleInput(inputStr, key) ?? false;
|
|
220
|
+
case "connect":
|
|
221
|
+
return connectOverlayRef.current?.handleInput(inputStr, key) ?? false;
|
|
218
222
|
case "search":
|
|
219
223
|
return searchOverlayRef.current?.handleInput(inputStr, key) ?? false;
|
|
220
224
|
case "prompt-list":
|
|
@@ -1180,6 +1184,52 @@ ${result.context}`,
|
|
|
1180
1184
|
},
|
|
1181
1185
|
[handleClose, setMessages]
|
|
1182
1186
|
);
|
|
1187
|
+
const handleConnectDone = useCallback(
|
|
1188
|
+
async (outcome) => {
|
|
1189
|
+
handleClose();
|
|
1190
|
+
if (outcome.outcome === "closed") {
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
setMessages((prev) => [
|
|
1194
|
+
...prev,
|
|
1195
|
+
{
|
|
1196
|
+
id: generateMessageId("system"),
|
|
1197
|
+
role: "system",
|
|
1198
|
+
content: outcome.outcome === "success" ? `\u2705 ${outcome.message}` : "Model provider connection cancelled.",
|
|
1199
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
1200
|
+
}
|
|
1201
|
+
]);
|
|
1202
|
+
if (outcome.outcome !== "success") {
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
const currentConfig = agent.getCurrentLLMConfig(session.id || void 0);
|
|
1206
|
+
if (currentConfig.provider !== outcome.providerId) {
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
try {
|
|
1210
|
+
await agent.switchLLM(
|
|
1211
|
+
{
|
|
1212
|
+
provider: currentConfig.provider,
|
|
1213
|
+
model: currentConfig.model,
|
|
1214
|
+
...currentConfig.baseURL ? { baseURL: currentConfig.baseURL } : {},
|
|
1215
|
+
...currentConfig.reasoning ? { reasoning: currentConfig.reasoning } : {}
|
|
1216
|
+
},
|
|
1217
|
+
session.id || void 0
|
|
1218
|
+
);
|
|
1219
|
+
} catch (error) {
|
|
1220
|
+
setMessages((prev) => [
|
|
1221
|
+
...prev,
|
|
1222
|
+
{
|
|
1223
|
+
id: generateMessageId("error"),
|
|
1224
|
+
role: "system",
|
|
1225
|
+
content: `Failed to apply model provider connection: ${error instanceof Error ? error.message : String(error)}`,
|
|
1226
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
1227
|
+
}
|
|
1228
|
+
]);
|
|
1229
|
+
}
|
|
1230
|
+
},
|
|
1231
|
+
[agent, handleClose, session.id, setMessages]
|
|
1232
|
+
);
|
|
1183
1233
|
const handleLogLevelSelect = useCallback(
|
|
1184
1234
|
(level) => {
|
|
1185
1235
|
setUi((prev) => ({ ...prev, activeOverlay: "none", mcpWizardServerType: null }));
|
|
@@ -2432,6 +2482,14 @@ Use /${data.name} to run it.`,
|
|
|
2432
2482
|
onDone: handleLogoutDone
|
|
2433
2483
|
}
|
|
2434
2484
|
) }),
|
|
2485
|
+
ui.activeOverlay === "connect" && /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(
|
|
2486
|
+
ConnectOverlay,
|
|
2487
|
+
{
|
|
2488
|
+
ref: connectOverlayRef,
|
|
2489
|
+
isVisible: true,
|
|
2490
|
+
onDone: handleConnectDone
|
|
2491
|
+
}
|
|
2492
|
+
) }),
|
|
2435
2493
|
ui.activeOverlay === "api-key-input" && ui.pendingModelSwitch && /* @__PURE__ */ jsx(
|
|
2436
2494
|
ApiKeyInput,
|
|
2437
2495
|
{
|
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var auth_exports = {};
|
|
20
20
|
__export(auth_exports, {
|
|
21
|
+
connectCommand: () => connectCommand,
|
|
21
22
|
loginCommand: () => loginCommand,
|
|
22
23
|
logoutCommand: () => logoutCommand
|
|
23
24
|
});
|
|
@@ -37,8 +38,16 @@ const logoutCommand = {
|
|
|
37
38
|
category: "General",
|
|
38
39
|
handler: import_command_parser.overlayOnlyHandler
|
|
39
40
|
};
|
|
41
|
+
const connectCommand = {
|
|
42
|
+
name: "connect",
|
|
43
|
+
description: "Connect or switch model provider auth",
|
|
44
|
+
usage: "/connect",
|
|
45
|
+
category: "Model Management",
|
|
46
|
+
handler: import_command_parser.overlayOnlyHandler
|
|
47
|
+
};
|
|
40
48
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
49
|
0 && (module.exports = {
|
|
50
|
+
connectCommand,
|
|
42
51
|
loginCommand,
|
|
43
52
|
logoutCommand
|
|
44
53
|
});
|
|
@@ -10,4 +10,5 @@ import type { CommandDefinition } from '../command-parser.js';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const loginCommand: CommandDefinition;
|
|
12
12
|
export declare const logoutCommand: CommandDefinition;
|
|
13
|
+
export declare const connectCommand: CommandDefinition;
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interactive-commands/auth/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,iBAM1B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,iBAM3B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interactive-commands/auth/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,iBAM1B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,iBAM3B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBAM5B,CAAC"}
|
|
@@ -13,7 +13,15 @@ const logoutCommand = {
|
|
|
13
13
|
category: "General",
|
|
14
14
|
handler: overlayOnlyHandler
|
|
15
15
|
};
|
|
16
|
+
const connectCommand = {
|
|
17
|
+
name: "connect",
|
|
18
|
+
description: "Connect or switch model provider auth",
|
|
19
|
+
usage: "/connect",
|
|
20
|
+
category: "Model Management",
|
|
21
|
+
handler: overlayOnlyHandler
|
|
22
|
+
};
|
|
16
23
|
export {
|
|
24
|
+
connectCommand,
|
|
17
25
|
loginCommand,
|
|
18
26
|
logoutCommand
|
|
19
27
|
};
|
|
@@ -83,7 +83,9 @@ const baseCommands = [
|
|
|
83
83
|
// Documentation commands
|
|
84
84
|
...import_documentation_commands.documentationCommands,
|
|
85
85
|
// Auth commands (feature-flagged)
|
|
86
|
-
...(0, import_agent_management.isDextoAuthEnabled)() ? [import_auth.loginCommand, import_auth.logoutCommand] : []
|
|
86
|
+
...(0, import_agent_management.isDextoAuthEnabled)() ? [import_auth.loginCommand, import_auth.logoutCommand] : [],
|
|
87
|
+
// Model provider auth
|
|
88
|
+
import_auth.connectCommand
|
|
87
89
|
];
|
|
88
90
|
CLI_COMMANDS.push((0, import_general_commands.createHelpCommand)((agent) => getAvailableCommands(agent)));
|
|
89
91
|
CLI_COMMANDS.push(...baseCommands);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,EAIH,KAAK,eAAe,EACvB,MAAM,qBAAqB,CAAC;AAgB7B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,EAAE,iBAAiB,EAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/interactive-commands/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,EAIH,KAAK,eAAe,EACvB,MAAM,qBAAqB,CAAC;AAgB7B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,EAAE,iBAAiB,EAAO,CAAC;AAoDpD;;;;;GAKG;AACH,wBAAsB,cAAc,CAChC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,eAAe,EACtB,SAAS,CAAC,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CA+D/B;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,iBAAiB,EAAE,CAEpD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,eAAe,GAAG,iBAAiB,EAAE,CAEhF"}
|
|
@@ -15,7 +15,7 @@ import { toolCommands } from "./tool-commands.js";
|
|
|
15
15
|
import { promptCommands } from "./prompt-commands.js";
|
|
16
16
|
import { skillCommands } from "./skill-commands.js";
|
|
17
17
|
import { documentationCommands } from "./documentation-commands.js";
|
|
18
|
-
import { loginCommand, logoutCommand } from "./auth/index.js";
|
|
18
|
+
import { connectCommand, loginCommand, logoutCommand } from "./auth/index.js";
|
|
19
19
|
const CLI_COMMANDS = [];
|
|
20
20
|
const baseCommands = [
|
|
21
21
|
// General commands (without help)
|
|
@@ -51,7 +51,9 @@ const baseCommands = [
|
|
|
51
51
|
// Documentation commands
|
|
52
52
|
...documentationCommands,
|
|
53
53
|
// Auth commands (feature-flagged)
|
|
54
|
-
...isDextoAuthEnabled() ? [loginCommand, logoutCommand] : []
|
|
54
|
+
...isDextoAuthEnabled() ? [loginCommand, logoutCommand] : [],
|
|
55
|
+
// Model provider auth
|
|
56
|
+
connectCommand
|
|
55
57
|
];
|
|
56
58
|
CLI_COMMANDS.push(createHelpCommand((agent) => getAvailableCommands(agent)));
|
|
57
59
|
CLI_COMMANDS.push(...baseCommands);
|
package/dist/state/types.d.ts
CHANGED
|
@@ -287,7 +287,7 @@ export interface InsufficientCreditsState {
|
|
|
287
287
|
/**
|
|
288
288
|
* Available overlay types
|
|
289
289
|
*/
|
|
290
|
-
export type OverlayType = 'none' | 'slash-autocomplete' | 'resource-autocomplete' | 'model-selector' | 'reasoning' | 'custom-model-wizard' | 'session-selector' | 'mcp-server-list' | 'mcp-server-actions' | 'mcp-add-choice' | 'mcp-add-selector' | 'mcp-custom-type-selector' | 'mcp-custom-wizard' | 'log-level-selector' | 'stream-selector' | 'sounds-selector' | 'session-subcommand-selector' | 'api-key-input' | 'chatgpt-usage-cap' | 'insufficient-credits' | 'login' | 'logout' | 'search' | 'approval' | 'tool-browser' | 'prompt-list' | 'prompt-add-choice' | 'prompt-add-wizard' | 'prompt-delete-selector' | 'session-rename' | 'context-stats' | 'export-wizard' | 'plugin-manager' | 'plugin-list' | 'plugin-actions' | 'marketplace-browser' | 'marketplace-add' | 'command-output';
|
|
290
|
+
export type OverlayType = 'none' | 'slash-autocomplete' | 'resource-autocomplete' | 'model-selector' | 'reasoning' | 'custom-model-wizard' | 'session-selector' | 'mcp-server-list' | 'mcp-server-actions' | 'mcp-add-choice' | 'mcp-add-selector' | 'mcp-custom-type-selector' | 'mcp-custom-wizard' | 'log-level-selector' | 'stream-selector' | 'sounds-selector' | 'session-subcommand-selector' | 'api-key-input' | 'chatgpt-usage-cap' | 'insufficient-credits' | 'login' | 'logout' | 'connect' | 'search' | 'approval' | 'tool-browser' | 'prompt-list' | 'prompt-add-choice' | 'prompt-add-wizard' | 'prompt-delete-selector' | 'session-rename' | 'context-stats' | 'export-wizard' | 'plugin-manager' | 'plugin-list' | 'plugin-actions' | 'marketplace-browser' | 'marketplace-add' | 'command-output';
|
|
291
291
|
/**
|
|
292
292
|
* Temporary modal output for slash commands (e.g., /help, /stats).
|
|
293
293
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EACR,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,aAAa,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,gBAAgB,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACrD,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,kDAAkD;IAClD,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACpC,wEAAwE;IACxE,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACxC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,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C;QACf,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;QACzD,WAAW,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC,CAAC;IACH,0EAA0E;IAC1E,sBAAsB,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACtD,mBAAmB,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAErD,cAAc,EAAE,OAAO,CAAC;IACxB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IAErB,KAAK,EAAE,UAAU,CAAC;IAGlB,EAAE,EAAE,OAAO,CAAC;IAGZ,OAAO,EAAE,YAAY,CAAC;IAGtB,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IACjC,aAAa,EAAE,eAAe,EAAE,CAAC;CACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandOverlays.d.ts","sourceRoot":"","sources":["../../src/utils/commandOverlays.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"commandOverlays.d.ts","sourceRoot":"","sources":["../../src/utils/commandOverlays.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAsC/E;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,eAAe,GACvB,WAAW,GAAG,IAAI,CAgBpB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE7D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/tui",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"description": "Interactive terminal UI for Dexto CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"string-width": "^8.1.0",
|
|
29
29
|
"strip-ansi": "^7.1.2",
|
|
30
30
|
"wrap-ansi": "^9.0.2",
|
|
31
|
-
"@dexto/agent-management": "1.8.
|
|
32
|
-
"@dexto/core": "1.8.
|
|
33
|
-
"@dexto/llm": "1.8.
|
|
34
|
-
"@dexto/registry": "1.8.
|
|
31
|
+
"@dexto/agent-management": "1.8.2",
|
|
32
|
+
"@dexto/core": "1.8.2",
|
|
33
|
+
"@dexto/llm": "1.8.2",
|
|
34
|
+
"@dexto/registry": "1.8.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/react": "^19.0.0",
|