@copilotkit/react-textarea 0.19.0-alpha.7 → 0.19.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +163 -160
- package/CHANGELOG.md +11 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +1910 -33
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.mjs +52 -3
- package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.mjs +46 -3
- package/dist/components/base-copilot-textarea/render-placeholder.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +86 -4
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +57 -3
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +2378 -45
- package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +22 -3
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +125 -3
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +1055 -16
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +761 -10
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +774 -11
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +774 -12
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
- package/dist/components/index.mjs +2379 -46
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.mjs +5 -6
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
- package/dist/components/source-search-box/source-search-box.mjs +356 -10
- package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
- package/dist/components/ui/button.mjs +88 -4
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/card.mjs +53 -7
- package/dist/components/ui/card.mjs.map +1 -1
- package/dist/components/ui/command.mjs +266 -5
- package/dist/components/ui/command.mjs.map +1 -1
- package/dist/components/ui/dialog.mjs +164 -4
- package/dist/components/ui/dialog.mjs.map +1 -1
- package/dist/components/ui/label.mjs +63 -4
- package/dist/components/ui/label.mjs.map +1 -1
- package/dist/components/ui/separator.mjs +50 -8
- package/dist/components/ui/separator.mjs.map +1 -1
- package/dist/components/ui/textarea.mjs +48 -7
- package/dist/components/ui/textarea.mjs.map +1 -1
- package/dist/context/index.mjs +0 -2
- package/dist/context/index.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +168 -6
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +168 -4
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +155 -5
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -1
- package/dist/hooks/index.mjs +0 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +145 -14
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +199 -14
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.mjs +15 -3
- package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -1
- package/dist/index.mjs +2382 -48
- package/dist/index.mjs.map +1 -1
- package/dist/lib/debouncer.mjs +51 -3
- package/dist/lib/debouncer.mjs.map +1 -1
- package/dist/lib/editor-to-text.mjs +43 -3
- package/dist/lib/editor-to-text.mjs.map +1 -1
- package/dist/lib/get-text-around-cursor.mjs +109 -3
- package/dist/lib/get-text-around-cursor.mjs.map +1 -1
- package/dist/lib/retry.mjs +17 -3
- package/dist/lib/retry.mjs.map +1 -1
- package/dist/lib/slatejs-edits/add-autocompletions.mjs +25 -3
- package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs +23 -3
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/replace-text.mjs +27 -3
- package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.mjs +106 -3
- package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -1
- package/dist/lib/stream-promise-flatten.mjs +47 -3
- package/dist/lib/stream-promise-flatten.mjs.map +1 -1
- package/dist/lib/utils.mjs +71 -3
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/lib/utils.test.mjs +0 -1
- package/dist/lib/utils.test.mjs.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs +0 -2
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +253 -8
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.mjs +83 -3
- package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/index.mjs +309 -10
- package/dist/types/autosuggestions-config/index.mjs.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +77 -3
- package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs +77 -3
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs +0 -2
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs +0 -2
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs.map +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +64 -3
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -1
- package/dist/types/base/autosuggestion-state.mjs +0 -2
- package/dist/types/base/autosuggestion-state.mjs.map +1 -1
- package/dist/types/base/autosuggestions-bare-function.mjs +0 -2
- package/dist/types/base/autosuggestions-bare-function.mjs.map +1 -1
- package/dist/types/base/base-autosuggestions-config.mjs +11 -3
- package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
- package/dist/types/base/base-copilot-textarea-props.mjs +0 -2
- package/dist/types/base/base-copilot-textarea-props.mjs.map +1 -1
- package/dist/types/base/custom-editor.mjs +0 -2
- package/dist/types/base/custom-editor.mjs.map +1 -1
- package/dist/types/base/editor-autocomplete-state.mjs +17 -4
- package/dist/types/base/editor-autocomplete-state.mjs.map +1 -1
- package/dist/types/base/index.mjs +11 -4
- package/dist/types/base/index.mjs.map +1 -1
- package/dist/types/html-copilot-textarea-element.mjs +0 -2
- package/dist/types/html-copilot-textarea-element.mjs.map +1 -1
- package/dist/types/index.mjs +310 -12
- package/dist/types/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-2NURR2DX.mjs +0 -47
- package/dist/chunk-2NURR2DX.mjs.map +0 -1
- package/dist/chunk-2TQBFDO7.mjs +0 -19
- package/dist/chunk-2TQBFDO7.mjs.map +0 -1
- package/dist/chunk-4S5ZJH3I.mjs +0 -18
- package/dist/chunk-4S5ZJH3I.mjs.map +0 -1
- package/dist/chunk-5EJ5XOGP.mjs +0 -22
- package/dist/chunk-5EJ5XOGP.mjs.map +0 -1
- package/dist/chunk-5FO6ISW4.mjs +0 -3
- package/dist/chunk-5FO6ISW4.mjs.map +0 -1
- package/dist/chunk-66BDXIX4.mjs +0 -76
- package/dist/chunk-66BDXIX4.mjs.map +0 -1
- package/dist/chunk-7XKICWEE.mjs +0 -44
- package/dist/chunk-7XKICWEE.mjs.map +0 -1
- package/dist/chunk-CSGFJU3L.mjs +0 -65
- package/dist/chunk-CSGFJU3L.mjs.map +0 -1
- package/dist/chunk-D7SEV5PR.mjs +0 -12
- package/dist/chunk-D7SEV5PR.mjs.map +0 -1
- package/dist/chunk-DE5K76I2.mjs +0 -3
- package/dist/chunk-DE5K76I2.mjs.map +0 -1
- package/dist/chunk-F3MHL6ZY.mjs +0 -25
- package/dist/chunk-F3MHL6ZY.mjs.map +0 -1
- package/dist/chunk-FN7GDKKG.mjs +0 -29
- package/dist/chunk-FN7GDKKG.mjs.map +0 -1
- package/dist/chunk-H4VKQGVU.mjs +0 -3
- package/dist/chunk-H4VKQGVU.mjs.map +0 -1
- package/dist/chunk-HRTFMM7P.mjs +0 -82
- package/dist/chunk-HRTFMM7P.mjs.map +0 -1
- package/dist/chunk-IU3WTXLQ.mjs +0 -3
- package/dist/chunk-IU3WTXLQ.mjs.map +0 -1
- package/dist/chunk-IXJ2HCOA.mjs +0 -101
- package/dist/chunk-IXJ2HCOA.mjs.map +0 -1
- package/dist/chunk-JAFCXEPU.mjs +0 -10
- package/dist/chunk-JAFCXEPU.mjs.map +0 -1
- package/dist/chunk-JHTAOLEW.mjs +0 -63
- package/dist/chunk-JHTAOLEW.mjs.map +0 -1
- package/dist/chunk-K2AVA67P.mjs +0 -57
- package/dist/chunk-K2AVA67P.mjs.map +0 -1
- package/dist/chunk-KCHYD3EB.mjs +0 -107
- package/dist/chunk-KCHYD3EB.mjs.map +0 -1
- package/dist/chunk-KGKLUWKW.mjs +0 -47
- package/dist/chunk-KGKLUWKW.mjs.map +0 -1
- package/dist/chunk-KIRROE2K.mjs +0 -37
- package/dist/chunk-KIRROE2K.mjs.map +0 -1
- package/dist/chunk-L7VVZH4Q.mjs +0 -3
- package/dist/chunk-L7VVZH4Q.mjs.map +0 -1
- package/dist/chunk-LNAIMEB2.mjs +0 -34
- package/dist/chunk-LNAIMEB2.mjs.map +0 -1
- package/dist/chunk-MMVDU6DF.mjs +0 -3
- package/dist/chunk-MMVDU6DF.mjs.map +0 -1
- package/dist/chunk-MPME5BW2.mjs +0 -59
- package/dist/chunk-MPME5BW2.mjs.map +0 -1
- package/dist/chunk-MRXNTQOX.mjs +0 -55
- package/dist/chunk-MRXNTQOX.mjs.map +0 -1
- package/dist/chunk-ND5PXTAW.mjs +0 -17
- package/dist/chunk-ND5PXTAW.mjs.map +0 -1
- package/dist/chunk-NKA6K7FW.mjs +0 -201
- package/dist/chunk-NKA6K7FW.mjs.map +0 -1
- package/dist/chunk-NKW5OU2S.mjs +0 -33
- package/dist/chunk-NKW5OU2S.mjs.map +0 -1
- package/dist/chunk-O5OWT5GE.mjs +0 -114
- package/dist/chunk-O5OWT5GE.mjs.map +0 -1
- package/dist/chunk-OD7ZMOVE.mjs +0 -45
- package/dist/chunk-OD7ZMOVE.mjs.map +0 -1
- package/dist/chunk-OELUUJZY.mjs +0 -16
- package/dist/chunk-OELUUJZY.mjs.map +0 -1
- package/dist/chunk-OXPXFYUG.mjs +0 -111
- package/dist/chunk-OXPXFYUG.mjs.map +0 -1
- package/dist/chunk-RQHOUUXQ.mjs +0 -29
- package/dist/chunk-RQHOUUXQ.mjs.map +0 -1
- package/dist/chunk-U5AJ5PBH.mjs +0 -107
- package/dist/chunk-U5AJ5PBH.mjs.map +0 -1
- package/dist/chunk-UHD44NC5.mjs +0 -101
- package/dist/chunk-UHD44NC5.mjs.map +0 -1
- package/dist/chunk-WADHCMPK.mjs +0 -3
- package/dist/chunk-WADHCMPK.mjs.map +0 -1
- package/dist/chunk-WJHSY5T6.mjs +0 -3
- package/dist/chunk-WJHSY5T6.mjs.map +0 -1
- package/dist/chunk-WJYQWL4I.mjs +0 -27
- package/dist/chunk-WJYQWL4I.mjs.map +0 -1
- package/dist/chunk-XA7M72ZO.mjs +0 -106
- package/dist/chunk-XA7M72ZO.mjs.map +0 -1
- package/dist/chunk-XHUMROEY.mjs +0 -91
- package/dist/chunk-XHUMROEY.mjs.map +0 -1
- package/dist/chunk-XYXKONR4.mjs +0 -501
- package/dist/chunk-XYXKONR4.mjs.map +0 -1
- package/dist/chunk-YQU7WG7T.mjs +0 -83
- package/dist/chunk-YQU7WG7T.mjs.map +0 -1
- package/dist/chunk-YTOPHPSG.mjs +0 -45
- package/dist/chunk-YTOPHPSG.mjs.map +0 -1
- package/dist/chunk-YW3REYX6.mjs +0 -23
- package/dist/chunk-YW3REYX6.mjs.map +0 -1
- package/dist/chunk-ZA3R6NZI.mjs +0 -20
- package/dist/chunk-ZA3R6NZI.mjs.map +0 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +0 -13
- package/dist/components/base-copilot-textarea/render-element.d.ts +0 -6
- package/dist/components/base-copilot-textarea/render-placeholder.d.ts +0 -6
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.d.ts +0 -6
- package/dist/components/base-copilot-textarea/use-add-branding-css.d.ts +0 -3
- package/dist/components/copilot-textarea/copilot-textarea.d.ts +0 -19
- package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +0 -13
- package/dist/components/hovering-toolbar/hovering-toolbar-components.d.ts +0 -18
- package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +0 -8
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.ts +0 -29
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +0 -12
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.d.ts +0 -3
- package/dist/components/index.d.ts +0 -14
- package/dist/components/manual-ui/chip-with-icon.d.ts +0 -10
- package/dist/components/source-search-box/source-search-box.d.ts +0 -17
- package/dist/components/ui/button.d.ts +0 -14
- package/dist/components/ui/card.d.ts +0 -10
- package/dist/components/ui/command.d.ts +0 -48
- package/dist/components/ui/dialog.d.ts +0 -18
- package/dist/components/ui/label.d.ts +0 -8
- package/dist/components/ui/separator.d.ts +0 -6
- package/dist/components/ui/textarea.d.ts +0 -7
- package/dist/context/index.d.ts +0 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +0 -13
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.d.ts +0 -8
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.ts +0 -7
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +0 -21
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +0 -22
- package/dist/hooks/misc/use-autosize-textarea.d.ts +0 -5
- package/dist/index.d.ts +0 -16
- package/dist/lib/debouncer.d.ts +0 -11
- package/dist/lib/editor-to-text.d.ts +0 -7
- package/dist/lib/get-text-around-cursor.d.ts +0 -15
- package/dist/lib/retry.d.ts +0 -3
- package/dist/lib/slatejs-edits/add-autocompletions.d.ts +0 -8
- package/dist/lib/slatejs-edits/clear-autocompletions.d.ts +0 -8
- package/dist/lib/slatejs-edits/replace-text.d.ts +0 -5
- package/dist/lib/slatejs-edits/with-partial-history.d.ts +0 -10
- package/dist/lib/stream-promise-flatten.d.ts +0 -3
- package/dist/lib/utils.d.ts +0 -10
- package/dist/lib/utils.test.d.ts +0 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +0 -22
- package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +0 -19
- package/dist/types/autosuggestions-config/editing-api-config.d.ts +0 -15
- package/dist/types/autosuggestions-config/index.d.ts +0 -11
- package/dist/types/autosuggestions-config/insertions-api-config.d.ts +0 -15
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.d.ts +0 -27
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.ts +0 -3
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.d.ts +0 -7
- package/dist/types/autosuggestions-config/suggestions-api-config.d.ts +0 -15
- package/dist/types/base/autosuggestion-state.d.ts +0 -8
- package/dist/types/base/autosuggestions-bare-function.d.ts +0 -17
- package/dist/types/base/base-autosuggestions-config.d.ts +0 -14
- package/dist/types/base/base-copilot-textarea-props.d.ts +0 -40
- package/dist/types/base/custom-editor.d.ts +0 -29
- package/dist/types/base/editor-autocomplete-state.d.ts +0 -10
- package/dist/types/base/index.d.ts +0 -4
- package/dist/types/html-copilot-textarea-element.d.ts +0 -7
- package/dist/types/index.d.ts +0 -14
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ui/label.tsx"],"names":[],"mappings":";;;;;;;;;AAEA,YAAY,WAAW;AACvB,YAAY,oBAAoB;AAChC,SAAS,WAA8B;AAarC;AAjBF;AAQA,IAAM,gBAAgB;AAAA,EACpB;AACF;AAEA,IAAM,QAAc,iBAIlB,CAAC,IAAyB,QAAK;AAA9B,eAAE,YAhBL,IAgBG,IAAgB,kBAAhB,IAAgB,CAAd;AACH,6BAAgB,qBAAf;AAAA,IACC;AAAA,IACA,WAAW,GAAG,cAAc,GAAG,SAAS;AAAA,KACpC,MACN;AAAA,CACD;AACD,MAAM,cAA6B,oBAAK","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n);\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &\n VariantProps<typeof labelVariants>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root\n ref={ref}\n className={cn(labelVariants(), className)}\n {...props}\n />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n\nexport { Label };\n"]}
|
package/dist/chunk-5FO6ISW4.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/chunk-66BDXIX4.mjs
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// src/types/autosuggestions-config/insertions-api-config.tsx
|
|
2
|
-
var defaultInsertionsMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
3
|
-
return `You are a versatile writing assistant.
|
|
4
|
-
|
|
5
|
-
The user is writing some text.
|
|
6
|
-
The purpose is: "${textareaPurpose}"
|
|
7
|
-
|
|
8
|
-
The user also provides you with a prompt for INSERTIONS into the text they are writing.
|
|
9
|
-
Your job is to come up with an INSERTION into the text that the user would like AS BEST YOU CAN.
|
|
10
|
-
Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
|
|
11
|
-
|
|
12
|
-
Adjust yourself to the user's style and implied intent.
|
|
13
|
-
|
|
14
|
-
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.
|
|
15
|
-
<TextAfterCursor>
|
|
16
|
-
<TextBeforeCursor>
|
|
17
|
-
<InsertionPrompt>
|
|
18
|
-
<YourSuggestion>
|
|
19
|
-
|
|
20
|
-
If we need to add a whitespace character to the suggested text, make sure to explicitly add it in.
|
|
21
|
-
|
|
22
|
-
The following external context is also provided. Use it to help you make better suggestions!!!
|
|
23
|
-
\`\`\`
|
|
24
|
-
${contextString}
|
|
25
|
-
\`\`\`
|
|
26
|
-
`;
|
|
27
|
-
};
|
|
28
|
-
var defaultInsertionsFewShotMessages = [
|
|
29
|
-
{
|
|
30
|
-
role: "user",
|
|
31
|
-
name: "TextAfterCursor",
|
|
32
|
-
content: "While I was there I also picked up some apples, oranges, and bananas."
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
role: "user",
|
|
36
|
-
name: "TextBeforeCursor",
|
|
37
|
-
content: "This morning I woke up and went straight to the grocery store."
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
role: "user",
|
|
41
|
-
name: "InsertionPrompt",
|
|
42
|
-
content: "I bought a big watermelon"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
role: "assistant",
|
|
46
|
-
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
role: "user",
|
|
50
|
-
name: "TextAfterCursor",
|
|
51
|
-
content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
role: "user",
|
|
55
|
-
name: "TextBeforeCursor",
|
|
56
|
-
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;`
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
role: "user",
|
|
60
|
-
name: "InsertionPrompt",
|
|
61
|
-
content: "add section about the optionholder's pro rata share"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
role: "assistant",
|
|
65
|
-
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"; `
|
|
66
|
-
}
|
|
67
|
-
];
|
|
68
|
-
var defaultInsertionsApiConfig = {
|
|
69
|
-
makeSystemPrompt: defaultInsertionsMakeSystemPrompt,
|
|
70
|
-
fewShotMessages: defaultInsertionsFewShotMessages,
|
|
71
|
-
forwardedParams: void 0
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export { defaultInsertionsApiConfig, defaultInsertionsFewShotMessages, defaultInsertionsMakeSystemPrompt };
|
|
75
|
-
//# sourceMappingURL=out.js.map
|
|
76
|
-
//# sourceMappingURL=chunk-66BDXIX4.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/autosuggestions-config/insertions-api-config.tsx"],"names":[],"mappings":";AASO,IAAM,oCAAsD,CACjE,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBlB;AAAA;AAAA;AAGF;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","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 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 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 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\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 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"]}
|
package/dist/chunk-7XKICWEE.mjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useMakeStandardAutosuggestionFunction } from './chunk-K2AVA67P.mjs';
|
|
2
|
-
import { useMakeStandardInsertionOrEditingFunction } from './chunk-OXPXFYUG.mjs';
|
|
3
|
-
import { BaseCopilotTextarea } from './chunk-NKA6K7FW.mjs';
|
|
4
|
-
import { defaultAutosuggestionsConfig } from './chunk-2TQBFDO7.mjs';
|
|
5
|
-
import { __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import merge from 'lodash.merge';
|
|
8
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
9
|
-
|
|
10
|
-
var CopilotTextarea = React.forwardRef(
|
|
11
|
-
(props, ref) => {
|
|
12
|
-
const autosuggestionsConfig = merge(
|
|
13
|
-
defaultAutosuggestionsConfig,
|
|
14
|
-
props.autosuggestionsConfig
|
|
15
|
-
);
|
|
16
|
-
const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(
|
|
17
|
-
autosuggestionsConfig.textareaPurpose,
|
|
18
|
-
autosuggestionsConfig.externalContextCategories,
|
|
19
|
-
autosuggestionsConfig.chatApiConfigs.suggestionsApiConfig
|
|
20
|
-
);
|
|
21
|
-
const insertionOrEditingFunction = useMakeStandardInsertionOrEditingFunction(
|
|
22
|
-
autosuggestionsConfig.textareaPurpose,
|
|
23
|
-
autosuggestionsConfig.externalContextCategories,
|
|
24
|
-
autosuggestionsConfig.chatApiConfigs.insertionApiConfig,
|
|
25
|
-
autosuggestionsConfig.chatApiConfigs.editingApiConfig
|
|
26
|
-
);
|
|
27
|
-
return /* @__PURE__ */ jsx(Fragment, {
|
|
28
|
-
children: /* @__PURE__ */ jsx(BaseCopilotTextarea, __spreadProps(__spreadValues({
|
|
29
|
-
ref
|
|
30
|
-
}, props), {
|
|
31
|
-
baseAutosuggestionsConfig: __spreadProps(__spreadValues({}, autosuggestionsConfig), {
|
|
32
|
-
apiConfig: {
|
|
33
|
-
insertionOrEditingFunction,
|
|
34
|
-
autosuggestionsFunction
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
}))
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
export { CopilotTextarea };
|
|
43
|
-
//# sourceMappingURL=out.js.map
|
|
44
|
-
//# sourceMappingURL=chunk-7XKICWEE.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/copilot-textarea/copilot-textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,OAAO,WAAW;AAUlB,OAAO,WAAW;AAmCZ,mBACE,WADF;AAzBC,IAAM,kBAAkB,MAAM;AAAA,EACnC,CACE,OACA,QACgB;AAChB,UAAM,wBAA+C;AAAA,MACnD;AAAA,MACA,MAAM;AAAA,IACR;AAEA,UAAM,0BAA0B;AAAA,MAC9B,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB,eAAe;AAAA,IACvC;AAEA,UAAM,6BACJ;AAAA,MACE,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB,eAAe;AAAA,MACrC,sBAAsB,eAAe;AAAA,IACvC;AAEF,WACE;AAAA,MACE,8BAAC;AAAA,QACC;AAAA,SACI,QAFL;AAAA,QAGC,2BAA2B,iCACtB,wBADsB;AAAA,UAEzB,WAAW;AAAA,YACT;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACF;AAAA,KACF;AAAA,EAEJ;AACF","sourcesContent":["// This example is for an Editor with `ReactEditor` and `HistoryEditor`\nimport React from \"react\";\nimport { useMakeStandardAutosuggestionFunction } from \"../../hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function\";\nimport { HTMLCopilotTextAreaElement } from \"../../types\";\nimport { BaseCopilotTextareaProps } from \"../../types/base/base-copilot-textarea-props\";\nimport {\n AutosuggestionsConfig,\n defaultAutosuggestionsConfig,\n} from \"../../types/autosuggestions-config\";\nimport { BaseCopilotTextarea } from \"../base-copilot-textarea/base-copilot-textarea\";\nimport { useMakeStandardInsertionOrEditingFunction } from \"../../hooks/make-autosuggestions-function/use-make-standard-insertion-function\";\nimport merge from \"lodash.merge\";\nimport { AutosuggestionsConfigUserSpecified } from \"../../types/autosuggestions-config/autosuggestions-config-user-specified\";\n\n// Like the base copilot textarea props,\n// but with baseAutosuggestionsConfig replaced with autosuggestionsConfig.\nexport interface CopilotTextareaProps\n extends Omit<BaseCopilotTextareaProps, \"baseAutosuggestionsConfig\"> {\n autosuggestionsConfig: AutosuggestionsConfigUserSpecified;\n}\n\nexport const CopilotTextarea = React.forwardRef(\n (\n props: CopilotTextareaProps,\n ref: React.Ref<HTMLCopilotTextAreaElement>\n ): JSX.Element => {\n const autosuggestionsConfig: AutosuggestionsConfig = merge(\n defaultAutosuggestionsConfig,\n props.autosuggestionsConfig\n );\n\n const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(\n autosuggestionsConfig.textareaPurpose,\n autosuggestionsConfig.externalContextCategories,\n autosuggestionsConfig.chatApiConfigs.suggestionsApiConfig\n );\n\n const insertionOrEditingFunction =\n useMakeStandardInsertionOrEditingFunction(\n autosuggestionsConfig.textareaPurpose,\n autosuggestionsConfig.externalContextCategories,\n autosuggestionsConfig.chatApiConfigs.insertionApiConfig,\n autosuggestionsConfig.chatApiConfigs.editingApiConfig\n );\n\n return (\n <>\n <BaseCopilotTextarea\n ref={ref}\n {...props}\n baseAutosuggestionsConfig={{\n ...autosuggestionsConfig,\n apiConfig: {\n insertionOrEditingFunction: insertionOrEditingFunction,\n autosuggestionsFunction: autosuggestionsFunction,\n },\n }}\n />\n </>\n );\n }\n);\n"]}
|
package/dist/chunk-CSGFJU3L.mjs
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { withPartialHistory, defaultShouldSave } from './chunk-KCHYD3EB.mjs';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import { createEditor, Element } from 'slate';
|
|
4
|
-
import { withReact } from 'slate-react';
|
|
5
|
-
|
|
6
|
-
var shouldSave = (op, prev) => {
|
|
7
|
-
const excludedNodeType = "suggestion";
|
|
8
|
-
if (op.type === "insert_node" && Element.isElement(op.node) && op.node.type === excludedNodeType) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
if (op.type === "remove_node" && Element.isElement(op.node) && op.node.type === excludedNodeType) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
if (op.type === "set_node" && "type" in op.newProperties && op.newProperties.type === excludedNodeType) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
if (op.type == "set_node" && "type" in op.properties && op.properties.type === excludedNodeType) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
if (op.type === "merge_node" && "type" in op.properties && op.properties.type === excludedNodeType) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
if (op.type === "split_node" && "type" in op.properties && op.properties.type === excludedNodeType) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
return defaultShouldSave(op, prev);
|
|
27
|
-
};
|
|
28
|
-
function useCopilotTextareaEditor() {
|
|
29
|
-
const editor = useMemo(() => {
|
|
30
|
-
const editor2 = withPartialHistory(withReact(createEditor()), shouldSave);
|
|
31
|
-
const { isVoid } = editor2;
|
|
32
|
-
editor2.isVoid = (element) => {
|
|
33
|
-
switch (element.type) {
|
|
34
|
-
case "suggestion":
|
|
35
|
-
return true;
|
|
36
|
-
default:
|
|
37
|
-
return isVoid(element);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const { markableVoid } = editor2;
|
|
41
|
-
editor2.markableVoid = (element) => {
|
|
42
|
-
switch (element.type) {
|
|
43
|
-
case "suggestion":
|
|
44
|
-
return true;
|
|
45
|
-
default:
|
|
46
|
-
return markableVoid(element);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
const { isInline } = editor2;
|
|
50
|
-
editor2.isInline = (element) => {
|
|
51
|
-
switch (element.type) {
|
|
52
|
-
case "suggestion":
|
|
53
|
-
return element.inline;
|
|
54
|
-
default:
|
|
55
|
-
return isInline(element);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
return editor2;
|
|
59
|
-
}, []);
|
|
60
|
-
return editor;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export { useCopilotTextareaEditor };
|
|
64
|
-
//# sourceMappingURL=out.js.map
|
|
65
|
-
//# sourceMappingURL=chunk-CSGFJU3L.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx"],"names":["editor"],"mappings":";;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,cAAc,eAAe;AACtC,SAAS,iBAAiB;AAQ1B,IAAM,aAAkC,CAAC,IAAI,SAAS;AACpD,QAAM,mBAAmB;AAEzB,MACE,GAAG,SAAS,iBACZ,QAAQ,UAAU,GAAG,IAAI,KACzB,GAAG,KAAK,SAAS,kBACjB;AACA,WAAO;AAAA,EACT;AAEA,MACE,GAAG,SAAS,iBACZ,QAAQ,UAAU,GAAG,IAAI,KACzB,GAAG,KAAK,SAAS,kBACjB;AACA,WAAO;AAAA,EACT;AAEA,MACE,GAAG,SAAS,cACZ,UAAU,GAAG,iBACb,GAAG,cAAc,SAAS,kBAC1B;AACA,WAAO;AAAA,EACT;AAEA,MACE,GAAG,QAAQ,cACX,UAAU,GAAG,cACb,GAAG,WAAW,SAAS,kBACvB;AACA,WAAO;AAAA,EACT;AAEA,MACE,GAAG,SAAS,gBACZ,UAAU,GAAG,cACb,GAAG,WAAW,SAAS,kBACvB;AACA,WAAO;AAAA,EACT;AAEA,MACE,GAAG,SAAS,gBACZ,UAAU,GAAG,cACb,GAAG,WAAW,SAAS,kBACvB;AACA,WAAO;AAAA,EACT;AAGA,SAAO,kBAAkB,IAAI,IAAI;AACnC;AAEO,SAAS,2BAAyC;AACvD,QAAM,SAAS,QAAQ,MAAM;AAC3B,UAAMA,UAAS,mBAAmB,UAAU,aAAa,CAAC,GAAG,UAAU;AAEvE,UAAM,EAAE,OAAO,IAAIA;AACnB,IAAAA,QAAO,SAAS,CAAC,YAAY;AAC3B,cAAQ,QAAQ,MAAM;AAAA,QACpB,KAAK;AACH,iBAAO;AAAA,QACT;AACE,iBAAO,OAAO,OAAO;AAAA,MACzB;AAAA,IACF;AAEA,UAAM,EAAE,aAAa,IAAIA;AACzB,IAAAA,QAAO,eAAe,CAAC,YAAY;AACjC,cAAQ,QAAQ,MAAM;AAAA,QACpB,KAAK;AACH,iBAAO;AAAA,QACT;AACE,iBAAO,aAAa,OAAO;AAAA,MAC/B;AAAA,IACF;AAEA,UAAM,EAAE,SAAS,IAAIA;AACrB,IAAAA,QAAO,WAAW,CAAC,YAAY;AAC7B,cAAQ,QAAQ,MAAM;AAAA,QACpB,KAAK;AACH,iBAAO,QAAQ;AAAA,QACjB;AACE,iBAAO,SAAS,OAAO;AAAA,MAC3B;AAAA,IACF;AAEA,WAAOA;AAAA,EACT,GAAG,CAAC,CAAC;AAEL,SAAO;AACT","sourcesContent":["import { useMemo } from \"react\";\nimport { createEditor, Element } from \"slate\";\nimport { withReact } from \"slate-react\";\nimport {\n defaultShouldSave,\n ShouldSaveToHistory,\n withPartialHistory,\n} from \"../../lib/slatejs-edits/with-partial-history\";\nimport { CustomEditor } from \"../../types/base/custom-editor\";\n\nconst shouldSave: ShouldSaveToHistory = (op, prev) => {\n const excludedNodeType = \"suggestion\";\n // Check if the operation involves the suggestion inline node type\n if (\n op.type === \"insert_node\" &&\n Element.isElement(op.node) &&\n op.node.type === excludedNodeType\n ) {\n return false;\n }\n\n if (\n op.type === \"remove_node\" &&\n Element.isElement(op.node) &&\n op.node.type === excludedNodeType\n ) {\n return false;\n }\n\n if (\n op.type === \"set_node\" &&\n \"type\" in op.newProperties &&\n op.newProperties.type === excludedNodeType\n ) {\n return false;\n }\n\n if (\n op.type == \"set_node\" &&\n \"type\" in op.properties &&\n op.properties.type === excludedNodeType\n ) {\n return false;\n }\n\n if (\n op.type === \"merge_node\" &&\n \"type\" in op.properties &&\n op.properties.type === excludedNodeType\n ) {\n return false;\n }\n\n if (\n op.type === \"split_node\" &&\n \"type\" in op.properties &&\n op.properties.type === excludedNodeType\n ) {\n return false;\n }\n\n // Otherwise, save the operation to history\n return defaultShouldSave(op, prev);\n};\n\nexport function useCopilotTextareaEditor(): CustomEditor {\n const editor = useMemo(() => {\n const editor = withPartialHistory(withReact(createEditor()), shouldSave);\n\n const { isVoid } = editor;\n editor.isVoid = (element) => {\n switch (element.type) {\n case \"suggestion\":\n return true;\n default:\n return isVoid(element);\n }\n };\n\n const { markableVoid } = editor;\n editor.markableVoid = (element) => {\n switch (element.type) {\n case \"suggestion\":\n return true;\n default:\n return markableVoid(element);\n }\n };\n\n const { isInline } = editor;\n editor.isInline = (element) => {\n switch (element.type) {\n case \"suggestion\":\n return element.inline;\n default:\n return isInline(element);\n }\n };\n\n return editor;\n }, []);\n\n return editor;\n}\n"]}
|
package/dist/chunk-D7SEV5PR.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// src/types/base/base-autosuggestions-config.tsx
|
|
2
|
-
var defaultBaseAutosuggestionsConfig = {
|
|
3
|
-
debounceTime: 250,
|
|
4
|
-
acceptAutosuggestionKey: "Tab",
|
|
5
|
-
disableWhenEmpty: true,
|
|
6
|
-
disabled: false,
|
|
7
|
-
temporarilyDisableWhenMovingCursorWithoutChangingText: true
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { defaultBaseAutosuggestionsConfig };
|
|
11
|
-
//# sourceMappingURL=out.js.map
|
|
12
|
-
//# sourceMappingURL=chunk-D7SEV5PR.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/base/base-autosuggestions-config.tsx"],"names":[],"mappings":";AAYO,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,yBAAyB;AAAA,EACzB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,uDAAuD;AACzD","sourcesContent":["import { BaseCopilotTextareaApiConfig } from \"./autosuggestions-bare-function\";\n\nexport interface BaseAutosuggestionsConfig {\n textareaPurpose: 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 acceptAutosuggestionKey: \"Tab\",\n disableWhenEmpty: true,\n disabled: false,\n temporarilyDisableWhenMovingCursorWithoutChangingText: true,\n};\n"]}
|
package/dist/chunk-DE5K76I2.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/chunk-F3MHL6ZY.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Node, Element, Transforms } from 'slate';
|
|
2
|
-
|
|
3
|
-
// src/lib/slatejs-edits/clear-autocompletions.ts
|
|
4
|
-
function clearAutocompletionsFromEditor(editor) {
|
|
5
|
-
const paths = [];
|
|
6
|
-
for (const [node, path] of Node.nodes(editor)) {
|
|
7
|
-
if (Element.isElement(node) && node.type === "suggestion") {
|
|
8
|
-
paths.push(path);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
for (const path of paths) {
|
|
12
|
-
try {
|
|
13
|
-
Transforms.removeNodes(editor, { at: path });
|
|
14
|
-
} catch (e) {
|
|
15
|
-
console.log(
|
|
16
|
-
"CopilotTextarea.clearAutocompletionsFromEditor: error removing node",
|
|
17
|
-
e
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { clearAutocompletionsFromEditor };
|
|
24
|
-
//# sourceMappingURL=out.js.map
|
|
25
|
-
//# sourceMappingURL=chunk-F3MHL6ZY.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/slatejs-edits/clear-autocompletions.ts"],"names":[],"mappings":";AAAA,SAAS,SAAS,MAAY,kBAAkB;AAGzC,SAAS,+BAA+B,QAAsB;AAEnE,QAAM,QAAgB,CAAC;AACvB,aAAW,CAAC,MAAM,IAAI,KAAK,KAAK,MAAM,MAAM,GAAG;AAC7C,QAAI,QAAQ,UAAU,IAAI,KAAK,KAAK,SAAS,cAAc;AACzD,YAAM,KAAK,IAAI;AAAA,IACjB;AAAA,EACF;AACA,aAAW,QAAQ,OAAO;AACxB,QAAI;AACF,iBAAW,YAAY,QAAQ,EAAE,IAAI,KAAK,CAAC;AAAA,IAC7C,SAAS,GAAP;AACA,cAAQ;AAAA,QACN;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["import { Element, Node, Path, Transforms } from \"slate\";\nimport { CustomEditor } from \"../../types/base/custom-editor\";\n\nexport function clearAutocompletionsFromEditor(editor: CustomEditor) {\n // clear previous suggestion\n const paths: Path[] = [];\n for (const [node, path] of Node.nodes(editor)) {\n if (Element.isElement(node) && node.type === \"suggestion\") {\n paths.push(path);\n }\n }\n for (const path of paths) {\n try {\n Transforms.removeNodes(editor, { at: path });\n } catch (e) {\n console.log(\n \"CopilotTextarea.clearAutocompletionsFromEditor: error removing node\",\n e\n );\n }\n }\n}\n"]}
|
package/dist/chunk-FN7GDKKG.mjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { __async } from './chunk-MRXNTQOX.mjs';
|
|
2
|
-
|
|
3
|
-
// src/lib/stream-promise-flatten.ts
|
|
4
|
-
function streamPromiseFlatten(promise) {
|
|
5
|
-
return new ReadableStream({
|
|
6
|
-
start(controller) {
|
|
7
|
-
return __async(this, null, function* () {
|
|
8
|
-
try {
|
|
9
|
-
const stream = yield promise;
|
|
10
|
-
const reader = stream.getReader();
|
|
11
|
-
while (true) {
|
|
12
|
-
const { done, value } = yield reader.read();
|
|
13
|
-
if (done) {
|
|
14
|
-
controller.close();
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
controller.enqueue(value);
|
|
18
|
-
}
|
|
19
|
-
} catch (error) {
|
|
20
|
-
controller.error(error);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { streamPromiseFlatten };
|
|
28
|
-
//# sourceMappingURL=out.js.map
|
|
29
|
-
//# sourceMappingURL=chunk-FN7GDKKG.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/stream-promise-flatten.ts"],"names":[],"mappings":";;;;;AAAO,SAAS,qBACd,SACmB;AACnB,SAAO,IAAI,eAAkB;AAAA,IACrB,MAAM,YAAY;AAAA;AACtB,YAAI;AACF,gBAAM,SAAS,MAAM;AACrB,gBAAM,SAAS,OAAO,UAAU;AAEhC,iBAAO,MAAM;AACX,kBAAM,EAAE,MAAM,MAAM,IAAI,MAAM,OAAO,KAAK;AAE1C,gBAAI,MAAM;AACR,yBAAW,MAAM;AACjB;AAAA,YACF;AAEA,uBAAW,QAAQ,KAAK;AAAA,UAC1B;AAAA,QACF,SAAS,OAAP;AACA,qBAAW,MAAM,KAAK;AAAA,QACxB;AAAA,MACF;AAAA;AAAA,EACF,CAAC;AACH","sourcesContent":["export function streamPromiseFlatten<A>(\n promise: Promise<ReadableStream<A>>\n): ReadableStream<A> {\n return new ReadableStream<A>({\n async start(controller) {\n try {\n const stream = await promise;\n const reader = stream.getReader();\n\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) {\n controller.close();\n return;\n }\n\n controller.enqueue(value);\n }\n } catch (error) {\n controller.error(error);\n }\n },\n });\n}\n"]}
|
package/dist/chunk-H4VKQGVU.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/chunk-HRTFMM7P.mjs
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// src/types/autosuggestions-config/editing-api-config.tsx
|
|
2
|
-
var defaultEditingMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
3
|
-
return `You are a versatile writing assistant.
|
|
4
|
-
|
|
5
|
-
The user is writing some text.
|
|
6
|
-
The purpose is: "${textareaPurpose}"
|
|
7
|
-
|
|
8
|
-
The user also provides you with a prompt for EDITING some text they are writing.
|
|
9
|
-
Your job is to come up with an EDIT of the text that the user would like to use - AS BEST YOU CAN.
|
|
10
|
-
|
|
11
|
-
Adjust yourself to the user's style and implied intent.
|
|
12
|
-
|
|
13
|
-
The user will provide the following information; use this to infer the best relevant EDIT:
|
|
14
|
-
<TextBeforeCursor>
|
|
15
|
-
<TextToEdit>
|
|
16
|
-
<TextAfterCursor>
|
|
17
|
-
<EditingPrompt>
|
|
18
|
-
|
|
19
|
-
<YourEditSuggestion>
|
|
20
|
-
|
|
21
|
-
If we need to add a whitespace character to the suggested edit text, make sure to explicitly add it in.
|
|
22
|
-
|
|
23
|
-
The following external context is also provided. Use it to help you make better suggestions!!!
|
|
24
|
-
\`\`\`
|
|
25
|
-
${contextString}
|
|
26
|
-
\`\`\`
|
|
27
|
-
`;
|
|
28
|
-
};
|
|
29
|
-
var defaultEditingFewShotMessages = [
|
|
30
|
-
{
|
|
31
|
-
role: "user",
|
|
32
|
-
name: "TextBeforeCursor",
|
|
33
|
-
content: "This morning I woke up and went straight to the grocery store. "
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
role: "user",
|
|
37
|
-
name: "TextToEdit",
|
|
38
|
-
content: "While I was there I also picked up some apples, oranges, and bananas. "
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
role: "user",
|
|
42
|
-
name: "TextAfterCursor",
|
|
43
|
-
content: "The grocery store was having a sale on fruit, so I decided to stock up."
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
role: "user",
|
|
47
|
-
name: "EditingPrompt",
|
|
48
|
-
content: "I bought a big watermelon"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
role: "assistant",
|
|
52
|
-
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
role: "user",
|
|
56
|
-
name: "TextAfterCursor",
|
|
57
|
-
content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
role: "user",
|
|
61
|
-
name: "TextBeforeCursor",
|
|
62
|
-
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;`
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
role: "user",
|
|
66
|
-
name: "InsertionPrompt",
|
|
67
|
-
content: "add section about the optionholder's pro rata share"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
role: "assistant",
|
|
71
|
-
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"; `
|
|
72
|
-
}
|
|
73
|
-
];
|
|
74
|
-
var defaultEditingApiConfig = {
|
|
75
|
-
makeSystemPrompt: defaultEditingMakeSystemPrompt,
|
|
76
|
-
fewShotMessages: defaultEditingFewShotMessages,
|
|
77
|
-
forwardedParams: void 0
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export { defaultEditingApiConfig, defaultEditingFewShotMessages, defaultEditingMakeSystemPrompt };
|
|
81
|
-
//# sourceMappingURL=out.js.map
|
|
82
|
-
//# sourceMappingURL=chunk-HRTFMM7P.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/autosuggestions-config/editing-api-config.tsx"],"names":[],"mappings":";AASO,IAAM,iCAAmD,CAC9D,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBlB;AAAA;AAAA;AAGF;AAEO,IAAM,gCAAyD;AAAA,EACpE;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;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;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,0BAA4C;AAAA,EACvD,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB","sourcesContent":["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 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\nIf we need to add a whitespace character to the suggested edit 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 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"]}
|
package/dist/chunk-IU3WTXLQ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/chunk-IXJ2HCOA.mjs
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { Range, Editor, Text, Element, Path, Point } from 'slate';
|
|
2
|
-
|
|
3
|
-
// src/lib/get-text-around-cursor.ts
|
|
4
|
-
function getTextAroundCollapsedCursor(editor) {
|
|
5
|
-
const { selection } = editor;
|
|
6
|
-
if (!selection || !Range.isCollapsed(selection)) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
const cursorPoint = selection.anchor;
|
|
10
|
-
const beforeRange = {
|
|
11
|
-
anchor: Editor.start(editor, []),
|
|
12
|
-
focus: cursorPoint
|
|
13
|
-
};
|
|
14
|
-
const afterRange = {
|
|
15
|
-
anchor: cursorPoint,
|
|
16
|
-
focus: Editor.end(editor, [])
|
|
17
|
-
};
|
|
18
|
-
const before = extractTextWithNewlines(editor, beforeRange);
|
|
19
|
-
const after = extractTextWithNewlines(editor, afterRange);
|
|
20
|
-
return {
|
|
21
|
-
cursorPoint,
|
|
22
|
-
textBeforeCursor: before,
|
|
23
|
-
textAfterCursor: after
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function getTextAroundSelection(editor) {
|
|
27
|
-
const { selection } = editor;
|
|
28
|
-
if (!selection) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const wellOrderedSelection = wellOrderedRange(selection);
|
|
32
|
-
const beforeRange = {
|
|
33
|
-
anchor: Editor.start(editor, []),
|
|
34
|
-
focus: wellOrderedSelection.anchor
|
|
35
|
-
};
|
|
36
|
-
const afterRange = {
|
|
37
|
-
anchor: wellOrderedSelection.focus,
|
|
38
|
-
focus: Editor.end(editor, [])
|
|
39
|
-
};
|
|
40
|
-
const before = extractTextWithNewlines(editor, beforeRange);
|
|
41
|
-
const after = extractTextWithNewlines(editor, afterRange);
|
|
42
|
-
const selectedText = extractTextWithNewlines(editor, wellOrderedSelection);
|
|
43
|
-
return {
|
|
44
|
-
selection: wellOrderedSelection,
|
|
45
|
-
textBeforeCursor: before,
|
|
46
|
-
selectedText,
|
|
47
|
-
textAfterCursor: after
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function getFullEditorTextWithNewlines(editor) {
|
|
51
|
-
const fullDocumentRange = {
|
|
52
|
-
anchor: Editor.start(editor, []),
|
|
53
|
-
focus: Editor.end(editor, [])
|
|
54
|
-
};
|
|
55
|
-
return extractTextWithNewlines(editor, fullDocumentRange);
|
|
56
|
-
}
|
|
57
|
-
function extractTextWithNewlines(editor, range) {
|
|
58
|
-
const voids = false;
|
|
59
|
-
const [start, end] = Range.edges(range);
|
|
60
|
-
let text = "";
|
|
61
|
-
let lastBlock = null;
|
|
62
|
-
for (const [node, path] of Editor.nodes(editor, {
|
|
63
|
-
at: range,
|
|
64
|
-
match: Text.isText,
|
|
65
|
-
voids
|
|
66
|
-
})) {
|
|
67
|
-
let t = node.text;
|
|
68
|
-
const [block] = Editor.above(editor, {
|
|
69
|
-
at: path,
|
|
70
|
-
match: (n) => Element.isElement(n) && n.type === "paragraph"
|
|
71
|
-
}) || [null];
|
|
72
|
-
if (lastBlock !== block && block) {
|
|
73
|
-
if (lastBlock) {
|
|
74
|
-
text += "\n";
|
|
75
|
-
}
|
|
76
|
-
lastBlock = block;
|
|
77
|
-
}
|
|
78
|
-
if (Path.equals(path, end.path)) {
|
|
79
|
-
t = t.slice(0, end.offset);
|
|
80
|
-
}
|
|
81
|
-
if (Path.equals(path, start.path)) {
|
|
82
|
-
t = t.slice(start.offset);
|
|
83
|
-
}
|
|
84
|
-
text += t;
|
|
85
|
-
}
|
|
86
|
-
return text;
|
|
87
|
-
}
|
|
88
|
-
function wellOrderedRange(range) {
|
|
89
|
-
const { anchor, focus } = range;
|
|
90
|
-
if (Point.isBefore(anchor, focus)) {
|
|
91
|
-
return range;
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
anchor: focus,
|
|
95
|
-
focus: anchor
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export { extractTextWithNewlines, getFullEditorTextWithNewlines, getTextAroundCollapsedCursor, getTextAroundSelection };
|
|
100
|
-
//# sourceMappingURL=out.js.map
|
|
101
|
-
//# sourceMappingURL=chunk-IXJ2HCOA.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/get-text-around-cursor.ts"],"names":[],"mappings":";AAAA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,OACK;AAWA,SAAS,6BACd,QACgC;AAChC,QAAM,EAAE,UAAU,IAAI;AACtB,MAAI,CAAC,aAAa,CAAC,MAAM,YAAY,SAAS,GAAG;AAC/C,WAAO;AAAA,EACT;AAEA,QAAM,cAAc,UAAU;AAG9B,QAAM,cAAqB;AAAA,IACzB,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO;AAAA,EACT;AACA,QAAM,aAAoB;AAAA,IACxB,QAAQ;AAAA,IACR,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AAGA,QAAM,SAAS,wBAAwB,QAAQ,WAAW;AAC1D,QAAM,QAAQ,wBAAwB,QAAQ,UAAU;AAExD,SAAO;AAAA,IACL;AAAA,IACA,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,EACnB;AACF;AAEO,SAAS,uBAAuB,QAAwC;AAC7E,QAAM,EAAE,UAAU,IAAI;AACtB,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,QAAM,uBAAuB,iBAAiB,SAAS;AAGvD,QAAM,cAAqB;AAAA,IACzB,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO,qBAAqB;AAAA,EAC9B;AACA,QAAM,aAAoB;AAAA,IACxB,QAAQ,qBAAqB;AAAA,IAC7B,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AAGA,QAAM,SAAS,wBAAwB,QAAQ,WAAW;AAC1D,QAAM,QAAQ,wBAAwB,QAAQ,UAAU;AACxD,QAAM,eAAe,wBAAwB,QAAQ,oBAAoB;AAEzE,SAAO;AAAA,IACL,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB;AAAA,IACA,iBAAiB;AAAA,EACnB;AACF;AAEO,SAAS,8BAA8B,QAAwB;AACpE,QAAM,oBAA2B;AAAA,IAC/B,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AACA,SAAO,wBAAwB,QAAQ,iBAAiB;AAC1D;AAGO,SAAS,wBAAwB,QAAgB,OAAsB;AAC5E,QAAM,QAAQ;AACd,QAAM,CAAC,OAAO,GAAG,IAAI,MAAM,MAAM,KAAK;AACtC,MAAI,OAAO;AACX,MAAI,YAAyB;AAE7B,aAAW,CAAC,MAAM,IAAI,KAAK,OAAO,MAAM,QAAQ;AAAA,IAC9C,IAAI;AAAA,IACJ,OAAO,KAAK;AAAA,IACZ;AAAA,EACF,CAAC,GAAG;AACF,QAAI,IAAI,KAAK;AAGb,UAAM,CAAC,KAAK,IAAI,OAAO,MAAM,QAAQ;AAAA,MACnC,IAAI;AAAA,MACJ,OAAO,CAAC,MAAM,QAAQ,UAAU,CAAC,KAAK,EAAE,SAAS;AAAA,IACnD,CAAC,KAAK,CAAC,IAAI;AAGX,QAAI,cAAc,SAAS,OAAO;AAEhC,UAAI,WAAW;AACb,gBAAQ;AAAA,MACV;AACA,kBAAY;AAAA,IACd;AAEA,QAAI,KAAK,OAAO,MAAM,IAAI,IAAI,GAAG;AAC/B,UAAI,EAAE,MAAM,GAAG,IAAI,MAAM;AAAA,IAC3B;AAEA,QAAI,KAAK,OAAO,MAAM,MAAM,IAAI,GAAG;AACjC,UAAI,EAAE,MAAM,MAAM,MAAM;AAAA,IAC1B;AAEA,YAAQ;AAAA,EACV;AAEA,SAAO;AACT;AAEA,SAAS,iBAAiB,OAA6B;AACrD,QAAM,EAAE,QAAQ,MAAM,IAAI;AAE1B,MAAI,MAAM,SAAS,QAAQ,KAAK,GAAG;AACjC,WAAO;AAAA,EACT;AAGA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,OAAO;AAAA,EACT;AACF","sourcesContent":["import {\n Editor,\n Node,\n Path,\n Range,\n Text,\n Element,\n BasePoint,\n BaseRange,\n Point,\n} from \"slate\";\nimport { EditorAutocompleteState } from \"../types/base/editor-autocomplete-state\";\n\nexport interface EditorTextState {\n selection: BaseRange;\n\n textBeforeCursor: string;\n selectedText: string;\n textAfterCursor: string;\n}\n\nexport function getTextAroundCollapsedCursor(\n editor: Editor\n): EditorAutocompleteState | null {\n const { selection } = editor;\n if (!selection || !Range.isCollapsed(selection)) {\n return null;\n }\n\n const cursorPoint = selection.anchor;\n\n // Create two ranges: one before the anchor and one after\n const beforeRange: Range = {\n anchor: Editor.start(editor, []),\n focus: cursorPoint,\n };\n const afterRange: Range = {\n anchor: cursorPoint,\n focus: Editor.end(editor, []),\n };\n\n // Extract text for these ranges\n const before = extractTextWithNewlines(editor, beforeRange);\n const after = extractTextWithNewlines(editor, afterRange);\n\n return {\n cursorPoint: cursorPoint,\n textBeforeCursor: before,\n textAfterCursor: after,\n };\n}\n\nexport function getTextAroundSelection(editor: Editor): EditorTextState | null {\n const { selection } = editor;\n if (!selection) {\n return null;\n }\n\n const wellOrderedSelection = wellOrderedRange(selection);\n\n // Create two ranges: one before the anchor and one after\n const beforeRange: Range = {\n anchor: Editor.start(editor, []),\n focus: wellOrderedSelection.anchor,\n };\n const afterRange: Range = {\n anchor: wellOrderedSelection.focus,\n focus: Editor.end(editor, []),\n };\n\n // Extract text for these ranges\n const before = extractTextWithNewlines(editor, beforeRange);\n const after = extractTextWithNewlines(editor, afterRange);\n const selectedText = extractTextWithNewlines(editor, wellOrderedSelection);\n\n return {\n selection: wellOrderedSelection,\n textBeforeCursor: before,\n selectedText,\n textAfterCursor: after,\n };\n}\n\nexport function getFullEditorTextWithNewlines(editor: Editor): string {\n const fullDocumentRange: Range = {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n };\n return extractTextWithNewlines(editor, fullDocumentRange);\n}\n\n// Helper function to extract text with newlines\nexport function extractTextWithNewlines(editor: Editor, range: Range): string {\n const voids = false;\n const [start, end] = Range.edges(range);\n let text = \"\";\n let lastBlock: Node | null = null;\n\n for (const [node, path] of Editor.nodes(editor, {\n at: range,\n match: Text.isText,\n voids,\n })) {\n let t = node.text;\n\n // Determine the parent block of the current text node\n const [block] = Editor.above(editor, {\n at: path,\n match: (n) => Element.isElement(n) && n.type === \"paragraph\",\n }) || [null];\n\n // If we encounter a new block, prepend a newline\n if (lastBlock !== block && block) {\n // check that lastBlock is not null to avoid adding a newline at the beginning\n if (lastBlock) {\n text += \"\\n\";\n }\n lastBlock = block;\n }\n\n if (Path.equals(path, end.path)) {\n t = t.slice(0, end.offset);\n }\n\n if (Path.equals(path, start.path)) {\n t = t.slice(start.offset);\n }\n\n text += t;\n }\n\n return text;\n}\n\nfunction wellOrderedRange(range: BaseRange): BaseRange {\n const { anchor, focus } = range;\n // if anchor is before focus, return range as is\n if (Point.isBefore(anchor, focus)) {\n return range;\n }\n\n // if focus is before anchor, return range with anchor and focus swapped\n return {\n anchor: focus,\n focus: anchor,\n };\n}\n"]}
|
package/dist/chunk-JAFCXEPU.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { arraysAreEqual } from './chunk-KGKLUWKW.mjs';
|
|
2
|
-
|
|
3
|
-
// src/types/base/editor-autocomplete-state.ts
|
|
4
|
-
function areEqual_autocompleteState(prev, next) {
|
|
5
|
-
return prev.cursorPoint.offset === next.cursorPoint.offset && arraysAreEqual(prev.cursorPoint.path, next.cursorPoint.path) && prev.textBeforeCursor === next.textBeforeCursor && prev.textAfterCursor === next.textAfterCursor;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export { areEqual_autocompleteState };
|
|
9
|
-
//# sourceMappingURL=out.js.map
|
|
10
|
-
//# sourceMappingURL=chunk-JAFCXEPU.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/base/editor-autocomplete-state.ts"],"names":[],"mappings":";;;;;AASO,SAAS,2BACd,MACA,MACA;AACA,SACE,KAAK,YAAY,WAAW,KAAK,YAAY,UAC7C,eAAe,KAAK,YAAY,MAAM,KAAK,YAAY,IAAI,KAC3D,KAAK,qBAAqB,KAAK,oBAC/B,KAAK,oBAAoB,KAAK;AAElC","sourcesContent":["import { BasePoint } from \"slate\";\nimport { arraysAreEqual } from \"../../lib/utils\";\n\nexport interface EditorAutocompleteState {\n cursorPoint: BasePoint;\n textBeforeCursor: string;\n textAfterCursor: string;\n}\n\nexport function areEqual_autocompleteState(\n prev: EditorAutocompleteState,\n next: EditorAutocompleteState\n) {\n return (\n prev.cursorPoint.offset === next.cursorPoint.offset &&\n arraysAreEqual(prev.cursorPoint.path, next.cursorPoint.path) &&\n prev.textBeforeCursor === next.textBeforeCursor &&\n prev.textAfterCursor === next.textAfterCursor\n );\n}\n"]}
|
package/dist/chunk-JHTAOLEW.mjs
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// src/types/autosuggestions-config/suggestions-api-config.tsx
|
|
2
|
-
var defaultSuggestionsMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
3
|
-
return `You are a versatile writing assistant.
|
|
4
|
-
|
|
5
|
-
The user is writing some text.
|
|
6
|
-
The purpose is: "${textareaPurpose}"
|
|
7
|
-
|
|
8
|
-
Your job is to guess what the user will write next AS BEST YOU CAN.
|
|
9
|
-
Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
|
|
10
|
-
|
|
11
|
-
Adjust yourself to the user's style and implied intent.
|
|
12
|
-
|
|
13
|
-
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.
|
|
14
|
-
<TextAfterCursor>
|
|
15
|
-
<TextBeforeCursor>
|
|
16
|
-
<YourSuggestion>
|
|
17
|
-
|
|
18
|
-
If we need to add a whitespace character to the suggested text, make sure to explicitly add it in.
|
|
19
|
-
|
|
20
|
-
The following external context is also provided. Use it to help you make better suggestions!!!
|
|
21
|
-
\`\`\`
|
|
22
|
-
${contextString}
|
|
23
|
-
\`\`\`
|
|
24
|
-
`;
|
|
25
|
-
};
|
|
26
|
-
var defaultSuggestionsFewShotMessages = [
|
|
27
|
-
{
|
|
28
|
-
role: "user",
|
|
29
|
-
name: "TextAfterCursor",
|
|
30
|
-
content: "While I was there I also picked up some apples, oranges, and bananas."
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
role: "user",
|
|
34
|
-
content: "This morning I woke up and went straight to the grocery store."
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
role: "assistant",
|
|
38
|
-
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
role: "user",
|
|
42
|
-
name: "TextAfterCursor",
|
|
43
|
-
content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
role: "user",
|
|
47
|
-
name: "TextBeforeCursor",
|
|
48
|
-
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;`
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
role: "assistant",
|
|
52
|
-
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"; `
|
|
53
|
-
}
|
|
54
|
-
];
|
|
55
|
-
var defaultSuggestionsApiConfig = {
|
|
56
|
-
makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,
|
|
57
|
-
fewShotMessages: defaultSuggestionsFewShotMessages,
|
|
58
|
-
forwardedParams: void 0
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export { defaultSuggestionsApiConfig, defaultSuggestionsFewShotMessages, defaultSuggestionsMakeSystemPrompt };
|
|
62
|
-
//# sourceMappingURL=out.js.map
|
|
63
|
-
//# sourceMappingURL=chunk-JHTAOLEW.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/autosuggestions-config/suggestions-api-config.tsx"],"names":[],"mappings":";AASO,IAAM,qCAAuD,CAClE,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBlB;AAAA;AAAA;AAGF;AAEO,IAAM,oCAA6D;AAAA,EACxE;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,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,SACE;AAAA,EACJ;AACF;AAEO,IAAM,8BAAoD;AAAA,EAC/D,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB","sourcesContent":["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"]}
|