@inkeep/agents-manage-api 0.1.2 → 0.1.6
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/LICENSE.md +7 -0
- package/README.md +1 -1
- package/SUPPLEMENTAL_TERMS.md +40 -0
- package/dist/index.cjs +5083 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +13 -18
- package/dist/index.js +5052 -26
- package/package.json +10 -10
- package/dist/ManagementServer.d.ts +0 -28
- package/dist/ManagementServer.d.ts.map +0 -1
- package/dist/ManagementServer.js +0 -41
- package/dist/__tests__/setup.d.ts +0 -2
- package/dist/__tests__/setup.d.ts.map +0 -1
- package/dist/__tests__/setup.js +0 -26
- package/dist/__tests__/utils/testProject.d.ts +0 -18
- package/dist/__tests__/utils/testProject.d.ts.map +0 -1
- package/dist/__tests__/utils/testProject.js +0 -26
- package/dist/__tests__/utils/testRequest.d.ts +0 -2
- package/dist/__tests__/utils/testRequest.d.ts.map +0 -1
- package/dist/__tests__/utils/testRequest.js +0 -11
- package/dist/__tests__/utils/testTenant.d.ts +0 -64
- package/dist/__tests__/utils/testTenant.d.ts.map +0 -1
- package/dist/__tests__/utils/testTenant.js +0 -71
- package/dist/app.d.ts +0 -11
- package/dist/app.d.ts.map +0 -1
- package/dist/app.js +0 -148
- package/dist/data/conversations.d.ts +0 -59
- package/dist/data/conversations.d.ts.map +0 -1
- package/dist/data/conversations.js +0 -216
- package/dist/data/db/clean.d.ts +0 -6
- package/dist/data/db/clean.d.ts.map +0 -1
- package/dist/data/db/clean.js +0 -77
- package/dist/data/db/dbClient.d.ts +0 -3
- package/dist/data/db/dbClient.d.ts.map +0 -1
- package/dist/data/db/dbClient.js +0 -13
- package/dist/data/graphFull.d.ts +0 -11
- package/dist/data/graphFull.d.ts.map +0 -1
- package/dist/data/graphFull.js +0 -90
- package/dist/data/graphFullClient.d.ts +0 -22
- package/dist/data/graphFullClient.d.ts.map +0 -1
- package/dist/data/graphFullClient.js +0 -189
- package/dist/data/tools.d.ts +0 -82
- package/dist/data/tools.d.ts.map +0 -1
- package/dist/data/tools.js +0 -271
- package/dist/env.d.ts +0 -41
- package/dist/env.d.ts.map +0 -1
- package/dist/env.js +0 -59
- package/dist/index.d.ts.map +0 -1
- package/dist/logger.d.ts +0 -4
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -32
- package/dist/middleware/auth.d.ts +0 -12
- package/dist/middleware/auth.d.ts.map +0 -1
- package/dist/middleware/auth.js +0 -36
- package/dist/openapi.d.ts +0 -2
- package/dist/openapi.d.ts.map +0 -1
- package/dist/openapi.js +0 -38
- package/dist/routes/agentArtifactComponents.d.ts +0 -4
- package/dist/routes/agentArtifactComponents.d.ts.map +0 -1
- package/dist/routes/agentArtifactComponents.js +0 -230
- package/dist/routes/agentDataComponents.d.ts +0 -4
- package/dist/routes/agentDataComponents.d.ts.map +0 -1
- package/dist/routes/agentDataComponents.js +0 -225
- package/dist/routes/agentGraph.d.ts +0 -4
- package/dist/routes/agentGraph.d.ts.map +0 -1
- package/dist/routes/agentGraph.js +0 -289
- package/dist/routes/agentRelations.d.ts +0 -4
- package/dist/routes/agentRelations.d.ts.map +0 -1
- package/dist/routes/agentRelations.js +0 -290
- package/dist/routes/agentToolRelations.d.ts +0 -4
- package/dist/routes/agentToolRelations.d.ts.map +0 -1
- package/dist/routes/agentToolRelations.js +0 -342
- package/dist/routes/agents.d.ts +0 -4
- package/dist/routes/agents.d.ts.map +0 -1
- package/dist/routes/agents.js +0 -213
- package/dist/routes/apiKeys.d.ts +0 -4
- package/dist/routes/apiKeys.d.ts.map +0 -1
- package/dist/routes/apiKeys.js +0 -236
- package/dist/routes/artifactComponents.d.ts +0 -4
- package/dist/routes/artifactComponents.d.ts.map +0 -1
- package/dist/routes/artifactComponents.js +0 -202
- package/dist/routes/contextConfigs.d.ts +0 -4
- package/dist/routes/contextConfigs.d.ts.map +0 -1
- package/dist/routes/contextConfigs.js +0 -181
- package/dist/routes/credentials.d.ts +0 -10
- package/dist/routes/credentials.d.ts.map +0 -1
- package/dist/routes/credentials.js +0 -219
- package/dist/routes/dataComponents.d.ts +0 -4
- package/dist/routes/dataComponents.d.ts.map +0 -1
- package/dist/routes/dataComponents.js +0 -188
- package/dist/routes/externalAgents.d.ts +0 -4
- package/dist/routes/externalAgents.d.ts.map +0 -1
- package/dist/routes/externalAgents.js +0 -216
- package/dist/routes/graphFull.d.ts +0 -4
- package/dist/routes/graphFull.d.ts.map +0 -1
- package/dist/routes/graphFull.js +0 -248
- package/dist/routes/index.d.ts +0 -4
- package/dist/routes/index.d.ts.map +0 -1
- package/dist/routes/index.js +0 -37
- package/dist/routes/oauth.d.ts +0 -21
- package/dist/routes/oauth.d.ts.map +0 -1
- package/dist/routes/oauth.js +0 -191
- package/dist/routes/projects.d.ts +0 -4
- package/dist/routes/projects.d.ts.map +0 -1
- package/dist/routes/projects.js +0 -221
- package/dist/routes/tools.d.ts +0 -11
- package/dist/routes/tools.d.ts.map +0 -1
- package/dist/routes/tools.js +0 -555
- package/dist/utils/auth-detection.d.ts +0 -22
- package/dist/utils/auth-detection.d.ts.map +0 -1
- package/dist/utils/auth-detection.js +0 -149
- package/dist/utils/oauth-service.d.ts +0 -88
- package/dist/utils/oauth-service.d.ts.map +0 -1
- package/dist/utils/oauth-service.js +0 -240
package/dist/routes/projects.js
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
import { ErrorResponseSchema, ListResponseSchema, PaginationQueryParamsSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, SingleResponseSchema, TenantIdParamsSchema, TenantParamsSchema, createProject, deleteProject, getProject, listProjectsPaginated, updateProject, } from '@inkeep/agents-core';
|
|
3
|
-
import { commonGetErrorResponses, createApiError } from '@inkeep/agents-core';
|
|
4
|
-
import dbClient from '../data/db/dbClient.js';
|
|
5
|
-
const app = new OpenAPIHono();
|
|
6
|
-
app.openapi(createRoute({
|
|
7
|
-
method: 'get',
|
|
8
|
-
path: '/',
|
|
9
|
-
summary: 'List Projects',
|
|
10
|
-
description: 'List all projects within a tenant with pagination',
|
|
11
|
-
operationId: 'list-projects',
|
|
12
|
-
tags: ['Projects'],
|
|
13
|
-
request: {
|
|
14
|
-
params: TenantParamsSchema,
|
|
15
|
-
query: PaginationQueryParamsSchema,
|
|
16
|
-
},
|
|
17
|
-
responses: {
|
|
18
|
-
200: {
|
|
19
|
-
description: 'List of projects retrieved successfully',
|
|
20
|
-
content: {
|
|
21
|
-
'application/json': {
|
|
22
|
-
schema: ListResponseSchema(ProjectApiSelectSchema),
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
...commonGetErrorResponses,
|
|
27
|
-
},
|
|
28
|
-
}), async (c) => {
|
|
29
|
-
const { tenantId } = c.req.valid('param');
|
|
30
|
-
const page = Number(c.req.query('page')) || 1;
|
|
31
|
-
const limit = Math.min(Number(c.req.query('limit')) || 10, 100);
|
|
32
|
-
const result = await listProjectsPaginated(dbClient)({
|
|
33
|
-
tenantId,
|
|
34
|
-
pagination: { page, limit },
|
|
35
|
-
});
|
|
36
|
-
return c.json(result);
|
|
37
|
-
});
|
|
38
|
-
app.openapi(createRoute({
|
|
39
|
-
method: 'get',
|
|
40
|
-
path: '/{id}',
|
|
41
|
-
summary: 'Get Project',
|
|
42
|
-
description: 'Get a single project by ID',
|
|
43
|
-
operationId: 'get-project-by-id',
|
|
44
|
-
tags: ['Projects'],
|
|
45
|
-
request: {
|
|
46
|
-
params: TenantIdParamsSchema,
|
|
47
|
-
},
|
|
48
|
-
responses: {
|
|
49
|
-
200: {
|
|
50
|
-
description: 'Project found',
|
|
51
|
-
content: {
|
|
52
|
-
'application/json': {
|
|
53
|
-
schema: SingleResponseSchema(ProjectApiSelectSchema),
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
...commonGetErrorResponses,
|
|
58
|
-
},
|
|
59
|
-
}), async (c) => {
|
|
60
|
-
const { tenantId, id } = c.req.valid('param');
|
|
61
|
-
const project = await getProject(dbClient)({ scopes: { tenantId, projectId: id } });
|
|
62
|
-
if (!project) {
|
|
63
|
-
throw createApiError({
|
|
64
|
-
code: 'not_found',
|
|
65
|
-
message: 'Project not found',
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return c.json({ data: project });
|
|
69
|
-
});
|
|
70
|
-
app.openapi(createRoute({
|
|
71
|
-
method: 'post',
|
|
72
|
-
path: '/',
|
|
73
|
-
summary: 'Create Project',
|
|
74
|
-
description: 'Create a new project',
|
|
75
|
-
operationId: 'create-project',
|
|
76
|
-
tags: ['Projects'],
|
|
77
|
-
request: {
|
|
78
|
-
params: TenantParamsSchema,
|
|
79
|
-
body: {
|
|
80
|
-
content: {
|
|
81
|
-
'application/json': {
|
|
82
|
-
schema: ProjectApiInsertSchema,
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
responses: {
|
|
88
|
-
201: {
|
|
89
|
-
description: 'Project created successfully',
|
|
90
|
-
content: {
|
|
91
|
-
'application/json': {
|
|
92
|
-
schema: SingleResponseSchema(ProjectApiSelectSchema),
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
409: {
|
|
97
|
-
description: 'Project already exists',
|
|
98
|
-
content: {
|
|
99
|
-
'application/json': {
|
|
100
|
-
schema: ErrorResponseSchema,
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
...commonGetErrorResponses,
|
|
105
|
-
},
|
|
106
|
-
}), async (c) => {
|
|
107
|
-
const { tenantId } = c.req.valid('param');
|
|
108
|
-
const body = c.req.valid('json');
|
|
109
|
-
try {
|
|
110
|
-
const project = await createProject(dbClient)({
|
|
111
|
-
tenantId,
|
|
112
|
-
...body,
|
|
113
|
-
});
|
|
114
|
-
return c.json({ data: project }, 201);
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
// Check if it's a unique constraint violation
|
|
118
|
-
if (error?.message?.includes('UNIQUE constraint') ||
|
|
119
|
-
error?.message?.includes('UNIQUE') ||
|
|
120
|
-
error?.code === 'SQLITE_CONSTRAINT' ||
|
|
121
|
-
error?.code === 'SQLITE_ERROR') {
|
|
122
|
-
throw createApiError({
|
|
123
|
-
code: 'conflict',
|
|
124
|
-
message: 'Project with this ID already exists',
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
throw error;
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
app.openapi(createRoute({
|
|
131
|
-
method: 'patch',
|
|
132
|
-
path: '/{id}',
|
|
133
|
-
summary: 'Update Project',
|
|
134
|
-
description: 'Update an existing project',
|
|
135
|
-
operationId: 'update-project',
|
|
136
|
-
tags: ['Projects'],
|
|
137
|
-
request: {
|
|
138
|
-
params: TenantIdParamsSchema,
|
|
139
|
-
body: {
|
|
140
|
-
content: {
|
|
141
|
-
'application/json': {
|
|
142
|
-
schema: ProjectApiUpdateSchema,
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
responses: {
|
|
148
|
-
200: {
|
|
149
|
-
description: 'Project updated successfully',
|
|
150
|
-
content: {
|
|
151
|
-
'application/json': {
|
|
152
|
-
schema: SingleResponseSchema(ProjectApiSelectSchema),
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
...commonGetErrorResponses,
|
|
157
|
-
},
|
|
158
|
-
}), async (c) => {
|
|
159
|
-
const { tenantId, id } = c.req.valid('param');
|
|
160
|
-
const body = c.req.valid('json');
|
|
161
|
-
const project = await updateProject(dbClient)({
|
|
162
|
-
scopes: { tenantId, projectId: id },
|
|
163
|
-
data: body,
|
|
164
|
-
});
|
|
165
|
-
if (!project) {
|
|
166
|
-
throw createApiError({
|
|
167
|
-
code: 'not_found',
|
|
168
|
-
message: 'Project not found',
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
return c.json({ data: project });
|
|
172
|
-
});
|
|
173
|
-
app.openapi(createRoute({
|
|
174
|
-
method: 'delete',
|
|
175
|
-
path: '/{id}',
|
|
176
|
-
summary: 'Delete Project',
|
|
177
|
-
description: 'Delete a project. Will fail if the project has existing resources.',
|
|
178
|
-
operationId: 'delete-project',
|
|
179
|
-
tags: ['Projects'],
|
|
180
|
-
request: {
|
|
181
|
-
params: TenantIdParamsSchema,
|
|
182
|
-
},
|
|
183
|
-
responses: {
|
|
184
|
-
204: {
|
|
185
|
-
description: 'Project deleted successfully',
|
|
186
|
-
},
|
|
187
|
-
409: {
|
|
188
|
-
description: 'Cannot delete project with existing resources',
|
|
189
|
-
content: {
|
|
190
|
-
'application/json': {
|
|
191
|
-
schema: ErrorResponseSchema,
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
...commonGetErrorResponses,
|
|
196
|
-
},
|
|
197
|
-
}), async (c) => {
|
|
198
|
-
const { tenantId, id } = c.req.valid('param');
|
|
199
|
-
try {
|
|
200
|
-
const deleted = await deleteProject(dbClient)({
|
|
201
|
-
scopes: { tenantId, projectId: id },
|
|
202
|
-
});
|
|
203
|
-
if (!deleted) {
|
|
204
|
-
throw createApiError({
|
|
205
|
-
code: 'not_found',
|
|
206
|
-
message: 'Project not found',
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
return c.body(null, 204);
|
|
210
|
-
}
|
|
211
|
-
catch (error) {
|
|
212
|
-
if (error.message?.includes('Cannot delete project with existing resources')) {
|
|
213
|
-
throw createApiError({
|
|
214
|
-
code: 'conflict',
|
|
215
|
-
message: 'Cannot delete project with existing resources',
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
throw error;
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
export default app;
|
package/dist/routes/tools.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
import type { CredentialStoreRegistry, ServerConfig } from '@inkeep/agents-core';
|
|
3
|
-
type AppVariables = {
|
|
4
|
-
serverConfig: ServerConfig;
|
|
5
|
-
credentialStores: CredentialStoreRegistry;
|
|
6
|
-
};
|
|
7
|
-
declare const app: OpenAPIHono<{
|
|
8
|
-
Variables: AppVariables;
|
|
9
|
-
}, {}, "/">;
|
|
10
|
-
export default app;
|
|
11
|
-
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/routes/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAmCjF,KAAK,YAAY,GAAG;IAClB,YAAY,EAAE,YAAY,CAAC;IAC3B,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,GAAG;eAAgC,YAAY;WAAK,CAAC;AAyoB3D,eAAe,GAAG,CAAC"}
|