@copilotkit/react-core 0.37.0-mme-fix-textarea-css.1 → 0.37.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 (94) hide show
  1. package/.turbo/turbo-build.log +110 -110
  2. package/CHANGELOG.md +15 -0
  3. package/dist/{chunk-R5OF6NLN.mjs → chunk-2EQGN5QK.mjs} +3 -3
  4. package/dist/{chunk-K3T5WSHP.mjs → chunk-4OIVQMEM.mjs} +3 -3
  5. package/dist/{chunk-WSE45BNB.mjs → chunk-B244LK6F.mjs} +2 -2
  6. package/dist/{chunk-UG6IOUHF.mjs → chunk-B2H3NC4E.mjs} +2 -2
  7. package/dist/{chunk-ANYRLQY3.mjs → chunk-DY63PD22.mjs} +1 -1
  8. package/dist/chunk-DY63PD22.mjs.map +1 -0
  9. package/dist/{chunk-G6QRG37I.mjs → chunk-HUKLBIUK.mjs} +4 -4
  10. package/dist/{chunk-CZK6EOID.mjs → chunk-LLU5URI5.mjs} +4 -3
  11. package/dist/{chunk-CZK6EOID.mjs.map → chunk-LLU5URI5.mjs.map} +1 -1
  12. package/dist/{chunk-7YTDTTX5.mjs → chunk-MJKBCG4U.mjs} +3 -2
  13. package/dist/chunk-MJKBCG4U.mjs.map +1 -0
  14. package/dist/{chunk-E2FYNVYX.mjs → chunk-MNZXQ6UH.mjs} +2 -2
  15. package/dist/{chunk-X5HCQBME.mjs → chunk-NSUYO6TP.mjs} +2 -2
  16. package/dist/{chunk-MZ2JGV3C.mjs → chunk-S5LWO5V3.mjs} +2 -2
  17. package/dist/{chunk-6DKGH7LT.mjs → chunk-SR4RW4CU.mjs} +2 -2
  18. package/dist/{chunk-LQGRLQSL.mjs → chunk-Z5FB4WBL.mjs} +3 -3
  19. package/dist/components/copilot-provider/copilotkit-props.d.ts +5 -0
  20. package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
  21. package/dist/components/copilot-provider/copilotkit.js +2 -1
  22. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  23. package/dist/components/copilot-provider/copilotkit.mjs +2 -2
  24. package/dist/components/copilot-provider/index.js +2 -1
  25. package/dist/components/copilot-provider/index.js.map +1 -1
  26. package/dist/components/copilot-provider/index.mjs +2 -2
  27. package/dist/components/index.js +2 -1
  28. package/dist/components/index.js.map +1 -1
  29. package/dist/components/index.mjs +2 -2
  30. package/dist/context/copilot-context.d.ts +5 -0
  31. package/dist/context/copilot-context.js.map +1 -1
  32. package/dist/context/copilot-context.mjs +1 -1
  33. package/dist/context/index.js.map +1 -1
  34. package/dist/context/index.mjs +1 -1
  35. package/dist/hooks/index.js +2 -1
  36. package/dist/hooks/index.js.map +1 -1
  37. package/dist/hooks/index.mjs +10 -10
  38. package/dist/hooks/use-chat.js +2 -1
  39. package/dist/hooks/use-chat.js.map +1 -1
  40. package/dist/hooks/use-chat.mjs +2 -2
  41. package/dist/hooks/use-copilot-action.js.map +1 -1
  42. package/dist/hooks/use-copilot-action.mjs +2 -2
  43. package/dist/hooks/use-copilot-chat.js +2 -1
  44. package/dist/hooks/use-copilot-chat.js.map +1 -1
  45. package/dist/hooks/use-copilot-chat.mjs +5 -5
  46. package/dist/hooks/use-copilot-readable.js.map +1 -1
  47. package/dist/hooks/use-copilot-readable.mjs +2 -2
  48. package/dist/hooks/use-make-copilot-actionable.js.map +1 -1
  49. package/dist/hooks/use-make-copilot-actionable.mjs +2 -2
  50. package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
  51. package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
  52. package/dist/hooks/use-make-copilot-readable.js.map +1 -1
  53. package/dist/hooks/use-make-copilot-readable.mjs +2 -2
  54. package/dist/index.js +4 -2
  55. package/dist/index.js.map +1 -1
  56. package/dist/index.mjs +13 -13
  57. package/dist/lib/copilot-task.js +2 -1
  58. package/dist/lib/copilot-task.js.map +1 -1
  59. package/dist/lib/copilot-task.mjs +4 -4
  60. package/dist/lib/index.js +2 -1
  61. package/dist/lib/index.js.map +1 -1
  62. package/dist/lib/index.mjs +4 -4
  63. package/dist/openai-assistants/hooks/index.js.map +1 -1
  64. package/dist/openai-assistants/hooks/index.mjs +3 -3
  65. package/dist/openai-assistants/hooks/use-copilot-chat-v2.js.map +1 -1
  66. package/dist/openai-assistants/hooks/use-copilot-chat-v2.mjs +3 -3
  67. package/dist/openai-assistants/index.js.map +1 -1
  68. package/dist/openai-assistants/index.mjs +3 -3
  69. package/dist/utils/extract.js +2 -1
  70. package/dist/utils/extract.js.map +1 -1
  71. package/dist/utils/extract.mjs +4 -4
  72. package/dist/utils/fetch-chat-completion.js +2 -1
  73. package/dist/utils/fetch-chat-completion.js.map +1 -1
  74. package/dist/utils/fetch-chat-completion.mjs +1 -1
  75. package/dist/utils/index.js +2 -1
  76. package/dist/utils/index.js.map +1 -1
  77. package/dist/utils/index.mjs +4 -4
  78. package/package.json +4 -4
  79. package/src/components/copilot-provider/copilotkit-props.tsx +6 -0
  80. package/src/components/copilot-provider/copilotkit.tsx +1 -0
  81. package/src/context/copilot-context.tsx +6 -0
  82. package/src/utils/fetch-chat-completion.ts +1 -0
  83. package/dist/chunk-7YTDTTX5.mjs.map +0 -1
  84. package/dist/chunk-ANYRLQY3.mjs.map +0 -1
  85. /package/dist/{chunk-R5OF6NLN.mjs.map → chunk-2EQGN5QK.mjs.map} +0 -0
  86. /package/dist/{chunk-K3T5WSHP.mjs.map → chunk-4OIVQMEM.mjs.map} +0 -0
  87. /package/dist/{chunk-WSE45BNB.mjs.map → chunk-B244LK6F.mjs.map} +0 -0
  88. /package/dist/{chunk-UG6IOUHF.mjs.map → chunk-B2H3NC4E.mjs.map} +0 -0
  89. /package/dist/{chunk-G6QRG37I.mjs.map → chunk-HUKLBIUK.mjs.map} +0 -0
  90. /package/dist/{chunk-E2FYNVYX.mjs.map → chunk-MNZXQ6UH.mjs.map} +0 -0
  91. /package/dist/{chunk-X5HCQBME.mjs.map → chunk-NSUYO6TP.mjs.map} +0 -0
  92. /package/dist/{chunk-MZ2JGV3C.mjs.map → chunk-S5LWO5V3.mjs.map} +0 -0
  93. /package/dist/{chunk-6DKGH7LT.mjs.map → chunk-SR4RW4CU.mjs.map} +0 -0
  94. /package/dist/{chunk-LQGRLQSL.mjs.map → chunk-Z5FB4WBL.mjs.map} +0 -0
@@ -1,5 +1,5 @@
1
1
 
2
- > @copilotkit/react-core@0.37.0-mme-fix-textarea-css.1 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/react-core
2
+ > @copilotkit/react-core@0.37.0 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/react-core
3
3
  > tsup --clean
4
4
 
