@copilotkit/runtime 0.0.0-fix-restore-handle-method-node-http-20251222114321 → 0.0.0-fix-restore-handle-method-node-http-20260105204107

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/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "0.0.0-fix-restore-handle-method-node-http-20251222114321",
12
+ "version": "0.0.0-fix-restore-handle-method-node-http-20260105204107",
13
13
  "sideEffects": false,
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.mjs",
@@ -72,7 +72,7 @@
72
72
  "rxjs": "7.8.1",
73
73
  "type-graphql": "2.0.0-rc.1",
74
74
  "zod": "^3.23.3",
75
- "@copilotkit/shared": "0.0.0-fix-restore-handle-method-node-http-20251222114321"
75
+ "@copilotkit/shared": "0.0.0-fix-restore-handle-method-node-http-20260105204107"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@anthropic-ai/sdk": "^0.57.0",
@@ -1,6 +1,8 @@
1
1
  import { CreateCopilotRuntimeServerOptions, getCommonConfig } from "../shared";
2
2
  import telemetry, { getRuntimeInstanceTelemetryInfo } from "../../telemetry-client";
3
3
  import { createCopilotEndpointSingleRoute } from "@copilotkitnext/runtime";
4
+ import { getRequestListener } from "@hono/node-server";
5
+ import type { IncomingMessage, ServerResponse } from "node:http";
4
6
 
5
7
  export function copilotRuntimeNodeHttpEndpoint(options: CreateCopilotRuntimeServerOptions) {
6
8
  const commonConfig = getCommonConfig(options);
@@ -32,5 +34,18 @@ export function copilotRuntimeNodeHttpEndpoint(options: CreateCopilotRuntimeServ
32
34
  basePath: options.baseUrl ?? options.endpoint,
33
35
  });
34
36
 
35
- return honoApp.fetch;
37
+ const handle = getRequestListener(honoApp.fetch);
38
+
39
+ return function (
40
+ reqOrRequest: IncomingMessage | Request,
41
+ res?: ServerResponse,
42
+ ): Promise<void> | Promise<Response> | Response {
43
+ if (reqOrRequest instanceof Request) {
44
+ return honoApp.fetch(reqOrRequest as Request);
45
+ }
46
+ if (!res) {
47
+ throw new TypeError("ServerResponse is required for Node HTTP requests");
48
+ }
49
+ return handle(reqOrRequest as IncomingMessage, res);
50
+ };
36
51
  }