@copilotkit/react-core 0.18.0-alpha.0 → 0.18.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/.turbo/turbo-build.log +96 -96
  2. package/CHANGELOG.md +12 -1
  3. package/dist/{chunk-QTET3FBV.mjs → chunk-D4NQCVHE.mjs} +2 -2
  4. package/dist/{chunk-SFQOMKM2.mjs → chunk-FY7XNRJP.mjs} +12 -8
  5. package/dist/chunk-FY7XNRJP.mjs.map +1 -0
  6. package/dist/{chunk-TU4DNDO7.mjs → chunk-P34OLW2N.mjs} +2 -2
  7. package/dist/components/copilot-provider/copilot-provider.mjs +2 -2
  8. package/dist/components/copilot-provider/index.mjs +2 -2
  9. package/dist/components/index.mjs +2 -2
  10. package/dist/hooks/index.d.ts +1 -0
  11. package/dist/hooks/index.mjs +5 -5
  12. package/dist/hooks/use-copilot-chat.d.ts +5 -3
  13. package/dist/hooks/use-copilot-chat.mjs +3 -3
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.mjs +9 -9
  16. package/dist/openai-assistants/hooks/index.mjs +3 -3
  17. package/dist/openai-assistants/hooks/use-copilot-chat-v2.mjs +3 -3
  18. package/dist/openai-assistants/index.mjs +3 -3
  19. package/dist/types/index.d.ts +1 -0
  20. package/dist/types/system-message.d.ts +3 -0
  21. package/dist/types/system-message.mjs +3 -0
  22. package/package.json +4 -4
  23. package/src/hooks/use-copilot-chat.ts +13 -6
  24. package/src/types/index.ts +1 -0
  25. package/src/types/system-message.ts +4 -0
  26. package/dist/chunk-SFQOMKM2.mjs.map +0 -1
  27. package/dist/types/message.d.ts +0 -2
  28. package/dist/types/message.mjs +0 -3
  29. package/src/types/message.ts +0 -0
  30. /package/dist/{chunk-QTET3FBV.mjs.map → chunk-D4NQCVHE.mjs.map} +0 -0
  31. /package/dist/{chunk-TU4DNDO7.mjs.map → chunk-P34OLW2N.mjs.map} +0 -0
  32. /package/dist/types/{message.mjs.map → system-message.mjs.map} +0 -0
@@ -1,8 +1,8 @@
1
1
 
2
- > @copilotkit/react-core@0.17.1 build /Users/ataibarkai/LocalGit/Recursively.ai/CopilotKit/CopilotKit/packages/react-core
2
+ > @copilotkit/react-core@0.18.0-alpha.0 build /Users/ataibarkai/LocalGit/Recursively.ai/CopilotKit/CopilotKit/packages/react-core
3
3
  > tsup --treeshake
4
4
 
5
- CLI Building entry: src/index.tsx, src/context/copilot-context.tsx, src/context/index.ts, src/components/index.ts, src/hooks/index.ts, src/hooks/use-chat.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/chat-completion-client.ts, src/openai/chat-completion-stream.ts, src/openai/chat-completion-transport.ts, src/openai/index.tsx, src/openai-assistants/index.ts, src/types/annotated-function.ts, src/types/base.ts, src/types/document-pointer.ts, src/types/index.ts, src/types/message.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
5
+ CLI Building entry: src/index.tsx, src/components/index.ts, src/hooks/index.ts, src/hooks/use-chat.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/utils/utils.test.ts, src/utils/utils.ts, src/openai-assistants/index.ts, src/openai/chat-completion-client.ts, src/openai/chat-completion-stream.ts, src/openai/chat-completion-transport.ts, src/openai/index.tsx, src/types/annotated-function.ts, src/types/base.ts, src/types/document-pointer.ts, src/types/index.ts, src/types/system-message.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
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v6.7.0
8
8
  CLI Using tsup config: /Users/ataibarkai/LocalGit/Recursively.ai/CopilotKit/CopilotKit/packages/react-core/tsup.config.ts
@@ -12,149 +12,149 @@ 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-actionable.mjs" was ignored.
16
- Module level directives cause errors when bundled, "use client" in "dist/hooks/use-make-copilot-document-readable.mjs" was ignored.
17
15
  Module level directives cause errors when bundled, "use client" in "dist/hooks/use-make-copilot-readable.mjs" was ignored.
18
16
  Module level directives cause errors when bundled, "use client" in "dist/context/copilot-context.mjs" was ignored.
17
+ Module level directives cause errors when bundled, "use client" in "dist/hooks/use-make-copilot-actionable.mjs" was ignored.
18
+ Module level directives cause errors when bundled, "use client" in "dist/hooks/use-make-copilot-document-readable.mjs" was ignored.
19
19
  Generated an empty chunk: "copilot-provider-props".
20
20
  Generated an empty chunk: "annotated-function".
21
21
  Generated an empty chunk: "base".
22
22
  Generated an empty chunk: "document-pointer".
23
- Generated an empty chunk: "message".
23
+ Generated an empty chunk: "system-message".
24
24
  Generated an empty chunk: "utils".
25
+ Generated an empty chunk: "chunk-PUFR5OAI".
26
+ Generated an empty chunk: "chunk-EFZPSZWO".
25
27
  Generated an empty chunk: "chunk-7GFKOIO7".
26
28
  Generated an empty chunk: "chunk-BABVSMJR".
27
29
  Generated an empty chunk: "chunk-FRAKUJWH".
28
- Generated an empty chunk: "chunk-EFZPSZWO".
29
- Generated an empty chunk: "chunk-PUFR5OAI".
30
30
  Generated an empty chunk: "chunk-VNRDQJXW".
31
31
  Generated an empty chunk: "chunk-5UGLWBZJ".
32
32
  Generated an empty chunk: "chunk-JD7BAH7U".
33
33
  Generated an empty chunk: "chunk-SPCZTZCY".
34
- ESM dist/chunk-7GFKOIO7.mjs 76.00 B
35
- ESM dist/openai-assistants/index.mjs 570.00 B
36
- ESM dist/openai/chat-completion-client.mjs 209.00 B
34
+ ESM dist/chunk-PUFR5OAI.mjs 76.00 B
35
+ ESM dist/types/index.mjs 98.00 B
36
+ ESM dist/hooks/use-make-copilot-readable.mjs 214.00 B
37
37
  ESM dist/context/copilot-context.mjs 164.00 B
38
+ ESM dist/openai/chat-completion-stream.mjs 209.00 B
39
+ ESM dist/openai-assistants/index.mjs 570.00 B
38
40
  ESM dist/components/index.mjs 380.00 B
39
- ESM dist/types/index.mjs 98.00 B
40
- ESM dist/hooks/use-make-copilot-actionable.mjs 218.00 B
41
- ESM dist/chunk-BABVSMJR.mjs 76.00 B
42
- ESM dist/chunk-PUFR5OAI.mjs 76.00 B
43
- ESM dist/chunk-FRAKUJWH.mjs 76.00 B
44
- ESM dist/chunk-EFZPSZWO.mjs 76.00 B
41
+ ESM dist/chunk-7GFKOIO7.mjs 76.00 B
45
42
  ESM dist/chunk-VNRDQJXW.mjs 76.00 B
