@inkeep/agents-manage-api 0.0.0-dev-20250910232631 → 0.0.0-dev-20250910233151

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.
Files changed (108) hide show
  1. package/dist/index.cjs +5075 -0
  2. package/dist/index.d.cts +15 -0
  3. package/dist/index.d.ts +13 -8
  4. package/dist/index.js +5044 -26
  5. package/package.json +3 -3
  6. package/dist/__tests__/setup.d.ts +0 -2
  7. package/dist/__tests__/setup.d.ts.map +0 -1
  8. package/dist/__tests__/setup.js +0 -26
  9. package/dist/__tests__/utils/testProject.d.ts +0 -18
  10. package/dist/__tests__/utils/testProject.d.ts.map +0 -1
  11. package/dist/__tests__/utils/testProject.js +0 -26
  12. package/dist/__tests__/utils/testRequest.d.ts +0 -2
  13. package/dist/__tests__/utils/testRequest.d.ts.map +0 -1
  14. package/dist/__tests__/utils/testRequest.js +0 -11
  15. package/dist/__tests__/utils/testTenant.d.ts +0 -64
  16. package/dist/__tests__/utils/testTenant.d.ts.map +0 -1
  17. package/dist/__tests__/utils/testTenant.js +0 -71
  18. package/dist/app.d.ts +0 -5
  19. package/dist/app.d.ts.map +0 -1
  20. package/dist/app.js +0 -151
  21. package/dist/data/conversations.d.ts +0 -59
  22. package/dist/data/conversations.d.ts.map +0 -1
  23. package/dist/data/conversations.js +0 -216
  24. package/dist/data/db/clean.d.ts +0 -6
  25. package/dist/data/db/clean.d.ts.map +0 -1
  26. package/dist/data/db/clean.js +0 -77
  27. package/dist/data/db/dbClient.d.ts +0 -3
  28. package/dist/data/db/dbClient.d.ts.map +0 -1
  29. package/dist/data/db/dbClient.js +0 -13
  30. package/dist/data/graphFull.d.ts +0 -11
  31. package/dist/data/graphFull.d.ts.map +0 -1
  32. package/dist/data/graphFull.js +0 -90
  33. package/dist/data/graphFullClient.d.ts +0 -22
  34. package/dist/data/graphFullClient.d.ts.map +0 -1
  35. package/dist/data/graphFullClient.js +0 -189
  36. package/dist/data/tools.d.ts +0 -82
  37. package/dist/data/tools.d.ts.map +0 -1
  38. package/dist/data/tools.js +0 -271
  39. package/dist/env.d.ts +0 -41
  40. package/dist/env.d.ts.map +0 -1
  41. package/dist/env.js +0 -59
  42. package/dist/index.d.ts.map +0 -1
  43. package/dist/logger.d.ts +0 -4
  44. package/dist/logger.d.ts.map +0 -1
  45. package/dist/logger.js +0 -32
  46. package/dist/middleware/auth.d.ts +0 -12
  47. package/dist/middleware/auth.d.ts.map +0 -1
  48. package/dist/middleware/auth.js +0 -36
  49. package/dist/openapi.d.ts +0 -2
  50. package/dist/openapi.d.ts.map +0 -1
  51. package/dist/openapi.js +0 -38
  52. package/dist/routes/agentArtifactComponents.d.ts +0 -4
  53. package/dist/routes/agentArtifactComponents.d.ts.map +0 -1
  54. package/dist/routes/agentArtifactComponents.js +0 -228
  55. package/dist/routes/agentDataComponents.d.ts +0 -4
  56. package/dist/routes/agentDataComponents.d.ts.map +0 -1
  57. package/dist/routes/agentDataComponents.js +0 -224
  58. package/dist/routes/agentGraph.d.ts +0 -4
  59. package/dist/routes/agentGraph.d.ts.map +0 -1
  60. package/dist/routes/agentGraph.js +0 -287
  61. package/dist/routes/agentRelations.d.ts +0 -4
  62. package/dist/routes/agentRelations.d.ts.map +0 -1
  63. package/dist/routes/agentRelations.js +0 -289
  64. package/dist/routes/agentToolRelations.d.ts +0 -4
  65. package/dist/routes/agentToolRelations.d.ts.map +0 -1
  66. package/dist/routes/agentToolRelations.js +0 -342
  67. package/dist/routes/agents.d.ts +0 -4
  68. package/dist/routes/agents.d.ts.map +0 -1
  69. package/dist/routes/agents.js +0 -212
  70. package/dist/routes/apiKeys.d.ts +0 -4
  71. package/dist/routes/apiKeys.d.ts.map +0 -1
  72. package/dist/routes/apiKeys.js +0 -235
  73. package/dist/routes/artifactComponents.d.ts +0 -4
  74. package/dist/routes/artifactComponents.d.ts.map +0 -1
  75. package/dist/routes/artifactComponents.js +0 -201
  76. package/dist/routes/contextConfigs.d.ts +0 -4
  77. package/dist/routes/contextConfigs.d.ts.map +0 -1
  78. package/dist/routes/contextConfigs.js +0 -180
  79. package/dist/routes/credentials.d.ts +0 -10
  80. package/dist/routes/credentials.d.ts.map +0 -1
  81. package/dist/routes/credentials.js +0 -218
  82. package/dist/routes/dataComponents.d.ts +0 -4
  83. package/dist/routes/dataComponents.d.ts.map +0 -1
  84. package/dist/routes/dataComponents.js +0 -187
  85. package/dist/routes/externalAgents.d.ts +0 -4
  86. package/dist/routes/externalAgents.d.ts.map +0 -1
  87. package/dist/routes/externalAgents.js +0 -215
  88. package/dist/routes/graphFull.d.ts +0 -4
  89. package/dist/routes/graphFull.d.ts.map +0 -1
  90. package/dist/routes/graphFull.js +0 -247
  91. package/dist/routes/index.d.ts +0 -4
  92. package/dist/routes/index.d.ts.map +0 -1
  93. package/dist/routes/index.js +0 -37
  94. package/dist/routes/oauth.d.ts +0 -21
  95. package/dist/routes/oauth.d.ts.map +0 -1
  96. package/dist/routes/oauth.js +0 -191
  97. package/dist/routes/projects.d.ts +0 -4
  98. package/dist/routes/projects.d.ts.map +0 -1
  99. package/dist/routes/projects.js +0 -220
  100. package/dist/routes/tools.d.ts +0 -11
  101. package/dist/routes/tools.d.ts.map +0 -1
  102. package/dist/routes/tools.js +0 -554
  103. package/dist/utils/auth-detection.d.ts +0 -22
  104. package/dist/utils/auth-detection.d.ts.map +0 -1
  105. package/dist/utils/auth-detection.js +0 -149
  106. package/dist/utils/oauth-service.d.ts +0 -88
  107. package/dist/utils/oauth-service.d.ts.map +0 -1
  108. package/dist/utils/oauth-service.js +0 -240
