@copilotkit/react-textarea 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +88 -130
- package/.turbo/turbo-check-types.log +4 -0
- package/CHANGELOG.md +11 -0
- package/dist/{chunk-CHK3DSAA.mjs → chunk-6FAYV255.mjs} +2 -2
- package/dist/{chunk-RJDWVMCN.mjs → chunk-A3SFEHWZ.mjs} +3 -21
- package/dist/chunk-A3SFEHWZ.mjs.map +1 -0
- package/dist/{chunk-VF6DFXKX.mjs → chunk-PP225CLG.mjs} +3 -3
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +3 -3
- package/dist/components/copilot-textarea/copilot-textarea.mjs +7 -7
- package/dist/components/index.mjs +7 -7
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +1 -1
- package/dist/index.mjs +8 -8
- package/dist/lib/utils.test.d.ts +1 -0
- package/dist/lib/utils.test.mjs +8 -0
- package/dist/lib/utils.test.mjs.map +1 -0
- package/jest.config.js +5 -0
- package/package.json +7 -3
- package/src/components/index.ts +1 -1
- package/src/lib/utils.test.ts +7 -0
- package/tsconfig.json +8 -1
- package/tsup.config.ts +5 -0
- package/dist/chunk-RJDWVMCN.mjs.map +0 -1
- /package/dist/{chunk-CHK3DSAA.mjs.map → chunk-6FAYV255.mjs.map} +0 -0
- /package/dist/{chunk-VF6DFXKX.mjs.map → chunk-PP225CLG.mjs.map} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> @copilotkit/react-textarea@0.
|
|
2
|
+
> @copilotkit/react-textarea@0.7.0 build /Users/ataibarkai/LocalGit/Recursively.ai/CopilotKit/CopilotKit/packages/react-textarea
|
|
3
3
|
> tsup --treeshake
|
|
4
4
|
|
|
5
|
-
CLI Building entry: src/index.tsx, src/context/index.ts, src/components/index.ts, src/hooks/index.ts, src/hooks/use-autosuggestions.ts, src/hooks/use-copilot-textarea-editor.tsx, src/
|
|
5
|
+
CLI Building entry: src/index.tsx, src/context/index.ts, src/components/index.ts, src/hooks/index.ts, src/hooks/use-autosuggestions.ts, src/hooks/use-copilot-textarea-editor.tsx, src/lib/debouncer.ts, src/lib/editor-to-text.ts, src/lib/get-text-around-cursor.ts, src/lib/utils.test.ts, src/lib/utils.ts, src/types/index.ts, src/components/base-copilot-textarea/base-copilot-textarea.tsx, src/components/base-copilot-textarea/render-element.tsx, src/components/base-copilot-textarea/render-placeholder.tsx, src/components/copilot-textarea/copilot-textarea.tsx, src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx, src/lib/slatejs-edits/add-autocompletions.ts, src/lib/slatejs-edits/clear-autocompletions.ts, src/lib/slatejs-edits/replace-text.ts, src/lib/slatejs-edits/with-partial-history.ts, src/types/base/autosuggestion-state.ts, src/types/base/autosuggestions-bare-function.ts, src/types/base/base-autosuggestions-config.tsx, src/types/base/custom-editor.tsx, src/types/base/editor-autocomplete-state.ts, src/types/base/index.ts, src/types/standard-autosuggestions/autosuggestions-config.tsx, src/types/standard-autosuggestions/index.ts, src/types/standard-autosuggestions/minimal-chat-gpt-message.tsx
|
|
6
6
|
CLI Using tsconfig: tsconfig.json
|
|
7
7
|
CLI tsup v6.5.0
|
|
8
8
|
CLI Using tsup config: /Users/ataibarkai/LocalGit/Recursively.ai/CopilotKit/CopilotKit/packages/react-textarea/tsup.config.ts
|
|
@@ -13,171 +13,128 @@ Browserslist: caniuse-lite is outdated. Please run:
|
|
|
13
13
|
npx update-browserslist-db@latest
|
|
14
14
|
Why you should do it regularly: https://github.com/browserslist/update-db#readme
|
|
15
15
|
DTS Build start
|
|
16
|
-
|
|
17
|
-
WARN [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mIgnoring this import because "../react-core/dist/chunk-MRXNTQOX.mjs" was marked as having no side effects[0m [ignored-bare-import]
|
|
18
|
-
|
|
19
|
-
../react-core/dist/chunk-YOYU25BE.mjs:1:7:
|
|
20
|
-
[37m 1 │ import [32m'./chunk-MRXNTQOX.mjs'[37m;
|
|
21
|
-
╵ [32m~~~~~~~~~~~~~~~~~~~~~~[0m
|
|
22
|
-
|
|
23
|
-
"sideEffects" is false in the enclosing "package.json" file
|
|
24
|
-
|
|
25
|
-
../react-core/package.json:8:2:
|
|
26
|
-
[37m 8 │ [32m"sideEffects"[37m: false,
|
|
27
|
-
╵ [32m~~~~~~~~~~~~~[0m
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
WARN [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mIgnoring this import because "../react-core/dist/chunk-3BOHSSKR.mjs" was marked as having no side effects[0m [ignored-bare-import]
|
|
33
|
-
|
|
34
|
-
../react-core/dist/index.mjs:4:7:
|
|
35
|
-
[37m 4 │ import [32m'./chunk-3BOHSSKR.mjs'[37m;
|
|
36
|
-
╵ [32m~~~~~~~~~~~~~~~~~~~~~~[0m
|
|
37
|
-
|
|
38
|
-
"sideEffects" is false in the enclosing "package.json" file
|
|
39
|
-
|
|
40
|
-
../react-core/package.json:8:2:
|
|
41
|
-
[37m 8 │ [32m"sideEffects"[37m: false,
|
|
42
|
-
╵ [32m~~~~~~~~~~~~~[0m
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
WARN [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mIgnoring this import because "../react-core/dist/chunk-MRXNTQOX.mjs" was marked as having no side effects[0m [ignored-bare-import]
|
|
48
|
-
|
|
49
|
-
../react-core/dist/index.mjs:11:7:
|
|
50
|
-
[37m 11 │ import [32m'./chunk-MRXNTQOX.mjs'[37m;
|
|
51
|
-
╵ [32m~~~~~~~~~~~~~~~~~~~~~~[0m
|
|
52
|
-
|
|
53
|
-
"sideEffects" is false in the enclosing "package.json" file
|
|
54
|
-
|
|
55
|
-
../react-core/package.json:8:2:
|
|
56
|
-
[37m 8 │ [32m"sideEffects"[37m: false,
|
|
57
|
-
╵ [32m~~~~~~~~~~~~~[0m
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
16
|
+
Generated an empty chunk: "custom-editor".
|
|
61
17
|
Generated an empty chunk: "minimal-chat-gpt-message".
|
|
62
18
|
Generated an empty chunk: "autosuggestion-state".
|
|
63
19
|
Generated an empty chunk: "autosuggestions-bare-function".
|
|
64
|
-
Generated an empty chunk: "
|
|
20
|
+
Generated an empty chunk: "chunk-FD6FGKYY".
|
|
65
21
|
Generated an empty chunk: "chunk-IU3WTXLQ".
|
|
66
22
|
Generated an empty chunk: "chunk-MMVDU6DF".
|
|
67
|
-
Generated an empty chunk: "chunk-H4VKQGVU".
|
|
68
|
-
Generated an empty chunk: "chunk-FD6FGKYY".
|
|
69
23
|
Generated an empty chunk: "chunk-AZQCUNBV".
|
|
70
24
|
Generated an empty chunk: "chunk-WJHSY5T6".
|
|
25
|
+
Generated an empty chunk: "chunk-H4VKQGVU".
|
|
71
26
|
ESM dist/index.css 5.52 KB
|
|
72
27
|
ESM dist/index.css.map 11.97 KB
|
|
73
|
-
ESM dist/
|
|
74
|
-
ESM dist/chunk-MMVDU6DF.mjs 76.00 B
|
|
75
|
-
ESM dist/chunk-AZQCUNBV.mjs 76.00 B
|
|
76
|
-
ESM dist/types/base/autosuggestions-bare-function.mjs 91.00 B
|
|
77
|
-
ESM dist/chunk-6LKDH2UJ.mjs 295.00 B
|
|
78
|
-
ESM dist/types/base/autosuggestion-state.mjs 82.00 B
|
|
28
|
+
ESM dist/lib/utils.test.mjs 200.00 B
|
|
79
29
|
ESM dist/lib/slatejs-edits/add-autocompletions.mjs 186.00 B
|
|
80
|
-
ESM dist/
|
|
81
|
-
ESM dist/
|
|
82
|
-
ESM dist/
|
|
83
|
-
ESM dist/
|
|
30
|
+
ESM dist/types/index.mjs 387.00 B
|
|
31
|
+
ESM dist/context/index.mjs 98.00 B
|
|
32
|
+
ESM dist/components/index.mjs 792.00 B
|
|
33
|
+
ESM dist/hooks/index.mjs 98.00 B
|
|
84
34
|
ESM dist/chunk-FD6FGKYY.mjs 76.00 B
|
|
35
|
+
ESM dist/chunk-IU3WTXLQ.mjs 76.00 B
|
|
36
|
+
ESM dist/chunk-MMVDU6DF.mjs 76.00 B
|
|
37
|
+
ESM dist/chunk-H4VKQGVU.mjs 76.00 B
|
|
85
38
|
ESM dist/chunk-MRXNTQOX.mjs 1.92 KB
|
|
39
|
+
ESM dist/lib/slatejs-edits/clear-autocompletions.mjs 192.00 B
|
|
40
|
+
ESM dist/lib/slatejs-edits/replace-text.mjs 170.00 B
|
|
86
41
|
ESM dist/lib/slatejs-edits/with-partial-history.mjs 198.00 B
|
|
87
|
-
ESM dist/types/base/custom-editor.mjs 75.00 B
|
|
88
|
-
ESM dist/types/base/index.mjs 213.00 B
|
|
89
|
-
ESM dist/chunk-IU3WTXLQ.mjs 76.00 B
|
|
90
42
|
ESM dist/lib/get-text-around-cursor.mjs 232.00 B
|
|
91
|
-
ESM dist/types/standard-autosuggestions/minimal-chat-gpt-message.mjs 86.00 B
|
|
92
|
-
ESM dist/components/base-copilot-textarea/render-placeholder.mjs 188.00 B
|
|
93
43
|
ESM dist/lib/utils.mjs 220.00 B
|
|
94
|
-
ESM dist/
|
|
95
|
-
ESM dist/
|
|
96
|
-
ESM dist/
|
|
97
|
-
ESM dist/chunk-
|
|
98
|
-
ESM dist/chunk-
|
|
99
|
-
ESM dist/chunk-TSF4AJIK.mjs 716.00 B
|
|
44
|
+
ESM dist/index.mjs 993.00 B
|
|
45
|
+
ESM dist/chunk-PP225CLG.mjs 1.06 KB
|
|
46
|
+
ESM dist/chunk-A3SFEHWZ.mjs 2.09 KB
|
|
47
|
+
ESM dist/chunk-ZPACRCJ6.mjs 2.75 KB
|
|
48
|
+
ESM dist/chunk-6FAYV255.mjs 4.69 KB
|
|
100
49
|
ESM dist/chunk-WJYQWL4I.mjs 595.00 B
|
|
101
50
|
ESM dist/chunk-4XYYSJ5C.mjs 527.00 B
|
|
51
|
+
ESM dist/chunk-TSF4AJIK.mjs 716.00 B
|
|
102
52
|
ESM dist/chunk-3UQM3NLM.mjs 1.76 KB
|
|
103
|
-
ESM dist/context/index.mjs 98.00 B
|
|
104
|
-
ESM dist/hooks/index.mjs 98.00 B
|
|
105
53
|
ESM dist/chunk-6Q4X3YEO.mjs 1.14 KB
|
|
106
|
-
ESM dist/chunk-
|
|
107
|
-
ESM dist/
|
|
108
|
-
ESM dist/chunk-
|
|
54
|
+
ESM dist/chunk-OELUUJZY.mjs 625.00 B
|
|
55
|
+
ESM dist/hooks/use-autosuggestions.mjs 268.00 B
|
|
56
|
+
ESM dist/chunk-24IOWJS4.mjs 2.93 KB
|
|
109
57
|
ESM dist/chunk-UW3ITU2Y.mjs 496.00 B
|
|
110
|
-
ESM dist/
|
|
58
|
+
ESM dist/chunk-KGKLUWKW.mjs 1.37 KB
|
|
111
59
|
ESM dist/hooks/use-copilot-textarea-editor.mjs 218.00 B
|
|
112
60
|
ESM dist/chunk-6SYD77G6.mjs 2.01 KB
|
|
113
|
-
ESM dist/chunk-
|
|
114
|
-
ESM dist/components/base-copilot-textarea/base-copilot-textarea.mjs 671.00 B
|
|
115
|
-
ESM dist/types/index.mjs 387.00 B
|
|
61
|
+
ESM dist/chunk-KCHYD3EB.mjs 3.08 KB
|
|
116
62
|
ESM dist/lib/debouncer.mjs 153.00 B
|
|
117
|
-
ESM dist/types/standard-autosuggestions/autosuggestions-config.mjs 310.00 B
|
|
118
63
|
ESM dist/chunk-NKW5OU2S.mjs 959.00 B
|
|
119
64
|
ESM dist/lib/editor-to-text.mjs 1.34 KB
|
|
120
|
-
ESM dist/chunk-
|
|
121
|
-
ESM dist/chunk-24IOWJS4.mjs 2.93 KB
|
|
122
|
-
ESM dist/chunk-ZPACRCJ6.mjs 2.75 KB
|
|
123
|
-
ESM dist/hooks/use-autosuggestions.mjs 268.00 B
|
|
124
|
-
ESM dist/components/index.mjs 792.00 B
|
|
65
|
+
ESM dist/chunk-AZQCUNBV.mjs 76.00 B
|
|
125
66
|
ESM dist/chunk-WJHSY5T6.mjs 76.00 B
|
|
126
|
-
ESM dist/chunk-
|
|
127
|
-
ESM dist/
|
|
128
|
-
ESM dist/
|
|
129
|
-
ESM dist/
|
|
130
|
-
ESM dist/
|
|
131
|
-
ESM dist/
|
|
132
|
-
ESM dist/types/base/
|
|
67
|
+
ESM dist/chunk-6LKDH2UJ.mjs 295.00 B
|
|
68
|
+
ESM dist/types/base/custom-editor.mjs 75.00 B
|
|
69
|
+
ESM dist/types/standard-autosuggestions/minimal-chat-gpt-message.mjs 86.00 B
|
|
70
|
+
ESM dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs 220.00 B
|
|
71
|
+
ESM dist/components/base-copilot-textarea/base-copilot-textarea.mjs 671.00 B
|
|
72
|
+
ESM dist/components/copilot-textarea/copilot-textarea.mjs 802.00 B
|
|
73
|
+
ESM dist/types/base/autosuggestion-state.mjs 82.00 B
|
|
74
|
+
ESM dist/types/base/autosuggestions-bare-function.mjs 91.00 B
|
|
75
|
+
ESM dist/types/base/editor-autocomplete-state.mjs 227.00 B
|
|
76
|
+
ESM dist/types/base/index.mjs 213.00 B
|
|
77
|
+
ESM dist/types/standard-autosuggestions/index.mjs 328.00 B
|
|
78
|
+
ESM dist/types/base/base-autosuggestions-config.mjs 200.00 B
|
|
79
|
+
ESM dist/components/base-copilot-textarea/render-element.mjs 180.00 B
|
|
80
|
+
ESM dist/components/base-copilot-textarea/render-placeholder.mjs 188.00 B
|
|
81
|
+
ESM dist/lib/utils.test.mjs.map 349.00 B
|
|
82
|
+
ESM dist/lib/slatejs-edits/add-autocompletions.mjs.map 51.00 B
|
|
83
|
+
ESM dist/context/index.mjs.map 51.00 B
|
|
84
|
+
ESM dist/components/index.mjs.map 51.00 B
|
|
85
|
+
ESM dist/types/index.mjs.map 51.00 B
|
|
86
|
+
ESM dist/types/standard-autosuggestions/autosuggestions-config.mjs 310.00 B
|
|
87
|
+
ESM dist/hooks/index.mjs.map 51.00 B
|
|
133
88
|
ESM dist/chunk-FD6FGKYY.mjs.map 51.00 B
|
|
134
89
|
ESM dist/chunk-MRXNTQOX.mjs.map 71.00 B
|
|
135
|
-
ESM dist/
|
|
136
|
-
ESM dist/
|
|
137
|
-
ESM dist/
|
|
90
|
+
ESM dist/lib/slatejs-edits/clear-autocompletions.mjs.map 51.00 B
|
|
91
|
+
ESM dist/lib/slatejs-edits/replace-text.mjs.map 51.00 B
|
|
92
|
+
ESM dist/lib/slatejs-edits/with-partial-history.mjs.map 51.00 B
|
|
138
93
|
ESM dist/lib/get-text-around-cursor.mjs.map 51.00 B
|
|
139
|
-
ESM dist/
|
|
140
|
-
ESM dist/types/base/base-autosuggestions-config.mjs.map 51.00 B
|
|
141
|
-
ESM dist/types/standard-autosuggestions/index.mjs.map 51.00 B
|
|
142
|
-
ESM dist/types/standard-autosuggestions/minimal-chat-gpt-message.mjs.map 51.00 B
|
|
143
|
-
ESM dist/chunk-VF6DFXKX.mjs.map 1.75 KB
|
|
94
|
+
ESM dist/chunk-IU3WTXLQ.mjs.map 51.00 B
|
|
144
95
|
ESM dist/lib/utils.mjs.map 51.00 B
|
|
145
|
-
ESM dist/
|
|
146
|
-
ESM dist/
|
|
96
|
+
ESM dist/chunk-PP225CLG.mjs.map 1.75 KB
|
|
97
|
+
ESM dist/chunk-6FAYV255.mjs.map 8.05 KB
|
|
98
|
+
ESM dist/chunk-ZPACRCJ6.mjs.map 4.01 KB
|
|
99
|
+
ESM dist/chunk-3UQM3NLM.mjs.map 3.63 KB
|
|
147
100
|
ESM dist/chunk-TSF4AJIK.mjs.map 1.31 KB
|
|
148
|
-
ESM dist/components/copilot-textarea/copilot-textarea.mjs.map 51.00 B
|
|
149
|
-
ESM dist/lib/slatejs-edits/with-partial-history.mjs.map 51.00 B
|
|
150
|
-
ESM dist/chunk-WJYQWL4I.mjs.map 1.04 KB
|
|
151
|
-
ESM dist/chunk-6Q4X3YEO.mjs.map 1.82 KB
|
|
152
101
|
ESM dist/chunk-4XYYSJ5C.mjs.map 921.00 B
|
|
153
|
-
ESM dist/chunk-
|
|
154
|
-
ESM dist/
|
|
155
|
-
ESM dist/chunk-3UQM3NLM.mjs.map 3.63 KB
|
|
156
|
-
ESM dist/index.mjs.map 51.00 B
|
|
157
|
-
ESM dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map 51.00 B
|
|
158
|
-
ESM dist/chunk-KGKLUWKW.mjs.map 2.45 KB
|
|
102
|
+
ESM dist/chunk-6Q4X3YEO.mjs.map 1.82 KB
|
|
103
|
+
ESM dist/hooks/use-autosuggestions.mjs.map 51.00 B
|
|
159
104
|
ESM dist/chunk-OELUUJZY.mjs.map 957.00 B
|
|
105
|
+
ESM dist/chunk-24IOWJS4.mjs.map 5.54 KB
|
|
160
106
|
ESM dist/chunk-UW3ITU2Y.mjs.map 878.00 B
|
|
161
|
-
ESM dist/chunk-6SYD77G6.mjs.map 3.78 KB
|
|
162
|
-
ESM dist/types/index.mjs.map 51.00 B
|
|
163
107
|
ESM dist/hooks/use-copilot-textarea-editor.mjs.map 51.00 B
|
|
108
|
+
ESM dist/chunk-KGKLUWKW.mjs.map 2.45 KB
|
|
109
|
+
ESM dist/chunk-6SYD77G6.mjs.map 3.78 KB
|
|
164
110
|
ESM dist/lib/debouncer.mjs.map 51.00 B
|
|
165
|
-
ESM dist/types/standard-autosuggestions/autosuggestions-config.mjs.map 51.00 B
|
|
166
|
-
ESM dist/lib/editor-to-text.mjs.map 2.83 KB
|
|
167
111
|
ESM dist/chunk-NKW5OU2S.mjs.map 1.60 KB
|
|
168
|
-
ESM dist/
|
|
112
|
+
ESM dist/chunk-AZQCUNBV.mjs.map 51.00 B
|
|
113
|
+
ESM dist/lib/editor-to-text.mjs.map 2.83 KB
|
|
114
|
+
ESM dist/chunk-WJYQWL4I.mjs.map 1.04 KB
|
|
115
|
+
ESM dist/index.mjs.map 51.00 B
|
|
116
|
+
ESM dist/chunk-WJHSY5T6.mjs.map 51.00 B
|
|
117
|
+
ESM dist/chunk-6LKDH2UJ.mjs.map 566.00 B
|
|
118
|
+
ESM dist/chunk-A3SFEHWZ.mjs.map 4.73 KB
|
|
119
|
+
ESM dist/chunk-MMVDU6DF.mjs.map 51.00 B
|
|
120
|
+
ESM dist/chunk-H4VKQGVU.mjs.map 51.00 B
|
|
169
121
|
ESM dist/chunk-KCHYD3EB.mjs.map 6.12 KB
|
|
170
|
-
ESM dist/
|
|
122
|
+
ESM dist/types/base/custom-editor.mjs.map 51.00 B
|
|
123
|
+
ESM dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map 51.00 B
|
|
124
|
+
ESM dist/types/standard-autosuggestions/minimal-chat-gpt-message.mjs.map 51.00 B
|
|
171
125
|
ESM dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map 51.00 B
|
|
172
|
-
ESM dist/
|
|
173
|
-
ESM dist/
|
|
174
|
-
ESM dist/
|
|
175
|
-
ESM dist/
|
|
126
|
+
ESM dist/components/copilot-textarea/copilot-textarea.mjs.map 51.00 B
|
|
127
|
+
ESM dist/types/base/autosuggestion-state.mjs.map 51.00 B
|
|
128
|
+
ESM dist/types/base/autosuggestions-bare-function.mjs.map 51.00 B
|
|
129
|
+
ESM dist/types/base/editor-autocomplete-state.mjs.map 51.00 B
|
|
130
|
+
ESM dist/types/base/index.mjs.map 51.00 B
|
|
131
|
+
ESM dist/types/standard-autosuggestions/index.mjs.map 51.00 B
|
|
132
|
+
ESM dist/types/base/base-autosuggestions-config.mjs.map 51.00 B
|
|
133
|
+
ESM dist/components/base-copilot-textarea/render-element.mjs.map 51.00 B
|
|
176
134
|
ESM dist/components/base-copilot-textarea/render-placeholder.mjs.map 51.00 B
|
|
177
|
-
ESM dist/
|
|
178
|
-
ESM
|
|
179
|
-
|
|
180
|
-
DTS ⚡️ Build success in 826ms
|
|
135
|
+
ESM dist/types/standard-autosuggestions/autosuggestions-config.mjs.map 51.00 B
|
|
136
|
+
ESM ⚡️ Build success in 548ms
|
|
137
|
+
DTS ⚡️ Build success in 1038ms
|
|
181
138
|
DTS dist/index.d.ts 763.00 B
|
|
182
139
|
DTS dist/components/base-copilot-textarea/base-copilot-textarea.d.ts 789.00 B
|
|
183
140
|
DTS dist/components/copilot-textarea/copilot-textarea.d.ts 703.00 B
|
|
@@ -193,17 +150,18 @@ DTS dist/types/base/autosuggestion-state.d.ts
|
|
|
193
150
|
DTS dist/types/base/editor-autocomplete-state.d.ts 342.00 B
|
|
194
151
|
DTS dist/hooks/use-copilot-textarea-editor.d.ts 223.00 B
|
|
195
152
|
DTS dist/types/base/custom-editor.d.ts 801.00 B
|
|
196
|
-
DTS dist/types/index.d.ts 491.00 B
|
|
197
153
|
DTS dist/lib/debouncer.d.ts 372.00 B
|
|
198
154
|
DTS dist/lib/editor-to-text.d.ts 243.00 B
|
|
199
155
|
DTS dist/lib/get-text-around-cursor.d.ts 453.00 B
|
|
156
|
+
DTS dist/lib/utils.test.d.ts 1.00 B
|
|
200
157
|
DTS dist/lib/utils.d.ts 638.00 B
|
|
158
|
+
DTS dist/types/index.d.ts 491.00 B
|
|
201
159
|
DTS dist/components/base-copilot-textarea/render-element.d.ts 292.00 B
|
|
202
160
|
DTS dist/components/base-copilot-textarea/render-placeholder.d.ts 321.00 B
|
|
203
161
|
DTS dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts 1.79 KB
|
|
204
|
-
DTS dist/types/base/index.d.ts 194.00 B
|
|
205
|
-
DTS dist/types/standard-autosuggestions/index.d.ts 286.00 B
|
|
206
162
|
DTS dist/lib/slatejs-edits/add-autocompletions.d.ts 302.00 B
|
|
207
163
|
DTS dist/lib/slatejs-edits/clear-autocompletions.d.ts 250.00 B
|
|
208
164
|
DTS dist/lib/slatejs-edits/replace-text.d.ts 139.00 B
|
|
209
165
|
DTS dist/lib/slatejs-edits/with-partial-history.d.ts 542.00 B
|
|
166
|
+
DTS dist/types/base/index.d.ts 194.00 B
|
|
167
|
+
DTS dist/types/standard-autosuggestions/index.d.ts 286.00 B
|
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,11 @@ import { addAutocompletionsToEditor } from './chunk-WJYQWL4I.mjs';
|
|
|
2
2
|
import { clearAutocompletionsFromEditor } from './chunk-4XYYSJ5C.mjs';
|
|
3
3
|
import { replaceEditorText } from './chunk-TSF4AJIK.mjs';
|
|
4
4
|
import { getTextAroundCursor, getFullEditorTextWithNewlines } from './chunk-3UQM3NLM.mjs';
|
|
5
|
+
import { defaultBaseAutosuggestionsConfig } from './chunk-6LKDH2UJ.mjs';
|
|
5
6
|
import { makeRenderElementFunction } from './chunk-6Q4X3YEO.mjs';
|
|
6
7
|
import { makeRenderPlaceholderFunction } from './chunk-OELUUJZY.mjs';
|
|
7
8
|
import { useAutosuggestions } from './chunk-24IOWJS4.mjs';
|
|
8
9
|
import { useCopilotTextareaEditor } from './chunk-6SYD77G6.mjs';
|
|
9
|
-
import { defaultBaseAutosuggestionsConfig } from './chunk-6LKDH2UJ.mjs';
|
|
10
10
|
import { __spreadValues, __objRest } from './chunk-MRXNTQOX.mjs';
|
|
11
11
|
import { useMemo, useState, useCallback, useEffect } from 'react';
|
|
12
12
|
import { Editor } from 'slate';
|
|
@@ -121,4 +121,4 @@ function BaseCopilotTextarea(props) {
|
|
|
121
121
|
|
|
122
122
|
export { BaseCopilotTextarea };
|
|
123
123
|
//# sourceMappingURL=out.js.map
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-6FAYV255.mjs.map
|
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
import { __async, __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { CopilotContext } from '@copilotkit/react-core';
|
|
3
|
+
import { useContext, useCallback } from 'react';
|
|
3
4
|
|
|
4
|
-
var emptyCopilotContext = {
|
|
5
|
-
entryPoints: {},
|
|
6
|
-
setEntryPoint: () => {
|
|
7
|
-
},
|
|
8
|
-
removeEntryPoint: () => {
|
|
9
|
-
},
|
|
10
|
-
getChatCompletionFunctionDescriptions: () => returnAndThrowInDebug(),
|
|
11
|
-
getFunctionCallHandler: () => returnAndThrowInDebug(),
|
|
12
|
-
getContextString: () => returnAndThrowInDebug(),
|
|
13
|
-
addContext: () => "",
|
|
14
|
-
removeContext: () => {
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var CopilotContext = React.createContext(emptyCopilotContext);
|
|
18
|
-
function returnAndThrowInDebug(value) {
|
|
19
|
-
throw new Error(
|
|
20
|
-
"Remember to wrap your app in a `<CopilotProvider> {...} </CopilotProvider>` !!!"
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
5
|
function useMakeStandardAutosuggestionFunction(purposePrompt, apiEndpoint, makeSystemPrompt, fewShotMessages, contextCategories, forwardedProps) {
|
|
24
6
|
const { getContextString } = useContext(CopilotContext);
|
|
25
7
|
return useCallback(
|
|
@@ -82,4 +64,4 @@ function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
|
|
|
82
64
|
|
|
83
65
|
export { useMakeStandardAutosuggestionFunction };
|
|
84
66
|
//# sourceMappingURL=out.js.map
|
|
85
|
-
//# sourceMappingURL=chunk-
|
|
67
|
+
//# sourceMappingURL=chunk-A3SFEHWZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx"],"names":[],"mappings":";;;;;;;AAAA,SAAS,sBAAsB;AAC/B,SAAS,aAAa,kBAAkB;AAmBjC,SAAS,sCACd,eACA,aACA,kBACA,iBACA,mBACA,gBAC6B;AAC7B,QAAM,EAAE,iBAAiB,IAAI,WAAW,cAAc;AAEtD,SAAO;AAAA,IACL,CAAO,YAAoB,WAAmB,gBAA6B;AACzE,YAAM,MAAM,MAAM,MAAM,MAAY;AAClC,eAAO,MAAM,MAAM,aAAa;AAAA,UAC9B,QAAQ;AAAA,UACR,MAAM,KAAK,UAAU,iCAChB,iBADgB;AAAA,YAEnB,UAAU;AAAA,cACR;AAAA,gBACE,MAAM;AAAA,gBACN,SAAS;AAAA,kBACP;AAAA,kBACA,iBAAiB,iBAAiB;AAAA,gBACpC;AAAA,cACF;AAAA,cACA,GAAG;AAAA,cACH;AAAA,gBACE,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN,SAAS;AAAA,cACX;AAAA,cACA;AAAA,gBACE,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN,SAAS;AAAA,cACX;AAAA,YACF;AAAA,UACF,EAAC;AAAA,UACD,QAAQ;AAAA,QACV,CAAC;AAAA,MACH,EAAC;AAED,YAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,YAAM,aAAa,KAAK,QAAQ,GAAG,QAAQ;AAE3C,aAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,MACP,IACA,cAAsB,GACtB,WAAmB,KACnB,UAAkB,KACN;AACZ,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,OAAG,EACA,KAAK,OAAO,EACZ,MAAM,CAAC,UAAU;AAChB,UAAI,gBAAgB,GAAG;AACrB,eAAO,KAAK;AACZ;AAAA,MACF;AAEA,iBAAW,MAAM;AACf,cAAM,IAAI,cAAc,GAAG,WAAW,SAAS,OAAO,EACnD,KAAK,OAAO,EACZ,MAAM,MAAM;AAAA,MACjB,GAAG,QAAQ;AAAA,IACb,CAAC;AAAA,EACL,CAAC;AACH","sourcesContent":["import { CopilotContext } from \"@copilotkit/react-core\";\nimport { useCallback, useContext } from \"react\";\nimport {\n AutosuggestionsBareFunction,\n MakeSystemPrompt,\n MinimalChatGPTMessage,\n} from \"../../types\";\n/**\n * Returns a memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n * The function takes in the text before and after the cursor, and an abort signal.\n * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.\n * The function returns the suggestion from the API response.\n *\n * @param purposePrompt - The purpose of the textarea. This is included in the system message.\n * @param apiEndpoint - The API endpoint to send the autosuggestion request to.\n * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.\n * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.\n * @param contextCategories - The categories of context strings we want to include. By default, we include the (default) \"global\" context category.\n * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n */\nexport function useMakeStandardAutosuggestionFunction(\n purposePrompt: string,\n apiEndpoint: string,\n makeSystemPrompt: MakeSystemPrompt,\n fewShotMessages: MinimalChatGPTMessage[],\n contextCategories: string[] | undefined,\n forwardedProps?: { [key: string]: any }\n): AutosuggestionsBareFunction {\n const { getContextString } = useContext(CopilotContext);\n\n return useCallback(\n async (beforeText: string, afterText: string, abortSignal: AbortSignal) => {\n const res = await retry(async () => {\n return await fetch(apiEndpoint, {\n method: \"POST\",\n body: JSON.stringify({\n ...forwardedProps,\n messages: [\n {\n role: \"system\",\n content: makeSystemPrompt(\n purposePrompt,\n getContextString(contextCategories)\n ),\n },\n ...fewShotMessages,\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: afterText,\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: beforeText,\n },\n ],\n }),\n signal: abortSignal,\n });\n });\n\n const json = await res.json();\n const suggestion = json.choices[0].message.content;\n\n return suggestion;\n },\n [\n apiEndpoint,\n makeSystemPrompt,\n fewShotMessages,\n getContextString,\n contextCategories,\n purposePrompt,\n ]\n );\n}\n\nfunction retry<T>(\n fn: () => Promise<T>,\n retriesLeft: number = 2,\n interval: number = 200,\n backoff: number = 1.5\n): Promise<T> {\n return new Promise((resolve, reject) => {\n fn()\n .then(resolve)\n .catch((error) => {\n if (retriesLeft === 1) {\n reject(error);\n return;\n }\n\n setTimeout(() => {\n retry(fn, retriesLeft - 1, interval * backoff, backoff)\n .then(resolve)\n .catch(reject);\n }, interval);\n });\n });\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useMakeStandardAutosuggestionFunction } from './chunk-RJDWVMCN.mjs';
|
|
1
|
+
import { useMakeStandardAutosuggestionFunction } from './chunk-A3SFEHWZ.mjs';
|
|
3
2
|
import { defaultAutosuggestionsConfig } from './chunk-ZPACRCJ6.mjs';
|
|
3
|
+
import { BaseCopilotTextarea } from './chunk-6FAYV255.mjs';
|
|
4
4
|
import { __spreadValues, __spreadProps } from './chunk-MRXNTQOX.mjs';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
@@ -22,4 +22,4 @@ function CopilotTextarea(props) {
|
|
|
22
22
|
|
|
23
23
|
export { CopilotTextarea };
|
|
24
24
|
//# sourceMappingURL=out.js.map
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-PP225CLG.mjs.map
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export { BaseCopilotTextarea } from '../../chunk-
|
|
1
|
+
export { BaseCopilotTextarea } from '../../chunk-6FAYV255.mjs';
|
|
2
2
|
import '../../chunk-WJYQWL4I.mjs';
|
|
3
3
|
import '../../chunk-4XYYSJ5C.mjs';
|
|
4
4
|
import '../../chunk-TSF4AJIK.mjs';
|
|
5
5
|
import '../../chunk-3UQM3NLM.mjs';
|
|
6
|
+
import '../../chunk-WJHSY5T6.mjs';
|
|
7
|
+
import '../../chunk-6LKDH2UJ.mjs';
|
|
6
8
|
import '../../chunk-6Q4X3YEO.mjs';
|
|
7
9
|
import '../../chunk-OELUUJZY.mjs';
|
|
8
10
|
import '../../chunk-24IOWJS4.mjs';
|
|
@@ -10,8 +12,6 @@ import '../../chunk-UW3ITU2Y.mjs';
|
|
|
10
12
|
import '../../chunk-KGKLUWKW.mjs';
|
|
11
13
|
import '../../chunk-6SYD77G6.mjs';
|
|
12
14
|
import '../../chunk-KCHYD3EB.mjs';
|
|
13
|
-
import '../../chunk-WJHSY5T6.mjs';
|
|
14
|
-
import '../../chunk-6LKDH2UJ.mjs';
|
|
15
15
|
import '../../chunk-NKW5OU2S.mjs';
|
|
16
16
|
import '../../chunk-MRXNTQOX.mjs';
|
|
17
17
|
//# sourceMappingURL=out.js.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export { CopilotTextarea } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { CopilotTextarea } from '../../chunk-PP225CLG.mjs';
|
|
2
|
+
import '../../chunk-A3SFEHWZ.mjs';
|
|
3
|
+
import '../../chunk-AZQCUNBV.mjs';
|
|
4
|
+
import '../../chunk-ZPACRCJ6.mjs';
|
|
5
|
+
import '../../chunk-6FAYV255.mjs';
|
|
3
6
|
import '../../chunk-WJYQWL4I.mjs';
|
|
4
7
|
import '../../chunk-4XYYSJ5C.mjs';
|
|
5
8
|
import '../../chunk-TSF4AJIK.mjs';
|
|
6
9
|
import '../../chunk-3UQM3NLM.mjs';
|
|
10
|
+
import '../../chunk-WJHSY5T6.mjs';
|
|
11
|
+
import '../../chunk-6LKDH2UJ.mjs';
|
|
7
12
|
import '../../chunk-6Q4X3YEO.mjs';
|
|
8
13
|
import '../../chunk-OELUUJZY.mjs';
|
|
9
|
-
import '../../chunk-RJDWVMCN.mjs';
|
|
10
14
|
import '../../chunk-24IOWJS4.mjs';
|
|
11
15
|
import '../../chunk-UW3ITU2Y.mjs';
|
|
12
16
|
import '../../chunk-KGKLUWKW.mjs';
|
|
13
17
|
import '../../chunk-6SYD77G6.mjs';
|
|
14
18
|
import '../../chunk-KCHYD3EB.mjs';
|
|
15
|
-
import '../../chunk-AZQCUNBV.mjs';
|
|
16
|
-
import '../../chunk-ZPACRCJ6.mjs';
|
|
17
|
-
import '../../chunk-WJHSY5T6.mjs';
|
|
18
|
-
import '../../chunk-6LKDH2UJ.mjs';
|
|
19
19
|
import '../../chunk-NKW5OU2S.mjs';
|
|
20
20
|
import '../../chunk-MRXNTQOX.mjs';
|
|
21
21
|
//# sourceMappingURL=out.js.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import '../chunk-MMVDU6DF.mjs';
|
|
2
|
-
export { CopilotTextarea } from '../chunk-
|
|
3
|
-
|
|
2
|
+
export { CopilotTextarea } from '../chunk-PP225CLG.mjs';
|
|
3
|
+
import '../chunk-A3SFEHWZ.mjs';
|
|
4
|
+
import '../chunk-AZQCUNBV.mjs';
|
|
5
|
+
import '../chunk-ZPACRCJ6.mjs';
|
|
6
|
+
export { BaseCopilotTextarea } from '../chunk-6FAYV255.mjs';
|
|
4
7
|
import '../chunk-WJYQWL4I.mjs';
|
|
5
8
|
import '../chunk-4XYYSJ5C.mjs';
|
|
6
9
|
import '../chunk-TSF4AJIK.mjs';
|
|
7
10
|
import '../chunk-3UQM3NLM.mjs';
|
|
11
|
+
import '../chunk-WJHSY5T6.mjs';
|
|
12
|
+
import '../chunk-6LKDH2UJ.mjs';
|
|
8
13
|
import '../chunk-6Q4X3YEO.mjs';
|
|
9
14
|
import '../chunk-OELUUJZY.mjs';
|
|
10
|
-
import '../chunk-RJDWVMCN.mjs';
|
|
11
15
|
import '../chunk-24IOWJS4.mjs';
|
|
12
16
|
import '../chunk-UW3ITU2Y.mjs';
|
|
13
17
|
import '../chunk-KGKLUWKW.mjs';
|
|
14
18
|
import '../chunk-6SYD77G6.mjs';
|
|
15
19
|
import '../chunk-KCHYD3EB.mjs';
|
|
16
|
-
import '../chunk-AZQCUNBV.mjs';
|
|
17
|
-
import '../chunk-ZPACRCJ6.mjs';
|
|
18
|
-
import '../chunk-WJHSY5T6.mjs';
|
|
19
|
-
import '../chunk-6LKDH2UJ.mjs';
|
|
20
20
|
import '../chunk-NKW5OU2S.mjs';
|
|
21
21
|
import '../chunk-MRXNTQOX.mjs';
|
|
22
22
|
//# sourceMappingURL=out.js.map
|
package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useMakeStandardAutosuggestionFunction } from '../../chunk-
|
|
1
|
+
export { useMakeStandardAutosuggestionFunction } from '../../chunk-A3SFEHWZ.mjs';
|
|
2
2
|
import '../../chunk-MRXNTQOX.mjs';
|
|
3
3
|
//# sourceMappingURL=out.js.map
|
|
4
4
|
//# sourceMappingURL=use-make-standard-autosuggestions-function.mjs.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
+
import './chunk-FD6FGKYY.mjs';
|
|
1
2
|
import './chunk-IU3WTXLQ.mjs';
|
|
2
3
|
import './chunk-MMVDU6DF.mjs';
|
|
3
|
-
export { CopilotTextarea } from './chunk-
|
|
4
|
-
|
|
4
|
+
export { CopilotTextarea } from './chunk-PP225CLG.mjs';
|
|
5
|
+
import './chunk-A3SFEHWZ.mjs';
|
|
6
|
+
import './chunk-AZQCUNBV.mjs';
|
|
7
|
+
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from './chunk-ZPACRCJ6.mjs';
|
|
8
|
+
export { BaseCopilotTextarea } from './chunk-6FAYV255.mjs';
|
|
5
9
|
import './chunk-WJYQWL4I.mjs';
|
|
6
10
|
import './chunk-4XYYSJ5C.mjs';
|
|
7
11
|
import './chunk-TSF4AJIK.mjs';
|
|
8
12
|
import './chunk-3UQM3NLM.mjs';
|
|
13
|
+
import './chunk-WJHSY5T6.mjs';
|
|
14
|
+
export { defaultBaseAutosuggestionsConfig } from './chunk-6LKDH2UJ.mjs';
|
|
9
15
|
import './chunk-6Q4X3YEO.mjs';
|
|
10
16
|
import './chunk-OELUUJZY.mjs';
|
|
11
|
-
import './chunk-RJDWVMCN.mjs';
|
|
12
17
|
import './chunk-H4VKQGVU.mjs';
|
|
13
18
|
import './chunk-24IOWJS4.mjs';
|
|
14
19
|
import './chunk-UW3ITU2Y.mjs';
|
|
15
20
|
import './chunk-KGKLUWKW.mjs';
|
|
16
21
|
import './chunk-6SYD77G6.mjs';
|
|
17
22
|
import './chunk-KCHYD3EB.mjs';
|
|
18
|
-
import './chunk-FD6FGKYY.mjs';
|
|
19
|
-
import './chunk-AZQCUNBV.mjs';
|
|
20
|
-
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from './chunk-ZPACRCJ6.mjs';
|
|
21
|
-
import './chunk-WJHSY5T6.mjs';
|
|
22
|
-
export { defaultBaseAutosuggestionsConfig } from './chunk-6LKDH2UJ.mjs';
|
|
23
23
|
import './chunk-NKW5OU2S.mjs';
|
|
24
24
|
import './chunk-MRXNTQOX.mjs';
|
|
25
25
|
//# sourceMappingURL=out.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.test.ts"],"names":[],"mappings":";AAEA,SAAS,aAAa,MAAM;AAC1B,KAAG,oBAAoB,MAAM;AAC3B,WAAO,IAAI,EAAE,WAAW;AAAA,EAC1B,CAAC;AACH,CAAC","sourcesContent":["import * as utils from \"./utils\";\n\ndescribe(\"emptyTest\", () => {\n it(\"should be truthy\", () => {\n expect(true).toBeTruthy();\n });\n});\n"]}
|
package/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.8.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"**/*.css"
|
|
10
10
|
],
|
|
@@ -19,15 +19,17 @@
|
|
|
19
19
|
"react": "^18.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
+
"@types/jest": "^29.5.4",
|
|
22
23
|
"@types/react": "^18.2.5",
|
|
23
24
|
"@types/react-syntax-highlighter": "^15.5.7",
|
|
24
25
|
"eslint": "^7.32.0",
|
|
26
|
+
"jest": "^29.6.4",
|
|
25
27
|
"postcss": "^8.4.20",
|
|
26
28
|
"react": "^18.2.0",
|
|
27
29
|
"tailwindcss": "^3.3.0",
|
|
30
|
+
"ts-jest": "^29.1.1",
|
|
28
31
|
"tsup": "^6.1.3",
|
|
29
32
|
"typescript": "^4.9.4",
|
|
30
|
-
"@copilotkit/react-core": "0.6.0",
|
|
31
33
|
"tailwind-config": "0.1.0",
|
|
32
34
|
"tsconfig": "0.3.0",
|
|
33
35
|
"eslint-config-custom": "0.2.0"
|
|
@@ -43,11 +45,13 @@
|
|
|
43
45
|
"slate": "^0.94.1",
|
|
44
46
|
"slate-history": "^0.93.0",
|
|
45
47
|
"slate-react": "^0.98.1",
|
|
46
|
-
"tailwind-merge": "^1.13.2"
|
|
48
|
+
"tailwind-merge": "^1.13.2",
|
|
49
|
+
"@copilotkit/react-core": "0.7.0"
|
|
47
50
|
},
|
|
48
51
|
"scripts": {
|
|
49
52
|
"build": "tsup --treeshake",
|
|
50
53
|
"dev": "tsup --watch --no-splitting",
|
|
54
|
+
"test": "jest",
|
|
51
55
|
"check-types": "tsc --noEmit",
|
|
52
56
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next"
|
|
53
57
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { BaseCopilotTextarea } from "./base-copilot-textarea/base-copilot-textar
|
|
|
2
2
|
export type { BaseCopilotTextareaProps } from "./base-copilot-textarea/base-copilot-textarea";
|
|
3
3
|
|
|
4
4
|
export { CopilotTextarea } from "./copilot-textarea/copilot-textarea";
|
|
5
|
-
export type { CopilotTextareaProps } from "./copilot-textarea/copilot-textarea";
|
|
5
|
+
export type { CopilotTextareaProps } from "./copilot-textarea/copilot-textarea";
|
package/tsconfig.json
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "tsconfig/react-library.json",
|
|
3
3
|
"include": ["."],
|
|
4
|
-
"exclude": [
|
|
4
|
+
"exclude": [
|
|
5
|
+
"dist",
|
|
6
|
+
"build",
|
|
7
|
+
"node_modules",
|
|
8
|
+
"**/*.test.ts", // Exclude TypeScript test files
|
|
9
|
+
"**/*.test.tsx", // Exclude TypeScript React test files
|
|
10
|
+
"**/__tests__/*" // Exclude any files inside a __tests__ directory
|
|
11
|
+
]
|
|
5
12
|
}
|
package/tsup.config.ts
CHANGED
|
@@ -8,5 +8,10 @@ export default defineConfig((options: Options) => ({
|
|
|
8
8
|
clean: true,
|
|
9
9
|
external: ["react"],
|
|
10
10
|
sourcemap: true,
|
|
11
|
+
exclude: [
|
|
12
|
+
"**/*.test.ts", // Exclude TypeScript test files
|
|
13
|
+
"**/*.test.tsx", // Exclude TypeScript React test files
|
|
14
|
+
"**/__tests__/*", // Exclude any files inside a __tests__ directory
|
|
15
|
+
],
|
|
11
16
|
...options,
|
|
12
17
|
}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../react-core/src/context/copilot-context.tsx","../src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx"],"names":[],"mappings":";;;;;;;;;;EAIA,eAAO,MAAW;EAJlB;EA0BA,kBAAM,MAA4C;EAChD;EACA,uCAAqB,MAAA,sBAAA;EAAC,wBAAA,MAAA,sBAAA;EACtB,kBAAkB,MAAM,sBAAA;EAAC,YAAA,MAAA;EACzB,eAAA,MAAA;EACA;AAAgE;AAAE,IAElE,iBAAkB,MAAM,cAAA,mBAAwB;AAAA,SAChD,sBAAkB,OAAA;AAClB,QAAA,IAAA;IAAsB;EACxB;AAEO;;;ACrCP,SAAS,aAAa,kBAAkB;AAmBjC,SAAS,sCACd,eACA,aACA,kBACA,iBACA,mBACA,gBAC6B;AAC7B,QAAM,EAAE,iBAAiB,IAAI,WAAW,cAAc;AAEtD,SAAO;AAAA,IACL,CAAO,YAAoB,WAAmB,gBAA6B;AACzE,YAAM,MAAM,MAAM,MAAM,MAAY;AAClC,eAAO,MAAM,MAAM,aAAa;AAAA,UAC9B,QAAQ;AAAA,UACR,MAAM,KAAK,UAAU,iCAChB,iBADgB;AAAA,YAEnB,UAAU;AAAA,cACR;AAAA,gBACE,MAAM;AAAA,gBACN,SAAS;AAAA,kBACP;AAAA,kBACA,iBAAiB,iBAAiB;AAAA,gBACpC;AAAA,cACF;AAAA,cACA,GAAG;AAAA,cACH;AAAA,gBACE,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN,SAAS;AAAA,cACX;AAAA,cACA;AAAA,gBACE,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN,SAAS;AAAA,cACX;AAAA,YACF;AAAA,UACF,EAAC;AAAA,UACD,QAAQ;AAAA,QACV,CAAC;AAAA,MACH,EAAC;AAED,YAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,YAAM,aAAa,KAAK,QAAQ,GAAG,QAAQ;AAE3C,aAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,MACP,IACA,cAAsB,GACtB,WAAmB,KACnB,UAAkB,KACN;AACZ,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,OAAG,EACA,KAAK,OAAO,EACZ,MAAM,CAAC,UAAU;AAChB,UAAI,gBAAgB,GAAG;AACrB,eAAO,KAAK;AACZ;AAAA,MACF;AAEA,iBAAW,MAAM;AACf,cAAM,IAAI,cAAc,GAAG,WAAW,SAAS,OAAO,EACnD,KAAK,OAAO,EACZ,MAAM,MAAM;AAAA,MACjB,GAAG,QAAQ;AAAA,IACb,CAAC;AAAA,EACL,CAAC;AACH","sourcesContent":["\"use client\";\n\nimport { FunctionCallHandler } from \"ai\";\nimport { CompletionCreateParams } from \"openai/resources/chat\";\nimport React from \"react\";\nimport { TreeNodeId } from \"../hooks/use-tree\";\nimport { AnnotatedFunction } from \"../types/annotated-function\";\n\nexport interface CopilotContextParams {\n // function-calling\n entryPoints: Record<string, AnnotatedFunction<any[]>>;\n setEntryPoint: (id: string, entryPoint: AnnotatedFunction<any[]>) => void;\n removeEntryPoint: (id: string) => void;\n getChatCompletionFunctionDescriptions: () => CompletionCreateParams.Function[];\n getFunctionCallHandler: () => FunctionCallHandler;\n\n // text context\n getContextString: (categories?: string[]) => string;\n addContext: (\n context: string,\n parentId?: string,\n categories?: string[]\n ) => TreeNodeId;\n removeContext: (id: TreeNodeId) => void;\n}\n\nconst emptyCopilotContext: CopilotContextParams = {\n entryPoints: {},\n setEntryPoint: () => {},\n removeEntryPoint: () => {},\n getChatCompletionFunctionDescriptions: () => returnAndThrowInDebug([]),\n getFunctionCallHandler: () => returnAndThrowInDebug(async () => {}),\n\n getContextString: () => returnAndThrowInDebug(\"\"),\n addContext: () => \"\",\n removeContext: () => {},\n};\n\nexport const CopilotContext =\n React.createContext<CopilotContextParams>(emptyCopilotContext);\n\nfunction returnAndThrowInDebug<T>(value: T): T {\n throw new Error(\n \"Remember to wrap your app in a `<CopilotProvider> {...} </CopilotProvider>` !!!\"\n );\n return value;\n}\n","import { CopilotContext } from \"@copilotkit/react-core\";\nimport { useCallback, useContext } from \"react\";\nimport {\n AutosuggestionsBareFunction,\n MakeSystemPrompt,\n MinimalChatGPTMessage,\n} from \"../../types\";\n/**\n * Returns a memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n * The function takes in the text before and after the cursor, and an abort signal.\n * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.\n * The function returns the suggestion from the API response.\n *\n * @param purposePrompt - The purpose of the textarea. This is included in the system message.\n * @param apiEndpoint - The API endpoint to send the autosuggestion request to.\n * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.\n * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.\n * @param contextCategories - The categories of context strings we want to include. By default, we include the (default) \"global\" context category.\n * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n */\nexport function useMakeStandardAutosuggestionFunction(\n purposePrompt: string,\n apiEndpoint: string,\n makeSystemPrompt: MakeSystemPrompt,\n fewShotMessages: MinimalChatGPTMessage[],\n contextCategories: string[] | undefined,\n forwardedProps?: { [key: string]: any }\n): AutosuggestionsBareFunction {\n const { getContextString } = useContext(CopilotContext);\n\n return useCallback(\n async (beforeText: string, afterText: string, abortSignal: AbortSignal) => {\n const res = await retry(async () => {\n return await fetch(apiEndpoint, {\n method: \"POST\",\n body: JSON.stringify({\n ...forwardedProps,\n messages: [\n {\n role: \"system\",\n content: makeSystemPrompt(\n purposePrompt,\n getContextString(contextCategories)\n ),\n },\n ...fewShotMessages,\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: afterText,\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: beforeText,\n },\n ],\n }),\n signal: abortSignal,\n });\n });\n\n const json = await res.json();\n const suggestion = json.choices[0].message.content;\n\n return suggestion;\n },\n [\n apiEndpoint,\n makeSystemPrompt,\n fewShotMessages,\n getContextString,\n contextCategories,\n purposePrompt,\n ]\n );\n}\n\nfunction retry<T>(\n fn: () => Promise<T>,\n retriesLeft: number = 2,\n interval: number = 200,\n backoff: number = 1.5\n): Promise<T> {\n return new Promise((resolve, reject) => {\n fn()\n .then(resolve)\n .catch((error) => {\n if (retriesLeft === 1) {\n reject(error);\n return;\n }\n\n setTimeout(() => {\n retry(fn, retriesLeft - 1, interval * backoff, backoff)\n .then(resolve)\n .catch(reject);\n }, interval);\n });\n });\n}\n"]}
|
|
File without changes
|
|
File without changes
|