@copilotkit/react-core 0.16.0-alpha.3 → 0.16.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.
Files changed (44) hide show
  1. package/.turbo/turbo-build.log +133 -133
  2. package/CHANGELOG.md +2 -40
  3. package/dist/{chunk-OFRZZ5OF.mjs → chunk-DE37LEZJ.mjs} +3 -3
  4. package/dist/{chunk-6LKBKYRJ.mjs → chunk-EV26IMLL.mjs} +3 -3
  5. package/dist/chunk-EV26IMLL.mjs.map +1 -0
  6. package/dist/{chunk-6N6X7K7T.mjs → chunk-F2JIAPZQ.mjs} +2 -2
  7. package/dist/chunk-F2JIAPZQ.mjs.map +1 -0
  8. package/dist/{chunk-JHJ7LUTD.mjs → chunk-IF64NU27.mjs} +3 -3
  9. package/dist/{chunk-45PUEKTG.mjs → chunk-PF7LXYPO.mjs} +2 -2
  10. package/dist/{chunk-6LNDDH6K.mjs → chunk-RFZQHCNS.mjs} +2 -2
  11. package/dist/{chunk-E3P5YZO2.mjs → chunk-WL2MC3E2.mjs} +2 -2
  12. package/dist/{chunk-3MAIWZNZ.mjs → chunk-YGJFU4ZP.mjs} +1 -1
  13. package/dist/{chunk-3MAIWZNZ.mjs.map → chunk-YGJFU4ZP.mjs.map} +1 -1
  14. package/dist/components/copilot-provider/copilot-provider.d.ts +8 -3
  15. package/dist/components/copilot-provider/copilot-provider.mjs +3 -3
  16. package/dist/components/copilot-provider/index.mjs +3 -3
  17. package/dist/components/copilot-provider/standard-copilot-api-config.mjs +4 -0
  18. package/dist/components/index.mjs +3 -3
  19. package/dist/context/copilot-context.d.ts +2 -2
  20. package/dist/context/copilot-context.mjs +1 -1
  21. package/dist/context/index.mjs +1 -1
  22. package/dist/hooks/index.mjs +7 -7
  23. package/dist/hooks/use-copilot-chat.mjs +4 -4
  24. package/dist/hooks/use-make-copilot-actionable.mjs +2 -2
  25. package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
  26. package/dist/hooks/use-make-copilot-readable.mjs +2 -2
  27. package/dist/index.mjs +9 -9
  28. package/dist/openai-assistants/hooks/index.mjs +4 -4
  29. package/dist/openai-assistants/hooks/use-copilot-chat-v2.mjs +4 -4
  30. package/dist/openai-assistants/index.mjs +4 -4
  31. package/package.json +4 -4
  32. package/src/components/copilot-provider/copilot-provider.tsx +10 -4
  33. package/src/context/copilot-context.tsx +2 -2
  34. package/dist/chunk-6LKBKYRJ.mjs.map +0 -1
  35. package/dist/chunk-6N6X7K7T.mjs.map +0 -1
  36. package/dist/components/copilot-provider/standard-cpilot-api-config.mjs +0 -4
  37. /package/dist/{chunk-OFRZZ5OF.mjs.map → chunk-DE37LEZJ.mjs.map} +0 -0
  38. /package/dist/{chunk-JHJ7LUTD.mjs.map → chunk-IF64NU27.mjs.map} +0 -0
  39. /package/dist/{chunk-45PUEKTG.mjs.map → chunk-PF7LXYPO.mjs.map} +0 -0
  40. /package/dist/{chunk-6LNDDH6K.mjs.map → chunk-RFZQHCNS.mjs.map} +0 -0
  41. /package/dist/{chunk-E3P5YZO2.mjs.map → chunk-WL2MC3E2.mjs.map} +0 -0
  42. /package/dist/components/copilot-provider/{standard-cpilot-api-config.d.ts → standard-copilot-api-config.d.ts} +0 -0
  43. /package/dist/components/copilot-provider/{standard-cpilot-api-config.mjs.map → standard-copilot-api-config.mjs.map} +0 -0
  44. /package/src/components/copilot-provider/{standard-cpilot-api-config.tsx → standard-copilot-api-config.tsx} +0 -0
@@ -1,151 +1,151 @@
1
1
 
2
- > @copilotkit/react-core@0.15.0 build /Users/ataibarkai/LocalGit/Recursively.ai/CopilotKit/CopilotKit/packages/react-core
2
+ > @copilotkit/react-core@0.16.0 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/react-core
3
3
  > tsup --treeshake
4
4
 
5
- CLI Building entry: src/index.tsx, src/components/index.ts, src/context/copilot-context.tsx, src/context/index.ts, src/hooks/index.ts, src/hooks/use-copilot-chat.ts, src/hooks/use-flat-category-store.ts, src/hooks/use-make-copilot-actionable.ts, src/hooks/use-make-copilot-document-readable.ts, src/hooks/use-make-copilot-readable.ts, src/hooks/use-tree.ts, src/openai-assistants/index.ts, src/utils/utils.test.ts, src/utils/utils.ts, src/types/annotated-function.ts, src/types/document-pointer.ts, src/types/index.ts, src/components/copilot-provider/copilot-provider-props.tsx, src/components/copilot-provider/copilot-provider.tsx, src/components/copilot-provider/index.ts, src/components/copilot-provider/standard-cpilot-api-config.tsx, src/openai-assistants/hooks/index.ts, src/openai-assistants/hooks/use-assistants.ts, src/openai-assistants/hooks/use-copilot-chat-v2.ts, src/openai-assistants/utils/index.ts, src/openai-assistants/utils/process-message-stream.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v6.7.0
8
- CLI Using tsup config: /Users/ataibarkai/LocalGit/Recursively.ai/CopilotKit/CopilotKit/packages/react-core/tsup.config.ts
9
- CLI Target: es6
10
- CLI Cleaning output folder
11
- ESM Build start
5
+ CLI Building entry: src/index.tsx, src/components/index.ts, src/hooks/index.ts, src/hooks/use-copilot-chat.ts, src/hooks/use-flat-category-store.ts, src/hooks/use-make-copilot-actionable.ts, src/hooks/use-make-copilot-document-readable.ts, src/hooks/use-make-copilot-readable.ts, src/hooks/use-tree.ts, src/context/copilot-context.tsx, src/context/index.ts, src/openai-assistants/index.ts, src/types/annotated-function.ts, src/types/document-pointer.ts, src/types/index.ts, src/utils/utils.test.ts, src/utils/utils.ts, src/components/copilot-provider/copilot-provider-props.tsx, src/components/copilot-provider/copilot-provider.tsx, src/components/copilot-provider/index.ts, src/components/copilot-provider/standard-copilot-api-config.tsx, src/openai-assistants/hooks/index.ts, src/openai-assistants/hooks/use-assistants.ts, src/openai-assistants/hooks/use-copilot-chat-v2.ts, src/openai-assistants/utils/index.ts, src/openai-assistants/utils/process-message-stream.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v6.7.0
8
+ CLI Using tsup config: /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/react-core/tsup.config.ts
9
+ CLI Target: es6
10
+ CLI Cleaning output folder
11
+ ESM Build start
12
12
  Module level directives cause errors when bundled, "use client" in "dist/components/copilot-provider/copilot-provider-props.mjs" was ignored.
13
13
  Module level directives cause errors when bundled, "use client" in "dist/components/copilot-provider/copilot-provider.mjs" was ignored.
14
14
  Module level directives cause errors when bundled, "use client" in "dist/openai-assistants/hooks/use-assistants.mjs" was ignored.
15
- Module level directives cause errors when bundled, "use client" in "dist/hooks/use-make-copilot-document-readable.mjs" was ignored.
16
- Module level directives cause errors when bundled, "use client" in "dist/hooks/use-make-copilot-readable.mjs" was ignored.
17
15
  Module level directives cause errors when bundled, "use client" in "dist/context/copilot-context.mjs" was ignored.
18
16
  Module level directives cause errors when bundled, "use client" in "dist/hooks/use-make-copilot-actionable.mjs" was ignored.
19
- Generated an empty chunk: "copilot-provider-props".
17
+ Module level directives cause errors when bundled, "use client" in "dist/hooks/use-make-copilot-document-readable.mjs" was ignored.
18
+ Module level directives cause errors when bundled, "use client" in "dist/hooks/use-make-copilot-readable.mjs" was ignored.
20
19
  Generated an empty chunk: "utils".
20
+ Generated an empty chunk: "copilot-provider-props".
21
21
  Generated an empty chunk: "annotated-function".
22
22
  Generated an empty chunk: "document-pointer".
23
- Generated an empty chunk: "chunk-EFZPSZWO".
24
23
  Generated an empty chunk: "chunk-7GFKOIO7".
25
24
  Generated an empty chunk: "chunk-BABVSMJR".
26
25
  Generated an empty chunk: "chunk-FRAKUJWH".
27
26
  Generated an empty chunk: "chunk-YPSGKPDA".
27
+ Generated an empty chunk: "chunk-EFZPSZWO".
28
28
  Generated an empty chunk: "chunk-QACD2U6P".
29
29
  Generated an empty chunk: "chunk-JD7BAH7U".
30
30
  Generated an empty chunk: "chunk-SPCZTZCY".
