@inkeep/agents-manage-api 0.2.1 → 0.3.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 +224 -291
- package/dist/index.js +225 -268
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -11,64 +11,20 @@ var requestId = require('hono/request-id');
|
|
|
11
11
|
var honoPino = require('hono-pino');
|
|
12
12
|
var async_hooks = require('async_hooks');
|
|
13
13
|
var pino = require('pino');
|
|
14
|
-
var fs = require('fs');
|
|
15
|
-
var path = require('path');
|
|
16
|
-
var dotenv = require('dotenv');
|
|
17
14
|
var zod = require('zod');
|
|
18
15
|
var factory = require('hono/factory');
|
|
19
16
|
var swaggerUi = require('@hono/swagger-ui');
|
|
20
17
|
var nanoid = require('nanoid');
|
|
21
18
|
|
|
22
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
-
|
|
24
|
-
function _interopNamespace(e) {
|
|
25
|
-
if (e && e.__esModule) return e;
|
|
26
|
-
var n = Object.create(null);
|
|
27
|
-
if (e) {
|
|
28
|
-
Object.keys(e).forEach(function (k) {
|
|
29
|
-
if (k !== 'default') {
|
|
30
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
31
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () { return e[k]; }
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
n.default = e;
|
|
39
|
-
return Object.freeze(n);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
43
|
-
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
44
|
-
var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
|
|
45
|
-
|
|
46
19
|
var __defProp = Object.defineProperty;
|
|
47
20
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
48
21
|
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
49
|
-
|
|
50
|
-
zod.z.enum(["development", "production"]).default("development");
|
|
51
|
-
var environmentSchema = zod.z.enum(["development", "pentest", "production", "test"]);
|
|
52
|
-
var criticalEnv = zod.z.object({
|
|
53
|
-
ENVIRONMENT: environmentSchema
|
|
54
|
-
}).parse(process.env);
|
|
55
|
-
var loadEnvFile = () => {
|
|
56
|
-
const envPath = path__default.default.resolve(process.cwd(), `.env.${criticalEnv.ENVIRONMENT}.nonsecret`);
|
|
57
|
-
if (fs__default.default.existsSync(envPath)) {
|
|
58
|
-
const envConfig = dotenv__namespace.parse(fs__default.default.readFileSync(envPath));
|
|
59
|
-
for (const k in envConfig) {
|
|
60
|
-
if (!(k in process.env)) {
|
|
61
|
-
process.env[k] = envConfig[k];
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
loadEnvFile();
|
|
22
|
+
agentsCore.loadEnvironmentFiles();
|
|
67
23
|
var envSchema = zod.z.object({
|
|
68
24
|
NODE_ENV: zod.z.enum(["development", "production", "test"]).optional(),
|
|
69
25
|
ENVIRONMENT: zod.z.enum(["development", "production", "pentest", "test"]).optional(),
|
|
70
26
|
AGENTS_MANAGE_API_URL: zod.z.string().optional().default("http://localhost:3002"),
|
|
71
|
-
DB_FILE_NAME: zod.z.string()
|
|
27
|
+
DB_FILE_NAME: zod.z.string(),
|
|
72
28
|
LOG_LEVEL: zod.z.enum(["trace", "debug", "info", "warn", "error"]).optional().default("debug"),
|
|
73
29
|
NANGO_SECRET_KEY: zod.z.string().optional(),
|
|
74
30
|
INKEEP_AGENTS_MANAGE_API_BYPASS_SECRET: zod.z.string().optional()
|
|
@@ -194,9 +150,9 @@ app.openapi(
|
|
|
194
150
|
path: "/agent/:agentId",
|
|
195
151
|
summary: "Get Artifact Components for Agent",
|
|
196
152
|
operationId: "get-artifact-components-for-agent",
|
|
197
|
-
tags: ["
|
|
153
|
+
tags: ["Agent Artifact Component Relations"],
|
|
198
154
|
request: {
|
|
199
|
-
params: agentsCore.
|
|
155
|
+
params: agentsCore.TenantProjectGraphParamsSchema.extend({
|
|
200
156
|
agentId: zod.z.string()
|
|
201
157
|
})
|
|
202
158
|
},
|
|
@@ -215,10 +171,9 @@ app.openapi(
|
|
|
215
171
|
}
|
|
216
172
|
}),
|
|
217
173
|
async (c) => {
|
|
218
|
-
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
174
|
+
const { tenantId, projectId, graphId, agentId } = c.req.valid("param");
|
|
219
175
|
const artifactComponents = await agentsCore.getArtifactComponentsForAgent(dbClient_default)({
|
|
220
|
-
scopes: { tenantId, projectId }
|
|
221
|
-
agentId
|
|
176
|
+
scopes: { tenantId, projectId, graphId, agentId }
|
|
222
177
|
});
|
|
223
178
|
return c.json({
|
|
224
179
|
data: artifactComponents
|
|
@@ -231,9 +186,9 @@ app.openapi(
|
|
|
231
186
|
path: "/component/:artifactComponentId/agents",
|
|
232
187
|
summary: "Get Agents Using Artifact Component",
|
|
233
188
|
operationId: "get-agents-using-artifact-component",
|
|
234
|
-
tags: ["
|
|
189
|
+
tags: ["Agent Artifact Component Relations"],
|
|
235
190
|
request: {
|
|
236
|
-
params: agentsCore.
|
|
191
|
+
params: agentsCore.TenantProjectGraphParamsSchema.extend({
|
|
237
192
|
artifactComponentId: zod.z.string()
|
|
238
193
|
})
|
|
239
194
|
},
|
|
@@ -271,9 +226,9 @@ app.openapi(
|
|
|
271
226
|
path: "/",
|
|
272
227
|
summary: "Associate Artifact Component with Agent",
|
|
273
228
|
operationId: "associate-artifact-component-with-agent",
|
|
274
|
-
tags: ["
|
|
229
|
+
tags: ["Agent Artifact Component Relations"],
|
|
275
230
|
request: {
|
|
276
|
-
params: agentsCore.
|
|
231
|
+
params: agentsCore.TenantProjectGraphParamsSchema,
|
|
277
232
|
body: {
|
|
278
233
|
content: {
|
|
279
234
|
"application/json": {
|
|
@@ -303,9 +258,12 @@ app.openapi(
|
|
|
303
258
|
}
|
|
304
259
|
}),
|
|
305
260
|
async (c) => {
|
|
306
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
261
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
307
262
|
const { agentId, artifactComponentId } = c.req.valid("json");
|
|
308
|
-
const agent = await agentsCore.getAgentById(dbClient_default)({
|
|
263
|
+
const agent = await agentsCore.getAgentById(dbClient_default)({
|
|
264
|
+
scopes: { tenantId, projectId, graphId },
|
|
265
|
+
agentId
|
|
266
|
+
});
|
|
309
267
|
const artifactComponent = await agentsCore.getArtifactComponentById(dbClient_default)({
|
|
310
268
|
scopes: { tenantId, projectId },
|
|
311
269
|
id: artifactComponentId
|
|
@@ -323,8 +281,7 @@ app.openapi(
|
|
|
323
281
|
});
|
|
324
282
|
}
|
|
325
283
|
const exists = await agentsCore.isArtifactComponentAssociatedWithAgent(dbClient_default)({
|
|
326
|
-
scopes: { tenantId, projectId },
|
|
327
|
-
agentId,
|
|
284
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
328
285
|
artifactComponentId
|
|
329
286
|
});
|
|
330
287
|
if (exists) {
|
|
@@ -334,8 +291,7 @@ app.openapi(
|
|
|
334
291
|
});
|
|
335
292
|
}
|
|
336
293
|
const association = await agentsCore.associateArtifactComponentWithAgent(dbClient_default)({
|
|
337
|
-
scopes: { tenantId, projectId },
|
|
338
|
-
agentId,
|
|
294
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
339
295
|
artifactComponentId
|
|
340
296
|
});
|
|
341
297
|
return c.json({ data: association }, 201);
|
|
@@ -347,9 +303,9 @@ app.openapi(
|
|
|
347
303
|
path: "/agent/:agentId/component/:artifactComponentId",
|
|
348
304
|
summary: "Remove Artifact Component from Agent",
|
|
349
305
|
operationId: "remove-artifact-component-from-agent",
|
|
350
|
-
tags: ["
|
|
306
|
+
tags: ["Agent Artifact Component Relations"],
|
|
351
307
|
request: {
|
|
352
|
-
params: agentsCore.
|
|
308
|
+
params: agentsCore.TenantProjectGraphParamsSchema.extend({
|
|
353
309
|
agentId: zod.z.string(),
|
|
354
310
|
artifactComponentId: zod.z.string()
|
|
355
311
|
})
|
|
@@ -367,10 +323,9 @@ app.openapi(
|
|
|
367
323
|
}
|
|
368
324
|
}),
|
|
369
325
|
async (c) => {
|
|
370
|
-
const { tenantId, projectId, agentId, artifactComponentId } = c.req.valid("param");
|
|
326
|
+
const { tenantId, projectId, graphId, agentId, artifactComponentId } = c.req.valid("param");
|
|
371
327
|
const removed = await agentsCore.removeArtifactComponentFromAgent(dbClient_default)({
|
|
372
|
-
scopes: { tenantId, projectId },
|
|
373
|
-
agentId,
|
|
328
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
374
329
|
artifactComponentId
|
|
375
330
|
});
|
|
376
331
|
if (!removed) {
|
|
@@ -391,9 +346,9 @@ app.openapi(
|
|
|
391
346
|
path: "/agent/:agentId/component/:artifactComponentId/exists",
|
|
392
347
|
summary: "Check if Artifact Component is Associated with Agent",
|
|
393
348
|
operationId: "check-artifact-component-agent-association",
|
|
394
|
-
tags: ["
|
|
349
|
+
tags: ["Agent Artifact Component Relations"],
|
|
395
350
|
request: {
|
|
396
|
-
params: agentsCore.
|
|
351
|
+
params: agentsCore.TenantProjectGraphParamsSchema.extend({
|
|
397
352
|
agentId: zod.z.string(),
|
|
398
353
|
artifactComponentId: zod.z.string()
|
|
399
354
|
})
|
|
@@ -411,10 +366,9 @@ app.openapi(
|
|
|
411
366
|
}
|
|
412
367
|
}),
|
|
413
368
|
async (c) => {
|
|
414
|
-
const { tenantId, projectId, agentId, artifactComponentId } = c.req.valid("param");
|
|
369
|
+
const { tenantId, projectId, graphId, agentId, artifactComponentId } = c.req.valid("param");
|
|
415
370
|
const exists = await agentsCore.isArtifactComponentAssociatedWithAgent(dbClient_default)({
|
|
416
|
-
scopes: { tenantId, projectId },
|
|
417
|
-
agentId,
|
|
371
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
418
372
|
artifactComponentId
|
|
419
373
|
});
|
|
420
374
|
return c.json({ exists });
|
|
@@ -428,9 +382,9 @@ app2.openapi(
|
|
|
428
382
|
path: "/agent/:agentId",
|
|
429
383
|
summary: "Get Data Components for Agent",
|
|
430
384
|
operationId: "get-data-components-for-agent",
|
|
431
|
-
tags: ["
|
|
385
|
+
tags: ["Agent Data Component Relations"],
|
|
432
386
|
request: {
|
|
433
|
-
params: agentsCore.
|
|
387
|
+
params: agentsCore.TenantProjectGraphParamsSchema.extend({
|
|
434
388
|
agentId: zod.z.string()
|
|
435
389
|
})
|
|
436
390
|
},
|
|
@@ -449,10 +403,9 @@ app2.openapi(
|
|
|
449
403
|
}
|
|
450
404
|
}),
|
|
451
405
|
async (c) => {
|
|
452
|
-
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
406
|
+
const { tenantId, projectId, graphId, agentId } = c.req.valid("param");
|
|
453
407
|
const dataComponents = await agentsCore.getDataComponentsForAgent(dbClient_default)({
|
|
454
|
-
scopes: { tenantId, projectId }
|
|
455
|
-
agentId
|
|
408
|
+
scopes: { tenantId, projectId, graphId, agentId }
|
|
456
409
|
});
|
|
457
410
|
return c.json({ data: dataComponents });
|
|
458
411
|
}
|
|
@@ -463,9 +416,9 @@ app2.openapi(
|
|
|
463
416
|
path: "/component/:dataComponentId/agents",
|
|
464
417
|
summary: "Get Agents Using Data Component",
|
|
465
418
|
operationId: "get-agents-using-data-component",
|
|
466
|
-
tags: ["
|
|
419
|
+
tags: ["Agent Data Component Relations"],
|
|
467
420
|
request: {
|
|
468
|
-
params: agentsCore.
|
|
421
|
+
params: agentsCore.TenantProjectGraphParamsSchema.extend({
|
|
469
422
|
dataComponentId: zod.z.string()
|
|
470
423
|
})
|
|
471
424
|
},
|
|
@@ -503,9 +456,9 @@ app2.openapi(
|
|
|
503
456
|
path: "/",
|
|
504
457
|
summary: "Associate Data Component with Agent",
|
|
505
458
|
operationId: "associate-data-component-with-agent",
|
|
506
|
-
tags: ["
|
|
459
|
+
tags: ["Agent Data Component Relations"],
|
|
507
460
|
request: {
|
|
508
|
-
params: agentsCore.
|
|
461
|
+
params: agentsCore.TenantProjectGraphParamsSchema,
|
|
509
462
|
body: {
|
|
510
463
|
content: {
|
|
511
464
|
"application/json": {
|
|
@@ -535,10 +488,10 @@ app2.openapi(
|
|
|
535
488
|
}
|
|
536
489
|
}),
|
|
537
490
|
async (c) => {
|
|
538
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
491
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
539
492
|
const { agentId, dataComponentId } = c.req.valid("json");
|
|
540
493
|
const [agent, dataComponent] = await Promise.all([
|
|
541
|
-
agentsCore.getAgentById(dbClient_default)({ scopes: { tenantId, projectId }, agentId }),
|
|
494
|
+
agentsCore.getAgentById(dbClient_default)({ scopes: { tenantId, projectId, graphId }, agentId }),
|
|
542
495
|
agentsCore.getDataComponent(dbClient_default)({ scopes: { tenantId, projectId }, dataComponentId })
|
|
543
496
|
]);
|
|
544
497
|
if (!agent) {
|
|
@@ -554,8 +507,7 @@ app2.openapi(
|
|
|
554
507
|
});
|
|
555
508
|
}
|
|
556
509
|
const exists = await agentsCore.isDataComponentAssociatedWithAgent(dbClient_default)({
|
|
557
|
-
scopes: { tenantId, projectId },
|
|
558
|
-
agentId,
|
|
510
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
559
511
|
dataComponentId
|
|
560
512
|
});
|
|
561
513
|
if (exists) {
|
|
@@ -565,8 +517,7 @@ app2.openapi(
|
|
|
565
517
|
});
|
|
566
518
|
}
|
|
567
519
|
const association = await agentsCore.associateDataComponentWithAgent(dbClient_default)({
|
|
568
|
-
scopes: { tenantId, projectId },
|
|
569
|
-
agentId,
|
|
520
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
570
521
|
dataComponentId
|
|
571
522
|
});
|
|
572
523
|
return c.json({ data: association }, 201);
|
|
@@ -578,9 +529,9 @@ app2.openapi(
|
|
|
578
529
|
path: "/agent/:agentId/component/:dataComponentId",
|
|
579
530
|
summary: "Remove Data Component from Agent",
|
|
580
531
|
operationId: "remove-data-component-from-agent",
|
|
581
|
-
tags: ["
|
|
532
|
+
tags: ["Agent Data Component Relations"],
|
|
582
533
|
request: {
|
|
583
|
-
params: agentsCore.
|
|
534
|
+
params: agentsCore.TenantProjectGraphParamsSchema.extend({
|
|
584
535
|
agentId: zod.z.string(),
|
|
585
536
|
dataComponentId: zod.z.string()
|
|
586
537
|
})
|
|
@@ -598,10 +549,9 @@ app2.openapi(
|
|
|
598
549
|
}
|
|
599
550
|
}),
|
|
600
551
|
async (c) => {
|
|
601
|
-
const { tenantId, projectId, agentId, dataComponentId } = c.req.valid("param");
|
|
552
|
+
const { tenantId, projectId, graphId, agentId, dataComponentId } = c.req.valid("param");
|
|
602
553
|
const removed = await agentsCore.removeDataComponentFromAgent(dbClient_default)({
|
|
603
|
-
scopes: { tenantId, projectId },
|
|
604
|
-
agentId,
|
|
554
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
605
555
|
dataComponentId
|
|
606
556
|
});
|
|
607
557
|
if (!removed) {
|
|
@@ -622,9 +572,9 @@ app2.openapi(
|
|
|
622
572
|
path: "/agent/:agentId/component/:dataComponentId/exists",
|
|
623
573
|
summary: "Check if Data Component is Associated with Agent",
|
|
624
574
|
operationId: "check-data-component-agent-association",
|
|
625
|
-
tags: ["
|
|
575
|
+
tags: ["Agent Data Component Relations"],
|
|
626
576
|
request: {
|
|
627
|
-
params: agentsCore.
|
|
577
|
+
params: agentsCore.TenantProjectGraphParamsSchema.extend({
|
|
628
578
|
agentId: zod.z.string(),
|
|
629
579
|
dataComponentId: zod.z.string()
|
|
630
580
|
})
|
|
@@ -642,10 +592,9 @@ app2.openapi(
|
|
|
642
592
|
}
|
|
643
593
|
}),
|
|
644
594
|
async (c) => {
|
|
645
|
-
const { tenantId, projectId, agentId, dataComponentId } = c.req.valid("param");
|
|
595
|
+
const { tenantId, projectId, graphId, agentId, dataComponentId } = c.req.valid("param");
|
|
646
596
|
const exists = await agentsCore.isDataComponentAssociatedWithAgent(dbClient_default)({
|
|
647
|
-
scopes: { tenantId, projectId },
|
|
648
|
-
agentId,
|
|
597
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
649
598
|
dataComponentId
|
|
650
599
|
});
|
|
651
600
|
return c.json({ exists });
|
|
@@ -659,7 +608,7 @@ app3.openapi(
|
|
|
659
608
|
path: "/",
|
|
660
609
|
summary: "List Agent Graphs",
|
|
661
610
|
operationId: "list-agent-graphs",
|
|
662
|
-
tags: ["
|
|
611
|
+
tags: ["Agent Graph"],
|
|
663
612
|
request: {
|
|
664
613
|
params: agentsCore.TenantProjectParamsSchema,
|
|
665
614
|
query: agentsCore.PaginationQueryParamsSchema
|
|
@@ -698,7 +647,7 @@ app3.openapi(
|
|
|
698
647
|
path: "/{id}",
|
|
699
648
|
summary: "Get Agent Graph",
|
|
700
649
|
operationId: "get-agent-graph",
|
|
701
|
-
tags: ["
|
|
650
|
+
tags: ["Agent Graph"],
|
|
702
651
|
request: {
|
|
703
652
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
704
653
|
},
|
|
@@ -716,9 +665,8 @@ app3.openapi(
|
|
|
716
665
|
}),
|
|
717
666
|
async (c) => {
|
|
718
667
|
const { tenantId, projectId, id } = c.req.valid("param");
|
|
719
|
-
const graph = await agentsCore.
|
|
720
|
-
scopes: { tenantId, projectId }
|
|
721
|
-
graphId: id
|
|
668
|
+
const graph = await agentsCore.getAgentGraphById(dbClient_default)({
|
|
669
|
+
scopes: { tenantId, projectId, graphId: id }
|
|
722
670
|
});
|
|
723
671
|
if (!graph) {
|
|
724
672
|
throw agentsCore.createApiError({
|
|
@@ -735,7 +683,7 @@ app3.openapi(
|
|
|
735
683
|
path: "/{graphId}/agents/{agentId}/related",
|
|
736
684
|
summary: "Get Related Agent Infos",
|
|
737
685
|
operationId: "get-related-agent-infos",
|
|
738
|
-
tags: ["
|
|
686
|
+
tags: ["Agent Graph"],
|
|
739
687
|
request: {
|
|
740
688
|
params: agentsCore.TenantProjectParamsSchema.extend({
|
|
741
689
|
graphId: zod.z.string(),
|
|
@@ -784,7 +732,7 @@ app3.openapi(
|
|
|
784
732
|
path: "/{graphId}/full",
|
|
785
733
|
summary: "Get Full Graph Definition",
|
|
786
734
|
operationId: "get-full-graph-definition",
|
|
787
|
-
tags: ["
|
|
735
|
+
tags: ["Agent Graph"],
|
|
788
736
|
request: {
|
|
789
737
|
params: agentsCore.TenantProjectParamsSchema.extend({
|
|
790
738
|
graphId: zod.z.string()
|
|
@@ -805,8 +753,7 @@ app3.openapi(
|
|
|
805
753
|
async (c) => {
|
|
806
754
|
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
807
755
|
const fullGraph = await agentsCore.getFullGraphDefinition(dbClient_default)({
|
|
808
|
-
scopes: { tenantId, projectId }
|
|
809
|
-
graphId
|
|
756
|
+
scopes: { tenantId, projectId, graphId }
|
|
810
757
|
});
|
|
811
758
|
if (!fullGraph) {
|
|
812
759
|
throw agentsCore.createApiError({
|
|
@@ -823,7 +770,7 @@ app3.openapi(
|
|
|
823
770
|
path: "/",
|
|
824
771
|
summary: "Create Agent Graph",
|
|
825
772
|
operationId: "create-agent-graph",
|
|
826
|
-
tags: ["
|
|
773
|
+
tags: ["Agent Graph"],
|
|
827
774
|
request: {
|
|
828
775
|
params: agentsCore.TenantProjectParamsSchema,
|
|
829
776
|
body: {
|
|
@@ -866,7 +813,7 @@ app3.openapi(
|
|
|
866
813
|
path: "/{id}",
|
|
867
814
|
summary: "Update Agent Graph",
|
|
868
815
|
operationId: "update-agent-graph",
|
|
869
|
-
tags: ["
|
|
816
|
+
tags: ["Agent Graph"],
|
|
870
817
|
request: {
|
|
871
818
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema),
|
|
872
819
|
body: {
|
|
@@ -893,8 +840,7 @@ app3.openapi(
|
|
|
893
840
|
const { tenantId, projectId, id } = c.req.valid("param");
|
|
894
841
|
const validatedBody = c.req.valid("json");
|
|
895
842
|
const updatedGraph = await agentsCore.updateAgentGraph(dbClient_default)({
|
|
896
|
-
scopes: { tenantId, projectId },
|
|
897
|
-
graphId: id,
|
|
843
|
+
scopes: { tenantId, projectId, graphId: id },
|
|
898
844
|
data: {
|
|
899
845
|
defaultAgentId: validatedBody.defaultAgentId,
|
|
900
846
|
contextConfigId: validatedBody.contextConfigId ?? void 0
|
|
@@ -915,7 +861,7 @@ app3.openapi(
|
|
|
915
861
|
path: "/{id}",
|
|
916
862
|
summary: "Delete Agent Graph",
|
|
917
863
|
operationId: "delete-agent-graph",
|
|
918
|
-
tags: ["
|
|
864
|
+
tags: ["Agent Graph"],
|
|
919
865
|
request: {
|
|
920
866
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
921
867
|
},
|
|
@@ -936,8 +882,7 @@ app3.openapi(
|
|
|
936
882
|
async (c) => {
|
|
937
883
|
const { tenantId, projectId, id } = c.req.valid("param");
|
|
938
884
|
const deleted = await agentsCore.deleteAgentGraph(dbClient_default)({
|
|
939
|
-
scopes: { tenantId, projectId }
|
|
940
|
-
graphId: id
|
|
885
|
+
scopes: { tenantId, projectId, graphId: id }
|
|
941
886
|
});
|
|
942
887
|
if (!deleted) {
|
|
943
888
|
throw agentsCore.createApiError({
|
|
@@ -956,9 +901,9 @@ app4.openapi(
|
|
|
956
901
|
path: "/",
|
|
957
902
|
summary: "List Agent Relations",
|
|
958
903
|
operationId: "list-agent-relations",
|
|
959
|
-
tags: ["
|
|
904
|
+
tags: ["Agent Relations"],
|
|
960
905
|
request: {
|
|
961
|
-
params: agentsCore.
|
|
906
|
+
params: agentsCore.TenantProjectGraphParamsSchema,
|
|
962
907
|
query: agentsCore.PaginationQueryParamsSchema.merge(agentsCore.AgentRelationQuerySchema)
|
|
963
908
|
},
|
|
964
909
|
responses: {
|
|
@@ -974,7 +919,7 @@ app4.openapi(
|
|
|
974
919
|
}
|
|
975
920
|
}),
|
|
976
921
|
async (c) => {
|
|
977
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
922
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
978
923
|
const {
|
|
979
924
|
page = 1,
|
|
980
925
|
limit = 10,
|
|
@@ -988,28 +933,28 @@ app4.openapi(
|
|
|
988
933
|
let result;
|
|
989
934
|
if (sourceAgentId) {
|
|
990
935
|
const rawResult = await agentsCore.getAgentRelationsBySource(dbClient_default)({
|
|
991
|
-
scopes: { tenantId, projectId },
|
|
936
|
+
scopes: { tenantId, projectId, graphId },
|
|
992
937
|
sourceAgentId,
|
|
993
938
|
pagination: { page: pageNum, limit: limitNum }
|
|
994
939
|
});
|
|
995
940
|
result = { ...rawResult, data: rawResult.data };
|
|
996
941
|
} else if (targetAgentId) {
|
|
997
942
|
const rawResult = await agentsCore.getAgentRelationsByTarget(dbClient_default)({
|
|
998
|
-
scopes: { tenantId, projectId },
|
|
943
|
+
scopes: { tenantId, projectId, graphId },
|
|
999
944
|
targetAgentId,
|
|
1000
945
|
pagination: { page: pageNum, limit: limitNum }
|
|
1001
946
|
});
|
|
1002
947
|
result = { ...rawResult, data: rawResult.data };
|
|
1003
948
|
} else if (externalAgentId) {
|
|
1004
949
|
const rawResult = await agentsCore.getExternalAgentRelations(dbClient_default)({
|
|
1005
|
-
scopes: { tenantId, projectId },
|
|
950
|
+
scopes: { tenantId, projectId, graphId },
|
|
1006
951
|
externalAgentId,
|
|
1007
952
|
pagination: { page: pageNum, limit: limitNum }
|
|
1008
953
|
});
|
|
1009
954
|
result = { ...rawResult, data: rawResult.data };
|
|
1010
955
|
} else {
|
|
1011
956
|
const rawResult = await agentsCore.listAgentRelations(dbClient_default)({
|
|
1012
|
-
scopes: { tenantId, projectId },
|
|
957
|
+
scopes: { tenantId, projectId, graphId },
|
|
1013
958
|
pagination: { page: pageNum, limit: limitNum }
|
|
1014
959
|
});
|
|
1015
960
|
result = { ...rawResult, data: rawResult.data };
|
|
@@ -1029,9 +974,9 @@ app4.openapi(
|
|
|
1029
974
|
path: "/{id}",
|
|
1030
975
|
summary: "Get Agent Relation",
|
|
1031
976
|
operationId: "get-agent-relation-by-id",
|
|
1032
|
-
tags: ["
|
|
977
|
+
tags: ["Agent Relations"],
|
|
1033
978
|
request: {
|
|
1034
|
-
params: agentsCore.
|
|
979
|
+
params: agentsCore.TenantProjectGraphIdParamsSchema
|
|
1035
980
|
},
|
|
1036
981
|
responses: {
|
|
1037
982
|
200: {
|
|
@@ -1046,9 +991,9 @@ app4.openapi(
|
|
|
1046
991
|
}
|
|
1047
992
|
}),
|
|
1048
993
|
async (c) => {
|
|
1049
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
994
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1050
995
|
const agentRelation = await agentsCore.getAgentRelationById(dbClient_default)({
|
|
1051
|
-
scopes: { tenantId, projectId },
|
|
996
|
+
scopes: { tenantId, projectId, graphId },
|
|
1052
997
|
relationId: id
|
|
1053
998
|
});
|
|
1054
999
|
if (!agentRelation) {
|
|
@@ -1066,9 +1011,9 @@ app4.openapi(
|
|
|
1066
1011
|
path: "/",
|
|
1067
1012
|
summary: "Create Agent Relation",
|
|
1068
1013
|
operationId: "create-agent-relation",
|
|
1069
|
-
tags: ["
|
|
1014
|
+
tags: ["Agent Relations"],
|
|
1070
1015
|
request: {
|
|
1071
|
-
params: agentsCore.
|
|
1016
|
+
params: agentsCore.TenantProjectGraphParamsSchema,
|
|
1072
1017
|
body: {
|
|
1073
1018
|
content: {
|
|
1074
1019
|
"application/json": {
|
|
@@ -1090,13 +1035,12 @@ app4.openapi(
|
|
|
1090
1035
|
}
|
|
1091
1036
|
}),
|
|
1092
1037
|
async (c) => {
|
|
1093
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
1038
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
1094
1039
|
const body = await c.req.valid("json");
|
|
1095
1040
|
const isExternalAgent = body.externalAgentId != null;
|
|
1096
1041
|
if (isExternalAgent && body.externalAgentId) {
|
|
1097
1042
|
const externalAgentExists = await agentsCore.validateExternalAgent(dbClient_default)({
|
|
1098
|
-
scopes: { tenantId, projectId }
|
|
1099
|
-
agentId: body.externalAgentId
|
|
1043
|
+
scopes: { tenantId, projectId, graphId, agentId: body.externalAgentId }
|
|
1100
1044
|
});
|
|
1101
1045
|
if (!externalAgentExists) {
|
|
1102
1046
|
throw agentsCore.createApiError({
|
|
@@ -1107,8 +1051,7 @@ app4.openapi(
|
|
|
1107
1051
|
}
|
|
1108
1052
|
if (!isExternalAgent && body.targetAgentId) {
|
|
1109
1053
|
const internalAgentExists = await agentsCore.validateInternalAgent(dbClient_default)({
|
|
1110
|
-
scopes: { tenantId, projectId }
|
|
1111
|
-
agentId: body.targetAgentId
|
|
1054
|
+
scopes: { tenantId, projectId, graphId, agentId: body.targetAgentId }
|
|
1112
1055
|
});
|
|
1113
1056
|
if (!internalAgentExists) {
|
|
1114
1057
|
throw agentsCore.createApiError({
|
|
@@ -1118,11 +1061,11 @@ app4.openapi(
|
|
|
1118
1061
|
}
|
|
1119
1062
|
}
|
|
1120
1063
|
const existingRelations = await agentsCore.listAgentRelations(dbClient_default)({
|
|
1121
|
-
scopes: { tenantId, projectId },
|
|
1064
|
+
scopes: { tenantId, projectId, graphId },
|
|
1122
1065
|
pagination: { page: 1, limit: 1e3 }
|
|
1123
1066
|
});
|
|
1124
1067
|
const isDuplicate = existingRelations.data.some((relation) => {
|
|
1125
|
-
if (relation.graphId !==
|
|
1068
|
+
if (relation.graphId !== graphId || relation.sourceAgentId !== body.sourceAgentId) {
|
|
1126
1069
|
return false;
|
|
1127
1070
|
}
|
|
1128
1071
|
if (isExternalAgent) {
|
|
@@ -1138,7 +1081,7 @@ app4.openapi(
|
|
|
1138
1081
|
});
|
|
1139
1082
|
}
|
|
1140
1083
|
const relationData = {
|
|
1141
|
-
graphId
|
|
1084
|
+
graphId,
|
|
1142
1085
|
tenantId,
|
|
1143
1086
|
id: nanoid.nanoid(),
|
|
1144
1087
|
projectId,
|
|
@@ -1159,9 +1102,9 @@ app4.openapi(
|
|
|
1159
1102
|
path: "/{id}",
|
|
1160
1103
|
summary: "Update Agent Relation",
|
|
1161
1104
|
operationId: "update-agent-relation",
|
|
1162
|
-
tags: ["
|
|
1105
|
+
tags: ["Agent Relations"],
|
|
1163
1106
|
request: {
|
|
1164
|
-
params: agentsCore.
|
|
1107
|
+
params: agentsCore.TenantProjectGraphIdParamsSchema,
|
|
1165
1108
|
body: {
|
|
1166
1109
|
content: {
|
|
1167
1110
|
"application/json": {
|
|
@@ -1183,10 +1126,10 @@ app4.openapi(
|
|
|
1183
1126
|
}
|
|
1184
1127
|
}),
|
|
1185
1128
|
async (c) => {
|
|
1186
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1129
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1187
1130
|
const body = await c.req.valid("json");
|
|
1188
1131
|
const updatedAgentRelation = await agentsCore.updateAgentRelation(dbClient_default)({
|
|
1189
|
-
scopes: { tenantId, projectId },
|
|
1132
|
+
scopes: { tenantId, projectId, graphId },
|
|
1190
1133
|
relationId: id,
|
|
1191
1134
|
data: body
|
|
1192
1135
|
});
|
|
@@ -1205,9 +1148,9 @@ app4.openapi(
|
|
|
1205
1148
|
path: "/{id}",
|
|
1206
1149
|
summary: "Delete Agent Relation",
|
|
1207
1150
|
operationId: "delete-agent-relation",
|
|
1208
|
-
tags: ["
|
|
1151
|
+
tags: ["Agent Relations"],
|
|
1209
1152
|
request: {
|
|
1210
|
-
params: agentsCore.
|
|
1153
|
+
params: agentsCore.TenantProjectGraphIdParamsSchema
|
|
1211
1154
|
},
|
|
1212
1155
|
responses: {
|
|
1213
1156
|
204: {
|
|
@@ -1224,9 +1167,9 @@ app4.openapi(
|
|
|
1224
1167
|
}
|
|
1225
1168
|
}),
|
|
1226
1169
|
async (c) => {
|
|
1227
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1170
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1228
1171
|
const deleted = await agentsCore.deleteAgentRelation(dbClient_default)({
|
|
1229
|
-
scopes: { tenantId, projectId },
|
|
1172
|
+
scopes: { tenantId, projectId, graphId },
|
|
1230
1173
|
relationId: id
|
|
1231
1174
|
});
|
|
1232
1175
|
if (!deleted) {
|
|
@@ -1246,9 +1189,9 @@ app5.openapi(
|
|
|
1246
1189
|
path: "/",
|
|
1247
1190
|
summary: "List Agents",
|
|
1248
1191
|
operationId: "list-agents",
|
|
1249
|
-
tags: ["
|
|
1192
|
+
tags: ["Agent"],
|
|
1250
1193
|
request: {
|
|
1251
|
-
params: agentsCore.
|
|
1194
|
+
params: agentsCore.TenantProjectGraphParamsSchema,
|
|
1252
1195
|
query: agentsCore.PaginationQueryParamsSchema
|
|
1253
1196
|
},
|
|
1254
1197
|
responses: {
|
|
@@ -1264,11 +1207,11 @@ app5.openapi(
|
|
|
1264
1207
|
}
|
|
1265
1208
|
}),
|
|
1266
1209
|
async (c) => {
|
|
1267
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
1210
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
1268
1211
|
const page = Number(c.req.query("page")) || 1;
|
|
1269
1212
|
const limit = Math.min(Number(c.req.query("limit")) || 10, 100);
|
|
1270
1213
|
const result = await agentsCore.listAgentsPaginated(dbClient_default)({
|
|
1271
|
-
scopes: { tenantId, projectId },
|
|
1214
|
+
scopes: { tenantId, projectId, graphId },
|
|
1272
1215
|
pagination: { page, limit }
|
|
1273
1216
|
});
|
|
1274
1217
|
const dataWithType = {
|
|
@@ -1287,9 +1230,9 @@ app5.openapi(
|
|
|
1287
1230
|
path: "/{id}",
|
|
1288
1231
|
summary: "Get Agent",
|
|
1289
1232
|
operationId: "get-agent-by-id",
|
|
1290
|
-
tags: ["
|
|
1233
|
+
tags: ["Agent"],
|
|
1291
1234
|
request: {
|
|
1292
|
-
params: agentsCore.
|
|
1235
|
+
params: agentsCore.TenantProjectGraphIdParamsSchema
|
|
1293
1236
|
},
|
|
1294
1237
|
responses: {
|
|
1295
1238
|
200: {
|
|
@@ -1304,9 +1247,9 @@ app5.openapi(
|
|
|
1304
1247
|
}
|
|
1305
1248
|
}),
|
|
1306
1249
|
async (c) => {
|
|
1307
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1250
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1308
1251
|
const agent = await agentsCore.getAgentById(dbClient_default)({
|
|
1309
|
-
scopes: { tenantId, projectId },
|
|
1252
|
+
scopes: { tenantId, projectId, graphId },
|
|
1310
1253
|
agentId: id
|
|
1311
1254
|
});
|
|
1312
1255
|
if (!agent) {
|
|
@@ -1328,9 +1271,9 @@ app5.openapi(
|
|
|
1328
1271
|
path: "/",
|
|
1329
1272
|
summary: "Create Agent",
|
|
1330
1273
|
operationId: "create-agent",
|
|
1331
|
-
tags: ["
|
|
1274
|
+
tags: ["Agent"],
|
|
1332
1275
|
request: {
|
|
1333
|
-
params: agentsCore.
|
|
1276
|
+
params: agentsCore.TenantProjectGraphParamsSchema,
|
|
1334
1277
|
body: {
|
|
1335
1278
|
content: {
|
|
1336
1279
|
"application/json": {
|
|
@@ -1352,14 +1295,15 @@ app5.openapi(
|
|
|
1352
1295
|
}
|
|
1353
1296
|
}),
|
|
1354
1297
|
async (c) => {
|
|
1355
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
1298
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
1356
1299
|
const body = c.req.valid("json");
|
|
1357
1300
|
const agentId = body.id ? String(body.id) : nanoid.nanoid();
|
|
1358
1301
|
const agent = await agentsCore.createAgent(dbClient_default)({
|
|
1359
1302
|
...body,
|
|
1360
1303
|
id: agentId,
|
|
1361
1304
|
tenantId,
|
|
1362
|
-
projectId
|
|
1305
|
+
projectId,
|
|
1306
|
+
graphId
|
|
1363
1307
|
});
|
|
1364
1308
|
const agentWithType = {
|
|
1365
1309
|
...agent,
|
|
@@ -1374,9 +1318,9 @@ app5.openapi(
|
|
|
1374
1318
|
path: "/{id}",
|
|
1375
1319
|
summary: "Update Agent",
|
|
1376
1320
|
operationId: "update-agent",
|
|
1377
|
-
tags: ["
|
|
1321
|
+
tags: ["Agent"],
|
|
1378
1322
|
request: {
|
|
1379
|
-
params: agentsCore.
|
|
1323
|
+
params: agentsCore.TenantProjectGraphIdParamsSchema,
|
|
1380
1324
|
body: {
|
|
1381
1325
|
content: {
|
|
1382
1326
|
"application/json": {
|
|
@@ -1398,10 +1342,10 @@ app5.openapi(
|
|
|
1398
1342
|
}
|
|
1399
1343
|
}),
|
|
1400
1344
|
async (c) => {
|
|
1401
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1345
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1402
1346
|
const body = c.req.valid("json");
|
|
1403
1347
|
const updatedAgent = await agentsCore.updateAgent(dbClient_default)({
|
|
1404
|
-
scopes: { tenantId, projectId },
|
|
1348
|
+
scopes: { tenantId, projectId, graphId },
|
|
1405
1349
|
agentId: id,
|
|
1406
1350
|
data: body
|
|
1407
1351
|
});
|
|
@@ -1424,9 +1368,9 @@ app5.openapi(
|
|
|
1424
1368
|
path: "/{id}",
|
|
1425
1369
|
summary: "Delete Agent",
|
|
1426
1370
|
operationId: "delete-agent",
|
|
1427
|
-
tags: ["
|
|
1371
|
+
tags: ["Agent"],
|
|
1428
1372
|
request: {
|
|
1429
|
-
params: agentsCore.
|
|
1373
|
+
params: agentsCore.TenantProjectGraphIdParamsSchema
|
|
1430
1374
|
},
|
|
1431
1375
|
responses: {
|
|
1432
1376
|
204: {
|
|
@@ -1443,9 +1387,9 @@ app5.openapi(
|
|
|
1443
1387
|
}
|
|
1444
1388
|
}),
|
|
1445
1389
|
async (c) => {
|
|
1446
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1390
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1447
1391
|
const deleted = await agentsCore.deleteAgent(dbClient_default)({
|
|
1448
|
-
scopes: { tenantId, projectId },
|
|
1392
|
+
scopes: { tenantId, projectId, graphId },
|
|
1449
1393
|
agentId: id
|
|
1450
1394
|
});
|
|
1451
1395
|
if (!deleted) {
|
|
@@ -1465,9 +1409,9 @@ app6.openapi(
|
|
|
1465
1409
|
path: "/",
|
|
1466
1410
|
summary: "List Agent Tool Relations",
|
|
1467
1411
|
operationId: "list-agent-tool-relations",
|
|
1468
|
-
tags: ["
|
|
1412
|
+
tags: ["Agent Tool Relations"],
|
|
1469
1413
|
request: {
|
|
1470
|
-
params: agentsCore.
|
|
1414
|
+
params: agentsCore.TenantProjectGraphParamsSchema,
|
|
1471
1415
|
query: agentsCore.PaginationQueryParamsSchema.extend({
|
|
1472
1416
|
agentId: zod.z.string().optional(),
|
|
1473
1417
|
toolId: zod.z.string().optional()
|
|
@@ -1486,13 +1430,12 @@ app6.openapi(
|
|
|
1486
1430
|
}
|
|
1487
1431
|
}),
|
|
1488
1432
|
async (c) => {
|
|
1489
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
1433
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
1490
1434
|
const { page, limit, agentId, toolId } = c.req.valid("query");
|
|
1491
1435
|
let result;
|
|
1492
1436
|
if (agentId) {
|
|
1493
1437
|
const dbResult = await agentsCore.getAgentToolRelationByAgent(dbClient_default)({
|
|
1494
|
-
scopes: { tenantId, projectId },
|
|
1495
|
-
agentId,
|
|
1438
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
1496
1439
|
pagination: { page, limit }
|
|
1497
1440
|
});
|
|
1498
1441
|
result = {
|
|
@@ -1501,7 +1444,7 @@ app6.openapi(
|
|
|
1501
1444
|
};
|
|
1502
1445
|
} else if (toolId) {
|
|
1503
1446
|
const dbResult = await agentsCore.getAgentToolRelationByTool(dbClient_default)({
|
|
1504
|
-
scopes: { tenantId, projectId },
|
|
1447
|
+
scopes: { tenantId, projectId, graphId },
|
|
1505
1448
|
toolId,
|
|
1506
1449
|
pagination: { page, limit }
|
|
1507
1450
|
});
|
|
@@ -1511,7 +1454,7 @@ app6.openapi(
|
|
|
1511
1454
|
};
|
|
1512
1455
|
} else {
|
|
1513
1456
|
const dbResult = await agentsCore.listAgentToolRelations(dbClient_default)({
|
|
1514
|
-
scopes: { tenantId, projectId },
|
|
1457
|
+
scopes: { tenantId, projectId, graphId },
|
|
1515
1458
|
pagination: { page, limit }
|
|
1516
1459
|
});
|
|
1517
1460
|
result = {
|
|
@@ -1528,9 +1471,9 @@ app6.openapi(
|
|
|
1528
1471
|
path: "/{id}",
|
|
1529
1472
|
summary: "Get Agent Tool Relation",
|
|
1530
1473
|
operationId: "get-agent-tool-relation",
|
|
1531
|
-
tags: ["
|
|
1474
|
+
tags: ["Agent Tool Relations"],
|
|
1532
1475
|
request: {
|
|
1533
|
-
params: agentsCore.
|
|
1476
|
+
params: agentsCore.TenantProjectGraphParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
1534
1477
|
},
|
|
1535
1478
|
responses: {
|
|
1536
1479
|
200: {
|
|
@@ -1545,9 +1488,9 @@ app6.openapi(
|
|
|
1545
1488
|
}
|
|
1546
1489
|
}),
|
|
1547
1490
|
async (c) => {
|
|
1548
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1491
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1549
1492
|
const agentToolRelation = await agentsCore.getAgentToolRelationById(dbClient_default)({
|
|
1550
|
-
scopes: { tenantId, projectId },
|
|
1493
|
+
scopes: { tenantId, projectId, graphId, agentId: id },
|
|
1551
1494
|
relationId: id
|
|
1552
1495
|
});
|
|
1553
1496
|
if (!agentToolRelation) {
|
|
@@ -1565,9 +1508,9 @@ app6.openapi(
|
|
|
1565
1508
|
path: "/agent/{agentId}/tools",
|
|
1566
1509
|
summary: "Get Tools for Agent",
|
|
1567
1510
|
operationId: "get-tools-for-agent",
|
|
1568
|
-
tags: ["
|
|
1511
|
+
tags: ["Agent Tool Relations"],
|
|
1569
1512
|
request: {
|
|
1570
|
-
params: agentsCore.
|
|
1513
|
+
params: agentsCore.TenantProjectGraphParamsSchema.extend({
|
|
1571
1514
|
agentId: zod.z.string()
|
|
1572
1515
|
}),
|
|
1573
1516
|
query: agentsCore.PaginationQueryParamsSchema
|
|
@@ -1585,11 +1528,10 @@ app6.openapi(
|
|
|
1585
1528
|
}
|
|
1586
1529
|
}),
|
|
1587
1530
|
async (c) => {
|
|
1588
|
-
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
1531
|
+
const { tenantId, projectId, graphId, agentId } = c.req.valid("param");
|
|
1589
1532
|
const { page, limit } = c.req.valid("query");
|
|
1590
1533
|
const dbResult = await agentsCore.getToolsForAgent(dbClient_default)({
|
|
1591
|
-
scopes: { tenantId, projectId },
|
|
1592
|
-
agentId,
|
|
1534
|
+
scopes: { tenantId, projectId, graphId, agentId },
|
|
1593
1535
|
pagination: { page, limit }
|
|
1594
1536
|
});
|
|
1595
1537
|
const result = {
|
|
@@ -1605,9 +1547,9 @@ app6.openapi(
|
|
|
1605
1547
|
path: "/tool/{toolId}/agents",
|
|
1606
1548
|
summary: "Get Agents for Tool",
|
|
1607
1549
|
operationId: "get-agents-for-tool",
|
|
1608
|
-
tags: ["
|
|
1550
|
+
tags: ["Agent Tool Relations"],
|
|
1609
1551
|
request: {
|
|
1610
|
-
params: agentsCore.
|
|
1552
|
+
params: agentsCore.TenantProjectGraphParamsSchema.extend({
|
|
1611
1553
|
toolId: zod.z.string()
|
|
1612
1554
|
}),
|
|
1613
1555
|
query: agentsCore.PaginationQueryParamsSchema
|
|
@@ -1625,18 +1567,14 @@ app6.openapi(
|
|
|
1625
1567
|
}
|
|
1626
1568
|
}),
|
|
1627
1569
|
async (c) => {
|
|
1628
|
-
const { tenantId, projectId, toolId } = c.req.valid("param");
|
|
1570
|
+
const { tenantId, projectId, graphId, toolId } = c.req.valid("param");
|
|
1629
1571
|
const { page, limit } = c.req.valid("query");
|
|
1630
1572
|
const dbResult = await agentsCore.getAgentsForTool(dbClient_default)({
|
|
1631
|
-
scopes: { tenantId, projectId },
|
|
1573
|
+
scopes: { tenantId, projectId, graphId },
|
|
1632
1574
|
toolId,
|
|
1633
1575
|
pagination: { page, limit }
|
|
1634
1576
|
});
|
|
1635
|
-
|
|
1636
|
-
data: dbResult.data,
|
|
1637
|
-
pagination: dbResult.pagination
|
|
1638
|
-
};
|
|
1639
|
-
return c.json(result);
|
|
1577
|
+
return c.json(dbResult);
|
|
1640
1578
|
}
|
|
1641
1579
|
);
|
|
1642
1580
|
app6.openapi(
|
|
@@ -1645,9 +1583,9 @@ app6.openapi(
|
|
|
1645
1583
|
path: "/",
|
|
1646
1584
|
summary: "Create Agent Tool Relation",
|
|
1647
1585
|
operationId: "create-agent-tool-relation",
|
|
1648
|
-
tags: ["
|
|
1586
|
+
tags: ["Agent Tool Relations"],
|
|
1649
1587
|
request: {
|
|
1650
|
-
params: agentsCore.
|
|
1588
|
+
params: agentsCore.TenantProjectGraphParamsSchema,
|
|
1651
1589
|
body: {
|
|
1652
1590
|
content: {
|
|
1653
1591
|
"application/json": {
|
|
@@ -1669,10 +1607,10 @@ app6.openapi(
|
|
|
1669
1607
|
}
|
|
1670
1608
|
}),
|
|
1671
1609
|
async (c) => {
|
|
1672
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
1610
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
1673
1611
|
const body = c.req.valid("json");
|
|
1674
1612
|
const existingRelations = await agentsCore.listAgentToolRelations(dbClient_default)({
|
|
1675
|
-
scopes: { tenantId, projectId },
|
|
1613
|
+
scopes: { tenantId, projectId, graphId },
|
|
1676
1614
|
pagination: { limit: 1e3 }
|
|
1677
1615
|
});
|
|
1678
1616
|
const isDuplicate = existingRelations.data.some((relation) => {
|
|
@@ -1687,7 +1625,7 @@ app6.openapi(
|
|
|
1687
1625
|
}
|
|
1688
1626
|
try {
|
|
1689
1627
|
const agentToolRelation = await agentsCore.createAgentToolRelation(dbClient_default)({
|
|
1690
|
-
scopes: { tenantId, projectId },
|
|
1628
|
+
scopes: { tenantId, projectId, graphId },
|
|
1691
1629
|
data: body
|
|
1692
1630
|
});
|
|
1693
1631
|
return c.json({ data: agentToolRelation }, 201);
|
|
@@ -1708,9 +1646,9 @@ app6.openapi(
|
|
|
1708
1646
|
path: "/{id}",
|
|
1709
1647
|
summary: "Update Agent Tool Relation",
|
|
1710
1648
|
operationId: "update-agent-tool-relation",
|
|
1711
|
-
tags: ["
|
|
1649
|
+
tags: ["Agent Tool Relations"],
|
|
1712
1650
|
request: {
|
|
1713
|
-
params: agentsCore.
|
|
1651
|
+
params: agentsCore.TenantProjectGraphParamsSchema.merge(agentsCore.IdParamsSchema),
|
|
1714
1652
|
body: {
|
|
1715
1653
|
content: {
|
|
1716
1654
|
"application/json": {
|
|
@@ -1732,7 +1670,7 @@ app6.openapi(
|
|
|
1732
1670
|
}
|
|
1733
1671
|
}),
|
|
1734
1672
|
async (c) => {
|
|
1735
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1673
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1736
1674
|
console.log("id", id);
|
|
1737
1675
|
const body = await c.req.valid("json");
|
|
1738
1676
|
if (Object.keys(body).length === 0) {
|
|
@@ -1742,7 +1680,7 @@ app6.openapi(
|
|
|
1742
1680
|
});
|
|
1743
1681
|
}
|
|
1744
1682
|
const updatedAgentToolRelation = await agentsCore.updateAgentToolRelation(dbClient_default)({
|
|
1745
|
-
scopes: { tenantId, projectId },
|
|
1683
|
+
scopes: { tenantId, projectId, graphId },
|
|
1746
1684
|
relationId: id,
|
|
1747
1685
|
data: body
|
|
1748
1686
|
});
|
|
@@ -1761,9 +1699,9 @@ app6.openapi(
|
|
|
1761
1699
|
path: "/{id}",
|
|
1762
1700
|
summary: "Delete Agent Tool Relation",
|
|
1763
1701
|
operationId: "delete-agent-tool-relation",
|
|
1764
|
-
tags: ["
|
|
1702
|
+
tags: ["Agent Tool Relations"],
|
|
1765
1703
|
request: {
|
|
1766
|
-
params: agentsCore.
|
|
1704
|
+
params: agentsCore.TenantProjectGraphParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
1767
1705
|
},
|
|
1768
1706
|
responses: {
|
|
1769
1707
|
204: {
|
|
@@ -1780,9 +1718,9 @@ app6.openapi(
|
|
|
1780
1718
|
}
|
|
1781
1719
|
}),
|
|
1782
1720
|
async (c) => {
|
|
1783
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1721
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
1784
1722
|
const deleted = await agentsCore.deleteAgentToolRelation(dbClient_default)({
|
|
1785
|
-
scopes: { tenantId, projectId },
|
|
1723
|
+
scopes: { tenantId, projectId, graphId },
|
|
1786
1724
|
relationId: id
|
|
1787
1725
|
});
|
|
1788
1726
|
if (!deleted) {
|
|
@@ -1803,7 +1741,7 @@ app7.openapi(
|
|
|
1803
1741
|
summary: "List API Keys",
|
|
1804
1742
|
description: "List all API keys for a tenant with optional pagination",
|
|
1805
1743
|
operationId: "list-api-keys",
|
|
1806
|
-
tags: ["
|
|
1744
|
+
tags: ["API Keys"],
|
|
1807
1745
|
request: {
|
|
1808
1746
|
params: agentsCore.TenantProjectParamsSchema,
|
|
1809
1747
|
query: agentsCore.PaginationQueryParamsSchema.extend({
|
|
@@ -1846,7 +1784,7 @@ app7.openapi(
|
|
|
1846
1784
|
summary: "Get API Key",
|
|
1847
1785
|
description: "Get a specific API key by ID (does not return the actual key)",
|
|
1848
1786
|
operationId: "get-api-key-by-id",
|
|
1849
|
-
tags: ["
|
|
1787
|
+
tags: ["API Keys"],
|
|
1850
1788
|
request: {
|
|
1851
1789
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
1852
1790
|
},
|
|
@@ -1891,7 +1829,7 @@ app7.openapi(
|
|
|
1891
1829
|
summary: "Create API Key",
|
|
1892
1830
|
description: "Create a new API key for a graph. Returns the full key (shown only once).",
|
|
1893
1831
|
operationId: "create-api-key",
|
|
1894
|
-
tags: ["
|
|
1832
|
+
tags: ["API Keys"],
|
|
1895
1833
|
request: {
|
|
1896
1834
|
params: agentsCore.TenantProjectParamsSchema,
|
|
1897
1835
|
body: {
|
|
@@ -1960,7 +1898,7 @@ app7.openapi(
|
|
|
1960
1898
|
summary: "Update API Key",
|
|
1961
1899
|
description: "Update an API key (currently only expiration date can be changed)",
|
|
1962
1900
|
operationId: "update-api-key",
|
|
1963
|
-
tags: ["
|
|
1901
|
+
tags: ["API Keys"],
|
|
1964
1902
|
request: {
|
|
1965
1903
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema),
|
|
1966
1904
|
body: {
|
|
@@ -2016,7 +1954,7 @@ app7.openapi(
|
|
|
2016
1954
|
summary: "Delete API Key",
|
|
2017
1955
|
description: "Delete an API key permanently",
|
|
2018
1956
|
operationId: "delete-api-key",
|
|
2019
|
-
tags: ["
|
|
1957
|
+
tags: ["API Keys"],
|
|
2020
1958
|
request: {
|
|
2021
1959
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
2022
1960
|
},
|
|
@@ -2057,7 +1995,7 @@ app8.openapi(
|
|
|
2057
1995
|
path: "/",
|
|
2058
1996
|
summary: "List Artifact Components",
|
|
2059
1997
|
operationId: "list-artifact-components",
|
|
2060
|
-
tags: ["
|
|
1998
|
+
tags: ["Artifact Component"],
|
|
2061
1999
|
request: {
|
|
2062
2000
|
params: agentsCore.TenantProjectParamsSchema,
|
|
2063
2001
|
query: agentsCore.PaginationQueryParamsSchema
|
|
@@ -2091,7 +2029,7 @@ app8.openapi(
|
|
|
2091
2029
|
path: "/{id}",
|
|
2092
2030
|
summary: "Get Artifact Component",
|
|
2093
2031
|
operationId: "get-artifact-component-by-id",
|
|
2094
|
-
tags: ["
|
|
2032
|
+
tags: ["Artifact Component"],
|
|
2095
2033
|
request: {
|
|
2096
2034
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
2097
2035
|
},
|
|
@@ -2128,7 +2066,7 @@ app8.openapi(
|
|
|
2128
2066
|
path: "/",
|
|
2129
2067
|
summary: "Create Artifact Component",
|
|
2130
2068
|
operationId: "create-artifact-component",
|
|
2131
|
-
tags: ["
|
|
2069
|
+
tags: ["Artifact Component"],
|
|
2132
2070
|
request: {
|
|
2133
2071
|
params: agentsCore.TenantProjectParamsSchema,
|
|
2134
2072
|
body: {
|
|
@@ -2186,7 +2124,7 @@ app8.openapi(
|
|
|
2186
2124
|
path: "/{id}",
|
|
2187
2125
|
summary: "Update Artifact Component",
|
|
2188
2126
|
operationId: "update-artifact-component",
|
|
2189
|
-
tags: ["
|
|
2127
|
+
tags: ["Artifact Component"],
|
|
2190
2128
|
request: {
|
|
2191
2129
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema),
|
|
2192
2130
|
body: {
|
|
@@ -2237,7 +2175,7 @@ app8.openapi(
|
|
|
2237
2175
|
path: "/{id}",
|
|
2238
2176
|
summary: "Delete Artifact Component",
|
|
2239
2177
|
operationId: "delete-artifact-component",
|
|
2240
|
-
tags: ["
|
|
2178
|
+
tags: ["Artifact Component"],
|
|
2241
2179
|
request: {
|
|
2242
2180
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
2243
2181
|
},
|
|
@@ -2278,7 +2216,7 @@ app9.openapi(
|
|
|
2278
2216
|
path: "/",
|
|
2279
2217
|
summary: "List Context Configurations",
|
|
2280
2218
|
operationId: "list-context-configs",
|
|
2281
|
-
tags: ["
|
|
2219
|
+
tags: ["Context Config"],
|
|
2282
2220
|
request: {
|
|
2283
2221
|
params: agentsCore.TenantProjectParamsSchema,
|
|
2284
2222
|
query: agentsCore.PaginationQueryParamsSchema
|
|
@@ -2312,7 +2250,7 @@ app9.openapi(
|
|
|
2312
2250
|
path: "/{id}",
|
|
2313
2251
|
summary: "Get Context Configuration",
|
|
2314
2252
|
operationId: "get-context-config-by-id",
|
|
2315
|
-
tags: ["
|
|
2253
|
+
tags: ["Context Config"],
|
|
2316
2254
|
request: {
|
|
2317
2255
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
2318
2256
|
},
|
|
@@ -2349,7 +2287,7 @@ app9.openapi(
|
|
|
2349
2287
|
path: "/",
|
|
2350
2288
|
summary: "Create Context Configuration",
|
|
2351
2289
|
operationId: "create-context-config",
|
|
2352
|
-
tags: ["
|
|
2290
|
+
tags: ["Context Config"],
|
|
2353
2291
|
request: {
|
|
2354
2292
|
params: agentsCore.TenantProjectParamsSchema,
|
|
2355
2293
|
body: {
|
|
@@ -2390,7 +2328,7 @@ app9.openapi(
|
|
|
2390
2328
|
path: "/{id}",
|
|
2391
2329
|
summary: "Update Context Configuration",
|
|
2392
2330
|
operationId: "update-context-config",
|
|
2393
|
-
tags: ["
|
|
2331
|
+
tags: ["Context Config"],
|
|
2394
2332
|
request: {
|
|
2395
2333
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema),
|
|
2396
2334
|
body: {
|
|
@@ -2436,7 +2374,7 @@ app9.openapi(
|
|
|
2436
2374
|
path: "/{id}",
|
|
2437
2375
|
summary: "Delete Context Configuration",
|
|
2438
2376
|
operationId: "delete-context-config",
|
|
2439
|
-
tags: ["
|
|
2377
|
+
tags: ["Context Config"],
|
|
2440
2378
|
request: {
|
|
2441
2379
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
2442
2380
|
},
|
|
@@ -2470,7 +2408,7 @@ app10.openapi(
|
|
|
2470
2408
|
path: "/",
|
|
2471
2409
|
summary: "List Credentials",
|
|
2472
2410
|
operationId: "list-credentials",
|
|
2473
|
-
tags: ["
|
|
2411
|
+
tags: ["Credential"],
|
|
2474
2412
|
request: {
|
|
2475
2413
|
params: agentsCore.TenantProjectParamsSchema,
|
|
2476
2414
|
query: agentsCore.PaginationQueryParamsSchema
|
|
@@ -2505,7 +2443,7 @@ app10.openapi(
|
|
|
2505
2443
|
path: "/{id}",
|
|
2506
2444
|
summary: "Get Credential",
|
|
2507
2445
|
operationId: "get-credential-by-id",
|
|
2508
|
-
tags: ["
|
|
2446
|
+
tags: ["Credential"],
|
|
2509
2447
|
request: {
|
|
2510
2448
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
2511
2449
|
},
|
|
@@ -2543,7 +2481,7 @@ app10.openapi(
|
|
|
2543
2481
|
path: "/",
|
|
2544
2482
|
summary: "Create Credential",
|
|
2545
2483
|
operationId: "create-credential",
|
|
2546
|
-
tags: ["
|
|
2484
|
+
tags: ["Credential"],
|
|
2547
2485
|
request: {
|
|
2548
2486
|
params: agentsCore.TenantProjectParamsSchema,
|
|
2549
2487
|
body: {
|
|
@@ -2585,7 +2523,7 @@ app10.openapi(
|
|
|
2585
2523
|
path: "/{id}",
|
|
2586
2524
|
summary: "Update Credential",
|
|
2587
2525
|
operationId: "update-credential",
|
|
2588
|
-
tags: ["
|
|
2526
|
+
tags: ["Credential"],
|
|
2589
2527
|
request: {
|
|
2590
2528
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema),
|
|
2591
2529
|
body: {
|
|
@@ -2632,7 +2570,7 @@ app10.openapi(
|
|
|
2632
2570
|
path: "/{id}",
|
|
2633
2571
|
summary: "Delete Credential",
|
|
2634
2572
|
operationId: "delete-credential",
|
|
2635
|
-
tags: ["
|
|
2573
|
+
tags: ["Credential"],
|
|
2636
2574
|
request: {
|
|
2637
2575
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
2638
2576
|
},
|
|
@@ -2705,7 +2643,7 @@ app11.openapi(
|
|
|
2705
2643
|
path: "/",
|
|
2706
2644
|
summary: "List Data Components",
|
|
2707
2645
|
operationId: "list-data-components",
|
|
2708
|
-
tags: ["
|
|
2646
|
+
tags: ["Data Component"],
|
|
2709
2647
|
request: {
|
|
2710
2648
|
params: agentsCore.TenantProjectParamsSchema,
|
|
2711
2649
|
query: agentsCore.PaginationQueryParamsSchema
|
|
@@ -2739,7 +2677,7 @@ app11.openapi(
|
|
|
2739
2677
|
path: "/{id}",
|
|
2740
2678
|
summary: "Get Data Component",
|
|
2741
2679
|
operationId: "get-data-component-by-id",
|
|
2742
|
-
tags: ["
|
|
2680
|
+
tags: ["Data Component"],
|
|
2743
2681
|
request: {
|
|
2744
2682
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
2745
2683
|
},
|
|
@@ -2776,7 +2714,7 @@ app11.openapi(
|
|
|
2776
2714
|
path: "/",
|
|
2777
2715
|
summary: "Create Data Component",
|
|
2778
2716
|
operationId: "create-data-component",
|
|
2779
|
-
tags: ["
|
|
2717
|
+
tags: ["Data Component"],
|
|
2780
2718
|
request: {
|
|
2781
2719
|
params: agentsCore.TenantProjectParamsSchema,
|
|
2782
2720
|
body: {
|
|
@@ -2817,7 +2755,7 @@ app11.openapi(
|
|
|
2817
2755
|
path: "/{id}",
|
|
2818
2756
|
summary: "Update Data Component",
|
|
2819
2757
|
operationId: "update-data-component",
|
|
2820
|
-
tags: ["
|
|
2758
|
+
tags: ["Data Component"],
|
|
2821
2759
|
request: {
|
|
2822
2760
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema),
|
|
2823
2761
|
body: {
|
|
@@ -2863,7 +2801,7 @@ app11.openapi(
|
|
|
2863
2801
|
path: "/{id}",
|
|
2864
2802
|
summary: "Delete Data Component",
|
|
2865
2803
|
operationId: "delete-data-component",
|
|
2866
|
-
tags: ["
|
|
2804
|
+
tags: ["Data Component"],
|
|
2867
2805
|
request: {
|
|
2868
2806
|
params: agentsCore.TenantProjectParamsSchema.merge(agentsCore.IdParamsSchema)
|
|
2869
2807
|
},
|
|
@@ -2904,9 +2842,9 @@ app12.openapi(
|
|
|
2904
2842
|
path: "/",
|
|
2905
2843
|
summary: "List External Agents",
|
|
2906
2844
|
operationId: "list-external-agents",
|
|
2907
|
-
tags: ["
|
|
2845
|
+
tags: ["External Agents"],
|
|
2908
2846
|
request: {
|
|
2909
|
-
params: agentsCore.
|
|
2847
|
+
params: agentsCore.TenantProjectGraphParamsSchema,
|
|
2910
2848
|
query: agentsCore.PaginationQueryParamsSchema
|
|
2911
2849
|
},
|
|
2912
2850
|
responses: {
|
|
@@ -2922,10 +2860,10 @@ app12.openapi(
|
|
|
2922
2860
|
}
|
|
2923
2861
|
}),
|
|
2924
2862
|
async (c) => {
|
|
2925
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
2863
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
2926
2864
|
const { page, limit } = c.req.valid("query");
|
|
2927
2865
|
const result = await agentsCore.listExternalAgentsPaginated(dbClient_default)({
|
|
2928
|
-
scopes: { tenantId, projectId },
|
|
2866
|
+
scopes: { tenantId, projectId, graphId },
|
|
2929
2867
|
pagination: { page, limit }
|
|
2930
2868
|
});
|
|
2931
2869
|
const dataWithType = {
|
|
@@ -2944,9 +2882,9 @@ app12.openapi(
|
|
|
2944
2882
|
path: "/{id}",
|
|
2945
2883
|
summary: "Get External Agent",
|
|
2946
2884
|
operationId: "get-external-agent-by-id",
|
|
2947
|
-
tags: ["
|
|
2885
|
+
tags: ["External Agents"],
|
|
2948
2886
|
request: {
|
|
2949
|
-
params: agentsCore.
|
|
2887
|
+
params: agentsCore.TenantProjectGraphIdParamsSchema
|
|
2950
2888
|
},
|
|
2951
2889
|
responses: {
|
|
2952
2890
|
200: {
|
|
@@ -2961,9 +2899,9 @@ app12.openapi(
|
|
|
2961
2899
|
}
|
|
2962
2900
|
}),
|
|
2963
2901
|
async (c) => {
|
|
2964
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
2902
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
2965
2903
|
const externalAgent = await agentsCore.getExternalAgent(dbClient_default)({
|
|
2966
|
-
scopes: { tenantId, projectId },
|
|
2904
|
+
scopes: { tenantId, projectId, graphId },
|
|
2967
2905
|
agentId: id
|
|
2968
2906
|
});
|
|
2969
2907
|
if (!externalAgent) {
|
|
@@ -2985,9 +2923,9 @@ app12.openapi(
|
|
|
2985
2923
|
path: "/",
|
|
2986
2924
|
summary: "Create External Agent",
|
|
2987
2925
|
operationId: "create-external-agent",
|
|
2988
|
-
tags: ["
|
|
2926
|
+
tags: ["External Agents"],
|
|
2989
2927
|
request: {
|
|
2990
|
-
params: agentsCore.
|
|
2928
|
+
params: agentsCore.TenantProjectGraphParamsSchema,
|
|
2991
2929
|
body: {
|
|
2992
2930
|
content: {
|
|
2993
2931
|
"application/json": {
|
|
@@ -3009,11 +2947,12 @@ app12.openapi(
|
|
|
3009
2947
|
}
|
|
3010
2948
|
}),
|
|
3011
2949
|
async (c) => {
|
|
3012
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
2950
|
+
const { tenantId, projectId, graphId } = c.req.valid("param");
|
|
3013
2951
|
const body = c.req.valid("json");
|
|
3014
2952
|
const externalAgentData = {
|
|
3015
2953
|
tenantId,
|
|
3016
2954
|
projectId,
|
|
2955
|
+
graphId,
|
|
3017
2956
|
id: body.id ? String(body.id) : nanoid.nanoid(),
|
|
3018
2957
|
name: body.name,
|
|
3019
2958
|
description: body.description,
|
|
@@ -3035,9 +2974,9 @@ app12.openapi(
|
|
|
3035
2974
|
path: "/{id}",
|
|
3036
2975
|
summary: "Update External Agent",
|
|
3037
2976
|
operationId: "update-external-agent",
|
|
3038
|
-
tags: ["
|
|
2977
|
+
tags: ["External Agents"],
|
|
3039
2978
|
request: {
|
|
3040
|
-
params: agentsCore.
|
|
2979
|
+
params: agentsCore.TenantProjectGraphIdParamsSchema,
|
|
3041
2980
|
body: {
|
|
3042
2981
|
content: {
|
|
3043
2982
|
"application/json": {
|
|
@@ -3059,10 +2998,10 @@ app12.openapi(
|
|
|
3059
2998
|
}
|
|
3060
2999
|
}),
|
|
3061
3000
|
async (c) => {
|
|
3062
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
3001
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
3063
3002
|
const body = c.req.valid("json");
|
|
3064
3003
|
const updatedExternalAgent = await agentsCore.updateExternalAgent(dbClient_default)({
|
|
3065
|
-
scopes: { tenantId, projectId },
|
|
3004
|
+
scopes: { tenantId, projectId, graphId },
|
|
3066
3005
|
agentId: id,
|
|
3067
3006
|
data: body
|
|
3068
3007
|
});
|
|
@@ -3085,9 +3024,9 @@ app12.openapi(
|
|
|
3085
3024
|
path: "/{id}",
|
|
3086
3025
|
summary: "Delete External Agent",
|
|
3087
3026
|
operationId: "delete-external-agent",
|
|
3088
|
-
tags: ["
|
|
3027
|
+
tags: ["External Agents"],
|
|
3089
3028
|
request: {
|
|
3090
|
-
params: agentsCore.
|
|
3029
|
+
params: agentsCore.TenantProjectGraphIdParamsSchema
|
|
3091
3030
|
},
|
|
3092
3031
|
responses: {
|
|
3093
3032
|
204: {
|
|
@@ -3104,9 +3043,9 @@ app12.openapi(
|
|
|
3104
3043
|
}
|
|
3105
3044
|
}),
|
|
3106
3045
|
async (c) => {
|
|
3107
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
3046
|
+
const { tenantId, projectId, graphId, id } = c.req.valid("param");
|
|
3108
3047
|
const deleted = await agentsCore.deleteExternalAgent(dbClient_default)({
|
|
3109
|
-
scopes: { tenantId, projectId },
|
|
3048
|
+
scopes: { tenantId, projectId, graphId },
|
|
3110
3049
|
agentId: id
|
|
3111
3050
|
});
|
|
3112
3051
|
if (!deleted) {
|
|
@@ -3141,7 +3080,7 @@ app13.openapi(
|
|
|
3141
3080
|
path: "/",
|
|
3142
3081
|
summary: "Create Full Graph",
|
|
3143
3082
|
operationId: "create-full-graph",
|
|
3144
|
-
tags: ["
|
|
3083
|
+
tags: ["Full Graph"],
|
|
3145
3084
|
description: "Create a complete agent graph with all agents, tools, and relationships from JSON definition",
|
|
3146
3085
|
request: {
|
|
3147
3086
|
params: agentsCore.TenantProjectParamsSchema,
|
|
@@ -3190,7 +3129,7 @@ app13.openapi(
|
|
|
3190
3129
|
path: "/{graphId}",
|
|
3191
3130
|
summary: "Get Full Graph",
|
|
3192
3131
|
operationId: "get-full-graph",
|
|
3193
|
-
tags: ["
|
|
3132
|
+
tags: ["Full Graph"],
|
|
3194
3133
|
description: "Retrieve a complete agent graph definition with all agents, tools, and relationships",
|
|
3195
3134
|
request: {
|
|
3196
3135
|
params: GraphIdParamsSchema
|
|
@@ -3214,8 +3153,7 @@ app13.openapi(
|
|
|
3214
3153
|
dbClient_default,
|
|
3215
3154
|
logger3
|
|
3216
3155
|
)({
|
|
3217
|
-
scopes: { tenantId, projectId }
|
|
3218
|
-
graphId
|
|
3156
|
+
scopes: { tenantId, projectId, graphId }
|
|
3219
3157
|
});
|
|
3220
3158
|
if (!graph) {
|
|
3221
3159
|
throw agentsCore.createApiError({
|
|
@@ -3244,7 +3182,7 @@ app13.openapi(
|
|
|
3244
3182
|
path: "/{graphId}",
|
|
3245
3183
|
summary: "Update Full Graph",
|
|
3246
3184
|
operationId: "update-full-graph",
|
|
3247
|
-
tags: ["
|
|
3185
|
+
tags: ["Full Graph"],
|
|
3248
3186
|
description: "Update or create a complete agent graph with all agents, tools, and relationships from JSON definition",
|
|
3249
3187
|
request: {
|
|
3250
3188
|
params: GraphIdParamsSchema,
|
|
@@ -3291,8 +3229,7 @@ app13.openapi(
|
|
|
3291
3229
|
dbClient_default,
|
|
3292
3230
|
logger3
|
|
3293
3231
|
)({
|
|
3294
|
-
scopes: { tenantId, projectId }
|
|
3295
|
-
graphId
|
|
3232
|
+
scopes: { tenantId, projectId, graphId }
|
|
3296
3233
|
});
|
|
3297
3234
|
const isCreate = !existingGraph;
|
|
3298
3235
|
const updatedGraph = isCreate ? await agentsCore.createFullGraphServerSide(dbClient_default, logger3)(
|
|
@@ -3329,7 +3266,7 @@ app13.openapi(
|
|
|
3329
3266
|
path: "/{graphId}",
|
|
3330
3267
|
summary: "Delete Full Graph",
|
|
3331
3268
|
operationId: "delete-full-graph",
|
|
3332
|
-
tags: ["
|
|
3269
|
+
tags: ["Full Graph"],
|
|
3333
3270
|
description: "Delete a complete agent graph and cascade to all related entities (relationships, not agents/tools)",
|
|
3334
3271
|
request: {
|
|
3335
3272
|
params: GraphIdParamsSchema
|
|
@@ -3348,8 +3285,7 @@ app13.openapi(
|
|
|
3348
3285
|
dbClient_default,
|
|
3349
3286
|
logger3
|
|
3350
3287
|
)({
|
|
3351
|
-
scopes: { tenantId, projectId }
|
|
3352
|
-
graphId
|
|
3288
|
+
scopes: { tenantId, projectId, graphId }
|
|
3353
3289
|
});
|
|
3354
3290
|
if (!deleted) {
|
|
3355
3291
|
throw agentsCore.createApiError({
|
|
@@ -3950,14 +3886,14 @@ function retrievePKCEVerifier(state) {
|
|
|
3950
3886
|
return null;
|
|
3951
3887
|
}
|
|
3952
3888
|
var OAuthService = class {
|
|
3953
|
-
constructor(
|
|
3889
|
+
constructor(config = {}) {
|
|
3954
3890
|
__publicField(this, "defaultConfig");
|
|
3955
3891
|
this.defaultConfig = {
|
|
3956
|
-
defaultClientId:
|
|
3957
|
-
clientName:
|
|
3958
|
-
clientUri:
|
|
3959
|
-
logoUri:
|
|
3960
|
-
redirectBaseUrl:
|
|
3892
|
+
defaultClientId: config.defaultClientId || process.env.DEFAULT_OAUTH_CLIENT_ID || "mcp-client",
|
|
3893
|
+
clientName: config.clientName || process.env.OAUTH_CLIENT_NAME || "Inkeep Agent Framework",
|
|
3894
|
+
clientUri: config.clientUri || process.env.OAUTH_CLIENT_URI || "https://inkeep.com",
|
|
3895
|
+
logoUri: config.logoUri || process.env.OAUTH_CLIENT_LOGO_URI || "https://inkeep.com/images/logos/inkeep-logo-blue.svg",
|
|
3896
|
+
redirectBaseUrl: config.redirectBaseUrl || process.env.OAUTH_REDIRECT_BASE_URL || "http://localhost:3002"
|
|
3961
3897
|
};
|
|
3962
3898
|
}
|
|
3963
3899
|
/**
|
|
@@ -4101,7 +4037,7 @@ var OAuthService = class {
|
|
|
4101
4037
|
const tokenUrl = new URL(oAuthConfig.tokenUrl);
|
|
4102
4038
|
const oauthServerUrl = `${tokenUrl.protocol}//${tokenUrl.host}`;
|
|
4103
4039
|
logger6.info({ oauthServerUrl, clientId }, "Attempting openid-client discovery");
|
|
4104
|
-
const
|
|
4040
|
+
const config = await oauth.discovery(
|
|
4105
4041
|
new URL(oauthServerUrl),
|
|
4106
4042
|
clientId,
|
|
4107
4043
|
void 0
|
|
@@ -4110,7 +4046,7 @@ var OAuthService = class {
|
|
|
4110
4046
|
const callbackUrl = new URL(
|
|
4111
4047
|
`${redirectUri}?${new URLSearchParams({ code, state: "unused" }).toString()}`
|
|
4112
4048
|
);
|
|
4113
|
-
return await oauth.authorizationCodeGrant(
|
|
4049
|
+
return await oauth.authorizationCodeGrant(config, callbackUrl, {
|
|
4114
4050
|
pkceCodeVerifier: codeVerifier
|
|
4115
4051
|
});
|
|
4116
4052
|
}
|
|
@@ -4175,7 +4111,7 @@ app15.openapi(
|
|
|
4175
4111
|
path: "/",
|
|
4176
4112
|
summary: "List Tools",
|
|
4177
4113
|
operationId: "list-tools",
|
|
4178
|
-
tags: ["
|
|
4114
|
+
tags: ["Tools"],
|
|
4179
4115
|
request: {
|
|
4180
4116
|
params: agentsCore.TenantProjectParamsSchema,
|
|
4181
4117
|
query: agentsCore.PaginationQueryParamsSchema.extend({
|
|
@@ -4228,7 +4164,7 @@ app15.openapi(
|
|
|
4228
4164
|
path: "/{id}",
|
|
4229
4165
|
summary: "Get Tool",
|
|
4230
4166
|
operationId: "get-tool",
|
|
4231
|
-
tags: ["
|
|
4167
|
+
tags: ["Tools"],
|
|
4232
4168
|
request: {
|
|
4233
4169
|
params: agentsCore.TenantProjectParamsSchema.extend(agentsCore.IdParamsSchema.shape)
|
|
4234
4170
|
},
|
|
@@ -4264,7 +4200,7 @@ app15.openapi(
|
|
|
4264
4200
|
path: "/",
|
|
4265
4201
|
summary: "Create Tool",
|
|
4266
4202
|
operationId: "create-tool",
|
|
4267
|
-
tags: ["
|
|
4203
|
+
tags: ["Tools"],
|
|
4268
4204
|
request: {
|
|
4269
4205
|
params: agentsCore.TenantProjectParamsSchema,
|
|
4270
4206
|
body: {
|
|
@@ -4316,7 +4252,7 @@ app15.openapi(
|
|
|
4316
4252
|
path: "/{id}",
|
|
4317
4253
|
summary: "Update Tool",
|
|
4318
4254
|
operationId: "update-tool",
|
|
4319
|
-
tags: ["
|
|
4255
|
+
tags: ["Tools"],
|
|
4320
4256
|
request: {
|
|
4321
4257
|
params: agentsCore.TenantProjectParamsSchema.extend(agentsCore.IdParamsSchema.shape),
|
|
4322
4258
|
body: {
|
|
@@ -4376,7 +4312,7 @@ app15.openapi(
|
|
|
4376
4312
|
path: "/{id}",
|
|
4377
4313
|
summary: "Delete Tool",
|
|
4378
4314
|
operationId: "delete-tool",
|
|
4379
|
-
tags: ["
|
|
4315
|
+
tags: ["Tools"],
|
|
4380
4316
|
request: {
|
|
4381
4317
|
params: agentsCore.TenantProjectParamsSchema.extend(agentsCore.IdParamsSchema.shape)
|
|
4382
4318
|
},
|
|
@@ -4412,7 +4348,7 @@ app15.openapi(
|
|
|
4412
4348
|
path: "/{id}/health-check",
|
|
4413
4349
|
summary: "Check Tool Health",
|
|
4414
4350
|
operationId: "check-tool-health",
|
|
4415
|
-
tags: ["
|
|
4351
|
+
tags: ["Tools"],
|
|
4416
4352
|
request: {
|
|
4417
4353
|
params: agentsCore.TenantProjectParamsSchema.extend(agentsCore.IdParamsSchema.shape)
|
|
4418
4354
|
},
|
|
@@ -4468,7 +4404,7 @@ app15.openapi(
|
|
|
4468
4404
|
path: "/health-check-all",
|
|
4469
4405
|
summary: "Check All Tools Health",
|
|
4470
4406
|
operationId: "check-all-tools-health",
|
|
4471
|
-
tags: ["
|
|
4407
|
+
tags: ["Tools"],
|
|
4472
4408
|
request: {
|
|
4473
4409
|
params: agentsCore.TenantProjectParamsSchema
|
|
4474
4410
|
},
|
|
@@ -4532,7 +4468,7 @@ app15.openapi(
|
|
|
4532
4468
|
path: "/{id}/sync",
|
|
4533
4469
|
summary: "Sync Tool Definitions",
|
|
4534
4470
|
operationId: "sync-tool-definitions",
|
|
4535
|
-
tags: ["
|
|
4471
|
+
tags: ["Tools"],
|
|
4536
4472
|
request: {
|
|
4537
4473
|
params: agentsCore.TenantProjectParamsSchema.extend(agentsCore.IdParamsSchema.shape)
|
|
4538
4474
|
},
|
|
@@ -4576,7 +4512,7 @@ app15.openapi(
|
|
|
4576
4512
|
path: "/{id}/available-tools",
|
|
4577
4513
|
summary: "Get Available Tools",
|
|
4578
4514
|
operationId: "get-available-tools",
|
|
4579
|
-
tags: ["
|
|
4515
|
+
tags: ["Tools"],
|
|
4580
4516
|
request: {
|
|
4581
4517
|
params: agentsCore.TenantProjectParamsSchema.extend(agentsCore.IdParamsSchema.shape)
|
|
4582
4518
|
},
|
|
@@ -4628,7 +4564,7 @@ app15.openapi(
|
|
|
4628
4564
|
path: "/{id}/status",
|
|
4629
4565
|
summary: "Update Tool Status",
|
|
4630
4566
|
operationId: "update-tool-status",
|
|
4631
|
-
tags: ["
|
|
4567
|
+
tags: ["Tools"],
|
|
4632
4568
|
request: {
|
|
4633
4569
|
params: agentsCore.TenantProjectParamsSchema.extend(agentsCore.IdParamsSchema.shape),
|
|
4634
4570
|
body: {
|
|
@@ -4748,17 +4684,17 @@ var tools_default = app15;
|
|
|
4748
4684
|
// src/routes/index.ts
|
|
4749
4685
|
var app16 = new zodOpenapi.OpenAPIHono();
|
|
4750
4686
|
app16.route("/projects", projects_default);
|
|
4751
|
-
app16.route("/projects/:projectId/agents", agents_default);
|
|
4752
|
-
app16.route("/projects/:projectId/agent-relations", agentRelations_default);
|
|
4687
|
+
app16.route("/projects/:projectId/graphs/:graphId/agents", agents_default);
|
|
4688
|
+
app16.route("/projects/:projectId/graphs/:graphId/agent-relations", agentRelations_default);
|
|
4753
4689
|
app16.route("/projects/:projectId/agent-graphs", agentGraph_default);
|
|
4754
|
-
app16.route("/projects/:projectId/agent-tool-relations", agentToolRelations_default);
|
|
4755
|
-
app16.route("/projects/:projectId/agent-artifact-components", agentArtifactComponents_default);
|
|
4756
|
-
app16.route("/projects/:projectId/agent-data-components", agentDataComponents_default);
|
|
4690
|
+
app16.route("/projects/:projectId/graphs/:graphId/agent-tool-relations", agentToolRelations_default);
|
|
4691
|
+
app16.route("/projects/:projectId/graphs/:graphId/agent-artifact-components", agentArtifactComponents_default);
|
|
4692
|
+
app16.route("/projects/:projectId/graphs/:graphId/agent-data-components", agentDataComponents_default);
|
|
4757
4693
|
app16.route("/projects/:projectId/artifact-components", artifactComponents_default);
|
|
4758
4694
|
app16.route("/projects/:projectId/context-configs", contextConfigs_default);
|
|
4759
4695
|
app16.route("/projects/:projectId/credentials", credentials_default);
|
|
4760
4696
|
app16.route("/projects/:projectId/data-components", dataComponents_default);
|
|
4761
|
-
app16.route("/projects/:projectId/external-agents", externalAgents_default);
|
|
4697
|
+
app16.route("/projects/:projectId/graphs/:graphId/external-agents", externalAgents_default);
|
|
4762
4698
|
app16.route("/projects/:projectId/tools", tools_default);
|
|
4763
4699
|
app16.route("/projects/:projectId/api-keys", apiKeys_default);
|
|
4764
4700
|
app16.route("/projects/:projectId/graph", graphFull_default);
|
|
@@ -4958,7 +4894,7 @@ app18.openapi(
|
|
|
4958
4894
|
path: "/project-full",
|
|
4959
4895
|
summary: "Create Full Project",
|
|
4960
4896
|
operationId: "create-full-project",
|
|
4961
|
-
tags: ["
|
|
4897
|
+
tags: ["Full Project"],
|
|
4962
4898
|
description: "Create a complete project with all graphs, agents, tools, and relationships from JSON definition",
|
|
4963
4899
|
request: {
|
|
4964
4900
|
params: TenantParamsSchema2,
|
|
@@ -5017,7 +4953,7 @@ app18.openapi(
|
|
|
5017
4953
|
path: "/project-full/{projectId}",
|
|
5018
4954
|
summary: "Get Full Project",
|
|
5019
4955
|
operationId: "get-full-project",
|
|
5020
|
-
tags: ["
|
|
4956
|
+
tags: ["Full Project"],
|
|
5021
4957
|
description: "Retrieve a complete project definition with all graphs, agents, tools, and relationships",
|
|
5022
4958
|
request: {
|
|
5023
4959
|
params: ProjectIdParamsSchema
|
|
@@ -5041,8 +4977,7 @@ app18.openapi(
|
|
|
5041
4977
|
dbClient_default,
|
|
5042
4978
|
logger8
|
|
5043
4979
|
)({
|
|
5044
|
-
scopes: { tenantId, projectId }
|
|
5045
|
-
projectId
|
|
4980
|
+
scopes: { tenantId, projectId }
|
|
5046
4981
|
});
|
|
5047
4982
|
if (!project) {
|
|
5048
4983
|
throw agentsCore.createApiError({
|
|
@@ -5071,7 +5006,7 @@ app18.openapi(
|
|
|
5071
5006
|
path: "/project-full/{projectId}",
|
|
5072
5007
|
summary: "Update Full Project",
|
|
5073
5008
|
operationId: "update-full-project",
|
|
5074
|
-
tags: ["
|
|
5009
|
+
tags: ["Full Project"],
|
|
5075
5010
|
description: "Update or create a complete project with all graphs, agents, tools, and relationships from JSON definition",
|
|
5076
5011
|
request: {
|
|
5077
5012
|
params: ProjectIdParamsSchema,
|
|
@@ -5118,8 +5053,7 @@ app18.openapi(
|
|
|
5118
5053
|
dbClient_default,
|
|
5119
5054
|
logger8
|
|
5120
5055
|
)({
|
|
5121
|
-
scopes: { tenantId, projectId }
|
|
5122
|
-
projectId
|
|
5056
|
+
scopes: { tenantId, projectId }
|
|
5123
5057
|
});
|
|
5124
5058
|
const isCreate = !existingProject;
|
|
5125
5059
|
const updatedProject = isCreate ? await agentsCore.createFullProjectServerSide(dbClient_default, logger8)(
|
|
@@ -5156,7 +5090,7 @@ app18.openapi(
|
|
|
5156
5090
|
path: "/project-full/{projectId}",
|
|
5157
5091
|
summary: "Delete Full Project",
|
|
5158
5092
|
operationId: "delete-full-project",
|
|
5159
|
-
tags: ["
|
|
5093
|
+
tags: ["Full Project"],
|
|
5160
5094
|
description: "Delete a complete project and cascade to all related entities (graphs, agents, tools, relationships)",
|
|
5161
5095
|
request: {
|
|
5162
5096
|
params: ProjectIdParamsSchema
|
|
@@ -5175,8 +5109,7 @@ app18.openapi(
|
|
|
5175
5109
|
dbClient_default,
|
|
5176
5110
|
logger8
|
|
5177
5111
|
)({
|
|
5178
|
-
scopes: { tenantId, projectId }
|
|
5179
|
-
projectId
|
|
5112
|
+
scopes: { tenantId, projectId }
|
|
5180
5113
|
});
|
|
5181
5114
|
if (!deleted) {
|
|
5182
5115
|
throw agentsCore.createApiError({
|
|
@@ -5330,7 +5263,7 @@ function createManagementHono(serverConfig, credentialStores) {
|
|
|
5330
5263
|
}
|
|
5331
5264
|
);
|
|
5332
5265
|
app20.use("/tenants/*", apiKeyAuth());
|
|
5333
|
-
app20.route("/tenants/:tenantId
|
|
5266
|
+
app20.route("/tenants/:tenantId", routes_default);
|
|
5334
5267
|
app20.route("/tenants/:tenantId", projectFull_default);
|
|
5335
5268
|
app20.route("/oauth", oauth_default);
|
|
5336
5269
|
setupOpenAPIRoutes(app20);
|
|
@@ -5353,9 +5286,9 @@ var defaultStores = agentsCore.createDefaultCredentialStores();
|
|
|
5353
5286
|
var defaultRegistry = new agentsCore.CredentialStoreRegistry(defaultStores);
|
|
5354
5287
|
var app19 = createManagementHono(defaultConfig, defaultRegistry);
|
|
5355
5288
|
var index_default = app19;
|
|
5356
|
-
function createManagementApp(
|
|
5357
|
-
const serverConfig =
|
|
5358
|
-
const stores =
|
|
5289
|
+
function createManagementApp(config) {
|
|
5290
|
+
const serverConfig = config?.serverConfig ?? defaultConfig;
|
|
5291
|
+
const stores = config?.credentialStores ?? defaultStores;
|
|
5359
5292
|
const registry = new agentsCore.CredentialStoreRegistry(stores);
|
|
5360
5293
|
return createManagementHono(serverConfig, registry);
|
|
5361
5294
|
}
|