@copilotkit/react-textarea 0.19.1 → 0.21.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/.turbo/turbo-build.log +258 -298
  2. package/CHANGELOG.md +22 -0
  3. package/dist/{chunk-RDHPSSHJ.mjs → chunk-24SYR4JB.mjs} +13 -8
  4. package/dist/chunk-24SYR4JB.mjs.map +1 -0
  5. package/dist/{chunk-L6DZHWEL.mjs → chunk-463BFNUP.mjs} +10 -9
  6. package/dist/chunk-463BFNUP.mjs.map +1 -0
  7. package/dist/{chunk-QNJ6MXJ2.mjs → chunk-5DU2QDHZ.mjs} +3 -3
  8. package/dist/{chunk-QNJ6MXJ2.mjs.map → chunk-5DU2QDHZ.mjs.map} +1 -1
  9. package/dist/chunk-63FSISXT.mjs +48 -0
  10. package/dist/chunk-63FSISXT.mjs.map +1 -0
  11. package/dist/{chunk-HRTFMM7P.mjs → chunk-AXN37AHC.mjs} +6 -8
  12. package/dist/chunk-AXN37AHC.mjs.map +1 -0
  13. package/dist/{chunk-K2AVA67P.mjs → chunk-DYGPLRY3.mjs} +3 -3
  14. package/dist/chunk-DYGPLRY3.mjs.map +1 -0
  15. package/dist/{chunk-BBKDE7YT.mjs → chunk-F2TIBXML.mjs} +3 -3
  16. package/dist/{chunk-FN7GDKKG.mjs → chunk-GCMQHIRF.mjs} +1 -1
  17. package/dist/chunk-GCMQHIRF.mjs.map +1 -0
  18. package/dist/{chunk-7QWJ3OV7.mjs → chunk-KLROO6ID.mjs} +2 -2
  19. package/dist/{chunk-47JRPWI3.mjs → chunk-O7G7E3E3.mjs} +20 -53
  20. package/dist/chunk-O7G7E3E3.mjs.map +1 -0
  21. package/dist/{chunk-KIRROE2K.mjs → chunk-QJDMIGLU.mjs} +4 -3
  22. package/dist/chunk-QJDMIGLU.mjs.map +1 -0
  23. package/dist/{chunk-66BDXIX4.mjs → chunk-RR6OQGTI.mjs} +7 -9
  24. package/dist/chunk-RR6OQGTI.mjs.map +1 -0
  25. package/dist/{chunk-XA7M72ZO.mjs → chunk-WLPYYGES.mjs} +5 -2
  26. package/dist/chunk-WLPYYGES.mjs.map +1 -0
  27. package/dist/{chunk-OXPXFYUG.mjs → chunk-WPIA53HF.mjs} +14 -8
  28. package/dist/chunk-WPIA53HF.mjs.map +1 -0
  29. package/dist/{chunk-3TK2VELX.mjs → chunk-YXA3UPMI.mjs} +2 -2
  30. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +8 -7
  31. package/dist/components/copilot-textarea/copilot-textarea.mjs +15 -14
  32. package/dist/components/hovering-toolbar/hovering-toolbar.mjs +7 -6
  33. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +5 -4
  34. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +6 -5
  35. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +6 -0
  36. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +1 -0
  37. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +6 -5
  38. package/dist/components/index.mjs +15 -14
  39. package/dist/components/source-search-box/source-search-box.mjs +2 -2
  40. package/dist/components/ui/command.mjs +1 -1
  41. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +5 -5
  42. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +5 -5
  43. package/dist/index.css +6 -7
  44. package/dist/index.css.map +1 -1
  45. package/dist/index.mjs +15 -14
  46. package/dist/lib/stream-promise-flatten.mjs +1 -1
  47. package/dist/types/autosuggestions-config/autosuggestions-config.mjs +3 -3
  48. package/dist/types/autosuggestions-config/editing-api-config.mjs +1 -1
  49. package/dist/types/autosuggestions-config/index.mjs +4 -4
  50. package/dist/types/autosuggestions-config/insertions-api-config.mjs +1 -1
  51. package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs +1 -1
  52. package/dist/types/index.mjs +4 -4
  53. package/package.json +3 -5
  54. package/src/components/copilot-textarea/copilot-textarea.tsx +8 -2
  55. package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +27 -62
  56. package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx +1 -1
  57. package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +54 -0
  58. package/src/components/source-search-box/source-search-box.tsx +9 -8
  59. package/src/components/ui/command.tsx +4 -1
  60. package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +1 -1
  61. package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +13 -3
  62. package/src/lib/stream-promise-flatten.ts +10 -0
  63. package/src/types/autosuggestions-config/editing-api-config.tsx +5 -7
  64. package/src/types/autosuggestions-config/insertions-api-config.tsx +6 -8
  65. package/src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx +4 -0
  66. package/src/types/base/autosuggestions-bare-function.ts +3 -0
  67. package/dist/chunk-47JRPWI3.mjs.map +0 -1
  68. package/dist/chunk-66BDXIX4.mjs.map +0 -1
  69. package/dist/chunk-FN7GDKKG.mjs.map +0 -1
  70. package/dist/chunk-HRTFMM7P.mjs.map +0 -1
  71. package/dist/chunk-K2AVA67P.mjs.map +0 -1
  72. package/dist/chunk-KIRROE2K.mjs.map +0 -1
  73. package/dist/chunk-L6DZHWEL.mjs.map +0 -1
  74. package/dist/chunk-OXPXFYUG.mjs.map +0 -1
  75. package/dist/chunk-RDHPSSHJ.mjs.map +0 -1
  76. package/dist/chunk-XA7M72ZO.mjs.map +0 -1
  77. package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +0 -13
  78. package/dist/components/base-copilot-textarea/render-element.d.ts +0 -6
  79. package/dist/components/base-copilot-textarea/render-placeholder.d.ts +0 -6
  80. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.d.ts +0 -6
  81. package/dist/components/base-copilot-textarea/use-add-branding-css.d.ts +0 -3
  82. package/dist/components/copilot-textarea/copilot-textarea.d.ts +0 -19
  83. package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +0 -13
  84. package/dist/components/hovering-toolbar/hovering-toolbar-components.d.ts +0 -18
  85. package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +0 -9
  86. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.ts +0 -26
  87. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +0 -13
  88. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.d.ts +0 -3
  89. package/dist/components/index.d.ts +0 -14
  90. package/dist/components/manual-ui/chip-with-icon.d.ts +0 -10
  91. package/dist/components/source-search-box/source-search-box.d.ts +0 -14
  92. package/dist/components/ui/button.d.ts +0 -14
  93. package/dist/components/ui/card.d.ts +0 -10
  94. package/dist/components/ui/command.d.ts +0 -48
  95. package/dist/components/ui/dialog.d.ts +0 -18
  96. package/dist/components/ui/label.d.ts +0 -8
  97. package/dist/components/ui/separator.d.ts +0 -6
  98. package/dist/components/ui/textarea.d.ts +0 -7
  99. package/dist/context/index.d.ts +0 -1
  100. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +0 -13
  101. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.d.ts +0 -8
  102. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.ts +0 -7
  103. package/dist/hooks/index.d.ts +0 -1
  104. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +0 -21
  105. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +0 -22
  106. package/dist/hooks/misc/use-autosize-textarea.d.ts +0 -5
  107. package/dist/index.d.ts +0 -16
  108. package/dist/lib/debouncer.d.ts +0 -11
  109. package/dist/lib/editor-to-text.d.ts +0 -7
  110. package/dist/lib/get-text-around-cursor.d.ts +0 -15
  111. package/dist/lib/retry.d.ts +0 -3
  112. package/dist/lib/slatejs-edits/add-autocompletions.d.ts +0 -8
  113. package/dist/lib/slatejs-edits/clear-autocompletions.d.ts +0 -8
  114. package/dist/lib/slatejs-edits/replace-text.d.ts +0 -5
  115. package/dist/lib/slatejs-edits/with-partial-history.d.ts +0 -10
  116. package/dist/lib/stream-promise-flatten.d.ts +0 -3
  117. package/dist/lib/utils.d.ts +0 -10
  118. package/dist/lib/utils.test.d.ts +0 -1
  119. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +0 -22
  120. package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +0 -19
  121. package/dist/types/autosuggestions-config/editing-api-config.d.ts +0 -15
  122. package/dist/types/autosuggestions-config/index.d.ts +0 -11
  123. package/dist/types/autosuggestions-config/insertions-api-config.d.ts +0 -15
  124. package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.d.ts +0 -27
  125. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.ts +0 -3
  126. package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.d.ts +0 -7
  127. package/dist/types/autosuggestions-config/suggestions-api-config.d.ts +0 -15
  128. package/dist/types/base/autosuggestion-state.d.ts +0 -8
  129. package/dist/types/base/autosuggestions-bare-function.d.ts +0 -17
  130. package/dist/types/base/base-autosuggestions-config.d.ts +0 -15
  131. package/dist/types/base/base-copilot-textarea-props.d.ts +0 -40
  132. package/dist/types/base/custom-editor.d.ts +0 -29
  133. package/dist/types/base/editor-autocomplete-state.d.ts +0 -10
  134. package/dist/types/base/index.d.ts +0 -4
  135. package/dist/types/html-copilot-textarea-element.d.ts +0 -7
  136. package/dist/types/index.d.ts +0 -14
  137. /package/dist/{chunk-BBKDE7YT.mjs.map → chunk-F2TIBXML.mjs.map} +0 -0
  138. /package/dist/{chunk-7QWJ3OV7.mjs.map → chunk-KLROO6ID.mjs.map} +0 -0
  139. /package/dist/{chunk-3TK2VELX.mjs.map → chunk-YXA3UPMI.mjs.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAUA,SAAgB,YAAY,WAAW,QAAQ,gBAAgB;AAE/D,OAAO,UAAU;AACjB,OAAO,YAAY;AAEnB,SAAS,sBAAsB;AA8I3B,mBACE,KACA,YAFF;AAjIG,IAAM,iCAET,CAAC;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,oBAAoB,IAAI,WAAW,cAAc;AAEzD,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAiB,EAAE;AAC/D,QAAM,CAAC,qBAAqB,sBAAsB,IAChD,SAAkB,KAAK;AAEzB,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAiB,EAAE;AAEnE,QAAM,CAAC,sBAAsB,uBAAuB,IAClD,SAAwC,IAAI;AAE9C,QAAM,wBAAwB,OAA4B,IAAI;AAC9D,QAAM,wBAAwB,OAA4B,IAAI;AAE9D,QAAM,CAAC,cAAc,eAAe,IAAI,SAA4B,CAAC,CAAC;AAEtE,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAA4B,CAAC,CAAC;AAC1E,YAAU,MAAM;AACd,sBAAkB,oBAAoB,iBAAiB,CAAC;AAAA,EAC1D,GAAG,CAAC,mBAAmB,mBAAmB,CAAC;AAE3C,gCAAoB,uBAAuB,kBAAkB,EAAE;AAC/D,gCAAoB,uBAAuB,oBAAoB,EAAE;AAGjE,YAAU,MAAM;AA7DlB;AA8DI,gCAAsB,YAAtB,mBAA+B;AAAA,EACjC,GAAG,CAAC,CAAC;AAGL,YAAU,MAAM;AAEd,QAAI,CAAC,sBAAsB;AACzB;AAAA,IACF;AAGA,QAAI,qBAAqB,QAAQ;AAC/B;AAAA,IACF;AAGA,sBAAkB,EAAE;AAGpB,UAA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,YAAY,MAO5D;AAAA,QAEJ,CAAC;AAAA,OACH;AAAA;AAAA,GACF;AAEJ;AAOO,IAAM,kBAAiD,CAAC;AAAA,EAC7D;AAAA,EACA;AACF,MAAM;AACJ,SACE,oBAAC;AAAA,IACC,OAAO,YAAY;AAAA,IACnB;AAAA,IACA,QAAQ,oBAAC;AAAA,MAAO,IAAI,EAAE,iBAAiB,cAAc;AAAA,KAAG;AAAA,GAC1D;AAEJ","sourcesContent":["import useAutosizeTextArea from \"../../../hooks/misc/use-autosize-textarea\";\nimport { MinimalChatGPTMessage } from \"../../../types\";\nimport {\n EditingEditorState,\n Generator_InsertionOrEditingSuggestion,\n} from \"../../../types/base/autosuggestions-bare-function\";\nimport { SourceSearchBox } from \"../../source-search-box/source-search-box\";\nimport { DocumentPointer } from \"@copilotkit/react-core\";\nimport { Button } from \"../../ui/button\";\nimport { Label } from \"../../ui/label\";\nimport React, { useContext, useEffect, useRef, useState } from \"react\";\n\nimport Chip from \"@mui/material/Chip\";\nimport Avatar from \"@mui/material/Avatar\";\nimport { streamPromiseFlatten } from \"../../../lib/stream-promise-flatten\";\nimport { CopilotContext } from \"@copilotkit/react-core\";\n\nexport type SuggestionState = {\n editorState: EditingEditorState;\n};\n\nexport interface HoveringInsertionPromptBoxCoreProps {\n state: SuggestionState;\n performInsertion: (insertedText: string) => void;\n insertionOrEditingFunction: Generator_InsertionOrEditingSuggestion;\n contextCategories: string[];\n}\n\nexport const HoveringInsertionPromptBoxCore: React.FC<\n HoveringInsertionPromptBoxCoreProps\n> = ({\n performInsertion,\n state,\n insertionOrEditingFunction,\n contextCategories,\n}) => {\n const { getDocumentsContext } = useContext(CopilotContext);\n\n const [editSuggestion, setEditSuggestion] = useState<string>(\"\");\n const [suggestionIsLoading, setSuggestionIsLoading] =\n useState<boolean>(false);\n\n const [adjustmentPrompt, setAdjustmentPrompt] = useState<string>(\"\");\n\n const [generatingSuggestion, setGeneratingSuggestion] =\n useState<ReadableStream<string> | null>(null);\n\n const adjustmentTextAreaRef = useRef<HTMLTextAreaElement>(null);\n const suggestionTextAreaRef = useRef<HTMLTextAreaElement>(null);\n\n const [filePointers, setFilePointers] = useState<DocumentPointer[]>([]);\n\n const [suggestedFiles, setSuggestedFiles] = useState<DocumentPointer[]>([]);\n useEffect(() => {\n setSuggestedFiles(getDocumentsContext(contextCategories));\n }, [contextCategories, getDocumentsContext]);\n\n useAutosizeTextArea(suggestionTextAreaRef, editSuggestion || \"\");\n useAutosizeTextArea(adjustmentTextAreaRef, adjustmentPrompt || \"\");\n\n // initially focus on the adjustment prompt text area\n useEffect(() => {\n adjustmentTextAreaRef.current?.focus();\n }, []);\n\n // continuously read the generating suggestion stream and update the edit suggestion\n useEffect(() => {\n // if no generating suggestion, do nothing\n if (!generatingSuggestion) {\n return;\n }\n\n // Check if the stream is already locked (i.e. already reading from it)\n if (generatingSuggestion.locked) {\n return;\n }\n\n // reset the edit suggestion\n setEditSuggestion(\"\");\n\n // read the generating suggestion stream and continuously update the edit suggestion\n const reader = generatingSuggestion.getReader();\n\n const read = async () => {\n setSuggestionIsLoading(true);\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n setEditSuggestion((prev) => {\n const newSuggestion = prev + value;\n\n // Scroll to the bottom of the textarea. We call this here to make sure scroll-to-bottom is synchronous with the state update.\n if (suggestionTextAreaRef.current) {\n suggestionTextAreaRef.current.scrollTop =\n suggestionTextAreaRef.current.scrollHeight;\n }\n return newSuggestion;\n });\n }\n\n setSuggestionIsLoading(false);\n };\n read();\n\n return () => {\n const releaseLockIfNotClosed = async () => {\n try {\n await reader.closed;\n } catch {\n reader.releaseLock();\n }\n };\n\n releaseLockIfNotClosed();\n };\n }, [generatingSuggestion]);\n\n // when the adjustment prompt changes, reset the edit suggestion\n const begingGeneratingAdjustment = async () => {\n // don't generate text if the prompt is empty\n if (!adjustmentPrompt.trim()) {\n return;\n }\n\n // if the current edit suggestion is not empty, then use it as the selected text instead of the editor state's selected text\n let editorState = state.editorState;\n if (editSuggestion !== \"\") {\n editorState.selectedText = editSuggestion;\n }\n\n const adjustmentSuggestionTextStreamPromise = insertionOrEditingFunction(\n editorState,\n adjustmentPrompt,\n new AbortController().signal\n );\n const adjustmentSuggestionTextStream = streamPromiseFlatten(\n adjustmentSuggestionTextStreamPromise\n );\n\n setGeneratingSuggestion(adjustmentSuggestionTextStream);\n };\n\n const isLoading = suggestionIsLoading;\n\n const textToEdit = editSuggestion || state.editorState.selectedText;\n const adjustmentLabel =\n textToEdit === \"\"\n ? \"Describe the text you want to insert\"\n : \"Describe adjustments to the suggested text\";\n const placeholder =\n textToEdit === \"\"\n ? \"e.g. 'summarize the client's top 3 pain-points from @CallTranscript'\"\n : \"e.g. 'make it more formal', 'be more specific', ...\";\n\n const AdjustmentPromptComponent = (\n <>\n <Label className=\"\">{adjustmentLabel}</Label>\n <div className=\"relative w-full flex items-center\">\n <textarea\n disabled={suggestionIsLoading}\n ref={adjustmentTextAreaRef}\n value={adjustmentPrompt}\n onChange={(e) => setAdjustmentPrompt(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && e.shiftKey) {\n e.preventDefault();\n setAdjustmentPrompt(adjustmentPrompt + \"\\n\");\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n begingGeneratingAdjustment();\n }\n }}\n placeholder={placeholder}\n style={{ minHeight: \"3rem\" }}\n className=\"w-full bg-slate-100 h-auto h-min-14 text-sm p-2 rounded-md resize-none overflow-visible focus:outline-none focus:ring-0 focus:border-non pr-[3rem]\"\n rows={1}\n />\n <button\n onClick={begingGeneratingAdjustment}\n className=\"absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center\"\n >\n <i className=\"material-icons\">arrow_forward</i>\n </button>\n </div>\n </>\n );\n\n const SuggestionComponent = (\n <>\n <div className=\"flex justify-between items-end w-full\">\n <Label className=\"mt-4\">Suggested:</Label>\n <div className=\"ml-auto\">\n {isLoading && (\n <div className=\"flex justify-center items-center\">\n <div\n className=\"inline-block h-4 w-4 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]\"\n role=\"status\"\n >\n <span className=\"!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]\">\n Loading...\n </span>\n </div>\n </div>\n )}\n </div>\n </div>\n <textarea\n ref={suggestionTextAreaRef}\n value={editSuggestion}\n disabled={suggestionIsLoading}\n onChange={(e) => setEditSuggestion(e.target.value)}\n className=\"w-full text-base p-2 border border-gray-300 rounded-md resize-none bg-green-50\"\n style={{ overflow: \"auto\", maxHeight: \"10em\" }}\n />\n </>\n );\n\n const SubmitComponent = (\n <div className=\"flex w-full gap-4 justify-start\">\n <Button\n className=\" bg-green-700 text-white\"\n onClick={() => {\n performInsertion(editSuggestion);\n }}\n >\n Insert <i className=\"material-icons\">check</i>\n </Button>\n </div>\n );\n\n // show source search if the last word in the adjustment prompt BEGINS with an @\n const sourceSearchCandidate = adjustmentPrompt.split(\" \").pop();\n // if the candidate is @someCandidate, then 'someCandidate', otherwise undefined\n const sourceSearchWord = sourceSearchCandidate?.startsWith(\"@\")\n ? sourceSearchCandidate.slice(1)\n : undefined;\n\n return (\n <div className=\"w-full flex flex-col items-start relative gap-2\">\n {AdjustmentPromptComponent}\n {filePointers.length > 0 && (\n <IncludedFilesPreview\n includedFiles={filePointers}\n setIncludedFiles={setFilePointers}\n />\n )}\n {sourceSearchWord !== undefined && (\n <SourceSearchBox\n searchTerm={sourceSearchWord}\n suggestedFiles={suggestedFiles}\n onSelectedFile={(filePointer) => {\n setAdjustmentPrompt(\n adjustmentPrompt.replace(new RegExp(`@${sourceSearchWord}$`), \"\")\n );\n setFilePointers((prev) => [...prev, filePointer]);\n\n // focus back on the adjustment prompt, and move the cursor to the end\n adjustmentTextAreaRef.current?.focus();\n }}\n />\n )}\n {generatingSuggestion ? SuggestionComponent : null}\n {generatingSuggestion ? SubmitComponent : null}\n </div>\n );\n};\n\ninterface IncludedFilesPreviewProps {\n includedFiles: DocumentPointer[];\n setIncludedFiles: React.Dispatch<React.SetStateAction<DocumentPointer[]>>;\n}\n\nexport const IncludedFilesPreview: React.FC<IncludedFilesPreviewProps> = ({\n includedFiles,\n setIncludedFiles,\n}) => {\n return (\n <div className=\"flex flex-col gap-2 mt-2\">\n <Label className=\"\">Included context:</Label>\n <div className=\"flex flex-wrap gap-2\">\n {includedFiles.map((filePointer, index) => {\n return (\n <FileChipPreview\n key={`file-${filePointer.sourceApplication}.${filePointer.name}`}\n filePointer={filePointer}\n onDelete={() => {\n setIncludedFiles((prev) =>\n prev.filter((fp) => fp !== filePointer)\n );\n }}\n />\n );\n })}\n </div>\n </div>\n );\n};\n\nexport interface FileChipPreviewProp {\n filePointer: DocumentPointer;\n onDelete: () => void;\n}\n\nexport const FileChipPreview: React.FC<FileChipPreviewProp> = ({\n filePointer,\n onDelete,\n}) => {\n return (\n <Chip\n label={filePointer.name}\n onDelete={onDelete}\n avatar={<Avatar sx={{ backgroundColor: \"transparent\" }}></Avatar>}\n />\n );\n};\n"]}
