@copilotkit/runtime 1.51.2-next.1 → 1.51.3-next.0
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/CHANGELOG.md +22 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/lib/integrations/nextjs/app-router.ts +3 -1
- package/src/lib/integrations/node-http/index.ts +3 -1
- package/src/lib/integrations/shared.ts +20 -0
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.51.
|
|
12
|
+
"version": "1.51.3-next.0",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"graphql": "^16.8.1",
|
|
62
62
|
"graphql-scalars": "^1.23.0",
|
|
63
63
|
"graphql-yoga": "^5.3.1",
|
|
64
|
-
"hono": "^4.
|
|
64
|
+
"hono": "^4.11.4",
|
|
65
65
|
"openai": "^4.85.1",
|
|
66
66
|
"partial-json": "^0.1.7",
|
|
67
67
|
"pino": "^9.2.0",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"rxjs": "7.8.1",
|
|
71
71
|
"type-graphql": "2.0.0-rc.1",
|
|
72
72
|
"zod": "^3.23.3",
|
|
73
|
-
"@copilotkit/shared": "1.51.
|
|
74
|
-
"@copilotkitnext/agent": "1.51.
|
|
75
|
-
"@copilotkitnext/runtime": "1.51.
|
|
73
|
+
"@copilotkit/shared": "1.51.3-next.0",
|
|
74
|
+
"@copilotkitnext/agent": "1.51.3-next.0",
|
|
75
|
+
"@copilotkitnext/runtime": "1.51.3-next.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@anthropic-ai/sdk": "^0.57.0",
|
|
@@ -85,9 +85,9 @@
|
|
|
85
85
|
"groq-sdk": ">=0.3.0 <1.0.0",
|
|
86
86
|
"langchain": ">=0.3.3",
|
|
87
87
|
"openai": "^4.85.1",
|
|
88
|
-
"@copilotkit/shared": "1.51.
|
|
89
|
-
"@copilotkitnext/agent": "1.51.
|
|
90
|
-
"@copilotkitnext/runtime": "1.51.
|
|
88
|
+
"@copilotkit/shared": "1.51.3-next.0",
|
|
89
|
+
"@copilotkitnext/agent": "1.51.3-next.0",
|
|
90
|
+
"@copilotkitnext/runtime": "1.51.3-next.0"
|
|
91
91
|
},
|
|
92
92
|
"peerDependenciesMeta": {
|
|
93
93
|
"@anthropic-ai/sdk": {
|
|
@@ -28,10 +28,12 @@ export function copilotRuntimeNextJSAppRouterEndpoint(options: CreateCopilotRunt
|
|
|
28
28
|
options.runtime.handleServiceAdapter(serviceAdapter);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
// Note: cors option requires @copilotkitnext/runtime with credentials support
|
|
31
32
|
const copilotRoute = createCopilotEndpointSingleRoute({
|
|
32
33
|
runtime: options.runtime.instance,
|
|
33
34
|
basePath: options.baseUrl ?? options.endpoint,
|
|
34
|
-
|
|
35
|
+
...(options.cors && { cors: options.cors }),
|
|
36
|
+
} as any);
|
|
35
37
|
|
|
36
38
|
const handleRequest = handle(copilotRoute as any);
|
|
37
39
|
return { handleRequest };
|
|
@@ -38,10 +38,12 @@ export function copilotRuntimeNodeHttpEndpoint(options: CreateCopilotRuntimeServ
|
|
|
38
38
|
options.runtime.handleServiceAdapter(serviceAdapter);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
// Note: cors option requires @copilotkitnext/runtime with credentials support
|
|
41
42
|
const honoApp = createCopilotEndpointSingleRoute({
|
|
42
43
|
runtime: options.runtime.instance,
|
|
43
44
|
basePath: options.baseUrl ?? options.endpoint,
|
|
44
|
-
|
|
45
|
+
...(options.cors && { cors: options.cors }),
|
|
46
|
+
} as any);
|
|
45
47
|
|
|
46
48
|
const handle = async function handler(req: IncomingWithBody, res: ServerResponse) {
|
|
47
49
|
const url = getFullUrl(req);
|
|
@@ -12,6 +12,21 @@ import { StateResolver } from "../../graphql/resolvers/state.resolver";
|
|
|
12
12
|
import * as packageJson from "../../../package.json";
|
|
13
13
|
import { CopilotKitError, CopilotKitErrorCode } from "@copilotkit/shared";
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* CORS configuration for CopilotKit endpoints.
|
|
17
|
+
*/
|
|
18
|
+
export interface CopilotEndpointCorsConfig {
|
|
19
|
+
/**
|
|
20
|
+
* Allowed origin(s). Can be a string, array of strings, or a function that returns the origin.
|
|
21
|
+
*/
|
|
22
|
+
origin: string | string[] | ((origin: string, c: any) => string | undefined | null);
|
|
23
|
+
/**
|
|
24
|
+
* Whether to include credentials (cookies, authorization headers) in CORS requests.
|
|
25
|
+
* When true, origin cannot be "*" - must be an explicit origin.
|
|
26
|
+
*/
|
|
27
|
+
credentials?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
15
30
|
const logger = createLogger();
|
|
16
31
|
|
|
17
32
|
export const addCustomHeaderPlugin = {
|
|
@@ -41,6 +56,11 @@ export interface CreateCopilotRuntimeServerOptions {
|
|
|
41
56
|
cloud?: CopilotCloudOptions;
|
|
42
57
|
properties?: CopilotRequestContextProperties;
|
|
43
58
|
logLevel?: LogLevel;
|
|
59
|
+
/**
|
|
60
|
+
* Optional CORS configuration. When not provided, defaults to allowing all origins without credentials.
|
|
61
|
+
* To support HTTP-only cookies, provide cors config with credentials: true and explicit origin.
|
|
62
|
+
*/
|
|
63
|
+
cors?: CopilotEndpointCorsConfig;
|
|
44
64
|
}
|
|
45
65
|
|
|
46
66
|
export async function createContext(
|