5
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-chat.ts, src/hooks/use-copilot-action.ts, src/hooks/use-copilot-chat.ts, src/hooks/use-copilot-readable.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/lib/copilot-task.ts, src/lib/index.ts, src/openai-assistants/index.ts, src/types/chat-suggestion-configuration.ts, src/types/document-pointer.ts, src/types/frontend-action.ts, src/types/index.ts, src/types/system-message.ts, src/utils/extract.ts, src/utils/fetch-chat-completion.ts, src/utils/index.ts, src/utils/utils.test.ts, src/utils/utils.ts, src/components/copilot-provider/copilotkit-props.tsx, src/components/copilot-provider/copilotkit.tsx, src/components/copilot-provider/index.ts, 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
@@ -10,6 +10,77 @@
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
+ CJS dist/lib/copilot-task.js 7.78 KB
14
+ CJS dist/openai-assistants/index.js 9.69 KB
15
+ CJS dist/types/chat-suggestion-configuration.js 893.00 B
16
+ CJS dist/utils/extract.js 8.75 KB
17
+ CJS dist/components/copilot-provider/copilotkit-props.js 864.00 B
18
+ CJS dist/openai-assistants/hooks/index.js 9.59 KB
19
+ CJS dist/openai-assistants/utils/index.js 2.30 KB
20
+ CJS dist/index.js 47.02 KB
21
+ CJS dist/components/index.js 17.23 KB
22
+ CJS dist/context/copilot-context.js 3.99 KB
23
+ CJS dist/context/index.js 3.98 KB
24
+ CJS dist/hooks/index.js 22.14 KB
25
+ CJS dist/hooks/use-chat.js 11.90 KB
26
+ CJS dist/hooks/use-copilot-action.js 5.28 KB
27
+ CJS dist/hooks/use-copilot-chat.js 17.53 KB
28
+ CJS dist/hooks/use-copilot-readable.js 4.70 KB
29
+ CJS dist/hooks/use-flat-category-store.js 2.87 KB
30
+ CJS dist/hooks/use-make-copilot-actionable.js 4.96 KB
31
+ CJS dist/hooks/use-make-copilot-document-readable.js 4.58 KB
32
+ CJS dist/hooks/use-make-copilot-readable.js 4.46 KB
33
+ CJS dist/hooks/use-tree.js 5.53 KB
34
+ CJS dist/lib/index.js 7.74 KB
35
+ CJS dist/types/document-pointer.js 841.00 B
36
+ CJS dist/types/frontend-action.js 837.00 B
37
+ CJS dist/types/index.js 797.00 B
38
+ CJS dist/types/system-message.js 833.00 B
39
+ CJS dist/utils/fetch-chat-completion.js 5.13 KB
40
+ CJS dist/utils/index.js 9.53 KB
41
+ CJS dist/utils/utils.test.js 184.00 B
42
+ CJS dist/utils/utils.js 797.00 B
43
+ CJS dist/components/copilot-provider/copilotkit.js 17.21 KB
44
+ CJS dist/components/copilot-provider/index.js 17.27 KB
45
+ CJS dist/openai-assistants/hooks/use-assistants.js 4.81 KB
46
+ CJS dist/openai-assistants/hooks/use-copilot-chat-v2.js 9.68 KB
47
+ CJS dist/openai-assistants/utils/process-message-stream.js 2.33 KB
48
+ CJS dist/lib/copilot-task.js.map 21.93 KB
49
+ CJS dist/openai-assistants/index.js.map 24.43 KB
50
+ CJS dist/types/chat-suggestion-configuration.js.map 673.00 B
51
+ CJS dist/utils/extract.js.map 19.79 KB
52
+ CJS dist/components/copilot-provider/copilotkit-props.js.map 1.80 KB
53
+ CJS dist/openai-assistants/hooks/index.js.map 24.73 KB
54
+ CJS dist/openai-assistants/utils/index.js.map 1.44 KB
55
+ CJS dist/index.js.map 96.64 KB
56
+ CJS dist/components/index.js.map 31.34 KB
57
+ CJS dist/context/copilot-context.js.map 6.81 KB
58
+ CJS dist/context/index.js.map 7.04 KB
59
+ CJS dist/hooks/index.js.map 56.58 KB
60
+ CJS dist/hooks/use-chat.js.map 19.47 KB
61
+ CJS dist/hooks/use-copilot-action.js.map 10.96 KB
62
+ CJS dist/hooks/use-copilot-chat.js.map 42.38 KB
63
+ CJS dist/hooks/use-copilot-readable.js.map 11.84 KB
64
+ CJS dist/hooks/use-flat-category-store.js.map 4.25 KB
65
+ CJS dist/hooks/use-make-copilot-actionable.js.map 8.56 KB
66
+ CJS dist/hooks/use-make-copilot-document-readable.js.map 8.09 KB
67
+ CJS dist/hooks/use-make-copilot-readable.js.map 7.78 KB
68
+ CJS dist/hooks/use-tree.js.map 8.32 KB
69
+ CJS dist/lib/index.js.map 22.00 KB
70
+ CJS dist/types/document-pointer.js.map 292.00 B
71
+ CJS dist/types/frontend-action.js.map 1.77 KB
72
+ CJS dist/types/index.js.map 432.00 B
73
+ CJS dist/types/system-message.js.map 249.00 B
74
+ CJS dist/utils/fetch-chat-completion.js.map 5.11 KB
75
+ CJS dist/utils/index.js.map 20.31 KB
76
+ CJS dist/utils/utils.test.js.map 354.00 B
77
+ CJS dist/utils/utils.js.map 137.00 B
78
+ CJS dist/components/copilot-provider/copilotkit.js.map 31.28 KB
79
+ CJS dist/components/copilot-provider/index.js.map 31.47 KB
80
+ CJS dist/openai-assistants/hooks/use-assistants.js.map 5.90 KB
81
+ CJS dist/openai-assistants/hooks/use-copilot-chat-v2.js.map 24.34 KB
82
+ CJS dist/openai-assistants/utils/process-message-stream.js.map 1.33 KB
83
+ CJS ⚡️ Build success in 213ms
13
84
  ESM dist/index.mjs 1.76 KB
14
85
  ESM dist/components/index.mjs 375.00 B
15
86
  ESM dist/context/copilot-context.mjs 205.00 B
@@ -17,48 +88,47 @@
17
88
  ESM dist/chunk-CYDWEPFL.mjs 43.00 B
18
89
  ESM dist/chunk-7GFKOIO7.mjs 43.00 B
19
90
  ESM dist/chunk-BABVSMJR.mjs 43.00 B
20
- ESM dist/chunk-R5OF6NLN.mjs 4.39 KB
91
+ ESM dist/chunk-2EQGN5QK.mjs 4.39 KB
21
92
  ESM dist/chunk-FRAKUJWH.mjs 43.00 B
22
93
  ESM dist/chunk-ZFS5SQUT.mjs 802.00 B
23
94
  ESM dist/chunk-EFZPSZWO.mjs 43.00 B
24
- ESM dist/chunk-K3T5WSHP.mjs 3.79 KB
95
+ ESM dist/chunk-4OIVQMEM.mjs 3.79 KB
25
96
  ESM dist/chunk-LUGEI4YQ.mjs 43.00 B
26
- ESM dist/chunk-LQGRLQSL.mjs 3.40 KB
97
+ ESM dist/chunk-Z5FB4WBL.mjs 3.40 KB
27
98
  ESM dist/context/index.mjs 227.00 B
28
99
  ESM dist/chunk-VNRDQJXW.mjs 43.00 B
29
100
  ESM dist/chunk-EYKDJBDE.mjs 43.00 B
30
- ESM dist/chunk-E2FYNVYX.mjs 909.00 B
31
- ESM dist/chunk-6DKGH7LT.mjs 1.06 KB
32
- ESM dist/chunk-MZ2JGV3C.mjs 700.00 B
33
- ESM dist/chunk-WSE45BNB.mjs 640.00 B
101
+ ESM dist/chunk-MNZXQ6UH.mjs 909.00 B
102
+ ESM dist/chunk-SR4RW4CU.mjs 1.06 KB
103
+ ESM dist/chunk-S5LWO5V3.mjs 700.00 B
104
+ ESM dist/chunk-B244LK6F.mjs 640.00 B
34
105
  ESM dist/hooks/use-chat.mjs 174.00 B
35
106
  ESM dist/hooks/use-copilot-action.mjs 202.00 B
36
- ESM dist/chunk-X5HCQBME.mjs 1.46 KB
107
+ ESM dist/chunk-NSUYO6TP.mjs 1.46 KB
37
108
  ESM dist/hooks/use-copilot-chat.mjs 468.00 B
38
- ESM dist/chunk-G6QRG37I.mjs 3.48 KB
109
+ ESM dist/chunk-HUKLBIUK.mjs 3.48 KB
39
110
  ESM dist/chunk-JD7BAH7U.mjs 43.00 B
40
111
  ESM dist/chunk-SPCZTZCY.mjs 43.00 B
41
- ESM dist/chunk-CZK6EOID.mjs 6.36 KB
112
+ ESM dist/chunk-LLU5URI5.mjs 6.40 KB
42
113
  ESM dist/chunk-YULKJPY3.mjs 1.84 KB
43
114
  ESM dist/chunk-YWITCRBI.mjs 3.89 KB
44
- ESM dist/chunk-UG6IOUHF.mjs 6.78 KB
45
- ESM dist/chunk-7YTDTTX5.mjs 2.83 KB
46
- ESM dist/chunk-ANYRLQY3.mjs 1.80 KB
115
+ ESM dist/chunk-B2H3NC4E.mjs 6.78 KB
116
+ ESM dist/chunk-MJKBCG4U.mjs 2.87 KB
117
+ ESM dist/chunk-DY63PD22.mjs 1.80 KB
47
118
  ESM dist/chunk-SKC7AJIV.mjs 1.97 KB
