@inkeep/agents-sdk 0.27.0 → 0.28.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 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(
@@ -2399,23 +2404,27 @@ var Project = class {
2399
2404
  let dataComponentName;
2400
2405
  let dataComponentDescription;
2401
2406
  let dataComponentProps;
2407
+ let dataComponentRender;
2402
2408
  if (dataComponent2.getId) {
2403
2409
  dataComponentId = dataComponent2.getId();
2404
2410
  dataComponentName = dataComponent2.getName();
2405
2411
  dataComponentDescription = dataComponent2.getDescription() || "";
2406
2412
  dataComponentProps = dataComponent2.getProps() || {};
2413
+ dataComponentRender = dataComponent2.getRender?.() || null;
2407
2414
  } else {
2408
2415
  dataComponentId = dataComponent2.id || (dataComponent2.name ? dataComponent2.name.toLowerCase().replace(/\s+/g, "-") : "");
2409
2416
  dataComponentName = dataComponent2.name || "";
2410
2417
  dataComponentDescription = dataComponent2.description || "";
2411
2418
  dataComponentProps = dataComponent2.props || {};
2419
+ dataComponentRender = dataComponent2.render || null;
2412
2420
  }
2413
2421
  if (!dataComponentsObject[dataComponentId] && dataComponentName) {
2414
2422
  dataComponentsObject[dataComponentId] = {
2415
2423
  id: dataComponentId,
2416
2424
  name: dataComponentName,
2417
2425
  description: dataComponentDescription,
2418
- props: dataComponentProps
2426
+ props: dataComponentProps,
2427
+ render: dataComponentRender
2419
2428
  };
2420
2429
  }
2421
2430
  }
@@ -2977,7 +2986,8 @@ var SubAgent = class {
2977
2986
  id: comp.getId(),
2978
2987
  name: comp.getName(),
2979
2988
  description: comp.getDescription(),
2980
- props: comp.getProps()
2989
+ props: comp.getProps(),
2990
+ render: comp.getRender?.() || null
2981
2991
  };
2982
2992
  }
2983
2993
  if (comp && typeof comp === "object" && comp.props && schemaConversion.isZodSchema(comp.props)) {
@@ -2985,7 +2995,8 @@ var SubAgent = class {
2985
2995
  id: comp.id,
2986
2996
  name: comp.name,
2987
2997
  description: comp.description,
2988
- props: schemaConversion.convertZodToJsonSchemaWithPreview(comp.props)
2998
+ props: schemaConversion.convertZodToJsonSchemaWithPreview(comp.props),
2999
+ render: comp.render || null
2989
3000
  };
2990
3001
  }
2991
3002
  return comp;
@@ -3477,7 +3488,8 @@ var SubAgent = class {
3477
3488
  id: dataComponent2.id,
3478
3489
  name: dataComponent2.name,
3479
3490
  description: dataComponent2.description,
3480
- props: dataComponent2.props
3491
+ props: dataComponent2.props,
3492
+ render: dataComponent2.render
3481
3493
  });
3482
3494
  dc.setContext(this.tenantId, this.projectId);
3483
3495
  await dc.init();