31
- ESM dist/components/copilot-provider/copilot-provider-props.mjs 84.00 B
32
- ESM dist/chunk-FRAKUJWH.mjs 76.00 B
33
- ESM dist/utils/utils.mjs 67.00 B
34
- ESM dist/chunk-YPSGKPDA.mjs 76.00 B
35
- ESM dist/utils/utils.test.mjs 202.00 B
36
- ESM dist/chunk-BABVSMJR.mjs 76.00 B
37
- ESM dist/chunk-QACD2U6P.mjs 76.00 B
38
- ESM dist/chunk-SPCZTZCY.mjs 76.00 B
39
- ESM dist/chunk-JD7BAH7U.mjs 76.00 B
40
- ESM dist/openai-assistants/utils/process-message-stream.mjs 183.00 B
41
- ESM dist/chunk-6N6X7K7T.mjs 434.00 B
42
- ESM dist/chunk-EFZPSZWO.mjs 76.00 B
43
- ESM dist/components/copilot-provider/index.mjs 369.00 B
44
- ESM dist/openai-assistants/utils/index.mjs 201.00 B
45
- ESM dist/components/copilot-provider/copilot-provider.mjs 345.00 B
46
- ESM dist/components/copilot-provider/standard-cpilot-api-config.mjs 191.00 B
47
- ESM dist/openai-assistants/hooks/use-copilot-chat-v2.mjs 548.00 B
48
- ESM dist/openai-assistants/hooks/use-assistants.mjs 2.55 KB
49
- ESM dist/openai-assistants/hooks/index.mjs 547.00 B
50
- ESM dist/hooks/use-make-copilot-document-readable.mjs 231.00 B
51
- ESM dist/chunk-MZ5UN3BY.mjs 830.00 B
52
- ESM dist/openai-assistants/index.mjs 570.00 B
53
- ESM dist/components/index.mjs 380.00 B
54
- ESM dist/index.mjs 984.00 B
55
- ESM dist/chunk-JHJ7LUTD.mjs 4.39 KB
56
- ESM dist/chunk-6LNDDH6K.mjs 677.00 B
57
- ESM dist/hooks/index.mjs 612.00 B
58
- ESM dist/context/copilot-context.mjs 194.00 B
59
- ESM dist/context/index.mjs 216.00 B
60
- ESM dist/chunk-MRXNTQOX.mjs 1.92 KB
61
- ESM dist/chunk-OFRZZ5OF.mjs 3.00 KB
62
- ESM dist/types/index.mjs 98.00 B
63
- ESM dist/chunk-6LKBKYRJ.mjs 5.19 KB
64
- ESM dist/chunk-45PUEKTG.mjs 626.00 B
65
- ESM dist/chunk-YULKJPY3.mjs 1.87 KB
66
- ESM dist/hooks/use-copilot-chat.mjs 411.00 B
67
- ESM dist/chunk-VUY2K2DI.mjs 3.89 KB
68
- ESM dist/chunk-E3P5YZO2.mjs 954.00 B
69
- ESM dist/hooks/use-make-copilot-readable.mjs 214.00 B
70
- ESM dist/hooks/use-make-copilot-actionable.mjs 218.00 B
71
- ESM dist/chunk-3MAIWZNZ.mjs 1.55 KB
72
- ESM dist/hooks/use-flat-category-store.mjs 200.00 B
73
- ESM dist/types/annotated-function.mjs 80.00 B
74
- ESM dist/types/document-pointer.mjs 78.00 B
75
- ESM dist/hooks/use-tree.mjs 170.00 B
76
- ESM dist/chunk-7GFKOIO7.mjs 76.00 B
77
- ESM dist/chunk-FRAKUJWH.mjs.map 51.00 B
78
- ESM dist/utils/utils.test.mjs.map 351.00 B
79
- ESM dist/chunk-SPCZTZCY.mjs.map 51.00 B
80
- ESM dist/chunk-QACD2U6P.mjs.map 51.00 B
81
- ESM dist/chunk-JD7BAH7U.mjs.map 51.00 B
82
- ESM dist/chunk-BABVSMJR.mjs.map 51.00 B
83
- ESM dist/chunk-EFZPSZWO.mjs.map 51.00 B
84
- ESM dist/chunk-6N6X7K7T.mjs.map 1.12 KB
85
- ESM dist/chunk-YPSGKPDA.mjs.map 51.00 B
86
- ESM dist/components/copilot-provider/index.mjs.map 51.00 B
87
- ESM dist/components/copilot-provider/copilot-provider.mjs.map 51.00 B
88
- ESM dist/components/copilot-provider/standard-cpilot-api-config.mjs.map 51.00 B
89
- ESM dist/openai-assistants/hooks/use-assistants.mjs.map 4.67 KB
90
- ESM dist/chunk-MZ5UN3BY.mjs.map 1.26 KB
91
- ESM dist/openai-assistants/hooks/use-copilot-chat-v2.mjs.map 51.00 B
92
- ESM dist/hooks/use-make-copilot-document-readable.mjs.map 51.00 B
93
- ESM dist/openai-assistants/index.mjs.map 51.00 B
94
- ESM dist/openai-assistants/utils/process-message-stream.mjs.map 51.00 B
95
- ESM dist/chunk-6LNDDH6K.mjs.map 1.42 KB
96
- ESM dist/components/index.mjs.map 51.00 B
97
- ESM dist/hooks/index.mjs.map 51.00 B
98
- ESM dist/context/copilot-context.mjs.map 51.00 B
99
- ESM dist/chunk-JHJ7LUTD.mjs.map 7.97 KB
100
- ESM dist/openai-assistants/hooks/index.mjs.map 51.00 B
101
- ESM dist/context/index.mjs.map 51.00 B
102
- ESM dist/types/index.mjs.map 51.00 B
103
- ESM dist/chunk-6LKBKYRJ.mjs.map 10.71 KB
104
- ESM dist/chunk-MRXNTQOX.mjs.map 71.00 B
105
- ESM dist/chunk-45PUEKTG.mjs.map 1.47 KB
106
- ESM dist/chunk-OFRZZ5OF.mjs.map 4.98 KB
107
- ESM dist/index.mjs.map 51.00 B
108
- ESM dist/chunk-VUY2K2DI.mjs.map 8.27 KB
109
- ESM dist/hooks/use-copilot-chat.mjs.map 51.00 B
110
- ESM dist/chunk-3MAIWZNZ.mjs.map 4.68 KB
111
- ESM dist/hooks/use-make-copilot-actionable.mjs.map 51.00 B
112
- ESM dist/hooks/use-flat-category-store.mjs.map 51.00 B
113
- ESM dist/hooks/use-make-copilot-readable.mjs.map 51.00 B
114
- ESM dist/types/annotated-function.mjs.map 51.00 B
115
- ESM dist/openai-assistants/utils/index.mjs.map 51.00 B
116
- ESM dist/chunk-YULKJPY3.mjs.map 4.21 KB
117
- ESM dist/chunk-E3P5YZO2.mjs.map 1.67 KB
118
- ESM dist/types/document-pointer.mjs.map 51.00 B
119
- ESM dist/hooks/use-tree.mjs.map 51.00 B
120
- ESM dist/components/copilot-provider/copilot-provider-props.mjs.map 51.00 B
121
- ESM dist/utils/utils.mjs.map 51.00 B
122
- ESM dist/chunk-7GFKOIO7.mjs.map 51.00 B
123
- ESM ⚡️ Build success in 126ms
124
- DTS Build start
125
- DTS ⚡️ Build success in 2355ms
126
- DTS dist/index.d.ts 1.29 KB
127
- DTS dist/components/copilot-provider/copilot-provider.d.ts 1.17 KB
128
- DTS dist/components/copilot-provider/copilot-provider-props.d.ts 1.50 KB
129
- DTS dist/context/copilot-context.d.ts 2.15 KB
130
- DTS dist/hooks/use-copilot-chat.d.ts 890.00 B
131
- DTS dist/hooks/use-make-copilot-actionable.d.ts 255.00 B
132
- DTS dist/hooks/use-make-copilot-readable.d.ts 598.00 B
133
- DTS dist/hooks/use-make-copilot-document-readable.d.ts 516.00 B
134
- DTS dist/types/annotated-function.d.ts 767.00 B
135
- DTS dist/types/document-pointer.d.ts 181.00 B
136
- DTS dist/openai-assistants/hooks/use-copilot-chat-v2.d.ts 1.41 KB
137
- DTS dist/openai-assistants/utils/process-message-stream.d.ts 196.00 B
138
- DTS dist/hooks/use-tree.d.ts 543.00 B
139
- DTS dist/components/index.d.ts 468.00 B
140
- DTS dist/context/index.d.ts 297.00 B
141
- DTS dist/hooks/index.d.ts 434.00 B
142
- DTS dist/hooks/use-flat-category-store.d.ts 424.00 B
143
- DTS dist/openai-assistants/index.d.ts 262.00 B
144
- DTS dist/utils/utils.test.d.ts 12.00 B
145
- DTS dist/utils/utils.d.ts 12.00 B
146
- DTS dist/types/index.d.ts 145.00 B
147
- DTS dist/components/copilot-provider/index.d.ts 446.00 B
148
- DTS dist/components/copilot-provider/standard-cpilot-api-config.d.ts 894.00 B
149
- DTS dist/openai-assistants/hooks/index.d.ts 182.00 B
150
- DTS dist/openai-assistants/hooks/use-assistants.d.ts 551.00 B
151
- DTS dist/openai-assistants/utils/index.d.ts 68.00 B
31
+ ESM dist/chunk-7GFKOIO7.mjs 76.00 B
32
+ ESM dist/hooks/use-tree.mjs 170.00 B
33
+ ESM dist/context/copilot-context.mjs 194.00 B
34
+ ESM dist/openai-assistants/index.mjs 570.00 B
35
+ ESM dist/types/index.mjs 98.00 B
36
+ ESM dist/components/index.mjs 380.00 B
37
+ ESM dist/chunk-BABVSMJR.mjs 76.00 B
38
+ ESM dist/chunk-FRAKUJWH.mjs 76.00 B
39
+ ESM dist/chunk-YPSGKPDA.mjs 76.00 B
40
+ ESM dist/chunk-EFZPSZWO.mjs 76.00 B
41
+ ESM dist/chunk-QACD2U6P.mjs 76.00 B
42
+ ESM dist/chunk-JD7BAH7U.mjs 76.00 B
43
+ ESM dist/chunk-SPCZTZCY.mjs 76.00 B
44
+ ESM dist/chunk-F2JIAPZQ.mjs 435.00 B
45
+ ESM dist/chunk-MRXNTQOX.mjs 1.92 KB
46
+ ESM dist/context/index.mjs 216.00 B
47
+ ESM dist/index.mjs 984.00 B
48
+ ESM dist/chunk-IF64NU27.mjs 4.39 KB
49
+ ESM dist/chunk-MZ5UN3BY.mjs 830.00 B
50
+ ESM dist/hooks/index.mjs 612.00 B
51
+ ESM dist/hooks/use-copilot-chat.mjs 411.00 B
52
+ ESM dist/chunk-DE37LEZJ.mjs 3.00 KB
53
+ ESM dist/chunk-EV26IMLL.mjs 5.19 KB
54
+ ESM dist/chunk-VUY2K2DI.mjs 3.89 KB
55
+ ESM dist/hooks/use-flat-category-store.mjs 200.00 B
56
+ ESM dist/chunk-YULKJPY3.mjs 1.87 KB
57
+ ESM dist/hooks/use-make-copilot-actionable.mjs 218.00 B
58
+ ESM dist/chunk-WL2MC3E2.mjs 954.00 B
59
+ ESM dist/hooks/use-make-copilot-document-readable.mjs 231.00 B
60
+ ESM dist/chunk-RFZQHCNS.mjs 677.00 B
61
+ ESM dist/hooks/use-make-copilot-readable.mjs 214.00 B
62
+ ESM dist/chunk-PF7LXYPO.mjs 626.00 B
63
+ ESM dist/chunk-YGJFU4ZP.mjs 1.55 KB
64
+ ESM dist/components/copilot-provider/copilot-provider-props.mjs 84.00 B
65
+ ESM dist/utils/utils.mjs 67.00 B
66
+ ESM dist/openai-assistants/utils/index.mjs 201.00 B
67
+ ESM dist/openai-assistants/hooks/index.mjs 547.00 B
68
+ ESM dist/types/annotated-function.mjs 80.00 B
69
+ ESM dist/types/document-pointer.mjs 78.00 B
70
+ ESM dist/utils/utils.test.mjs 202.00 B
71
+ ESM dist/openai-assistants/utils/process-message-stream.mjs 183.00 B
72
+ ESM dist/components/copilot-provider/copilot-provider.mjs 345.00 B
73
+ ESM dist/components/copilot-provider/index.mjs 369.00 B
74
+ ESM dist/components/copilot-provider/standard-copilot-api-config.mjs 192.00 B
75
+ ESM dist/openai-assistants/hooks/use-assistants.mjs 2.55 KB
76
+ ESM dist/openai-assistants/hooks/use-copilot-chat-v2.mjs 548.00 B
77
+ ESM dist/chunk-7GFKOIO7.mjs.map 51.00 B
78
+ ESM dist/hooks/use-tree.mjs.map 51.00 B
79
+ ESM dist/context/copilot-context.mjs.map 51.00 B
80
+ ESM dist/openai-assistants/index.mjs.map 51.00 B
81
+ ESM dist/types/index.mjs.map 51.00 B
82
+ ESM dist/components/index.mjs.map 51.00 B
83
+ ESM dist/chunk-BABVSMJR.mjs.map 51.00 B
84
+ ESM dist/chunk-FRAKUJWH.mjs.map 51.00 B
85
+ ESM dist/chunk-YPSGKPDA.mjs.map 51.00 B
86
+ ESM dist/chunk-EFZPSZWO.mjs.map 51.00 B
87
+ ESM dist/chunk-QACD2U6P.mjs.map 51.00 B
88
+ ESM dist/chunk-JD7BAH7U.mjs.map 51.00 B
89
+ ESM dist/chunk-SPCZTZCY.mjs.map 51.00 B
90
+ ESM dist/chunk-F2JIAPZQ.mjs.map 1.12 KB
91
+ ESM dist/chunk-MRXNTQOX.mjs.map 71.00 B
92
+ ESM dist/context/index.mjs.map 51.00 B
93
+ ESM dist/index.mjs.map 51.00 B
94
+ ESM dist/chunk-IF64NU27.mjs.map 7.97 KB
95
+ ESM dist/chunk-MZ5UN3BY.mjs.map 1.26 KB
96
+ ESM dist/hooks/index.mjs.map 51.00 B
97
+ ESM dist/hooks/use-copilot-chat.mjs.map 51.00 B
98
+ ESM dist/chunk-DE37LEZJ.mjs.map 4.98 KB
99
+ ESM dist/chunk-EV26IMLL.mjs.map 11.08 KB
100
+ ESM dist/chunk-VUY2K2DI.mjs.map 8.27 KB
101
+ ESM dist/hooks/use-flat-category-store.mjs.map 51.00 B
102
+ ESM dist/chunk-YULKJPY3.mjs.map 4.21 KB
103
+ ESM dist/hooks/use-make-copilot-actionable.mjs.map 51.00 B
104
+ ESM dist/chunk-WL2MC3E2.mjs.map 1.67 KB
105
+ ESM dist/hooks/use-make-copilot-document-readable.mjs.map 51.00 B
106
+ ESM dist/chunk-RFZQHCNS.mjs.map 1.42 KB
107
+ ESM dist/hooks/use-make-copilot-readable.mjs.map 51.00 B
108
+ ESM dist/chunk-PF7LXYPO.mjs.map 1.47 KB
109
+ ESM dist/chunk-YGJFU4ZP.mjs.map 4.68 KB
110
+ ESM dist/components/copilot-provider/copilot-provider-props.mjs.map 51.00 B
111
+ ESM dist/utils/utils.mjs.map 51.00 B
112
+ ESM dist/openai-assistants/utils/index.mjs.map 51.00 B
113
+ ESM dist/openai-assistants/hooks/index.mjs.map 51.00 B
114
+ ESM dist/types/annotated-function.mjs.map 51.00 B
115
+ ESM dist/types/document-pointer.mjs.map 51.00 B
116
+ ESM dist/utils/utils.test.mjs.map 351.00 B
117
+ ESM dist/openai-assistants/utils/process-message-stream.mjs.map 51.00 B
118
+ ESM dist/components/copilot-provider/copilot-provider.mjs.map 51.00 B
119
+ ESM dist/components/copilot-provider/index.mjs.map 51.00 B
120
+ ESM dist/components/copilot-provider/standard-copilot-api-config.mjs.map 51.00 B
121
+ ESM dist/openai-assistants/hooks/use-assistants.mjs.map 4.67 KB
122
+ ESM dist/openai-assistants/hooks/use-copilot-chat-v2.mjs.map 51.00 B
123
+ ESM ⚡️ Build success in 365ms
124
+ DTS Build start
125
+ DTS ⚡️ Build success in 4650ms
126
+ DTS dist/index.d.ts 1.29 KB
127
+ DTS dist/components/copilot-provider/copilot-provider.d.ts 1.53 KB
128
+ DTS dist/components/copilot-provider/copilot-provider-props.d.ts 1.50 KB
129
+ DTS dist/context/copilot-context.d.ts 2.15 KB
130
+ DTS dist/hooks/use-copilot-chat.d.ts 890.00 B
131
+ DTS dist/hooks/use-make-copilot-actionable.d.ts 255.00 B
132
+ DTS dist/hooks/use-make-copilot-readable.d.ts 598.00 B
133
+ DTS dist/hooks/use-make-copilot-document-readable.d.ts 516.00 B
134
+ DTS dist/types/annotated-function.d.ts 767.00 B
135
+ DTS dist/types/document-pointer.d.ts 181.00 B
136
+ DTS dist/openai-assistants/hooks/use-copilot-chat-v2.d.ts 1.41 KB
137
+ DTS dist/openai-assistants/utils/process-message-stream.d.ts 196.00 B
138
+ DTS dist/hooks/use-tree.d.ts 543.00 B
139
+ DTS dist/components/index.d.ts 468.00 B
140
+ DTS dist/hooks/index.d.ts 434.00 B
141
+ DTS dist/hooks/use-flat-category-store.d.ts 424.00 B
142
+ DTS dist/context/index.d.ts 297.00 B
143
+ DTS dist/openai-assistants/index.d.ts 262.00 B
144
+ DTS dist/types/index.d.ts 145.00 B
145
+ DTS dist/utils/utils.test.d.ts 12.00 B
146
+ DTS dist/utils/utils.d.ts 12.00 B
147
+ DTS dist/components/copilot-provider/index.d.ts 446.00 B
148
+ DTS dist/components/copilot-provider/standard-copilot-api-config.d.ts 894.00 B
149
+ DTS dist/openai-assistants/hooks/index.d.ts 182.00 B
150
+ DTS dist/openai-assistants/hooks/use-assistants.d.ts 551.00 B
151
+ DTS dist/openai-assistants/utils/index.d.ts 68.00 B
package/CHANGELOG.md CHANGED
@@ -1,48 +1,10 @@
1
1
  # ui
