@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/dist/index.mjs
CHANGED
|
@@ -65,7 +65,7 @@ var require_package = __commonJS({
|
|
|
65
65
|
publishConfig: {
|
|
66
66
|
access: "public"
|
|
67
67
|
},
|
|
68
|
-
version: "1.
|
|
68
|
+
version: "1.51.0-next.1",
|
|
69
69
|
sideEffects: false,
|
|
70
70
|
main: "./dist/index.js",
|
|
71
71
|
module: "./dist/index.mjs",
|
|
@@ -89,7 +89,7 @@ var require_package = __commonJS({
|
|
|
89
89
|
types: "./dist/index.d.ts",
|
|
90
90
|
license: "MIT",
|
|
91
91
|
scripts: {
|
|
92
|
-
build:
|
|
92
|
+
build: "pnpm run generate-graphql-schema && tsup",
|
|
93
93
|
dev: 'tsup --watch --onSuccess "pnpm run generate-graphql-schema"',
|
|
94
94
|
test: "jest --passWithNoTests",
|
|
95
95
|
"check-types": "tsc --noEmit",
|
|
@@ -99,6 +99,9 @@ var require_package = __commonJS({
|
|
|
99
99
|
"unlink:global": "pnpm unlink --global"
|
|
100
100
|
},
|
|
101
101
|
devDependencies: {
|
|
102
|
+
"@copilotkit/shared": "workspace:*",
|
|
103
|
+
"@copilotkitnext/agent": "workspace:*",
|
|
104
|
+
"@copilotkitnext/runtime": "workspace:*",
|
|
102
105
|
"@jest/globals": "^29.7.0",
|
|
103
106
|
"@swc/core": "1.5.28",
|
|
104
107
|
"@types/jest": "^29.5.12",
|
|
@@ -116,12 +119,6 @@ var require_package = __commonJS({
|
|
|
116
119
|
vitest: "^3.2.4"
|
|
117
120
|
},
|
|
118
121
|
dependencies: {
|
|
119
|
-
"@ag-ui/client": "^0.0.42",
|
|
120
|
-
"@ag-ui/core": "^0.0.42",
|
|
121
|
-
"@ag-ui/langgraph": "^0.0.20",
|
|
122
|
-
"@copilotkit/shared": "workspace:*",
|
|
123
|
-
"@copilotkitnext/agent": "0.0.33",
|
|
124
|
-
"@copilotkitnext/runtime": "0.0.33",
|
|
125
122
|
"@graphql-yoga/plugin-defer-stream": "^3.3.1",
|
|
126
123
|
"@hono/node-server": "^1.13.5",
|
|
127
124
|
"@scarf/scarf": "^1.3.0",
|
|
@@ -141,7 +138,13 @@ var require_package = __commonJS({
|
|
|
141
138
|
zod: "^3.23.3"
|
|
142
139
|
},
|
|
143
140
|
peerDependencies: {
|
|
141
|
+
"@ag-ui/client": "^0.0.42",
|
|
142
|
+
"@ag-ui/core": "^0.0.42",
|
|
143
|
+
"@ag-ui/langgraph": "^0.0.20",
|
|
144
144
|
"@anthropic-ai/sdk": "^0.57.0",
|
|
145
|
+
"@copilotkit/shared": "workspace:*",
|
|
146
|
+
"@copilotkitnext/agent": "workspace:*",
|
|
147
|
+
"@copilotkitnext/runtime": "workspace:*",
|
|
145
148
|
"@langchain/aws": ">=0.1.9",
|
|
146
149
|
"@langchain/core": ">=0.3.66",
|
|
147
150
|
"@langchain/community": ">=0.3.58",
|
|
@@ -4748,9 +4751,27 @@ function readableStreamToNodeStream(webStream) {
|
|
|
4748
4751
|
});
|
|
4749
4752
|
}
|
|
4750
4753
|
__name(readableStreamToNodeStream, "readableStreamToNodeStream");
|
|
4754
|
+
function nodeStreamToReadableStream(nodeStream) {
|
|
4755
|
+
return new ReadableStream({
|
|
4756
|
+
start(controller) {
|
|
4757
|
+
nodeStream.on("data", (chunk) => {
|
|
4758
|
+
controller.enqueue(chunk instanceof Buffer ? new Uint8Array(chunk) : chunk);
|
|
4759
|
+
});
|
|
4760
|
+
nodeStream.on("end", () => {
|
|
4761
|
+
controller.close();
|
|
4762
|
+
});
|
|
4763
|
+
nodeStream.on("error", (err) => {
|
|
4764
|
+
controller.error(err);
|
|
4765
|
+
});
|
|
4766
|
+
},
|
|
4767
|
+
cancel() {
|
|
4768
|
+
nodeStream.destroy();
|
|
4769
|
+
}
|
|
4770
|
+
});
|
|
4771
|
+
}
|
|
4772
|
+
__name(nodeStreamToReadableStream, "nodeStreamToReadableStream");
|
|
4751
4773
|
function getFullUrl(req) {
|
|
4752
|
-
const
|
|
4753
|
-
const path = expressPath || req.url || "/";
|
|
4774
|
+
const path = req.url || "/";
|
|
4754
4775
|
const host = req.headers["x-forwarded-host"] || req.headers.host || "localhost";
|
|
4755
4776
|
const proto = req.headers["x-forwarded-proto"] || (req.socket.encrypted ? "https" : "http");
|
|
4756
4777
|
return `${proto}://${host}${path}`;
|
|
@@ -4802,6 +4823,8 @@ function isDisturbedOrLockedError(error) {
|
|
|
4802
4823
|
return error instanceof TypeError && typeof error.message === "string" && (error.message.includes("disturbed") || error.message.includes("locked"));
|
|
4803
4824
|
}
|
|
4804
4825
|
__name(isDisturbedOrLockedError, "isDisturbedOrLockedError");
|
|
4826
|
+
|
|
4827
|
+
// src/lib/integrations/node-http/index.ts
|
|
4805
4828
|
function copilotRuntimeNodeHttpEndpoint(options) {
|
|
4806
4829
|
var _a;
|
|
4807
4830
|
const commonConfig = getCommonConfig(options);
|
|
@@ -4826,7 +4849,7 @@ function copilotRuntimeNodeHttpEndpoint(options) {
|
|
|
4826
4849
|
runtime: options.runtime.instance,
|
|
4827
4850
|
basePath: options.baseUrl ?? options.endpoint
|
|
4828
4851
|
});
|
|
4829
|
-
|
|
4852
|
+
const handle2 = /* @__PURE__ */ __name(async function handler(req, res) {
|
|
4830
4853
|
const url = getFullUrl(req);
|
|
4831
4854
|
const hasBody = req.method !== "GET" && req.method !== "HEAD";
|
|
4832
4855
|
const baseHeaders = toHeaders(req.headers);
|
|
@@ -4836,7 +4859,7 @@ function copilotRuntimeNodeHttpEndpoint(options) {
|
|
|
4836
4859
|
let requestBody = void 0;
|
|
4837
4860
|
let useDuplex = false;
|
|
4838
4861
|
if (hasBody && canStream) {
|
|
4839
|
-
requestBody = req;
|
|
4862
|
+
requestBody = nodeStreamToReadableStream(req);
|
|
4840
4863
|
useDuplex = true;
|
|
4841
4864
|
}
|
|
4842
4865
|
if (hasBody && streamConsumed) {
|
|
@@ -4892,6 +4915,15 @@ function copilotRuntimeNodeHttpEndpoint(options) {
|
|
|
4892
4915
|
res.end();
|
|
4893
4916
|
}
|
|
4894
4917
|
}, "handler");
|
|
4918
|
+
return function(reqOrRequest, res) {
|
|
4919
|
+
if (reqOrRequest instanceof Request) {
|
|
4920
|
+
return honoApp.fetch(reqOrRequest);
|
|
4921
|
+
}
|
|
4922
|
+
if (!res) {
|
|
4923
|
+
throw new TypeError("ServerResponse is required for Node HTTP requests");
|
|
4924
|
+
}
|
|
4925
|
+
return handle2(reqOrRequest, res);
|
|
4926
|
+
};
|
|
4895
4927
|
}
|
|
4896
4928
|
__name(copilotRuntimeNodeHttpEndpoint, "copilotRuntimeNodeHttpEndpoint");
|
|
4897
4929
|
|
|
@@ -5564,6 +5596,6 @@ var EmptyAdapter = class {
|
|
|
5564
5596
|
__name(EmptyAdapter, "EmptyAdapter");
|
|
5565
5597
|
var ExperimentalEmptyAdapter = EmptyAdapter;
|
|
5566
5598
|
|
|
5567
|
-
export { AnthropicAdapter, BedrockAdapter, CopilotRuntime, EmptyAdapter, ExperimentalEmptyAdapter, ExperimentalOllamaAdapter, GoogleGenerativeAIAdapter, GroqAdapter, GuardrailsValidationFailureResponse, LangChainAdapter, LangGraphAgent, LangGraphHttpAgent, MessageStreamInterruptedResponse, OpenAIAdapter, OpenAIAssistantAdapter, RemoteChain, TelemetryAgentRunner, UnifyAdapter, UnknownErrorResponse, addCustomHeaderPlugin, buildSchema, config, convertMCPToolsToActions, convertServiceAdapterError, copilotKitEndpoint, copilotRuntimeNestEndpoint, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint, copilotRuntimeNodeExpressEndpoint, copilotRuntimeNodeHttpEndpoint, createContext, createLogger, extractParametersFromSchema, generateMcpToolInstructions, getCommonConfig, langGraphPlatformEndpoint,
|
|
5599
|
+
export { AnthropicAdapter, BedrockAdapter, CopilotRuntime, EmptyAdapter, ExperimentalEmptyAdapter, ExperimentalOllamaAdapter, GoogleGenerativeAIAdapter, GroqAdapter, GuardrailsValidationFailureResponse, LangChainAdapter, LangGraphAgent, LangGraphHttpAgent, MessageStreamInterruptedResponse, OpenAIAdapter, OpenAIAssistantAdapter, RemoteChain, TelemetryAgentRunner, UnifyAdapter, UnknownErrorResponse, addCustomHeaderPlugin, buildSchema, config, convertMCPToolsToActions, convertServiceAdapterError, copilotKitEndpoint, copilotRuntimeNestEndpoint, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint, copilotRuntimeNodeExpressEndpoint, copilotRuntimeNodeHttpEndpoint, createContext, createLogger, extractParametersFromSchema, generateMcpToolInstructions, getCommonConfig, langGraphPlatformEndpoint, resolveEndpointType };
|
|
5568
5600
|
//# sourceMappingURL=out.js.map
|
|
5569
5601
|
//# sourceMappingURL=index.mjs.map
|