@@ -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"]}
@@ -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"]}
@@ -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"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,SAAS,sBAAsB;AAC/B,SAAS,aAAa,kBAAkB;AAsBjC,SAAS,sCACd,iBACA,mBACA,WAC6B;AAC7B,QAAM,EAAE,kBAAkB,iBAAiB,IAAI,WAAW,cAAc;AAExE,SAAO;AAAA,IACL,CAAO,aAAmC,gBAA6B;AACrE,YAAM,MAAM,MAAM,MAAM,MAAY;AAClC,cAAM,WAAoC;AAAA,UACxC;AAAA,YACE,MAAM;AAAA,YACN,SAAS,UAAU;AAAA,cACjB;AAAA,cACA,iBAAiB,iBAAiB;AAAA,YACpC;AAAA,UACF;AAAA,UACA,GAAG,UAAU;AAAA,UACb;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS,YAAY;AAAA,UACvB;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS,YAAY;AAAA,UACvB;AAAA,QACF;AAEA,cAAM,cACJ,oBAAoB,qBAAqB,gBAAgB;AAC3D,cAAM,SAAS,MAAM,YAAY;AAAA,UAC/B;AAAA,UACA;AAAA,UACA,UAAU;AAAA,QACZ;AAGA,cAAM,SAAS,OAAO,UAAU;AAChC,YAAI,SAAS;AAEb,eAAO,MAAM;AACX,gBAAM,EAAE,MAAM,MAAM,IAAI,MAAM,OAAO,KAAK;AAC1C,cAAI,MAAM;AACR;AAAA,UACF;AACA,oBAAU;AAAA,QACZ;AAEA,eAAO;AAAA,MACT,EAAC;AAED,aAAO;AAAA,IACT;AAAA,IACA,CAAC,WAAW,kBAAkB,mBAAmB,eAAe;AAAA,EAClE;AACF","sourcesContent":["import { CopilotContext } from \"@copilotkit/react-core\";\nimport { useCallback, useContext } from \"react\";\nimport {\n AutosuggestionsBareFunction,\n ChatlikeApiEndpoint,\n MinimalChatGPTMessage,\n} from \"../../types\";\nimport { retry } from \"../../lib/retry\";\nimport { InsertionEditorState } from \"../../types/base/autosuggestions-bare-function\";\nimport { SuggestionsApiConfig } from \"../../types/autosuggestions-config/suggestions-api-config\";\n/**\n * Returns a memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n * The function takes in the text before and after the cursor, and an abort signal.\n * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.\n * The function returns the suggestion from the API response.\n *\n * @param textareaPurpose - The purpose of the textarea. This is included in the system message.\n * @param apiEndpoint - The API endpoint to send the autosuggestion request to.\n * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.\n * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.\n * @param contextCategories - The categories of context strings we want to include. By default, we include the (default) \"global\" context category.\n * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n */\nexport function useMakeStandardAutosuggestionFunction(\n textareaPurpose: string,\n contextCategories: string[] | undefined,\n apiConfig: SuggestionsApiConfig\n): AutosuggestionsBareFunction {\n const { getContextString, copilotApiConfig } = useContext(CopilotContext);\n\n return useCallback(\n async (editorState: InsertionEditorState, abortSignal: AbortSignal) => {\n const res = await retry(async () => {\n const messages: MinimalChatGPTMessage[] = [\n {\n role: \"system\",\n content: apiConfig.makeSystemPrompt(\n textareaPurpose,\n getContextString(contextCategories)\n ),\n },\n ...apiConfig.fewShotMessages,\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: editorState.textAfterCursor,\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: editorState.textBeforeCursor,\n },\n ];\n\n const apiEndpoint =\n ChatlikeApiEndpoint.fromCopilotApiConfig(copilotApiConfig);\n const stream = await apiEndpoint.run(\n abortSignal,\n messages,\n apiConfig.forwardedParams\n );\n\n // read the stream:\n const reader = stream.getReader();\n let result = \"\";\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n result += value;\n }\n\n return result;\n });\n\n return res;\n },\n [apiConfig, getContextString, contextCategories, textareaPurpose]\n );\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx"],"names":[],"mappings":";;;;;;;AAAA;AAAA,EAEE;AAAA,OACK;AAeA,IAAM,sBAAN,MAA0B;AAAA,EAG/B,YAAY,KAAuC;AACjD,SAAK,MAAM;AAAA,EACb;AAAA,EAOA,OAAO,qBACL,kBACqB;AACrB,WAAO,IAAI;AAAA,MACT,CACE,aACA,UACA,mBACG;AACH,cAAM,MAAM,MAAM;AAAA,UAChB,6BAA6B,gBAAgB,EAAE;AAAA,UAC/C;AAAA,YACE,QAAQ;AAAA,YACR,MAAM,KAAK,UAAU,iCAChB,iBADgB;AAAA,cAEnB;AAAA,YACF,EAAC;AAAA,YACD,QAAQ;AAAA,UACV;AAAA,QACF;AAEA,cAAM,aAAgD,IAAI;AAC1D,YAAI,CAAC,YAAY;AACf,gBAAM,IAAI,MAAM,6BAA6B;AAAA,QAC/C;AAGA,cAAM,eAAe,WAAW,YAAY,IAAI,kBAAkB,CAAC;AAEnE,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAAA,EAOA,OAAO,OAAO,KAA4D;AACxE,WAAO,IAAI,oBAAoB,GAAG;AAAA,EACpC;AACF","sourcesContent":["import {\n CopilotApiConfig,\n copilotApiConfigExtrapolator,\n} from \"@copilotkit/react-core\";\nimport { MinimalChatGPTMessage } from \"./minimal-chat-gpt-message\";\n\nexport type ChatlikeApiEndpointImpl = (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n) => Promise<string>;\n\nexport type StreamingChatlikeApiEndpointImpl = (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n) => Promise<ReadableStream<string>>;\n\nexport class ChatlikeApiEndpoint {\n public run: StreamingChatlikeApiEndpointImpl;\n\n constructor(run: StreamingChatlikeApiEndpointImpl) {\n this.run = run;\n }\n\n /**\n * Creates a new instance of ChatlikeApiEndpoint with the provided API endpoint.\n * @param apiEndpoint The URL of the OpenAI-compatible API endpoint.\n * @returns A new instance of ChatlikeApiEndpoint.\n */\n static fromCopilotApiConfig(\n copilotApiConfig: CopilotApiConfig\n ): ChatlikeApiEndpoint {\n return new ChatlikeApiEndpoint(\n async (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n ) => {\n const res = await fetch(\n copilotApiConfigExtrapolator(copilotApiConfig).chatApiEndpoint,\n {\n method: \"POST\",\n body: JSON.stringify({\n ...forwardedProps,\n messages: messages,\n }),\n signal: abortSignal,\n }\n );\n\n const bodySteram: ReadableStream<Uint8Array> | null = res.body;\n if (!bodySteram) {\n throw new Error(\"The response body is empty.\");\n }\n\n // map the stream to a stream of strings\n const stringStream = bodySteram.pipeThrough(new TextDecoderStream());\n\n return stringStream;\n }\n );\n }\n\n /**\n * Creates a fully customized instance of ChatlikeApiEndpoint.\n * @param run - The implementation of the ChatlikeApiEndpointImpl interface.\n * @returns A new instance of ChatlikeApiEndpoint .\n */\n static custom(run: StreamingChatlikeApiEndpointImpl): ChatlikeApiEndpoint {\n return new ChatlikeApiEndpoint(run);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/source-search-box/source-search-box.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,SAAS,gBAAgB;AAmDnB,cAkBU,YAlBV;AArBC,SAAS,gBAAgB,OAA6B;AAC3D,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAiB,EAAE;AAE7D,SACE,qBAAC;AAAA,IACC,WAAU;AAAA,IACV,OAAO;AAAA,IACP,eAAe,CAAC,UAAU;AACxB,uBAAiB,KAAK;AAAA,IACxB;AAAA,IACA,QAAQ,CAAC,OAAO,WAAW;AAEzB,UAAI,MAAM,eAAe;AAAI,eAAO;AAGpC,UAAI,MAAM,WAAW,MAAM,UAAU;AAAG,eAAO;AAG/C,aAAO;AAAA,IACT;AAAA,IAEA;AAAA,0BAAC;AAAA,QACC,OAAO,MAAM;AAAA,QACb,WAAU;AAAA,QACV,aAAY;AAAA,OACd;AAAA,MACA,qBAAC;AAAA,QACC;AAAA,8BAAC;AAAA,YAAa;AAAA,WAAiB;AAAA,UAE/B,oBAAC;AAAA,YAAa,SAAQ;AAAA,YACnB,gBAAM,eAAe,IAAI,CAAC,gBAAgB;AACzC,qBACE,oBAAC;AAAA,gBAEC,OAAO,YAAY;AAAA,gBACnB,UAAU,CAAC,UAAU;AACnB,wBAAM,eAAe,WAAW;AAAA,gBAClC;AAAA,gBAEA,+BAAC;AAAA,kBAAI,WAAU;AAAA,kBACb;AAAA,wCAAC;AAAA,sBAAK,MAAK;AAAA,sBACT,8BAAC;AAAA,wBACC,KAAK,YAAY;AAAA,wBACjB,KAAK,YAAY;AAAA,wBACjB,OAAO;AAAA,wBACP,QAAQ;AAAA,uBACV;AAAA,qBACF;AAAA,oBACC,YAAY;AAAA;AAAA,iBACf;AAAA,iBAhBK,QAAQ,YAAY,qBAAqB,YAAY,MAiB5D;AAAA,YAEJ,CAAC;AAAA,WACH;AAAA,UAqBA,oBAAC,oBAAiB;AAAA;AAAA,OACpB;AAAA;AAAA,GACF;AAEJ;AAEO,SAAS,KAAK;AAAA,EACnB;AAAA,EACA,OAAO;AACT,GAGG;AACD,SACE,oBAAC;AAAA,IACC,WAAU;AAAA,IACV,OAAO,EAAE,OAAO,MAAM,QAAQ,KAAK;AAAA,IAElC;AAAA,GACH;AAEJ","sourcesContent":["import { useState } from \"react\";\nimport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n} from \"../ui/command\";\n\nimport {\n Calculator,\n Calendar,\n CreditCard,\n Settings,\n Smile,\n User,\n} from \"lucide-react\";\n\nimport { DocumentPointer } from \"@copilotkit/react-core\";\n\nexport interface SourceSearchBoxProps {\n searchTerm: string;\n suggestedFiles: DocumentPointer[];\n onSelectedFile: (filePointer: DocumentPointer) => void;\n}\n\nexport function SourceSearchBox(props: SourceSearchBoxProps) {\n const [selectedValue, setSelectedValue] = useState<string>(\"\");\n\n return (\n <Command\n className=\"rounded-lg border shadow-md\"\n value={selectedValue}\n onValueChange={(value) => {\n setSelectedValue(value);\n }}\n filter={(value, search) => {\n // if the search term is empty, show all commands\n if (props.searchTerm === \"\") return 1;\n\n // if the search term is a prefix of the command, show it\n if (value.startsWith(props.searchTerm)) return 1;\n\n // otherwise, don't show it\n return 0;\n }}\n >\n <CommandInput\n value={props.searchTerm}\n className=\"rounded-t-lg hidden\"\n placeholder=\"Search for a command...\"\n />\n <CommandList>\n <CommandEmpty>No results found.</CommandEmpty>\n\n <CommandGroup heading=\"Available resources\">\n {props.suggestedFiles.map((filePointer) => {\n return (\n <CommandItem\n key={`word-${filePointer.sourceApplication}.${filePointer.name}`}\n value={filePointer.name}\n onSelect={(value) => {\n props.onSelectedFile(filePointer);\n }}\n >\n <div className=\"flex flex-row gap-3 items-center\">\n <Logo size=\"30px\">\n <img\n src={filePointer.iconImageUri}\n alt={filePointer.sourceApplication}\n width={30}\n height={30}\n />\n </Logo>\n {filePointer.name}\n </div>\n </CommandItem>\n );\n })}\n </CommandGroup>\n\n {/* <CommandGroup heading=\"Suggestions\">\n <CommandItem\n onSelect={(value) => {\n console.log(value);\n console.log(value);\n }}\n >\n <Calendar className=\"mr-2 h-4 w-4\" />\n <span>Calendar</span>\n </CommandItem>\n <CommandItem>\n <Smile className=\"mr-2 h-4 w-4\" />\n <span>Search Emoji</span>\n </CommandItem>\n <CommandItem>\n <Calculator className=\"mr-2 h-4 w-4\" />\n <span>Calculator</span>\n </CommandItem>\n </CommandGroup> */}\n <CommandSeparator />\n </CommandList>\n </Command>\n );\n}\n\nexport function Logo({\n children,\n size = \"30px\",\n}: {\n children: React.ReactNode;\n size?: string;\n}) {\n return (\n <div\n className=\"flex items-center justify-center bg-black\"\n style={{ width: size, height: size }}\n >\n {children}\n </div>\n );\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,SAAS,sBAAsB;AAC/B,SAAS,aAAa,kBAAkB;AAyBjC,SAAS,0CACd,iBACA,mBACA,oBACA,kBACwC;AACxC,QAAM,EAAE,kBAAkB,iBAAiB,IAAI,WAAW,cAAc;AAExE,QAAM,oBAAoB;AAAA,IACxB,CACE,aACA,iBACA,gBACG;AACH,YAAM,MAAM,MAAM,MAAM,MAAY;AAClC,cAAM,WAAoC;AAAA,UACxC;AAAA,YACE,MAAM;AAAA,YACN,SAAS,mBAAmB;AAAA,cAC1B;AAAA,cACA,iBAAiB,iBAAiB;AAAA,YACpC;AAAA,UACF;AAAA,UACA,GAAG,mBAAmB;AAAA,UACtB;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS,YAAY;AAAA,UACvB;AAAA,UAC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I,YAAY,iBAAiB,IAAI;AACnC,eAAO,MAAM;AAAA,UACX;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF,OAAO;AACL,eAAO,MAAM,gBAAgB,aAAa,iBAAiB,WAAW;AAAA,MACxE;AAAA,IACF;AAAA,IACA,CAAC,mBAAmB,eAAe;AAAA,EACrC;AAEA,SAAO;AACT","sourcesContent":["import { CopilotContext } from \"@copilotkit/react-core\";\nimport { useCallback, useContext } from \"react\";\nimport { ChatlikeApiEndpoint, MinimalChatGPTMessage } from \"../../types\";\nimport { retry } from \"../../lib/retry\";\nimport {\n EditingEditorState,\n Generator_InsertionOrEditingSuggestion,\n InsertionEditorApiConfig,\n InsertionEditorState,\n} from \"../../types/base/autosuggestions-bare-function\";\nimport { InsertionsApiConfig } from \"../../types/autosuggestions-config/insertions-api-config\";\nimport { EditingApiConfig } from \"../../types/autosuggestions-config/editing-api-config\";\n\n/**\n * Returns a memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n * The function takes in the text before and after the cursor, and an abort signal.\n * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.\n * The function returns the suggestion from the API response.\n *\n * @param textareaPurpose - The purpose of the textarea. This is included in the system message.\n * @param apiEndpoint - The API endpoint to send the autosuggestion request to.\n * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.\n * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.\n * @param contextCategories - The categories of context strings we want to include. By default, we include the (default) \"global\" context category.\n * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n */\nexport function useMakeStandardInsertionOrEditingFunction(\n textareaPurpose: string,\n contextCategories: string[] | undefined,\n insertionApiConfig: InsertionsApiConfig,\n editingApiConfig: EditingApiConfig\n): Generator_InsertionOrEditingSuggestion {\n const { getContextString, copilotApiConfig } = useContext(CopilotContext);\n\n const insertionFunction = useCallback(\n async (\n editorState: EditingEditorState,\n insertionPrompt: string,\n abortSignal: AbortSignal\n ) => {\n const res = await retry(async () => {\n const messages: MinimalChatGPTMessage[] = [\n {\n role: \"system\",\n content: insertionApiConfig.makeSystemPrompt(\n textareaPurpose,\n getContextString(contextCategories)\n ),\n },\n ...insertionApiConfig.fewShotMessages,\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: editorState.textAfterCursor,\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: editorState.textBeforeCursor,\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: insertionPrompt,\n },\n ];\n\n const apiEndpoint =\n ChatlikeApiEndpoint.fromCopilotApiConfig(copilotApiConfig);\n return await apiEndpoint.run(\n abortSignal,\n messages,\n insertionApiConfig.forwardedParams\n );\n });\n\n return res;\n },\n [insertionApiConfig, getContextString, contextCategories, textareaPurpose]\n );\n\n const editingFunction = useCallback(\n async (\n editorState: EditingEditorState,\n editingPrompt: string,\n abortSignal: AbortSignal\n ) => {\n const res = await retry(async () => {\n const messages: MinimalChatGPTMessage[] = [\n {\n role: \"system\",\n content: editingApiConfig.makeSystemPrompt(\n textareaPurpose,\n getContextString(contextCategories)\n ),\n },\n ...editingApiConfig.fewShotMessages,\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: editorState.textBeforeCursor,\n },\n {\n role: \"user\",\n name: \"TextToEdit\",\n content: editorState.selectedText,\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: editorState.textAfterCursor,\n },\n {\n role: \"user\",\n name: \"EditingPrompt\",\n content: editingPrompt,\n },\n ];\n\n const apiEndpoint =\n ChatlikeApiEndpoint.fromCopilotApiConfig(copilotApiConfig);\n return await apiEndpoint.run(\n abortSignal,\n messages,\n editingApiConfig.forwardedParams\n );\n });\n\n return res;\n },\n [editingApiConfig, getContextString, contextCategories, textareaPurpose]\n );\n\n const insertionOrEditingFunction = useCallback(\n async (\n editorState: EditingEditorState,\n insertionPrompt: string,\n abortSignal: AbortSignal\n ) => {\n if (editorState.selectedText === \"\") {\n return await insertionFunction(\n editorState,\n insertionPrompt,\n abortSignal\n );\n } else {\n return await editingFunction(editorState, insertionPrompt, abortSignal);\n }\n },\n [insertionFunction, editingFunction]\n );\n\n return insertionOrEditingFunction;\n}\n"]}
@@ -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"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/ui/command.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,YAAY,WAAW;AAEvB,SAAS,WAAW,wBAAwB;AAU1C;AAdF;AAUA,IAAM,UAAgB,iBAGpB,CAAC,IAAyB,QAAK;AAA9B,eAAE,YAbL,IAaG,IAAgB,kBAAhB,IAAgB,CAAd;AACH,6BAAC;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAA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AAc,iBAAiB,MAAM;AAElD,IAAM,mBAAyB,iBAG7B,CAAC,IAAyB,QAAK;AAA9B,eAAE,YAvGL,IAuGG,IAAgB,kBAAhB,IAAgB,CAAd;AACH,6BAAC,iBAAiB,WAAjB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,wBAAwB,SAAS;AAAA,KAC3C,MACN;AAAA,CACD;AACD,iBAAiB,cAAc,iBAAiB,UAAU;AAE1D,IAAM,cAAoB,iBAGxB,CAAC,IAAyB,QAAK;AAA9B,eAAE,YAnHL,IAmHG,IAAgB,kBAAhB,IAAgB,CAAd;AACH,6BAAC,iBAAiB,MAAjB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,KACI,MACN;AAAA,CACD;AAED,YAAY,cAAc,iBAAiB,KAAK;AAEhD,IAAM,kBAAkB,CAAC,OAGoB;AAHpB,eACvB;AAAA;AAAA,EAjIF,IAgIyB,IAEpB,kBAFoB,IAEpB;AAAA,IADH;AAAA;AAGA,SACE,oBAAC;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,KACI,MACN;AAEJ;AACA,gBAAgB,cAAc","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { DialogProps } from \"@radix-ui/react-dialog\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { Search } from \"lucide-react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { Dialog, DialogContent } from \"./dialog\";\n\nconst Command = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n className\n )}\n {...props}\n />\n));\nCommand.displayName = CommandPrimitive.displayName;\n\ninterface CommandDialogProps extends DialogProps {}\n\nconst CommandDialog = ({ children, ...props }: CommandDialogProps) => {\n return (\n <Dialog {...props}>\n <DialogContent className=\"overflow-hidden p-0 shadow-lg\">\n <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n );\n};\n\nconst CommandInput = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, ...props }, ref) => (\n <div className=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n {/* <Search className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" /> */}\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n \"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n />\n </div>\n));\n\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\nconst CommandList = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n {...props}\n />\n));\n\nCommandList.displayName = CommandPrimitive.List.displayName;\n\nconst CommandEmpty = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n));\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\nconst CommandGroup = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n \"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n className\n )}\n {...props}\n />\n));\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\nconst CommandSeparator = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\nconst CommandItem = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n />\n));\n\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n\nconst CommandShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className\n )}\n {...props}\n />\n );\n};\nCommandShortcut.displayName = \"CommandShortcut\";\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n};\n"]}
@@ -1,13 +0,0 @@
1
- import React__default from 'react';
2
- import { BaseCopilotTextareaProps } from '../../types/base/base-copilot-textarea-props.js';
3
- import '../../types/base/base-autosuggestions-config.js';
4
- import '../../types/base/autosuggestions-bare-function.js';
5
-
6
- interface HTMLCopilotTextAreaElement extends HTMLElement {
7
- value: string;
8
- focus: () => void;
9
- blur: () => void;
10
- }
11
- declare const BaseCopilotTextarea: React__default.ForwardRefExoticComponent<BaseCopilotTextareaProps & React__default.RefAttributes<HTMLCopilotTextAreaElement>>;
12
-
13
- export { BaseCopilotTextarea, HTMLCopilotTextAreaElement };
@@ -1,6 +0,0 @@
1
- import { RenderElementProps } from 'slate-react';
2
-
3
- type RenderElementFunction = (props: RenderElementProps) => JSX.Element;
4
- declare function makeRenderElementFunction(suggestionsStyle: React.CSSProperties): RenderElementFunction;
5
-
6
- export { RenderElementFunction, makeRenderElementFunction };
@@ -1,6 +0,0 @@
1
- import { RenderPlaceholderProps } from 'slate-react';
2
-
3
- type RenderPlaceholderFunction = (props: RenderPlaceholderProps) => JSX.Element;
4
- declare function makeRenderPlaceholderFunction(placeholderStyle?: React.CSSProperties): RenderPlaceholderFunction;
5
-
6
- export { RenderPlaceholderFunction, makeRenderPlaceholderFunction };
@@ -1,6 +0,0 @@
1
- interface TrackerTextEditedSinceLastCursorMovementProps {
2
- setCursorMovedSinceLastTextChange: (value: boolean) => void;
3
- }
4
- declare function TrackerTextEditedSinceLastCursorMovement(props: TrackerTextEditedSinceLastCursorMovementProps): JSX.Element;
5
-
6
- export { TrackerTextEditedSinceLastCursorMovement };
@@ -1,3 +0,0 @@
1
- declare function useAddBrandingCss(suggestionStyleAugmented: React.CSSProperties, disableBranding: boolean | undefined): void;
2
-
3
- export { useAddBrandingCss };
@@ -1,19 +0,0 @@
1
- import React__default from 'react';
2
- import { BaseCopilotTextareaProps } from '../../types/base/base-copilot-textarea-props.js';
3
- import { HTMLCopilotTextAreaElement } from '../../types/html-copilot-textarea-element.js';
4
- import { AutosuggestionsConfigUserSpecified } from '../../types/autosuggestions-config/autosuggestions-config-user-specified.js';
5
- import '../../types/base/base-autosuggestions-config.js';
6
- import '../../types/base/autosuggestions-bare-function.js';
7
- import '../../types/autosuggestions-config/autosuggestions-config.js';
8
- import '../../types/autosuggestions-config/suggestions-api-config.js';
9
- import '../../types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js';
10
- import '../../types/autosuggestions-config/subtypes/make-system-prompt.js';
11
- import '../../types/autosuggestions-config/insertions-api-config.js';
12
- import '../../types/autosuggestions-config/editing-api-config.js';
13
-
14
- interface CopilotTextareaProps extends Omit<BaseCopilotTextareaProps, "baseAutosuggestionsConfig"> {
15
- autosuggestionsConfig: AutosuggestionsConfigUserSpecified;
16
- }
17
- declare const CopilotTextarea: React__default.ForwardRefExoticComponent<CopilotTextareaProps & React__default.RefAttributes<HTMLCopilotTextAreaElement>>;
18
-
19
- export { CopilotTextarea, CopilotTextareaProps };
@@ -1,13 +0,0 @@
1
- import { ReactNode } from 'react';
2
-
3
- interface HoveringEditorContextProps {
4
- isDisplayed: boolean;
5
- setIsDisplayed: (value: boolean) => void;
6
- }
7
- interface HoveringEditorProviderProps {
8
- children: ReactNode;
9
- }
10
- declare const HoveringEditorProvider: ({ children, }: HoveringEditorProviderProps) => JSX.Element;
11
- declare const useHoveringEditorContext: () => HoveringEditorContextProps;
12
-
13
- export { HoveringEditorProvider, useHoveringEditorContext };
@@ -1,18 +0,0 @@
1
- import React__default from 'react';
2
-
3
- interface BaseProps {
4
- className: string;
5
- [key: string]: unknown;
6
- }
7
- declare const Button: React__default.ForwardRefExoticComponent<Omit<React__default.PropsWithChildren<{
8
- active: boolean;
9
- reversed: boolean;
10
- } & BaseProps>, "ref"> & React__default.RefAttributes<HTMLSpanElement>>;
11
- declare const Icon: React__default.ForwardRefExoticComponent<Omit<React__default.PropsWithChildren<BaseProps>, "ref"> & React__default.RefAttributes<HTMLSpanElement>>;
12
- declare const Menu: React__default.ForwardRefExoticComponent<Omit<React__default.PropsWithChildren<BaseProps>, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
13
- declare const Portal: ({ children }: {
14
- children: React__default.ReactNode;
15
- }) => React__default.ReactPortal | null;
16
- declare const Toolbar: React__default.ForwardRefExoticComponent<Omit<React__default.PropsWithChildren<BaseProps>, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
17
-
18
- export { Button, Icon, Menu, Portal, Toolbar };
@@ -1,9 +0,0 @@
1
- import { InsertionEditorApiConfig } from '../../types/base/autosuggestions-bare-function.js';
2
-
3
- interface HoveringToolbarProps {
4
- apiConfig: InsertionEditorApiConfig;
5
- contextCategories: string[];
6
- }
7
- declare const HoveringToolbar: (props: HoveringToolbarProps) => JSX.Element | null;
8
-
9
- export { HoveringToolbar, HoveringToolbarProps };
@@ -1,26 +0,0 @@
1
- import { EditingEditorState, Generator_InsertionOrEditingSuggestion } from '../../../types/base/autosuggestions-bare-function.js';
2
- import { DocumentPointer } from '@copilotkit/react-core';
3
- import React__default from 'react';
4
-
5
- type SuggestionState = {
6
- editorState: EditingEditorState;
7
- };
8
- interface HoveringInsertionPromptBoxCoreProps {
9
- state: SuggestionState;
10
- performInsertion: (insertedText: string) => void;
11
- insertionOrEditingFunction: Generator_InsertionOrEditingSuggestion;
12
- contextCategories: string[];
13
- }
14
- declare const HoveringInsertionPromptBoxCore: React__default.FC<HoveringInsertionPromptBoxCoreProps>;
15
- interface IncludedFilesPreviewProps {
16
- includedFiles: DocumentPointer[];
17
- setIncludedFiles: React__default.Dispatch<React__default.SetStateAction<DocumentPointer[]>>;
18
- }
19
- declare const IncludedFilesPreview: React__default.FC<IncludedFilesPreviewProps>;
20
- interface FileChipPreviewProp {
21
- filePointer: DocumentPointer;
22
- onDelete: () => void;
23
- }
24
- declare const FileChipPreview: React__default.FC<FileChipPreviewProp>;
25
-
26
- export { FileChipPreview, FileChipPreviewProp, HoveringInsertionPromptBoxCore, HoveringInsertionPromptBoxCoreProps, IncludedFilesPreview, SuggestionState };
@@ -1,13 +0,0 @@
1
- import React__default from 'react';
2
- import { EditingEditorState, InsertionEditorApiConfig } from '../../../types/base/autosuggestions-bare-function.js';
3
-
4
- interface Props {
5
- editorState: EditingEditorState;
6
- apiConfig: InsertionEditorApiConfig;
7
- performInsertion: (insertedText: string) => void;
8
- closeWindow: () => void;
9
- contextCategories: string[];
10
- }
11
- declare const HoveringInsertionPromptBox: React__default.FC<Props>;
12
-
13
- export { HoveringInsertionPromptBox, Props };
@@ -1,3 +0,0 @@
1
- export { HoveringInsertionPromptBox, Props } from './hovering-insertion-prompt-box.js';
2
- import 'react';
3
- import '../../../types/base/autosuggestions-bare-function.js';
@@ -1,14 +0,0 @@
1
- export { BaseCopilotTextarea } from './base-copilot-textarea/base-copilot-textarea.js';
2
- export { CopilotTextarea, CopilotTextareaProps } from './copilot-textarea/copilot-textarea.js';
3
- import 'react';
4
- import '../types/base/base-copilot-textarea-props.js';
5
- import '../types/base/base-autosuggestions-config.js';
6
- import '../types/base/autosuggestions-bare-function.js';
7
- import '../types/html-copilot-textarea-element.js';
8
- import '../types/autosuggestions-config/autosuggestions-config-user-specified.js';
9
- import '../types/autosuggestions-config/autosuggestions-config.js';
10
- import '../types/autosuggestions-config/suggestions-api-config.js';
11
- import '../types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js';
12
- import '../types/autosuggestions-config/subtypes/make-system-prompt.js';
13
- import '../types/autosuggestions-config/insertions-api-config.js';
14
- import '../types/autosuggestions-config/editing-api-config.js';
@@ -1,10 +0,0 @@
1
- import React__default from 'react';
2
-
3
- interface ChipWithIconProps {
4
- label: string;
5
- onDelete: () => void;
6
- iconUrl: string;
7
- }
8
- declare const ChipWithIcon: React__default.FC<ChipWithIconProps>;
9
-
10
- export { ChipWithIcon, ChipWithIconProps };
@@ -1,14 +0,0 @@
1
- import { DocumentPointer } from '@copilotkit/react-core';
2
-
3
- interface SourceSearchBoxProps {
4
- searchTerm: string;
5
- suggestedFiles: DocumentPointer[];
6
- onSelectedFile: (filePointer: DocumentPointer) => void;
7
- }
8
- declare function SourceSearchBox(props: SourceSearchBoxProps): JSX.Element;
9
- declare function Logo({ children, size, }: {
10
- children: React.ReactNode;
11
- size?: string;
12
- }): JSX.Element;
13
-
14
- export { Logo, SourceSearchBox, SourceSearchBoxProps };
@@ -1,14 +0,0 @@
1
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
2
- import * as React from 'react';
3
- import { VariantProps } from 'class-variance-authority';
4
-
5
- declare const buttonVariants: (props?: ({
6
- variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
7
- size?: "default" | "sm" | "lg" | "icon" | null | undefined;
8
- } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
9
- interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
10
- asChild?: boolean;
11
- }
12
- declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
13
-
14
- export { Button, ButtonProps, buttonVariants };
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
-
3
- declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
4
- declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
5
- declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
6
- declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
7
- declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
8
- declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
9
-
10
- export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
@@ -1,48 +0,0 @@
1
- import * as React from 'react';
2
- import { DialogProps } from '@radix-ui/react-dialog';
3
-
4
- declare const Command: React.ForwardRefExoticComponent<Omit<{
5
- children?: React.ReactNode;
6
- } & React.HTMLAttributes<HTMLDivElement> & {
7
- label?: string | undefined;
8
- shouldFilter?: boolean | undefined;
9
- filter?: ((value: string, search: string) => number) | undefined;
10
- value?: string | undefined;
11
- onValueChange?: ((value: string) => void) | undefined;
12
- loop?: boolean | undefined;
13
- } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
14
- interface CommandDialogProps extends DialogProps {
15
- }
16
- declare const CommandDialog: ({ children, ...props }: CommandDialogProps) => JSX.Element;
17
- declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "type"> & {
18
- value?: string | undefined;
19
- onValueChange?: ((search: string) => void) | undefined;
20
- } & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
21
- declare const CommandList: React.ForwardRefExoticComponent<Omit<{
22
- children?: React.ReactNode;
23
- } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
24
- declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
25
- children?: React.ReactNode;
26
- } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
27
- declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
28
- children?: React.ReactNode;
29
- } & Omit<React.HTMLAttributes<HTMLDivElement>, "value" | "heading"> & {
30
- heading?: React.ReactNode;
31
- value?: string | undefined;
32
- } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
33
- declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement> & {
34
- alwaysRender?: boolean | undefined;
35
- } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
36
- declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
37
- children?: React.ReactNode;
38
- } & Omit<React.HTMLAttributes<HTMLDivElement>, "disabled" | "value" | "onSelect"> & {
39
- disabled?: boolean | undefined;
40
- onSelect?: ((value: string) => void) | undefined;
41
- value?: string | undefined;
42
- } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
43
- declare const CommandShortcut: {
44
- ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): JSX.Element;
45
- displayName: string;
46
- };
47
-
48
- export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
@@ -1,18 +0,0 @@
1
- import * as React from 'react';
2
- import * as DialogPrimitive from '@radix-ui/react-dialog';
3
-
4
- declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
5
- declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
- declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
- declare const DialogHeader: {
8
- ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): JSX.Element;
9
- displayName: string;
10
- };
11
- declare const DialogFooter: {
12
- ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): JSX.Element;
13
- displayName: string;
14
- };
15
- declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
16
- declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
17
-
18
- export { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger };
@@ -1,8 +0,0 @@
1
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
2
- import * as React from 'react';
3
- import * as LabelPrimitive from '@radix-ui/react-label';
4
- import { VariantProps } from 'class-variance-authority';
5
-
6
- declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_dist_types.ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
7
-
8
- export { Label };
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- import * as SeparatorPrimitive from '@radix-ui/react-separator';
3
-
4
- declare const Separator: React.ForwardRefExoticComponent<Omit<SeparatorPrimitive.SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
-
6
- export { Separator };
@@ -1,7 +0,0 @@
1
- import * as React from 'react';
2
-
3
- interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
4
- }
5
- declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
6
-
7
- export { Textarea, TextareaProps };
@@ -1 +0,0 @@
1
-
@@ -1,13 +0,0 @@
1
- import { AutosuggestionsBareFunction } from '../../types/base/autosuggestions-bare-function.js';
2
- import { AutosuggestionState } from '../../types/base/autosuggestion-state.js';
3
- import { EditorAutocompleteState } from '../../types/base/editor-autocomplete-state.js';
4
- import 'slate';
5
-
6
- interface UseAutosuggestionsResult {
7
- currentAutocompleteSuggestion: AutosuggestionState | null;
8
- onChangeHandler: (newEditorState: EditorAutocompleteState | null) => void;
9
- onKeyDownHandler: (event: React.KeyboardEvent<HTMLDivElement>) => void;
10
- }
11
- declare function useAutosuggestions(debounceTime: number, acceptAutosuggestionKey: string, autosuggestionFunction: AutosuggestionsBareFunction, insertAutocompleteSuggestion: (suggestion: AutosuggestionState) => void, disableWhenEmpty: boolean, disabled: boolean): UseAutosuggestionsResult;
12
-
13
- export { UseAutosuggestionsResult, useAutosuggestions };
@@ -1,8 +0,0 @@
1
- import { CustomEditor } from '../../types/base/custom-editor.js';
2
- import 'slate';
3
- import 'slate-react';
4
- import 'slate-history';
5
-
6
- declare function useCopilotTextareaEditor(): CustomEditor;
7
-
8
- export { useCopilotTextareaEditor };
@@ -1,7 +0,0 @@
1
- import React__default from 'react';
2
- import { Editor } from 'slate';
3
- import { HTMLCopilotTextAreaElement } from '../../types/html-copilot-textarea-element.js';
4
-
5
- declare function usePopulateCopilotTextareaRef(editor: Editor, ref: React__default.Ref<HTMLCopilotTextAreaElement>): void;
6
-
7
- export { usePopulateCopilotTextareaRef };
@@ -1 +0,0 @@
1
-
@@ -1,21 +0,0 @@
1
- import { AutosuggestionsBareFunction } from '../../types/base/autosuggestions-bare-function.js';
2
- import { SuggestionsApiConfig } from '../../types/autosuggestions-config/suggestions-api-config.js';
3
- import '../../types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js';
4
- import '../../types/autosuggestions-config/subtypes/make-system-prompt.js';
5
-
6
- /**
7
- * Returns a memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
8
- * The function takes in the text before and after the cursor, and an abort signal.
9
- * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.
10
- * The function returns the suggestion from the API response.
11
- *
12
- * @param textareaPurpose - The purpose of the textarea. This is included in the system message.
13
- * @param apiEndpoint - The API endpoint to send the autosuggestion request to.
14
- * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.
15
- * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.
16
- * @param contextCategories - The categories of context strings we want to include. By default, we include the (default) "global" context category.
17
- * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
18
- */
19
- declare function useMakeStandardAutosuggestionFunction(textareaPurpose: string, contextCategories: string[] | undefined, apiConfig: SuggestionsApiConfig): AutosuggestionsBareFunction;
20
-
21
- export { useMakeStandardAutosuggestionFunction };
@@ -1,22 +0,0 @@
1
- import { Generator_InsertionOrEditingSuggestion } from '../../types/base/autosuggestions-bare-function.js';
2
- import { InsertionsApiConfig } from '../../types/autosuggestions-config/insertions-api-config.js';
3
- import { EditingApiConfig } from '../../types/autosuggestions-config/editing-api-config.js';
4
- import '../../types/autosuggestions-config/subtypes/make-system-prompt.js';
5
- import '../../types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js';
6
-
7
- /**
8
- * Returns a memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
9
- * The function takes in the text before and after the cursor, and an abort signal.
10
- * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.
11
- * The function returns the suggestion from the API response.
12
- *
13
- * @param textareaPurpose - The purpose of the textarea. This is included in the system message.
14
- * @param apiEndpoint - The API endpoint to send the autosuggestion request to.
15
- * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.
16
- * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.
17
- * @param contextCategories - The categories of context strings we want to include. By default, we include the (default) "global" context category.
18
- * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
19
- */
20
- declare function useMakeStandardInsertionOrEditingFunction(textareaPurpose: string, contextCategories: string[] | undefined, insertionApiConfig: InsertionsApiConfig, editingApiConfig: EditingApiConfig): Generator_InsertionOrEditingSuggestion;
21
-
22
- export { useMakeStandardInsertionOrEditingFunction };
@@ -1,5 +0,0 @@
1
- import { RefObject } from 'react';
2
-
3
- declare const useAutosizeTextArea: (textAreaRef: RefObject<HTMLTextAreaElement>, value: string) => void;
4
-
5
- export { useAutosizeTextArea as default };
package/dist/index.d.ts DELETED
@@ -1,16 +0,0 @@
1
- export { BaseCopilotTextarea } from './components/base-copilot-textarea/base-copilot-textarea.js';
2
- export { CopilotTextarea, CopilotTextareaProps } from './components/copilot-textarea/copilot-textarea.js';
3
- export { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig } from './types/base/base-autosuggestions-config.js';
4
- export { AutosuggestionsBareFunction } from './types/base/autosuggestions-bare-function.js';
5
- export { BaseCopilotTextareaProps } from './types/base/base-copilot-textarea-props.js';
6
- export { HTMLCopilotTextAreaElement } from './types/html-copilot-textarea-element.js';
7
- export { AutosuggestionsConfig, defaultAutosuggestionsConfig } from './types/autosuggestions-config/autosuggestions-config.js';
8
- export { MinimalChatGPTMessage } from './types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js';
9
- export { MakeSystemPrompt } from './types/autosuggestions-config/subtypes/make-system-prompt.js';
10
- export { ChatlikeApiEndpoint, ChatlikeApiEndpointImpl } from './types/autosuggestions-config/subtypes/chatlike-api-endpoint.js';
11
- export { AutosuggestionsConfigUserSpecified, InsertionsApiConfigUserSpecified, SuggestionsApiConfigUserSpecified } from './types/autosuggestions-config/autosuggestions-config-user-specified.js';
12
- import 'react';
13
- import './types/autosuggestions-config/suggestions-api-config.js';
14
- import './types/autosuggestions-config/insertions-api-config.js';
15
- import './types/autosuggestions-config/editing-api-config.js';
16
- import '@copilotkit/react-core';