@inkeep/agents-cli 0.41.0 → 0.41.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/commands/init.js
CHANGED
|
@@ -230,6 +230,10 @@ async function localInitCommand(options) {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
if (existsSync(configPath)) {
|
|
233
|
+
if (options?.interactive === false) {
|
|
234
|
+
console.log(chalk.yellow(`Config file already exists at ${configPath}, skipping creation.`));
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
233
237
|
const overwrite = await p.confirm({
|
|
234
238
|
message: `${basename(configPath)} already exists. Overwrite?`,
|
|
235
239
|
initialValue: false
|
|
@@ -243,46 +247,58 @@ async function localInitCommand(options) {
|
|
|
243
247
|
return;
|
|
244
248
|
}
|
|
245
249
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
+
let tenantId;
|
|
251
|
+
let manageApiUrl;
|
|
252
|
+
let runApiUrl;
|
|
253
|
+
if (options?.interactive === false) {
|
|
254
|
+
tenantId = "default";
|
|
255
|
+
manageApiUrl = "http://localhost:3002";
|
|
256
|
+
runApiUrl = "http://localhost:3003";
|
|
257
|
+
} else {
|
|
258
|
+
const tenantIdInput = await p.text({
|
|
259
|
+
message: "Enter your tenant ID:",
|
|
260
|
+
validate: (input) => {
|
|
261
|
+
if (!input || input.trim() === "") return "Tenant ID is required";
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
if (p.isCancel(tenantIdInput)) {
|
|
265
|
+
p.cancel("Operation cancelled");
|
|
266
|
+
process.exit(0);
|
|
250
267
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
if (input && input.trim() !== "") {
|
|
259
|
-
new URL(input);
|
|
268
|
+
tenantId = tenantIdInput;
|
|
269
|
+
const validateUrl = (input) => {
|
|
270
|
+
try {
|
|
271
|
+
if (input && input.trim() !== "") {
|
|
272
|
+
new URL(input);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
260
275
|
return;
|
|
276
|
+
} catch {
|
|
277
|
+
return "Please enter a valid URL";
|
|
261
278
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
279
|
+
};
|
|
280
|
+
const manageApiUrlInput = await p.text({
|
|
281
|
+
message: "Enter the Management API URL:",
|
|
282
|
+
placeholder: "http://localhost:3002",
|
|
283
|
+
initialValue: "http://localhost:3002",
|
|
284
|
+
validate: validateUrl
|
|
285
|
+
});
|
|
286
|
+
if (p.isCancel(manageApiUrlInput)) {
|
|
287
|
+
p.cancel("Operation cancelled");
|
|
288
|
+
process.exit(0);
|
|
265
289
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
message: "Enter the Run API URL:",
|
|
279
|
-
placeholder: "http://localhost:3003",
|
|
280
|
-
initialValue: "http://localhost:3003",
|
|
281
|
-
validate: validateUrl
|
|
282
|
-
});
|
|
283
|
-
if (p.isCancel(runApiUrl)) {
|
|
284
|
-
p.cancel("Operation cancelled");
|
|
285
|
-
process.exit(0);
|
|
290
|
+
manageApiUrl = manageApiUrlInput;
|
|
291
|
+
const runApiUrlInput = await p.text({
|
|
292
|
+
message: "Enter the Run API URL:",
|
|
293
|
+
placeholder: "http://localhost:3003",
|
|
294
|
+
initialValue: "http://localhost:3003",
|
|
295
|
+
validate: validateUrl
|
|
296
|
+
});
|
|
297
|
+
if (p.isCancel(runApiUrlInput)) {
|
|
298
|
+
p.cancel("Operation cancelled");
|
|
299
|
+
process.exit(0);
|
|
300
|
+
}
|
|
301
|
+
runApiUrl = runApiUrlInput;
|
|
286
302
|
}
|
|
287
303
|
const configContent = `import { defineConfig } from '@inkeep/agents-cli/config';
|
|
288
304
|
|
|
@@ -299,6 +315,36 @@ export default defineConfig({
|
|
|
299
315
|
try {
|
|
300
316
|
writeFileSync(configPath, configContent);
|
|
301
317
|
console.log(chalk.green("✓"), `Created ${chalk.cyan(configPath)}`);
|
|
318
|
+
try {
|
|
319
|
+
const profileManager = new ProfileManager();
|
|
320
|
+
const localProfile = {
|
|
321
|
+
remote: {
|
|
322
|
+
manageApi: manageApiUrl,
|
|
323
|
+
manageUi: "http://localhost:3001",
|
|
324
|
+
runApi: runApiUrl
|
|
325
|
+
},
|
|
326
|
+
credential: "none",
|
|
327
|
+
environment: "development"
|
|
328
|
+
};
|
|
329
|
+
if (profileManager.profilesFileExists()) if (profileManager.loadProfiles().profiles.local) {
|
|
330
|
+
profileManager.setActiveProfile("local");
|
|
331
|
+
console.log(chalk.green("✓"), "Set local profile as active");
|
|
332
|
+
} else {
|
|
333
|
+
profileManager.addProfile("local", localProfile);
|
|
334
|
+
profileManager.setActiveProfile("local");
|
|
335
|
+
console.log(chalk.green("✓"), "Created and activated local profile");
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
const profilesConfig = {
|
|
339
|
+
activeProfile: "local",
|
|
340
|
+
profiles: { local: localProfile }
|
|
341
|
+
};
|
|
342
|
+
profileManager.saveProfiles(profilesConfig);
|
|
343
|
+
console.log(chalk.green("✓"), "Created local profile");
|
|
344
|
+
}
|
|
345
|
+
} catch (profileError) {
|
|
346
|
+
console.log(chalk.yellow("⚠"), "Could not set up local profile:", profileError instanceof Error ? profileError.message : String(profileError));
|
|
347
|
+
}
|
|
302
348
|
console.log(chalk.gray("\nYou can now use the Inkeep CLI commands."));
|
|
303
349
|
const configDir = dirname(configPath);
|
|
304
350
|
if (configDir !== process.cwd()) {
|
|
@@ -21,6 +21,11 @@ const PROVIDER_CONFIGS = [
|
|
|
21
21
|
name: "google",
|
|
22
22
|
envVars: ["GOOGLE_GENERATIVE_AI_API_KEY"],
|
|
23
23
|
model: "gemini-2.5-flash"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "azure",
|
|
27
|
+
envVars: ["AZURE_API_KEY"],
|
|
28
|
+
model: ""
|
|
24
29
|
}
|
|
25
30
|
];
|
|
26
31
|
/**
|
|
@@ -35,9 +40,10 @@ function getAvailableModel() {
|
|
|
35
40
|
case "anthropic": return anthropic(config.model);
|
|
36
41
|
case "openai": return openai(config.model);
|
|
37
42
|
case "google": return google(config.model);
|
|
43
|
+
case "azure": continue;
|
|
38
44
|
default: throw new Error(`Unknown provider: ${config.name}`);
|
|
39
45
|
}
|
|
40
|
-
throw new Error("No API keys detected. Please set ANTHROPIC_API_KEY, OPENAI_API_KEY, or
|
|
46
|
+
throw new Error("No API keys detected. Please set ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, or AZURE_API_KEY");
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
//#endregion
|
|
@@ -36,6 +36,10 @@ async function promptForModelConfiguration() {
|
|
|
36
36
|
{
|
|
37
37
|
value: "google",
|
|
38
38
|
label: "Google (Gemini)"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
value: "azure",
|
|
42
|
+
label: "Azure OpenAI"
|
|
39
43
|
}
|
|
40
44
|
],
|
|
41
45
|
required: true
|
|
@@ -126,10 +130,73 @@ async function promptForModelConfiguration() {
|
|
|
126
130
|
value: GOOGLE_MODELS.GEMINI_2_5_FLASH_LITE
|
|
127
131
|
}
|
|
128
132
|
];
|
|
133
|
+
const azureConfigs = {};
|
|
134
|
+
if (providers.includes("azure")) {
|
|
135
|
+
p.note("Azure OpenAI requires custom deployment configuration.");
|
|
136
|
+
const deploymentName = await p.text({
|
|
137
|
+
message: "Enter your Azure deployment name:",
|
|
138
|
+
placeholder: "my-gpt-4o-deployment",
|
|
139
|
+
validate: (value) => {
|
|
140
|
+
if (!value?.trim()) return "Deployment name is required";
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
if (p.isCancel(deploymentName)) {
|
|
144
|
+
p.cancel("Operation cancelled");
|
|
145
|
+
process.exit(0);
|
|
146
|
+
}
|
|
147
|
+
const connectionMethod = await p.select({
|
|
148
|
+
message: "How would you like to connect to Azure?",
|
|
149
|
+
options: [{
|
|
150
|
+
value: "resource",
|
|
151
|
+
label: "Azure Resource Name (recommended)"
|
|
152
|
+
}, {
|
|
153
|
+
value: "url",
|
|
154
|
+
label: "Custom Base URL"
|
|
155
|
+
}]
|
|
156
|
+
});
|
|
157
|
+
if (p.isCancel(connectionMethod)) {
|
|
158
|
+
p.cancel("Operation cancelled");
|
|
159
|
+
process.exit(0);
|
|
160
|
+
}
|
|
161
|
+
if (connectionMethod === "resource") {
|
|
162
|
+
const resourceName = await p.text({
|
|
163
|
+
message: "Enter your Azure resource name:",
|
|
164
|
+
placeholder: "your-azure-resource",
|
|
165
|
+
validate: (value) => {
|
|
166
|
+
if (!value?.trim()) return "Resource name is required";
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
if (p.isCancel(resourceName)) {
|
|
170
|
+
p.cancel("Operation cancelled");
|
|
171
|
+
process.exit(0);
|
|
172
|
+
}
|
|
173
|
+
azureConfigs.resourceName = resourceName;
|
|
174
|
+
} else {
|
|
175
|
+
const baseURL = await p.text({
|
|
176
|
+
message: "Enter your Azure base URL:",
|
|
177
|
+
placeholder: "https://your-endpoint.openai.azure.com/openai",
|
|
178
|
+
validate: (value) => {
|
|
179
|
+
if (!value?.trim()) return "Base URL is required";
|
|
180
|
+
if (!value.startsWith("https://")) return "Base URL must start with https://";
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
if (p.isCancel(baseURL)) {
|
|
184
|
+
p.cancel("Operation cancelled");
|
|
185
|
+
process.exit(0);
|
|
186
|
+
}
|
|
187
|
+
azureConfigs.baseURL = baseURL;
|
|
188
|
+
}
|
|
189
|
+
azureConfigs.deploymentName = deploymentName;
|
|
190
|
+
azureConfigs.model = `azure/${deploymentName}`;
|
|
191
|
+
}
|
|
129
192
|
const availableModels = [];
|
|
130
193
|
if (providers.includes("anthropic")) availableModels.push(...anthropicModels);
|
|
131
194
|
if (providers.includes("openai")) availableModels.push(...openaiModels);
|
|
132
195
|
if (providers.includes("google")) availableModels.push(...googleModels);
|
|
196
|
+
if (providers.includes("azure") && azureConfigs.model) availableModels.push({
|
|
197
|
+
label: `${azureConfigs.deploymentName} (Azure)`,
|
|
198
|
+
value: azureConfigs.model
|
|
199
|
+
});
|
|
133
200
|
const baseModel = await p.select({
|
|
134
201
|
message: "Select your default model for general tasks (required):",
|
|
135
202
|
options: availableModels
|
|
@@ -172,9 +239,27 @@ async function promptForModelConfiguration() {
|
|
|
172
239
|
}
|
|
173
240
|
summarizerModel = summarizerResponse;
|
|
174
241
|
}
|
|
242
|
+
const addProviderOptions = (model) => {
|
|
243
|
+
if (model.startsWith("azure/") && (azureConfigs.resourceName || azureConfigs.baseURL)) {
|
|
244
|
+
const providerOptions = {};
|
|
245
|
+
if (azureConfigs.resourceName) providerOptions.resourceName = azureConfigs.resourceName;
|
|
246
|
+
if (azureConfigs.baseURL) providerOptions.baseURL = azureConfigs.baseURL;
|
|
247
|
+
return providerOptions;
|
|
248
|
+
}
|
|
249
|
+
};
|
|
175
250
|
const modelSettings = { base: { model: baseModel } };
|
|
176
|
-
|
|
177
|
-
if (
|
|
251
|
+
const baseProviderOptions = addProviderOptions(baseModel);
|
|
252
|
+
if (baseProviderOptions) modelSettings.base.providerOptions = baseProviderOptions;
|
|
253
|
+
if (structuredOutputModel) {
|
|
254
|
+
modelSettings.structuredOutput = { model: structuredOutputModel };
|
|
255
|
+
const structuredProviderOptions = addProviderOptions(structuredOutputModel);
|
|
256
|
+
if (structuredProviderOptions) modelSettings.structuredOutput.providerOptions = structuredProviderOptions;
|
|
257
|
+
}
|
|
258
|
+
if (summarizerModel) {
|
|
259
|
+
modelSettings.summarizer = { model: summarizerModel };
|
|
260
|
+
const summarizerProviderOptions = addProviderOptions(summarizerModel);
|
|
261
|
+
if (summarizerProviderOptions) modelSettings.summarizer.providerOptions = summarizerProviderOptions;
|
|
262
|
+
}
|
|
178
263
|
return { modelSettings };
|
|
179
264
|
}
|
|
180
265
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CLOUD_REMOTE, DEFAULT_CLOUD_PROFILE, DEFAULT_PROFILES_CONFIG, explicitRemoteSchema, profileNameSchema, profileSchema, profilesConfigSchema, remoteSchema } from "./types.js";
|
|
1
|
+
import { CLOUD_REMOTE, DEFAULT_CLOUD_PROFILE, DEFAULT_LOCAL_PROFILE, DEFAULT_PROFILES_CONFIG, LOCAL_REMOTE, explicitRemoteSchema, profileNameSchema, profileSchema, profilesConfigSchema, remoteSchema } from "./types.js";
|
|
2
2
|
import { ProfileError, ProfileManager, profileManager } from "./profile-manager.js";
|
|
3
3
|
|
|
4
|
-
export { CLOUD_REMOTE, DEFAULT_CLOUD_PROFILE, DEFAULT_PROFILES_CONFIG, ProfileError, ProfileManager, explicitRemoteSchema, profileManager, profileNameSchema, profileSchema, profilesConfigSchema, remoteSchema };
|
|
4
|
+
export { CLOUD_REMOTE, DEFAULT_CLOUD_PROFILE, DEFAULT_LOCAL_PROFILE, DEFAULT_PROFILES_CONFIG, LOCAL_REMOTE, ProfileError, ProfileManager, explicitRemoteSchema, profileManager, profileNameSchema, profileSchema, profilesConfigSchema, remoteSchema };
|
|
@@ -57,6 +57,23 @@ const DEFAULT_PROFILES_CONFIG = {
|
|
|
57
57
|
activeProfile: "cloud",
|
|
58
58
|
profiles: { cloud: DEFAULT_CLOUD_PROFILE }
|
|
59
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* Baked-in URLs for local development deployment
|
|
62
|
+
*/
|
|
63
|
+
const LOCAL_REMOTE = {
|
|
64
|
+
manageApi: "http://localhost:3002",
|
|
65
|
+
manageUi: "http://localhost:3001",
|
|
66
|
+
runApi: "http://localhost:3003"
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Default local profile configuration
|
|
70
|
+
* Note: credential is 'none' as local deployments typically don't require auth
|
|
71
|
+
*/
|
|
72
|
+
const DEFAULT_LOCAL_PROFILE = {
|
|
73
|
+
remote: LOCAL_REMOTE,
|
|
74
|
+
credential: "none",
|
|
75
|
+
environment: "development"
|
|
76
|
+
};
|
|
60
77
|
|
|
61
78
|
//#endregion
|
|
62
|
-
export { CLOUD_REMOTE, DEFAULT_CLOUD_PROFILE, DEFAULT_PROFILES_CONFIG, explicitRemoteSchema, profileNameSchema, profileSchema, profilesConfigSchema, remoteSchema };
|
|
79
|
+
export { CLOUD_REMOTE, DEFAULT_CLOUD_PROFILE, DEFAULT_LOCAL_PROFILE, DEFAULT_PROFILES_CONFIG, LOCAL_REMOTE, explicitRemoteSchema, profileNameSchema, profileSchema, profilesConfigSchema, remoteSchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-cli",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.2",
|
|
4
4
|
"description": "Inkeep CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"ts-morph": "^26.0.0",
|
|
41
41
|
"tsx": "^4.20.5",
|
|
42
42
|
"yaml": "^2.7.0",
|
|
43
|
-
"@inkeep/agents-core": "^0.41.
|
|
44
|
-
"@inkeep/agents-sdk": "^0.41.
|
|
43
|
+
"@inkeep/agents-core": "^0.41.2",
|
|
44
|
+
"@inkeep/agents-sdk": "^0.41.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/degit": "^2.8.6",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"build": "tsdown",
|
|
77
77
|
"cli": "node ./dist/index.js",
|
|
78
78
|
"postinstall": "node scripts/ensure-keytar.mjs || true",
|
|
79
|
-
"dev": "
|
|
79
|
+
"dev": "pnpm build --watch",
|
|
80
80
|
"test": "node -e \"process.exit(process.env.CI ? 0 : 1)\" && vitest --run --config vitest.config.ci.ts || vitest --run",
|
|
81
81
|
"test:debug": "vitest --run --reporter=verbose --no-coverage",
|
|
82
82
|
"test:watch": "vitest",
|