@inkeep/agents-manage-api 0.1.1 → 0.1.2
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 +22 -17
- package/dist/__tests__/utils/testRequest.js +1 -1
- package/dist/app.d.ts +10 -3
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +129 -121
- package/dist/data/tools.d.ts +18 -17
- package/dist/data/tools.d.ts.map +1 -1
- package/dist/data/tools.js +16 -11
- package/dist/env.d.ts +5 -5
- package/dist/index.d.ts +19 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -37
- package/dist/routes/credentials.d.ts +7 -1
- package/dist/routes/credentials.d.ts.map +1 -1
- package/dist/routes/credentials.js +3 -3
- package/dist/routes/oauth.d.ts +8 -1
- package/dist/routes/oauth.d.ts.map +1 -1
- package/dist/routes/oauth.js +2 -2
- package/dist/routes/tools.d.ts +8 -1
- package/dist/routes/tools.d.ts.map +1 -1
- package/dist/routes/tools.js +11 -3
- package/package.json +7 -5
package/LICENSE.md
CHANGED
|
@@ -1,44 +1,49 @@
|
|
|
1
|
-
Elastic License
|
|
2
|
-
|
|
1
|
+
# Inkeep SDK – Elastic License 2.0 with Supplemental Terms
|
|
2
|
+
|
|
3
|
+
NOTE: The Inkeep SDK is licensed under the Elastic License 2.0 (ELv2), subject to Supplemental Terms included in [SUPPLEMENTAL_TERMS.md](SUPPLEMENTAL_TERMS.md). In the event of conflict, the Supplemental Terms control.
|
|
4
|
+
|
|
5
|
+
# Elastic License 2.0
|
|
6
|
+
|
|
7
|
+
## Acceptance
|
|
3
8
|
By using the software, you agree to all of the terms and conditions below.
|
|
4
9
|
|
|
5
|
-
Copyright License
|
|
10
|
+
## Copyright License
|
|
6
11
|
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below.
|
|
7
12
|
|
|
8
|
-
Limitations
|
|
13
|
+
## Limitations
|
|
9
14
|
You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
|
|
10
15
|
|
|
11
16
|
You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
|
|
12
17
|
|
|
13
18
|
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
|
14
19
|
|
|
15
|
-
Patents
|
|
20
|
+
## Patents
|
|
16
21
|
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
17
22
|
|
|
18
|
-
Notices
|
|
23
|
+
## Notices
|
|
19
24
|
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
|
20
25
|
|
|
21
26
|
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
|
22
27
|
|
|
23
|
-
No Other Rights
|
|
28
|
+
## No Other Rights
|
|
24
29
|
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
25
30
|
|
|
26
|
-
Termination
|
|
31
|
+
## Termination
|
|
27
32
|
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
|
|
28
33
|
|
|
29
|
-
No Liability
|
|
30
|
-
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim
|
|
34
|
+
## No Liability
|
|
35
|
+
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
|
|
31
36
|
|
|
32
|
-
Definitions
|
|
33
|
-
The licensor is the entity offering these terms, and the software is the software the licensor makes available under these terms, including any portion of it.
|
|
37
|
+
## Definitions
|
|
38
|
+
The **licensor** is the entity offering these terms, and the **software** is the software the licensor makes available under these terms, including any portion of it.
|
|
34
39
|
|
|
35
|
-
you refers to the individual or entity agreeing to these terms.
|
|
40
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
36
41
|
|
|
37
|
-
your company is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. control means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
42
|
+
**your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
38
43
|
|
|
39
|
-
your licenses are all the licenses granted to you for the software under these terms.
|
|
44
|
+
**your licenses** are all the licenses granted to you for the software under these terms.
|
|
40
45
|
|
|
41
|
-
use means anything you do with the software requiring one of your licenses.
|
|
46
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
42
47
|
|
|
43
|
-
trademark means trademarks, service marks, and similar rights.
|
|
48
|
+
**trademark** means trademarks, service marks, and similar rights.
|
|
44
49
|
|
package/dist/app.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
+
import type { ServerConfig, CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
3
|
+
type AppVariables = {
|
|
4
|
+
serverConfig: ServerConfig;
|
|
5
|
+
credentialStores: CredentialStoreRegistry;
|
|
6
|
+
};
|
|
7
|
+
declare function createManagementHono(serverConfig: ServerConfig, credentialStores: CredentialStoreRegistry): OpenAPIHono<{
|
|
8
|
+
Variables: AppVariables;
|
|
9
|
+
}, {}, "/">;
|
|
10
|
+
export { createManagementHono };
|
|
4
11
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAajF,KAAK,YAAY,GAAG;IAClB,YAAY,EAAE,YAAY,CAAC;IAC3B,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,iBAAS,oBAAoB,CAC3B,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,uBAAuB;eAEA,YAAY;YAgKtD;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
package/dist/app.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { createRoute } from '@hono/zod-openapi';
|
|
2
|
-
import { OpenApiHonoWithExecutionContext } from '@inkeep/agents-core';
|
|
1
|
+
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
3
2
|
import { cors } from 'hono/cors';
|
|
4
3
|
import { HTTPException } from 'hono/http-exception';
|
|
5
4
|
import { requestId } from 'hono/request-id';
|
|
@@ -10,131 +9,140 @@ import crudRoutes from './routes/index.js';
|
|
|
10
9
|
import { apiKeyAuth } from './middleware/auth.js';
|
|
11
10
|
import oauthRoutes from './routes/oauth.js';
|
|
12
11
|
import { setupOpenAPIRoutes } from './openapi.js';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
function createManagementHono(serverConfig, credentialStores) {
|
|
13
|
+
const app = new OpenAPIHono();
|
|
14
|
+
// Request ID middleware
|
|
15
|
+
app.use('*', requestId());
|
|
16
|
+
// Server config and credential stores middleware
|
|
17
|
+
app.use('*', async (c, next) => {
|
|
18
|
+
c.set('serverConfig', serverConfig);
|
|
19
|
+
c.set('credentialStores', credentialStores);
|
|
20
|
+
return next();
|
|
21
|
+
});
|
|
22
|
+
// Logging middleware
|
|
23
|
+
app.use(pinoLogger({
|
|
24
|
+
pino: getLogger(),
|
|
25
|
+
http: {
|
|
26
|
+
onResLevel(c) {
|
|
27
|
+
if (c.res.status >= 500) {
|
|
28
|
+
return 'error';
|
|
29
|
+
}
|
|
30
|
+
return 'info';
|
|
31
|
+
},
|
|
25
32
|
},
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
}));
|
|
34
|
+
// Error handling
|
|
35
|
+
app.onError(async (err, c) => {
|
|
36
|
+
const isExpectedError = err instanceof HTTPException;
|
|
37
|
+
const status = isExpectedError ? err.status : 500;
|
|
38
|
+
const requestId = c.get('requestId') || 'unknown';
|
|
39
|
+
// Zod validation error detection
|
|
40
|
+
let zodIssues;
|
|
41
|
+
if (err && typeof err === 'object') {
|
|
42
|
+
if (err.cause && Array.isArray(err.cause.issues)) {
|
|
43
|
+
zodIssues = err.cause.issues;
|
|
44
|
+
}
|
|
45
|
+
else if (Array.isArray(err.issues)) {
|
|
46
|
+
zodIssues = err.issues;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (status === 400 && Array.isArray(zodIssues)) {
|
|
50
|
+
c.status(400);
|
|
51
|
+
c.header('Content-Type', 'application/problem+json');
|
|
52
|
+
c.header('X-Content-Type-Options', 'nosniff');
|
|
53
|
+
return c.json({
|
|
54
|
+
type: 'https://docs.inkeep.com/agents-api/errors#bad_request',
|
|
55
|
+
title: 'Validation Failed',
|
|
56
|
+
status: 400,
|
|
57
|
+
detail: 'Request validation failed',
|
|
58
|
+
errors: zodIssues.map((issue) => ({
|
|
59
|
+
detail: issue.message,
|
|
60
|
+
pointer: issue.path ? `/${issue.path.join('/')}` : undefined,
|
|
61
|
+
name: issue.path ? issue.path.join('.') : undefined,
|
|
62
|
+
reason: issue.message,
|
|
63
|
+
})),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (status >= 500) {
|
|
67
|
+
if (!isExpectedError) {
|
|
68
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
69
|
+
const errorStack = err instanceof Error ? err.stack : undefined;
|
|
70
|
+
getLogger().error({
|
|
71
|
+
error: err,
|
|
72
|
+
message: errorMessage,
|
|
73
|
+
stack: errorStack,
|
|
74
|
+
path: c.req.path,
|
|
75
|
+
requestId,
|
|
76
|
+
}, 'Unexpected server error occurred');
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
getLogger().error({
|
|
80
|
+
error: err,
|
|
81
|
+
path: c.req.path,
|
|
82
|
+
requestId,
|
|
83
|
+
status,
|
|
84
|
+
}, 'Server error occurred');
|
|
85
|
+
}
|
|
38
86
|
}
|
|
39
|
-
|
|
40
|
-
|
|
87
|
+
if (isExpectedError) {
|
|
88
|
+
try {
|
|
89
|
+
const response = err.getResponse();
|
|
90
|
+
return response;
|
|
91
|
+
}
|
|
92
|
+
catch (responseError) {
|
|
93
|
+
getLogger().error({ error: responseError }, 'Error while handling HTTPException response');
|
|
94
|
+
}
|
|
41
95
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
c.status(400);
|
|
96
|
+
const { status: respStatus, title, detail, instance } = await handleApiError(err, requestId);
|
|
97
|
+
c.status(respStatus);
|
|
45
98
|
c.header('Content-Type', 'application/problem+json');
|
|
46
99
|
c.header('X-Content-Type-Options', 'nosniff');
|
|
47
100
|
return c.json({
|
|
48
|
-
type: 'https://docs.inkeep.com/agents-api/errors#
|
|
49
|
-
title
|
|
50
|
-
status:
|
|
51
|
-
detail
|
|
52
|
-
|
|
53
|
-
detail: issue.message,
|
|
54
|
-
pointer: issue.path ? `/${issue.path.join('/')}` : undefined,
|
|
55
|
-
name: issue.path ? issue.path.join('.') : undefined,
|
|
56
|
-
reason: issue.message,
|
|
57
|
-
})),
|
|
101
|
+
type: 'https://docs.inkeep.com/agents-api/errors#internal_server_error',
|
|
102
|
+
title,
|
|
103
|
+
status: respStatus,
|
|
104
|
+
detail,
|
|
105
|
+
...(instance && { instance }),
|
|
58
106
|
});
|
|
59
|
-
}
|
|
60
|
-
if (status >= 500) {
|
|
61
|
-
if (!isExpectedError) {
|
|
62
|
-
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
63
|
-
const errorStack = err instanceof Error ? err.stack : undefined;
|
|
64
|
-
getLogger().error({
|
|
65
|
-
error: err,
|
|
66
|
-
message: errorMessage,
|
|
67
|
-
stack: errorStack,
|
|
68
|
-
path: c.req.path,
|
|
69
|
-
requestId,
|
|
70
|
-
}, 'Unexpected server error occurred');
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
getLogger().error({
|
|
74
|
-
error: err,
|
|
75
|
-
path: c.req.path,
|
|
76
|
-
requestId,
|
|
77
|
-
status,
|
|
78
|
-
}, 'Server error occurred');
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (isExpectedError) {
|
|
82
|
-
try {
|
|
83
|
-
const response = err.getResponse();
|
|
84
|
-
return response;
|
|
85
|
-
}
|
|
86
|
-
catch (responseError) {
|
|
87
|
-
getLogger().error({ error: responseError }, 'Error while handling HTTPException response');
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
const { status: respStatus, title, detail, instance } = await handleApiError(err, requestId);
|
|
91
|
-
c.status(respStatus);
|
|
92
|
-
c.header('Content-Type', 'application/problem+json');
|
|
93
|
-
c.header('X-Content-Type-Options', 'nosniff');
|
|
94
|
-
return c.json({
|
|
95
|
-
type: 'https://docs.inkeep.com/agents-api/errors#internal_server_error',
|
|
96
|
-
title,
|
|
97
|
-
status: respStatus,
|
|
98
|
-
detail,
|
|
99
|
-
...(instance && { instance }),
|
|
100
107
|
});
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return origin
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
: null;
|
|
110
|
-
},
|
|
111
|
-
allowMethods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'],
|
|
112
|
-
allowHeaders: ['*'],
|
|
113
|
-
exposeHeaders: ['Content-Length'],
|
|
114
|
-
maxAge: 86400,
|
|
115
|
-
credentials: true,
|
|
116
|
-
}));
|
|
117
|
-
// Health check endpoint
|
|
118
|
-
app.openapi(createRoute({
|
|
119
|
-
method: 'get',
|
|
120
|
-
path: '/health',
|
|
121
|
-
tags: ['health'],
|
|
122
|
-
summary: 'Health check',
|
|
123
|
-
description: 'Check if the management service is healthy',
|
|
124
|
-
responses: {
|
|
125
|
-
204: {
|
|
126
|
-
description: 'Service is healthy',
|
|
108
|
+
// CORS middleware
|
|
109
|
+
app.use('*', cors({
|
|
110
|
+
origin: (origin) => {
|
|
111
|
+
if (!origin)
|
|
112
|
+
return origin;
|
|
113
|
+
return origin.startsWith('http://localhost:') || origin.startsWith('https://localhost:')
|
|
114
|
+
? origin
|
|
115
|
+
: null;
|
|
127
116
|
},
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
//
|
|
135
|
-
app.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
117
|
+
allowMethods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'],
|
|
118
|
+
allowHeaders: ['*'],
|
|
119
|
+
exposeHeaders: ['Content-Length'],
|
|
120
|
+
maxAge: 86400,
|
|
121
|
+
credentials: true,
|
|
122
|
+
}));
|
|
123
|
+
// Health check endpoint
|
|
124
|
+
app.openapi(createRoute({
|
|
125
|
+
method: 'get',
|
|
126
|
+
path: '/health',
|
|
127
|
+
tags: ['health'],
|
|
128
|
+
summary: 'Health check',
|
|
129
|
+
description: 'Check if the management service is healthy',
|
|
130
|
+
responses: {
|
|
131
|
+
204: {
|
|
132
|
+
description: 'Service is healthy',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
}), (c) => {
|
|
136
|
+
return c.body(null, 204);
|
|
137
|
+
});
|
|
138
|
+
// API Key authentication middleware for protected routes
|
|
139
|
+
app.use('/tenants/*', apiKeyAuth());
|
|
140
|
+
// Mount CRUD routes for all entities
|
|
141
|
+
app.route('/tenants/:tenantId/crud', crudRoutes);
|
|
142
|
+
// Mount OAuth routes - global OAuth callback endpoint
|
|
143
|
+
app.route('/oauth', oauthRoutes);
|
|
144
|
+
// Setup OpenAPI documentation endpoints (/openapi.json and /docs)
|
|
145
|
+
setupOpenAPIRoutes(app);
|
|
146
|
+
return app;
|
|
147
|
+
}
|
|
148
|
+
export { createManagementHono };
|
package/dist/data/tools.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type McpServerCapabilities, type McpTool, type McpToolDefinition, type McpToolStatus } from '@inkeep/agents-core';
|
|
1
|
+
import { type McpServerCapabilities, type McpTool, type McpToolDefinition, type McpToolStatus, type CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
2
2
|
export declare const updateToolHealth: ({ tenantId, projectId, toolId, status, error, }: {
|
|
3
3
|
tenantId: string;
|
|
4
4
|
projectId: string;
|
|
@@ -10,72 +10,73 @@ export declare const updateToolHealth: ({ tenantId, projectId, toolId, status, e
|
|
|
10
10
|
projectId: string;
|
|
11
11
|
id: string;
|
|
12
12
|
name: string;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
status: string;
|
|
13
16
|
config: {
|
|
14
17
|
type: "mcp";
|
|
15
18
|
mcp: import("@inkeep/agents-core").ToolMcpConfig;
|
|
16
19
|
};
|
|
17
20
|
credentialReferenceId: string | null;
|
|
18
|
-
createdAt: string;
|
|
19
|
-
updatedAt: string;
|
|
20
|
-
status: string;
|
|
21
21
|
headers: Record<string, string> | null;
|
|
22
22
|
imageUrl: string | null;
|
|
23
23
|
capabilities: import("@inkeep/agents-core").ToolServerCapabilities | null;
|
|
24
24
|
lastHealthCheck: string | null;
|
|
25
25
|
lastError: string | null;
|
|
26
|
-
availableTools:
|
|
26
|
+
availableTools: McpToolDefinition[] | null;
|
|
27
27
|
lastToolsSync: string | null;
|
|
28
28
|
}>;
|
|
29
|
-
export declare const checkToolHealth: (tool: McpTool) => Promise<{
|
|
29
|
+
export declare const checkToolHealth: (tool: McpTool, credentialStoreRegistry?: CredentialStoreRegistry) => Promise<{
|
|
30
30
|
status: McpToolStatus;
|
|
31
31
|
error?: string;
|
|
32
32
|
capabilities?: McpServerCapabilities;
|
|
33
33
|
}>;
|
|
34
|
-
export declare const discoverToolsFromServer: (tool: McpTool) => Promise<McpToolDefinition[]>;
|
|
35
|
-
export declare const syncToolDefinitions: ({ tenantId, projectId, toolId, }: {
|
|
34
|
+
export declare const discoverToolsFromServer: (tool: McpTool, credentialStoreRegistry?: CredentialStoreRegistry) => Promise<McpToolDefinition[]>;
|
|
35
|
+
export declare const syncToolDefinitions: ({ tenantId, projectId, toolId, credentialStoreRegistry, }: {
|
|
36
36
|
tenantId: string;
|
|
37
37
|
projectId: string;
|
|
38
38
|
toolId: string;
|
|
39
|
+
credentialStoreRegistry?: CredentialStoreRegistry;
|
|
39
40
|
}) => Promise<{
|
|
40
41
|
tenantId: string;
|
|
41
42
|
projectId: string;
|
|
42
43
|
id: string;
|
|
43
44
|
name: string;
|
|
45
|
+
createdAt: string;
|
|
46
|
+
updatedAt: string;
|
|
47
|
+
status: string;
|
|
44
48
|
config: {
|
|
45
49
|
type: "mcp";
|
|
46
50
|
mcp: import("@inkeep/agents-core").ToolMcpConfig;
|
|
47
51
|
};
|
|
48
52
|
credentialReferenceId: string | null;
|
|
49
|
-
createdAt: string;
|
|
50
|
-
updatedAt: string;
|
|
51
|
-
status: string;
|
|
52
53
|
headers: Record<string, string> | null;
|
|
53
54
|
imageUrl: string | null;
|
|
54
55
|
capabilities: import("@inkeep/agents-core").ToolServerCapabilities | null;
|
|
55
56
|
lastHealthCheck: string | null;
|
|
56
57
|
lastError: string | null;
|
|
57
|
-
availableTools:
|
|
58
|
+
availableTools: McpToolDefinition[] | null;
|
|
58
59
|
lastToolsSync: string | null;
|
|
59
60
|
}>;
|
|
60
|
-
export declare const checkAllToolsHealth: (tenantId: string, projectId: string) => Promise<PromiseSettledResult<{
|
|
61
|
+
export declare const checkAllToolsHealth: (tenantId: string, projectId: string, credentialStoreRegistry?: CredentialStoreRegistry) => Promise<PromiseSettledResult<{
|
|
61
62
|
tenantId: string;
|
|
62
63
|
projectId: string;
|
|
63
64
|
id: string;
|
|
64
65
|
name: string;
|
|
66
|
+
createdAt: string;
|
|
67
|
+
updatedAt: string;
|
|
68
|
+
status: string;
|
|
65
69
|
config: {
|
|
66
70
|
type: "mcp";
|
|
67
71
|
mcp: import("@inkeep/agents-core").ToolMcpConfig;
|
|
68
72
|
};
|
|
69
73
|
credentialReferenceId: string | null;
|
|
70
|
-
createdAt: string;
|
|
71
|
-
updatedAt: string;
|
|
72
|
-
status: string;
|
|
73
74
|
headers: Record<string, string> | null;
|
|
74
75
|
imageUrl: string | null;
|
|
75
76
|
capabilities: import("@inkeep/agents-core").ToolServerCapabilities | null;
|
|
76
77
|
lastHealthCheck: string | null;
|
|
77
78
|
lastError: string | null;
|
|
78
|
-
availableTools:
|
|
79
|
+
availableTools: McpToolDefinition[] | null;
|
|
79
80
|
lastToolsSync: string | null;
|
|
80
81
|
}>[]>;
|
|
81
82
|
//# sourceMappingURL=tools.d.ts.map
|
package/dist/data/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/data/tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/data/tools.ts"],"names":[],"mappings":"AAGA,OAAO,EAML,KAAK,qBAAqB,EAC1B,KAAK,OAAO,EACZ,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAUlB,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAgD7B,eAAO,MAAM,gBAAgB,GAAU,iDAMpC;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;;;;;;;;;;;;;;;;;;;;EAmBA,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,MAAM,OAAO,EACb,0BAA0B,uBAAuB,KAChD,OAAO,CAAC;IACT,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC,CAqGA,CAAC;AAGF,eAAO,MAAM,uBAAuB,GAAU,MAAM,OAAO,EAAE,0BAA0B,uBAAuB,KAAG,OAAO,CAAC,iBAAiB,EAAE,CAuF3I,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAU,2DAKvC;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;CACnD;;;;;;;;;;;;;;;;;;;;EA+CA,CAAC;AAGF,eAAO,MAAM,mBAAmB,GAAU,UAAU,MAAM,EAAE,WAAW,MAAM,EAAE,0BAA0B,uBAAuB;;;;;;;;;;;;;;;;;;;;KAiB/H,CAAC"}
|
package/dist/data/tools.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { managementServer } from '../index.js';
|
|
2
1
|
import { getLogger } from '../logger.js';
|
|
3
2
|
import dbClient from './db/dbClient.js';
|
|
4
3
|
import { McpClient, CredentialStuffer, getCredentialReference, updateTool, dbResultToMcpTool, listTools, getToolById, detectAuthenticationRequired, ContextResolver, } from '@inkeep/agents-core';
|
|
@@ -58,7 +57,7 @@ export const updateToolHealth = async ({ tenantId, projectId, toolId, status, er
|
|
|
58
57
|
});
|
|
59
58
|
return tool;
|
|
60
59
|
};
|
|
61
|
-
export const checkToolHealth = async (tool) => {
|
|
60
|
+
export const checkToolHealth = async (tool, credentialStoreRegistry) => {
|
|
62
61
|
try {
|
|
63
62
|
const transportType = tool.config.mcp.transport?.type || 'streamable_http';
|
|
64
63
|
const baseConfig = {
|
|
@@ -81,8 +80,11 @@ export const checkToolHealth = async (tool) => {
|
|
|
81
80
|
retrievalParams: credentialReference.retrievalParams || {},
|
|
82
81
|
};
|
|
83
82
|
// Use CredentialStuffer to build proper config with auth headers
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
if (!credentialStoreRegistry) {
|
|
84
|
+
throw new Error('CredentialStoreRegistry is required for authenticated tools');
|
|
85
|
+
}
|
|
86
|
+
const contextResolver = new ContextResolver(tool.tenantId, tool.projectId, dbClient, credentialStoreRegistry);
|
|
87
|
+
const credentialStuffer = new CredentialStuffer(credentialStoreRegistry, contextResolver);
|
|
86
88
|
serverConfig = await credentialStuffer.buildMcpServerConfig({ tenantId: tool.tenantId, projectId: tool.projectId }, convertToMCPToolConfig(tool), storeReference);
|
|
87
89
|
}
|
|
88
90
|
else {
|
|
@@ -140,7 +142,7 @@ export const checkToolHealth = async (tool) => {
|
|
|
140
142
|
}
|
|
141
143
|
};
|
|
142
144
|
// Tool discovery
|
|
143
|
-
export const discoverToolsFromServer = async (tool) => {
|
|
145
|
+
export const discoverToolsFromServer = async (tool, credentialStoreRegistry) => {
|
|
144
146
|
try {
|
|
145
147
|
const credentialReferenceId = tool.credentialReferenceId;
|
|
146
148
|
let serverConfig;
|
|
@@ -159,8 +161,11 @@ export const discoverToolsFromServer = async (tool) => {
|
|
|
159
161
|
retrievalParams: credentialReference.retrievalParams || {},
|
|
160
162
|
};
|
|
161
163
|
// Use CredentialStuffer to build proper config with auth headers
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
if (!credentialStoreRegistry) {
|
|
165
|
+
throw new Error('CredentialStoreRegistry is required for authenticated tools');
|
|
166
|
+
}
|
|
167
|
+
const contextResolver = new ContextResolver(tool.tenantId, tool.projectId, dbClient, credentialStoreRegistry);
|
|
168
|
+
const credentialStuffer = new CredentialStuffer(credentialStoreRegistry, contextResolver);
|
|
164
169
|
serverConfig = (await credentialStuffer.buildMcpServerConfig({ tenantId: tool.tenantId, projectId: tool.projectId }, convertToMCPToolConfig(tool), storeReference));
|
|
165
170
|
}
|
|
166
171
|
else {
|
|
@@ -207,14 +212,14 @@ export const discoverToolsFromServer = async (tool) => {
|
|
|
207
212
|
throw error;
|
|
208
213
|
}
|
|
209
214
|
};
|
|
210
|
-
export const syncToolDefinitions = async ({ tenantId, projectId, toolId, }) => {
|
|
215
|
+
export const syncToolDefinitions = async ({ tenantId, projectId, toolId, credentialStoreRegistry, }) => {
|
|
211
216
|
const tool = await getToolById(dbClient)({ scopes: { tenantId, projectId }, toolId });
|
|
212
217
|
if (!tool) {
|
|
213
218
|
throw new Error(`Tool ${toolId} not found`);
|
|
214
219
|
}
|
|
215
220
|
const mcpTool = dbResultToMcpTool(tool);
|
|
216
221
|
try {
|
|
217
|
-
const availableTools = await discoverToolsFromServer(mcpTool);
|
|
222
|
+
const availableTools = await discoverToolsFromServer(mcpTool, credentialStoreRegistry);
|
|
218
223
|
const updatedTool = await updateTool(dbClient)({
|
|
219
224
|
scopes: { tenantId, projectId },
|
|
220
225
|
toolId,
|
|
@@ -250,10 +255,10 @@ export const syncToolDefinitions = async ({ tenantId, projectId, toolId, }) => {
|
|
|
250
255
|
}
|
|
251
256
|
};
|
|
252
257
|
// Bulk health checking
|
|
253
|
-
export const checkAllToolsHealth = async (tenantId, projectId) => {
|
|
258
|
+
export const checkAllToolsHealth = async (tenantId, projectId, credentialStoreRegistry) => {
|
|
254
259
|
const toolsList = await listTools(dbClient)({ scopes: { tenantId, projectId } });
|
|
255
260
|
const results = await Promise.allSettled(toolsList.data.map(async (tool) => {
|
|
256
|
-
const healthResult = await checkToolHealth(dbResultToMcpTool(tool));
|
|
261
|
+
const healthResult = await checkToolHealth(dbResultToMcpTool(tool), credentialStoreRegistry);
|
|
257
262
|
return await updateToolHealth({
|
|
258
263
|
tenantId,
|
|
259
264
|
projectId: tool.projectId,
|
package/dist/env.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ declare const envSchema: z.ZodObject<{
|
|
|
7
7
|
}>>;
|
|
8
8
|
ENVIRONMENT: z.ZodOptional<z.ZodEnum<{
|
|
9
9
|
development: "development";
|
|
10
|
-
production: "production";
|
|
11
10
|
pentest: "pentest";
|
|
11
|
+
production: "production";
|
|
12
12
|
test: "test";
|
|
13
13
|
}>>;
|
|
14
14
|
DB_FILE_NAME: z.ZodDefault<z.ZodString>;
|
|
@@ -16,11 +16,11 @@ declare const envSchema: z.ZodObject<{
|
|
|
16
16
|
MANAGEMENT_PORT: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
17
17
|
AGENT_BASE_URL: z.ZodOptional<z.ZodString>;
|
|
18
18
|
LOG_LEVEL: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
19
|
-
|
|
19
|
+
error: "error";
|
|
20
20
|
debug: "debug";
|
|
21
21
|
info: "info";
|
|
22
|
+
trace: "trace";
|
|
22
23
|
warn: "warn";
|
|
23
|
-
error: "error";
|
|
24
24
|
}>>>;
|
|
25
25
|
NANGO_SECRET_KEY: z.ZodOptional<z.ZodString>;
|
|
26
26
|
INKEEP_AGENTS_MANAGE_API_SECRET: z.ZodOptional<z.ZodString>;
|
|
@@ -29,9 +29,9 @@ export declare const env: {
|
|
|
29
29
|
DB_FILE_NAME: string;
|
|
30
30
|
PORT: number;
|
|
31
31
|
MANAGEMENT_PORT: number;
|
|
32
|
-
LOG_LEVEL: "
|
|
32
|
+
LOG_LEVEL: "error" | "debug" | "info" | "trace" | "warn";
|
|
33
33
|
NODE_ENV?: "development" | "production" | "test" | undefined;
|
|
34
|
-
ENVIRONMENT?: "development" | "
|
|
34
|
+
ENVIRONMENT?: "development" | "pentest" | "production" | "test" | undefined;
|
|
35
35
|
AGENT_BASE_URL?: string | undefined;
|
|
36
36
|
NANGO_SECRET_KEY?: string | undefined;
|
|
37
37
|
INKEEP_AGENTS_MANAGE_API_SECRET?: string | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { createManagementHono } from './app.js';
|
|
2
|
+
import { CredentialStoreRegistry, type CredentialStore, type ServerConfig } from '@inkeep/agents-core';
|
|
3
|
+
declare const app: import("@hono/zod-openapi").OpenAPIHono<{
|
|
4
|
+
Variables: {
|
|
5
|
+
serverConfig: ServerConfig;
|
|
6
|
+
credentialStores: CredentialStoreRegistry;
|
|
7
|
+
};
|
|
8
|
+
}, {}, "/">;
|
|
9
|
+
export default app;
|
|
10
|
+
export { createManagementHono };
|
|
11
|
+
export declare function createManagementApp(config?: {
|
|
12
|
+
serverConfig?: ServerConfig;
|
|
13
|
+
credentialStores?: CredentialStore[];
|
|
14
|
+
}): import("@hono/zod-openapi").OpenAPIHono<{
|
|
15
|
+
Variables: {
|
|
16
|
+
serverConfig: ServerConfig;
|
|
17
|
+
credentialStores: CredentialStoreRegistry;
|
|
18
|
+
};
|
|
19
|
+
}, {}, "/">;
|
|
4
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EACL,uBAAuB,EAEvB,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAiB7B,QAAA,MAAM,GAAG;;;;;WAAuD,CAAC;AAGjE,eAAe,GAAG,CAAC;AAGnB,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAGhC,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE;IAC3C,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;CACtC;;;;;YAMA"}
|
package/dist/index.js
CHANGED
|
@@ -1,42 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const MANAGEMENT_API_PORT = 3002;
|
|
7
|
-
// Create credential stores
|
|
8
|
-
const credentialStores = [
|
|
9
|
-
new InMemoryCredentialStore('memory-default'), // In-memory store + env vars
|
|
10
|
-
// Nango store (only loads if NANGO_SECRET_KEY is set)
|
|
11
|
-
...(process.env.NANGO_SECRET_KEY
|
|
12
|
-
? [
|
|
13
|
-
createNangoCredentialStore('nango-default', {
|
|
14
|
-
apiUrl: process.env.NANGO_HOST || 'https://api.nango.dev',
|
|
15
|
-
secretKey: process.env.NANGO_SECRET_KEY,
|
|
16
|
-
}),
|
|
17
|
-
]
|
|
18
|
-
: []),
|
|
19
|
-
createKeyChainStore('keychain-default'),
|
|
20
|
-
];
|
|
21
|
-
// Initialize Management Server
|
|
22
|
-
export const managementServer = new ManagementServer({
|
|
23
|
-
port: MANAGEMENT_API_PORT,
|
|
24
|
-
credentialStores,
|
|
1
|
+
import { createManagementHono } from './app.js';
|
|
2
|
+
import { CredentialStoreRegistry, createDefaultCredentialStores, } from '@inkeep/agents-core';
|
|
3
|
+
// Create default configuration
|
|
4
|
+
const defaultConfig = {
|
|
5
|
+
port: 3002,
|
|
25
6
|
serverOptions: {
|
|
26
|
-
requestTimeout: 60000, // 60 seconds
|
|
7
|
+
requestTimeout: 60000, // 60 seconds for management requests
|
|
27
8
|
keepAliveTimeout: 60000,
|
|
28
9
|
keepAlive: true,
|
|
29
10
|
},
|
|
30
|
-
}
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
11
|
+
};
|
|
12
|
+
// Create default credential stores
|
|
13
|
+
const defaultStores = createDefaultCredentialStores();
|
|
14
|
+
const defaultRegistry = new CredentialStoreRegistry(defaultStores);
|
|
15
|
+
// Create default app instance for simple usage
|
|
16
|
+
const app = createManagementHono(defaultConfig, defaultRegistry);
|
|
17
|
+
// Export the default app for Vite dev server and simple deployments
|
|
18
|
+
export default app;
|
|
19
|
+
// Also export the factory function for advanced usage
|
|
20
|
+
export { createManagementHono };
|
|
21
|
+
// Export a helper to create app with custom credential stores
|
|
22
|
+
export function createManagementApp(config) {
|
|
23
|
+
const serverConfig = config?.serverConfig ?? defaultConfig;
|
|
24
|
+
const stores = config?.credentialStores ?? defaultStores;
|
|
25
|
+
const registry = new CredentialStoreRegistry(stores);
|
|
26
|
+
return createManagementHono(serverConfig, registry);
|
|
42
27
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
|
|
2
|
+
import { type CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
3
|
+
type AppVariables = {
|
|
4
|
+
credentialStores: CredentialStoreRegistry;
|
|
5
|
+
};
|
|
6
|
+
declare const app: OpenAPIHono<{
|
|
7
|
+
Variables: AppVariables;
|
|
8
|
+
}, {}, "/">;
|
|
3
9
|
export default app;
|
|
4
10
|
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/routes/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/routes/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAoB7B,KAAK,YAAY,GAAG;IAClB,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,GAAG;eAAgC,YAAY;WAAK,CAAC;AA+P3D,eAAe,GAAG,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
import { commonGetErrorResponses, createApiError } from '@inkeep/agents-core';
|
|
3
|
-
import { managementServer } from '../index.js';
|
|
2
|
+
import { commonGetErrorResponses, createApiError, } from '@inkeep/agents-core';
|
|
4
3
|
import { CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, ErrorResponseSchema, IdParamsSchema, ListResponseSchema, PaginationQueryParamsSchema, SingleResponseSchema, TenantProjectParamsSchema, createCredentialReference, deleteCredentialReference, getCredentialReferenceById, listCredentialReferencesPaginated, updateCredentialReference, getCredentialStoreLookupKeyFromRetrievalParams, } from '@inkeep/agents-core';
|
|
5
4
|
import dbClient from '../data/db/dbClient.js';
|
|
6
5
|
const app = new OpenAPIHono();
|
|
@@ -184,7 +183,8 @@ app.openapi(createRoute({
|
|
|
184
183
|
message: 'Credential not found',
|
|
185
184
|
});
|
|
186
185
|
}
|
|
187
|
-
const
|
|
186
|
+
const credentialStores = c.get('credentialStores');
|
|
187
|
+
const credentialStore = credentialStores.get(credential.credentialStoreId);
|
|
188
188
|
if (credentialStore && credential.retrievalParams) {
|
|
189
189
|
const lookupKey = getCredentialStoreLookupKeyFromRetrievalParams({
|
|
190
190
|
retrievalParams: credential.retrievalParams,
|
package/dist/routes/oauth.d.ts
CHANGED
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
* - Redirects users back to frontend
|
|
10
10
|
*/
|
|
11
11
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
12
|
-
|
|
12
|
+
import { type CredentialStoreRegistry, type ServerConfig } from '@inkeep/agents-core';
|
|
13
|
+
type AppVariables = {
|
|
14
|
+
serverConfig: ServerConfig;
|
|
15
|
+
credentialStores: CredentialStoreRegistry;
|
|
16
|
+
};
|
|
17
|
+
declare const app: OpenAPIHono<{
|
|
18
|
+
Variables: AppVariables;
|
|
19
|
+
}, {}, "/">;
|
|
13
20
|
export default app;
|
|
14
21
|
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/routes/oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/routes/oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAOL,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAK7B,KAAK,YAAY,GAAG;IAClB,YAAY,EAAE,YAAY,CAAC;IAC3B,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,GAAG;eAAgC,YAAY;WAAK,CAAC;AA8M3D,eAAe,GAAG,CAAC"}
|
package/dist/routes/oauth.js
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { createRoute, OpenAPIHono, z } from '@hono/zod-openapi';
|
|
12
12
|
import { dbResultToMcpTool, getToolById, updateTool, createCredentialReference, getCredentialReference, updateCredentialReference, } from '@inkeep/agents-core';
|
|
13
|
-
import { managementServer } from '../index.js';
|
|
14
13
|
import { getLogger } from '../logger.js';
|
|
15
14
|
import { oauthService, retrievePKCEVerifier } from '../utils/oauth-service.js';
|
|
16
15
|
import dbClient from '../data/db/dbClient.js';
|
|
@@ -93,7 +92,8 @@ app.openapi(createRoute({
|
|
|
93
92
|
});
|
|
94
93
|
logger.info({ toolId, tokenType: tokens.token_type, hasRefresh: !!tokens.refresh_token }, 'Token exchange successful');
|
|
95
94
|
// Store access token in keychain
|
|
96
|
-
const
|
|
95
|
+
const credentialStores = c.get('credentialStores');
|
|
96
|
+
const keychainStore = credentialStores.get('keychain-default');
|
|
97
97
|
const keychainKey = `oauth_token_${toolId}`;
|
|
98
98
|
await keychainStore?.set(keychainKey, JSON.stringify(tokens));
|
|
99
99
|
const credentialId = tool.name;
|
package/dist/routes/tools.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
|
|
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
|
+
}, {}, "/">;
|
|
3
10
|
export default app;
|
|
4
11
|
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/routes/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
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"}
|
package/dist/routes/tools.js
CHANGED
|
@@ -272,7 +272,8 @@ app.openapi(createRoute({
|
|
|
272
272
|
message: 'Tool not found',
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
|
-
const
|
|
275
|
+
const credentialStores = c.get('credentialStores');
|
|
276
|
+
const healthResult = await checkToolHealth(dbResultToMcpTool(tool), credentialStores);
|
|
276
277
|
const updatedTool = await updateToolHealth({
|
|
277
278
|
tenantId,
|
|
278
279
|
projectId,
|
|
@@ -320,7 +321,8 @@ app.openapi(createRoute({
|
|
|
320
321
|
},
|
|
321
322
|
}), async (c) => {
|
|
322
323
|
const { tenantId, projectId } = c.req.valid('param');
|
|
323
|
-
const
|
|
324
|
+
const credentialStores = c.get('credentialStores');
|
|
325
|
+
const results = await checkAllToolsHealth(tenantId, projectId, credentialStores);
|
|
324
326
|
const summary = {
|
|
325
327
|
total: results.length,
|
|
326
328
|
successful: results.filter((r) => r.status === 'fulfilled').length,
|
|
@@ -375,7 +377,13 @@ app.openapi(createRoute({
|
|
|
375
377
|
message: 'Tool not found',
|
|
376
378
|
});
|
|
377
379
|
}
|
|
378
|
-
const
|
|
380
|
+
const credentialStores = c.get('credentialStores');
|
|
381
|
+
const updatedTool = await syncToolDefinitions({
|
|
382
|
+
tenantId,
|
|
383
|
+
projectId,
|
|
384
|
+
toolId: id,
|
|
385
|
+
credentialStoreRegistry: credentialStores,
|
|
386
|
+
});
|
|
379
387
|
return c.json({
|
|
380
388
|
data: dbResultToMcpTool(updatedTool),
|
|
381
389
|
message: 'Tool definitions synchronized successfully',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-manage-api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Management API for Inkeep Agent Framework - handles CRUD operations and OAuth",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,16 +25,19 @@
|
|
|
25
25
|
"pino": "^9.7.0",
|
|
26
26
|
"pino-pretty": "^13.0.0",
|
|
27
27
|
"zod": "^4.1.5",
|
|
28
|
-
"@inkeep/agents-core": "0.1.
|
|
28
|
+
"@inkeep/agents-core": "^0.1.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@biomejs/biome": "2.1.4",
|
|
32
|
+
"@hono/vite-dev-server": "^0.20.1",
|
|
32
33
|
"@types/node": "^20.11.24",
|
|
33
34
|
"@vitest/coverage-v8": "^2.0.0",
|
|
34
35
|
"drizzle-kit": "^0.31.4",
|
|
35
36
|
"nodemon": "^3.1.0",
|
|
36
37
|
"tsx": "^4.7.1",
|
|
37
38
|
"typescript": "^5.3.3",
|
|
39
|
+
"vite": "^7.1.4",
|
|
40
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
38
41
|
"vitest": "^3.1.4"
|
|
39
42
|
},
|
|
40
43
|
"engines": {
|
|
@@ -55,10 +58,9 @@
|
|
|
55
58
|
"directory": "agents-manage-api"
|
|
56
59
|
},
|
|
57
60
|
"scripts": {
|
|
58
|
-
"dev": "
|
|
59
|
-
"dev:apis": "nodemon --watch src --ext ts --exec 'tsx src/index.ts'",
|
|
61
|
+
"dev": "vite",
|
|
60
62
|
"build": "tsc",
|
|
61
|
-
"start": "node dist/
|
|
63
|
+
"start": "node dist/server.js",
|
|
62
64
|
"test": "ENVIRONMENT=test vitest --run",
|
|
63
65
|
"test:watch": "ENVIRONMENT=test vitest",
|
|
64
66
|
"test:coverage": "ENVIRONMENT=test vitest --run --coverage",
|