@copilotkit/react-textarea 0.0.0-feat-dynamic-copilotcloud-qa-20250117190454
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/CHANGELOG.md +2456 -0
- package/README.md +46 -0
- package/dist/chunk-23Q6A46J.mjs +103 -0
- package/dist/chunk-23Q6A46J.mjs.map +1 -0
- package/dist/chunk-2C7O2EVM.mjs +27 -0
- package/dist/chunk-2C7O2EVM.mjs.map +1 -0
- package/dist/chunk-2QDCE7PD.mjs +32 -0
- package/dist/chunk-2QDCE7PD.mjs.map +1 -0
- package/dist/chunk-2VMZ5ZWT.mjs +229 -0
- package/dist/chunk-2VMZ5ZWT.mjs.map +1 -0
- package/dist/chunk-3PQ7GSFE.mjs +17 -0
- package/dist/chunk-3PQ7GSFE.mjs.map +1 -0
- package/dist/chunk-4CVSOOJY.mjs +30 -0
- package/dist/chunk-4CVSOOJY.mjs.map +1 -0
- package/dist/chunk-4NHVQZ67.mjs +108 -0
- package/dist/chunk-4NHVQZ67.mjs.map +1 -0
- package/dist/chunk-4PDYALMP.mjs +52 -0
- package/dist/chunk-4PDYALMP.mjs.map +1 -0
- package/dist/chunk-4XXU5BSA.mjs +125 -0
- package/dist/chunk-4XXU5BSA.mjs.map +1 -0
- package/dist/chunk-5UNJXFUO.mjs +29 -0
- package/dist/chunk-5UNJXFUO.mjs.map +1 -0
- package/dist/chunk-7L6GIHDM.mjs +39 -0
- package/dist/chunk-7L6GIHDM.mjs.map +1 -0
- package/dist/chunk-7LSRNPNI.mjs +59 -0
- package/dist/chunk-7LSRNPNI.mjs.map +1 -0
- package/dist/chunk-ABYCGF77.mjs +31 -0
- package/dist/chunk-ABYCGF77.mjs.map +1 -0
- package/dist/chunk-AJ5OMEXM.mjs +13 -0
- package/dist/chunk-AJ5OMEXM.mjs.map +1 -0
- package/dist/chunk-BNBGJBBM.mjs +60 -0
- package/dist/chunk-BNBGJBBM.mjs.map +1 -0
- package/dist/chunk-D47EKHIF.mjs +26 -0
- package/dist/chunk-D47EKHIF.mjs.map +1 -0
- package/dist/chunk-DE5K76I2.mjs +1 -0
- package/dist/chunk-DE5K76I2.mjs.map +1 -0
- package/dist/chunk-DFTV4TST.mjs +36 -0
- package/dist/chunk-DFTV4TST.mjs.map +1 -0
- package/dist/chunk-DRV2FOHZ.mjs +70 -0
- package/dist/chunk-DRV2FOHZ.mjs.map +1 -0
- package/dist/chunk-ECR45NSD.mjs +104 -0
- package/dist/chunk-ECR45NSD.mjs.map +1 -0
- package/dist/chunk-EJGGLWWR.mjs +82 -0
- package/dist/chunk-EJGGLWWR.mjs.map +1 -0
- package/dist/chunk-F6GMWOLE.mjs +93 -0
- package/dist/chunk-F6GMWOLE.mjs.map +1 -0
- package/dist/chunk-GQN2HYFJ.mjs +22 -0
- package/dist/chunk-GQN2HYFJ.mjs.map +1 -0
- package/dist/chunk-H4VKQGVU.mjs +1 -0
- package/dist/chunk-H4VKQGVU.mjs.map +1 -0
- package/dist/chunk-HDBI2WN5.mjs +113 -0
- package/dist/chunk-HDBI2WN5.mjs.map +1 -0
- package/dist/chunk-I72DKFHD.mjs +114 -0
- package/dist/chunk-I72DKFHD.mjs.map +1 -0
- package/dist/chunk-IU3WTXLQ.mjs +1 -0
- package/dist/chunk-IU3WTXLQ.mjs.map +1 -0
- package/dist/chunk-KMVGEY7Q.mjs +51 -0
- package/dist/chunk-KMVGEY7Q.mjs.map +1 -0
- package/dist/chunk-KNQIEOFP.mjs +19 -0
- package/dist/chunk-KNQIEOFP.mjs.map +1 -0
- package/dist/chunk-L7VVZH4Q.mjs +1 -0
- package/dist/chunk-L7VVZH4Q.mjs.map +1 -0
- package/dist/chunk-LQ2OWQU7.mjs +49 -0
- package/dist/chunk-LQ2OWQU7.mjs.map +1 -0
- package/dist/chunk-LYB4B6MK.mjs +19 -0
- package/dist/chunk-LYB4B6MK.mjs.map +1 -0
- package/dist/chunk-MCNXIA4Q.mjs +75 -0
- package/dist/chunk-MCNXIA4Q.mjs.map +1 -0
- package/dist/chunk-MGYT7RNL.mjs +32 -0
- package/dist/chunk-MGYT7RNL.mjs.map +1 -0
- package/dist/chunk-MMVDU6DF.mjs +1 -0
- package/dist/chunk-MMVDU6DF.mjs.map +1 -0
- package/dist/chunk-MRXNTQOX.mjs +59 -0
- package/dist/chunk-MRXNTQOX.mjs.map +1 -0
- package/dist/chunk-PZYM7K4Y.mjs +265 -0
- package/dist/chunk-PZYM7K4Y.mjs.map +1 -0
- package/dist/chunk-QFXR6DOA.mjs +64 -0
- package/dist/chunk-QFXR6DOA.mjs.map +1 -0
- package/dist/chunk-QJNFNPWH.mjs +85 -0
- package/dist/chunk-QJNFNPWH.mjs.map +1 -0
- package/dist/chunk-RUV6NBIF.mjs +1 -0
- package/dist/chunk-RUV6NBIF.mjs.map +1 -0
- package/dist/chunk-RXV67GJN.mjs +168 -0
- package/dist/chunk-RXV67GJN.mjs.map +1 -0
- package/dist/chunk-T6MTDQZ7.mjs +45 -0
- package/dist/chunk-T6MTDQZ7.mjs.map +1 -0
- package/dist/chunk-VSVQZUPW.mjs +124 -0
- package/dist/chunk-VSVQZUPW.mjs.map +1 -0
- package/dist/chunk-WADHCMPK.mjs +1 -0
- package/dist/chunk-WADHCMPK.mjs.map +1 -0
- package/dist/chunk-WGWQRALG.mjs +83 -0
- package/dist/chunk-WGWQRALG.mjs.map +1 -0
- package/dist/chunk-WJHSY5T6.mjs +1 -0
- package/dist/chunk-WJHSY5T6.mjs.map +1 -0
- package/dist/chunk-XW3ICO4S.mjs +25 -0
- package/dist/chunk-XW3ICO4S.mjs.map +1 -0
- package/dist/chunk-YLFAIYRY.mjs +50 -0
- package/dist/chunk-YLFAIYRY.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.css +9 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.css.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +43 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +1795 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +40 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/render-element.d.ts +6 -0
- package/dist/components/base-copilot-textarea/render-element.js +75 -0
- package/dist/components/base-copilot-textarea/render-element.js.map +1 -0
- package/dist/components/base-copilot-textarea/render-element.mjs +8 -0
- package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/render-placeholder.d.ts +6 -0
- package/dist/components/base-copilot-textarea/render-placeholder.js +72 -0
- package/dist/components/base-copilot-textarea/render-placeholder.js.map +1 -0
- package/dist/components/base-copilot-textarea/render-placeholder.mjs +8 -0
- package/dist/components/base-copilot-textarea/render-placeholder.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.d.ts +8 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js +112 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +1 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +9 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.d.ts +3 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.js +83 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.js.map +1 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +8 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -0
- package/dist/components/copilot-textarea/copilot-textarea.css +9 -0
- package/dist/components/copilot-textarea/copilot-textarea.css.map +1 -0
- package/dist/components/copilot-textarea/copilot-textarea.d.ts +171 -0
- package/dist/components/copilot-textarea/copilot-textarea.js +2289 -0
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -0
- package/dist/components/copilot-textarea/copilot-textarea.mjs +49 -0
- package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -0
- package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +18 -0
- package/dist/components/hovering-toolbar/hovering-editor-provider.js +44 -0
- package/dist/components/hovering-toolbar/hovering-editor-provider.js.map +1 -0
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +10 -0
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.d.ts +18 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js +174 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +16 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +12 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.js +912 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +23 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.ts +16 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +606 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +18 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +14 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +629 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +19 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.d.ts +16 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +133 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +12 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.d.ts +4 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +629 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +20 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -0
- package/dist/components/index.css +9 -0
- package/dist/components/index.css.map +1 -0
- package/dist/components/index.d.ts +15 -0
- package/dist/components/index.js +2293 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +53 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/components/manual-ui/chip-with-icon.d.ts +10 -0
- package/dist/components/manual-ui/chip-with-icon.js +38 -0
- package/dist/components/manual-ui/chip-with-icon.js.map +1 -0
- package/dist/components/manual-ui/chip-with-icon.mjs +15 -0
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -0
- package/dist/components/source-search-box/source-search-box.d.ts +16 -0
- package/dist/components/source-search-box/source-search-box.js +240 -0
- package/dist/components/source-search-box/source-search-box.js.map +1 -0
- package/dist/components/source-search-box/source-search-box.mjs +13 -0
- package/dist/components/source-search-box/source-search-box.mjs.map +1 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.js +114 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/button.mjs +11 -0
- package/dist/components/ui/button.mjs.map +1 -0
- package/dist/components/ui/command.d.ts +53 -0
- package/dist/components/ui/command.js +285 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/command.mjs +26 -0
- package/dist/components/ui/command.mjs.map +1 -0
- package/dist/components/ui/dialog.d.ts +19 -0
- package/dist/components/ui/dialog.js +183 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dialog.mjs +21 -0
- package/dist/components/ui/dialog.mjs.map +1 -0
- package/dist/components/ui/label.d.ts +8 -0
- package/dist/components/ui/label.js +87 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/label.mjs +9 -0
- package/dist/components/ui/label.mjs.map +1 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +19 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/index.mjs +2 -0
- package/dist/context/index.mjs.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +15 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js +180 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +11 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.d.ts +8 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js +194 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +9 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.ts +7 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js +180 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +10 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +19 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +2 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +22 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +153 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +9 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +23 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +228 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +9 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -0
- package/dist/hooks/misc/use-autosize-textarea.d.ts +5 -0
- package/dist/hooks/misc/use-autosize-textarea.js +37 -0
- package/dist/hooks/misc/use-autosize-textarea.js.map +1 -0
- package/dist/hooks/misc/use-autosize-textarea.mjs +8 -0
- package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -0
- package/dist/index.css +644 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +2298 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +64 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/debouncer.d.ts +11 -0
- package/dist/lib/debouncer.js +76 -0
- package/dist/lib/debouncer.js.map +1 -0
- package/dist/lib/debouncer.mjs +8 -0
- package/dist/lib/debouncer.mjs.map +1 -0
- package/dist/lib/editor-to-text.d.ts +7 -0
- package/dist/lib/editor-to-text.js +69 -0
- package/dist/lib/editor-to-text.js.map +1 -0
- package/dist/lib/editor-to-text.mjs +8 -0
- package/dist/lib/editor-to-text.mjs.map +1 -0
- package/dist/lib/get-text-around-cursor.d.ts +15 -0
- package/dist/lib/get-text-around-cursor.js +131 -0
- package/dist/lib/get-text-around-cursor.js.map +1 -0
- package/dist/lib/get-text-around-cursor.mjs +14 -0
- package/dist/lib/get-text-around-cursor.mjs.map +1 -0
- package/dist/lib/retry.d.ts +3 -0
- package/dist/lib/retry.js +43 -0
- package/dist/lib/retry.js.map +1 -0
- package/dist/lib/retry.mjs +8 -0
- package/dist/lib/retry.mjs.map +1 -0
- package/dist/lib/slatejs-edits/add-autocompletions.d.ts +8 -0
- package/dist/lib/slatejs-edits/add-autocompletions.js +51 -0
- package/dist/lib/slatejs-edits/add-autocompletions.js.map +1 -0
- package/dist/lib/slatejs-edits/add-autocompletions.mjs +8 -0
- package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.d.ts +8 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.js +46 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.js.map +1 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs +8 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -0
- package/dist/lib/slatejs-edits/replace-text.d.ts +5 -0
- package/dist/lib/slatejs-edits/replace-text.js +53 -0
- package/dist/lib/slatejs-edits/replace-text.js.map +1 -0
- package/dist/lib/slatejs-edits/replace-text.mjs +8 -0
- package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -0
- package/dist/lib/slatejs-edits/with-partial-history.d.ts +8 -0
- package/dist/lib/slatejs-edits/with-partial-history.js +133 -0
- package/dist/lib/slatejs-edits/with-partial-history.js.map +1 -0
- package/dist/lib/slatejs-edits/with-partial-history.mjs +10 -0
- package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -0
- package/dist/lib/stream-promise-flatten.d.ts +12 -0
- package/dist/lib/stream-promise-flatten.js +72 -0
- package/dist/lib/stream-promise-flatten.js.map +1 -0
- package/dist/lib/stream-promise-flatten.mjs +8 -0
- package/dist/lib/stream-promise-flatten.mjs.map +1 -0
- package/dist/lib/utils.d.ts +9 -0
- package/dist/lib/utils.js +94 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.mjs +16 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/dist/lib/utils.test.d.ts +2 -0
- package/dist/lib/utils.test.js +9 -0
- package/dist/lib/utils.test.js.map +1 -0
- package/dist/lib/utils.test.mjs +7 -0
- package/dist/lib/utils.test.mjs.map +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +23 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js +19 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js.map +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs.map +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +20 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.js +287 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +13 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -0
- package/dist/types/autosuggestions-config/editing-api-config.d.ts +15 -0
- package/dist/types/autosuggestions-config/editing-api-config.js +108 -0
- package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -0
- package/dist/types/autosuggestions-config/editing-api-config.mjs +12 -0
- package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -0
- package/dist/types/autosuggestions-config/index.d.ts +10 -0
- package/dist/types/autosuggestions-config/index.js +287 -0
- package/dist/types/autosuggestions-config/index.js.map +1 -0
- package/dist/types/autosuggestions-config/index.mjs +14 -0
- package/dist/types/autosuggestions-config/index.mjs.map +1 -0
- package/dist/types/autosuggestions-config/insertions-api-config.d.ts +15 -0
- package/dist/types/autosuggestions-config/insertions-api-config.js +101 -0
- package/dist/types/autosuggestions-config/insertions-api-config.js.map +1 -0
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +12 -0
- package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.ts +3 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js +19 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js.map +1 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs +1 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs.map +1 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.d.ts +15 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.js +90 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.js.map +1 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +12 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -0
- package/dist/types/base/autosuggestion-state.d.ts +8 -0
- package/dist/types/base/autosuggestion-state.js +19 -0
- package/dist/types/base/autosuggestion-state.js.map +1 -0
- package/dist/types/base/autosuggestion-state.mjs +1 -0
- package/dist/types/base/autosuggestion-state.mjs.map +1 -0
- package/dist/types/base/autosuggestions-bare-function.d.ts +19 -0
- package/dist/types/base/autosuggestions-bare-function.js +19 -0
- package/dist/types/base/autosuggestions-bare-function.js.map +1 -0
- package/dist/types/base/autosuggestions-bare-function.mjs +1 -0
- package/dist/types/base/autosuggestions-bare-function.mjs.map +1 -0
- package/dist/types/base/base-autosuggestions-config.d.ts +83 -0
- package/dist/types/base/base-autosuggestions-config.js +54 -0
- package/dist/types/base/base-autosuggestions-config.js.map +1 -0
- package/dist/types/base/base-autosuggestions-config.mjs +8 -0
- package/dist/types/base/base-autosuggestions-config.mjs.map +1 -0
- package/dist/types/base/base-copilot-textarea-props.d.ts +5 -0
- package/dist/types/base/base-copilot-textarea-props.js +19 -0
- package/dist/types/base/base-copilot-textarea-props.js.map +1 -0
- package/dist/types/base/base-copilot-textarea-props.mjs +1 -0
- package/dist/types/base/base-copilot-textarea-props.mjs.map +1 -0
- package/dist/types/base/custom-editor.d.ts +29 -0
- package/dist/types/base/custom-editor.js +19 -0
- package/dist/types/base/custom-editor.js.map +1 -0
- package/dist/types/base/custom-editor.mjs +1 -0
- package/dist/types/base/custom-editor.mjs.map +1 -0
- package/dist/types/base/editor-autocomplete-state.d.ts +10 -0
- package/dist/types/base/editor-autocomplete-state.js +40 -0
- package/dist/types/base/editor-autocomplete-state.js.map +1 -0
- package/dist/types/base/editor-autocomplete-state.mjs +9 -0
- package/dist/types/base/editor-autocomplete-state.mjs.map +1 -0
- package/dist/types/base/index.d.ts +54 -0
- package/dist/types/base/index.js +56 -0
- package/dist/types/base/index.js.map +1 -0
- package/dist/types/base/index.mjs +9 -0
- package/dist/types/base/index.mjs.map +1 -0
- package/dist/types/html-copilot-textarea-element.d.ts +7 -0
- package/dist/types/html-copilot-textarea-element.js +19 -0
- package/dist/types/html-copilot-textarea-element.js.map +1 -0
- package/dist/types/html-copilot-textarea-element.mjs +2 -0
- package/dist/types/html-copilot-textarea-element.mjs.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.js +289 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +19 -0
- package/dist/types/index.mjs.map +1 -0
- package/jest.config.js +5 -0
- package/package.json +95 -0
- package/postcss.config.js +12 -0
- package/src/components/base-copilot-textarea/base-copilot-textarea.css +9 -0
- package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +317 -0
- package/src/components/base-copilot-textarea/render-element.tsx +39 -0
- package/src/components/base-copilot-textarea/render-placeholder.tsx +23 -0
- package/src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx +80 -0
- package/src/components/base-copilot-textarea/use-add-branding-css.tsx +74 -0
- package/src/components/copilot-textarea/copilot-textarea.tsx +210 -0
- package/src/components/hovering-toolbar/hovering-editor-provider.tsx +31 -0
- package/src/components/hovering-toolbar/hovering-toolbar-components.tsx +100 -0
- package/src/components/hovering-toolbar/hovering-toolbar.tsx +151 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +276 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx +31 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +55 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/index.ts +2 -0
- package/src/components/index.ts +4 -0
- package/src/components/manual-ui/chip-with-icon.tsx +17 -0
- package/src/components/source-search-box/source-search-box.tsx +117 -0
- package/src/components/ui/button.tsx +49 -0
- package/src/components/ui/command.tsx +141 -0
- package/src/components/ui/dialog.tsx +107 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/context/index.ts +1 -0
- package/src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts +142 -0
- package/src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx +100 -0
- package/src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts +93 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +114 -0
- package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +214 -0
- package/src/hooks/misc/use-autosize-textarea.tsx +18 -0
- package/src/index.tsx +7 -0
- package/src/lib/debouncer.ts +36 -0
- package/src/lib/editor-to-text.ts +61 -0
- package/src/lib/get-text-around-cursor.ts +135 -0
- package/src/lib/retry.tsx +23 -0
- package/src/lib/slatejs-edits/add-autocompletions.ts +30 -0
- package/src/lib/slatejs-edits/clear-autocompletions.ts +19 -0
- package/src/lib/slatejs-edits/replace-text.ts +28 -0
- package/src/lib/slatejs-edits/with-partial-history.ts +149 -0
- package/src/lib/stream-promise-flatten.ts +33 -0
- package/src/lib/utils.test.ts +7 -0
- package/src/lib/utils.ts +49 -0
- package/src/styles.css +3 -0
- package/src/types/autosuggestions-config/autosuggestions-config-user-specified.tsx +19 -0
- package/src/types/autosuggestions-config/autosuggestions-config.tsx +30 -0
- package/src/types/autosuggestions-config/editing-api-config.tsx +96 -0
- package/src/types/autosuggestions-config/index.ts +8 -0
- package/src/types/autosuggestions-config/insertions-api-config.tsx +87 -0
- package/src/types/autosuggestions-config/subtypes/make-system-prompt.ts +1 -0
- package/src/types/autosuggestions-config/suggestions-api-config.tsx +76 -0
- package/src/types/base/autosuggestion-state.ts +6 -0
- package/src/types/base/autosuggestions-bare-function.ts +30 -0
- package/src/types/base/base-autosuggestions-config.tsx +123 -0
- package/src/types/base/base-copilot-textarea-props.tsx +58 -0
- package/src/types/base/custom-editor.tsx +29 -0
- package/src/types/base/editor-autocomplete-state.ts +20 -0
- package/src/types/base/index.ts +6 -0
- package/src/types/html-copilot-textarea-element.ts +5 -0
- package/src/types/index.ts +3 -0
- package/tailwind.config.js +9 -0
- package/tsconfig.json +12 -0
- package/tsup.config.ts +16 -0
- package/typedoc.json +4 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Editor, Operation, Path, Range, Transforms } from "slate";
|
|
2
|
+
import { HistoryEditor } from "slate-history";
|
|
3
|
+
|
|
4
|
+
// Copy-pasted from `https://github.com/ianstormtaylor/slate/blob/main/packages/slate-history/src/with-history.ts`
|
|
5
|
+
// With one exception: the `shouldSave` function is passed in as an argument to `withPartialHistory` instead of being hardcoded
|
|
6
|
+
export type ShouldSaveToHistory = (op: Operation, prev: Operation | undefined) => boolean;
|
|
7
|
+
|
|
8
|
+
export const withPartialHistory = <T extends Editor>(
|
|
9
|
+
editor: T,
|
|
10
|
+
shouldSave: ShouldSaveToHistory,
|
|
11
|
+
) => {
|
|
12
|
+
const e = editor as T & HistoryEditor;
|
|
13
|
+
const { apply } = e;
|
|
14
|
+
e.history = { undos: [], redos: [] };
|
|
15
|
+
|
|
16
|
+
e.redo = () => {
|
|
17
|
+
const { history } = e;
|
|
18
|
+
const { redos } = history;
|
|
19
|
+
|
|
20
|
+
if (redos.length > 0) {
|
|
21
|
+
const batch = redos[redos.length - 1];
|
|
22
|
+
|
|
23
|
+
if (batch.selectionBefore) {
|
|
24
|
+
Transforms.setSelection(e, batch.selectionBefore);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
HistoryEditor.withoutSaving(e, () => {
|
|
28
|
+
Editor.withoutNormalizing(e, () => {
|
|
29
|
+
for (const op of batch.operations) {
|
|
30
|
+
e.apply(op);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
history.redos.pop();
|
|
36
|
+
e.writeHistory("undos", batch);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
e.undo = () => {
|
|
41
|
+
const { history } = e;
|
|
42
|
+
const { undos } = history;
|
|
43
|
+
|
|
44
|
+
if (undos.length > 0) {
|
|
45
|
+
const batch = undos[undos.length - 1];
|
|
46
|
+
|
|
47
|
+
HistoryEditor.withoutSaving(e, () => {
|
|
48
|
+
Editor.withoutNormalizing(e, () => {
|
|
49
|
+
const inverseOps = batch.operations.map(Operation.inverse).reverse();
|
|
50
|
+
|
|
51
|
+
for (const op of inverseOps) {
|
|
52
|
+
e.apply(op);
|
|
53
|
+
}
|
|
54
|
+
if (batch.selectionBefore) {
|
|
55
|
+
Transforms.setSelection(e, batch.selectionBefore);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
e.writeHistory("redos", batch);
|
|
61
|
+
history.undos.pop();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
e.apply = (op: Operation) => {
|
|
66
|
+
const { operations, history } = e;
|
|
67
|
+
const { undos } = history;
|
|
68
|
+
const lastBatch = undos[undos.length - 1];
|
|
69
|
+
const lastOp = lastBatch && lastBatch.operations[lastBatch.operations.length - 1];
|
|
70
|
+
let save = HistoryEditor.isSaving(e);
|
|
71
|
+
let merge = HistoryEditor.isMerging(e);
|
|
72
|
+
|
|
73
|
+
if (save == null) {
|
|
74
|
+
save = shouldSave(op, lastOp);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (save) {
|
|
78
|
+
if (merge == null) {
|
|
79
|
+
if (lastBatch == null) {
|
|
80
|
+
merge = false;
|
|
81
|
+
} else if (operations.length !== 0) {
|
|
82
|
+
merge = true;
|
|
83
|
+
} else {
|
|
84
|
+
merge = shouldMerge(op, lastOp);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (lastBatch && merge) {
|
|
89
|
+
lastBatch.operations.push(op);
|
|
90
|
+
} else {
|
|
91
|
+
const batch = {
|
|
92
|
+
operations: [op],
|
|
93
|
+
selectionBefore: e.selection,
|
|
94
|
+
};
|
|
95
|
+
e.writeHistory("undos", batch);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
while (undos.length > 100) {
|
|
99
|
+
undos.shift();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
history.redos = [];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
apply(op);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
e.writeHistory = (stack: "undos" | "redos", batch: any) => {
|
|
109
|
+
e.history[stack].push(batch);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
return e;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Check whether to merge an operation into the previous operation.
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
const shouldMerge = (op: Operation, prev: Operation | undefined): boolean => {
|
|
120
|
+
if (
|
|
121
|
+
prev &&
|
|
122
|
+
op.type === "insert_text" &&
|
|
123
|
+
prev.type === "insert_text" &&
|
|
124
|
+
op.offset === prev.offset + prev.text.length &&
|
|
125
|
+
Path.equals(op.path, prev.path)
|
|
126
|
+
) {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (
|
|
131
|
+
prev &&
|
|
132
|
+
op.type === "remove_text" &&
|
|
133
|
+
prev.type === "remove_text" &&
|
|
134
|
+
op.offset + op.text.length === prev.offset &&
|
|
135
|
+
Path.equals(op.path, prev.path)
|
|
136
|
+
) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return false;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const defaultShouldSave = (op: Operation, prev: Operation | undefined): boolean => {
|
|
144
|
+
if (op.type === "set_selection") {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return true;
|
|
149
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flatten a promise of a stream, into a stream.
|
|
3
|
+
*
|
|
4
|
+
* Useful because a stream already includes the notion of async value delivery,
|
|
5
|
+
* so it often makes sense to simply await the values rather than the generator of the values.
|
|
6
|
+
*
|
|
7
|
+
* @param {Promise<ReadableStream<A>>} promise - The promise to flatten.
|
|
8
|
+
* @returns {ReadableStream<A>} - The flattened stream.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export function streamPromiseFlatten<A>(promise: Promise<ReadableStream<A>>): ReadableStream<A> {
|
|
12
|
+
return new ReadableStream<A>({
|
|
13
|
+
async start(controller) {
|
|
14
|
+
try {
|
|
15
|
+
const stream = await promise;
|
|
16
|
+
const reader = stream.getReader();
|
|
17
|
+
|
|
18
|
+
while (true) {
|
|
19
|
+
const { done, value } = await reader.read();
|
|
20
|
+
|
|
21
|
+
if (done) {
|
|
22
|
+
controller.close();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
controller.enqueue(value);
|
|
27
|
+
}
|
|
28
|
+
} catch (error) {
|
|
29
|
+
controller.error(error);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
package/src/lib/utils.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { clsx, type ClassValue } from "clsx";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
|
|
4
|
+
export function cn(...inputs: ClassValue[]) {
|
|
5
|
+
return twMerge(clsx(inputs));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export async function fetcher<JSON = any>(input: RequestInfo, init?: RequestInit): Promise<JSON> {
|
|
9
|
+
const res = await fetch(input, init);
|
|
10
|
+
|
|
11
|
+
if (!res.ok) {
|
|
12
|
+
const json = await res.json();
|
|
13
|
+
if (json.error) {
|
|
14
|
+
const error = new Error(json.error) as Error & {
|
|
15
|
+
status: number;
|
|
16
|
+
};
|
|
17
|
+
error.status = res.status;
|
|
18
|
+
throw error;
|
|
19
|
+
} else {
|
|
20
|
+
throw new Error("An unexpected error occurred");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return res.json();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function formatDate(input: string | number | Date): string {
|
|
28
|
+
const date = new Date(input);
|
|
29
|
+
return date.toLocaleDateString("en-US", {
|
|
30
|
+
month: "long",
|
|
31
|
+
day: "numeric",
|
|
32
|
+
year: "numeric",
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const arraysAreEqual = (arr1: number[], arr2: number[]): boolean =>
|
|
37
|
+
arr1.length === arr2.length && arr1.every((value, index) => value === arr2[index]);
|
|
38
|
+
|
|
39
|
+
export function nullableCompatibleEqualityCheck<T>(
|
|
40
|
+
naiveEqualityCheck: (a: T, b: T) => boolean,
|
|
41
|
+
a: T | null | undefined,
|
|
42
|
+
b: T | null | undefined,
|
|
43
|
+
): boolean {
|
|
44
|
+
if (a === null || a === undefined || b === null || b === undefined) {
|
|
45
|
+
return a === b;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return naiveEqualityCheck(a, b);
|
|
49
|
+
}
|
package/src/styles.css
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AutosuggestionsConfig } from ".";
|
|
2
|
+
import { InsertionsApiConfig } from "./insertions-api-config";
|
|
3
|
+
import { SuggestionsApiConfig } from "./suggestions-api-config";
|
|
4
|
+
|
|
5
|
+
// Mostly mirrors a partial SuggestionsApiConfig, but with some fields MANDATORY.
|
|
6
|
+
export interface SuggestionsApiConfigUserSpecified extends Partial<SuggestionsApiConfig> {}
|
|
7
|
+
|
|
8
|
+
// Mostly mirrors a partial InsertionsApiConfig, but with some fields MANDATORY.
|
|
9
|
+
export interface InsertionsApiConfigUserSpecified extends Partial<InsertionsApiConfig> {}
|
|
10
|
+
|
|
11
|
+
// Mostly mirrors a partial AutosuggestionsConfig, but with some fields MANDATORY.
|
|
12
|
+
export interface AutosuggestionsConfigUserSpecified
|
|
13
|
+
extends Partial<Omit<AutosuggestionsConfig, "chatApiConfigs" | "textareaPurpose">> {
|
|
14
|
+
textareaPurpose: string; // the user MUST specify textareaPurpose - it's not optional
|
|
15
|
+
chatApiConfigs: {
|
|
16
|
+
suggestionsApiConfig?: SuggestionsApiConfigUserSpecified;
|
|
17
|
+
insertionApiConfig?: InsertionsApiConfigUserSpecified;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig } from "../base";
|
|
2
|
+
import { SuggestionsApiConfig, defaultSuggestionsApiConfig } from "./suggestions-api-config";
|
|
3
|
+
import { InsertionsApiConfig, defaultInsertionsApiConfig } from "./insertions-api-config";
|
|
4
|
+
import { EditingApiConfig, defaultEditingApiConfig } from "./editing-api-config";
|
|
5
|
+
import { defaultCopilotContextCategories } from "@copilotkit/react-core";
|
|
6
|
+
|
|
7
|
+
// Like the base autosuggestions config, with 2 additional fields:
|
|
8
|
+
// 1. contextCategories: string[] | undefined;
|
|
9
|
+
// 2. instead of apiConfigs, we have chatApiConfigs: a higher-level abstraction that uses a ChatGPT-like API endpoint.
|
|
10
|
+
export interface AutosuggestionsConfig extends Omit<BaseAutosuggestionsConfig, "apiConfig"> {
|
|
11
|
+
contextCategories: string[];
|
|
12
|
+
chatApiConfigs: {
|
|
13
|
+
suggestionsApiConfig: SuggestionsApiConfig;
|
|
14
|
+
insertionApiConfig: InsertionsApiConfig;
|
|
15
|
+
editingApiConfig: EditingApiConfig;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const defaultAutosuggestionsConfig: Omit<
|
|
20
|
+
AutosuggestionsConfig,
|
|
21
|
+
"textareaPurpose" | "apiEndpoint"
|
|
22
|
+
> = {
|
|
23
|
+
...defaultBaseAutosuggestionsConfig,
|
|
24
|
+
contextCategories: defaultCopilotContextCategories,
|
|
25
|
+
chatApiConfigs: {
|
|
26
|
+
suggestionsApiConfig: defaultSuggestionsApiConfig,
|
|
27
|
+
insertionApiConfig: defaultInsertionsApiConfig,
|
|
28
|
+
editingApiConfig: defaultEditingApiConfig,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Message, Role, TextMessage } from "@copilotkit/runtime-client-gql";
|
|
2
|
+
import { MakeSystemPrompt } from "./subtypes/make-system-prompt";
|
|
3
|
+
|
|
4
|
+
export interface EditingApiConfig {
|
|
5
|
+
makeSystemPrompt: MakeSystemPrompt;
|
|
6
|
+
fewShotMessages: Message[];
|
|
7
|
+
forwardedParams: { [key: string]: any } | undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const defaultEditingMakeSystemPrompt: MakeSystemPrompt = (
|
|
11
|
+
textareaPurpose,
|
|
12
|
+
contextString,
|
|
13
|
+
) => {
|
|
14
|
+
return `You are a versatile writing assistant helping the user edit a portion of their text.
|
|
15
|
+
|
|
16
|
+
The user is writing some text.
|
|
17
|
+
The purpose is: \"${textareaPurpose}\"
|
|
18
|
+
|
|
19
|
+
The following external context is also provided. Use it when relevant.
|
|
20
|
+
\`\`\`
|
|
21
|
+
${contextString}
|
|
22
|
+
\`\`\`
|
|
23
|
+
|
|
24
|
+
The user has provided you with a PROMPT for EDITING a PORTION of the text.
|
|
25
|
+
Your job is to come up with a new EDITED version OF THE SEGMENT IN QUESTION - AS BEST YOU CAN.
|
|
26
|
+
Only rewrite the portion of the text that the user has marked as "TextToEdit"!!!
|
|
27
|
+
|
|
28
|
+
Adjust yourself to the user's style and implied intent.
|
|
29
|
+
|
|
30
|
+
The conversation will be structured as follows:
|
|
31
|
+
<TextBeforeCursor>
|
|
32
|
+
<TextToEdit>
|
|
33
|
+
<TextAfterCursor>
|
|
34
|
+
<EditingPrompt>
|
|
35
|
+
|
|
36
|
+
<YourEditSuggestion>
|
|
37
|
+
`;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const defaultEditingFewShotMessages: Message[] = [
|
|
41
|
+
new TextMessage({
|
|
42
|
+
role: Role.User,
|
|
43
|
+
content:
|
|
44
|
+
"<TextBeforeCursor>This morning I woke up and went straight to the grocery store. </TextBeforeCursor>",
|
|
45
|
+
}),
|
|
46
|
+
new TextMessage({
|
|
47
|
+
role: Role.User,
|
|
48
|
+
content:
|
|
49
|
+
"<TextToEdit>While I was there I picked up some apples, oranges, and bananas. </TextToEdit>",
|
|
50
|
+
}),
|
|
51
|
+
new TextMessage({
|
|
52
|
+
role: Role.User,
|
|
53
|
+
content:
|
|
54
|
+
"<TextAfterCursor>The grocery store was having a sale on fruit, so I decided to stock up.</TextAfterCursor>",
|
|
55
|
+
}),
|
|
56
|
+
new TextMessage({
|
|
57
|
+
role: Role.User,
|
|
58
|
+
content: "<EditingPrompt>I also bought a big watermelon</EditingPrompt>",
|
|
59
|
+
}),
|
|
60
|
+
new TextMessage({
|
|
61
|
+
role: Role.Assistant,
|
|
62
|
+
content:
|
|
63
|
+
"While I was there I picked up some apples, oranges, and bananas, and a big watermelon.",
|
|
64
|
+
}),
|
|
65
|
+
|
|
66
|
+
new TextMessage({
|
|
67
|
+
role: Role.User,
|
|
68
|
+
content:
|
|
69
|
+
"<TextBeforeCursor>Yesterday, I spent the afternoon working on my new project.</TextBeforeCursor>",
|
|
70
|
+
}),
|
|
71
|
+
new TextMessage({
|
|
72
|
+
role: Role.User,
|
|
73
|
+
content: "<TextToEdit>It's quite challenging and requires a lot of focus.</TextToEdit>",
|
|
74
|
+
}),
|
|
75
|
+
new TextMessage({
|
|
76
|
+
role: Role.User,
|
|
77
|
+
content:
|
|
78
|
+
"<TextAfterCursor>I'm really excited about the potential outcomes of this project.</TextAfterCursor>",
|
|
79
|
+
}),
|
|
80
|
+
new TextMessage({
|
|
81
|
+
role: Role.User,
|
|
82
|
+
content:
|
|
83
|
+
"<EditingPrompt>emphasize the complexity and my enthusiasm for the project</EditingPrompt>",
|
|
84
|
+
}),
|
|
85
|
+
new TextMessage({
|
|
86
|
+
role: Role.Assistant,
|
|
87
|
+
content:
|
|
88
|
+
"It's a highly complex task that demands intense concentration, but I'm incredibly enthusiastic about the promising prospects of this project.",
|
|
89
|
+
}),
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
export const defaultEditingApiConfig: EditingApiConfig = {
|
|
93
|
+
makeSystemPrompt: defaultEditingMakeSystemPrompt,
|
|
94
|
+
fewShotMessages: defaultEditingFewShotMessages,
|
|
95
|
+
forwardedParams: undefined,
|
|
96
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { defaultAutosuggestionsConfig } from "./autosuggestions-config";
|
|
2
|
+
export type { AutosuggestionsConfig } from "./autosuggestions-config";
|
|
3
|
+
|
|
4
|
+
export type { MakeSystemPrompt } from "./subtypes/make-system-prompt";
|
|
5
|
+
|
|
6
|
+
export type { AutosuggestionsConfigUserSpecified } from "./autosuggestions-config-user-specified";
|
|
7
|
+
export type { SuggestionsApiConfigUserSpecified } from "./autosuggestions-config-user-specified";
|
|
8
|
+
export type { InsertionsApiConfigUserSpecified } from "./autosuggestions-config-user-specified";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Message, Role, TextMessage } from "@copilotkit/runtime-client-gql";
|
|
2
|
+
import { MakeSystemPrompt } from "./subtypes/make-system-prompt";
|
|
3
|
+
|
|
4
|
+
export interface InsertionsApiConfig {
|
|
5
|
+
makeSystemPrompt: MakeSystemPrompt;
|
|
6
|
+
fewShotMessages: Message[];
|
|
7
|
+
forwardedParams: { [key: string]: any } | undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const defaultInsertionsMakeSystemPrompt: MakeSystemPrompt = (
|
|
11
|
+
textareaPurpose,
|
|
12
|
+
contextString,
|
|
13
|
+
) => {
|
|
14
|
+
return `You are a versatile writing assistant helping the user insert new text into their existing work.
|
|
15
|
+
|
|
16
|
+
The user is writing some text.
|
|
17
|
+
The purpose is: \"${textareaPurpose}\"
|
|
18
|
+
|
|
19
|
+
The following external context is also provided. Use it to inform your suggestions when relevant!!!
|
|
20
|
+
\`\`\`
|
|
21
|
+
${contextString}
|
|
22
|
+
\`\`\`
|
|
23
|
+
|
|
24
|
+
The user will provide you with a prompt for an INSERTION into the text they are writing.
|
|
25
|
+
Your job is to come up with an INSERTION into the text that the user would like to use, AS BEST YOU CAN.
|
|
26
|
+
Only insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.
|
|
27
|
+
|
|
28
|
+
Adjust yourself to the user's style and implied intent.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
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.
|
|
32
|
+
The conversation will be structured as follows:
|
|
33
|
+
<TextAfterCursor>
|
|
34
|
+
<TextBeforeCursor>
|
|
35
|
+
<InsertionPrompt>
|
|
36
|
+
|
|
37
|
+
<YourInsertionSuggestion>
|
|
38
|
+
`;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const defaultInsertionsFewShotMessages: Message[] = [
|
|
42
|
+
new TextMessage({
|
|
43
|
+
role: Role.User,
|
|
44
|
+
content:
|
|
45
|
+
"<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>",
|
|
46
|
+
}),
|
|
47
|
+
new TextMessage({
|
|
48
|
+
role: Role.User,
|
|
49
|
+
content:
|
|
50
|
+
"<TextBeforeCursor>This morning I woke up and went straight to the grocery store.</TextBeforeCursor>",
|
|
51
|
+
}),
|
|
52
|
+
new TextMessage({
|
|
53
|
+
role: Role.User,
|
|
54
|
+
content: "<InsertionPrompt>I bought a big watermelon</InsertionPrompt>",
|
|
55
|
+
}),
|
|
56
|
+
new TextMessage({
|
|
57
|
+
role: Role.Assistant,
|
|
58
|
+
content:
|
|
59
|
+
"When I arrived I went straight to the produce section and picked out a big watermelon.",
|
|
60
|
+
}),
|
|
61
|
+
new TextMessage({
|
|
62
|
+
role: Role.User,
|
|
63
|
+
content:
|
|
64
|
+
"<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>",
|
|
65
|
+
}),
|
|
66
|
+
new TextMessage({
|
|
67
|
+
role: Role.User,
|
|
68
|
+
content:
|
|
69
|
+
'<TextBeforeCursor>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;</TextBeforeCursor>',
|
|
70
|
+
}),
|
|
71
|
+
new TextMessage({
|
|
72
|
+
role: Role.User,
|
|
73
|
+
content:
|
|
74
|
+
"<InsertionPrompt>add section about the optionholder's pro rata share</InsertionPrompt>",
|
|
75
|
+
}),
|
|
76
|
+
new TextMessage({
|
|
77
|
+
role: Role.Assistant,
|
|
78
|
+
content:
|
|
79
|
+
' (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"; ',
|
|
80
|
+
}),
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
export const defaultInsertionsApiConfig: InsertionsApiConfig = {
|
|
84
|
+
makeSystemPrompt: defaultInsertionsMakeSystemPrompt,
|
|
85
|
+
fewShotMessages: defaultInsertionsFewShotMessages,
|
|
86
|
+
forwardedParams: undefined,
|
|
87
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type MakeSystemPrompt = (textareaPurpose: string, contextString: string) => string;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Message, Role, TextMessage } from "@copilotkit/runtime-client-gql";
|
|
2
|
+
import { MakeSystemPrompt } from "./subtypes/make-system-prompt";
|
|
3
|
+
|
|
4
|
+
export interface SuggestionsApiConfig {
|
|
5
|
+
makeSystemPrompt: MakeSystemPrompt;
|
|
6
|
+
fewShotMessages: Message[];
|
|
7
|
+
maxTokens?: number;
|
|
8
|
+
stop?: string[];
|
|
9
|
+
temperature?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const defaultSuggestionsMakeSystemPrompt: MakeSystemPrompt = (
|
|
13
|
+
textareaPurpose,
|
|
14
|
+
contextString,
|
|
15
|
+
) => {
|
|
16
|
+
return `You are a versatile writing assistant.
|
|
17
|
+
|
|
18
|
+
The user is writing some text.
|
|
19
|
+
The purpose is: \"${textareaPurpose}\"
|
|
20
|
+
|
|
21
|
+
Your job is to guess what the user will write next AS BEST YOU CAN.
|
|
22
|
+
Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
|
|
23
|
+
|
|
24
|
+
Adjust yourself to the user's style and implied intent.
|
|
25
|
+
|
|
26
|
+
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.
|
|
27
|
+
<TextAfterCursor>
|
|
28
|
+
<TextBeforeCursor>
|
|
29
|
+
<YourSuggestion>
|
|
30
|
+
|
|
31
|
+
If we need to add a whitespace character to the suggested text, make sure to explicitly add it in.
|
|
32
|
+
Refrain from adding <YourSuggestion> tags when responding
|
|
33
|
+
|
|
34
|
+
The following external context is also provided. Use it to help you make better suggestions!!!
|
|
35
|
+
\`\`\`
|
|
36
|
+
${contextString}
|
|
37
|
+
\`\`\`
|
|
38
|
+
`;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const defaultSuggestionsFewShotMessages: Message[] = [
|
|
42
|
+
new TextMessage({
|
|
43
|
+
role: Role.User,
|
|
44
|
+
content:
|
|
45
|
+
"<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>",
|
|
46
|
+
}),
|
|
47
|
+
new TextMessage({
|
|
48
|
+
role: Role.User,
|
|
49
|
+
content: "This morning I woke up and went straight to the grocery store.",
|
|
50
|
+
}),
|
|
51
|
+
new TextMessage({
|
|
52
|
+
role: Role.Assistant,
|
|
53
|
+
content:
|
|
54
|
+
" When I arrived I went straight to the produce section and picked out a big watermelon. ",
|
|
55
|
+
}),
|
|
56
|
+
new TextMessage({
|
|
57
|
+
role: Role.User,
|
|
58
|
+
content:
|
|
59
|
+
"<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>",
|
|
60
|
+
}),
|
|
61
|
+
new TextMessage({
|
|
62
|
+
role: Role.User,
|
|
63
|
+
content:
|
|
64
|
+
'<TextBeforeCursor>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;</TextBeforeCursor>',
|
|
65
|
+
}),
|
|
66
|
+
new TextMessage({
|
|
67
|
+
role: Role.Assistant,
|
|
68
|
+
content:
|
|
69
|
+
' (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"; ',
|
|
70
|
+
}),
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
export const defaultSuggestionsApiConfig: SuggestionsApiConfig = {
|
|
74
|
+
makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,
|
|
75
|
+
fewShotMessages: defaultSuggestionsFewShotMessages,
|
|
76
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DocumentPointer } from "@copilotkit/react-core";
|
|
2
|
+
|
|
3
|
+
export interface InsertionEditorState {
|
|
4
|
+
textBeforeCursor: string;
|
|
5
|
+
textAfterCursor: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface EditingEditorState extends InsertionEditorState {
|
|
9
|
+
selectedText: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type AutosuggestionsBareFunction = (
|
|
13
|
+
editorState: InsertionEditorState,
|
|
14
|
+
abortSignal: AbortSignal,
|
|
15
|
+
) => Promise<string>;
|
|
16
|
+
|
|
17
|
+
export type Generator_InsertionOrEditingSuggestion = (
|
|
18
|
+
editorState: EditingEditorState,
|
|
19
|
+
prompt: string,
|
|
20
|
+
documents: DocumentPointer[],
|
|
21
|
+
abortSignal: AbortSignal,
|
|
22
|
+
) => Promise<ReadableStream<string>>;
|
|
23
|
+
|
|
24
|
+
export interface InsertionEditorApiConfig {
|
|
25
|
+
insertionOrEditingFunction: Generator_InsertionOrEditingSuggestion;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface BaseCopilotTextareaApiConfig extends InsertionEditorApiConfig {
|
|
29
|
+
autosuggestionsFunction: AutosuggestionsBareFunction;
|
|
30
|
+
}
|