46
- ESM dist/chunk-5UGLWBZJ.mjs 76.00 B
47
- ESM dist/chunk-JD7BAH7U.mjs 76.00 B
43
+ ESM dist/chunk-F2JIAPZQ.mjs 435.00 B
48
44
  ESM dist/chunk-SPCZTZCY.mjs 76.00 B
49
45
  ESM dist/chunk-MRXNTQOX.mjs 1.92 KB
50
- ESM dist/chunk-F2JIAPZQ.mjs 435.00 B
51
- ESM dist/hooks/use-make-copilot-document-readable.mjs 231.00 B
52
- ESM dist/hooks/use-make-copilot-readable.mjs 214.00 B
53
- ESM dist/openai/chat-completion-stream.mjs 209.00 B
54
- ESM dist/chunk-TU4DNDO7.mjs 4.33 KB
46
+ ESM dist/openai/chat-completion-transport.mjs 183.00 B
47
+ ESM dist/chunk-EFZPSZWO.mjs 76.00 B
48
+ ESM dist/openai/index.mjs 224.00 B
49
+ ESM dist/hooks/use-tree.mjs 170.00 B
50
+ ESM dist/chunk-BABVSMJR.mjs 76.00 B
55
51
  ESM dist/index.mjs 1.11 KB
52
+ ESM dist/context/index.mjs 186.00 B
56
53
  ESM dist/chunk-MZ5UN3BY.mjs 830.00 B
57
- ESM dist/chunk-6SOQYBNX.mjs 1.24 KB
58
- ESM dist/chunk-FP4EXCGS.mjs 954.00 B
59
- ESM dist/hooks/use-tree.mjs 170.00 B
60
- ESM dist/chunk-7P4OYNP3.mjs 677.00 B
54
+ ESM dist/chunk-FRAKUJWH.mjs 76.00 B
55
+ ESM dist/chunk-5UGLWBZJ.mjs 76.00 B
61
56
  ESM dist/chunk-HW5IH6PV.mjs 626.00 B
62
57
  ESM dist/hooks/use-chat.mjs 214.00 B
63
- ESM dist/chunk-SFQOMKM2.mjs 2.71 KB
64
- ESM dist/chunk-QTET3FBV.mjs 5.18 KB
65
- ESM dist/chunk-6A4PCNMZ.mjs 1.30 KB
66
- ESM dist/context/index.mjs 186.00 B
58
+ ESM dist/hooks/index.mjs 708.00 B
59
+ ESM dist/chunk-FY7XNRJP.mjs 2.88 KB
60
+ ESM dist/hooks/use-copilot-chat.mjs 507.00 B
61
+ ESM dist/chunk-VUY2K2DI.mjs 3.89 KB
62
+ ESM dist/chunk-JD7BAH7U.mjs 76.00 B
67
63
  ESM dist/chunk-LMZN4NSM.mjs 3.69 KB
68
- ESM dist/chunk-TKXPMMND.mjs 5.33 KB
69
64
  ESM dist/chunk-VK25FIML.mjs 4.48 KB
70
- ESM dist/hooks/use-flat-category-store.mjs 200.00 B
65
+ ESM dist/chunk-TKXPMMND.mjs 5.33 KB
66
+ ESM dist/chunk-FP4EXCGS.mjs 954.00 B
67
+ ESM dist/hooks/use-make-copilot-actionable.mjs 218.00 B
71
68
  ESM dist/chunk-YULKJPY3.mjs 1.87 KB
72
- ESM dist/hooks/use-copilot-chat.mjs 507.00 B
73
- ESM dist/chunk-VUY2K2DI.mjs 3.89 KB
74
- ESM dist/hooks/index.mjs 708.00 B
75
- ESM dist/openai/chat-completion-transport.mjs 183.00 B
76
- ESM dist/openai/index.mjs 224.00 B
77
- ESM dist/utils/utils.test.mjs 202.00 B
69
+ ESM dist/hooks/use-flat-category-store.mjs 200.00 B
70
+ ESM dist/chunk-D4NQCVHE.mjs 5.18 KB
71
+ ESM dist/openai/chat-completion-client.mjs 209.00 B
72
+ ESM dist/chunk-6SOQYBNX.mjs 1.24 KB
73
+ ESM dist/chunk-7P4OYNP3.mjs 677.00 B
74
+ ESM dist/chunk-6A4PCNMZ.mjs 1.30 KB
75
+ ESM dist/chunk-P34OLW2N.mjs 4.33 KB
76
+ ESM dist/hooks/use-make-copilot-document-readable.mjs 231.00 B
78
77
  ESM dist/components/copilot-provider/copilot-provider-props.mjs 84.00 B
78
+ ESM dist/utils/utils.test.mjs 202.00 B
79
79
  ESM dist/openai-assistants/utils/process-message-stream.mjs 183.00 B
80
- ESM dist/openai-assistants/hooks/index.mjs 547.00 B
80
+ ESM dist/openai-assistants/hooks/use-assistants.mjs 2.55 KB
81
+ ESM dist/types/system-message.mjs 76.00 B
82
+ ESM dist/types/document-pointer.mjs 78.00 B
81
83
  ESM dist/types/annotated-function.mjs 80.00 B
82
- ESM dist/types/message.mjs 69.00 B
83
- ESM dist/utils/utils.mjs 67.00 B
84
84
  ESM dist/types/base.mjs 66.00 B
85
85
  ESM dist/components/copilot-provider/copilot-provider.mjs 345.00 B
86
- ESM dist/components/copilot-provider/standard-copilot-api-config.mjs 192.00 B
87
- ESM dist/types/document-pointer.mjs 78.00 B
88
86
  ESM dist/components/copilot-provider/index.mjs 369.00 B
87
+ ESM dist/utils/utils.mjs 67.00 B
88
+ ESM dist/components/copilot-provider/standard-copilot-api-config.mjs 192.00 B
89
89
  ESM dist/openai-assistants/utils/index.mjs 201.00 B
90
- ESM dist/openai-assistants/hooks/use-assistants.mjs 2.55 KB
91
- ESM dist/chunk-7GFKOIO7.mjs.map 51.00 B
92
- ESM dist/openai/chat-completion-client.mjs.map 51.00 B
93
90
  ESM dist/openai-assistants/hooks/use-copilot-chat-v2.mjs 548.00 B
94
- ESM dist/openai-assistants/index.mjs.map 51.00 B
91
+ ESM dist/openai-assistants/hooks/index.mjs 547.00 B
92
+ ESM dist/chunk-PUFR5OAI.mjs.map 51.00 B
93
+ ESM dist/types/index.mjs.map 51.00 B
95
94
  ESM dist/context/copilot-context.mjs.map 51.00 B
95
+ ESM dist/hooks/use-make-copilot-readable.mjs.map 51.00 B
96
+ ESM dist/openai/chat-completion-stream.mjs.map 51.00 B
97
+ ESM dist/openai-assistants/index.mjs.map 51.00 B
96
98
  ESM dist/components/index.mjs.map 51.00 B
