@inkeep/agents-manage-api 0.0.0-dev-20250919020857 → 0.0.0-dev-20250919131621
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 +128 -151
- package/dist/index.js +129 -152
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadEnvironmentFiles, getLogger as getLogger$1, createDatabaseClient, commonGetErrorResponses,
|
|
1
|
+
import { loadEnvironmentFiles, getLogger as getLogger$1, createDatabaseClient, commonGetErrorResponses, TenantProjectGraphParamsSchema, ArtifactComponentApiSelectSchema, getArtifactComponentsForAgent, getAgentsUsingArtifactComponent, ErrorResponseSchema, SingleResponseSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, getAgentById, getArtifactComponentById, createApiError, isArtifactComponentAssociatedWithAgent, associateArtifactComponentWithAgent, RemovedResponseSchema, removeArtifactComponentFromAgent, ExistsResponseSchema, DataComponentApiSelectSchema, getDataComponentsForAgent, getAgentsUsingDataComponent, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, getDataComponent, isDataComponentAssociatedWithAgent, associateDataComponentWithAgent, removeDataComponentFromAgent, ListResponseSchema, PaginationQueryParamsSchema, TenantProjectParamsSchema, AgentGraphApiSelectSchema, listAgentGraphs, IdParamsSchema, getAgentGraphById, getGraphAgentInfos, FullGraphDefinitionSchema, getFullGraphDefinition, AgentGraphApiInsertSchema, createAgentGraph, AgentGraphApiUpdateSchema, updateAgentGraph, deleteAgentGraph, AgentRelationApiSelectSchema, AgentRelationQuerySchema, getAgentRelationsBySource, getAgentRelationsByTarget, getExternalAgentRelations, listAgentRelations, TenantProjectGraphIdParamsSchema, getAgentRelationById, AgentRelationApiInsertSchema, validateExternalAgent, validateInternalAgent, createAgentRelation, AgentRelationApiUpdateSchema, updateAgentRelation, deleteAgentRelation, AgentApiSelectSchema, listAgentsPaginated, AgentApiInsertSchema, createAgent, AgentApiUpdateSchema, updateAgent, deleteAgent, AgentToolRelationApiSelectSchema, getAgentToolRelationByAgent, getAgentToolRelationByTool, listAgentToolRelations, getAgentToolRelationById, getToolsForAgent, getAgentsForTool, AgentToolRelationApiInsertSchema, createAgentToolRelation, AgentToolRelationApiUpdateSchema, updateAgentToolRelation, deleteAgentToolRelation, ApiKeyApiSelectSchema, listApiKeysPaginated, getApiKeyById, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, generateApiKey, createApiKey, ApiKeyApiUpdateSchema, updateApiKey, deleteApiKey, listArtifactComponentsPaginated, ArtifactComponentApiInsertSchema, createArtifactComponent, ArtifactComponentApiUpdateSchema, updateArtifactComponent, deleteArtifactComponent, ContextConfigApiSelectSchema, listContextConfigsPaginated, getContextConfigById, ContextConfigApiInsertSchema, createContextConfig, commonUpdateErrorResponses, ContextConfigApiUpdateSchema, updateContextConfig, commonDeleteErrorResponses, deleteContextConfig, CredentialReferenceApiSelectSchema, listCredentialReferencesPaginated, getCredentialReferenceById, CredentialReferenceApiInsertSchema, createCredentialReference, CredentialReferenceApiUpdateSchema, updateCredentialReference, getCredentialStoreLookupKeyFromRetrievalParams, deleteCredentialReference, listDataComponentsPaginated, DataComponentApiInsertSchema, createDataComponent, DataComponentApiUpdateSchema, updateDataComponent, deleteDataComponent, ExternalAgentApiSelectSchema, listExternalAgentsPaginated, getExternalAgent, ExternalAgentApiInsertSchema, createExternalAgent, ExternalAgentApiUpdateSchema, updateExternalAgent, deleteExternalAgent, createFullGraphServerSide, getFullGraph, updateFullGraphServerSide, deleteFullGraph, TenantParamsSchema, ProjectApiSelectSchema, listProjectsPaginated, TenantIdParamsSchema, getProject, ProjectApiInsertSchema, createProject, ProjectApiUpdateSchema, updateProject, deleteProject, McpToolSchema, ToolStatusSchema, listToolsByStatus, dbResultToMcpTool, listTools, getToolById, ToolApiInsertSchema, createTool, ToolApiUpdateSchema, updateTool, deleteTool, getCredentialReference, CredentialStoreType, FullProjectDefinitionSchema, createFullProjectServerSide, getFullProject, updateFullProjectServerSide, deleteFullProject, createDefaultCredentialStores, CredentialStoreRegistry, ContextResolver, CredentialStuffer, McpClient, detectAuthenticationRequired, handleApiError, MCPServerType, MCPTransportType } from '@inkeep/agents-core';
|
|
2
2
|
import { OpenAPIHono, createRoute, z as z$1 } from '@hono/zod-openapi';
|
|
3
3
|
import { Hono } from 'hono';
|
|
4
4
|
import { cors } from 'hono/cors';
|
|
@@ -148,7 +148,7 @@ app.openapi(
|
|
|
148
148
|
operationId: "get-artifact-components-for-agent",
|
|
149
149
|
tags: ["CRUD Agent Artifact Component Relations"],
|
|
150
150
|
request: {
|
|
151
|
-
params:
|
|
151
|
+
params: TenantProjectGraphParamsSchema.extend({
|
|
152
152
|
agentId: z.string()
|
|
153
153
|
})
|
|
154
154
|
},
|
|
@@ -167,10 +167,9 @@ app.openapi(
|
|
|
167
167
|
}
|
|
168
168
|
}),
|
|
169
169
|
async (c) => {
|
|
170
|
-
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
170
|
+
const { tenantId, projectId, graphId, agentId } = c.req.valid("param");
|
|
171
171
|
const artifactComponents = await getArtifactComponentsForAgent(dbClient_default)({
|
|
172
|
-
scopes: { tenantId, projectId }
|
|
173
|
-
agentId
|
|
172
|
+
scopes: { tenantId, projectId, graphId, agentId }
|
|
174
173
|
});
|
|
175
174
|
return c.json({
|
|
176
175
|
data: artifactComponents
|
|
@@ -185,7 +184,7 @@ app.openapi(
|
|
|
185
184
|
operationId: "get-agents-using-artifact-component",
|
|
186
185
|
tags: ["CRUD Agent Artifact Component Relations"],
|
|
187
186
|
request: {
|
|
188
|
-
params:
|
|
187
|
+
params: TenantProjectGraphParamsSchema.extend({
|
|
189
188
|
artifactComponentId: z.string()
|
|
190
189
|
})
|
|
191
190
|
},
|
|
@@ -225,7 +224,7 @@ app.openapi(
|
|
|
225
224
|
operationId: "associate-artifact-component-with-agent",
|
|
226
225
|
tags: ["CRUD Agent Artifact Component Relations"],
|
|
227
226
|
request: {
|
|
228
|
-
params:
|
|
227
|
+
params: TenantProjectGraphParamsSchema,
|
|
229
228
|
body: {
|
|
230
229
|
content: {
|
|
231
230
|
"application/json": {
|
|
@@ -255,9 +254,12 @@ app.openapi(
|
|
|
255
254
|
}
|
|
256
255
|
}),
|
|
257
256
|
async (c) => {
|
|
258
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
257
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
259
258
|
const { agentId, artifactComponentId } = c.req.valid("json");
|
|
260
|
-
const agent = await getAgentById(dbClient_default)({
|
|
259
|
+
const agent = await getAgentById(dbClient_default)({
|
|
260
|
+
scopes: { tenantId, projectId, graphId },
|
|
261
|
+
agentId
|
|
262
|
+
});
|
|
261
263
|
const artifactComponent = await getArtifactComponentById(dbClient_default)({
|
|
262
264
|
scopes: { tenantId, projectId },
|
|
263
265
|
id: artifactComponentId
|
|
@@ -275,8 +277,7 @@ app.openapi(
|
|
|
275
277
|
});
|
|
276
278
|
}
|
|
277
279
|
const exists = await isArtifactComponentAssociatedWithAgent(dbClient_default)({
|
|
278
|
-
scopes: { tenantId, projectId },
|
|
279
|
-
agentId,
|
|
280
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
280
281
|
artifactComponentId
|
|
281
282
|
});
|
|
282
283
|
if (exists) {
|
|
@@ -286,8 +287,7 @@ app.openapi(
|
|
|
286
287
|
});
|
|
287
288
|
}
|
|
288
289
|
const association = await associateArtifactComponentWithAgent(dbClient_default)({
|
|
289
|
-
scopes: { tenantId, projectId },
|
|
290
|
-
agentId,
|
|
290
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
291
291
|
artifactComponentId
|
|
292
292
|
});
|
|
293
293
|
return c.json({ data: association }, 201);
|
|
@@ -301,7 +301,7 @@ app.openapi(
|
|
|
301
301
|
operationId: "remove-artifact-component-from-agent",
|
|
302
302
|
tags: ["CRUD Agent Artifact Component Relations"],
|
|
303
303
|
request: {
|
|
304
|
-
params:
|
|
304
|
+
params: TenantProjectGraphParamsSchema.extend({
|
|
305
305
|
agentId: z.string(),
|
|
306
306
|
artifactComponentId: z.string()
|
|
307
307
|
})
|
|
@@ -319,10 +319,9 @@ app.openapi(
|
|
|
319
319
|
}
|
|
320
320
|
}),
|
|
321
321
|
async (c) => {
|
|
322
|
-
const { tenantId, projectId, agentId, artifactComponentId } = c.req.valid("param");
|
|
322
|
+
const { tenantId, projectId, graphId, agentId, artifactComponentId } = c.req.valid("param");
|
|
323
323
|
const removed = await removeArtifactComponentFromAgent(dbClient_default)({
|
|
324
|
-
scopes: { tenantId, projectId },
|
|
325
|
-
agentId,
|
|
324
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
326
325
|
artifactComponentId
|
|
327
326
|
});
|
|
328
327
|
if (!removed) {
|
|
@@ -345,7 +344,7 @@ app.openapi(
|
|
|
345
344
|
operationId: "check-artifact-component-agent-association",
|
|
346
345
|
tags: ["CRUD Agent Artifact Component Relations"],
|
|
347
346
|
request: {
|
|
348
|
-
params:
|
|
347
|
+
params: TenantProjectGraphParamsSchema.extend({
|
|
349
348
|
agentId: z.string(),
|
|
350
349
|
artifactComponentId: z.string()
|
|
351
350
|
})
|
|
@@ -363,10 +362,9 @@ app.openapi(
|
|
|
363
362
|
}
|
|
364
363
|
}),
|
|
365
364
|
async (c) => {
|
|
366
|
-
const { tenantId, projectId, agentId, artifactComponentId } = c.req.valid("param");
|
|
365
|
+
const { tenantId, projectId, graphId, agentId, artifactComponentId } = c.req.valid("param");
|
|
367
366
|
const exists = await isArtifactComponentAssociatedWithAgent(dbClient_default)({
|
|
368
|
-
scopes: { tenantId, projectId },
|
|
369
|
-
agentId,
|
|
367
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
370
368
|
artifactComponentId
|
|
371
369
|
});
|
|
372
370
|
return c.json({ exists });
|
|
@@ -382,7 +380,7 @@ app2.openapi(
|
|
|
382
380
|
operationId: "get-data-components-for-agent",
|
|
383
381
|
tags: ["CRUD Agent Data Component Relations"],
|
|
384
382
|
request: {
|
|
385
|
-
params:
|
|
383
|
+
params: TenantProjectGraphParamsSchema.extend({
|
|
386
384
|
agentId: z.string()
|
|
387
385
|
})
|
|
388
386
|
},
|
|
@@ -401,10 +399,9 @@ app2.openapi(
|
|
|
401
399
|
}
|
|
402
400
|
}),
|
|
403
401
|
async (c) => {
|
|
404
|
-
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
402
|
+
const { tenantId, projectId, graphId, agentId } = c.req.valid("param");
|
|
405
403
|
const dataComponents = await getDataComponentsForAgent(dbClient_default)({
|
|
406
|
-
scopes: { tenantId, projectId }
|
|
407
|
-
agentId
|
|
404
|
+
scopes: { tenantId, projectId, graphId, agentId }
|
|
408
405
|
});
|
|
409
406
|
return c.json({ data: dataComponents });
|
|
410
407
|
}
|
|
@@ -417,7 +414,7 @@ app2.openapi(
|
|
|
417
414
|
operationId: "get-agents-using-data-component",
|
|
418
415
|
tags: ["CRUD Agent Data Component Relations"],
|
|
419
416
|
request: {
|
|
420
|
-
params:
|
|
417
|
+
params: TenantProjectGraphParamsSchema.extend({
|
|
421
418
|
dataComponentId: z.string()
|
|
422
419
|
})
|
|
423
420
|
},
|
|
@@ -457,7 +454,7 @@ app2.openapi(
|
|
|
457
454
|
operationId: "associate-data-component-with-agent",
|
|
458
455
|
tags: ["CRUD Agent Data Component Relations"],
|
|
459
456
|
request: {
|
|
460
|
-
params:
|
|
457
|
+
params: TenantProjectGraphParamsSchema,
|
|
461
458
|
body: {
|
|
462
459
|
content: {
|
|
463
460
|
"application/json": {
|
|
@@ -487,10 +484,10 @@ app2.openapi(
|
|
|
487
484
|
}
|
|
488
485
|
}),
|
|
489
486
|
async (c) => {
|
|
490
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
487
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
491
488
|
const { agentId, dataComponentId } = c.req.valid("json");
|
|
492
489
|
const [agent, dataComponent] = await Promise.all([
|
|
493
|
-
getAgentById(dbClient_default)({ scopes: { tenantId, projectId }, agentId }),
|
|
490
|
+
getAgentById(dbClient_default)({ scopes: { tenantId, projectId, graphId }, agentId }),
|
|
494
491
|
getDataComponent(dbClient_default)({ scopes: { tenantId, projectId }, dataComponentId })
|
|
495
492
|
]);
|
|
496
493
|
if (!agent) {
|
|
@@ -506,8 +503,7 @@ app2.openapi(
|
|
|
506
503
|
});
|
|
507
504
|
}
|
|
508
505
|
const exists = await isDataComponentAssociatedWithAgent(dbClient_default)({
|
|
509
|
-
scopes: { tenantId, projectId },
|
|
510
|
-
agentId,
|
|
506
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
511
507
|
dataComponentId
|
|
512
508
|
});
|
|
513
509
|
if (exists) {
|
|
@@ -517,8 +513,7 @@ app2.openapi(
|
|
|
517
513
|
});
|
|
518
514
|
}
|
|
519
515
|
const association = await associateDataComponentWithAgent(dbClient_default)({
|
|
520
|
-
scopes: { tenantId, projectId },
|
|
521
|
-
agentId,
|
|
516
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
522
517
|
dataComponentId
|
|
523
518
|
});
|
|
524
519
|
return c.json({ data: association }, 201);
|
|
@@ -532,7 +527,7 @@ app2.openapi(
|
|
|
532
527
|
operationId: "remove-data-component-from-agent",
|
|
533
528
|
tags: ["CRUD Agent Data Component Relations"],
|
|
534
529
|
request: {
|
|
535
|
-
params:
|
|
530
|
+
params: TenantProjectGraphParamsSchema.extend({
|
|
536
531
|
agentId: z.string(),
|
|
537
532
|
dataComponentId: z.string()
|
|
538
533
|
})
|
|
@@ -550,10 +545,9 @@ app2.openapi(
|
|
|
550
545
|
}
|
|
551
546
|
}),
|
|
552
547
|
async (c) => {
|
|
553
|
-
const { tenantId, projectId, agentId, dataComponentId } = c.req.valid("param");
|
|
548
|
+
const { tenantId, projectId, graphId, agentId, dataComponentId } = c.req.valid("param");
|
|
554
549
|
const removed = await removeDataComponentFromAgent(dbClient_default)({
|
|
555
|
-
scopes: { tenantId, projectId },
|
|
556
|
-
agentId,
|
|
550
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
557
551
|
dataComponentId
|
|
558
552
|
});
|
|
559
553
|
if (!removed) {
|
|
@@ -576,7 +570,7 @@ app2.openapi(
|
|
|
576
570
|
operationId: "check-data-component-agent-association",
|
|
577
571
|
tags: ["CRUD Agent Data Component Relations"],
|
|
578
572
|
request: {
|
|
579
|
-
params:
|
|
573
|
+
params: TenantProjectGraphParamsSchema.extend({
|
|
580
574
|
agentId: z.string(),
|
|
581
575
|
dataComponentId: z.string()
|
|
582
576
|
})
|
|
@@ -594,10 +588,9 @@ app2.openapi(
|
|
|
594
588
|
}
|
|
595
589
|
}),
|
|
596
590
|
async (c) => {
|
|
597
|
-
const { tenantId, projectId, agentId, dataComponentId } = c.req.valid("param");
|
|
591
|
+
const { tenantId, projectId, graphId, agentId, dataComponentId } = c.req.valid("param");
|
|
598
592
|
const exists = await isDataComponentAssociatedWithAgent(dbClient_default)({
|
|
599
|
-
scopes: { tenantId, projectId },
|
|
600
|
-
agentId,
|
|
593
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
601
594
|
dataComponentId
|
|
602
595
|
});
|
|
603
596
|
return c.json({ exists });
|
|
@@ -668,9 +661,8 @@ app3.openapi(
|
|
|
668
661
|
}),
|
|
669
662
|
async (c) => {
|
|
670
663
|
const { tenantId, projectId, id } = c.req.valid("param");
|
|
671
|
-
const graph = await
|
|
672
|
-
scopes: { tenantId, projectId }
|
|
673
|
-
graphId: id
|
|
664
|
+
const graph = await getAgentGraphById(dbClient_default)({
|
|
665
|
+
scopes: { tenantId, projectId, graphId: id }
|
|
674
666
|
});
|
|
675
667
|
if (!graph) {
|
|
676
668
|
throw createApiError({
|
|
@@ -757,8 +749,7 @@ app3.openapi(
|
|
|
757
749
|
async (c) => {
|
|
758
750
|
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
759
751
|
const fullGraph = await getFullGraphDefinition(dbClient_default)({
|
|
760
|
-
scopes: { tenantId, projectId }
|
|
761
|
-
graphId
|
|
752
|
+
scopes: { tenantId, projectId, graphId }
|
|
762
753
|
});
|
|
763
754
|
if (!fullGraph) {
|
|
764
755
|
throw createApiError({
|
|
@@ -845,8 +836,7 @@ app3.openapi(
|
|
|
845
836
|
const { tenantId, projectId, id } = c.req.valid("param");
|
|
846
837
|
const validatedBody = c.req.valid("json");
|
|
847
838
|
const updatedGraph = await updateAgentGraph(dbClient_default)({
|
|
848
|
-
scopes: { tenantId, projectId },
|
|
849
|
-
graphId: id,
|
|
839
|
+
scopes: { tenantId, projectId, graphId: id },
|
|
850
840
|
data: {
|
|
851
841
|
defaultAgentId: validatedBody.defaultAgentId,
|
|
852
842
|
contextConfigId: validatedBody.contextConfigId ?? void 0
|
|
@@ -888,8 +878,7 @@ app3.openapi(
|
|
|
888
878
|
async (c) => {
|
|
889
879
|
const { tenantId, projectId, id } = c.req.valid("param");
|
|
890
880
|
const deleted = await deleteAgentGraph(dbClient_default)({
|
|
891
|
-
scopes: { tenantId, projectId }
|
|
892
|
-
graphId: id
|
|
881
|
+
scopes: { tenantId, projectId, graphId: id }
|
|
893
882
|
});
|
|
894
883
|
if (!deleted) {
|
|
895
884
|
throw createApiError({
|
|
@@ -910,7 +899,7 @@ app4.openapi(
|
|
|
910
899
|
operationId: "list-agent-relations",
|
|
911
900
|
tags: ["CRUD Agent Relations"],
|
|
912
901
|
request: {
|
|
913
|
-
params:
|
|
902
|
+
params: TenantProjectGraphParamsSchema,
|
|
914
903
|
query: PaginationQueryParamsSchema.merge(AgentRelationQuerySchema)
|
|
915
904
|
},
|
|
916
905
|
responses: {
|
|
@@ -926,7 +915,7 @@ app4.openapi(
|
|
|
926
915
|
}
|
|
927
916
|
}),
|
|
928
917
|
async (c) => {
|
|
929
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
918
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
930
919
|
const {
|
|
931
920
|
page = 1,
|
|
932
921
|
limit = 10,
|
|
@@ -940,28 +929,28 @@ app4.openapi(
|
|
|
940
929
|
let result;
|
|
941
930
|
if (sourceAgentId) {
|
|
942
931
|
const rawResult = await getAgentRelationsBySource(dbClient_default)({
|
|
943
|
-
scopes: { tenantId, projectId },
|
|
932
|
+
scopes: { tenantId, projectId, graphId },
|
|
944
933
|
sourceAgentId,
|
|
945
934
|
pagination: { page: pageNum, limit: limitNum }
|
|
946
935
|
});
|
|
947
936
|
result = { ...rawResult, data: rawResult.data };
|
|
948
937
|
} else if (targetAgentId) {
|
|
949
938
|
const rawResult = await getAgentRelationsByTarget(dbClient_default)({
|
|
950
|
-
scopes: { tenantId, projectId },
|
|
939
|
+
scopes: { tenantId, projectId, graphId },
|
|
951
940
|
targetAgentId,
|
|
952
941
|
pagination: { page: pageNum, limit: limitNum }
|
|
953
942
|
});
|
|
954
943
|
result = { ...rawResult, data: rawResult.data };
|
|
955
944
|
} else if (externalAgentId) {
|
|
956
945
|
const rawResult = await getExternalAgentRelations(dbClient_default)({
|
|
957
|
-
scopes: { tenantId, projectId },
|
|
946
|
+
scopes: { tenantId, projectId, graphId },
|
|
958
947
|
externalAgentId,
|
|
959
948
|
pagination: { page: pageNum, limit: limitNum }
|
|
960
949
|
});
|
|
961
950
|
result = { ...rawResult, data: rawResult.data };
|
|
962
951
|
} else {
|
|
963
952
|
const rawResult = await listAgentRelations(dbClient_default)({
|
|
964
|
-
scopes: { tenantId, projectId },
|
|
953
|
+
scopes: { tenantId, projectId, graphId },
|
|
965
954
|
pagination: { page: pageNum, limit: limitNum }
|
|
966
955
|
});
|
|
967
956
|
result = { ...rawResult, data: rawResult.data };
|
|
@@ -983,7 +972,7 @@ app4.openapi(
|
|
|
983
972
|
operationId: "get-agent-relation-by-id",
|
|
984
973
|
tags: ["CRUD Agent Relations"],
|
|
985
974
|
request: {
|
|
986
|
-
params:
|
|
975
|
+
params: TenantProjectGraphIdParamsSchema
|
|
987
976
|
},
|
|
988
977
|
responses: {
|
|
989
978
|
200: {
|
|
@@ -998,9 +987,9 @@ app4.openapi(
|
|
|
998
987
|
}
|
|
999
988
|
}),
|
|
1000
989
|
async (c) => {
|
|
1001
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
990
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1002
991
|
const agentRelation = await getAgentRelationById(dbClient_default)({
|
|
1003
|
-
scopes: { tenantId, projectId },
|
|
992
|
+
scopes: { tenantId, projectId, graphId },
|
|
1004
993
|
relationId: id
|
|
1005
994
|
});
|
|
1006
995
|
if (!agentRelation) {
|
|
@@ -1020,7 +1009,7 @@ app4.openapi(
|
|
|
1020
1009
|
operationId: "create-agent-relation",
|
|
1021
1010
|
tags: ["CRUD Agent Relations"],
|
|
1022
1011
|
request: {
|
|
1023
|
-
params:
|
|
1012
|
+
params: TenantProjectGraphParamsSchema,
|
|
1024
1013
|
body: {
|
|
1025
1014
|
content: {
|
|
1026
1015
|
"application/json": {
|
|
@@ -1042,13 +1031,12 @@ app4.openapi(
|
|
|
1042
1031
|
}
|
|
1043
1032
|
}),
|
|
1044
1033
|
async (c) => {
|
|
1045
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
1034
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
1046
1035
|
const body = await c.req.valid("json");
|
|
1047
1036
|
const isExternalAgent = body.externalAgentId != null;
|
|
1048
1037
|
if (isExternalAgent && body.externalAgentId) {
|
|
1049
1038
|
const externalAgentExists = await validateExternalAgent(dbClient_default)({
|
|
1050
|
-
scopes: { tenantId, projectId }
|
|
1051
|
-
agentId: body.externalAgentId
|
|
1039
|
+
scopes: { tenantId, projectId, graphId, agentId: body.externalAgentId }
|
|
1052
1040
|
});
|
|
1053
1041
|
if (!externalAgentExists) {
|
|
1054
1042
|
throw createApiError({
|
|
@@ -1059,8 +1047,7 @@ app4.openapi(
|
|
|
1059
1047
|
}
|
|
1060
1048
|
if (!isExternalAgent && body.targetAgentId) {
|
|
1061
1049
|
const internalAgentExists = await validateInternalAgent(dbClient_default)({
|
|
1062
|
-
scopes: { tenantId, projectId }
|
|
1063
|
-
agentId: body.targetAgentId
|
|
1050
|
+
scopes: { tenantId, projectId, graphId, agentId: body.targetAgentId }
|
|
1064
1051
|
});
|
|
1065
1052
|
if (!internalAgentExists) {
|
|
1066
1053
|
throw createApiError({
|
|
@@ -1070,11 +1057,11 @@ app4.openapi(
|
|
|
1070
1057
|
}
|
|
1071
1058
|
}
|
|
1072
1059
|
const existingRelations = await listAgentRelations(dbClient_default)({
|
|
1073
|
-
scopes: { tenantId, projectId },
|
|
1060
|
+
scopes: { tenantId, projectId, graphId },
|
|
1074
1061
|
pagination: { page: 1, limit: 1e3 }
|
|
1075
1062
|
});
|
|
1076
1063
|
const isDuplicate = existingRelations.data.some((relation) => {
|
|
1077
|
-
if (relation.graphId !==
|
|
1064
|
+
if (relation.graphId !== graphId || relation.sourceAgentId !== body.sourceAgentId) {
|
|
1078
1065
|
return false;
|
|
1079
1066
|
}
|
|
1080
1067
|
if (isExternalAgent) {
|
|
@@ -1090,7 +1077,7 @@ app4.openapi(
|
|
|
1090
1077
|
});
|
|
1091
1078
|
}
|
|
1092
1079
|
const relationData = {
|
|
1093
|
-
graphId
|
|
1080
|
+
graphId,
|
|
1094
1081
|
tenantId,
|
|
1095
1082
|
id: nanoid(),
|
|
1096
1083
|
projectId,
|
|
@@ -1113,7 +1100,7 @@ app4.openapi(
|
|
|
1113
1100
|
operationId: "update-agent-relation",
|
|
1114
1101
|
tags: ["CRUD Agent Relations"],
|
|
1115
1102
|
request: {
|
|
1116
|
-
params:
|
|
1103
|
+
params: TenantProjectGraphIdParamsSchema,
|
|
1117
1104
|
body: {
|
|
1118
1105
|
content: {
|
|
1119
1106
|
"application/json": {
|
|
@@ -1135,10 +1122,10 @@ app4.openapi(
|
|
|
1135
1122
|
}
|
|
1136
1123
|
}),
|
|
1137
1124
|
async (c) => {
|
|
1138
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1125
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1139
1126
|
const body = await c.req.valid("json");
|
|
1140
1127
|
const updatedAgentRelation = await updateAgentRelation(dbClient_default)({
|
|
1141
|
-
scopes: { tenantId, projectId },
|
|
1128
|
+
scopes: { tenantId, projectId, graphId },
|
|
1142
1129
|
relationId: id,
|
|
1143
1130
|
data: body
|
|
1144
1131
|
});
|
|
@@ -1159,7 +1146,7 @@ app4.openapi(
|
|
|
1159
1146
|
operationId: "delete-agent-relation",
|
|
1160
1147
|
tags: ["CRUD Agent Relations"],
|
|
1161
1148
|
request: {
|
|
1162
|
-
params:
|
|
1149
|
+
params: TenantProjectGraphIdParamsSchema
|
|
1163
1150
|
},
|
|
1164
1151
|
responses: {
|
|
1165
1152
|
204: {
|
|
@@ -1176,9 +1163,9 @@ app4.openapi(
|
|
|
1176
1163
|
}
|
|
1177
1164
|
}),
|
|
1178
1165
|
async (c) => {
|
|
1179
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1166
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1180
1167
|
const deleted = await deleteAgentRelation(dbClient_default)({
|
|
1181
|
-
scopes: { tenantId, projectId },
|
|
1168
|
+
scopes: { tenantId, projectId, graphId },
|
|
1182
1169
|
relationId: id
|
|
1183
1170
|
});
|
|
1184
1171
|
if (!deleted) {
|
|
@@ -1200,7 +1187,7 @@ app5.openapi(
|
|
|
1200
1187
|
operationId: "list-agents",
|
|
1201
1188
|
tags: ["CRUD Agent"],
|
|
1202
1189
|
request: {
|
|
1203
|
-
params:
|
|
1190
|
+
params: TenantProjectGraphParamsSchema,
|
|
1204
1191
|
query: PaginationQueryParamsSchema
|
|
1205
1192
|
},
|
|
1206
1193
|
responses: {
|
|
@@ -1216,11 +1203,11 @@ app5.openapi(
|
|
|
1216
1203
|
}
|
|
1217
1204
|
}),
|
|
1218
1205
|
async (c) => {
|
|
1219
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
1206
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
1220
1207
|
const page = Number(c.req.query("page")) || 1;
|
|
1221
1208
|
const limit = Math.min(Number(c.req.query("limit")) || 10, 100);
|
|
1222
1209
|
const result = await listAgentsPaginated(dbClient_default)({
|
|
1223
|
-
scopes: { tenantId, projectId },
|
|
1210
|
+
scopes: { tenantId, projectId, graphId },
|
|
1224
1211
|
pagination: { page, limit }
|
|
1225
1212
|
});
|
|
1226
1213
|
const dataWithType = {
|
|
@@ -1241,7 +1228,7 @@ app5.openapi(
|
|
|
1241
1228
|
operationId: "get-agent-by-id",
|
|
1242
1229
|
tags: ["CRUD Agent"],
|
|
1243
1230
|
request: {
|
|
1244
|
-
params:
|
|
1231
|
+
params: TenantProjectGraphIdParamsSchema
|
|
1245
1232
|
},
|
|
1246
1233
|
responses: {
|
|
1247
1234
|
200: {
|
|
@@ -1256,9 +1243,9 @@ app5.openapi(
|
|
|
1256
1243
|
}
|
|
1257
1244
|
}),
|
|
1258
1245
|
async (c) => {
|
|
1259
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1246
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1260
1247
|
const agent = await getAgentById(dbClient_default)({
|
|
1261
|
-
scopes: { tenantId, projectId },
|
|
1248
|
+
scopes: { tenantId, projectId, graphId },
|
|
1262
1249
|
agentId: id
|
|
1263
1250
|
});
|
|
1264
1251
|
if (!agent) {
|
|
@@ -1282,7 +1269,7 @@ app5.openapi(
|
|
|
1282
1269
|
operationId: "create-agent",
|
|
1283
1270
|
tags: ["CRUD Agent"],
|
|
1284
1271
|
request: {
|
|
1285
|
-
params:
|
|
1272
|
+
params: TenantProjectGraphParamsSchema,
|
|
1286
1273
|
body: {
|
|
1287
1274
|
content: {
|
|
1288
1275
|
"application/json": {
|
|
@@ -1304,14 +1291,15 @@ app5.openapi(
|
|
|
1304
1291
|
}
|
|
1305
1292
|
}),
|
|
1306
1293
|
async (c) => {
|
|
1307
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
1294
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
1308
1295
|
const body = c.req.valid("json");
|
|
1309
1296
|
const agentId = body.id ? String(body.id) : nanoid();
|
|
1310
1297
|
const agent = await createAgent(dbClient_default)({
|
|
1311
1298
|
...body,
|
|
1312
1299
|
id: agentId,
|
|
1313
1300
|
tenantId,
|
|
1314
|
-
projectId
|
|
1301
|
+
projectId,
|
|
1302
|
+
graphId
|
|
1315
1303
|
});
|
|
1316
1304
|
const agentWithType = {
|
|
1317
1305
|
...agent,
|
|
@@ -1328,7 +1316,7 @@ app5.openapi(
|
|
|
1328
1316
|
operationId: "update-agent",
|
|
1329
1317
|
tags: ["CRUD Agent"],
|
|
1330
1318
|
request: {
|
|
1331
|
-
params:
|
|
1319
|
+
params: TenantProjectGraphIdParamsSchema,
|
|
1332
1320
|
body: {
|
|
1333
1321
|
content: {
|
|
1334
1322
|
"application/json": {
|
|
@@ -1350,10 +1338,10 @@ app5.openapi(
|
|
|
1350
1338
|
}
|
|
1351
1339
|
}),
|
|
1352
1340
|
async (c) => {
|
|
1353
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1341
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1354
1342
|
const body = c.req.valid("json");
|
|
1355
1343
|
const updatedAgent = await updateAgent(dbClient_default)({
|
|
1356
|
-
scopes: { tenantId, projectId },
|
|
1344
|
+
scopes: { tenantId, projectId, graphId },
|
|
1357
1345
|
agentId: id,
|
|
1358
1346
|
data: body
|
|
1359
1347
|
});
|
|
@@ -1378,7 +1366,7 @@ app5.openapi(
|
|
|
1378
1366
|
operationId: "delete-agent",
|
|
1379
1367
|
tags: ["CRUD Agent"],
|
|
1380
1368
|
request: {
|
|
1381
|
-
params:
|
|
1369
|
+
params: TenantProjectGraphIdParamsSchema
|
|
1382
1370
|
},
|
|
1383
1371
|
responses: {
|
|
1384
1372
|
204: {
|
|
@@ -1395,9 +1383,9 @@ app5.openapi(
|
|
|
1395
1383
|
}
|
|
1396
1384
|
}),
|
|
1397
1385
|
async (c) => {
|
|
1398
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1386
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1399
1387
|
const deleted = await deleteAgent(dbClient_default)({
|
|
1400
|
-
scopes: { tenantId, projectId },
|
|
1388
|
+
scopes: { tenantId, projectId, graphId },
|
|
1401
1389
|
agentId: id
|
|
1402
1390
|
});
|
|
1403
1391
|
if (!deleted) {
|
|
@@ -1419,7 +1407,7 @@ app6.openapi(
|
|
|
1419
1407
|
operationId: "list-agent-tool-relations",
|
|
1420
1408
|
tags: ["CRUD Agent Tool Relations"],
|
|
1421
1409
|
request: {
|
|
1422
|
-
params:
|
|
1410
|
+
params: TenantProjectGraphParamsSchema,
|
|
1423
1411
|
query: PaginationQueryParamsSchema.extend({
|
|
1424
1412
|
agentId: z.string().optional(),
|
|
1425
1413
|
toolId: z.string().optional()
|
|
@@ -1438,13 +1426,12 @@ app6.openapi(
|
|
|
1438
1426
|
}
|
|
1439
1427
|
}),
|
|
1440
1428
|
async (c) => {
|
|
1441
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
1429
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
1442
1430
|
const { page, limit, agentId, toolId } = c.req.valid("query");
|
|
1443
1431
|
let result;
|
|
1444
1432
|
if (agentId) {
|
|
1445
1433
|
const dbResult = await getAgentToolRelationByAgent(dbClient_default)({
|
|
1446
|
-
scopes: { tenantId, projectId },
|
|
1447
|
-
agentId,
|
|
1434
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
1448
1435
|
pagination: { page, limit }
|
|
1449
1436
|
});
|
|
1450
1437
|
result = {
|
|
@@ -1453,7 +1440,7 @@ app6.openapi(
|
|
|
1453
1440
|
};
|
|
1454
1441
|
} else if (toolId) {
|
|
1455
1442
|
const dbResult = await getAgentToolRelationByTool(dbClient_default)({
|
|
1456
|
-
scopes: { tenantId, projectId },
|
|
1443
|
+
scopes: { tenantId, projectId, graphId },
|
|
1457
1444
|
toolId,
|
|
1458
1445
|
pagination: { page, limit }
|
|
1459
1446
|
});
|
|
@@ -1463,7 +1450,7 @@ app6.openapi(
|
|
|
1463
1450
|
};
|
|
1464
1451
|
} else {
|
|
1465
1452
|
const dbResult = await listAgentToolRelations(dbClient_default)({
|
|
1466
|
-
scopes: { tenantId, projectId },
|
|
1453
|
+
scopes: { tenantId, projectId, graphId },
|
|
1467
1454
|
pagination: { page, limit }
|
|
1468
1455
|
});
|
|
1469
1456
|
result = {
|
|
@@ -1482,7 +1469,7 @@ app6.openapi(
|
|
|
1482
1469
|
operationId: "get-agent-tool-relation",
|
|
1483
1470
|
tags: ["CRUD Agent Tool Relations"],
|
|
1484
1471
|
request: {
|
|
1485
|
-
params:
|
|
1472
|
+
params: TenantProjectGraphParamsSchema.merge(IdParamsSchema)
|
|
1486
1473
|
},
|
|
1487
1474
|
responses: {
|
|
1488
1475
|
200: {
|
|
@@ -1497,9 +1484,9 @@ app6.openapi(
|
|
|
1497
1484
|
}
|
|
1498
1485
|
}),
|
|
1499
1486
|
async (c) => {
|
|
1500
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1487
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1501
1488
|
const agentToolRelation = await getAgentToolRelationById(dbClient_default)({
|
|
1502
|
-
scopes: { tenantId, projectId },
|
|
1489
|
+
scopes: { tenantId, projectId, graphId, agentId: id },
|
|
1503
1490
|
relationId: id
|
|
1504
1491
|
});
|
|
1505
1492
|
if (!agentToolRelation) {
|
|
@@ -1519,7 +1506,7 @@ app6.openapi(
|
|
|
1519
1506
|
operationId: "get-tools-for-agent",
|
|
1520
1507
|
tags: ["CRUD Agent Tool Relations"],
|
|
1521
1508
|
request: {
|
|
1522
|
-
params:
|
|
1509
|
+
params: TenantProjectGraphParamsSchema.extend({
|
|
1523
1510
|
agentId: z.string()
|
|
1524
1511
|
}),
|
|
1525
1512
|
query: PaginationQueryParamsSchema
|
|
@@ -1537,11 +1524,10 @@ app6.openapi(
|
|
|
1537
1524
|
}
|
|
1538
1525
|
}),
|
|
1539
1526
|
async (c) => {
|
|
1540
|
-
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
1527
|
+
const { tenantId, projectId, graphId, agentId } = c.req.valid("param");
|
|
1541
1528
|
const { page, limit } = c.req.valid("query");
|
|
1542
1529
|
const dbResult = await getToolsForAgent(dbClient_default)({
|
|
1543
|
-
scopes: { tenantId, projectId },
|
|
1544
|
-
agentId,
|
|
1530
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
1545
1531
|
pagination: { page, limit }
|
|
1546
1532
|
});
|
|
1547
1533
|
const result = {
|
|
@@ -1559,7 +1545,7 @@ app6.openapi(
|
|
|
1559
1545
|
operationId: "get-agents-for-tool",
|
|
1560
1546
|
tags: ["CRUD Agent Tool Relations"],
|
|
1561
1547
|
request: {
|
|
1562
|
-
params:
|
|
1548
|
+
params: TenantProjectGraphParamsSchema.extend({
|
|
1563
1549
|
toolId: z.string()
|
|
1564
1550
|
}),
|
|
1565
1551
|
query: PaginationQueryParamsSchema
|
|
@@ -1577,18 +1563,14 @@ app6.openapi(
|
|
|
1577
1563
|
}
|
|
1578
1564
|
}),
|
|
1579
1565
|
async (c) => {
|
|
1580
|
-
const { tenantId, projectId, toolId } = c.req.valid("param");
|
|
1566
|
+
const { tenantId, projectId, graphId, toolId } = c.req.valid("param");
|
|
1581
1567
|
const { page, limit } = c.req.valid("query");
|
|
1582
1568
|
const dbResult = await getAgentsForTool(dbClient_default)({
|
|
1583
|
-
scopes: { tenantId, projectId },
|
|
1569
|
+
scopes: { tenantId, projectId, graphId },
|
|
1584
1570
|
toolId,
|
|
1585
1571
|
pagination: { page, limit }
|
|
1586
1572
|
});
|
|
1587
|
-
|
|
1588
|
-
data: dbResult.data,
|
|
1589
|
-
pagination: dbResult.pagination
|
|
1590
|
-
};
|
|
1591
|
-
return c.json(result);
|
|
1573
|
+
return c.json(dbResult);
|
|
1592
1574
|
}
|
|
1593
1575
|
);
|
|
1594
1576
|
app6.openapi(
|
|
@@ -1599,7 +1581,7 @@ app6.openapi(
|
|
|
1599
1581
|
operationId: "create-agent-tool-relation",
|
|
1600
1582
|
tags: ["CRUD Agent Tool Relations"],
|
|
1601
1583
|
request: {
|
|
1602
|
-
params:
|
|
1584
|
+
params: TenantProjectGraphParamsSchema,
|
|
1603
1585
|
body: {
|
|
1604
1586
|
content: {
|
|
1605
1587
|
"application/json": {
|
|
@@ -1621,10 +1603,10 @@ app6.openapi(
|
|
|
1621
1603
|
}
|
|
1622
1604
|
}),
|
|
1623
1605
|
async (c) => {
|
|
1624
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
1606
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
1625
1607
|
const body = c.req.valid("json");
|
|
1626
1608
|
const existingRelations = await listAgentToolRelations(dbClient_default)({
|
|
1627
|
-
scopes: { tenantId, projectId },
|
|
1609
|
+
scopes: { tenantId, projectId, graphId },
|
|
1628
1610
|
pagination: { limit: 1e3 }
|
|
1629
1611
|
});
|
|
1630
1612
|
const isDuplicate = existingRelations.data.some((relation) => {
|
|
@@ -1639,7 +1621,7 @@ app6.openapi(
|
|
|
1639
1621
|
}
|
|
1640
1622
|
try {
|
|
1641
1623
|
const agentToolRelation = await createAgentToolRelation(dbClient_default)({
|
|
1642
|
-
scopes: { tenantId, projectId },
|
|
1624
|
+
scopes: { tenantId, projectId, graphId },
|
|
1643
1625
|
data: body
|
|
1644
1626
|
});
|
|
1645
1627
|
return c.json({ data: agentToolRelation }, 201);
|
|
@@ -1662,7 +1644,7 @@ app6.openapi(
|
|
|
1662
1644
|
operationId: "update-agent-tool-relation",
|
|
1663
1645
|
tags: ["CRUD Agent Tool Relations"],
|
|
1664
1646
|
request: {
|
|
1665
|
-
params:
|
|
1647
|
+
params: TenantProjectGraphParamsSchema.merge(IdParamsSchema),
|
|
1666
1648
|
body: {
|
|
1667
1649
|
content: {
|
|
1668
1650
|
"application/json": {
|
|
@@ -1684,7 +1666,7 @@ app6.openapi(
|
|
|
1684
1666
|
}
|
|
1685
1667
|
}),
|
|
1686
1668
|
async (c) => {
|
|
1687
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1669
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1688
1670
|
console.log("id", id);
|
|
1689
1671
|
const body = await c.req.valid("json");
|
|
1690
1672
|
if (Object.keys(body).length === 0) {
|
|
@@ -1694,7 +1676,7 @@ app6.openapi(
|
|
|
1694
1676
|
});
|
|
1695
1677
|
}
|
|
1696
1678
|
const updatedAgentToolRelation = await updateAgentToolRelation(dbClient_default)({
|
|
1697
|
-
scopes: { tenantId, projectId },
|
|
1679
|
+
scopes: { tenantId, projectId, graphId },
|
|
1698
1680
|
relationId: id,
|
|
1699
1681
|
data: body
|
|
1700
1682
|
});
|
|
@@ -1715,7 +1697,7 @@ app6.openapi(
|
|
|
1715
1697
|
operationId: "delete-agent-tool-relation",
|
|
1716
1698
|
tags: ["CRUD Agent Tool Relations"],
|
|
1717
1699
|
request: {
|
|
1718
|
-
params:
|
|
1700
|
+
params: TenantProjectGraphParamsSchema.merge(IdParamsSchema)
|
|
1719
1701
|
},
|
|
1720
1702
|
responses: {
|
|
1721
1703
|
204: {
|
|
@@ -1732,9 +1714,9 @@ app6.openapi(
|
|
|
1732
1714
|
}
|
|
1733
1715
|
}),
|
|
1734
1716
|
async (c) => {
|
|
1735
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1717
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1736
1718
|
const deleted = await deleteAgentToolRelation(dbClient_default)({
|
|
1737
|
-
scopes: { tenantId, projectId },
|
|
1719
|
+
scopes: { tenantId, projectId, graphId },
|
|
1738
1720
|
relationId: id
|
|
1739
1721
|
});
|
|
1740
1722
|
if (!deleted) {
|
|
@@ -2858,7 +2840,7 @@ app12.openapi(
|
|
|
2858
2840
|
operationId: "list-external-agents",
|
|
2859
2841
|
tags: ["CRUD External Agents"],
|
|
2860
2842
|
request: {
|
|
2861
|
-
params:
|
|
2843
|
+
params: TenantProjectGraphParamsSchema,
|
|
2862
2844
|
query: PaginationQueryParamsSchema
|
|
2863
2845
|
},
|
|
2864
2846
|
responses: {
|
|
@@ -2874,10 +2856,10 @@ app12.openapi(
|
|
|
2874
2856
|
}
|
|
2875
2857
|
}),
|
|
2876
2858
|
async (c) => {
|
|
2877
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
2859
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
2878
2860
|
const { page, limit } = c.req.valid("query");
|
|
2879
2861
|
const result = await listExternalAgentsPaginated(dbClient_default)({
|
|
2880
|
-
scopes: { tenantId, projectId },
|
|
2862
|
+
scopes: { tenantId, projectId, graphId },
|
|
2881
2863
|
pagination: { page, limit }
|
|
2882
2864
|
});
|
|
2883
2865
|
const dataWithType = {
|
|
@@ -2898,7 +2880,7 @@ app12.openapi(
|
|
|
2898
2880
|
operationId: "get-external-agent-by-id",
|
|
2899
2881
|
tags: ["CRUD External Agents"],
|
|
2900
2882
|
request: {
|
|
2901
|
-
params:
|
|
2883
|
+
params: TenantProjectGraphIdParamsSchema
|
|
2902
2884
|
},
|
|
2903
2885
|
responses: {
|
|
2904
2886
|
200: {
|
|
@@ -2913,9 +2895,9 @@ app12.openapi(
|
|
|
2913
2895
|
}
|
|
2914
2896
|
}),
|
|
2915
2897
|
async (c) => {
|
|
2916
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
2898
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
2917
2899
|
const externalAgent = await getExternalAgent(dbClient_default)({
|
|
2918
|
-
scopes: { tenantId, projectId },
|
|
2900
|
+
scopes: { tenantId, projectId, graphId },
|
|
2919
2901
|
agentId: id
|
|
2920
2902
|
});
|
|
2921
2903
|
if (!externalAgent) {
|
|
@@ -2939,7 +2921,7 @@ app12.openapi(
|
|
|
2939
2921
|
operationId: "create-external-agent",
|
|
2940
2922
|
tags: ["CRUD External Agents"],
|
|
2941
2923
|
request: {
|
|
2942
|
-
params:
|
|
2924
|
+
params: TenantProjectGraphParamsSchema,
|
|
2943
2925
|
body: {
|
|
2944
2926
|
content: {
|
|
2945
2927
|
"application/json": {
|
|
@@ -2961,11 +2943,12 @@ app12.openapi(
|
|
|
2961
2943
|
}
|
|
2962
2944
|
}),
|
|
2963
2945
|
async (c) => {
|
|
2964
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
2946
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
2965
2947
|
const body = c.req.valid("json");
|
|
2966
2948
|
const externalAgentData = {
|
|
2967
2949
|
tenantId,
|
|
2968
2950
|
projectId,
|
|
2951
|
+
graphId,
|
|
2969
2952
|
id: body.id ? String(body.id) : nanoid(),
|
|
2970
2953
|
name: body.name,
|
|
2971
2954
|
description: body.description,
|
|
@@ -2989,7 +2972,7 @@ app12.openapi(
|
|
|
2989
2972
|
operationId: "update-external-agent",
|
|
2990
2973
|
tags: ["CRUD External Agents"],
|
|
2991
2974
|
request: {
|
|
2992
|
-
params:
|
|
2975
|
+
params: TenantProjectGraphIdParamsSchema,
|
|
2993
2976
|
body: {
|
|
2994
2977
|
content: {
|
|
2995
2978
|
"application/json": {
|
|
@@ -3011,10 +2994,10 @@ app12.openapi(
|
|
|
3011
2994
|
}
|
|
3012
2995
|
}),
|
|
3013
2996
|
async (c) => {
|
|
3014
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
2997
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
3015
2998
|
const body = c.req.valid("json");
|
|
3016
2999
|
const updatedExternalAgent = await updateExternalAgent(dbClient_default)({
|
|
3017
|
-
scopes: { tenantId, projectId },
|
|
3000
|
+
scopes: { tenantId, projectId, graphId },
|
|
3018
3001
|
agentId: id,
|
|
3019
3002
|
data: body
|
|
3020
3003
|
});
|
|
@@ -3039,7 +3022,7 @@ app12.openapi(
|
|
|
3039
3022
|
operationId: "delete-external-agent",
|
|
3040
3023
|
tags: ["CRUD External Agents"],
|
|
3041
3024
|
request: {
|
|
3042
|
-
params:
|
|
3025
|
+
params: TenantProjectGraphIdParamsSchema
|
|
3043
3026
|
},
|
|
3044
3027
|
responses: {
|
|
3045
3028
|
204: {
|
|
@@ -3056,9 +3039,9 @@ app12.openapi(
|
|
|
3056
3039
|
}
|
|
3057
3040
|
}),
|
|
3058
3041
|
async (c) => {
|
|
3059
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
3042
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
3060
3043
|
const deleted = await deleteExternalAgent(dbClient_default)({
|
|
3061
|
-
scopes: { tenantId, projectId },
|
|
3044
|
+
scopes: { tenantId, projectId, graphId },
|
|
3062
3045
|
agentId: id
|
|
3063
3046
|
});
|
|
3064
3047
|
if (!deleted) {
|
|
@@ -3166,8 +3149,7 @@ app13.openapi(
|
|
|
3166
3149
|
dbClient_default,
|
|
3167
3150
|
logger3
|
|
3168
3151
|
)({
|
|
3169
|
-
scopes: { tenantId, projectId }
|
|
3170
|
-
graphId
|
|
3152
|
+
scopes: { tenantId, projectId, graphId }
|
|
3171
3153
|
});
|
|
3172
3154
|
if (!graph) {
|
|
3173
3155
|
throw createApiError({
|
|
@@ -3243,8 +3225,7 @@ app13.openapi(
|
|
|
3243
3225
|
dbClient_default,
|
|
3244
3226
|
logger3
|
|
3245
3227
|
)({
|
|
3246
|
-
scopes: { tenantId, projectId }
|
|
3247
|
-
graphId
|
|
3228
|
+
scopes: { tenantId, projectId, graphId }
|
|
3248
3229
|
});
|
|
3249
3230
|
const isCreate = !existingGraph;
|
|
3250
3231
|
const updatedGraph = isCreate ? await createFullGraphServerSide(dbClient_default, logger3)(
|
|
@@ -3300,8 +3281,7 @@ app13.openapi(
|
|
|
3300
3281
|
dbClient_default,
|
|
3301
3282
|
logger3
|
|
3302
3283
|
)({
|
|
3303
|
-
scopes: { tenantId, projectId }
|
|
3304
|
-
graphId
|
|
3284
|
+
scopes: { tenantId, projectId, graphId }
|
|
3305
3285
|
});
|
|
3306
3286
|
if (!deleted) {
|
|
3307
3287
|
throw createApiError({
|
|
@@ -4700,17 +4680,17 @@ var tools_default = app15;
|
|
|
4700
4680
|
// src/routes/index.ts
|
|
4701
4681
|
var app16 = new OpenAPIHono();
|
|
4702
4682
|
app16.route("/projects", projects_default);
|
|
4703
|
-
app16.route("/projects/:projectId/agents", agents_default);
|
|
4704
|
-
app16.route("/projects/:projectId/agent-relations", agentRelations_default);
|
|
4683
|
+
app16.route("/projects/:projectId/graphs/:graphId/agents", agents_default);
|
|
4684
|
+
app16.route("/projects/:projectId/graphs/:graphId/agent-relations", agentRelations_default);
|
|
4705
4685
|
app16.route("/projects/:projectId/agent-graphs", agentGraph_default);
|
|
4706
|
-
app16.route("/projects/:projectId/agent-tool-relations", agentToolRelations_default);
|
|
4707
|
-
app16.route("/projects/:projectId/agent-artifact-components", agentArtifactComponents_default);
|
|
4708
|
-
app16.route("/projects/:projectId/agent-data-components", agentDataComponents_default);
|
|
4686
|
+
app16.route("/projects/:projectId/graphs/:graphId/agent-tool-relations", agentToolRelations_default);
|
|
4687
|
+
app16.route("/projects/:projectId/graphs/:graphId/agent-artifact-components", agentArtifactComponents_default);
|
|
4688
|
+
app16.route("/projects/:projectId/graphs/:graphId/agent-data-components", agentDataComponents_default);
|
|
4709
4689
|
app16.route("/projects/:projectId/artifact-components", artifactComponents_default);
|
|
4710
4690
|
app16.route("/projects/:projectId/context-configs", contextConfigs_default);
|
|
4711
4691
|
app16.route("/projects/:projectId/credentials", credentials_default);
|
|
4712
4692
|
app16.route("/projects/:projectId/data-components", dataComponents_default);
|
|
4713
|
-
app16.route("/projects/:projectId/external-agents", externalAgents_default);
|
|
4693
|
+
app16.route("/projects/:projectId/graphs/:graphId/external-agents", externalAgents_default);
|
|
4714
4694
|
app16.route("/projects/:projectId/tools", tools_default);
|
|
4715
4695
|
app16.route("/projects/:projectId/api-keys", apiKeys_default);
|
|
4716
4696
|
app16.route("/projects/:projectId/graph", graphFull_default);
|
|
@@ -4993,8 +4973,7 @@ app18.openapi(
|
|
|
4993
4973
|
dbClient_default,
|
|
4994
4974
|
logger8
|
|
4995
4975
|
)({
|
|
4996
|
-
scopes: { tenantId, projectId }
|
|
4997
|
-
projectId
|
|
4976
|
+
scopes: { tenantId, projectId }
|
|
4998
4977
|
});
|
|
4999
4978
|
if (!project) {
|
|
5000
4979
|
throw createApiError({
|
|
@@ -5070,8 +5049,7 @@ app18.openapi(
|
|
|
5070
5049
|
dbClient_default,
|
|
5071
5050
|
logger8
|
|
5072
5051
|
)({
|
|
5073
|
-
scopes: { tenantId, projectId }
|
|
5074
|
-
projectId
|
|
5052
|
+
scopes: { tenantId, projectId }
|
|
5075
5053
|
});
|
|
5076
5054
|
const isCreate = !existingProject;
|
|
5077
5055
|
const updatedProject = isCreate ? await createFullProjectServerSide(dbClient_default, logger8)(
|
|
@@ -5127,8 +5105,7 @@ app18.openapi(
|
|
|
5127
5105
|
dbClient_default,
|
|
5128
5106
|
logger8
|
|
5129
5107
|
)({
|
|
5130
|
-
scopes: { tenantId, projectId }
|
|
5131
|
-
projectId
|
|
5108
|
+
scopes: { tenantId, projectId }
|
|
5132
5109
|
});
|
|
5133
5110
|
if (!deleted) {
|
|
5134
5111
|
throw createApiError({
|