@dexto/server 1.13.5 → 1.14.1
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/dist/hono/index.cjs +3 -2
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +7 -3
- package/dist/hono/middleware/auth.cjs +42 -32
- package/dist/hono/middleware/auth.d.ts +15 -1
- package/dist/hono/middleware/auth.d.ts.map +1 -1
- package/dist/hono/middleware/auth.js +39 -31
- package/dist/hono/node/index.cjs +33 -22
- package/dist/hono/node/index.d.ts +1 -0
- package/dist/hono/node/index.d.ts.map +1 -1
- package/dist/hono/node/index.js +33 -22
- package/dist/hono/routes/agents.d.ts +14 -14
- package/dist/hono/routes/greeting.d.ts +13 -13
- package/dist/hono/routes/key.d.ts +4 -4
- package/dist/hono/routes/llm.d.ts +54 -54
- package/dist/hono/routes/memory.d.ts +10 -10
- package/dist/hono/routes/messages.d.ts +8 -8
- package/dist/hono/routes/models.d.ts +6 -6
- package/dist/hono/routes/openrouter.d.ts +6 -6
- package/dist/hono/routes/prompts.d.ts +2 -2
- package/dist/hono/routes/queue.d.ts +16 -16
- package/dist/hono/routes/resources.d.ts +2 -2
- package/dist/hono/routes/schedules.d.ts +12 -12
- package/dist/hono/routes/search.d.ts +4 -4
- package/dist/hono/routes/sessions.d.ts +24 -24
- package/dist/hono/routes/system-prompt.d.ts +2 -2
- package/dist/hono/routes/webhooks.d.ts +2 -2
- package/dist/hono/routes/workspaces.d.ts +2 -2
- package/dist/hono/types.d.ts +2 -0
- package/dist/hono/types.d.ts.map +1 -1
- package/dist/mcp/mcp-handler.cjs +32 -32
- package/dist/mcp/mcp-handler.d.ts +9 -3
- package/dist/mcp/mcp-handler.d.ts.map +1 -1
- package/dist/mcp/mcp-handler.js +32 -32
- package/package.json +15 -10
package/dist/hono/index.cjs
CHANGED
|
@@ -126,10 +126,11 @@ function createDextoApp(options) {
|
|
|
126
126
|
`\u26A0\uFE0F Authentication disabled (disableAuth=true). createAuthMiddleware() skipped. Ensure external auth is in place.`
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
|
+
const httpAuthorization = disableAuth ? () => ({ allowed: true }) : (0, import_auth.createHttpAuthorization)();
|
|
129
130
|
const app = new import_zod_openapi.OpenAPIHono({ strict: false });
|
|
130
131
|
app.use("*", (0, import_cors.createCorsMiddleware)());
|
|
131
132
|
if (!disableAuth) {
|
|
132
|
-
app.use("*", (0, import_auth.createAuthMiddleware)());
|
|
133
|
+
app.use("*", (0, import_auth.createAuthMiddleware)(httpAuthorization));
|
|
133
134
|
}
|
|
134
135
|
app.onError((err, ctx) => (0, import_error.handleHonoError)(ctx, err));
|
|
135
136
|
const rawPrefix = apiPrefix ?? DEFAULT_API_PREFIX;
|
|
@@ -297,7 +298,7 @@ function createDextoApp(options) {
|
|
|
297
298
|
fullApp.route("/", (0, import_static.createStaticRouter)(webRoot));
|
|
298
299
|
fullApp.notFound((0, import_static.createSpaFallbackHandler)(webRoot, webUIConfig, normalizedPrefix));
|
|
299
300
|
}
|
|
300
|
-
Object.assign(fullApp, { webhookSubscriber });
|
|
301
|
+
Object.assign(fullApp, { webhookSubscriber, httpAuthorization });
|
|
301
302
|
return fullApp;
|
|
302
303
|
}
|
|
303
304
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/hono/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hono/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAwB,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,C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,GACf,oBAAoB,GACpB,mBAAmB,GACnB,qBAAqB,GACrB,kBAAkB,GAClB,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,CAAC;AAEzB,KAAK,sBAAsB,GAAG,qBAAqB,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAE7F,KAAK,kBAAkB,GACjB,sBAAsB,GACtB,eAAe,GACf,iBAAiB,GACjB,qBAAqB,GACrB,kBAAkB,GAClB,wBAAwB,GACxB,qBAAqB,CAAC;AAE5B,KAAK,sBAAsB,GACrB,wBAAwB,GACxB,uBAAuB,GACvB,sBAAsB,GACtB,kBAAkB,CAAC;AAEzB,KAAK,gBAAgB,GAAG,eAAe,CAAC,sBAAsB,EAAE,OAAO,kBAAkB,CAAC,CAAC;AAM3F,KAAK,eAAe,GAAG,YAAY,GAAG,eAAe,GAAG,aAAa,CAAC;AACtE,KAAK,SAAS,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAEpD,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,QAAQ,CAgPvE;AAED,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;AAGrD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/hono/index.js
CHANGED
|
@@ -37,7 +37,10 @@ import {
|
|
|
37
37
|
import { handleHonoError } from "./middleware/error.js";
|
|
38
38
|
import { prettyJsonMiddleware, redactionMiddleware } from "./middleware/redaction.js";
|
|
39
39
|
import { createCorsMiddleware } from "./middleware/cors.js";
|
|
40
|
-
import {
|
|
40
|
+
import {
|
|
41
|
+
createAuthMiddleware,
|
|
42
|
+
createHttpAuthorization
|
|
43
|
+
} from "./middleware/auth.js";
|
|
41
44
|
import { existsSync, readFileSync } from "node:fs";
|
|
42
45
|
import { fileURLToPath } from "node:url";
|
|
43
46
|
import { dirname, join } from "node:path";
|
|
@@ -107,10 +110,11 @@ function createDextoApp(options) {
|
|
|
107
110
|
`\u26A0\uFE0F Authentication disabled (disableAuth=true). createAuthMiddleware() skipped. Ensure external auth is in place.`
|
|
108
111
|
);
|
|
109
112
|
}
|
|
113
|
+
const httpAuthorization = disableAuth ? () => ({ allowed: true }) : createHttpAuthorization();
|
|
110
114
|
const app = new OpenAPIHono({ strict: false });
|
|
111
115
|
app.use("*", createCorsMiddleware());
|
|
112
116
|
if (!disableAuth) {
|
|
113
|
-
app.use("*", createAuthMiddleware());
|
|
117
|
+
app.use("*", createAuthMiddleware(httpAuthorization));
|
|
114
118
|
}
|
|
115
119
|
app.onError((err, ctx) => handleHonoError(ctx, err));
|
|
116
120
|
const rawPrefix = apiPrefix ?? DEFAULT_API_PREFIX;
|
|
@@ -278,7 +282,7 @@ function createDextoApp(options) {
|
|
|
278
282
|
fullApp.route("/", createStaticRouter(webRoot));
|
|
279
283
|
fullApp.notFound(createSpaFallbackHandler(webRoot, webUIConfig, normalizedPrefix));
|
|
280
284
|
}
|
|
281
|
-
Object.assign(fullApp, { webhookSubscriber });
|
|
285
|
+
Object.assign(fullApp, { webhookSubscriber, httpAuthorization });
|
|
282
286
|
return fullApp;
|
|
283
287
|
}
|
|
284
288
|
export {
|
|
@@ -18,58 +18,68 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var auth_exports = {};
|
|
20
20
|
__export(auth_exports, {
|
|
21
|
-
createAuthMiddleware: () => createAuthMiddleware
|
|
21
|
+
createAuthMiddleware: () => createAuthMiddleware,
|
|
22
|
+
createHttpAuthorization: () => createHttpAuthorization,
|
|
23
|
+
createRequiredBearerAuthorization: () => createRequiredBearerAuthorization
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(auth_exports);
|
|
24
26
|
var import_core = require("@dexto/core");
|
|
25
27
|
const PUBLIC_ROUTES = ["/health", "/.well-known/agent-card.json", "/openapi.json"];
|
|
26
|
-
function
|
|
28
|
+
function createRequiredBearerAuthorization(apiKey, configurationMessage = "Server API key not configured.") {
|
|
29
|
+
return (header) => {
|
|
30
|
+
if (!apiKey) {
|
|
31
|
+
return {
|
|
32
|
+
allowed: false,
|
|
33
|
+
status: 500,
|
|
34
|
+
body: { error: "Configuration Error", message: configurationMessage }
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const providedKey = header?.match(/^Bearer\s+(.+)$/i)?.[1];
|
|
38
|
+
if (!providedKey || providedKey !== apiKey) {
|
|
39
|
+
return {
|
|
40
|
+
allowed: false,
|
|
41
|
+
status: 401,
|
|
42
|
+
body: {
|
|
43
|
+
error: "Unauthorized",
|
|
44
|
+
message: "Invalid or missing API key. Provide Authorization: Bearer <api-key> header."
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return { allowed: true };
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function createHttpAuthorization() {
|
|
27
52
|
const apiKey = process.env.DEXTO_SERVER_API_KEY;
|
|
28
53
|
const isProduction = process.env.NODE_ENV === "production";
|
|
29
54
|
const requireAuth = process.env.DEXTO_SERVER_REQUIRE_AUTH === "true";
|
|
55
|
+
if (!isProduction && !requireAuth) return () => ({ allowed: true });
|
|
30
56
|
if (isProduction && !apiKey) {
|
|
31
57
|
import_core.logger.warn(
|
|
32
|
-
|
|
58
|
+
"Production HTTP authentication requires DEXTO_SERVER_API_KEY; protected requests will fail closed."
|
|
33
59
|
);
|
|
34
60
|
}
|
|
61
|
+
return createRequiredBearerAuthorization(
|
|
62
|
+
apiKey,
|
|
63
|
+
requireAuth ? "DEXTO_SERVER_REQUIRE_AUTH=true but DEXTO_SERVER_API_KEY not set. Set DEXTO_SERVER_API_KEY environment variable." : "NODE_ENV=production requires DEXTO_SERVER_API_KEY. Set DEXTO_SERVER_API_KEY environment variable to secure your API."
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function createAuthMiddleware(authorize = createHttpAuthorization()) {
|
|
35
67
|
return async (ctx, next) => {
|
|
36
68
|
const path = ctx.req.path;
|
|
37
69
|
if (PUBLIC_ROUTES.some((route) => path === route || path.startsWith(route))) {
|
|
38
70
|
return next();
|
|
39
71
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return ctx.json(
|
|
45
|
-
{
|
|
46
|
-
error: "Configuration Error",
|
|
47
|
-
message: requireAuth ? "DEXTO_SERVER_REQUIRE_AUTH=true but DEXTO_SERVER_API_KEY not set. Set DEXTO_SERVER_API_KEY environment variable." : "NODE_ENV=production requires DEXTO_SERVER_API_KEY. Set DEXTO_SERVER_API_KEY environment variable to secure your API."
|
|
48
|
-
},
|
|
49
|
-
500
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
const authHeader = ctx.req.header("Authorization");
|
|
53
|
-
const providedKey = authHeader?.replace(/^Bearer\s+/i, "");
|
|
54
|
-
if (!providedKey || providedKey !== apiKey) {
|
|
55
|
-
import_core.logger.warn("Unauthorized API access attempt", {
|
|
56
|
-
path,
|
|
57
|
-
hasKey: !!providedKey,
|
|
58
|
-
origin: ctx.req.header("origin"),
|
|
59
|
-
userAgent: ctx.req.header("user-agent")
|
|
60
|
-
});
|
|
61
|
-
return ctx.json(
|
|
62
|
-
{
|
|
63
|
-
error: "Unauthorized",
|
|
64
|
-
message: "Invalid or missing API key. Provide Authorization: Bearer <api-key> header."
|
|
65
|
-
},
|
|
66
|
-
401
|
|
67
|
-
);
|
|
72
|
+
const result = authorize(ctx.req.header("Authorization"));
|
|
73
|
+
if (!result.allowed) {
|
|
74
|
+
if (result.status === 401) import_core.logger.warn("Unauthorized API access attempt", { path });
|
|
75
|
+
return ctx.json(result.body, result.status);
|
|
68
76
|
}
|
|
69
77
|
await next();
|
|
70
78
|
};
|
|
71
79
|
}
|
|
72
80
|
// Annotate the CommonJS export names for ESM import in node:
|
|
73
81
|
0 && (module.exports = {
|
|
74
|
-
createAuthMiddleware
|
|
82
|
+
createAuthMiddleware,
|
|
83
|
+
createHttpAuthorization,
|
|
84
|
+
createRequiredBearerAuthorization
|
|
75
85
|
});
|
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
import type { MiddlewareHandler } from 'hono';
|
|
2
|
-
export
|
|
2
|
+
export type HttpAuthorizationResult = {
|
|
3
|
+
allowed: true;
|
|
4
|
+
} | {
|
|
5
|
+
allowed: false;
|
|
6
|
+
status: 401 | 500;
|
|
7
|
+
body: {
|
|
8
|
+
error: string;
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type HttpAuthorization = (header: string | undefined) => HttpAuthorizationResult;
|
|
13
|
+
/** Required bearer validation, independent of the development-mode server default. */
|
|
14
|
+
export declare function createRequiredBearerAuthorization(apiKey: string | undefined, configurationMessage?: string): HttpAuthorization;
|
|
15
|
+
export declare function createHttpAuthorization(): HttpAuthorization;
|
|
16
|
+
export declare function createAuthMiddleware(authorize?: HttpAuthorization): MiddlewareHandler;
|
|
3
17
|
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/hono/middleware/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAuB9C,wBAAgB,oBAAoB,IAAI,iBAAiB,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/hono/middleware/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAuB9C,MAAM,MAAM,uBAAuB,GAC7B;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GACjB;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC;IAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAEtF,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,uBAAuB,CAAC;AAExF,sFAAsF;AACtF,wBAAgB,iCAAiC,CAC7C,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,oBAAoB,SAAmC,GACxD,iBAAiB,CAuBnB;AAED,wBAAgB,uBAAuB,IAAI,iBAAiB,CAgB3D;AAED,wBAAgB,oBAAoB,CAChC,SAAS,GAAE,iBAA6C,GACzD,iBAAiB,CAanB"}
|
|
@@ -1,51 +1,59 @@
|
|
|
1
1
|
import { logger } from "@dexto/core";
|
|
2
2
|
const PUBLIC_ROUTES = ["/health", "/.well-known/agent-card.json", "/openapi.json"];
|
|
3
|
-
function
|
|
3
|
+
function createRequiredBearerAuthorization(apiKey, configurationMessage = "Server API key not configured.") {
|
|
4
|
+
return (header) => {
|
|
5
|
+
if (!apiKey) {
|
|
6
|
+
return {
|
|
7
|
+
allowed: false,
|
|
8
|
+
status: 500,
|
|
9
|
+
body: { error: "Configuration Error", message: configurationMessage }
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
const providedKey = header?.match(/^Bearer\s+(.+)$/i)?.[1];
|
|
13
|
+
if (!providedKey || providedKey !== apiKey) {
|
|
14
|
+
return {
|
|
15
|
+
allowed: false,
|
|
16
|
+
status: 401,
|
|
17
|
+
body: {
|
|
18
|
+
error: "Unauthorized",
|
|
19
|
+
message: "Invalid or missing API key. Provide Authorization: Bearer <api-key> header."
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return { allowed: true };
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function createHttpAuthorization() {
|
|
4
27
|
const apiKey = process.env.DEXTO_SERVER_API_KEY;
|
|
5
28
|
const isProduction = process.env.NODE_ENV === "production";
|
|
6
29
|
const requireAuth = process.env.DEXTO_SERVER_REQUIRE_AUTH === "true";
|
|
30
|
+
if (!isProduction && !requireAuth) return () => ({ allowed: true });
|
|
7
31
|
if (isProduction && !apiKey) {
|
|
8
32
|
logger.warn(
|
|
9
|
-
|
|
33
|
+
"Production HTTP authentication requires DEXTO_SERVER_API_KEY; protected requests will fail closed."
|
|
10
34
|
);
|
|
11
35
|
}
|
|
36
|
+
return createRequiredBearerAuthorization(
|
|
37
|
+
apiKey,
|
|
38
|
+
requireAuth ? "DEXTO_SERVER_REQUIRE_AUTH=true but DEXTO_SERVER_API_KEY not set. Set DEXTO_SERVER_API_KEY environment variable." : "NODE_ENV=production requires DEXTO_SERVER_API_KEY. Set DEXTO_SERVER_API_KEY environment variable to secure your API."
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function createAuthMiddleware(authorize = createHttpAuthorization()) {
|
|
12
42
|
return async (ctx, next) => {
|
|
13
43
|
const path = ctx.req.path;
|
|
14
44
|
if (PUBLIC_ROUTES.some((route) => path === route || path.startsWith(route))) {
|
|
15
45
|
return next();
|
|
16
46
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return ctx.json(
|
|
22
|
-
{
|
|
23
|
-
error: "Configuration Error",
|
|
24
|
-
message: requireAuth ? "DEXTO_SERVER_REQUIRE_AUTH=true but DEXTO_SERVER_API_KEY not set. Set DEXTO_SERVER_API_KEY environment variable." : "NODE_ENV=production requires DEXTO_SERVER_API_KEY. Set DEXTO_SERVER_API_KEY environment variable to secure your API."
|
|
25
|
-
},
|
|
26
|
-
500
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
const authHeader = ctx.req.header("Authorization");
|
|
30
|
-
const providedKey = authHeader?.replace(/^Bearer\s+/i, "");
|
|
31
|
-
if (!providedKey || providedKey !== apiKey) {
|
|
32
|
-
logger.warn("Unauthorized API access attempt", {
|
|
33
|
-
path,
|
|
34
|
-
hasKey: !!providedKey,
|
|
35
|
-
origin: ctx.req.header("origin"),
|
|
36
|
-
userAgent: ctx.req.header("user-agent")
|
|
37
|
-
});
|
|
38
|
-
return ctx.json(
|
|
39
|
-
{
|
|
40
|
-
error: "Unauthorized",
|
|
41
|
-
message: "Invalid or missing API key. Provide Authorization: Bearer <api-key> header."
|
|
42
|
-
},
|
|
43
|
-
401
|
|
44
|
-
);
|
|
47
|
+
const result = authorize(ctx.req.header("Authorization"));
|
|
48
|
+
if (!result.allowed) {
|
|
49
|
+
if (result.status === 401) logger.warn("Unauthorized API access attempt", { path });
|
|
50
|
+
return ctx.json(result.body, result.status);
|
|
45
51
|
}
|
|
46
52
|
await next();
|
|
47
53
|
};
|
|
48
54
|
}
|
|
49
55
|
export {
|
|
50
|
-
createAuthMiddleware
|
|
56
|
+
createAuthMiddleware,
|
|
57
|
+
createHttpAuthorization,
|
|
58
|
+
createRequiredBearerAuthorization
|
|
51
59
|
};
|
package/dist/hono/node/index.cjs
CHANGED
|
@@ -23,10 +23,12 @@ __export(node_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(node_exports);
|
|
24
24
|
var import_node_http = require("node:http");
|
|
25
25
|
var import_node_stream = require("node:stream");
|
|
26
|
+
var import_auth = require("../middleware/auth.js");
|
|
26
27
|
var import_core = require("@dexto/core");
|
|
27
28
|
function createNodeServer(app, options) {
|
|
28
29
|
const { getAgent: _getAgent } = options;
|
|
29
30
|
const webhookSubscriber = app.webhookSubscriber;
|
|
31
|
+
const authorize = app.httpAuthorization ?? (0, import_auth.createHttpAuthorization)();
|
|
30
32
|
const server = (0, import_node_http.createServer)(async (req, res) => {
|
|
31
33
|
const disconnectController = new AbortController();
|
|
32
34
|
const abortOnDisconnect = () => {
|
|
@@ -35,7 +37,13 @@ function createNodeServer(app, options) {
|
|
|
35
37
|
req.on("aborted", abortOnDisconnect);
|
|
36
38
|
res.on("close", abortOnDisconnect);
|
|
37
39
|
try {
|
|
38
|
-
if (options.mcpHandlers && req.url
|
|
40
|
+
if (options.mcpHandlers && req.method !== "OPTIONS" && new URL(req.url ?? "/", "http://localhost").pathname === "/mcp") {
|
|
41
|
+
const authorization = authorize(req.headers.authorization);
|
|
42
|
+
if (!authorization.allowed) {
|
|
43
|
+
res.writeHead(authorization.status, { "Content-Type": "application/json" });
|
|
44
|
+
res.end(JSON.stringify(authorization.body));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
39
47
|
if (req.method === "GET") {
|
|
40
48
|
await options.mcpHandlers.handleGet(req, res);
|
|
41
49
|
return;
|
|
@@ -44,38 +52,41 @@ function createNodeServer(app, options) {
|
|
|
44
52
|
req.setEncoding("utf8");
|
|
45
53
|
let body = "";
|
|
46
54
|
const MAX_BODY_SIZE = 10 * 1024 * 1024;
|
|
47
|
-
|
|
55
|
+
for await (const chunk of req) {
|
|
48
56
|
body += chunk;
|
|
49
57
|
if (body.length > MAX_BODY_SIZE) {
|
|
50
|
-
req.destroy();
|
|
51
58
|
res.statusCode = 413;
|
|
52
59
|
res.end("Payload too large");
|
|
60
|
+
return;
|
|
53
61
|
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
req.on("error", (err) => {
|
|
66
|
-
import_core.logger.error(`Error reading MCP POST body: ${String(err)}`);
|
|
67
|
-
res.statusCode = 500;
|
|
68
|
-
res.end("Failed to read request body");
|
|
69
|
-
});
|
|
62
|
+
}
|
|
63
|
+
let parsed;
|
|
64
|
+
try {
|
|
65
|
+
parsed = body.length > 0 ? JSON.parse(body) : void 0;
|
|
66
|
+
} catch {
|
|
67
|
+
import_core.logger.error("Invalid MCP POST JSON");
|
|
68
|
+
res.statusCode = 400;
|
|
69
|
+
res.end("Invalid JSON body");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
await options.mcpHandlers.handlePost(req, res, parsed);
|
|
70
73
|
return;
|
|
71
74
|
}
|
|
75
|
+
if (req.method === "DELETE" && options.mcpHandlers.handleDelete) {
|
|
76
|
+
await options.mcpHandlers.handleDelete(req, res);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
res.writeHead(405, {
|
|
80
|
+
Allow: options.mcpHandlers.handleDelete ? "GET, POST, DELETE" : "GET, POST"
|
|
81
|
+
});
|
|
82
|
+
res.end("Method not allowed");
|
|
83
|
+
return;
|
|
72
84
|
}
|
|
73
85
|
const request = await toRequest(req, disconnectController.signal);
|
|
74
86
|
const response = await app.fetch(request);
|
|
75
87
|
await sendNodeResponse(res, response, disconnectController.signal);
|
|
76
|
-
} catch
|
|
77
|
-
|
|
78
|
-
import_core.logger.error(`Unhandled error in Node bridge: ${message}`, { error });
|
|
88
|
+
} catch {
|
|
89
|
+
import_core.logger.error("Unhandled request error in Node bridge");
|
|
79
90
|
res.statusCode = 500;
|
|
80
91
|
res.end("Internal Server Error");
|
|
81
92
|
} finally {
|
|
@@ -9,6 +9,7 @@ export type NodeBridgeOptions = {
|
|
|
9
9
|
mcpHandlers?: {
|
|
10
10
|
handlePost: (req: IncomingMessage, res: ServerResponse, body: unknown) => Promise<void> | void;
|
|
11
11
|
handleGet: (req: IncomingMessage, res: ServerResponse) => Promise<void> | void;
|
|
12
|
+
handleDelete?: (req: IncomingMessage, res: ServerResponse) => Promise<void> | void;
|
|
12
13
|
} | null;
|
|
13
14
|
};
|
|
14
15
|
export type NodeBridgeResult = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hono/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hono/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAIpF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAKjF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,EAAE,MAAM,UAAU,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE;QACV,UAAU,EAAE,CACR,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,OAAO,KACZ,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAC1B,SAAS,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAC/E,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;KACtF,GAAG,IAAI,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IACxC,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;CAC9C,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAkG5F"}
|
package/dist/hono/node/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createServer } from "node:http";
|
|
2
2
|
import { Readable } from "node:stream";
|
|
3
|
+
import { createHttpAuthorization } from "../middleware/auth.js";
|
|
3
4
|
import { logger } from "@dexto/core";
|
|
4
5
|
function createNodeServer(app, options) {
|
|
5
6
|
const { getAgent: _getAgent } = options;
|
|
6
7
|
const webhookSubscriber = app.webhookSubscriber;
|
|
8
|
+
const authorize = app.httpAuthorization ?? createHttpAuthorization();
|
|
7
9
|
const server = createServer(async (req, res) => {
|
|
8
10
|
const disconnectController = new AbortController();
|
|
9
11
|
const abortOnDisconnect = () => {
|
|
@@ -12,7 +14,13 @@ function createNodeServer(app, options) {
|
|
|
12
14
|
req.on("aborted", abortOnDisconnect);
|
|
13
15
|
res.on("close", abortOnDisconnect);
|
|
14
16
|
try {
|
|
15
|
-
if (options.mcpHandlers && req.url
|
|
17
|
+
if (options.mcpHandlers && req.method !== "OPTIONS" && new URL(req.url ?? "/", "http://localhost").pathname === "/mcp") {
|
|
18
|
+
const authorization = authorize(req.headers.authorization);
|
|
19
|
+
if (!authorization.allowed) {
|
|
20
|
+
res.writeHead(authorization.status, { "Content-Type": "application/json" });
|
|
21
|
+
res.end(JSON.stringify(authorization.body));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
16
24
|
if (req.method === "GET") {
|
|
17
25
|
await options.mcpHandlers.handleGet(req, res);
|
|
18
26
|
return;
|
|
@@ -21,38 +29,41 @@ function createNodeServer(app, options) {
|
|
|
21
29
|
req.setEncoding("utf8");
|
|
22
30
|
let body = "";
|
|
23
31
|
const MAX_BODY_SIZE = 10 * 1024 * 1024;
|
|
24
|
-
|
|
32
|
+
for await (const chunk of req) {
|
|
25
33
|
body += chunk;
|
|
26
34
|
if (body.length > MAX_BODY_SIZE) {
|
|
27
|
-
req.destroy();
|
|
28
35
|
res.statusCode = 413;
|
|
29
36
|
res.end("Payload too large");
|
|
37
|
+
return;
|
|
30
38
|
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
req.on("error", (err) => {
|
|
43
|
-
logger.error(`Error reading MCP POST body: ${String(err)}`);
|
|
44
|
-
res.statusCode = 500;
|
|
45
|
-
res.end("Failed to read request body");
|
|
46
|
-
});
|
|
39
|
+
}
|
|
40
|
+
let parsed;
|
|
41
|
+
try {
|
|
42
|
+
parsed = body.length > 0 ? JSON.parse(body) : void 0;
|
|
43
|
+
} catch {
|
|
44
|
+
logger.error("Invalid MCP POST JSON");
|
|
45
|
+
res.statusCode = 400;
|
|
46
|
+
res.end("Invalid JSON body");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
await options.mcpHandlers.handlePost(req, res, parsed);
|
|
47
50
|
return;
|
|
48
51
|
}
|
|
52
|
+
if (req.method === "DELETE" && options.mcpHandlers.handleDelete) {
|
|
53
|
+
await options.mcpHandlers.handleDelete(req, res);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
res.writeHead(405, {
|
|
57
|
+
Allow: options.mcpHandlers.handleDelete ? "GET, POST, DELETE" : "GET, POST"
|
|
58
|
+
});
|
|
59
|
+
res.end("Method not allowed");
|
|
60
|
+
return;
|
|
49
61
|
}
|
|
50
62
|
const request = await toRequest(req, disconnectController.signal);
|
|
51
63
|
const response = await app.fetch(request);
|
|
52
64
|
await sendNodeResponse(res, response, disconnectController.signal);
|
|
53
|
-
} catch
|
|
54
|
-
|
|
55
|
-
logger.error(`Unhandled error in Node bridge: ${message}`, { error });
|
|
65
|
+
} catch {
|
|
66
|
+
logger.error("Unhandled request error in Node bridge");
|
|
56
67
|
res.statusCode = 500;
|
|
57
68
|
res.end("Internal Server Error");
|
|
58
69
|
} finally {
|
|
@@ -6168,7 +6168,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
6168
6168
|
stack?: string | undefined;
|
|
6169
6169
|
};
|
|
6170
6170
|
outputFormat: "json";
|
|
6171
|
-
status:
|
|
6171
|
+
status: 500;
|
|
6172
6172
|
} | {
|
|
6173
6173
|
input: {
|
|
6174
6174
|
json: {
|
|
@@ -6212,7 +6212,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
6212
6212
|
stack?: string | undefined;
|
|
6213
6213
|
};
|
|
6214
6214
|
outputFormat: "json";
|
|
6215
|
-
status:
|
|
6215
|
+
status: 400;
|
|
6216
6216
|
} | {
|
|
6217
6217
|
input: {
|
|
6218
6218
|
json: {
|
|
@@ -6363,7 +6363,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
6363
6363
|
stack?: string | undefined;
|
|
6364
6364
|
};
|
|
6365
6365
|
outputFormat: "json";
|
|
6366
|
-
status:
|
|
6366
|
+
status: 500;
|
|
6367
6367
|
} | {
|
|
6368
6368
|
input: {
|
|
6369
6369
|
json: {
|
|
@@ -6397,7 +6397,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
6397
6397
|
stack?: string | undefined;
|
|
6398
6398
|
};
|
|
6399
6399
|
outputFormat: "json";
|
|
6400
|
-
status:
|
|
6400
|
+
status: 400;
|
|
6401
6401
|
} | {
|
|
6402
6402
|
input: {
|
|
6403
6403
|
json: {
|
|
@@ -6517,7 +6517,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
6517
6517
|
stack?: string | undefined;
|
|
6518
6518
|
};
|
|
6519
6519
|
outputFormat: "json";
|
|
6520
|
-
status:
|
|
6520
|
+
status: 500;
|
|
6521
6521
|
} | {
|
|
6522
6522
|
input: {
|
|
6523
6523
|
json: {
|
|
@@ -6551,7 +6551,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
6551
6551
|
stack?: string | undefined;
|
|
6552
6552
|
};
|
|
6553
6553
|
outputFormat: "json";
|
|
6554
|
-
status:
|
|
6554
|
+
status: 400;
|
|
6555
6555
|
} | {
|
|
6556
6556
|
input: {
|
|
6557
6557
|
json: {
|
|
@@ -6671,7 +6671,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
6671
6671
|
stack?: string | undefined;
|
|
6672
6672
|
};
|
|
6673
6673
|
outputFormat: "json";
|
|
6674
|
-
status:
|
|
6674
|
+
status: 500;
|
|
6675
6675
|
} | {
|
|
6676
6676
|
input: {
|
|
6677
6677
|
json: {
|
|
@@ -6705,7 +6705,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
6705
6705
|
stack?: string | undefined;
|
|
6706
6706
|
};
|
|
6707
6707
|
outputFormat: "json";
|
|
6708
|
-
status:
|
|
6708
|
+
status: 400;
|
|
6709
6709
|
} | {
|
|
6710
6710
|
input: {
|
|
6711
6711
|
json: {
|
|
@@ -6828,7 +6828,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
6828
6828
|
stack?: string | undefined;
|
|
6829
6829
|
};
|
|
6830
6830
|
outputFormat: "json";
|
|
6831
|
-
status:
|
|
6831
|
+
status: 500;
|
|
6832
6832
|
} | {
|
|
6833
6833
|
input: {
|
|
6834
6834
|
json: {
|
|
@@ -6866,7 +6866,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
6866
6866
|
stack?: string | undefined;
|
|
6867
6867
|
};
|
|
6868
6868
|
outputFormat: "json";
|
|
6869
|
-
status:
|
|
6869
|
+
status: 400;
|
|
6870
6870
|
} | {
|
|
6871
6871
|
input: {
|
|
6872
6872
|
json: {
|
|
@@ -7258,7 +7258,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
7258
7258
|
stack?: string | undefined;
|
|
7259
7259
|
};
|
|
7260
7260
|
outputFormat: "json";
|
|
7261
|
-
status:
|
|
7261
|
+
status: 500;
|
|
7262
7262
|
} | {
|
|
7263
7263
|
input: {
|
|
7264
7264
|
json: {
|
|
@@ -7291,7 +7291,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
7291
7291
|
stack?: string | undefined;
|
|
7292
7292
|
};
|
|
7293
7293
|
outputFormat: "json";
|
|
7294
|
-
status:
|
|
7294
|
+
status: 400;
|
|
7295
7295
|
} | {
|
|
7296
7296
|
input: {
|
|
7297
7297
|
json: {
|
|
@@ -7418,7 +7418,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
7418
7418
|
stack?: string | undefined;
|
|
7419
7419
|
};
|
|
7420
7420
|
outputFormat: "json";
|
|
7421
|
-
status:
|
|
7421
|
+
status: 500;
|
|
7422
7422
|
} | {
|
|
7423
7423
|
input: {
|
|
7424
7424
|
json: {
|
|
@@ -7451,7 +7451,7 @@ export declare function createAgentsRouter(getAgent: GetAgentFn, context: Agents
|
|
|
7451
7451
|
stack?: string | undefined;
|
|
7452
7452
|
};
|
|
7453
7453
|
outputFormat: "json";
|
|
7454
|
-
status:
|
|
7454
|
+
status: 400;
|
|
7455
7455
|
} | {
|
|
7456
7456
|
input: {
|
|
7457
7457
|
json: {
|
|
@@ -301,17 +301,6 @@ declare const greetingRoute: {
|
|
|
301
301
|
export declare function createGreetingRouter(getAgent: GetAgentFn): OpenAPIHono<import("hono/types").Env, {
|
|
302
302
|
"/greeting": {
|
|
303
303
|
$get: {
|
|
304
|
-
input: {
|
|
305
|
-
query: {
|
|
306
|
-
sessionId?: string | undefined;
|
|
307
|
-
};
|
|
308
|
-
};
|
|
309
|
-
output: {
|
|
310
|
-
greeting?: string | undefined;
|
|
311
|
-
};
|
|
312
|
-
outputFormat: "json";
|
|
313
|
-
status: 200;
|
|
314
|
-
} | {
|
|
315
304
|
input: {
|
|
316
305
|
query: {
|
|
317
306
|
sessionId?: string | undefined;
|
|
@@ -343,7 +332,18 @@ export declare function createGreetingRouter(getAgent: GetAgentFn): OpenAPIHono<
|
|
|
343
332
|
stack?: string | undefined;
|
|
344
333
|
};
|
|
345
334
|
outputFormat: "json";
|
|
346
|
-
status:
|
|
335
|
+
status: 500;
|
|
336
|
+
} | {
|
|
337
|
+
input: {
|
|
338
|
+
query: {
|
|
339
|
+
sessionId?: string | undefined;
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
output: {
|
|
343
|
+
greeting?: string | undefined;
|
|
344
|
+
};
|
|
345
|
+
outputFormat: "json";
|
|
346
|
+
status: 200;
|
|
347
347
|
} | {
|
|
348
348
|
input: {
|
|
349
349
|
query: {
|
|
@@ -376,7 +376,7 @@ export declare function createGreetingRouter(getAgent: GetAgentFn): OpenAPIHono<
|
|
|
376
376
|
stack?: string | undefined;
|
|
377
377
|
};
|
|
378
378
|
outputFormat: "json";
|
|
379
|
-
status:
|
|
379
|
+
status: 400;
|
|
380
380
|
};
|
|
381
381
|
};
|
|
382
382
|
}, "/">;
|