@copilotkit/react-textarea 0.19.1 → 0.20.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 (94) hide show
  1. package/.turbo/turbo-build.log +67 -62
  2. package/CHANGELOG.md +11 -0
  3. package/dist/{chunk-3TK2VELX.mjs → chunk-34D4UIYX.mjs} +2 -2
  4. package/dist/{chunk-L6DZHWEL.mjs → chunk-463BFNUP.mjs} +10 -9
  5. package/dist/chunk-463BFNUP.mjs.map +1 -0
  6. package/dist/{chunk-QNJ6MXJ2.mjs → chunk-7JO276KU.mjs} +3 -3
  7. package/dist/{chunk-QNJ6MXJ2.mjs.map → chunk-7JO276KU.mjs.map} +1 -1
  8. package/dist/{chunk-HRTFMM7P.mjs → chunk-AXN37AHC.mjs} +6 -8
  9. package/dist/chunk-AXN37AHC.mjs.map +1 -0
  10. package/dist/{chunk-BBKDE7YT.mjs → chunk-F2TIBXML.mjs} +3 -3
  11. package/dist/{chunk-47JRPWI3.mjs → chunk-F4WZCQG6.mjs} +20 -53
  12. package/dist/chunk-F4WZCQG6.mjs.map +1 -0
  13. package/dist/{chunk-FN7GDKKG.mjs → chunk-GCMQHIRF.mjs} +1 -1
  14. package/dist/chunk-GCMQHIRF.mjs.map +1 -0
  15. package/dist/{chunk-OXPXFYUG.mjs → chunk-IBSJOQI7.mjs} +13 -7
  16. package/dist/chunk-IBSJOQI7.mjs.map +1 -0
  17. package/dist/{chunk-7QWJ3OV7.mjs → chunk-LRXRD5KU.mjs} +2 -2
  18. package/dist/{chunk-RDHPSSHJ.mjs → chunk-OM3Z4S4Y.mjs} +5 -5
  19. package/dist/{chunk-K2AVA67P.mjs → chunk-PPWNZF3T.mjs} +2 -2
  20. package/dist/chunk-PPWNZF3T.mjs.map +1 -0
  21. package/dist/{chunk-66BDXIX4.mjs → chunk-RR6OQGTI.mjs} +7 -9
  22. package/dist/chunk-RR6OQGTI.mjs.map +1 -0
  23. package/dist/chunk-TIBMW3DC.mjs +48 -0
  24. package/dist/chunk-TIBMW3DC.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/components/base-copilot-textarea/base-copilot-textarea.d.ts +1 -0
  28. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +8 -7
  29. package/dist/components/copilot-textarea/copilot-textarea.d.ts +1 -0
  30. package/dist/components/copilot-textarea/copilot-textarea.mjs +14 -13
  31. package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +1 -0
  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.d.ts +2 -12
  34. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +5 -4
  35. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +1 -0
  36. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +6 -5
  37. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.d.ts +15 -0
  38. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +6 -0
  39. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +1 -0
  40. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.d.ts +1 -0
  41. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +6 -5
  42. package/dist/components/index.d.ts +1 -0
  43. package/dist/components/index.mjs +14 -13
  44. package/dist/components/source-search-box/source-search-box.d.ts +3 -2
  45. package/dist/components/source-search-box/source-search-box.mjs +2 -2
  46. package/dist/components/ui/command.mjs +1 -1
  47. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +1 -0
  48. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +1 -0
  49. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +4 -4
  50. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +1 -0
  51. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +4 -4
  52. package/dist/index.css +6 -7
  53. package/dist/index.css.map +1 -1
  54. package/dist/index.d.ts +1 -1
  55. package/dist/index.mjs +14 -13
  56. package/dist/lib/stream-promise-flatten.d.ts +9 -0
  57. package/dist/lib/stream-promise-flatten.mjs +1 -1
  58. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +1 -0
  59. package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +1 -0
  60. package/dist/types/autosuggestions-config/autosuggestions-config.mjs +3 -3
  61. package/dist/types/autosuggestions-config/editing-api-config.mjs +1 -1
  62. package/dist/types/autosuggestions-config/index.d.ts +1 -1
  63. package/dist/types/autosuggestions-config/index.mjs +3 -3
  64. package/dist/types/autosuggestions-config/insertions-api-config.mjs +1 -1
  65. package/dist/types/base/autosuggestions-bare-function.d.ts +3 -1
  66. package/dist/types/base/base-autosuggestions-config.d.ts +1 -0
  67. package/dist/types/base/base-copilot-textarea-props.d.ts +1 -0
  68. package/dist/types/base/index.d.ts +1 -0
  69. package/dist/types/index.d.ts +1 -1
  70. package/dist/types/index.mjs +3 -3
  71. package/package.json +2 -2
  72. package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +27 -62
  73. package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx +1 -1
  74. package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +54 -0
  75. package/src/components/source-search-box/source-search-box.tsx +9 -8
  76. package/src/components/ui/command.tsx +4 -1
  77. package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +1 -1
  78. package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +13 -3
  79. package/src/lib/stream-promise-flatten.ts +10 -0
  80. package/src/types/autosuggestions-config/editing-api-config.tsx +5 -7
  81. package/src/types/autosuggestions-config/insertions-api-config.tsx +6 -8
  82. package/src/types/base/autosuggestions-bare-function.ts +3 -0
  83. package/dist/chunk-47JRPWI3.mjs.map +0 -1
  84. package/dist/chunk-66BDXIX4.mjs.map +0 -1
  85. package/dist/chunk-FN7GDKKG.mjs.map +0 -1
  86. package/dist/chunk-HRTFMM7P.mjs.map +0 -1
  87. package/dist/chunk-K2AVA67P.mjs.map +0 -1
  88. package/dist/chunk-L6DZHWEL.mjs.map +0 -1
  89. package/dist/chunk-OXPXFYUG.mjs.map +0 -1
  90. package/dist/chunk-XA7M72ZO.mjs.map +0 -1
  91. /package/dist/{chunk-3TK2VELX.mjs.map → chunk-34D4UIYX.mjs.map} +0 -0
  92. /package/dist/{chunk-BBKDE7YT.mjs.map → chunk-F2TIBXML.mjs.map} +0 -0
  93. /package/dist/{chunk-7QWJ3OV7.mjs.map → chunk-LRXRD5KU.mjs.map} +0 -0
  94. /package/dist/{chunk-RDHPSSHJ.mjs.map → chunk-OM3Z4S4Y.mjs.map} +0 -0
