@copilotkit/runtime 1.50.1-next.3 → 1.50.2-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 +17 -0
- package/dist/index.d.ts +6 -21
- package/dist/index.js +34 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- 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,22 @@
|
|
|
1
1
|
# @copilotkit/runtime
|
|
2
2
|
|
|
3
|
+
## 1.50.2-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cf245a6: fix: restore and fix handle method in node http
|
|
8
|
+
- cf245a6: fix: use direct hono node integration on node-http integration
|
|
9
|
+
- @copilotkit/shared@1.50.2-next.0
|
|
10
|
+
|
|
11
|
+
## 1.50.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 80dffec: Updated the default model and API version for the Google GenAI adapter
|
|
16
|
+
- eac8b20: - fix: use latest vnext
|
|
17
|
+
- Updated dependencies [80dffec]
|
|
18
|
+
- @copilotkit/shared@1.50.1
|
|
19
|
+
|
|
3
20
|
## 1.50.1-next.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -12,8 +12,7 @@ import { YogaInitialContext, createYoga } from 'graphql-yoga';
|
|
|
12
12
|
import { CopilotRuntimeOptions, CopilotRuntime as CopilotRuntime$1, AgentRunner } from '@copilotkitnext/runtime';
|
|
13
13
|
import { AbstractAgent } from '@ag-ui/client';
|
|
14
14
|
import * as http from 'http';
|
|
15
|
-
import {
|
|
16
|
-
import { Readable } from 'node:stream';
|
|
15
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
17
16
|
|
|
18
17
|
declare enum MessageRole {
|
|
19
18
|
assistant = "assistant",
|
|
@@ -1351,27 +1350,13 @@ declare const config: {
|
|
|
1351
1350
|
};
|
|
1352
1351
|
};
|
|
1353
1352
|
|
|
1354
|
-
declare function copilotRuntimeNextJSPagesRouterEndpoint(options: CreateCopilotRuntimeServerOptions): (
|
|
1355
|
-
body?: unknown;
|
|
1356
|
-
complete?: boolean;
|
|
1357
|
-
}, res: http.ServerResponse) => Promise<void>;
|
|
1353
|
+
declare function copilotRuntimeNextJSPagesRouterEndpoint(options: CreateCopilotRuntimeServerOptions): (reqOrRequest: http.IncomingMessage | Request, res?: http.ServerResponse) => Promise<void> | Promise<Response> | Response;
|
|
1358
1354
|
|
|
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>;
|
|
1355
|
+
declare function copilotRuntimeNodeHttpEndpoint(options: CreateCopilotRuntimeServerOptions): (reqOrRequest: IncomingMessage | Request, res?: ServerResponse) => Promise<void> | Promise<Response> | Response;
|
|
1365
1356
|
|
|
1366
|
-
declare function copilotRuntimeNodeExpressEndpoint(options: CreateCopilotRuntimeServerOptions): (
|
|
1367
|
-
body?: unknown;
|
|
1368
|
-
complete?: boolean;
|
|
1369
|
-
}, res: http.ServerResponse) => Promise<void>;
|
|
1357
|
+
declare function copilotRuntimeNodeExpressEndpoint(options: CreateCopilotRuntimeServerOptions): (reqOrRequest: http.IncomingMessage | Request, res?: http.ServerResponse) => Promise<void> | Promise<Response> | Response;
|
|
1370
1358
|
|
|
1371
|
-
declare function copilotRuntimeNestEndpoint(options: CreateCopilotRuntimeServerOptions): (
|
|
1372
|
-
body?: unknown;
|
|
1373
|
-
complete?: boolean;
|
|
1374
|
-
}, res: http.ServerResponse) => Promise<void>;
|
|
1359
|
+
declare function copilotRuntimeNestEndpoint(options: CreateCopilotRuntimeServerOptions): (reqOrRequest: http.IncomingMessage | Request, res?: http.ServerResponse) => Promise<void> | Promise<Response> | Response;
|
|
1375
1360
|
|
|
1376
1361
|
/**
|
|
1377
1362
|
* TelemetryAgentRunner - A wrapper around AgentRunner that adds telemetry
|
|
@@ -1506,4 +1491,4 @@ declare class UnknownErrorResponse extends FailedResponseStatus {
|
|
|
1506
1491
|
});
|
|
1507
1492
|
}
|
|
1508
1493
|
|
|
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,
|
|
1494
|
+
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.50.
|
|
75
|
+
version: "1.50.2-next.0",
|
|
76
76
|
sideEffects: false,
|
|
77
77
|
main: "./dist/index.js",
|
|
78
78
|
module: "./dist/index.mjs",
|
|
@@ -4755,9 +4755,27 @@ function readableStreamToNodeStream(webStream) {
|
|
|
4755
4755
|
});
|
|
4756
4756
|
}
|
|
4757
4757
|
__name(readableStreamToNodeStream, "readableStreamToNodeStream");
|
|
4758
|
+
function nodeStreamToReadableStream(nodeStream) {
|
|
4759
|
+
return new ReadableStream({
|
|
4760
|
+
start(controller) {
|
|
4761
|
+
nodeStream.on("data", (chunk) => {
|
|
4762
|
+
controller.enqueue(chunk instanceof Buffer ? new Uint8Array(chunk) : chunk);
|
|
4763
|
+
});
|
|
4764
|
+
nodeStream.on("end", () => {
|
|
4765
|
+
controller.close();
|
|
4766
|
+
});
|
|
4767
|
+
nodeStream.on("error", (err) => {
|
|
4768
|
+
controller.error(err);
|
|
4769
|
+
});
|
|
4770
|
+
},
|
|
4771
|
+
cancel() {
|
|
4772
|
+
nodeStream.destroy();
|
|
4773
|
+
}
|
|
4774
|
+
});
|
|
4775
|
+
}
|
|
4776
|
+
__name(nodeStreamToReadableStream, "nodeStreamToReadableStream");
|
|
4758
4777
|
function getFullUrl(req) {
|
|
4759
|
-
const
|
|
4760
|
-
const path = expressPath || req.url || "/";
|
|
4778
|
+
const path = req.url || "/";
|
|
4761
4779
|
const host = req.headers["x-forwarded-host"] || req.headers.host || "localhost";
|
|
4762
4780
|
const proto = req.headers["x-forwarded-proto"] || (req.socket.encrypted ? "https" : "http");
|
|
4763
4781
|
return `${proto}://${host}${path}`;
|
|
@@ -4809,6 +4827,8 @@ function isDisturbedOrLockedError(error) {
|
|
|
4809
4827
|
return error instanceof TypeError && typeof error.message === "string" && (error.message.includes("disturbed") || error.message.includes("locked"));
|
|
4810
4828
|
}
|
|
4811
4829
|
__name(isDisturbedOrLockedError, "isDisturbedOrLockedError");
|
|
4830
|
+
|
|
4831
|
+
// src/lib/integrations/node-http/index.ts
|
|
4812
4832
|
function copilotRuntimeNodeHttpEndpoint(options) {
|
|
4813
4833
|
var _a;
|
|
4814
4834
|
const commonConfig = getCommonConfig(options);
|
|
@@ -4833,7 +4853,7 @@ function copilotRuntimeNodeHttpEndpoint(options) {
|
|
|
4833
4853
|
runtime: options.runtime.instance,
|
|
4834
4854
|
basePath: options.baseUrl ?? options.endpoint
|
|
4835
4855
|
});
|
|
4836
|
-
|
|
4856
|
+
const handle2 = /* @__PURE__ */ __name(async function handler(req, res) {
|
|
4837
4857
|
const url = getFullUrl(req);
|
|
4838
4858
|
const hasBody = req.method !== "GET" && req.method !== "HEAD";
|
|
4839
4859
|
const baseHeaders = toHeaders(req.headers);
|
|
@@ -4843,7 +4863,7 @@ function copilotRuntimeNodeHttpEndpoint(options) {
|
|
|
4843
4863
|
let requestBody = void 0;
|
|
4844
4864
|
let useDuplex = false;
|
|
4845
4865
|
if (hasBody && canStream) {
|
|
4846
|
-
requestBody = req;
|
|
4866
|
+
requestBody = nodeStreamToReadableStream(req);
|
|
4847
4867
|
useDuplex = true;
|
|
4848
4868
|
}
|
|
4849
4869
|
if (hasBody && streamConsumed) {
|
|
@@ -4899,6 +4919,15 @@ function copilotRuntimeNodeHttpEndpoint(options) {
|
|
|
4899
4919
|
res.end();
|
|
4900
4920
|
}
|
|
4901
4921
|
}, "handler");
|
|
4922
|
+
return function(reqOrRequest, res) {
|
|
4923
|
+
if (reqOrRequest instanceof Request) {
|
|
4924
|
+
return honoApp.fetch(reqOrRequest);
|
|
4925
|
+
}
|
|
4926
|
+
if (!res) {
|
|
4927
|
+
throw new TypeError("ServerResponse is required for Node HTTP requests");
|
|
4928
|
+
}
|
|
4929
|
+
return handle2(reqOrRequest, res);
|
|
4930
|
+
};
|
|
4902
4931
|
}
|
|
4903
4932
|
__name(copilotRuntimeNodeHttpEndpoint, "copilotRuntimeNodeHttpEndpoint");
|
|
4904
4933
|
|
|
@@ -5607,7 +5636,6 @@ exports.extractParametersFromSchema = extractParametersFromSchema;
|
|
|
5607
5636
|
exports.generateMcpToolInstructions = generateMcpToolInstructions;
|
|
5608
5637
|
exports.getCommonConfig = getCommonConfig;
|
|
5609
5638
|
exports.langGraphPlatformEndpoint = langGraphPlatformEndpoint;
|
|
5610
|
-
exports.readableStreamToNodeStream = readableStreamToNodeStream;
|
|
5611
5639
|
exports.resolveEndpointType = resolveEndpointType;
|
|
5612
5640
|
//# sourceMappingURL=out.js.map
|
|
5613
5641
|
//# sourceMappingURL=index.js.map
|