@inkeep/agents-manage-api 0.24.1 → 0.25.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 +339 -143
- package/dist/index.js +340 -144
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -72,10 +72,10 @@ var apiKeyAuth = () => factory.createMiddleware(async (c, next) => {
|
|
|
72
72
|
await next();
|
|
73
73
|
return;
|
|
74
74
|
});
|
|
75
|
-
function setupOpenAPIRoutes(
|
|
76
|
-
|
|
75
|
+
function setupOpenAPIRoutes(app24) {
|
|
76
|
+
app24.get("/openapi.json", (c) => {
|
|
77
77
|
try {
|
|
78
|
-
const document =
|
|
78
|
+
const document = app24.getOpenAPIDocument({
|
|
79
79
|
openapi: "3.0.0",
|
|
80
80
|
info: {
|
|
81
81
|
title: "Inkeep Agents Manage API",
|
|
@@ -96,7 +96,7 @@ function setupOpenAPIRoutes(app23) {
|
|
|
96
96
|
return c.json({ error: "Failed to generate OpenAPI document", details: errorDetails }, 500);
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
|
-
|
|
99
|
+
app24.get(
|
|
100
100
|
"/docs",
|
|
101
101
|
swaggerUi.swaggerUI({
|
|
102
102
|
url: "/openapi.json",
|
|
@@ -323,7 +323,7 @@ app.openapi(
|
|
|
323
323
|
const agent = await agentsCore.createAgent(dbClient_default)({
|
|
324
324
|
tenantId,
|
|
325
325
|
projectId,
|
|
326
|
-
id: validatedBody.id ||
|
|
326
|
+
id: validatedBody.id || agentsCore.generateId(),
|
|
327
327
|
name: validatedBody.name,
|
|
328
328
|
defaultSubAgentId: validatedBody.defaultSubAgentId,
|
|
329
329
|
contextConfigId: validatedBody.contextConfigId ?? void 0
|
|
@@ -578,6 +578,7 @@ app2.openapi(
|
|
|
578
578
|
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
579
579
|
const agentData = c.req.valid("json");
|
|
580
580
|
try {
|
|
581
|
+
logger2.info({}, "test agent data");
|
|
581
582
|
const validatedAgentData = agentsCore.AgentWithinContextOfProjectSchema.parse(agentData);
|
|
582
583
|
if (agentId !== validatedAgentData.id) {
|
|
583
584
|
throw agentsCore.createApiError({
|
|
@@ -1040,7 +1041,7 @@ app4.openapi(
|
|
|
1040
1041
|
});
|
|
1041
1042
|
}
|
|
1042
1043
|
}
|
|
1043
|
-
const finalId = body.id ? String(body.id) :
|
|
1044
|
+
const finalId = body.id ? String(body.id) : agentsCore.generateId();
|
|
1044
1045
|
const componentData = {
|
|
1045
1046
|
tenantId,
|
|
1046
1047
|
projectId,
|
|
@@ -1554,7 +1555,7 @@ app7.openapi(
|
|
|
1554
1555
|
}),
|
|
1555
1556
|
async (c) => {
|
|
1556
1557
|
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1557
|
-
const credential = await agentsCore.
|
|
1558
|
+
const credential = await agentsCore.getCredentialReferenceWithResources(dbClient_default)({
|
|
1558
1559
|
scopes: { tenantId, projectId },
|
|
1559
1560
|
id
|
|
1560
1561
|
});
|
|
@@ -1957,7 +1958,7 @@ app9.openapi(
|
|
|
1957
1958
|
operationId: "list-external-agents",
|
|
1958
1959
|
tags: ["External Agents"],
|
|
1959
1960
|
request: {
|
|
1960
|
-
params: agentsCore.
|
|
1961
|
+
params: agentsCore.TenantProjectParamsSchema,
|
|
1961
1962
|
query: agentsCore.PaginationQueryParamsSchema
|
|
1962
1963
|
},
|
|
1963
1964
|
responses: {
|
|
@@ -1973,10 +1974,10 @@ app9.openapi(
|
|
|
1973
1974
|
}
|
|
1974
1975
|
}),
|
|
1975
1976
|
async (c) => {
|
|
1976
|
-
const { tenantId, projectId
|
|
1977
|
+
const { tenantId, projectId } = c.req.valid("param");
|
|
1977
1978
|
const { page, limit } = c.req.valid("query");
|
|
1978
1979
|
const result = await agentsCore.listExternalAgentsPaginated(dbClient_default)({
|
|
1979
|
-
scopes: { tenantId, projectId
|
|
1980
|
+
scopes: { tenantId, projectId },
|
|
1980
1981
|
pagination: { page, limit }
|
|
1981
1982
|
});
|
|
1982
1983
|
const dataWithType = {
|
|
@@ -1997,7 +1998,7 @@ app9.openapi(
|
|
|
1997
1998
|
operationId: "get-external-agent-by-id",
|
|
1998
1999
|
tags: ["External Agents"],
|
|
1999
2000
|
request: {
|
|
2000
|
-
params: agentsCore.
|
|
2001
|
+
params: agentsCore.TenantProjectIdParamsSchema
|
|
2001
2002
|
},
|
|
2002
2003
|
responses: {
|
|
2003
2004
|
200: {
|
|
@@ -2012,10 +2013,10 @@ app9.openapi(
|
|
|
2012
2013
|
}
|
|
2013
2014
|
}),
|
|
2014
2015
|
async (c) => {
|
|
2015
|
-
const { tenantId, projectId,
|
|
2016
|
+
const { tenantId, projectId, id } = c.req.valid("param");
|
|
2016
2017
|
const externalAgent = await agentsCore.getExternalAgent(dbClient_default)({
|
|
2017
|
-
scopes: { tenantId, projectId
|
|
2018
|
-
|
|
2018
|
+
scopes: { tenantId, projectId },
|
|
2019
|
+
externalAgentId: id
|
|
2019
2020
|
});
|
|
2020
2021
|
if (!externalAgent) {
|
|
2021
2022
|
throw agentsCore.createApiError({
|
|
@@ -2038,7 +2039,7 @@ app9.openapi(
|
|
|
2038
2039
|
operationId: "create-external-agent",
|
|
2039
2040
|
tags: ["External Agents"],
|
|
2040
2041
|
request: {
|
|
2041
|
-
params: agentsCore.
|
|
2042
|
+
params: agentsCore.TenantProjectParamsSchema,
|
|
2042
2043
|
body: {
|
|
2043
2044
|
content: {
|
|
2044
2045
|
"application/json": {
|
|
@@ -2060,18 +2061,16 @@ app9.openapi(
|
|
|
2060
2061
|
}
|
|
2061
2062
|
}),
|
|
2062
2063
|
async (c) => {
|
|
2063
|
-
const { tenantId, projectId
|
|
2064
|
+
const { tenantId, projectId } = c.req.valid("param");
|
|
2064
2065
|
const body = c.req.valid("json");
|
|
2065
2066
|
const externalAgentData = {
|
|
2066
2067
|
tenantId,
|
|
2067
2068
|
projectId,
|
|
2068
|
-
|
|
2069
|
-
id: body.id ? String(body.id) : nanoid.nanoid(),
|
|
2069
|
+
id: body.id ? String(body.id) : agentsCore.generateId(),
|
|
2070
2070
|
name: body.name,
|
|
2071
2071
|
description: body.description,
|
|
2072
2072
|
baseUrl: body.baseUrl,
|
|
2073
|
-
credentialReferenceId: body.credentialReferenceId || void 0
|
|
2074
|
-
headers: body.headers || void 0
|
|
2073
|
+
credentialReferenceId: body.credentialReferenceId || void 0
|
|
2075
2074
|
};
|
|
2076
2075
|
const externalAgent = await agentsCore.createExternalAgent(dbClient_default)(externalAgentData);
|
|
2077
2076
|
const agentWithType = {
|
|
@@ -2089,7 +2088,7 @@ app9.openapi(
|
|
|
2089
2088
|
operationId: "update-external-agent",
|
|
2090
2089
|
tags: ["External Agents"],
|
|
2091
2090
|
request: {
|
|
2092
|
-
params: agentsCore.
|
|
2091
|
+
params: agentsCore.TenantProjectIdParamsSchema,
|
|
2093
2092
|
body: {
|
|
2094
2093
|
content: {
|
|
2095
2094
|
"application/json": {
|
|
@@ -2111,11 +2110,11 @@ app9.openapi(
|
|
|
2111
2110
|
}
|
|
2112
2111
|
}),
|
|
2113
2112
|
async (c) => {
|
|
2114
|
-
const { tenantId, projectId,
|
|
2113
|
+
const { tenantId, projectId, id } = c.req.valid("param");
|
|
2115
2114
|
const body = c.req.valid("json");
|
|
2116
2115
|
const updatedExternalAgent = await agentsCore.updateExternalAgent(dbClient_default)({
|
|
2117
|
-
scopes: { tenantId, projectId
|
|
2118
|
-
|
|
2116
|
+
scopes: { tenantId, projectId },
|
|
2117
|
+
externalAgentId: id,
|
|
2119
2118
|
data: body
|
|
2120
2119
|
});
|
|
2121
2120
|
if (!updatedExternalAgent) {
|
|
@@ -2139,7 +2138,7 @@ app9.openapi(
|
|
|
2139
2138
|
operationId: "delete-external-agent",
|
|
2140
2139
|
tags: ["External Agents"],
|
|
2141
2140
|
request: {
|
|
2142
|
-
params: agentsCore.
|
|
2141
|
+
params: agentsCore.TenantProjectIdParamsSchema
|
|
2143
2142
|
},
|
|
2144
2143
|
responses: {
|
|
2145
2144
|
204: {
|
|
@@ -2156,10 +2155,10 @@ app9.openapi(
|
|
|
2156
2155
|
}
|
|
2157
2156
|
}),
|
|
2158
2157
|
async (c) => {
|
|
2159
|
-
const { tenantId, projectId,
|
|
2158
|
+
const { tenantId, projectId, id } = c.req.valid("param");
|
|
2160
2159
|
const deleted = await agentsCore.deleteExternalAgent(dbClient_default)({
|
|
2161
|
-
scopes: { tenantId, projectId
|
|
2162
|
-
|
|
2160
|
+
scopes: { tenantId, projectId },
|
|
2161
|
+
externalAgentId: id
|
|
2163
2162
|
});
|
|
2164
2163
|
if (!deleted) {
|
|
2165
2164
|
throw agentsCore.createApiError({
|
|
@@ -2296,7 +2295,7 @@ app10.openapi(
|
|
|
2296
2295
|
const { tenantId, projectId } = c.req.valid("param");
|
|
2297
2296
|
const functionData = c.req.valid("json");
|
|
2298
2297
|
try {
|
|
2299
|
-
const id = functionData.id ||
|
|
2298
|
+
const id = functionData.id || agentsCore.generateId();
|
|
2300
2299
|
await agentsCore.upsertFunction(dbClient_default)({
|
|
2301
2300
|
data: {
|
|
2302
2301
|
...functionData,
|
|
@@ -2554,7 +2553,7 @@ app11.openapi(
|
|
|
2554
2553
|
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
2555
2554
|
const body = c.req.valid("json");
|
|
2556
2555
|
try {
|
|
2557
|
-
const id = body.id ||
|
|
2556
|
+
const id = body.id || agentsCore.generateId();
|
|
2558
2557
|
const functionTool = await agentsCore.createFunctionTool(dbClient_default)({
|
|
2559
2558
|
scopes: { tenantId, projectId, agentId },
|
|
2560
2559
|
data: {
|
|
@@ -3369,6 +3368,228 @@ app14.openapi(
|
|
|
3369
3368
|
var subAgentDataComponents_default = app14;
|
|
3370
3369
|
var app15 = new zodOpenapi.OpenAPIHono();
|
|
3371
3370
|
app15.openapi(
|
|
3371
|
+
zodOpenapi.createRoute({
|
|
3372
|
+
method: "get",
|
|
3373
|
+
path: "/",
|
|
3374
|
+
summary: "List Sub Agent External Agent Relations",
|
|
3375
|
+
operationId: "list-sub-agent-external-agent-relations",
|
|
3376
|
+
tags: ["Sub Agent External Agent Relations"],
|
|
3377
|
+
request: {
|
|
3378
|
+
params: agentsCore.TenantProjectAgentSubAgentParamsSchema,
|
|
3379
|
+
query: agentsCore.PaginationQueryParamsSchema
|
|
3380
|
+
},
|
|
3381
|
+
responses: {
|
|
3382
|
+
200: {
|
|
3383
|
+
description: "List of sub agent external agent relations retrieved successfully",
|
|
3384
|
+
content: {
|
|
3385
|
+
"application/json": {
|
|
3386
|
+
schema: agentsCore.ListResponseSchema(agentsCore.SubAgentExternalAgentRelationApiSelectSchema)
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
},
|
|
3390
|
+
...agentsCore.commonGetErrorResponses
|
|
3391
|
+
}
|
|
3392
|
+
}),
|
|
3393
|
+
async (c) => {
|
|
3394
|
+
const { tenantId, projectId, agentId, subAgentId } = c.req.valid("param");
|
|
3395
|
+
const { page = 1, limit = 10 } = c.req.valid("query");
|
|
3396
|
+
const pageNum = Number(page);
|
|
3397
|
+
const limitNum = Math.min(Number(limit), 100);
|
|
3398
|
+
try {
|
|
3399
|
+
const result = await agentsCore.listSubAgentExternalAgentRelations(dbClient_default)({
|
|
3400
|
+
scopes: { tenantId, projectId, agentId, subAgentId },
|
|
3401
|
+
pagination: { page: pageNum, limit: limitNum }
|
|
3402
|
+
});
|
|
3403
|
+
return c.json(result);
|
|
3404
|
+
} catch (_error) {
|
|
3405
|
+
throw agentsCore.createApiError({
|
|
3406
|
+
code: "internal_server_error",
|
|
3407
|
+
message: "Failed to retrieve sub agent external agent relations"
|
|
3408
|
+
});
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
);
|
|
3412
|
+
app15.openapi(
|
|
3413
|
+
zodOpenapi.createRoute({
|
|
3414
|
+
method: "get",
|
|
3415
|
+
path: "/{id}",
|
|
3416
|
+
summary: "Get Sub Agent External Agent Relation",
|
|
3417
|
+
operationId: "get-sub-agent-external-agent-relation-by-id",
|
|
3418
|
+
tags: ["Sub Agent External Agent Relations"],
|
|
3419
|
+
request: {
|
|
3420
|
+
params: agentsCore.TenantProjectAgentSubAgentIdParamsSchema
|
|
3421
|
+
},
|
|
3422
|
+
responses: {
|
|
3423
|
+
200: {
|
|
3424
|
+
description: "Sub Agent external agent relation found",
|
|
3425
|
+
content: {
|
|
3426
|
+
"application/json": {
|
|
3427
|
+
schema: agentsCore.SingleResponseSchema(agentsCore.SubAgentExternalAgentRelationApiSelectSchema)
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
},
|
|
3431
|
+
...agentsCore.commonGetErrorResponses
|
|
3432
|
+
}
|
|
3433
|
+
}),
|
|
3434
|
+
async (c) => {
|
|
3435
|
+
const { tenantId, projectId, agentId, subAgentId, id } = c.req.valid("param");
|
|
3436
|
+
const relation = await agentsCore.getSubAgentExternalAgentRelationById(dbClient_default)({
|
|
3437
|
+
scopes: { tenantId, projectId, agentId, subAgentId },
|
|
3438
|
+
relationId: id
|
|
3439
|
+
});
|
|
3440
|
+
if (!relation) {
|
|
3441
|
+
throw agentsCore.createApiError({
|
|
3442
|
+
code: "not_found",
|
|
3443
|
+
message: "Sub Agent External Agent Relation not found"
|
|
3444
|
+
});
|
|
3445
|
+
}
|
|
3446
|
+
return c.json({ data: relation });
|
|
3447
|
+
}
|
|
3448
|
+
);
|
|
3449
|
+
app15.openapi(
|
|
3450
|
+
zodOpenapi.createRoute({
|
|
3451
|
+
method: "post",
|
|
3452
|
+
path: "/",
|
|
3453
|
+
summary: "Create Sub Agent External Agent Relation",
|
|
3454
|
+
operationId: "create-sub-agent-external-agent-relation",
|
|
3455
|
+
tags: ["Sub Agent External Agent Relations"],
|
|
3456
|
+
request: {
|
|
3457
|
+
params: agentsCore.TenantProjectAgentSubAgentParamsSchema,
|
|
3458
|
+
body: {
|
|
3459
|
+
content: {
|
|
3460
|
+
"application/json": {
|
|
3461
|
+
schema: agentsCore.SubAgentExternalAgentRelationApiInsertSchema
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
},
|
|
3466
|
+
responses: {
|
|
3467
|
+
201: {
|
|
3468
|
+
description: "Sub Agent External Agent Relation created successfully",
|
|
3469
|
+
content: {
|
|
3470
|
+
"application/json": {
|
|
3471
|
+
schema: agentsCore.SingleResponseSchema(agentsCore.SubAgentExternalAgentRelationApiSelectSchema)
|
|
3472
|
+
}
|
|
3473
|
+
}
|
|
3474
|
+
},
|
|
3475
|
+
...agentsCore.commonGetErrorResponses
|
|
3476
|
+
}
|
|
3477
|
+
}),
|
|
3478
|
+
async (c) => {
|
|
3479
|
+
const { tenantId, projectId, agentId, subAgentId } = c.req.valid("param");
|
|
3480
|
+
const body = await c.req.valid("json");
|
|
3481
|
+
const existingRelations = await agentsCore.listSubAgentExternalAgentRelations(dbClient_default)({
|
|
3482
|
+
scopes: { tenantId, projectId, agentId, subAgentId },
|
|
3483
|
+
pagination: { page: 1, limit: 1e3 }
|
|
3484
|
+
});
|
|
3485
|
+
const isDuplicate = existingRelations.data.some(
|
|
3486
|
+
(relation2) => relation2.externalAgentId === body.externalAgentId && relation2.subAgentId === subAgentId
|
|
3487
|
+
);
|
|
3488
|
+
if (isDuplicate) {
|
|
3489
|
+
throw agentsCore.createApiError({
|
|
3490
|
+
code: "unprocessable_entity",
|
|
3491
|
+
message: `A relation between this sub-agent and external agent already exists`
|
|
3492
|
+
});
|
|
3493
|
+
}
|
|
3494
|
+
const relation = await agentsCore.createSubAgentExternalAgentRelation(dbClient_default)({
|
|
3495
|
+
scopes: { tenantId, projectId, agentId, subAgentId },
|
|
3496
|
+
relationId: nanoid.nanoid(),
|
|
3497
|
+
data: {
|
|
3498
|
+
externalAgentId: body.externalAgentId,
|
|
3499
|
+
headers: body.headers || null
|
|
3500
|
+
}
|
|
3501
|
+
});
|
|
3502
|
+
return c.json({ data: relation }, 201);
|
|
3503
|
+
}
|
|
3504
|
+
);
|
|
3505
|
+
app15.openapi(
|
|
3506
|
+
zodOpenapi.createRoute({
|
|
3507
|
+
method: "put",
|
|
3508
|
+
path: "/{id}",
|
|
3509
|
+
summary: "Update Sub Agent External Agent Relation",
|
|
3510
|
+
operationId: "update-sub-agent-external-agent-relation",
|
|
3511
|
+
tags: ["Sub Agent External Agent Relations"],
|
|
3512
|
+
request: {
|
|
3513
|
+
params: agentsCore.TenantProjectAgentSubAgentIdParamsSchema,
|
|
3514
|
+
body: {
|
|
3515
|
+
content: {
|
|
3516
|
+
"application/json": {
|
|
3517
|
+
schema: agentsCore.SubAgentExternalAgentRelationApiUpdateSchema
|
|
3518
|
+
}
|
|
3519
|
+
}
|
|
3520
|
+
}
|
|
3521
|
+
},
|
|
3522
|
+
responses: {
|
|
3523
|
+
200: {
|
|
3524
|
+
description: "Sub Agent external agent relation updated successfully",
|
|
3525
|
+
content: {
|
|
3526
|
+
"application/json": {
|
|
3527
|
+
schema: agentsCore.SingleResponseSchema(agentsCore.SubAgentExternalAgentRelationApiSelectSchema)
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3530
|
+
},
|
|
3531
|
+
...agentsCore.commonGetErrorResponses
|
|
3532
|
+
}
|
|
3533
|
+
}),
|
|
3534
|
+
async (c) => {
|
|
3535
|
+
const { tenantId, projectId, agentId, subAgentId, id } = c.req.valid("param");
|
|
3536
|
+
const body = await c.req.valid("json");
|
|
3537
|
+
const updatedRelation = await agentsCore.updateSubAgentExternalAgentRelation(dbClient_default)({
|
|
3538
|
+
scopes: { tenantId, projectId, agentId, subAgentId },
|
|
3539
|
+
relationId: id,
|
|
3540
|
+
data: body
|
|
3541
|
+
});
|
|
3542
|
+
if (!updatedRelation) {
|
|
3543
|
+
throw agentsCore.createApiError({
|
|
3544
|
+
code: "not_found",
|
|
3545
|
+
message: "Sub Agent External Agent Relation not found"
|
|
3546
|
+
});
|
|
3547
|
+
}
|
|
3548
|
+
return c.json({ data: updatedRelation });
|
|
3549
|
+
}
|
|
3550
|
+
);
|
|
3551
|
+
app15.openapi(
|
|
3552
|
+
zodOpenapi.createRoute({
|
|
3553
|
+
method: "delete",
|
|
3554
|
+
path: "/{id}",
|
|
3555
|
+
summary: "Delete Sub Agent External Agent Relation",
|
|
3556
|
+
operationId: "delete-sub-agent-external-agent-relation",
|
|
3557
|
+
tags: ["Sub Agent External Agent Relations"],
|
|
3558
|
+
request: {
|
|
3559
|
+
params: agentsCore.TenantProjectAgentSubAgentIdParamsSchema
|
|
3560
|
+
},
|
|
3561
|
+
responses: {
|
|
3562
|
+
204: {
|
|
3563
|
+
description: "Sub Agent External Agent Relation deleted successfully"
|
|
3564
|
+
},
|
|
3565
|
+
404: {
|
|
3566
|
+
description: "Sub Agent External Agent Relation not found",
|
|
3567
|
+
content: {
|
|
3568
|
+
"application/json": {
|
|
3569
|
+
schema: agentsCore.ErrorResponseSchema
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
}),
|
|
3575
|
+
async (c) => {
|
|
3576
|
+
const { tenantId, projectId, agentId, subAgentId, id } = c.req.valid("param");
|
|
3577
|
+
const deleted = await agentsCore.deleteSubAgentExternalAgentRelation(dbClient_default)({
|
|
3578
|
+
scopes: { tenantId, projectId, agentId, subAgentId },
|
|
3579
|
+
relationId: id
|
|
3580
|
+
});
|
|
3581
|
+
if (!deleted) {
|
|
3582
|
+
throw agentsCore.createApiError({
|
|
3583
|
+
code: "not_found",
|
|
3584
|
+
message: "Sub Agent External Agent Relation not found"
|
|
3585
|
+
});
|
|
3586
|
+
}
|
|
3587
|
+
return c.body(null, 204);
|
|
3588
|
+
}
|
|
3589
|
+
);
|
|
3590
|
+
var subAgentExternalAgentRelations_default = app15;
|
|
3591
|
+
var app16 = new zodOpenapi.OpenAPIHono();
|
|
3592
|
+
app16.openapi(
|
|
3372
3593
|
zodOpenapi.createRoute({
|
|
3373
3594
|
method: "get",
|
|
3374
3595
|
path: "/",
|
|
@@ -3393,13 +3614,7 @@ app15.openapi(
|
|
|
3393
3614
|
}),
|
|
3394
3615
|
async (c) => {
|
|
3395
3616
|
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
3396
|
-
const {
|
|
3397
|
-
page = 1,
|
|
3398
|
-
limit = 10,
|
|
3399
|
-
sourceSubAgentId,
|
|
3400
|
-
targetSubAgentId,
|
|
3401
|
-
externalSubAgentId
|
|
3402
|
-
} = c.req.valid("query");
|
|
3617
|
+
const { page = 1, limit = 10, sourceSubAgentId, targetSubAgentId } = c.req.valid("query");
|
|
3403
3618
|
const pageNum = Number(page);
|
|
3404
3619
|
const limitNum = Math.min(Number(limit), 100);
|
|
3405
3620
|
try {
|
|
@@ -3418,13 +3633,6 @@ app15.openapi(
|
|
|
3418
3633
|
pagination: { page: pageNum, limit: limitNum }
|
|
3419
3634
|
});
|
|
3420
3635
|
result = { ...rawResult, data: rawResult.data };
|
|
3421
|
-
} else if (externalSubAgentId) {
|
|
3422
|
-
const rawResult = await agentsCore.getExternalAgentRelations(dbClient_default)({
|
|
3423
|
-
scopes: { tenantId, projectId, agentId },
|
|
3424
|
-
externalSubAgentId,
|
|
3425
|
-
pagination: { page: pageNum, limit: limitNum }
|
|
3426
|
-
});
|
|
3427
|
-
result = { ...rawResult, data: rawResult.data };
|
|
3428
3636
|
} else {
|
|
3429
3637
|
const rawResult = await agentsCore.listAgentRelations(dbClient_default)({
|
|
3430
3638
|
scopes: { tenantId, projectId, agentId },
|
|
@@ -3441,7 +3649,7 @@ app15.openapi(
|
|
|
3441
3649
|
}
|
|
3442
3650
|
}
|
|
3443
3651
|
);
|
|
3444
|
-
|
|
3652
|
+
app16.openapi(
|
|
3445
3653
|
zodOpenapi.createRoute({
|
|
3446
3654
|
method: "get",
|
|
3447
3655
|
path: "/{id}",
|
|
@@ -3478,7 +3686,7 @@ app15.openapi(
|
|
|
3478
3686
|
return c.json({ data: agentRelation });
|
|
3479
3687
|
}
|
|
3480
3688
|
);
|
|
3481
|
-
|
|
3689
|
+
app16.openapi(
|
|
3482
3690
|
zodOpenapi.createRoute({
|
|
3483
3691
|
method: "post",
|
|
3484
3692
|
path: "/",
|
|
@@ -3510,26 +3718,14 @@ app15.openapi(
|
|
|
3510
3718
|
async (c) => {
|
|
3511
3719
|
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
3512
3720
|
const body = await c.req.valid("json");
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
const externalAgentExists = await agentsCore.validateExternalAgent(dbClient_default)({
|
|
3516
|
-
scopes: { tenantId, projectId, agentId, subAgentId: body.externalSubAgentId }
|
|
3517
|
-
});
|
|
3518
|
-
if (!externalAgentExists) {
|
|
3519
|
-
throw agentsCore.createApiError({
|
|
3520
|
-
code: "bad_request",
|
|
3521
|
-
message: `External agent with ID ${body.externalSubAgentId} not found`
|
|
3522
|
-
});
|
|
3523
|
-
}
|
|
3524
|
-
}
|
|
3525
|
-
if (!isExternalAgent && body.targetSubAgentId) {
|
|
3526
|
-
const internalAgentExists = await agentsCore.validateInternalSubAgent(dbClient_default)({
|
|
3721
|
+
if (body.targetSubAgentId) {
|
|
3722
|
+
const subAgentExists = await agentsCore.validateSubAgent(dbClient_default)({
|
|
3527
3723
|
scopes: { tenantId, projectId, agentId, subAgentId: body.targetSubAgentId }
|
|
3528
3724
|
});
|
|
3529
|
-
if (!
|
|
3725
|
+
if (!subAgentExists) {
|
|
3530
3726
|
throw agentsCore.createApiError({
|
|
3531
3727
|
code: "bad_request",
|
|
3532
|
-
message: `
|
|
3728
|
+
message: `Sub agent with ID ${body.targetSubAgentId} not found`
|
|
3533
3729
|
});
|
|
3534
3730
|
}
|
|
3535
3731
|
}
|
|
@@ -3541,26 +3737,21 @@ app15.openapi(
|
|
|
3541
3737
|
if (relation.agentId !== agentId || relation.sourceSubAgentId !== body.sourceSubAgentId) {
|
|
3542
3738
|
return false;
|
|
3543
3739
|
}
|
|
3544
|
-
if (isExternalAgent) {
|
|
3545
|
-
return relation.externalSubAgentId === body.externalSubAgentId;
|
|
3546
|
-
}
|
|
3547
3740
|
return relation.targetSubAgentId === body.targetSubAgentId;
|
|
3548
3741
|
});
|
|
3549
3742
|
if (isDuplicate) {
|
|
3550
|
-
const agentType = isExternalAgent ? "external" : "internal";
|
|
3551
3743
|
throw agentsCore.createApiError({
|
|
3552
3744
|
code: "unprocessable_entity",
|
|
3553
|
-
message: `A relation between these agents
|
|
3745
|
+
message: `A relation between these agents in this agent already exists`
|
|
3554
3746
|
});
|
|
3555
3747
|
}
|
|
3556
3748
|
const relationData = {
|
|
3557
3749
|
agentId,
|
|
3558
3750
|
tenantId,
|
|
3559
|
-
id:
|
|
3751
|
+
id: agentsCore.generateId(),
|
|
3560
3752
|
projectId,
|
|
3561
3753
|
sourceSubAgentId: body.sourceSubAgentId,
|
|
3562
|
-
targetSubAgentId:
|
|
3563
|
-
externalSubAgentId: isExternalAgent ? body.externalSubAgentId : void 0,
|
|
3754
|
+
targetSubAgentId: body.targetSubAgentId,
|
|
3564
3755
|
relationType: body.relationType
|
|
3565
3756
|
};
|
|
3566
3757
|
const agentRelation = await agentsCore.createSubAgentRelation(dbClient_default)({
|
|
@@ -3569,7 +3760,7 @@ app15.openapi(
|
|
|
3569
3760
|
return c.json({ data: agentRelation }, 201);
|
|
3570
3761
|
}
|
|
3571
3762
|
);
|
|
3572
|
-
|
|
3763
|
+
app16.openapi(
|
|
3573
3764
|
zodOpenapi.createRoute({
|
|
3574
3765
|
method: "put",
|
|
3575
3766
|
path: "/{id}",
|
|
@@ -3615,7 +3806,7 @@ app15.openapi(
|
|
|
3615
3806
|
return c.json({ data: updatedAgentRelation });
|
|
3616
3807
|
}
|
|
3617
3808
|
);
|
|
3618
|
-
|
|
3809
|
+
app16.openapi(
|
|
3619
3810
|
zodOpenapi.createRoute({
|
|
3620
3811
|
method: "delete",
|
|
3621
3812
|
path: "/{id}",
|
|
@@ -3654,9 +3845,9 @@ app15.openapi(
|
|
|
3654
3845
|
return c.body(null, 204);
|
|
3655
3846
|
}
|
|
3656
3847
|
);
|
|
3657
|
-
var subAgentRelations_default =
|
|
3658
|
-
var
|
|
3659
|
-
|
|
3848
|
+
var subAgentRelations_default = app16;
|
|
3849
|
+
var app17 = new zodOpenapi.OpenAPIHono();
|
|
3850
|
+
app17.openapi(
|
|
3660
3851
|
zodOpenapi.createRoute({
|
|
3661
3852
|
method: "get",
|
|
3662
3853
|
path: "/",
|
|
@@ -3697,7 +3888,7 @@ app16.openapi(
|
|
|
3697
3888
|
return c.json(dataWithType);
|
|
3698
3889
|
}
|
|
3699
3890
|
);
|
|
3700
|
-
|
|
3891
|
+
app17.openapi(
|
|
3701
3892
|
zodOpenapi.createRoute({
|
|
3702
3893
|
method: "get",
|
|
3703
3894
|
path: "/{id}",
|
|
@@ -3738,7 +3929,7 @@ app16.openapi(
|
|
|
3738
3929
|
return c.json({ data: subAgentWithType });
|
|
3739
3930
|
}
|
|
3740
3931
|
);
|
|
3741
|
-
|
|
3932
|
+
app17.openapi(
|
|
3742
3933
|
zodOpenapi.createRoute({
|
|
3743
3934
|
method: "post",
|
|
3744
3935
|
path: "/",
|
|
@@ -3770,7 +3961,7 @@ app16.openapi(
|
|
|
3770
3961
|
async (c) => {
|
|
3771
3962
|
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
3772
3963
|
const body = c.req.valid("json");
|
|
3773
|
-
const subAgentId = body.id ? String(body.id) :
|
|
3964
|
+
const subAgentId = body.id ? String(body.id) : agentsCore.generateId();
|
|
3774
3965
|
const subAgent = await agentsCore.createSubAgent(dbClient_default)({
|
|
3775
3966
|
...body,
|
|
3776
3967
|
id: subAgentId,
|
|
@@ -3785,7 +3976,7 @@ app16.openapi(
|
|
|
3785
3976
|
return c.json({ data: subAgentWithType }, 201);
|
|
3786
3977
|
}
|
|
3787
3978
|
);
|
|
3788
|
-
|
|
3979
|
+
app17.openapi(
|
|
3789
3980
|
zodOpenapi.createRoute({
|
|
3790
3981
|
method: "put",
|
|
3791
3982
|
path: "/{id}",
|
|
@@ -3835,7 +4026,7 @@ app16.openapi(
|
|
|
3835
4026
|
return c.json({ data: subAgentWithType });
|
|
3836
4027
|
}
|
|
3837
4028
|
);
|
|
3838
|
-
|
|
4029
|
+
app17.openapi(
|
|
3839
4030
|
zodOpenapi.createRoute({
|
|
3840
4031
|
method: "delete",
|
|
3841
4032
|
path: "/{id}",
|
|
@@ -3874,9 +4065,9 @@ app16.openapi(
|
|
|
3874
4065
|
return c.body(null, 204);
|
|
3875
4066
|
}
|
|
3876
4067
|
);
|
|
3877
|
-
var subAgents_default =
|
|
3878
|
-
var
|
|
3879
|
-
|
|
4068
|
+
var subAgents_default = app17;
|
|
4069
|
+
var app18 = new zodOpenapi.OpenAPIHono();
|
|
4070
|
+
app18.openapi(
|
|
3880
4071
|
zodOpenapi.createRoute({
|
|
3881
4072
|
method: "get",
|
|
3882
4073
|
path: "/",
|
|
@@ -3938,7 +4129,7 @@ app17.openapi(
|
|
|
3938
4129
|
return c.json(result);
|
|
3939
4130
|
}
|
|
3940
4131
|
);
|
|
3941
|
-
|
|
4132
|
+
app18.openapi(
|
|
3942
4133
|
zodOpenapi.createRoute({
|
|
3943
4134
|
method: "get",
|
|
3944
4135
|
path: "/{id}",
|
|
@@ -3975,7 +4166,7 @@ app17.openapi(
|
|
|
3975
4166
|
return c.json({ data: agentToolRelation });
|
|
3976
4167
|
}
|
|
3977
4168
|
);
|
|
3978
|
-
|
|
4169
|
+
app18.openapi(
|
|
3979
4170
|
zodOpenapi.createRoute({
|
|
3980
4171
|
method: "get",
|
|
3981
4172
|
path: "/tool/{toolId}/sub-agents",
|
|
@@ -4011,7 +4202,7 @@ app17.openapi(
|
|
|
4011
4202
|
return c.json(dbResult);
|
|
4012
4203
|
}
|
|
4013
4204
|
);
|
|
4014
|
-
|
|
4205
|
+
app18.openapi(
|
|
4015
4206
|
zodOpenapi.createRoute({
|
|
4016
4207
|
method: "post",
|
|
4017
4208
|
path: "/",
|
|
@@ -4074,7 +4265,7 @@ app17.openapi(
|
|
|
4074
4265
|
}
|
|
4075
4266
|
}
|
|
4076
4267
|
);
|
|
4077
|
-
|
|
4268
|
+
app18.openapi(
|
|
4078
4269
|
zodOpenapi.createRoute({
|
|
4079
4270
|
method: "put",
|
|
4080
4271
|
path: "/{id}",
|
|
@@ -4127,7 +4318,7 @@ app17.openapi(
|
|
|
4127
4318
|
return c.json({ data: updatedAgentToolRelation });
|
|
4128
4319
|
}
|
|
4129
4320
|
);
|
|
4130
|
-
|
|
4321
|
+
app18.openapi(
|
|
4131
4322
|
zodOpenapi.createRoute({
|
|
4132
4323
|
method: "delete",
|
|
4133
4324
|
path: "/{id}",
|
|
@@ -4166,10 +4357,10 @@ app17.openapi(
|
|
|
4166
4357
|
return c.body(null, 204);
|
|
4167
4358
|
}
|
|
4168
4359
|
);
|
|
4169
|
-
var subAgentToolRelations_default =
|
|
4360
|
+
var subAgentToolRelations_default = app18;
|
|
4170
4361
|
var logger5 = agentsCore.getLogger("tools");
|
|
4171
|
-
var
|
|
4172
|
-
|
|
4362
|
+
var app19 = new zodOpenapi.OpenAPIHono();
|
|
4363
|
+
app19.openapi(
|
|
4173
4364
|
zodOpenapi.createRoute({
|
|
4174
4365
|
method: "get",
|
|
4175
4366
|
path: "/",
|
|
@@ -4229,7 +4420,7 @@ app18.openapi(
|
|
|
4229
4420
|
return c.json(result);
|
|
4230
4421
|
}
|
|
4231
4422
|
);
|
|
4232
|
-
|
|
4423
|
+
app19.openapi(
|
|
4233
4424
|
zodOpenapi.createRoute({
|
|
4234
4425
|
method: "get",
|
|
4235
4426
|
path: "/{id}",
|
|
@@ -4266,7 +4457,7 @@ app18.openapi(
|
|
|
4266
4457
|
});
|
|
4267
4458
|
}
|
|
4268
4459
|
);
|
|
4269
|
-
|
|
4460
|
+
app19.openapi(
|
|
4270
4461
|
zodOpenapi.createRoute({
|
|
4271
4462
|
method: "post",
|
|
4272
4463
|
path: "/",
|
|
@@ -4300,7 +4491,7 @@ app18.openapi(
|
|
|
4300
4491
|
const body = c.req.valid("json");
|
|
4301
4492
|
const credentialStores = c.get("credentialStores");
|
|
4302
4493
|
logger5.info({ body }, "body");
|
|
4303
|
-
const id = body.id ||
|
|
4494
|
+
const id = body.id || agentsCore.generateId();
|
|
4304
4495
|
const tool = await agentsCore.createTool(dbClient_default)({
|
|
4305
4496
|
tenantId,
|
|
4306
4497
|
projectId,
|
|
@@ -4319,7 +4510,7 @@ app18.openapi(
|
|
|
4319
4510
|
);
|
|
4320
4511
|
}
|
|
4321
4512
|
);
|
|
4322
|
-
|
|
4513
|
+
app19.openapi(
|
|
4323
4514
|
zodOpenapi.createRoute({
|
|
4324
4515
|
method: "put",
|
|
4325
4516
|
path: "/{id}",
|
|
@@ -4380,7 +4571,7 @@ app18.openapi(
|
|
|
4380
4571
|
});
|
|
4381
4572
|
}
|
|
4382
4573
|
);
|
|
4383
|
-
|
|
4574
|
+
app19.openapi(
|
|
4384
4575
|
zodOpenapi.createRoute({
|
|
4385
4576
|
method: "delete",
|
|
4386
4577
|
path: "/{id}",
|
|
@@ -4416,38 +4607,42 @@ app18.openapi(
|
|
|
4416
4607
|
return c.body(null, 204);
|
|
4417
4608
|
}
|
|
4418
4609
|
);
|
|
4419
|
-
var tools_default =
|
|
4610
|
+
var tools_default = app19;
|
|
4420
4611
|
|
|
4421
4612
|
// src/routes/index.ts
|
|
4422
|
-
var
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4613
|
+
var app20 = new zodOpenapi.OpenAPIHono();
|
|
4614
|
+
app20.route("/projects", projects_default);
|
|
4615
|
+
app20.route("/projects/:projectId/agents/:agentId/sub-agents", subAgents_default);
|
|
4616
|
+
app20.route("/projects/:projectId/agents/:agentId/sub-agent-relations", subAgentRelations_default);
|
|
4617
|
+
app20.route(
|
|
4618
|
+
"/projects/:projectId/agents/:agentId/sub-agents/:subAgentId/external-agent-relations",
|
|
4619
|
+
subAgentExternalAgentRelations_default
|
|
4620
|
+
);
|
|
4621
|
+
app20.route("/projects/:projectId/agents", agent_default);
|
|
4622
|
+
app20.route(
|
|
4428
4623
|
"/projects/:projectId/agents/:agentId/sub-agent-tool-relations",
|
|
4429
4624
|
subAgentToolRelations_default
|
|
4430
4625
|
);
|
|
4431
|
-
|
|
4626
|
+
app20.route(
|
|
4432
4627
|
"/projects/:projectId/agents/:agentId/sub-agent-artifact-components",
|
|
4433
4628
|
subAgentArtifactComponents_default
|
|
4434
4629
|
);
|
|
4435
|
-
|
|
4630
|
+
app20.route(
|
|
4436
4631
|
"/projects/:projectId/agents/:agentId/sub-agent-data-components",
|
|
4437
4632
|
subAgentDataComponents_default
|
|
4438
4633
|
);
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
var routes_default =
|
|
4634
|
+
app20.route("/projects/:projectId/artifact-components", artifactComponents_default);
|
|
4635
|
+
app20.route("/projects/:projectId/agents/:agentId/context-configs", contextConfigs_default);
|
|
4636
|
+
app20.route("/projects/:projectId/credentials", credentials_default);
|
|
4637
|
+
app20.route("/projects/:projectId/credential-stores", credentialStores_default);
|
|
4638
|
+
app20.route("/projects/:projectId/data-components", dataComponents_default);
|
|
4639
|
+
app20.route("/projects/:projectId/external-agents", externalAgents_default);
|
|
4640
|
+
app20.route("/projects/:projectId/agents/:agentId/function-tools", functionTools_default);
|
|
4641
|
+
app20.route("/projects/:projectId/functions", functions_default);
|
|
4642
|
+
app20.route("/projects/:projectId/tools", tools_default);
|
|
4643
|
+
app20.route("/projects/:projectId/api-keys", apiKeys_default);
|
|
4644
|
+
app20.route("/projects/:projectId/agent", agentFull_default);
|
|
4645
|
+
var routes_default = app20;
|
|
4451
4646
|
var logger6 = agentsCore.getLogger("oauth-service");
|
|
4452
4647
|
var pkceStore = /* @__PURE__ */ new Map();
|
|
4453
4648
|
function storePKCEVerifier(state, codeVerifier, toolId, tenantId, projectId, clientInformation, metadata, resourceUrl) {
|
|
@@ -4562,7 +4757,7 @@ var oauthService = new OAuthService();
|
|
|
4562
4757
|
// src/routes/oauth.ts
|
|
4563
4758
|
async function findOrCreateCredential(tenantId, projectId, credentialData) {
|
|
4564
4759
|
try {
|
|
4565
|
-
const existingCredential = await agentsCore.
|
|
4760
|
+
const existingCredential = await agentsCore.getCredentialReferenceWithResources(dbClient_default)({
|
|
4566
4761
|
scopes: { tenantId, projectId },
|
|
4567
4762
|
id: credentialData.id
|
|
4568
4763
|
});
|
|
@@ -4585,7 +4780,7 @@ async function findOrCreateCredential(tenantId, projectId, credentialData) {
|
|
|
4585
4780
|
throw new Error(`Failed to save credential '${credentialData.id}' to database`);
|
|
4586
4781
|
}
|
|
4587
4782
|
}
|
|
4588
|
-
var
|
|
4783
|
+
var app21 = new zodOpenapi.OpenAPIHono();
|
|
4589
4784
|
var logger7 = agentsCore.getLogger("oauth-callback");
|
|
4590
4785
|
function getBaseUrlFromRequest(c) {
|
|
4591
4786
|
const url = new URL(c.req.url);
|
|
@@ -4672,7 +4867,7 @@ var OAuthCallbackQuerySchema = zodOpenapi.z.object({
|
|
|
4672
4867
|
error: zodOpenapi.z.string().optional(),
|
|
4673
4868
|
error_description: zodOpenapi.z.string().optional()
|
|
4674
4869
|
});
|
|
4675
|
-
|
|
4870
|
+
app21.openapi(
|
|
4676
4871
|
zodOpenapi.createRoute({
|
|
4677
4872
|
method: "get",
|
|
4678
4873
|
path: "/login",
|
|
@@ -4737,7 +4932,7 @@ app20.openapi(
|
|
|
4737
4932
|
}
|
|
4738
4933
|
}
|
|
4739
4934
|
);
|
|
4740
|
-
|
|
4935
|
+
app21.openapi(
|
|
4741
4936
|
zodOpenapi.createRoute({
|
|
4742
4937
|
method: "get",
|
|
4743
4938
|
path: "/callback",
|
|
@@ -4879,9 +5074,9 @@ app20.openapi(
|
|
|
4879
5074
|
}
|
|
4880
5075
|
}
|
|
4881
5076
|
);
|
|
4882
|
-
var oauth_default =
|
|
5077
|
+
var oauth_default = app21;
|
|
4883
5078
|
var logger8 = agentsCore.getLogger("projectFull");
|
|
4884
|
-
var
|
|
5079
|
+
var app22 = new zodOpenapi.OpenAPIHono();
|
|
4885
5080
|
var ProjectIdParamsSchema = zod.z.object({
|
|
4886
5081
|
tenantId: zod.z.string().openapi({
|
|
4887
5082
|
description: "Tenant identifier",
|
|
@@ -4898,7 +5093,7 @@ var TenantParamsSchema2 = zod.z.object({
|
|
|
4898
5093
|
example: "tenant_123"
|
|
4899
5094
|
})
|
|
4900
5095
|
}).openapi("TenantParams");
|
|
4901
|
-
|
|
5096
|
+
app22.openapi(
|
|
4902
5097
|
zodOpenapi.createRoute({
|
|
4903
5098
|
method: "post",
|
|
4904
5099
|
path: "/project-full",
|
|
@@ -4940,6 +5135,7 @@ app21.openapi(
|
|
|
4940
5135
|
const { tenantId } = c.req.valid("param");
|
|
4941
5136
|
const projectData = c.req.valid("json");
|
|
4942
5137
|
const validatedProjectData = agentsCore.FullProjectDefinitionSchema.parse(projectData);
|
|
5138
|
+
console.log("validatedProjectData", validatedProjectData);
|
|
4943
5139
|
try {
|
|
4944
5140
|
const createdProject = await agentsCore.createFullProjectServerSide(dbClient_default, logger8)(
|
|
4945
5141
|
{ tenantId, projectId: validatedProjectData.id },
|
|
@@ -4957,7 +5153,7 @@ app21.openapi(
|
|
|
4957
5153
|
}
|
|
4958
5154
|
}
|
|
4959
5155
|
);
|
|
4960
|
-
|
|
5156
|
+
app22.openapi(
|
|
4961
5157
|
zodOpenapi.createRoute({
|
|
4962
5158
|
method: "get",
|
|
4963
5159
|
path: "/project-full/{projectId}",
|
|
@@ -5010,7 +5206,7 @@ app21.openapi(
|
|
|
5010
5206
|
}
|
|
5011
5207
|
}
|
|
5012
5208
|
);
|
|
5013
|
-
|
|
5209
|
+
app22.openapi(
|
|
5014
5210
|
zodOpenapi.createRoute({
|
|
5015
5211
|
method: "put",
|
|
5016
5212
|
path: "/project-full/{projectId}",
|
|
@@ -5094,7 +5290,7 @@ app21.openapi(
|
|
|
5094
5290
|
}
|
|
5095
5291
|
}
|
|
5096
5292
|
);
|
|
5097
|
-
|
|
5293
|
+
app22.openapi(
|
|
5098
5294
|
zodOpenapi.createRoute({
|
|
5099
5295
|
method: "delete",
|
|
5100
5296
|
path: "/project-full/{projectId}",
|
|
@@ -5142,20 +5338,20 @@ app21.openapi(
|
|
|
5142
5338
|
}
|
|
5143
5339
|
}
|
|
5144
5340
|
);
|
|
5145
|
-
var projectFull_default =
|
|
5341
|
+
var projectFull_default = app22;
|
|
5146
5342
|
|
|
5147
5343
|
// src/app.ts
|
|
5148
5344
|
var logger9 = agentsCore.getLogger("agents-manage-api");
|
|
5149
5345
|
logger9.info({ logger: logger9.getTransports() }, "Logger initialized");
|
|
5150
5346
|
function createManagementHono(serverConfig, credentialStores) {
|
|
5151
|
-
const
|
|
5152
|
-
|
|
5153
|
-
|
|
5347
|
+
const app24 = new zodOpenapi.OpenAPIHono();
|
|
5348
|
+
app24.use("*", requestId.requestId());
|
|
5349
|
+
app24.use("*", async (c, next) => {
|
|
5154
5350
|
c.set("serverConfig", serverConfig);
|
|
5155
5351
|
c.set("credentialStores", credentialStores);
|
|
5156
5352
|
return next();
|
|
5157
5353
|
});
|
|
5158
|
-
|
|
5354
|
+
app24.use(
|
|
5159
5355
|
honoPino.pinoLogger({
|
|
5160
5356
|
pino: agentsCore.getLogger("agents-manage-api").getPinoInstance(),
|
|
5161
5357
|
http: {
|
|
@@ -5168,7 +5364,7 @@ function createManagementHono(serverConfig, credentialStores) {
|
|
|
5168
5364
|
}
|
|
5169
5365
|
})
|
|
5170
5366
|
);
|
|
5171
|
-
|
|
5367
|
+
app24.onError(async (err, c) => {
|
|
5172
5368
|
const isExpectedError = err instanceof httpException.HTTPException;
|
|
5173
5369
|
const status = isExpectedError ? err.status : 500;
|
|
5174
5370
|
const requestId2 = c.get("requestId") || "unknown";
|
|
@@ -5243,7 +5439,7 @@ function createManagementHono(serverConfig, credentialStores) {
|
|
|
5243
5439
|
...instance && { instance }
|
|
5244
5440
|
});
|
|
5245
5441
|
});
|
|
5246
|
-
|
|
5442
|
+
app24.use(
|
|
5247
5443
|
"*",
|
|
5248
5444
|
cors.cors({
|
|
5249
5445
|
origin: (origin) => {
|
|
@@ -5257,7 +5453,7 @@ function createManagementHono(serverConfig, credentialStores) {
|
|
|
5257
5453
|
credentials: true
|
|
5258
5454
|
})
|
|
5259
5455
|
);
|
|
5260
|
-
|
|
5456
|
+
app24.openapi(
|
|
5261
5457
|
zodOpenapi.createRoute({
|
|
5262
5458
|
method: "get",
|
|
5263
5459
|
path: "/health",
|
|
@@ -5274,13 +5470,13 @@ function createManagementHono(serverConfig, credentialStores) {
|
|
|
5274
5470
|
return c.body(null, 204);
|
|
5275
5471
|
}
|
|
5276
5472
|
);
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
setupOpenAPIRoutes(
|
|
5473
|
+
app24.use("/tenants/*", apiKeyAuth());
|
|
5474
|
+
app24.route("/tenants/:tenantId", routes_default);
|
|
5475
|
+
app24.route("/tenants/:tenantId", projectFull_default);
|
|
5476
|
+
app24.route("/oauth", oauth_default);
|
|
5477
|
+
setupOpenAPIRoutes(app24);
|
|
5282
5478
|
const baseApp = new hono.Hono();
|
|
5283
|
-
baseApp.route("/",
|
|
5479
|
+
baseApp.route("/", app24);
|
|
5284
5480
|
return baseApp;
|
|
5285
5481
|
}
|
|
5286
5482
|
|
|
@@ -5296,8 +5492,8 @@ var defaultConfig = {
|
|
|
5296
5492
|
};
|
|
5297
5493
|
var defaultStores = agentsCore.createDefaultCredentialStores();
|
|
5298
5494
|
var defaultRegistry = new agentsCore.CredentialStoreRegistry(defaultStores);
|
|
5299
|
-
var
|
|
5300
|
-
var index_default =
|
|
5495
|
+
var app23 = createManagementHono(defaultConfig, defaultRegistry);
|
|
5496
|
+
var index_default = app23;
|
|
5301
5497
|
function createManagementApp(config) {
|
|
5302
5498
|
const serverConfig = config?.serverConfig ?? defaultConfig;
|
|
5303
5499
|
const stores = config?.credentialStores ?? defaultStores;
|