@dexto/server 1.6.21 → 1.6.22
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/approval/wire-approval-events.cjs +44 -0
- package/dist/approval/wire-approval-events.d.ts +4 -0
- package/dist/approval/wire-approval-events.d.ts.map +1 -0
- package/dist/approval/wire-approval-events.js +20 -0
- package/dist/events/session-sse-subscriber.cjs +167 -0
- package/dist/events/session-sse-subscriber.d.ts +13 -0
- package/dist/events/session-sse-subscriber.d.ts.map +1 -0
- package/dist/events/session-sse-subscriber.js +143 -0
- package/dist/hono/__tests__/test-fixtures.cjs +8 -0
- package/dist/hono/__tests__/test-fixtures.d.ts +1 -0
- package/dist/hono/__tests__/test-fixtures.d.ts.map +1 -1
- package/dist/hono/__tests__/test-fixtures.js +8 -0
- package/dist/hono/index.cjs +2 -1
- package/dist/hono/index.d.ts +2 -0
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +2 -1
- package/dist/hono/node/index.cjs +51 -6
- package/dist/hono/node/index.d.ts.map +1 -1
- package/dist/hono/node/index.js +51 -6
- package/dist/hono/routes/llm.cjs +1 -1
- package/dist/hono/routes/llm.d.ts +110 -110
- package/dist/hono/routes/llm.d.ts.map +1 -1
- package/dist/hono/routes/llm.js +1 -1
- package/dist/hono/routes/messages.cjs +43 -53
- package/dist/hono/routes/messages.d.ts +1 -2
- package/dist/hono/routes/messages.d.ts.map +1 -1
- package/dist/hono/routes/messages.js +43 -53
- package/dist/hono/routes/models.d.ts +5 -5
- package/dist/hono/routes/prompts.d.ts +50 -50
- package/dist/hono/routes/queue.d.ts +106 -12
- package/dist/hono/routes/queue.d.ts.map +1 -1
- package/dist/hono/routes/resources.d.ts +5 -5
- package/dist/hono/routes/search.d.ts +297 -43
- package/dist/hono/routes/search.d.ts.map +1 -1
- package/dist/hono/routes/sessions.cjs +93 -2
- package/dist/hono/routes/sessions.d.ts +1736 -93
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +95 -3
- package/dist/hono/routes/tools.d.ts +5 -5
- package/dist/hono/schemas/responses.cjs +59 -3
- package/dist/hono/schemas/responses.d.ts +648 -87
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/schemas/responses.js +59 -4
- package/dist/hono/start-server.cjs +9 -0
- package/dist/hono/start-server.d.ts.map +1 -1
- package/dist/hono/start-server.js +9 -0
- package/dist/index.cjs +5 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/package.json +7 -7
|
@@ -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;AAGpF,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;KAClF,GAAG,IAAI,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,MAAM,EAAE,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.js
CHANGED
|
@@ -5,6 +5,12 @@ function createNodeServer(app, options) {
|
|
|
5
5
|
const { getAgent: _getAgent } = options;
|
|
6
6
|
const webhookSubscriber = app.webhookSubscriber;
|
|
7
7
|
const server = createServer(async (req, res) => {
|
|
8
|
+
const disconnectController = new AbortController();
|
|
9
|
+
const abortOnDisconnect = () => {
|
|
10
|
+
disconnectController.abort();
|
|
11
|
+
};
|
|
12
|
+
req.on("aborted", abortOnDisconnect);
|
|
13
|
+
res.on("close", abortOnDisconnect);
|
|
8
14
|
try {
|
|
9
15
|
if (options.mcpHandlers && req.url?.startsWith("/mcp")) {
|
|
10
16
|
if (req.method === "GET") {
|
|
@@ -41,14 +47,17 @@ function createNodeServer(app, options) {
|
|
|
41
47
|
return;
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
|
-
const request = await toRequest(req);
|
|
50
|
+
const request = await toRequest(req, disconnectController.signal);
|
|
45
51
|
const response = await app.fetch(request);
|
|
46
|
-
await sendNodeResponse(res, response);
|
|
52
|
+
await sendNodeResponse(res, response, disconnectController.signal);
|
|
47
53
|
} catch (error) {
|
|
48
54
|
const message = error instanceof Error ? error.message : String(error);
|
|
49
55
|
logger.error(`Unhandled error in Node bridge: ${message}`, { error });
|
|
50
56
|
res.statusCode = 500;
|
|
51
57
|
res.end("Internal Server Error");
|
|
58
|
+
} finally {
|
|
59
|
+
req.off("aborted", abortOnDisconnect);
|
|
60
|
+
res.off("close", abortOnDisconnect);
|
|
52
61
|
}
|
|
53
62
|
});
|
|
54
63
|
server.on("close", () => {
|
|
@@ -68,7 +77,7 @@ function createNodeServer(app, options) {
|
|
|
68
77
|
}
|
|
69
78
|
return result;
|
|
70
79
|
}
|
|
71
|
-
async function toRequest(req) {
|
|
80
|
+
async function toRequest(req, signal) {
|
|
72
81
|
const protocol = req.socket?.encrypted ? "https" : "http";
|
|
73
82
|
const host = req.headers.host ?? "localhost";
|
|
74
83
|
const url = new URL(req.url ?? "/", `${protocol}://${host}`);
|
|
@@ -87,10 +96,11 @@ async function toRequest(req) {
|
|
|
87
96
|
method,
|
|
88
97
|
headers,
|
|
89
98
|
body: body ?? void 0,
|
|
99
|
+
signal,
|
|
90
100
|
duplex: body ? "half" : void 0
|
|
91
101
|
});
|
|
92
102
|
}
|
|
93
|
-
async function sendNodeResponse(res, response) {
|
|
103
|
+
async function sendNodeResponse(res, response, signal) {
|
|
94
104
|
res.statusCode = response.status;
|
|
95
105
|
response.headers.forEach((value, key) => {
|
|
96
106
|
if (key.toLowerCase() === "content-length") {
|
|
@@ -105,8 +115,43 @@ async function sendNodeResponse(res, response) {
|
|
|
105
115
|
const webStream = response.body;
|
|
106
116
|
const readable = Readable.fromWeb(webStream);
|
|
107
117
|
await new Promise((resolve, reject) => {
|
|
108
|
-
|
|
109
|
-
|
|
118
|
+
let settled = false;
|
|
119
|
+
const settle = (callback) => {
|
|
120
|
+
if (settled) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
settled = true;
|
|
124
|
+
cleanup();
|
|
125
|
+
callback();
|
|
126
|
+
};
|
|
127
|
+
const cleanup = () => {
|
|
128
|
+
readable.off("error", handleError);
|
|
129
|
+
readable.off("close", handleReadableClose);
|
|
130
|
+
res.off("finish", handleFinish);
|
|
131
|
+
res.off("close", handleClose);
|
|
132
|
+
signal.removeEventListener("abort", handleAbort);
|
|
133
|
+
};
|
|
134
|
+
const handleError = (error) => {
|
|
135
|
+
settle(() => reject(error));
|
|
136
|
+
};
|
|
137
|
+
const handleReadableClose = () => {
|
|
138
|
+
settle(resolve);
|
|
139
|
+
};
|
|
140
|
+
const handleFinish = () => {
|
|
141
|
+
settle(resolve);
|
|
142
|
+
};
|
|
143
|
+
const handleAbort = () => {
|
|
144
|
+
readable.destroy();
|
|
145
|
+
};
|
|
146
|
+
const handleClose = () => {
|
|
147
|
+
readable.destroy();
|
|
148
|
+
settle(resolve);
|
|
149
|
+
};
|
|
150
|
+
readable.on("error", handleError);
|
|
151
|
+
readable.on("close", handleReadableClose);
|
|
152
|
+
res.on("finish", handleFinish);
|
|
153
|
+
res.on("close", handleClose);
|
|
154
|
+
signal.addEventListener("abort", handleAbort, { once: true });
|
|
110
155
|
readable.pipe(res);
|
|
111
156
|
});
|
|
112
157
|
}
|
package/dist/hono/routes/llm.cjs
CHANGED
|
@@ -43,7 +43,7 @@ const CatalogQuerySchema = import_zod_openapi.z.object({
|
|
|
43
43
|
hasKey: import_zod_openapi.z.union([import_zod_openapi.z.literal("true"), import_zod_openapi.z.literal("false"), import_zod_openapi.z.literal("1"), import_zod_openapi.z.literal("0")]).optional().transform(
|
|
44
44
|
(raw) => raw === "true" || raw === "1" ? true : raw === "false" || raw === "0" ? false : void 0
|
|
45
45
|
).describe("Filter by API key presence (true or false)"),
|
|
46
|
-
fileType: import_zod_openapi.z.enum(import_core2.SUPPORTED_FILE_TYPES).optional().describe("Filter by supported file type (audio, pdf, or
|
|
46
|
+
fileType: import_zod_openapi.z.enum(import_core2.SUPPORTED_FILE_TYPES).optional().describe("Filter by supported file type (audio, pdf, image, video, or document)"),
|
|
47
47
|
defaultOnly: import_zod_openapi.z.union([import_zod_openapi.z.literal("true"), import_zod_openapi.z.literal("false"), import_zod_openapi.z.literal("1"), import_zod_openapi.z.literal("0")]).optional().transform(
|
|
48
48
|
(raw) => raw === "true" || raw === "1" ? true : raw === "false" || raw === "0" ? false : void 0
|
|
49
49
|
).describe("Include only default models (true or false)"),
|