@redaksjon/protokoll 1.0.14 → 1.0.15-dev.20260218065403.154eebf
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/.transcript/weight-model.json +2 -2
- package/dist/configDiscovery.js +29 -11
- package/dist/configDiscovery.js.map +1 -1
- package/dist/mcp/server-hono.js +12 -4
- package/dist/mcp/server-hono.js.map +1 -1
- package/dist/mcp/server-http.js +1 -0
- package/dist/mcp/server-http.js.map +1 -1
- package/dist/mcp/server.js +1 -0
- package/dist/mcp/server.js.map +1 -1
- package/package.json +4 -4
package/dist/mcp/server-hono.js
CHANGED
|
@@ -21,6 +21,7 @@ import 'js-yaml';
|
|
|
21
21
|
import 'node:url';
|
|
22
22
|
import '@redaksjon/context';
|
|
23
23
|
import 'winston';
|
|
24
|
+
import 'crypto';
|
|
24
25
|
import '@utilarium/cardigantime';
|
|
25
26
|
|
|
26
27
|
const { findUploadedTranscripts, markTranscriptAsTranscribing, markTranscriptAsFailed } = Transcript;
|
|
@@ -302,7 +303,7 @@ function createMcpServer() {
|
|
|
302
303
|
const app = new Hono();
|
|
303
304
|
app.use("/mcp", cors({
|
|
304
305
|
origin: "*",
|
|
305
|
-
allowHeaders: ["Content-Type", "Mcp-Session-Id", "Mcp-Protocol-Version", "Last-Event-Id"],
|
|
306
|
+
allowHeaders: ["Content-Type", "Accept", "Mcp-Session-Id", "Mcp-Protocol-Version", "Last-Event-Id"],
|
|
306
307
|
exposeHeaders: ["Mcp-Session-Id", "Mcp-Protocol-Version"],
|
|
307
308
|
allowMethods: ["GET", "POST", "DELETE", "OPTIONS"]
|
|
308
309
|
}));
|
|
@@ -561,10 +562,10 @@ app.get("/mcp", async (c) => {
|
|
|
561
562
|
}
|
|
562
563
|
session.lastActivity = Date.now();
|
|
563
564
|
return streamSSE(c, async (stream) => {
|
|
564
|
-
await stream.
|
|
565
|
+
await stream.write(": connected\n\n");
|
|
565
566
|
const pingInterval = setInterval(async () => {
|
|
566
567
|
try {
|
|
567
|
-
await stream.
|
|
568
|
+
await stream.write(": ping\n\n");
|
|
568
569
|
} catch {
|
|
569
570
|
clearInterval(pingInterval);
|
|
570
571
|
}
|
|
@@ -573,7 +574,14 @@ app.get("/mcp", async (c) => {
|
|
|
573
574
|
clearInterval(pingInterval);
|
|
574
575
|
console.log(`SSE client disconnected from session ${sessionId}`);
|
|
575
576
|
});
|
|
576
|
-
|
|
577
|
+
let keepAlive = true;
|
|
578
|
+
while (keepAlive) {
|
|
579
|
+
try {
|
|
580
|
+
await stream.sleep(864e5);
|
|
581
|
+
} catch {
|
|
582
|
+
keepAlive = false;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
577
585
|
});
|
|
578
586
|
});
|
|
579
587
|
app.delete("/mcp", async (c) => {
|