97
- ESM dist/hooks/use-make-copilot-actionable.mjs.map 51.00 B
98
- ESM dist/chunk-BABVSMJR.mjs.map 51.00 B
99
- ESM dist/chunk-PUFR5OAI.mjs.map 51.00 B
100
- ESM dist/chunk-FRAKUJWH.mjs.map 51.00 B
101
- ESM dist/chunk-EFZPSZWO.mjs.map 51.00 B
102
- ESM dist/chunk-VNRDQJXW.mjs.map 51.00 B
103
- ESM dist/chunk-5UGLWBZJ.mjs.map 51.00 B
99
+ ESM dist/chunk-7GFKOIO7.mjs.map 51.00 B
104
100
  ESM dist/chunk-SPCZTZCY.mjs.map 51.00 B
105
101
  ESM dist/chunk-F2JIAPZQ.mjs.map 1.12 KB
106
- ESM dist/hooks/use-make-copilot-readable.mjs.map 51.00 B
107
- ESM dist/openai/chat-completion-stream.mjs.map 51.00 B
108
- ESM dist/chunk-TU4DNDO7.mjs.map 7.90 KB
102
+ ESM dist/chunk-VNRDQJXW.mjs.map 51.00 B
103
+ ESM dist/chunk-EFZPSZWO.mjs.map 51.00 B
104
+ ESM dist/openai/chat-completion-transport.mjs.map 51.00 B
105
+ ESM dist/chunk-MRXNTQOX.mjs.map 71.00 B
109
106
  ESM dist/index.mjs.map 51.00 B
107
+ ESM dist/context/index.mjs.map 51.00 B
110
108
  ESM dist/chunk-MZ5UN3BY.mjs.map 1.26 KB
111
- ESM dist/chunk-6SOQYBNX.mjs.map 2.07 KB
112
- ESM dist/chunk-FP4EXCGS.mjs.map 1.67 KB
113
- ESM dist/chunk-7P4OYNP3.mjs.map 1.42 KB
109
+ ESM dist/chunk-FRAKUJWH.mjs.map 51.00 B
114
110
  ESM dist/hooks/use-chat.mjs.map 51.00 B
115
- ESM dist/hooks/use-tree.mjs.map 51.00 B
116
- ESM dist/chunk-SFQOMKM2.mjs.map 4.37 KB
117
- ESM dist/chunk-QTET3FBV.mjs.map 11.03 KB
118
- ESM dist/context/index.mjs.map 51.00 B
119
- ESM dist/chunk-LMZN4NSM.mjs.map 8.47 KB
120
- ESM dist/chunk-TKXPMMND.mjs.map 9.93 KB
111
+ ESM dist/chunk-HW5IH6PV.mjs.map 1.47 KB
112
+ ESM dist/chunk-BABVSMJR.mjs.map 51.00 B
113
+ ESM dist/chunk-5UGLWBZJ.mjs.map 51.00 B
121
114
  ESM dist/chunk-VK25FIML.mjs.map 7.84 KB
122
- ESM dist/hooks/use-flat-category-store.mjs.map 51.00 B
123
- ESM dist/chunk-YULKJPY3.mjs.map 4.21 KB
124
- ESM dist/types/index.mjs.map 51.00 B
115
+ ESM dist/chunk-FY7XNRJP.mjs.map 4.65 KB
116
+ ESM dist/chunk-LMZN4NSM.mjs.map 8.47 KB
117
+ ESM dist/openai/index.mjs.map 51.00 B
125
118
  ESM dist/hooks/use-copilot-chat.mjs.map 51.00 B
126
- ESM dist/hooks/use-make-copilot-document-readable.mjs.map 51.00 B
119
+ ESM dist/chunk-FP4EXCGS.mjs.map 1.67 KB
120
+ ESM dist/hooks/use-tree.mjs.map 51.00 B
121
+ ESM dist/hooks/use-make-copilot-actionable.mjs.map 51.00 B
127
122
  ESM dist/chunk-VUY2K2DI.mjs.map 8.27 KB
128
- ESM dist/chunk-MRXNTQOX.mjs.map 71.00 B
123
+ ESM dist/chunk-YULKJPY3.mjs.map 4.21 KB
124
+ ESM dist/openai/chat-completion-client.mjs.map 51.00 B
129
125
  ESM dist/hooks/index.mjs.map 51.00 B
126
+ ESM dist/hooks/use-flat-category-store.mjs.map 51.00 B
127
+ ESM dist/chunk-JD7BAH7U.mjs.map 51.00 B
128
+ ESM dist/chunk-6SOQYBNX.mjs.map 2.07 KB
129
+ ESM dist/chunk-7P4OYNP3.mjs.map 1.42 KB
130
+ ESM dist/chunk-D4NQCVHE.mjs.map 11.03 KB
131
+ ESM dist/chunk-TKXPMMND.mjs.map 9.93 KB
132
+ ESM dist/chunk-P34OLW2N.mjs.map 7.90 KB
130
133
  ESM dist/chunk-6A4PCNMZ.mjs.map 4.26 KB
131
- ESM dist/openai/chat-completion-transport.mjs.map 51.00 B
132
- ESM dist/chunk-HW5IH6PV.mjs.map 1.47 KB
133
- ESM dist/openai/index.mjs.map 51.00 B
134
- ESM dist/utils/utils.test.mjs.map 351.00 B
134
+ ESM dist/hooks/use-make-copilot-document-readable.mjs.map 51.00 B
135
135
  ESM dist/components/copilot-provider/copilot-provider-props.mjs.map 51.00 B
136
+ ESM dist/utils/utils.test.mjs.map 351.00 B
136
137
  ESM dist/openai-assistants/utils/process-message-stream.mjs.map 51.00 B
137
- ESM dist/chunk-JD7BAH7U.mjs.map 51.00 B
138
+ ESM dist/openai-assistants/hooks/use-assistants.mjs.map 4.67 KB
139
+ ESM dist/types/system-message.mjs.map 51.00 B
140
+ ESM dist/types/document-pointer.mjs.map 51.00 B
141
+ ESM dist/components/copilot-provider/copilot-provider.mjs.map 51.00 B
138
142
  ESM dist/types/annotated-function.mjs.map 51.00 B
139
- ESM dist/types/message.mjs.map 51.00 B
140
- ESM dist/utils/utils.mjs.map 51.00 B
141
143
  ESM dist/types/base.mjs.map 51.00 B
142
- ESM dist/components/copilot-provider/copilot-provider.mjs.map 51.00 B
143
- ESM dist/components/copilot-provider/standard-copilot-api-config.mjs.map 51.00 B
144
- ESM dist/types/document-pointer.mjs.map 51.00 B
144
+ ESM dist/utils/utils.mjs.map 51.00 B
145
+ ESM dist/components/copilot-provider/index.mjs.map 51.00 B
145
146
  ESM dist/openai-assistants/utils/index.mjs.map 51.00 B
146
- ESM dist/openai-assistants/hooks/use-assistants.mjs.map 4.67 KB
147
- ESM dist/openai-assistants/hooks/index.mjs.map 51.00 B
148
147
  ESM dist/openai-assistants/hooks/use-copilot-chat-v2.mjs.map 51.00 B
149
- ESM dist/components/copilot-provider/index.mjs.map 51.00 B
150
- ESM ⚡️ Build success in 149ms
148
+ ESM dist/components/copilot-provider/standard-copilot-api-config.mjs.map 51.00 B
149
+ ESM dist/openai-assistants/hooks/index.mjs.map 51.00 B
150
+ ESM ⚡️ Build success in 139ms
151
151
  DTS Build start