@@ -1,12 +1,11 @@
1
+ import { IncludedFilesPreview } from './chunk-TIBMW3DC.mjs';
1
2
  import { use_autosize_textarea_default } from './chunk-ND5PXTAW.mjs';
2
3
  import { Button } from './chunk-2NURR2DX.mjs';
3
4
  import { Label } from './chunk-5EJ5XOGP.mjs';
4
- import { SourceSearchBox } from './chunk-L6DZHWEL.mjs';
5
- import { streamPromiseFlatten } from './chunk-FN7GDKKG.mjs';
5
+ import { SourceSearchBox } from './chunk-463BFNUP.mjs';
6
+ import { streamPromiseFlatten } from './chunk-GCMQHIRF.mjs';
6
7
  import { __async } from './chunk-MRXNTQOX.mjs';
7
- import { useContext, useState, useRef, useEffect } from 'react';
8
- import Chip from '@mui/material/Chip';
9
- import Avatar from '@mui/material/Avatar';
8
+ import { useContext, useState, useRef, useEffect, useCallback } from 'react';
10
9
  import { CopilotContext } from '@copilotkit/react-core';
11
10
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
12
11
 
@@ -72,24 +71,31 @@ var HoveringInsertionPromptBoxCore = ({
72
71
  releaseLockIfNotClosed();
73
72
  };
74
73
  }, [generatingSuggestion]);
75
- const begingGeneratingAdjustment = () => __async(void 0, null, function* () {
74
+ const beginGeneratingAdjustment = useCallback(() => __async(void 0, null, function* () {
76
75
  if (!adjustmentPrompt.trim()) {
77
76
  return;
78
77
  }
79
- let editorState = state.editorState;
78
+ let modificationState = state.editorState;
80
79
  if (editSuggestion !== "") {
81
- editorState.selectedText = editSuggestion;
80
+ modificationState.selectedText = editSuggestion;
82
81
  }
83
82
  const adjustmentSuggestionTextStreamPromise = insertionOrEditingFunction(
84
- editorState,
83
+ modificationState,
85
84
  adjustmentPrompt,
85
+ filePointers,
86
86
  new AbortController().signal
87
87
  );
88
88
  const adjustmentSuggestionTextStream = streamPromiseFlatten(
89
89
  adjustmentSuggestionTextStreamPromise
90
90
  );
91
91
  setGeneratingSuggestion(adjustmentSuggestionTextStream);
92
- });
92
+ }), [
93
+ adjustmentPrompt,
94
+ editSuggestion,
95
+ state.editorState,
96
+ insertionOrEditingFunction,
97
+ filePointers
98
+ ]);
93
99
  const isLoading = suggestionIsLoading;
94
100
  const textToEdit = editSuggestion || state.editorState.selectedText;
95
101
  const adjustmentLabel = textToEdit === "" ? "Describe the text you want to insert" : "Describe adjustments to the suggested text";
@@ -114,7 +120,7 @@ var HoveringInsertionPromptBoxCore = ({
114
120
  setAdjustmentPrompt(adjustmentPrompt + "\n");
115
121
  } else if (e.key === "Enter") {
116
122
  e.preventDefault();
117
- begingGeneratingAdjustment();
123
+ beginGeneratingAdjustment();
118
124
  }
119
125
  },
120
126
  placeholder,
@@ -123,7 +129,7 @@ var HoveringInsertionPromptBoxCore = ({
123
129
  rows: 1
124
130
  }),
