@copilotkit/runtime 1.50.1 → 1.51.0-next.1
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 +16 -21
- package/LICENSE +21 -0
- package/dist/index.d.ts +10 -24
- package/dist/index.js +44 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -10
- package/src/lib/integrations/node-http/index.ts +26 -94
- package/src/lib/integrations/node-http/request-handler.ts +111 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @copilotkit/runtime
|
|
2
2
|
|
|
3
|
+
## 1.51.0-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @copilotkit/shared@1.51.0-next.1
|
|
8
|
+
- @copilotkitnext/agent@1.51.0-next.1
|
|
9
|
+
- @copilotkitnext/runtime@1.51.0-next.1
|
|
10
|
+
|
|
11
|
+
## 1.50.2-next.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- cf245a6: fix: restore and fix handle method in node http
|
|
16
|
+
- cf245a6: fix: use direct hono node integration on node-http integration
|
|
17
|
+
- @copilotkit/shared@1.50.2-next.0
|
|
18
|
+
|
|
3
19
|
## 1.50.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -515,7 +531,6 @@
|
|
|
515
531
|
### Patch Changes
|
|
516
532
|
|
|
517
533
|
- 1abcecf: - fix: add graphqlContext to constructAGUIRemoteAction for enhanced agent properties
|
|
518
|
-
|
|
519
534
|
- Updated constructAGUIRemoteAction to accept graphqlContext, allowing forwarding of properties like Authorization token to the agent.
|
|
520
535
|
- Modified setupRemoteActions to include graphqlContext in the parameters.
|
|
521
536
|
|
|
@@ -617,7 +632,6 @@
|
|
|
617
632
|
### Patch Changes
|
|
618
633
|
|
|
619
634
|
- 1abcecf: - fix: add graphqlContext to constructAGUIRemoteAction for enhanced agent properties
|
|
620
|
-
|
|
621
635
|
- Updated constructAGUIRemoteAction to accept graphqlContext, allowing forwarding of properties like Authorization token to the agent.
|
|
622
636
|
- Modified setupRemoteActions to include graphqlContext in the parameters.
|
|
623
637
|
- @copilotkit/shared@1.10.0-next.1
|
|
@@ -685,7 +699,6 @@
|
|
|
685
699
|
- remove request logging
|
|
686
700
|
- 3a7f45f: - fix: resolve agui agents only after all other endpoints
|
|
687
701
|
- fac89c2: - refactor: rename onTrace to onError throughout codebase
|
|
688
|
-
|
|
689
702
|
- Rename CopilotTraceEvent to CopilotErrorEvent and CopilotTraceHandler to CopilotErrorHandler
|
|
690
703
|
|
|
691
704
|
- 7ca7023: - feat: send node name to agui agent
|
|
@@ -786,7 +799,6 @@
|
|
|
786
799
|
### Patch Changes
|
|
787
800
|
|
|
788
801
|
- fac89c2: - refactor: rename onTrace to onError throughout codebase
|
|
789
|
-
|
|
790
802
|
- Rename CopilotTraceEvent to CopilotErrorEvent and CopilotTraceHandler to CopilotErrorHandler
|
|
791
803
|
|
|
792
804
|
- Updated dependencies [fac89c2]
|
|
@@ -1268,11 +1280,9 @@
|
|
|
1268
1280
|
- c0d3261: - full AWP support
|
|
1269
1281
|
|
|
1270
1282
|
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
|
|
1271
|
-
|
|
1272
1283
|
- refactor: address linter issues with the new pages
|
|
1273
1284
|
|
|
1274
1285
|
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
|
|
1275
|
-
|
|
1276
1286
|
- Merge branch 'mme/acp' into mme/mastra
|
|
1277
1287
|
- add sse example
|
|
1278
1288
|
- Create small-turkeys-agree.md
|
|
@@ -1289,17 +1299,14 @@
|
|
|
1289
1299
|
- 77a7457: - feat: Add Model Context Protocol (MCP) support
|
|
1290
1300
|
- 76d9ef9: - fix: handle langgraph client specific errors when running lgc stream
|
|
1291
1301
|
- c0d3261: - add AWP support
|
|
1292
|
-
|
|
1293
1302
|
- make it work
|
|
1294
1303
|
- update docs
|
|
1295
1304
|
- refactor: move UI files to be normal NextJS pages and update generation
|
|
1296
1305
|
|
|
1297
1306
|
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
|
|
1298
|
-
|
|
1299
1307
|
- refactor: address linter issues with the new pages
|
|
1300
1308
|
|
|
1301
1309
|
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
|
|
1302
|
-
|
|
1303
1310
|
- Merge branch 'mme/acp' into mme/mastra
|
|
1304
1311
|
- add sse example
|
|
1305
1312
|
|
|
@@ -1313,11 +1320,9 @@
|
|
|
1313
1320
|
- c0d3261: - full AWP support
|
|
1314
1321
|
|
|
1315
1322
|
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
|
|
1316
|
-
|
|
1317
1323
|
- refactor: address linter issues with the new pages
|
|
1318
1324
|
|
|
1319
1325
|
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
|
|
1320
|
-
|
|
1321
1326
|
- Merge branch 'mme/acp' into mme/mastra
|
|
1322
1327
|
- add sse example
|
|
1323
1328
|
- Create small-turkeys-agree.md
|
|
@@ -1332,17 +1337,14 @@
|
|
|
1332
1337
|
- fix missing tool call ids
|
|
1333
1338
|
|
|
1334
1339
|
- c0d3261: - add AWP support
|
|
1335
|
-
|
|
1336
1340
|
- make it work
|
|
1337
1341
|
- update docs
|
|
1338
1342
|
- refactor: move UI files to be normal NextJS pages and update generation
|
|
1339
1343
|
|
|
1340
1344
|
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
|
|
1341
|
-
|
|
1342
1345
|
- refactor: address linter issues with the new pages
|
|
1343
1346
|
|
|
1344
1347
|
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
|
|
1345
|
-
|
|
1346
1348
|
- Merge branch 'mme/acp' into mme/mastra
|
|
1347
1349
|
- add sse example
|
|
1348
1350
|
- @copilotkit/shared@1.8.5-next.5
|
|
@@ -2347,7 +2349,6 @@
|
|
|
2347
2349
|
- e16d95e: New prerelease
|
|
2348
2350
|
- 1721cbd: Add convertActionsToDynamicStructuredTools to sdk-js
|
|
2349
2351
|
- CopilotKit Core:
|
|
2350
|
-
|
|
2351
2352
|
- Improved error messages and overall logs
|
|
2352
2353
|
- `useCopilotAction.renderAndAwait` renamed to `.renderAndAwaitForResponse` (backwards compatible, will be deprecated in the future)
|
|
2353
2354
|
- Improved scrolling behavior. It is now possible to scroll up during LLM response generation
|
|
@@ -2355,7 +2356,6 @@
|
|
|
2355
2356
|
- Updated interfaces for better developer ergonomics
|
|
2356
2357
|
|
|
2357
2358
|
CoAgents:
|
|
2358
|
-
|
|
2359
2359
|
- Renamed `remoteActions` to `remoteEndpoints` (backwards compatible, will be deprecated in the future)
|
|
2360
2360
|
- Support for LangGraph Platform in Remote Endpoints
|
|
2361
2361
|
- LangGraph JS Support for CoAgents (locally via `langgraph dev`, `langgraph up` or deployed to LangGraph Platform)
|
|
@@ -2363,7 +2363,6 @@
|
|
|
2363
2363
|
- Enhanced state management and message handling
|
|
2364
2364
|
|
|
2365
2365
|
CopilotKid Back-end SDK:
|
|
2366
|
-
|
|
2367
2366
|
- Released a whole-new `@copilotkit/sdk-js` for building agents with LangGraph JS Support
|
|
2368
2367
|
|
|
2369
2368
|
- 8d0144f: bump
|
|
@@ -2710,7 +2709,6 @@ CopilotKid Back-end SDK:
|
|
|
2710
2709
|
### Patch Changes
|
|
2711
2710
|
|
|
2712
2711
|
- inject minified css in bundle
|
|
2713
|
-
|
|
2714
2712
|
- removes the need to import `styles.css` manually
|
|
2715
2713
|
- empty `styles.css` included in the build for backwards compatibility
|
|
2716
2714
|
- uses tsup's `injectStyles` with `postcss` to bundle and minify the CSS, then inject it as a style tag
|
|
@@ -2847,7 +2845,6 @@ CopilotKid Back-end SDK:
|
|
|
2847
2845
|
### Major Changes
|
|
2848
2846
|
|
|
2849
2847
|
- b6a4b6eb: V1.0 Release Candidate
|
|
2850
|
-
|
|
2851
2848
|
- A robust new protocol between the frontend and the Copilot Runtime
|
|
2852
2849
|
- Support for Copilot Cloud
|
|
2853
2850
|
- Generative UI
|
|
@@ -2855,7 +2852,6 @@ CopilotKid Back-end SDK:
|
|
|
2855
2852
|
- OpenAI assistant API streaming
|
|
2856
2853
|
|
|
2857
2854
|
- V1.0 Release
|
|
2858
|
-
|
|
2859
2855
|
- A robust new protocol between the frontend and the Copilot Runtime
|
|
2860
2856
|
- Support for Copilot Cloud
|
|
2861
2857
|
- Generative UI
|
|
@@ -2893,7 +2889,6 @@ CopilotKid Back-end SDK:
|
|
|
2893
2889
|
### Major Changes
|
|
2894
2890
|
|
|
2895
2891
|
- V1.0 Release Candidate
|
|
2896
|
-
|
|
2897
2892
|
- A robust new protocol between the frontend and the Copilot Runtime
|
|
2898
2893
|
- Support for Copilot Cloud
|
|
2899
2894
|
- Generative UI
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Atai Barkai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/dist/index.d.ts
CHANGED
|
@@ -7,13 +7,13 @@ import { IterableReadableStream, IterableReadableStreamInterface } from '@langch
|
|
|
7
7
|
import { Groq } from 'groq-sdk';
|
|
8
8
|
import Anthropic from '@anthropic-ai/sdk';
|
|
9
9
|
import * as graphql from 'graphql';
|
|
10
|
-
import * as
|
|
10
|
+
import * as createPinoLogger from 'pino';
|
|
11
|
+
import createPinoLogger__default from 'pino';
|
|
11
12
|
import { YogaInitialContext, createYoga } from 'graphql-yoga';
|
|
12
13
|
import { CopilotRuntimeOptions, CopilotRuntime as CopilotRuntime$1, AgentRunner } from '@copilotkitnext/runtime';
|
|
13
14
|
import { AbstractAgent } from '@ag-ui/client';
|
|
14
15
|
import * as http from 'http';
|
|
15
|
-
import {
|
|
16
|
-
import { Readable } from 'node:stream';
|
|
16
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
17
17
|
|
|
18
18
|
declare enum MessageRole {
|
|
19
19
|
assistant = "assistant",
|
|
@@ -1302,9 +1302,9 @@ type CopilotRuntimeLogger = ReturnType<typeof createLogger>;
|
|
|
1302
1302
|
declare function createLogger(options?: {
|
|
1303
1303
|
level?: LogLevel;
|
|
1304
1304
|
component?: string;
|
|
1305
|
-
}):
|
|
1305
|
+
}): createPinoLogger__default.Logger<never, boolean>;
|
|
1306
1306
|
|
|
1307
|
-
declare const logger:
|
|
1307
|
+
declare const logger: createPinoLogger.Logger<never, boolean>;
|
|
1308
1308
|
declare const addCustomHeaderPlugin: {
|
|
1309
1309
|
onResponse({ response }: {
|
|
1310
1310
|
response: any;
|
|
@@ -1351,27 +1351,13 @@ declare const config: {
|
|
|
1351
1351
|
};
|
|
1352
1352
|
};
|
|
1353
1353
|
|
|
1354
|
-
declare function copilotRuntimeNextJSPagesRouterEndpoint(options: CreateCopilotRuntimeServerOptions): (
|
|
1355
|
-
body?: unknown;
|
|
1356
|
-
complete?: boolean;
|
|
1357
|
-
}, res: http.ServerResponse) => Promise<void>;
|
|
1354
|
+
declare function copilotRuntimeNextJSPagesRouterEndpoint(options: CreateCopilotRuntimeServerOptions): (reqOrRequest: http.IncomingMessage | Request, res?: http.ServerResponse) => Promise<void> | Promise<Response> | Response;
|
|
1358
1355
|
|
|
1359
|
-
|
|
1360
|
-
body?: unknown;
|
|
1361
|
-
complete?: boolean;
|
|
1362
|
-
};
|
|
1363
|
-
declare function readableStreamToNodeStream(webStream: ReadableStream): Readable;
|
|
1364
|
-
declare function copilotRuntimeNodeHttpEndpoint(options: CreateCopilotRuntimeServerOptions): (req: IncomingWithBody, res: ServerResponse) => Promise<void>;
|
|
1356
|
+
declare function copilotRuntimeNodeHttpEndpoint(options: CreateCopilotRuntimeServerOptions): (reqOrRequest: IncomingMessage | Request, res?: ServerResponse) => Promise<void> | Promise<Response> | Response;
|
|
1365
1357
|
|
|
1366
|
-
declare function copilotRuntimeNodeExpressEndpoint(options: CreateCopilotRuntimeServerOptions): (
|
|
1367
|
-
body?: unknown;
|
|
1368
|
-
complete?: boolean;
|
|
1369
|
-
}, res: http.ServerResponse) => Promise<void>;
|
|
1358
|
+
declare function copilotRuntimeNodeExpressEndpoint(options: CreateCopilotRuntimeServerOptions): (reqOrRequest: http.IncomingMessage | Request, res?: http.ServerResponse) => Promise<void> | Promise<Response> | Response;
|
|
1370
1359
|
|
|
1371
|
-
declare function copilotRuntimeNestEndpoint(options: CreateCopilotRuntimeServerOptions): (
|
|
1372
|
-
body?: unknown;
|
|
1373
|
-
complete?: boolean;
|
|
1374
|
-
}, res: http.ServerResponse) => Promise<void>;
|
|
1360
|
+
declare function copilotRuntimeNestEndpoint(options: CreateCopilotRuntimeServerOptions): (reqOrRequest: http.IncomingMessage | Request, res?: http.ServerResponse) => Promise<void> | Promise<Response> | Response;
|
|
1375
1361
|
|
|
1376
1362
|
/**
|
|
1377
1363
|
* TelemetryAgentRunner - A wrapper around AgentRunner that adds telemetry
|
|
@@ -1506,4 +1492,4 @@ declare class UnknownErrorResponse extends FailedResponseStatus {
|
|
|
1506
1492
|
});
|
|
1507
1493
|
}
|
|
1508
1494
|
|
|
1509
|
-
export { AnthropicAdapter, AnthropicAdapterParams, AnthropicPromptCachingConfig, BedrockAdapter, BedrockAdapterParams, CommonConfig, CopilotRequestContextProperties, CopilotRuntime, CopilotRuntimeChatCompletionRequest, CopilotRuntimeChatCompletionResponse, CopilotRuntimeConstructorParams_BASE, CopilotRuntimeLogger, CopilotServiceAdapter, CreateCopilotRuntimeServerOptions, CustomEventNames, EmptyAdapter, ExperimentalEmptyAdapter, ExperimentalOllamaAdapter, GoogleGenerativeAIAdapter, GraphQLContext, GroqAdapter, GroqAdapterParams, GuardrailsValidationFailureResponse, LangChainAdapter, LangGraphAgent, LangGraphHttpAgent, LogLevel, MCPClient, MCPEndpointConfig, MCPTool, MessageStreamInterruptedResponse, OpenAIAdapter, OpenAIAdapterParams, OpenAIAssistantAdapter, OpenAIAssistantAdapterParams, PredictStateTool, RemoteChain, RemoteChainParameters, TelemetryAgentRunner, TelemetryAgentRunnerConfig, TextMessageEvents, ToolCallEvents, UnifyAdapter, UnifyAdapterParams, UnknownErrorResponse, addCustomHeaderPlugin, buildSchema, config, convertMCPToolsToActions, convertServiceAdapterError, copilotKitEndpoint, copilotRuntimeNestEndpoint, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint, copilotRuntimeNodeExpressEndpoint, copilotRuntimeNodeHttpEndpoint, createContext, createLogger, extractParametersFromSchema, generateMcpToolInstructions, getCommonConfig, langGraphPlatformEndpoint,
|
|
1495
|
+
export { AnthropicAdapter, AnthropicAdapterParams, AnthropicPromptCachingConfig, BedrockAdapter, BedrockAdapterParams, CommonConfig, CopilotRequestContextProperties, CopilotRuntime, CopilotRuntimeChatCompletionRequest, CopilotRuntimeChatCompletionResponse, CopilotRuntimeConstructorParams_BASE, CopilotRuntimeLogger, CopilotServiceAdapter, CreateCopilotRuntimeServerOptions, CustomEventNames, EmptyAdapter, ExperimentalEmptyAdapter, ExperimentalOllamaAdapter, GoogleGenerativeAIAdapter, GraphQLContext, GroqAdapter, GroqAdapterParams, GuardrailsValidationFailureResponse, LangChainAdapter, LangGraphAgent, LangGraphHttpAgent, LogLevel, MCPClient, MCPEndpointConfig, MCPTool, MessageStreamInterruptedResponse, OpenAIAdapter, OpenAIAdapterParams, OpenAIAssistantAdapter, OpenAIAssistantAdapterParams, PredictStateTool, RemoteChain, RemoteChainParameters, TelemetryAgentRunner, TelemetryAgentRunnerConfig, TextMessageEvents, ToolCallEvents, UnifyAdapter, UnifyAdapterParams, UnknownErrorResponse, addCustomHeaderPlugin, buildSchema, config, convertMCPToolsToActions, convertServiceAdapterError, copilotKitEndpoint, copilotRuntimeNestEndpoint, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint, copilotRuntimeNodeExpressEndpoint, copilotRuntimeNodeHttpEndpoint, createContext, createLogger, extractParametersFromSchema, generateMcpToolInstructions, getCommonConfig, langGraphPlatformEndpoint, resolveEndpointType };
|
package/dist/index.js
CHANGED
|
@@ -72,7 +72,7 @@ var require_package = __commonJS({
|
|
|
72
72
|
publishConfig: {
|
|
73
73
|
access: "public"
|
|
74
74
|
},
|
|
75
|
-
version: "1.
|
|
75
|
+
version: "1.51.0-next.1",
|
|
76
76
|
sideEffects: false,
|
|
77
77
|
main: "./dist/index.js",
|
|
78
78
|
module: "./dist/index.mjs",
|
|
@@ -96,7 +96,7 @@ var require_package = __commonJS({
|
|
|
96
96
|
types: "./dist/index.d.ts",
|
|
97
97
|
license: "MIT",
|
|
98
98
|
scripts: {
|
|
99
|
-
build:
|
|
99
|
+
build: "pnpm run generate-graphql-schema && tsup",
|
|
100
100
|
dev: 'tsup --watch --onSuccess "pnpm run generate-graphql-schema"',
|
|
101
101
|
test: "jest --passWithNoTests",
|
|
102
102
|
"check-types": "tsc --noEmit",
|
|
@@ -106,6 +106,9 @@ var require_package = __commonJS({
|
|
|
106
106
|
"unlink:global": "pnpm unlink --global"
|
|
107
107
|
},
|
|
108
108
|
devDependencies: {
|
|
109
|
+
"@copilotkit/shared": "workspace:*",
|
|
110
|
+
"@copilotkitnext/agent": "workspace:*",
|
|
111
|
+
"@copilotkitnext/runtime": "workspace:*",
|
|
109
112
|
"@jest/globals": "^29.7.0",
|
|
110
113
|
"@swc/core": "1.5.28",
|
|
111
114
|
"@types/jest": "^29.5.12",
|
|
@@ -123,12 +126,6 @@ var require_package = __commonJS({
|
|
|
123
126
|
vitest: "^3.2.4"
|
|
124
127
|
},
|
|
125
128
|
dependencies: {
|
|
126
|
-
"@ag-ui/client": "^0.0.42",
|
|
127
|
-
"@ag-ui/core": "^0.0.42",
|
|
128
|
-
"@ag-ui/langgraph": "^0.0.20",
|
|
129
|
-
"@copilotkit/shared": "workspace:*",
|
|
130
|
-
"@copilotkitnext/agent": "0.0.33",
|
|
131
|
-
"@copilotkitnext/runtime": "0.0.33",
|
|
132
129
|
"@graphql-yoga/plugin-defer-stream": "^3.3.1",
|
|
133
130
|
"@hono/node-server": "^1.13.5",
|
|
134
131
|
"@scarf/scarf": "^1.3.0",
|
|
@@ -148,7 +145,13 @@ var require_package = __commonJS({
|
|
|
148
145
|
zod: "^3.23.3"
|
|
149
146
|
},
|
|
150
147
|
peerDependencies: {
|
|
148
|
+
"@ag-ui/client": "^0.0.42",
|
|
149
|
+
"@ag-ui/core": "^0.0.42",
|
|
150
|
+
"@ag-ui/langgraph": "^0.0.20",
|
|
151
151
|
"@anthropic-ai/sdk": "^0.57.0",
|
|
152
|
+
"@copilotkit/shared": "workspace:*",
|
|
153
|
+
"@copilotkitnext/agent": "workspace:*",
|
|
154
|
+
"@copilotkitnext/runtime": "workspace:*",
|
|
152
155
|
"@langchain/aws": ">=0.1.9",
|
|
153
156
|
"@langchain/core": ">=0.3.66",
|
|
154
157
|
"@langchain/community": ">=0.3.58",
|
|
@@ -4755,9 +4758,27 @@ function readableStreamToNodeStream(webStream) {
|
|
|
4755
4758
|
});
|
|
4756
4759
|
}
|
|
4757
4760
|
__name(readableStreamToNodeStream, "readableStreamToNodeStream");
|
|
4761
|
+
function nodeStreamToReadableStream(nodeStream) {
|
|
4762
|
+
return new ReadableStream({
|
|
4763
|
+
start(controller) {
|
|
4764
|
+
nodeStream.on("data", (chunk) => {
|
|
4765
|
+
controller.enqueue(chunk instanceof Buffer ? new Uint8Array(chunk) : chunk);
|
|
4766
|
+
});
|
|
4767
|
+
nodeStream.on("end", () => {
|
|
4768
|
+
controller.close();
|
|
4769
|
+
});
|
|
4770
|
+
nodeStream.on("error", (err) => {
|
|
4771
|
+
controller.error(err);
|
|
4772
|
+
});
|
|
4773
|
+
},
|
|
4774
|
+
cancel() {
|
|
4775
|
+
nodeStream.destroy();
|
|
4776
|
+
}
|
|
4777
|
+
});
|
|
4778
|
+
}
|
|
4779
|
+
__name(nodeStreamToReadableStream, "nodeStreamToReadableStream");
|
|
4758
4780
|
function getFullUrl(req) {
|
|
4759
|
-
const
|
|
4760
|
-
const path = expressPath || req.url || "/";
|
|
4781
|
+
const path = req.url || "/";
|
|
4761
4782
|
const host = req.headers["x-forwarded-host"] || req.headers.host || "localhost";
|
|
4762
4783
|
const proto = req.headers["x-forwarded-proto"] || (req.socket.encrypted ? "https" : "http");
|
|
4763
4784
|
return `${proto}://${host}${path}`;
|
|
@@ -4809,6 +4830,8 @@ function isDisturbedOrLockedError(error) {
|
|
|
4809
4830
|
return error instanceof TypeError && typeof error.message === "string" && (error.message.includes("disturbed") || error.message.includes("locked"));
|
|
4810
4831
|
}
|
|
4811
4832
|
__name(isDisturbedOrLockedError, "isDisturbedOrLockedError");
|
|
4833
|
+
|
|
4834
|
+
// src/lib/integrations/node-http/index.ts
|
|
4812
4835
|
function copilotRuntimeNodeHttpEndpoint(options) {
|
|
4813
4836
|
var _a;
|
|
4814
4837
|
const commonConfig = getCommonConfig(options);
|
|
@@ -4833,7 +4856,7 @@ function copilotRuntimeNodeHttpEndpoint(options) {
|
|
|
4833
4856
|
runtime: options.runtime.instance,
|
|
4834
4857
|
basePath: options.baseUrl ?? options.endpoint
|
|
4835
4858
|
});
|
|
4836
|
-
|
|
4859
|
+
const handle2 = /* @__PURE__ */ __name(async function handler(req, res) {
|
|
4837
4860
|
const url = getFullUrl(req);
|
|
4838
4861
|
const hasBody = req.method !== "GET" && req.method !== "HEAD";
|
|
4839
4862
|
const baseHeaders = toHeaders(req.headers);
|
|
@@ -4843,7 +4866,7 @@ function copilotRuntimeNodeHttpEndpoint(options) {
|
|
|
4843
4866
|
let requestBody = void 0;
|
|
4844
4867
|
let useDuplex = false;
|
|
4845
4868
|
if (hasBody && canStream) {
|
|
4846
|
-
requestBody = req;
|
|
4869
|
+
requestBody = nodeStreamToReadableStream(req);
|
|
4847
4870
|
useDuplex = true;
|
|
4848
4871
|
}
|
|
4849
4872
|
if (hasBody && streamConsumed) {
|
|
@@ -4899,6 +4922,15 @@ function copilotRuntimeNodeHttpEndpoint(options) {
|
|
|
4899
4922
|
res.end();
|
|
4900
4923
|
}
|
|
4901
4924
|
}, "handler");
|
|
4925
|
+
return function(reqOrRequest, res) {
|
|
4926
|
+
if (reqOrRequest instanceof Request) {
|
|
4927
|
+
return honoApp.fetch(reqOrRequest);
|
|
4928
|
+
}
|
|
4929
|
+
if (!res) {
|
|
4930
|
+
throw new TypeError("ServerResponse is required for Node HTTP requests");
|
|
4931
|
+
}
|
|
4932
|
+
return handle2(reqOrRequest, res);
|
|
4933
|
+
};
|
|
4902
4934
|
}
|
|
4903
4935
|
__name(copilotRuntimeNodeHttpEndpoint, "copilotRuntimeNodeHttpEndpoint");
|
|
4904
4936
|
|
|
@@ -5607,7 +5639,6 @@ exports.extractParametersFromSchema = extractParametersFromSchema;
|
|
|
5607
5639
|
exports.generateMcpToolInstructions = generateMcpToolInstructions;
|
|
5608
5640
|
exports.getCommonConfig = getCommonConfig;
|
|
5609
5641
|
exports.langGraphPlatformEndpoint = langGraphPlatformEndpoint;
|
|
5610
|
-
exports.readableStreamToNodeStream = readableStreamToNodeStream;
|
|
5611
5642
|
exports.resolveEndpointType = resolveEndpointType;
|
|
5612
5643
|
//# sourceMappingURL=out.js.map
|
|
5613
5644
|
//# sourceMappingURL=index.js.map
|