152
- DTS ⚡️ Build success in 2992ms
153
- DTS dist/index.d.ts 1.61 KB
152
+ DTS ⚡️ Build success in 2854ms
153
+ DTS dist/index.d.ts 1.68 KB
154
154
  DTS dist/components/copilot-provider/copilot-provider.d.ts 1.55 KB
155
155
  DTS dist/components/copilot-provider/copilot-provider-props.d.ts 1.52 KB
156
156
  DTS dist/context/copilot-context.d.ts 1.98 KB
157
- DTS dist/hooks/use-copilot-chat.d.ts 955.00 B
157
+ DTS dist/hooks/use-copilot-chat.d.ts 1.08 KB
158
158
  DTS dist/hooks/use-make-copilot-actionable.d.ts 255.00 B
159
159
  DTS dist/hooks/use-make-copilot-readable.d.ts 598.00 B
160
160
  DTS dist/hooks/use-make-copilot-document-readable.d.ts 516.00 B
@@ -162,22 +162,22 @@ DTS dist/hooks/use-chat.d.ts 2.75 KB
162
162
  DTS dist/types/annotated-function.d.ts 767.00 B
163
163
  DTS dist/types/document-pointer.d.ts 181.00 B
164
164
  DTS dist/types/base.d.ts 1.96 KB
165
+ DTS dist/types/system-message.d.ts 132.00 B
165
166
  DTS dist/openai-assistants/hooks/use-copilot-chat-v2.d.ts 1.41 KB
166
167
  DTS dist/openai-assistants/utils/process-message-stream.d.ts 196.00 B
167
168
  DTS dist/openai/chat-completion-stream.d.ts 694.00 B
168
169
  DTS dist/openai/chat-completion-transport.d.ts 1.26 KB
169
170
  DTS dist/hooks/use-tree.d.ts 543.00 B
170
- DTS dist/context/index.d.ts 281.00 B
171
171
  DTS dist/components/index.d.ts 482.00 B
172
- DTS dist/hooks/index.d.ts 608.00 B
172
+ DTS dist/hooks/index.d.ts 645.00 B
173
173
  DTS dist/hooks/use-flat-category-store.d.ts 424.00 B
174
- DTS dist/openai/chat-completion-client.d.ts 1.44 KB
175
- DTS dist/openai/index.d.ts 438.00 B
176
- DTS dist/openai-assistants/index.d.ts 262.00 B
177
- DTS dist/types/index.d.ts 233.00 B
178
- DTS dist/types/message.d.ts 12.00 B
174
+ DTS dist/context/index.d.ts 281.00 B
179
175
  DTS dist/utils/utils.test.d.ts 12.00 B
180
176
  DTS dist/utils/utils.d.ts 12.00 B
177
+ DTS dist/openai-assistants/index.d.ts 262.00 B
178
+ DTS dist/openai/chat-completion-client.d.ts 1.44 KB
179
+ DTS dist/openai/index.d.ts 438.00 B
180
+ DTS dist/types/index.d.ts 294.00 B
181
181
  DTS dist/components/copilot-provider/index.d.ts 463.00 B
182
182
  DTS dist/components/copilot-provider/standard-copilot-api-config.d.ts 911.00 B
183
183
  DTS dist/openai-assistants/hooks/index.d.ts 182.00 B
package/CHANGELOG.md CHANGED
@@ -1,10 +1,21 @@
1
1
  # ui
2
2
 
3
+ ## 0.18.0-alpha.1
4
+
5
+ ### Minor Changes
6
+
7
+ - new sidebar ui
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @copilotkit/shared@0.2.0-alpha.0
13
+
3
14
  ## 0.18.0-alpha.0
4
15
 
5
16
  ### Minor Changes
6
17
 
7
- - propagate makeSystemMessage through CopilotSidebarUIProvider
18
+ - New Copilot ui
8
19
 
9
20
  ## 0.17.1
10
21
 
@@ -1,7 +1,7 @@
1
1
  import { StandardCopilotApiConfig } from './chunk-F2JIAPZQ.mjs';
2
2
  import { use_tree_default } from './chunk-VUY2K2DI.mjs';
3
- import { CopilotContext } from './chunk-6A4PCNMZ.mjs';
4
3
  import { use_flat_category_store_default } from './chunk-YULKJPY3.mjs';
4
+ import { CopilotContext } from './chunk-6A4PCNMZ.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-QTET3FBV.mjs.map
165
+ //# sourceMappingURL=chunk-D4NQCVHE.mjs.map
@@ -1,14 +1,16 @@
1
- import { defaultCopilotContextCategories } from './chunk-QTET3FBV.mjs';
2
- import { CopilotContext } from './chunk-6A4PCNMZ.mjs';
1
+ import { defaultCopilotContextCategories } from './chunk-D4NQCVHE.mjs';
3
2
  import { useChat } from './chunk-LMZN4NSM.mjs';