@@ -1,342 +0,0 @@
1
- import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
2
- import { AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, commonGetErrorResponses, createAgentToolRelation, createApiError, deleteAgentToolRelation, ErrorResponseSchema, getAgentsForTool, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getToolsForAgent, IdParamsSchema, ListResponseSchema, listAgentToolRelations, PaginationQueryParamsSchema, SingleResponseSchema, TenantProjectParamsSchema, updateAgentToolRelation, } from '@inkeep/agents-core';
3
- import { z } from 'zod';
4
- import dbClient from '../data/db/dbClient';
5
- const app = new OpenAPIHono();
6
- // List agent tool relations
7
- app.openapi(createRoute({
8
- method: 'get',
9
- path: '/',
10
- summary: 'List Agent Tool Relations',
11
- operationId: 'list-agent-tool-relations',
12
- tags: ['CRUD Agent Tool Relations'],
13
- request: {
14
- params: TenantProjectParamsSchema,
15
- query: PaginationQueryParamsSchema.extend({
16
- agentId: z.string().optional(),
17
- toolId: z.string().optional(),
18
- }),
19
- },
20
- responses: {
21
- 200: {
22
- description: 'List of agent tool relations retrieved successfully',
23
- content: {
24
- 'application/json': {
25
- schema: ListResponseSchema(AgentToolRelationApiSelectSchema),
26
- },
27
- },
28
- },
29
- ...commonGetErrorResponses,
30
- },
31
- }), async (c) => {
32
- const { tenantId, projectId } = c.req.valid('param');
33
- const { page, limit, agentId, toolId } = c.req.valid('query');
34
- let result;
35
- // Filter by agent if provided
36
- if (agentId) {
37
- const dbResult = await getAgentToolRelationByAgent(dbClient)({
38
- scopes: { tenantId, projectId },
39
- agentId,
40
- pagination: { page, limit },
41
- });
42
- result = {
43
- data: dbResult.data,
44
- pagination: dbResult.pagination,
45
- };
46
- }
47
- // Filter by tool if provided
48
- else if (toolId) {
49
- const dbResult = await getAgentToolRelationByTool(dbClient)({
50
- scopes: { tenantId, projectId },
51
- toolId,
52
- pagination: { page, limit },
53
- });
54
- result = {
55
- data: dbResult.data,
56
- pagination: dbResult.pagination,
57
- };
58
- }
59
- // Default: get all agent tool relations
60
- else {
61
- const dbResult = await listAgentToolRelations(dbClient)({
62
- scopes: { tenantId, projectId },
63
- pagination: { page, limit },
64
- });
65
- result = {
66
- data: dbResult.data,
67
- pagination: dbResult.pagination,
68
- };
69
- }
70
- return c.json(result);
71
- });
72
- // Get agent tool relation by ID
73
- app.openapi(createRoute({
74
- method: 'get',
75
- path: '/{id}',
76
- summary: 'Get Agent Tool Relation',
77
- operationId: 'get-agent-tool-relation',
78
- tags: ['CRUD Agent Tool Relations'],
79
- request: {
80
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
81
- },
82
- responses: {
83
- 200: {
84
- description: 'Agent tool relation found',
85
- content: {
86
- 'application/json': {
87
- schema: SingleResponseSchema(AgentToolRelationApiSelectSchema),
88
- },
89
- },
90
- },
91
- ...commonGetErrorResponses,
92
- },
93
- }), async (c) => {
94
- const { tenantId, projectId, id } = c.req.valid('param');
95
- const agentToolRelation = await getAgentToolRelationById(dbClient)({
96
- scopes: { tenantId, projectId },
97
- relationId: id,
98
- });
99
- if (!agentToolRelation) {
100
- throw createApiError({
101
- code: 'not_found',
102
- message: 'Agent tool relation not found',
103
- });
104
- }
105
- return c.json({ data: agentToolRelation });
106
- });
107
- // Get tools for a specific agent (with tool details)
108
- app.openapi(createRoute({
109
- method: 'get',
110
- path: '/agent/{agentId}/tools',
111
- summary: 'Get Tools for Agent',
112
- operationId: 'get-tools-for-agent',
113
- tags: ['CRUD Agent Tool Relations'],
114
- request: {
115
- params: TenantProjectParamsSchema.extend({
116
- agentId: z.string(),
117
- }),
118
- query: PaginationQueryParamsSchema,
119
- },
120
- responses: {
121
- 200: {
122
- description: 'Tools for agent retrieved successfully',
123
- content: {
124
- 'application/json': {
125
- schema: ListResponseSchema(AgentToolRelationApiSelectSchema),
126
- },
127
- },
128
- },
129
- ...commonGetErrorResponses,
130
- },
131
- }), async (c) => {
132
- const { tenantId, projectId, agentId } = c.req.valid('param');
133
- const { page, limit } = c.req.valid('query');
134
- const dbResult = await getToolsForAgent(dbClient)({
135
- scopes: { tenantId, projectId },
136
- agentId,
137
- pagination: { page, limit },
138
- });
139
- const result = {
140
- data: dbResult.data,
141
- pagination: dbResult.pagination,
142
- };
143
- return c.json(result);
144
- });
145
- // Get agents for a specific tool (with agent details)
146
- app.openapi(createRoute({
147
- method: 'get',
148
- path: '/tool/{toolId}/agents',
149
- summary: 'Get Agents for Tool',
150
- operationId: 'get-agents-for-tool',
151
- tags: ['CRUD Agent Tool Relations'],
152
- request: {
153
- params: TenantProjectParamsSchema.extend({
154
- toolId: z.string(),
155
- }),
156
- query: PaginationQueryParamsSchema,
157
- },
158
- responses: {
159
- 200: {
160
- description: 'Agents for tool retrieved successfully',
161
- content: {
162
- 'application/json': {
163
- schema: ListResponseSchema(AgentToolRelationApiSelectSchema),
164
- },
165
- },
166
- },
167
- ...commonGetErrorResponses,
168
- },
169
- }), async (c) => {
170
- const { tenantId, projectId, toolId } = c.req.valid('param');
171
- const { page, limit } = c.req.valid('query');
172
- const dbResult = await getAgentsForTool(dbClient)({
173
- scopes: { tenantId, projectId },
174
- toolId,
175
- pagination: { page, limit },
176
- });
177
- const result = {
178
- data: dbResult.data,
179
- pagination: dbResult.pagination,
180
- };
181
- return c.json(result);
182
- });
183
- // Create agent tool relation
184
- app.openapi(createRoute({
185
- method: 'post',
186
- path: '/',
187
- summary: 'Create Agent Tool Relation',
188
- operationId: 'create-agent-tool-relation',
189
- tags: ['CRUD Agent Tool Relations'],
190
- request: {
191
- params: TenantProjectParamsSchema,
192
- body: {
193
- content: {
194
- 'application/json': {
195
- schema: AgentToolRelationApiInsertSchema,
196
- },
197
- },
198
- },
199
- },
200
- responses: {
201
- 201: {
202
- description: 'Agent tool relation created successfully',
203
- content: {
204
- 'application/json': {
205
- schema: SingleResponseSchema(AgentToolRelationApiSelectSchema),
206
- },
207
- },
208
- },
209
- ...commonGetErrorResponses,
210
- },
211
- }), async (c) => {
212
- const { tenantId, projectId } = c.req.valid('param');
213
- const body = c.req.valid('json');
214
- // Check if relation already exists (prevent duplicates)
215
- const existingRelations = await listAgentToolRelations(dbClient)({
216
- scopes: { tenantId, projectId },
217
- pagination: { limit: 1000 },
218
- });
219
- const isDuplicate = existingRelations.data.some((relation) => {
220
- const typedRelation = relation;
221
- return typedRelation.agentId === body.agentId && typedRelation.toolId === body.toolId;
222
- });
223
- if (isDuplicate) {
224
- throw createApiError({
225
- code: 'unprocessable_entity',
226
- message: 'Agent tool relation already exists',
227
- });
228
- }
229
- try {
230
- const agentToolRelation = await createAgentToolRelation(dbClient)({
231
- scopes: { tenantId, projectId },
232
- data: body,
233
- });
234
- return c.json({ data: agentToolRelation }, 201);
235
- }
236
- catch (error) {
237
- // Handle foreign key constraint violations
238
- if (error instanceof Error &&
239
- (error.message.includes('FOREIGN KEY constraint failed') ||
240
- error.message.includes('foreign key constraint') ||
241
- error.message.includes('SQLITE_CONSTRAINT_FOREIGNKEY') ||
242
- error.code === 'SQLITE_CONSTRAINT_FOREIGNKEY' ||
243
- error?.cause?.code === 'SQLITE_CONSTRAINT_FOREIGNKEY')) {
244
- throw createApiError({
245
- code: 'bad_request',
246
- message: 'Invalid agent ID or tool ID - referenced entity does not exist',
247
- });
248
- }
249
- throw error;
250
- }
251
- });
252
- // Update agent tool relation
253
- app.openapi(createRoute({
254
- method: 'put',
255
- path: '/{id}',
256
- summary: 'Update Agent Tool Relation',
257
- operationId: 'update-agent-tool-relation',
258
- tags: ['CRUD Agent Tool Relations'],
259
- request: {
260
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
261
- body: {
262
- content: {
263
- 'application/json': {
264
- schema: AgentToolRelationApiUpdateSchema,
265
- },
266
- },
267
- },
268
- },
269
- responses: {
270
- 200: {
271
- description: 'Agent tool relation updated successfully',
272
- content: {
273
- 'application/json': {
274
- schema: SingleResponseSchema(AgentToolRelationApiSelectSchema),
275
- },
276
- },
277
- },
278
- ...commonGetErrorResponses,
279
- },
280
- }), async (c) => {
281
- const { tenantId, projectId, id } = c.req.valid('param');
282
- console.log('id', id);
283
- const body = await c.req.valid('json');
284
- // Check if there are any fields to update
285
- if (Object.keys(body).length === 0) {
286
- throw createApiError({
287
- code: 'bad_request',
288
- message: 'No fields to update',
289
- });
290
- }
291
- console.log('body', body);
292
- const updatedAgentToolRelation = await updateAgentToolRelation(dbClient)({
293
- scopes: { tenantId, projectId },
294
- relationId: id,
295
- data: body,
296
- });
297
- if (!updatedAgentToolRelation) {
298
- throw createApiError({
299
- code: 'not_found',
300
- message: 'Agent tool relation not found',
301
- });
302
- }
303
- return c.json({ data: updatedAgentToolRelation });
304
- });
305
- // Delete agent tool relation
306
- app.openapi(createRoute({
307
- method: 'delete',
308
- path: '/{id}',
309
- summary: 'Delete Agent Tool Relation',
310
- operationId: 'delete-agent-tool-relation',
311
- tags: ['CRUD Agent Tool Relations'],
312
- request: {
313
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
314
- },
315
- responses: {
316
- 204: {
317
- description: 'Agent tool relation deleted successfully',
318
- },
319
- 404: {
320
- description: 'Agent tool relation not found',
321
- content: {
322
- 'application/json': {
323
- schema: ErrorResponseSchema,
324
- },
325
- },
326
- },
327
- },
328
- }), async (c) => {
329
- const { tenantId, projectId, id } = c.req.valid('param');
330
- const deleted = await deleteAgentToolRelation(dbClient)({
331
- scopes: { tenantId, projectId },
332
- relationId: id,
333
- });
334
- if (!deleted) {
335
- throw createApiError({
336
- code: 'not_found',
337
- message: 'Agent tool relation not found',
338
- });
339
- }
340
- return c.body(null, 204);
341
- });
342
- export default app;
@@ -1,4 +0,0 @@
1
- import { OpenAPIHono } from '@hono/zod-openapi';
2
- declare const app: OpenAPIHono<import("hono").Env, {}, "/">;
3
- export default app;
4
- //# sourceMappingURL=agents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/routes/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAsB7D,QAAA,MAAM,GAAG,0CAAoB,CAAC;AAkP9B,eAAe,GAAG,CAAC"}
@@ -1,212 +0,0 @@
1
- import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
2
- import { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, commonGetErrorResponses, createAgent, createApiError, deleteAgent, ErrorResponseSchema, getAgentById, ListResponseSchema, listAgentsPaginated, PaginationQueryParamsSchema, SingleResponseSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, updateAgent, } from '@inkeep/agents-core';
3
- import { nanoid } from 'nanoid';
4
- import dbClient from '../data/db/dbClient';
5
- const app = new OpenAPIHono();
6
- app.openapi(createRoute({
7
- method: 'get',
8
- path: '/',
9
- summary: 'List Agents',
10
- operationId: 'list-agents',
11
- tags: ['CRUD Agent'],
12
- request: {
13
- params: TenantProjectParamsSchema,
14
- query: PaginationQueryParamsSchema,
15
- },
16
- responses: {
17
- 200: {
18
- description: 'List of agents retrieved successfully',
19
- content: {
20
- 'application/json': {
21
- schema: ListResponseSchema(AgentApiSelectSchema),
22
- },
23
- },
24
- },
25
- ...commonGetErrorResponses,
26
- },
27
- }), async (c) => {
28
- const { tenantId, projectId } = c.req.valid('param');
29
- const page = Number(c.req.query('page')) || 1;
30
- const limit = Math.min(Number(c.req.query('limit')) || 10, 100);
31
- const result = await listAgentsPaginated(dbClient)({
32
- scopes: { tenantId, projectId },
33
- pagination: { page, limit },
34
- });
35
- // Add type field to all agents in the response
36
- const dataWithType = {
37
- ...result,
38
- data: result.data.map((agent) => ({
39
- ...agent,
40
- type: 'internal',
41
- })),
42
- };
43
- return c.json(dataWithType);
44
- });
45
- app.openapi(createRoute({
46
- method: 'get',
47
- path: '/{id}',
48
- summary: 'Get Agent',
49
- operationId: 'get-agent-by-id',
50
- tags: ['CRUD Agent'],
51
- request: {
52
- params: TenantProjectIdParamsSchema,
53
- },
54
- responses: {
55
- 200: {
56
- description: 'Agent found',
57
- content: {
58
- 'application/json': {
59
- schema: SingleResponseSchema(AgentApiSelectSchema),
60
- },
61
- },
62
- },
63
- ...commonGetErrorResponses,
64
- },
65
- }), async (c) => {
66
- const { tenantId, projectId, id } = c.req.valid('param');
67
- const agent = await getAgentById(dbClient)({
68
- scopes: { tenantId, projectId },
69
- agentId: id,
70
- });
71
- if (!agent) {
72
- throw createApiError({
73
- code: 'not_found',
74
- message: 'Agent not found',
75
- });
76
- }
77
- // Add type field to the agent response
78
- const agentWithType = {
79
- ...agent,
80
- type: 'internal',
81
- };
82
- return c.json({ data: agentWithType });
83
- });
84
- app.openapi(createRoute({
85
- method: 'post',
86
- path: '/',
87
- summary: 'Create Agent',
88
- operationId: 'create-agent',
89
- tags: ['CRUD Agent'],
90
- request: {
91
- params: TenantProjectParamsSchema,
92
- body: {
93
- content: {
94
- 'application/json': {
95
- schema: AgentApiInsertSchema,
96
- },
97
- },
98
- },
99
- },
100
- responses: {
101
- 201: {
102
- description: 'Agent created successfully',
103
- content: {
104
- 'application/json': {
105
- schema: SingleResponseSchema(AgentApiSelectSchema),
106
- },
107
- },
108
- },
109
- ...commonGetErrorResponses,
110
- },
111
- }), async (c) => {
112
- const { tenantId, projectId } = c.req.valid('param');
113
- const body = c.req.valid('json');
114
- const agentId = body.id ? String(body.id) : nanoid();
115
- const agent = await createAgent(dbClient)({
116
- ...body,
117
- id: agentId,
118
- tenantId,
119
- projectId,
120
- });
121
- // Add type field to the agent response
122
- const agentWithType = {
123
- ...agent,
124
- type: 'internal',
125
- };
126
- return c.json({ data: agentWithType }, 201);
127
- });
128
- app.openapi(createRoute({
129
- method: 'put',
130
- path: '/{id}',
131
- summary: 'Update Agent',
132
- operationId: 'update-agent',
133
- tags: ['CRUD Agent'],
134
- request: {
135
- params: TenantProjectIdParamsSchema,
136
- body: {
137
- content: {
138
- 'application/json': {
139
- schema: AgentApiUpdateSchema,
140
- },
141
- },
142
- },
143
- },
144
- responses: {
145
- 200: {
146
- description: 'Agent updated successfully',
147
- content: {
148
- 'application/json': {
149
- schema: SingleResponseSchema(AgentApiSelectSchema),
150
- },
151
- },
152
- },
153
- ...commonGetErrorResponses,
154
- },
155
- }), async (c) => {
156
- const { tenantId, projectId, id } = c.req.valid('param');
157
- const body = c.req.valid('json');
158
- const updatedAgent = await updateAgent(dbClient)({
159
- scopes: { tenantId, projectId },
160
- agentId: id,
161
- data: body,
162
- });
163
- if (!updatedAgent) {
164
- throw createApiError({
165
- code: 'not_found',
166
- message: 'Agent not found',
167
- });
168
- }
169
- // Add type field to the agent response
170
- const agentWithType = {
171
- ...updatedAgent,
172
- type: 'internal',
173
- };
174
- return c.json({ data: agentWithType });
175
- });
176
- app.openapi(createRoute({
177
- method: 'delete',
178
- path: '/{id}',
179
- summary: 'Delete Agent',
180
- operationId: 'delete-agent',
181
- tags: ['CRUD Agent'],
182
- request: {
183
- params: TenantProjectIdParamsSchema,
184
- },
185
- responses: {
186
- 204: {
187
- description: 'Agent deleted successfully',
188
- },
189
- 404: {
190
- description: 'Agent not found',
191
- content: {
192
- 'application/json': {
193
- schema: ErrorResponseSchema,
194
- },
195
- },
196
- },
197
- },
198
- }), async (c) => {
199
- const { tenantId, projectId, id } = c.req.valid('param');
200
- const deleted = await deleteAgent(dbClient)({
201
- scopes: { tenantId, projectId },
202
- agentId: id,
203
- });
204
- if (!deleted) {
205
- throw createApiError({
206
- code: 'not_found',
207
- message: 'Agent not found',
208
- });
209
- }
210
- return c.body(null, 204);
211
- });
212
- export default app;
@@ -1,4 +0,0 @@
1
- import { OpenAPIHono } from '@hono/zod-openapi';
2
- declare const app: OpenAPIHono<import("hono").Env, {}, "/">;
3
- export default app;
4
- //# sourceMappingURL=apiKeys.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiKeys.d.ts","sourceRoot":"","sources":["../../src/routes/apiKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAwB7D,QAAA,MAAM,GAAG,0CAAoB,CAAC;AA4Q9B,eAAe,GAAG,CAAC"}