@@ -3735,6 +3747,35 @@ function isCredentialReference(value) {
3735
3747
  // src/environment-settings.ts
3736
3748
  function createEnvironmentSettings(environments) {
3737
3749
  return {
3750
+ getEnvironmentCredential: (key) => {
3751
+ const currentEnv = process.env.INKEEP_ENV || "development";
3752
+ const env = environments[currentEnv];
3753
+ if (!env) {
3754
+ throw new Error(
3755
+ `Environment '${currentEnv}' not found. Available: ${Object.keys(environments).join(", ")}`
3756
+ );
3757
+ }
3758
+ const credential2 = env.credentials?.[key];
3759
+ if (!credential2) {
3760
+ throw new Error(`Credential '${String(key)}' not found in environment '${currentEnv}'`);
3761
+ }
3762
+ return credential2;
3763
+ },
3764
+ getEnvironmentMcp: (key) => {
3765
+ const currentEnv = process.env.INKEEP_ENV || "development";
3766
+ const env = environments[currentEnv];
3767
+ if (!env) {
3768
+ throw new Error(
3769
+ `Environment '${currentEnv}' not found. Available: ${Object.keys(environments).join(", ")}`
3770
+ );
3771
+ }
3772
+ const mcpServer2 = env.mcpServers?.[key];
3773
+ if (!mcpServer2) {
3774
+ throw new Error(`MCP Server '${String(key)}' not found in environment '${currentEnv}'`);
3775
+ }
3776
+ return mcpServer2;
3777
+ },
3778
+ //Deprecated: Use getEnvironmentCredential instead
3738
3779
  getEnvironmentSetting: (key) => {
3739
3780
  const currentEnv = process.env.INKEEP_ENV || "development";
3740
3781
  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
  }
@@ -1313,16 +1322,33 @@ type ExtractCredentialIds<T> = T extends {
1313
1322
  type UnionCredentialIds<T extends Record<string, any>> = {
1314
1323
  [K in keyof T]: ExtractCredentialIds<T[K]>;
1315
1324
  }[keyof T];
1325
+ /**
1326
+ * Type helper to extract tool IDs from environment configuration
1327
+ */
1328
+ type ExtractMcpServerIds<T> = T extends {
1329
+ mcpServers?: infer T;
1330
+ } ? T extends Record<string, any> ? keyof T : never : never;
1331
+ /**
1332
+ * Type helper to create a union of all available tool IDs from multiple environments
1333
+ */
1334
+ type UnionMcpServerIds<T extends Record<string, any>> = {
1335
+ [K in keyof T]: ExtractMcpServerIds<T[K]>;
1336
+ }[keyof T];
1316
1337
 
1317
1338
  interface EnvironmentSettingsConfig {
1318
1339
  credentials?: {
1319
1340
  [settingId: string]: CredentialReferenceApiInsert;
1320
1341
  };
1342
+ mcpServers?: {
1343
+ [mcpServerId: string]: Tool;
1344
+ };
1321
1345
  }
1322
1346
  /**
1323
1347
  * Create a setting helper with TypeScript autocomplete
1324
1348
  */
1325
1349
  declare function createEnvironmentSettings<T extends Record<string, EnvironmentSettingsConfig>>(environments: T): {
1350
+ getEnvironmentCredential: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
1351
+ getEnvironmentMcp: (key: UnionMcpServerIds<T>) => Tool;
1326
1352
  getEnvironmentSetting: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
1327
1353
  };
1328
1354
  /**
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
  }
@@ -1313,16 +1322,33 @@ type ExtractCredentialIds<T> = T extends {
1313
1322
  type UnionCredentialIds<T extends Record<string, any>> = {
1314
1323
  [K in keyof T]: ExtractCredentialIds<T[K]>;
1315
1324
  }[keyof T];
1325
+ /**
1326
+ * Type helper to extract tool IDs from environment configuration
1327
+ */
1328
+ type ExtractMcpServerIds<T> = T extends {
1329
+ mcpServers?: infer T;
1330
+ } ? T extends Record<string, any> ? keyof T : never : never;
1331
+ /**
1332
+ * Type helper to create a union of all available tool IDs from multiple environments
1333
+ */
1334
+ type UnionMcpServerIds<T extends Record<string, any>> = {
1335
+ [K in keyof T]: ExtractMcpServerIds<T[K]>;
1336
+ }[keyof T];
1316
1337
 
1317
1338
  interface EnvironmentSettingsConfig {
1318
1339
  credentials?: {
1319
1340
  [settingId: string]: CredentialReferenceApiInsert;
1320
1341
  };
1342
+ mcpServers?: {
1343
+ [mcpServerId: string]: Tool;
1344
+ };
1321
1345
  }
1322
1346
  /**
1323
1347
  * Create a setting helper with TypeScript autocomplete
1324
1348
  */
1325
1349
  declare function createEnvironmentSettings<T extends Record<string, EnvironmentSettingsConfig>>(environments: T): {
1350
+ getEnvironmentCredential: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
1351
+ getEnvironmentMcp: (key: UnionMcpServerIds<T>) => Tool;
1326
1352
  getEnvironmentSetting: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
1327
1353
  };
1328
1354
  /**
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(
@@ -2372,23 +2377,27 @@ var Project = class {
2372
2377
  let dataComponentName;
2373
2378
  let dataComponentDescription;
2374
2379
  let dataComponentProps;
2380
+ let dataComponentRender;
2375
2381
  if (dataComponent2.getId) {
2376
2382
  dataComponentId = dataComponent2.getId();
2377
2383
  dataComponentName = dataComponent2.getName();
2378
2384
  dataComponentDescription = dataComponent2.getDescription() || "";
2379
2385
  dataComponentProps = dataComponent2.getProps() || {};
2386
+ dataComponentRender = dataComponent2.getRender?.() || null;
2380
2387
  } else {
2381
2388
  dataComponentId = dataComponent2.id || (dataComponent2.name ? dataComponent2.name.toLowerCase().replace(/\s+/g, "-") : "");
2382
2389
  dataComponentName = dataComponent2.name || "";
2383
2390
  dataComponentDescription = dataComponent2.description || "";
2384
2391
  dataComponentProps = dataComponent2.props || {};
2392
+ dataComponentRender = dataComponent2.render || null;
2385
2393
  }
2386
2394
  if (!dataComponentsObject[dataComponentId] && dataComponentName) {
2387
2395
  dataComponentsObject[dataComponentId] = {
2388
2396
  id: dataComponentId,
2389
2397
  name: dataComponentName,
2390
2398
  description: dataComponentDescription,
2391
- props: dataComponentProps
2399
+ props: dataComponentProps,
2400
+ render: dataComponentRender
2392
2401
  };
2393
2402
  }
2394
2403
  }
@@ -2950,7 +2959,8 @@ var SubAgent = class {
2950
2959
  id: comp.getId(),
2951
2960
  name: comp.getName(),
2952
2961
  description: comp.getDescription(),
2953
- props: comp.getProps()
2962
+ props: comp.getProps(),
2963
+ render: comp.getRender?.() || null
2954
2964
  };
2955
2965
  }
2956
2966
  if (comp && typeof comp === "object" && comp.props && isZodSchema(comp.props)) {
@@ -2958,7 +2968,8 @@ var SubAgent = class {
2958
2968
  id: comp.id,
2959
2969
  name: comp.name,
2960
2970
  description: comp.description,
2961
- props: convertZodToJsonSchemaWithPreview(comp.props)
2971
+ props: convertZodToJsonSchemaWithPreview(comp.props),
2972
+ render: comp.render || null
2962
2973
  };
2963
2974
  }
2964
2975
  return comp;
@@ -3450,7 +3461,8 @@ var SubAgent = class {
3450
3461
  id: dataComponent2.id,
3451
3462
  name: dataComponent2.name,
3452
3463
  description: dataComponent2.description,
3453
- props: dataComponent2.props
3464
+ props: dataComponent2.props,
3465
+ render: dataComponent2.render
3454
3466
  });
3455
3467
  dc.setContext(this.tenantId, this.projectId);
3456
3468
  await dc.init();
@@ -3708,6 +3720,35 @@ function isCredentialReference(value) {
3708
3720
  // src/environment-settings.ts
3709
3721
  function createEnvironmentSettings(environments) {
3710
3722
  return {
3723
+ getEnvironmentCredential: (key) => {
3724
+ const currentEnv = process.env.INKEEP_ENV || "development";
3725
+ const env = environments[currentEnv];
3726
+ if (!env) {
3727
+ throw new Error(
3728
+ `Environment '${currentEnv}' not found. Available: ${Object.keys(environments).join(", ")}`
3729
+ );
3730
+ }
3731
+ const credential2 = env.credentials?.[key];
3732
+ if (!credential2) {
3733
+ throw new Error(`Credential '${String(key)}' not found in environment '${currentEnv}'`);
3734
+ }
3735
+ return credential2;
3736
+ },
3737
+ getEnvironmentMcp: (key) => {
3738
+ const currentEnv = process.env.INKEEP_ENV || "development";
3739
+ const env = environments[currentEnv];
3740
+ if (!env) {
3741
+ throw new Error(
3742
+ `Environment '${currentEnv}' not found. Available: ${Object.keys(environments).join(", ")}`
3743
+ );
3744
+ }
3745
+ const mcpServer2 = env.mcpServers?.[key];
3746
+ if (!mcpServer2) {
3747
+ throw new Error(`MCP Server '${String(key)}' not found in environment '${currentEnv}'`);
3748
+ }
3749
+ return mcpServer2;
3750
+ },
3751
+ //Deprecated: Use getEnvironmentCredential instead
3711
3752
  getEnvironmentSetting: (key) => {
3712
3753
  const currentEnv = process.env.INKEEP_ENV || "development";
3713
3754
  const env = environments[currentEnv];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-sdk",
3
- "version": "0.27.0",
3
+ "version": "0.28.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.27.0"
15
+ "@inkeep/agents-core": "^0.28.0"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/js-yaml": "^4.0.9",