48
119
  ESM dist/openai-assistants/hooks/use-copilot-chat-v2.mjs 540.00 B
49
120
  ESM dist/openai-assistants/utils/index.mjs 206.00 B
50
- ESM dist/utils/index.mjs 589.00 B
51
- ESM dist/components/copilot-provider/copilotkit-props.mjs 45.00 B
52
- ESM dist/types/chat-suggestion-configuration.mjs 58.00 B
53
- ESM dist/lib/copilot-task.mjs 378.00 B
54
121
  ESM dist/openai-assistants/utils/process-message-stream.mjs 188.00 B
122
+ ESM dist/utils/index.mjs 589.00 B
55
123
  ESM dist/utils/utils.test.mjs 170.00 B
56
124
  ESM dist/utils/utils.mjs 34.00 B
125
+ ESM dist/components/copilot-provider/copilotkit-props.mjs 45.00 B
57
126
  ESM dist/components/copilot-provider/copilotkit.mjs 331.00 B
58
127
  ESM dist/components/copilot-provider/index.mjs 361.00 B
59
128
  ESM dist/openai-assistants/hooks/index.mjs 513.00 B
60
129
  ESM dist/openai-assistants/hooks/use-assistants.mjs 2.57 KB
61
130
  ESM dist/openai-assistants/index.mjs 565.00 B
131
+ ESM dist/types/chat-suggestion-configuration.mjs 58.00 B
62
132
  ESM dist/types/document-pointer.mjs 45.00 B
63
133
  ESM dist/types/frontend-action.mjs 44.00 B
64
134
  ESM dist/types/index.mjs 66.00 B
@@ -71,6 +141,7 @@
71
141
  ESM dist/hooks/use-make-copilot-document-readable.mjs 246.00 B
72
142
  ESM dist/hooks/use-make-copilot-readable.mjs 221.00 B
73
143
  ESM dist/hooks/use-tree.mjs 171.00 B
144
+ ESM dist/lib/copilot-task.mjs 378.00 B
74
145
  ESM dist/lib/index.mjs 403.00 B
75
146
  ESM dist/index.mjs.map 71.00 B
76
147
  ESM dist/components/index.mjs.map 71.00 B
@@ -79,48 +150,47 @@
79
150
  ESM dist/chunk-CYDWEPFL.mjs.map 71.00 B
80
151
  ESM dist/chunk-7GFKOIO7.mjs.map 71.00 B
81
152
  ESM dist/chunk-BABVSMJR.mjs.map 71.00 B
82
- ESM dist/chunk-R5OF6NLN.mjs.map 7.90 KB
153
+ ESM dist/chunk-2EQGN5QK.mjs.map 7.90 KB
83
154
  ESM dist/chunk-FRAKUJWH.mjs.map 71.00 B
84
155
  ESM dist/chunk-ZFS5SQUT.mjs.map 1.26 KB
85
156
  ESM dist/chunk-EFZPSZWO.mjs.map 71.00 B
86
- ESM dist/chunk-K3T5WSHP.mjs.map 6.47 KB
157
+ ESM dist/chunk-4OIVQMEM.mjs.map 6.47 KB
87
158
  ESM dist/chunk-LUGEI4YQ.mjs.map 71.00 B
88
- ESM dist/chunk-LQGRLQSL.mjs.map 8.65 KB
159
+ ESM dist/chunk-Z5FB4WBL.mjs.map 8.65 KB
89
160
  ESM dist/context/index.mjs.map 71.00 B
90
161
  ESM dist/chunk-VNRDQJXW.mjs.map 71.00 B
91
162
  ESM dist/chunk-EYKDJBDE.mjs.map 71.00 B
92
- ESM dist/chunk-E2FYNVYX.mjs.map 5.15 KB
93
- ESM dist/chunk-6DKGH7LT.mjs.map 1.87 KB
94
- ESM dist/chunk-MZ2JGV3C.mjs.map 1.40 KB
95
- ESM dist/chunk-WSE45BNB.mjs.map 1.08 KB
163
+ ESM dist/chunk-MNZXQ6UH.mjs.map 5.15 KB
164
+ ESM dist/chunk-SR4RW4CU.mjs.map 1.87 KB
165
+ ESM dist/chunk-S5LWO5V3.mjs.map 1.40 KB
166
+ ESM dist/chunk-B244LK6F.mjs.map 1.08 KB
96
167
  ESM dist/hooks/use-chat.mjs.map 71.00 B
97
168
  ESM dist/hooks/use-copilot-action.mjs.map 71.00 B
98
- ESM dist/chunk-X5HCQBME.mjs.map 4.27 KB
169
+ ESM dist/chunk-NSUYO6TP.mjs.map 4.27 KB
99
170
  ESM dist/hooks/use-copilot-chat.mjs.map 71.00 B
100
- ESM dist/chunk-G6QRG37I.mjs.map 7.80 KB
171
+ ESM dist/chunk-HUKLBIUK.mjs.map 7.80 KB
101
172
  ESM dist/chunk-JD7BAH7U.mjs.map 71.00 B
102
173
  ESM dist/chunk-SPCZTZCY.mjs.map 71.00 B
103
- ESM dist/chunk-CZK6EOID.mjs.map 12.09 KB
174
+ ESM dist/chunk-LLU5URI5.mjs.map 12.15 KB
104
175
  ESM dist/chunk-YULKJPY3.mjs.map 4.21 KB
105
176
  ESM dist/chunk-YWITCRBI.mjs.map 8.27 KB
106
- ESM dist/chunk-UG6IOUHF.mjs.map 14.66 KB
107
- ESM dist/chunk-7YTDTTX5.mjs.map 5.00 KB
108
- ESM dist/chunk-ANYRLQY3.mjs.map 6.53 KB
177
+ ESM dist/chunk-B2H3NC4E.mjs.map 14.66 KB
178
+ ESM dist/chunk-MJKBCG4U.mjs.map 5.07 KB
179
+ ESM dist/chunk-DY63PD22.mjs.map 6.71 KB
109
180
  ESM dist/chunk-SKC7AJIV.mjs.map 71.00 B
110
181
  ESM dist/openai-assistants/hooks/use-copilot-chat-v2.mjs.map 71.00 B
111
182
  ESM dist/openai-assistants/utils/index.mjs.map 71.00 B
112
- ESM dist/utils/index.mjs.map 71.00 B
113
- ESM dist/components/copilot-provider/copilotkit-props.mjs.map 71.00 B
114
- ESM dist/types/chat-suggestion-configuration.mjs.map 71.00 B
115
- ESM dist/lib/copilot-task.mjs.map 71.00 B
116
183
  ESM dist/openai-assistants/utils/process-message-stream.mjs.map 71.00 B
184
+ ESM dist/utils/index.mjs.map 71.00 B
117
185
  ESM dist/utils/utils.test.mjs.map 352.00 B
118
186
  ESM dist/utils/utils.mjs.map 71.00 B
187
+ ESM dist/components/copilot-provider/copilotkit-props.mjs.map 71.00 B
119
188
  ESM dist/components/copilot-provider/copilotkit.mjs.map 71.00 B
120
189
  ESM dist/components/copilot-provider/index.mjs.map 71.00 B
121
190
  ESM dist/openai-assistants/hooks/index.mjs.map 71.00 B
122
191
  ESM dist/openai-assistants/hooks/use-assistants.mjs.map 4.65 KB
123
192
  ESM dist/openai-assistants/index.mjs.map 71.00 B
193
+ ESM dist/types/chat-suggestion-configuration.mjs.map 71.00 B
124
194
  ESM dist/types/document-pointer.mjs.map 71.00 B
125
195
  ESM dist/types/frontend-action.mjs.map 71.00 B
126
196
  ESM dist/types/index.mjs.map 71.00 B
@@ -133,85 +203,15 @@
133
203
  ESM dist/hooks/use-make-copilot-document-readable.mjs.map 71.00 B
134
204
  ESM dist/hooks/use-make-copilot-readable.mjs.map 71.00 B
135
205
  ESM dist/hooks/use-tree.mjs.map 71.00 B
206
+ ESM dist/lib/copilot-task.mjs.map 71.00 B
136
207
  ESM dist/lib/index.mjs.map 71.00 B