3
+ import { CopilotContext } from './chunk-6A4PCNMZ.mjs';
4
4
  import { __objRest, __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
5
5
  import { useContext, useMemo } from 'react';
6
6
 
7
7
  function useCopilotChat(_a) {
8
8
  var _b = _a, {
9
- makeSystemMessage
9
+ makeSystemMessage,
10
+ additionalInstructions
10
11
  } = _b, options = __objRest(_b, [
11
- "makeSystemMessage"
12
+ "makeSystemMessage",
13
+ "additionalInstructions"
12
14
  ]);
13
15
  const {
14
16
  getContextString,
@@ -21,7 +23,7 @@ function useCopilotChat(_a) {
21
23
  const contextString = getContextString([], defaultCopilotContextCategories);
22
24
  return {
23
25
  id: "system",
24
- content: systemMessageMaker(contextString),
26
+ content: systemMessageMaker(contextString, additionalInstructions),
25
27
  role: "system"
26
28
  };
27
29
  }, [getContextString, makeSystemMessage]);
@@ -50,7 +52,7 @@ function useCopilotChat(_a) {
50
52
  setInput
51
53
  };
52
54
  }
53
- function defaultSystemMessage(contextString) {
55
+ function defaultSystemMessage(contextString, additionalInstructions) {
54
56
  return `
55
57
  Please act as an efficient, competent, conscientious, and industrious professional assistant.
56
58
 
@@ -69,9 +71,11 @@ Please assist them as best you can.
69
71
  You can ask them for clarifying questions if needed, but don't be annoying about it. If you can reasonably 'fill in the blanks' yourself, do so.
70
72
 
71
73
  If you would like to call a function, call it without saying anything else.
72
- `;
74
+ ` + (additionalInstructions ? `
75
+
76
+ ${additionalInstructions}` : "");
73
77
  }
74
78
 
75
79
  export { defaultSystemMessage, useCopilotChat };
76
80
  //# sourceMappingURL=out.js.map
77
- //# sourceMappingURL=chunk-SFQOMKM2.mjs.map
81
+ //# sourceMappingURL=chunk-FY7XNRJP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/use-copilot-chat.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,SAAS,kBAAkB;AAsB7B,SAAS,eAAe,IAIiB;AAJjB,eAC7B;AAAA;AAAA,IACA;AAAA,EAxBF,IAsB+B,IAG1B,oBAH0B,IAG1B;AAAA,IAFH;AAAA,IACA;AAAA;AAGA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,cAAc;AAE7B,QAAM,gBAAyB,QAAQ,MAAM;AAC3C,UAAM,qBAAqB,qBAAqB;AAChD,UAAM,gBAAgB,iBAAiB,CAAC,GAAG,+BAA+B;AAE1E,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,SAAS,mBAAmB,eAAe,sBAAsB;AAAA,MACjE,MAAM;AAAA,IACR;AAAA,EACF,GAAG,CAAC,kBAAkB,iBAAiB,CAAC;AAExC,QAAM,uBAA8D,QAAQ,MAAM;AAChF,WAAO,sCAAsC;AAAA,EAC/C,GAAG,CAAC,qCAAqC,CAAC;AAE1C,QAAM,EAAE,UAAU,QAAQ,QAAQ,MAAM,WAAW,OAAO,SAAS,IAAI,QAAQ,iCAC1E,UAD0E;AAAA,IAE7E,eAAe;AAAA,IACf,IAAI,QAAQ;AAAA,IACZ,iBAAiB,CAAC,aAAa,EAAE,OAAO,QAAQ,mBAAmB,CAAC,CAAC;AAAA,IACrE,WAAW;AAAA,IACX,gBAAgB,uBAAuB;AAAA,IACvC,SAAS,mBAAK,QAAQ;AAAA,IACtB,MAAM,mBACD,QAAQ;AAAA,EAEf,EAAC;AAED,QAAM,kBAAkB,SAAS;AAAA,IAC/B,CAAC,YAAY,QAAQ,SAAS,UAAU,QAAQ,SAAS;AAAA,EAC3D;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,qBACd,eACA,wBACQ;AACR,SACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAUG,yBAAyB;AAAA;AAAA,EAAO,2BAA2B;AAEhE","sourcesContent":["import { useMemo, useContext } from \"react\";\nimport { CopilotContext, CopilotContextParams } from \"../context/copilot-context\";\nimport { Message, SystemMessageFunction } from \"../types\";\nimport { UseChatOptions, useChat } from \"./use-chat\";\nimport { defaultCopilotContextCategories } from \"../components\";\nimport { ChatCompletionCreateParams } from \"openai/resources/chat\";\n\nexport interface UseCopilotChatOptions extends UseChatOptions {\n makeSystemMessage?: SystemMessageFunction;\n additionalInstructions?: string;\n}\n\nexport interface UseCopilotChatReturn {\n visibleMessages: Message[];\n append: (message: Message) => Promise<void>;\n reload: () => Promise<void>;\n stop: () => void;\n isLoading: boolean;\n input: string;\n setInput: React.Dispatch<React.SetStateAction<string>>;\n}\n\nexport function useCopilotChat({\n makeSystemMessage,\n additionalInstructions,\n ...options\n}: UseCopilotChatOptions): UseCopilotChatReturn {\n const {\n getContextString,\n getChatCompletionFunctionDescriptions,\n getFunctionCallHandler,\n copilotApiConfig,\n } = useContext(CopilotContext);\n\n const systemMessage: Message = useMemo(() => {\n const systemMessageMaker = makeSystemMessage || defaultSystemMessage;\n const contextString = getContextString([], defaultCopilotContextCategories); // TODO: make the context categories configurable\n\n return {\n id: \"system\",\n content: systemMessageMaker(contextString, additionalInstructions),\n role: \"system\",\n };\n }, [getContextString, makeSystemMessage]);\n\n const functionDescriptions: ChatCompletionCreateParams.Function[] = useMemo(() => {\n return getChatCompletionFunctionDescriptions();\n }, [getChatCompletionFunctionDescriptions]);\n\n const { messages, append, reload, stop, isLoading, input, setInput } = useChat({\n ...options,\n copilotConfig: copilotApiConfig,\n id: options.id,\n initialMessages: [systemMessage].concat(options.initialMessages || []),\n functions: functionDescriptions,\n onFunctionCall: getFunctionCallHandler(),\n headers: { ...options.headers },\n body: {\n ...options.body,\n },\n });\n\n const visibleMessages = messages.filter(\n (message) => message.role === \"user\" || message.role === \"assistant\",\n );\n\n return {\n visibleMessages,\n append,\n reload,\n stop,\n isLoading,\n input,\n setInput,\n };\n}\n\nexport function defaultSystemMessage(\n contextString: string,\n additionalInstructions?: string,\n): string {\n return (\n `\nPlease act as an efficient, competent, conscientious, and industrious professional assistant.\n\nHelp the user achieve their goals, and you do so in a way that is as efficient as possible, without unnecessary fluff, but also without sacrificing professionalism.\nAlways be polite and respectful, and prefer brevity over verbosity.\n\nThe user has provided you with the following context:\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThey have also provided you with functions you can call to initiate actions on their behalf, or functions you can call to receive more information.\n\nPlease assist them as best you can.\n\nYou can ask them for clarifying questions if needed, but don't be annoying about it. If you can reasonably 'fill in the blanks' yourself, do so.\n\nIf you would like to call a function, call it without saying anything else.\n` + (additionalInstructions ? `\\n\\n${additionalInstructions}` : \"\")\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { processMessageStream } from './chunk-MZ5UN3BY.mjs';
2
- import { defaultCopilotContextCategories } from './chunk-QTET3FBV.mjs';
2
+ import { defaultCopilotContextCategories } from './chunk-D4NQCVHE.mjs';
3
3
  import { CopilotContext } from './chunk-6A4PCNMZ.mjs';
4
4
  import { __async, __spreadValues } from './chunk-MRXNTQOX.mjs';
5
5
  import { useContext, useState, useMemo } from 'react';
@@ -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-TU4DNDO7.mjs.map
125
+ //# sourceMappingURL=chunk-P34OLW2N.mjs.map
@@ -1,8 +1,8 @@
1
- export { CopilotProvider, defaultCopilotContextCategories } from '../../chunk-QTET3FBV.mjs';
1
+ export { CopilotProvider, defaultCopilotContextCategories } from '../../chunk-D4NQCVHE.mjs';
2
2
  import '../../chunk-F2JIAPZQ.mjs';
3
3
  import '../../chunk-VUY2K2DI.mjs';
4
- import '../../chunk-6A4PCNMZ.mjs';
5
4
  import '../../chunk-YULKJPY3.mjs';
5
+ import '../../chunk-6A4PCNMZ.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-QTET3FBV.mjs';
2
+ export { CopilotProvider, defaultCopilotContextCategories } from '../../chunk-D4NQCVHE.mjs';
3
3
  import '../../chunk-F2JIAPZQ.mjs';
4
4
  import '../../chunk-VUY2K2DI.mjs';
5
- import '../../chunk-6A4PCNMZ.mjs';
6
5
  import '../../chunk-YULKJPY3.mjs';
6
+ import '../../chunk-6A4PCNMZ.mjs';
7
7
  import '../../chunk-MRXNTQOX.mjs';
8
8
  //# sourceMappingURL=out.js.map
9
9
  //# sourceMappingURL=index.mjs.map
@@ -1,10 +1,10 @@
1
1
  import '../chunk-JD7BAH7U.mjs';
2
2
  import '../chunk-SPCZTZCY.mjs';
3
- export { CopilotProvider, defaultCopilotContextCategories } from '../chunk-QTET3FBV.mjs';
3
+ export { CopilotProvider, defaultCopilotContextCategories } from '../chunk-D4NQCVHE.mjs';
4
4
  import '../chunk-F2JIAPZQ.mjs';
5
5
  import '../chunk-VUY2K2DI.mjs';
6
- import '../chunk-6A4PCNMZ.mjs';
7
6
  import '../chunk-YULKJPY3.mjs';
7
+ import '../chunk-6A4PCNMZ.mjs';
8
8
  import '../chunk-MRXNTQOX.mjs';
9
9
  //# sourceMappingURL=out.js.map
10
10
  //# sourceMappingURL=index.mjs.map
@@ -4,6 +4,7 @@ export { useMakeCopilotReadable } from './use-make-copilot-readable.js';
4
4
  export { useMakeCopilotDocumentReadable } from './use-make-copilot-document-readable.js';
5
5
  export { UseChatHelpers } from './use-chat.js';
6
6
  import '../types/base.js';
7
+ import '../types/system-message.js';
7
8
  import '../context/copilot-context.js';
8
9
  import '../types/annotated-function.js';
9
10
  import '../types/document-pointer.js';
@@ -1,18 +1,18 @@
1
1
  import '../chunk-5UGLWBZJ.mjs';
2
- export { useMakeCopilotActionable } from '../chunk-FP4EXCGS.mjs';
3
- export { useMakeCopilotDocumentReadable } from '../chunk-7P4OYNP3.mjs';
4
2
  export { useMakeCopilotReadable } from '../chunk-HW5IH6PV.mjs';
5
- export { useCopilotChat } from '../chunk-SFQOMKM2.mjs';
3
+ export { useCopilotChat } from '../chunk-FY7XNRJP.mjs';
6
4
  import '../chunk-JD7BAH7U.mjs';
7
5
  import '../chunk-SPCZTZCY.mjs';
8
- import '../chunk-QTET3FBV.mjs';
6
+ import '../chunk-D4NQCVHE.mjs';
9
7
  import '../chunk-F2JIAPZQ.mjs';
10
8
  import '../chunk-VUY2K2DI.mjs';
11
- import '../chunk-6A4PCNMZ.mjs';
12
9
  import '../chunk-LMZN4NSM.mjs';
13
10
  import '../chunk-TKXPMMND.mjs';
14
11
  import '../chunk-VK25FIML.mjs';
15
12
  import '../chunk-YULKJPY3.mjs';
13
+ export { useMakeCopilotActionable } from '../chunk-FP4EXCGS.mjs';
14
+ export { useMakeCopilotDocumentReadable } from '../chunk-7P4OYNP3.mjs';
15
+ import '../chunk-6A4PCNMZ.mjs';
16
16
  import '../chunk-MRXNTQOX.mjs';
17
17
  //# sourceMappingURL=out.js.map
18
18
  //# sourceMappingURL=index.mjs.map
@@ -1,4 +1,5 @@
1
1
  import { Message } from '../types/base.js';
2
+ import { SystemMessageFunction } from '../types/system-message.js';
2
3
  import { UseChatOptions } from './use-chat.js';
3
4
  import '../context/copilot-context.js';
4
5
  import '../types/annotated-function.js';
@@ -8,7 +9,8 @@ import './use-tree.js';
8
9
  import 'openai/resources/chat';
9
10
 
10
11
  interface UseCopilotChatOptions extends UseChatOptions {
11
- makeSystemMessage?: (contextString: string) => string;
12
+ makeSystemMessage?: SystemMessageFunction;
13
+ additionalInstructions?: string;
12
14
  }
13
15
  interface UseCopilotChatReturn {
14
16
  visibleMessages: Message[];
@@ -19,7 +21,7 @@ interface UseCopilotChatReturn {
19
21
  input: string;
20
22
  setInput: React.Dispatch<React.SetStateAction<string>>;
21
23
  }
22
- declare function useCopilotChat({ makeSystemMessage, ...options }: UseCopilotChatOptions): UseCopilotChatReturn;
23
- declare function defaultSystemMessage(contextString: string): string;
24
+ declare function useCopilotChat({ makeSystemMessage, additionalInstructions, ...options }: UseCopilotChatOptions): UseCopilotChatReturn;
25
+ declare function defaultSystemMessage(contextString: string, additionalInstructions?: string): string;
24
26
 
25
27
  export { UseCopilotChatOptions, UseCopilotChatReturn, defaultSystemMessage, useCopilotChat };
@@ -1,14 +1,14 @@
1
- export { defaultSystemMessage, useCopilotChat } from '../chunk-SFQOMKM2.mjs';
1
+ export { defaultSystemMessage, useCopilotChat } from '../chunk-FY7XNRJP.mjs';
2
2
  import '../chunk-JD7BAH7U.mjs';
3
3
  import '../chunk-SPCZTZCY.mjs';
4
- import '../chunk-QTET3FBV.mjs';
4
+ import '../chunk-D4NQCVHE.mjs';
5
5
  import '../chunk-F2JIAPZQ.mjs';
6
6
  import '../chunk-VUY2K2DI.mjs';
7
- import '../chunk-6A4PCNMZ.mjs';
8
7
  import '../chunk-LMZN4NSM.mjs';
9
8
  import '../chunk-TKXPMMND.mjs';
10
9
  import '../chunk-VK25FIML.mjs';
11
10
  import '../chunk-YULKJPY3.mjs';
11
+ import '../chunk-6A4PCNMZ.mjs';
12
12
  import '../chunk-MRXNTQOX.mjs';
13
13
  //# sourceMappingURL=out.js.map
14
14
  //# sourceMappingURL=use-copilot-chat.mjs.map
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export { UseChatHelpers } from './hooks/use-chat.js';
9
9
  export { AnnotatedFunction, AnnotatedFunctionArgument } from './types/annotated-function.js';
10
10
  export { DocumentPointer } from './types/document-pointer.js';
11
11
  export { Function, FunctionCall, FunctionCallHandler, Message, Role } from './types/base.js';
12
+ export { SystemMessageFunction } from './types/system-message.js';
12
13
  export { AssistantStatus, RequestForwardingOptions, UseCopilotChatOptionsV2, UseCopilotChatV2Result, useCopilotChatV2 } from './openai-assistants/hooks/use-copilot-chat-v2.js';
13
14
  export { processMessageStream } from './openai-assistants/utils/process-message-stream.js';
14
15
  export { ChatCompletionStream, ChatCompletionStreamConfiguration } from './openai/chat-completion-stream.js';
package/dist/index.mjs CHANGED
@@ -1,27 +1,27 @@
1
+ import './chunk-PUFR5OAI.mjs';
2
+ export { ChatCompletionStream } from './chunk-6SOQYBNX.mjs';
3
+ import './chunk-EFZPSZWO.mjs';
1
4
  import './chunk-7GFKOIO7.mjs';
2
5
  import './chunk-BABVSMJR.mjs';
3
- export { useCopilotChatV2 } from './chunk-TU4DNDO7.mjs';
6
+ export { useCopilotChatV2 } from './chunk-P34OLW2N.mjs';
4
7
  import './chunk-FRAKUJWH.mjs';
5
8
  export { processMessageStream } from './chunk-MZ5UN3BY.mjs';
6
- import './chunk-EFZPSZWO.mjs';
7
- import './chunk-PUFR5OAI.mjs';
8
- export { ChatCompletionStream } from './chunk-6SOQYBNX.mjs';
9
9
  import './chunk-VNRDQJXW.mjs';
10
10
  import './chunk-5UGLWBZJ.mjs';
11
- export { useMakeCopilotActionable } from './chunk-FP4EXCGS.mjs';
12
- export { useMakeCopilotDocumentReadable } from './chunk-7P4OYNP3.mjs';
13
11
  export { useMakeCopilotReadable } from './chunk-HW5IH6PV.mjs';
14
- export { useCopilotChat } from './chunk-SFQOMKM2.mjs';
12
+ export { useCopilotChat } from './chunk-FY7XNRJP.mjs';
15
13
  import './chunk-JD7BAH7U.mjs';
16
14
  import './chunk-SPCZTZCY.mjs';
17
- export { CopilotProvider, defaultCopilotContextCategories } from './chunk-QTET3FBV.mjs';
15
+ export { CopilotProvider, defaultCopilotContextCategories } from './chunk-D4NQCVHE.mjs';
18
16
  import './chunk-F2JIAPZQ.mjs';
19
17
  import './chunk-VUY2K2DI.mjs';
20
- export { CopilotContext } from './chunk-6A4PCNMZ.mjs';
21
18
  import './chunk-LMZN4NSM.mjs';
22
19
  import './chunk-TKXPMMND.mjs';
23
20
  import './chunk-VK25FIML.mjs';
24
21
  import './chunk-YULKJPY3.mjs';
22
+ export { useMakeCopilotActionable } from './chunk-FP4EXCGS.mjs';
23
+ export { useMakeCopilotDocumentReadable } from './chunk-7P4OYNP3.mjs';
24
+ export { CopilotContext } from './chunk-6A4PCNMZ.mjs';
25
25
  import './chunk-MRXNTQOX.mjs';
26
26
  //# sourceMappingURL=out.js.map
27
27
  //# sourceMappingURL=index.mjs.map
@@ -1,15 +1,15 @@
1
1
  import '../../chunk-BABVSMJR.mjs';
2
- export { useCopilotChatV2 } from '../../chunk-TU4DNDO7.mjs';
2
+ export { useCopilotChatV2 } from '../../chunk-P34OLW2N.mjs';
3
3
  import '../../chunk-FRAKUJWH.mjs';
4
4
  import '../../chunk-MZ5UN3BY.mjs';
5
5
  import '../../chunk-VNRDQJXW.mjs';
6
6
  import '../../chunk-JD7BAH7U.mjs';
7
7
  import '../../chunk-SPCZTZCY.mjs';
8
- import '../../chunk-QTET3FBV.mjs';
8
+ import '../../chunk-D4NQCVHE.mjs';
9
9
  import '../../chunk-F2JIAPZQ.mjs';
10
10
  import '../../chunk-VUY2K2DI.mjs';
11
- import '../../chunk-6A4PCNMZ.mjs';
12
11
  import '../../chunk-YULKJPY3.mjs';
12
+ import '../../chunk-6A4PCNMZ.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-TU4DNDO7.mjs';
1
+ export { defaultSystemMessage, useCopilotChatV2 } from '../../chunk-P34OLW2N.mjs';
2
2
  import '../../chunk-FRAKUJWH.mjs';
3
3
  import '../../chunk-MZ5UN3BY.mjs';
4
4
  import '../../chunk-VNRDQJXW.mjs';
5
5
  import '../../chunk-JD7BAH7U.mjs';
6
6
  import '../../chunk-SPCZTZCY.mjs';
7
- import '../../chunk-QTET3FBV.mjs';
7
+ import '../../chunk-D4NQCVHE.mjs';
8
8
  import '../../chunk-F2JIAPZQ.mjs';
9
9
  import '../../chunk-VUY2K2DI.mjs';
10
- import '../../chunk-6A4PCNMZ.mjs';
11
10
  import '../../chunk-YULKJPY3.mjs';
11
+ import '../../chunk-6A4PCNMZ.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-TU4DNDO7.mjs';
3
+ export { useCopilotChatV2 } from '../chunk-P34OLW2N.mjs';
4
4
  import '../chunk-FRAKUJWH.mjs';
5
5
  export { processMessageStream } from '../chunk-MZ5UN3BY.mjs';
6
6
  import '../chunk-VNRDQJXW.mjs';
7
7
  import '../chunk-JD7BAH7U.mjs';
8
8
  import '../chunk-SPCZTZCY.mjs';
9
- import '../chunk-QTET3FBV.mjs';
9
+ import '../chunk-D4NQCVHE.mjs';
10
10
  import '../chunk-F2JIAPZQ.mjs';
11
11
  import '../chunk-VUY2K2DI.mjs';
12
- import '../chunk-6A4PCNMZ.mjs';
13
12
  import '../chunk-YULKJPY3.mjs';
13
+ import '../chunk-6A4PCNMZ.mjs';
14
14
  import '../chunk-MRXNTQOX.mjs';
15
15
  //# sourceMappingURL=out.js.map
16
16
  //# sourceMappingURL=index.mjs.map
@@ -1,3 +1,4 @@
1
1
  export { AnnotatedFunction, AnnotatedFunctionArgument } from './annotated-function.js';
2
2
  export { DocumentPointer } from './document-pointer.js';
3
3
  export { Function, FunctionCall, FunctionCallHandler, Message, Role } from './base.js';
4
+ export { SystemMessageFunction } from './system-message.js';
@@ -0,0 +1,3 @@
1
+ type SystemMessageFunction = (contextString: string, additionalInstructions?: string) => string;
2
+
3
+ export { SystemMessageFunction };
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=out.js.map
3
+ //# sourceMappingURL=system-message.mjs.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.18.0-alpha.0",
7
+ "version": "0.18.0-alpha.1",
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
- "eslint-config-custom": "0.2.0",
27
- "tsconfig": "0.6.0"
26
+ "tsconfig": "0.7.0-alpha.0",
27
+ "eslint-config-custom": "0.3.0-alpha.0"
28
28
  },
29
29
  "dependencies": {
30
30
  "eventemitter3": "^5.0.1",
31
31
  "nanoid": "^4.0.2",
32
32
  "openai": "^4.6.0",
33
- "@copilotkit/shared": "0.1.1"
33
+ "@copilotkit/shared": "0.2.0-alpha.0"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup --treeshake",
@@ -1,12 +1,13 @@
1
1
  import { useMemo, useContext } from "react";
2
2
  import { CopilotContext, CopilotContextParams } from "../context/copilot-context";
3
- import { Message } from "../types";
3
+ import { Message, SystemMessageFunction } from "../types";
4
4
  import { UseChatOptions, useChat } from "./use-chat";
5
5
  import { defaultCopilotContextCategories } from "../components";
6
6
  import { ChatCompletionCreateParams } from "openai/resources/chat";
7
7
 
8
8
  export interface UseCopilotChatOptions extends UseChatOptions {
9
- makeSystemMessage?: (contextString: string) => string;
9
+ makeSystemMessage?: SystemMessageFunction;
10
+ additionalInstructions?: string;
10
11
  }
11
12
 
12
13
  export interface UseCopilotChatReturn {
@@ -21,6 +22,7 @@ export interface UseCopilotChatReturn {
21
22
 
22
23
  export function useCopilotChat({
23
24
  makeSystemMessage,
25
+ additionalInstructions,
24
26
  ...options
25
27
  }: UseCopilotChatOptions): UseCopilotChatReturn {
26
28
  const {
@@ -36,7 +38,7 @@ export function useCopilotChat({
36
38
 
37
39
  return {
38
40
  id: "system",
39
- content: systemMessageMaker(contextString),
41
+ content: systemMessageMaker(contextString, additionalInstructions),
40
42
  role: "system",
41
43
  };
42
44
  }, [getContextString, makeSystemMessage]);
@@ -73,8 +75,12 @@ export function useCopilotChat({
73
75
  };
74
76
  }
75
77
 
76
- export function defaultSystemMessage(contextString: string): string {
77
- return `
78
+ export function defaultSystemMessage(
79
+ contextString: string,
80
+ additionalInstructions?: string,
81
+ ): string {
82
+ return (
83
+ `
78
84
  Please act as an efficient, competent, conscientious, and industrious professional assistant.
79
85
 
80
86
  Help the user achieve their goals, and you do so in a way that is as efficient as possible, without unnecessary fluff, but also without sacrificing professionalism.
@@ -92,5 +98,6 @@ Please assist them as best you can.
92
98
  You can ask them for clarifying questions if needed, but don't be annoying about it. If you can reasonably 'fill in the blanks' yourself, do so.
93
99
 
94
100
  If you would like to call a function, call it without saying anything else.
95
- `;
101
+ ` + (additionalInstructions ? `\n\n${additionalInstructions}` : "")
102
+ );
96
103
  }
@@ -2,3 +2,4 @@ export type { AnnotatedFunctionArgument } from "./annotated-function";
2
2
  export type { AnnotatedFunction } from "./annotated-function";
3
3
  export type { DocumentPointer } from "./document-pointer";
4
4
  export type { Role, Message, Function, FunctionCall, FunctionCallHandler } from "./base";
5
+ export type { SystemMessageFunction } from "./system-message";
@@ -0,0 +1,4 @@
1
+ export type SystemMessageFunction = (
2
+ contextString: string,
3
+ additionalInstructions?: string,
4
+ ) => string;
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/hooks/use-copilot-chat.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,SAAS,kBAAkB;AAqB7B,SAAS,eAAe,IAGiB;AAHjB,eAC7B;AAAA;AAAA,EAtBF,IAqB+B,IAE1B,oBAF0B,IAE1B;AAAA,IADH;AAAA;AAGA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,cAAc;AAE7B,QAAM,gBAAyB,QAAQ,MAAM;AAC3C,UAAM,qBAAqB,qBAAqB;AAChD,UAAM,gBAAgB,iBAAiB,CAAC,GAAG,+BAA+B;AAE1E,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,SAAS,mBAAmB,aAAa;AAAA,MACzC,MAAM;AAAA,IACR;AAAA,EACF,GAAG,CAAC,kBAAkB,iBAAiB,CAAC;AAExC,QAAM,uBAA8D,QAAQ,MAAM;AAChF,WAAO,sCAAsC;AAAA,EAC/C,GAAG,CAAC,qCAAqC,CAAC;AAE1C,QAAM,EAAE,UAAU,QAAQ,QAAQ,MAAM,WAAW,OAAO,SAAS,IAAI,QAAQ,iCAC1E,UAD0E;AAAA,IAE7E,eAAe;AAAA,IACf,IAAI,QAAQ;AAAA,IACZ,iBAAiB,CAAC,aAAa,EAAE,OAAO,QAAQ,mBAAmB,CAAC,CAAC;AAAA,IACrE,WAAW;AAAA,IACX,gBAAgB,uBAAuB;AAAA,IACvC,SAAS,mBAAK,QAAQ;AAAA,IACtB,MAAM,mBACD,QAAQ;AAAA,EAEf,EAAC;AAED,QAAM,kBAAkB,SAAS;AAAA,IAC/B,CAAC,YAAY,QAAQ,SAAS,UAAU,QAAQ,SAAS;AAAA,EAC3D;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,qBAAqB,eAA+B;AAClE,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWF","sourcesContent":["import { useMemo, useContext } from \"react\";\nimport { CopilotContext, CopilotContextParams } from \"../context/copilot-context\";\nimport { Message } from \"../types\";\nimport { UseChatOptions, useChat } from \"./use-chat\";\nimport { defaultCopilotContextCategories } from \"../components\";\nimport { ChatCompletionCreateParams } from \"openai/resources/chat\";\n\nexport interface UseCopilotChatOptions extends UseChatOptions {\n makeSystemMessage?: (contextString: string) => string;\n}\n\nexport interface UseCopilotChatReturn {\n visibleMessages: Message[];\n append: (message: Message) => Promise<void>;\n reload: () => Promise<void>;\n stop: () => void;\n isLoading: boolean;\n input: string;\n setInput: React.Dispatch<React.SetStateAction<string>>;\n}\n\nexport function useCopilotChat({\n makeSystemMessage,\n ...options\n}: UseCopilotChatOptions): UseCopilotChatReturn {\n const {\n getContextString,\n getChatCompletionFunctionDescriptions,\n getFunctionCallHandler,\n copilotApiConfig,\n } = useContext(CopilotContext);\n\n const systemMessage: Message = useMemo(() => {\n const systemMessageMaker = makeSystemMessage || defaultSystemMessage;\n const contextString = getContextString([], defaultCopilotContextCategories); // TODO: make the context categories configurable\n\n return {\n id: \"system\",\n content: systemMessageMaker(contextString),\n role: \"system\",\n };\n }, [getContextString, makeSystemMessage]);\n\n const functionDescriptions: ChatCompletionCreateParams.Function[] = useMemo(() => {\n return getChatCompletionFunctionDescriptions();\n }, [getChatCompletionFunctionDescriptions]);\n\n const { messages, append, reload, stop, isLoading, input, setInput } = useChat({\n ...options,\n copilotConfig: copilotApiConfig,\n id: options.id,\n initialMessages: [systemMessage].concat(options.initialMessages || []),\n functions: functionDescriptions,\n onFunctionCall: getFunctionCallHandler(),\n headers: { ...options.headers },\n body: {\n ...options.body,\n },\n });\n\n const visibleMessages = messages.filter(\n (message) => message.role === \"user\" || message.role === \"assistant\",\n );\n\n return {\n visibleMessages,\n append,\n reload,\n stop,\n isLoading,\n input,\n setInput,\n };\n}\n\nexport function defaultSystemMessage(contextString: string): string {\n return `\nPlease act as an efficient, competent, conscientious, and industrious professional assistant.\n\nHelp the user achieve their goals, and you do so in a way that is as efficient as possible, without unnecessary fluff, but also without sacrificing professionalism.\nAlways be polite and respectful, and prefer brevity over verbosity.\n\nThe user has provided you with the following context:\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThey have also provided you with functions you can call to initiate actions on their behalf, or functions you can call to receive more information.\n\nPlease assist them as best you can.\n\nYou can ask them for clarifying questions if needed, but don't be annoying about it. If you can reasonably 'fill in the blanks' yourself, do so.\n\nIf you would like to call a function, call it without saying anything else.\n`;\n}\n"]}
@@ -1,2 +0,0 @@
1
-
2
- export { }
@@ -1,3 +0,0 @@
1
-
2
- //# sourceMappingURL=out.js.map
3
- //# sourceMappingURL=message.mjs.map
File without changes