@inkeep/agents-sdk 0.1.9 → 0.2.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 +62 -8
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +62 -8
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1292,12 +1292,15 @@ var AgentGraph = class {
|
|
|
1292
1292
|
const tools = [];
|
|
1293
1293
|
const selectedToolsMapping = {};
|
|
1294
1294
|
const agentTools = internalAgent.getTools();
|
|
1295
|
-
for (const [
|
|
1295
|
+
for (const [_toolName, toolInstance] of Object.entries(agentTools)) {
|
|
1296
1296
|
if (toolInstance && typeof toolInstance === "object") {
|
|
1297
1297
|
let toolId;
|
|
1298
1298
|
toolId = toolInstance.getId?.() || toolInstance.id;
|
|
1299
1299
|
if ("selectedTools" in toolInstance && toolInstance.selectedTools !== void 0) {
|
|
1300
|
-
logger7.info(
|
|
1300
|
+
logger7.info(
|
|
1301
|
+
{ toolId, selectedTools: toolInstance.selectedTools },
|
|
1302
|
+
"Selected tools"
|
|
1303
|
+
);
|
|
1301
1304
|
selectedToolsMapping[toolId] = toolInstance.selectedTools;
|
|
1302
1305
|
}
|
|
1303
1306
|
tools.push(toolId);
|
|
@@ -1472,12 +1475,18 @@ var AgentGraph = class {
|
|
|
1472
1475
|
agents: agentsObject,
|
|
1473
1476
|
tools: toolsObject,
|
|
1474
1477
|
contextConfig: this.contextConfig?.toObject(),
|
|
1475
|
-
credentialReferences: this.credentials?.
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1478
|
+
credentialReferences: this.credentials?.reduce(
|
|
1479
|
+
(acc, credentialReference) => {
|
|
1480
|
+
acc[credentialReference.id] = {
|
|
1481
|
+
type: credentialReference.type,
|
|
1482
|
+
id: credentialReference.id,
|
|
1483
|
+
credentialStoreId: credentialReference.credentialStoreId,
|
|
1484
|
+
retrievalParams: credentialReference.retrievalParams || {}
|
|
1485
|
+
};
|
|
1486
|
+
return acc;
|
|
1487
|
+
},
|
|
1488
|
+
{}
|
|
1489
|
+
),
|
|
1481
1490
|
models: this.models,
|
|
1482
1491
|
statusUpdates: this.statusUpdateSettings,
|
|
1483
1492
|
graphPrompt: this.graphPrompt,
|
|
@@ -2682,6 +2691,7 @@ async function deleteFullProjectViaAPI(tenantId, apiUrl, projectId) {
|
|
|
2682
2691
|
var logger9 = agentsCore.getLogger("project");
|
|
2683
2692
|
var Project = class {
|
|
2684
2693
|
constructor(config) {
|
|
2694
|
+
__publicField(this, "__type", "project");
|
|
2685
2695
|
__publicField(this, "projectId");
|
|
2686
2696
|
__publicField(this, "projectName");
|
|
2687
2697
|
__publicField(this, "projectDescription");
|
|
@@ -2692,6 +2702,7 @@ var Project = class {
|
|
|
2692
2702
|
__publicField(this, "stopWhen");
|
|
2693
2703
|
__publicField(this, "graphs", []);
|
|
2694
2704
|
__publicField(this, "graphMap", /* @__PURE__ */ new Map());
|
|
2705
|
+
__publicField(this, "credentialReferences", []);
|
|
2695
2706
|
this.projectId = config.id;
|
|
2696
2707
|
this.projectName = config.name;
|
|
2697
2708
|
this.projectDescription = config.description;
|
|
@@ -2737,6 +2748,20 @@ var Project = class {
|
|
|
2737
2748
|
"Project configuration updated"
|
|
2738
2749
|
);
|
|
2739
2750
|
}
|
|
2751
|
+
/**
|
|
2752
|
+
* Set credential references for the project
|
|
2753
|
+
* This is used by the CLI to inject environment-specific credentials
|
|
2754
|
+
*/
|
|
2755
|
+
setCredentials(credentials) {
|
|
2756
|
+
this.credentialReferences = Object.values(credentials);
|
|
2757
|
+
logger9.info(
|
|
2758
|
+
{
|
|
2759
|
+
projectId: this.projectId,
|
|
2760
|
+
credentialCount: this.credentialReferences?.length || 0
|
|
2761
|
+
},
|
|
2762
|
+
"Project credentials updated"
|
|
2763
|
+
);
|
|
2764
|
+
}
|
|
2740
2765
|
/**
|
|
2741
2766
|
* Initialize the project and create/update it in the backend using full project approach
|
|
2742
2767
|
*/
|
|
@@ -2754,6 +2779,35 @@ var Project = class {
|
|
|
2754
2779
|
"Initializing project using full project endpoint"
|
|
2755
2780
|
);
|
|
2756
2781
|
try {
|
|
2782
|
+
const projectMetadata = {
|
|
2783
|
+
id: this.projectId,
|
|
2784
|
+
name: this.projectName,
|
|
2785
|
+
description: this.projectDescription || "",
|
|
2786
|
+
models: this.models,
|
|
2787
|
+
stopWhen: this.stopWhen,
|
|
2788
|
+
graphs: {},
|
|
2789
|
+
// Empty graphs object for now
|
|
2790
|
+
tools: {},
|
|
2791
|
+
// Empty tools object
|
|
2792
|
+
credentialReferences: void 0,
|
|
2793
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2794
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2795
|
+
};
|
|
2796
|
+
logger9.info(
|
|
2797
|
+
{
|
|
2798
|
+
projectId: this.projectId,
|
|
2799
|
+
mode: "api-client",
|
|
2800
|
+
apiUrl: this.baseURL
|
|
2801
|
+
},
|
|
2802
|
+
"Creating project metadata first"
|
|
2803
|
+
);
|
|
2804
|
+
await updateFullProjectViaAPI(this.tenantId, this.baseURL, this.projectId, projectMetadata);
|
|
2805
|
+
logger9.info(
|
|
2806
|
+
{
|
|
2807
|
+
projectId: this.projectId
|
|
2808
|
+
},
|
|
2809
|
+
"Project metadata created successfully"
|
|
2810
|
+
);
|
|
2757
2811
|
const initPromises = this.graphs.map(async (graph) => {
|
|
2758
2812
|
try {
|
|
2759
2813
|
await graph.init();
|
package/dist/index.d.cts
CHANGED
|
@@ -771,6 +771,7 @@ interface ProjectInterface {
|
|
|
771
771
|
* ```
|
|
772
772
|
*/
|
|
773
773
|
declare class Project implements ProjectInterface {
|
|
774
|
+
readonly __type: "project";
|
|
774
775
|
private projectId;
|
|
775
776
|
private projectName;
|
|
776
777
|
private projectDescription?;
|
|
@@ -781,12 +782,18 @@ declare class Project implements ProjectInterface {
|
|
|
781
782
|
private stopWhen?;
|
|
782
783
|
private graphs;
|
|
783
784
|
private graphMap;
|
|
785
|
+
private credentialReferences?;
|
|
784
786
|
constructor(config: ProjectConfig);
|
|
785
787
|
/**
|
|
786
788
|
* Set or update the configuration (tenantId and apiUrl)
|
|
787
789
|
* This is used by the CLI to inject configuration from inkeep.config.ts
|
|
788
790
|
*/
|
|
789
791
|
setConfig(tenantId: string, apiUrl: string): void;
|
|
792
|
+
/**
|
|
793
|
+
* Set credential references for the project
|
|
794
|
+
* This is used by the CLI to inject environment-specific credentials
|
|
795
|
+
*/
|
|
796
|
+
setCredentials(credentials: Record<string, CredentialReferenceApiInsert>): void;
|
|
790
797
|
/**
|
|
791
798
|
* Initialize the project and create/update it in the backend using full project approach
|
|
792
799
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -771,6 +771,7 @@ interface ProjectInterface {
|
|
|
771
771
|
* ```
|
|
772
772
|
*/
|
|
773
773
|
declare class Project implements ProjectInterface {
|
|
774
|
+
readonly __type: "project";
|
|
774
775
|
private projectId;
|
|
775
776
|
private projectName;
|
|
776
777
|
private projectDescription?;
|
|
@@ -781,12 +782,18 @@ declare class Project implements ProjectInterface {
|
|
|
781
782
|
private stopWhen?;
|
|
782
783
|
private graphs;
|
|
783
784
|
private graphMap;
|
|
785
|
+
private credentialReferences?;
|
|
784
786
|
constructor(config: ProjectConfig);
|
|
785
787
|
/**
|
|
786
788
|
* Set or update the configuration (tenantId and apiUrl)
|
|
787
789
|
* This is used by the CLI to inject configuration from inkeep.config.ts
|
|
788
790
|
*/
|
|
789
791
|
setConfig(tenantId: string, apiUrl: string): void;
|
|
792
|
+
/**
|
|
793
|
+
* Set credential references for the project
|
|
794
|
+
* This is used by the CLI to inject environment-specific credentials
|
|
795
|
+
*/
|
|
796
|
+
setCredentials(credentials: Record<string, CredentialReferenceApiInsert>): void;
|
|
790
797
|
/**
|
|
791
798
|
* Initialize the project and create/update it in the backend using full project approach
|
|
792
799
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1290,12 +1290,15 @@ var AgentGraph = class {
|
|
|
1290
1290
|
const tools = [];
|
|
1291
1291
|
const selectedToolsMapping = {};
|
|
1292
1292
|
const agentTools = internalAgent.getTools();
|
|
1293
|
-
for (const [
|
|
1293
|
+
for (const [_toolName, toolInstance] of Object.entries(agentTools)) {
|
|
1294
1294
|
if (toolInstance && typeof toolInstance === "object") {
|
|
1295
1295
|
let toolId;
|
|
1296
1296
|
toolId = toolInstance.getId?.() || toolInstance.id;
|
|
1297
1297
|
if ("selectedTools" in toolInstance && toolInstance.selectedTools !== void 0) {
|
|
1298
|
-
logger7.info(
|
|
1298
|
+
logger7.info(
|
|
1299
|
+
{ toolId, selectedTools: toolInstance.selectedTools },
|
|
1300
|
+
"Selected tools"
|
|
1301
|
+
);
|
|
1299
1302
|
selectedToolsMapping[toolId] = toolInstance.selectedTools;
|
|
1300
1303
|
}
|
|
1301
1304
|
tools.push(toolId);
|
|
@@ -1470,12 +1473,18 @@ var AgentGraph = class {
|
|
|
1470
1473
|
agents: agentsObject,
|
|
1471
1474
|
tools: toolsObject,
|
|
1472
1475
|
contextConfig: this.contextConfig?.toObject(),
|
|
1473
|
-
credentialReferences: this.credentials?.
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1476
|
+
credentialReferences: this.credentials?.reduce(
|
|
1477
|
+
(acc, credentialReference) => {
|
|
1478
|
+
acc[credentialReference.id] = {
|
|
1479
|
+
type: credentialReference.type,
|
|
1480
|
+
id: credentialReference.id,
|
|
1481
|
+
credentialStoreId: credentialReference.credentialStoreId,
|
|
1482
|
+
retrievalParams: credentialReference.retrievalParams || {}
|
|
1483
|
+
};
|
|
1484
|
+
return acc;
|
|
1485
|
+
},
|
|
1486
|
+
{}
|
|
1487
|
+
),
|
|
1479
1488
|
models: this.models,
|
|
1480
1489
|
statusUpdates: this.statusUpdateSettings,
|
|
1481
1490
|
graphPrompt: this.graphPrompt,
|
|
@@ -2680,6 +2689,7 @@ async function deleteFullProjectViaAPI(tenantId, apiUrl, projectId) {
|
|
|
2680
2689
|
var logger9 = getLogger("project");
|
|
2681
2690
|
var Project = class {
|
|
2682
2691
|
constructor(config) {
|
|
2692
|
+
__publicField(this, "__type", "project");
|
|
2683
2693
|
__publicField(this, "projectId");
|
|
2684
2694
|
__publicField(this, "projectName");
|
|
2685
2695
|
__publicField(this, "projectDescription");
|
|
@@ -2690,6 +2700,7 @@ var Project = class {
|
|
|
2690
2700
|
__publicField(this, "stopWhen");
|
|
2691
2701
|
__publicField(this, "graphs", []);
|
|
2692
2702
|
__publicField(this, "graphMap", /* @__PURE__ */ new Map());
|
|
2703
|
+
__publicField(this, "credentialReferences", []);
|
|
2693
2704
|
this.projectId = config.id;
|
|
2694
2705
|
this.projectName = config.name;
|
|
2695
2706
|
this.projectDescription = config.description;
|
|
@@ -2735,6 +2746,20 @@ var Project = class {
|
|
|
2735
2746
|
"Project configuration updated"
|
|
2736
2747
|
);
|
|
2737
2748
|
}
|
|
2749
|
+
/**
|
|
2750
|
+
* Set credential references for the project
|
|
2751
|
+
* This is used by the CLI to inject environment-specific credentials
|
|
2752
|
+
*/
|
|
2753
|
+
setCredentials(credentials) {
|
|
2754
|
+
this.credentialReferences = Object.values(credentials);
|
|
2755
|
+
logger9.info(
|
|
2756
|
+
{
|
|
2757
|
+
projectId: this.projectId,
|
|
2758
|
+
credentialCount: this.credentialReferences?.length || 0
|
|
2759
|
+
},
|
|
2760
|
+
"Project credentials updated"
|
|
2761
|
+
);
|
|
2762
|
+
}
|
|
2738
2763
|
/**
|
|
2739
2764
|
* Initialize the project and create/update it in the backend using full project approach
|
|
2740
2765
|
*/
|
|
@@ -2752,6 +2777,35 @@ var Project = class {
|
|
|
2752
2777
|
"Initializing project using full project endpoint"
|
|
2753
2778
|
);
|
|
2754
2779
|
try {
|
|
2780
|
+
const projectMetadata = {
|
|
2781
|
+
id: this.projectId,
|
|
2782
|
+
name: this.projectName,
|
|
2783
|
+
description: this.projectDescription || "",
|
|
2784
|
+
models: this.models,
|
|
2785
|
+
stopWhen: this.stopWhen,
|
|
2786
|
+
graphs: {},
|
|
2787
|
+
// Empty graphs object for now
|
|
2788
|
+
tools: {},
|
|
2789
|
+
// Empty tools object
|
|
2790
|
+
credentialReferences: void 0,
|
|
2791
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2792
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2793
|
+
};
|
|
2794
|
+
logger9.info(
|
|
2795
|
+
{
|
|
2796
|
+
projectId: this.projectId,
|
|
2797
|
+
mode: "api-client",
|
|
2798
|
+
apiUrl: this.baseURL
|
|
2799
|
+
},
|
|
2800
|
+
"Creating project metadata first"
|
|
2801
|
+
);
|
|
2802
|
+
await updateFullProjectViaAPI(this.tenantId, this.baseURL, this.projectId, projectMetadata);
|
|
2803
|
+
logger9.info(
|
|
2804
|
+
{
|
|
2805
|
+
projectId: this.projectId
|
|
2806
|
+
},
|
|
2807
|
+
"Project metadata created successfully"
|
|
2808
|
+
);
|
|
2755
2809
|
const initPromises = this.graphs.map(async (graph) => {
|
|
2756
2810
|
try {
|
|
2757
2811
|
await graph.init();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.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",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"nanoid": "^5.1.5",
|
|
10
10
|
"zod": "^4.1.5",
|
|
11
|
-
"@inkeep/agents-core": "^0.
|
|
11
|
+
"@inkeep/agents-core": "^0.2.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@types/node": "^20.11.24",
|