@inkeep/agents-sdk 0.3.0 → 0.6.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 +374 -112
- package/dist/index.d.cts +131 -86
- package/dist/index.d.ts +131 -86
- package/dist/index.js +374 -114
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { getLogger,
|
|
1
|
+
import { getLogger, CredentialReferenceApiInsertSchema, MCPToolConfigSchema, createDatabaseClient, getProject } from '@inkeep/agents-core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
+
|
|
8
|
+
// src/utils/generateIdFromName.ts
|
|
9
|
+
function generateIdFromName(name) {
|
|
10
|
+
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/artifact-component.ts
|
|
7
14
|
var logger = getLogger("artifactComponent");
|
|
8
15
|
var ArtifactComponent = class {
|
|
9
16
|
constructor(config) {
|
|
@@ -13,16 +20,14 @@ var ArtifactComponent = class {
|
|
|
13
20
|
__publicField(this, "projectId");
|
|
14
21
|
__publicField(this, "initialized", false);
|
|
15
22
|
__publicField(this, "id");
|
|
16
|
-
this.id = generateIdFromName(config.name);
|
|
23
|
+
this.id = config.id || generateIdFromName(config.name);
|
|
17
24
|
this.config = {
|
|
18
25
|
...config,
|
|
19
|
-
id: this.id
|
|
20
|
-
tenantId: config.tenantId || "default",
|
|
21
|
-
projectId: config.projectId || "default"
|
|
26
|
+
id: this.id
|
|
22
27
|
};
|
|
23
28
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
24
|
-
this.tenantId =
|
|
25
|
-
this.projectId =
|
|
29
|
+
this.tenantId = "default";
|
|
30
|
+
this.projectId = "default";
|
|
26
31
|
logger.info(
|
|
27
32
|
{
|
|
28
33
|
artifactComponentId: this.getId(),
|
|
@@ -31,6 +36,11 @@ var ArtifactComponent = class {
|
|
|
31
36
|
"ArtifactComponent constructor initialized"
|
|
32
37
|
);
|
|
33
38
|
}
|
|
39
|
+
// Set context (tenantId and projectId) from external source (agent, graph, CLI, etc)
|
|
40
|
+
setContext(tenantId, projectId) {
|
|
41
|
+
this.tenantId = tenantId;
|
|
42
|
+
this.projectId = projectId;
|
|
43
|
+
}
|
|
34
44
|
// Compute ID from name using same slug transformation as agents
|
|
35
45
|
getId() {
|
|
36
46
|
return this.id;
|
|
@@ -81,7 +91,7 @@ var ArtifactComponent = class {
|
|
|
81
91
|
};
|
|
82
92
|
logger.info({ artifactComponentData }, "artifactComponentData for create/update");
|
|
83
93
|
const updateResponse = await fetch(
|
|
84
|
-
`${this.baseURL}/tenants/${this.tenantId}/artifact-components/${this.getId()}`,
|
|
94
|
+
`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/artifact-components/${this.getId()}`,
|
|
85
95
|
{
|
|
86
96
|
method: "PUT",
|
|
87
97
|
headers: {
|
|
@@ -114,7 +124,7 @@ var ArtifactComponent = class {
|
|
|
114
124
|
"ArtifactComponent not found, creating new artifact component"
|
|
115
125
|
);
|
|
116
126
|
const createResponse = await fetch(
|
|
117
|
-
`${this.baseURL}/tenants/${this.tenantId}/artifact-components`,
|
|
127
|
+
`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/artifact-components`,
|
|
118
128
|
{
|
|
119
129
|
method: "POST",
|
|
120
130
|
headers: {
|
|
@@ -152,16 +162,14 @@ var DataComponent = class {
|
|
|
152
162
|
__publicField(this, "projectId");
|
|
153
163
|
__publicField(this, "initialized", false);
|
|
154
164
|
__publicField(this, "id");
|
|
155
|
-
this.id = generateIdFromName(config.name);
|
|
165
|
+
this.id = config.id || generateIdFromName(config.name);
|
|
156
166
|
this.config = {
|
|
157
167
|
...config,
|
|
158
|
-
id: this.id
|
|
159
|
-
tenantId: config.tenantId || "default",
|
|
160
|
-
projectId: config.projectId || "default"
|
|
168
|
+
id: this.id
|
|
161
169
|
};
|
|
162
170
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
163
|
-
this.tenantId =
|
|
164
|
-
this.projectId =
|
|
171
|
+
this.tenantId = "default";
|
|
172
|
+
this.projectId = "default";
|
|
165
173
|
logger2.info(
|
|
166
174
|
{
|
|
167
175
|
dataComponentId: this.getId(),
|
|
@@ -170,6 +178,11 @@ var DataComponent = class {
|
|
|
170
178
|
"DataComponent constructor initialized"
|
|
171
179
|
);
|
|
172
180
|
}
|
|
181
|
+
// Set context (tenantId and projectId) from external source (agent, graph, CLI, etc)
|
|
182
|
+
setContext(tenantId, projectId) {
|
|
183
|
+
this.tenantId = tenantId;
|
|
184
|
+
this.projectId = projectId;
|
|
185
|
+
}
|
|
173
186
|
// Compute ID from name using same slug transformation as agents
|
|
174
187
|
getId() {
|
|
175
188
|
return this.id;
|
|
@@ -216,7 +229,7 @@ var DataComponent = class {
|
|
|
216
229
|
};
|
|
217
230
|
logger2.info({ dataComponentData }, "dataComponentData for create/update");
|
|
218
231
|
const updateResponse = await fetch(
|
|
219
|
-
`${this.baseURL}/tenants/${this.tenantId}/data-components/${this.getId()}`,
|
|
232
|
+
`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/data-components/${this.getId()}`,
|
|
220
233
|
{
|
|
221
234
|
method: "PUT",
|
|
222
235
|
headers: {
|
|
@@ -249,7 +262,7 @@ var DataComponent = class {
|
|
|
249
262
|
"DataComponent not found, creating new data component"
|
|
250
263
|
);
|
|
251
264
|
const createResponse = await fetch(
|
|
252
|
-
`${this.baseURL}/tenants/${this.tenantId}/data-components`,
|
|
265
|
+
`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/data-components`,
|
|
253
266
|
{
|
|
254
267
|
method: "POST",
|
|
255
268
|
headers: {
|
|
@@ -288,8 +301,8 @@ var Tool = class {
|
|
|
288
301
|
__publicField(this, "projectId");
|
|
289
302
|
this.config = config;
|
|
290
303
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
291
|
-
this.tenantId =
|
|
292
|
-
this.projectId =
|
|
304
|
+
this.tenantId = "default";
|
|
305
|
+
this.projectId = "default";
|
|
293
306
|
logger3.info(
|
|
294
307
|
{
|
|
295
308
|
Id: this.getId(),
|
|
@@ -298,6 +311,11 @@ var Tool = class {
|
|
|
298
311
|
"Tool constructor initialized"
|
|
299
312
|
);
|
|
300
313
|
}
|
|
314
|
+
// Set context (tenantId and projectId) from external source (agent, graph, CLI, etc)
|
|
315
|
+
setContext(tenantId, projectId) {
|
|
316
|
+
this.tenantId = tenantId;
|
|
317
|
+
this.projectId = projectId;
|
|
318
|
+
}
|
|
301
319
|
// Compute ID from name using same slug transformation as agents
|
|
302
320
|
getId() {
|
|
303
321
|
return this.config.id;
|
|
@@ -435,8 +453,8 @@ var Agent = class {
|
|
|
435
453
|
__publicField(this, "initialized", false);
|
|
436
454
|
this.config = { ...config, type: "internal" };
|
|
437
455
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
438
|
-
this.tenantId =
|
|
439
|
-
this.projectId =
|
|
456
|
+
this.tenantId = "default";
|
|
457
|
+
this.projectId = "default";
|
|
440
458
|
logger4.info(
|
|
441
459
|
{
|
|
442
460
|
tenantId: this.tenantId,
|
|
@@ -446,6 +464,11 @@ var Agent = class {
|
|
|
446
464
|
"Agent constructor initialized"
|
|
447
465
|
);
|
|
448
466
|
}
|
|
467
|
+
// Set context (tenantId and projectId) from external source (graph, CLI, etc)
|
|
468
|
+
setContext(tenantId, projectId) {
|
|
469
|
+
this.tenantId = tenantId;
|
|
470
|
+
this.projectId = projectId;
|
|
471
|
+
}
|
|
449
472
|
// Return the configured ID
|
|
450
473
|
getId() {
|
|
451
474
|
return this.config.id;
|
|
@@ -505,10 +528,33 @@ var Agent = class {
|
|
|
505
528
|
return typeof this.config.canDelegateTo === "function" ? this.config.canDelegateTo() : [];
|
|
506
529
|
}
|
|
507
530
|
getDataComponents() {
|
|
508
|
-
|
|
531
|
+
const components = resolveGetter(this.config.dataComponents) || [];
|
|
532
|
+
return components.map((comp) => {
|
|
533
|
+
if (comp && typeof comp.getId === "function") {
|
|
534
|
+
return {
|
|
535
|
+
id: comp.getId(),
|
|
536
|
+
name: comp.getName(),
|
|
537
|
+
description: comp.getDescription(),
|
|
538
|
+
props: comp.getProps()
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
return comp;
|
|
542
|
+
});
|
|
509
543
|
}
|
|
510
544
|
getArtifactComponents() {
|
|
511
|
-
|
|
545
|
+
const components = resolveGetter(this.config.artifactComponents) || [];
|
|
546
|
+
return components.map((comp) => {
|
|
547
|
+
if (comp && typeof comp.getId === "function") {
|
|
548
|
+
return {
|
|
549
|
+
id: comp.getId(),
|
|
550
|
+
name: comp.getName(),
|
|
551
|
+
description: comp.getDescription(),
|
|
552
|
+
summaryProps: comp.getSummaryProps?.() || comp.summaryProps,
|
|
553
|
+
fullProps: comp.getFullProps?.() || comp.fullProps
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
return comp;
|
|
557
|
+
});
|
|
512
558
|
}
|
|
513
559
|
// adjust
|
|
514
560
|
addTool(_name, tool) {
|
|
@@ -657,7 +703,13 @@ var Agent = class {
|
|
|
657
703
|
const components = resolveGetter(this.config.dataComponents);
|
|
658
704
|
if (components) {
|
|
659
705
|
for (const dataComponent2 of components) {
|
|
660
|
-
|
|
706
|
+
const plainComponent = dataComponent2 && typeof dataComponent2.getId === "function" ? {
|
|
707
|
+
id: dataComponent2.getId(),
|
|
708
|
+
name: dataComponent2.getName(),
|
|
709
|
+
description: dataComponent2.getDescription(),
|
|
710
|
+
props: dataComponent2.getProps()
|
|
711
|
+
} : dataComponent2;
|
|
712
|
+
await this.createDataComponent(plainComponent);
|
|
661
713
|
}
|
|
662
714
|
}
|
|
663
715
|
}
|
|
@@ -669,7 +721,14 @@ var Agent = class {
|
|
|
669
721
|
const components = resolveGetter(this.config.artifactComponents);
|
|
670
722
|
if (components) {
|
|
671
723
|
for (const artifactComponent2 of components) {
|
|
672
|
-
|
|
724
|
+
const plainComponent = artifactComponent2 && typeof artifactComponent2.getId === "function" ? {
|
|
725
|
+
id: artifactComponent2.getId(),
|
|
726
|
+
name: artifactComponent2.getName(),
|
|
727
|
+
description: artifactComponent2.getDescription(),
|
|
728
|
+
summaryProps: artifactComponent2.getSummaryProps?.() || artifactComponent2.summaryProps,
|
|
729
|
+
fullProps: artifactComponent2.getFullProps?.() || artifactComponent2.fullProps
|
|
730
|
+
} : artifactComponent2;
|
|
731
|
+
await this.createArtifactComponent(plainComponent);
|
|
673
732
|
}
|
|
674
733
|
}
|
|
675
734
|
}
|
|
@@ -678,8 +737,6 @@ var Agent = class {
|
|
|
678
737
|
const existingComponents = [];
|
|
679
738
|
const dbDataComponents = existingComponents.map((component) => ({
|
|
680
739
|
id: component.id,
|
|
681
|
-
tenantId: component.tenantId || this.tenantId,
|
|
682
|
-
projectId: component.projectId || this.projectId,
|
|
683
740
|
name: component.name,
|
|
684
741
|
description: component.description,
|
|
685
742
|
props: component.props,
|
|
@@ -687,9 +744,24 @@ var Agent = class {
|
|
|
687
744
|
updatedAt: component.updatedAt
|
|
688
745
|
}));
|
|
689
746
|
const configComponents = resolveGetter(this.config.dataComponents) || [];
|
|
690
|
-
const
|
|
747
|
+
const normalizedConfigComponents = configComponents.map((comp) => {
|
|
748
|
+
if (comp && typeof comp.getId === "function") {
|
|
749
|
+
return {
|
|
750
|
+
id: comp.getId(),
|
|
751
|
+
name: comp.getName(),
|
|
752
|
+
description: comp.getDescription(),
|
|
753
|
+
props: comp.getProps()
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
return comp;
|
|
757
|
+
});
|
|
758
|
+
const allComponents = [...dbDataComponents, ...normalizedConfigComponents];
|
|
691
759
|
const uniqueComponents = allComponents.reduce((acc, component) => {
|
|
692
|
-
const
|
|
760
|
+
const componentId = typeof component.getId === "function" ? component.getId() : component.id;
|
|
761
|
+
const existingIndex = acc.findIndex((c) => {
|
|
762
|
+
const cId = typeof c.getId === "function" ? c.getId() : c.id;
|
|
763
|
+
return cId === componentId;
|
|
764
|
+
});
|
|
693
765
|
if (existingIndex >= 0) {
|
|
694
766
|
acc[existingIndex] = component;
|
|
695
767
|
} else {
|
|
@@ -697,7 +769,7 @@ var Agent = class {
|
|
|
697
769
|
}
|
|
698
770
|
return acc;
|
|
699
771
|
}, []);
|
|
700
|
-
this.config.dataComponents = uniqueComponents;
|
|
772
|
+
this.config.dataComponents = () => uniqueComponents;
|
|
701
773
|
logger4.info(
|
|
702
774
|
{
|
|
703
775
|
agentId: this.getId(),
|
|
@@ -722,8 +794,6 @@ var Agent = class {
|
|
|
722
794
|
const existingComponents = [];
|
|
723
795
|
const dbArtifactComponents = existingComponents.map((component) => ({
|
|
724
796
|
id: component.id,
|
|
725
|
-
tenantId: component.tenantId || this.tenantId,
|
|
726
|
-
projectId: component.projectId || this.projectId,
|
|
727
797
|
name: component.name,
|
|
728
798
|
description: component.description,
|
|
729
799
|
summaryProps: component.summaryProps,
|
|
@@ -732,9 +802,25 @@ var Agent = class {
|
|
|
732
802
|
updatedAt: component.updatedAt
|
|
733
803
|
}));
|
|
734
804
|
const configComponents = resolveGetter(this.config.artifactComponents) || [];
|
|
735
|
-
const
|
|
805
|
+
const normalizedConfigComponents = configComponents.map((comp) => {
|
|
806
|
+
if (comp && typeof comp.getId === "function") {
|
|
807
|
+
return {
|
|
808
|
+
id: comp.getId(),
|
|
809
|
+
name: comp.getName(),
|
|
810
|
+
description: comp.getDescription(),
|
|
811
|
+
summaryProps: comp.getSummaryProps?.() || comp.summaryProps,
|
|
812
|
+
fullProps: comp.getFullProps?.() || comp.fullProps
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
return comp;
|
|
816
|
+
});
|
|
817
|
+
const allComponents = [...dbArtifactComponents, ...normalizedConfigComponents];
|
|
736
818
|
const uniqueComponents = allComponents.reduce((acc, component) => {
|
|
737
|
-
const
|
|
819
|
+
const componentId = typeof component.getId === "function" ? component.getId() : component.id;
|
|
820
|
+
const existingIndex = acc.findIndex((c) => {
|
|
821
|
+
const cId = typeof c.getId === "function" ? c.getId() : c.id;
|
|
822
|
+
return cId === componentId;
|
|
823
|
+
});
|
|
738
824
|
if (existingIndex >= 0) {
|
|
739
825
|
acc[existingIndex] = component;
|
|
740
826
|
} else {
|
|
@@ -742,7 +828,7 @@ var Agent = class {
|
|
|
742
828
|
}
|
|
743
829
|
return acc;
|
|
744
830
|
}, []);
|
|
745
|
-
this.config.artifactComponents = uniqueComponents;
|
|
831
|
+
this.config.artifactComponents = () => uniqueComponents;
|
|
746
832
|
logger4.info(
|
|
747
833
|
{
|
|
748
834
|
agentId: this.getId(),
|
|
@@ -780,20 +866,22 @@ var Agent = class {
|
|
|
780
866
|
const mcpConfig = toolConfig;
|
|
781
867
|
tool = mcpConfig.server;
|
|
782
868
|
selectedTools = mcpConfig.selectedTools;
|
|
869
|
+
tool.setContext(this.tenantId, this.projectId);
|
|
783
870
|
await tool.init();
|
|
784
871
|
} else if (toolConfig instanceof Tool) {
|
|
785
872
|
tool = toolConfig;
|
|
873
|
+
tool.setContext(this.tenantId, this.projectId);
|
|
786
874
|
await tool.init();
|
|
787
875
|
} else {
|
|
788
876
|
tool = new Tool({
|
|
789
877
|
id: toolId,
|
|
790
|
-
tenantId: this.tenantId,
|
|
791
878
|
name: toolConfig.name || toolId,
|
|
792
879
|
description: toolConfig.description || `MCP tool: ${toolId}`,
|
|
793
880
|
serverUrl: toolConfig.config?.serverUrl || toolConfig.serverUrl || "http://localhost:3000",
|
|
794
881
|
activeTools: toolConfig.config?.mcp?.activeTools,
|
|
795
882
|
credential: toolConfig.credential
|
|
796
883
|
});
|
|
884
|
+
tool.setContext(this.tenantId, this.projectId);
|
|
797
885
|
await tool.init();
|
|
798
886
|
}
|
|
799
887
|
await this.createAgentToolRelation(tool.getId(), selectedTools);
|
|
@@ -819,12 +907,12 @@ var Agent = class {
|
|
|
819
907
|
async createDataComponent(dataComponent2) {
|
|
820
908
|
try {
|
|
821
909
|
const dc = new DataComponent({
|
|
822
|
-
|
|
823
|
-
projectId: this.projectId,
|
|
910
|
+
id: dataComponent2.id,
|
|
824
911
|
name: dataComponent2.name,
|
|
825
912
|
description: dataComponent2.description,
|
|
826
913
|
props: dataComponent2.props
|
|
827
914
|
});
|
|
915
|
+
dc.setContext(this.tenantId, this.projectId);
|
|
828
916
|
await dc.init();
|
|
829
917
|
await this.createAgentDataComponentRelation(dc.getId());
|
|
830
918
|
logger4.info(
|
|
@@ -849,13 +937,13 @@ var Agent = class {
|
|
|
849
937
|
async createArtifactComponent(artifactComponent2) {
|
|
850
938
|
try {
|
|
851
939
|
const ac = new ArtifactComponent({
|
|
852
|
-
|
|
853
|
-
projectId: this.projectId,
|
|
940
|
+
id: artifactComponent2.id,
|
|
854
941
|
name: artifactComponent2.name,
|
|
855
942
|
description: artifactComponent2.description,
|
|
856
943
|
summaryProps: artifactComponent2.summaryProps,
|
|
857
944
|
fullProps: artifactComponent2.fullProps
|
|
858
945
|
});
|
|
946
|
+
ac.setContext(this.tenantId, this.projectId);
|
|
859
947
|
await ac.init();
|
|
860
948
|
await this.createAgentArtifactComponentRelation(ac.getId());
|
|
861
949
|
logger4.info(
|
|
@@ -973,13 +1061,13 @@ var ExternalAgent = class {
|
|
|
973
1061
|
__publicField(this, "tenantId");
|
|
974
1062
|
__publicField(this, "baseURL");
|
|
975
1063
|
this.config = { ...config, type: "external" };
|
|
976
|
-
this.tenantId =
|
|
1064
|
+
this.tenantId = "default";
|
|
977
1065
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
978
1066
|
logger5.debug(
|
|
979
1067
|
{
|
|
980
1068
|
externalAgentName: this.config.name,
|
|
981
1069
|
baseUrl: this.config.baseUrl,
|
|
982
|
-
tenantId: this.
|
|
1070
|
+
tenantId: this.tenantId
|
|
983
1071
|
},
|
|
984
1072
|
"External Agent constructor initialized"
|
|
985
1073
|
);
|
|
@@ -1009,6 +1097,10 @@ var ExternalAgent = class {
|
|
|
1009
1097
|
throw error;
|
|
1010
1098
|
}
|
|
1011
1099
|
}
|
|
1100
|
+
// Set context (tenantId) from external source (graph, CLI, etc)
|
|
1101
|
+
setContext(tenantId) {
|
|
1102
|
+
this.tenantId = tenantId;
|
|
1103
|
+
}
|
|
1012
1104
|
// Compute ID from name using a simple slug transformation
|
|
1013
1105
|
getId() {
|
|
1014
1106
|
return this.config.id;
|
|
@@ -1202,7 +1294,7 @@ var AgentGraph = class {
|
|
|
1202
1294
|
__publicField(this, "stopWhen");
|
|
1203
1295
|
__publicField(this, "dbClient");
|
|
1204
1296
|
this.defaultAgent = config.defaultAgent;
|
|
1205
|
-
this.tenantId =
|
|
1297
|
+
this.tenantId = "default";
|
|
1206
1298
|
this.projectId = "default";
|
|
1207
1299
|
this.graphId = config.id;
|
|
1208
1300
|
this.graphName = config.name || this.graphId;
|
|
@@ -1253,14 +1345,14 @@ var AgentGraph = class {
|
|
|
1253
1345
|
for (const agent2 of this.agents) {
|
|
1254
1346
|
if (this.isInternalAgent(agent2)) {
|
|
1255
1347
|
const internalAgent = agent2;
|
|
1256
|
-
if (
|
|
1257
|
-
internalAgent.
|
|
1348
|
+
if (internalAgent.setContext) {
|
|
1349
|
+
internalAgent.setContext(tenantId, projectId);
|
|
1258
1350
|
}
|
|
1259
1351
|
const tools = internalAgent.getTools();
|
|
1260
1352
|
for (const [_, toolInstance] of Object.entries(tools)) {
|
|
1261
|
-
if (toolInstance && typeof toolInstance === "object"
|
|
1262
|
-
if (
|
|
1263
|
-
toolInstance.
|
|
1353
|
+
if (toolInstance && typeof toolInstance === "object") {
|
|
1354
|
+
if ("setContext" in toolInstance && typeof toolInstance.setContext === "function") {
|
|
1355
|
+
toolInstance.setContext(tenantId, projectId);
|
|
1264
1356
|
}
|
|
1265
1357
|
if ("baseURL" in toolInstance && !toolInstance.baseURL) {
|
|
1266
1358
|
toolInstance.baseURL = apiUrl;
|
|
@@ -1269,8 +1361,8 @@ var AgentGraph = class {
|
|
|
1269
1361
|
}
|
|
1270
1362
|
}
|
|
1271
1363
|
}
|
|
1272
|
-
if (this.contextConfig
|
|
1273
|
-
this.contextConfig.tenantId
|
|
1364
|
+
if (this.contextConfig?.setContext) {
|
|
1365
|
+
this.contextConfig.setContext(tenantId, projectId);
|
|
1274
1366
|
}
|
|
1275
1367
|
logger7.info(
|
|
1276
1368
|
{
|
|
@@ -1325,6 +1417,10 @@ var AgentGraph = class {
|
|
|
1325
1417
|
artifactComponents.push(artifactComponentId);
|
|
1326
1418
|
}
|
|
1327
1419
|
}
|
|
1420
|
+
const canUse = tools.map((toolId) => ({
|
|
1421
|
+
toolId,
|
|
1422
|
+
toolSelection: selectedToolsMapping[toolId] || null
|
|
1423
|
+
}));
|
|
1328
1424
|
agentsObject[internalAgent.getId()] = {
|
|
1329
1425
|
id: internalAgent.getId(),
|
|
1330
1426
|
name: internalAgent.getName(),
|
|
@@ -1333,8 +1429,8 @@ var AgentGraph = class {
|
|
|
1333
1429
|
models: internalAgent.config.models,
|
|
1334
1430
|
canTransferTo: transfers.map((h) => h.getId()),
|
|
1335
1431
|
canDelegateTo: delegates.map((d) => d.getId()),
|
|
1336
|
-
|
|
1337
|
-
|
|
1432
|
+
canUse,
|
|
1433
|
+
// Always include for internal agents (required by API)
|
|
1338
1434
|
dataComponents: dataComponents.length > 0 ? dataComponents : void 0,
|
|
1339
1435
|
artifactComponents: artifactComponents.length > 0 ? artifactComponents : void 0,
|
|
1340
1436
|
type: "internal"
|
|
@@ -1348,8 +1444,6 @@ var AgentGraph = class {
|
|
|
1348
1444
|
baseUrl: externalAgent2.getBaseUrl(),
|
|
1349
1445
|
credentialReferenceId: externalAgent2.getCredentialReferenceId(),
|
|
1350
1446
|
headers: externalAgent2.getHeaders(),
|
|
1351
|
-
tools: [],
|
|
1352
|
-
// External agents don't have tools in this context
|
|
1353
1447
|
type: "external"
|
|
1354
1448
|
};
|
|
1355
1449
|
}
|
|
@@ -2343,7 +2437,6 @@ var AgentGraph = class {
|
|
|
2343
2437
|
throw error;
|
|
2344
2438
|
}
|
|
2345
2439
|
}
|
|
2346
|
-
// enableComponentMode removed – feature deprecated
|
|
2347
2440
|
async createExternalAgentRelation(sourceAgent, externalAgent2, relationType) {
|
|
2348
2441
|
try {
|
|
2349
2442
|
const response = await fetch(
|
|
@@ -2468,13 +2561,24 @@ async function createFullProjectViaAPI(tenantId, apiUrl, projectData) {
|
|
|
2468
2561
|
"Creating full project via API"
|
|
2469
2562
|
);
|
|
2470
2563
|
const url = `${apiUrl}/tenants/${tenantId}/project-full`;
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2564
|
+
let response;
|
|
2565
|
+
try {
|
|
2566
|
+
response = await fetch(url, {
|
|
2567
|
+
method: "POST",
|
|
2568
|
+
headers: {
|
|
2569
|
+
"Content-Type": "application/json"
|
|
2570
|
+
},
|
|
2571
|
+
body: JSON.stringify(projectData)
|
|
2572
|
+
});
|
|
2573
|
+
} catch (fetchError) {
|
|
2574
|
+
logger8.error({
|
|
2575
|
+
error: fetchError instanceof Error ? fetchError.message : "Unknown fetch error",
|
|
2576
|
+
url,
|
|
2577
|
+
tenantId,
|
|
2578
|
+
projectId: projectData.id
|
|
2579
|
+
}, "Fetch request failed");
|
|
2580
|
+
throw fetchError;
|
|
2581
|
+
}
|
|
2478
2582
|
if (!response.ok) {
|
|
2479
2583
|
const errorText = await response.text();
|
|
2480
2584
|
let errorMessage = `Failed to create project: ${response.status} ${response.statusText}`;
|
|
@@ -2516,13 +2620,24 @@ async function updateFullProjectViaAPI(tenantId, apiUrl, projectId, projectData)
|
|
|
2516
2620
|
"Updating full project via API"
|
|
2517
2621
|
);
|
|
2518
2622
|
const url = `${apiUrl}/tenants/${tenantId}/project-full/${projectId}`;
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2623
|
+
let response;
|
|
2624
|
+
try {
|
|
2625
|
+
response = await fetch(url, {
|
|
2626
|
+
method: "PUT",
|
|
2627
|
+
headers: {
|
|
2628
|
+
"Content-Type": "application/json"
|
|
2629
|
+
},
|
|
2630
|
+
body: JSON.stringify(projectData)
|
|
2631
|
+
});
|
|
2632
|
+
} catch (fetchError) {
|
|
2633
|
+
logger8.error({
|
|
2634
|
+
error: fetchError instanceof Error ? fetchError.message : "Unknown fetch error",
|
|
2635
|
+
url,
|
|
2636
|
+
tenantId,
|
|
2637
|
+
projectId
|
|
2638
|
+
}, "Fetch request failed");
|
|
2639
|
+
throw fetchError;
|
|
2640
|
+
}
|
|
2526
2641
|
if (!response.ok) {
|
|
2527
2642
|
const errorText = await response.text();
|
|
2528
2643
|
let errorMessage = `Failed to update project: ${response.status} ${response.statusText}`;
|
|
@@ -2675,7 +2790,7 @@ var Project = class {
|
|
|
2675
2790
|
this.projectId = config.id;
|
|
2676
2791
|
this.projectName = config.name;
|
|
2677
2792
|
this.projectDescription = config.description;
|
|
2678
|
-
this.tenantId =
|
|
2793
|
+
this.tenantId = process.env.INKEEP_TENANT_ID || "default";
|
|
2679
2794
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
2680
2795
|
this.models = config.models;
|
|
2681
2796
|
this.stopWhen = config.stopWhen;
|
|
@@ -2887,6 +3002,20 @@ var Project = class {
|
|
|
2887
3002
|
setStopWhen(stopWhen) {
|
|
2888
3003
|
this.stopWhen = stopWhen;
|
|
2889
3004
|
}
|
|
3005
|
+
/**
|
|
3006
|
+
* Get credential tracking information
|
|
3007
|
+
*/
|
|
3008
|
+
async getCredentialTracking() {
|
|
3009
|
+
const fullDef = await this.toFullProjectDefinition();
|
|
3010
|
+
const credentials = fullDef.credentialReferences || {};
|
|
3011
|
+
const usage = {};
|
|
3012
|
+
for (const [credId, credData] of Object.entries(credentials)) {
|
|
3013
|
+
if (credData.usedBy) {
|
|
3014
|
+
usage[credId] = credData.usedBy;
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
return { credentials, usage };
|
|
3018
|
+
}
|
|
2890
3019
|
/**
|
|
2891
3020
|
* Get all graphs in the project
|
|
2892
3021
|
*/
|
|
@@ -2982,9 +3111,82 @@ var Project = class {
|
|
|
2982
3111
|
const toolsObject = {};
|
|
2983
3112
|
const dataComponentsObject = {};
|
|
2984
3113
|
const artifactComponentsObject = {};
|
|
3114
|
+
const credentialReferencesObject = {};
|
|
3115
|
+
const credentialUsageMap = {};
|
|
2985
3116
|
for (const graph of this.graphs) {
|
|
2986
3117
|
const graphDefinition = await graph.toFullGraphDefinition();
|
|
2987
3118
|
graphsObject[graph.getId()] = graphDefinition;
|
|
3119
|
+
const graphCredentials = graph.credentials;
|
|
3120
|
+
if (graphCredentials && Array.isArray(graphCredentials)) {
|
|
3121
|
+
for (const credential2 of graphCredentials) {
|
|
3122
|
+
if (credential2?.__type === "credential-ref") {
|
|
3123
|
+
continue;
|
|
3124
|
+
}
|
|
3125
|
+
if (credential2?.id) {
|
|
3126
|
+
if (!credentialReferencesObject[credential2.id]) {
|
|
3127
|
+
credentialReferencesObject[credential2.id] = {
|
|
3128
|
+
id: credential2.id,
|
|
3129
|
+
type: credential2.type,
|
|
3130
|
+
credentialStoreId: credential2.credentialStoreId,
|
|
3131
|
+
retrievalParams: credential2.retrievalParams
|
|
3132
|
+
};
|
|
3133
|
+
credentialUsageMap[credential2.id] = [];
|
|
3134
|
+
}
|
|
3135
|
+
credentialUsageMap[credential2.id].push({
|
|
3136
|
+
type: "graph",
|
|
3137
|
+
id: graph.getId()
|
|
3138
|
+
});
|
|
3139
|
+
}
|
|
3140
|
+
}
|
|
3141
|
+
}
|
|
3142
|
+
const contextConfig = graph.contextConfig;
|
|
3143
|
+
if (contextConfig) {
|
|
3144
|
+
const contextVariables = contextConfig.getContextVariables?.() || contextConfig.contextVariables;
|
|
3145
|
+
if (contextVariables) {
|
|
3146
|
+
for (const [key, variable] of Object.entries(contextVariables)) {
|
|
3147
|
+
if (variable?.credential) {
|
|
3148
|
+
const credential2 = variable.credential;
|
|
3149
|
+
let credId;
|
|
3150
|
+
if (credential2.__type === "credential-ref") {
|
|
3151
|
+
credId = credential2.id;
|
|
3152
|
+
if (credId && this.credentialReferences) {
|
|
3153
|
+
const resolvedCred = this.credentialReferences.find((c) => c.id === credId);
|
|
3154
|
+
if (resolvedCred && !credentialReferencesObject[credId]) {
|
|
3155
|
+
credentialReferencesObject[credId] = resolvedCred;
|
|
3156
|
+
credentialUsageMap[credId] = [];
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
} else if (credential2.id) {
|
|
3160
|
+
credId = credential2.id;
|
|
3161
|
+
if (credId && !credentialReferencesObject[credId]) {
|
|
3162
|
+
credentialReferencesObject[credId] = credential2;
|
|
3163
|
+
credentialUsageMap[credId] = [];
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
if (credId) {
|
|
3167
|
+
if (!credentialUsageMap[credId]) {
|
|
3168
|
+
credentialUsageMap[credId] = [];
|
|
3169
|
+
}
|
|
3170
|
+
credentialUsageMap[credId].push({
|
|
3171
|
+
type: "contextVariable",
|
|
3172
|
+
id: key,
|
|
3173
|
+
graphId: graph.getId()
|
|
3174
|
+
});
|
|
3175
|
+
}
|
|
3176
|
+
} else if (variable?.credentialReferenceId) {
|
|
3177
|
+
const credId = variable.credentialReferenceId;
|
|
3178
|
+
if (!credentialUsageMap[credId]) {
|
|
3179
|
+
credentialUsageMap[credId] = [];
|
|
3180
|
+
}
|
|
3181
|
+
credentialUsageMap[credId].push({
|
|
3182
|
+
type: "contextVariable",
|
|
3183
|
+
id: key,
|
|
3184
|
+
graphId: graph.getId()
|
|
3185
|
+
});
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
2988
3190
|
for (const agent2 of graph.agents) {
|
|
2989
3191
|
if (!agent2.getTools) {
|
|
2990
3192
|
continue;
|
|
@@ -3049,7 +3251,27 @@ var Project = class {
|
|
|
3049
3251
|
toolData.lastToolsSync = actualTool.lastToolsSync;
|
|
3050
3252
|
}
|
|
3051
3253
|
if (actualTool.getCredentialReferenceId?.()) {
|
|
3052
|
-
|
|
3254
|
+
const credId = actualTool.getCredentialReferenceId();
|
|
3255
|
+
toolData.credentialReferenceId = credId;
|
|
3256
|
+
if (!credentialUsageMap[credId]) {
|
|
3257
|
+
credentialUsageMap[credId] = [];
|
|
3258
|
+
}
|
|
3259
|
+
credentialUsageMap[credId].push({
|
|
3260
|
+
type: "tool",
|
|
3261
|
+
id: toolId,
|
|
3262
|
+
graphId: graph.getId()
|
|
3263
|
+
});
|
|
3264
|
+
} else if (actualTool.config?.credential?.id) {
|
|
3265
|
+
const credId = actualTool.config.credential.id;
|
|
3266
|
+
toolData.credentialReferenceId = credId;
|
|
3267
|
+
if (!credentialUsageMap[credId]) {
|
|
3268
|
+
credentialUsageMap[credId] = [];
|
|
3269
|
+
}
|
|
3270
|
+
credentialUsageMap[credId].push({
|
|
3271
|
+
type: "tool",
|
|
3272
|
+
id: toolId,
|
|
3273
|
+
graphId: graph.getId()
|
|
3274
|
+
});
|
|
3053
3275
|
}
|
|
3054
3276
|
toolsObject[toolId] = toolData;
|
|
3055
3277
|
}
|
|
@@ -3058,13 +3280,27 @@ var Project = class {
|
|
|
3058
3280
|
const agentDataComponents = agent2.getDataComponents?.();
|
|
3059
3281
|
if (agentDataComponents) {
|
|
3060
3282
|
for (const dataComponent2 of agentDataComponents) {
|
|
3061
|
-
|
|
3062
|
-
|
|
3283
|
+
let dataComponentId;
|
|
3284
|
+
let dataComponentName;
|
|
3285
|
+
let dataComponentDescription;
|
|
3286
|
+
let dataComponentProps;
|
|
3287
|
+
if (dataComponent2.getId) {
|
|
3288
|
+
dataComponentId = dataComponent2.getId();
|
|
3289
|
+
dataComponentName = dataComponent2.getName();
|
|
3290
|
+
dataComponentDescription = dataComponent2.getDescription() || "";
|
|
3291
|
+
dataComponentProps = dataComponent2.getProps() || {};
|
|
3292
|
+
} else {
|
|
3293
|
+
dataComponentId = dataComponent2.id || (dataComponent2.name ? dataComponent2.name.toLowerCase().replace(/\s+/g, "-") : "");
|
|
3294
|
+
dataComponentName = dataComponent2.name || "";
|
|
3295
|
+
dataComponentDescription = dataComponent2.description || "";
|
|
3296
|
+
dataComponentProps = dataComponent2.props || {};
|
|
3297
|
+
}
|
|
3298
|
+
if (!dataComponentsObject[dataComponentId] && dataComponentName) {
|
|
3063
3299
|
dataComponentsObject[dataComponentId] = {
|
|
3064
3300
|
id: dataComponentId,
|
|
3065
|
-
name:
|
|
3066
|
-
description:
|
|
3067
|
-
props:
|
|
3301
|
+
name: dataComponentName,
|
|
3302
|
+
description: dataComponentDescription,
|
|
3303
|
+
props: dataComponentProps
|
|
3068
3304
|
};
|
|
3069
3305
|
}
|
|
3070
3306
|
}
|
|
@@ -3072,20 +3308,52 @@ var Project = class {
|
|
|
3072
3308
|
const agentArtifactComponents = agent2.getArtifactComponents?.();
|
|
3073
3309
|
if (agentArtifactComponents) {
|
|
3074
3310
|
for (const artifactComponent2 of agentArtifactComponents) {
|
|
3075
|
-
|
|
3076
|
-
|
|
3311
|
+
let artifactComponentId;
|
|
3312
|
+
let artifactComponentName;
|
|
3313
|
+
let artifactComponentDescription;
|
|
3314
|
+
let artifactComponentSummaryProps;
|
|
3315
|
+
let artifactComponentFullProps;
|
|
3316
|
+
if (artifactComponent2.getId) {
|
|
3317
|
+
artifactComponentId = artifactComponent2.getId();
|
|
3318
|
+
artifactComponentName = artifactComponent2.getName();
|
|
3319
|
+
artifactComponentDescription = artifactComponent2.getDescription() || "";
|
|
3320
|
+
artifactComponentSummaryProps = artifactComponent2.getSummaryProps() || {};
|
|
3321
|
+
artifactComponentFullProps = artifactComponent2.getFullProps() || {};
|
|
3322
|
+
} else {
|
|
3323
|
+
artifactComponentId = artifactComponent2.id || (artifactComponent2.name ? artifactComponent2.name.toLowerCase().replace(/\s+/g, "-") : "");
|
|
3324
|
+
artifactComponentName = artifactComponent2.name || "";
|
|
3325
|
+
artifactComponentDescription = artifactComponent2.description || "";
|
|
3326
|
+
artifactComponentSummaryProps = artifactComponent2.summaryProps || {};
|
|
3327
|
+
artifactComponentFullProps = artifactComponent2.fullProps || {};
|
|
3328
|
+
}
|
|
3329
|
+
if (!artifactComponentsObject[artifactComponentId] && artifactComponentName) {
|
|
3077
3330
|
artifactComponentsObject[artifactComponentId] = {
|
|
3078
3331
|
id: artifactComponentId,
|
|
3079
|
-
name:
|
|
3080
|
-
description:
|
|
3081
|
-
summaryProps:
|
|
3082
|
-
fullProps:
|
|
3332
|
+
name: artifactComponentName,
|
|
3333
|
+
description: artifactComponentDescription,
|
|
3334
|
+
summaryProps: artifactComponentSummaryProps,
|
|
3335
|
+
fullProps: artifactComponentFullProps
|
|
3083
3336
|
};
|
|
3084
3337
|
}
|
|
3085
3338
|
}
|
|
3086
3339
|
}
|
|
3087
3340
|
}
|
|
3088
3341
|
}
|
|
3342
|
+
if (this.credentialReferences && this.credentialReferences.length > 0) {
|
|
3343
|
+
for (const credential2 of this.credentialReferences) {
|
|
3344
|
+
if (credential2.id) {
|
|
3345
|
+
if (!credentialReferencesObject[credential2.id]) {
|
|
3346
|
+
credentialReferencesObject[credential2.id] = credential2;
|
|
3347
|
+
credentialUsageMap[credential2.id] = [];
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
}
|
|
3352
|
+
for (const [credId, usages] of Object.entries(credentialUsageMap)) {
|
|
3353
|
+
if (credentialReferencesObject[credId]) {
|
|
3354
|
+
credentialReferencesObject[credId].usedBy = usages;
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3089
3357
|
return {
|
|
3090
3358
|
id: this.projectId,
|
|
3091
3359
|
name: this.projectName,
|
|
@@ -3096,31 +3364,13 @@ var Project = class {
|
|
|
3096
3364
|
tools: toolsObject,
|
|
3097
3365
|
dataComponents: Object.keys(dataComponentsObject).length > 0 ? dataComponentsObject : void 0,
|
|
3098
3366
|
artifactComponents: Object.keys(artifactComponentsObject).length > 0 ? artifactComponentsObject : void 0,
|
|
3099
|
-
credentialReferences: void 0,
|
|
3100
|
-
// Projects don't directly hold credentials yet
|
|
3367
|
+
credentialReferences: Object.keys(credentialReferencesObject).length > 0 ? credentialReferencesObject : void 0,
|
|
3101
3368
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3102
3369
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3103
3370
|
};
|
|
3104
3371
|
}
|
|
3105
|
-
/**
|
|
3106
|
-
* Convert project configuration to API format
|
|
3107
|
-
*/
|
|
3108
|
-
toApiFormat() {
|
|
3109
|
-
return {
|
|
3110
|
-
id: this.projectId,
|
|
3111
|
-
name: this.projectName,
|
|
3112
|
-
description: this.projectDescription || "",
|
|
3113
|
-
models: this.models,
|
|
3114
|
-
stopWhen: this.stopWhen
|
|
3115
|
-
};
|
|
3116
|
-
}
|
|
3117
3372
|
};
|
|
3118
3373
|
|
|
3119
|
-
// src/utils/generateIdFromName.ts
|
|
3120
|
-
function generateIdFromName3(name) {
|
|
3121
|
-
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
3122
|
-
}
|
|
3123
|
-
|
|
3124
3374
|
// src/builderFunctions.ts
|
|
3125
3375
|
function agentGraph(config) {
|
|
3126
3376
|
return new AgentGraph(config);
|
|
@@ -3143,13 +3393,12 @@ function mcpServer(config) {
|
|
|
3143
3393
|
if (!config.serverUrl) {
|
|
3144
3394
|
throw new Error("MCP server requires a serverUrl");
|
|
3145
3395
|
}
|
|
3146
|
-
const id = config.id ||
|
|
3396
|
+
const id = config.id || generateIdFromName(config.name);
|
|
3147
3397
|
return new Tool({
|
|
3148
3398
|
id,
|
|
3149
3399
|
name: config.name,
|
|
3150
3400
|
description: config.description,
|
|
3151
3401
|
serverUrl: config.serverUrl,
|
|
3152
|
-
tenantId: config.tenantId,
|
|
3153
3402
|
credential: config.credential,
|
|
3154
3403
|
activeTools: config.activeTools,
|
|
3155
3404
|
headers: config.headers,
|
|
@@ -3160,24 +3409,24 @@ function mcpServer(config) {
|
|
|
3160
3409
|
function mcpTool(config) {
|
|
3161
3410
|
const configWithId = {
|
|
3162
3411
|
...config,
|
|
3163
|
-
id: config.id ||
|
|
3412
|
+
id: config.id || generateIdFromName(config.name)
|
|
3164
3413
|
};
|
|
3165
3414
|
const validatedConfig = MCPToolConfigSchema.parse(configWithId);
|
|
3166
3415
|
return new Tool(validatedConfig);
|
|
3167
3416
|
}
|
|
3168
3417
|
function artifactComponent(config) {
|
|
3169
|
-
|
|
3418
|
+
const configWithId = {
|
|
3170
3419
|
...config,
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3420
|
+
id: config.id || generateIdFromName(config.name)
|
|
3421
|
+
};
|
|
3422
|
+
return new ArtifactComponent(configWithId);
|
|
3174
3423
|
}
|
|
3175
3424
|
function dataComponent(config) {
|
|
3176
|
-
|
|
3425
|
+
const configWithId = {
|
|
3177
3426
|
...config,
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3427
|
+
id: config.id || generateIdFromName(config.name)
|
|
3428
|
+
};
|
|
3429
|
+
return new DataComponent(configWithId);
|
|
3181
3430
|
}
|
|
3182
3431
|
function agentMcp(config) {
|
|
3183
3432
|
return {
|
|
@@ -3186,6 +3435,17 @@ function agentMcp(config) {
|
|
|
3186
3435
|
};
|
|
3187
3436
|
}
|
|
3188
3437
|
|
|
3438
|
+
// src/credential-ref.ts
|
|
3439
|
+
function credentialRef(id) {
|
|
3440
|
+
return {
|
|
3441
|
+
__type: "credential-ref",
|
|
3442
|
+
id
|
|
3443
|
+
};
|
|
3444
|
+
}
|
|
3445
|
+
function isCredentialReference(value) {
|
|
3446
|
+
return value && typeof value === "object" && value.__type === "credential-ref";
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3189
3449
|
// src/utils/validateFunction.ts
|
|
3190
3450
|
function validateFunction(value, name) {
|
|
3191
3451
|
if (typeof value !== "function") {
|
|
@@ -3217,7 +3477,7 @@ function transfer(targetAgent, description, condition) {
|
|
|
3217
3477
|
// src/environment-settings.ts
|
|
3218
3478
|
function createEnvironmentSettings(environments) {
|
|
3219
3479
|
return {
|
|
3220
|
-
getEnvironmentSetting:
|
|
3480
|
+
getEnvironmentSetting: (key) => {
|
|
3221
3481
|
const currentEnv = process.env.INKEEP_ENV || "development";
|
|
3222
3482
|
const env = environments[currentEnv];
|
|
3223
3483
|
if (!env) {
|
|
@@ -3435,4 +3695,4 @@ var run = Runner.run.bind(Runner);
|
|
|
3435
3695
|
var stream = Runner.stream.bind(Runner);
|
|
3436
3696
|
var raceGraphs = Runner.raceGraphs.bind(Runner);
|
|
3437
3697
|
|
|
3438
|
-
export { Agent, ArtifactComponent, DataComponent, ExternalAgent, Project, Runner, Tool, agent, agentGraph, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, getFullProjectViaAPI, mcpServer, mcpTool, project, raceGraphs, registerEnvironmentSettings, run, stream, transfer, updateFullProjectViaAPI };
|
|
3698
|
+
export { Agent, ArtifactComponent, DataComponent, ExternalAgent, Project, Runner, Tool, agent, agentGraph, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, getFullProjectViaAPI, isCredentialReference, mcpServer, mcpTool, project, raceGraphs, registerEnvironmentSettings, run, stream, transfer, updateFullProjectViaAPI };
|