2
2
 
3
- ## 0.16.0-alpha.3
3
+ ## 0.16.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - fix typo
8
-
9
- ### Patch Changes
10
-
11
- - Updated dependencies
12
- - @copilotkit/shared@0.2.0-alpha.3
13
-
14
- ## 0.16.0-alpha.2
15
-
16
- ### Minor Changes
17
-
18
- - point example app at new api endpoint route
19
-
20
- ### Patch Changes
21
-
22
- - Updated dependencies
23
- - @copilotkit/shared@0.2.0-alpha.2
24
-
25
- ## 0.16.0-alpha.1
26
-
27
- ### Minor Changes
28
-
29
- - CopilotProvider api config docs
30
-
31
- ### Patch Changes
32
-
33
- - Updated dependencies
34
- - @copilotkit/shared@0.2.0-alpha.1
35
-
36
- ## 0.16.0-alpha.0
37
-
38
- ### Minor Changes
39
-
40
- - adding portkey examples
41
-
42
- ### Patch Changes
43
-
44
- - Updated dependencies
45
- - @copilotkit/shared@0.2.0-alpha.0
7
+ - fixed backend pointing
46
8
 
47
9
  ## 0.15.0
48
10
 
@@ -1,5 +1,5 @@
1
- import { defaultCopilotContextCategories } from './chunk-6LKBKYRJ.mjs';
2
- import { CopilotContext, copilotApiConfigExtrapolator } from './chunk-3MAIWZNZ.mjs';
1
+ import { defaultCopilotContextCategories } from './chunk-EV26IMLL.mjs';
2
+ import { CopilotContext, copilotApiConfigExtrapolator } from './chunk-YGJFU4ZP.mjs';
3
3
  import { __objRest, __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
4
4
  import { useContext, useMemo } from 'react';
5
5
  import { useChat } from 'ai/react';
@@ -76,4 +76,4 @@ If you would like to call a function, call it without saying anything else.
76
76
 
77
77
  export { defaultSystemMessage, useCopilotChat };
78
78
  //# sourceMappingURL=out.js.map
79
- //# sourceMappingURL=chunk-OFRZZ5OF.mjs.map
79
+ //# sourceMappingURL=chunk-DE37LEZJ.mjs.map
@@ -1,7 +1,7 @@
1
- import { StandardCopilotApiConfig } from './chunk-6N6X7K7T.mjs';
1
+ import { StandardCopilotApiConfig } from './chunk-F2JIAPZQ.mjs';
2
2
  import { use_tree_default } from './chunk-VUY2K2DI.mjs';
3
3
  import { use_flat_category_store_default } from './chunk-YULKJPY3.mjs';
4
- import { CopilotContext } from './chunk-3MAIWZNZ.mjs';
4
+ import { CopilotContext } from './chunk-YGJFU4ZP.mjs';
5
5
  import { __objRest, __spreadProps, __spreadValues, __async } from './chunk-MRXNTQOX.mjs';
6
6
  import { useState, useCallback } from 'react';
7
7
  import { jsx } from 'react/jsx-runtime';
@@ -162,4 +162,4 @@ function annotatedFunctionToChatCompletionFunction(annotatedFunction) {
162
162
 
163
163
  export { CopilotProvider, defaultCopilotContextCategories };
164
164
  //# sourceMappingURL=out.js.map
165
- //# sourceMappingURL=chunk-6LKBKYRJ.mjs.map
165
+ //# sourceMappingURL=chunk-EV26IMLL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/copilot-provider/copilot-provider.tsx"],"names":[],"mappings":"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","sourcesContent":["\"use client\";\n\nimport { FunctionCallHandler } from \"ai\";\nimport { useCallback, useState } from \"react\";\nimport { CopilotContext, CopilotApiConfig } from \"../../context/copilot-context\";\nimport useTree from \"../../hooks/use-tree\";\nimport { AnnotatedFunction } from \"../../types/annotated-function\";\nimport { ChatCompletionCreateParams } from \"openai/resources/chat\";\nimport { DocumentPointer } from \"../../types\";\nimport useFlatCategoryStore from \"../../hooks/use-flat-category-store\";\nimport { StandardCopilotApiConfig } from \"./standard-copilot-api-config\";\nimport { CopilotProviderProps } from \"./copilot-provider-props\";\n\n/**\n * The CopilotProvider component.\n * This component provides the Copilot context to its children.\n * It can be configured either with a chat API endpoint or a CopilotApiConfig.\n *\n * NOTE: The backend can use OpenAI, or you can bring your own LLM.\n * For examples of the backend api implementation, see `examples/next-openai` usage (under `src/api/copilotkit`),\n * or read the documentation at https://docs.copilotkit.ai\n * In particular, Getting-Started > Quickstart-Backend: https://docs.copilotkit.ai/getting-started/quickstart-backend\n *\n * Example usage:\n * ```\n * <CopilotProvider chatApiEndpoint=\"https://your.copilotkit.api\">\n * <App />\n * </CopilotProvider>\n * ```\n *\n * or\n *\n * ```\n * const copilotApiConfig = new StandardCopilotApiConfig(\n * \"https://your.copilotkit.api/v1\",\n * \"https://your.copilotkit.api/v2\",\n * {},\n * {}\n * );\n *\n * // ...\n *\n * <CopilotProvider chatApiConfig={copilotApiConfig}>\n * <App />\n * </CopilotProvider>\n * ```\n *\n * @param props - The props for the component.\n * @returns The CopilotProvider component.\n */\nexport function CopilotProvider({ children, ...props }: CopilotProviderProps): JSX.Element {\n // Compute all the functions and properties that we need to pass\n // to the CopilotContext.\n\n const [entryPoints, setEntryPoints] = useState<Record<string, AnnotatedFunction<any[]>>>({});\n\n const { addElement, removeElement, printTree } = useTree();\n\n const {\n addElement: addDocument,\n removeElement: removeDocument,\n allElements: allDocuments,\n } = useFlatCategoryStore<DocumentPointer>();\n\n const setEntryPoint = useCallback((id: string, entryPoint: AnnotatedFunction<any[]>) => {\n setEntryPoints((prevPoints) => {\n return {\n ...prevPoints,\n [id]: entryPoint,\n };\n });\n }, []);\n\n const removeEntryPoint = useCallback((id: string) => {\n setEntryPoints((prevPoints) => {\n const newPoints = { ...prevPoints };\n delete newPoints[id];\n return newPoints;\n });\n }, []);\n\n const getContextString = useCallback(\n (documents: DocumentPointer[], categories: string[]) => {\n const documentsString = documents\n .map((document) => {\n return `${document.name} (${document.sourceApplication}):\\n${document.getContents()}`;\n })\n .join(\"\\n\\n\");\n\n const nonDocumentStrings = printTree(categories);\n\n return `${documentsString}\\n\\n${nonDocumentStrings}`;\n },\n [printTree],\n );\n\n const addContext = useCallback(\n (\n context: string,\n parentId?: string,\n categories: string[] = defaultCopilotContextCategories,\n ) => {\n return addElement(context, categories, parentId);\n },\n [addElement],\n );\n\n const removeContext = useCallback(\n (id: string) => {\n removeElement(id);\n },\n [removeElement],\n );\n\n const getChatCompletionFunctionDescriptions = useCallback(() => {\n return entryPointsToChatCompletionFunctions(Object.values(entryPoints));\n }, [entryPoints]);\n\n const getFunctionCallHandler = useCallback(() => {\n return entryPointsToFunctionCallHandler(Object.values(entryPoints));\n }, [entryPoints]);\n\n const getDocumentsContext = useCallback(\n (categories: string[]) => {\n return allDocuments(categories);\n },\n [allDocuments],\n );\n\n const addDocumentContext = useCallback(\n (documentPointer: DocumentPointer, categories: string[] = defaultCopilotContextCategories) => {\n return addDocument(documentPointer, categories);\n },\n [addDocument],\n );\n\n const removeDocumentContext = useCallback(\n (documentId: string) => {\n removeDocument(documentId);\n },\n [removeDocument],\n );\n\n // get the appropriate CopilotApiConfig from the props\n let copilotApiConfig: CopilotApiConfig;\n if (\"chatApiEndpoint\" in props) {\n copilotApiConfig = new StandardCopilotApiConfig(\n props.chatApiEndpoint,\n props.chatApiEndpointV2 || `${props.chatApiEndpoint}/v2`,\n {},\n {},\n );\n } else {\n copilotApiConfig = props.chatApiConfig;\n }\n\n return (\n <CopilotContext.Provider\n value={{\n entryPoints,\n getChatCompletionFunctionDescriptions,\n getFunctionCallHandler,\n setEntryPoint,\n removeEntryPoint,\n getContextString,\n addContext,\n removeContext,\n getDocumentsContext,\n addDocumentContext,\n removeDocumentContext,\n copilotApiConfig: copilotApiConfig,\n }}\n >\n {children}\n </CopilotContext.Provider>\n );\n}\n\nexport const defaultCopilotContextCategories = [\"global\"];\n\nfunction entryPointsToFunctionCallHandler(\n entryPoints: AnnotatedFunction<any[]>[],\n): FunctionCallHandler {\n return async (chatMessages, functionCall) => {\n let entrypointsByFunctionName: Record<string, AnnotatedFunction<any[]>> = {};\n for (let entryPoint of entryPoints) {\n entrypointsByFunctionName[entryPoint.name] = entryPoint;\n }\n\n const entryPointFunction = entrypointsByFunctionName[functionCall.name || \"\"];\n if (entryPointFunction) {\n let parsedFunctionCallArguments: Record<string, any>[] = [];\n if (functionCall.arguments) {\n parsedFunctionCallArguments = JSON.parse(functionCall.arguments);\n }\n\n const paramsInCorrectOrder: any[] = [];\n for (let arg of entryPointFunction.argumentAnnotations) {\n paramsInCorrectOrder.push(\n parsedFunctionCallArguments[arg.name as keyof typeof parsedFunctionCallArguments],\n );\n }\n\n await entryPointFunction.implementation(...paramsInCorrectOrder);\n\n // commented out becasue for now we don't want to return anything\n // const result = await entryPointFunction.implementation(\n // ...parsedFunctionCallArguments\n // );\n // const functionResponse: ChatRequest = {\n // messages: [\n // ...chatMessages,\n // {\n // id: nanoid(),\n // name: functionCall.name,\n // role: 'function' as const,\n // content: JSON.stringify(result),\n // },\n // ],\n // };\n\n // return functionResponse;\n }\n };\n}\n\nfunction entryPointsToChatCompletionFunctions(\n entryPoints: AnnotatedFunction<any[]>[],\n): ChatCompletionCreateParams.Function[] {\n return entryPoints.map(annotatedFunctionToChatCompletionFunction);\n}\n\nfunction annotatedFunctionToChatCompletionFunction(\n annotatedFunction: AnnotatedFunction<any[]>,\n): ChatCompletionCreateParams.Function {\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: ChatCompletionCreateParams.Function = {\n name: annotatedFunction.name,\n description: annotatedFunction.description,\n parameters: {\n type: \"object\",\n properties: parameters,\n required: requiredParameterNames,\n },\n };\n\n return chatCompletionFunction;\n}\n"]}
@@ -1,4 +1,4 @@
1
- // src/components/copilot-provider/standard-cpilot-api-config.tsx
1
+ // src/components/copilot-provider/standard-copilot-api-config.tsx
2
2
  var StandardCopilotApiConfig = class {
3
3
  constructor(chatApiEndpoint, chatApiEndpointV2, headers, body) {
4
4
  this.chatApiEndpoint = chatApiEndpoint;
@@ -10,4 +10,4 @@ var StandardCopilotApiConfig = class {
10
10
 
11
11
  export { StandardCopilotApiConfig };
12
12
  //# sourceMappingURL=out.js.map
13
- //# sourceMappingURL=chunk-6N6X7K7T.mjs.map
13
+ //# sourceMappingURL=chunk-F2JIAPZQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/copilot-provider/standard-copilot-api-config.tsx"],"names":[],"mappings":";AAUO,IAAM,2BAAN,MAA2D;AAAA,EAMhE,YACE,iBACA,mBACA,SACA,MACA;AACA,SAAK,kBAAkB;AACvB,SAAK,oBAAoB;AACzB,SAAK,UAAU;AACf,SAAK,OAAO;AAAA,EACd;AACF","sourcesContent":["import { CopilotApiConfig } from \"../../context/copilot-context\";\n\n/**\n * A standard implementation of the CopilotApiConfig interface.\n *\n * Pass in the base URL of the chat API, the headers to be sent with each request, and the body to be sent with each request.\n * The rest of the CopilotApiConfig interface is implemented by default.\n *\n */\n\nexport class StandardCopilotApiConfig implements CopilotApiConfig {\n chatApiEndpoint: string;\n chatApiEndpointV2: string;\n headers: Record<string, string>;\n body: Record<string, any>;\n\n constructor(\n chatApiEndpoint: string,\n chatApiEndpointV2: string,\n headers: Record<string, string>,\n body: Record<string, any>,\n ) {\n this.chatApiEndpoint = chatApiEndpoint;\n this.chatApiEndpointV2 = chatApiEndpointV2;\n this.headers = headers;\n this.body = body;\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { processMessageStream } from './chunk-MZ5UN3BY.mjs';
2
- import { defaultCopilotContextCategories } from './chunk-6LKBKYRJ.mjs';
3
- import { CopilotContext, copilotApiConfigExtrapolator } from './chunk-3MAIWZNZ.mjs';
2
+ import { defaultCopilotContextCategories } from './chunk-EV26IMLL.mjs';
3
+ import { CopilotContext, copilotApiConfigExtrapolator } from './chunk-YGJFU4ZP.mjs';
4
4
  import { __async, __spreadValues } from './chunk-MRXNTQOX.mjs';
5
5
  import { useContext, useState, useMemo } from 'react';
6
6
  import { parseStreamPart } from '@copilotkit/shared';
@@ -122,4 +122,4 @@ If you would like to call a function, call it without saying anything else.
122
122
 
123
123
  export { defaultSystemMessage, useCopilotChatV2 };
124
124
  //# sourceMappingURL=out.js.map
125
- //# sourceMappingURL=chunk-JHJ7LUTD.mjs.map
125
+ //# sourceMappingURL=chunk-IF64NU27.mjs.map
@@ -1,4 +1,4 @@
1
- import { CopilotContext } from './chunk-3MAIWZNZ.mjs';
1
+ import { CopilotContext } from './chunk-YGJFU4ZP.mjs';
2
2
  import { useContext, useRef, useEffect } from 'react';
3
3
 
4
4
  function useMakeCopilotReadable(information, parentId, categories) {
@@ -16,4 +16,4 @@ function useMakeCopilotReadable(information, parentId, categories) {
16
16
 
17
17
  export { useMakeCopilotReadable };
18
18
  //# sourceMappingURL=out.js.map
19
- //# sourceMappingURL=chunk-45PUEKTG.mjs.map
19
+ //# sourceMappingURL=chunk-PF7LXYPO.mjs.map
@@ -1,4 +1,4 @@
1
- import { CopilotContext } from './chunk-3MAIWZNZ.mjs';
1
+ import { CopilotContext } from './chunk-YGJFU4ZP.mjs';
2
2
  import { useContext, useRef, useEffect } from 'react';
3
3
 
4
4
  function useMakeCopilotDocumentReadable(document, categories, dependencies = []) {
@@ -16,4 +16,4 @@ function useMakeCopilotDocumentReadable(document, categories, dependencies = [])
16
16
 
17
17
  export { useMakeCopilotDocumentReadable };
18
18
  //# sourceMappingURL=out.js.map
19
- //# sourceMappingURL=chunk-6LNDDH6K.mjs.map
19
+ //# sourceMappingURL=chunk-RFZQHCNS.mjs.map
@@ -1,4 +1,4 @@
1
- import { CopilotContext } from './chunk-3MAIWZNZ.mjs';
1
+ import { CopilotContext } from './chunk-YGJFU4ZP.mjs';
2
2
  import { useRef, useContext, useMemo, useEffect } from 'react';
3
3
  import { nanoid } from 'nanoid';
4
4
 
@@ -24,4 +24,4 @@ function useMakeCopilotActionable(annotatedFunction, dependencies) {
24
24
 
25
25
  export { useMakeCopilotActionable };
26
26
  //# sourceMappingURL=out.js.map
27
- //# sourceMappingURL=chunk-E3P5YZO2.mjs.map
27
+ //# sourceMappingURL=chunk-WL2MC3E2.mjs.map
@@ -55,4 +55,4 @@ function returnAndThrowInDebug(value) {
55
55
 
56
56
  export { CopilotContext, copilotApiConfigExtrapolator };
57
57
  //# sourceMappingURL=out.js.map
58
- //# sourceMappingURL=chunk-3MAIWZNZ.mjs.map
58
+ //# sourceMappingURL=chunk-YGJFU4ZP.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/context/copilot-context.tsx"],"names":[],"mappings":";;;;;AAGA,OAAO,WAAW;AA6CX,SAAS,6BAA6B,QAA0B;AACrE,SAAO;AAAA,IACL,IAAI,kBAA0B;AAC5B,aAAO,GAAG,OAAO;AAAA,IACnB;AAAA,IACA,IAAI,oBAA4B;AAC9B,aAAO,GAAG,OAAO;AAAA,IACnB;AAAA,EACF;AACF;AAwBA,IAAM,sBAA4C;AAAA,EAChD,aAAa,CAAC;AAAA,EACd,eAAe,MAAM;AAAA,EAAC;AAAA,EACtB,kBAAkB,MAAM;AAAA,EAAC;AAAA,EACzB,uCAAuC,MAAM,sBAAsB,CAAC,CAAC;AAAA,EACrE,wBAAwB,MAAM,sBAAsB,MAAY;AAAA,EAAC,EAAC;AAAA,EAElE,kBAAkB,CAAC,WAA8B,eAC/C,sBAAsB,EAAE;AAAA,EAC1B,YAAY,MAAM;AAAA,EAClB,eAAe,MAAM;AAAA,EAAC;AAAA,EAEtB,qBAAqB,CAAC,eAAyB,sBAAsB,CAAC,CAAC;AAAA,EACvE,oBAAoB,MAAM,sBAAsB,EAAE;AAAA,EAClD,uBAAuB,MAAM;AAAA,EAAC;AAAA,EAE9B,kBAAkB,IAAK,MAAkC;AAAA,IACvD,IAAI,kBAA0B;AAC5B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,IACA,IAAI,oBAA4B;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,IACA,IAAI,UAAkC;AACpC,aAAO,CAAC;AAAA,IACV;AAAA,IACA,IAAI,OAA4B;AAC9B,aAAO,CAAC;AAAA,IACV;AAAA,EACF,EAAG;AACL;AAEO,IAAM,iBAAiB,MAAM,cAAoC,mBAAmB;AAE3F,SAAS,sBAAyB,OAAa;AAC7C,QAAM,IAAI;AAAA,IACR;AAAA,EACF;AACA,SAAO;AACT","sourcesContent":["\"use client\";\n\nimport { FunctionCallHandler } from \"ai\";\nimport React from \"react\";\nimport { TreeNodeId } from \"../hooks/use-tree\";\nimport { AnnotatedFunction } from \"../types/annotated-function\";\nimport { ChatCompletionCreateParams } from \"openai/resources/chat\";\nimport { DocumentPointer } from \"../types\";\n\n/**\n * Interface for the configuration of the Copilot API.\n */\nexport interface CopilotApiConfig {\n /**\n * The endpoint for the chat API.\n */\n chatApiEndpoint: string;\n\n /**\n * The endpoint for the chat API v2.\n */\n chatApiEndpointV2: string;\n\n /**\n * additional headers to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'Authorization': 'Bearer your_token_here'\n * }\n * ```\n */\n headers: Record<string, string>;\n\n /**\n * Additional body params to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'message': 'Hello, world!'\n * }\n * ```\n */\n body: Record<string, any>;\n}\n\nexport function copilotApiConfigExtrapolator(config: CopilotApiConfig) {\n return {\n get chatApiEndpoint(): string {\n return `${config.chatApiEndpoint}`;\n },\n get chatApiEndpointV2(): string {\n return `${config.chatApiEndpointV2}`;\n },\n };\n}\n\nexport interface CopilotContextParams {\n // function-calling\n entryPoints: Record<string, AnnotatedFunction<any[]>>;\n setEntryPoint: (id: string, entryPoint: AnnotatedFunction<any[]>) => void;\n removeEntryPoint: (id: string) => void;\n getChatCompletionFunctionDescriptions: () => ChatCompletionCreateParams.Function[];\n getFunctionCallHandler: () => FunctionCallHandler;\n\n // text context\n getContextString: (documents: DocumentPointer[], categories: string[]) => string;\n addContext: (context: string, parentId?: string, categories?: string[]) => TreeNodeId;\n removeContext: (id: TreeNodeId) => void;\n\n // document context\n getDocumentsContext: (categories: string[]) => DocumentPointer[];\n addDocumentContext: (documentPointer: DocumentPointer, categories?: string[]) => TreeNodeId;\n removeDocumentContext: (documentId: string) => void;\n\n // api endpoints\n copilotApiConfig: CopilotApiConfig;\n}\n\nconst emptyCopilotContext: CopilotContextParams = {\n entryPoints: {},\n setEntryPoint: () => {},\n removeEntryPoint: () => {},\n getChatCompletionFunctionDescriptions: () => returnAndThrowInDebug([]),\n getFunctionCallHandler: () => returnAndThrowInDebug(async () => {}),\n\n getContextString: (documents: DocumentPointer[], categories: string[]) =>\n returnAndThrowInDebug(\"\"),\n addContext: () => \"\",\n removeContext: () => {},\n\n getDocumentsContext: (categories: string[]) => returnAndThrowInDebug([]),\n addDocumentContext: () => returnAndThrowInDebug(\"\"),\n removeDocumentContext: () => {},\n\n copilotApiConfig: new (class implements CopilotApiConfig {\n get chatApiEndpoint(): string {\n throw new Error(\n \"Remember to wrap your app in a `<CopilotProvider> {...} </CopilotProvider>` !!!\",\n );\n }\n get chatApiEndpointV2(): string {\n throw new Error(\n \"Remember to wrap your app in a `<CopilotProvider> {...} </CopilotProvider>` !!!\",\n );\n }\n get headers(): Record<string, string> {\n return {};\n }\n get body(): Record<string, any> {\n return {};\n }\n })(),\n};\n\nexport const CopilotContext = React.createContext<CopilotContextParams>(emptyCopilotContext);\n\nfunction returnAndThrowInDebug<T>(value: T): T {\n throw new Error(\n \"Remember to wrap your app in a `<CopilotProvider> {...} </CopilotProvider>` !!!\",\n );\n return value;\n}\n"]}
1
+ {"version":3,"sources":["../src/context/copilot-context.tsx"],"names":[],"mappings":";;;;;AAGA,OAAO,WAAW;AA6CX,SAAS,6BAA6B,QAA0B;AACrE,SAAO;AAAA,IACL,IAAI,kBAA0B;AAC5B,aAAO,GAAG,OAAO;AAAA,IACnB;AAAA,IACA,IAAI,oBAA4B;AAC9B,aAAO,GAAG,OAAO;AAAA,IACnB;AAAA,EACF;AACF;AAwBA,IAAM,sBAA4C;AAAA,EAChD,aAAa,CAAC;AAAA,EACd,eAAe,MAAM;AAAA,EAAC;AAAA,EACtB,kBAAkB,MAAM;AAAA,EAAC;AAAA,EACzB,uCAAuC,MAAM,sBAAsB,CAAC,CAAC;AAAA,EACrE,wBAAwB,MAAM,sBAAsB,MAAY;AAAA,EAAC,EAAC;AAAA,EAElE,kBAAkB,CAAC,WAA8B,eAC/C,sBAAsB,EAAE;AAAA,EAC1B,YAAY,MAAM;AAAA,EAClB,eAAe,MAAM;AAAA,EAAC;AAAA,EAEtB,qBAAqB,CAAC,eAAyB,sBAAsB,CAAC,CAAC;AAAA,EACvE,oBAAoB,MAAM,sBAAsB,EAAE;AAAA,EAClD,uBAAuB,MAAM;AAAA,EAAC;AAAA,EAE9B,kBAAkB,IAAK,MAAkC;AAAA,IACvD,IAAI,kBAA0B;AAC5B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,IACA,IAAI,oBAA4B;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,IACA,IAAI,UAAkC;AACpC,aAAO,CAAC;AAAA,IACV;AAAA,IACA,IAAI,OAA4B;AAC9B,aAAO,CAAC;AAAA,IACV;AAAA,EACF,EAAG;AACL;AAEO,IAAM,iBAAiB,MAAM,cAAoC,mBAAmB;AAE3F,SAAS,sBAAyB,OAAa;AAC7C,QAAM,IAAI;AAAA,IACR;AAAA,EACF;AACA,SAAO;AACT","sourcesContent":["\"use client\";\n\nimport { FunctionCallHandler } from \"ai\";\nimport React from \"react\";\nimport { TreeNodeId } from \"../hooks/use-tree\";\nimport { AnnotatedFunction } from \"../types/annotated-function\";\nimport { ChatCompletionCreateParams } from \"openai/resources/chat\";\nimport { DocumentPointer } from \"../types\";\n\n/**\n * Interface for the configuration of the Copilot API.\n */\nexport interface CopilotApiConfig {\n /**\n * The endpoint for the chat API.\n */\n chatApiEndpoint: string;\n\n /**\n * The endpoint for the chat API v2.\n */\n chatApiEndpointV2: string;\n\n /**\n * additional headers to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'Authorization': 'Bearer your_token_here'\n * }\n * ```\n */\n headers: Record<string, string>;\n\n /**\n * Additional body params to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'message': 'Hello, world!'\n * }\n * ```\n */\n body: Record<string, any>;\n}\n\nexport function copilotApiConfigExtrapolator(config: CopilotApiConfig) {\n return {\n get chatApiEndpoint(): string {\n return `${config.chatApiEndpoint}`;\n },\n get chatApiEndpointV2(): string {\n return `${config.chatApiEndpointV2}`;\n },\n };\n}\n\nexport interface CopilotContextParams {\n // function-calling\n entryPoints: Record<string, AnnotatedFunction<any[]>>;\n setEntryPoint: (id: string, entryPoint: AnnotatedFunction<any[]>) => void;\n removeEntryPoint: (id: string) => void;\n getChatCompletionFunctionDescriptions: () => ChatCompletionCreateParams.Function[];\n getFunctionCallHandler: () => FunctionCallHandler;\n\n // text context\n addContext: (context: string, parentId?: string, categories?: string[]) => TreeNodeId;\n removeContext: (id: TreeNodeId) => void;\n getContextString: (documents: DocumentPointer[], categories: string[]) => string;\n\n // document context\n addDocumentContext: (documentPointer: DocumentPointer, categories?: string[]) => TreeNodeId;\n removeDocumentContext: (documentId: string) => void;\n getDocumentsContext: (categories: string[]) => DocumentPointer[];\n\n // api endpoints\n copilotApiConfig: CopilotApiConfig;\n}\n\nconst emptyCopilotContext: CopilotContextParams = {\n entryPoints: {},\n setEntryPoint: () => {},\n removeEntryPoint: () => {},\n getChatCompletionFunctionDescriptions: () => returnAndThrowInDebug([]),\n getFunctionCallHandler: () => returnAndThrowInDebug(async () => {}),\n\n getContextString: (documents: DocumentPointer[], categories: string[]) =>\n returnAndThrowInDebug(\"\"),\n addContext: () => \"\",\n removeContext: () => {},\n\n getDocumentsContext: (categories: string[]) => returnAndThrowInDebug([]),\n addDocumentContext: () => returnAndThrowInDebug(\"\"),\n removeDocumentContext: () => {},\n\n copilotApiConfig: new (class implements CopilotApiConfig {\n get chatApiEndpoint(): string {\n throw new Error(\n \"Remember to wrap your app in a `<CopilotProvider> {...} </CopilotProvider>` !!!\",\n );\n }\n get chatApiEndpointV2(): string {\n throw new Error(\n \"Remember to wrap your app in a `<CopilotProvider> {...} </CopilotProvider>` !!!\",\n );\n }\n get headers(): Record<string, string> {\n return {};\n }\n get body(): Record<string, any> {\n return {};\n }\n })(),\n};\n\nexport const CopilotContext = React.createContext<CopilotContextParams>(emptyCopilotContext);\n\nfunction returnAndThrowInDebug<T>(value: T): T {\n throw new Error(\n \"Remember to wrap your app in a `<CopilotProvider> {...} </CopilotProvider>` !!!\",\n );\n return value;\n}\n"]}
@@ -12,9 +12,14 @@ import '../../types/document-pointer.js';
12
12
  * This component provides the Copilot context to its children.
13
13
  * It can be configured either with a chat API endpoint or a CopilotApiConfig.
14
14
  *
15
+ * NOTE: The backend can use OpenAI, or you can bring your own LLM.
16
+ * For examples of the backend api implementation, see `examples/next-openai` usage (under `src/api/copilotkit`),
17
+ * or read the documentation at https://docs.copilotkit.ai
18
+ * In particular, Getting-Started > Quickstart-Backend: https://docs.copilotkit.ai/getting-started/quickstart-backend
19
+ *
15
20
  * Example usage:
16
21
  * ```
17
- * <CopilotProvider chatApiEndpoint="https://api.copilot.chat">
22
+ * <CopilotProvider chatApiEndpoint="https://your.copilotkit.api">
18
23
  * <App />
19
24
  * </CopilotProvider>
20
25
  * ```
@@ -23,8 +28,8 @@ import '../../types/document-pointer.js';
23
28
  *
24
29
  * ```
25
30
  * const copilotApiConfig = new StandardCopilotApiConfig(
26
- * "https://api.copilot.chat",
27
- * "https://api.copilot.chat/v2",
31
+ * "https://your.copilotkit.api/v1",
32
+ * "https://your.copilotkit.api/v2",
28
33
  * {},
29
34
  * {}
30
35
  * );
@@ -1,8 +1,8 @@
1
- export { CopilotProvider, defaultCopilotContextCategories } from '../../chunk-6LKBKYRJ.mjs';
2
- import '../../chunk-6N6X7K7T.mjs';
1
+ export { CopilotProvider, defaultCopilotContextCategories } from '../../chunk-EV26IMLL.mjs';
2
+ import '../../chunk-F2JIAPZQ.mjs';
3
3
  import '../../chunk-VUY2K2DI.mjs';
4
4
  import '../../chunk-YULKJPY3.mjs';
5
- import '../../chunk-3MAIWZNZ.mjs';
5
+ import '../../chunk-YGJFU4ZP.mjs';
6
6
  import '../../chunk-MRXNTQOX.mjs';
7
7
  //# sourceMappingURL=out.js.map
8
8
  //# sourceMappingURL=copilot-provider.mjs.map
@@ -1,9 +1,9 @@
1
1
  import '../../chunk-SPCZTZCY.mjs';
2
- export { CopilotProvider, defaultCopilotContextCategories } from '../../chunk-6LKBKYRJ.mjs';
3
- import '../../chunk-6N6X7K7T.mjs';
2
+ export { CopilotProvider, defaultCopilotContextCategories } from '../../chunk-EV26IMLL.mjs';
3
+ import '../../chunk-F2JIAPZQ.mjs';
4
4
  import '../../chunk-VUY2K2DI.mjs';
5
5
  import '../../chunk-YULKJPY3.mjs';
6
- import '../../chunk-3MAIWZNZ.mjs';
6
+ import '../../chunk-YGJFU4ZP.mjs';
7
7
  import '../../chunk-MRXNTQOX.mjs';
8
8
  //# sourceMappingURL=out.js.map
9
9
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,4 @@
1
+ export { StandardCopilotApiConfig } from '../../chunk-F2JIAPZQ.mjs';
2
+ import '../../chunk-MRXNTQOX.mjs';
3
+ //# sourceMappingURL=out.js.map
4
+ //# sourceMappingURL=standard-copilot-api-config.mjs.map
@@ -1,10 +1,10 @@
1
1
  import '../chunk-JD7BAH7U.mjs';
2
2
  import '../chunk-SPCZTZCY.mjs';
3
- export { CopilotProvider, defaultCopilotContextCategories } from '../chunk-6LKBKYRJ.mjs';
4
- import '../chunk-6N6X7K7T.mjs';
3
+ export { CopilotProvider, defaultCopilotContextCategories } from '../chunk-EV26IMLL.mjs';
4
+ import '../chunk-F2JIAPZQ.mjs';
5
5
  import '../chunk-VUY2K2DI.mjs';
6
6
  import '../chunk-YULKJPY3.mjs';
7
- import '../chunk-3MAIWZNZ.mjs';
7
+ import '../chunk-YGJFU4ZP.mjs';
8
8
  import '../chunk-MRXNTQOX.mjs';
9
9
  //# sourceMappingURL=out.js.map
10
10
  //# sourceMappingURL=index.mjs.map
@@ -50,12 +50,12 @@ interface CopilotContextParams {
50
50
  removeEntryPoint: (id: string) => void;
51
51
  getChatCompletionFunctionDescriptions: () => ChatCompletionCreateParams.Function[];
52
52
  getFunctionCallHandler: () => FunctionCallHandler;
53
- getContextString: (documents: DocumentPointer[], categories: string[]) => string;
54
53
  addContext: (context: string, parentId?: string, categories?: string[]) => TreeNodeId;
55
54
  removeContext: (id: TreeNodeId) => void;
56
- getDocumentsContext: (categories: string[]) => DocumentPointer[];
55
+ getContextString: (documents: DocumentPointer[], categories: string[]) => string;
57
56
  addDocumentContext: (documentPointer: DocumentPointer, categories?: string[]) => TreeNodeId;
58
57
  removeDocumentContext: (documentId: string) => void;
58
+ getDocumentsContext: (categories: string[]) => DocumentPointer[];
59
59
  copilotApiConfig: CopilotApiConfig;
60
60
  }
61
61
  declare const CopilotContext: React.Context<CopilotContextParams>;
@@ -1,4 +1,4 @@
1
- export { CopilotContext, copilotApiConfigExtrapolator } from '../chunk-3MAIWZNZ.mjs';
1
+ export { CopilotContext, copilotApiConfigExtrapolator } from '../chunk-YGJFU4ZP.mjs';
2
2
  import '../chunk-MRXNTQOX.mjs';
3
3
  //# sourceMappingURL=out.js.map
4
4
  //# sourceMappingURL=copilot-context.mjs.map
@@ -1,5 +1,5 @@
1
1
  import '../chunk-YPSGKPDA.mjs';
2
- export { CopilotContext, copilotApiConfigExtrapolator } from '../chunk-3MAIWZNZ.mjs';
2
+ export { CopilotContext, copilotApiConfigExtrapolator } from '../chunk-YGJFU4ZP.mjs';
3
3
  import '../chunk-MRXNTQOX.mjs';
4
4
  //# sourceMappingURL=out.js.map
5
5
  //# sourceMappingURL=index.mjs.map
@@ -1,15 +1,15 @@
1
1
  import '../chunk-QACD2U6P.mjs';
2
- export { useMakeCopilotDocumentReadable } from '../chunk-6LNDDH6K.mjs';
3
- export { useMakeCopilotReadable } from '../chunk-45PUEKTG.mjs';
4
- export { useCopilotChat } from '../chunk-OFRZZ5OF.mjs';
2
+ export { useCopilotChat } from '../chunk-DE37LEZJ.mjs';
5
3
  import '../chunk-JD7BAH7U.mjs';
6
4
  import '../chunk-SPCZTZCY.mjs';
7
- import '../chunk-6LKBKYRJ.mjs';
8
- import '../chunk-6N6X7K7T.mjs';
5
+ import '../chunk-EV26IMLL.mjs';
6
+ import '../chunk-F2JIAPZQ.mjs';
9
7
  import '../chunk-VUY2K2DI.mjs';
10
8
  import '../chunk-YULKJPY3.mjs';
11
- export { useMakeCopilotActionable } from '../chunk-E3P5YZO2.mjs';
12
- import '../chunk-3MAIWZNZ.mjs';
9
+ export { useMakeCopilotActionable } from '../chunk-WL2MC3E2.mjs';
10
+ export { useMakeCopilotDocumentReadable } from '../chunk-RFZQHCNS.mjs';
11
+ export { useMakeCopilotReadable } from '../chunk-PF7LXYPO.mjs';
12
+ import '../chunk-YGJFU4ZP.mjs';
13
13
  import '../chunk-MRXNTQOX.mjs';
14
14
  //# sourceMappingURL=out.js.map
15
15
  //# sourceMappingURL=index.mjs.map
@@ -1,11 +1,11 @@
1
- export { defaultSystemMessage, useCopilotChat } from '../chunk-OFRZZ5OF.mjs';
1
+ export { defaultSystemMessage, useCopilotChat } from '../chunk-DE37LEZJ.mjs';
2
2
  import '../chunk-JD7BAH7U.mjs';
3
3
  import '../chunk-SPCZTZCY.mjs';
4
- import '../chunk-6LKBKYRJ.mjs';
5
- import '../chunk-6N6X7K7T.mjs';
4
+ import '../chunk-EV26IMLL.mjs';
5
+ import '../chunk-F2JIAPZQ.mjs';
6
6
  import '../chunk-VUY2K2DI.mjs';
7
7
  import '../chunk-YULKJPY3.mjs';
8
- import '../chunk-3MAIWZNZ.mjs';
8
+ import '../chunk-YGJFU4ZP.mjs';
9
9
  import '../chunk-MRXNTQOX.mjs';
10
10
  //# sourceMappingURL=out.js.map
11
11
  //# sourceMappingURL=use-copilot-chat.mjs.map
@@ -1,5 +1,5 @@
1
- export { useMakeCopilotActionable } from '../chunk-E3P5YZO2.mjs';
2
- import '../chunk-3MAIWZNZ.mjs';
1
+ export { useMakeCopilotActionable } from '../chunk-WL2MC3E2.mjs';
2
+ import '../chunk-YGJFU4ZP.mjs';
3
3
  import '../chunk-MRXNTQOX.mjs';
4
4
  //# sourceMappingURL=out.js.map
5
5
  //# sourceMappingURL=use-make-copilot-actionable.mjs.map
@@ -1,5 +1,5 @@
1
- export { useMakeCopilotDocumentReadable } from '../chunk-6LNDDH6K.mjs';
2
- import '../chunk-3MAIWZNZ.mjs';
1
+ export { useMakeCopilotDocumentReadable } from '../chunk-RFZQHCNS.mjs';
2
+ import '../chunk-YGJFU4ZP.mjs';
3
3
  import '../chunk-MRXNTQOX.mjs';
4
4
  //# sourceMappingURL=out.js.map
5
5
  //# sourceMappingURL=use-make-copilot-document-readable.mjs.map
@@ -1,5 +1,5 @@
1
- export { useMakeCopilotReadable } from '../chunk-45PUEKTG.mjs';
2
- import '../chunk-3MAIWZNZ.mjs';
1
+ export { useMakeCopilotReadable } from '../chunk-PF7LXYPO.mjs';
2
+ import '../chunk-YGJFU4ZP.mjs';
3
3
  import '../chunk-MRXNTQOX.mjs';
4
4
  //# sourceMappingURL=out.js.map
5
5
  //# sourceMappingURL=use-make-copilot-readable.mjs.map
package/dist/index.mjs CHANGED
@@ -1,22 +1,22 @@
1
- import './chunk-EFZPSZWO.mjs';
2
1
  import './chunk-7GFKOIO7.mjs';
3
2
  import './chunk-BABVSMJR.mjs';
4
- export { useCopilotChatV2 } from './chunk-JHJ7LUTD.mjs';
3
+ export { useCopilotChatV2 } from './chunk-IF64NU27.mjs';
5
4
  import './chunk-FRAKUJWH.mjs';
6
5
  export { processMessageStream } from './chunk-MZ5UN3BY.mjs';
7
6
  import './chunk-YPSGKPDA.mjs';
7
+ import './chunk-EFZPSZWO.mjs';
8
8
  import './chunk-QACD2U6P.mjs';
9
- export { useMakeCopilotDocumentReadable } from './chunk-6LNDDH6K.mjs';
10
- export { useMakeCopilotReadable } from './chunk-45PUEKTG.mjs';
11
- export { useCopilotChat } from './chunk-OFRZZ5OF.mjs';
9
+ export { useCopilotChat } from './chunk-DE37LEZJ.mjs';
12
10
  import './chunk-JD7BAH7U.mjs';
13
11
  import './chunk-SPCZTZCY.mjs';
14
- export { CopilotProvider, defaultCopilotContextCategories } from './chunk-6LKBKYRJ.mjs';
15
- import './chunk-6N6X7K7T.mjs';
12
+ export { CopilotProvider, defaultCopilotContextCategories } from './chunk-EV26IMLL.mjs';
13
+ import './chunk-F2JIAPZQ.mjs';
16
14
  import './chunk-VUY2K2DI.mjs';
17
15
  import './chunk-YULKJPY3.mjs';
18
- export { useMakeCopilotActionable } from './chunk-E3P5YZO2.mjs';
19
- export { CopilotContext, copilotApiConfigExtrapolator } from './chunk-3MAIWZNZ.mjs';
16
+ export { useMakeCopilotActionable } from './chunk-WL2MC3E2.mjs';
17
+ export { useMakeCopilotDocumentReadable } from './chunk-RFZQHCNS.mjs';
18
+ export { useMakeCopilotReadable } from './chunk-PF7LXYPO.mjs';
19
+ export { CopilotContext, copilotApiConfigExtrapolator } from './chunk-YGJFU4ZP.mjs';
20
20
  import './chunk-MRXNTQOX.mjs';
21
21
  //# sourceMappingURL=out.js.map
22
22
  //# sourceMappingURL=index.mjs.map
@@ -1,15 +1,15 @@
1
1
  import '../../chunk-BABVSMJR.mjs';
2
- export { useCopilotChatV2 } from '../../chunk-JHJ7LUTD.mjs';
2
+ export { useCopilotChatV2 } from '../../chunk-IF64NU27.mjs';
3
3
  import '../../chunk-FRAKUJWH.mjs';
4
4
  import '../../chunk-MZ5UN3BY.mjs';
5
5
  import '../../chunk-YPSGKPDA.mjs';
6
6
  import '../../chunk-JD7BAH7U.mjs';
7
7
  import '../../chunk-SPCZTZCY.mjs';
8
- import '../../chunk-6LKBKYRJ.mjs';
9
- import '../../chunk-6N6X7K7T.mjs';
8
+ import '../../chunk-EV26IMLL.mjs';
9
+ import '../../chunk-F2JIAPZQ.mjs';
10
10
  import '../../chunk-VUY2K2DI.mjs';
11
11
  import '../../chunk-YULKJPY3.mjs';
12
- import '../../chunk-3MAIWZNZ.mjs';
12
+ import '../../chunk-YGJFU4ZP.mjs';
13
13
  import '../../chunk-MRXNTQOX.mjs';
14
14
  //# sourceMappingURL=out.js.map
15
15
  //# sourceMappingURL=index.mjs.map
@@ -1,14 +1,14 @@
1
- export { defaultSystemMessage, useCopilotChatV2 } from '../../chunk-JHJ7LUTD.mjs';
1
+ export { defaultSystemMessage, useCopilotChatV2 } from '../../chunk-IF64NU27.mjs';
2
2
  import '../../chunk-FRAKUJWH.mjs';
3
3
  import '../../chunk-MZ5UN3BY.mjs';
4
4
  import '../../chunk-YPSGKPDA.mjs';
5
5
  import '../../chunk-JD7BAH7U.mjs';
6
6
  import '../../chunk-SPCZTZCY.mjs';
7
- import '../../chunk-6LKBKYRJ.mjs';
8
- import '../../chunk-6N6X7K7T.mjs';
7
+ import '../../chunk-EV26IMLL.mjs';
8
+ import '../../chunk-F2JIAPZQ.mjs';
9
9
  import '../../chunk-VUY2K2DI.mjs';
10
10
  import '../../chunk-YULKJPY3.mjs';
11
- import '../../chunk-3MAIWZNZ.mjs';
11
+ import '../../chunk-YGJFU4ZP.mjs';
12
12
  import '../../chunk-MRXNTQOX.mjs';
13
13
  //# sourceMappingURL=out.js.map
14
14
  //# sourceMappingURL=use-copilot-chat-v2.mjs.map
@@ -1,16 +1,16 @@
1
1
  import '../chunk-7GFKOIO7.mjs';
2
2
  import '../chunk-BABVSMJR.mjs';
3
- export { useCopilotChatV2 } from '../chunk-JHJ7LUTD.mjs';
3
+ export { useCopilotChatV2 } from '../chunk-IF64NU27.mjs';
4
4
  import '../chunk-FRAKUJWH.mjs';
5
5
  export { processMessageStream } from '../chunk-MZ5UN3BY.mjs';
6
6
  import '../chunk-YPSGKPDA.mjs';
7
7
  import '../chunk-JD7BAH7U.mjs';
8
8
  import '../chunk-SPCZTZCY.mjs';
9
- import '../chunk-6LKBKYRJ.mjs';
10
- import '../chunk-6N6X7K7T.mjs';
9
+ import '../chunk-EV26IMLL.mjs';
10
+ import '../chunk-F2JIAPZQ.mjs';
11
11
  import '../chunk-VUY2K2DI.mjs';
12
12
  import '../chunk-YULKJPY3.mjs';
13
- import '../chunk-3MAIWZNZ.mjs';
13
+ import '../chunk-YGJFU4ZP.mjs';
14
14
  import '../chunk-MRXNTQOX.mjs';
15
15
  //# sourceMappingURL=out.js.map
16
16
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.16.0-alpha.3",
7
+ "version": "0.16.0",
8
8
  "sideEffects": false,
9
9
  "main": "./dist/index.js",
10
10
  "module": "./dist/index.mjs",
@@ -23,14 +23,14 @@
23
23
  "ts-jest": "^29.1.1",
24
24
  "tsup": "^6.7.0",
25
25
  "typescript": "^5.1.3",
26
- "tsconfig": "0.6.0",
27
- "eslint-config-custom": "0.2.0"
26
+ "eslint-config-custom": "0.2.0",
27
+ "tsconfig": "0.6.0"
28
28
  },
29
29
  "dependencies": {
30
30
  "ai": "^2.2.23",
31
31
  "nanoid": "^4.0.2",
32
32
  "openai": "^4.6.0",
33
- "@copilotkit/shared": "0.2.0-alpha.3"
33
+ "@copilotkit/shared": "0.1.0"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup --treeshake",
@@ -8,7 +8,7 @@ import { AnnotatedFunction } from "../../types/annotated-function";
8
8
  import { ChatCompletionCreateParams } from "openai/resources/chat";
9
9
  import { DocumentPointer } from "../../types";
10
10
  import useFlatCategoryStore from "../../hooks/use-flat-category-store";
11
- import { StandardCopilotApiConfig } from "./standard-cpilot-api-config";
11
+ import { StandardCopilotApiConfig } from "./standard-copilot-api-config";
12
12
  import { CopilotProviderProps } from "./copilot-provider-props";
13
13
 
14
14
  /**
@@ -16,9 +16,14 @@ import { CopilotProviderProps } from "./copilot-provider-props";
16
16
  * This component provides the Copilot context to its children.
17
17
  * It can be configured either with a chat API endpoint or a CopilotApiConfig.
18
18
  *
19
+ * NOTE: The backend can use OpenAI, or you can bring your own LLM.
20
+ * For examples of the backend api implementation, see `examples/next-openai` usage (under `src/api/copilotkit`),
21
+ * or read the documentation at https://docs.copilotkit.ai
22
+ * In particular, Getting-Started > Quickstart-Backend: https://docs.copilotkit.ai/getting-started/quickstart-backend
23
+ *
19
24
  * Example usage:
20
25
  * ```
21
- * <CopilotProvider chatApiEndpoint="https://api.copilot.chat">
26
+ * <CopilotProvider chatApiEndpoint="https://your.copilotkit.api">
22
27
  * <App />
23
28
  * </CopilotProvider>
24
29
  * ```
@@ -27,8 +32,8 @@ import { CopilotProviderProps } from "./copilot-provider-props";
27
32
  *
28
33
  * ```
29
34
  * const copilotApiConfig = new StandardCopilotApiConfig(
30
- * "https://api.copilot.chat",
31
- * "https://api.copilot.chat/v2",
35
+ * "https://your.copilotkit.api/v1",
36
+ * "https://your.copilotkit.api/v2",
32
37
  * {},
33
38
  * {}
34
39
  * );
@@ -50,6 +55,7 @@ export function CopilotProvider({ children, ...props }: CopilotProviderProps): J
50
55
  const [entryPoints, setEntryPoints] = useState<Record<string, AnnotatedFunction<any[]>>>({});
51
56
 
52
57
  const { addElement, removeElement, printTree } = useTree();
58
+
53
59
  const {
54
60
  addElement: addDocument,
55
61
  removeElement: removeDocument,
@@ -66,14 +66,14 @@ export interface CopilotContextParams {
66
66
  getFunctionCallHandler: () => FunctionCallHandler;
67
67
 
68
68
  // text context
69
- getContextString: (documents: DocumentPointer[], categories: string[]) => string;
70
69
  addContext: (context: string, parentId?: string, categories?: string[]) => TreeNodeId;
71
70
  removeContext: (id: TreeNodeId) => void;
71
+ getContextString: (documents: DocumentPointer[], categories: string[]) => string;
72
72
 
73
73
  // document context
74
- getDocumentsContext: (categories: string[]) => DocumentPointer[];
75
74
  addDocumentContext: (documentPointer: DocumentPointer, categories?: string[]) => TreeNodeId;
76
75
  removeDocumentContext: (documentId: string) => void;
76
+ getDocumentsContext: (categories: string[]) => DocumentPointer[];
77
77
 
78
78
  // api endpoints
79
79
  copilotApiConfig: CopilotApiConfig;
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/copilot-provider/copilot-provider.tsx"],"names":[],"mappings":"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","sourcesContent":["\"use client\";\n\nimport { FunctionCallHandler } from \"ai\";\nimport { useCallback, useState } from \"react\";\nimport { CopilotContext, CopilotApiConfig } from \"../../context/copilot-context\";\nimport useTree from \"../../hooks/use-tree\";\nimport { AnnotatedFunction } from \"../../types/annotated-function\";\nimport { ChatCompletionCreateParams } from \"openai/resources/chat\";\nimport { DocumentPointer } from \"../../types\";\nimport useFlatCategoryStore from \"../../hooks/use-flat-category-store\";\nimport { StandardCopilotApiConfig } from \"./standard-cpilot-api-config\";\nimport { CopilotProviderProps } from \"./copilot-provider-props\";\n\n/**\n * The CopilotProvider component.\n * This component provides the Copilot context to its children.\n * It can be configured either with a chat API endpoint or a CopilotApiConfig.\n *\n * Example usage:\n * ```\n * <CopilotProvider chatApiEndpoint=\"https://api.copilot.chat\">\n * <App />\n * </CopilotProvider>\n * ```\n *\n * or\n *\n * ```\n * const copilotApiConfig = new StandardCopilotApiConfig(\n * \"https://api.copilot.chat\",\n * \"https://api.copilot.chat/v2\",\n * {},\n * {}\n * );\n *\n * // ...\n *\n * <CopilotProvider chatApiConfig={copilotApiConfig}>\n * <App />\n * </CopilotProvider>\n * ```\n *\n * @param props - The props for the component.\n * @returns The CopilotProvider component.\n */\nexport function CopilotProvider({ children, ...props }: CopilotProviderProps): JSX.Element {\n // Compute all the functions and properties that we need to pass\n // to the CopilotContext.\n\n const [entryPoints, setEntryPoints] = useState<Record<string, AnnotatedFunction<any[]>>>({});\n\n const { addElement, removeElement, printTree } = useTree();\n const {\n addElement: addDocument,\n removeElement: removeDocument,\n allElements: allDocuments,\n } = useFlatCategoryStore<DocumentPointer>();\n\n const setEntryPoint = useCallback((id: string, entryPoint: AnnotatedFunction<any[]>) => {\n setEntryPoints((prevPoints) => {\n return {\n ...prevPoints,\n [id]: entryPoint,\n };\n });\n }, []);\n\n const removeEntryPoint = useCallback((id: string) => {\n setEntryPoints((prevPoints) => {\n const newPoints = { ...prevPoints };\n delete newPoints[id];\n return newPoints;\n });\n }, []);\n\n const getContextString = useCallback(\n (documents: DocumentPointer[], categories: string[]) => {\n const documentsString = documents\n .map((document) => {\n return `${document.name} (${document.sourceApplication}):\\n${document.getContents()}`;\n })\n .join(\"\\n\\n\");\n\n const nonDocumentStrings = printTree(categories);\n\n return `${documentsString}\\n\\n${nonDocumentStrings}`;\n },\n [printTree],\n );\n\n const addContext = useCallback(\n (\n context: string,\n parentId?: string,\n categories: string[] = defaultCopilotContextCategories,\n ) => {\n return addElement(context, categories, parentId);\n },\n [addElement],\n );\n\n const removeContext = useCallback(\n (id: string) => {\n removeElement(id);\n },\n [removeElement],\n );\n\n const getChatCompletionFunctionDescriptions = useCallback(() => {\n return entryPointsToChatCompletionFunctions(Object.values(entryPoints));\n }, [entryPoints]);\n\n const getFunctionCallHandler = useCallback(() => {\n return entryPointsToFunctionCallHandler(Object.values(entryPoints));\n }, [entryPoints]);\n\n const getDocumentsContext = useCallback(\n (categories: string[]) => {\n return allDocuments(categories);\n },\n [allDocuments],\n );\n\n const addDocumentContext = useCallback(\n (documentPointer: DocumentPointer, categories: string[] = defaultCopilotContextCategories) => {\n return addDocument(documentPointer, categories);\n },\n [addDocument],\n );\n\n const removeDocumentContext = useCallback(\n (documentId: string) => {\n removeDocument(documentId);\n },\n [removeDocument],\n );\n\n // get the appropriate CopilotApiConfig from the props\n let copilotApiConfig: CopilotApiConfig;\n if (\"chatApiEndpoint\" in props) {\n copilotApiConfig = new StandardCopilotApiConfig(\n props.chatApiEndpoint,\n props.chatApiEndpointV2 || `${props.chatApiEndpoint}/v2`,\n {},\n {},\n );\n } else {\n copilotApiConfig = props.chatApiConfig;\n }\n\n return (\n <CopilotContext.Provider\n value={{\n entryPoints,\n getChatCompletionFunctionDescriptions,\n getFunctionCallHandler,\n setEntryPoint,\n removeEntryPoint,\n getContextString,\n addContext,\n removeContext,\n getDocumentsContext,\n addDocumentContext,\n removeDocumentContext,\n copilotApiConfig: copilotApiConfig,\n }}\n >\n {children}\n </CopilotContext.Provider>\n );\n}\n\nexport const defaultCopilotContextCategories = [\"global\"];\n\nfunction entryPointsToFunctionCallHandler(\n entryPoints: AnnotatedFunction<any[]>[],\n): FunctionCallHandler {\n return async (chatMessages, functionCall) => {\n let entrypointsByFunctionName: Record<string, AnnotatedFunction<any[]>> = {};\n for (let entryPoint of entryPoints) {\n entrypointsByFunctionName[entryPoint.name] = entryPoint;\n }\n\n const entryPointFunction = entrypointsByFunctionName[functionCall.name || \"\"];\n if (entryPointFunction) {\n let parsedFunctionCallArguments: Record<string, any>[] = [];\n if (functionCall.arguments) {\n parsedFunctionCallArguments = JSON.parse(functionCall.arguments);\n }\n\n const paramsInCorrectOrder: any[] = [];\n for (let arg of entryPointFunction.argumentAnnotations) {\n paramsInCorrectOrder.push(\n parsedFunctionCallArguments[arg.name as keyof typeof parsedFunctionCallArguments],\n );\n }\n\n await entryPointFunction.implementation(...paramsInCorrectOrder);\n\n // commented out becasue for now we don't want to return anything\n // const result = await entryPointFunction.implementation(\n // ...parsedFunctionCallArguments\n // );\n // const functionResponse: ChatRequest = {\n // messages: [\n // ...chatMessages,\n // {\n // id: nanoid(),\n // name: functionCall.name,\n // role: 'function' as const,\n // content: JSON.stringify(result),\n // },\n // ],\n // };\n\n // return functionResponse;\n }\n };\n}\n\nfunction entryPointsToChatCompletionFunctions(\n entryPoints: AnnotatedFunction<any[]>[],\n): ChatCompletionCreateParams.Function[] {\n return entryPoints.map(annotatedFunctionToChatCompletionFunction);\n}\n\nfunction annotatedFunctionToChatCompletionFunction(\n annotatedFunction: AnnotatedFunction<any[]>,\n): ChatCompletionCreateParams.Function {\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: ChatCompletionCreateParams.Function = {\n name: annotatedFunction.name,\n description: annotatedFunction.description,\n parameters: {\n type: \"object\",\n properties: parameters,\n required: requiredParameterNames,\n },\n };\n\n return chatCompletionFunction;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/copilot-provider/standard-cpilot-api-config.tsx"],"names":[],"mappings":";AAUO,IAAM,2BAAN,MAA2D;AAAA,EAMhE,YACE,iBACA,mBACA,SACA,MACA;AACA,SAAK,kBAAkB;AACvB,SAAK,oBAAoB;AACzB,SAAK,UAAU;AACf,SAAK,OAAO;AAAA,EACd;AACF","sourcesContent":["import { CopilotApiConfig } from \"../../context/copilot-context\";\n\n/**\n * A standard implementation of the CopilotApiConfig interface.\n *\n * Pass in the base URL of the chat API, the headers to be sent with each request, and the body to be sent with each request.\n * The rest of the CopilotApiConfig interface is implemented by default.\n *\n */\n\nexport class StandardCopilotApiConfig implements CopilotApiConfig {\n chatApiEndpoint: string;\n chatApiEndpointV2: string;\n headers: Record<string, string>;\n body: Record<string, any>;\n\n constructor(\n chatApiEndpoint: string,\n chatApiEndpointV2: string,\n headers: Record<string, string>,\n body: Record<string, any>,\n ) {\n this.chatApiEndpoint = chatApiEndpoint;\n this.chatApiEndpointV2 = chatApiEndpointV2;\n this.headers = headers;\n this.body = body;\n }\n}\n"]}
@@ -1,4 +0,0 @@
1
- export { StandardCopilotApiConfig } from '../../chunk-6N6X7K7T.mjs';
2
- import '../../chunk-MRXNTQOX.mjs';
3
- //# sourceMappingURL=out.js.map
4
- //# sourceMappingURL=standard-cpilot-api-config.mjs.map