@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.
@@ -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.writeSSE({ data: "connected", event: "comment" });
565
+ await stream.write(": connected\n\n");
565
566
  const pingInterval = setInterval(async () => {
566
567
  try {
567
- await stream.writeSSE({ data: "ping", event: "comment" });
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
- await stream.sleep(Number.MAX_SAFE_INTEGER);
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) => {