@inkeep/agents-manage-api 0.21.0 → 1.0.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 +673 -537
- package/dist/index.js +674 -538
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -71,10 +71,10 @@ var apiKeyAuth = () => factory.createMiddleware(async (c, next) => {
|
|
|
71
71
|
await next();
|
|
72
72
|
return;
|
|
73
73
|
});
|
|
74
|
-
function setupOpenAPIRoutes(
|
|
75
|
-
|
|
74
|
+
function setupOpenAPIRoutes(app23) {
|
|
75
|
+
app23.get("/openapi.json", (c) => {
|
|
76
76
|
try {
|
|
77
|
-
const document =
|
|
77
|
+
const document = app23.getOpenAPIDocument({
|
|
78
78
|
openapi: "3.0.0",
|
|
79
79
|
info: {
|
|
80
80
|
title: "Inkeep Agents Manage API",
|
|
@@ -95,7 +95,7 @@ function setupOpenAPIRoutes(app22) {
|
|
|
95
95
|
return c.json({ error: "Failed to generate OpenAPI document", details: errorDetails }, 500);
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
|
-
|
|
98
|
+
app23.get(
|
|
99
99
|
"/docs",
|
|
100
100
|
swaggerUi.swaggerUI({
|
|
101
101
|
url: "/openapi.json",
|
|
@@ -208,7 +208,7 @@ app.openapi(
|
|
|
208
208
|
path: "/{agentId}/sub-agents/{subAgentId}/related",
|
|
209
209
|
summary: "Get Related Agent Infos",
|
|
210
210
|
operationId: "get-related-agent-infos",
|
|
211
|
-
tags: ["Agent
|
|
211
|
+
tags: ["Agent"],
|
|
212
212
|
request: {
|
|
213
213
|
params: agentsCore.TenantProjectParamsSchema.extend({
|
|
214
214
|
agentId: zod.z.string(),
|
|
@@ -257,7 +257,7 @@ app.openapi(
|
|
|
257
257
|
path: "/{agentId}/full",
|
|
258
258
|
summary: "Get Full Agent Definition",
|
|
259
259
|
operationId: "get-full-agent-definition",
|
|
260
|
-
tags: ["Agent
|
|
260
|
+
tags: ["Agent"],
|
|
261
261
|
request: {
|
|
262
262
|
params: agentsCore.TenantProjectAgentParamsSchema
|
|
263
263
|
},
|
|
@@ -417,8 +417,259 @@ app.openapi(
|
|
|
417
417
|
}
|
|
418
418
|
);
|
|
419
419
|
var agent_default = app;
|
|
420
|
+
var logger2 = agentsCore.getLogger("agentFull");
|
|
420
421
|
var app2 = new zodOpenapi.OpenAPIHono();
|
|
422
|
+
var AgentIdParamsSchema = zod.z.object({
|
|
423
|
+
tenantId: zod.z.string().openapi({
|
|
424
|
+
description: "Tenant identifier",
|
|
425
|
+
example: "tenant_123"
|
|
426
|
+
}),
|
|
427
|
+
projectId: zod.z.string().openapi({
|
|
428
|
+
description: "Project identifier",
|
|
429
|
+
example: "project_456"
|
|
430
|
+
}),
|
|
431
|
+
agentId: zod.z.string().openapi({
|
|
432
|
+
description: "Agent identifier",
|
|
433
|
+
example: "agent_789"
|
|
434
|
+
})
|
|
435
|
+
}).openapi("AgentIdParams");
|
|
436
|
+
app2.openapi(
|
|
437
|
+
zodOpenapi.createRoute({
|
|
438
|
+
method: "post",
|
|
439
|
+
path: "/",
|
|
440
|
+
summary: "Create Full Agent",
|
|
441
|
+
operationId: "create-full-agent",
|
|
442
|
+
tags: ["Full Agent"],
|
|
443
|
+
description: "Create a complete agent with all agents, tools, and relationships from JSON definition",
|
|
444
|
+
request: {
|
|
445
|
+
params: agentsCore.TenantProjectParamsSchema,
|
|
446
|
+
body: {
|
|
447
|
+
content: {
|
|
448
|
+
"application/json": {
|
|
449
|
+
schema: agentsCore.AgentWithinContextOfProjectSchema
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
responses: {
|
|
455
|
+
201: {
|
|
456
|
+
description: "Full agent created successfully",
|
|
457
|
+
content: {
|
|
458
|
+
"application/json": {
|
|
459
|
+
schema: agentsCore.SingleResponseSchema(agentsCore.AgentWithinContextOfProjectSchema)
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
409: {
|
|
464
|
+
description: "Agent already exists",
|
|
465
|
+
content: {
|
|
466
|
+
"application/json": {
|
|
467
|
+
schema: agentsCore.ErrorResponseSchema
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
...agentsCore.commonGetErrorResponses
|
|
472
|
+
}
|
|
473
|
+
}),
|
|
474
|
+
async (c) => {
|
|
475
|
+
const { tenantId, projectId } = c.req.valid("param");
|
|
476
|
+
const agentData = c.req.valid("json");
|
|
477
|
+
const validatedAgentData = agentsCore.AgentWithinContextOfProjectSchema.parse(agentData);
|
|
478
|
+
const createdAgent = await agentsCore.createFullAgentServerSide(dbClient_default, logger2)(
|
|
479
|
+
{ tenantId, projectId },
|
|
480
|
+
validatedAgentData
|
|
481
|
+
);
|
|
482
|
+
return c.json({ data: createdAgent }, 201);
|
|
483
|
+
}
|
|
484
|
+
);
|
|
421
485
|
app2.openapi(
|
|
486
|
+
zodOpenapi.createRoute({
|
|
487
|
+
method: "get",
|
|
488
|
+
path: "/{agentId}",
|
|
489
|
+
summary: "Get Full Agent",
|
|
490
|
+
operationId: "get-full-agent",
|
|
491
|
+
tags: ["Full Agent"],
|
|
492
|
+
description: "Retrieve a complete agent definition with all agents, tools, and relationships",
|
|
493
|
+
request: {
|
|
494
|
+
params: AgentIdParamsSchema
|
|
495
|
+
},
|
|
496
|
+
responses: {
|
|
497
|
+
200: {
|
|
498
|
+
description: "Full agent found",
|
|
499
|
+
content: {
|
|
500
|
+
"application/json": {
|
|
501
|
+
schema: agentsCore.SingleResponseSchema(agentsCore.AgentWithinContextOfProjectSchema)
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
...agentsCore.commonGetErrorResponses
|
|
506
|
+
}
|
|
507
|
+
}),
|
|
508
|
+
async (c) => {
|
|
509
|
+
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
510
|
+
try {
|
|
511
|
+
const agent = await agentsCore.getFullAgent(
|
|
512
|
+
dbClient_default,
|
|
513
|
+
logger2
|
|
514
|
+
)({
|
|
515
|
+
scopes: { tenantId, projectId, agentId }
|
|
516
|
+
});
|
|
517
|
+
if (!agent) {
|
|
518
|
+
throw agentsCore.createApiError({
|
|
519
|
+
code: "not_found",
|
|
520
|
+
message: "Agent not found"
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
return c.json({ data: agent });
|
|
524
|
+
} catch (error) {
|
|
525
|
+
if (error instanceof Error && error.message.includes("not found")) {
|
|
526
|
+
throw agentsCore.createApiError({
|
|
527
|
+
code: "not_found",
|
|
528
|
+
message: "Agent not found"
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
throw agentsCore.createApiError({
|
|
532
|
+
code: "internal_server_error",
|
|
533
|
+
message: error instanceof Error ? error.message : "Failed to retrieve agent"
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
);
|
|
538
|
+
app2.openapi(
|
|
539
|
+
zodOpenapi.createRoute({
|
|
540
|
+
method: "put",
|
|
541
|
+
path: "/{agentId}",
|
|
542
|
+
summary: "Update Full Agent",
|
|
543
|
+
operationId: "update-full-agent",
|
|
544
|
+
tags: ["Full Agent"],
|
|
545
|
+
description: "Update or create a complete agent with all agents, tools, and relationships from JSON definition",
|
|
546
|
+
request: {
|
|
547
|
+
params: AgentIdParamsSchema,
|
|
548
|
+
body: {
|
|
549
|
+
content: {
|
|
550
|
+
"application/json": {
|
|
551
|
+
schema: agentsCore.AgentWithinContextOfProjectSchema
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
responses: {
|
|
557
|
+
200: {
|
|
558
|
+
description: "Full agent updated successfully",
|
|
559
|
+
content: {
|
|
560
|
+
"application/json": {
|
|
561
|
+
schema: agentsCore.SingleResponseSchema(agentsCore.AgentWithinContextOfProjectSchema)
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
201: {
|
|
566
|
+
description: "Full agent created successfully",
|
|
567
|
+
content: {
|
|
568
|
+
"application/json": {
|
|
569
|
+
schema: agentsCore.SingleResponseSchema(agentsCore.AgentWithinContextOfProjectSchema)
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
...agentsCore.commonGetErrorResponses
|
|
574
|
+
}
|
|
575
|
+
}),
|
|
576
|
+
async (c) => {
|
|
577
|
+
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
578
|
+
const agentData = c.req.valid("json");
|
|
579
|
+
try {
|
|
580
|
+
const validatedAgentData = agentsCore.AgentWithinContextOfProjectSchema.parse(agentData);
|
|
581
|
+
if (agentId !== validatedAgentData.id) {
|
|
582
|
+
throw agentsCore.createApiError({
|
|
583
|
+
code: "bad_request",
|
|
584
|
+
message: `Agent ID mismatch: expected ${agentId}, got ${validatedAgentData.id}`
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
const existingAgent = await agentsCore.getFullAgent(
|
|
588
|
+
dbClient_default,
|
|
589
|
+
logger2
|
|
590
|
+
)({
|
|
591
|
+
scopes: { tenantId, projectId, agentId }
|
|
592
|
+
});
|
|
593
|
+
const isCreate = !existingAgent;
|
|
594
|
+
const updatedAgent = isCreate ? await agentsCore.createFullAgentServerSide(dbClient_default, logger2)(
|
|
595
|
+
{ tenantId, projectId },
|
|
596
|
+
validatedAgentData
|
|
597
|
+
) : await agentsCore.updateFullAgentServerSide(dbClient_default, logger2)(
|
|
598
|
+
{ tenantId, projectId },
|
|
599
|
+
validatedAgentData
|
|
600
|
+
);
|
|
601
|
+
return c.json({ data: updatedAgent }, isCreate ? 201 : 200);
|
|
602
|
+
} catch (error) {
|
|
603
|
+
if (error instanceof zod.z.ZodError) {
|
|
604
|
+
throw agentsCore.createApiError({
|
|
605
|
+
code: "bad_request",
|
|
606
|
+
message: "Invalid agent definition"
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
if (error instanceof Error && error.message.includes("ID mismatch")) {
|
|
610
|
+
throw agentsCore.createApiError({
|
|
611
|
+
code: "bad_request",
|
|
612
|
+
message: error.message
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
throw agentsCore.createApiError({
|
|
616
|
+
code: "internal_server_error",
|
|
617
|
+
message: error instanceof Error ? error.message : "Failed to update agent"
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
);
|
|
622
|
+
app2.openapi(
|
|
623
|
+
zodOpenapi.createRoute({
|
|
624
|
+
method: "delete",
|
|
625
|
+
path: "/{agentId}",
|
|
626
|
+
summary: "Delete Full Agent",
|
|
627
|
+
operationId: "delete-full-agent",
|
|
628
|
+
tags: ["Full Agent"],
|
|
629
|
+
description: "Delete a complete agent and cascade to all related entities (relationships, not other agents/tools)",
|
|
630
|
+
request: {
|
|
631
|
+
params: AgentIdParamsSchema
|
|
632
|
+
},
|
|
633
|
+
responses: {
|
|
634
|
+
204: {
|
|
635
|
+
description: "Agent deleted successfully"
|
|
636
|
+
},
|
|
637
|
+
...agentsCore.commonGetErrorResponses
|
|
638
|
+
}
|
|
639
|
+
}),
|
|
640
|
+
async (c) => {
|
|
641
|
+
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
642
|
+
try {
|
|
643
|
+
const deleted = await agentsCore.deleteFullAgent(
|
|
644
|
+
dbClient_default,
|
|
645
|
+
logger2
|
|
646
|
+
)({
|
|
647
|
+
scopes: { tenantId, projectId, agentId }
|
|
648
|
+
});
|
|
649
|
+
if (!deleted) {
|
|
650
|
+
throw agentsCore.createApiError({
|
|
651
|
+
code: "not_found",
|
|
652
|
+
message: "Agent not found"
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
return c.body(null, 204);
|
|
656
|
+
} catch (error) {
|
|
657
|
+
if (error instanceof Error && error.message.includes("not found")) {
|
|
658
|
+
throw agentsCore.createApiError({
|
|
659
|
+
code: "not_found",
|
|
660
|
+
message: "Agent not found"
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
throw agentsCore.createApiError({
|
|
664
|
+
code: "internal_server_error",
|
|
665
|
+
message: error instanceof Error ? error.message : "Failed to delete agent"
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
);
|
|
670
|
+
var agentFull_default = app2;
|
|
671
|
+
var app3 = new zodOpenapi.OpenAPIHono();
|
|
672
|
+
app3.openapi(
|
|
422
673
|
zodOpenapi.createRoute({
|
|
423
674
|
method: "get",
|
|
424
675
|
path: "/",
|
|
@@ -461,7 +712,7 @@ app2.openapi(
|
|
|
461
712
|
});
|
|
462
713
|
}
|
|
463
714
|
);
|
|
464
|
-
|
|
715
|
+
app3.openapi(
|
|
465
716
|
zodOpenapi.createRoute({
|
|
466
717
|
method: "get",
|
|
467
718
|
path: "/{id}",
|
|
@@ -506,7 +757,7 @@ app2.openapi(
|
|
|
506
757
|
});
|
|
507
758
|
}
|
|
508
759
|
);
|
|
509
|
-
|
|
760
|
+
app3.openapi(
|
|
510
761
|
zodOpenapi.createRoute({
|
|
511
762
|
method: "post",
|
|
512
763
|
path: "/",
|
|
@@ -576,7 +827,7 @@ app2.openapi(
|
|
|
576
827
|
}
|
|
577
828
|
}
|
|
578
829
|
);
|
|
579
|
-
|
|
830
|
+
app3.openapi(
|
|
580
831
|
zodOpenapi.createRoute({
|
|
581
832
|
method: "put",
|
|
582
833
|
path: "/{id}",
|
|
@@ -633,7 +884,7 @@ app2.openapi(
|
|
|
633
884
|
});
|
|
634
885
|
}
|
|
635
886
|
);
|
|
636
|
-
|
|
887
|
+
app3.openapi(
|
|
637
888
|
zodOpenapi.createRoute({
|
|
638
889
|
method: "delete",
|
|
639
890
|
path: "/{id}",
|
|
@@ -673,9 +924,9 @@ app2.openapi(
|
|
|
673
924
|
return c.body(null, 204);
|
|
674
925
|
}
|
|
675
926
|
);
|
|
676
|
-
var apiKeys_default =
|
|
677
|
-
var
|
|
678
|
-
|
|
927
|
+
var apiKeys_default = app3;
|
|
928
|
+
var app4 = new zodOpenapi.OpenAPIHono();
|
|
929
|
+
app4.openapi(
|
|
679
930
|
zodOpenapi.createRoute({
|
|
680
931
|
method: "get",
|
|
681
932
|
path: "/",
|
|
@@ -709,7 +960,7 @@ app3.openapi(
|
|
|
709
960
|
return c.json(result);
|
|
710
961
|
}
|
|
711
962
|
);
|
|
712
|
-
|
|
963
|
+
app4.openapi(
|
|
713
964
|
zodOpenapi.createRoute({
|
|
714
965
|
method: "get",
|
|
715
966
|
path: "/{id}",
|
|
@@ -746,7 +997,7 @@ app3.openapi(
|
|
|
746
997
|
return c.json({ data: artifactComponent });
|
|
747
998
|
}
|
|
748
999
|
);
|
|
749
|
-
|
|
1000
|
+
app4.openapi(
|
|
750
1001
|
zodOpenapi.createRoute({
|
|
751
1002
|
method: "post",
|
|
752
1003
|
path: "/",
|
|
@@ -813,7 +1064,7 @@ app3.openapi(
|
|
|
813
1064
|
}
|
|
814
1065
|
}
|
|
815
1066
|
);
|
|
816
|
-
|
|
1067
|
+
app4.openapi(
|
|
817
1068
|
zodOpenapi.createRoute({
|
|
818
1069
|
method: "put",
|
|
819
1070
|
path: "/{id}",
|
|
@@ -879,7 +1130,7 @@ app3.openapi(
|
|
|
879
1130
|
return c.json({ data: updatedArtifactComponent });
|
|
880
1131
|
}
|
|
881
1132
|
);
|
|
882
|
-
|
|
1133
|
+
app4.openapi(
|
|
883
1134
|
zodOpenapi.createRoute({
|
|
884
1135
|
method: "delete",
|
|
885
1136
|
path: "/{id}",
|
|
@@ -918,9 +1169,9 @@ app3.openapi(
|
|
|
918
1169
|
return c.body(null, 204);
|
|
919
1170
|
}
|
|
920
1171
|
);
|
|
921
|
-
var artifactComponents_default =
|
|
922
|
-
var
|
|
923
|
-
|
|
1172
|
+
var artifactComponents_default = app4;
|
|
1173
|
+
var app5 = new zodOpenapi.OpenAPIHono();
|
|
1174
|
+
app5.openapi(
|
|
924
1175
|
zodOpenapi.createRoute({
|
|
925
1176
|
method: "get",
|
|
926
1177
|
path: "/",
|
|
@@ -954,7 +1205,7 @@ app4.openapi(
|
|
|
954
1205
|
return c.json(result);
|
|
955
1206
|
}
|
|
956
1207
|
);
|
|
957
|
-
|
|
1208
|
+
app5.openapi(
|
|
958
1209
|
zodOpenapi.createRoute({
|
|
959
1210
|
method: "get",
|
|
960
1211
|
path: "/{id}",
|
|
@@ -991,7 +1242,7 @@ app4.openapi(
|
|
|
991
1242
|
return c.json({ data: contextConfig });
|
|
992
1243
|
}
|
|
993
1244
|
);
|
|
994
|
-
|
|
1245
|
+
app5.openapi(
|
|
995
1246
|
zodOpenapi.createRoute({
|
|
996
1247
|
method: "post",
|
|
997
1248
|
path: "/",
|
|
@@ -1033,7 +1284,7 @@ app4.openapi(
|
|
|
1033
1284
|
return c.json({ data: contextConfig }, 201);
|
|
1034
1285
|
}
|
|
1035
1286
|
);
|
|
1036
|
-
|
|
1287
|
+
app5.openapi(
|
|
1037
1288
|
zodOpenapi.createRoute({
|
|
1038
1289
|
method: "put",
|
|
1039
1290
|
path: "/{id}",
|
|
@@ -1079,7 +1330,7 @@ app4.openapi(
|
|
|
1079
1330
|
return c.json({ data: updatedContextConfig });
|
|
1080
1331
|
}
|
|
1081
1332
|
);
|
|
1082
|
-
|
|
1333
|
+
app5.openapi(
|
|
1083
1334
|
zodOpenapi.createRoute({
|
|
1084
1335
|
method: "delete",
|
|
1085
1336
|
path: "/{id}",
|
|
@@ -1111,9 +1362,139 @@ app4.openapi(
|
|
|
1111
1362
|
return c.body(null, 204);
|
|
1112
1363
|
}
|
|
1113
1364
|
);
|
|
1114
|
-
var contextConfigs_default =
|
|
1115
|
-
var
|
|
1116
|
-
|
|
1365
|
+
var contextConfigs_default = app5;
|
|
1366
|
+
var app6 = new zodOpenapi.OpenAPIHono();
|
|
1367
|
+
var CredentialStoreSchema = zod.z.object({
|
|
1368
|
+
id: zod.z.string().describe("Unique identifier of the credential store"),
|
|
1369
|
+
type: zod.z.enum(agentsCore.CredentialStoreType),
|
|
1370
|
+
available: zod.z.boolean().describe("Whether the store is functional and ready to use"),
|
|
1371
|
+
reason: zod.z.string().nullable().describe("Reason why store is not available, if applicable")
|
|
1372
|
+
});
|
|
1373
|
+
var CredentialStoreListResponseSchema = zod.z.object({
|
|
1374
|
+
data: zod.z.array(CredentialStoreSchema).describe("List of credential stores")
|
|
1375
|
+
});
|
|
1376
|
+
var CreateCredentialInStoreRequestSchema = zod.z.object({
|
|
1377
|
+
key: zod.z.string().describe("The credential key"),
|
|
1378
|
+
value: zod.z.string().describe("The credential value")
|
|
1379
|
+
});
|
|
1380
|
+
var CreateCredentialInStoreResponseSchema = zod.z.object({
|
|
1381
|
+
data: zod.z.object({
|
|
1382
|
+
key: zod.z.string().describe("The credential key"),
|
|
1383
|
+
storeId: zod.z.string().describe("The store ID where credential was created"),
|
|
1384
|
+
createdAt: zod.z.string().describe("ISO timestamp of creation")
|
|
1385
|
+
})
|
|
1386
|
+
});
|
|
1387
|
+
app6.openapi(
|
|
1388
|
+
zodOpenapi.createRoute({
|
|
1389
|
+
method: "get",
|
|
1390
|
+
path: "/",
|
|
1391
|
+
summary: "List Credential Stores",
|
|
1392
|
+
operationId: "list-credential-stores",
|
|
1393
|
+
tags: ["Credential Store"],
|
|
1394
|
+
request: {
|
|
1395
|
+
params: agentsCore.TenantProjectParamsSchema
|
|
1396
|
+
},
|
|
1397
|
+
responses: {
|
|
1398
|
+
200: {
|
|
1399
|
+
description: "List of credential stores retrieved successfully",
|
|
1400
|
+
content: {
|
|
1401
|
+
"application/json": {
|
|
1402
|
+
schema: CredentialStoreListResponseSchema
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
...agentsCore.commonGetErrorResponses
|
|
1407
|
+
}
|
|
1408
|
+
}),
|
|
1409
|
+
async (c) => {
|
|
1410
|
+
const credentialStores = c.get("credentialStores");
|
|
1411
|
+
const allStores = credentialStores.getAll();
|
|
1412
|
+
const storeStatuses = await Promise.all(
|
|
1413
|
+
allStores.map(async (store) => {
|
|
1414
|
+
const { available, reason } = await store.checkAvailability();
|
|
1415
|
+
return {
|
|
1416
|
+
id: store.id,
|
|
1417
|
+
type: store.type,
|
|
1418
|
+
available,
|
|
1419
|
+
reason: reason || null
|
|
1420
|
+
};
|
|
1421
|
+
})
|
|
1422
|
+
);
|
|
1423
|
+
return c.json({
|
|
1424
|
+
data: storeStatuses
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1427
|
+
);
|
|
1428
|
+
app6.openapi(
|
|
1429
|
+
zodOpenapi.createRoute({
|
|
1430
|
+
method: "post",
|
|
1431
|
+
path: "/{id}/credentials",
|
|
1432
|
+
summary: "Create Credential in Store",
|
|
1433
|
+
operationId: "create-credential-in-store",
|
|
1434
|
+
tags: ["Credential Store"],
|
|
1435
|
+
request: {
|
|
1436
|
+
params: agentsCore.TenantProjectIdParamsSchema.extend({
|
|
1437
|
+
id: zod.z.string().describe("The credential store ID")
|
|
1438
|
+
}),
|
|
1439
|
+
body: {
|
|
1440
|
+
content: {
|
|
1441
|
+
"application/json": {
|
|
1442
|
+
schema: CreateCredentialInStoreRequestSchema
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
},
|
|
1447
|
+
responses: {
|
|
1448
|
+
201: {
|
|
1449
|
+
description: "Credential created successfully",
|
|
1450
|
+
content: {
|
|
1451
|
+
"application/json": {
|
|
1452
|
+
schema: CreateCredentialInStoreResponseSchema
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
},
|
|
1456
|
+
...agentsCore.commonGetErrorResponses
|
|
1457
|
+
}
|
|
1458
|
+
}),
|
|
1459
|
+
async (c) => {
|
|
1460
|
+
const { id: storeId } = c.req.param();
|
|
1461
|
+
const { key, value } = await c.req.json();
|
|
1462
|
+
const credentialStores = c.get("credentialStores");
|
|
1463
|
+
const store = credentialStores.get(storeId);
|
|
1464
|
+
if (!store) {
|
|
1465
|
+
throw agentsCore.createApiError({
|
|
1466
|
+
code: "not_found",
|
|
1467
|
+
message: `Credential store '${storeId}' not found`
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
try {
|
|
1471
|
+
const { available, reason } = await store.checkAvailability();
|
|
1472
|
+
if (!available) {
|
|
1473
|
+
throw agentsCore.createApiError({
|
|
1474
|
+
code: "internal_server_error",
|
|
1475
|
+
message: `Credential store '${storeId}' is not available: ${reason}`
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
await store.set(key, value);
|
|
1479
|
+
return c.json({
|
|
1480
|
+
data: {
|
|
1481
|
+
key,
|
|
1482
|
+
storeId,
|
|
1483
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1484
|
+
}
|
|
1485
|
+
}, 201);
|
|
1486
|
+
} catch (error) {
|
|
1487
|
+
console.error(`Error setting credential in store ${storeId}:`, error);
|
|
1488
|
+
throw agentsCore.createApiError({
|
|
1489
|
+
code: "internal_server_error",
|
|
1490
|
+
message: `Failed to store credential: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
);
|
|
1495
|
+
var credentialStores_default = app6;
|
|
1496
|
+
var app7 = new zodOpenapi.OpenAPIHono();
|
|
1497
|
+
app7.openapi(
|
|
1117
1498
|
zodOpenapi.createRoute({
|
|
1118
1499
|
method: "get",
|
|
1119
1500
|
path: "/",
|
|
@@ -1148,7 +1529,7 @@ app5.openapi(
|
|
|
1148
1529
|
return c.json(validatedResult);
|
|
1149
1530
|
}
|
|
1150
1531
|
);
|
|
1151
|
-
|
|
1532
|
+
app7.openapi(
|
|
1152
1533
|
zodOpenapi.createRoute({
|
|
1153
1534
|
method: "get",
|
|
1154
1535
|
path: "/{id}",
|
|
@@ -1186,7 +1567,7 @@ app5.openapi(
|
|
|
1186
1567
|
return c.json({ data: validatedCredential });
|
|
1187
1568
|
}
|
|
1188
1569
|
);
|
|
1189
|
-
|
|
1570
|
+
app7.openapi(
|
|
1190
1571
|
zodOpenapi.createRoute({
|
|
1191
1572
|
method: "post",
|
|
1192
1573
|
path: "/",
|
|
@@ -1228,7 +1609,7 @@ app5.openapi(
|
|
|
1228
1609
|
return c.json({ data: validatedCredential }, 201);
|
|
1229
1610
|
}
|
|
1230
1611
|
);
|
|
1231
|
-
|
|
1612
|
+
app7.openapi(
|
|
1232
1613
|
zodOpenapi.createRoute({
|
|
1233
1614
|
method: "put",
|
|
1234
1615
|
path: "/{id}",
|
|
@@ -1275,7 +1656,7 @@ app5.openapi(
|
|
|
1275
1656
|
return c.json({ data: validatedCredential });
|
|
1276
1657
|
}
|
|
1277
1658
|
);
|
|
1278
|
-
|
|
1659
|
+
app7.openapi(
|
|
1279
1660
|
zodOpenapi.createRoute({
|
|
1280
1661
|
method: "delete",
|
|
1281
1662
|
path: "/{id}",
|
|
@@ -1346,9 +1727,9 @@ app5.openapi(
|
|
|
1346
1727
|
return c.body(null, 204);
|
|
1347
1728
|
}
|
|
1348
1729
|
);
|
|
1349
|
-
var credentials_default =
|
|
1350
|
-
var
|
|
1351
|
-
|
|
1730
|
+
var credentials_default = app7;
|
|
1731
|
+
var app8 = new zodOpenapi.OpenAPIHono();
|
|
1732
|
+
app8.openapi(
|
|
1352
1733
|
zodOpenapi.createRoute({
|
|
1353
1734
|
method: "get",
|
|
1354
1735
|
path: "/",
|
|
@@ -1382,7 +1763,7 @@ app6.openapi(
|
|
|
1382
1763
|
return c.json(result);
|
|
1383
1764
|
}
|
|
1384
1765
|
);
|
|
1385
|
-
|
|
1766
|
+
app8.openapi(
|
|
1386
1767
|
zodOpenapi.createRoute({
|
|
1387
1768
|
method: "get",
|
|
1388
1769
|
path: "/{id}",
|
|
@@ -1419,7 +1800,7 @@ app6.openapi(
|
|
|
1419
1800
|
return c.json({ data: dataComponent });
|
|
1420
1801
|
}
|
|
1421
1802
|
);
|
|
1422
|
-
|
|
1803
|
+
app8.openapi(
|
|
1423
1804
|
zodOpenapi.createRoute({
|
|
1424
1805
|
method: "post",
|
|
1425
1806
|
path: "/",
|
|
@@ -1470,7 +1851,7 @@ app6.openapi(
|
|
|
1470
1851
|
return c.json({ data: dataComponent }, 201);
|
|
1471
1852
|
}
|
|
1472
1853
|
);
|
|
1473
|
-
|
|
1854
|
+
app8.openapi(
|
|
1474
1855
|
zodOpenapi.createRoute({
|
|
1475
1856
|
method: "put",
|
|
1476
1857
|
path: "/{id}",
|
|
@@ -1526,7 +1907,7 @@ app6.openapi(
|
|
|
1526
1907
|
return c.json({ data: updatedDataComponent });
|
|
1527
1908
|
}
|
|
1528
1909
|
);
|
|
1529
|
-
|
|
1910
|
+
app8.openapi(
|
|
1530
1911
|
zodOpenapi.createRoute({
|
|
1531
1912
|
method: "delete",
|
|
1532
1913
|
path: "/{id}",
|
|
@@ -1565,9 +1946,9 @@ app6.openapi(
|
|
|
1565
1946
|
return c.body(null, 204);
|
|
1566
1947
|
}
|
|
1567
1948
|
);
|
|
1568
|
-
var dataComponents_default =
|
|
1569
|
-
var
|
|
1570
|
-
|
|
1949
|
+
var dataComponents_default = app8;
|
|
1950
|
+
var app9 = new zodOpenapi.OpenAPIHono();
|
|
1951
|
+
app9.openapi(
|
|
1571
1952
|
zodOpenapi.createRoute({
|
|
1572
1953
|
method: "get",
|
|
1573
1954
|
path: "/",
|
|
@@ -1607,7 +1988,7 @@ app7.openapi(
|
|
|
1607
1988
|
return c.json(dataWithType);
|
|
1608
1989
|
}
|
|
1609
1990
|
);
|
|
1610
|
-
|
|
1991
|
+
app9.openapi(
|
|
1611
1992
|
zodOpenapi.createRoute({
|
|
1612
1993
|
method: "get",
|
|
1613
1994
|
path: "/{id}",
|
|
@@ -1648,7 +2029,7 @@ app7.openapi(
|
|
|
1648
2029
|
return c.json({ data: agentWithType });
|
|
1649
2030
|
}
|
|
1650
2031
|
);
|
|
1651
|
-
|
|
2032
|
+
app9.openapi(
|
|
1652
2033
|
zodOpenapi.createRoute({
|
|
1653
2034
|
method: "post",
|
|
1654
2035
|
path: "/",
|
|
@@ -1699,7 +2080,7 @@ app7.openapi(
|
|
|
1699
2080
|
return c.json({ data: agentWithType }, 201);
|
|
1700
2081
|
}
|
|
1701
2082
|
);
|
|
1702
|
-
|
|
2083
|
+
app9.openapi(
|
|
1703
2084
|
zodOpenapi.createRoute({
|
|
1704
2085
|
method: "put",
|
|
1705
2086
|
path: "/{id}",
|
|
@@ -1749,7 +2130,7 @@ app7.openapi(
|
|
|
1749
2130
|
return c.json({ data: agentWithType });
|
|
1750
2131
|
}
|
|
1751
2132
|
);
|
|
1752
|
-
|
|
2133
|
+
app9.openapi(
|
|
1753
2134
|
zodOpenapi.createRoute({
|
|
1754
2135
|
method: "delete",
|
|
1755
2136
|
path: "/{id}",
|
|
@@ -1788,10 +2169,10 @@ app7.openapi(
|
|
|
1788
2169
|
return c.body(null, 204);
|
|
1789
2170
|
}
|
|
1790
2171
|
);
|
|
1791
|
-
var externalAgents_default =
|
|
1792
|
-
var
|
|
1793
|
-
var
|
|
1794
|
-
|
|
2172
|
+
var externalAgents_default = app9;
|
|
2173
|
+
var logger3 = agentsCore.getLogger("functions");
|
|
2174
|
+
var app10 = new zodOpenapi.OpenAPIHono();
|
|
2175
|
+
app10.openapi(
|
|
1795
2176
|
zodOpenapi.createRoute({
|
|
1796
2177
|
method: "get",
|
|
1797
2178
|
path: "/",
|
|
@@ -1828,7 +2209,7 @@ app8.openapi(
|
|
|
1828
2209
|
}
|
|
1829
2210
|
});
|
|
1830
2211
|
} catch (error) {
|
|
1831
|
-
|
|
2212
|
+
logger3.error({ error, tenantId }, "Failed to list functions");
|
|
1832
2213
|
return c.json(
|
|
1833
2214
|
agentsCore.createApiError({ code: "internal_server_error", message: "Failed to list functions" }),
|
|
1834
2215
|
500
|
|
@@ -1836,7 +2217,7 @@ app8.openapi(
|
|
|
1836
2217
|
}
|
|
1837
2218
|
}
|
|
1838
2219
|
);
|
|
1839
|
-
|
|
2220
|
+
app10.openapi(
|
|
1840
2221
|
zodOpenapi.createRoute({
|
|
1841
2222
|
method: "get",
|
|
1842
2223
|
path: "/{id}",
|
|
@@ -1873,7 +2254,7 @@ app8.openapi(
|
|
|
1873
2254
|
}
|
|
1874
2255
|
return c.json({ data: functionData });
|
|
1875
2256
|
} catch (error) {
|
|
1876
|
-
|
|
2257
|
+
logger3.error({ error, tenantId, id }, "Failed to get function");
|
|
1877
2258
|
return c.json(
|
|
1878
2259
|
agentsCore.createApiError({ code: "internal_server_error", message: "Failed to get function" }),
|
|
1879
2260
|
500
|
|
@@ -1881,7 +2262,7 @@ app8.openapi(
|
|
|
1881
2262
|
}
|
|
1882
2263
|
}
|
|
1883
2264
|
);
|
|
1884
|
-
|
|
2265
|
+
app10.openapi(
|
|
1885
2266
|
zodOpenapi.createRoute({
|
|
1886
2267
|
method: "post",
|
|
1887
2268
|
path: "/",
|
|
@@ -1926,10 +2307,10 @@ app8.openapi(
|
|
|
1926
2307
|
functionId: id,
|
|
1927
2308
|
scopes: { tenantId, projectId }
|
|
1928
2309
|
});
|
|
1929
|
-
|
|
2310
|
+
logger3.info({ tenantId, functionId: id }, "Function created");
|
|
1930
2311
|
return c.json({ data: created }, 201);
|
|
1931
2312
|
} catch (error) {
|
|
1932
|
-
|
|
2313
|
+
logger3.error({ error, tenantId, functionData }, "Failed to create function");
|
|
1933
2314
|
return c.json(
|
|
1934
2315
|
agentsCore.createApiError({ code: "internal_server_error", message: "Failed to create function" }),
|
|
1935
2316
|
500
|
|
@@ -1937,7 +2318,7 @@ app8.openapi(
|
|
|
1937
2318
|
}
|
|
1938
2319
|
}
|
|
1939
2320
|
);
|
|
1940
|
-
|
|
2321
|
+
app10.openapi(
|
|
1941
2322
|
zodOpenapi.createRoute({
|
|
1942
2323
|
method: "put",
|
|
1943
2324
|
path: "/{id}",
|
|
@@ -1992,10 +2373,10 @@ app8.openapi(
|
|
|
1992
2373
|
functionId: id,
|
|
1993
2374
|
scopes: { tenantId, projectId }
|
|
1994
2375
|
});
|
|
1995
|
-
|
|
2376
|
+
logger3.info({ tenantId, functionId: id }, "Function updated");
|
|
1996
2377
|
return c.json({ data: updated });
|
|
1997
2378
|
} catch (error) {
|
|
1998
|
-
|
|
2379
|
+
logger3.error({ error, tenantId, id, updateData }, "Failed to update function");
|
|
1999
2380
|
return c.json(
|
|
2000
2381
|
agentsCore.createApiError({ code: "internal_server_error", message: "Failed to update function" }),
|
|
2001
2382
|
500
|
|
@@ -2003,7 +2384,7 @@ app8.openapi(
|
|
|
2003
2384
|
}
|
|
2004
2385
|
}
|
|
2005
2386
|
);
|
|
2006
|
-
|
|
2387
|
+
app10.openapi(
|
|
2007
2388
|
zodOpenapi.createRoute({
|
|
2008
2389
|
method: "delete",
|
|
2009
2390
|
path: "/{id}",
|
|
@@ -2037,10 +2418,10 @@ app8.openapi(
|
|
|
2037
2418
|
functionId: id,
|
|
2038
2419
|
scopes: { tenantId, projectId }
|
|
2039
2420
|
});
|
|
2040
|
-
|
|
2421
|
+
logger3.info({ tenantId, functionId: id }, "Function deleted");
|
|
2041
2422
|
return c.body(null, 204);
|
|
2042
2423
|
} catch (error) {
|
|
2043
|
-
|
|
2424
|
+
logger3.error({ error, tenantId, id }, "Failed to delete function");
|
|
2044
2425
|
return c.json(
|
|
2045
2426
|
agentsCore.createApiError({ code: "internal_server_error", message: "Failed to delete function" }),
|
|
2046
2427
|
500
|
|
@@ -2048,10 +2429,10 @@ app8.openapi(
|
|
|
2048
2429
|
}
|
|
2049
2430
|
}
|
|
2050
2431
|
);
|
|
2051
|
-
var functions_default =
|
|
2052
|
-
var
|
|
2053
|
-
var
|
|
2054
|
-
|
|
2432
|
+
var functions_default = app10;
|
|
2433
|
+
var logger4 = agentsCore.getLogger("functionTools");
|
|
2434
|
+
var app11 = new zodOpenapi.OpenAPIHono();
|
|
2435
|
+
app11.openapi(
|
|
2055
2436
|
zodOpenapi.createRoute({
|
|
2056
2437
|
method: "get",
|
|
2057
2438
|
path: "/",
|
|
@@ -2084,7 +2465,7 @@ app9.openapi(
|
|
|
2084
2465
|
});
|
|
2085
2466
|
return c.json(result);
|
|
2086
2467
|
} catch (error) {
|
|
2087
|
-
|
|
2468
|
+
logger4.error({ error, tenantId, projectId, agentId }, "Failed to list function tools");
|
|
2088
2469
|
return c.json(
|
|
2089
2470
|
agentsCore.createApiError({ code: "internal_server_error", message: "Failed to list function tools" }),
|
|
2090
2471
|
500
|
|
@@ -2092,7 +2473,7 @@ app9.openapi(
|
|
|
2092
2473
|
}
|
|
2093
2474
|
}
|
|
2094
2475
|
);
|
|
2095
|
-
|
|
2476
|
+
app11.openapi(
|
|
2096
2477
|
zodOpenapi.createRoute({
|
|
2097
2478
|
method: "get",
|
|
2098
2479
|
path: "/:id",
|
|
@@ -2131,7 +2512,7 @@ app9.openapi(
|
|
|
2131
2512
|
}
|
|
2132
2513
|
return c.json({ data: functionTool });
|
|
2133
2514
|
} catch (error) {
|
|
2134
|
-
|
|
2515
|
+
logger4.error({ error, tenantId, projectId, agentId, id }, "Failed to get function tool");
|
|
2135
2516
|
return c.json(
|
|
2136
2517
|
agentsCore.createApiError({ code: "internal_server_error", message: "Failed to get function tool" }),
|
|
2137
2518
|
500
|
|
@@ -2139,7 +2520,7 @@ app9.openapi(
|
|
|
2139
2520
|
}
|
|
2140
2521
|
}
|
|
2141
2522
|
);
|
|
2142
|
-
|
|
2523
|
+
app11.openapi(
|
|
2143
2524
|
zodOpenapi.createRoute({
|
|
2144
2525
|
method: "post",
|
|
2145
2526
|
path: "/",
|
|
@@ -2169,288 +2550,55 @@ app9.openapi(
|
|
|
2169
2550
|
}
|
|
2170
2551
|
}),
|
|
2171
2552
|
async (c) => {
|
|
2172
|
-
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
2173
|
-
const body = c.req.valid("json");
|
|
2174
|
-
try {
|
|
2175
|
-
const id = body.id || nanoid.nanoid();
|
|
2176
|
-
const functionTool = await agentsCore.createFunctionTool(dbClient_default)({
|
|
2177
|
-
scopes: { tenantId, projectId, agentId },
|
|
2178
|
-
data: {
|
|
2179
|
-
...body,
|
|
2180
|
-
id
|
|
2181
|
-
}
|
|
2182
|
-
});
|
|
2183
|
-
return c.json({ data: functionTool }, 201);
|
|
2184
|
-
} catch (error) {
|
|
2185
|
-
logger3.error({ error, tenantId, projectId, agentId, body }, "Failed to create function tool");
|
|
2186
|
-
return c.json(
|
|
2187
|
-
agentsCore.createApiError({
|
|
2188
|
-
code: "internal_server_error",
|
|
2189
|
-
message: "Failed to create function tool"
|
|
2190
|
-
}),
|
|
2191
|
-
500
|
|
2192
|
-
);
|
|
2193
|
-
}
|
|
2194
|
-
}
|
|
2195
|
-
);
|
|
2196
|
-
app9.openapi(
|
|
2197
|
-
zodOpenapi.createRoute({
|
|
2198
|
-
method: "put",
|
|
2199
|
-
path: "/:id",
|
|
2200
|
-
summary: "Update Function Tool",
|
|
2201
|
-
operationId: "update-function-tool",
|
|
2202
|
-
tags: ["Function Tools"],
|
|
2203
|
-
request: {
|
|
2204
|
-
params: agentsCore.TenantProjectAgentParamsSchema.extend({
|
|
2205
|
-
id: zod.z.string()
|
|
2206
|
-
}),
|
|
2207
|
-
body: {
|
|
2208
|
-
content: {
|
|
2209
|
-
"application/json": {
|
|
2210
|
-
schema: agentsCore.FunctionToolApiUpdateSchema
|
|
2211
|
-
}
|
|
2212
|
-
}
|
|
2213
|
-
}
|
|
2214
|
-
},
|
|
2215
|
-
responses: {
|
|
2216
|
-
200: {
|
|
2217
|
-
description: "Function tool updated successfully",
|
|
2218
|
-
content: {
|
|
2219
|
-
"application/json": {
|
|
2220
|
-
schema: agentsCore.SingleResponseSchema(agentsCore.FunctionToolApiSelectSchema)
|
|
2221
|
-
}
|
|
2222
|
-
}
|
|
2223
|
-
},
|
|
2224
|
-
...agentsCore.commonGetErrorResponses
|
|
2225
|
-
}
|
|
2226
|
-
}),
|
|
2227
|
-
async (c) => {
|
|
2228
|
-
const { tenantId, projectId, agentId, id } = c.req.valid("param");
|
|
2229
|
-
const body = c.req.valid("json");
|
|
2230
|
-
try {
|
|
2231
|
-
const functionTool = await agentsCore.updateFunctionTool(dbClient_default)({
|
|
2232
|
-
scopes: { tenantId, projectId, agentId },
|
|
2233
|
-
functionToolId: id,
|
|
2234
|
-
data: body
|
|
2235
|
-
});
|
|
2236
|
-
if (!functionTool) {
|
|
2237
|
-
return c.json(
|
|
2238
|
-
agentsCore.createApiError({ code: "not_found", message: "Function tool not found" }),
|
|
2239
|
-
404
|
|
2240
|
-
);
|
|
2241
|
-
}
|
|
2242
|
-
return c.json({ data: functionTool });
|
|
2243
|
-
} catch (error) {
|
|
2244
|
-
logger3.error(
|
|
2245
|
-
{ error, tenantId, projectId, agentId, id, body },
|
|
2246
|
-
"Failed to update function tool"
|
|
2247
|
-
);
|
|
2248
|
-
return c.json(
|
|
2249
|
-
agentsCore.createApiError({
|
|
2250
|
-
code: "internal_server_error",
|
|
2251
|
-
message: "Failed to update function tool"
|
|
2252
|
-
}),
|
|
2253
|
-
500
|
|
2254
|
-
);
|
|
2255
|
-
}
|
|
2256
|
-
}
|
|
2257
|
-
);
|
|
2258
|
-
app9.openapi(
|
|
2259
|
-
zodOpenapi.createRoute({
|
|
2260
|
-
method: "delete",
|
|
2261
|
-
path: "/:id",
|
|
2262
|
-
summary: "Delete Function Tool",
|
|
2263
|
-
operationId: "delete-function-tool",
|
|
2264
|
-
tags: ["Function Tools"],
|
|
2265
|
-
request: {
|
|
2266
|
-
params: agentsCore.TenantProjectAgentParamsSchema.extend({
|
|
2267
|
-
id: zod.z.string()
|
|
2268
|
-
})
|
|
2269
|
-
},
|
|
2270
|
-
responses: {
|
|
2271
|
-
204: {
|
|
2272
|
-
description: "Function tool deleted successfully"
|
|
2273
|
-
},
|
|
2274
|
-
...agentsCore.commonGetErrorResponses
|
|
2275
|
-
}
|
|
2276
|
-
}),
|
|
2277
|
-
async (c) => {
|
|
2278
|
-
const { tenantId, projectId, agentId, id } = c.req.valid("param");
|
|
2279
|
-
try {
|
|
2280
|
-
const deleted = await agentsCore.deleteFunctionTool(dbClient_default)({
|
|
2281
|
-
scopes: { tenantId, projectId, agentId },
|
|
2282
|
-
functionToolId: id
|
|
2283
|
-
});
|
|
2284
|
-
if (!deleted) {
|
|
2285
|
-
return c.json(
|
|
2286
|
-
agentsCore.createApiError({ code: "not_found", message: "Function tool not found" }),
|
|
2287
|
-
404
|
|
2288
|
-
);
|
|
2289
|
-
}
|
|
2290
|
-
return c.body(null, 204);
|
|
2291
|
-
} catch (error) {
|
|
2292
|
-
logger3.error({ error, tenantId, projectId, agentId, id }, "Failed to delete function tool");
|
|
2293
|
-
return c.json(
|
|
2294
|
-
agentsCore.createApiError({
|
|
2295
|
-
code: "internal_server_error",
|
|
2296
|
-
message: "Failed to delete function tool"
|
|
2297
|
-
}),
|
|
2298
|
-
500
|
|
2299
|
-
);
|
|
2300
|
-
}
|
|
2301
|
-
}
|
|
2302
|
-
);
|
|
2303
|
-
var functionTools_default = app9;
|
|
2304
|
-
var logger4 = agentsCore.getLogger("agentFull");
|
|
2305
|
-
var app10 = new zodOpenapi.OpenAPIHono();
|
|
2306
|
-
var AgentIdParamsSchema = zod.z.object({
|
|
2307
|
-
tenantId: zod.z.string().openapi({
|
|
2308
|
-
description: "Tenant identifier",
|
|
2309
|
-
example: "tenant_123"
|
|
2310
|
-
}),
|
|
2311
|
-
projectId: zod.z.string().openapi({
|
|
2312
|
-
description: "Project identifier",
|
|
2313
|
-
example: "project_456"
|
|
2314
|
-
}),
|
|
2315
|
-
agentId: zod.z.string().openapi({
|
|
2316
|
-
description: "Agent identifier",
|
|
2317
|
-
example: "agent_789"
|
|
2318
|
-
})
|
|
2319
|
-
}).openapi("AgentIdParams");
|
|
2320
|
-
app10.openapi(
|
|
2321
|
-
zodOpenapi.createRoute({
|
|
2322
|
-
method: "post",
|
|
2323
|
-
path: "/",
|
|
2324
|
-
summary: "Create Full Agent",
|
|
2325
|
-
operationId: "create-full-agent",
|
|
2326
|
-
tags: ["Full Agent"],
|
|
2327
|
-
description: "Create a complete agent with all agents, tools, and relationships from JSON definition",
|
|
2328
|
-
request: {
|
|
2329
|
-
params: agentsCore.TenantProjectParamsSchema,
|
|
2330
|
-
body: {
|
|
2331
|
-
content: {
|
|
2332
|
-
"application/json": {
|
|
2333
|
-
schema: agentsCore.AgentWithinContextOfProjectSchema
|
|
2334
|
-
}
|
|
2335
|
-
}
|
|
2336
|
-
}
|
|
2337
|
-
},
|
|
2338
|
-
responses: {
|
|
2339
|
-
201: {
|
|
2340
|
-
description: "Full agent created successfully",
|
|
2341
|
-
content: {
|
|
2342
|
-
"application/json": {
|
|
2343
|
-
schema: agentsCore.SingleResponseSchema(agentsCore.AgentWithinContextOfProjectSchema)
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2346
|
-
},
|
|
2347
|
-
409: {
|
|
2348
|
-
description: "Agent already exists",
|
|
2349
|
-
content: {
|
|
2350
|
-
"application/json": {
|
|
2351
|
-
schema: agentsCore.ErrorResponseSchema
|
|
2352
|
-
}
|
|
2353
|
-
}
|
|
2354
|
-
},
|
|
2355
|
-
...agentsCore.commonGetErrorResponses
|
|
2356
|
-
}
|
|
2357
|
-
}),
|
|
2358
|
-
async (c) => {
|
|
2359
|
-
const { tenantId, projectId } = c.req.valid("param");
|
|
2360
|
-
const agentData = c.req.valid("json");
|
|
2361
|
-
const validatedAgentData = agentsCore.AgentWithinContextOfProjectSchema.parse(agentData);
|
|
2362
|
-
const createdAgent = await agentsCore.createFullAgentServerSide(dbClient_default, logger4)(
|
|
2363
|
-
{ tenantId, projectId },
|
|
2364
|
-
validatedAgentData
|
|
2365
|
-
);
|
|
2366
|
-
return c.json({ data: createdAgent }, 201);
|
|
2367
|
-
}
|
|
2368
|
-
);
|
|
2369
|
-
app10.openapi(
|
|
2370
|
-
zodOpenapi.createRoute({
|
|
2371
|
-
method: "get",
|
|
2372
|
-
path: "/{agentId}",
|
|
2373
|
-
summary: "Get Full Agent",
|
|
2374
|
-
operationId: "get-full-agent",
|
|
2375
|
-
tags: ["Full Agent"],
|
|
2376
|
-
description: "Retrieve a complete agent definition with all agents, tools, and relationships",
|
|
2377
|
-
request: {
|
|
2378
|
-
params: AgentIdParamsSchema
|
|
2379
|
-
},
|
|
2380
|
-
responses: {
|
|
2381
|
-
200: {
|
|
2382
|
-
description: "Full agent found",
|
|
2383
|
-
content: {
|
|
2384
|
-
"application/json": {
|
|
2385
|
-
schema: agentsCore.SingleResponseSchema(agentsCore.AgentWithinContextOfProjectSchema)
|
|
2386
|
-
}
|
|
2387
|
-
}
|
|
2388
|
-
},
|
|
2389
|
-
...agentsCore.commonGetErrorResponses
|
|
2390
|
-
}
|
|
2391
|
-
}),
|
|
2392
|
-
async (c) => {
|
|
2393
|
-
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
2394
|
-
try {
|
|
2395
|
-
const agent = await agentsCore.getFullAgent(
|
|
2396
|
-
dbClient_default,
|
|
2397
|
-
logger4
|
|
2398
|
-
)({
|
|
2399
|
-
scopes: { tenantId, projectId, agentId }
|
|
2400
|
-
});
|
|
2401
|
-
if (!agent) {
|
|
2402
|
-
throw agentsCore.createApiError({
|
|
2403
|
-
code: "not_found",
|
|
2404
|
-
message: "Agent not found"
|
|
2405
|
-
});
|
|
2406
|
-
}
|
|
2407
|
-
return c.json({ data: agent });
|
|
2408
|
-
} catch (error) {
|
|
2409
|
-
if (error instanceof Error && error.message.includes("not found")) {
|
|
2410
|
-
throw agentsCore.createApiError({
|
|
2411
|
-
code: "not_found",
|
|
2412
|
-
message: "Agent not found"
|
|
2413
|
-
});
|
|
2414
|
-
}
|
|
2415
|
-
throw agentsCore.createApiError({
|
|
2416
|
-
code: "internal_server_error",
|
|
2417
|
-
message: error instanceof Error ? error.message : "Failed to retrieve agent"
|
|
2553
|
+
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
2554
|
+
const body = c.req.valid("json");
|
|
2555
|
+
try {
|
|
2556
|
+
const id = body.id || nanoid.nanoid();
|
|
2557
|
+
const functionTool = await agentsCore.createFunctionTool(dbClient_default)({
|
|
2558
|
+
scopes: { tenantId, projectId, agentId },
|
|
2559
|
+
data: {
|
|
2560
|
+
...body,
|
|
2561
|
+
id
|
|
2562
|
+
}
|
|
2418
2563
|
});
|
|
2564
|
+
return c.json({ data: functionTool }, 201);
|
|
2565
|
+
} catch (error) {
|
|
2566
|
+
logger4.error({ error, tenantId, projectId, agentId, body }, "Failed to create function tool");
|
|
2567
|
+
return c.json(
|
|
2568
|
+
agentsCore.createApiError({
|
|
2569
|
+
code: "internal_server_error",
|
|
2570
|
+
message: "Failed to create function tool"
|
|
2571
|
+
}),
|
|
2572
|
+
500
|
|
2573
|
+
);
|
|
2419
2574
|
}
|
|
2420
2575
|
}
|
|
2421
2576
|
);
|
|
2422
|
-
|
|
2577
|
+
app11.openapi(
|
|
2423
2578
|
zodOpenapi.createRoute({
|
|
2424
2579
|
method: "put",
|
|
2425
|
-
path: "
|
|
2426
|
-
summary: "Update
|
|
2427
|
-
operationId: "update-
|
|
2428
|
-
tags: ["
|
|
2429
|
-
description: "Update or create a complete agent with all agents, tools, and relationships from JSON definition",
|
|
2580
|
+
path: "/:id",
|
|
2581
|
+
summary: "Update Function Tool",
|
|
2582
|
+
operationId: "update-function-tool",
|
|
2583
|
+
tags: ["Function Tools"],
|
|
2430
2584
|
request: {
|
|
2431
|
-
params:
|
|
2585
|
+
params: agentsCore.TenantProjectAgentParamsSchema.extend({
|
|
2586
|
+
id: zod.z.string()
|
|
2587
|
+
}),
|
|
2432
2588
|
body: {
|
|
2433
2589
|
content: {
|
|
2434
2590
|
"application/json": {
|
|
2435
|
-
schema: agentsCore.
|
|
2591
|
+
schema: agentsCore.FunctionToolApiUpdateSchema
|
|
2436
2592
|
}
|
|
2437
2593
|
}
|
|
2438
2594
|
}
|
|
2439
2595
|
},
|
|
2440
2596
|
responses: {
|
|
2441
2597
|
200: {
|
|
2442
|
-
description: "
|
|
2443
|
-
content: {
|
|
2444
|
-
"application/json": {
|
|
2445
|
-
schema: agentsCore.SingleResponseSchema(agentsCore.AgentWithinContextOfProjectSchema)
|
|
2446
|
-
}
|
|
2447
|
-
}
|
|
2448
|
-
},
|
|
2449
|
-
201: {
|
|
2450
|
-
description: "Full agent created successfully",
|
|
2598
|
+
description: "Function tool updated successfully",
|
|
2451
2599
|
content: {
|
|
2452
2600
|
"application/json": {
|
|
2453
|
-
schema: agentsCore.SingleResponseSchema(agentsCore.
|
|
2601
|
+
schema: agentsCore.SingleResponseSchema(agentsCore.FunctionToolApiSelectSchema)
|
|
2454
2602
|
}
|
|
2455
2603
|
}
|
|
2456
2604
|
},
|
|
@@ -2458,102 +2606,84 @@ app10.openapi(
|
|
|
2458
2606
|
}
|
|
2459
2607
|
}),
|
|
2460
2608
|
async (c) => {
|
|
2461
|
-
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
2462
|
-
const
|
|
2609
|
+
const { tenantId, projectId, agentId, id } = c.req.valid("param");
|
|
2610
|
+
const body = c.req.valid("json");
|
|
2463
2611
|
try {
|
|
2464
|
-
const
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
message: `Agent ID mismatch: expected ${agentId}, got ${validatedAgentData.id}`
|
|
2469
|
-
});
|
|
2470
|
-
}
|
|
2471
|
-
const existingAgent = await agentsCore.getFullAgent(
|
|
2472
|
-
dbClient_default,
|
|
2473
|
-
logger4
|
|
2474
|
-
)({
|
|
2475
|
-
scopes: { tenantId, projectId, agentId }
|
|
2612
|
+
const functionTool = await agentsCore.updateFunctionTool(dbClient_default)({
|
|
2613
|
+
scopes: { tenantId, projectId, agentId },
|
|
2614
|
+
functionToolId: id,
|
|
2615
|
+
data: body
|
|
2476
2616
|
});
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
{ tenantId, projectId },
|
|
2483
|
-
validatedAgentData
|
|
2484
|
-
);
|
|
2485
|
-
return c.json({ data: updatedAgent }, isCreate ? 201 : 200);
|
|
2486
|
-
} catch (error) {
|
|
2487
|
-
if (error instanceof zod.z.ZodError) {
|
|
2488
|
-
throw agentsCore.createApiError({
|
|
2489
|
-
code: "bad_request",
|
|
2490
|
-
message: "Invalid agent definition"
|
|
2491
|
-
});
|
|
2492
|
-
}
|
|
2493
|
-
if (error instanceof Error && error.message.includes("ID mismatch")) {
|
|
2494
|
-
throw agentsCore.createApiError({
|
|
2495
|
-
code: "bad_request",
|
|
2496
|
-
message: error.message
|
|
2497
|
-
});
|
|
2617
|
+
if (!functionTool) {
|
|
2618
|
+
return c.json(
|
|
2619
|
+
agentsCore.createApiError({ code: "not_found", message: "Function tool not found" }),
|
|
2620
|
+
404
|
|
2621
|
+
);
|
|
2498
2622
|
}
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2623
|
+
return c.json({ data: functionTool });
|
|
2624
|
+
} catch (error) {
|
|
2625
|
+
logger4.error(
|
|
2626
|
+
{ error, tenantId, projectId, agentId, id, body },
|
|
2627
|
+
"Failed to update function tool"
|
|
2628
|
+
);
|
|
2629
|
+
return c.json(
|
|
2630
|
+
agentsCore.createApiError({
|
|
2631
|
+
code: "internal_server_error",
|
|
2632
|
+
message: "Failed to update function tool"
|
|
2633
|
+
}),
|
|
2634
|
+
500
|
|
2635
|
+
);
|
|
2503
2636
|
}
|
|
2504
2637
|
}
|
|
2505
2638
|
);
|
|
2506
|
-
|
|
2639
|
+
app11.openapi(
|
|
2507
2640
|
zodOpenapi.createRoute({
|
|
2508
2641
|
method: "delete",
|
|
2509
|
-
path: "
|
|
2510
|
-
summary: "Delete
|
|
2511
|
-
operationId: "delete-
|
|
2512
|
-
tags: ["
|
|
2513
|
-
description: "Delete a complete agent and cascade to all related entities (relationships, not other agents/tools)",
|
|
2642
|
+
path: "/:id",
|
|
2643
|
+
summary: "Delete Function Tool",
|
|
2644
|
+
operationId: "delete-function-tool",
|
|
2645
|
+
tags: ["Function Tools"],
|
|
2514
2646
|
request: {
|
|
2515
|
-
params:
|
|
2647
|
+
params: agentsCore.TenantProjectAgentParamsSchema.extend({
|
|
2648
|
+
id: zod.z.string()
|
|
2649
|
+
})
|
|
2516
2650
|
},
|
|
2517
2651
|
responses: {
|
|
2518
2652
|
204: {
|
|
2519
|
-
description: "
|
|
2653
|
+
description: "Function tool deleted successfully"
|
|
2520
2654
|
},
|
|
2521
2655
|
...agentsCore.commonGetErrorResponses
|
|
2522
2656
|
}
|
|
2523
2657
|
}),
|
|
2524
2658
|
async (c) => {
|
|
2525
|
-
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
2659
|
+
const { tenantId, projectId, agentId, id } = c.req.valid("param");
|
|
2526
2660
|
try {
|
|
2527
|
-
const deleted = await agentsCore.
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
)({
|
|
2531
|
-
scopes: { tenantId, projectId, agentId }
|
|
2661
|
+
const deleted = await agentsCore.deleteFunctionTool(dbClient_default)({
|
|
2662
|
+
scopes: { tenantId, projectId, agentId },
|
|
2663
|
+
functionToolId: id
|
|
2532
2664
|
});
|
|
2533
2665
|
if (!deleted) {
|
|
2534
|
-
|
|
2535
|
-
code: "not_found",
|
|
2536
|
-
|
|
2537
|
-
|
|
2666
|
+
return c.json(
|
|
2667
|
+
agentsCore.createApiError({ code: "not_found", message: "Function tool not found" }),
|
|
2668
|
+
404
|
|
2669
|
+
);
|
|
2538
2670
|
}
|
|
2539
2671
|
return c.body(null, 204);
|
|
2540
2672
|
} catch (error) {
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
message: error instanceof Error ? error.message : "Failed to delete agent"
|
|
2550
|
-
});
|
|
2673
|
+
logger4.error({ error, tenantId, projectId, agentId, id }, "Failed to delete function tool");
|
|
2674
|
+
return c.json(
|
|
2675
|
+
agentsCore.createApiError({
|
|
2676
|
+
code: "internal_server_error",
|
|
2677
|
+
message: "Failed to delete function tool"
|
|
2678
|
+
}),
|
|
2679
|
+
500
|
|
2680
|
+
);
|
|
2551
2681
|
}
|
|
2552
2682
|
}
|
|
2553
2683
|
);
|
|
2554
|
-
var
|
|
2555
|
-
var
|
|
2556
|
-
|
|
2684
|
+
var functionTools_default = app11;
|
|
2685
|
+
var app12 = new zodOpenapi.OpenAPIHono();
|
|
2686
|
+
app12.openapi(
|
|
2557
2687
|
zodOpenapi.createRoute({
|
|
2558
2688
|
method: "get",
|
|
2559
2689
|
path: "/",
|
|
@@ -2588,7 +2718,7 @@ app11.openapi(
|
|
|
2588
2718
|
return c.json(result);
|
|
2589
2719
|
}
|
|
2590
2720
|
);
|
|
2591
|
-
|
|
2721
|
+
app12.openapi(
|
|
2592
2722
|
zodOpenapi.createRoute({
|
|
2593
2723
|
method: "get",
|
|
2594
2724
|
path: "/{id}",
|
|
@@ -2623,7 +2753,7 @@ app11.openapi(
|
|
|
2623
2753
|
return c.json({ data: project });
|
|
2624
2754
|
}
|
|
2625
2755
|
);
|
|
2626
|
-
|
|
2756
|
+
app12.openapi(
|
|
2627
2757
|
zodOpenapi.createRoute({
|
|
2628
2758
|
method: "post",
|
|
2629
2759
|
path: "/",
|
|
@@ -2681,7 +2811,7 @@ app11.openapi(
|
|
|
2681
2811
|
}
|
|
2682
2812
|
}
|
|
2683
2813
|
);
|
|
2684
|
-
|
|
2814
|
+
app12.openapi(
|
|
2685
2815
|
zodOpenapi.createRoute({
|
|
2686
2816
|
method: "patch",
|
|
2687
2817
|
path: "/{id}",
|
|
@@ -2727,7 +2857,7 @@ app11.openapi(
|
|
|
2727
2857
|
return c.json({ data: project });
|
|
2728
2858
|
}
|
|
2729
2859
|
);
|
|
2730
|
-
|
|
2860
|
+
app12.openapi(
|
|
2731
2861
|
zodOpenapi.createRoute({
|
|
2732
2862
|
method: "delete",
|
|
2733
2863
|
path: "/{id}",
|
|
@@ -2777,9 +2907,9 @@ app11.openapi(
|
|
|
2777
2907
|
}
|
|
2778
2908
|
}
|
|
2779
2909
|
);
|
|
2780
|
-
var projects_default =
|
|
2781
|
-
var
|
|
2782
|
-
|
|
2910
|
+
var projects_default = app12;
|
|
2911
|
+
var app13 = new zodOpenapi.OpenAPIHono();
|
|
2912
|
+
app13.openapi(
|
|
2783
2913
|
zodOpenapi.createRoute({
|
|
2784
2914
|
method: "get",
|
|
2785
2915
|
path: "/agent/:subAgentId",
|
|
@@ -2815,7 +2945,7 @@ app12.openapi(
|
|
|
2815
2945
|
});
|
|
2816
2946
|
}
|
|
2817
2947
|
);
|
|
2818
|
-
|
|
2948
|
+
app13.openapi(
|
|
2819
2949
|
zodOpenapi.createRoute({
|
|
2820
2950
|
method: "get",
|
|
2821
2951
|
path: "/component/:artifactComponentId/agents",
|
|
@@ -2855,7 +2985,7 @@ app12.openapi(
|
|
|
2855
2985
|
return c.json({ data: agents });
|
|
2856
2986
|
}
|
|
2857
2987
|
);
|
|
2858
|
-
|
|
2988
|
+
app13.openapi(
|
|
2859
2989
|
zodOpenapi.createRoute({
|
|
2860
2990
|
method: "post",
|
|
2861
2991
|
path: "/",
|
|
@@ -2932,7 +3062,7 @@ app12.openapi(
|
|
|
2932
3062
|
return c.json({ data: association }, 201);
|
|
2933
3063
|
}
|
|
2934
3064
|
);
|
|
2935
|
-
|
|
3065
|
+
app13.openapi(
|
|
2936
3066
|
zodOpenapi.createRoute({
|
|
2937
3067
|
method: "delete",
|
|
2938
3068
|
path: "/agent/:subAgentId/component/:artifactComponentId",
|
|
@@ -2975,7 +3105,7 @@ app12.openapi(
|
|
|
2975
3105
|
});
|
|
2976
3106
|
}
|
|
2977
3107
|
);
|
|
2978
|
-
|
|
3108
|
+
app13.openapi(
|
|
2979
3109
|
zodOpenapi.createRoute({
|
|
2980
3110
|
method: "get",
|
|
2981
3111
|
path: "/agent/:subAgentId/component/:artifactComponentId/exists",
|
|
@@ -3009,9 +3139,9 @@ app12.openapi(
|
|
|
3009
3139
|
return c.json({ exists });
|
|
3010
3140
|
}
|
|
3011
3141
|
);
|
|
3012
|
-
var subAgentArtifactComponents_default =
|
|
3013
|
-
var
|
|
3014
|
-
|
|
3142
|
+
var subAgentArtifactComponents_default = app13;
|
|
3143
|
+
var app14 = new zodOpenapi.OpenAPIHono();
|
|
3144
|
+
app14.openapi(
|
|
3015
3145
|
zodOpenapi.createRoute({
|
|
3016
3146
|
method: "get",
|
|
3017
3147
|
path: "/agent/:subAgentId",
|
|
@@ -3045,7 +3175,7 @@ app13.openapi(
|
|
|
3045
3175
|
return c.json({ data: dataComponents });
|
|
3046
3176
|
}
|
|
3047
3177
|
);
|
|
3048
|
-
|
|
3178
|
+
app14.openapi(
|
|
3049
3179
|
zodOpenapi.createRoute({
|
|
3050
3180
|
method: "get",
|
|
3051
3181
|
path: "/component/:dataComponentId/agents",
|
|
@@ -3085,7 +3215,7 @@ app13.openapi(
|
|
|
3085
3215
|
return c.json({ data: agents });
|
|
3086
3216
|
}
|
|
3087
3217
|
);
|
|
3088
|
-
|
|
3218
|
+
app14.openapi(
|
|
3089
3219
|
zodOpenapi.createRoute({
|
|
3090
3220
|
method: "post",
|
|
3091
3221
|
path: "/",
|
|
@@ -3158,7 +3288,7 @@ app13.openapi(
|
|
|
3158
3288
|
return c.json({ data: association }, 201);
|
|
3159
3289
|
}
|
|
3160
3290
|
);
|
|
3161
|
-
|
|
3291
|
+
app14.openapi(
|
|
3162
3292
|
zodOpenapi.createRoute({
|
|
3163
3293
|
method: "delete",
|
|
3164
3294
|
path: "/agent/:subAgentId/component/:dataComponentId",
|
|
@@ -3201,7 +3331,7 @@ app13.openapi(
|
|
|
3201
3331
|
});
|
|
3202
3332
|
}
|
|
3203
3333
|
);
|
|
3204
|
-
|
|
3334
|
+
app14.openapi(
|
|
3205
3335
|
zodOpenapi.createRoute({
|
|
3206
3336
|
method: "get",
|
|
3207
3337
|
path: "/agent/:subAgentId/component/:dataComponentId/exists",
|
|
@@ -3235,22 +3365,22 @@ app13.openapi(
|
|
|
3235
3365
|
return c.json({ exists });
|
|
3236
3366
|
}
|
|
3237
3367
|
);
|
|
3238
|
-
var subAgentDataComponents_default =
|
|
3239
|
-
var
|
|
3240
|
-
|
|
3368
|
+
var subAgentDataComponents_default = app14;
|
|
3369
|
+
var app15 = new zodOpenapi.OpenAPIHono();
|
|
3370
|
+
app15.openapi(
|
|
3241
3371
|
zodOpenapi.createRoute({
|
|
3242
3372
|
method: "get",
|
|
3243
3373
|
path: "/",
|
|
3244
|
-
summary: "List Agent Relations",
|
|
3245
|
-
operationId: "list-agent-relations",
|
|
3246
|
-
tags: ["Agent Relations"],
|
|
3374
|
+
summary: "List Sub Agent Relations",
|
|
3375
|
+
operationId: "list-sub-agent-relations",
|
|
3376
|
+
tags: ["Sub Agent Relations"],
|
|
3247
3377
|
request: {
|
|
3248
3378
|
params: agentsCore.TenantProjectAgentParamsSchema,
|
|
3249
3379
|
query: agentsCore.PaginationQueryParamsSchema.merge(agentsCore.SubAgentRelationQuerySchema)
|
|
3250
3380
|
},
|
|
3251
3381
|
responses: {
|
|
3252
3382
|
200: {
|
|
3253
|
-
description: "List of agent relations retrieved successfully",
|
|
3383
|
+
description: "List of sub agent relations retrieved successfully",
|
|
3254
3384
|
content: {
|
|
3255
3385
|
"application/json": {
|
|
3256
3386
|
schema: agentsCore.ListResponseSchema(agentsCore.SubAgentRelationApiSelectSchema)
|
|
@@ -3281,7 +3411,7 @@ app14.openapi(
|
|
|
3281
3411
|
});
|
|
3282
3412
|
result = { ...rawResult, data: rawResult.data };
|
|
3283
3413
|
} else if (targetSubAgentId) {
|
|
3284
|
-
const rawResult = await agentsCore.
|
|
3414
|
+
const rawResult = await agentsCore.getSubAgentRelationsByTarget(dbClient_default)({
|
|
3285
3415
|
scopes: { tenantId, projectId, agentId },
|
|
3286
3416
|
targetSubAgentId,
|
|
3287
3417
|
pagination: { page: pageNum, limit: limitNum }
|
|
@@ -3305,24 +3435,24 @@ app14.openapi(
|
|
|
3305
3435
|
} catch (_error) {
|
|
3306
3436
|
throw agentsCore.createApiError({
|
|
3307
3437
|
code: "internal_server_error",
|
|
3308
|
-
message: "Failed to retrieve agent relations"
|
|
3438
|
+
message: "Failed to retrieve sub agent relations"
|
|
3309
3439
|
});
|
|
3310
3440
|
}
|
|
3311
3441
|
}
|
|
3312
3442
|
);
|
|
3313
|
-
|
|
3443
|
+
app15.openapi(
|
|
3314
3444
|
zodOpenapi.createRoute({
|
|
3315
3445
|
method: "get",
|
|
3316
3446
|
path: "/{id}",
|
|
3317
|
-
summary: "Get Agent Relation",
|
|
3318
|
-
operationId: "get-agent-relation-by-id",
|
|
3319
|
-
tags: ["Agent Relations"],
|
|
3447
|
+
summary: "Get Sub Agent Relation",
|
|
3448
|
+
operationId: "get-sub-agent-relation-by-id",
|
|
3449
|
+
tags: ["Sub Agent Relations"],
|
|
3320
3450
|
request: {
|
|
3321
3451
|
params: agentsCore.TenantProjectAgentIdParamsSchema
|
|
3322
3452
|
},
|
|
3323
3453
|
responses: {
|
|
3324
3454
|
200: {
|
|
3325
|
-
description: "Agent relation found",
|
|
3455
|
+
description: "Sub Agent relation found",
|
|
3326
3456
|
content: {
|
|
3327
3457
|
"application/json": {
|
|
3328
3458
|
schema: agentsCore.SingleResponseSchema(agentsCore.SubAgentRelationApiSelectSchema)
|
|
@@ -3341,19 +3471,19 @@ app14.openapi(
|
|
|
3341
3471
|
if (!agentRelation) {
|
|
3342
3472
|
throw agentsCore.createApiError({
|
|
3343
3473
|
code: "not_found",
|
|
3344
|
-
message: "Agent
|
|
3474
|
+
message: "Sub Agent Relation not found"
|
|
3345
3475
|
});
|
|
3346
3476
|
}
|
|
3347
3477
|
return c.json({ data: agentRelation });
|
|
3348
3478
|
}
|
|
3349
3479
|
);
|
|
3350
|
-
|
|
3480
|
+
app15.openapi(
|
|
3351
3481
|
zodOpenapi.createRoute({
|
|
3352
3482
|
method: "post",
|
|
3353
3483
|
path: "/",
|
|
3354
|
-
summary: "Create Agent Relation",
|
|
3355
|
-
operationId: "create-agent-relation",
|
|
3356
|
-
tags: ["Agent Relations"],
|
|
3484
|
+
summary: "Create Sub Agent Relation",
|
|
3485
|
+
operationId: "create-sub-agent-relation",
|
|
3486
|
+
tags: ["Sub Agent Relations"],
|
|
3357
3487
|
request: {
|
|
3358
3488
|
params: agentsCore.TenantProjectAgentParamsSchema,
|
|
3359
3489
|
body: {
|
|
@@ -3366,7 +3496,7 @@ app14.openapi(
|
|
|
3366
3496
|
},
|
|
3367
3497
|
responses: {
|
|
3368
3498
|
201: {
|
|
3369
|
-
description: "Agent
|
|
3499
|
+
description: "Sub Agent Relation created successfully",
|
|
3370
3500
|
content: {
|
|
3371
3501
|
"application/json": {
|
|
3372
3502
|
schema: agentsCore.SingleResponseSchema(agentsCore.SubAgentRelationApiSelectSchema)
|
|
@@ -3438,13 +3568,13 @@ app14.openapi(
|
|
|
3438
3568
|
return c.json({ data: agentRelation }, 201);
|
|
3439
3569
|
}
|
|
3440
3570
|
);
|
|
3441
|
-
|
|
3571
|
+
app15.openapi(
|
|
3442
3572
|
zodOpenapi.createRoute({
|
|
3443
3573
|
method: "put",
|
|
3444
3574
|
path: "/{id}",
|
|
3445
|
-
summary: "Update Agent Relation",
|
|
3446
|
-
operationId: "update-agent-relation",
|
|
3447
|
-
tags: ["Agent Relations"],
|
|
3575
|
+
summary: "Update Sub Agent Relation",
|
|
3576
|
+
operationId: "update-sub-agent-relation",
|
|
3577
|
+
tags: ["Sub Agent Relations"],
|
|
3448
3578
|
request: {
|
|
3449
3579
|
params: agentsCore.TenantProjectAgentIdParamsSchema,
|
|
3450
3580
|
body: {
|
|
@@ -3457,7 +3587,7 @@ app14.openapi(
|
|
|
3457
3587
|
},
|
|
3458
3588
|
responses: {
|
|
3459
3589
|
200: {
|
|
3460
|
-
description: "Agent relation updated successfully",
|
|
3590
|
+
description: "Sub Agent relation updated successfully",
|
|
3461
3591
|
content: {
|
|
3462
3592
|
"application/json": {
|
|
3463
3593
|
schema: agentsCore.SingleResponseSchema(agentsCore.SubAgentRelationApiSelectSchema)
|
|
@@ -3478,28 +3608,28 @@ app14.openapi(
|
|
|
3478
3608
|
if (!updatedAgentRelation) {
|
|
3479
3609
|
throw agentsCore.createApiError({
|
|
3480
3610
|
code: "not_found",
|
|
3481
|
-
message: "Agent
|
|
3611
|
+
message: "Sub Agent Relation not found"
|
|
3482
3612
|
});
|
|
3483
3613
|
}
|
|
3484
3614
|
return c.json({ data: updatedAgentRelation });
|
|
3485
3615
|
}
|
|
3486
3616
|
);
|
|
3487
|
-
|
|
3617
|
+
app15.openapi(
|
|
3488
3618
|
zodOpenapi.createRoute({
|
|
3489
3619
|
method: "delete",
|
|
3490
3620
|
path: "/{id}",
|
|
3491
|
-
summary: "Delete Agent Relation",
|
|
3492
|
-
operationId: "delete-agent-relation",
|
|
3493
|
-
tags: ["Agent Relations"],
|
|
3621
|
+
summary: "Delete Sub Agent Relation",
|
|
3622
|
+
operationId: "delete-sub-agent-relation",
|
|
3623
|
+
tags: ["Sub Agent Relations"],
|
|
3494
3624
|
request: {
|
|
3495
3625
|
params: agentsCore.TenantProjectAgentIdParamsSchema
|
|
3496
3626
|
},
|
|
3497
3627
|
responses: {
|
|
3498
3628
|
204: {
|
|
3499
|
-
description: "Agent
|
|
3629
|
+
description: "Sub Agent Relation deleted successfully"
|
|
3500
3630
|
},
|
|
3501
3631
|
404: {
|
|
3502
|
-
description: "Agent
|
|
3632
|
+
description: "Sub Agent Relation not found",
|
|
3503
3633
|
content: {
|
|
3504
3634
|
"application/json": {
|
|
3505
3635
|
schema: agentsCore.ErrorResponseSchema
|
|
@@ -3517,15 +3647,15 @@ app14.openapi(
|
|
|
3517
3647
|
if (!deleted) {
|
|
3518
3648
|
throw agentsCore.createApiError({
|
|
3519
3649
|
code: "not_found",
|
|
3520
|
-
message: "Agent
|
|
3650
|
+
message: "Sub Agent Relation not found"
|
|
3521
3651
|
});
|
|
3522
3652
|
}
|
|
3523
3653
|
return c.body(null, 204);
|
|
3524
3654
|
}
|
|
3525
3655
|
);
|
|
3526
|
-
var subAgentRelations_default =
|
|
3527
|
-
var
|
|
3528
|
-
|
|
3656
|
+
var subAgentRelations_default = app15;
|
|
3657
|
+
var app16 = new zodOpenapi.OpenAPIHono();
|
|
3658
|
+
app16.openapi(
|
|
3529
3659
|
zodOpenapi.createRoute({
|
|
3530
3660
|
method: "get",
|
|
3531
3661
|
path: "/",
|
|
@@ -3566,7 +3696,7 @@ app15.openapi(
|
|
|
3566
3696
|
return c.json(dataWithType);
|
|
3567
3697
|
}
|
|
3568
3698
|
);
|
|
3569
|
-
|
|
3699
|
+
app16.openapi(
|
|
3570
3700
|
zodOpenapi.createRoute({
|
|
3571
3701
|
method: "get",
|
|
3572
3702
|
path: "/{id}",
|
|
@@ -3607,7 +3737,7 @@ app15.openapi(
|
|
|
3607
3737
|
return c.json({ data: subAgentWithType });
|
|
3608
3738
|
}
|
|
3609
3739
|
);
|
|
3610
|
-
|
|
3740
|
+
app16.openapi(
|
|
3611
3741
|
zodOpenapi.createRoute({
|
|
3612
3742
|
method: "post",
|
|
3613
3743
|
path: "/",
|
|
@@ -3654,7 +3784,7 @@ app15.openapi(
|
|
|
3654
3784
|
return c.json({ data: subAgentWithType }, 201);
|
|
3655
3785
|
}
|
|
3656
3786
|
);
|
|
3657
|
-
|
|
3787
|
+
app16.openapi(
|
|
3658
3788
|
zodOpenapi.createRoute({
|
|
3659
3789
|
method: "put",
|
|
3660
3790
|
path: "/{id}",
|
|
@@ -3704,7 +3834,7 @@ app15.openapi(
|
|
|
3704
3834
|
return c.json({ data: subAgentWithType });
|
|
3705
3835
|
}
|
|
3706
3836
|
);
|
|
3707
|
-
|
|
3837
|
+
app16.openapi(
|
|
3708
3838
|
zodOpenapi.createRoute({
|
|
3709
3839
|
method: "delete",
|
|
3710
3840
|
path: "/{id}",
|
|
@@ -3743,9 +3873,9 @@ app15.openapi(
|
|
|
3743
3873
|
return c.body(null, 204);
|
|
3744
3874
|
}
|
|
3745
3875
|
);
|
|
3746
|
-
var subAgents_default =
|
|
3747
|
-
var
|
|
3748
|
-
|
|
3876
|
+
var subAgents_default = app16;
|
|
3877
|
+
var app17 = new zodOpenapi.OpenAPIHono();
|
|
3878
|
+
app17.openapi(
|
|
3749
3879
|
zodOpenapi.createRoute({
|
|
3750
3880
|
method: "get",
|
|
3751
3881
|
path: "/",
|
|
@@ -3807,7 +3937,7 @@ app16.openapi(
|
|
|
3807
3937
|
return c.json(result);
|
|
3808
3938
|
}
|
|
3809
3939
|
);
|
|
3810
|
-
|
|
3940
|
+
app17.openapi(
|
|
3811
3941
|
zodOpenapi.createRoute({
|
|
3812
3942
|
method: "get",
|
|
3813
3943
|
path: "/{id}",
|
|
@@ -3844,7 +3974,7 @@ app16.openapi(
|
|
|
3844
3974
|
return c.json({ data: agentToolRelation });
|
|
3845
3975
|
}
|
|
3846
3976
|
);
|
|
3847
|
-
|
|
3977
|
+
app17.openapi(
|
|
3848
3978
|
zodOpenapi.createRoute({
|
|
3849
3979
|
method: "get",
|
|
3850
3980
|
path: "/tool/{toolId}/sub-agents",
|
|
@@ -3880,7 +4010,7 @@ app16.openapi(
|
|
|
3880
4010
|
return c.json(dbResult);
|
|
3881
4011
|
}
|
|
3882
4012
|
);
|
|
3883
|
-
|
|
4013
|
+
app17.openapi(
|
|
3884
4014
|
zodOpenapi.createRoute({
|
|
3885
4015
|
method: "post",
|
|
3886
4016
|
path: "/",
|
|
@@ -3943,7 +4073,7 @@ app16.openapi(
|
|
|
3943
4073
|
}
|
|
3944
4074
|
}
|
|
3945
4075
|
);
|
|
3946
|
-
|
|
4076
|
+
app17.openapi(
|
|
3947
4077
|
zodOpenapi.createRoute({
|
|
3948
4078
|
method: "put",
|
|
3949
4079
|
path: "/{id}",
|
|
@@ -3996,7 +4126,7 @@ app16.openapi(
|
|
|
3996
4126
|
return c.json({ data: updatedAgentToolRelation });
|
|
3997
4127
|
}
|
|
3998
4128
|
);
|
|
3999
|
-
|
|
4129
|
+
app17.openapi(
|
|
4000
4130
|
zodOpenapi.createRoute({
|
|
4001
4131
|
method: "delete",
|
|
4002
4132
|
path: "/{id}",
|
|
@@ -4035,10 +4165,10 @@ app16.openapi(
|
|
|
4035
4165
|
return c.body(null, 204);
|
|
4036
4166
|
}
|
|
4037
4167
|
);
|
|
4038
|
-
var subAgentToolRelations_default =
|
|
4168
|
+
var subAgentToolRelations_default = app17;
|
|
4039
4169
|
var logger5 = agentsCore.getLogger("tools");
|
|
4040
|
-
var
|
|
4041
|
-
|
|
4170
|
+
var app18 = new zodOpenapi.OpenAPIHono();
|
|
4171
|
+
app18.openapi(
|
|
4042
4172
|
zodOpenapi.createRoute({
|
|
4043
4173
|
method: "get",
|
|
4044
4174
|
path: "/",
|
|
@@ -4098,7 +4228,7 @@ app17.openapi(
|
|
|
4098
4228
|
return c.json(result);
|
|
4099
4229
|
}
|
|
4100
4230
|
);
|
|
4101
|
-
|
|
4231
|
+
app18.openapi(
|
|
4102
4232
|
zodOpenapi.createRoute({
|
|
4103
4233
|
method: "get",
|
|
4104
4234
|
path: "/{id}",
|
|
@@ -4135,7 +4265,7 @@ app17.openapi(
|
|
|
4135
4265
|
});
|
|
4136
4266
|
}
|
|
4137
4267
|
);
|
|
4138
|
-
|
|
4268
|
+
app18.openapi(
|
|
4139
4269
|
zodOpenapi.createRoute({
|
|
4140
4270
|
method: "post",
|
|
4141
4271
|
path: "/",
|
|
@@ -4188,7 +4318,7 @@ app17.openapi(
|
|
|
4188
4318
|
);
|
|
4189
4319
|
}
|
|
4190
4320
|
);
|
|
4191
|
-
|
|
4321
|
+
app18.openapi(
|
|
4192
4322
|
zodOpenapi.createRoute({
|
|
4193
4323
|
method: "put",
|
|
4194
4324
|
path: "/{id}",
|
|
@@ -4249,7 +4379,7 @@ app17.openapi(
|
|
|
4249
4379
|
});
|
|
4250
4380
|
}
|
|
4251
4381
|
);
|
|
4252
|
-
|
|
4382
|
+
app18.openapi(
|
|
4253
4383
|
zodOpenapi.createRoute({
|
|
4254
4384
|
method: "delete",
|
|
4255
4385
|
path: "/{id}",
|
|
@@ -4285,37 +4415,38 @@ app17.openapi(
|
|
|
4285
4415
|
return c.body(null, 204);
|
|
4286
4416
|
}
|
|
4287
4417
|
);
|
|
4288
|
-
var tools_default =
|
|
4418
|
+
var tools_default = app18;
|
|
4289
4419
|
|
|
4290
4420
|
// src/routes/index.ts
|
|
4291
|
-
var
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4421
|
+
var app19 = new zodOpenapi.OpenAPIHono();
|
|
4422
|
+
app19.route("/projects", projects_default);
|
|
4423
|
+
app19.route("/projects/:projectId/agents/:agentId/sub-agents", subAgents_default);
|
|
4424
|
+
app19.route("/projects/:projectId/agents/:agentId/sub-agent-relations", subAgentRelations_default);
|
|
4425
|
+
app19.route("/projects/:projectId/agents", agent_default);
|
|
4426
|
+
app19.route(
|
|
4297
4427
|
"/projects/:projectId/agents/:agentId/sub-agent-tool-relations",
|
|
4298
4428
|
subAgentToolRelations_default
|
|
4299
4429
|
);
|
|
4300
|
-
|
|
4430
|
+
app19.route(
|
|
4301
4431
|
"/projects/:projectId/agents/:agentId/sub-agent-artifact-components",
|
|
4302
4432
|
subAgentArtifactComponents_default
|
|
4303
4433
|
);
|
|
4304
|
-
|
|
4434
|
+
app19.route(
|
|
4305
4435
|
"/projects/:projectId/agents/:agentId/sub-agent-data-components",
|
|
4306
4436
|
subAgentDataComponents_default
|
|
4307
4437
|
);
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4438
|
+
app19.route("/projects/:projectId/artifact-components", artifactComponents_default);
|
|
4439
|
+
app19.route("/projects/:projectId/agents/:agentId/context-configs", contextConfigs_default);
|
|
4440
|
+
app19.route("/projects/:projectId/credentials", credentials_default);
|
|
4441
|
+
app19.route("/projects/:projectId/credential-stores", credentialStores_default);
|
|
4442
|
+
app19.route("/projects/:projectId/data-components", dataComponents_default);
|
|
4443
|
+
app19.route("/projects/:projectId/agents/:agentId/external-agents", externalAgents_default);
|
|
4444
|
+
app19.route("/projects/:projectId/agents/:agentId/function-tools", functionTools_default);
|
|
4445
|
+
app19.route("/projects/:projectId/functions", functions_default);
|
|
4446
|
+
app19.route("/projects/:projectId/tools", tools_default);
|
|
4447
|
+
app19.route("/projects/:projectId/api-keys", apiKeys_default);
|
|
4448
|
+
app19.route("/projects/:projectId/agent", agentFull_default);
|
|
4449
|
+
var routes_default = app19;
|
|
4319
4450
|
var logger6 = agentsCore.getLogger("oauth-service");
|
|
4320
4451
|
var pkceStore = /* @__PURE__ */ new Map();
|
|
4321
4452
|
function storePKCEVerifier(state, codeVerifier, toolId, tenantId, projectId, clientId) {
|
|
@@ -4587,7 +4718,7 @@ async function findOrCreateCredential(tenantId, projectId, credentialData) {
|
|
|
4587
4718
|
throw new Error(`Failed to save credential '${credentialData.id}' to database`);
|
|
4588
4719
|
}
|
|
4589
4720
|
}
|
|
4590
|
-
var
|
|
4721
|
+
var app20 = new zodOpenapi.OpenAPIHono();
|
|
4591
4722
|
var logger7 = agentsCore.getLogger("oauth-callback");
|
|
4592
4723
|
function getBaseUrlFromRequest(c) {
|
|
4593
4724
|
const url = new URL(c.req.url);
|
|
@@ -4674,7 +4805,7 @@ var OAuthCallbackQuerySchema = zodOpenapi.z.object({
|
|
|
4674
4805
|
error: zodOpenapi.z.string().optional(),
|
|
4675
4806
|
error_description: zodOpenapi.z.string().optional()
|
|
4676
4807
|
});
|
|
4677
|
-
|
|
4808
|
+
app20.openapi(
|
|
4678
4809
|
zodOpenapi.createRoute({
|
|
4679
4810
|
method: "get",
|
|
4680
4811
|
path: "/login",
|
|
@@ -4741,7 +4872,7 @@ app19.openapi(
|
|
|
4741
4872
|
}
|
|
4742
4873
|
}
|
|
4743
4874
|
);
|
|
4744
|
-
|
|
4875
|
+
app20.openapi(
|
|
4745
4876
|
zodOpenapi.createRoute({
|
|
4746
4877
|
method: "get",
|
|
4747
4878
|
path: "/callback",
|
|
@@ -4825,22 +4956,7 @@ app19.openapi(
|
|
|
4825
4956
|
);
|
|
4826
4957
|
const credentialTokenKey = `oauth_token_${toolId}`;
|
|
4827
4958
|
let newCredentialData;
|
|
4828
|
-
|
|
4829
|
-
if (keychainStore) {
|
|
4830
|
-
try {
|
|
4831
|
-
await keychainStore.set(credentialTokenKey, JSON.stringify(tokens));
|
|
4832
|
-
newCredentialData = {
|
|
4833
|
-
id: agentsCore.generateIdFromName(mcpTool.name),
|
|
4834
|
-
type: agentsCore.CredentialStoreType.keychain,
|
|
4835
|
-
credentialStoreId: "keychain-default",
|
|
4836
|
-
retrievalParams: {
|
|
4837
|
-
key: credentialTokenKey
|
|
4838
|
-
}
|
|
4839
|
-
};
|
|
4840
|
-
} catch {
|
|
4841
|
-
}
|
|
4842
|
-
}
|
|
4843
|
-
if (!newCredentialData && process.env.NANGO_SECRET_KEY) {
|
|
4959
|
+
if (process.env.NANGO_SECRET_KEY) {
|
|
4844
4960
|
const nangoStore = credentialStores.get("nango-default");
|
|
4845
4961
|
await nangoStore?.set(credentialTokenKey, JSON.stringify(tokens));
|
|
4846
4962
|
newCredentialData = {
|
|
@@ -4854,6 +4970,26 @@ app19.openapi(
|
|
|
4854
4970
|
authMode: "API_KEY"
|
|
4855
4971
|
}
|
|
4856
4972
|
};
|
|
4973
|
+
} else {
|
|
4974
|
+
const keychainStore = credentialStores.get("keychain-default");
|
|
4975
|
+
if (keychainStore) {
|
|
4976
|
+
try {
|
|
4977
|
+
await keychainStore.set(credentialTokenKey, JSON.stringify(tokens));
|
|
4978
|
+
newCredentialData = {
|
|
4979
|
+
id: agentsCore.generateIdFromName(mcpTool.name),
|
|
4980
|
+
type: agentsCore.CredentialStoreType.keychain,
|
|
4981
|
+
credentialStoreId: "keychain-default",
|
|
4982
|
+
retrievalParams: {
|
|
4983
|
+
key: credentialTokenKey
|
|
4984
|
+
}
|
|
4985
|
+
};
|
|
4986
|
+
} catch (error2) {
|
|
4987
|
+
logger7.info(
|
|
4988
|
+
{ error: error2 instanceof Error ? error2.message : error2 },
|
|
4989
|
+
"Keychain store not available."
|
|
4990
|
+
);
|
|
4991
|
+
}
|
|
4992
|
+
}
|
|
4857
4993
|
}
|
|
4858
4994
|
if (!newCredentialData) {
|
|
4859
4995
|
throw new Error("No credential store found");
|
|
@@ -4885,9 +5021,9 @@ app19.openapi(
|
|
|
4885
5021
|
}
|
|
4886
5022
|
}
|
|
4887
5023
|
);
|
|
4888
|
-
var oauth_default =
|
|
5024
|
+
var oauth_default = app20;
|
|
4889
5025
|
var logger8 = agentsCore.getLogger("projectFull");
|
|
4890
|
-
var
|
|
5026
|
+
var app21 = new zodOpenapi.OpenAPIHono();
|
|
4891
5027
|
var ProjectIdParamsSchema = zod.z.object({
|
|
4892
5028
|
tenantId: zod.z.string().openapi({
|
|
4893
5029
|
description: "Tenant identifier",
|
|
@@ -4904,7 +5040,7 @@ var TenantParamsSchema2 = zod.z.object({
|
|
|
4904
5040
|
example: "tenant_123"
|
|
4905
5041
|
})
|
|
4906
5042
|
}).openapi("TenantParams");
|
|
4907
|
-
|
|
5043
|
+
app21.openapi(
|
|
4908
5044
|
zodOpenapi.createRoute({
|
|
4909
5045
|
method: "post",
|
|
4910
5046
|
path: "/project-full",
|
|
@@ -4963,7 +5099,7 @@ app20.openapi(
|
|
|
4963
5099
|
}
|
|
4964
5100
|
}
|
|
4965
5101
|
);
|
|
4966
|
-
|
|
5102
|
+
app21.openapi(
|
|
4967
5103
|
zodOpenapi.createRoute({
|
|
4968
5104
|
method: "get",
|
|
4969
5105
|
path: "/project-full/{projectId}",
|
|
@@ -5016,7 +5152,7 @@ app20.openapi(
|
|
|
5016
5152
|
}
|
|
5017
5153
|
}
|
|
5018
5154
|
);
|
|
5019
|
-
|
|
5155
|
+
app21.openapi(
|
|
5020
5156
|
zodOpenapi.createRoute({
|
|
5021
5157
|
method: "put",
|
|
5022
5158
|
path: "/project-full/{projectId}",
|
|
@@ -5100,7 +5236,7 @@ app20.openapi(
|
|
|
5100
5236
|
}
|
|
5101
5237
|
}
|
|
5102
5238
|
);
|
|
5103
|
-
|
|
5239
|
+
app21.openapi(
|
|
5104
5240
|
zodOpenapi.createRoute({
|
|
5105
5241
|
method: "delete",
|
|
5106
5242
|
path: "/project-full/{projectId}",
|
|
@@ -5148,20 +5284,20 @@ app20.openapi(
|
|
|
5148
5284
|
}
|
|
5149
5285
|
}
|
|
5150
5286
|
);
|
|
5151
|
-
var projectFull_default =
|
|
5287
|
+
var projectFull_default = app21;
|
|
5152
5288
|
|
|
5153
5289
|
// src/app.ts
|
|
5154
5290
|
var logger9 = agentsCore.getLogger("agents-manage-api");
|
|
5155
5291
|
logger9.info({ logger: logger9.getTransports() }, "Logger initialized");
|
|
5156
5292
|
function createManagementHono(serverConfig, credentialStores) {
|
|
5157
|
-
const
|
|
5158
|
-
|
|
5159
|
-
|
|
5293
|
+
const app23 = new zodOpenapi.OpenAPIHono();
|
|
5294
|
+
app23.use("*", requestId.requestId());
|
|
5295
|
+
app23.use("*", async (c, next) => {
|
|
5160
5296
|
c.set("serverConfig", serverConfig);
|
|
5161
5297
|
c.set("credentialStores", credentialStores);
|
|
5162
5298
|
return next();
|
|
5163
5299
|
});
|
|
5164
|
-
|
|
5300
|
+
app23.use(
|
|
5165
5301
|
honoPino.pinoLogger({
|
|
5166
5302
|
pino: agentsCore.getLogger("agents-manage-api").getPinoInstance(),
|
|
5167
5303
|
http: {
|
|
@@ -5174,7 +5310,7 @@ function createManagementHono(serverConfig, credentialStores) {
|
|
|
5174
5310
|
}
|
|
5175
5311
|
})
|
|
5176
5312
|
);
|
|
5177
|
-
|
|
5313
|
+
app23.onError(async (err, c) => {
|
|
5178
5314
|
const isExpectedError = err instanceof httpException.HTTPException;
|
|
5179
5315
|
const status = isExpectedError ? err.status : 500;
|
|
5180
5316
|
const requestId2 = c.get("requestId") || "unknown";
|
|
@@ -5249,7 +5385,7 @@ function createManagementHono(serverConfig, credentialStores) {
|
|
|
5249
5385
|
...instance && { instance }
|
|
5250
5386
|
});
|
|
5251
5387
|
});
|
|
5252
|
-
|
|
5388
|
+
app23.use(
|
|
5253
5389
|
"*",
|
|
5254
5390
|
cors.cors({
|
|
5255
5391
|
origin: (origin) => {
|
|
@@ -5263,7 +5399,7 @@ function createManagementHono(serverConfig, credentialStores) {
|
|
|
5263
5399
|
credentials: true
|
|
5264
5400
|
})
|
|
5265
5401
|
);
|
|
5266
|
-
|
|
5402
|
+
app23.openapi(
|
|
5267
5403
|
zodOpenapi.createRoute({
|
|
5268
5404
|
method: "get",
|
|
5269
5405
|
path: "/health",
|
|
@@ -5280,13 +5416,13 @@ function createManagementHono(serverConfig, credentialStores) {
|
|
|
5280
5416
|
return c.body(null, 204);
|
|
5281
5417
|
}
|
|
5282
5418
|
);
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
setupOpenAPIRoutes(
|
|
5419
|
+
app23.use("/tenants/*", apiKeyAuth());
|
|
5420
|
+
app23.route("/tenants/:tenantId", routes_default);
|
|
5421
|
+
app23.route("/tenants/:tenantId", projectFull_default);
|
|
5422
|
+
app23.route("/oauth", oauth_default);
|
|
5423
|
+
setupOpenAPIRoutes(app23);
|
|
5288
5424
|
const baseApp = new hono.Hono();
|
|
5289
|
-
baseApp.route("/",
|
|
5425
|
+
baseApp.route("/", app23);
|
|
5290
5426
|
return baseApp;
|
|
5291
5427
|
}
|
|
5292
5428
|
|
|
@@ -5302,8 +5438,8 @@ var defaultConfig = {
|
|
|
5302
5438
|
};
|
|
5303
5439
|
var defaultStores = agentsCore.createDefaultCredentialStores();
|
|
5304
5440
|
var defaultRegistry = new agentsCore.CredentialStoreRegistry(defaultStores);
|
|
5305
|
-
var
|
|
5306
|
-
var index_default =
|
|
5441
|
+
var app22 = createManagementHono(defaultConfig, defaultRegistry);
|
|
5442
|
+
var index_default = app22;
|
|
5307
5443
|
function createManagementApp(config) {
|
|
5308
5444
|
const serverConfig = config?.serverConfig ?? defaultConfig;
|
|
5309
5445
|
const stores = config?.credentialStores ?? defaultStores;
|