@inkeep/agents-sdk 0.1.10 → 0.2.1

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
@@ -459,7 +459,12 @@ var Agent = class {
459
459
  getInstructions() {
460
460
  return this.config.prompt;
461
461
  }
462
- // adjust
462
+ /**
463
+ * Get the agent's description (the human-readable description field)
464
+ */
465
+ getDescription() {
466
+ return this.config.description || "";
467
+ }
463
468
  getTools() {
464
469
  const tools = resolveGetter(this.config.canUse);
465
470
  if (!tools) {
@@ -1292,12 +1297,15 @@ var AgentGraph = class {
1292
1297
  const tools = [];
1293
1298
  const selectedToolsMapping = {};
1294
1299
  const agentTools = internalAgent.getTools();
1295
- for (const [toolName, toolInstance] of Object.entries(agentTools)) {
1300
+ for (const [_toolName, toolInstance] of Object.entries(agentTools)) {
1296
1301
  if (toolInstance && typeof toolInstance === "object") {
1297
1302
  let toolId;
1298
1303
  toolId = toolInstance.getId?.() || toolInstance.id;
1299
1304
  if ("selectedTools" in toolInstance && toolInstance.selectedTools !== void 0) {
1300
- logger7.info({ toolId, selectedTools: toolInstance.selectedTools }, "Selected tools");
1305
+ logger7.info(
1306
+ { toolId, selectedTools: toolInstance.selectedTools },
1307
+ "Selected tools"
1308
+ );
1301
1309
  selectedToolsMapping[toolId] = toolInstance.selectedTools;
1302
1310
  }
1303
1311
  tools.push(toolId);
@@ -1472,12 +1480,18 @@ var AgentGraph = class {
1472
1480
  agents: agentsObject,
1473
1481
  tools: toolsObject,
1474
1482
  contextConfig: this.contextConfig?.toObject(),
1475
- credentialReferences: this.credentials?.map((credentialReference) => ({
1476
- type: credentialReference.type,
1477
- id: credentialReference.id,
1478
- credentialStoreId: credentialReference.credentialStoreId,
1479
- retrievalParams: credentialReference.retrievalParams || {}
1480
- })),
1483
+ credentialReferences: this.credentials?.reduce(
1484
+ (acc, credentialReference) => {
1485
+ acc[credentialReference.id] = {
1486
+ type: credentialReference.type,
1487
+ id: credentialReference.id,
1488
+ credentialStoreId: credentialReference.credentialStoreId,
1489
+ retrievalParams: credentialReference.retrievalParams || {}
1490
+ };
1491
+ return acc;
1492
+ },
1493
+ {}
1494
+ ),
1481
1495
  models: this.models,
1482
1496
  statusUpdates: this.statusUpdateSettings,
1483
1497
  graphPrompt: this.graphPrompt,
@@ -2682,6 +2696,7 @@ async function deleteFullProjectViaAPI(tenantId, apiUrl, projectId) {
2682
2696
  var logger9 = agentsCore.getLogger("project");
2683
2697
  var Project = class {
2684
2698
  constructor(config) {
2699
+ __publicField(this, "__type", "project");
2685
2700
  __publicField(this, "projectId");
2686
2701
  __publicField(this, "projectName");
2687
2702
  __publicField(this, "projectDescription");
@@ -2692,6 +2707,7 @@ var Project = class {
2692
2707
  __publicField(this, "stopWhen");
2693
2708
  __publicField(this, "graphs", []);
2694
2709
  __publicField(this, "graphMap", /* @__PURE__ */ new Map());
2710
+ __publicField(this, "credentialReferences", []);
2695
2711
  this.projectId = config.id;
2696
2712
  this.projectName = config.name;
2697
2713
  this.projectDescription = config.description;
@@ -2719,12 +2735,15 @@ var Project = class {
2719
2735
  * Set or update the configuration (tenantId and apiUrl)
2720
2736
  * This is used by the CLI to inject configuration from inkeep.config.ts
2721
2737
  */
2722
- setConfig(tenantId, apiUrl) {
2738
+ setConfig(tenantId, apiUrl, models) {
2723
2739
  if (this.initialized) {
2724
2740
  throw new Error("Cannot set config after project has been initialized");
2725
2741
  }
2726
2742
  this.tenantId = tenantId;
2727
2743
  this.baseURL = apiUrl;
2744
+ if (models) {
2745
+ this.models = models;
2746
+ }
2728
2747
  for (const graph of this.graphs) {
2729
2748
  graph.setConfig(tenantId, this.projectId, apiUrl);
2730
2749
  }
@@ -2732,11 +2751,26 @@ var Project = class {
2732
2751
  {
2733
2752
  projectId: this.projectId,
2734
2753
  tenantId: this.tenantId,
2735
- apiUrl: this.baseURL
2754
+ apiUrl: this.baseURL,
2755
+ hasModels: !!this.models
2736
2756
  },
2737
2757
  "Project configuration updated"
2738
2758
  );
2739
2759
  }
2760
+ /**
2761
+ * Set credential references for the project
2762
+ * This is used by the CLI to inject environment-specific credentials
2763
+ */
2764
+ setCredentials(credentials) {
2765
+ this.credentialReferences = Object.values(credentials);
2766
+ logger9.info(
2767
+ {
2768
+ projectId: this.projectId,
2769
+ credentialCount: this.credentialReferences?.length || 0
2770
+ },
2771
+ "Project credentials updated"
2772
+ );
2773
+ }
2740
2774
  /**
2741
2775
  * Initialize the project and create/update it in the backend using full project approach
2742
2776
  */
@@ -2754,6 +2788,35 @@ var Project = class {
2754
2788
  "Initializing project using full project endpoint"
2755
2789
  );
2756
2790
  try {
2791
+ const projectMetadata = {
2792
+ id: this.projectId,
2793
+ name: this.projectName,
2794
+ description: this.projectDescription || "",
2795
+ models: this.models,
2796
+ stopWhen: this.stopWhen,
2797
+ graphs: {},
2798
+ // Empty graphs object for now
2799
+ tools: {},
2800
+ // Empty tools object
2801
+ credentialReferences: void 0,
2802
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2803
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
2804
+ };
2805
+ logger9.info(
2806
+ {
2807
+ projectId: this.projectId,
2808
+ mode: "api-client",
2809
+ apiUrl: this.baseURL
2810
+ },
2811
+ "Creating project metadata first"
2812
+ );
2813
+ await updateFullProjectViaAPI(this.tenantId, this.baseURL, this.projectId, projectMetadata);
2814
+ logger9.info(
2815
+ {
2816
+ projectId: this.projectId
2817
+ },
2818
+ "Project metadata created successfully"
2819
+ );
2757
2820
  const initPromises = this.graphs.map(async (graph) => {
2758
2821
  try {
2759
2822
  await graph.init();
package/dist/index.d.cts CHANGED
@@ -312,11 +312,9 @@ interface RunResult {
312
312
  };
313
313
  }
314
314
  interface StatusComponent {
315
- id: string;
316
- name: string;
317
315
  type: string;
318
316
  description?: string;
319
- schema: {
317
+ schema?: {
320
318
  type: 'object';
321
319
  properties: Record<string, any>;
322
320
  required?: string[];
@@ -368,6 +366,7 @@ interface AgentInterface {
368
366
  init(): Promise<void>;
369
367
  getId(): string;
370
368
  getName(): string;
369
+ getDescription(): string;
371
370
  getInstructions(): string;
372
371
  getTools(): Record<string, any>;
373
372
  getTransfers(): AgentInterface[];
@@ -439,6 +438,10 @@ declare class Agent implements AgentInterface {
439
438
  getId(): string;
440
439
  getName(): string;
441
440
  getInstructions(): string;
441
+ /**
442
+ * Get the agent's description (the human-readable description field)
443
+ */
444
+ getDescription(): string;
442
445
  getTools(): Record<string, unknown>;
443
446
  getModels(): typeof this$1.config.models;
444
447
  setModels(models: typeof this$1.config.models): void;
@@ -771,6 +774,7 @@ interface ProjectInterface {
771
774
  * ```
772
775
  */
773
776
  declare class Project implements ProjectInterface {
777
+ readonly __type: "project";
774
778
  private projectId;
775
779
  private projectName;
776
780
  private projectDescription?;
@@ -781,12 +785,18 @@ declare class Project implements ProjectInterface {
781
785
  private stopWhen?;
782
786
  private graphs;
783
787
  private graphMap;
788
+ private credentialReferences?;
784
789
  constructor(config: ProjectConfig);
785
790
  /**
786
791
  * Set or update the configuration (tenantId and apiUrl)
787
792
  * This is used by the CLI to inject configuration from inkeep.config.ts
788
793
  */
789
- setConfig(tenantId: string, apiUrl: string): void;
794
+ setConfig(tenantId: string, apiUrl: string, models?: ProjectConfig['models']): void;
795
+ /**
796
+ * Set credential references for the project
797
+ * This is used by the CLI to inject environment-specific credentials
798
+ */
799
+ setCredentials(credentials: Record<string, CredentialReferenceApiInsert>): void;
790
800
  /**
791
801
  * Initialize the project and create/update it in the backend using full project approach
792
802
  */
package/dist/index.d.ts CHANGED
@@ -312,11 +312,9 @@ interface RunResult {
312
312
  };
313
313
  }
314
314
  interface StatusComponent {
315
- id: string;
316
- name: string;
317
315
  type: string;
318
316
  description?: string;
319
- schema: {
317
+ schema?: {
320
318
  type: 'object';
321
319
  properties: Record<string, any>;
322
320
  required?: string[];
@@ -368,6 +366,7 @@ interface AgentInterface {
368
366
  init(): Promise<void>;
369
367
  getId(): string;
370
368
  getName(): string;
369
+ getDescription(): string;
371
370
  getInstructions(): string;
372
371
  getTools(): Record<string, any>;
373
372
  getTransfers(): AgentInterface[];
@@ -439,6 +438,10 @@ declare class Agent implements AgentInterface {
439
438
  getId(): string;
440
439
  getName(): string;
441
440
  getInstructions(): string;
441
+ /**
442
+ * Get the agent's description (the human-readable description field)
443
+ */
444
+ getDescription(): string;
442
445
  getTools(): Record<string, unknown>;
443
446
  getModels(): typeof this$1.config.models;
444
447
  setModels(models: typeof this$1.config.models): void;
@@ -771,6 +774,7 @@ interface ProjectInterface {
771
774
  * ```
772
775
  */
773
776
  declare class Project implements ProjectInterface {
777
+ readonly __type: "project";
774
778
  private projectId;
775
779
  private projectName;
776
780
  private projectDescription?;
@@ -781,12 +785,18 @@ declare class Project implements ProjectInterface {
781
785
  private stopWhen?;
782
786
  private graphs;
783
787
  private graphMap;
788
+ private credentialReferences?;
784
789
  constructor(config: ProjectConfig);
785
790
  /**
786
791
  * Set or update the configuration (tenantId and apiUrl)
787
792
  * This is used by the CLI to inject configuration from inkeep.config.ts
788
793
  */
789
- setConfig(tenantId: string, apiUrl: string): void;
794
+ setConfig(tenantId: string, apiUrl: string, models?: ProjectConfig['models']): void;
795
+ /**
796
+ * Set credential references for the project
797
+ * This is used by the CLI to inject environment-specific credentials
798
+ */
799
+ setCredentials(credentials: Record<string, CredentialReferenceApiInsert>): void;
790
800
  /**
791
801
  * Initialize the project and create/update it in the backend using full project approach
792
802
  */
package/dist/index.js CHANGED
@@ -457,7 +457,12 @@ var Agent = class {
457
457
  getInstructions() {
458
458
  return this.config.prompt;
459
459
  }
460
- // adjust
460
+ /**
461
+ * Get the agent's description (the human-readable description field)
462
+ */
463
+ getDescription() {
464
+ return this.config.description || "";
465
+ }
461
466
  getTools() {
462
467
  const tools = resolveGetter(this.config.canUse);
463
468
  if (!tools) {
@@ -1290,12 +1295,15 @@ var AgentGraph = class {
1290
1295
  const tools = [];
1291
1296
  const selectedToolsMapping = {};
1292
1297
  const agentTools = internalAgent.getTools();
1293
- for (const [toolName, toolInstance] of Object.entries(agentTools)) {
1298
+ for (const [_toolName, toolInstance] of Object.entries(agentTools)) {
1294
1299
  if (toolInstance && typeof toolInstance === "object") {
1295
1300
  let toolId;
1296
1301
  toolId = toolInstance.getId?.() || toolInstance.id;
1297
1302
  if ("selectedTools" in toolInstance && toolInstance.selectedTools !== void 0) {
1298
- logger7.info({ toolId, selectedTools: toolInstance.selectedTools }, "Selected tools");
1303
+ logger7.info(
1304
+ { toolId, selectedTools: toolInstance.selectedTools },
1305
+ "Selected tools"
1306
+ );
1299
1307
  selectedToolsMapping[toolId] = toolInstance.selectedTools;
1300
1308
  }
1301
1309
  tools.push(toolId);
@@ -1470,12 +1478,18 @@ var AgentGraph = class {
1470
1478
  agents: agentsObject,
1471
1479
  tools: toolsObject,
1472
1480
  contextConfig: this.contextConfig?.toObject(),
1473
- credentialReferences: this.credentials?.map((credentialReference) => ({
1474
- type: credentialReference.type,
1475
- id: credentialReference.id,
1476
- credentialStoreId: credentialReference.credentialStoreId,
1477
- retrievalParams: credentialReference.retrievalParams || {}
1478
- })),
1481
+ credentialReferences: this.credentials?.reduce(
1482
+ (acc, credentialReference) => {
1483
+ acc[credentialReference.id] = {
1484
+ type: credentialReference.type,
1485
+ id: credentialReference.id,
1486
+ credentialStoreId: credentialReference.credentialStoreId,
1487
+ retrievalParams: credentialReference.retrievalParams || {}
1488
+ };
1489
+ return acc;
1490
+ },
1491
+ {}
1492
+ ),
1479
1493
  models: this.models,
1480
1494
  statusUpdates: this.statusUpdateSettings,
1481
1495
  graphPrompt: this.graphPrompt,
@@ -2680,6 +2694,7 @@ async function deleteFullProjectViaAPI(tenantId, apiUrl, projectId) {
2680
2694
  var logger9 = getLogger("project");
2681
2695
  var Project = class {
2682
2696
  constructor(config) {
2697
+ __publicField(this, "__type", "project");
2683
2698
  __publicField(this, "projectId");
2684
2699
  __publicField(this, "projectName");
2685
2700
  __publicField(this, "projectDescription");
@@ -2690,6 +2705,7 @@ var Project = class {
2690
2705
  __publicField(this, "stopWhen");
2691
2706
  __publicField(this, "graphs", []);
2692
2707
  __publicField(this, "graphMap", /* @__PURE__ */ new Map());
2708
+ __publicField(this, "credentialReferences", []);
2693
2709
  this.projectId = config.id;
2694
2710
  this.projectName = config.name;
2695
2711
  this.projectDescription = config.description;
@@ -2717,12 +2733,15 @@ var Project = class {
2717
2733
  * Set or update the configuration (tenantId and apiUrl)
2718
2734
  * This is used by the CLI to inject configuration from inkeep.config.ts
2719
2735
  */
2720
- setConfig(tenantId, apiUrl) {
2736
+ setConfig(tenantId, apiUrl, models) {
2721
2737
  if (this.initialized) {
2722
2738
  throw new Error("Cannot set config after project has been initialized");
2723
2739
  }
2724
2740
  this.tenantId = tenantId;
2725
2741
  this.baseURL = apiUrl;
2742
+ if (models) {
2743
+ this.models = models;
2744
+ }
2726
2745
  for (const graph of this.graphs) {
2727
2746
  graph.setConfig(tenantId, this.projectId, apiUrl);
2728
2747
  }
@@ -2730,11 +2749,26 @@ var Project = class {
2730
2749
  {
2731
2750
  projectId: this.projectId,
2732
2751
  tenantId: this.tenantId,
2733
- apiUrl: this.baseURL
2752
+ apiUrl: this.baseURL,
2753
+ hasModels: !!this.models
2734
2754
  },
2735
2755
  "Project configuration updated"
2736
2756
  );
2737
2757
  }
2758
+ /**
2759
+ * Set credential references for the project
2760
+ * This is used by the CLI to inject environment-specific credentials
2761
+ */
2762
+ setCredentials(credentials) {
2763
+ this.credentialReferences = Object.values(credentials);
2764
+ logger9.info(
2765
+ {
2766
+ projectId: this.projectId,
2767
+ credentialCount: this.credentialReferences?.length || 0
2768
+ },
2769
+ "Project credentials updated"
2770
+ );
2771
+ }
2738
2772
  /**
2739
2773
  * Initialize the project and create/update it in the backend using full project approach
2740
2774
  */
@@ -2752,6 +2786,35 @@ var Project = class {
2752
2786
  "Initializing project using full project endpoint"
2753
2787
  );
2754
2788
  try {
2789
+ const projectMetadata = {
2790
+ id: this.projectId,
2791
+ name: this.projectName,
2792
+ description: this.projectDescription || "",
2793
+ models: this.models,
2794
+ stopWhen: this.stopWhen,
2795
+ graphs: {},
2796
+ // Empty graphs object for now
2797
+ tools: {},
2798
+ // Empty tools object
2799
+ credentialReferences: void 0,
2800
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2801
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
2802
+ };
2803
+ logger9.info(
2804
+ {
2805
+ projectId: this.projectId,
2806
+ mode: "api-client",
2807
+ apiUrl: this.baseURL
2808
+ },
2809
+ "Creating project metadata first"
2810
+ );
2811
+ await updateFullProjectViaAPI(this.tenantId, this.baseURL, this.projectId, projectMetadata);
2812
+ logger9.info(
2813
+ {
2814
+ projectId: this.projectId
2815
+ },
2816
+ "Project metadata created successfully"
2817
+ );
2755
2818
  const initPromises = this.graphs.map(async (graph) => {
2756
2819
  try {
2757
2820
  await graph.init();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-sdk",
3
- "version": "0.1.10",
3
+ "version": "0.2.1",
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",
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "nanoid": "^5.1.5",
10
10
  "zod": "^4.1.5",
11
- "@inkeep/agents-core": "^0.1.10"
11
+ "@inkeep/agents-core": "^0.2.1"
12
12
  },
13
13
  "devDependencies": {
14
14
  "@types/node": "^20.11.24",