dexto 1.0.1 → 1.0.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/README.md +13 -11
- package/dist/src/app/{chunk-O5YHNFMH.js → chunk-W7G44EAE.js} +49 -21
- package/dist/src/app/{cli-confirmation-handler-2APQRKHG.js → cli-confirmation-handler-EZF6AMUS.js} +1 -1
- package/dist/src/app/index.js +9182 -236
- package/dist/src/app/{sqlite-backend-KIJZ5IP3.js → sqlite-backend-VRXGIKHQ.js} +1 -1
- package/dist/src/app/webui/.next/standalone/.next/BUILD_ID +1 -1
- package/dist/src/app/webui/.next/standalone/.next/build-manifest.json +2 -2
- package/dist/src/app/webui/.next/standalone/.next/prerender-manifest.json +9 -9
- package/dist/src/app/webui/.next/standalone/.next/required-server-files.json +1 -1
- package/dist/src/app/webui/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/src/app/webui/.next/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/src/app/webui/.next/standalone/.next/server/app/index.html +1 -1
- package/dist/src/app/webui/.next/standalone/.next/server/app/index.rsc +1 -1
- package/dist/src/app/webui/.next/standalone/.next/server/app/playground.html +1 -1
- package/dist/src/app/webui/.next/standalone/.next/server/app/playground.rsc +1 -1
- package/dist/src/app/webui/.next/standalone/.next/server/pages/404.html +1 -1
- package/dist/src/app/webui/.next/standalone/.next/server/pages/500.html +1 -1
- package/dist/src/app/webui/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/src/app/webui/.next/standalone/server.js +1 -1
- package/dist/src/core/{chunk-BGO5B3L4.js → chunk-6VYPSHEV.js} +49 -20
- package/dist/src/core/index.cjs +93 -79
- package/dist/src/core/index.d.cts +46 -9
- package/dist/src/core/index.d.ts +46 -9
- package/dist/src/core/index.js +42 -53
- package/dist/src/core/{sqlite-backend-RKK4WBHE.js → sqlite-backend-M2ZPSSIZ.js} +1 -1
- package/package.json +3 -2
- package/dist/src/app/chunk-M4OZIDPC.js +0 -8651
- package/dist/src/app/interactive-api-key-setup-V3GAACLN.js +0 -269
- /package/dist/src/app/webui/.next/standalone/.next/static/{H-71qcBOOk528tDEa_ldn → L4341-2-iEIknMYuTWeoz}/_buildManifest.js +0 -0
- /package/dist/src/app/webui/.next/standalone/.next/static/{H-71qcBOOk528tDEa_ldn → L4341-2-iEIknMYuTWeoz}/_ssgManifest.js +0 -0
- /package/dist/src/app/webui/.next/static/{H-71qcBOOk528tDEa_ldn → L4341-2-iEIknMYuTWeoz}/_buildManifest.js +0 -0
- /package/dist/src/app/webui/.next/static/{H-71qcBOOk528tDEa_ldn → L4341-2-iEIknMYuTWeoz}/_ssgManifest.js +0 -0
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getPrimaryApiKeyEnvVar,
|
|
3
|
-
updateDextoConfigFile,
|
|
4
|
-
updateEnvFile
|
|
5
|
-
} from "./chunk-M4OZIDPC.js";
|
|
6
|
-
import {
|
|
7
|
-
DEFAULT_CONFIG_PATH,
|
|
8
|
-
logger,
|
|
9
|
-
resolveConfigPath
|
|
10
|
-
} from "./chunk-O5YHNFMH.js";
|
|
11
|
-
|
|
12
|
-
// src/app/cli/utils/interactive-api-key-setup.ts
|
|
13
|
-
import * as p from "@clack/prompts";
|
|
14
|
-
import chalk from "chalk";
|
|
15
|
-
async function interactiveApiKeySetup() {
|
|
16
|
-
try {
|
|
17
|
-
p.intro(chalk.cyan("\u{1F511} API Key Setup"));
|
|
18
|
-
p.note(
|
|
19
|
-
`Dexto needs an API key to work with AI models. You can:
|
|
20
|
-
|
|
21
|
-
\u2022 ${chalk.green("Google Gemini")} - Free tier available (15 requests/minute)
|
|
22
|
-
\u2022 ${chalk.blue("OpenAI")} - Most popular, requires payment
|
|
23
|
-
\u2022 ${chalk.magenta("Anthropic")} - High quality models, requires payment
|
|
24
|
-
\u2022 ${chalk.yellow("Groq")} - Fast inference, free tier available
|
|
25
|
-
|
|
26
|
-
Don't have an API key? Get a free one from Google AI Studio!`,
|
|
27
|
-
chalk.bold("Choose your AI provider")
|
|
28
|
-
);
|
|
29
|
-
const action = await p.select({
|
|
30
|
-
message: "What would you like to do?",
|
|
31
|
-
options: [
|
|
32
|
-
{
|
|
33
|
-
value: "setup",
|
|
34
|
-
label: "Set up an API key now",
|
|
35
|
-
hint: "Interactive setup (recommended)"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
value: "manual",
|
|
39
|
-
label: "Set up manually later",
|
|
40
|
-
hint: "Get instructions for manual setup"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
value: "exit",
|
|
44
|
-
label: "Exit",
|
|
45
|
-
hint: "Quit Dexto for now"
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
});
|
|
49
|
-
if (action === "exit") {
|
|
50
|
-
p.cancel("Setup cancelled. Run dexto again when you have an API key!");
|
|
51
|
-
return { success: false, skipSetup: true };
|
|
52
|
-
}
|
|
53
|
-
if (action === "manual") {
|
|
54
|
-
showManualSetupInstructions();
|
|
55
|
-
return { success: false, skipSetup: true };
|
|
56
|
-
}
|
|
57
|
-
const provider = await p.select({
|
|
58
|
-
message: "Select your AI provider",
|
|
59
|
-
options: [
|
|
60
|
-
{
|
|
61
|
-
value: "google",
|
|
62
|
-
label: "Google Gemini",
|
|
63
|
-
hint: "\u{1F193} Free tier available - get key from aistudio.google.com"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
value: "openai",
|
|
67
|
-
label: "OpenAI",
|
|
68
|
-
hint: "\u{1F4B0} Requires payment - get key from platform.openai.com"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
value: "anthropic",
|
|
72
|
-
label: "Anthropic Claude",
|
|
73
|
-
hint: "\u{1F4B0} Requires payment - get key from console.anthropic.com"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
value: "groq",
|
|
77
|
-
label: "Groq",
|
|
78
|
-
hint: "\u{1F193} Free tier available - get key from console.groq.com"
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
});
|
|
82
|
-
showProviderInstructions(provider);
|
|
83
|
-
const apiKey = await p.text({
|
|
84
|
-
message: `Enter your ${getProviderDisplayName(provider)} API key`,
|
|
85
|
-
placeholder: getApiKeyPlaceholder(provider),
|
|
86
|
-
validate: (value) => {
|
|
87
|
-
if (!value || value.trim().length === 0) {
|
|
88
|
-
return "API key is required";
|
|
89
|
-
}
|
|
90
|
-
if (!isValidApiKeyFormat(value.trim(), provider)) {
|
|
91
|
-
return `Invalid ${getProviderDisplayName(provider)} API key format`;
|
|
92
|
-
}
|
|
93
|
-
return void 0;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
if (p.isCancel(apiKey)) {
|
|
97
|
-
p.cancel("Setup cancelled");
|
|
98
|
-
return { success: false };
|
|
99
|
-
}
|
|
100
|
-
const spinner2 = p.spinner();
|
|
101
|
-
spinner2.start("Saving API key and updating configuration...");
|
|
102
|
-
try {
|
|
103
|
-
await updateEnvFile(process.cwd(), provider, apiKey.trim());
|
|
104
|
-
try {
|
|
105
|
-
const configPath = resolveConfigPath(DEFAULT_CONFIG_PATH);
|
|
106
|
-
await updateDextoConfigFile(configPath, provider);
|
|
107
|
-
spinner2.stop("Configuration updated successfully! \u2728");
|
|
108
|
-
} catch (configError) {
|
|
109
|
-
spinner2.stop("API key saved, but config update failed");
|
|
110
|
-
logger.debug(`Failed to update agent config: ${configError}`);
|
|
111
|
-
p.note(
|
|
112
|
-
`API key saved successfully, but automatic config update failed.
|
|
113
|
-
|
|
114
|
-
To use ${getProviderDisplayName(provider)}, you may need to:
|
|
115
|
-
1. Edit your agent.yml file
|
|
116
|
-
2. Update the llm.provider to "${provider}"
|
|
117
|
-
3. Update the llm.apiKey to "$${getPrimaryApiKeyEnvVar(provider)}"`,
|
|
118
|
-
chalk.yellow("Manual config update needed")
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
p.outro(
|
|
122
|
-
chalk.green("\u{1F389} Setup complete!") + `
|
|
123
|
-
|
|
124
|
-
Your ${getProviderDisplayName(provider)} API key has been saved to .env
|
|
125
|
-
Dexto is now configured to use ${getProviderDisplayName(provider)}.`
|
|
126
|
-
);
|
|
127
|
-
return { success: true, provider };
|
|
128
|
-
} catch (error) {
|
|
129
|
-
spinner2.stop("Failed to save API key");
|
|
130
|
-
logger.error(`Failed to update .env file: ${error}`);
|
|
131
|
-
p.note(
|
|
132
|
-
`Manual setup required:
|
|
133
|
-
|
|
134
|
-
1. Create a .env file in your project root
|
|
135
|
-
2. Add this line: ${getPrimaryApiKeyEnvVar(provider)}=${apiKey}
|
|
136
|
-
3. Update your agent.yml llm.provider to "${provider}"
|
|
137
|
-
4. Update your agent.yml llm.apiKey to "$${getPrimaryApiKeyEnvVar(provider)}"
|
|
138
|
-
5. Run dexto again`,
|
|
139
|
-
chalk.yellow("Save this API key manually")
|
|
140
|
-
);
|
|
141
|
-
return { success: false, provider };
|
|
142
|
-
}
|
|
143
|
-
} catch (error) {
|
|
144
|
-
if (p.isCancel(error)) {
|
|
145
|
-
p.cancel("Setup cancelled");
|
|
146
|
-
return { success: false };
|
|
147
|
-
}
|
|
148
|
-
throw error;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function showManualSetupInstructions() {
|
|
152
|
-
const instructions = [
|
|
153
|
-
`${chalk.bold("1. Get an API key:")}`,
|
|
154
|
-
` \u2022 ${chalk.green("Google Gemini (Free)")}: https://aistudio.google.com/apikey`,
|
|
155
|
-
` \u2022 ${chalk.blue("OpenAI")}: https://platform.openai.com/api-keys`,
|
|
156
|
-
` \u2022 ${chalk.magenta("Anthropic")}: https://console.anthropic.com/keys`,
|
|
157
|
-
` \u2022 ${chalk.yellow("Groq (Free)")}: https://console.groq.com/keys`,
|
|
158
|
-
``,
|
|
159
|
-
`${chalk.bold("2. Create a .env file in your project:")}`,
|
|
160
|
-
` echo "GOOGLE_GENERATIVE_AI_API_KEY=your_key_here" > .env`,
|
|
161
|
-
` # OR for other providers:`,
|
|
162
|
-
` # OPENAI_API_KEY=your_key_here`,
|
|
163
|
-
` # ANTHROPIC_API_KEY=your_key_here`,
|
|
164
|
-
` # GROQ_API_KEY=your_key_here`,
|
|
165
|
-
``,
|
|
166
|
-
`${chalk.bold("3. Run dexto again:")}`,
|
|
167
|
-
` npx dexto`,
|
|
168
|
-
``,
|
|
169
|
-
`${chalk.dim("\u{1F4A1} Tip: Start with Google Gemini for a free experience!")}`
|
|
170
|
-
].join("\n");
|
|
171
|
-
p.note(instructions, chalk.bold("Manual Setup Instructions"));
|
|
172
|
-
}
|
|
173
|
-
function showProviderInstructions(provider) {
|
|
174
|
-
const instructions = getProviderInstructions(provider);
|
|
175
|
-
if (instructions) {
|
|
176
|
-
p.note(instructions.content, instructions.title);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
function getProviderInstructions(provider) {
|
|
180
|
-
switch (provider) {
|
|
181
|
-
case "google":
|
|
182
|
-
return {
|
|
183
|
-
title: chalk.green("Google Gemini - Free API Key"),
|
|
184
|
-
content: `1. Visit: ${chalk.cyan("https://aistudio.google.com/apikey")}
|
|
185
|
-
2. Sign in with your Google account
|
|
186
|
-
3. Click "Create API Key"
|
|
187
|
-
4. Copy the key (starts with "AIza...")
|
|
188
|
-
|
|
189
|
-
${chalk.dim("\u2728 Free tier: 15 requests/minute, 1500 requests/day")}`
|
|
190
|
-
};
|
|
191
|
-
case "openai":
|
|
192
|
-
return {
|
|
193
|
-
title: chalk.blue("OpenAI API Key"),
|
|
194
|
-
content: `1. Visit: ${chalk.cyan("https://platform.openai.com/api-keys")}
|
|
195
|
-
2. Sign in to your OpenAI account
|
|
196
|
-
3. Click "Create new secret key"
|
|
197
|
-
4. Copy the key (starts with "sk-...")
|
|
198
|
-
|
|
199
|
-
${chalk.dim("\u{1F4B0} Requires payment - $5 minimum credit")}`
|
|
200
|
-
};
|
|
201
|
-
case "anthropic":
|
|
202
|
-
return {
|
|
203
|
-
title: chalk.magenta("Anthropic API Key"),
|
|
204
|
-
content: `1. Visit: ${chalk.cyan("https://console.anthropic.com/keys")}
|
|
205
|
-
2. Sign in to your Anthropic account
|
|
206
|
-
3. Click "Create Key"
|
|
207
|
-
4. Copy the key (starts with "sk-ant-...")
|
|
208
|
-
|
|
209
|
-
${chalk.dim("\u{1F4B0} Requires payment - $5 minimum credit")}`
|
|
210
|
-
};
|
|
211
|
-
case "groq":
|
|
212
|
-
return {
|
|
213
|
-
title: chalk.yellow("Groq API Key"),
|
|
214
|
-
content: `1. Visit: ${chalk.cyan("https://console.groq.com/keys")}
|
|
215
|
-
2. Sign in with your account
|
|
216
|
-
3. Click "Create API Key"
|
|
217
|
-
4. Copy the key (starts with "gsk_...")
|
|
218
|
-
|
|
219
|
-
${chalk.dim("\u{1F193} Free tier: 30 requests/minute")}`
|
|
220
|
-
};
|
|
221
|
-
default:
|
|
222
|
-
return null;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
function getProviderDisplayName(provider) {
|
|
226
|
-
switch (provider) {
|
|
227
|
-
case "google":
|
|
228
|
-
return "Google Gemini";
|
|
229
|
-
case "openai":
|
|
230
|
-
return "OpenAI";
|
|
231
|
-
case "anthropic":
|
|
232
|
-
return "Anthropic";
|
|
233
|
-
case "groq":
|
|
234
|
-
return "Groq";
|
|
235
|
-
default:
|
|
236
|
-
return provider;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
function getApiKeyPlaceholder(provider) {
|
|
240
|
-
switch (provider) {
|
|
241
|
-
case "google":
|
|
242
|
-
return "AIza...";
|
|
243
|
-
case "openai":
|
|
244
|
-
return "sk-...";
|
|
245
|
-
case "anthropic":
|
|
246
|
-
return "sk-ant-...";
|
|
247
|
-
case "groq":
|
|
248
|
-
return "gsk_...";
|
|
249
|
-
default:
|
|
250
|
-
return "your-api-key";
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
function isValidApiKeyFormat(apiKey, provider) {
|
|
254
|
-
switch (provider) {
|
|
255
|
-
case "google":
|
|
256
|
-
return apiKey.startsWith("AIza") && apiKey.length > 20;
|
|
257
|
-
case "openai":
|
|
258
|
-
return apiKey.startsWith("sk-") && apiKey.length > 40;
|
|
259
|
-
case "anthropic":
|
|
260
|
-
return apiKey.startsWith("sk-ant-") && apiKey.length > 40;
|
|
261
|
-
case "groq":
|
|
262
|
-
return apiKey.startsWith("gsk_") && apiKey.length > 40;
|
|
263
|
-
default:
|
|
264
|
-
return apiKey.length > 10;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
export {
|
|
268
|
-
interactiveApiKeySetup
|
|
269
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|