137
- ESM ⚡️ Build success in 189ms
138
- CJS dist/index.js 46.94 KB
139
- CJS dist/components/index.js 17.20 KB
140
- CJS dist/context/copilot-context.js 3.99 KB
141
- CJS dist/context/index.js 3.98 KB
142
- CJS dist/hooks/index.js 22.10 KB
143
- CJS dist/hooks/use-chat.js 11.85 KB
144
- CJS dist/hooks/use-copilot-action.js 5.28 KB
145
- CJS dist/hooks/use-copilot-chat.js 17.48 KB
146
- CJS dist/hooks/use-copilot-readable.js 4.70 KB
147
- CJS dist/hooks/use-flat-category-store.js 2.87 KB
148
- CJS dist/hooks/use-make-copilot-actionable.js 4.96 KB
149
- CJS dist/hooks/use-make-copilot-document-readable.js 4.58 KB
150
- CJS dist/hooks/use-make-copilot-readable.js 4.46 KB
151
- CJS dist/hooks/use-tree.js 5.53 KB
152
- CJS dist/lib/copilot-task.js 7.74 KB
153
- CJS dist/lib/index.js 7.70 KB
154
- CJS dist/openai-assistants/index.js 9.69 KB
155
- CJS dist/types/chat-suggestion-configuration.js 893.00 B
156
- CJS dist/types/document-pointer.js 841.00 B
157
- CJS dist/types/frontend-action.js 837.00 B
158
- CJS dist/types/index.js 797.00 B
159
- CJS dist/types/system-message.js 833.00 B
160
- CJS dist/utils/extract.js 8.71 KB
161
- CJS dist/utils/fetch-chat-completion.js 5.08 KB
162
- CJS dist/utils/index.js 9.48 KB
163
- CJS dist/utils/utils.test.js 184.00 B
164
- CJS dist/utils/utils.js 797.00 B
165
- CJS dist/components/copilot-provider/copilotkit-props.js 864.00 B
166
- CJS dist/components/copilot-provider/copilotkit.js 17.17 KB
167
- CJS dist/components/copilot-provider/index.js 17.23 KB
168
- CJS dist/openai-assistants/hooks/index.js 9.59 KB
169
- CJS dist/openai-assistants/hooks/use-assistants.js 4.81 KB
170
- CJS dist/openai-assistants/hooks/use-copilot-chat-v2.js 9.68 KB
171
- CJS dist/openai-assistants/utils/index.js 2.30 KB
172
- CJS dist/openai-assistants/utils/process-message-stream.js 2.33 KB
173
- CJS dist/index.js.map 96.33 KB
174
- CJS dist/components/index.js.map 31.10 KB
175
- CJS dist/context/copilot-context.js.map 6.62 KB
176
- CJS dist/hooks/index.js.map 56.29 KB
177
- CJS dist/context/index.js.map 6.85 KB
178
- CJS dist/hooks/use-chat.js.map 19.40 KB
179
- CJS dist/hooks/use-copilot-action.js.map 10.78 KB
180
- CJS dist/hooks/use-copilot-readable.js.map 11.66 KB
181
- CJS dist/hooks/use-flat-category-store.js.map 4.25 KB
182
- CJS dist/hooks/use-make-copilot-actionable.js.map 8.37 KB
183
- CJS dist/hooks/use-make-copilot-document-readable.js.map 7.91 KB
184
- CJS dist/hooks/use-copilot-chat.js.map 42.10 KB
185
- CJS dist/hooks/use-make-copilot-readable.js.map 7.59 KB
186
- CJS dist/hooks/use-tree.js.map 8.32 KB
187
- CJS dist/lib/copilot-task.js.map 21.83 KB
188
- CJS dist/lib/index.js.map 21.89 KB
189
- CJS dist/openai-assistants/index.js.map 24.21 KB
190
- CJS dist/types/document-pointer.js.map 292.00 B
191
- CJS dist/types/chat-suggestion-configuration.js.map 673.00 B
192
- CJS dist/types/frontend-action.js.map 1.77 KB
193
- CJS dist/types/index.js.map 432.00 B
194
- CJS dist/types/system-message.js.map 249.00 B
195
- CJS dist/utils/fetch-chat-completion.js.map 5.05 KB
196
- CJS dist/utils/extract.js.map 19.69 KB
197
- CJS dist/utils/index.js.map 20.21 KB
198
- CJS dist/utils/utils.test.js.map 354.00 B
199
- CJS dist/utils/utils.js.map 137.00 B
200
- CJS dist/components/copilot-provider/copilotkit-props.js.map 1.61 KB
201
- CJS dist/components/copilot-provider/copilotkit.js.map 31.04 KB
202
- CJS dist/components/copilot-provider/index.js.map 31.23 KB
203
- CJS dist/openai-assistants/hooks/index.js.map 24.51 KB
204
- CJS dist/openai-assistants/hooks/use-assistants.js.map 5.90 KB
205
- CJS dist/openai-assistants/utils/index.js.map 1.44 KB
206
- CJS dist/openai-assistants/utils/process-message-stream.js.map 1.33 KB
207
- CJS dist/openai-assistants/hooks/use-copilot-chat-v2.js.map 24.12 KB
208
- CJS ⚡️ Build success in 199ms
208
+ ESM ⚡️ Build success in 221ms
209
209
  DTS Build start
210
- DTS ⚡️ Build success in 8993ms
210
+ DTS ⚡️ Build success in 8429ms
211
211
  DTS dist/index.d.ts 1.76 KB
212
212
  DTS dist/components/copilot-provider/copilotkit.d.ts 271.00 B
213
- DTS dist/components/copilot-provider/copilotkit-props.d.ts 1.51 KB
214
- DTS dist/context/copilot-context.d.ts 3.59 KB
213
+ DTS dist/components/copilot-provider/copilotkit-props.d.ts 1.70 KB
214
+ DTS dist/context/copilot-context.d.ts 3.78 KB
215
215
  DTS dist/hooks/use-copilot-chat.d.ts 1.63 KB
216
216
  DTS dist/hooks/use-make-copilot-actionable.d.ts 309.00 B
217
217
  DTS dist/hooks/use-copilot-action.d.ts 286.00 B
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # ui
2
2
 
3
+ ## 0.37.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f771353: Fix: Stale CopilotReadable
8
+ - 9df8d43: Remove unneeded tailwind components
9
+ - CSS improvements, useCopilotChat, invisible messages
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [f771353]
14
+ - Updated dependencies [9df8d43]
15
+ - Updated dependencies
16
+ - @copilotkit/shared@0.37.0
17
+
3
18
  ## 0.37.0-mme-fix-textarea-css.1
4
19
 
5
20
  ### Minor Changes
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-ZFS5SQUT.mjs";
4
4
  import {
5
5
  defaultCopilotContextCategories
6
- } from "./chunk-CZK6EOID.mjs";
6
+ } from "./chunk-LLU5URI5.mjs";
7
7
  import {
8
8
  CopilotContext
9
- } from "./chunk-ANYRLQY3.mjs";
9
+ } from "./chunk-DY63PD22.mjs";
10
10
  import {
11
11
  __async,
12
12
  __spreadValues
@@ -134,4 +134,4 @@ export {
134
134
  useCopilotChatV2,
135
135
  defaultSystemMessage
136
136
  };
137
- //# sourceMappingURL=chunk-R5OF6NLN.mjs.map
137
+ //# sourceMappingURL=chunk-2EQGN5QK.mjs.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  defaultCopilotContextCategories
3
- } from "./chunk-CZK6EOID.mjs";
3
+ } from "./chunk-LLU5URI5.mjs";
4
4
  import {
5
5
  fetchAndDecodeChatCompletion
6
- } from "./chunk-7YTDTTX5.mjs";
6
+ } from "./chunk-MJKBCG4U.mjs";
7
7
  import {
8
8
  __async,
9
9
  __spreadValues
@@ -119,4 +119,4 @@ Any additional messages provided are for providing context only and should not b
119
119
  export {
120
120
  extract
121
121
  };
122
- //# sourceMappingURL=chunk-K3T5WSHP.mjs.map
122
+ //# sourceMappingURL=chunk-4OIVQMEM.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotContext
3
- } from "./chunk-ANYRLQY3.mjs";
3
+ } from "./chunk-DY63PD22.mjs";
4
4
 
5
5
  // src/hooks/use-make-copilot-readable.ts
6
6
  import { useContext, useEffect, useRef } from "react";