125
131
  /* @__PURE__ */ jsx("button", {
126
- onClick: begingGeneratingAdjustment,
132
+ onClick: beginGeneratingAdjustment,
127
133
  className: "absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center",
128
134
  children: /* @__PURE__ */ jsx("i", {
129
135
  className: "material-icons",
@@ -212,46 +218,7 @@ var HoveringInsertionPromptBoxCore = ({
212
218
  ]
213
219
  });
214
220
  };
215
- var IncludedFilesPreview = ({
216
- includedFiles,
217
- setIncludedFiles
218
- }) => {
219
- return /* @__PURE__ */ jsxs("div", {
220
- className: "flex flex-col gap-2 mt-2",
221
- children: [
222
- /* @__PURE__ */ jsx(Label, {
223
- className: "",
224
- children: "Included context:"
225
- }),
226
- /* @__PURE__ */ jsx("div", {
227
- className: "flex flex-wrap gap-2",
228
- children: includedFiles.map((filePointer, index) => {
229
- return /* @__PURE__ */ jsx(FileChipPreview, {
230
- filePointer,
231
- onDelete: () => {
232
- setIncludedFiles(
233
- (prev) => prev.filter((fp) => fp !== filePointer)
234
- );
235
- }
236
- }, `file-${filePointer.sourceApplication}.${filePointer.name}`);
237
- })
238
- })
239
- ]
240
- });
241
- };
242
- var FileChipPreview = ({
243
- filePointer,
244
- onDelete
245
- }) => {
246
- return /* @__PURE__ */ jsx(Chip, {
247
- label: filePointer.name,
248
- onDelete,
249
- avatar: /* @__PURE__ */ jsx(Avatar, {
250
- sx: { backgroundColor: "transparent" }
251
- })
252
- });
253
- };
254
221
 
255
- export { FileChipPreview, HoveringInsertionPromptBoxCore, IncludedFilesPreview };
222
+ export { HoveringInsertionPromptBoxCore };
256
223
  //# sourceMappingURL=out.js.map
257
- //# sourceMappingURL=chunk-47JRPWI3.mjs.map
224
+ //# sourceMappingURL=chunk-F4WZCQG6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,sBAAsB;AAwJ3B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F,QAAM,wBAAwB,iBAAiB,MAAM,GAAG,EAAE,IAAI;AAE9D,QAAM,oBAAmB,+DAAuB,WAAW,QACvD,sBAAsB,MAAM,CAAC,IAC7B;AAEJ,SACE,qBAAC;AAAA,IAAI,WAAU;AAAA,IACZ;AAAA;AAAA,MACA,aAAa,SAAS,KACrB,oBAAC;AAAA,QACC,eAAe;AAAA,QACf,kBAAkB;AAAA,OACpB;AAAA,MAED,qBAAqB,UACpB,oBAAC;AAAA,QACC,YAAY;AAAA,QACZ;AAAA,QACA,gBAAgB,CAAC,gBAAgB;AA1Q3C;AA2QY;AAAA,YACE,iBAAiB,QAAQ,IAAI,OAAO,IAAI,mBAAmB,GAAG,EAAE;AAAA,UAClE;AACA,0BAAgB,CAAC,SAAS,CAAC,GAAG,MAAM,WAAW,CAAC;AAGhD,sCAAsB,YAAtB,mBAA+B;AAAA,QACjC;AAAA,OACF;AAAA,MAED,uBAAuB,sBAAsB;AAAA,MAC7C,uBAAuB,kBAAkB;AAAA;AAAA,GAC5C;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, {\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport { streamPromiseFlatten } from \"../../../lib/stream-promise-flatten\";\nimport { CopilotContext } from \"@copilotkit/react-core\";\nimport { IncludedFilesPreview } from \"./included-files-preview\";\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 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 // release the lock if the reader is not closed on unmount\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 // generate an adjustment to the completed text, based on the adjustment prompt\n const beginGeneratingAdjustment = useCallback(async () => {\n // don't generate text if the prompt is empty\n if (!adjustmentPrompt.trim()) {\n return;\n }\n\n // editor state includes the text being edited, and the text before/after the selection\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 modificationState = state.editorState;\n if (editSuggestion !== \"\") {\n modificationState.selectedText = editSuggestion;\n }\n\n // generate the adjustment suggestion\n const adjustmentSuggestionTextStreamPromise = insertionOrEditingFunction(\n modificationState,\n adjustmentPrompt,\n filePointers,\n new AbortController().signal\n );\n const adjustmentSuggestionTextStream = streamPromiseFlatten(\n adjustmentSuggestionTextStreamPromise\n );\n\n setGeneratingSuggestion(adjustmentSuggestionTextStream);\n }, [\n adjustmentPrompt,\n editSuggestion,\n state.editorState,\n insertionOrEditingFunction,\n filePointers,\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 beginGeneratingAdjustment();\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={beginGeneratingAdjustment}\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"]}
@@ -26,4 +26,4 @@ function streamPromiseFlatten(promise) {
26
26
 
27
27
  export { streamPromiseFlatten };
28
28
  //# sourceMappingURL=out.js.map
29
- //# sourceMappingURL=chunk-FN7GDKKG.mjs.map
29
+ //# sourceMappingURL=chunk-GCMQHIRF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/stream-promise-flatten.ts"],"names":[],"mappings":";;;;;AAUO,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":["/**\n * Flatten a promise of a stream, into a stream.\n *\n * Useful because a stream already includes the notion of async value delivery,\n * so it often makes sense to simply await the values rather than the generator of the values.\n *\n * @param {Promise<ReadableStream<A>>} promise - The promise to flatten.\n * @returns {ReadableStream<A>} - The flattened stream.\n */\n\nexport 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"]}
@@ -7,14 +7,14 @@ import { useContext, useCallback } from 'react';
7
7
  function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCategories, insertionApiConfig, editingApiConfig) {
8
8
  const { getContextString, copilotApiConfig } = useContext(CopilotContext);
9
9
  const insertionFunction = useCallback(
10
- (editorState, insertionPrompt, abortSignal) => __async(this, null, function* () {
10
+ (editorState, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
11
11
  const res = yield retry(() => __async(this, null, function* () {
12
12
  const messages = [
13
13
  {
14
14
  role: "system",
15
15
  content: insertionApiConfig.makeSystemPrompt(
16
16
  textareaPurpose,
17
- getContextString(contextCategories)
17
+ getContextString(documents, contextCategories)
18
18
  )
19
19
  },
20
20
  ...insertionApiConfig.fewShotMessages,
@@ -46,14 +46,14 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
46
46
  [insertionApiConfig, getContextString, contextCategories, textareaPurpose]
47
47
  );
48
48
  const editingFunction = useCallback(
49
- (editorState, editingPrompt, abortSignal) => __async(this, null, function* () {
49
+ (editorState, editingPrompt, documents, abortSignal) => __async(this, null, function* () {
50
50
  const res = yield retry(() => __async(this, null, function* () {
51
51
  const messages = [
52
52
  {
53
53
  role: "system",
54
54
  content: editingApiConfig.makeSystemPrompt(
55
55
  textareaPurpose,
56
- getContextString(contextCategories)
56
+ getContextString(documents, contextCategories)
57
57
  )
58
58
  },
59
59
  ...editingApiConfig.fewShotMessages,
@@ -90,15 +90,21 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
90
90
  [editingApiConfig, getContextString, contextCategories, textareaPurpose]
91
91
  );
92
92
  const insertionOrEditingFunction = useCallback(
93
- (editorState, insertionPrompt, abortSignal) => __async(this, null, function* () {
93
+ (editorState, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
94
94
  if (editorState.selectedText === "") {
95
95
  return yield insertionFunction(
96
96
  editorState,
97
97
  insertionPrompt,
98
+ documents,
98
99
  abortSignal
99
100
  );
100
101
  } else {
101
- return yield editingFunction(editorState, insertionPrompt, abortSignal);
102
+ return yield editingFunction(
103
+ editorState,
104
+ insertionPrompt,
105
+ documents,
106
+ abortSignal
107
+ );
102
108
  }
103
109
  }),
104
110
  [insertionFunction, editingFunction]
@@ -108,4 +114,4 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
108
114
 
109
115
  export { useMakeStandardInsertionOrEditingFunction };
110
116
  //# sourceMappingURL=out.js.map
111
- //# sourceMappingURL=chunk-OXPXFYUG.mjs.map
117
+ //# sourceMappingURL=chunk-IBSJOQI7.mjs.map
@@ -0,0 +1 @@
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;AA0BjC,SAAS,0CACd,iBACA,mBACA,oBACA,kBACwC;AACxC,QAAM,EAAE,kBAAkB,iBAAiB,IAAI,WAAW,cAAc;AAExE,QAAM,oBAAoB;AAAA,IACxB,CACE,aACA,iBACA,WACA,gBACG;AACH,YAAM,MAAM,MAAM,MAAM,MAAY;AAClC,cAAM,WAAoC;AAAA,UACxC;AAAA,YACE,MAAM;AAAA,YACN,SAAS,mBAAmB;AAAA,cAC1B;AAAA,cACA,iBAAiB,WAAW,iBAAiB;AAAA,YAC/C;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AO;AAAA,IACT;AAAA,IACA,CAAC,kBAAkB,kBAAkB,mBAAmB,eAAe;AAAA,EACzE;AAEA,QAAM,6BAA6B;AAAA,IACjC,CACE,aACA,iBACA,WACA,gBACG;AACH,UAAI,YAAY,iBAAiB,IAAI;AACnC,eAAO,MAAM;AAAA,UACX;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF,OAAO;AACL,eAAO,MAAM;AAAA,UACX;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;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\";\nimport { DocumentPointer } from \"@copilotkit/react-core\";\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 documents: DocumentPointer[],\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(documents, 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 documents: DocumentPointer[],\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(documents, 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 documents: DocumentPointer[],\n abortSignal: AbortSignal\n ) => {\n if (editorState.selectedText === \"\") {\n return await insertionFunction(\n editorState,\n insertionPrompt,\n documents,\n abortSignal\n );\n } else {\n return await editingFunction(\n editorState,\n insertionPrompt,\n documents,\n abortSignal\n );\n }\n },\n [insertionFunction, editingFunction]\n );\n\n return insertionOrEditingFunction;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { HoveringInsertionPromptBox } from './chunk-QNJ6MXJ2.mjs';
1
+ import { HoveringInsertionPromptBox } from './chunk-7JO276KU.mjs';
2
2
  import { useHoveringEditorContext } from './chunk-YW3REYX6.mjs';
3
3
  import { Portal, Menu } from './chunk-XHUMROEY.mjs';
4
4
  import { getTextAroundSelection, getFullEditorTextWithNewlines } from './chunk-IXJ2HCOA.mjs';
@@ -105,4 +105,4 @@ function editorState(editor, selection) {
105
105
 
106
106
  export { HoveringToolbar };
107
107
  //# sourceMappingURL=out.js.map
108
- //# sourceMappingURL=chunk-7QWJ3OV7.mjs.map
108
+ //# sourceMappingURL=chunk-LRXRD5KU.mjs.map
@@ -1,7 +1,7 @@
1
- import { useMakeStandardAutosuggestionFunction } from './chunk-K2AVA67P.mjs';
2
- import { useMakeStandardInsertionOrEditingFunction } from './chunk-OXPXFYUG.mjs';
3
- import { defaultAutosuggestionsConfig } from './chunk-BBKDE7YT.mjs';
4
- import { BaseCopilotTextarea } from './chunk-3TK2VELX.mjs';
1
+ import { useMakeStandardAutosuggestionFunction } from './chunk-PPWNZF3T.mjs';
2
+ import { useMakeStandardInsertionOrEditingFunction } from './chunk-IBSJOQI7.mjs';
3
+ import { defaultAutosuggestionsConfig } from './chunk-F2TIBXML.mjs';
4
+ import { BaseCopilotTextarea } from './chunk-34D4UIYX.mjs';
5
5
  import { __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
6
6
  import React from 'react';
7
7
  import merge from 'lodash.merge';
@@ -41,4 +41,4 @@ var CopilotTextarea = React.forwardRef(
41
41
 
42
42
  export { CopilotTextarea };
43
43
  //# sourceMappingURL=out.js.map
44
- //# sourceMappingURL=chunk-RDHPSSHJ.mjs.map
44
+ //# sourceMappingURL=chunk-OM3Z4S4Y.mjs.map
@@ -14,7 +14,7 @@ function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategorie
14
14
  role: "system",
15
15
  content: apiConfig.makeSystemPrompt(
16
16
  textareaPurpose,
17
- getContextString(contextCategories)
17
+ getContextString([], contextCategories)
18
18
  )
19
19
  },
20
20
  ...apiConfig.fewShotMessages,
@@ -54,4 +54,4 @@ function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategorie
54
54
 
55
55
  export { useMakeStandardAutosuggestionFunction };
56
56
  //# sourceMappingURL=out.js.map
57
- //# sourceMappingURL=chunk-K2AVA67P.mjs.map
57
+ //# sourceMappingURL=chunk-PPWNZF3T.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,SAAS,sBAAsB;AAC/B,SAAS,aAAa,kBAAkB;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,CAAC,GAAG,iBAAiB;AAAA,YACxC;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"]}
@@ -5,9 +5,14 @@ var defaultInsertionsMakeSystemPrompt = (textareaPurpose, contextString) => {
5
5
  The user is writing some text.
6
6
  The purpose is: "${textareaPurpose}"
7
7
 
8
+ The following external context is also provided. Use it to help you make better suggestions!!!
9
+ \`\`\`
10
+ ${contextString}
11
+ \`\`\`
12
+
8
13
  The user also provides you with a prompt for INSERTIONS into the text they are writing.
9
14
  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.
15
+ Only insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.
11
16
 
12
17
  Adjust yourself to the user's style and implied intent.
13
18
 
@@ -16,13 +21,6 @@ The user will provide the text before and after the cursor, as well as the inser
16
21
  <TextBeforeCursor>
17
22
  <InsertionPrompt>
18
23
  <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
24
  `;
27
25
  };
28
26
  var defaultInsertionsFewShotMessages = [
@@ -73,4 +71,4 @@ var defaultInsertionsApiConfig = {
73
71
 
74
72
  export { defaultInsertionsApiConfig, defaultInsertionsFewShotMessages, defaultInsertionsMakeSystemPrompt };
75
73
  //# sourceMappingURL=out.js.map
76
- //# sourceMappingURL=chunk-66BDXIX4.mjs.map
74
+ //# sourceMappingURL=chunk-RR6OQGTI.mjs.map
@@ -0,0 +1 @@
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,EAIlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeF;AAEO,IAAM,mCAA4D;AAAA,EACvE;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AACF;AAEO,IAAM,6BAAkD;AAAA,EAC7D,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB","sourcesContent":["import { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\n\nexport interface InsertionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultInsertionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user also provides you with a prompt for INSERTIONS into the text they are writing. \nYour job is to come up with an INSERTION into the text that the user would like AS BEST YOU CAN.\nOnly insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide the text before and after the cursor, as well as the insertion prompt. You should use this to infer the best relevant insertion.\n<TextAfterCursor>\n<TextBeforeCursor>\n<InsertionPrompt>\n<YourSuggestion>\n`;\n};\n\nexport const defaultInsertionsFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"While I was there I also picked up some apples, oranges, and bananas.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: \"This morning I woke up and went straight to the grocery store.\",\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: \"I bought a big watermelon\",\n },\n {\n role: \"assistant\",\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content:\n 'The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;',\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: \"add section about the optionholder's pro rata share\",\n },\n {\n role: \"assistant\",\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n },\n];\n\nexport const defaultInsertionsApiConfig: InsertionsApiConfig = {\n makeSystemPrompt: defaultInsertionsMakeSystemPrompt,\n fewShotMessages: defaultInsertionsFewShotMessages,\n forwardedParams: undefined,\n};\n"]}
@@ -0,0 +1,48 @@
1
+ import { Label } from './chunk-5EJ5XOGP.mjs';
2
+ import Chip from '@mui/material/Chip';
3
+ import Avatar from '@mui/material/Avatar';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ var IncludedFilesPreview = ({
7
+ includedFiles,
8
+ setIncludedFiles
9
+ }) => {
10
+ return /* @__PURE__ */ jsxs("div", {
11
+ className: "flex flex-col gap-2 mt-2",
12
+ children: [
13
+ /* @__PURE__ */ jsx(Label, {
14
+ className: "",
15
+ children: "Included context:"
16
+ }),
17
+ /* @__PURE__ */ jsx("div", {
18
+ className: "flex flex-wrap gap-2",
19
+ children: includedFiles.map((filePointer, index) => {
20
+ return /* @__PURE__ */ jsx(FileChipPreview, {
21
+ filePointer,
22
+ onDelete: () => {
23
+ setIncludedFiles(
24
+ (prev) => prev.filter((fp) => fp !== filePointer)
25
+ );
26
+ }
27
+ }, `file-${filePointer.sourceApplication}.${filePointer.name}`);
28
+ })
29
+ })
30
+ ]
31
+ });
32
+ };
33
+ var FileChipPreview = ({
34
+ filePointer,
35
+ onDelete
36
+ }) => {
37
+ return /* @__PURE__ */ jsx(Chip, {
38
+ label: filePointer.name,
39
+ onDelete,
40
+ avatar: /* @__PURE__ */ jsx(Avatar, {
41
+ sx: { backgroundColor: "transparent" }
42
+ })
43
+ });
44
+ };
45
+
46
+ export { FileChipPreview, IncludedFilesPreview };
47
+ //# sourceMappingURL=out.js.map
48
+ //# sourceMappingURL=chunk-TIBMW3DC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx"],"names":[],"mappings":";;;;;AAGA,OAAO,UAAU;AACjB,OAAO,YAAY;AAYf,SACE,KADF;AALG,IAAM,uBAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AACF,MAAM;AACJ,SACE,qBAAC;AAAA,IAAI,WAAU;AAAA,IACb;AAAA,0BAAC;AAAA,QAAM,WAAU;AAAA,QAAG;AAAA,OAAiB;AAAA,MACrC,oBAAC;AAAA,QAAI,WAAU;AAAA,QACZ,wBAAc,IAAI,CAAC,aAAa,UAAU;AACzC,iBACE,oBAAC;AAAA,YAEC;AAAA,YACA,UAAU,MAAM;AACd;AAAA,gBAAiB,CAAC,SAChB,KAAK,OAAO,CAAC,OAAO,OAAO,WAAW;AAAA,cACxC;AAAA,YACF;AAAA,aANK,QAAQ,YAAY,qBAAqB,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 { DocumentPointer } from \"@copilotkit/react-core\";\nimport { Label } from \"../../ui/label\";\nimport React from \"react\";\nimport Chip from \"@mui/material/Chip\";\nimport Avatar from \"@mui/material/Avatar\";\n\nexport interface 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"]}
@@ -47,7 +47,10 @@ var CommandList = React.forwardRef((_a, ref) => {
47
47
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
48
48
  return /* @__PURE__ */ jsx(Command$1.List, __spreadValues({
49
49
  ref,
50
- className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)
50
+ className: cn(
51
+ "max-h-[300px] overflow-y-auto overflow-x-hidden pb-2",
52
+ className
53
+ )
51
54
  }, props));
52
55
  });
53
56
  CommandList.displayName = Command$1.List.displayName;
@@ -103,4 +106,4 @@ CommandShortcut.displayName = "CommandShortcut";
103
106
 
104
107
  export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
105
108
  //# sourceMappingURL=out.js.map
106
- //# sourceMappingURL=chunk-XA7M72ZO.mjs.map
109
+ //# sourceMappingURL=chunk-WLPYYGES.mjs.map
@@ -0,0 +1 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AAjB;AAAA,EACC;AAAA,EACA,WAAU;AAAA,GACN,MACN,CACD;AAED,aAAa,cAAc,iBAAiB,MAAM;AAElD,IAAM,eAAqB,iBAGzB,CAAC,IAAyB,QAAK;AAA9B,eAAE,YA1FL,IA0FG,IAAgB,kBAAhB,IAAgB,CAAd;AACH,6BAAC,iBAAiB,OAAjB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,KACI,MACN;AAAA,CACD;AAED,aAAa,cAAc,iBAAiB,MAAM;AAElD,IAAM,mBAAyB,iBAG7B,CAAC,IAAyB,QAAK;AAA9B,eAAE,YA1GL,IA0GG,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,YAtHL,IAsHG,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,EApIF,IAmIyB,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(\n \"max-h-[300px] overflow-y-auto overflow-x-hidden pb-2\",\n className\n )}\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"]}
@@ -2,6 +2,7 @@ import React__default from 'react';
2
2
  import { BaseCopilotTextareaProps } from '../../types/base/base-copilot-textarea-props.js';
3
3
  import '../../types/base/base-autosuggestions-config.js';
4
4
  import '../../types/base/autosuggestions-bare-function.js';
5
+ import '@copilotkit/react-core';
5
6
 
6
7
  interface HTMLCopilotTextAreaElement extends HTMLElement {
7
8
  value: string;
@@ -1,4 +1,4 @@
1
- export { BaseCopilotTextarea } from '../../chunk-3TK2VELX.mjs';
1
+ export { BaseCopilotTextarea } from '../../chunk-34D4UIYX.mjs';
2
2
  import '../../chunk-CSGFJU3L.mjs';
3
3
  import '../../chunk-KCHYD3EB.mjs';
4
4
  import '../../chunk-YQU7WG7T.mjs';
@@ -9,19 +9,20 @@ import '../../chunk-UHD44NC5.mjs';
9
9
  import '../../chunk-JAFCXEPU.mjs';
10
10
  import '../../chunk-OD7ZMOVE.mjs';
11
11
  import '../../chunk-MPME5BW2.mjs';
12
- import '../../chunk-7QWJ3OV7.mjs';
12
+ import '../../chunk-LRXRD5KU.mjs';
13
13
  import '../../chunk-L7VVZH4Q.mjs';
14
- import '../../chunk-QNJ6MXJ2.mjs';
15
- import '../../chunk-47JRPWI3.mjs';
14
+ import '../../chunk-7JO276KU.mjs';
15
+ import '../../chunk-F4WZCQG6.mjs';
16
+ import '../../chunk-TIBMW3DC.mjs';
16
17
  import '../../chunk-ND5PXTAW.mjs';
17
18
  import '../../chunk-2NURR2DX.mjs';
18
19
  import '../../chunk-5EJ5XOGP.mjs';
19
20
  import '../../chunk-YW3REYX6.mjs';
20
21
  import '../../chunk-XHUMROEY.mjs';
21
- import '../../chunk-L6DZHWEL.mjs';
22
- import '../../chunk-XA7M72ZO.mjs';
22
+ import '../../chunk-463BFNUP.mjs';
23
+ import '../../chunk-WLPYYGES.mjs';
23
24
  import '../../chunk-O5OWT5GE.mjs';
24
- import '../../chunk-FN7GDKKG.mjs';
25
+ import '../../chunk-GCMQHIRF.mjs';
25
26
  import '../../chunk-KGKLUWKW.mjs';
26
27
  import '../../chunk-WJHSY5T6.mjs';
27
28
  import '../../chunk-S6JUGJK2.mjs';
@@ -4,6 +4,7 @@ import { HTMLCopilotTextAreaElement } from '../../types/html-copilot-textarea-el
4
4
  import { AutosuggestionsConfigUserSpecified } from '../../types/autosuggestions-config/autosuggestions-config-user-specified.js';
5
5
  import '../../types/base/base-autosuggestions-config.js';
6
6
  import '../../types/base/autosuggestions-bare-function.js';
7
+ import '@copilotkit/react-core';
7
8
  import '../../types/autosuggestions-config/autosuggestions-config.js';
8
9
  import '../../types/autosuggestions-config/suggestions-api-config.js';
9
10
  import '../../types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js';
@@ -1,15 +1,15 @@
1
- export { CopilotTextarea } from '../../chunk-RDHPSSHJ.mjs';
2
- import '../../chunk-K2AVA67P.mjs';
3
- import '../../chunk-OXPXFYUG.mjs';
1
+ export { CopilotTextarea } from '../../chunk-OM3Z4S4Y.mjs';
2
+ import '../../chunk-PPWNZF3T.mjs';
3
+ import '../../chunk-IBSJOQI7.mjs';
4
4
  import '../../chunk-DE5K76I2.mjs';
5
5
  import '../../chunk-5FO6ISW4.mjs';
6
6
  import '../../chunk-KIRROE2K.mjs';
7
- import '../../chunk-BBKDE7YT.mjs';
8
- import '../../chunk-HRTFMM7P.mjs';
9
- import '../../chunk-66BDXIX4.mjs';
7
+ import '../../chunk-F2TIBXML.mjs';
8
+ import '../../chunk-AXN37AHC.mjs';
9
+ import '../../chunk-RR6OQGTI.mjs';
10
10
  import '../../chunk-JHTAOLEW.mjs';
11
11
  import '../../chunk-WADHCMPK.mjs';
12
- import '../../chunk-3TK2VELX.mjs';
12
+ import '../../chunk-34D4UIYX.mjs';
13
13
  import '../../chunk-CSGFJU3L.mjs';
14
14
  import '../../chunk-KCHYD3EB.mjs';
15
15
  import '../../chunk-YQU7WG7T.mjs';
@@ -20,19 +20,20 @@ import '../../chunk-UHD44NC5.mjs';
20
20
  import '../../chunk-JAFCXEPU.mjs';
21
21
  import '../../chunk-OD7ZMOVE.mjs';
22
22
  import '../../chunk-MPME5BW2.mjs';
23
- import '../../chunk-7QWJ3OV7.mjs';
23
+ import '../../chunk-LRXRD5KU.mjs';
24
24
  import '../../chunk-L7VVZH4Q.mjs';
25
- import '../../chunk-QNJ6MXJ2.mjs';
26
- import '../../chunk-47JRPWI3.mjs';
25
+ import '../../chunk-7JO276KU.mjs';
26
+ import '../../chunk-F4WZCQG6.mjs';
27
+ import '../../chunk-TIBMW3DC.mjs';
27
28
  import '../../chunk-ND5PXTAW.mjs';
28
29
  import '../../chunk-2NURR2DX.mjs';
29
30
  import '../../chunk-5EJ5XOGP.mjs';
30
31
  import '../../chunk-YW3REYX6.mjs';
31
32
  import '../../chunk-XHUMROEY.mjs';
32
- import '../../chunk-L6DZHWEL.mjs';
33
- import '../../chunk-XA7M72ZO.mjs';
33
+ import '../../chunk-463BFNUP.mjs';
34
+ import '../../chunk-WLPYYGES.mjs';
34
35
  import '../../chunk-O5OWT5GE.mjs';
35
- import '../../chunk-FN7GDKKG.mjs';
36
+ import '../../chunk-GCMQHIRF.mjs';
36
37
  import '../../chunk-KGKLUWKW.mjs';
37
38
  import '../../chunk-WJHSY5T6.mjs';
38
39
  import '../../chunk-S6JUGJK2.mjs';
@@ -1,4 +1,5 @@
1
1
  import { InsertionEditorApiConfig } from '../../types/base/autosuggestions-bare-function.js';
2
+ import '@copilotkit/react-core';
2
3
 
3
4
  interface HoveringToolbarProps {
4
5
  apiConfig: InsertionEditorApiConfig;
@@ -1,16 +1,17 @@
1
- export { HoveringToolbar } from '../../chunk-7QWJ3OV7.mjs';
1
+ export { HoveringToolbar } from '../../chunk-LRXRD5KU.mjs';
2
2
  import '../../chunk-L7VVZH4Q.mjs';
3
- import '../../chunk-QNJ6MXJ2.mjs';
4
- import '../../chunk-47JRPWI3.mjs';
3
+ import '../../chunk-7JO276KU.mjs';
4
+ import '../../chunk-F4WZCQG6.mjs';
5
+ import '../../chunk-TIBMW3DC.mjs';
5
6
  import '../../chunk-ND5PXTAW.mjs';
6
7
  import '../../chunk-2NURR2DX.mjs';
7
8
  import '../../chunk-5EJ5XOGP.mjs';
8
9
  import '../../chunk-YW3REYX6.mjs';
9
10
  import '../../chunk-XHUMROEY.mjs';
10
- import '../../chunk-L6DZHWEL.mjs';
11
- import '../../chunk-XA7M72ZO.mjs';
11
+ import '../../chunk-463BFNUP.mjs';
12
+ import '../../chunk-WLPYYGES.mjs';
12
13
  import '../../chunk-O5OWT5GE.mjs';
13
- import '../../chunk-FN7GDKKG.mjs';
14
+ import '../../chunk-GCMQHIRF.mjs';
14
15
  import '../../chunk-KGKLUWKW.mjs';
15
16
  import '../../chunk-IXJ2HCOA.mjs';
16
17
  import '../../chunk-MRXNTQOX.mjs';
@@ -1,6 +1,6 @@
1
1
  import { EditingEditorState, Generator_InsertionOrEditingSuggestion } from '../../../types/base/autosuggestions-bare-function.js';
2
- import { DocumentPointer } from '@copilotkit/react-core';
3
2
  import React__default from 'react';
3
+ import '@copilotkit/react-core';
4
4
 
5
5
  type SuggestionState = {
6
6
  editorState: EditingEditorState;
@@ -12,15 +12,5 @@ interface HoveringInsertionPromptBoxCoreProps {
12
12
  contextCategories: string[];
13
13
  }
14
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
15
 
26
- export { FileChipPreview, FileChipPreviewProp, HoveringInsertionPromptBoxCore, HoveringInsertionPromptBoxCoreProps, IncludedFilesPreview, SuggestionState };
16
+ export { HoveringInsertionPromptBoxCore, HoveringInsertionPromptBoxCoreProps, SuggestionState };