@inkeep/agents-sdk 0.27.0 → 0.29.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/index.cjs +59 -7
- package/dist/index.d.cts +30 -1
- package/dist/index.d.ts +30 -1
- package/dist/index.js +59 -7
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1517,7 +1517,8 @@ var DataComponent = class {
|
|
|
1517
1517
|
this.config = {
|
|
1518
1518
|
...config,
|
|
1519
1519
|
id: this.id,
|
|
1520
|
-
props: processedProps
|
|
1520
|
+
props: processedProps,
|
|
1521
|
+
render: config.render || null
|
|
1521
1522
|
};
|
|
1522
1523
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
1523
1524
|
this.tenantId = "default";
|
|
@@ -1551,6 +1552,9 @@ var DataComponent = class {
|
|
|
1551
1552
|
getProps() {
|
|
1552
1553
|
return this.config.props;
|
|
1553
1554
|
}
|
|
1555
|
+
getRender() {
|
|
1556
|
+
return this.config.render;
|
|
1557
|
+
}
|
|
1554
1558
|
// Public method to ensure data component exists in backend (with upsert behavior)
|
|
1555
1559
|
async init() {
|
|
1556
1560
|
if (this.initialized) return;
|
|
@@ -1580,7 +1584,8 @@ var DataComponent = class {
|
|
|
1580
1584
|
id: this.getId(),
|
|
1581
1585
|
name: this.config.name,
|
|
1582
1586
|
description: this.config.description,
|
|
1583
|
-
props: this.config.props
|
|
1587
|
+
props: this.config.props,
|
|
1588
|
+
render: this.config.render
|
|
1584
1589
|
};
|
|
1585
1590
|
logger6.info({ dataComponentData }, "dataComponentData for create/update");
|
|
1586
1591
|
const updateResponse = await fetch(
|
|
@@ -2258,6 +2263,7 @@ var Project = class {
|
|
|
2258
2263
|
if (!credentialReferencesObject[credential2.id]) {
|
|
2259
2264
|
credentialReferencesObject[credential2.id] = {
|
|
2260
2265
|
id: credential2.id,
|
|
2266
|
+
name: credential2.name,
|
|
2261
2267
|
type: credential2.type,
|
|
2262
2268
|
credentialStoreId: credential2.credentialStoreId,
|
|
2263
2269
|
retrievalParams: credential2.retrievalParams
|
|
@@ -2375,6 +2381,7 @@ var Project = class {
|
|
|
2375
2381
|
if (!credentialReferencesObject[credential2.id]) {
|
|
2376
2382
|
credentialReferencesObject[credential2.id] = {
|
|
2377
2383
|
id: credential2.id,
|
|
2384
|
+
name: credential2.name,
|
|
2378
2385
|
type: credential2.type,
|
|
2379
2386
|
credentialStoreId: credential2.credentialStoreId,
|
|
2380
2387
|
retrievalParams: credential2.retrievalParams
|
|
@@ -2399,23 +2406,27 @@ var Project = class {
|
|
|
2399
2406
|
let dataComponentName;
|
|
2400
2407
|
let dataComponentDescription;
|
|
2401
2408
|
let dataComponentProps;
|
|
2409
|
+
let dataComponentRender;
|
|
2402
2410
|
if (dataComponent2.getId) {
|
|
2403
2411
|
dataComponentId = dataComponent2.getId();
|
|
2404
2412
|
dataComponentName = dataComponent2.getName();
|
|
2405
2413
|
dataComponentDescription = dataComponent2.getDescription() || "";
|
|
2406
2414
|
dataComponentProps = dataComponent2.getProps() || {};
|
|
2415
|
+
dataComponentRender = dataComponent2.getRender?.() || null;
|
|
2407
2416
|
} else {
|
|
2408
2417
|
dataComponentId = dataComponent2.id || (dataComponent2.name ? dataComponent2.name.toLowerCase().replace(/\s+/g, "-") : "");
|
|
2409
2418
|
dataComponentName = dataComponent2.name || "";
|
|
2410
2419
|
dataComponentDescription = dataComponent2.description || "";
|
|
2411
2420
|
dataComponentProps = dataComponent2.props || {};
|
|
2421
|
+
dataComponentRender = dataComponent2.render || null;
|
|
2412
2422
|
}
|
|
2413
2423
|
if (!dataComponentsObject[dataComponentId] && dataComponentName) {
|
|
2414
2424
|
dataComponentsObject[dataComponentId] = {
|
|
2415
2425
|
id: dataComponentId,
|
|
2416
2426
|
name: dataComponentName,
|
|
2417
2427
|
description: dataComponentDescription,
|
|
2418
|
-
props: dataComponentProps
|
|
2428
|
+
props: dataComponentProps,
|
|
2429
|
+
render: dataComponentRender
|
|
2419
2430
|
};
|
|
2420
2431
|
}
|
|
2421
2432
|
}
|
|
@@ -2458,6 +2469,7 @@ var Project = class {
|
|
|
2458
2469
|
if (!credentialReferencesObject[credential2.id]) {
|
|
2459
2470
|
credentialReferencesObject[credential2.id] = {
|
|
2460
2471
|
id: credential2.id,
|
|
2472
|
+
name: credential2.name,
|
|
2461
2473
|
type: credential2.type,
|
|
2462
2474
|
credentialStoreId: credential2.credentialStoreId,
|
|
2463
2475
|
retrievalParams: credential2.retrievalParams
|
|
@@ -2977,7 +2989,8 @@ var SubAgent = class {
|
|
|
2977
2989
|
id: comp.getId(),
|
|
2978
2990
|
name: comp.getName(),
|
|
2979
2991
|
description: comp.getDescription(),
|
|
2980
|
-
props: comp.getProps()
|
|
2992
|
+
props: comp.getProps(),
|
|
2993
|
+
render: comp.getRender?.() || null
|
|
2981
2994
|
};
|
|
2982
2995
|
}
|
|
2983
2996
|
if (comp && typeof comp === "object" && comp.props && schemaConversion.isZodSchema(comp.props)) {
|
|
@@ -2985,7 +2998,8 @@ var SubAgent = class {
|
|
|
2985
2998
|
id: comp.id,
|
|
2986
2999
|
name: comp.name,
|
|
2987
3000
|
description: comp.description,
|
|
2988
|
-
props: schemaConversion.convertZodToJsonSchemaWithPreview(comp.props)
|
|
3001
|
+
props: schemaConversion.convertZodToJsonSchemaWithPreview(comp.props),
|
|
3002
|
+
render: comp.render || null
|
|
2989
3003
|
};
|
|
2990
3004
|
}
|
|
2991
3005
|
return comp;
|
|
@@ -3477,7 +3491,8 @@ var SubAgent = class {
|
|
|
3477
3491
|
id: dataComponent2.id,
|
|
3478
3492
|
name: dataComponent2.name,
|
|
3479
3493
|
description: dataComponent2.description,
|
|
3480
|
-
props: dataComponent2.props
|
|
3494
|
+
props: dataComponent2.props,
|
|
3495
|
+
render: dataComponent2.render
|
|
3481
3496
|
});
|
|
3482
3497
|
dc.setContext(this.tenantId, this.projectId);
|
|
3483
3498
|
await dc.init();
|
|
@@ -3638,7 +3653,15 @@ function subAgent(config) {
|
|
|
3638
3653
|
return new SubAgent(config);
|
|
3639
3654
|
}
|
|
3640
3655
|
function credential(config) {
|
|
3641
|
-
|
|
3656
|
+
try {
|
|
3657
|
+
return agentsCore.CredentialReferenceApiInsertSchema.parse(config);
|
|
3658
|
+
} catch (error) {
|
|
3659
|
+
if (error instanceof Error) {
|
|
3660
|
+
const credId = config.id || "unknown";
|
|
3661
|
+
throw new Error(`Invalid credential '${credId}': ${error.message}`);
|
|
3662
|
+
}
|
|
3663
|
+
throw error;
|
|
3664
|
+
}
|
|
3642
3665
|
}
|
|
3643
3666
|
function mcpServer(config) {
|
|
3644
3667
|
if (!config.serverUrl) {
|
|
@@ -3735,6 +3758,35 @@ function isCredentialReference(value) {
|
|
|
3735
3758
|
// src/environment-settings.ts
|
|
3736
3759
|
function createEnvironmentSettings(environments) {
|
|
3737
3760
|
return {
|
|
3761
|
+
getEnvironmentCredential: (key) => {
|
|
3762
|
+
const currentEnv = process.env.INKEEP_ENV || "development";
|
|
3763
|
+
const env = environments[currentEnv];
|
|
3764
|
+
if (!env) {
|
|
3765
|
+
throw new Error(
|
|
3766
|
+
`Environment '${currentEnv}' not found. Available: ${Object.keys(environments).join(", ")}`
|
|
3767
|
+
);
|
|
3768
|
+
}
|
|
3769
|
+
const credential2 = env.credentials?.[key];
|
|
3770
|
+
if (!credential2) {
|
|
3771
|
+
throw new Error(`Credential '${String(key)}' not found in environment '${currentEnv}'`);
|
|
3772
|
+
}
|
|
3773
|
+
return credential2;
|
|
3774
|
+
},
|
|
3775
|
+
getEnvironmentMcp: (key) => {
|
|
3776
|
+
const currentEnv = process.env.INKEEP_ENV || "development";
|
|
3777
|
+
const env = environments[currentEnv];
|
|
3778
|
+
if (!env) {
|
|
3779
|
+
throw new Error(
|
|
3780
|
+
`Environment '${currentEnv}' not found. Available: ${Object.keys(environments).join(", ")}`
|
|
3781
|
+
);
|
|
3782
|
+
}
|
|
3783
|
+
const mcpServer2 = env.mcpServers?.[key];
|
|
3784
|
+
if (!mcpServer2) {
|
|
3785
|
+
throw new Error(`MCP Server '${String(key)}' not found in environment '${currentEnv}'`);
|
|
3786
|
+
}
|
|
3787
|
+
return mcpServer2;
|
|
3788
|
+
},
|
|
3789
|
+
//Deprecated: Use getEnvironmentCredential instead
|
|
3738
3790
|
getEnvironmentSetting: (key) => {
|
|
3739
3791
|
const currentEnv = process.env.INKEEP_ENV || "development";
|
|
3740
3792
|
const env = environments[currentEnv];
|
package/dist/index.d.cts
CHANGED
|
@@ -156,6 +156,10 @@ interface ArtifactComponentConfig extends ComponentConfig {
|
|
|
156
156
|
}
|
|
157
157
|
interface DataComponentConfig extends ComponentConfig {
|
|
158
158
|
props: Record<string, unknown> | z.ZodObject<any>;
|
|
159
|
+
render?: {
|
|
160
|
+
component: string;
|
|
161
|
+
mockData: Record<string, unknown>;
|
|
162
|
+
};
|
|
159
163
|
}
|
|
160
164
|
interface StatusComponentConfig {
|
|
161
165
|
type: string;
|
|
@@ -202,8 +206,12 @@ type AgentMcpConfigInput = {
|
|
|
202
206
|
*/
|
|
203
207
|
declare function transfer(targetAgent: SubAgent, description?: string, condition?: TransferConditionFunction): TransferConfig;
|
|
204
208
|
|
|
205
|
-
type DataComponentConfigWithZod = Omit<DataComponentInsert, 'tenantId' | 'projectId' | 'props'> & {
|
|
209
|
+
type DataComponentConfigWithZod = Omit<DataComponentInsert, 'tenantId' | 'projectId' | 'props' | 'render'> & {
|
|
206
210
|
props?: Record<string, unknown> | z.ZodObject<any> | null;
|
|
211
|
+
render?: {
|
|
212
|
+
component: string;
|
|
213
|
+
mockData: Record<string, unknown>;
|
|
214
|
+
} | null;
|
|
207
215
|
};
|
|
208
216
|
interface DataComponentInterface {
|
|
209
217
|
config: Omit<DataComponentInsert, 'tenantId' | 'projectId'>;
|
|
@@ -227,6 +235,7 @@ declare class DataComponent implements DataComponentInterface {
|
|
|
227
235
|
getName(): string;
|
|
228
236
|
getDescription(): string;
|
|
229
237
|
getProps(): DataComponentInsert['props'];
|
|
238
|
+
getRender(): DataComponentInsert['render'];
|
|
230
239
|
init(): Promise<void>;
|
|
231
240
|
private upsertDataComponent;
|
|
232
241
|
}
|
|
@@ -1073,12 +1082,14 @@ declare function subAgent(config: SubAgentConfig): SubAgent;
|
|
|
1073
1082
|
* ```typescript
|
|
1074
1083
|
* const apiCredential = credential({
|
|
1075
1084
|
* id: 'github-token',
|
|
1085
|
+
* name: 'GitHub Token',
|
|
1076
1086
|
* type: 'bearer',
|
|
1077
1087
|
* value: process.env.GITHUB_TOKEN
|
|
1078
1088
|
* });
|
|
1079
1089
|
* ```
|
|
1080
1090
|
*/
|
|
1081
1091
|
declare function credential(config: CredentialReferenceApiInsert): {
|
|
1092
|
+
name: string;
|
|
1082
1093
|
id: string;
|
|
1083
1094
|
credentialStoreId: string;
|
|
1084
1095
|
type: "nango" | "memory" | "keychain";
|
|
@@ -1112,6 +1123,7 @@ declare function credential(config: CredentialReferenceApiInsert): {
|
|
|
1112
1123
|
* serverUrl: 'https://secure.example.com/mcp',
|
|
1113
1124
|
* credential: credential({
|
|
1114
1125
|
* id: 'api-key',
|
|
1126
|
+
* name: 'API Key',
|
|
1115
1127
|
* type: 'bearer',
|
|
1116
1128
|
* value: process.env.API_KEY
|
|
1117
1129
|
* })
|
|
@@ -1313,16 +1325,33 @@ type ExtractCredentialIds<T> = T extends {
|
|
|
1313
1325
|
type UnionCredentialIds<T extends Record<string, any>> = {
|
|
1314
1326
|
[K in keyof T]: ExtractCredentialIds<T[K]>;
|
|
1315
1327
|
}[keyof T];
|
|
1328
|
+
/**
|
|
1329
|
+
* Type helper to extract tool IDs from environment configuration
|
|
1330
|
+
*/
|
|
1331
|
+
type ExtractMcpServerIds<T> = T extends {
|
|
1332
|
+
mcpServers?: infer T;
|
|
1333
|
+
} ? T extends Record<string, any> ? keyof T : never : never;
|
|
1334
|
+
/**
|
|
1335
|
+
* Type helper to create a union of all available tool IDs from multiple environments
|
|
1336
|
+
*/
|
|
1337
|
+
type UnionMcpServerIds<T extends Record<string, any>> = {
|
|
1338
|
+
[K in keyof T]: ExtractMcpServerIds<T[K]>;
|
|
1339
|
+
}[keyof T];
|
|
1316
1340
|
|
|
1317
1341
|
interface EnvironmentSettingsConfig {
|
|
1318
1342
|
credentials?: {
|
|
1319
1343
|
[settingId: string]: CredentialReferenceApiInsert;
|
|
1320
1344
|
};
|
|
1345
|
+
mcpServers?: {
|
|
1346
|
+
[mcpServerId: string]: Tool;
|
|
1347
|
+
};
|
|
1321
1348
|
}
|
|
1322
1349
|
/**
|
|
1323
1350
|
* Create a setting helper with TypeScript autocomplete
|
|
1324
1351
|
*/
|
|
1325
1352
|
declare function createEnvironmentSettings<T extends Record<string, EnvironmentSettingsConfig>>(environments: T): {
|
|
1353
|
+
getEnvironmentCredential: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
|
|
1354
|
+
getEnvironmentMcp: (key: UnionMcpServerIds<T>) => Tool;
|
|
1326
1355
|
getEnvironmentSetting: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
|
|
1327
1356
|
};
|
|
1328
1357
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -156,6 +156,10 @@ interface ArtifactComponentConfig extends ComponentConfig {
|
|
|
156
156
|
}
|
|
157
157
|
interface DataComponentConfig extends ComponentConfig {
|
|
158
158
|
props: Record<string, unknown> | z.ZodObject<any>;
|
|
159
|
+
render?: {
|
|
160
|
+
component: string;
|
|
161
|
+
mockData: Record<string, unknown>;
|
|
162
|
+
};
|
|
159
163
|
}
|
|
160
164
|
interface StatusComponentConfig {
|
|
161
165
|
type: string;
|
|
@@ -202,8 +206,12 @@ type AgentMcpConfigInput = {
|
|
|
202
206
|
*/
|
|
203
207
|
declare function transfer(targetAgent: SubAgent, description?: string, condition?: TransferConditionFunction): TransferConfig;
|
|
204
208
|
|
|
205
|
-
type DataComponentConfigWithZod = Omit<DataComponentInsert, 'tenantId' | 'projectId' | 'props'> & {
|
|
209
|
+
type DataComponentConfigWithZod = Omit<DataComponentInsert, 'tenantId' | 'projectId' | 'props' | 'render'> & {
|
|
206
210
|
props?: Record<string, unknown> | z.ZodObject<any> | null;
|
|
211
|
+
render?: {
|
|
212
|
+
component: string;
|
|
213
|
+
mockData: Record<string, unknown>;
|
|
214
|
+
} | null;
|
|
207
215
|
};
|
|
208
216
|
interface DataComponentInterface {
|
|
209
217
|
config: Omit<DataComponentInsert, 'tenantId' | 'projectId'>;
|
|
@@ -227,6 +235,7 @@ declare class DataComponent implements DataComponentInterface {
|
|
|
227
235
|
getName(): string;
|
|
228
236
|
getDescription(): string;
|
|
229
237
|
getProps(): DataComponentInsert['props'];
|
|
238
|
+
getRender(): DataComponentInsert['render'];
|
|
230
239
|
init(): Promise<void>;
|
|
231
240
|
private upsertDataComponent;
|
|
232
241
|
}
|
|
@@ -1073,12 +1082,14 @@ declare function subAgent(config: SubAgentConfig): SubAgent;
|
|
|
1073
1082
|
* ```typescript
|
|
1074
1083
|
* const apiCredential = credential({
|
|
1075
1084
|
* id: 'github-token',
|
|
1085
|
+
* name: 'GitHub Token',
|
|
1076
1086
|
* type: 'bearer',
|
|
1077
1087
|
* value: process.env.GITHUB_TOKEN
|
|
1078
1088
|
* });
|
|
1079
1089
|
* ```
|
|
1080
1090
|
*/
|
|
1081
1091
|
declare function credential(config: CredentialReferenceApiInsert): {
|
|
1092
|
+
name: string;
|
|
1082
1093
|
id: string;
|
|
1083
1094
|
credentialStoreId: string;
|
|
1084
1095
|
type: "nango" | "memory" | "keychain";
|
|
@@ -1112,6 +1123,7 @@ declare function credential(config: CredentialReferenceApiInsert): {
|
|
|
1112
1123
|
* serverUrl: 'https://secure.example.com/mcp',
|
|
1113
1124
|
* credential: credential({
|
|
1114
1125
|
* id: 'api-key',
|
|
1126
|
+
* name: 'API Key',
|
|
1115
1127
|
* type: 'bearer',
|
|
1116
1128
|
* value: process.env.API_KEY
|
|
1117
1129
|
* })
|
|
@@ -1313,16 +1325,33 @@ type ExtractCredentialIds<T> = T extends {
|
|
|
1313
1325
|
type UnionCredentialIds<T extends Record<string, any>> = {
|
|
1314
1326
|
[K in keyof T]: ExtractCredentialIds<T[K]>;
|
|
1315
1327
|
}[keyof T];
|
|
1328
|
+
/**
|
|
1329
|
+
* Type helper to extract tool IDs from environment configuration
|
|
1330
|
+
*/
|
|
1331
|
+
type ExtractMcpServerIds<T> = T extends {
|
|
1332
|
+
mcpServers?: infer T;
|
|
1333
|
+
} ? T extends Record<string, any> ? keyof T : never : never;
|
|
1334
|
+
/**
|
|
1335
|
+
* Type helper to create a union of all available tool IDs from multiple environments
|
|
1336
|
+
*/
|
|
1337
|
+
type UnionMcpServerIds<T extends Record<string, any>> = {
|
|
1338
|
+
[K in keyof T]: ExtractMcpServerIds<T[K]>;
|
|
1339
|
+
}[keyof T];
|
|
1316
1340
|
|
|
1317
1341
|
interface EnvironmentSettingsConfig {
|
|
1318
1342
|
credentials?: {
|
|
1319
1343
|
[settingId: string]: CredentialReferenceApiInsert;
|
|
1320
1344
|
};
|
|
1345
|
+
mcpServers?: {
|
|
1346
|
+
[mcpServerId: string]: Tool;
|
|
1347
|
+
};
|
|
1321
1348
|
}
|
|
1322
1349
|
/**
|
|
1323
1350
|
* Create a setting helper with TypeScript autocomplete
|
|
1324
1351
|
*/
|
|
1325
1352
|
declare function createEnvironmentSettings<T extends Record<string, EnvironmentSettingsConfig>>(environments: T): {
|
|
1353
|
+
getEnvironmentCredential: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
|
|
1354
|
+
getEnvironmentMcp: (key: UnionMcpServerIds<T>) => Tool;
|
|
1326
1355
|
getEnvironmentSetting: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
|
|
1327
1356
|
};
|
|
1328
1357
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1490,7 +1490,8 @@ var DataComponent = class {
|
|
|
1490
1490
|
this.config = {
|
|
1491
1491
|
...config,
|
|
1492
1492
|
id: this.id,
|
|
1493
|
-
props: processedProps
|
|
1493
|
+
props: processedProps,
|
|
1494
|
+
render: config.render || null
|
|
1494
1495
|
};
|
|
1495
1496
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
1496
1497
|
this.tenantId = "default";
|
|
@@ -1524,6 +1525,9 @@ var DataComponent = class {
|
|
|
1524
1525
|
getProps() {
|
|
1525
1526
|
return this.config.props;
|
|
1526
1527
|
}
|
|
1528
|
+
getRender() {
|
|
1529
|
+
return this.config.render;
|
|
1530
|
+
}
|
|
1527
1531
|
// Public method to ensure data component exists in backend (with upsert behavior)
|
|
1528
1532
|
async init() {
|
|
1529
1533
|
if (this.initialized) return;
|
|
@@ -1553,7 +1557,8 @@ var DataComponent = class {
|
|
|
1553
1557
|
id: this.getId(),
|
|
1554
1558
|
name: this.config.name,
|
|
1555
1559
|
description: this.config.description,
|
|
1556
|
-
props: this.config.props
|
|
1560
|
+
props: this.config.props,
|
|
1561
|
+
render: this.config.render
|
|
1557
1562
|
};
|
|
1558
1563
|
logger6.info({ dataComponentData }, "dataComponentData for create/update");
|
|
1559
1564
|
const updateResponse = await fetch(
|
|
@@ -2231,6 +2236,7 @@ var Project = class {
|
|
|
2231
2236
|
if (!credentialReferencesObject[credential2.id]) {
|
|
2232
2237
|
credentialReferencesObject[credential2.id] = {
|
|
2233
2238
|
id: credential2.id,
|
|
2239
|
+
name: credential2.name,
|
|
2234
2240
|
type: credential2.type,
|
|
2235
2241
|
credentialStoreId: credential2.credentialStoreId,
|
|
2236
2242
|
retrievalParams: credential2.retrievalParams
|
|
@@ -2348,6 +2354,7 @@ var Project = class {
|
|
|
2348
2354
|
if (!credentialReferencesObject[credential2.id]) {
|
|
2349
2355
|
credentialReferencesObject[credential2.id] = {
|
|
2350
2356
|
id: credential2.id,
|
|
2357
|
+
name: credential2.name,
|
|
2351
2358
|
type: credential2.type,
|
|
2352
2359
|
credentialStoreId: credential2.credentialStoreId,
|
|
2353
2360
|
retrievalParams: credential2.retrievalParams
|
|
@@ -2372,23 +2379,27 @@ var Project = class {
|
|
|
2372
2379
|
let dataComponentName;
|
|
2373
2380
|
let dataComponentDescription;
|
|
2374
2381
|
let dataComponentProps;
|
|
2382
|
+
let dataComponentRender;
|
|
2375
2383
|
if (dataComponent2.getId) {
|
|
2376
2384
|
dataComponentId = dataComponent2.getId();
|
|
2377
2385
|
dataComponentName = dataComponent2.getName();
|
|
2378
2386
|
dataComponentDescription = dataComponent2.getDescription() || "";
|
|
2379
2387
|
dataComponentProps = dataComponent2.getProps() || {};
|
|
2388
|
+
dataComponentRender = dataComponent2.getRender?.() || null;
|
|
2380
2389
|
} else {
|
|
2381
2390
|
dataComponentId = dataComponent2.id || (dataComponent2.name ? dataComponent2.name.toLowerCase().replace(/\s+/g, "-") : "");
|
|
2382
2391
|
dataComponentName = dataComponent2.name || "";
|
|
2383
2392
|
dataComponentDescription = dataComponent2.description || "";
|
|
2384
2393
|
dataComponentProps = dataComponent2.props || {};
|
|
2394
|
+
dataComponentRender = dataComponent2.render || null;
|
|
2385
2395
|
}
|
|
2386
2396
|
if (!dataComponentsObject[dataComponentId] && dataComponentName) {
|
|
2387
2397
|
dataComponentsObject[dataComponentId] = {
|
|
2388
2398
|
id: dataComponentId,
|
|
2389
2399
|
name: dataComponentName,
|
|
2390
2400
|
description: dataComponentDescription,
|
|
2391
|
-
props: dataComponentProps
|
|
2401
|
+
props: dataComponentProps,
|
|
2402
|
+
render: dataComponentRender
|
|
2392
2403
|
};
|
|
2393
2404
|
}
|
|
2394
2405
|
}
|
|
@@ -2431,6 +2442,7 @@ var Project = class {
|
|
|
2431
2442
|
if (!credentialReferencesObject[credential2.id]) {
|
|
2432
2443
|
credentialReferencesObject[credential2.id] = {
|
|
2433
2444
|
id: credential2.id,
|
|
2445
|
+
name: credential2.name,
|
|
2434
2446
|
type: credential2.type,
|
|
2435
2447
|
credentialStoreId: credential2.credentialStoreId,
|
|
2436
2448
|
retrievalParams: credential2.retrievalParams
|
|
@@ -2950,7 +2962,8 @@ var SubAgent = class {
|
|
|
2950
2962
|
id: comp.getId(),
|
|
2951
2963
|
name: comp.getName(),
|
|
2952
2964
|
description: comp.getDescription(),
|
|
2953
|
-
props: comp.getProps()
|
|
2965
|
+
props: comp.getProps(),
|
|
2966
|
+
render: comp.getRender?.() || null
|
|
2954
2967
|
};
|
|
2955
2968
|
}
|
|
2956
2969
|
if (comp && typeof comp === "object" && comp.props && isZodSchema(comp.props)) {
|
|
@@ -2958,7 +2971,8 @@ var SubAgent = class {
|
|
|
2958
2971
|
id: comp.id,
|
|
2959
2972
|
name: comp.name,
|
|
2960
2973
|
description: comp.description,
|
|
2961
|
-
props: convertZodToJsonSchemaWithPreview(comp.props)
|
|
2974
|
+
props: convertZodToJsonSchemaWithPreview(comp.props),
|
|
2975
|
+
render: comp.render || null
|
|
2962
2976
|
};
|
|
2963
2977
|
}
|
|
2964
2978
|
return comp;
|
|
@@ -3450,7 +3464,8 @@ var SubAgent = class {
|
|
|
3450
3464
|
id: dataComponent2.id,
|
|
3451
3465
|
name: dataComponent2.name,
|
|
3452
3466
|
description: dataComponent2.description,
|
|
3453
|
-
props: dataComponent2.props
|
|
3467
|
+
props: dataComponent2.props,
|
|
3468
|
+
render: dataComponent2.render
|
|
3454
3469
|
});
|
|
3455
3470
|
dc.setContext(this.tenantId, this.projectId);
|
|
3456
3471
|
await dc.init();
|
|
@@ -3611,7 +3626,15 @@ function subAgent(config) {
|
|
|
3611
3626
|
return new SubAgent(config);
|
|
3612
3627
|
}
|
|
3613
3628
|
function credential(config) {
|
|
3614
|
-
|
|
3629
|
+
try {
|
|
3630
|
+
return CredentialReferenceApiInsertSchema.parse(config);
|
|
3631
|
+
} catch (error) {
|
|
3632
|
+
if (error instanceof Error) {
|
|
3633
|
+
const credId = config.id || "unknown";
|
|
3634
|
+
throw new Error(`Invalid credential '${credId}': ${error.message}`);
|
|
3635
|
+
}
|
|
3636
|
+
throw error;
|
|
3637
|
+
}
|
|
3615
3638
|
}
|
|
3616
3639
|
function mcpServer(config) {
|
|
3617
3640
|
if (!config.serverUrl) {
|
|
@@ -3708,6 +3731,35 @@ function isCredentialReference(value) {
|
|
|
3708
3731
|
// src/environment-settings.ts
|
|
3709
3732
|
function createEnvironmentSettings(environments) {
|
|
3710
3733
|
return {
|
|
3734
|
+
getEnvironmentCredential: (key) => {
|
|
3735
|
+
const currentEnv = process.env.INKEEP_ENV || "development";
|
|
3736
|
+
const env = environments[currentEnv];
|
|
3737
|
+
if (!env) {
|
|
3738
|
+
throw new Error(
|
|
3739
|
+
`Environment '${currentEnv}' not found. Available: ${Object.keys(environments).join(", ")}`
|
|
3740
|
+
);
|
|
3741
|
+
}
|
|
3742
|
+
const credential2 = env.credentials?.[key];
|
|
3743
|
+
if (!credential2) {
|
|
3744
|
+
throw new Error(`Credential '${String(key)}' not found in environment '${currentEnv}'`);
|
|
3745
|
+
}
|
|
3746
|
+
return credential2;
|
|
3747
|
+
},
|
|
3748
|
+
getEnvironmentMcp: (key) => {
|
|
3749
|
+
const currentEnv = process.env.INKEEP_ENV || "development";
|
|
3750
|
+
const env = environments[currentEnv];
|
|
3751
|
+
if (!env) {
|
|
3752
|
+
throw new Error(
|
|
3753
|
+
`Environment '${currentEnv}' not found. Available: ${Object.keys(environments).join(", ")}`
|
|
3754
|
+
);
|
|
3755
|
+
}
|
|
3756
|
+
const mcpServer2 = env.mcpServers?.[key];
|
|
3757
|
+
if (!mcpServer2) {
|
|
3758
|
+
throw new Error(`MCP Server '${String(key)}' not found in environment '${currentEnv}'`);
|
|
3759
|
+
}
|
|
3760
|
+
return mcpServer2;
|
|
3761
|
+
},
|
|
3762
|
+
//Deprecated: Use getEnvironmentCredential instead
|
|
3711
3763
|
getEnvironmentSetting: (key) => {
|
|
3712
3764
|
const currentEnv = process.env.INKEEP_ENV || "development";
|
|
3713
3765
|
const env = environments[currentEnv];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Agents SDK for building and managing agents in the Inkeep Agent Framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"nanoid": "^5.1.5",
|
|
13
13
|
"typescript": "^5.3.3",
|
|
14
14
|
"zod": "^4.1.11",
|
|
15
|
-
"@inkeep/agents-core": "^0.
|
|
15
|
+
"@inkeep/agents-core": "^0.29.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/js-yaml": "^4.0.9",
|