@@ -20,4 +20,4 @@ function useMakeCopilotReadable(information, parentId, categories) {
20
20
  export {
21
21
  useMakeCopilotReadable
22
22
  };
23
- //# sourceMappingURL=chunk-WSE45BNB.mjs.map
23
+ //# sourceMappingURL=chunk-B244LK6F.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  fetchAndDecodeChatCompletion
3
- } from "./chunk-7YTDTTX5.mjs";
3
+ } from "./chunk-MJKBCG4U.mjs";
4
4
  import {
5
5
  __async,
6
6
  __spreadProps,
@@ -201,4 +201,4 @@ function useChat(options) {
201
201
  export {
202
202
  useChat
203
203
  };
204
- //# sourceMappingURL=chunk-UG6IOUHF.mjs.map
204
+ //# sourceMappingURL=chunk-B2H3NC4E.mjs.map
@@ -61,4 +61,4 @@ export {
61
61
  CopilotContext,
62
62
  useCopilotContext
63
63
  };
64
- //# sourceMappingURL=chunk-ANYRLQY3.mjs.map
64
+ //# sourceMappingURL=chunk-DY63PD22.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/context/copilot-context.tsx"],"sourcesContent":["import {\n CopilotCloudConfig,\n FunctionCallHandler,\n Message,\n ToolDefinition,\n} from \"@copilotkit/shared\";\nimport { ActionRenderProps, FrontendAction } from \"../types/frontend-action\";\nimport React from \"react\";\nimport { TreeNodeId } from \"../hooks/use-tree\";\nimport { DocumentPointer } from \"../types\";\nimport { CopilotChatSuggestionConfiguration } from \"../types/chat-suggestion-configuration\";\n\n/**\n * Interface for the configuration of the Copilot API.\n */\nexport interface CopilotApiConfig {\n /**\n * The public API key for Copilot Cloud.\n */\n publicApiKey?: string;\n\n /**\n * The configuration for Copilot Cloud.\n */\n cloud?: CopilotCloudConfig;\n\n /**\n * The endpoint for the chat API.\n */\n chatApiEndpoint: string;\n\n /**\n * The endpoint for the Copilot transcribe audio service.\n */\n transcribeAudioUrl?: string;\n\n /**\n * The endpoint for the Copilot text to speech service.\n */\n textToSpeechUrl?: 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 /**\n * Backend only props that will be combined to body params to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'user_id': 'user_id'\n * }\n * ```\n */\n backendOnlyProps?: Record<string, any>;\n\n /**\n * Indicates whether the user agent should send or receive cookies from the other domain\n * in the case of cross-origin requests.\n */\n credentials?: RequestCredentials;\n}\n\nexport type InChatRenderFunction = (props: ActionRenderProps<any>) => string | JSX.Element;\n\nexport interface CopilotContextParams {\n // function-calling\n entryPoints: Record<string, FrontendAction<any>>;\n setEntryPoint: (id: string, entryPoint: FrontendAction<any>) => void;\n removeEntryPoint: (id: string) => void;\n chatComponentsCache: React.RefObject<Record<string, InChatRenderFunction | string>>;\n getChatCompletionFunctionDescriptions: (\n customEntryPoints?: Record<string, FrontendAction<any>>,\n ) => ToolDefinition[];\n getFunctionCallHandler: (\n customEntryPoints?: Record<string, FrontendAction<any>>,\n ) => 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 // chat\n messages: Message[];\n setMessages: React.Dispatch<React.SetStateAction<Message[]>>;\n\n isLoading: boolean;\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>;\n\n chatSuggestionConfiguration: { [key: string]: CopilotChatSuggestionConfiguration };\n addChatSuggestionConfiguration: (\n id: string,\n suggestion: CopilotChatSuggestionConfiguration,\n ) => void;\n removeChatSuggestionConfiguration: (id: string) => void;\n\n chatInstructions: string;\n setChatInstructions: React.Dispatch<React.SetStateAction<string>>;\n\n // api endpoints\n copilotApiConfig: CopilotApiConfig;\n}\n\nconst emptyCopilotContext: CopilotContextParams = {\n entryPoints: {},\n setEntryPoint: () => {},\n removeEntryPoint: () => {},\n\n chatComponentsCache: { current: {} },\n getContextString: (documents: DocumentPointer[], categories: string[]) =>\n returnAndThrowInDebug(\"\"),\n addContext: () => \"\",\n removeContext: () => {},\n\n getChatCompletionFunctionDescriptions: () => returnAndThrowInDebug([]),\n getFunctionCallHandler: () => returnAndThrowInDebug(async () => {}),\n\n messages: [],\n setMessages: () => returnAndThrowInDebug([]),\n\n isLoading: false,\n setIsLoading: () => returnAndThrowInDebug(false),\n\n chatInstructions: \"\",\n setChatInstructions: () => returnAndThrowInDebug(\"\"),\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(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n }\n get chatApiEndpointV2(): string {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n }\n get headers(): Record<string, string> {\n return {};\n }\n get body(): Record<string, any> {\n return {};\n }\n })(),\n\n chatSuggestionConfiguration: {},\n addChatSuggestionConfiguration: () => {},\n removeChatSuggestionConfiguration: () => {},\n};\n\nexport const CopilotContext = React.createContext<CopilotContextParams>(emptyCopilotContext);\n\nexport function useCopilotContext(): CopilotContextParams {\n return React.useContext(CopilotContext);\n}\n\nfunction returnAndThrowInDebug<T>(value: T): T {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n return value;\n}\n"],"mappings":";;;;;AAOA,OAAO,WAAW;AAgIlB,IAAM,sBAA4C;AAAA,EAChD,aAAa,CAAC;AAAA,EACd,eAAe,MAAM;AAAA,EAAC;AAAA,EACtB,kBAAkB,MAAM;AAAA,EAAC;AAAA,EAEzB,qBAAqB,EAAE,SAAS,CAAC,EAAE;AAAA,EACnC,kBAAkB,CAAC,WAA8B,eAC/C,sBAAsB,EAAE;AAAA,EAC1B,YAAY,MAAM;AAAA,EAClB,eAAe,MAAM;AAAA,EAAC;AAAA,EAEtB,uCAAuC,MAAM,sBAAsB,CAAC,CAAC;AAAA,EACrE,wBAAwB,MAAM,sBAAsB,MAAY;AAAA,EAAC,EAAC;AAAA,EAElE,UAAU,CAAC;AAAA,EACX,aAAa,MAAM,sBAAsB,CAAC,CAAC;AAAA,EAE3C,WAAW;AAAA,EACX,cAAc,MAAM,sBAAsB,KAAK;AAAA,EAE/C,kBAAkB;AAAA,EAClB,qBAAqB,MAAM,sBAAsB,EAAE;AAAA,EAEnD,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,MAAM,uEAAuE;AAAA,IACzF;AAAA,IACA,IAAI,oBAA4B;AAC9B,YAAM,IAAI,MAAM,uEAAuE;AAAA,IACzF;AAAA,IACA,IAAI,UAAkC;AACpC,aAAO,CAAC;AAAA,IACV;AAAA,IACA,IAAI,OAA4B;AAC9B,aAAO,CAAC;AAAA,IACV;AAAA,EACF,EAAG;AAAA,EAEH,6BAA6B,CAAC;AAAA,EAC9B,gCAAgC,MAAM;AAAA,EAAC;AAAA,EACvC,mCAAmC,MAAM;AAAA,EAAC;AAC5C;AAEO,IAAM,iBAAiB,MAAM,cAAoC,mBAAmB;AAEpF,SAAS,oBAA0C;AACxD,SAAO,MAAM,WAAW,cAAc;AACxC;AAEA,SAAS,sBAAyB,OAAa;AAC7C,QAAM,IAAI,MAAM,uEAAuE;AACvF,SAAO;AACT;","names":[]}
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  defaultCopilotContextCategories
3
- } from "./chunk-CZK6EOID.mjs";
3
+ } from "./chunk-LLU5URI5.mjs";
4
4
  import {
5
5
  useChat
6
- } from "./chunk-UG6IOUHF.mjs";
6
+ } from "./chunk-B2H3NC4E.mjs";
7
7
  import {
8
8
  CopilotContext
9
- } from "./chunk-ANYRLQY3.mjs";
9
+ } from "./chunk-DY63PD22.mjs";
10
10
  import {
11
11
  __objRest,
12
12
  __spreadProps,
@@ -113,4 +113,4 @@ export {
113
113
  useCopilotChat,
114
114
  defaultSystemMessage
115
115
  };
116
- //# sourceMappingURL=chunk-G6QRG37I.mjs.map
116
+ //# sourceMappingURL=chunk-HUKLBIUK.mjs.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-YWITCRBI.mjs";
7
7
  import {
8
8
  CopilotContext
9
- } from "./chunk-ANYRLQY3.mjs";
9
+ } from "./chunk-DY63PD22.mjs";
10
10
  import {
11
11
  __async,
12
12
  __objRest,
@@ -138,7 +138,8 @@ ${nonDocumentStrings}`;
138
138
  headers: props.headers || {},
139
139
  body: __spreadValues(__spreadValues({}, props.body), props.backendOnlyProps),
140
140
  transcribeAudioUrl: props.transcribeAudioUrl,
141
- textToSpeechUrl: props.textToSpeechUrl
141
+ textToSpeechUrl: props.textToSpeechUrl,
142
+ credentials: props.credentials
142
143
  });
143
144
  const [chatSuggestionConfiguration, setChatSuggestionConfiguration] = useState({});
144
145
  const addChatSuggestionConfiguration = (id, suggestion) => {
@@ -206,4 +207,4 @@ export {
206
207
  CopilotKit,
207
208
  defaultCopilotContextCategories
208
209
  };
209
- //# sourceMappingURL=chunk-CZK6EOID.mjs.map
210
+ //# sourceMappingURL=chunk-LLU5URI5.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/copilot-provider/copilotkit.tsx"],"sourcesContent":["/**\n * Provides the Copilot context to its children.\n * \n * <img\n * referrerPolicy=\"no-referrer-when-downgrade\"\n * src=\"https://static.scarf.sh/a.png?x-pxid=a9b290bb-38f9-4518-ac3b-8f54fdbf43be\"\n * />\n * \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>\n * The backend can use OpenAI, or you can bring your own LLM. For examples of the\n * backend api implementation, see `examples/next-openai` or the [runtime\n * docs](https://docs.copilotkit.ai/getting-started/quickstart-runtime).\n * </Note>\n * \n * <RequestExample>\n * ```jsx CopilotKit Example\n * import { CopilotKit } from \"@copilotkit/react-core\";\n * \n * <CopilotKit \n * runtimeUrl=\"https://your.copilotkit.api\">\n * <YourApp/>\n * </CopilotKit>\n * ```\n * </RequestExample>\n * \n * ## Example usage\n * \n * ```jsx\n * <CopilotKit publicApiKey=\"the api key or self host (see below)\">\n * <App />\n * </CopilotKit>\n```\n */\nimport { Ref, useCallback, useRef, useState } from \"react\";\nimport {\n CopilotContext,\n CopilotApiConfig,\n InChatRenderFunction,\n} from \"../../context/copilot-context\";\nimport useTree from \"../../hooks/use-tree\";\nimport { CopilotChatSuggestionConfiguration, DocumentPointer } from \"../../types\";\n\nimport {\n COPILOT_CLOUD_CHAT_URL,\n CopilotCloudConfig,\n FunctionCallHandler,\n Message,\n actionToChatCompletionFunction,\n} from \"@copilotkit/shared\";\n\nimport { FrontendAction } from \"../../types/frontend-action\";\nimport useFlatCategoryStore from \"../../hooks/use-flat-category-store\";\nimport { CopilotKitProps } from \"./copilotkit-props\";\nimport { ToolDefinition } from \"@copilotkit/shared\";\n\nexport function CopilotKit({ children, ...props }: CopilotKitProps) {\n // Compute all the functions and properties that we need to pass\n // to the CopilotContext.\n\n if (!props.runtimeUrl && !props.url && !props.publicApiKey) {\n throw new Error(\"Please provide either a url or a publicApiKey to the CopilotKit component.\");\n }\n\n const chatApiEndpoint = props.runtimeUrl || props.url || COPILOT_CLOUD_CHAT_URL;\n\n const [entryPoints, setEntryPoints] = useState<Record<string, FrontendAction<any>>>({});\n const chatComponentsCache = useRef<Record<string, InChatRenderFunction | string>>({});\n const { addElement, removeElement, printTree } = useTree();\n const [messages, setMessages] = useState<Message[]>([]);\n const [isLoading, setIsLoading] = useState(false);\n const [chatInstructions, setChatInstructions] = useState(\"\");\n\n const {\n addElement: addDocument,\n removeElement: removeDocument,\n allElements: allDocuments,\n } = useFlatCategoryStore<DocumentPointer>();\n\n const setEntryPoint = useCallback((id: string, entryPoint: FrontendAction<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 (customEntryPoints?: Record<string, FrontendAction<any>>) => {\n return entryPointsToChatCompletionFunctions(Object.values(customEntryPoints || entryPoints));\n },\n [entryPoints],\n );\n\n const getFunctionCallHandler = useCallback(\n (customEntryPoints?: Record<string, FrontendAction<any>>) => {\n return entryPointsToFunctionCallHandler(Object.values(customEntryPoints || entryPoints));\n },\n [entryPoints],\n );\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 if (!props.publicApiKey) {\n if (props.cloudRestrictToTopic) {\n throw new Error(\n \"To use the cloudRestrictToTopic feature, please sign up at https://copilotkit.ai and provide a publicApiKey.\",\n );\n }\n }\n\n let cloud: CopilotCloudConfig | undefined = undefined;\n if (props.publicApiKey) {\n cloud = {\n guardrails: {\n input: {\n restrictToTopic: {\n enabled: props.cloudRestrictToTopic ? true : false,\n validTopics: props.cloudRestrictToTopic?.validTopics || [],\n invalidTopics: props.cloudRestrictToTopic?.invalidTopics || [],\n },\n },\n },\n };\n }\n\n // get the appropriate CopilotApiConfig from the props\n const copilotApiConfig: CopilotApiConfig = {\n publicApiKey: props.publicApiKey,\n ...(cloud ? { cloud } : {}),\n chatApiEndpoint: chatApiEndpoint,\n chatApiEndpointV2: `${props.url}/v2`,\n headers: props.headers || {},\n body: {\n ...props.body,\n ...props.backendOnlyProps,\n },\n transcribeAudioUrl: props.transcribeAudioUrl,\n textToSpeechUrl: props.textToSpeechUrl,\n };\n\n const [chatSuggestionConfiguration, setChatSuggestionConfiguration] = useState<{\n [key: string]: CopilotChatSuggestionConfiguration;\n }>({});\n\n const addChatSuggestionConfiguration = (\n id: string,\n suggestion: CopilotChatSuggestionConfiguration,\n ) => {\n setChatSuggestionConfiguration((prev) => ({ ...prev, [id]: suggestion }));\n };\n\n const removeChatSuggestionConfiguration = (id: string) => {\n setChatSuggestionConfiguration((prev) => {\n const { [id]: _, ...rest } = prev;\n return rest;\n });\n };\n\n return (\n <CopilotContext.Provider\n value={{\n entryPoints,\n chatComponentsCache,\n getChatCompletionFunctionDescriptions,\n getFunctionCallHandler,\n setEntryPoint,\n removeEntryPoint,\n getContextString,\n addContext,\n removeContext,\n getDocumentsContext,\n addDocumentContext,\n removeDocumentContext,\n copilotApiConfig: copilotApiConfig,\n messages,\n setMessages,\n isLoading,\n setIsLoading,\n chatSuggestionConfiguration,\n addChatSuggestionConfiguration,\n removeChatSuggestionConfiguration,\n chatInstructions,\n setChatInstructions,\n }}\n >\n {children}\n </CopilotContext.Provider>\n );\n}\n\nexport const defaultCopilotContextCategories = [\"global\"];\n\nfunction entryPointsToChatCompletionFunctions(actions: FrontendAction<any>[]): ToolDefinition[] {\n return actions.map(actionToChatCompletionFunction);\n}\n\nfunction entryPointsToFunctionCallHandler(actions: FrontendAction<any>[]): FunctionCallHandler {\n return async (chatMessages, functionCall) => {\n let actionsByFunctionName: Record<string, FrontendAction<any>> = {};\n for (let action of actions) {\n actionsByFunctionName[action.name] = action;\n }\n\n const action = actionsByFunctionName[functionCall.name || \"\"];\n if (action) {\n let functionCallArguments: Record<string, any>[] = [];\n if (functionCall.arguments) {\n functionCallArguments = JSON.parse(functionCall.arguments);\n }\n return await action.handler(functionCallArguments);\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoCA,SAAc,aAAa,QAAQ,gBAAgB;AASnD;AAAA,EACE;AAAA,EAIA;AAAA,OACK;AA4KH;AArKG,SAAS,WAAW,IAAyC;AAAzC,eAAE,WA1D7B,IA0D2B,IAAe,kBAAf,IAAe,CAAb;AA1D7B,MAAAA,KAAAC;AA8DE,MAAI,CAAC,MAAM,cAAc,CAAC,MAAM,OAAO,CAAC,MAAM,cAAc;AAC1D,UAAM,IAAI,MAAM,4EAA4E;AAAA,EAC9F;AAEA,QAAM,kBAAkB,MAAM,cAAc,MA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,IAAIA;AAAA,IACvC;AAEA,UAAM,SAAS,sBAAsB,aAAa,QAAQ,EAAE;AAC5D,QAAI,QAAQ;AACV,UAAI,wBAA+C,CAAC;AACpD,UAAI,aAAa,WAAW;AAC1B,gCAAwB,KAAK,MAAM,aAAa,SAAS;AAAA,MAC3D;AACA,aAAO,MAAM,OAAO,QAAQ,qBAAqB;AAAA,IACnD;AAAA,EACF;AACF;","names":["_a","_b","action"]}
1
+ {"version":3,"sources":["../src/components/copilot-provider/copilotkit.tsx"],"sourcesContent":["/**\n * Provides the Copilot context to its children.\n * \n * <img\n * referrerPolicy=\"no-referrer-when-downgrade\"\n * src=\"https://static.scarf.sh/a.png?x-pxid=a9b290bb-38f9-4518-ac3b-8f54fdbf43be\"\n * />\n * \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>\n * The backend can use OpenAI, or you can bring your own LLM. For examples of the\n * backend api implementation, see `examples/next-openai` or the [runtime\n * docs](https://docs.copilotkit.ai/getting-started/quickstart-runtime).\n * </Note>\n * \n * <RequestExample>\n * ```jsx CopilotKit Example\n * import { CopilotKit } from \"@copilotkit/react-core\";\n * \n * <CopilotKit \n * runtimeUrl=\"https://your.copilotkit.api\">\n * <YourApp/>\n * </CopilotKit>\n * ```\n * </RequestExample>\n * \n * ## Example usage\n * \n * ```jsx\n * <CopilotKit publicApiKey=\"the api key or self host (see below)\">\n * <App />\n * </CopilotKit>\n```\n */\nimport { Ref, useCallback, useRef, useState } from \"react\";\nimport {\n CopilotContext,\n CopilotApiConfig,\n InChatRenderFunction,\n} from \"../../context/copilot-context\";\nimport useTree from \"../../hooks/use-tree\";\nimport { CopilotChatSuggestionConfiguration, DocumentPointer } from \"../../types\";\n\nimport {\n COPILOT_CLOUD_CHAT_URL,\n CopilotCloudConfig,\n FunctionCallHandler,\n Message,\n actionToChatCompletionFunction,\n} from \"@copilotkit/shared\";\n\nimport { FrontendAction } from \"../../types/frontend-action\";\nimport useFlatCategoryStore from \"../../hooks/use-flat-category-store\";\nimport { CopilotKitProps } from \"./copilotkit-props\";\nimport { ToolDefinition } from \"@copilotkit/shared\";\n\nexport function CopilotKit({ children, ...props }: CopilotKitProps) {\n // Compute all the functions and properties that we need to pass\n // to the CopilotContext.\n\n if (!props.runtimeUrl && !props.url && !props.publicApiKey) {\n throw new Error(\"Please provide either a url or a publicApiKey to the CopilotKit component.\");\n }\n\n const chatApiEndpoint = props.runtimeUrl || props.url || COPILOT_CLOUD_CHAT_URL;\n\n const [entryPoints, setEntryPoints] = useState<Record<string, FrontendAction<any>>>({});\n const chatComponentsCache = useRef<Record<string, InChatRenderFunction | string>>({});\n const { addElement, removeElement, printTree } = useTree();\n const [messages, setMessages] = useState<Message[]>([]);\n const [isLoading, setIsLoading] = useState(false);\n const [chatInstructions, setChatInstructions] = useState(\"\");\n\n const {\n addElement: addDocument,\n removeElement: removeDocument,\n allElements: allDocuments,\n } = useFlatCategoryStore<DocumentPointer>();\n\n const setEntryPoint = useCallback((id: string, entryPoint: FrontendAction<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 (customEntryPoints?: Record<string, FrontendAction<any>>) => {\n return entryPointsToChatCompletionFunctions(Object.values(customEntryPoints || entryPoints));\n },\n [entryPoints],\n );\n\n const getFunctionCallHandler = useCallback(\n (customEntryPoints?: Record<string, FrontendAction<any>>) => {\n return entryPointsToFunctionCallHandler(Object.values(customEntryPoints || entryPoints));\n },\n [entryPoints],\n );\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 if (!props.publicApiKey) {\n if (props.cloudRestrictToTopic) {\n throw new Error(\n \"To use the cloudRestrictToTopic feature, please sign up at https://copilotkit.ai and provide a publicApiKey.\",\n );\n }\n }\n\n let cloud: CopilotCloudConfig | undefined = undefined;\n if (props.publicApiKey) {\n cloud = {\n guardrails: {\n input: {\n restrictToTopic: {\n enabled: props.cloudRestrictToTopic ? true : false,\n validTopics: props.cloudRestrictToTopic?.validTopics || [],\n invalidTopics: props.cloudRestrictToTopic?.invalidTopics || [],\n },\n },\n },\n };\n }\n\n // get the appropriate CopilotApiConfig from the props\n const copilotApiConfig: CopilotApiConfig = {\n publicApiKey: props.publicApiKey,\n ...(cloud ? { cloud } : {}),\n chatApiEndpoint: chatApiEndpoint,\n chatApiEndpointV2: `${props.url}/v2`,\n headers: props.headers || {},\n body: {\n ...props.body,\n ...props.backendOnlyProps,\n },\n transcribeAudioUrl: props.transcribeAudioUrl,\n textToSpeechUrl: props.textToSpeechUrl,\n credentials: props.credentials,\n };\n\n const [chatSuggestionConfiguration, setChatSuggestionConfiguration] = useState<{\n [key: string]: CopilotChatSuggestionConfiguration;\n }>({});\n\n const addChatSuggestionConfiguration = (\n id: string,\n suggestion: CopilotChatSuggestionConfiguration,\n ) => {\n setChatSuggestionConfiguration((prev) => ({ ...prev, [id]: suggestion }));\n };\n\n const removeChatSuggestionConfiguration = (id: string) => {\n setChatSuggestionConfiguration((prev) => {\n const { [id]: _, ...rest } = prev;\n return rest;\n });\n };\n\n return (\n <CopilotContext.Provider\n value={{\n entryPoints,\n chatComponentsCache,\n getChatCompletionFunctionDescriptions,\n getFunctionCallHandler,\n setEntryPoint,\n removeEntryPoint,\n getContextString,\n addContext,\n removeContext,\n getDocumentsContext,\n addDocumentContext,\n removeDocumentContext,\n copilotApiConfig: copilotApiConfig,\n messages,\n setMessages,\n isLoading,\n setIsLoading,\n chatSuggestionConfiguration,\n addChatSuggestionConfiguration,\n removeChatSuggestionConfiguration,\n chatInstructions,\n setChatInstructions,\n }}\n >\n {children}\n </CopilotContext.Provider>\n );\n}\n\nexport const defaultCopilotContextCategories = [\"global\"];\n\nfunction entryPointsToChatCompletionFunctions(actions: FrontendAction<any>[]): ToolDefinition[] {\n return actions.map(actionToChatCompletionFunction);\n}\n\nfunction entryPointsToFunctionCallHandler(actions: FrontendAction<any>[]): FunctionCallHandler {\n return async (chatMessages, functionCall) => {\n let actionsByFunctionName: Record<string, FrontendAction<any>> = {};\n for (let action of actions) {\n actionsByFunctionName[action.name] = action;\n }\n\n const action = actionsByFunctionName[functionCall.name || \"\"];\n if (action) {\n let functionCallArguments: Record<string, any>[] = [];\n if (functionCall.arguments) {\n functionCallArguments = JSON.parse(functionCall.arguments);\n }\n return await action.handler(functionCallArguments);\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoCA,SAAc,aAAa,QAAQ,gBAAgB;AASnD;AAAA,EACE;AAAA,EAIA;AAAA,OACK;AA6KH;AAtKG,SAAS,WAAW,IAAyC;AAAzC,eAAE,WA1D7B,IA0D2B,IAAe,kBAAf,IAAe,CAAb;AA1D7B,MAAAA,KAAAC;AA8DE,MAAI,CAAC,MAAM,cAAc,CAAC,MAAM,OAAO,CAAC,MAAM,cAAc;AAC1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AO,CAAO,cAAc,iBAAiB;AAC3C,QAAI,wBAA6D,CAAC;AAClE,aAASE,WAAU,SAAS;AAC1B,4BAAsBA,QAAO,IAAI,IAAIA;AAAA,IACvC;AAEA,UAAM,SAAS,sBAAsB,aAAa,QAAQ,EAAE;AAC5D,QAAI,QAAQ;AACV,UAAI,wBAA+C,CAAC;AACpD,UAAI,aAAa,WAAW;AAC1B,gCAAwB,KAAK,MAAM,aAAa,SAAS;AAAA,MAC3D;AACA,aAAO,MAAM,OAAO,QAAQ,qBAAqB;AAAA,IACnD;AAAA,EACF;AACF;","names":["_a","_b","action"]}
@@ -39,7 +39,8 @@ function fetchChatCompletion(_0) {
39
39
  messages: cleanedMessages,
40
40
  stream: true
41
41
  }, tools.length ? { tools } : {}), temperature ? { temperature } : {}), tools.length != 0 ? { tool_choice: toolChoice } : {}), copilotConfig.body), copilotConfig.backendOnlyProps), excludeBackendOnlyProps(copilotConfig)), body ? __spreadValues({}, body) : {}), copilotConfig.cloud ? { cloud: copilotConfig.cloud } : {})),
