@copilotkit/runtime 1.0.5 → 1.0.7
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/.turbo/turbo-build.log +44 -44
- package/CHANGELOG.md +17 -0
- package/dist/{chunk-TEOA3DRE.mjs → chunk-74N2ME6S.mjs} +16 -4
- package/dist/chunk-74N2ME6S.mjs.map +1 -0
- package/dist/{chunk-67DNPQCA.mjs → chunk-JA2IRWRL.mjs} +2 -9
- package/dist/chunk-JA2IRWRL.mjs.map +1 -0
- package/dist/{chunk-ENJUY6YN.mjs → chunk-W7VNHFVP.mjs} +2 -2
- package/dist/{chunk-UPH4KIVR.mjs → chunk-XUJZPK4P.mjs} +3 -3
- package/dist/{chunk-YBYJR245.mjs → chunk-YNH6B4QZ.mjs} +14 -2
- package/dist/chunk-YNH6B4QZ.mjs.map +1 -0
- package/dist/{chunk-LZ6WZIQ3.mjs → chunk-Z2G5OVBH.mjs} +2 -2
- package/dist/index.js +28 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/lib/index.js +28 -11
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +6 -6
- package/dist/lib/integrations/index.js +27 -3
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +4 -4
- package/dist/lib/integrations/nest/index.js +15 -3
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +2 -2
- package/dist/lib/integrations/node-express/index.js +15 -3
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +2 -2
- package/dist/lib/integrations/node-http/index.js +15 -3
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/dist/service-adapters/index.js +1 -8
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +1 -1
- package/package.json +4 -6
- package/src/lib/integrations/nextjs/app-router.ts +6 -0
- package/src/lib/integrations/nextjs/pages-router.ts +6 -0
- package/src/lib/integrations/node-http/index.ts +6 -0
- package/src/lib/integrations/shared.ts +8 -0
- package/src/service-adapters/openai/utils.ts +1 -8
- package/dist/chunk-67DNPQCA.mjs.map +0 -1
- package/dist/chunk-TEOA3DRE.mjs.map +0 -1
- package/dist/chunk-YBYJR245.mjs.map +0 -1
- /package/dist/{chunk-ENJUY6YN.mjs.map → chunk-W7VNHFVP.mjs.map} +0 -0
- /package/dist/{chunk-UPH4KIVR.mjs.map → chunk-XUJZPK4P.mjs.map} +0 -0
- /package/dist/{chunk-LZ6WZIQ3.mjs.map → chunk-Z2G5OVBH.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotRuntime,
|
|
3
3
|
flattenToolCallsNoDuplicates
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XUJZPK4P.mjs";
|
|
5
5
|
import {
|
|
6
6
|
GoogleGenerativeAIAdapter,
|
|
7
7
|
LangChainAdapter,
|
|
8
8
|
OpenAIAdapter,
|
|
9
9
|
OpenAIAssistantAdapter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JA2IRWRL.mjs";
|
|
11
11
|
import {
|
|
12
12
|
config,
|
|
13
13
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
14
14
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-YNH6B4QZ.mjs";
|
|
16
16
|
import {
|
|
17
17
|
copilotRuntimeNestEndpoint
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-W7VNHFVP.mjs";
|
|
19
19
|
import {
|
|
20
20
|
copilotRuntimeNodeExpressEndpoint
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-Z2G5OVBH.mjs";
|
|
22
22
|
import {
|
|
23
23
|
buildSchema,
|
|
24
24
|
copilotRuntimeNodeHttpEndpoint,
|
|
25
25
|
createContext,
|
|
26
26
|
getCommonConfig
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-74N2ME6S.mjs";
|
|
28
28
|
import "./chunk-URMISMK2.mjs";
|
|
29
29
|
import {
|
|
30
30
|
GuardrailsValidationFailureResponse,
|
package/dist/lib/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var require_package = __commonJS({
|
|
|
44
44
|
publishConfig: {
|
|
45
45
|
access: "public"
|
|
46
46
|
},
|
|
47
|
-
version: "1.0.
|
|
47
|
+
version: "1.0.7",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -90,14 +90,12 @@ var require_package = __commonJS({
|
|
|
90
90
|
"graphql-scalars": "^1.23.0",
|
|
91
91
|
"graphql-yoga": "^5.3.1",
|
|
92
92
|
"groq-sdk": "^0.5.0",
|
|
93
|
-
"js-tiktoken": "^1.0.8",
|
|
94
93
|
langchain: "^0.1.36",
|
|
95
94
|
openai: "^4.50.0",
|
|
96
95
|
pino: "^9.2.0",
|
|
97
96
|
"pino-pretty": "^11.2.1",
|
|
98
97
|
"reflect-metadata": "^0.2.2",
|
|
99
98
|
rxjs: "^7.8.1",
|
|
100
|
-
tiktoken: "^1.0.15",
|
|
101
99
|
"type-graphql": "2.0.0-rc.1",
|
|
102
100
|
zod: "^3.23.3"
|
|
103
101
|
},
|
|
@@ -199,7 +197,6 @@ var ResultMessage = class extends BaseMessage {
|
|
|
199
197
|
__name(ResultMessage, "ResultMessage");
|
|
200
198
|
|
|
201
199
|
// src/service-adapters/openai/utils.ts
|
|
202
|
-
var import_js_tiktoken = require("js-tiktoken");
|
|
203
200
|
function limitMessagesToTokenCount(messages, tools, model, maxTokens) {
|
|
204
201
|
maxTokens || (maxTokens = maxTokensForOpenAIModel(model));
|
|
205
202
|
const result = [];
|
|
@@ -284,13 +281,7 @@ function countMessageTokens(model, message) {
|
|
|
284
281
|
}
|
|
285
282
|
__name(countMessageTokens, "countMessageTokens");
|
|
286
283
|
function countTokens(model, text) {
|
|
287
|
-
|
|
288
|
-
try {
|
|
289
|
-
enc = (0, import_js_tiktoken.encodingForModel)(model);
|
|
290
|
-
} catch (e) {
|
|
291
|
-
enc = (0, import_js_tiktoken.encodingForModel)("gpt-4");
|
|
292
|
-
}
|
|
293
|
-
return enc.encode(text).length;
|
|
284
|
+
return text.length / 3;
|
|
294
285
|
}
|
|
295
286
|
__name(countTokens, "countTokens");
|
|
296
287
|
function convertActionInputToOpenAITool(action) {
|
|
@@ -2571,6 +2562,7 @@ function buildSchema(options = {}) {
|
|
|
2571
2562
|
}
|
|
2572
2563
|
__name(buildSchema, "buildSchema");
|
|
2573
2564
|
function getCommonConfig(options) {
|
|
2565
|
+
var _a;
|
|
2574
2566
|
const logLevel = process.env.LOG_LEVEL || options.logLevel || "error";
|
|
2575
2567
|
const logger2 = createLogger({
|
|
2576
2568
|
level: logLevel,
|
|
@@ -2585,6 +2577,13 @@ function getCommonConfig(options) {
|
|
|
2585
2577
|
baseUrl: options.cloud.baseUrl
|
|
2586
2578
|
});
|
|
2587
2579
|
}
|
|
2580
|
+
if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
|
|
2581
|
+
telemetry_client_default.setGlobalProperties({
|
|
2582
|
+
_copilotkit: {
|
|
2583
|
+
...options.properties._copilotkit
|
|
2584
|
+
}
|
|
2585
|
+
});
|
|
2586
|
+
}
|
|
2588
2587
|
telemetry_client_default.setGlobalProperties({
|
|
2589
2588
|
runtime: {
|
|
2590
2589
|
serviceAdapter: options.serviceAdapter.constructor.name
|
|
@@ -2607,12 +2606,18 @@ __name(getCommonConfig, "getCommonConfig");
|
|
|
2607
2606
|
// src/lib/integrations/nextjs/app-router.ts
|
|
2608
2607
|
var import_graphql_yoga2 = require("graphql-yoga");
|
|
2609
2608
|
function copilotRuntimeNextJSAppRouterEndpoint(options) {
|
|
2609
|
+
var _a;
|
|
2610
2610
|
const commonConfig = getCommonConfig(options);
|
|
2611
2611
|
telemetry_client_default.setGlobalProperties({
|
|
2612
2612
|
runtime: {
|
|
2613
2613
|
framework: "nextjs-app-router"
|
|
2614
2614
|
}
|
|
2615
2615
|
});
|
|
2616
|
+
if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
|
|
2617
|
+
telemetry_client_default.setGlobalProperties({
|
|
2618
|
+
_copilotkit: options.properties._copilotkit
|
|
2619
|
+
});
|
|
2620
|
+
}
|
|
2616
2621
|
telemetry_client_default.capture("oss.runtime.instance_created", {});
|
|
2617
2622
|
const logger2 = commonConfig.logging;
|
|
2618
2623
|
logger2.debug("Creating NextJS App Router endpoint");
|
|
@@ -2640,12 +2645,18 @@ var config = {
|
|
|
2640
2645
|
}
|
|
2641
2646
|
};
|
|
2642
2647
|
function copilotRuntimeNextJSPagesRouterEndpoint(options) {
|
|
2648
|
+
var _a;
|
|
2643
2649
|
const commonConfig = getCommonConfig(options);
|
|
2644
2650
|
telemetry_client_default.setGlobalProperties({
|
|
2645
2651
|
runtime: {
|
|
2646
2652
|
framework: "nextjs-pages-router"
|
|
2647
2653
|
}
|
|
2648
2654
|
});
|
|
2655
|
+
if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
|
|
2656
|
+
telemetry_client_default.setGlobalProperties({
|
|
2657
|
+
_copilotkit: options.properties._copilotkit
|
|
2658
|
+
});
|
|
2659
|
+
}
|
|
2649
2660
|
telemetry_client_default.capture("oss.runtime.instance_created", {});
|
|
2650
2661
|
const logger2 = commonConfig.logging;
|
|
2651
2662
|
logger2.debug("Creating NextJS Pages Router endpoint");
|
|
@@ -2660,12 +2671,18 @@ __name(copilotRuntimeNextJSPagesRouterEndpoint, "copilotRuntimeNextJSPagesRouter
|
|
|
2660
2671
|
// src/lib/integrations/node-http/index.ts
|
|
2661
2672
|
var import_graphql_yoga4 = require("graphql-yoga");
|
|
2662
2673
|
function copilotRuntimeNodeHttpEndpoint(options) {
|
|
2674
|
+
var _a;
|
|
2663
2675
|
const commonConfig = getCommonConfig(options);
|
|
2664
2676
|
telemetry_client_default.setGlobalProperties({
|
|
2665
2677
|
runtime: {
|
|
2666
2678
|
framework: "node-http"
|
|
2667
2679
|
}
|
|
2668
2680
|
});
|
|
2681
|
+
if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
|
|
2682
|
+
telemetry_client_default.setGlobalProperties({
|
|
2683
|
+
_copilotkit: options.properties._copilotkit
|
|
2684
|
+
});
|
|
2685
|
+
}
|
|
2669
2686
|
telemetry_client_default.capture("oss.runtime.instance_created", {});
|
|
2670
2687
|
const logger2 = commonConfig.logging;
|
|
2671
2688
|
logger2.debug("Creating Node HTTP endpoint");
|