@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,218 +0,0 @@
1
- import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
2
- import { CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, commonGetErrorResponses, createApiError, createCredentialReference, deleteCredentialReference, ErrorResponseSchema, getCredentialReferenceById, getCredentialStoreLookupKeyFromRetrievalParams, IdParamsSchema, ListResponseSchema, listCredentialReferencesPaginated, PaginationQueryParamsSchema, SingleResponseSchema, TenantProjectParamsSchema, updateCredentialReference, } from '@inkeep/agents-core';
3
- import dbClient from '../data/db/dbClient';
4
- const app = new OpenAPIHono();
5
- app.openapi(createRoute({
6
- method: 'get',
7
- path: '/',
8
- summary: 'List Credentials',
9
- operationId: 'list-credentials',
10
- tags: ['CRUD Credential'],
11
- request: {
12
- params: TenantProjectParamsSchema,
13
- query: PaginationQueryParamsSchema,
14
- },
15
- responses: {
16
- 200: {
17
- description: 'List of credentials retrieved successfully',
18
- content: {
19
- 'application/json': {
20
- schema: ListResponseSchema(CredentialReferenceApiSelectSchema),
21
- },
22
- },
23
- },
24
- ...commonGetErrorResponses,
25
- },
26
- }), async (c) => {
27
- const { tenantId, projectId } = c.req.valid('param');
28
- const page = Number(c.req.query('page')) || 1;
29
- const limit = Math.min(Number(c.req.query('limit')) || 10, 100);
30
- const result = await listCredentialReferencesPaginated(dbClient)({
31
- scopes: { tenantId, projectId },
32
- pagination: { page, limit },
33
- });
34
- return c.json(result);
35
- });
36
- app.openapi(createRoute({
37
- method: 'get',
38
- path: '/{id}',
39
- summary: 'Get Credential',
40
- operationId: 'get-credential-by-id',
41
- tags: ['CRUD Credential'],
42
- request: {
43
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
44
- },
45
- responses: {
46
- 200: {
47
- description: 'Credential found',
48
- content: {
49
- 'application/json': {
50
- schema: SingleResponseSchema(CredentialReferenceApiSelectSchema),
51
- },
52
- },
53
- },
54
- ...commonGetErrorResponses,
55
- },
56
- }), async (c) => {
57
- const { tenantId, projectId, id } = c.req.valid('param');
58
- const credential = await getCredentialReferenceById(dbClient)({
59
- scopes: { tenantId, projectId },
60
- id,
61
- });
62
- if (!credential) {
63
- throw createApiError({
64
- code: 'not_found',
65
- message: 'Credential not found',
66
- });
67
- }
68
- return c.json({ data: credential });
69
- });
70
- app.openapi(createRoute({
71
- method: 'post',
72
- path: '/',
73
- summary: 'Create Credential',
74
- operationId: 'create-credential',
75
- tags: ['CRUD Credential'],
76
- request: {
77
- params: TenantProjectParamsSchema,
78
- body: {
79
- content: {
80
- 'application/json': {
81
- schema: CredentialReferenceApiInsertSchema,
82
- },
83
- },
84
- },
85
- },
86
- responses: {
87
- 201: {
88
- description: 'Credential created successfully',
89
- content: {
90
- 'application/json': {
91
- schema: SingleResponseSchema(CredentialReferenceApiSelectSchema),
92
- },
93
- },
94
- },
95
- ...commonGetErrorResponses,
96
- },
97
- }), async (c) => {
98
- const { tenantId, projectId } = c.req.valid('param');
99
- const body = c.req.valid('json');
100
- const credentialData = {
101
- ...body,
102
- tenantId,
103
- projectId,
104
- };
105
- const credential = await createCredentialReference(dbClient)(credentialData);
106
- return c.json({ data: credential }, 201);
107
- });
108
- app.openapi(createRoute({
109
- method: 'put',
110
- path: '/{id}',
111
- summary: 'Update Credential',
112
- operationId: 'update-credential',
113
- tags: ['CRUD Credential'],
114
- request: {
115
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
116
- body: {
117
- content: {
118
- 'application/json': {
119
- schema: CredentialReferenceApiUpdateSchema,
120
- },
121
- },
122
- },
123
- },
124
- responses: {
125
- 200: {
126
- description: 'Credential updated successfully',
127
- content: {
128
- 'application/json': {
129
- schema: SingleResponseSchema(CredentialReferenceApiSelectSchema),
130
- },
131
- },
132
- },
133
- ...commonGetErrorResponses,
134
- },
135
- }), async (c) => {
136
- const { tenantId, projectId, id } = c.req.valid('param');
137
- const body = c.req.valid('json');
138
- const updatedCredential = await updateCredentialReference(dbClient)({
139
- scopes: { tenantId, projectId },
140
- id,
141
- data: body,
142
- });
143
- if (!updatedCredential) {
144
- throw createApiError({
145
- code: 'not_found',
146
- message: 'Credential not found',
147
- });
148
- }
149
- return c.json({ data: updatedCredential });
150
- });
151
- app.openapi(createRoute({
152
- method: 'delete',
153
- path: '/{id}',
154
- summary: 'Delete Credential',
155
- operationId: 'delete-credential',
156
- tags: ['CRUD Credential'],
157
- request: {
158
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
159
- },
160
- responses: {
161
- 204: {
162
- description: 'Credential deleted successfully',
163
- },
164
- 404: {
165
- description: 'Credential not found',
166
- content: {
167
- 'application/json': {
168
- schema: ErrorResponseSchema,
169
- },
170
- },
171
- },
172
- },
173
- }), async (c) => {
174
- const { tenantId, projectId, id } = c.req.valid('param');
175
- const credential = await getCredentialReferenceById(dbClient)({
176
- scopes: { tenantId, projectId },
177
- id,
178
- });
179
- if (!credential) {
180
- throw createApiError({
181
- code: 'not_found',
182
- message: 'Credential not found',
183
- });
184
- }
185
- const credentialStores = c.get('credentialStores');
186
- const credentialStore = credentialStores.get(credential.credentialStoreId);
187
- if (credentialStore && credential.retrievalParams) {
188
- const lookupKey = getCredentialStoreLookupKeyFromRetrievalParams({
189
- retrievalParams: credential.retrievalParams,
190
- credentialStoreType: credentialStore.type,
191
- });
192
- if (!lookupKey) {
193
- throw createApiError({
194
- code: 'bad_request',
195
- message: 'Could not generate lookup key for credential store',
196
- });
197
- }
198
- try {
199
- await credentialStore.delete(lookupKey);
200
- }
201
- catch (error) {
202
- // Log the error but continue with database deletion for graceful failure handling
203
- console.error(`Failed to delete credential from external store "${credential.credentialStoreId}":`, error);
204
- }
205
- }
206
- const deleted = await deleteCredentialReference(dbClient)({
207
- scopes: { tenantId, projectId },
208
- id,
209
- });
210
- if (!deleted) {
211
- throw createApiError({
212
- code: 'not_found',
213
- message: 'Failed to delete credential',
214
- });
215
- }
216
- return c.body(null, 204);
217
- });
218
- 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=dataComponents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dataComponents.d.ts","sourceRoot":"","sources":["../../src/routes/dataComponents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAqB7D,QAAA,MAAM,GAAG,0CAAoB,CAAC;AAwN9B,eAAe,GAAG,CAAC"}
@@ -1,187 +0,0 @@
1
- import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
2
- import { commonGetErrorResponses, createApiError, createDataComponent, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, deleteDataComponent, ErrorResponseSchema, getDataComponent, IdParamsSchema, ListResponseSchema, listDataComponentsPaginated, PaginationQueryParamsSchema, SingleResponseSchema, TenantProjectParamsSchema, updateDataComponent, } from '@inkeep/agents-core';
3
- import dbClient from '../data/db/dbClient';
4
- const app = new OpenAPIHono();
5
- app.openapi(createRoute({
6
- method: 'get',
7
- path: '/',
8
- summary: 'List Data Components',
9
- operationId: 'list-data-components',
10
- tags: ['CRUD Data Component'],
11
- request: {
12
- params: TenantProjectParamsSchema,
13
- query: PaginationQueryParamsSchema,
14
- },
15
- responses: {
16
- 200: {
17
- description: 'List of data components retrieved successfully',
18
- content: {
19
- 'application/json': {
20
- schema: ListResponseSchema(DataComponentApiSelectSchema),
21
- },
22
- },
23
- },
24
- ...commonGetErrorResponses,
25
- },
26
- }), async (c) => {
27
- const { tenantId, projectId } = c.req.valid('param');
28
- const page = Number(c.req.query('page')) || 1;
29
- const limit = Math.min(Number(c.req.query('limit')) || 10, 100);
30
- const result = await listDataComponentsPaginated(dbClient)({
31
- scopes: { tenantId, projectId },
32
- pagination: { page, limit },
33
- });
34
- return c.json(result);
35
- });
36
- app.openapi(createRoute({
37
- method: 'get',
38
- path: '/{id}',
39
- summary: 'Get Data Component',
40
- operationId: 'get-data-component-by-id',
41
- tags: ['CRUD Data Component'],
42
- request: {
43
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
44
- },
45
- responses: {
46
- 200: {
47
- description: 'Data component found',
48
- content: {
49
- 'application/json': {
50
- schema: SingleResponseSchema(DataComponentApiSelectSchema),
51
- },
52
- },
53
- },
54
- ...commonGetErrorResponses,
55
- },
56
- }), async (c) => {
57
- const { tenantId, projectId, id } = c.req.valid('param');
58
- const dataComponent = await getDataComponent(dbClient)({
59
- scopes: { tenantId, projectId },
60
- dataComponentId: id,
61
- });
62
- if (!dataComponent) {
63
- throw createApiError({
64
- code: 'not_found',
65
- message: 'Data component not found',
66
- });
67
- }
68
- return c.json({ data: dataComponent });
69
- });
70
- app.openapi(createRoute({
71
- method: 'post',
72
- path: '/',
73
- summary: 'Create Data Component',
74
- operationId: 'create-data-component',
75
- tags: ['CRUD Data Component'],
76
- request: {
77
- params: TenantProjectParamsSchema,
78
- body: {
79
- content: {
80
- 'application/json': {
81
- schema: DataComponentApiInsertSchema,
82
- },
83
- },
84
- },
85
- },
86
- responses: {
87
- 201: {
88
- description: 'Data component created successfully',
89
- content: {
90
- 'application/json': {
91
- schema: SingleResponseSchema(DataComponentApiSelectSchema),
92
- },
93
- },
94
- },
95
- ...commonGetErrorResponses,
96
- },
97
- }), async (c) => {
98
- const { tenantId, projectId } = c.req.valid('param');
99
- const body = c.req.valid('json');
100
- const dataComponentData = {
101
- ...body,
102
- tenantId,
103
- projectId,
104
- };
105
- const dataComponent = await createDataComponent(dbClient)(dataComponentData);
106
- return c.json({ data: dataComponent }, 201);
107
- });
108
- app.openapi(createRoute({
109
- method: 'put',
110
- path: '/{id}',
111
- summary: 'Update Data Component',
112
- operationId: 'update-data-component',
113
- tags: ['CRUD Data Component'],
114
- request: {
115
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
116
- body: {
117
- content: {
118
- 'application/json': {
119
- schema: DataComponentApiUpdateSchema,
120
- },
121
- },
122
- },
123
- },
124
- responses: {
125
- 200: {
126
- description: 'Data component updated successfully',
127
- content: {
128
- 'application/json': {
129
- schema: SingleResponseSchema(DataComponentApiSelectSchema),
130
- },
131
- },
132
- },
133
- ...commonGetErrorResponses,
134
- },
135
- }), async (c) => {
136
- const { tenantId, projectId, id } = c.req.valid('param');
137
- const body = c.req.valid('json');
138
- const updatedDataComponent = await updateDataComponent(dbClient)({
139
- scopes: { tenantId, projectId },
140
- dataComponentId: id,
141
- data: body,
142
- });
143
- if (!updatedDataComponent) {
144
- throw createApiError({
145
- code: 'not_found',
146
- message: 'Data component not found',
147
- });
148
- }
149
- return c.json({ data: updatedDataComponent });
150
- });
151
- app.openapi(createRoute({
152
- method: 'delete',
153
- path: '/{id}',
154
- summary: 'Delete Data Component',
155
- operationId: 'delete-data-component',
156
- tags: ['CRUD Data Component'],
157
- request: {
158
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
159
- },
160
- responses: {
161
- 204: {
162
- description: 'Data component deleted successfully',
163
- },
164
- 404: {
165
- description: 'Data component not found',
166
- content: {
167
- 'application/json': {
168
- schema: ErrorResponseSchema,
169
- },
170
- },
171
- },
172
- },
173
- }), async (c) => {
174
- const { tenantId, projectId, id } = c.req.valid('param');
175
- const deleted = await deleteDataComponent(dbClient)({
176
- scopes: { tenantId, projectId },
177
- dataComponentId: id,
178
- });
179
- if (!deleted) {
180
- throw createApiError({
181
- code: 'not_found',
182
- message: 'Data component not found',
183
- });
184
- }
185
- return c.body(null, 204);
186
- });
187
- 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=externalAgents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"externalAgents.d.ts","sourceRoot":"","sources":["../../src/routes/externalAgents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAsB7D,QAAA,MAAM,GAAG,0CAAoB,CAAC;AAuP9B,eAAe,GAAG,CAAC"}
@@ -1,215 +0,0 @@
1
- import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
2
- import { commonGetErrorResponses, createApiError, createExternalAgent, deleteExternalAgent, ErrorResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, getExternalAgent, IdParamsSchema, ListResponseSchema, listExternalAgentsPaginated, PaginationQueryParamsSchema, SingleResponseSchema, TenantProjectParamsSchema, updateExternalAgent, } 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 External Agents',
10
- operationId: 'list-external-agents',
11
- tags: ['CRUD External Agents'],
12
- request: {
13
- params: TenantProjectParamsSchema,
14
- query: PaginationQueryParamsSchema,
15
- },
16
- responses: {
17
- 200: {
18
- description: 'List of external agents retrieved successfully',
19
- content: {
20
- 'application/json': {
21
- schema: ListResponseSchema(ExternalAgentApiSelectSchema),
22
- },
23
- },
24
- },
25
- ...commonGetErrorResponses,
26
- },
27
- }), async (c) => {
28
- const { tenantId, projectId } = c.req.valid('param');
29
- const { page, limit } = c.req.valid('query');
30
- const result = await listExternalAgentsPaginated(dbClient)({
31
- scopes: { tenantId, projectId },
32
- pagination: { page, limit },
33
- });
34
- // Add type field to all external agents in the response
35
- const dataWithType = {
36
- ...result,
37
- data: result.data.map((agent) => ({
38
- ...agent,
39
- type: 'external',
40
- })),
41
- };
42
- return c.json(dataWithType);
43
- });
44
- app.openapi(createRoute({
45
- method: 'get',
46
- path: '/{id}',
47
- summary: 'Get External Agent',
48
- operationId: 'get-external-agent-by-id',
49
- tags: ['CRUD External Agents'],
50
- request: {
51
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
52
- },
53
- responses: {
54
- 200: {
55
- description: 'External agent found',
56
- content: {
57
- 'application/json': {
58
- schema: SingleResponseSchema(ExternalAgentApiSelectSchema),
59
- },
60
- },
61
- },
62
- ...commonGetErrorResponses,
63
- },
64
- }), async (c) => {
65
- const { tenantId, projectId, id } = c.req.valid('param');
66
- const externalAgent = await getExternalAgent(dbClient)({
67
- scopes: { tenantId, projectId },
68
- agentId: id,
69
- });
70
- if (!externalAgent) {
71
- throw createApiError({
72
- code: 'not_found',
73
- message: 'External agent not found',
74
- });
75
- }
76
- // Add type field to the external agent response
77
- const agentWithType = {
78
- ...externalAgent,
79
- type: 'external',
80
- };
81
- return c.json({ data: agentWithType });
82
- });
83
- app.openapi(createRoute({
84
- method: 'post',
85
- path: '/',
86
- summary: 'Create External Agent',
87
- operationId: 'create-external-agent',
88
- tags: ['CRUD External Agents'],
89
- request: {
90
- params: TenantProjectParamsSchema,
91
- body: {
92
- content: {
93
- 'application/json': {
94
- schema: ExternalAgentApiInsertSchema,
95
- },
96
- },
97
- },
98
- },
99
- responses: {
100
- 201: {
101
- description: 'External agent created successfully',
102
- content: {
103
- 'application/json': {
104
- schema: SingleResponseSchema(ExternalAgentApiSelectSchema),
105
- },
106
- },
107
- },
108
- ...commonGetErrorResponses,
109
- },
110
- }), async (c) => {
111
- const { tenantId, projectId } = c.req.valid('param');
112
- const body = c.req.valid('json');
113
- const externalAgentData = {
114
- tenantId,
115
- projectId,
116
- id: body.id ? String(body.id) : nanoid(),
117
- name: body.name,
118
- description: body.description,
119
- baseUrl: body.baseUrl,
120
- credentialReferenceId: body.credentialReferenceId || undefined,
121
- headers: body.headers || undefined,
122
- };
123
- const externalAgent = await createExternalAgent(dbClient)(externalAgentData);
124
- // Add type field to the external agent response
125
- const agentWithType = {
126
- ...externalAgent,
127
- type: 'external',
128
- };
129
- return c.json({ data: agentWithType }, 201);
130
- });
131
- app.openapi(createRoute({
132
- method: 'put',
133
- path: '/{id}',
134
- summary: 'Update External Agent',
135
- operationId: 'update-external-agent',
136
- tags: ['CRUD External Agents'],
137
- request: {
138
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
139
- body: {
140
- content: {
141
- 'application/json': {
142
- schema: ExternalAgentApiUpdateSchema,
143
- },
144
- },
145
- },
146
- },
147
- responses: {
148
- 200: {
149
- description: 'External agent updated successfully',
150
- content: {
151
- 'application/json': {
152
- schema: SingleResponseSchema(ExternalAgentApiSelectSchema),
153
- },
154
- },
155
- },
156
- ...commonGetErrorResponses,
157
- },
158
- }), async (c) => {
159
- const { tenantId, projectId, id } = c.req.valid('param');
160
- const body = c.req.valid('json');
161
- const updatedExternalAgent = await updateExternalAgent(dbClient)({
162
- scopes: { tenantId, projectId },
163
- agentId: id,
164
- data: body,
165
- });
166
- if (!updatedExternalAgent) {
167
- throw createApiError({
168
- code: 'not_found',
169
- message: 'External agent not found',
170
- });
171
- }
172
- // Add type field to the external agent response
173
- const agentWithType = {
174
- ...updatedExternalAgent,
175
- type: 'external',
176
- };
177
- return c.json({ data: agentWithType });
178
- });
179
- app.openapi(createRoute({
180
- method: 'delete',
181
- path: '/{id}',
182
- summary: 'Delete External Agent',
183
- operationId: 'delete-external-agent',
184
- tags: ['CRUD External Agents'],
185
- request: {
186
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
187
- },
188
- responses: {
189
- 204: {
190
- description: 'External agent deleted successfully',
191
- },
192
- 404: {
193
- description: 'External agent not found',
194
- content: {
195
- 'application/json': {
196
- schema: ErrorResponseSchema,
197
- },
198
- },
199
- },
200
- },
201
- }), async (c) => {
202
- const { tenantId, projectId, id } = c.req.valid('param');
203
- const deleted = await deleteExternalAgent(dbClient)({
204
- scopes: { tenantId, projectId },
205
- agentId: id,
206
- });
207
- if (!deleted) {
208
- throw createApiError({
209
- code: 'not_found',
210
- message: 'External agent not found',
211
- });
212
- }
213
- return c.body(null, 204);
214
- });
215
- 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=graphFull.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphFull.d.ts","sourceRoot":"","sources":["../../src/routes/graphFull.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAoB7D,QAAA,MAAM,GAAG,0CAAoB,CAAC;AAuS9B,eAAe,GAAG,CAAC"}