42
- signal
42
+ signal,
43
+ credentials: copilotConfig.credentials
43
44
  });
44
45
  return response;
45
46
  });
@@ -87,4 +88,4 @@ export {
87
88
  fetchAndDecodeChatCompletion,
88
89
  fetchAndDecodeChatCompletionAsText
89
90
  };
90
- //# sourceMappingURL=chunk-7YTDTTX5.mjs.map
91
+ //# sourceMappingURL=chunk-MJKBCG4U.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/fetch-chat-completion.ts"],"sourcesContent":["import {\n Message,\n ToolDefinition,\n ChatCompletionEvent,\n decodeChatCompletion,\n parseChatCompletion,\n decodeChatCompletionAsText,\n EXCLUDE_FROM_FORWARD_PROPS_KEYS,\n} from \"@copilotkit/shared\";\nimport { CopilotApiConfig } from \"../context\";\n\nexport interface FetchChatCompletionParams {\n copilotConfig: CopilotApiConfig;\n model?: string;\n messages: Message[];\n tools?: ToolDefinition[];\n temperature?: number;\n maxTokens?: number;\n headers?: Record<string, string> | Headers;\n body?: object;\n signal?: AbortSignal;\n toolChoice?: string | { type: \"function\"; function: { name: string } };\n}\n\nexport async function fetchChatCompletion({\n copilotConfig,\n model,\n messages,\n tools,\n temperature,\n headers,\n body,\n signal,\n toolChoice,\n}: FetchChatCompletionParams): Promise<Response> {\n temperature ||= 0.5;\n tools ||= [];\n\n // clean up any extra properties from messages\n const cleanedMessages = messages.map((message) => {\n const { content, role, name, function_call } = message;\n return { content, role, name, function_call };\n });\n\n toolChoice ||= \"auto\";\n\n const response = await fetch(copilotConfig.chatApiEndpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...copilotConfig.headers,\n ...(headers ? { ...headers } : {}),\n },\n body: JSON.stringify({\n model,\n messages: cleanedMessages,\n stream: true,\n ...(tools.length ? { tools } : {}),\n ...(temperature ? { temperature } : {}),\n ...(tools.length != 0 ? { tool_choice: toolChoice } : {}),\n ...copilotConfig.body,\n ...copilotConfig.backendOnlyProps,\n ...excludeBackendOnlyProps(copilotConfig),\n ...(body ? { ...body } : {}),\n ...(copilotConfig.cloud ? { cloud: copilotConfig.cloud } : {}),\n }),\n signal,\n credentials: copilotConfig.credentials,\n });\n\n return response;\n}\n\nfunction excludeBackendOnlyProps(copilotConfig: any) {\n const backendOnlyProps = copilotConfig.backendOnlyProps ?? {};\n if (Object.keys(backendOnlyProps).length > 0) {\n return {\n [EXCLUDE_FROM_FORWARD_PROPS_KEYS]: Object.keys(backendOnlyProps),\n };\n } else {\n return {};\n }\n}\n\nexport interface DecodedChatCompletionResponse extends Response {\n events: ReadableStream<ChatCompletionEvent> | null;\n}\n\nexport async function fetchAndDecodeChatCompletion(\n params: FetchChatCompletionParams,\n): Promise<DecodedChatCompletionResponse> {\n const response = await fetchChatCompletion(params);\n if (!response.ok || !response.body) {\n (response as any).events = null;\n } else {\n const events = await decodeChatCompletion(parseChatCompletion(response.body));\n (response as any).events = events;\n }\n return response as any;\n}\n\nexport interface DecodedChatCompletionResponseAsText extends Response {\n events: ReadableStream<string> | null;\n}\n\nexport async function fetchAndDecodeChatCompletionAsText(\n params: FetchChatCompletionParams,\n): Promise<DecodedChatCompletionResponseAsText> {\n const response = await fetchChatCompletion(params);\n if (!response.ok || !response.body) {\n (response as any).events = null;\n } else {\n const events = await decodeChatCompletionAsText(\n decodeChatCompletion(parseChatCompletion(response.body)),\n );\n (response as any).events = events;\n }\n\n return response as any;\n}\n"],"mappings":";;;;;;AAAA;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgBP,SAAsB,oBAAoB,IAUO;AAAA,6CAVP;AAAA,IACxC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAAiD;AAC/C,kCAAgB;AAChB,sBAAU,CAAC;AAGX,UAAM,kBAAkB,SAAS,IAAI,CAAC,YAAY;AAChD,YAAM,EAAE,SAAS,MAAM,MAAM,cAAc,IAAI;AAC/C,aAAO,EAAE,SAAS,MAAM,MAAM,cAAc;AAAA,IAC9C,CAAC;AAED,gCAAe;AAEf,UAAM,WAAW,MAAM,MAAM,cAAc,iBAAiB;AAAA,MAC1D,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB;AAAA,SACb,cAAc,UACb,UAAU,mBAAK,WAAY,CAAC;AAAA,MAElC,MAAM,KAAK,UAAU;AAAA,QACnB;AAAA,QACA,UAAU;AAAA,QACV,QAAQ;AAAA,SACJ,MAAM,SAAS,EAAE,MAAM,IAAI,CAAC,IAC5B,cAAc,EAAE,YAAY,IAAI,CAAC,IACjC,MAAM,UAAU,IAAI,EAAE,aAAa,WAAW,IAAI,CAAC,IACpD,cAAc,OACd,cAAc,mBACd,wBAAwB,aAAa,IACpC,OAAO,mBAAK,QAAS,CAAC,IACtB,cAAc,QAAQ,EAAE,OAAO,cAAc,MAAM,IAAI,CAAC,EAC7D;AAAA,MACD;AAAA,MACA,aAAa,cAAc;AAAA,IAC7B,CAAC;AAED,WAAO;AAAA,EACT;AAAA;AAEA,SAAS,wBAAwB,eAAoB;AAzErD;AA0EE,QAAM,oBAAmB,mBAAc,qBAAd,YAAkC,CAAC;AAC5D,MAAI,OAAO,KAAK,gBAAgB,EAAE,SAAS,GAAG;AAC5C,WAAO;AAAA,MACL,CAAC,+BAA+B,GAAG,OAAO,KAAK,gBAAgB;AAAA,IACjE;AAAA,EACF,OAAO;AACL,WAAO,CAAC;AAAA,EACV;AACF;AAMA,SAAsB,6BACpB,QACwC;AAAA;AACxC,UAAM,WAAW,MAAM,oBAAoB,MAAM;AACjD,QAAI,CAAC,SAAS,MAAM,CAAC,SAAS,MAAM;AAClC,MAAC,SAAiB,SAAS;AAAA,IAC7B,OAAO;AACL,YAAM,SAAS,MAAM,qBAAqB,oBAAoB,SAAS,IAAI,CAAC;AAC5E,MAAC,SAAiB,SAAS;AAAA,IAC7B;AACA,WAAO;AAAA,EACT;AAAA;AAMA,SAAsB,mCACpB,QAC8C;AAAA;AAC9C,UAAM,WAAW,MAAM,oBAAoB,MAAM;AACjD,QAAI,CAAC,SAAS,MAAM,CAAC,SAAS,MAAM;AAClC,MAAC,SAAiB,SAAS;AAAA,IAC7B,OAAO;AACL,YAAM,SAAS,MAAM;AAAA,QACnB,qBAAqB,oBAAoB,SAAS,IAAI,CAAC;AAAA,MACzD;AACA,MAAC,SAAiB,SAAS;AAAA,IAC7B;AAEA,WAAO;AAAA,EACT;AAAA;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotContext
3
- } from "./chunk-ANYRLQY3.mjs";
3
+ } from "./chunk-DY63PD22.mjs";
4
4
 
5
5
  // src/hooks/use-copilot-readable.ts
6
6
  import { useContext, useEffect, useRef } from "react";
@@ -25,4 +25,4 @@ function useCopilotReadable({ description, value, parentId, categories, convert
25
25
  export {
26
26
  useCopilotReadable
27
27
  };
28
- //# sourceMappingURL=chunk-E2FYNVYX.mjs.map
28
+ //# sourceMappingURL=chunk-MNZXQ6UH.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotContext
3
- } from "./chunk-ANYRLQY3.mjs";
3
+ } from "./chunk-DY63PD22.mjs";
4
4
 
5
5
  // src/hooks/use-copilot-action.ts
6
6
  import { useRef, useContext, useEffect } from "react";
@@ -44,4 +44,4 @@ function useCopilotAction(action, dependencies) {
44
44
  export {
45
45
  useCopilotAction
46
46
  };
47
- //# sourceMappingURL=chunk-X5HCQBME.mjs.map
47
+ //# sourceMappingURL=chunk-NSUYO6TP.mjs.map