@inkeep/agents-sdk 0.2.2 → 0.5.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 +127 -70
- package/dist/index.d.cts +7 -23
- package/dist/index.d.ts +7 -23
- package/dist/index.js +127 -70
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -83,7 +83,7 @@ var ArtifactComponent = class {
|
|
|
83
83
|
};
|
|
84
84
|
logger.info({ artifactComponentData }, "artifactComponentData for create/update");
|
|
85
85
|
const updateResponse = await fetch(
|
|
86
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
86
|
+
`${this.baseURL}/tenants/${this.tenantId}/artifact-components/${this.getId()}`,
|
|
87
87
|
{
|
|
88
88
|
method: "PUT",
|
|
89
89
|
headers: {
|
|
@@ -116,7 +116,7 @@ var ArtifactComponent = class {
|
|
|
116
116
|
"ArtifactComponent not found, creating new artifact component"
|
|
117
117
|
);
|
|
118
118
|
const createResponse = await fetch(
|
|
119
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
119
|
+
`${this.baseURL}/tenants/${this.tenantId}/artifact-components`,
|
|
120
120
|
{
|
|
121
121
|
method: "POST",
|
|
122
122
|
headers: {
|
|
@@ -218,7 +218,7 @@ var DataComponent = class {
|
|
|
218
218
|
};
|
|
219
219
|
logger2.info({ dataComponentData }, "dataComponentData for create/update");
|
|
220
220
|
const updateResponse = await fetch(
|
|
221
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
221
|
+
`${this.baseURL}/tenants/${this.tenantId}/data-components/${this.getId()}`,
|
|
222
222
|
{
|
|
223
223
|
method: "PUT",
|
|
224
224
|
headers: {
|
|
@@ -251,7 +251,7 @@ var DataComponent = class {
|
|
|
251
251
|
"DataComponent not found, creating new data component"
|
|
252
252
|
);
|
|
253
253
|
const createResponse = await fetch(
|
|
254
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
254
|
+
`${this.baseURL}/tenants/${this.tenantId}/data-components`,
|
|
255
255
|
{
|
|
256
256
|
method: "POST",
|
|
257
257
|
headers: {
|
|
@@ -368,7 +368,7 @@ var Tool = class {
|
|
|
368
368
|
};
|
|
369
369
|
logger3.info({ toolDataForCreate }, "toolDataForCreate");
|
|
370
370
|
const updateResponse = await fetch(
|
|
371
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
371
|
+
`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/tools/${this.getId()}`,
|
|
372
372
|
{
|
|
373
373
|
method: "PUT",
|
|
374
374
|
headers: {
|
|
@@ -395,7 +395,7 @@ var Tool = class {
|
|
|
395
395
|
"Tool not found, creating new tool"
|
|
396
396
|
);
|
|
397
397
|
const createResponse = await fetch(
|
|
398
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
398
|
+
`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/tools`,
|
|
399
399
|
{
|
|
400
400
|
method: "POST",
|
|
401
401
|
headers: {
|
|
@@ -573,7 +573,7 @@ var Agent = class {
|
|
|
573
573
|
stopWhen: this.config.stopWhen
|
|
574
574
|
};
|
|
575
575
|
const updateResponse = await fetch(
|
|
576
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
576
|
+
`${this.baseURL}/tenants/${this.tenantId}/agents/${this.getId()}`,
|
|
577
577
|
{
|
|
578
578
|
method: "PUT",
|
|
579
579
|
headers: {
|
|
@@ -598,7 +598,7 @@ var Agent = class {
|
|
|
598
598
|
},
|
|
599
599
|
"Agent not found, creating new agent"
|
|
600
600
|
);
|
|
601
|
-
const createResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/
|
|
601
|
+
const createResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/agents`, {
|
|
602
602
|
method: "POST",
|
|
603
603
|
headers: {
|
|
604
604
|
"Content-Type": "application/json"
|
|
@@ -881,7 +881,7 @@ var Agent = class {
|
|
|
881
881
|
}
|
|
882
882
|
async createAgentDataComponentRelation(dataComponentId) {
|
|
883
883
|
const relationResponse = await fetch(
|
|
884
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
884
|
+
`${this.baseURL}/tenants/${this.tenantId}/agent-data-components`,
|
|
885
885
|
{
|
|
886
886
|
method: "POST",
|
|
887
887
|
headers: {
|
|
@@ -910,7 +910,7 @@ var Agent = class {
|
|
|
910
910
|
}
|
|
911
911
|
async createAgentArtifactComponentRelation(artifactComponentId) {
|
|
912
912
|
const relationResponse = await fetch(
|
|
913
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
913
|
+
`${this.baseURL}/tenants/${this.tenantId}/agent-artifact-components`,
|
|
914
914
|
{
|
|
915
915
|
method: "POST",
|
|
916
916
|
headers: {
|
|
@@ -949,7 +949,7 @@ var Agent = class {
|
|
|
949
949
|
relationData.selectedTools = selectedTools;
|
|
950
950
|
}
|
|
951
951
|
const relationResponse = await fetch(
|
|
952
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
952
|
+
`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/agent-tool-relations`,
|
|
953
953
|
{
|
|
954
954
|
method: "POST",
|
|
955
955
|
headers: {
|
|
@@ -1026,7 +1026,7 @@ var ExternalAgent = class {
|
|
|
1026
1026
|
headers: this.config.headers || void 0
|
|
1027
1027
|
};
|
|
1028
1028
|
const updateResponse = await fetch(
|
|
1029
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
1029
|
+
`${this.baseURL}/tenants/${this.tenantId}/external-agents/${this.getId()}`,
|
|
1030
1030
|
{
|
|
1031
1031
|
method: "PUT",
|
|
1032
1032
|
headers: {
|
|
@@ -1052,7 +1052,7 @@ var ExternalAgent = class {
|
|
|
1052
1052
|
"External agent not found, creating new external agent"
|
|
1053
1053
|
);
|
|
1054
1054
|
const createResponse = await fetch(
|
|
1055
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
1055
|
+
`${this.baseURL}/tenants/${this.tenantId}/external-agents`,
|
|
1056
1056
|
{
|
|
1057
1057
|
method: "POST",
|
|
1058
1058
|
headers: {
|
|
@@ -1135,7 +1135,7 @@ async function updateFullGraphViaAPI(tenantId, projectId, apiUrl, graphId, graph
|
|
|
1135
1135
|
},
|
|
1136
1136
|
"Updating full graph via API"
|
|
1137
1137
|
);
|
|
1138
|
-
const url = `${apiUrl}/tenants/${tenantId}/
|
|
1138
|
+
const url = `${apiUrl}/tenants/${tenantId}/projects/${projectId}/graph/${graphId}`;
|
|
1139
1139
|
const response = await fetch(url, {
|
|
1140
1140
|
method: "PUT",
|
|
1141
1141
|
headers: {
|
|
@@ -1429,7 +1429,6 @@ var AgentGraph = class {
|
|
|
1429
1429
|
}
|
|
1430
1430
|
}
|
|
1431
1431
|
}
|
|
1432
|
-
const dataComponentsObject = {};
|
|
1433
1432
|
for (const agent2 of this.agents) {
|
|
1434
1433
|
if (!this.isInternalAgent(agent2)) {
|
|
1435
1434
|
continue;
|
|
@@ -1438,19 +1437,10 @@ var AgentGraph = class {
|
|
|
1438
1437
|
const agentDataComponents = internalAgent.getDataComponents();
|
|
1439
1438
|
if (agentDataComponents) {
|
|
1440
1439
|
for (const dataComponent2 of agentDataComponents) {
|
|
1441
|
-
|
|
1442
|
-
if (!dataComponentsObject[dataComponentId]) {
|
|
1443
|
-
dataComponentsObject[dataComponentId] = {
|
|
1444
|
-
id: dataComponentId,
|
|
1445
|
-
name: dataComponent2.name,
|
|
1446
|
-
description: dataComponent2.description || "",
|
|
1447
|
-
props: dataComponent2.props || {}
|
|
1448
|
-
};
|
|
1449
|
-
}
|
|
1440
|
+
dataComponent2.id || dataComponent2.name.toLowerCase().replace(/\s+/g, "-");
|
|
1450
1441
|
}
|
|
1451
1442
|
}
|
|
1452
1443
|
}
|
|
1453
|
-
const artifactComponentsObject = {};
|
|
1454
1444
|
for (const agent2 of this.agents) {
|
|
1455
1445
|
if (!this.isInternalAgent(agent2)) {
|
|
1456
1446
|
continue;
|
|
@@ -1459,16 +1449,7 @@ var AgentGraph = class {
|
|
|
1459
1449
|
const agentArtifactComponents = internalAgent.getArtifactComponents();
|
|
1460
1450
|
if (agentArtifactComponents) {
|
|
1461
1451
|
for (const artifactComponent2 of agentArtifactComponents) {
|
|
1462
|
-
|
|
1463
|
-
if (!artifactComponentsObject[artifactComponentId]) {
|
|
1464
|
-
artifactComponentsObject[artifactComponentId] = {
|
|
1465
|
-
id: artifactComponentId,
|
|
1466
|
-
name: artifactComponent2.name,
|
|
1467
|
-
description: artifactComponent2.description || "",
|
|
1468
|
-
summaryProps: artifactComponent2.summaryProps || {},
|
|
1469
|
-
fullProps: artifactComponent2.fullProps || {}
|
|
1470
|
-
};
|
|
1471
|
-
}
|
|
1452
|
+
artifactComponent2.id || artifactComponent2.name.toLowerCase().replace(/\s+/g, "-");
|
|
1472
1453
|
}
|
|
1473
1454
|
}
|
|
1474
1455
|
}
|
|
@@ -1478,25 +1459,10 @@ var AgentGraph = class {
|
|
|
1478
1459
|
description: this.graphDescription,
|
|
1479
1460
|
defaultAgentId: this.defaultAgent?.getId() || "",
|
|
1480
1461
|
agents: agentsObject,
|
|
1481
|
-
tools: toolsObject,
|
|
1482
1462
|
contextConfig: this.contextConfig?.toObject(),
|
|
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
|
-
),
|
|
1495
1463
|
models: this.models,
|
|
1496
1464
|
statusUpdates: this.statusUpdateSettings,
|
|
1497
1465
|
graphPrompt: this.graphPrompt,
|
|
1498
|
-
dataComponents: Object.keys(dataComponentsObject).length > 0 ? dataComponentsObject : void 0,
|
|
1499
|
-
artifactComponents: Object.keys(artifactComponentsObject).length > 0 ? artifactComponentsObject : void 0,
|
|
1500
1466
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1501
1467
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1502
1468
|
};
|
|
@@ -2187,7 +2153,7 @@ var AgentGraph = class {
|
|
|
2187
2153
|
}
|
|
2188
2154
|
async saveToDatabase() {
|
|
2189
2155
|
try {
|
|
2190
|
-
const getUrl = `${this.baseURL}/tenants/${this.tenantId}/
|
|
2156
|
+
const getUrl = `${this.baseURL}/tenants/${this.tenantId}/agent-graphs/${this.graphId}`;
|
|
2191
2157
|
try {
|
|
2192
2158
|
const getResponse = await fetch(getUrl, {
|
|
2193
2159
|
method: "GET",
|
|
@@ -2208,7 +2174,7 @@ var AgentGraph = class {
|
|
|
2208
2174
|
}
|
|
2209
2175
|
}
|
|
2210
2176
|
logger7.info({ graphId: this.graphId }, "Creating graph in backend");
|
|
2211
|
-
const createUrl = `${this.baseURL}/tenants/${this.tenantId}/
|
|
2177
|
+
const createUrl = `${this.baseURL}/tenants/${this.tenantId}/agent-graphs`;
|
|
2212
2178
|
const createResponse = await fetch(createUrl, {
|
|
2213
2179
|
method: "POST",
|
|
2214
2180
|
headers: {
|
|
@@ -2237,7 +2203,7 @@ var AgentGraph = class {
|
|
|
2237
2203
|
async saveRelations() {
|
|
2238
2204
|
if (this.defaultAgent) {
|
|
2239
2205
|
try {
|
|
2240
|
-
const updateUrl = `${this.baseURL}/tenants/${this.tenantId}/
|
|
2206
|
+
const updateUrl = `${this.baseURL}/tenants/${this.tenantId}/agent-graphs/${this.graphId}`;
|
|
2241
2207
|
const updateResponse = await fetch(updateUrl, {
|
|
2242
2208
|
method: "PUT",
|
|
2243
2209
|
headers: {
|
|
@@ -2326,7 +2292,7 @@ var AgentGraph = class {
|
|
|
2326
2292
|
async createInternalAgentRelation(sourceAgent, targetAgent, relationType) {
|
|
2327
2293
|
try {
|
|
2328
2294
|
const response = await fetch(
|
|
2329
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
2295
|
+
`${this.baseURL}/tenants/${this.tenantId}/agent-relations`,
|
|
2330
2296
|
{
|
|
2331
2297
|
method: "POST",
|
|
2332
2298
|
headers: {
|
|
@@ -2379,11 +2345,10 @@ var AgentGraph = class {
|
|
|
2379
2345
|
throw error;
|
|
2380
2346
|
}
|
|
2381
2347
|
}
|
|
2382
|
-
// enableComponentMode removed – feature deprecated
|
|
2383
2348
|
async createExternalAgentRelation(sourceAgent, externalAgent2, relationType) {
|
|
2384
2349
|
try {
|
|
2385
2350
|
const response = await fetch(
|
|
2386
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
2351
|
+
`${this.baseURL}/tenants/${this.tenantId}/agent-relations`,
|
|
2387
2352
|
{
|
|
2388
2353
|
method: "POST",
|
|
2389
2354
|
headers: {
|
|
@@ -3015,9 +2980,112 @@ var Project = class {
|
|
|
3015
2980
|
*/
|
|
3016
2981
|
async toFullProjectDefinition() {
|
|
3017
2982
|
const graphsObject = {};
|
|
2983
|
+
const toolsObject = {};
|
|
2984
|
+
const dataComponentsObject = {};
|
|
2985
|
+
const artifactComponentsObject = {};
|
|
3018
2986
|
for (const graph of this.graphs) {
|
|
3019
2987
|
const graphDefinition = await graph.toFullGraphDefinition();
|
|
3020
2988
|
graphsObject[graph.getId()] = graphDefinition;
|
|
2989
|
+
for (const agent2 of graph.agents) {
|
|
2990
|
+
if (!agent2.getTools) {
|
|
2991
|
+
continue;
|
|
2992
|
+
}
|
|
2993
|
+
const agentTools = agent2.getTools();
|
|
2994
|
+
for (const [toolName, toolInstance] of Object.entries(agentTools)) {
|
|
2995
|
+
if (toolInstance && typeof toolInstance === "object") {
|
|
2996
|
+
let actualTool;
|
|
2997
|
+
let toolId;
|
|
2998
|
+
if ("server" in toolInstance && "selectedTools" in toolInstance) {
|
|
2999
|
+
const mcpConfig = toolInstance;
|
|
3000
|
+
actualTool = mcpConfig.server;
|
|
3001
|
+
toolId = actualTool.getId();
|
|
3002
|
+
} else {
|
|
3003
|
+
actualTool = toolInstance;
|
|
3004
|
+
toolId = actualTool.getId?.() || actualTool.id || toolName;
|
|
3005
|
+
}
|
|
3006
|
+
if (!toolsObject[toolId]) {
|
|
3007
|
+
let toolConfig;
|
|
3008
|
+
if (actualTool.config?.serverUrl) {
|
|
3009
|
+
toolConfig = {
|
|
3010
|
+
type: "mcp",
|
|
3011
|
+
mcp: {
|
|
3012
|
+
server: {
|
|
3013
|
+
url: actualTool.config.serverUrl
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
};
|
|
3017
|
+
} else if (actualTool.config?.type === "mcp") {
|
|
3018
|
+
toolConfig = actualTool.config;
|
|
3019
|
+
} else {
|
|
3020
|
+
toolConfig = {
|
|
3021
|
+
type: "function",
|
|
3022
|
+
parameters: actualTool.parameters || {}
|
|
3023
|
+
};
|
|
3024
|
+
}
|
|
3025
|
+
const toolData = {
|
|
3026
|
+
id: toolId,
|
|
3027
|
+
name: actualTool.config?.name || actualTool.name || toolName,
|
|
3028
|
+
config: toolConfig,
|
|
3029
|
+
status: actualTool.getStatus?.() || actualTool.status || "unknown"
|
|
3030
|
+
};
|
|
3031
|
+
if (actualTool.config?.imageUrl) {
|
|
3032
|
+
toolData.imageUrl = actualTool.config.imageUrl;
|
|
3033
|
+
}
|
|
3034
|
+
if (actualTool.config?.headers) {
|
|
3035
|
+
toolData.headers = actualTool.config.headers;
|
|
3036
|
+
}
|
|
3037
|
+
if (actualTool.capabilities) {
|
|
3038
|
+
toolData.capabilities = actualTool.capabilities;
|
|
3039
|
+
}
|
|
3040
|
+
if (actualTool.lastHealthCheck) {
|
|
3041
|
+
toolData.lastHealthCheck = actualTool.lastHealthCheck;
|
|
3042
|
+
}
|
|
3043
|
+
if (actualTool.availableTools) {
|
|
3044
|
+
toolData.availableTools = actualTool.availableTools;
|
|
3045
|
+
}
|
|
3046
|
+
if (actualTool.lastError) {
|
|
3047
|
+
toolData.lastError = actualTool.lastError;
|
|
3048
|
+
}
|
|
3049
|
+
if (actualTool.lastToolsSync) {
|
|
3050
|
+
toolData.lastToolsSync = actualTool.lastToolsSync;
|
|
3051
|
+
}
|
|
3052
|
+
if (actualTool.getCredentialReferenceId?.()) {
|
|
3053
|
+
toolData.credentialReferenceId = actualTool.getCredentialReferenceId();
|
|
3054
|
+
}
|
|
3055
|
+
toolsObject[toolId] = toolData;
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
const agentDataComponents = agent2.getDataComponents?.();
|
|
3060
|
+
if (agentDataComponents) {
|
|
3061
|
+
for (const dataComponent2 of agentDataComponents) {
|
|
3062
|
+
const dataComponentId = dataComponent2.id || dataComponent2.name.toLowerCase().replace(/\s+/g, "-");
|
|
3063
|
+
if (!dataComponentsObject[dataComponentId]) {
|
|
3064
|
+
dataComponentsObject[dataComponentId] = {
|
|
3065
|
+
id: dataComponentId,
|
|
3066
|
+
name: dataComponent2.name,
|
|
3067
|
+
description: dataComponent2.description || "",
|
|
3068
|
+
props: dataComponent2.props || {}
|
|
3069
|
+
};
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
const agentArtifactComponents = agent2.getArtifactComponents?.();
|
|
3074
|
+
if (agentArtifactComponents) {
|
|
3075
|
+
for (const artifactComponent2 of agentArtifactComponents) {
|
|
3076
|
+
const artifactComponentId = artifactComponent2.id || artifactComponent2.name.toLowerCase().replace(/\s+/g, "-");
|
|
3077
|
+
if (!artifactComponentsObject[artifactComponentId]) {
|
|
3078
|
+
artifactComponentsObject[artifactComponentId] = {
|
|
3079
|
+
id: artifactComponentId,
|
|
3080
|
+
name: artifactComponent2.name,
|
|
3081
|
+
description: artifactComponent2.description || "",
|
|
3082
|
+
summaryProps: artifactComponent2.summaryProps || {},
|
|
3083
|
+
fullProps: artifactComponent2.fullProps || {}
|
|
3084
|
+
};
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3021
3089
|
}
|
|
3022
3090
|
return {
|
|
3023
3091
|
id: this.projectId,
|
|
@@ -3026,26 +3094,15 @@ var Project = class {
|
|
|
3026
3094
|
models: this.models,
|
|
3027
3095
|
stopWhen: this.stopWhen,
|
|
3028
3096
|
graphs: graphsObject,
|
|
3029
|
-
tools:
|
|
3030
|
-
|
|
3097
|
+
tools: toolsObject,
|
|
3098
|
+
dataComponents: Object.keys(dataComponentsObject).length > 0 ? dataComponentsObject : void 0,
|
|
3099
|
+
artifactComponents: Object.keys(artifactComponentsObject).length > 0 ? artifactComponentsObject : void 0,
|
|
3031
3100
|
credentialReferences: void 0,
|
|
3032
3101
|
// Projects don't directly hold credentials yet
|
|
3033
3102
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3034
3103
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3035
3104
|
};
|
|
3036
3105
|
}
|
|
3037
|
-
/**
|
|
3038
|
-
* Convert project configuration to API format
|
|
3039
|
-
*/
|
|
3040
|
-
toApiFormat() {
|
|
3041
|
-
return {
|
|
3042
|
-
id: this.projectId,
|
|
3043
|
-
name: this.projectName,
|
|
3044
|
-
description: this.projectDescription || "",
|
|
3045
|
-
models: this.models,
|
|
3046
|
-
stopWhen: this.stopWhen
|
|
3047
|
-
};
|
|
3048
|
-
}
|
|
3049
3106
|
};
|
|
3050
3107
|
|
|
3051
3108
|
// src/utils/generateIdFromName.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MCPToolConfig as MCPToolConfig$1, CredentialReferenceApiInsert, MCPTransportType, CredentialReferenceSelect, AgentApiInsert, AgentStopWhen, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, GraphStopWhen, ToolInsert, McpTransportConfig, ArtifactComponentInsert, DataComponentInsert, StopWhen, FullProjectDefinition } from '@inkeep/agents-core';
|
|
1
|
+
import { MCPToolConfig as MCPToolConfig$1, CredentialReferenceApiInsert, MCPTransportType, CredentialReferenceSelect, AgentApiInsert, AgentStopWhen, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, GraphStopWhen, StatusUpdateSettings, ToolInsert, McpTransportConfig, ArtifactComponentInsert, DataComponentInsert, StopWhen, FullProjectDefinition } from '@inkeep/agents-core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
interface ToolInterface {
|
|
@@ -311,23 +311,6 @@ interface RunResult {
|
|
|
311
311
|
transfers: TransferConfig[];
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
|
-
interface StatusComponent {
|
|
315
|
-
type: string;
|
|
316
|
-
description?: string;
|
|
317
|
-
schema?: {
|
|
318
|
-
type: 'object';
|
|
319
|
-
properties: Record<string, any>;
|
|
320
|
-
required?: string[];
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
interface StatusUpdateSettings {
|
|
324
|
-
enabled?: boolean;
|
|
325
|
-
numEvents?: number;
|
|
326
|
-
timeInSeconds?: number;
|
|
327
|
-
model?: string;
|
|
328
|
-
statusComponents?: StatusComponent[];
|
|
329
|
-
prompt?: string;
|
|
330
|
-
}
|
|
331
314
|
interface GraphConfig {
|
|
332
315
|
id: string;
|
|
333
316
|
name?: string;
|
|
@@ -721,6 +704,9 @@ interface ProjectConfig {
|
|
|
721
704
|
};
|
|
722
705
|
stopWhen?: StopWhen;
|
|
723
706
|
graphs?: () => AgentGraph[];
|
|
707
|
+
tools?: () => ToolConfig[];
|
|
708
|
+
dataComponents?: () => DataComponentConfig[];
|
|
709
|
+
artifactComponents?: () => ArtifactComponentConfig[];
|
|
724
710
|
}
|
|
725
711
|
/**
|
|
726
712
|
* Project interface for operations
|
|
@@ -869,10 +855,6 @@ declare class Project implements ProjectInterface {
|
|
|
869
855
|
* Convert the Project to FullProjectDefinition format
|
|
870
856
|
*/
|
|
871
857
|
private toFullProjectDefinition;
|
|
872
|
-
/**
|
|
873
|
-
* Convert project configuration to API format
|
|
874
|
-
*/
|
|
875
|
-
private toApiFormat;
|
|
876
858
|
}
|
|
877
859
|
|
|
878
860
|
/**
|
|
@@ -955,6 +937,8 @@ declare function credential(config: CredentialReferenceApiInsert): {
|
|
|
955
937
|
id: string;
|
|
956
938
|
credentialStoreId: string;
|
|
957
939
|
type: "nango" | "memory" | "keychain";
|
|
940
|
+
createdAt?: string | undefined;
|
|
941
|
+
updatedAt?: string | undefined;
|
|
958
942
|
retrievalParams?: Record<string, unknown> | null | undefined;
|
|
959
943
|
};
|
|
960
944
|
/**
|
|
@@ -1138,4 +1122,4 @@ declare const run: typeof Runner.run;
|
|
|
1138
1122
|
declare const stream: typeof Runner.stream;
|
|
1139
1123
|
declare const raceGraphs: typeof Runner.raceGraphs;
|
|
1140
1124
|
|
|
1141
|
-
export { Agent, type AgentCanUseType, type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AllAgentInterface, ArtifactComponent, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, DataComponent, ExternalAgent, type ExternalAgentInterface, type FetchDefinitionConfig, type GenerateOptions, type GraphConfig, type GraphInterface, type MCPToolConfig, MaxTurnsExceededError, type Message, type MessageInput, type ModelSettings, ModelSettingsSchema, Project, type RequestSchemaConfig, type RequestSchemaDefinition, type RunResult, Runner, type ServerConfig, type
|
|
1125
|
+
export { Agent, type AgentCanUseType, type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AllAgentInterface, ArtifactComponent, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, DataComponent, ExternalAgent, type ExternalAgentInterface, type FetchDefinitionConfig, type GenerateOptions, type GraphConfig, type GraphInterface, type MCPToolConfig, MaxTurnsExceededError, type Message, type MessageInput, type ModelSettings, ModelSettingsSchema, Project, type RequestSchemaConfig, type RequestSchemaDefinition, type RunResult, Runner, type ServerConfig, type StreamEvent, type StreamResponse, type SystemMessage, Tool, type ToolCall, type ToolConfig, ToolExecutionError, type ToolMessage, type ToolResult, type TransferConfig, TransferError, type UserMessage, agent, agentGraph, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, getFullProjectViaAPI, mcpServer, mcpTool, project, raceGraphs, registerEnvironmentSettings, run, stream, transfer, updateFullProjectViaAPI };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MCPToolConfig as MCPToolConfig$1, CredentialReferenceApiInsert, MCPTransportType, CredentialReferenceSelect, AgentApiInsert, AgentStopWhen, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, GraphStopWhen, ToolInsert, McpTransportConfig, ArtifactComponentInsert, DataComponentInsert, StopWhen, FullProjectDefinition } from '@inkeep/agents-core';
|
|
1
|
+
import { MCPToolConfig as MCPToolConfig$1, CredentialReferenceApiInsert, MCPTransportType, CredentialReferenceSelect, AgentApiInsert, AgentStopWhen, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, GraphStopWhen, StatusUpdateSettings, ToolInsert, McpTransportConfig, ArtifactComponentInsert, DataComponentInsert, StopWhen, FullProjectDefinition } from '@inkeep/agents-core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
interface ToolInterface {
|
|
@@ -311,23 +311,6 @@ interface RunResult {
|
|
|
311
311
|
transfers: TransferConfig[];
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
|
-
interface StatusComponent {
|
|
315
|
-
type: string;
|
|
316
|
-
description?: string;
|
|
317
|
-
schema?: {
|
|
318
|
-
type: 'object';
|
|
319
|
-
properties: Record<string, any>;
|
|
320
|
-
required?: string[];
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
interface StatusUpdateSettings {
|
|
324
|
-
enabled?: boolean;
|
|
325
|
-
numEvents?: number;
|
|
326
|
-
timeInSeconds?: number;
|
|
327
|
-
model?: string;
|
|
328
|
-
statusComponents?: StatusComponent[];
|
|
329
|
-
prompt?: string;
|
|
330
|
-
}
|
|
331
314
|
interface GraphConfig {
|
|
332
315
|
id: string;
|
|
333
316
|
name?: string;
|
|
@@ -721,6 +704,9 @@ interface ProjectConfig {
|
|
|
721
704
|
};
|
|
722
705
|
stopWhen?: StopWhen;
|
|
723
706
|
graphs?: () => AgentGraph[];
|
|
707
|
+
tools?: () => ToolConfig[];
|
|
708
|
+
dataComponents?: () => DataComponentConfig[];
|
|
709
|
+
artifactComponents?: () => ArtifactComponentConfig[];
|
|
724
710
|
}
|
|
725
711
|
/**
|
|
726
712
|
* Project interface for operations
|
|
@@ -869,10 +855,6 @@ declare class Project implements ProjectInterface {
|
|
|
869
855
|
* Convert the Project to FullProjectDefinition format
|
|
870
856
|
*/
|
|
871
857
|
private toFullProjectDefinition;
|
|
872
|
-
/**
|
|
873
|
-
* Convert project configuration to API format
|
|
874
|
-
*/
|
|
875
|
-
private toApiFormat;
|
|
876
858
|
}
|
|
877
859
|
|
|
878
860
|
/**
|
|
@@ -955,6 +937,8 @@ declare function credential(config: CredentialReferenceApiInsert): {
|
|
|
955
937
|
id: string;
|
|
956
938
|
credentialStoreId: string;
|
|
957
939
|
type: "nango" | "memory" | "keychain";
|
|
940
|
+
createdAt?: string | undefined;
|
|
941
|
+
updatedAt?: string | undefined;
|
|
958
942
|
retrievalParams?: Record<string, unknown> | null | undefined;
|
|
959
943
|
};
|
|
960
944
|
/**
|
|
@@ -1138,4 +1122,4 @@ declare const run: typeof Runner.run;
|
|
|
1138
1122
|
declare const stream: typeof Runner.stream;
|
|
1139
1123
|
declare const raceGraphs: typeof Runner.raceGraphs;
|
|
1140
1124
|
|
|
1141
|
-
export { Agent, type AgentCanUseType, type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AllAgentInterface, ArtifactComponent, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, DataComponent, ExternalAgent, type ExternalAgentInterface, type FetchDefinitionConfig, type GenerateOptions, type GraphConfig, type GraphInterface, type MCPToolConfig, MaxTurnsExceededError, type Message, type MessageInput, type ModelSettings, ModelSettingsSchema, Project, type RequestSchemaConfig, type RequestSchemaDefinition, type RunResult, Runner, type ServerConfig, type
|
|
1125
|
+
export { Agent, type AgentCanUseType, type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AllAgentInterface, ArtifactComponent, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, DataComponent, ExternalAgent, type ExternalAgentInterface, type FetchDefinitionConfig, type GenerateOptions, type GraphConfig, type GraphInterface, type MCPToolConfig, MaxTurnsExceededError, type Message, type MessageInput, type ModelSettings, ModelSettingsSchema, Project, type RequestSchemaConfig, type RequestSchemaDefinition, type RunResult, Runner, type ServerConfig, type StreamEvent, type StreamResponse, type SystemMessage, Tool, type ToolCall, type ToolConfig, ToolExecutionError, type ToolMessage, type ToolResult, type TransferConfig, TransferError, type UserMessage, agent, agentGraph, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, getFullProjectViaAPI, mcpServer, mcpTool, project, raceGraphs, registerEnvironmentSettings, run, stream, transfer, updateFullProjectViaAPI };
|
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ var ArtifactComponent = class {
|
|
|
81
81
|
};
|
|
82
82
|
logger.info({ artifactComponentData }, "artifactComponentData for create/update");
|
|
83
83
|
const updateResponse = await fetch(
|
|
84
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
84
|
+
`${this.baseURL}/tenants/${this.tenantId}/artifact-components/${this.getId()}`,
|
|
85
85
|
{
|
|
86
86
|
method: "PUT",
|
|
87
87
|
headers: {
|
|
@@ -114,7 +114,7 @@ var ArtifactComponent = class {
|
|
|
114
114
|
"ArtifactComponent not found, creating new artifact component"
|
|
115
115
|
);
|
|
116
116
|
const createResponse = await fetch(
|
|
117
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
117
|
+
`${this.baseURL}/tenants/${this.tenantId}/artifact-components`,
|
|
118
118
|
{
|
|
119
119
|
method: "POST",
|
|
120
120
|
headers: {
|
|
@@ -216,7 +216,7 @@ var DataComponent = class {
|
|
|
216
216
|
};
|
|
217
217
|
logger2.info({ dataComponentData }, "dataComponentData for create/update");
|
|
218
218
|
const updateResponse = await fetch(
|
|
219
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
219
|
+
`${this.baseURL}/tenants/${this.tenantId}/data-components/${this.getId()}`,
|
|
220
220
|
{
|
|
221
221
|
method: "PUT",
|
|
222
222
|
headers: {
|
|
@@ -249,7 +249,7 @@ var DataComponent = class {
|
|
|
249
249
|
"DataComponent not found, creating new data component"
|
|
250
250
|
);
|
|
251
251
|
const createResponse = await fetch(
|
|
252
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
252
|
+
`${this.baseURL}/tenants/${this.tenantId}/data-components`,
|
|
253
253
|
{
|
|
254
254
|
method: "POST",
|
|
255
255
|
headers: {
|
|
@@ -366,7 +366,7 @@ var Tool = class {
|
|
|
366
366
|
};
|
|
367
367
|
logger3.info({ toolDataForCreate }, "toolDataForCreate");
|
|
368
368
|
const updateResponse = await fetch(
|
|
369
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
369
|
+
`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/tools/${this.getId()}`,
|
|
370
370
|
{
|
|
371
371
|
method: "PUT",
|
|
372
372
|
headers: {
|
|
@@ -393,7 +393,7 @@ var Tool = class {
|
|
|
393
393
|
"Tool not found, creating new tool"
|
|
394
394
|
);
|
|
395
395
|
const createResponse = await fetch(
|
|
396
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
396
|
+
`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/tools`,
|
|
397
397
|
{
|
|
398
398
|
method: "POST",
|
|
399
399
|
headers: {
|
|
@@ -571,7 +571,7 @@ var Agent = class {
|
|
|
571
571
|
stopWhen: this.config.stopWhen
|
|
572
572
|
};
|
|
573
573
|
const updateResponse = await fetch(
|
|
574
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
574
|
+
`${this.baseURL}/tenants/${this.tenantId}/agents/${this.getId()}`,
|
|
575
575
|
{
|
|
576
576
|
method: "PUT",
|
|
577
577
|
headers: {
|
|
@@ -596,7 +596,7 @@ var Agent = class {
|
|
|
596
596
|
},
|
|
597
597
|
"Agent not found, creating new agent"
|
|
598
598
|
);
|
|
599
|
-
const createResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/
|
|
599
|
+
const createResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/agents`, {
|
|
600
600
|
method: "POST",
|
|
601
601
|
headers: {
|
|
602
602
|
"Content-Type": "application/json"
|
|
@@ -879,7 +879,7 @@ var Agent = class {
|
|
|
879
879
|
}
|
|
880
880
|
async createAgentDataComponentRelation(dataComponentId) {
|
|
881
881
|
const relationResponse = await fetch(
|
|
882
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
882
|
+
`${this.baseURL}/tenants/${this.tenantId}/agent-data-components`,
|
|
883
883
|
{
|
|
884
884
|
method: "POST",
|
|
885
885
|
headers: {
|
|
@@ -908,7 +908,7 @@ var Agent = class {
|
|
|
908
908
|
}
|
|
909
909
|
async createAgentArtifactComponentRelation(artifactComponentId) {
|
|
910
910
|
const relationResponse = await fetch(
|
|
911
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
911
|
+
`${this.baseURL}/tenants/${this.tenantId}/agent-artifact-components`,
|
|
912
912
|
{
|
|
913
913
|
method: "POST",
|
|
914
914
|
headers: {
|
|
@@ -947,7 +947,7 @@ var Agent = class {
|
|
|
947
947
|
relationData.selectedTools = selectedTools;
|
|
948
948
|
}
|
|
949
949
|
const relationResponse = await fetch(
|
|
950
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
950
|
+
`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/agent-tool-relations`,
|
|
951
951
|
{
|
|
952
952
|
method: "POST",
|
|
953
953
|
headers: {
|
|
@@ -1024,7 +1024,7 @@ var ExternalAgent = class {
|
|
|
1024
1024
|
headers: this.config.headers || void 0
|
|
1025
1025
|
};
|
|
1026
1026
|
const updateResponse = await fetch(
|
|
1027
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
1027
|
+
`${this.baseURL}/tenants/${this.tenantId}/external-agents/${this.getId()}`,
|
|
1028
1028
|
{
|
|
1029
1029
|
method: "PUT",
|
|
1030
1030
|
headers: {
|
|
@@ -1050,7 +1050,7 @@ var ExternalAgent = class {
|
|
|
1050
1050
|
"External agent not found, creating new external agent"
|
|
1051
1051
|
);
|
|
1052
1052
|
const createResponse = await fetch(
|
|
1053
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
1053
|
+
`${this.baseURL}/tenants/${this.tenantId}/external-agents`,
|
|
1054
1054
|
{
|
|
1055
1055
|
method: "POST",
|
|
1056
1056
|
headers: {
|
|
@@ -1133,7 +1133,7 @@ async function updateFullGraphViaAPI(tenantId, projectId, apiUrl, graphId, graph
|
|
|
1133
1133
|
},
|
|
1134
1134
|
"Updating full graph via API"
|
|
1135
1135
|
);
|
|
1136
|
-
const url = `${apiUrl}/tenants/${tenantId}/
|
|
1136
|
+
const url = `${apiUrl}/tenants/${tenantId}/projects/${projectId}/graph/${graphId}`;
|
|
1137
1137
|
const response = await fetch(url, {
|
|
1138
1138
|
method: "PUT",
|
|
1139
1139
|
headers: {
|
|
@@ -1427,7 +1427,6 @@ var AgentGraph = class {
|
|
|
1427
1427
|
}
|
|
1428
1428
|
}
|
|
1429
1429
|
}
|
|
1430
|
-
const dataComponentsObject = {};
|
|
1431
1430
|
for (const agent2 of this.agents) {
|
|
1432
1431
|
if (!this.isInternalAgent(agent2)) {
|
|
1433
1432
|
continue;
|
|
@@ -1436,19 +1435,10 @@ var AgentGraph = class {
|
|
|
1436
1435
|
const agentDataComponents = internalAgent.getDataComponents();
|
|
1437
1436
|
if (agentDataComponents) {
|
|
1438
1437
|
for (const dataComponent2 of agentDataComponents) {
|
|
1439
|
-
|
|
1440
|
-
if (!dataComponentsObject[dataComponentId]) {
|
|
1441
|
-
dataComponentsObject[dataComponentId] = {
|
|
1442
|
-
id: dataComponentId,
|
|
1443
|
-
name: dataComponent2.name,
|
|
1444
|
-
description: dataComponent2.description || "",
|
|
1445
|
-
props: dataComponent2.props || {}
|
|
1446
|
-
};
|
|
1447
|
-
}
|
|
1438
|
+
dataComponent2.id || dataComponent2.name.toLowerCase().replace(/\s+/g, "-");
|
|
1448
1439
|
}
|
|
1449
1440
|
}
|
|
1450
1441
|
}
|
|
1451
|
-
const artifactComponentsObject = {};
|
|
1452
1442
|
for (const agent2 of this.agents) {
|
|
1453
1443
|
if (!this.isInternalAgent(agent2)) {
|
|
1454
1444
|
continue;
|
|
@@ -1457,16 +1447,7 @@ var AgentGraph = class {
|
|
|
1457
1447
|
const agentArtifactComponents = internalAgent.getArtifactComponents();
|
|
1458
1448
|
if (agentArtifactComponents) {
|
|
1459
1449
|
for (const artifactComponent2 of agentArtifactComponents) {
|
|
1460
|
-
|
|
1461
|
-
if (!artifactComponentsObject[artifactComponentId]) {
|
|
1462
|
-
artifactComponentsObject[artifactComponentId] = {
|
|
1463
|
-
id: artifactComponentId,
|
|
1464
|
-
name: artifactComponent2.name,
|
|
1465
|
-
description: artifactComponent2.description || "",
|
|
1466
|
-
summaryProps: artifactComponent2.summaryProps || {},
|
|
1467
|
-
fullProps: artifactComponent2.fullProps || {}
|
|
1468
|
-
};
|
|
1469
|
-
}
|
|
1450
|
+
artifactComponent2.id || artifactComponent2.name.toLowerCase().replace(/\s+/g, "-");
|
|
1470
1451
|
}
|
|
1471
1452
|
}
|
|
1472
1453
|
}
|
|
@@ -1476,25 +1457,10 @@ var AgentGraph = class {
|
|
|
1476
1457
|
description: this.graphDescription,
|
|
1477
1458
|
defaultAgentId: this.defaultAgent?.getId() || "",
|
|
1478
1459
|
agents: agentsObject,
|
|
1479
|
-
tools: toolsObject,
|
|
1480
1460
|
contextConfig: this.contextConfig?.toObject(),
|
|
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
|
-
),
|
|
1493
1461
|
models: this.models,
|
|
1494
1462
|
statusUpdates: this.statusUpdateSettings,
|
|
1495
1463
|
graphPrompt: this.graphPrompt,
|
|
1496
|
-
dataComponents: Object.keys(dataComponentsObject).length > 0 ? dataComponentsObject : void 0,
|
|
1497
|
-
artifactComponents: Object.keys(artifactComponentsObject).length > 0 ? artifactComponentsObject : void 0,
|
|
1498
1464
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1499
1465
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1500
1466
|
};
|
|
@@ -2185,7 +2151,7 @@ var AgentGraph = class {
|
|
|
2185
2151
|
}
|
|
2186
2152
|
async saveToDatabase() {
|
|
2187
2153
|
try {
|
|
2188
|
-
const getUrl = `${this.baseURL}/tenants/${this.tenantId}/
|
|
2154
|
+
const getUrl = `${this.baseURL}/tenants/${this.tenantId}/agent-graphs/${this.graphId}`;
|
|
2189
2155
|
try {
|
|
2190
2156
|
const getResponse = await fetch(getUrl, {
|
|
2191
2157
|
method: "GET",
|
|
@@ -2206,7 +2172,7 @@ var AgentGraph = class {
|
|
|
2206
2172
|
}
|
|
2207
2173
|
}
|
|
2208
2174
|
logger7.info({ graphId: this.graphId }, "Creating graph in backend");
|
|
2209
|
-
const createUrl = `${this.baseURL}/tenants/${this.tenantId}/
|
|
2175
|
+
const createUrl = `${this.baseURL}/tenants/${this.tenantId}/agent-graphs`;
|
|
2210
2176
|
const createResponse = await fetch(createUrl, {
|
|
2211
2177
|
method: "POST",
|
|
2212
2178
|
headers: {
|
|
@@ -2235,7 +2201,7 @@ var AgentGraph = class {
|
|
|
2235
2201
|
async saveRelations() {
|
|
2236
2202
|
if (this.defaultAgent) {
|
|
2237
2203
|
try {
|
|
2238
|
-
const updateUrl = `${this.baseURL}/tenants/${this.tenantId}/
|
|
2204
|
+
const updateUrl = `${this.baseURL}/tenants/${this.tenantId}/agent-graphs/${this.graphId}`;
|
|
2239
2205
|
const updateResponse = await fetch(updateUrl, {
|
|
2240
2206
|
method: "PUT",
|
|
2241
2207
|
headers: {
|
|
@@ -2324,7 +2290,7 @@ var AgentGraph = class {
|
|
|
2324
2290
|
async createInternalAgentRelation(sourceAgent, targetAgent, relationType) {
|
|
2325
2291
|
try {
|
|
2326
2292
|
const response = await fetch(
|
|
2327
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
2293
|
+
`${this.baseURL}/tenants/${this.tenantId}/agent-relations`,
|
|
2328
2294
|
{
|
|
2329
2295
|
method: "POST",
|
|
2330
2296
|
headers: {
|
|
@@ -2377,11 +2343,10 @@ var AgentGraph = class {
|
|
|
2377
2343
|
throw error;
|
|
2378
2344
|
}
|
|
2379
2345
|
}
|
|
2380
|
-
// enableComponentMode removed – feature deprecated
|
|
2381
2346
|
async createExternalAgentRelation(sourceAgent, externalAgent2, relationType) {
|
|
2382
2347
|
try {
|
|
2383
2348
|
const response = await fetch(
|
|
2384
|
-
`${this.baseURL}/tenants/${this.tenantId}/
|
|
2349
|
+
`${this.baseURL}/tenants/${this.tenantId}/agent-relations`,
|
|
2385
2350
|
{
|
|
2386
2351
|
method: "POST",
|
|
2387
2352
|
headers: {
|
|
@@ -3013,9 +2978,112 @@ var Project = class {
|
|
|
3013
2978
|
*/
|
|
3014
2979
|
async toFullProjectDefinition() {
|
|
3015
2980
|
const graphsObject = {};
|
|
2981
|
+
const toolsObject = {};
|
|
2982
|
+
const dataComponentsObject = {};
|
|
2983
|
+
const artifactComponentsObject = {};
|
|
3016
2984
|
for (const graph of this.graphs) {
|
|
3017
2985
|
const graphDefinition = await graph.toFullGraphDefinition();
|
|
3018
2986
|
graphsObject[graph.getId()] = graphDefinition;
|
|
2987
|
+
for (const agent2 of graph.agents) {
|
|
2988
|
+
if (!agent2.getTools) {
|
|
2989
|
+
continue;
|
|
2990
|
+
}
|
|
2991
|
+
const agentTools = agent2.getTools();
|
|
2992
|
+
for (const [toolName, toolInstance] of Object.entries(agentTools)) {
|
|
2993
|
+
if (toolInstance && typeof toolInstance === "object") {
|
|
2994
|
+
let actualTool;
|
|
2995
|
+
let toolId;
|
|
2996
|
+
if ("server" in toolInstance && "selectedTools" in toolInstance) {
|
|
2997
|
+
const mcpConfig = toolInstance;
|
|
2998
|
+
actualTool = mcpConfig.server;
|
|
2999
|
+
toolId = actualTool.getId();
|
|
3000
|
+
} else {
|
|
3001
|
+
actualTool = toolInstance;
|
|
3002
|
+
toolId = actualTool.getId?.() || actualTool.id || toolName;
|
|
3003
|
+
}
|
|
3004
|
+
if (!toolsObject[toolId]) {
|
|
3005
|
+
let toolConfig;
|
|
3006
|
+
if (actualTool.config?.serverUrl) {
|
|
3007
|
+
toolConfig = {
|
|
3008
|
+
type: "mcp",
|
|
3009
|
+
mcp: {
|
|
3010
|
+
server: {
|
|
3011
|
+
url: actualTool.config.serverUrl
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
3014
|
+
};
|
|
3015
|
+
} else if (actualTool.config?.type === "mcp") {
|
|
3016
|
+
toolConfig = actualTool.config;
|
|
3017
|
+
} else {
|
|
3018
|
+
toolConfig = {
|
|
3019
|
+
type: "function",
|
|
3020
|
+
parameters: actualTool.parameters || {}
|
|
3021
|
+
};
|
|
3022
|
+
}
|
|
3023
|
+
const toolData = {
|
|
3024
|
+
id: toolId,
|
|
3025
|
+
name: actualTool.config?.name || actualTool.name || toolName,
|
|
3026
|
+
config: toolConfig,
|
|
3027
|
+
status: actualTool.getStatus?.() || actualTool.status || "unknown"
|
|
3028
|
+
};
|
|
3029
|
+
if (actualTool.config?.imageUrl) {
|
|
3030
|
+
toolData.imageUrl = actualTool.config.imageUrl;
|
|
3031
|
+
}
|
|
3032
|
+
if (actualTool.config?.headers) {
|
|
3033
|
+
toolData.headers = actualTool.config.headers;
|
|
3034
|
+
}
|
|
3035
|
+
if (actualTool.capabilities) {
|
|
3036
|
+
toolData.capabilities = actualTool.capabilities;
|
|
3037
|
+
}
|
|
3038
|
+
if (actualTool.lastHealthCheck) {
|
|
3039
|
+
toolData.lastHealthCheck = actualTool.lastHealthCheck;
|
|
3040
|
+
}
|
|
3041
|
+
if (actualTool.availableTools) {
|
|
3042
|
+
toolData.availableTools = actualTool.availableTools;
|
|
3043
|
+
}
|
|
3044
|
+
if (actualTool.lastError) {
|
|
3045
|
+
toolData.lastError = actualTool.lastError;
|
|
3046
|
+
}
|
|
3047
|
+
if (actualTool.lastToolsSync) {
|
|
3048
|
+
toolData.lastToolsSync = actualTool.lastToolsSync;
|
|
3049
|
+
}
|
|
3050
|
+
if (actualTool.getCredentialReferenceId?.()) {
|
|
3051
|
+
toolData.credentialReferenceId = actualTool.getCredentialReferenceId();
|
|
3052
|
+
}
|
|
3053
|
+
toolsObject[toolId] = toolData;
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
const agentDataComponents = agent2.getDataComponents?.();
|
|
3058
|
+
if (agentDataComponents) {
|
|
3059
|
+
for (const dataComponent2 of agentDataComponents) {
|
|
3060
|
+
const dataComponentId = dataComponent2.id || dataComponent2.name.toLowerCase().replace(/\s+/g, "-");
|
|
3061
|
+
if (!dataComponentsObject[dataComponentId]) {
|
|
3062
|
+
dataComponentsObject[dataComponentId] = {
|
|
3063
|
+
id: dataComponentId,
|
|
3064
|
+
name: dataComponent2.name,
|
|
3065
|
+
description: dataComponent2.description || "",
|
|
3066
|
+
props: dataComponent2.props || {}
|
|
3067
|
+
};
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
const agentArtifactComponents = agent2.getArtifactComponents?.();
|
|
3072
|
+
if (agentArtifactComponents) {
|
|
3073
|
+
for (const artifactComponent2 of agentArtifactComponents) {
|
|
3074
|
+
const artifactComponentId = artifactComponent2.id || artifactComponent2.name.toLowerCase().replace(/\s+/g, "-");
|
|
3075
|
+
if (!artifactComponentsObject[artifactComponentId]) {
|
|
3076
|
+
artifactComponentsObject[artifactComponentId] = {
|
|
3077
|
+
id: artifactComponentId,
|
|
3078
|
+
name: artifactComponent2.name,
|
|
3079
|
+
description: artifactComponent2.description || "",
|
|
3080
|
+
summaryProps: artifactComponent2.summaryProps || {},
|
|
3081
|
+
fullProps: artifactComponent2.fullProps || {}
|
|
3082
|
+
};
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3019
3087
|
}
|
|
3020
3088
|
return {
|
|
3021
3089
|
id: this.projectId,
|
|
@@ -3024,26 +3092,15 @@ var Project = class {
|
|
|
3024
3092
|
models: this.models,
|
|
3025
3093
|
stopWhen: this.stopWhen,
|
|
3026
3094
|
graphs: graphsObject,
|
|
3027
|
-
tools:
|
|
3028
|
-
|
|
3095
|
+
tools: toolsObject,
|
|
3096
|
+
dataComponents: Object.keys(dataComponentsObject).length > 0 ? dataComponentsObject : void 0,
|
|
3097
|
+
artifactComponents: Object.keys(artifactComponentsObject).length > 0 ? artifactComponentsObject : void 0,
|
|
3029
3098
|
credentialReferences: void 0,
|
|
3030
3099
|
// Projects don't directly hold credentials yet
|
|
3031
3100
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3032
3101
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3033
3102
|
};
|
|
3034
3103
|
}
|
|
3035
|
-
/**
|
|
3036
|
-
* Convert project configuration to API format
|
|
3037
|
-
*/
|
|
3038
|
-
toApiFormat() {
|
|
3039
|
-
return {
|
|
3040
|
-
id: this.projectId,
|
|
3041
|
-
name: this.projectName,
|
|
3042
|
-
description: this.projectDescription || "",
|
|
3043
|
-
models: this.models,
|
|
3044
|
-
stopWhen: this.stopWhen
|
|
3045
|
-
};
|
|
3046
|
-
}
|
|
3047
3104
|
};
|
|
3048
3105
|
|
|
3049
3106
|
// src/utils/generateIdFromName.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.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.5.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@types/node": "^20.11.24",
|