@copilotkit/react-textarea 0.21.0-alpha.6 → 0.21.0-alpha.7

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 (352) hide show
  1. package/.turbo/turbo-build.log +246 -363
  2. package/CHANGELOG.md +11 -0
  3. package/dist/chunk-2NURR2DX.mjs +8 -16
  4. package/dist/chunk-2NURR2DX.mjs.map +1 -1
  5. package/dist/chunk-463BFNUP.mjs +5 -16
  6. package/dist/chunk-463BFNUP.mjs.map +1 -1
  7. package/dist/chunk-4S5ZJH3I.mjs +2 -3
  8. package/dist/chunk-4S5ZJH3I.mjs.map +1 -1
  9. package/dist/chunk-5EJ5XOGP.mjs +8 -16
  10. package/dist/chunk-5EJ5XOGP.mjs.map +1 -1
  11. package/dist/chunk-5FO6ISW4.mjs +2 -0
  12. package/dist/chunk-5FO6ISW4.mjs.map +1 -1
  13. package/dist/chunk-AXN37AHC.mjs +2 -5
  14. package/dist/chunk-AXN37AHC.mjs.map +1 -1
  15. package/dist/chunk-CSGFJU3L.mjs +6 -11
  16. package/dist/chunk-CSGFJU3L.mjs.map +1 -1
  17. package/dist/chunk-DE5K76I2.mjs +2 -0
  18. package/dist/chunk-DE5K76I2.mjs.map +1 -1
  19. package/dist/chunk-DYGPLRY3.mjs +7 -15
  20. package/dist/chunk-DYGPLRY3.mjs.map +1 -1
  21. package/dist/chunk-F2TIBXML.mjs +7 -19
  22. package/dist/chunk-F2TIBXML.mjs.map +1 -1
  23. package/dist/chunk-F3MHL6ZY.mjs +4 -4
  24. package/dist/chunk-F3MHL6ZY.mjs.map +1 -1
  25. package/dist/chunk-GCMQHIRF.mjs +3 -6
  26. package/dist/chunk-GCMQHIRF.mjs.map +1 -1
  27. package/dist/chunk-H4VKQGVU.mjs +2 -0
  28. package/dist/chunk-H4VKQGVU.mjs.map +1 -1
  29. package/dist/{chunk-DB5KKYRC.mjs → chunk-IJC2EXRO.mjs} +12 -24
  30. package/dist/chunk-IJC2EXRO.mjs.map +1 -0
  31. package/dist/chunk-IU3WTXLQ.mjs +2 -0
  32. package/dist/chunk-IU3WTXLQ.mjs.map +1 -1
  33. package/dist/chunk-IXJ2HCOA.mjs +4 -14
  34. package/dist/chunk-IXJ2HCOA.mjs.map +1 -1
  35. package/dist/chunk-JAFCXEPU.mjs +3 -6
  36. package/dist/chunk-JAFCXEPU.mjs.map +1 -1
  37. package/dist/{chunk-MPAJBVBL.mjs → chunk-JBI2MZB4.mjs} +23 -59
  38. package/dist/chunk-JBI2MZB4.mjs.map +1 -0
  39. package/dist/chunk-JHTAOLEW.mjs +2 -5
  40. package/dist/chunk-JHTAOLEW.mjs.map +1 -1
  41. package/dist/chunk-KCHYD3EB.mjs +5 -6
  42. package/dist/chunk-KCHYD3EB.mjs.map +1 -1
  43. package/dist/chunk-KGKLUWKW.mjs +6 -15
  44. package/dist/chunk-KGKLUWKW.mjs.map +1 -1
  45. package/dist/chunk-L7VVZH4Q.mjs +2 -0
  46. package/dist/chunk-L7VVZH4Q.mjs.map +1 -1
  47. package/dist/chunk-LNAIMEB2.mjs +4 -9
  48. package/dist/chunk-LNAIMEB2.mjs.map +1 -1
  49. package/dist/chunk-MMVDU6DF.mjs +2 -0
  50. package/dist/chunk-MMVDU6DF.mjs.map +1 -1
  51. package/dist/chunk-MPME5BW2.mjs +4 -4
  52. package/dist/chunk-MPME5BW2.mjs.map +1 -1
  53. package/dist/{chunk-XHFJMEFG.mjs → chunk-MRPRZQMN.mjs} +13 -35
  54. package/dist/chunk-MRPRZQMN.mjs.map +1 -0
  55. package/dist/chunk-MRXNTQOX.mjs +2 -6
  56. package/dist/chunk-MRXNTQOX.mjs.map +1 -1
  57. package/dist/chunk-ND5PXTAW.mjs +4 -4
  58. package/dist/chunk-ND5PXTAW.mjs.map +1 -1
  59. package/dist/chunk-NKW5OU2S.mjs +3 -6
  60. package/dist/chunk-NKW5OU2S.mjs.map +1 -1
  61. package/dist/{chunk-FCN4H6UP.mjs → chunk-NO3EYPQH.mjs} +5 -9
  62. package/dist/chunk-NO3EYPQH.mjs.map +1 -0
  63. package/dist/chunk-O5OWT5GE.mjs +8 -23
  64. package/dist/chunk-O5OWT5GE.mjs.map +1 -1
  65. package/dist/chunk-OD7ZMOVE.mjs +7 -11
  66. package/dist/chunk-OD7ZMOVE.mjs.map +1 -1
  67. package/dist/chunk-OELUUJZY.mjs +4 -10
  68. package/dist/chunk-OELUUJZY.mjs.map +1 -1
  69. package/dist/{chunk-TIBMW3DC.mjs → chunk-PGGR6HL5.mjs} +7 -12
  70. package/dist/chunk-PGGR6HL5.mjs.map +1 -0
  71. package/dist/chunk-QJDMIGLU.mjs +4 -12
  72. package/dist/chunk-QJDMIGLU.mjs.map +1 -1
  73. package/dist/chunk-RQHOUUXQ.mjs +4 -4
  74. package/dist/chunk-RQHOUUXQ.mjs.map +1 -1
  75. package/dist/chunk-RR6OQGTI.mjs +2 -5
  76. package/dist/chunk-RR6OQGTI.mjs.map +1 -1
  77. package/dist/chunk-S6JUGJK2.mjs +2 -3
  78. package/dist/chunk-S6JUGJK2.mjs.map +1 -1
  79. package/dist/chunk-UHD44NC5.mjs +7 -17
  80. package/dist/chunk-UHD44NC5.mjs.map +1 -1
  81. package/dist/{chunk-7KHNUXA4.mjs → chunk-UIN6BEVR.mjs} +11 -25
  82. package/dist/chunk-UIN6BEVR.mjs.map +1 -0
  83. package/dist/chunk-WADHCMPK.mjs +2 -0
  84. package/dist/chunk-WADHCMPK.mjs.map +1 -1
  85. package/dist/chunk-WJHSY5T6.mjs +2 -0
  86. package/dist/chunk-WJHSY5T6.mjs.map +1 -1
  87. package/dist/chunk-WJYQWL4I.mjs +4 -4
  88. package/dist/chunk-WJYQWL4I.mjs.map +1 -1
  89. package/dist/chunk-WLPYYGES.mjs +22 -42
  90. package/dist/chunk-WLPYYGES.mjs.map +1 -1
  91. package/dist/chunk-WPIA53HF.mjs +7 -15
  92. package/dist/chunk-WPIA53HF.mjs.map +1 -1
  93. package/dist/chunk-XHUMROEY.mjs +7 -17
  94. package/dist/chunk-XHUMROEY.mjs.map +1 -1
  95. package/dist/chunk-YQU7WG7T.mjs +6 -12
  96. package/dist/chunk-YQU7WG7T.mjs.map +1 -1
  97. package/dist/chunk-YTOPHPSG.mjs +4 -4
  98. package/dist/chunk-YTOPHPSG.mjs.map +1 -1
  99. package/dist/chunk-YW3REYX6.mjs +5 -6
  100. package/dist/chunk-YW3REYX6.mjs.map +1 -1
  101. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +35 -39
  102. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
  103. package/dist/components/base-copilot-textarea/render-element.mjs +3 -7
  104. package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -1
  105. package/dist/components/base-copilot-textarea/render-placeholder.mjs +3 -7
  106. package/dist/components/base-copilot-textarea/render-placeholder.mjs.map +1 -1
  107. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +4 -8
  108. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map +1 -1
  109. package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +3 -7
  110. package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -1
  111. package/dist/components/copilot-textarea/copilot-textarea.mjs +47 -51
  112. package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
  113. package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +3 -9
  114. package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -1
  115. package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +3 -15
  116. package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -1
  117. package/dist/components/hovering-toolbar/hovering-toolbar.mjs +18 -22
  118. package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -1
  119. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +12 -16
  120. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -1
  121. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +13 -17
  122. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -1
  123. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +5 -11
  124. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +1 -1
  125. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +14 -18
  126. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
  127. package/dist/components/index.mjs +48 -55
  128. package/dist/components/index.mjs.map +1 -1
  129. package/dist/components/manual-ui/chip-with-icon.mjs +5 -6
  130. package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
  131. package/dist/components/source-search-box/source-search-box.mjs +6 -12
  132. package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
  133. package/dist/components/ui/button.mjs +4 -10
  134. package/dist/components/ui/button.mjs.map +1 -1
  135. package/dist/components/ui/card.mjs +7 -18
  136. package/dist/components/ui/card.mjs.map +1 -1
  137. package/dist/components/ui/command.mjs +5 -25
  138. package/dist/components/ui/command.mjs.map +1 -1
  139. package/dist/components/ui/dialog.mjs +4 -20
  140. package/dist/components/ui/dialog.mjs.map +1 -1
  141. package/dist/components/ui/label.mjs +4 -8
  142. package/dist/components/ui/label.mjs.map +1 -1
  143. package/dist/components/ui/separator.mjs +8 -15
  144. package/dist/components/ui/separator.mjs.map +1 -1
  145. package/dist/components/ui/textarea.mjs +7 -13
  146. package/dist/components/ui/textarea.mjs.map +1 -1
  147. package/dist/context/index.mjs +2 -1
  148. package/dist/context/index.mjs.map +1 -1
  149. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +6 -10
  150. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -1
  151. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +4 -8
  152. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -1
  153. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +5 -9
  154. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -1
  155. package/dist/hooks/index.mjs +2 -1
  156. package/dist/hooks/index.mjs.map +1 -1
  157. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +14 -18
  158. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map +1 -1
  159. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +14 -18
  160. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -1
  161. package/dist/hooks/misc/use-autosize-textarea.mjs +3 -7
  162. package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -1
  163. package/dist/index.mjs +50 -66
  164. package/dist/index.mjs.map +1 -1
  165. package/dist/lib/debouncer.mjs +3 -7
  166. package/dist/lib/debouncer.mjs.map +1 -1
  167. package/dist/lib/editor-to-text.mjs +3 -7
  168. package/dist/lib/editor-to-text.mjs.map +1 -1
  169. package/dist/lib/get-text-around-cursor.mjs +3 -13
  170. package/dist/lib/get-text-around-cursor.mjs.map +1 -1
  171. package/dist/lib/retry.mjs +3 -7
  172. package/dist/lib/retry.mjs.map +1 -1
  173. package/dist/lib/slatejs-edits/add-autocompletions.mjs +3 -7
  174. package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -1
  175. package/dist/lib/slatejs-edits/clear-autocompletions.mjs +3 -7
  176. package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -1
  177. package/dist/lib/slatejs-edits/replace-text.mjs +3 -7
  178. package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -1
  179. package/dist/lib/slatejs-edits/with-partial-history.mjs +3 -9
  180. package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -1
  181. package/dist/lib/stream-promise-flatten.mjs +3 -7
  182. package/dist/lib/stream-promise-flatten.mjs.map +1 -1
  183. package/dist/lib/utils.mjs +3 -17
  184. package/dist/lib/utils.mjs.map +1 -1
  185. package/dist/lib/utils.test.mjs +1 -0
  186. package/dist/lib/utils.test.mjs.map +1 -1
  187. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs +2 -0
  188. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs.map +1 -1
  189. package/dist/types/autosuggestions-config/autosuggestions-config.mjs +8 -12
  190. package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
  191. package/dist/types/autosuggestions-config/editing-api-config.mjs +3 -11
  192. package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -1
  193. package/dist/types/autosuggestions-config/index.mjs +10 -17
  194. package/dist/types/autosuggestions-config/index.mjs.map +1 -1
  195. package/dist/types/autosuggestions-config/insertions-api-config.mjs +3 -11
  196. package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -1
  197. package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs +3 -7
  198. package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs.map +1 -1
  199. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs +2 -0
  200. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs.map +1 -1
  201. package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs +2 -0
  202. package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs.map +1 -1
  203. package/dist/types/autosuggestions-config/suggestions-api-config.mjs +3 -11
  204. package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -1
  205. package/dist/types/base/autosuggestion-state.mjs +2 -0
  206. package/dist/types/base/autosuggestion-state.mjs.map +1 -1
  207. package/dist/types/base/autosuggestions-bare-function.mjs +2 -0
  208. package/dist/types/base/autosuggestions-bare-function.mjs.map +1 -1
  209. package/dist/types/base/base-autosuggestions-config.mjs +3 -7
  210. package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
  211. package/dist/types/base/base-copilot-textarea-props.mjs +2 -0
  212. package/dist/types/base/base-copilot-textarea-props.mjs.map +1 -1
  213. package/dist/types/base/custom-editor.mjs +2 -0
  214. package/dist/types/base/custom-editor.mjs.map +1 -1
  215. package/dist/types/base/editor-autocomplete-state.mjs +4 -8
  216. package/dist/types/base/editor-autocomplete-state.mjs.map +1 -1
  217. package/dist/types/base/index.mjs +4 -8
  218. package/dist/types/base/index.mjs.map +1 -1
  219. package/dist/types/html-copilot-textarea-element.mjs +2 -1
  220. package/dist/types/html-copilot-textarea-element.mjs.map +1 -1
  221. package/dist/types/index.mjs +12 -22
  222. package/dist/types/index.mjs.map +1 -1
  223. package/package.json +4 -4
  224. package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +2 -2
  225. package/dist/chunk-7KHNUXA4.mjs.map +0 -1
  226. package/dist/chunk-DB5KKYRC.mjs.map +0 -1
  227. package/dist/chunk-FCN4H6UP.mjs.map +0 -1
  228. package/dist/chunk-MPAJBVBL.mjs.map +0 -1
  229. package/dist/chunk-TIBMW3DC.mjs.map +0 -1
  230. package/dist/chunk-XHFJMEFG.mjs.map +0 -1
  231. package/dist/components/base-copilot-textarea/base-copilot-textarea.js +0 -1772
  232. package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +0 -1
  233. package/dist/components/base-copilot-textarea/render-element.js +0 -75
  234. package/dist/components/base-copilot-textarea/render-element.js.map +0 -1
  235. package/dist/components/base-copilot-textarea/render-placeholder.js +0 -69
  236. package/dist/components/base-copilot-textarea/render-placeholder.js.map +0 -1
  237. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js +0 -112
  238. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +0 -1
  239. package/dist/components/base-copilot-textarea/use-add-branding-css.js +0 -83
  240. package/dist/components/base-copilot-textarea/use-add-branding-css.js.map +0 -1
  241. package/dist/components/copilot-textarea/copilot-textarea.js +0 -2246
  242. package/dist/components/copilot-textarea/copilot-textarea.js.map +0 -1
  243. package/dist/components/hovering-toolbar/hovering-editor-provider.js +0 -49
  244. package/dist/components/hovering-toolbar/hovering-editor-provider.js.map +0 -1
  245. package/dist/components/hovering-toolbar/hovering-toolbar-components.js +0 -158
  246. package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +0 -1
  247. package/dist/components/hovering-toolbar/hovering-toolbar.js +0 -915
  248. package/dist/components/hovering-toolbar/hovering-toolbar.js.map +0 -1
  249. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +0 -622
  250. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +0 -1
  251. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +0 -639
  252. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +0 -1
  253. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +0 -140
  254. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +0 -1
  255. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +0 -639
  256. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +0 -1
  257. package/dist/components/index.js +0 -2250
  258. package/dist/components/index.js.map +0 -1
  259. package/dist/components/manual-ui/chip-with-icon.js +0 -53
  260. package/dist/components/manual-ui/chip-with-icon.js.map +0 -1
  261. package/dist/components/source-search-box/source-search-box.js +0 -243
  262. package/dist/components/source-search-box/source-search-box.js.map +0 -1
  263. package/dist/components/ui/button.js +0 -118
  264. package/dist/components/ui/button.js.map +0 -1
  265. package/dist/components/ui/card.js +0 -142
  266. package/dist/components/ui/card.js.map +0 -1
  267. package/dist/components/ui/command.js +0 -306
  268. package/dist/components/ui/command.js.map +0 -1
  269. package/dist/components/ui/dialog.js +0 -199
  270. package/dist/components/ui/dialog.js.map +0 -1
  271. package/dist/components/ui/label.js +0 -92
  272. package/dist/components/ui/label.js.map +0 -1
  273. package/dist/components/ui/separator.js +0 -96
  274. package/dist/components/ui/separator.js.map +0 -1
  275. package/dist/components/ui/textarea.js +0 -91
  276. package/dist/components/ui/textarea.js.map +0 -1
  277. package/dist/context/index.js +0 -19
  278. package/dist/context/index.js.map +0 -1
  279. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js +0 -193
  280. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +0 -1
  281. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js +0 -194
  282. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js.map +0 -1
  283. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js +0 -180
  284. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +0 -1
  285. package/dist/hooks/index.js +0 -19
  286. package/dist/hooks/index.js.map +0 -1
  287. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +0 -167
  288. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +0 -1
  289. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +0 -227
  290. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +0 -1
  291. package/dist/hooks/misc/use-autosize-textarea.js +0 -39
  292. package/dist/hooks/misc/use-autosize-textarea.js.map +0 -1
  293. package/dist/index.js +0 -2256
  294. package/dist/index.js.map +0 -1
  295. package/dist/lib/debouncer.js +0 -76
  296. package/dist/lib/debouncer.js.map +0 -1
  297. package/dist/lib/editor-to-text.js +0 -69
  298. package/dist/lib/editor-to-text.js.map +0 -1
  299. package/dist/lib/get-text-around-cursor.js +0 -131
  300. package/dist/lib/get-text-around-cursor.js.map +0 -1
  301. package/dist/lib/retry.js +0 -43
  302. package/dist/lib/retry.js.map +0 -1
  303. package/dist/lib/slatejs-edits/add-autocompletions.js +0 -51
  304. package/dist/lib/slatejs-edits/add-autocompletions.js.map +0 -1
  305. package/dist/lib/slatejs-edits/clear-autocompletions.js +0 -49
  306. package/dist/lib/slatejs-edits/clear-autocompletions.js.map +0 -1
  307. package/dist/lib/slatejs-edits/replace-text.js +0 -53
  308. package/dist/lib/slatejs-edits/replace-text.js.map +0 -1
  309. package/dist/lib/slatejs-edits/with-partial-history.js +0 -133
  310. package/dist/lib/slatejs-edits/with-partial-history.js.map +0 -1
  311. package/dist/lib/stream-promise-flatten.js +0 -72
  312. package/dist/lib/stream-promise-flatten.js.map +0 -1
  313. package/dist/lib/utils.js +0 -101
  314. package/dist/lib/utils.js.map +0 -1
  315. package/dist/lib/utils.test.js +0 -9
  316. package/dist/lib/utils.test.js.map +0 -1
  317. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js +0 -19
  318. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js.map +0 -1
  319. package/dist/types/autosuggestions-config/autosuggestions-config.js +0 -275
  320. package/dist/types/autosuggestions-config/autosuggestions-config.js.map +0 -1
  321. package/dist/types/autosuggestions-config/editing-api-config.js +0 -109
  322. package/dist/types/autosuggestions-config/editing-api-config.js.map +0 -1
  323. package/dist/types/autosuggestions-config/index.js +0 -331
  324. package/dist/types/autosuggestions-config/index.js.map +0 -1
  325. package/dist/types/autosuggestions-config/insertions-api-config.js +0 -103
  326. package/dist/types/autosuggestions-config/insertions-api-config.js.map +0 -1
  327. package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.js +0 -99
  328. package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.js.map +0 -1
  329. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js +0 -19
  330. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js.map +0 -1
  331. package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js +0 -19
  332. package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js.map +0 -1
  333. package/dist/types/autosuggestions-config/suggestions-api-config.js +0 -92
  334. package/dist/types/autosuggestions-config/suggestions-api-config.js.map +0 -1
  335. package/dist/types/base/autosuggestion-state.js +0 -19
  336. package/dist/types/base/autosuggestion-state.js.map +0 -1
  337. package/dist/types/base/autosuggestions-bare-function.js +0 -19
  338. package/dist/types/base/autosuggestions-bare-function.js.map +0 -1
  339. package/dist/types/base/base-autosuggestions-config.js +0 -38
  340. package/dist/types/base/base-autosuggestions-config.js.map +0 -1
  341. package/dist/types/base/base-copilot-textarea-props.js +0 -19
  342. package/dist/types/base/base-copilot-textarea-props.js.map +0 -1
  343. package/dist/types/base/custom-editor.js +0 -19
  344. package/dist/types/base/custom-editor.js.map +0 -1
  345. package/dist/types/base/editor-autocomplete-state.js +0 -45
  346. package/dist/types/base/editor-autocomplete-state.js.map +0 -1
  347. package/dist/types/base/index.js +0 -40
  348. package/dist/types/base/index.js.map +0 -1
  349. package/dist/types/html-copilot-textarea-element.js +0 -19
  350. package/dist/types/html-copilot-textarea-element.js.map +0 -1
  351. package/dist/types/index.js +0 -333
  352. package/dist/types/index.js.map +0 -1
