@inkeep/agents-manage-api 0.0.0-dev-20250910233133 → 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,228 +0,0 @@
1
- import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
2
- import { AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, ArtifactComponentApiSelectSchema, associateArtifactComponentWithAgent, commonGetErrorResponses, createApiError, ErrorResponseSchema, ExistsResponseSchema, getAgentById, getAgentsUsingArtifactComponent, getArtifactComponentById, getArtifactComponentsForAgent, isArtifactComponentAssociatedWithAgent, RemovedResponseSchema, removeArtifactComponentFromAgent, SingleResponseSchema, TenantProjectParamsSchema, } from '@inkeep/agents-core';
3
- import { z } from 'zod';
4
- import dbClient from '../data/db/dbClient';
5
- const app = new OpenAPIHono();
6
- // List artifact components for a specific agent in a graph
7
- app.openapi(createRoute({
8
- method: 'get',
9
- path: '/agent/:agentId',
10
- summary: 'Get Artifact Components for Agent',
11
- operationId: 'get-artifact-components-for-agent',
12
- tags: ['CRUD Agent Artifact Component Relations'],
13
- request: {
14
- params: TenantProjectParamsSchema.extend({
15
- agentId: z.string(),
16
- }),
17
- },
18
- responses: {
19
- 200: {
20
- description: 'Artifact components retrieved successfully',
21
- content: {
22
- 'application/json': {
23
- schema: z.object({
24
- data: z.array(ArtifactComponentApiSelectSchema),
25
- }),
26
- },
27
- },
28
- },
29
- ...commonGetErrorResponses,
30
- },
31
- }), async (c) => {
32
- const { tenantId, projectId, agentId } = c.req.valid('param');
33
- const artifactComponents = await getArtifactComponentsForAgent(dbClient)({
34
- scopes: { tenantId, projectId },
35
- agentId,
36
- });
37
- return c.json({
38
- data: artifactComponents,
39
- });
40
- });
41
- // List agents using a specific artifact component
42
- app.openapi(createRoute({
43
- method: 'get',
44
- path: '/component/:artifactComponentId/agents',
45
- summary: 'Get Agents Using Artifact Component',
46
- operationId: 'get-agents-using-artifact-component',
47
- tags: ['CRUD Agent Artifact Component Relations'],
48
- request: {
49
- params: TenantProjectParamsSchema.extend({
50
- artifactComponentId: z.string(),
51
- }),
52
- },
53
- responses: {
54
- 200: {
55
- description: 'Agents retrieved successfully',
56
- content: {
57
- 'application/json': {
58
- schema: z.object({
59
- data: z.array(z.object({
60
- agentId: z.string(),
61
- createdAt: z.string(),
62
- })),
63
- }),
64
- },
65
- },
66
- },
67
- ...commonGetErrorResponses,
68
- },
69
- }), async (c) => {
70
- const { tenantId, projectId, artifactComponentId } = c.req.valid('param');
71
- const agents = await getAgentsUsingArtifactComponent(dbClient)({
72
- scopes: { tenantId, projectId },
73
- artifactComponentId,
74
- });
75
- return c.json({ data: agents });
76
- });
77
- // Create agent artifact component association
78
- app.openapi(createRoute({
79
- method: 'post',
80
- path: '/',
81
- summary: 'Associate Artifact Component with Agent',
82
- operationId: 'associate-artifact-component-with-agent',
83
- tags: ['CRUD Agent Artifact Component Relations'],
84
- request: {
85
- params: TenantProjectParamsSchema,
86
- body: {
87
- content: {
88
- 'application/json': {
89
- schema: AgentArtifactComponentApiInsertSchema,
90
- },
91
- },
92
- },
93
- },
94
- responses: {
95
- 201: {
96
- description: 'Agent artifact component association created successfully',
97
- content: {
98
- 'application/json': {
99
- schema: SingleResponseSchema(AgentArtifactComponentApiSelectSchema),
100
- },
101
- },
102
- },
103
- 409: {
104
- description: 'Association already exists',
105
- content: {
106
- 'application/json': {
107
- schema: ErrorResponseSchema,
108
- },
109
- },
110
- },
111
- ...commonGetErrorResponses,
112
- },
113
- }), async (c) => {
114
- const { tenantId, projectId } = c.req.valid('param');
115
- const { agentId, artifactComponentId } = c.req.valid('json');
116
- // Validate that both agent and artifact component exist before creating association
117
- const agent = await getAgentById(dbClient)({ scopes: { tenantId, projectId }, agentId });
118
- const artifactComponent = await getArtifactComponentById(dbClient)({
119
- scopes: { tenantId, projectId },
120
- id: artifactComponentId,
121
- });
122
- if (!agent) {
123
- throw createApiError({
124
- code: 'not_found',
125
- message: `Agent with id '${agentId}' not found`,
126
- });
127
- }
128
- if (!artifactComponent) {
129
- throw createApiError({
130
- code: 'not_found',
131
- message: `Artifact component with id '${artifactComponentId}' not found`,
132
- });
133
- }
134
- // Check if association already exists
135
- const exists = await isArtifactComponentAssociatedWithAgent(dbClient)({
136
- scopes: { tenantId, projectId },
137
- agentId,
138
- artifactComponentId,
139
- });
140
- if (exists) {
141
- throw createApiError({
142
- code: 'conflict',
143
- message: 'Agent artifact component association already exists',
144
- });
145
- }
146
- const association = await associateArtifactComponentWithAgent(dbClient)({
147
- scopes: { tenantId, projectId },
148
- agentId,
149
- artifactComponentId,
150
- });
151
- return c.json({ data: association }, 201);
152
- });
153
- // Remove agent artifact component association
154
- app.openapi(createRoute({
155
- method: 'delete',
156
- path: '/agent/:agentId/component/:artifactComponentId',
157
- summary: 'Remove Artifact Component from Agent',
158
- operationId: 'remove-artifact-component-from-agent',
159
- tags: ['CRUD Agent Artifact Component Relations'],
160
- request: {
161
- params: TenantProjectParamsSchema.extend({
162
- agentId: z.string(),
163
- artifactComponentId: z.string(),
164
- }),
165
- },
166
- responses: {
167
- 200: {
168
- description: 'Association removed successfully',
169
- content: {
170
- 'application/json': {
171
- schema: RemovedResponseSchema,
172
- },
173
- },
174
- },
175
- ...commonGetErrorResponses,
176
- },
177
- }), async (c) => {
178
- const { tenantId, projectId, agentId, artifactComponentId } = c.req.valid('param');
179
- const removed = await removeArtifactComponentFromAgent(dbClient)({
180
- scopes: { tenantId, projectId },
181
- agentId,
182
- artifactComponentId,
183
- });
184
- if (!removed) {
185
- throw createApiError({
186
- code: 'not_found',
187
- message: 'Agent artifact component association not found',
188
- });
189
- }
190
- return c.json({
191
- message: 'Association removed successfully',
192
- removed: true,
193
- });
194
- });
195
- // Check if artifact component is associated with agent
196
- app.openapi(createRoute({
197
- method: 'get',
198
- path: '/agent/:agentId/component/:artifactComponentId/exists',
199
- summary: 'Check if Artifact Component is Associated with Agent',
200
- operationId: 'check-artifact-component-agent-association',
201
- tags: ['CRUD Agent Artifact Component Relations'],
202
- request: {
203
- params: TenantProjectParamsSchema.extend({
204
- agentId: z.string(),
205
- artifactComponentId: z.string(),
206
- }),
207
- },
208
- responses: {
209
- 200: {
210
- description: 'Association status retrieved successfully',
211
- content: {
212
- 'application/json': {
213
- schema: ExistsResponseSchema,
214
- },
215
- },
216
- },
217
- ...commonGetErrorResponses,
218
- },
219
- }), async (c) => {
220
- const { tenantId, projectId, agentId, artifactComponentId } = c.req.valid('param');
221
- const exists = await isArtifactComponentAssociatedWithAgent(dbClient)({
222
- scopes: { tenantId, projectId },
223
- agentId,
224
- artifactComponentId,
225
- });
226
- return c.json({ exists });
227
- });
228
- 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=agentDataComponents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agentDataComponents.d.ts","sourceRoot":"","sources":["../../src/routes/agentDataComponents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAuB7D,QAAA,MAAM,GAAG,0CAAoB,CAAC;AAkQ9B,eAAe,GAAG,CAAC"}
@@ -1,224 +0,0 @@
1
- import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
2
- import { AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, associateDataComponentWithAgent, commonGetErrorResponses, createApiError, DataComponentApiSelectSchema, ErrorResponseSchema, ExistsResponseSchema, getAgentById, getAgentsUsingDataComponent, getDataComponent, getDataComponentsForAgent, isDataComponentAssociatedWithAgent, RemovedResponseSchema, removeDataComponentFromAgent, SingleResponseSchema, TenantProjectParamsSchema, } from '@inkeep/agents-core';
3
- import { z } from 'zod';
4
- import dbClient from '../data/db/dbClient';
5
- const app = new OpenAPIHono();
6
- // List data components for a specific agent in a graph
7
- app.openapi(createRoute({
8
- method: 'get',
9
- path: '/agent/:agentId',
10
- summary: 'Get Data Components for Agent',
11
- operationId: 'get-data-components-for-agent',
12
- tags: ['CRUD Agent Data Component Relations'],
13
- request: {
14
- params: TenantProjectParamsSchema.extend({
15
- agentId: z.string(),
16
- }),
17
- },
18
- responses: {
19
- 200: {
20
- description: 'Data components retrieved successfully',
21
- content: {
22
- 'application/json': {
23
- schema: z.object({
24
- data: z.array(DataComponentApiSelectSchema),
25
- }),
26
- },
27
- },
28
- },
29
- ...commonGetErrorResponses,
30
- },
31
- }), async (c) => {
32
- const { tenantId, projectId, agentId } = c.req.valid('param');
33
- const dataComponents = await getDataComponentsForAgent(dbClient)({
34
- scopes: { tenantId, projectId },
35
- agentId,
36
- });
37
- return c.json({ data: dataComponents });
38
- });
39
- // List agent ids using a specific data component
40
- app.openapi(createRoute({
41
- method: 'get',
42
- path: '/component/:dataComponentId/agents',
43
- summary: 'Get Agents Using Data Component',
44
- operationId: 'get-agents-using-data-component',
45
- tags: ['CRUD Agent Data Component Relations'],
46
- request: {
47
- params: TenantProjectParamsSchema.extend({
48
- dataComponentId: z.string(),
49
- }),
50
- },
51
- responses: {
52
- 200: {
53
- description: 'Agents retrieved successfully',
54
- content: {
55
- 'application/json': {
56
- schema: z.object({
57
- data: z.array(z.object({
58
- agentId: z.string(),
59
- createdAt: z.string(),
60
- })),
61
- }),
62
- },
63
- },
64
- },
65
- ...commonGetErrorResponses,
66
- },
67
- }), async (c) => {
68
- const { tenantId, projectId, dataComponentId } = c.req.valid('param');
69
- const agents = await getAgentsUsingDataComponent(dbClient)({
70
- scopes: { tenantId, projectId },
71
- dataComponentId,
72
- });
73
- return c.json({ data: agents });
74
- });
75
- // Create agent data component association
76
- app.openapi(createRoute({
77
- method: 'post',
78
- path: '/',
79
- summary: 'Associate Data Component with Agent',
80
- operationId: 'associate-data-component-with-agent',
81
- tags: ['CRUD Agent Data Component Relations'],
82
- request: {
83
- params: TenantProjectParamsSchema,
84
- body: {
85
- content: {
86
- 'application/json': {
87
- schema: AgentDataComponentApiInsertSchema,
88
- },
89
- },
90
- },
91
- },
92
- responses: {
93
- 201: {
94
- description: 'Agent data component association created successfully',
95
- content: {
96
- 'application/json': {
97
- schema: SingleResponseSchema(AgentDataComponentApiSelectSchema),
98
- },
99
- },
100
- },
101
- 409: {
102
- description: 'Association already exists',
103
- content: {
104
- 'application/json': {
105
- schema: ErrorResponseSchema,
106
- },
107
- },
108
- },
109
- ...commonGetErrorResponses,
110
- },
111
- }), async (c) => {
112
- const { tenantId, projectId } = c.req.valid('param');
113
- const { agentId, dataComponentId } = c.req.valid('json');
114
- const [agent, dataComponent] = await Promise.all([
115
- getAgentById(dbClient)({ scopes: { tenantId, projectId }, agentId }),
116
- getDataComponent(dbClient)({ scopes: { tenantId, projectId }, dataComponentId }),
117
- ]);
118
- if (!agent) {
119
- throw createApiError({
120
- code: 'not_found',
121
- message: `Agent with id '${agentId}' not found`,
122
- });
123
- }
124
- if (!dataComponent) {
125
- throw createApiError({
126
- code: 'not_found',
127
- message: `Data component with id '${dataComponentId}' not found`,
128
- });
129
- }
130
- // Check if association already exists
131
- const exists = await isDataComponentAssociatedWithAgent(dbClient)({
132
- scopes: { tenantId, projectId },
133
- agentId,
134
- dataComponentId,
135
- });
136
- if (exists) {
137
- throw createApiError({
138
- code: 'conflict',
139
- message: 'Agent data component association already exists',
140
- });
141
- }
142
- const association = await associateDataComponentWithAgent(dbClient)({
143
- scopes: { tenantId, projectId },
144
- agentId,
145
- dataComponentId,
146
- });
147
- return c.json({ data: association }, 201);
148
- });
149
- // Remove agent data component association
150
- app.openapi(createRoute({
151
- method: 'delete',
152
- path: '/agent/:agentId/component/:dataComponentId',
153
- summary: 'Remove Data Component from Agent',
154
- operationId: 'remove-data-component-from-agent',
155
- tags: ['CRUD Agent Data Component Relations'],
156
- request: {
157
- params: TenantProjectParamsSchema.extend({
158
- agentId: z.string(),
159
- dataComponentId: z.string(),
160
- }),
161
- },
162
- responses: {
163
- 200: {
164
- description: 'Association removed successfully',
165
- content: {
166
- 'application/json': {
167
- schema: RemovedResponseSchema,
168
- },
169
- },
170
- },
171
- ...commonGetErrorResponses,
172
- },
173
- }), async (c) => {
174
- const { tenantId, projectId, agentId, dataComponentId } = c.req.valid('param');
175
- const removed = await removeDataComponentFromAgent(dbClient)({
176
- scopes: { tenantId, projectId },
177
- agentId,
178
- dataComponentId,
179
- });
180
- if (!removed) {
181
- throw createApiError({
182
- code: 'not_found',
183
- message: 'Agent data component association not found',
184
- });
185
- }
186
- return c.json({
187
- message: 'Association removed successfully',
188
- removed: true,
189
- });
190
- });
191
- // Check if data component is associated with agent
192
- app.openapi(createRoute({
193
- method: 'get',
194
- path: '/agent/:agentId/component/:dataComponentId/exists',
195
- summary: 'Check if Data Component is Associated with Agent',
196
- operationId: 'check-data-component-agent-association',
197
- tags: ['CRUD Agent Data Component Relations'],
198
- request: {
199
- params: TenantProjectParamsSchema.extend({
200
- agentId: z.string(),
201
- dataComponentId: z.string(),
202
- }),
203
- },
204
- responses: {
205
- 200: {
206
- description: 'Association status retrieved successfully',
207
- content: {
208
- 'application/json': {
209
- schema: ExistsResponseSchema,
210
- },
211
- },
212
- },
213
- ...commonGetErrorResponses,
214
- },
215
- }), async (c) => {
216
- const { tenantId, projectId, agentId, dataComponentId } = c.req.valid('param');
217
- const exists = await isDataComponentAssociatedWithAgent(dbClient)({
218
- scopes: { tenantId, projectId },
219
- agentId,
220
- dataComponentId,
221
- });
222
- return c.json({ exists });
223
- });
224
- 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=agentGraph.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agentGraph.d.ts","sourceRoot":"","sources":["../../src/routes/agentGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA0B7D,QAAA,MAAM,GAAG,0CAAoB,CAAC;AAsU9B,eAAe,GAAG,CAAC"}