@copilotkit/runtime 1.0.0-beta.0 → 1.0.0-beta.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/.turbo/turbo-build.log +79 -65
- package/CHANGELOG.md +8 -0
- package/__snapshots__/schema/schema.graphql +15 -1
- package/dist/chunk-44O2JGUY.mjs +12 -0
- package/dist/chunk-5U6S5EGT.mjs +24 -0
- package/dist/chunk-5U6S5EGT.mjs.map +1 -0
- package/dist/{chunk-JBDOA7MK.mjs → chunk-7QCEK4DP.mjs} +4 -4
- package/dist/{chunk-6YGDE3YI.mjs → chunk-DL2QQEOR.mjs} +154 -19
- package/dist/chunk-DL2QQEOR.mjs.map +1 -0
- package/dist/{chunk-FRK6BXXV.mjs → chunk-DVDKD6F5.mjs} +3 -3
- package/dist/{chunk-JIKPSUGQ.mjs → chunk-F5K2JKGM.mjs} +5 -5
- package/dist/{chunk-OZMCHYYR.mjs → chunk-GEIBJJQ4.mjs} +3 -3
- package/dist/{chunk-2PJG3NAC.mjs → chunk-R25IOQB5.mjs} +17 -4
- package/dist/chunk-R25IOQB5.mjs.map +1 -0
- package/dist/{chunk-6NZ4UMOD.mjs → chunk-RMZWGQ46.mjs} +2 -2
- package/dist/{chunk-BYB2LNMK.mjs → chunk-U3V2BCGI.mjs} +2 -2
- package/dist/chunk-ZTEJCDMJ.mjs +24 -0
- package/dist/chunk-ZTEJCDMJ.mjs.map +1 -0
- package/dist/graphql/types/base/index.mjs +2 -2
- package/dist/graphql/types/converted/index.mjs +3 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +187 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -9
- package/dist/index.mjs.map +1 -1
- package/dist/lib/index.d.ts +6 -3
- package/dist/lib/index.js +187 -13
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +17 -9
- package/dist/lib/integrations/index.d.ts +6 -3
- package/dist/lib/integrations/index.js +187 -13
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +15 -7
- package/dist/lib/integrations/nest/index.d.ts +14 -0
- package/dist/lib/integrations/nest/index.js +1481 -0
- package/dist/lib/integrations/nest/index.js.map +1 -0
- package/dist/lib/integrations/nest/index.mjs +13 -0
- package/dist/lib/integrations/nest/index.mjs.map +1 -0
- package/dist/lib/integrations/node-express/index.d.ts +14 -0
- package/dist/lib/integrations/node-express/index.js +1481 -0
- package/dist/lib/integrations/node-express/index.js.map +1 -0
- package/dist/lib/integrations/node-express/index.mjs +13 -0
- package/dist/lib/integrations/node-express/index.mjs.map +1 -0
- package/dist/lib/integrations/node-http/index.d.ts +6 -2
- package/dist/lib/integrations/node-http/index.js +147 -13
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +6 -6
- package/dist/{pages-router-e81920d5.d.ts → pages-router-24897543.d.ts} +1 -1
- package/dist/service-adapters/index.mjs +5 -5
- package/dist/{index-0e75acd2.d.ts → shared-48c0f7b8.d.ts} +2 -5
- package/dist/utils/index.mjs +2 -2
- package/package.json +2 -2
- package/src/graphql/inputs/cloud-guardrails.input.ts +2 -2
- package/src/graphql/inputs/generate-copilot-response.input.ts +10 -0
- package/src/graphql/resolvers/copilot.resolver.ts +12 -3
- package/src/graphql/types/enums.ts +13 -0
- package/src/lib/integrations/index.ts +2 -0
- package/src/lib/integrations/nest/index.ts +14 -0
- package/src/lib/integrations/nextjs/app-router.ts +10 -0
- package/src/lib/integrations/nextjs/pages-router.ts +10 -0
- package/src/lib/integrations/node-express/index.ts +14 -0
- package/src/lib/integrations/node-http/index.ts +10 -0
- package/src/lib/integrations/shared.ts +14 -1
- package/src/lib/telemetry-client.ts +9 -0
- package/dist/chunk-2PJG3NAC.mjs.map +0 -1
- package/dist/chunk-6YGDE3YI.mjs.map +0 -1
- package/dist/chunk-RHQLCJGG.mjs +0 -7
- /package/dist/{chunk-RHQLCJGG.mjs.map → chunk-44O2JGUY.mjs.map} +0 -0
- /package/dist/{chunk-JBDOA7MK.mjs.map → chunk-7QCEK4DP.mjs.map} +0 -0
- /package/dist/{chunk-FRK6BXXV.mjs.map → chunk-DVDKD6F5.mjs.map} +0 -0
- /package/dist/{chunk-JIKPSUGQ.mjs.map → chunk-F5K2JKGM.mjs.map} +0 -0
- /package/dist/{chunk-OZMCHYYR.mjs.map → chunk-GEIBJJQ4.mjs.map} +0 -0
- /package/dist/{chunk-6NZ4UMOD.mjs.map → chunk-RMZWGQ46.mjs.map} +0 -0
- /package/dist/{chunk-BYB2LNMK.mjs.map → chunk-U3V2BCGI.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,33 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotRuntime,
|
|
3
3
|
flattenToolCallsNoDuplicates
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-F5K2JKGM.mjs";
|
|
5
5
|
import {
|
|
6
6
|
GoogleGenerativeAIAdapter,
|
|
7
7
|
LangChainAdapter,
|
|
8
8
|
OpenAIAdapter,
|
|
9
9
|
OpenAIAssistantAdapter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7QCEK4DP.mjs";
|
|
11
11
|
import {
|
|
12
12
|
config,
|
|
13
13
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
14
14
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-R25IOQB5.mjs";
|
|
16
|
+
import {
|
|
17
|
+
copilotRuntimeNestEndpoint
|
|
18
|
+
} from "./chunk-ZTEJCDMJ.mjs";
|
|
19
|
+
import {
|
|
20
|
+
copilotRuntimeNodeExpressEndpoint
|
|
21
|
+
} from "./chunk-5U6S5EGT.mjs";
|
|
16
22
|
import {
|
|
17
23
|
buildSchema,
|
|
18
24
|
copilotRuntimeNodeHttpEndpoint,
|
|
19
25
|
createContext,
|
|
20
26
|
getCommonConfig
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
27
|
+
} from "./chunk-DL2QQEOR.mjs";
|
|
28
|
+
import "./chunk-DVDKD6F5.mjs";
|
|
23
29
|
import {
|
|
24
30
|
GuardrailsValidationFailureResponse,
|
|
25
31
|
MessageStreamInterruptedResponse,
|
|
26
32
|
UnknownErrorResponse
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-U3V2BCGI.mjs";
|
|
34
|
+
import "./chunk-GEIBJJQ4.mjs";
|
|
35
|
+
import "./chunk-RMZWGQ46.mjs";
|
|
36
|
+
import "./chunk-44O2JGUY.mjs";
|
|
31
37
|
|
|
32
38
|
// src/index.ts
|
|
33
39
|
import "reflect-metadata";
|
|
@@ -42,8 +48,10 @@ export {
|
|
|
42
48
|
UnknownErrorResponse,
|
|
43
49
|
buildSchema,
|
|
44
50
|
config,
|
|
51
|
+
copilotRuntimeNestEndpoint,
|
|
45
52
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
46
53
|
copilotRuntimeNextJSPagesRouterEndpoint,
|
|
54
|
+
copilotRuntimeNodeExpressEndpoint,
|
|
47
55
|
copilotRuntimeNodeHttpEndpoint,
|
|
48
56
|
createContext,
|
|
49
57
|
flattenToolCallsNoDuplicates,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import \"reflect-metadata\";\nexport * from \"./lib\";\nexport * from \"./utils\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import \"reflect-metadata\";\nexport * from \"./lib\";\nexport * from \"./utils\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO;","names":[]}
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
export { g as CommonConfig, b as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, c as CreateCopilotRuntimeServerOptions, G as GraphQLContext, e as buildSchema,
|
|
1
|
+
export { g as CommonConfig, b as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, c as CreateCopilotRuntimeServerOptions, G as GraphQLContext, e as buildSchema, d as createContext, f as flattenToolCallsNoDuplicates, h as getCommonConfig } from '../shared-48c0f7b8.js';
|
|
2
2
|
export { G as GoogleGenerativeAIAdapter, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams } from '../langchain-adapter-a02d1d38.js';
|
|
3
|
-
export { C as CopilotRuntimeServerInstance, a as config, c as copilotRuntimeNextJSAppRouterEndpoint, b as copilotRuntimeNextJSPagesRouterEndpoint } from '../pages-router-
|
|
4
|
-
|
|
3
|
+
export { C as CopilotRuntimeServerInstance, a as config, c as copilotRuntimeNextJSAppRouterEndpoint, b as copilotRuntimeNextJSPagesRouterEndpoint } from '../pages-router-24897543.js';
|
|
4
|
+
export { copilotRuntimeNodeHttpEndpoint } from './integrations/node-http/index.js';
|
|
5
|
+
export { copilotRuntimeNodeExpressEndpoint } from './integrations/node-express/index.js';
|
|
6
|
+
export { copilotRuntimeNestEndpoint } from './integrations/nest/index.js';
|
|
5
7
|
import 'graphql';
|
|
6
8
|
import 'pino';
|
|
9
|
+
import 'graphql-yoga';
|
|
7
10
|
import '@copilotkit/shared';
|
|
8
11
|
import '../langserve-75ebbc38.js';
|
|
9
12
|
import '../index-aa091e3c.js';
|
package/dist/lib/index.js
CHANGED
|
@@ -5,6 +5,9 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
8
11
|
var __export = (target, all) => {
|
|
9
12
|
for (var name in all)
|
|
10
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -27,6 +30,77 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
30
|
));
|
|
28
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
32
|
|
|
33
|
+
// package.json
|
|
34
|
+
var require_package = __commonJS({
|
|
35
|
+
"package.json"(exports, module2) {
|
|
36
|
+
module2.exports = {
|
|
37
|
+
name: "@copilotkit/runtime",
|
|
38
|
+
private: false,
|
|
39
|
+
publishConfig: {
|
|
40
|
+
access: "public"
|
|
41
|
+
},
|
|
42
|
+
version: "1.0.0-beta.1",
|
|
43
|
+
sideEffects: false,
|
|
44
|
+
main: "./dist/index.js",
|
|
45
|
+
module: "./dist/index.mjs",
|
|
46
|
+
exports: {
|
|
47
|
+
".": "./dist/index.js"
|
|
48
|
+
},
|
|
49
|
+
types: "./dist/index.d.ts",
|
|
50
|
+
license: "MIT",
|
|
51
|
+
scripts: {
|
|
52
|
+
build: "tsup --clean",
|
|
53
|
+
dev: 'tsup --watch --onSuccess "pnpm run generate-graphql-schema"',
|
|
54
|
+
test: "jest --passWithNoTests",
|
|
55
|
+
"check-types": "tsc --noEmit",
|
|
56
|
+
clean: "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next",
|
|
57
|
+
"generate-graphql-schema": "rm -rf __snapshots__ && ts-node ./scripts/generate-gql-schema.ts"
|
|
58
|
+
},
|
|
59
|
+
devDependencies: {
|
|
60
|
+
"@swc/core": "1.5.28",
|
|
61
|
+
"@types/express": "^4.17.21",
|
|
62
|
+
"@types/jest": "^29.5.4",
|
|
63
|
+
"@types/node": "^18.11.17",
|
|
64
|
+
"@whatwg-node/server": "^0.9.34",
|
|
65
|
+
eslint: "^8.56.0",
|
|
66
|
+
"eslint-config-custom": "workspace:*",
|
|
67
|
+
jest: "^29.6.4",
|
|
68
|
+
nodemon: "^3.1.3",
|
|
69
|
+
"ts-jest": "^29.1.1",
|
|
70
|
+
"ts-node": "^10.9.2",
|
|
71
|
+
tsconfig: "workspace:*",
|
|
72
|
+
tsup: "^6.7.0",
|
|
73
|
+
typescript: "^5.2.3"
|
|
74
|
+
},
|
|
75
|
+
dependencies: {
|
|
76
|
+
"@copilotkit/shared": "workspace:*",
|
|
77
|
+
"@google/generative-ai": "^0.11.2",
|
|
78
|
+
"@graphql-yoga/plugin-defer-stream": "^3.3.1",
|
|
79
|
+
"@langchain/community": "^0.0.53",
|
|
80
|
+
"@langchain/core": "^0.1.61",
|
|
81
|
+
"@langchain/openai": "^0.0.28",
|
|
82
|
+
"class-transformer": "^0.5.1",
|
|
83
|
+
express: "^4.19.2",
|
|
84
|
+
graphql: "^16.8.1",
|
|
85
|
+
"graphql-scalars": "^1.23.0",
|
|
86
|
+
"graphql-yoga": "^5.3.1",
|
|
87
|
+
"groq-sdk": "^0.5.0",
|
|
88
|
+
"js-tiktoken": "^1.0.8",
|
|
89
|
+
langchain: "^0.1.36",
|
|
90
|
+
nanoid: "3.3.4",
|
|
91
|
+
openai: "^4.50.0",
|
|
92
|
+
pino: "^9.2.0",
|
|
93
|
+
"pino-pretty": "^11.2.1",
|
|
94
|
+
"reflect-metadata": "^0.2.2",
|
|
95
|
+
rxjs: "^7.8.1",
|
|
96
|
+
tiktoken: "^1.0.15",
|
|
97
|
+
"type-graphql": "2.0.0-rc.1",
|
|
98
|
+
zod: "^3.23.3"
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
30
104
|
// src/lib/index.ts
|
|
31
105
|
var lib_exports = {};
|
|
32
106
|
__export(lib_exports, {
|
|
@@ -37,8 +111,10 @@ __export(lib_exports, {
|
|
|
37
111
|
OpenAIAssistantAdapter: () => OpenAIAssistantAdapter,
|
|
38
112
|
buildSchema: () => buildSchema,
|
|
39
113
|
config: () => config,
|
|
114
|
+
copilotRuntimeNestEndpoint: () => copilotRuntimeNestEndpoint,
|
|
40
115
|
copilotRuntimeNextJSAppRouterEndpoint: () => copilotRuntimeNextJSAppRouterEndpoint,
|
|
41
116
|
copilotRuntimeNextJSPagesRouterEndpoint: () => copilotRuntimeNextJSPagesRouterEndpoint,
|
|
117
|
+
copilotRuntimeNodeExpressEndpoint: () => copilotRuntimeNodeExpressEndpoint,
|
|
42
118
|
copilotRuntimeNodeHttpEndpoint: () => copilotRuntimeNodeHttpEndpoint,
|
|
43
119
|
createContext: () => createContext,
|
|
44
120
|
flattenToolCallsNoDuplicates: () => flattenToolCallsNoDuplicates,
|
|
@@ -1276,6 +1352,14 @@ var ActionExecutionScope;
|
|
|
1276
1352
|
ActionExecutionScope2["server"] = "server";
|
|
1277
1353
|
ActionExecutionScope2["client"] = "client";
|
|
1278
1354
|
})(ActionExecutionScope || (ActionExecutionScope = {}));
|
|
1355
|
+
var CopilotRequestType;
|
|
1356
|
+
(function(CopilotRequestType2) {
|
|
1357
|
+
CopilotRequestType2["Chat"] = "Chat";
|
|
1358
|
+
CopilotRequestType2["Task"] = "Task";
|
|
1359
|
+
CopilotRequestType2["TextareaCompletion"] = "TextareaCompletion";
|
|
1360
|
+
CopilotRequestType2["TextareaPopover"] = "TextareaPopover";
|
|
1361
|
+
CopilotRequestType2["Suggestion"] = "Suggestion";
|
|
1362
|
+
})(CopilotRequestType || (CopilotRequestType = {}));
|
|
1279
1363
|
(0, import_type_graphql2.registerEnumType)(MessageRole, {
|
|
1280
1364
|
name: "MessageRole",
|
|
1281
1365
|
description: "The role of the message"
|
|
@@ -1284,6 +1368,10 @@ var ActionExecutionScope;
|
|
|
1284
1368
|
name: "ActionExecutionScope",
|
|
1285
1369
|
description: "The scope of the action"
|
|
1286
1370
|
});
|
|
1371
|
+
(0, import_type_graphql2.registerEnumType)(CopilotRequestType, {
|
|
1372
|
+
name: "CopilotRequestType",
|
|
1373
|
+
description: "The type of Copilot request"
|
|
1374
|
+
});
|
|
1287
1375
|
|
|
1288
1376
|
// src/graphql/inputs/message.input.ts
|
|
1289
1377
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
@@ -1515,15 +1603,12 @@ GuardrailsRuleInput = _ts_decorate5([
|
|
|
1515
1603
|
(0, import_type_graphql6.InputType)()
|
|
1516
1604
|
], GuardrailsRuleInput);
|
|
1517
1605
|
var GuardrailsInput = class {
|
|
1518
|
-
inputValidationRules
|
|
1519
|
-
allowList: [],
|
|
1520
|
-
denyList: []
|
|
1521
|
-
};
|
|
1606
|
+
inputValidationRules;
|
|
1522
1607
|
};
|
|
1523
1608
|
__name(GuardrailsInput, "GuardrailsInput");
|
|
1524
1609
|
_ts_decorate5([
|
|
1525
1610
|
(0, import_type_graphql6.Field)(() => GuardrailsRuleInput, {
|
|
1526
|
-
nullable:
|
|
1611
|
+
nullable: false
|
|
1527
1612
|
}),
|
|
1528
1613
|
_ts_metadata5("design:type", typeof GuardrailsRuleInput === "undefined" ? Object : GuardrailsRuleInput)
|
|
1529
1614
|
], GuardrailsInput.prototype, "inputValidationRules", void 0);
|
|
@@ -1579,7 +1664,21 @@ function _ts_metadata7(k, v) {
|
|
|
1579
1664
|
return Reflect.metadata(k, v);
|
|
1580
1665
|
}
|
|
1581
1666
|
__name(_ts_metadata7, "_ts_metadata");
|
|
1667
|
+
var GenerateCopilotResponseMetadataInput = class {
|
|
1668
|
+
requestType;
|
|
1669
|
+
};
|
|
1670
|
+
__name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
|
|
1671
|
+
_ts_decorate7([
|
|
1672
|
+
(0, import_type_graphql8.Field)(() => CopilotRequestType, {
|
|
1673
|
+
nullable: true
|
|
1674
|
+
}),
|
|
1675
|
+
_ts_metadata7("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
|
|
1676
|
+
], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
|
|
1677
|
+
GenerateCopilotResponseMetadataInput = _ts_decorate7([
|
|
1678
|
+
(0, import_type_graphql8.InputType)()
|
|
1679
|
+
], GenerateCopilotResponseMetadataInput);
|
|
1582
1680
|
var GenerateCopilotResponseInput = class {
|
|
1681
|
+
metadata;
|
|
1583
1682
|
threadId;
|
|
1584
1683
|
runId;
|
|
1585
1684
|
messages;
|
|
@@ -1587,6 +1686,12 @@ var GenerateCopilotResponseInput = class {
|
|
|
1587
1686
|
cloud;
|
|
1588
1687
|
};
|
|
1589
1688
|
__name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
|
|
1689
|
+
_ts_decorate7([
|
|
1690
|
+
(0, import_type_graphql8.Field)(() => GenerateCopilotResponseMetadataInput, {
|
|
1691
|
+
nullable: false
|
|
1692
|
+
}),
|
|
1693
|
+
_ts_metadata7("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
|
|
1694
|
+
], GenerateCopilotResponseInput.prototype, "metadata", void 0);
|
|
1590
1695
|
_ts_decorate7([
|
|
1591
1696
|
(0, import_type_graphql8.Field)(() => String, {
|
|
1592
1697
|
nullable: true
|
|
@@ -1988,6 +2093,15 @@ var UnknownErrorResponse = class extends FailedResponseStatus {
|
|
|
1988
2093
|
};
|
|
1989
2094
|
__name(UnknownErrorResponse, "UnknownErrorResponse");
|
|
1990
2095
|
|
|
2096
|
+
// src/lib/telemetry-client.ts
|
|
2097
|
+
var import_shared2 = require("@copilotkit/shared");
|
|
2098
|
+
var packageJson = require_package();
|
|
2099
|
+
var telemetryClient = new import_shared2.TelemetryClient({
|
|
2100
|
+
packageName: packageJson.name,
|
|
2101
|
+
packageVersion: packageJson.version
|
|
2102
|
+
});
|
|
2103
|
+
var telemetry_client_default = telemetryClient;
|
|
2104
|
+
|
|
1991
2105
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
1992
2106
|
function _ts_decorate11(decorators, target, key, desc) {
|
|
1993
2107
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -2013,6 +2127,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
2013
2127
|
__name(_ts_param, "_ts_param");
|
|
2014
2128
|
var invokeGuardrails = /* @__PURE__ */ __name(async ({ baseUrl, copilotCloudPublicApiKey, data, onResult, onError }) => {
|
|
2015
2129
|
var _a;
|
|
2130
|
+
console.log("invokeGuardrails.baseUrl", baseUrl);
|
|
2016
2131
|
if (data.messages.length && ((_a = data.messages[data.messages.length - 1].textMessage) == null ? void 0 : _a.role) === MessageRole.user) {
|
|
2017
2132
|
const messages = data.messages.filter((m) => m.textMessage !== void 0 && (m.textMessage.role === MessageRole.user || m.textMessage.role === MessageRole.assistant)).map((m) => ({
|
|
2018
2133
|
role: m.textMessage.role,
|
|
@@ -2047,6 +2162,11 @@ var CopilotResolver = class {
|
|
|
2047
2162
|
return "Hello World";
|
|
2048
2163
|
}
|
|
2049
2164
|
async generateCopilotResponse(ctx, data, properties) {
|
|
2165
|
+
var _a, _b, _c;
|
|
2166
|
+
telemetry_client_default.capture("oss.runtime.copilot_request_created", {
|
|
2167
|
+
"cloud.guardrails.enabled": ((_a = data.cloud) == null ? void 0 : _a.guardrails) !== void 0,
|
|
2168
|
+
requestType: data.metadata.requestType
|
|
2169
|
+
});
|
|
2050
2170
|
let logger2 = ctx.logger.child({
|
|
2051
2171
|
component: "CopilotResolver.generateCopilotResponse"
|
|
2052
2172
|
});
|
|
@@ -2079,8 +2199,8 @@ var CopilotResolver = class {
|
|
|
2079
2199
|
}
|
|
2080
2200
|
if (process.env.COPILOT_CLOUD_BASE_URL) {
|
|
2081
2201
|
copilotCloudBaseUrl = process.env.COPILOT_CLOUD_BASE_URL;
|
|
2082
|
-
} else if (ctx._copilotkit.baseUrl) {
|
|
2083
|
-
copilotCloudBaseUrl = ctx._copilotkit.baseUrl;
|
|
2202
|
+
} else if ((_b = ctx._copilotkit.cloud) == null ? void 0 : _b.baseUrl) {
|
|
2203
|
+
copilotCloudBaseUrl = (_c = ctx._copilotkit.cloud) == null ? void 0 : _c.baseUrl;
|
|
2084
2204
|
} else {
|
|
2085
2205
|
copilotCloudBaseUrl = "https://api.cloud.copilotkit.ai";
|
|
2086
2206
|
}
|
|
@@ -2116,9 +2236,9 @@ var CopilotResolver = class {
|
|
|
2116
2236
|
runId,
|
|
2117
2237
|
status: (0, import_rxjs2.firstValueFrom)(responseStatus$),
|
|
2118
2238
|
messages: new import_graphql_yoga.Repeater(async (pushMessage, stopStreamingMessages) => {
|
|
2119
|
-
var
|
|
2239
|
+
var _a2, _b2;
|
|
2120
2240
|
logger2.debug("Messages repeater created");
|
|
2121
|
-
if ((
|
|
2241
|
+
if ((_a2 = data.cloud) == null ? void 0 : _a2.guardrails) {
|
|
2122
2242
|
logger2 = logger2.child({
|
|
2123
2243
|
guardrails: true
|
|
2124
2244
|
});
|
|
@@ -2167,7 +2287,7 @@ var CopilotResolver = class {
|
|
|
2167
2287
|
let eventStreamSubscription;
|
|
2168
2288
|
const eventStream = eventSource.process({
|
|
2169
2289
|
serversideActions: actions,
|
|
2170
|
-
guardrailsResult$: ((
|
|
2290
|
+
guardrailsResult$: ((_b2 = data.cloud) == null ? void 0 : _b2.guardrails) ? guardrailsResult$ : null
|
|
2171
2291
|
}).pipe(
|
|
2172
2292
|
// shareReplay() ensures that later subscribers will see the whole stream instead of
|
|
2173
2293
|
// just the events that were emitted after the subscriber was added.
|
|
@@ -2329,9 +2449,9 @@ var CopilotResolver = class {
|
|
|
2329
2449
|
rejectOutputMessagesPromise(err);
|
|
2330
2450
|
},
|
|
2331
2451
|
complete: async () => {
|
|
2332
|
-
var
|
|
2452
|
+
var _a3;
|
|
2333
2453
|
logger2.debug("Event stream completed");
|
|
2334
|
-
if ((
|
|
2454
|
+
if ((_a3 = data.cloud) == null ? void 0 : _a3.guardrails) {
|
|
2335
2455
|
logger2.debug("Guardrails is enabled, waiting for guardrails result");
|
|
2336
2456
|
await (0, import_rxjs2.firstValueFrom)(guardrailsResult$);
|
|
2337
2457
|
}
|
|
@@ -2440,10 +2560,20 @@ function getCommonConfig(options) {
|
|
|
2440
2560
|
level: logLevel,
|
|
2441
2561
|
component: "getCommonConfig"
|
|
2442
2562
|
});
|
|
2443
|
-
logger2.debug("Getting common config");
|
|
2444
2563
|
const contextLogger = createLogger({
|
|
2445
2564
|
level: logLevel
|
|
2446
2565
|
});
|
|
2566
|
+
if (options.cloud) {
|
|
2567
|
+
telemetry_client_default.setCloudConfiguration({
|
|
2568
|
+
publicApiKey: options.cloud.publicApiKey,
|
|
2569
|
+
baseUrl: options.cloud.baseUrl
|
|
2570
|
+
});
|
|
2571
|
+
}
|
|
2572
|
+
telemetry_client_default.setGlobalProperties({
|
|
2573
|
+
runtime: {
|
|
2574
|
+
serviceAdapter: options.serviceAdapter.constructor.name
|
|
2575
|
+
}
|
|
2576
|
+
});
|
|
2447
2577
|
return {
|
|
2448
2578
|
logging: createLogger({
|
|
2449
2579
|
component: "Yoga GraphQL",
|
|
@@ -2462,6 +2592,12 @@ __name(getCommonConfig, "getCommonConfig");
|
|
|
2462
2592
|
var import_graphql_yoga2 = require("graphql-yoga");
|
|
2463
2593
|
function copilotRuntimeNextJSAppRouterEndpoint(options) {
|
|
2464
2594
|
const commonConfig = getCommonConfig(options);
|
|
2595
|
+
telemetry_client_default.setGlobalProperties({
|
|
2596
|
+
runtime: {
|
|
2597
|
+
framework: "nextjs-app-router"
|
|
2598
|
+
}
|
|
2599
|
+
});
|
|
2600
|
+
telemetry_client_default.capture("oss.runtime.instance_created", {});
|
|
2465
2601
|
const logger2 = commonConfig.logging;
|
|
2466
2602
|
logger2.debug("Creating NextJS App Router endpoint");
|
|
2467
2603
|
const yoga = (0, import_graphql_yoga2.createYoga)({
|
|
@@ -2489,6 +2625,12 @@ var config = {
|
|
|
2489
2625
|
};
|
|
2490
2626
|
function copilotRuntimeNextJSPagesRouterEndpoint(options) {
|
|
2491
2627
|
const commonConfig = getCommonConfig(options);
|
|
2628
|
+
telemetry_client_default.setGlobalProperties({
|
|
2629
|
+
runtime: {
|
|
2630
|
+
framework: "nextjs-pages-router"
|
|
2631
|
+
}
|
|
2632
|
+
});
|
|
2633
|
+
telemetry_client_default.capture("oss.runtime.instance_created", {});
|
|
2492
2634
|
const logger2 = commonConfig.logging;
|
|
2493
2635
|
logger2.debug("Creating NextJS Pages Router endpoint");
|
|
2494
2636
|
const yoga = (0, import_graphql_yoga3.createYoga)({
|
|
@@ -2503,6 +2645,12 @@ __name(copilotRuntimeNextJSPagesRouterEndpoint, "copilotRuntimeNextJSPagesRouter
|
|
|
2503
2645
|
var import_graphql_yoga4 = require("graphql-yoga");
|
|
2504
2646
|
function copilotRuntimeNodeHttpEndpoint(options) {
|
|
2505
2647
|
const commonConfig = getCommonConfig(options);
|
|
2648
|
+
telemetry_client_default.setGlobalProperties({
|
|
2649
|
+
runtime: {
|
|
2650
|
+
framework: "node-http"
|
|
2651
|
+
}
|
|
2652
|
+
});
|
|
2653
|
+
telemetry_client_default.capture("oss.runtime.instance_created", {});
|
|
2506
2654
|
const logger2 = commonConfig.logging;
|
|
2507
2655
|
logger2.debug("Creating Node HTTP endpoint");
|
|
2508
2656
|
const yoga = (0, import_graphql_yoga4.createYoga)({
|
|
@@ -2512,6 +2660,30 @@ function copilotRuntimeNodeHttpEndpoint(options) {
|
|
|
2512
2660
|
return yoga;
|
|
2513
2661
|
}
|
|
2514
2662
|
__name(copilotRuntimeNodeHttpEndpoint, "copilotRuntimeNodeHttpEndpoint");
|
|
2663
|
+
|
|
2664
|
+
// src/lib/integrations/node-express/index.ts
|
|
2665
|
+
function copilotRuntimeNodeExpressEndpoint(options) {
|
|
2666
|
+
telemetry_client_default.setGlobalProperties({
|
|
2667
|
+
runtime: {
|
|
2668
|
+
framework: "node-express"
|
|
2669
|
+
}
|
|
2670
|
+
});
|
|
2671
|
+
telemetry_client_default.capture("oss.runtime.instance_created", {});
|
|
2672
|
+
return copilotRuntimeNodeHttpEndpoint(options);
|
|
2673
|
+
}
|
|
2674
|
+
__name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
|
|
2675
|
+
|
|
2676
|
+
// src/lib/integrations/nest/index.ts
|
|
2677
|
+
function copilotRuntimeNestEndpoint(options) {
|
|
2678
|
+
telemetry_client_default.setGlobalProperties({
|
|
2679
|
+
runtime: {
|
|
2680
|
+
framework: "nest"
|
|
2681
|
+
}
|
|
2682
|
+
});
|
|
2683
|
+
telemetry_client_default.capture("oss.runtime.instance_created", {});
|
|
2684
|
+
return copilotRuntimeNodeHttpEndpoint(options);
|
|
2685
|
+
}
|
|
2686
|
+
__name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
|
|
2515
2687
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2516
2688
|
0 && (module.exports = {
|
|
2517
2689
|
CopilotRuntime,
|
|
@@ -2521,8 +2693,10 @@ __name(copilotRuntimeNodeHttpEndpoint, "copilotRuntimeNodeHttpEndpoint");
|
|
|
2521
2693
|
OpenAIAssistantAdapter,
|
|
2522
2694
|
buildSchema,
|
|
2523
2695
|
config,
|
|
2696
|
+
copilotRuntimeNestEndpoint,
|
|
2524
2697
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
2525
2698
|
copilotRuntimeNextJSPagesRouterEndpoint,
|
|
2699
|
+
copilotRuntimeNodeExpressEndpoint,
|
|
2526
2700
|
copilotRuntimeNodeHttpEndpoint,
|
|
2527
2701
|
createContext,
|
|
2528
2702
|
flattenToolCallsNoDuplicates,
|