@@ -1,331 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
- var __export = (target, all) => {
24
- for (var name in all)
25
- __defProp(target, name, { get: all[name], enumerable: true });
26
- };
27
- var __copyProps = (to, from, except, desc) => {
28
- if (from && typeof from === "object" || typeof from === "function") {
29
- for (let key of __getOwnPropNames(from))
30
- if (!__hasOwnProp.call(to, key) && key !== except)
31
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
- }
33
- return to;
34
- };
35
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
- var __async = (__this, __arguments, generator) => {
37
- return new Promise((resolve, reject) => {
38
- var fulfilled = (value) => {
39
- try {
40
- step(generator.next(value));
41
- } catch (e) {
42
- reject(e);
43
- }
44
- };
45
- var rejected = (value) => {
46
- try {
47
- step(generator.throw(value));
48
- } catch (e) {
49
- reject(e);
50
- }
51
- };
52
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
53
- step((generator = generator.apply(__this, __arguments)).next());
54
- });
55
- };
56
-
57
- // src/types/autosuggestions-config/index.ts
58
- var autosuggestions_config_exports = {};
59
- __export(autosuggestions_config_exports, {
60
- ChatlikeApiEndpoint: () => ChatlikeApiEndpoint,
61
- defaultAutosuggestionsConfig: () => defaultAutosuggestionsConfig
62
- });
63
- module.exports = __toCommonJS(autosuggestions_config_exports);
64
-
65
- // src/types/base/base-autosuggestions-config.tsx
66
- var defaultBaseAutosuggestionsConfig = {
67
- debounceTime: 250,
68
- contextCategories: ["global"],
69
- acceptAutosuggestionKey: "Tab",
70
- disableWhenEmpty: true,
71
- disabled: false,
72
- temporarilyDisableWhenMovingCursorWithoutChangingText: true
73
- };
74
-
75
- // src/types/autosuggestions-config/suggestions-api-config.tsx
76
- var defaultSuggestionsMakeSystemPrompt = (textareaPurpose, contextString) => {
77
- return `You are a versatile writing assistant.
78
-
79
- The user is writing some text.
80
- The purpose is: "${textareaPurpose}"
81
-
82
- Your job is to guess what the user will write next AS BEST YOU CAN.
83
- Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
84
-
85
- Adjust yourself to the user's style and implied intent.
86
-
87
- The user will provide both the text before and after the cursor. You should use this to infer what the user is likely to write next.
88
- <TextAfterCursor>
89
- <TextBeforeCursor>
90
- <YourSuggestion>
91
-
92
- If we need to add a whitespace character to the suggested text, make sure to explicitly add it in.
93
-
94
- The following external context is also provided. Use it to help you make better suggestions!!!
95
- \`\`\`
96
- ${contextString}
97
- \`\`\`
98
- `;
99
- };
100
- var defaultSuggestionsFewShotMessages = [
101
- {
102
- role: "user",
103
- name: "TextAfterCursor",
104
- content: "While I was there I also picked up some apples, oranges, and bananas."
105
- },
106
- {
107
- role: "user",
108
- content: "This morning I woke up and went straight to the grocery store."
109
- },
110
- {
111
- role: "assistant",
112
- content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
113
- },
114
- {
115
- role: "user",
116
- name: "TextAfterCursor",
117
- content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
118
- },
119
- {
120
- role: "user",
121
- name: "TextBeforeCursor",
122
- content: `The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;`
123
- },
124
- {
125
- role: "assistant",
126
- content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
127
- }
128
- ];
129
- var defaultSuggestionsApiConfig = {
130
- makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,
131
- fewShotMessages: defaultSuggestionsFewShotMessages,
132
- forwardedParams: void 0
133
- };
134
-
135
- // src/types/autosuggestions-config/insertions-api-config.tsx
136
- var defaultInsertionsMakeSystemPrompt = (textareaPurpose, contextString) => {
137
- return `You are a versatile writing assistant.
138
-
139
- The user is writing some text.
140
- The purpose is: "${textareaPurpose}"
141
-
142
- The following external context is also provided. Use it to help you make better suggestions!!!
143
- \`\`\`
144
- ${contextString}
145
- \`\`\`
146
-
147
- The user also provides you with a prompt for INSERTIONS into the text they are writing.
148
- Your job is to come up with an INSERTION into the text that the user would like AS BEST YOU CAN.
149
- Only insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.
150
-
151
- Adjust yourself to the user's style and implied intent.
152
-
153
- The user will provide the text before and after the cursor, as well as the insertion prompt. You should use this to infer the best relevant insertion.
154
- <TextAfterCursor>
155
- <TextBeforeCursor>
156
- <InsertionPrompt>
157
- <YourSuggestion>
158
- `;
159
- };
160
- var defaultInsertionsFewShotMessages = [
161
- {
162
- role: "user",
163
- name: "TextAfterCursor",
164
- content: "While I was there I also picked up some apples, oranges, and bananas."
165
- },
166
- {
167
- role: "user",
168
- name: "TextBeforeCursor",
169
- content: "This morning I woke up and went straight to the grocery store."
170
- },
171
- {
172
- role: "user",
173
- name: "InsertionPrompt",
174
- content: "I bought a big watermelon"
175
- },
176
- {
177
- role: "assistant",
178
- content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
179
- },
180
- {
181
- role: "user",
182
- name: "TextAfterCursor",
183
- content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
184
- },
185
- {
186
- role: "user",
187
- name: "TextBeforeCursor",
188
- content: `The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;`
189
- },
190
- {
191
- role: "user",
192
- name: "InsertionPrompt",
193
- content: "add section about the optionholder's pro rata share"
194
- },
195
- {
196
- role: "assistant",
197
- content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
198
- }
199
- ];
200
- var defaultInsertionsApiConfig = {
201
- makeSystemPrompt: defaultInsertionsMakeSystemPrompt,
202
- fewShotMessages: defaultInsertionsFewShotMessages,
203
- forwardedParams: void 0
204
- };
205
-
206
- // src/types/autosuggestions-config/editing-api-config.tsx
207
- var defaultEditingMakeSystemPrompt = (textareaPurpose, contextString) => {
208
- return `You are a versatile writing assistant.
209
-
210
- The user is writing some text.
211
- The purpose is: "${textareaPurpose}"
212
-
213
- The following external context is also provided. Use it to help you make better suggestions!!!
214
- \`\`\`
215
- ${contextString}
216
- \`\`\`
217
-
218
- The user also provides you with a prompt for EDITING some text they are writing.
219
- Your job is to come up with an EDIT of the text that the user would like to use - AS BEST YOU CAN.
220
-
221
- Adjust yourself to the user's style and implied intent.
222
-
223
- The user will provide the following information; use this to infer the best relevant EDIT:
224
- <TextBeforeCursor>
225
- <TextToEdit>
226
- <TextAfterCursor>
227
- <EditingPrompt>
228
-
229
- <YourEditSuggestion>
230
- `;
231
- };
232
- var defaultEditingFewShotMessages = [
233
- {
234
- role: "user",
235
- name: "TextBeforeCursor",
236
- content: "This morning I woke up and went straight to the grocery store. "
237
- },
238
- {
239
- role: "user",
240
- name: "TextToEdit",
241
- content: "While I was there I also picked up some apples, oranges, and bananas. "
242
- },
243
- {
244
- role: "user",
245
- name: "TextAfterCursor",
246
- content: "The grocery store was having a sale on fruit, so I decided to stock up."
247
- },
248
- {
249
- role: "user",
250
- name: "EditingPrompt",
251
- content: "I bought a big watermelon"
252
- },
253
- {
254
- role: "assistant",
255
- content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
256
- },
257
- {
258
- role: "user",
259
- name: "TextAfterCursor",
260
- content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
261
- },
262
- {
263
- role: "user",
264
- name: "TextBeforeCursor",
265
- content: `The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;`
266
- },
267
- {
268
- role: "user",
269
- name: "InsertionPrompt",
270
- content: "add section about the optionholder's pro rata share"
271
- },
272
- {
273
- role: "assistant",
274
- content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
275
- }
276
- ];
277
- var defaultEditingApiConfig = {
278
- makeSystemPrompt: defaultEditingMakeSystemPrompt,
279
- fewShotMessages: defaultEditingFewShotMessages,
280
- forwardedParams: void 0
281
- };
282
-
283
- // src/types/autosuggestions-config/autosuggestions-config.tsx
284
- var defaultAutosuggestionsConfig = __spreadProps(__spreadValues({}, defaultBaseAutosuggestionsConfig), {
285
- externalContextCategories: void 0,
286
- chatApiConfigs: {
287
- suggestionsApiConfig: defaultSuggestionsApiConfig,
288
- insertionApiConfig: defaultInsertionsApiConfig,
289
- editingApiConfig: defaultEditingApiConfig
290
- }
291
- });
292
-
293
- // src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx
294
- var import_react_core = require("@copilotkit/react-core");
295
- var ChatlikeApiEndpoint = class {
296
- constructor(run) {
297
- this.run = run;
298
- }
299
- static fromCopilotApiConfig(copilotApiConfig) {
300
- return new ChatlikeApiEndpoint(
301
- (abortSignal, messages, forwardedProps) => __async(this, null, function* () {
302
- const res = yield fetch(
303
- (0, import_react_core.copilotApiConfigExtrapolator)(copilotApiConfig).chatApiEndpoint,
304
- {
305
- method: "POST",
306
- headers: __spreadValues({}, copilotApiConfig.headers),
307
- body: JSON.stringify(__spreadProps(__spreadValues(__spreadValues({}, forwardedProps), copilotApiConfig.body), {
308
- messages
309
- })),
310
- signal: abortSignal
311
- }
312
- );
313
- const bodySteram = res.body;
314
- if (!bodySteram) {
315
- throw new Error("The response body is empty.");
316
- }
317
- const stringStream = bodySteram.pipeThrough(new TextDecoderStream());
318
- return stringStream;
319
- })
320
- );
321
- }
322
- static custom(run) {
323
- return new ChatlikeApiEndpoint(run);
324
- }
325
- };
326
- // Annotate the CommonJS export names for ESM import in node:
327
- 0 && (module.exports = {
328
- ChatlikeApiEndpoint,
329
- defaultAutosuggestionsConfig
330
- });
331
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/types/autosuggestions-config/index.ts","../../../src/types/base/base-autosuggestions-config.tsx","../../../src/types/autosuggestions-config/suggestions-api-config.tsx","../../../src/types/autosuggestions-config/insertions-api-config.tsx","../../../src/types/autosuggestions-config/editing-api-config.tsx","../../../src/types/autosuggestions-config/autosuggestions-config.tsx","../../../src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx"],"sourcesContent":["export { defaultAutosuggestionsConfig } from \"./autosuggestions-config\";\nexport type { AutosuggestionsConfig } from \"./autosuggestions-config\";\n\nexport type { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\nexport type { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nexport { ChatlikeApiEndpoint } from \"./subtypes/chatlike-api-endpoint\";\nexport type { ChatlikeApiEndpointImpl } from \"./subtypes/chatlike-api-endpoint\";\n\nexport type { AutosuggestionsConfigUserSpecified } from \"./autosuggestions-config-user-specified\";\nexport type { SuggestionsApiConfigUserSpecified } from \"./autosuggestions-config-user-specified\";\nexport type { InsertionsApiConfigUserSpecified } from \"./autosuggestions-config-user-specified\";\n","import { BaseCopilotTextareaApiConfig } from \"./autosuggestions-bare-function\";\n\nexport interface BaseAutosuggestionsConfig {\n textareaPurpose: string;\n contextCategories: string[];\n debounceTime: number;\n acceptAutosuggestionKey: string;\n disableWhenEmpty: boolean;\n disabled: boolean;\n temporarilyDisableWhenMovingCursorWithoutChangingText: boolean;\n apiConfig: BaseCopilotTextareaApiConfig;\n}\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"textareaPurpose\" | \"apiConfig\"\n> = {\n debounceTime: 250,\n contextCategories: [\"global\"],\n acceptAutosuggestionKey: \"Tab\",\n disableWhenEmpty: true,\n disabled: false,\n temporarilyDisableWhenMovingCursorWithoutChangingText: true,\n};\n","import { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\n\nexport interface SuggestionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultSuggestionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nYour job is to guess what the user will write next AS BEST YOU CAN.\nOnly guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide both the text before and after the cursor. You should use this to infer what the user is likely to write next.\n<TextAfterCursor>\n<TextBeforeCursor>\n<YourSuggestion>\n\nIf we need to add a whitespace character to the suggested text, make sure to explicitly add it in.\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n`;\n};\n\nexport const defaultSuggestionsFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"While I was there I also picked up some apples, oranges, and bananas.\",\n },\n {\n role: \"user\",\n content: \"This morning I woke up and went straight to the grocery store.\",\n },\n {\n role: \"assistant\",\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content:\n 'The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;',\n },\n {\n role: \"assistant\",\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n },\n];\n\nexport const defaultSuggestionsApiConfig: SuggestionsApiConfig = {\n makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,\n fewShotMessages: defaultSuggestionsFewShotMessages,\n forwardedParams: undefined,\n};\n","import { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\n\nexport interface InsertionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultInsertionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user also provides you with a prompt for INSERTIONS into the text they are writing. \nYour job is to come up with an INSERTION into the text that the user would like AS BEST YOU CAN.\nOnly insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide the text before and after the cursor, as well as the insertion prompt. You should use this to infer the best relevant insertion.\n<TextAfterCursor>\n<TextBeforeCursor>\n<InsertionPrompt>\n<YourSuggestion>\n`;\n};\n\nexport const defaultInsertionsFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"While I was there I also picked up some apples, oranges, and bananas.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: \"This morning I woke up and went straight to the grocery store.\",\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: \"I bought a big watermelon\",\n },\n {\n role: \"assistant\",\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content:\n 'The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;',\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: \"add section about the optionholder's pro rata share\",\n },\n {\n role: \"assistant\",\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n },\n];\n\nexport const defaultInsertionsApiConfig: InsertionsApiConfig = {\n makeSystemPrompt: defaultInsertionsMakeSystemPrompt,\n fewShotMessages: defaultInsertionsFewShotMessages,\n forwardedParams: undefined,\n};\n","import { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\n\nexport interface EditingApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultEditingMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user also provides you with a prompt for EDITING some text they are writing. \nYour job is to come up with an EDIT of the text that the user would like to use - AS BEST YOU CAN.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide the following information; use this to infer the best relevant EDIT:\n<TextBeforeCursor>\n<TextToEdit>\n<TextAfterCursor>\n<EditingPrompt>\n\n<YourEditSuggestion>\n`;\n};\n\nexport const defaultEditingFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: \"This morning I woke up and went straight to the grocery store. \",\n },\n {\n role: \"user\",\n name: \"TextToEdit\",\n content:\n \"While I was there I also picked up some apples, oranges, and bananas. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"The grocery store was having a sale on fruit, so I decided to stock up.\",\n },\n {\n role: \"user\",\n name: \"EditingPrompt\",\n content: \"I bought a big watermelon\",\n },\n {\n role: \"assistant\",\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content:\n 'The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;',\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: \"add section about the optionholder's pro rata share\",\n },\n {\n role: \"assistant\",\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n },\n];\n\nexport const defaultEditingApiConfig: EditingApiConfig = {\n makeSystemPrompt: defaultEditingMakeSystemPrompt,\n fewShotMessages: defaultEditingFewShotMessages,\n forwardedParams: undefined,\n};\n","import {\n BaseAutosuggestionsConfig,\n defaultBaseAutosuggestionsConfig,\n} from \"../base\";\nimport {\n SuggestionsApiConfig,\n defaultSuggestionsApiConfig,\n} from \"./suggestions-api-config\";\nimport {\n InsertionsApiConfig,\n defaultInsertionsApiConfig,\n} from \"./insertions-api-config\";\nimport { ChatlikeApiEndpoint } from \".\";\nimport {\n EditingApiConfig,\n defaultEditingApiConfig,\n} from \"./editing-api-config\";\n\n// Like the base autosuggestions config, with 2 additional fields:\n// 1. externalContextCategories: string[] | undefined;\n// 2. instead of apiConfigs, we have chatApiConfigs: a higher-level abstraction that uses a ChatGPT-like API endpoint.\nexport interface AutosuggestionsConfig\n extends Omit<BaseAutosuggestionsConfig, \"apiConfig\"> {\n externalContextCategories: string[] | undefined;\n chatApiConfigs: {\n suggestionsApiConfig: SuggestionsApiConfig;\n insertionApiConfig: InsertionsApiConfig;\n editingApiConfig: EditingApiConfig;\n };\n}\n\nexport const defaultAutosuggestionsConfig: Omit<\n AutosuggestionsConfig,\n \"textareaPurpose\" | \"apiEndpoint\"\n> = {\n ...defaultBaseAutosuggestionsConfig,\n externalContextCategories: undefined,\n chatApiConfigs: {\n suggestionsApiConfig: defaultSuggestionsApiConfig,\n insertionApiConfig: defaultInsertionsApiConfig,\n editingApiConfig: defaultEditingApiConfig,\n },\n};\n","import {\n CopilotApiConfig,\n copilotApiConfigExtrapolator,\n} from \"@copilotkit/react-core\";\nimport { MinimalChatGPTMessage } from \"./minimal-chat-gpt-message\";\n\nexport type ChatlikeApiEndpointImpl = (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n) => Promise<string>;\n\nexport type StreamingChatlikeApiEndpointImpl = (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n) => Promise<ReadableStream<string>>;\n\nexport class ChatlikeApiEndpoint {\n public run: StreamingChatlikeApiEndpointImpl;\n\n constructor(run: StreamingChatlikeApiEndpointImpl) {\n this.run = run;\n }\n\n /**\n * Creates a new instance of ChatlikeApiEndpoint with the provided API endpoint.\n * @param apiEndpoint The URL of the OpenAI-compatible API endpoint.\n * @returns A new instance of ChatlikeApiEndpoint.\n */\n static fromCopilotApiConfig(\n copilotApiConfig: CopilotApiConfig\n ): ChatlikeApiEndpoint {\n return new ChatlikeApiEndpoint(\n async (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n ) => {\n const res = await fetch(\n copilotApiConfigExtrapolator(copilotApiConfig).chatApiEndpoint,\n {\n method: \"POST\",\n headers: {\n ...copilotApiConfig.headers,\n },\n body: JSON.stringify({\n ...forwardedProps,\n ...copilotApiConfig.body,\n messages: messages,\n }),\n signal: abortSignal,\n }\n );\n\n const bodySteram: ReadableStream<Uint8Array> | null = res.body;\n if (!bodySteram) {\n throw new Error(\"The response body is empty.\");\n }\n\n // map the stream to a stream of strings\n const stringStream = bodySteram.pipeThrough(new TextDecoderStream());\n\n return stringStream;\n }\n );\n }\n\n /**\n * Creates a fully customized instance of ChatlikeApiEndpoint.\n * @param run - The implementation of the ChatlikeApiEndpointImpl interface.\n * @returns A new instance of ChatlikeApiEndpoint .\n */\n static custom(run: StreamingChatlikeApiEndpointImpl): ChatlikeApiEndpoint {\n return new ChatlikeApiEndpoint(run);\n }\n}\n"],"mappings":"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","names":[]}
@@ -1,103 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/types/autosuggestions-config/insertions-api-config.tsx
21
- var insertions_api_config_exports = {};
22
- __export(insertions_api_config_exports, {
23
- defaultInsertionsApiConfig: () => defaultInsertionsApiConfig,
24
- defaultInsertionsFewShotMessages: () => defaultInsertionsFewShotMessages,
25
- defaultInsertionsMakeSystemPrompt: () => defaultInsertionsMakeSystemPrompt
26
- });
27
- module.exports = __toCommonJS(insertions_api_config_exports);
28
- var defaultInsertionsMakeSystemPrompt = (textareaPurpose, contextString) => {
29
- return `You are a versatile writing assistant.
30
-
31
- The user is writing some text.
32
- The purpose is: "${textareaPurpose}"
33
-
34
- The following external context is also provided. Use it to help you make better suggestions!!!
35
- \`\`\`
36
- ${contextString}
37
- \`\`\`
38
-
39
- The user also provides you with a prompt for INSERTIONS into the text they are writing.
40
- Your job is to come up with an INSERTION into the text that the user would like AS BEST YOU CAN.
41
- Only insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.
42
-
43
- Adjust yourself to the user's style and implied intent.
44
-
45
- The user will provide the text before and after the cursor, as well as the insertion prompt. You should use this to infer the best relevant insertion.
46
- <TextAfterCursor>
47
- <TextBeforeCursor>
48
- <InsertionPrompt>
49
- <YourSuggestion>
50
- `;
51
- };
52
- var defaultInsertionsFewShotMessages = [
53
- {
54
- role: "user",
55
- name: "TextAfterCursor",
56
- content: "While I was there I also picked up some apples, oranges, and bananas."
57
- },
58
- {
59
- role: "user",
60
- name: "TextBeforeCursor",
61
- content: "This morning I woke up and went straight to the grocery store."
62
- },
63
- {
64
- role: "user",
65
- name: "InsertionPrompt",
66
- content: "I bought a big watermelon"
67
- },
68
- {
69
- role: "assistant",
70
- content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
71
- },
72
- {
73
- role: "user",
74
- name: "TextAfterCursor",
75
- content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
76
- },
77
- {
78
- role: "user",
79
- name: "TextBeforeCursor",
80
- content: `The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;`
81
- },
82
- {
83
- role: "user",
84
- name: "InsertionPrompt",
85
- content: "add section about the optionholder's pro rata share"
86
- },
87
- {
88
- role: "assistant",
89
- content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
90
- }
91
- ];
92
- var defaultInsertionsApiConfig = {
93
- makeSystemPrompt: defaultInsertionsMakeSystemPrompt,
94
- fewShotMessages: defaultInsertionsFewShotMessages,
95
- forwardedParams: void 0
96
- };
97
- // Annotate the CommonJS export names for ESM import in node:
98
- 0 && (module.exports = {
99
- defaultInsertionsApiConfig,
100
- defaultInsertionsFewShotMessages,
101
- defaultInsertionsMakeSystemPrompt
102
- });
103
- //# sourceMappingURL=insertions-api-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/types/autosuggestions-config/insertions-api-config.tsx"],"sourcesContent":["import { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\n\nexport interface InsertionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultInsertionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user also provides you with a prompt for INSERTIONS into the text they are writing. \nYour job is to come up with an INSERTION into the text that the user would like AS BEST YOU CAN.\nOnly insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide the text before and after the cursor, as well as the insertion prompt. You should use this to infer the best relevant insertion.\n<TextAfterCursor>\n<TextBeforeCursor>\n<InsertionPrompt>\n<YourSuggestion>\n`;\n};\n\nexport const defaultInsertionsFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"While I was there I also picked up some apples, oranges, and bananas.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: \"This morning I woke up and went straight to the grocery store.\",\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: \"I bought a big watermelon\",\n },\n {\n role: \"assistant\",\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content:\n 'The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;',\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: \"add section about the optionholder's pro rata share\",\n },\n {\n role: \"assistant\",\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n },\n];\n\nexport const defaultInsertionsApiConfig: InsertionsApiConfig = {\n makeSystemPrompt: defaultInsertionsMakeSystemPrompt,\n fewShotMessages: defaultInsertionsFewShotMessages,\n forwardedParams: undefined,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,oCAAsD,CACjE,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA,EAIlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeF;AAEO,IAAM,mCAA4D;AAAA,EACvE;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AACF;AAEO,IAAM,6BAAkD;AAAA,EAC7D,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB;","names":[]}
@@ -1,99 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
- var __export = (target, all) => {
24
- for (var name in all)
25
- __defProp(target, name, { get: all[name], enumerable: true });
26
- };
27
- var __copyProps = (to, from, except, desc) => {
28
- if (from && typeof from === "object" || typeof from === "function") {
29
- for (let key of __getOwnPropNames(from))
30
- if (!__hasOwnProp.call(to, key) && key !== except)
31
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
- }
33
- return to;
34
- };
35
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
- var __async = (__this, __arguments, generator) => {
37
- return new Promise((resolve, reject) => {
38
- var fulfilled = (value) => {
39
- try {
40
- step(generator.next(value));
41
- } catch (e) {
42
- reject(e);
43
- }
44
- };
45
- var rejected = (value) => {
46
- try {
47
- step(generator.throw(value));
48
- } catch (e) {
49
- reject(e);
50
- }
51
- };
52
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
53
- step((generator = generator.apply(__this, __arguments)).next());
54
- });
55
- };
56
-
57
- // src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx
58
- var chatlike_api_endpoint_exports = {};
59
- __export(chatlike_api_endpoint_exports, {
60
- ChatlikeApiEndpoint: () => ChatlikeApiEndpoint
61
- });
62
- module.exports = __toCommonJS(chatlike_api_endpoint_exports);
63
- var import_react_core = require("@copilotkit/react-core");
64
- var ChatlikeApiEndpoint = class {
65
- constructor(run) {
66
- this.run = run;
67
- }
68
- static fromCopilotApiConfig(copilotApiConfig) {
69
- return new ChatlikeApiEndpoint(
70
- (abortSignal, messages, forwardedProps) => __async(this, null, function* () {
71
- const res = yield fetch(
72
- (0, import_react_core.copilotApiConfigExtrapolator)(copilotApiConfig).chatApiEndpoint,
73
- {
74
- method: "POST",
75
- headers: __spreadValues({}, copilotApiConfig.headers),
76
- body: JSON.stringify(__spreadProps(__spreadValues(__spreadValues({}, forwardedProps), copilotApiConfig.body), {
77
- messages
78
- })),
79
- signal: abortSignal
80
- }
81
- );
82
- const bodySteram = res.body;
83
- if (!bodySteram) {
84
- throw new Error("The response body is empty.");
85
- }
86
- const stringStream = bodySteram.pipeThrough(new TextDecoderStream());
87
- return stringStream;
88
- })
89
- );
90
- }
91
- static custom(run) {
92
- return new ChatlikeApiEndpoint(run);
93
- }
94
- };
95
- // Annotate the CommonJS export names for ESM import in node:
96
- 0 && (module.exports = {
97
- ChatlikeApiEndpoint
98
- });
99
- //# sourceMappingURL=chatlike-api-endpoint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx"],"sourcesContent":["import {\n CopilotApiConfig,\n copilotApiConfigExtrapolator,\n} from \"@copilotkit/react-core\";\nimport { MinimalChatGPTMessage } from \"./minimal-chat-gpt-message\";\n\nexport type ChatlikeApiEndpointImpl = (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n) => Promise<string>;\n\nexport type StreamingChatlikeApiEndpointImpl = (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n) => Promise<ReadableStream<string>>;\n\nexport class ChatlikeApiEndpoint {\n public run: StreamingChatlikeApiEndpointImpl;\n\n constructor(run: StreamingChatlikeApiEndpointImpl) {\n this.run = run;\n }\n\n /**\n * Creates a new instance of ChatlikeApiEndpoint with the provided API endpoint.\n * @param apiEndpoint The URL of the OpenAI-compatible API endpoint.\n * @returns A new instance of ChatlikeApiEndpoint.\n */\n static fromCopilotApiConfig(\n copilotApiConfig: CopilotApiConfig\n ): ChatlikeApiEndpoint {\n return new ChatlikeApiEndpoint(\n async (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n ) => {\n const res = await fetch(\n copilotApiConfigExtrapolator(copilotApiConfig).chatApiEndpoint,\n {\n method: \"POST\",\n headers: {\n ...copilotApiConfig.headers,\n },\n body: JSON.stringify({\n ...forwardedProps,\n ...copilotApiConfig.body,\n messages: messages,\n }),\n signal: abortSignal,\n }\n );\n\n const bodySteram: ReadableStream<Uint8Array> | null = res.body;\n if (!bodySteram) {\n throw new Error(\"The response body is empty.\");\n }\n\n // map the stream to a stream of strings\n const stringStream = bodySteram.pipeThrough(new TextDecoderStream());\n\n return stringStream;\n }\n );\n }\n\n /**\n * Creates a fully customized instance of ChatlikeApiEndpoint.\n * @param run - The implementation of the ChatlikeApiEndpointImpl interface.\n * @returns A new instance of ChatlikeApiEndpoint .\n */\n static custom(run: StreamingChatlikeApiEndpointImpl): ChatlikeApiEndpoint {\n return new ChatlikeApiEndpoint(run);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAGO;AAeA,IAAM,sBAAN,MAA0B;AAAA,EAG/B,YAAY,KAAuC;AACjD,SAAK,MAAM;AAAA,EACb;AAAA,EAOA,OAAO,qBACL,kBACqB;AACrB,WAAO,IAAI;AAAA,MACT,CACE,aACA,UACA,mBACG;AACH,cAAM,MAAM,MAAM;AAAA,cAChB,gDAA6B,gBAAgB,EAAE;AAAA,UAC/C;AAAA,YACE,QAAQ;AAAA,YACR,SAAS,mBACJ,iBAAiB;AAAA,YAEtB,MAAM,KAAK,UAAU,gDAChB,iBACA,iBAAiB,OAFD;AAAA,cAGnB;AAAA,YACF,EAAC;AAAA,YACD,QAAQ;AAAA,UACV;AAAA,QACF;AAEA,cAAM,aAAgD,IAAI;AAC1D,YAAI,CAAC,YAAY;AACf,gBAAM,IAAI,MAAM,6BAA6B;AAAA,QAC/C;AAGA,cAAM,eAAe,WAAW,YAAY,IAAI,kBAAkB,CAAC;AAEnE,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAAA,EAOA,OAAO,OAAO,KAA4D;AACxE,WAAO,IAAI,oBAAoB,GAAG;AAAA,EACpC;AACF;","names":[]}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/types/autosuggestions-config/subtypes/make-system-prompt.ts
17
- var make_system_prompt_exports = {};
18
- module.exports = __toCommonJS(make_system_prompt_exports);
19
- //# sourceMappingURL=make-system-prompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/types/autosuggestions-config/subtypes/make-system-prompt.ts"],"sourcesContent":["export type MakeSystemPrompt = (\n textareaPurpose: string,\n contextString: string\n) => string;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.tsx
17
- var minimal_chat_gpt_message_exports = {};
18
- module.exports = __toCommonJS(minimal_chat_gpt_message_exports);
19
- //# sourceMappingURL=minimal-chat-gpt-message.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.tsx"],"sourcesContent":["export interface MinimalChatGPTMessage {\n role: string;\n content: string;\n name?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}