@inkeep/agents-cli 0.12.1 → 0.13.0
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/config.d.ts +20 -2
- package/dist/index.js +98 -60
- package/package.json +3 -3
package/dist/config.d.ts
CHANGED
|
@@ -1,10 +1,28 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface ApiConfig {
|
|
2
|
+
url: string;
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
}
|
|
5
|
+
interface FlatInkeepConfig {
|
|
2
6
|
tenantId: string;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use the nested `agentsManageApi.url` format instead
|
|
9
|
+
*/
|
|
3
10
|
agentsManageApiUrl: string;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use the nested `agentsRunApi.url` format instead
|
|
13
|
+
*/
|
|
4
14
|
agentsRunApiUrl: string;
|
|
5
15
|
manageUiUrl?: string;
|
|
6
16
|
outputDirectory?: string;
|
|
7
17
|
}
|
|
18
|
+
interface NestedInkeepConfig {
|
|
19
|
+
tenantId: string;
|
|
20
|
+
agentsManageApi: ApiConfig;
|
|
21
|
+
agentsRunApi: ApiConfig;
|
|
22
|
+
manageUiUrl?: string;
|
|
23
|
+
outputDirectory?: string;
|
|
24
|
+
}
|
|
25
|
+
type InkeepConfig = FlatInkeepConfig | NestedInkeepConfig;
|
|
8
26
|
declare function defineConfig(config: InkeepConfig): InkeepConfig;
|
|
9
27
|
|
|
10
|
-
export { type InkeepConfig, defineConfig };
|
|
28
|
+
export { type ApiConfig, type FlatInkeepConfig, type InkeepConfig, type NestedInkeepConfig, defineConfig };
|
package/dist/index.js
CHANGED
|
@@ -2714,7 +2714,7 @@ var init_schemas = __esm({
|
|
|
2714
2714
|
});
|
|
2715
2715
|
ProjectSelectSchema = createSelectSchema(projects);
|
|
2716
2716
|
ProjectInsertSchema = createInsertSchema(projects).extend({
|
|
2717
|
-
models: ProjectModelSchema
|
|
2717
|
+
models: ProjectModelSchema,
|
|
2718
2718
|
stopWhen: StopWhenSchema.optional()
|
|
2719
2719
|
}).omit({
|
|
2720
2720
|
createdAt: true,
|
|
@@ -20529,41 +20529,6 @@ var init_src = __esm({
|
|
|
20529
20529
|
}
|
|
20530
20530
|
});
|
|
20531
20531
|
|
|
20532
|
-
// src/env.ts
|
|
20533
|
-
import { z as z10 } from "zod";
|
|
20534
|
-
var envSchema2, parseEnv2, env2;
|
|
20535
|
-
var init_env2 = __esm({
|
|
20536
|
-
"src/env.ts"() {
|
|
20537
|
-
"use strict";
|
|
20538
|
-
init_esm_shims();
|
|
20539
|
-
init_src();
|
|
20540
|
-
loadEnvironmentFiles();
|
|
20541
|
-
envSchema2 = z10.object({
|
|
20542
|
-
DEBUG: z10.string().optional(),
|
|
20543
|
-
// Secrets loaded from .env files (relative to where CLI is executed)
|
|
20544
|
-
INKEEP_AGENTS_MANAGE_API_BYPASS_SECRET: z10.string().optional(),
|
|
20545
|
-
INKEEP_AGENTS_RUN_API_BYPASS_SECRET: z10.string().optional(),
|
|
20546
|
-
ANTHROPIC_API_KEY: z10.string().optional()
|
|
20547
|
-
});
|
|
20548
|
-
parseEnv2 = () => {
|
|
20549
|
-
try {
|
|
20550
|
-
const parsedEnv = envSchema2.parse(process.env);
|
|
20551
|
-
return parsedEnv;
|
|
20552
|
-
} catch (error) {
|
|
20553
|
-
if (error instanceof z10.ZodError) {
|
|
20554
|
-
const missingVars = error.issues.map((issue) => issue.path.join("."));
|
|
20555
|
-
throw new Error(
|
|
20556
|
-
`\u274C Invalid environment variables: ${missingVars.join(", ")}
|
|
20557
|
-
${error.message}`
|
|
20558
|
-
);
|
|
20559
|
-
}
|
|
20560
|
-
throw error;
|
|
20561
|
-
}
|
|
20562
|
-
};
|
|
20563
|
-
env2 = parseEnv2();
|
|
20564
|
-
}
|
|
20565
|
-
});
|
|
20566
|
-
|
|
20567
20532
|
// src/utils/tsx-loader.ts
|
|
20568
20533
|
import { extname } from "path";
|
|
20569
20534
|
import { pathToFileURL } from "url";
|
|
@@ -20601,8 +20566,41 @@ var init_tsx_loader = __esm({
|
|
|
20601
20566
|
});
|
|
20602
20567
|
|
|
20603
20568
|
// src/utils/config.ts
|
|
20569
|
+
var config_exports = {};
|
|
20570
|
+
__export(config_exports, {
|
|
20571
|
+
getAgentsManageApiUrl: () => getAgentsManageApiUrl,
|
|
20572
|
+
getAgentsRunApiUrl: () => getAgentsRunApiUrl,
|
|
20573
|
+
getProjectId: () => getProjectId,
|
|
20574
|
+
getTenantId: () => getTenantId,
|
|
20575
|
+
loadConfig: () => loadConfig,
|
|
20576
|
+
validateConfiguration: () => validateConfiguration
|
|
20577
|
+
});
|
|
20604
20578
|
import { existsSync as existsSync4 } from "fs";
|
|
20605
20579
|
import { dirname as dirname3, join as join4, resolve as resolve2 } from "path";
|
|
20580
|
+
function isNestedConfig(config) {
|
|
20581
|
+
return config && (config.agentsManageApi !== void 0 || config.agentsRunApi !== void 0);
|
|
20582
|
+
}
|
|
20583
|
+
function normalizeConfig(config) {
|
|
20584
|
+
if (isNestedConfig(config)) {
|
|
20585
|
+
return {
|
|
20586
|
+
tenantId: config.tenantId,
|
|
20587
|
+
agentsManageApiUrl: config.agentsManageApi?.url,
|
|
20588
|
+
agentsRunApiUrl: config.agentsRunApi?.url,
|
|
20589
|
+
agentsManageApiKey: config.agentsManageApi?.apiKey,
|
|
20590
|
+
agentsRunApiKey: config.agentsRunApi?.apiKey,
|
|
20591
|
+
manageUiUrl: config.manageUiUrl,
|
|
20592
|
+
outputDirectory: config.outputDirectory
|
|
20593
|
+
};
|
|
20594
|
+
} else {
|
|
20595
|
+
return {
|
|
20596
|
+
tenantId: config.tenantId,
|
|
20597
|
+
agentsManageApiUrl: config.agentsManageApiUrl,
|
|
20598
|
+
agentsRunApiUrl: config.agentsRunApiUrl,
|
|
20599
|
+
manageUiUrl: config.manageUiUrl,
|
|
20600
|
+
outputDirectory: config.outputDirectory
|
|
20601
|
+
};
|
|
20602
|
+
}
|
|
20603
|
+
}
|
|
20606
20604
|
function findConfigFile(startPath = process.cwd()) {
|
|
20607
20605
|
let currentPath = resolve2(startPath);
|
|
20608
20606
|
const root = "/";
|
|
@@ -20638,11 +20636,12 @@ async function loadConfigFromFile(configPath) {
|
|
|
20638
20636
|
}
|
|
20639
20637
|
try {
|
|
20640
20638
|
const module = await importWithTypeScriptSupport(resolvedPath);
|
|
20641
|
-
const
|
|
20642
|
-
|
|
20643
|
-
if (!config) {
|
|
20639
|
+
const rawConfig = module.default || module.config;
|
|
20640
|
+
if (!rawConfig) {
|
|
20644
20641
|
throw new Error(`No config exported from ${resolvedPath}`);
|
|
20645
20642
|
}
|
|
20643
|
+
const config = normalizeConfig(rawConfig);
|
|
20644
|
+
logger12.info({ config }, `Loaded config values`);
|
|
20646
20645
|
return config;
|
|
20647
20646
|
} catch (error) {
|
|
20648
20647
|
console.warn(`Warning: Failed to load config file ${resolvedPath}:`, error);
|
|
@@ -20704,6 +20703,8 @@ async function validateConfiguration(tenantIdFlag, agentsManageApiUrlFlag, agent
|
|
|
20704
20703
|
tenantId: tenantIdFlag,
|
|
20705
20704
|
agentsManageApiUrl: agentsManageApiUrlFlag,
|
|
20706
20705
|
agentsRunApiUrl: agentsRunApiUrlFlag,
|
|
20706
|
+
agentsManageApiKey: config.agentsManageApiKey,
|
|
20707
|
+
agentsRunApiKey: config.agentsRunApiKey,
|
|
20707
20708
|
manageUiUrl: config.manageUiUrl,
|
|
20708
20709
|
sources: sources2
|
|
20709
20710
|
};
|
|
@@ -20742,6 +20743,8 @@ Please ensure your config file exports a valid configuration with tenantId.`
|
|
|
20742
20743
|
tenantId,
|
|
20743
20744
|
agentsManageApiUrl,
|
|
20744
20745
|
agentsRunApiUrl,
|
|
20746
|
+
agentsManageApiKey: config.agentsManageApiKey,
|
|
20747
|
+
agentsRunApiKey: config.agentsRunApiKey,
|
|
20745
20748
|
manageUiUrl: config.manageUiUrl,
|
|
20746
20749
|
sources
|
|
20747
20750
|
};
|
|
@@ -20763,16 +20766,17 @@ var init_api = __esm({
|
|
|
20763
20766
|
"src/api.ts"() {
|
|
20764
20767
|
"use strict";
|
|
20765
20768
|
init_esm_shims();
|
|
20766
|
-
init_env2();
|
|
20767
20769
|
init_config();
|
|
20768
20770
|
BaseApiClient = class {
|
|
20769
20771
|
apiUrl;
|
|
20770
20772
|
tenantId;
|
|
20771
20773
|
projectId;
|
|
20772
|
-
|
|
20774
|
+
apiKey;
|
|
20775
|
+
constructor(apiUrl, tenantId, projectId, apiKey) {
|
|
20773
20776
|
this.apiUrl = apiUrl;
|
|
20774
20777
|
this.tenantId = tenantId;
|
|
20775
20778
|
this.projectId = projectId;
|
|
20779
|
+
this.apiKey = apiKey;
|
|
20776
20780
|
}
|
|
20777
20781
|
checkTenantId() {
|
|
20778
20782
|
if (!this.tenantId) {
|
|
@@ -20791,14 +20795,16 @@ var init_api = __esm({
|
|
|
20791
20795
|
}
|
|
20792
20796
|
};
|
|
20793
20797
|
ManagementApiClient = class _ManagementApiClient extends BaseApiClient {
|
|
20794
|
-
constructor(apiUrl, tenantId, projectId) {
|
|
20795
|
-
super(apiUrl, tenantId, projectId);
|
|
20798
|
+
constructor(apiUrl, tenantId, projectId, apiKey) {
|
|
20799
|
+
super(apiUrl, tenantId, projectId, apiKey);
|
|
20796
20800
|
}
|
|
20797
20801
|
static async create(apiUrl, configPath, tenantIdOverride, projectIdOverride) {
|
|
20798
20802
|
const resolvedApiUrl = await getAgentsManageApiUrl(apiUrl, configPath);
|
|
20799
20803
|
const tenantId = tenantIdOverride || await getTenantId(configPath);
|
|
20800
20804
|
const projectId = projectIdOverride || await getProjectId(configPath);
|
|
20801
|
-
|
|
20805
|
+
const { validateConfiguration: validateConfiguration2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
20806
|
+
const config = await validateConfiguration2(tenantIdOverride, apiUrl, void 0, configPath);
|
|
20807
|
+
return new _ManagementApiClient(resolvedApiUrl, tenantId, projectId, config.agentsManageApiKey);
|
|
20802
20808
|
}
|
|
20803
20809
|
async listGraphs() {
|
|
20804
20810
|
const tenantId = this.checkTenantId();
|
|
@@ -20809,8 +20815,8 @@ var init_api = __esm({
|
|
|
20809
20815
|
method: "GET",
|
|
20810
20816
|
headers: {
|
|
20811
20817
|
"Content-Type": "application/json",
|
|
20812
|
-
...
|
|
20813
|
-
Authorization: `Bearer ${
|
|
20818
|
+
...this.apiKey && {
|
|
20819
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
20814
20820
|
}
|
|
20815
20821
|
}
|
|
20816
20822
|
}
|
|
@@ -20840,8 +20846,8 @@ var init_api = __esm({
|
|
|
20840
20846
|
method: "PUT",
|
|
20841
20847
|
headers: {
|
|
20842
20848
|
"Content-Type": "application/json",
|
|
20843
|
-
...
|
|
20844
|
-
Authorization: `Bearer ${
|
|
20849
|
+
...this.apiKey && {
|
|
20850
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
20845
20851
|
}
|
|
20846
20852
|
},
|
|
20847
20853
|
body: JSON.stringify(graphDefinition)
|
|
@@ -20857,14 +20863,16 @@ ${errorText}`);
|
|
|
20857
20863
|
}
|
|
20858
20864
|
};
|
|
20859
20865
|
ExecutionApiClient = class _ExecutionApiClient extends BaseApiClient {
|
|
20860
|
-
constructor(apiUrl, tenantId, projectId) {
|
|
20861
|
-
super(apiUrl, tenantId, projectId);
|
|
20866
|
+
constructor(apiUrl, tenantId, projectId, apiKey) {
|
|
20867
|
+
super(apiUrl, tenantId, projectId, apiKey);
|
|
20862
20868
|
}
|
|
20863
20869
|
static async create(apiUrl, configPath, tenantIdOverride, projectIdOverride) {
|
|
20864
20870
|
const resolvedApiUrl = await getAgentsRunApiUrl(apiUrl, configPath);
|
|
20865
20871
|
const tenantId = tenantIdOverride || await getTenantId(configPath);
|
|
20866
20872
|
const projectId = projectIdOverride || await getProjectId(configPath);
|
|
20867
|
-
|
|
20873
|
+
const { validateConfiguration: validateConfiguration2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
20874
|
+
const config = await validateConfiguration2(tenantIdOverride, void 0, apiUrl, configPath);
|
|
20875
|
+
return new _ExecutionApiClient(resolvedApiUrl, tenantId, projectId, config.agentsRunApiKey);
|
|
20868
20876
|
}
|
|
20869
20877
|
async chatCompletion(graphId, messages2, conversationId) {
|
|
20870
20878
|
const response = await fetch(`${this.apiUrl}/v1/chat/completions`, {
|
|
@@ -20872,8 +20880,8 @@ ${errorText}`);
|
|
|
20872
20880
|
headers: {
|
|
20873
20881
|
"Content-Type": "application/json",
|
|
20874
20882
|
Accept: "text/event-stream",
|
|
20875
|
-
...
|
|
20876
|
-
Authorization: `Bearer ${
|
|
20883
|
+
...this.apiKey && {
|
|
20884
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
20877
20885
|
},
|
|
20878
20886
|
"x-inkeep-tenant-id": this.tenantId || "test-tenant-id",
|
|
20879
20887
|
"x-inkeep-project-id": this.projectId,
|
|
@@ -21218,7 +21226,35 @@ var init_chat_enhanced = __esm({
|
|
|
21218
21226
|
|
|
21219
21227
|
// src/index.ts
|
|
21220
21228
|
init_esm_shims();
|
|
21221
|
-
|
|
21229
|
+
|
|
21230
|
+
// src/env.ts
|
|
21231
|
+
init_esm_shims();
|
|
21232
|
+
init_src();
|
|
21233
|
+
import { z as z10 } from "zod";
|
|
21234
|
+
loadEnvironmentFiles();
|
|
21235
|
+
var envSchema2 = z10.object({
|
|
21236
|
+
DEBUG: z10.string().optional(),
|
|
21237
|
+
// Secrets loaded from .env files (relative to where CLI is executed)
|
|
21238
|
+
ANTHROPIC_API_KEY: z10.string().optional()
|
|
21239
|
+
});
|
|
21240
|
+
var parseEnv2 = () => {
|
|
21241
|
+
try {
|
|
21242
|
+
const parsedEnv = envSchema2.parse(process.env);
|
|
21243
|
+
return parsedEnv;
|
|
21244
|
+
} catch (error) {
|
|
21245
|
+
if (error instanceof z10.ZodError) {
|
|
21246
|
+
const missingVars = error.issues.map((issue) => issue.path.join("."));
|
|
21247
|
+
throw new Error(
|
|
21248
|
+
`\u274C Invalid environment variables: ${missingVars.join(", ")}
|
|
21249
|
+
${error.message}`
|
|
21250
|
+
);
|
|
21251
|
+
}
|
|
21252
|
+
throw error;
|
|
21253
|
+
}
|
|
21254
|
+
};
|
|
21255
|
+
var env2 = parseEnv2();
|
|
21256
|
+
|
|
21257
|
+
// src/index.ts
|
|
21222
21258
|
import { readFileSync as readFileSync3 } from "fs";
|
|
21223
21259
|
import { dirname as dirname5, join as join10 } from "path";
|
|
21224
21260
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
@@ -21748,8 +21784,12 @@ async function initCommand(options) {
|
|
|
21748
21784
|
|
|
21749
21785
|
export default defineConfig({
|
|
21750
21786
|
tenantId: '${answers.tenantId}',
|
|
21751
|
-
|
|
21752
|
-
|
|
21787
|
+
agentsManageApi: {
|
|
21788
|
+
url: '${answers.apiUrl}',
|
|
21789
|
+
},
|
|
21790
|
+
agentsRunApi: {
|
|
21791
|
+
url: '${answers.apiUrl}',
|
|
21792
|
+
},
|
|
21753
21793
|
});
|
|
21754
21794
|
`;
|
|
21755
21795
|
try {
|
|
@@ -21847,13 +21887,12 @@ ${table.toString()}`);
|
|
|
21847
21887
|
|
|
21848
21888
|
// src/commands/pull.ts
|
|
21849
21889
|
init_esm_shims();
|
|
21850
|
-
init_env2();
|
|
21851
|
-
init_tsx_loader();
|
|
21852
21890
|
import { existsSync as existsSync6, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync4 } from "fs";
|
|
21853
21891
|
import { dirname as dirname4, join as join7, resolve as resolve4 } from "path";
|
|
21854
21892
|
import chalk6 from "chalk";
|
|
21855
21893
|
import ora4 from "ora";
|
|
21856
21894
|
import prompts from "prompts";
|
|
21895
|
+
init_tsx_loader();
|
|
21857
21896
|
|
|
21858
21897
|
// src/utils/project-directory.ts
|
|
21859
21898
|
init_esm_shims();
|
|
@@ -23199,12 +23238,11 @@ async function pullProjectCommand(options) {
|
|
|
23199
23238
|
|
|
23200
23239
|
// src/commands/push.ts
|
|
23201
23240
|
init_esm_shims();
|
|
23202
|
-
init_env2();
|
|
23203
|
-
init_config();
|
|
23204
23241
|
import { existsSync as existsSync8 } from "fs";
|
|
23205
23242
|
import { join as join9, resolve as resolve5 } from "path";
|
|
23206
23243
|
import chalk7 from "chalk";
|
|
23207
23244
|
import ora5 from "ora";
|
|
23245
|
+
init_config();
|
|
23208
23246
|
|
|
23209
23247
|
// src/utils/environment-loader.ts
|
|
23210
23248
|
init_esm_shims();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Inkeep CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"recast": "^0.23.0",
|
|
46
46
|
"ts-morph": "^26.0.0",
|
|
47
47
|
"tsx": "^4.20.5",
|
|
48
|
-
"@inkeep/agents-
|
|
49
|
-
"@inkeep/agents-
|
|
48
|
+
"@inkeep/agents-core": "^0.13.0",
|
|
49
|
+
"@inkeep/agents-manage-ui": "^0.13.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/degit": "^2.8.6",
|