@copilotkit/shared 0.9.0-multi-feature-usecopilotreadable.3 → 0.9.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/.turbo/turbo-build.log +114 -107
- package/CHANGELOG.md +50 -2
- package/dist/chunk-5VZXLWOP.mjs +13 -0
- package/dist/chunk-5VZXLWOP.mjs.map +1 -0
- package/dist/chunk-BANDZXMP.mjs +1 -0
- package/dist/{chunk-2C54HQBI.mjs → chunk-DBW3BY7E.mjs} +1 -1
- package/dist/{chunk-2C54HQBI.mjs.map → chunk-DBW3BY7E.mjs.map} +1 -1
- package/dist/chunk-MSUB6DGR.mjs +1 -0
- package/dist/{chunk-K7TZQSAZ.mjs → chunk-S4HGLK2E.mjs} +8 -5
- package/dist/chunk-S4HGLK2E.mjs.map +1 -0
- package/dist/constants/index.d.ts +7 -0
- package/dist/constants/index.js +14 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/index.mjs +10 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -20
- package/dist/types/copilot-cloud-config.d.ts +13 -0
- package/dist/types/copilot-cloud-config.js +19 -0
- package/dist/types/copilot-cloud-config.js.map +1 -0
- package/dist/types/copilot-cloud-config.mjs +2 -0
- package/dist/types/copilot-cloud-config.mjs.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +2 -1
- package/dist/utils/annotated-function.js +7 -4
- package/dist/utils/annotated-function.js.map +1 -1
- package/dist/utils/annotated-function.mjs +1 -1
- package/dist/utils/index.js +7 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +12 -12
- package/dist/utils/utils.d.ts +1 -1
- package/dist/utils/utils.js.map +1 -1
- package/dist/utils/utils.mjs +1 -1
- package/package.json +3 -3
- package/src/constants/index.ts +4 -0
- package/src/types/copilot-cloud-config.ts +11 -0
- package/src/types/index.ts +1 -0
- package/src/utils/annotated-function.ts +7 -4
- package/src/utils/utils.ts +1 -1
- package/dist/chunk-2M3YVRFS.mjs +0 -1
- package/dist/chunk-DE5K76I2.mjs +0 -1
- package/dist/chunk-K7TZQSAZ.mjs.map +0 -1
- /package/dist/{chunk-2M3YVRFS.mjs.map → chunk-BANDZXMP.mjs.map} +0 -0
- /package/dist/{chunk-DE5K76I2.mjs.map → chunk-MSUB6DGR.mjs.map} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,110 +1,117 @@
|
|
|
1
1
|
|
|
2
|
-
> @copilotkit/shared@0.9.0
|
|
2
|
+
> @copilotkit/shared@0.9.0 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/shared
|
|
3
3
|
> tsup --clean
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
5
|
+
[34mCLI[39m Building entry: src/index.ts, src/constants/copilot-protocol.ts, src/constants/index.ts, src/types/action.ts, src/types/annotated-function.ts, src/types/copilot-cloud-config.ts, src/types/index.ts, src/types/openai-assistant.ts, src/utils/annotated-function.ts, src/utils/decode-chat-completion-as-text.ts, src/utils/decode-chat-completion.ts, src/utils/index.ts, src/utils/parse-chat-completion.ts, src/utils/utils.test.ts, src/utils/utils.ts
|
|
6
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
+
[34mCLI[39m tsup v6.7.0
|
|
8
|
+
[34mCLI[39m Using tsup config: /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/shared/tsup.config.ts
|
|
9
|
+
[34mCLI[39m Target: node14
|
|
10
|
+
[34mCLI[39m Cleaning output folder
|
|
11
|
+
[34mESM[39m Build start
|
|
12
|
+
[34mCJS[39m Build start
|
|
13
|
+
[32mCJS[39m [1mdist/utils/annotated-function.js [22m[32m5.84 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/constants/copilot-protocol.js [22m[32m1.25 KB[39m
|
|
15
|
+
[32mCJS[39m [1mdist/index.js [22m[32m17.88 KB[39m
|
|
16
|
+
[32mCJS[39m [1mdist/constants/index.js [22m[32m1.90 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/types/annotated-function.js [22m[32m849.00 B[39m
|
|
18
|
+
[32mCJS[39m [1mdist/types/action.js [22m[32m801.00 B[39m
|
|
19
|
+
[32mCJS[39m [1mdist/types/copilot-cloud-config.js [22m[32m857.00 B[39m
|
|
20
|
+
[32mCJS[39m [1mdist/types/index.js [22m[32m797.00 B[39m
|
|
21
|
+
[32mCJS[39m [1mdist/utils/decode-chat-completion-as-text.js [22m[32m1.82 KB[39m
|
|
22
|
+
[32mCJS[39m [1mdist/types/openai-assistant.js [22m[32m841.00 B[39m
|
|
23
|
+
[32mCJS[39m [1mdist/utils/decode-chat-completion.js [22m[32m4.68 KB[39m
|
|
24
|
+
[32mCJS[39m [1mdist/utils/index.js [22m[32m17.02 KB[39m
|
|
25
|
+
[32mCJS[39m [1mdist/utils/utils.test.js [22m[32m184.00 B[39m
|
|
26
|
+
[32mCJS[39m [1mdist/utils/parse-chat-completion.js [22m[32m2.68 KB[39m
|
|
27
|
+
[32mCJS[39m [1mdist/utils/utils.js [22m[32m6.25 KB[39m
|
|
28
|
+
[32mCJS[39m [1mdist/utils/annotated-function.js.map [22m[32m8.45 KB[39m
|
|
29
|
+
[32mCJS[39m [1mdist/constants/copilot-protocol.js.map [22m[32m261.00 B[39m
|
|
30
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m33.63 KB[39m
|
|
31
|
+
[32mCJS[39m [1mdist/constants/index.js.map [22m[32m766.00 B[39m
|
|
32
|
+
[32mCJS[39m [1mdist/types/annotated-function.js.map [22m[32m871.00 B[39m
|
|
33
|
+
[32mCJS[39m [1mdist/types/action.js.map [22m[32m4.84 KB[39m
|
|
34
|
+
[32mCJS[39m [1mdist/types/copilot-cloud-config.js.map [22m[32m356.00 B[39m
|
|
35
|
+
[32mCJS[39m [1mdist/types/index.js.map [22m[32m277.00 B[39m
|
|
36
|
+
[32mCJS[39m [1mdist/utils/decode-chat-completion-as-text.js.map [22m[32m1.34 KB[39m
|
|
37
|
+
[32mCJS[39m [1mdist/types/openai-assistant.js.map [22m[32m2.86 KB[39m
|
|
38
|
+
[32mCJS[39m [1mdist/utils/decode-chat-completion.js.map [22m[32m7.26 KB[39m
|
|
39
|
+
[32mCJS[39m [1mdist/utils/index.js.map [22m[32m33.13 KB[39m
|
|
40
|
+
[32mCJS[39m [1mdist/utils/utils.test.js.map [22m[32m354.00 B[39m
|
|
41
|
+
[32mCJS[39m [1mdist/utils/parse-chat-completion.js.map [22m[32m4.17 KB[39m
|
|
42
|
+
[32mCJS[39m [1mdist/utils/utils.js.map [22m[32m12.09 KB[39m
|
|
43
|
+
[32mCJS[39m ⚡️ Build success in 79ms
|
|
44
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m1.49 KB[39m
|
|
45
|
+
[32mESM[39m [1mdist/constants/copilot-protocol.mjs [22m[32m166.00 B[39m
|
|
46
|
+
[32mESM[39m [1mdist/types/action.mjs [22m[32m67.00 B[39m
|
|
47
|
+
[32mESM[39m [1mdist/chunk-UAPRMZEY.mjs [22m[32m43.00 B[39m
|
|
48
|
+
[32mESM[39m [1mdist/chunk-S4HGLK2E.mjs [22m[32m4.62 KB[39m
|
|
49
|
+
[32mESM[39m [1mdist/chunk-4MTSDAP6.mjs [22m[32m729.00 B[39m
|
|
50
|
+
[32mESM[39m [1mdist/chunk-CBF2BIA7.mjs [22m[32m3.62 KB[39m
|
|
51
|
+
[32mESM[39m [1mdist/chunk-HW4V75UQ.mjs [22m[32m1.63 KB[39m
|
|
52
|
+
[32mESM[39m [1mdist/chunk-DBW3BY7E.mjs [22m[32m4.92 KB[39m
|
|
53
|
+
[32mESM[39m [1mdist/constants/index.mjs [22m[32m425.00 B[39m
|
|
54
|
+
[32mESM[39m [1mdist/chunk-5VZXLWOP.mjs [22m[32m474.00 B[39m
|
|
55
|
+
[32mESM[39m [1mdist/chunk-3ZU7SB62.mjs [22m[32m200.00 B[39m
|
|
56
|
+
[32mESM[39m [1mdist/types/annotated-function.mjs [22m[32m79.00 B[39m
|
|
57
|
+
[32mESM[39m [1mdist/types/copilot-cloud-config.mjs [22m[32m81.00 B[39m
|
|
58
|
+
[32mESM[39m [1mdist/types/index.mjs [22m[32m194.00 B[39m
|
|
59
|
+
[32mESM[39m [1mdist/chunk-BANDZXMP.mjs [22m[32m43.00 B[39m
|
|
60
|
+
[32mESM[39m [1mdist/chunk-NAFEBKSO.mjs [22m[32m43.00 B[39m
|
|
61
|
+
[32mESM[39m [1mdist/chunk-YBHX4Y25.mjs [22m[32m43.00 B[39m
|
|
62
|
+
[32mESM[39m [1mdist/chunk-MSUB6DGR.mjs [22m[32m43.00 B[39m
|
|
63
|
+
[32mESM[39m [1mdist/types/openai-assistant.mjs [22m[32m77.00 B[39m
|
|
64
|
+
[32mESM[39m [1mdist/chunk-IAFBVORQ.mjs [22m[32m43.00 B[39m
|
|
65
|
+
[32mESM[39m [1mdist/utils/annotated-function.mjs [22m[32m314.00 B[39m
|
|
66
|
+
[32mESM[39m [1mdist/utils/decode-chat-completion.mjs [22m[32m150.00 B[39m
|
|
67
|
+
[32mESM[39m [1mdist/utils/index.mjs [22m[32m1001.00 B[39m
|
|
68
|
+
[32mESM[39m [1mdist/utils/decode-chat-completion-as-text.mjs [22m[32m170.00 B[39m
|
|
69
|
+
[32mESM[39m [1mdist/utils/utils.test.mjs [22m[32m170.00 B[39m
|
|
70
|
+
[32mESM[39m [1mdist/utils/parse-chat-completion.mjs [22m[32m147.00 B[39m
|
|
71
|
+
[32mESM[39m [1mdist/utils/utils.mjs [22m[32m439.00 B[39m
|
|
72
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m71.00 B[39m
|
|
73
|
+
[32mESM[39m [1mdist/constants/copilot-protocol.mjs.map [22m[32m71.00 B[39m
|
|
74
|
+
[32mESM[39m [1mdist/types/action.mjs.map [22m[32m71.00 B[39m
|
|
75
|
+
[32mESM[39m [1mdist/chunk-UAPRMZEY.mjs.map [22m[32m71.00 B[39m
|
|
76
|
+
[32mESM[39m [1mdist/chunk-S4HGLK2E.mjs.map [22m[32m8.40 KB[39m
|
|
77
|
+
[32mESM[39m [1mdist/chunk-4MTSDAP6.mjs.map [22m[32m1.30 KB[39m
|
|
78
|
+
[32mESM[39m [1mdist/chunk-CBF2BIA7.mjs.map [22m[32m7.21 KB[39m
|
|
79
|
+
[32mESM[39m [1mdist/chunk-HW4V75UQ.mjs.map [22m[32m4.12 KB[39m
|
|
80
|
+
[32mESM[39m [1mdist/chunk-DBW3BY7E.mjs.map [22m[32m12.00 KB[39m
|
|
81
|
+
[32mESM[39m [1mdist/constants/index.mjs.map [22m[32m71.00 B[39m
|
|
82
|
+
[32mESM[39m [1mdist/chunk-5VZXLWOP.mjs.map [22m[32m547.00 B[39m
|
|
83
|
+
[32mESM[39m [1mdist/chunk-3ZU7SB62.mjs.map [22m[32m214.00 B[39m
|
|
84
|
+
[32mESM[39m [1mdist/types/annotated-function.mjs.map [22m[32m71.00 B[39m
|
|
85
|
+
[32mESM[39m [1mdist/types/copilot-cloud-config.mjs.map [22m[32m71.00 B[39m
|
|
86
|
+
[32mESM[39m [1mdist/types/index.mjs.map [22m[32m71.00 B[39m
|
|
87
|
+
[32mESM[39m [1mdist/chunk-BANDZXMP.mjs.map [22m[32m71.00 B[39m
|
|
88
|
+
[32mESM[39m [1mdist/chunk-NAFEBKSO.mjs.map [22m[32m71.00 B[39m
|
|
89
|
+
[32mESM[39m [1mdist/chunk-YBHX4Y25.mjs.map [22m[32m71.00 B[39m
|
|
90
|
+
[32mESM[39m [1mdist/chunk-MSUB6DGR.mjs.map [22m[32m71.00 B[39m
|
|
91
|
+
[32mESM[39m [1mdist/types/openai-assistant.mjs.map [22m[32m71.00 B[39m
|
|
92
|
+
[32mESM[39m [1mdist/chunk-IAFBVORQ.mjs.map [22m[32m71.00 B[39m
|
|
93
|
+
[32mESM[39m [1mdist/utils/annotated-function.mjs.map [22m[32m71.00 B[39m
|
|
94
|
+
[32mESM[39m [1mdist/utils/index.mjs.map [22m[32m71.00 B[39m
|
|
95
|
+
[32mESM[39m [1mdist/utils/decode-chat-completion.mjs.map [22m[32m71.00 B[39m
|
|
96
|
+
[32mESM[39m [1mdist/utils/decode-chat-completion-as-text.mjs.map [22m[32m71.00 B[39m
|
|
97
|
+
[32mESM[39m [1mdist/utils/utils.test.mjs.map [22m[32m352.00 B[39m
|
|
98
|
+
[32mESM[39m [1mdist/utils/parse-chat-completion.mjs.map [22m[32m71.00 B[39m
|
|
99
|
+
[32mESM[39m [1mdist/utils/utils.mjs.map [22m[32m71.00 B[39m
|
|
100
|
+
[32mESM[39m ⚡️ Build success in 86ms
|
|
101
|
+
[34mDTS[39m Build start
|
|
102
|
+
[32mDTS[39m ⚡️ Build success in 2228ms
|
|
103
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.47 KB[39m
|
|
104
|
+
[32mDTS[39m [1mdist/types/openai-assistant.d.ts [22m[32m2.79 KB[39m
|
|
105
|
+
[32mDTS[39m [1mdist/types/annotated-function.d.ts [22m[32m766.00 B[39m
|
|
106
|
+
[32mDTS[39m [1mdist/types/action.d.ts [22m[32m2.24 KB[39m
|
|
107
|
+
[32mDTS[39m [1mdist/types/copilot-cloud-config.d.ts [22m[32m278.00 B[39m
|
|
108
|
+
[32mDTS[39m [1mdist/utils/utils.d.ts [22m[32m4.32 KB[39m
|
|
109
|
+
[32mDTS[39m [1mdist/utils/parse-chat-completion.d.ts [22m[32m826.00 B[39m
|
|
110
|
+
[32mDTS[39m [1mdist/utils/decode-chat-completion.d.ts [22m[32m955.00 B[39m
|
|
111
|
+
[32mDTS[39m [1mdist/utils/decode-chat-completion-as-text.d.ts [22m[32m298.00 B[39m
|
|
112
|
+
[32mDTS[39m [1mdist/utils/annotated-function.d.ts [22m[32m600.00 B[39m
|
|
113
|
+
[32mDTS[39m [1mdist/constants/index.d.ts [22m[32m496.00 B[39m
|
|
114
|
+
[32mDTS[39m [1mdist/constants/copilot-protocol.d.ts [22m[32m128.00 B[39m
|
|
115
|
+
[32mDTS[39m [1mdist/types/index.d.ts [22m[32m443.00 B[39m
|
|
116
|
+
[32mDTS[39m [1mdist/utils/index.d.ts [22m[32m892.00 B[39m
|
|
117
|
+
[32mDTS[39m [1mdist/utils/utils.test.d.ts [22m[32m12.00 B[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,58 @@
|
|
|
1
1
|
# @copilotkit/shared
|
|
2
2
|
|
|
3
|
-
## 0.9.0
|
|
3
|
+
## 0.9.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 718520b: gpt-4-turbo-april-2024 function calling fixes
|
|
8
|
+
- 95bcbd8: streamline cloud configuration
|
|
9
|
+
- 95bcbd8: Rename
|
|
10
|
+
- 95bcbd8: Upgrade langchain
|
|
11
|
+
- 95bcbd8: Support input guardrails (cloud)
|
|
12
|
+
- 95bcbd8: Unify api key handling
|
|
13
|
+
- CopilotCloud V1, useCopilotReadable and more...
|
|
14
|
+
- 95bcbd8: Get api key from headers dict
|
|
15
|
+
- 95bcbd8: Update comments
|
|
16
|
+
- 95bcbd8: Include reason in guardrails response
|
|
17
|
+
- 718520b: gpt-4-turbo-april-2024
|
|
18
|
+
- 95bcbd8: Update comments
|
|
19
|
+
- 5f6f57a: fix backend function calling return values
|
|
20
|
+
- 95bcbd8: Retrieve public API key
|
|
21
|
+
|
|
22
|
+
## 0.9.0-mme-cloud.7
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- Get api key from headers dict
|
|
27
|
+
|
|
28
|
+
## 0.9.0-mme-cloud.6
|
|
29
|
+
|
|
30
|
+
### Minor Changes
|
|
31
|
+
|
|
32
|
+
- Upgrade langchain
|
|
33
|
+
|
|
34
|
+
## 0.9.0-mme-cloud.5
|
|
35
|
+
|
|
36
|
+
### Minor Changes
|
|
37
|
+
|
|
38
|
+
- Update comments
|
|
39
|
+
|
|
40
|
+
## 0.9.0-mme-cloud.4
|
|
41
|
+
|
|
42
|
+
### Minor Changes
|
|
43
|
+
|
|
44
|
+
- Update comments
|
|
45
|
+
|
|
46
|
+
## 0.9.0-mme-cloud.3
|
|
47
|
+
|
|
48
|
+
### Minor Changes
|
|
49
|
+
|
|
50
|
+
- 85c029b: streamline cloud configuration
|
|
51
|
+
- Rename
|
|
52
|
+
- a5ade3b: Support input guardrails (cloud)
|
|
53
|
+
- 12ff590: Unify api key handling
|
|
54
|
+
- f0c4745: Include reason in guardrails response
|
|
55
|
+
- 17f4b1b: Retrieve public API key
|
|
8
56
|
|
|
9
57
|
## 0.9.0-function-calling-fixes.2
|
|
10
58
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/constants/index.ts
|
|
2
|
+
var COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
|
|
3
|
+
var COPILOT_CLOUD_VERSION = "v1";
|
|
4
|
+
var COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/${COPILOT_CLOUD_VERSION}/copilotkit/runtime/chat`;
|
|
5
|
+
var COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
COPILOT_CLOUD_API_URL,
|
|
9
|
+
COPILOT_CLOUD_VERSION,
|
|
10
|
+
COPILOT_CLOUD_CHAT_URL,
|
|
11
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=chunk-5VZXLWOP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants/index.ts"],"sourcesContent":["export * from \"./copilot-protocol\";\nexport const COPILOT_CLOUD_API_URL = \"https://api.cloud.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/${COPILOT_CLOUD_VERSION}/copilotkit/runtime/chat`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = \"X-CopilotCloud-Public-Api-Key\";\n"],"mappings":";AACO,IAAM,wBAAwB;AAC9B,IAAM,wBAAwB;AAC9B,IAAM,yBAAyB,GAAG,yBAAyB;AAC3D,IAAM,sCAAsC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-BANDZXMP.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/utils.ts"],"sourcesContent":["import { AssistantMessage, FunctionCall, JSONValue } from \"../types/openai-assistant\";\n\nexport function encodeResult(result: string): string {\n if (result === undefined) {\n return \"\";\n } else if (typeof result === \"string\") {\n return result;\n } else {\n return JSON.stringify(result);\n }\n}\n\nexport function decodeResult(result: string): any {\n try {\n return JSON.parse(result);\n } catch (e) {\n return result;\n }\n}\n\nexport interface StreamPart<CODE extends string, NAME extends string, TYPE> {\n code: CODE;\n name: NAME;\n parse: (value: JSONValue) => { type: NAME; value: TYPE };\n}\n\nconst textStreamPart: StreamPart<\"0\", \"text\", string> = {\n code: \"0\",\n name: \"text\",\n parse: (value: JSONValue) => {\n if (typeof value !== \"string\") {\n throw new Error('\"text\" parts expect a string value.');\n }\n return { type: \"text\", value };\n },\n};\n\n/**\n * This is a utility function that helps in parsing the stream parts.\n * It takes a JSONValue as input and returns an object with type and value.\n * The type is a string that represents the type of the stream part.\n * The value is the actual value of the stream part.\n * If the input value is not a string, it throws an error.\n */\nconst functionCallStreamPart: StreamPart<\"1\", \"function_call\", { function_call: FunctionCall }> = {\n code: \"1\",\n name: \"function_call\",\n parse: (value: JSONValue) => {\n if (\n value == null ||\n typeof value !== \"object\" ||\n !(\"function_call\" in value) ||\n typeof value.function_call !== \"object\" ||\n value.function_call == null ||\n !(\"name\" in value.function_call) ||\n !(\"arguments\" in value.function_call) ||\n typeof value.function_call.name !== \"string\" ||\n typeof value.function_call.arguments !== \"string\"\n ) {\n throw new Error('\"function_call\" parts expect an object with a \"function_call\" property.');\n }\n\n return {\n type: \"function_call\",\n value: value as unknown as { function_call: FunctionCall },\n };\n },\n};\n\nconst dataStreamPart: StreamPart<\"2\", \"data\", Array<JSONValue>> = {\n code: \"2\",\n name: \"data\",\n parse: (value: JSONValue) => {\n if (!Array.isArray(value)) {\n throw new Error('\"data\" parts expect an array value.');\n }\n\n return { type: \"data\", value };\n },\n};\n\nconst errorStreamPart: StreamPart<\"3\", \"error\", string> = {\n code: \"3\",\n name: \"error\",\n parse: (value: JSONValue) => {\n if (typeof value !== \"string\") {\n throw new Error('\"error\" parts expect a string value.');\n }\n return { type: \"error\", value };\n },\n};\n\nconst assistantMessage: StreamPart<\"4\", \"assistant_message\", AssistantMessage> = {\n code: \"4\",\n name: \"assistant_message\",\n parse: (value: JSONValue) => {\n if (\n value == null ||\n typeof value !== \"object\" ||\n !(\"id\" in value) ||\n !(\"role\" in value) ||\n !(\"content\" in value) ||\n typeof value.id !== \"string\" ||\n typeof value.role !== \"string\" ||\n value.role !== \"assistant\" ||\n !Array.isArray(value.content) ||\n !value.content.every(\n (item) =>\n item != null &&\n typeof item === \"object\" &&\n \"type\" in item &&\n item.type === \"text\" &&\n \"text\" in item &&\n item.text != null &&\n typeof item.text === \"object\" &&\n \"value\" in item.text &&\n typeof item.text.value === \"string\",\n )\n ) {\n throw new Error(\n '\"assistant_message\" parts expect an object with an \"id\", \"role\", and \"content\" property.',\n );\n }\n\n return {\n type: \"assistant_message\",\n value: value as AssistantMessage,\n };\n },\n};\n\nconst assistantControlData: StreamPart<\n \"5\",\n \"assistant_control_data\",\n {\n threadId: string;\n messageId: string;\n }\n> = {\n code: \"5\",\n name: \"assistant_control_data\",\n parse: (value: JSONValue) => {\n if (\n value == null ||\n typeof value !== \"object\" ||\n !(\"threadId\" in value) ||\n !(\"messageId\" in value) ||\n typeof value.threadId !== \"string\" ||\n typeof value.messageId !== \"string\"\n ) {\n throw new Error(\n '\"assistant_control_data\" parts expect an object with a \"threadId\" and \"messageId\" property.',\n );\n }\n\n return {\n type: \"assistant_control_data\",\n value: {\n threadId: value.threadId,\n messageId: value.messageId,\n },\n };\n },\n};\n\nconst streamParts = [\n textStreamPart,\n functionCallStreamPart,\n dataStreamPart,\n errorStreamPart,\n assistantMessage,\n assistantControlData,\n] as const;\n\n// union type of all stream parts\ntype StreamParts =\n | typeof textStreamPart\n | typeof functionCallStreamPart\n | typeof dataStreamPart\n | typeof errorStreamPart\n | typeof assistantMessage\n | typeof assistantControlData;\n\n/**\n * Maps the type of a stream part to its value type.\n */\ntype StreamPartValueType = {\n [P in StreamParts as P[\"name\"]]: ReturnType<P[\"parse\"]>[\"value\"];\n};\n\nexport type StreamPartType =\n | ReturnType<typeof textStreamPart.parse>\n | ReturnType<typeof functionCallStreamPart.parse>\n | ReturnType<typeof dataStreamPart.parse>\n | ReturnType<typeof errorStreamPart.parse>\n | ReturnType<typeof assistantMessage.parse>\n | ReturnType<typeof assistantControlData.parse>;\n\nexport const streamPartsByCode = {\n [textStreamPart.code]: textStreamPart,\n [functionCallStreamPart.code]: functionCallStreamPart,\n [dataStreamPart.code]: dataStreamPart,\n [errorStreamPart.code]: errorStreamPart,\n [assistantMessage.code]: assistantMessage,\n [assistantControlData.code]: assistantControlData,\n} as const;\n\n/**\n * The map of prefixes for data in the stream\n *\n * - 0: Text from the LLM response\n * - 1: (OpenAI) function_call responses\n * - 2: custom JSON added by the user using `Data`\n *\n * Example:\n * ```\n * 0:Vercel\n * 0:'s\n * 0: AI\n * 0: AI\n * 0: SDK\n * 0: is great\n * 0:!\n * 2: { \"someJson\": \"value\" }\n * 1: {\"function_call\": {\"name\": \"get_current_weather\", \"arguments\": \"{\\\\n\\\\\"location\\\\\": \\\\\"Charlottesville, Virginia\\\\\",\\\\n\\\\\"format\\\\\": \\\\\"celsius\\\\\"\\\\n}\"}}\n *```\n */\nexport const StreamStringPrefixes = {\n [textStreamPart.name]: textStreamPart.code,\n [functionCallStreamPart.name]: functionCallStreamPart.code,\n [dataStreamPart.name]: dataStreamPart.code,\n [errorStreamPart.name]: errorStreamPart.code,\n [assistantMessage.name]: assistantMessage.code,\n [assistantControlData.name]: assistantControlData.code,\n} as const;\n\nexport const validCodes = streamParts.map((part) => part.code);\n\n/**\n * Parses a stream part from a string.\n *\n * @param line The string to parse.\n * @returns The parsed stream part.\n * @throws An error if the string cannot be parsed.\n */\nexport const parseStreamPart = (line: string): StreamPartType => {\n const firstSeparatorIndex = line.indexOf(\":\");\n\n if (firstSeparatorIndex === -1) {\n throw new Error(\"Failed to parse stream string. No separator found.\");\n }\n\n const prefix = line.slice(0, firstSeparatorIndex);\n\n if (!validCodes.includes(prefix as keyof typeof streamPartsByCode)) {\n throw new Error(`Failed to parse stream string. Invalid code ${prefix}.`);\n }\n\n const code = prefix as keyof typeof streamPartsByCode;\n\n const textValue = line.slice(firstSeparatorIndex + 1);\n const jsonValue: JSONValue = JSON.parse(textValue);\n\n return streamPartsByCode[code].parse(jsonValue);\n};\n\n/**\n * Prepends a string with a prefix from the `StreamChunkPrefixes`, JSON-ifies it,\n * and appends a new line.\n *\n * It ensures type-safety for the part type and value.\n */\nexport function formatStreamPart<T extends keyof StreamPartValueType>(\n type: T,\n value: StreamPartValueType[T],\n): StreamString {\n const streamPart = streamParts.find((part) => part.name === type);\n\n if (!streamPart) {\n throw new Error(`Invalid stream part type: ${type}`);\n }\n\n return `${streamPart.code}:${JSON.stringify(value)}\\n`;\n}\n\nexport const isStreamStringEqualToType = (\n type: keyof typeof StreamStringPrefixes,\n value: string,\n): value is StreamString =>\n value.startsWith(`${StreamStringPrefixes[type]}:`) && value.endsWith(\"\\n\");\n\nexport type StreamString =\n `${typeof StreamStringPrefixes[keyof typeof StreamStringPrefixes]}:${string}\\n`;\n\n/**\n * A header sent to the client so it knows how to handle parsing the stream (as a deprecated text response or using the new prefixed protocol)\n */\nexport const COMPLEX_HEADER = \"X-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D;AAEA,SAAO,GAAG,WAAW,QAAQ,KAAK,UAAU,KAAK;AAAA;AACnD;AAEO,IAAM,4BAA4B,CACvC,MACA,UAEA,MAAM,WAAW,GAAG,qBAAqB,IAAI,IAAI,KAAK,MAAM,SAAS,IAAI;AAQpE,IAAM,iBAAiB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/utils/utils.ts"],"sourcesContent":["import { AssistantMessage, FunctionCall, JSONValue } from \"../types/openai-assistant\";\n\nexport function encodeResult(result: string): string {\n if (result === undefined) {\n return \"\";\n } else if (typeof result === \"string\") {\n return result;\n } else {\n return JSON.stringify(result);\n }\n}\n\nexport function decodeResult(result: string): any {\n try {\n return JSON.parse(result);\n } catch (e) {\n return result;\n }\n}\n\nexport interface StreamPart<CODE extends string, NAME extends string, TYPE> {\n code: CODE;\n name: NAME;\n parse: (value: JSONValue) => { type: NAME; value: TYPE };\n}\n\nconst textStreamPart: StreamPart<\"0\", \"text\", string> = {\n code: \"0\",\n name: \"text\",\n parse: (value: JSONValue) => {\n if (typeof value !== \"string\") {\n throw new Error('\"text\" parts expect a string value.');\n }\n return { type: \"text\", value };\n },\n};\n\n/**\n * This is a utility function that helps in parsing the stream parts.\n * It takes a JSONValue as input and returns an object with type and value.\n * The type is a string that represents the type of the stream part.\n * The value is the actual value of the stream part.\n * If the input value is not a string, it throws an error.\n */\nconst functionCallStreamPart: StreamPart<\"1\", \"function_call\", { function_call: FunctionCall }> = {\n code: \"1\",\n name: \"function_call\",\n parse: (value: JSONValue) => {\n if (\n value == null ||\n typeof value !== \"object\" ||\n !(\"function_call\" in value) ||\n typeof value.function_call !== \"object\" ||\n value.function_call == null ||\n !(\"name\" in value.function_call) ||\n !(\"arguments\" in value.function_call) ||\n typeof value.function_call.name !== \"string\" ||\n typeof value.function_call.arguments !== \"string\"\n ) {\n throw new Error('\"function_call\" parts expect an object with a \"function_call\" property.');\n }\n\n return {\n type: \"function_call\",\n value: value as unknown as { function_call: FunctionCall },\n };\n },\n};\n\nconst dataStreamPart: StreamPart<\"2\", \"data\", Array<JSONValue>> = {\n code: \"2\",\n name: \"data\",\n parse: (value: JSONValue) => {\n if (!Array.isArray(value)) {\n throw new Error('\"data\" parts expect an array value.');\n }\n\n return { type: \"data\", value };\n },\n};\n\nconst errorStreamPart: StreamPart<\"3\", \"error\", string> = {\n code: \"3\",\n name: \"error\",\n parse: (value: JSONValue) => {\n if (typeof value !== \"string\") {\n throw new Error('\"error\" parts expect a string value.');\n }\n return { type: \"error\", value };\n },\n};\n\nconst assistantMessage: StreamPart<\"4\", \"assistant_message\", AssistantMessage> = {\n code: \"4\",\n name: \"assistant_message\",\n parse: (value: JSONValue) => {\n if (\n value == null ||\n typeof value !== \"object\" ||\n !(\"id\" in value) ||\n !(\"role\" in value) ||\n !(\"content\" in value) ||\n typeof value.id !== \"string\" ||\n typeof value.role !== \"string\" ||\n value.role !== \"assistant\" ||\n !Array.isArray(value.content) ||\n !value.content.every(\n (item) =>\n item != null &&\n typeof item === \"object\" &&\n \"type\" in item &&\n item.type === \"text\" &&\n \"text\" in item &&\n item.text != null &&\n typeof item.text === \"object\" &&\n \"value\" in item.text &&\n typeof item.text.value === \"string\",\n )\n ) {\n throw new Error(\n '\"assistant_message\" parts expect an object with an \"id\", \"role\", and \"content\" property.',\n );\n }\n\n return {\n type: \"assistant_message\",\n value: value as AssistantMessage,\n };\n },\n};\n\nconst assistantControlData: StreamPart<\n \"5\",\n \"assistant_control_data\",\n {\n threadId: string;\n messageId: string;\n }\n> = {\n code: \"5\",\n name: \"assistant_control_data\",\n parse: (value: JSONValue) => {\n if (\n value == null ||\n typeof value !== \"object\" ||\n !(\"threadId\" in value) ||\n !(\"messageId\" in value) ||\n typeof value.threadId !== \"string\" ||\n typeof value.messageId !== \"string\"\n ) {\n throw new Error(\n '\"assistant_control_data\" parts expect an object with a \"threadId\" and \"messageId\" property.',\n );\n }\n\n return {\n type: \"assistant_control_data\",\n value: {\n threadId: value.threadId,\n messageId: value.messageId,\n },\n };\n },\n};\n\nconst streamParts = [\n textStreamPart,\n functionCallStreamPart,\n dataStreamPart,\n errorStreamPart,\n assistantMessage,\n assistantControlData,\n] as const;\n\n// union type of all stream parts\ntype StreamParts =\n | typeof textStreamPart\n | typeof functionCallStreamPart\n | typeof dataStreamPart\n | typeof errorStreamPart\n | typeof assistantMessage\n | typeof assistantControlData;\n\n/**\n * Maps the type of a stream part to its value type.\n */\ntype StreamPartValueType = {\n [P in StreamParts as P[\"name\"]]: ReturnType<P[\"parse\"]>[\"value\"];\n};\n\nexport type StreamPartType =\n | ReturnType<typeof textStreamPart.parse>\n | ReturnType<typeof functionCallStreamPart.parse>\n | ReturnType<typeof dataStreamPart.parse>\n | ReturnType<typeof errorStreamPart.parse>\n | ReturnType<typeof assistantMessage.parse>\n | ReturnType<typeof assistantControlData.parse>;\n\nexport const streamPartsByCode = {\n [textStreamPart.code]: textStreamPart,\n [functionCallStreamPart.code]: functionCallStreamPart,\n [dataStreamPart.code]: dataStreamPart,\n [errorStreamPart.code]: errorStreamPart,\n [assistantMessage.code]: assistantMessage,\n [assistantControlData.code]: assistantControlData,\n} as const;\n\n/**\n * The map of prefixes for data in the stream\n *\n * - 0: Text from the LLM response\n * - 1: (OpenAI) function_call responses\n * - 2: custom JSON added by the user using `Data`\n *\n * Example:\n * ```\n * 0:Vercel\n * 0:'s\n * 0: AI\n * 0: AI\n * 0: SDK\n * 0: is great\n * 0:!\n * 2: { \"someJson\": \"value\" }\n * 1: {\"function_call\": {\"name\": \"get_current_weather\", \"arguments\": \"{\\\\n\\\\\"location\\\\\": \\\\\"Charlottesville, Virginia\\\\\",\\\\n\\\\\"format\\\\\": \\\\\"celsius\\\\\"\\\\n}\"}}\n *```\n */\nexport const StreamStringPrefixes = {\n [textStreamPart.name]: textStreamPart.code,\n [functionCallStreamPart.name]: functionCallStreamPart.code,\n [dataStreamPart.name]: dataStreamPart.code,\n [errorStreamPart.name]: errorStreamPart.code,\n [assistantMessage.name]: assistantMessage.code,\n [assistantControlData.name]: assistantControlData.code,\n} as const;\n\nexport const validCodes = streamParts.map((part) => part.code);\n\n/**\n * Parses a stream part from a string.\n *\n * @param line The string to parse.\n * @returns The parsed stream part.\n * @throws An error if the string cannot be parsed.\n */\nexport const parseStreamPart = (line: string): StreamPartType => {\n const firstSeparatorIndex = line.indexOf(\":\");\n\n if (firstSeparatorIndex === -1) {\n throw new Error(\"Failed to parse stream string. No separator found.\");\n }\n\n const prefix = line.slice(0, firstSeparatorIndex);\n\n if (!validCodes.includes(prefix as keyof typeof streamPartsByCode)) {\n throw new Error(`Failed to parse stream string. Invalid code ${prefix}.`);\n }\n\n const code = prefix as keyof typeof streamPartsByCode;\n\n const textValue = line.slice(firstSeparatorIndex + 1);\n const jsonValue: JSONValue = JSON.parse(textValue);\n\n return streamPartsByCode[code].parse(jsonValue);\n};\n\n/**\n * Prepends a string with a prefix from the `StreamChunkPrefixes`, JSON-ifies it,\n * and appends a new line.\n *\n * It ensures type-safety for the part type and value.\n */\nexport function formatStreamPart<T extends keyof StreamPartValueType>(\n type: T,\n value: StreamPartValueType[T],\n): StreamString {\n const streamPart = streamParts.find((part) => part.name === type);\n\n if (!streamPart) {\n throw new Error(`Invalid stream part type: ${type}`);\n }\n\n return `${streamPart.code}:${JSON.stringify(value)}\\n`;\n}\n\nexport const isStreamStringEqualToType = (\n type: keyof typeof StreamStringPrefixes,\n value: string,\n): value is StreamString =>\n value.startsWith(`${StreamStringPrefixes[type]}:`) && value.endsWith(\"\\n\");\n\nexport type StreamString =\n `${(typeof StreamStringPrefixes)[keyof typeof StreamStringPrefixes]}:${string}\\n`;\n\n/**\n * A header sent to the client so it knows how to handle parsing the stream (as a deprecated text response or using the new prefixed protocol)\n */\nexport const COMPLEX_HEADER = \"X-Experimental-Stream-Data\";\n"],"mappings":";AAEO,SAAS,aAAa,QAAwB;AACnD,MAAI,WAAW,QAAW;AACxB,WAAO;AAAA,EACT,WAAW,OAAO,WAAW,UAAU;AACrC,WAAO;AAAA,EACT,OAAO;AAC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S,IAAI;AAQpE,IAAM,iBAAiB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-MSUB6DGR.mjs.map
|
|
@@ -42,10 +42,13 @@ function convertAttribute(attribute) {
|
|
|
42
42
|
};
|
|
43
43
|
case "object":
|
|
44
44
|
case "object[]":
|
|
45
|
-
const properties = (_a = attribute.attributes) == null ? void 0 : _a.reduce(
|
|
46
|
-
acc
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
const properties = (_a = attribute.attributes) == null ? void 0 : _a.reduce(
|
|
46
|
+
(acc, attr) => {
|
|
47
|
+
acc[attr.name] = convertAttribute(attr);
|
|
48
|
+
return acc;
|
|
49
|
+
},
|
|
50
|
+
{}
|
|
51
|
+
);
|
|
49
52
|
const required = (_b = attribute.attributes) == null ? void 0 : _b.filter((attr) => attr.required !== false).map((attr) => attr.name);
|
|
50
53
|
if (attribute.type === "object[]") {
|
|
51
54
|
return {
|
|
@@ -157,4 +160,4 @@ export {
|
|
|
157
160
|
actionToChatCompletionFunction,
|
|
158
161
|
annotatedFunctionToAction
|
|
159
162
|
};
|
|
160
|
-
//# sourceMappingURL=chunk-
|
|
163
|
+
//# sourceMappingURL=chunk-S4HGLK2E.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/annotated-function.ts"],"sourcesContent":["import { Action, AnnotatedFunction, ToolDefinition, Parameter } from \"../types\";\n\nexport function annotatedFunctionToChatCompletionFunction(\n annotatedFunction: AnnotatedFunction<any[]>,\n): ToolDefinition {\n // Create the parameters object based on the argumentAnnotations\n let parameters: { [key: string]: any } = {};\n for (let arg of annotatedFunction.argumentAnnotations) {\n // isolate the args we should forward inline\n let { name, required, ...forwardedArgs } = arg;\n parameters[arg.name] = forwardedArgs;\n }\n\n let requiredParameterNames: string[] = [];\n for (let arg of annotatedFunction.argumentAnnotations) {\n if (arg.required) {\n requiredParameterNames.push(arg.name);\n }\n }\n\n // Create the ChatCompletionFunctions object\n let chatCompletionFunction: ToolDefinition = {\n type: \"function\",\n function: {\n name: annotatedFunction.name,\n description: annotatedFunction.description,\n parameters: {\n type: \"object\",\n properties: parameters,\n required: requiredParameterNames,\n },\n },\n };\n\n return chatCompletionFunction;\n}\n\nfunction convertAttribute(attribute: Parameter): any {\n switch (attribute.type) {\n case \"string\":\n return {\n type: \"string\",\n description: attribute.description,\n ...(attribute.enum && { enum: attribute.enum }),\n };\n case \"number\":\n case \"boolean\":\n return {\n type: attribute.type,\n description: attribute.description,\n };\n case \"object\":\n case \"object[]\":\n const properties = attribute.attributes?.reduce(\n (acc, attr) => {\n acc[attr.name] = convertAttribute(attr);\n return acc;\n },\n {} as Record<string, any>,\n );\n const required = attribute.attributes\n ?.filter((attr) => attr.required !== false)\n .map((attr) => attr.name);\n if (attribute.type === \"object[]\") {\n return {\n type: \"array\",\n items: {\n type: \"object\",\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n },\n description: attribute.description,\n };\n }\n return {\n type: \"object\",\n description: attribute.description,\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n };\n default:\n // Handle arrays of primitive types and undefined attribute.type\n if (attribute.type?.endsWith(\"[]\")) {\n const itemType = attribute.type.slice(0, -2);\n return {\n type: \"array\",\n items: { type: itemType },\n description: attribute.description,\n };\n }\n // Fallback for undefined type or any other unexpected type\n return {\n type: \"string\",\n description: attribute.description,\n };\n }\n}\n\nexport function actionToChatCompletionFunction(action: Action<any>): ToolDefinition {\n // Create the parameters object based on the argumentAnnotations\n let parameters: { [key: string]: any } = {};\n for (let parameter of action.parameters || []) {\n parameters[parameter.name] = convertAttribute(parameter);\n }\n\n let requiredParameterNames: string[] = [];\n for (let arg of action.parameters || []) {\n if (arg.required !== false) {\n requiredParameterNames.push(arg.name);\n }\n }\n\n // Create the ChatCompletionFunctions object\n let chatCompletionFunction: ToolDefinition = {\n type: \"function\",\n function: {\n name: action.name,\n ...(action.description && { description: action.description }),\n parameters: {\n type: \"object\",\n properties: parameters,\n required: requiredParameterNames,\n },\n },\n };\n\n return chatCompletionFunction;\n}\n\nexport function annotatedFunctionToAction(\n annotatedFunction: AnnotatedFunction<any[]>,\n): Action<any> {\n const parameters: Parameter[] = annotatedFunction.argumentAnnotations.map((annotation) => {\n switch (annotation.type) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n case \"object\":\n return {\n name: annotation.name,\n description: annotation.description,\n type: annotation.type,\n required: annotation.required,\n };\n case \"array\":\n let type;\n if (annotation.items.type === \"string\") {\n type = \"string[]\";\n } else if (annotation.items.type === \"number\") {\n type = \"number[]\";\n } else if (annotation.items.type === \"boolean\") {\n type = \"boolean[]\";\n } else if (annotation.items.type === \"object\") {\n type = \"object[]\";\n } else {\n type = \"string[]\";\n }\n return {\n name: annotation.name,\n description: annotation.description,\n type: type as any,\n required: annotation.required,\n };\n }\n });\n\n return {\n name: annotatedFunction.name,\n description: annotatedFunction.description,\n parameters: parameters,\n handler: (args) => {\n const paramsInCorrectOrder: any[] = [];\n for (let arg of annotatedFunction.argumentAnnotations) {\n paramsInCorrectOrder.push(args[arg.name]);\n }\n return annotatedFunction.implementation(...paramsInCorrectOrder);\n },\n };\n}\n"],"mappings":";AAEO,SAAS,0CACd,mBACgB;AAEhB,MAAI,aAAqC,CAAC;AAC1C,WAAS,OAAO,kBAAkB,qBAAqB;AAErD,QAAI,EAAE,MAAM,UAAU,GAAG,cAAc,IAAI;AAC3C,eAAW,IAAI,IAAI,IAAI;AAAA,EACzB;AAEA,MAAI,yBAAmC,CAAC;AACxC,WAAS,OAAO,kBAAkB,qBAAqB;AACrD,QAAI,IAAI,UAAU;AAChB,6BAAuB,KAAK,IAAI,IAAI;AAAA,IACtC;AAAA,EACF;AAGA,MAAI,yBAAyC;AAAA,IAC3C,MAAM;AAAA,IACN,UAAU;AAAA,MACR,MAAM,kBAAkB;AAAA,MACxB,aAAa,kBAAkB;AAAA,MAC/B,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAA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AAO;AAAA,QACT;AACA,eAAO;AAAA,UACL,MAAM,WAAW;AAAA,UACjB,aAAa,WAAW;AAAA,UACxB;AAAA,UACA,UAAU,WAAW;AAAA,QACvB;AAAA,IACJ;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,MAAM,kBAAkB;AAAA,IACxB,aAAa,kBAAkB;AAAA,IAC/B;AAAA,IACA,SAAS,CAAC,SAAS;AACjB,YAAM,uBAA8B,CAAC;AACrC,eAAS,OAAO,kBAAkB,qBAAqB;AACrD,6BAAqB,KAAK,KAAK,IAAI,IAAI,CAAC;AAAA,MAC1C;AACA,aAAO,kBAAkB,eAAe,GAAG,oBAAoB;AAAA,IACjE;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +1,8 @@
|
|
|
1
1
|
export { EXCLUDE_FROM_FORWARD_PROPS_KEYS } from './copilot-protocol.js';
|
|
2
|
+
|
|
3
|
+
declare const COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
|
|
4
|
+
declare const COPILOT_CLOUD_VERSION = "v1";
|
|
5
|
+
declare const COPILOT_CLOUD_CHAT_URL = "https://api.cloud.copilotkit.ai/v1/copilotkit/runtime/chat";
|
|
6
|
+
declare const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
|
|
7
|
+
|
|
8
|
+
export { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION };
|
package/dist/constants/index.js
CHANGED
|
@@ -20,14 +20,28 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/constants/index.ts
|
|
21
21
|
var constants_exports = {};
|
|
22
22
|
__export(constants_exports, {
|
|
23
|
+
COPILOT_CLOUD_API_URL: () => COPILOT_CLOUD_API_URL,
|
|
24
|
+
COPILOT_CLOUD_CHAT_URL: () => COPILOT_CLOUD_CHAT_URL,
|
|
25
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER: () => COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
26
|
+
COPILOT_CLOUD_VERSION: () => COPILOT_CLOUD_VERSION,
|
|
23
27
|
EXCLUDE_FROM_FORWARD_PROPS_KEYS: () => EXCLUDE_FROM_FORWARD_PROPS_KEYS
|
|
24
28
|
});
|
|
25
29
|
module.exports = __toCommonJS(constants_exports);
|
|
26
30
|
|
|
27
31
|
// src/constants/copilot-protocol.ts
|
|
28
32
|
var EXCLUDE_FROM_FORWARD_PROPS_KEYS = "exclude_from_forward_props_keys";
|
|
33
|
+
|
|
34
|
+
// src/constants/index.ts
|
|
35
|
+
var COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
|
|
36
|
+
var COPILOT_CLOUD_VERSION = "v1";
|
|
37
|
+
var COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/${COPILOT_CLOUD_VERSION}/copilotkit/runtime/chat`;
|
|
38
|
+
var COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
|
|
29
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30
40
|
0 && (module.exports = {
|
|
41
|
+
COPILOT_CLOUD_API_URL,
|
|
42
|
+
COPILOT_CLOUD_CHAT_URL,
|
|
43
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
44
|
+
COPILOT_CLOUD_VERSION,
|
|
31
45
|
EXCLUDE_FROM_FORWARD_PROPS_KEYS
|
|
32
46
|
});
|
|
33
47
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants/index.ts","../../src/constants/copilot-protocol.ts"],"sourcesContent":["export * from \"./copilot-protocol\";\n","export const EXCLUDE_FROM_FORWARD_PROPS_KEYS = \"exclude_from_forward_props_keys\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,kCAAkC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/constants/index.ts","../../src/constants/copilot-protocol.ts"],"sourcesContent":["export * from \"./copilot-protocol\";\nexport const COPILOT_CLOUD_API_URL = \"https://api.cloud.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/${COPILOT_CLOUD_VERSION}/copilotkit/runtime/chat`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = \"X-CopilotCloud-Public-Api-Key\";\n","export const EXCLUDE_FROM_FORWARD_PROPS_KEYS = \"exclude_from_forward_props_keys\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,kCAAkC;;;ADCxC,IAAM,wBAAwB;AAC9B,IAAM,wBAAwB;AAC9B,IAAM,yBAAyB,GAAG,yBAAyB;AAC3D,IAAM,sCAAsC;","names":[]}
|
package/dist/constants/index.mjs
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
COPILOT_CLOUD_API_URL,
|
|
3
|
+
COPILOT_CLOUD_CHAT_URL,
|
|
4
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
5
|
+
COPILOT_CLOUD_VERSION
|
|
6
|
+
} from "../chunk-5VZXLWOP.mjs";
|
|
2
7
|
import {
|
|
3
8
|
EXCLUDE_FROM_FORWARD_PROPS_KEYS
|
|
4
9
|
} from "../chunk-3ZU7SB62.mjs";
|
|
5
10
|
export {
|
|
11
|
+
COPILOT_CLOUD_API_URL,
|
|
12
|
+
COPILOT_CLOUD_CHAT_URL,
|
|
13
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
14
|
+
COPILOT_CLOUD_VERSION,
|
|
6
15
|
EXCLUDE_FROM_FORWARD_PROPS_KEYS
|
|
7
16
|
};
|
|
8
17
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export { AssistantMessage, FunctionCall, FunctionCallHandler, FunctionDefinition, JSONValue, Message, Role, ToolDefinition } from './types/openai-assistant.js';
|
|
2
2
|
export { AnnotatedFunction, AnnotatedFunctionArgument, AnnotatedFunctionArrayArgument, AnnotatedFunctionSimpleArgument } from './types/annotated-function.js';
|
|
3
3
|
export { Action, MappedParameterTypes, Parameter } from './types/action.js';
|
|
4
|
+
export { CopilotCloudConfig } from './types/copilot-cloud-config.js';
|
|
4
5
|
export { COMPLEX_HEADER, StreamPart, StreamPartType, StreamString, StreamStringPrefixes, decodeResult, encodeResult, formatStreamPart, isStreamStringEqualToType, parseStreamPart, streamPartsByCode, validCodes } from './utils/utils.js';
|
|
5
6
|
export { ChatCompletionChunk, ToolCallFunctionCall, ToolCallPayload, parseChatCompletion } from './utils/parse-chat-completion.js';
|
|
6
7
|
export { ChatCompletionContentEvent, ChatCompletionEvent, ChatCompletionFunctionEvent, ChatCompletionPartialEvent, ChatCompletionResultEvent, decodeChatCompletion } from './utils/decode-chat-completion.js';
|
|
7
8
|
export { decodeChatCompletionAsText } from './utils/decode-chat-completion-as-text.js';
|
|
8
9
|
export { actionToChatCompletionFunction, annotatedFunctionToAction, annotatedFunctionToChatCompletionFunction } from './utils/annotated-function.js';
|
|
10
|
+
export { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION } from './constants/index.js';
|
|
9
11
|
export { EXCLUDE_FROM_FORWARD_PROPS_KEYS } from './constants/copilot-protocol.js';
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
23
|
COMPLEX_HEADER: () => COMPLEX_HEADER,
|
|
24
|
+
COPILOT_CLOUD_API_URL: () => COPILOT_CLOUD_API_URL,
|
|
25
|
+
COPILOT_CLOUD_CHAT_URL: () => COPILOT_CLOUD_CHAT_URL,
|
|
26
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER: () => COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
27
|
+
COPILOT_CLOUD_VERSION: () => COPILOT_CLOUD_VERSION,
|
|
24
28
|
EXCLUDE_FROM_FORWARD_PROPS_KEYS: () => EXCLUDE_FROM_FORWARD_PROPS_KEYS,
|
|
25
29
|
StreamStringPrefixes: () => StreamStringPrefixes,
|
|
26
30
|
actionToChatCompletionFunction: () => actionToChatCompletionFunction,
|
|
@@ -424,10 +428,13 @@ function convertAttribute(attribute) {
|
|
|
424
428
|
};
|
|
425
429
|
case "object":
|
|
426
430
|
case "object[]":
|
|
427
|
-
const properties = (_a = attribute.attributes) == null ? void 0 : _a.reduce(
|
|
428
|
-
acc
|
|
429
|
-
|
|
430
|
-
|
|
431
|
+
const properties = (_a = attribute.attributes) == null ? void 0 : _a.reduce(
|
|
432
|
+
(acc, attr) => {
|
|
433
|
+
acc[attr.name] = convertAttribute(attr);
|
|
434
|
+
return acc;
|
|
435
|
+
},
|
|
436
|
+
{}
|
|
437
|
+
);
|
|
431
438
|
const required = (_b = attribute.attributes) == null ? void 0 : _b.filter((attr) => attr.required !== false).map((attr) => attr.name);
|
|
432
439
|
if (attribute.type === "object[]") {
|
|
433
440
|
return {
|
|
@@ -536,9 +543,19 @@ function annotatedFunctionToAction(annotatedFunction) {
|
|
|
536
543
|
|
|
537
544
|
// src/constants/copilot-protocol.ts
|
|
538
545
|
var EXCLUDE_FROM_FORWARD_PROPS_KEYS = "exclude_from_forward_props_keys";
|
|
546
|
+
|
|
547
|
+
// src/constants/index.ts
|
|
548
|
+
var COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
|
|
549
|
+
var COPILOT_CLOUD_VERSION = "v1";
|
|
550
|
+
var COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/${COPILOT_CLOUD_VERSION}/copilotkit/runtime/chat`;
|
|
551
|
+
var COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
|
|
539
552
|
// Annotate the CommonJS export names for ESM import in node:
|
|
540
553
|
0 && (module.exports = {
|
|
541
554
|
COMPLEX_HEADER,
|
|
555
|
+
COPILOT_CLOUD_API_URL,
|
|
556
|
+
COPILOT_CLOUD_CHAT_URL,
|
|
557
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
558
|
+
COPILOT_CLOUD_VERSION,
|
|
542
559
|
EXCLUDE_FROM_FORWARD_PROPS_KEYS,
|
|
543
560
|
StreamStringPrefixes,
|
|
544
561
|
actionToChatCompletionFunction,
|