@copilotkit/react-textarea 0.19.0-alpha.8 → 0.19.0-alpha.9

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 (99) hide show
  1. package/.turbo/turbo-build.log +150 -151
  2. package/CHANGELOG.md +11 -0
  3. package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +13 -0
  4. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +32 -208
  5. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
  6. package/dist/components/base-copilot-textarea/render-element.d.ts +6 -0
  7. package/dist/components/base-copilot-textarea/render-placeholder.d.ts +6 -0
  8. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.d.ts +6 -0
  9. package/dist/components/base-copilot-textarea/use-add-branding-css.d.ts +3 -0
  10. package/dist/components/copilot-textarea/copilot-textarea.d.ts +19 -0
  11. package/dist/components/copilot-textarea/copilot-textarea.mjs +35 -211
  12. package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
  13. package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +13 -0
  14. package/dist/components/hovering-toolbar/hovering-toolbar-components.d.ts +18 -0
  15. package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +9 -0
  16. package/dist/components/hovering-toolbar/hovering-toolbar.mjs +29 -207
  17. package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -1
  18. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.ts +26 -0
  19. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +23 -207
  20. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -1
  21. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +13 -0
  22. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +25 -207
  23. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -1
  24. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.d.ts +3 -0
  25. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +25 -207
  26. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
  27. package/dist/components/index.d.ts +14 -0
  28. package/dist/components/index.mjs +38 -214
  29. package/dist/components/index.mjs.map +1 -1
  30. package/dist/components/manual-ui/chip-with-icon.d.ts +10 -0
  31. package/dist/components/source-search-box/source-search-box.d.ts +14 -0
  32. package/dist/components/source-search-box/source-search-box.mjs +21 -168
  33. package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
  34. package/dist/components/ui/button.d.ts +14 -0
  35. package/dist/components/ui/card.d.ts +10 -0
  36. package/dist/components/ui/command.d.ts +48 -0
  37. package/dist/components/ui/dialog.d.ts +18 -0
  38. package/dist/components/ui/label.d.ts +8 -0
  39. package/dist/components/ui/separator.d.ts +6 -0
  40. package/dist/components/ui/textarea.d.ts +7 -0
  41. package/dist/context/index.d.ts +1 -0
  42. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +13 -0
  43. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.d.ts +8 -0
  44. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.ts +7 -0
  45. package/dist/hooks/index.d.ts +1 -0
  46. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +21 -0
  47. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +22 -0
  48. package/dist/hooks/misc/use-autosize-textarea.d.ts +5 -0
  49. package/dist/index.css +4 -18
  50. package/dist/index.css.map +1 -1
  51. package/dist/index.d.ts +16 -0
  52. package/dist/index.mjs +38 -214
  53. package/dist/index.mjs.map +1 -1
  54. package/dist/lib/debouncer.d.ts +11 -0
  55. package/dist/lib/editor-to-text.d.ts +7 -0
  56. package/dist/lib/get-text-around-cursor.d.ts +15 -0
  57. package/dist/lib/retry.d.ts +3 -0
  58. package/dist/lib/slatejs-edits/add-autocompletions.d.ts +8 -0
  59. package/dist/lib/slatejs-edits/clear-autocompletions.d.ts +8 -0
  60. package/dist/lib/slatejs-edits/replace-text.d.ts +5 -0
  61. package/dist/lib/slatejs-edits/with-partial-history.d.ts +10 -0
  62. package/dist/lib/stream-promise-flatten.d.ts +3 -0
  63. package/dist/lib/utils.d.ts +10 -0
  64. package/dist/lib/utils.test.d.ts +1 -0
  65. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +22 -0
  66. package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +19 -0
  67. package/dist/types/autosuggestions-config/autosuggestions-config.mjs +1 -0
  68. package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
  69. package/dist/types/autosuggestions-config/editing-api-config.d.ts +15 -0
  70. package/dist/types/autosuggestions-config/index.d.ts +11 -0
  71. package/dist/types/autosuggestions-config/index.mjs +1 -0
  72. package/dist/types/autosuggestions-config/index.mjs.map +1 -1
  73. package/dist/types/autosuggestions-config/insertions-api-config.d.ts +15 -0
  74. package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.d.ts +27 -0
  75. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.ts +3 -0
  76. package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.d.ts +7 -0
  77. package/dist/types/autosuggestions-config/suggestions-api-config.d.ts +15 -0
  78. package/dist/types/base/autosuggestion-state.d.ts +8 -0
  79. package/dist/types/base/autosuggestions-bare-function.d.ts +17 -0
  80. package/dist/types/base/base-autosuggestions-config.d.ts +15 -0
  81. package/dist/types/base/base-autosuggestions-config.mjs +1 -0
  82. package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
  83. package/dist/types/base/base-copilot-textarea-props.d.ts +40 -0
  84. package/dist/types/base/custom-editor.d.ts +29 -0
  85. package/dist/types/base/editor-autocomplete-state.d.ts +10 -0
  86. package/dist/types/base/index.d.ts +4 -0
  87. package/dist/types/base/index.mjs +1 -0
  88. package/dist/types/base/index.mjs.map +1 -1
  89. package/dist/types/html-copilot-textarea-element.d.ts +7 -0
  90. package/dist/types/index.d.ts +14 -0
  91. package/dist/types/index.mjs +1 -0
  92. package/dist/types/index.mjs.map +1 -1
  93. package/package.json +4 -4
  94. package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +4 -1
  95. package/src/components/hovering-toolbar/hovering-toolbar.tsx +2 -0
  96. package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +26 -152
  97. package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx +2 -0
  98. package/src/components/source-search-box/source-search-box.tsx +13 -17
  99. package/src/types/base/base-autosuggestions-config.tsx +2 -0
@@ -0,0 +1,6 @@
1
+ interface TrackerTextEditedSinceLastCursorMovementProps {
2
+ setCursorMovedSinceLastTextChange: (value: boolean) => void;
3
+ }
4
+ declare function TrackerTextEditedSinceLastCursorMovement(props: TrackerTextEditedSinceLastCursorMovementProps): JSX.Element;
5
+
6
+ export { TrackerTextEditedSinceLastCursorMovement };
@@ -0,0 +1,3 @@
1
+ declare function useAddBrandingCss(suggestionStyleAugmented: React.CSSProperties, disableBranding: boolean | undefined): void;
2
+
3
+ export { useAddBrandingCss };
@@ -0,0 +1,19 @@
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 };
@@ -60,6 +60,7 @@ import { useCallback, useContext } from "react";
60
60
  // src/types/base/base-autosuggestions-config.tsx
61
61
  var defaultBaseAutosuggestionsConfig = {
62
62
  debounceTime: 250,
63
+ contextCategories: ["global"],
63
64
  acceptAutosuggestionKey: "Tab",
64
65
  disableWhenEmpty: true,
65
66
  disabled: false,
@@ -1071,11 +1072,6 @@ var CommandShortcut = (_a) => {
1071
1072
  CommandShortcut.displayName = "CommandShortcut";
1072
1073
 
1073
1074
  // src/components/source-search-box/source-search-box.tsx
1074
- import {
1075
- Calculator,
1076
- Calendar,
1077
- Smile
1078
- } from "lucide-react";
1079
1075
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
1080
1076
  function SourceSearchBox(props) {
1081
1077
  const [selectedValue, setSelectedValue] = useState2("");
@@ -1104,12 +1100,11 @@ function SourceSearchBox(props) {
1104
1100
  children: "No results found."
1105
1101
  }),
1106
1102
  /* @__PURE__ */ jsx2(CommandGroup, {
1107
- heading: "Recents",
1108
- children: props.recentFiles.map((filePointer) => {
1103
+ heading: "Available resources",
1104
+ children: props.suggestedFiles.map((filePointer) => {
1109
1105
  return /* @__PURE__ */ jsx2(CommandItem, {
1110
1106
  value: filePointer.name,
1111
1107
  onSelect: (value) => {
1112
- console.log(filePointer.name);
1113
1108
  props.onSelectedFile(filePointer);
1114
1109
  },
1115
1110
  children: /* @__PURE__ */ jsxs("div", {
@@ -1117,9 +1112,11 @@ function SourceSearchBox(props) {
1117
1112
  children: [
1118
1113
  /* @__PURE__ */ jsx2(Logo, {
1119
1114
  size: "30px",
1120
- children: /* @__PURE__ */ jsx2(IconForFilePointer, {
1121
- filePointer,
1122
- className: "mx-auto my-auto"
1115
+ children: /* @__PURE__ */ jsx2("img", {
1116
+ src: filePointer.iconImageUri,
1117
+ alt: filePointer.sourceApplication,
1118
+ width: 30,
1119
+ height: 30
1123
1120
  })
1124
1121
  }),
1125
1122
  filePointer.name
@@ -1128,45 +1125,6 @@ function SourceSearchBox(props) {
1128
1125
  }, `word-${filePointer.sourceApplication}.${filePointer.name}`);
1129
1126
  })
1130
1127
  }),
1131
- /* @__PURE__ */ jsxs(CommandGroup, {
1132
- heading: "Suggestions",
1133
- children: [
1134
- /* @__PURE__ */ jsxs(CommandItem, {
1135
- onSelect: (value) => {
1136
- console.log(value);
1137
- console.log(value);
1138
- },
1139
- children: [
1140
- /* @__PURE__ */ jsx2(Calendar, {
1141
- className: "mr-2 h-4 w-4"
1142
- }),
1143
- /* @__PURE__ */ jsx2("span", {
1144
- children: "Calendar"
1145
- })
1146
- ]
1147
- }),
1148
- /* @__PURE__ */ jsxs(CommandItem, {
1149
- children: [
1150
- /* @__PURE__ */ jsx2(Smile, {
1151
- className: "mr-2 h-4 w-4"
1152
- }),
1153
- /* @__PURE__ */ jsx2("span", {
1154
- children: "Search Emoji"
1155
- })
1156
- ]
1157
- }),
1158
- /* @__PURE__ */ jsxs(CommandItem, {
1159
- children: [
1160
- /* @__PURE__ */ jsx2(Calculator, {
1161
- className: "mr-2 h-4 w-4"
1162
- }),
1163
- /* @__PURE__ */ jsx2("span", {
1164
- children: "Calculator"
1165
- })
1166
- ]
1167
- })
1168
- ]
1169
- }),
1170
1128
  /* @__PURE__ */ jsx2(CommandSeparator, {})
1171
1129
  ]
1172
1130
  })
@@ -1178,7 +1136,7 @@ function Logo({
1178
1136
  size = "30px"
1179
1137
  }) {
1180
1138
  return /* @__PURE__ */ jsx2("div", {
1181
- className: "flex items-center justify-center",
1139
+ className: "flex items-center justify-center bg-black",
1182
1140
  style: { width: size, height: size },
1183
1141
  children
1184
1142
  });
@@ -1245,7 +1203,7 @@ var Label = React4.forwardRef((_a, ref) => {
1245
1203
  Label.displayName = LabelPrimitive.Root.displayName;
1246
1204
 
1247
1205
  // src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
1248
- import { useEffect as useEffect3, useRef, useState as useState3 } from "react";
1206
+ import { useContext as useContext2, useEffect as useEffect3, useRef, useState as useState3 } from "react";
1249
1207
  import Chip from "@mui/material/Chip";
1250
1208
  import Avatar from "@mui/material/Avatar";
1251
1209
 
@@ -1274,8 +1232,15 @@ function streamPromiseFlatten(promise) {
1274
1232
  }
1275
1233
 
1276
1234
  // src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
1235
+ import { CopilotContext as CopilotContext2 } from "@copilotkit/react-core";
1277
1236
  import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
1278
- var HoveringInsertionPromptBoxCore = ({ performInsertion, state, insertionOrEditingFunction }) => {
1237
+ var HoveringInsertionPromptBoxCore = ({
1238
+ performInsertion,
1239
+ state,
1240
+ insertionOrEditingFunction,
1241
+ contextCategories
1242
+ }) => {
1243
+ const { getDocumentsContext } = useContext2(CopilotContext2);
1279
1244
  const [editSuggestion, setEditSuggestion] = useState3("");
1280
1245
  const [suggestionIsLoading, setSuggestionIsLoading] = useState3(false);
1281
1246
  const [adjustmentPrompt, setAdjustmentPrompt] = useState3("");
@@ -1283,6 +1248,10 @@ var HoveringInsertionPromptBoxCore = ({ performInsertion, state, insertionOrEdit
1283
1248
  const adjustmentTextAreaRef = useRef(null);
1284
1249
  const suggestionTextAreaRef = useRef(null);
1285
1250
  const [filePointers, setFilePointers] = useState3([]);
1251
+ const [suggestedFiles, setSuggestedFiles] = useState3([]);
1252
+ useEffect3(() => {
1253
+ setSuggestedFiles(getDocumentsContext(contextCategories));
1254
+ }, [contextCategories, getDocumentsContext]);
1286
1255
  use_autosize_textarea_default(suggestionTextAreaRef, editSuggestion || "");
1287
1256
  use_autosize_textarea_default(adjustmentTextAreaRef, adjustmentPrompt || "");
1288
1257
  useEffect3(() => {
@@ -1452,7 +1421,7 @@ var HoveringInsertionPromptBoxCore = ({ performInsertion, state, insertionOrEdit
1452
1421
  }),
1453
1422
  sourceSearchWord !== void 0 && /* @__PURE__ */ jsx5(SourceSearchBox, {
1454
1423
  searchTerm: sourceSearchWord,
1455
- recentFiles: mockFiles,
1424
+ suggestedFiles,
1456
1425
  onSelectedFile: (filePointer) => {
1457
1426
  var _a;
1458
1427
  setAdjustmentPrompt(
@@ -1502,158 +1471,10 @@ var FileChipPreview = ({
1502
1471
  label: filePointer.name,
1503
1472
  onDelete,
1504
1473
  avatar: /* @__PURE__ */ jsx5(Avatar, {
1505
- sx: { backgroundColor: "transparent" },
1506
- children: /* @__PURE__ */ jsx5(IconForFilePointer, {
1507
- filePointer,
1508
- className: "w-4 h-1 object-contain"
1509
- })
1474
+ sx: { backgroundColor: "transparent" }
1510
1475
  })
1511
1476
  });
1512
1477
  };
1513
- function IconForFilePointer({
1514
- filePointer,
1515
- className
1516
- }) {
1517
- if (filePointer.sourceApplication === "Salesforce") {
1518
- return /* @__PURE__ */ jsx5(IconSalesforce, {
1519
- className
1520
- });
1521
- } else if (filePointer.sourceApplication === "GoogleDocs") {
1522
- return /* @__PURE__ */ jsx5(IconGoogleDocs, {
1523
- className
1524
- });
1525
- } else {
1526
- return /* @__PURE__ */ jsx5(IconSalesforce, {
1527
- className
1528
- });
1529
- }
1530
- }
1531
- function IconSalesforce(_a) {
1532
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1533
- return /* @__PURE__ */ jsxs2("svg", __spreadProps(__spreadValues({
1534
- xmlns: "http://www.w3.org/2000/svg",
1535
- xmlnsXlink: "http://www.w3.org/1999/xlink",
1536
- preserveAspectRatio: "xMidYMid meet",
1537
- viewBox: "0 0 273 191"
1538
- }, props), {
1539
- children: [
1540
- /* @__PURE__ */ jsx5("title", {
1541
- children: "Salesforce.com logo"
1542
- }),
1543
- /* @__PURE__ */ jsx5("defs", {
1544
- children: /* @__PURE__ */ jsx5("path", {
1545
- id: "a",
1546
- d: "M.06.5h272v190H.06z"
1547
- })
1548
- }),
1549
- /* @__PURE__ */ jsxs2("g", {
1550
- fillRule: "evenodd",
1551
- children: [
1552
- /* @__PURE__ */ jsx5("mask", {
1553
- id: "b",
1554
- fill: "#fff",
1555
- children: /* @__PURE__ */ jsx5("use", {
1556
- xlinkHref: "#a"
1557
- })
1558
- }),
1559
- /* @__PURE__ */ jsx5("path", {
1560
- fill: "#00A1E0",
1561
- d: "M113 21.3c8.78-9.14 21-14.8 34.5-14.8 18 0 33.6 10 42 24.9a58 58 0 0 1 23.7-5.05c32.4 0 58.7 26.5 58.7 59.2s-26.3 59.2-58.7 59.2c-3.96 0-7.82-.398-11.6-1.15-7.35 13.1-21.4 22-37.4 22a42.7 42.7 0 0 1-18.8-4.32c-7.45 17.5-24.8 29.8-45 29.8-21.1 0-39-13.3-45.9-32a45.1 45.1 0 0 1-9.34.972c-25.1 0-45.4-20.6-45.4-45.9 0-17 9.14-31.8 22.7-39.8a52.6 52.6 0 0 1-4.35-21c0-29.2 23.7-52.8 52.9-52.8 17.1 0 32.4 8.15 42 20.8",
1562
- mask: "url(#b)"
1563
- }),
1564
- /* @__PURE__ */ jsx5("path", {
1565
- fill: "#FFFFFE",
1566
- d: "M39.4 99.3c-.171.446.061.539.116.618.511.37 1.03.638 1.55.939 2.78 1.47 5.4 1.9 8.14 1.9 5.58 0 9.05-2.97 9.05-7.75v-.094c0-4.42-3.92-6.03-7.58-7.18l-.479-.155c-2.77-.898-5.16-1.68-5.16-3.5v-.093c0-1.56 1.4-2.71 3.56-2.71 2.4 0 5.26.799 7.09 1.81 0 0 .542.35.739-.173.107-.283 1.04-2.78 1.14-3.06.106-.293-.08-.514-.271-.628-2.1-1.28-5-2.15-8-2.15l-.557.002c-5.11 0-8.68 3.09-8.68 7.51v.095c0 4.66 3.94 6.18 7.62 7.23l.592.184c2.68.824 5 1.54 5 3.42v.094c0 1.73-1.51 3.02-3.93 3.02-.941 0-3.94-.016-7.19-2.07-.393-.229-.617-.394-.92-.579-.16-.097-.56-.272-.734.252l-1.1 3.06m81.7 0c-.171.446.061.539.118.618.509.37 1.03.638 1.55.939 2.78 1.47 5.4 1.9 8.14 1.9 5.58 0 9.05-2.97 9.05-7.75v-.094c0-4.42-3.91-6.03-7.58-7.18l-.479-.155c-2.77-.898-5.16-1.68-5.16-3.5v-.093c0-1.56 1.4-2.71 3.56-2.71 2.4 0 5.25.799 7.09 1.81 0 0 .542.35.74-.173.106-.283 1.04-2.78 1.13-3.06.107-.293-.08-.514-.27-.628-2.1-1.28-5-2.15-8-2.15l-.558.002c-5.11 0-8.68 3.09-8.68 7.51v.095c0 4.66 3.94 6.18 7.62 7.23l.591.184c2.69.824 5 1.54 5 3.42v.094c0 1.73-1.51 3.02-3.93 3.02-.943 0-3.95-.016-7.19-2.07-.393-.229-.623-.387-.921-.579-.101-.064-.572-.248-.733.252l-1.1 3.06m55.8-9.36c0 2.7-.504 4.83-1.49 6.34-.984 1.49-2.47 2.22-4.54 2.22s-3.55-.724-4.52-2.21c-.977-1.5-1.47-3.64-1.47-6.34 0-2.7.496-4.82 1.47-6.31.968-1.48 2.44-2.19 4.52-2.19s3.56.717 4.54 2.19c.992 1.49 1.49 3.61 1.49 6.31m4.66-5.01c-.459-1.55-1.17-2.91-2.12-4.05a10.151 10.151 0 0 0-3.58-2.72c-1.42-.665-3.1-1-5-1s-3.57.337-5 1c-1.42.664-2.63 1.58-3.58 2.72-.948 1.14-1.66 2.5-2.12 4.05-.455 1.54-.686 3.22-.686 5.01 0 1.79.231 3.47.686 5.01.457 1.55 1.17 2.91 2.12 4.05.951 1.14 2.16 2.05 3.58 2.7 1.43.648 3.11.978 5 .978 1.89 0 3.57-.33 4.99-.978 1.42-.648 2.63-1.56 3.58-2.7.949-1.14 1.66-2.5 2.12-4.05.454-1.54.685-3.22.685-5.01 0-1.78-.231-3.47-.685-5.01m38.3 12.8c-.153-.453-.595-.282-.595-.282-.677.259-1.4.499-2.17.619-.776.122-1.64.183-2.55.183-2.25 0-4.05-.671-5.33-2-1.29-1.33-2.01-3.47-2-6.37.007-2.64.645-4.62 1.79-6.14 1.13-1.5 2.87-2.28 5.17-2.28 1.92 0 3.39.223 4.93.705 0 0 .365.159.54-.322.409-1.13.711-1.94 1.15-3.18.124-.355-.18-.505-.291-.548-.604-.236-2.03-.623-3.11-.786-1.01-.154-2.18-.234-3.5-.234-1.96 0-3.7.335-5.19.999-1.49.663-2.75 1.58-3.75 2.72-1 1.14-1.76 2.5-2.27 4.05-.505 1.54-.76 3.23-.76 5.02 0 3.86 1.04 6.99 3.1 9.28 2.06 2.3 5.16 3.46 9.2 3.46 2.39 0 4.84-.483 6.6-1.18 0 0 .336-.162.19-.554l-1.15-3.16m8.15-10.4c.223-1.5.634-2.75 1.28-3.72.967-1.48 2.44-2.29 4.51-2.29s3.44.814 4.42 2.29c.65.975.934 2.27 1.04 3.72l-11.3-.002zm15.7-3.3c-.397-1.49-1.38-3-2.02-3.69-1.02-1.09-2.01-1.86-3-2.28a11.5 11.5 0 0 0-4.52-.917c-1.97 0-3.76.333-5.21 1.01-1.45.682-2.67 1.61-3.63 2.77-.959 1.16-1.68 2.53-2.14 4.1-.46 1.55-.692 3.25-.692 5.03 0 1.82.241 3.51.715 5.04.479 1.54 1.25 2.89 2.29 4.01 1.04 1.13 2.37 2.01 3.97 2.63 1.59.615 3.52.934 5.73.927 4.56-.015 6.96-1.03 7.94-1.58.175-.098.34-.267.134-.754l-1.03-2.89c-.158-.431-.594-.275-.594-.275-1.13.422-2.73 1.18-6.48 1.17-2.45-.004-4.26-.727-5.4-1.86-1.16-1.16-1.74-2.85-1.83-5.25l15.8.012s.416-.004.459-.41c.017-.168.541-3.24-.471-6.79zm-142 3.3c.223-1.5.635-2.75 1.28-3.72.968-1.48 2.44-2.29 4.51-2.29s3.44.814 4.42 2.29c.649.975.933 2.27 1.04 3.72l-11.3-.002zm15.7-3.3c-.396-1.49-1.38-3-2.02-3.69-1.02-1.09-2.01-1.86-3-2.28a11.5 11.5 0 0 0-4.52-.917c-1.97 0-3.76.333-5.21 1.01-1.45.682-2.67 1.61-3.63 2.77-.957 1.16-1.68 2.53-2.14 4.1-.459 1.55-.69 3.25-.69 5.03 0 1.82.239 3.51.716 5.04.478 1.54 1.25 2.89 2.28 4.01 1.04 1.13 2.37 2.01 3.97 2.63 1.59.615 3.51.934 5.73.927 4.56-.015 6.96-1.03 7.94-1.58.174-.098.34-.267.133-.754l-1.03-2.89c-.159-.431-.595-.275-.595-.275-1.13.422-2.73 1.18-6.48 1.17-2.44-.004-4.26-.727-5.4-1.86-1.16-1.16-1.74-2.85-1.83-5.25l15.8.012s.416-.004.459-.41c.017-.168.541-3.24-.472-6.79zm-49.8 13.6c-.619-.494-.705-.615-.91-.936-.313-.483-.473-1.17-.473-2.05 0-1.38.46-2.38 1.41-3.05-.01.002 1.36-1.18 4.58-1.14a32 32 0 0 1 4.28.365v7.17h.002s-2 .431-4.26.567c-3.21.193-4.63-.924-4.62-.921zm6.28-11.1c-.64-.047-1.47-.07-2.46-.07-1.35 0-2.66.168-3.88.498-1.23.332-2.34.846-3.29 1.53a7.63 7.63 0 0 0-2.29 2.6c-.559 1.04-.844 2.26-.844 3.64 0 1.4.243 2.61.723 3.6a6.54 6.54 0 0 0 2.06 2.47c.877.638 1.96 1.11 3.21 1.39 1.24.283 2.64.426 4.18.426 1.62 0 3.23-.136 4.79-.399a95.1 95.1 0 0 0 3.97-.772c.526-.121 1.11-.28 1.11-.28.39-.099.36-.516.36-.516l-.009-14.4c0-3.16-.844-5.51-2.51-6.96-1.66-1.45-4.09-2.18-7.24-2.18-1.18 0-3.09.16-4.23.389 0 0-3.44.668-4.86 1.78 0 0-.312.192-.142.627l1.12 3c.139.389.518.256.518.256s.119-.047.259-.13c3.03-1.65 6.87-1.6 6.87-1.6 1.7 0 3.02.345 3.9 1.02.861.661 1.3 1.66 1.3 3.76v.667c-1.35-.196-2.6-.309-2.6-.309zm127-8.13a.428.428 0 0 0-.237-.568c-.269-.102-1.61-.385-2.64-.449-1.98-.124-3.08.21-4.07.654-.978.441-2.06 1.15-2.66 1.97l-.002-1.92c0-.264-.187-.477-.453-.477h-4.04c-.262 0-.452.213-.452.477v23.5a.48.48 0 0 0 .479.479h4.14a.479.479 0 0 0 .478-.479v-11.8c0-1.58.174-3.15.521-4.14.342-.979.807-1.76 1.38-2.32a4.79 4.79 0 0 1 1.95-1.17 7.68 7.68 0 0 1 2.12-.298c.825 0 1.73.212 1.73.212.304.034.473-.152.576-.426.271-.721 1.04-2.88 1.19-3.31"
1567
- }),
1568
- /* @__PURE__ */ jsx5("path", {
1569
- fill: "#FFFFFE",
1570
- d: "M162.201 67.548a13.258 13.258 0 0 0-1.559-.37 12.217 12.217 0 0 0-2.144-.166c-2.853 0-5.102.806-6.681 2.398-1.568 1.58-2.635 3.987-3.17 7.154l-.193 1.069h-3.581s-.437-.018-.529.459l-.588 3.28c-.041.314.094.51.514.508h3.486l-3.537 19.743c-.277 1.59-.594 2.898-.945 3.889-.346.978-.684 1.711-1.1 2.243-.403.515-.785.894-1.444 1.115-.544.183-1.17.267-1.856.267-.382 0-.89-.064-1.265-.139-.375-.074-.57-.158-.851-.276 0 0-.409-.156-.57.254-.131.335-1.06 2.89-1.17 3.206-.112.312.045.558.243.629.464.166.809.272 1.441.421.878.207 1.618.22 2.311.22 1.452 0 2.775-.204 3.872-.6 1.104-.399 2.065-1.094 2.915-2.035.919-1.015 1.497-2.078 2.05-3.528.547-1.437 1.013-3.221 1.386-5.3l3.554-20.109h5.196s.438.016.529-.459l.588-3.28c.041-.314-.093-.51-.515-.508h-5.043c.025-.114.254-1.888.833-3.558.247-.713.712-1.288 1.106-1.683a3.273 3.273 0 0 1 1.321-.822 5.48 5.48 0 0 1 1.693-.244c.475 0 .941.057 1.296.131.489.104.679.159.807.197.514.157.583.005.684-.244l1.206-3.312c.124-.356-.178-.506-.29-.55m-70.474 34.117c0 .264-.188.479-.452.479h-4.183c-.265 0-.453-.215-.453-.479V67.997c0-.263.188-.476.453-.476h4.183c.264 0 .452.213.452.476v33.668"
1571
- })
1572
- ]
1573
- })
1574
- ]
1575
- }));
1576
- }
1577
- function IconGoogleDocs(_a) {
1578
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1579
- return /* @__PURE__ */ jsxs2("svg", __spreadProps(__spreadValues({
1580
- xmlns: "http://www.w3.org/2000/svg",
1581
- xmlSpace: "preserve",
1582
- viewBox: "0 0 64 88"
1583
- }, props), {
1584
- children: [
1585
- /* @__PURE__ */ jsx5("path", {
1586
- d: "M58 88H6c-3.3 0-6-2.7-6-6V6c0-3.3 2.7-6 6-6h36l22 22v60c0 3.3-2.7 6-6 6z",
1587
- style: {
1588
- fill: "#3086f6"
1589
- }
1590
- }),
1591
- /* @__PURE__ */ jsx5("path", {
1592
- d: "m42 0 22 22H42V0z",
1593
- style: {
1594
- fill: "#0c67d6"
1595
- }
1596
- }),
1597
- /* @__PURE__ */ jsx5("path", {
1598
- d: "M50 39H14v-5h36v5zm0 7H14v5h36v-5zM40 58H14v5h26v-5z",
1599
- style: {
1600
- fill: "#fdffff"
1601
- }
1602
- })
1603
- ]
1604
- }));
1605
- }
1606
- var mockFiles = [
1607
- {
1608
- name: "CopilotTextarea README",
1609
- sourceApplication: "GoogleDocs",
1610
- getContents: () => __async(void 0, null, function* () {
1611
- return "some contents";
1612
- })
1613
- },
1614
- {
1615
- name: "prospecting call transcript",
1616
- sourceApplication: "Salesforce",
1617
- getContents: () => __async(void 0, null, function* () {
1618
- return "some contents";
1619
- })
1620
- },
1621
- {
1622
- name: "customer feedback",
1623
- sourceApplication: "Zendesk",
1624
- getContents: () => __async(void 0, null, function* () {
1625
- return "some contents";
1626
- })
1627
- },
1628
- {
1629
- name: "product specifications",
1630
- sourceApplication: "Google Docs",
1631
- getContents: () => __async(void 0, null, function* () {
1632
- return "some contents";
1633
- })
1634
- },
1635
- {
1636
- name: "meeting minutes",
1637
- sourceApplication: "Microsoft Teams",
1638
- getContents: () => __async(void 0, null, function* () {
1639
- return "some contents";
1640
- })
1641
- },
1642
- {
1643
- name: "project plan",
1644
- sourceApplication: "Trello",
1645
- getContents: () => __async(void 0, null, function* () {
1646
- return "some contents";
1647
- })
1648
- },
1649
- {
1650
- name: "code review comments",
1651
- sourceApplication: "Github",
1652
- getContents: () => __async(void 0, null, function* () {
1653
- return "some contents";
1654
- })
1655
- }
1656
- ];
1657
1478
 
1658
1479
  // src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx
1659
1480
  import { jsx as jsx6 } from "react/jsx-runtime";
@@ -1666,7 +1487,8 @@ var HoveringInsertionPromptBox = (props) => {
1666
1487
  editorState: props.editorState
1667
1488
  },
1668
1489
  performInsertion: props.performInsertion,
1669
- insertionOrEditingFunction: props.apiConfig.insertionOrEditingFunction
1490
+ insertionOrEditingFunction: props.apiConfig.insertionOrEditingFunction,
1491
+ contextCategories: props.contextCategories
1670
1492
  })
1671
1493
  });
1672
1494
  };
@@ -1759,7 +1581,7 @@ var Toolbar = React6.forwardRef(
1759
1581
  );
1760
1582
 
1761
1583
  // src/components/hovering-toolbar/hovering-editor-provider.tsx
1762
- import { createContext, useState as useState4, useContext as useContext2 } from "react";
1584
+ import { createContext, useState as useState4, useContext as useContext3 } from "react";
1763
1585
  import { jsx as jsx8 } from "react/jsx-runtime";
1764
1586
  var HoveringEditorContext = createContext({
1765
1587
  isDisplayed: false,
@@ -1775,7 +1597,7 @@ var HoveringEditorProvider = ({
1775
1597
  children
1776
1598
  });
1777
1599
  };
1778
- var useHoveringEditorContext = () => useContext2(HoveringEditorContext);
1600
+ var useHoveringEditorContext = () => useContext3(HoveringEditorContext);
1779
1601
 
1780
1602
  // src/components/hovering-toolbar/hovering-toolbar.tsx
1781
1603
  import { jsx as jsx9 } from "react/jsx-runtime";
@@ -1857,7 +1679,8 @@ var HoveringToolbar = (props) => {
1857
1679
  at: selection
1858
1680
  });
1859
1681
  setIsDisplayed(false);
1860
- }
1682
+ },
1683
+ contextCategories: props.contextCategories
1861
1684
  })
1862
1685
  })
1863
1686
  });
@@ -2195,7 +2018,8 @@ var BaseCopilotTextareaWithHoveringContext = React9.forwardRef(
2195
2018
  setCursorMovedSinceLastTextChange
2196
2019
  }),
2197
2020
  /* @__PURE__ */ jsx13(HoveringToolbar, {
2198
- apiConfig: autosuggestionsConfig.apiConfig
2021
+ apiConfig: autosuggestionsConfig.apiConfig,
2022
+ contextCategories: autosuggestionsConfig.contextCategories
2199
2023
  }),
2200
2024
  /* @__PURE__ */ jsx13(Editable, __spreadValues({
2201
2025
  renderElement: renderElementMemoized,
@@ -2235,10 +2059,10 @@ var BaseCopilotTextarea = React9.forwardRef(
2235
2059
  );
2236
2060
 
2237
2061
  // src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx
2238
- import { CopilotContext as CopilotContext2 } from "@copilotkit/react-core";
2239
- import { useCallback as useCallback4, useContext as useContext3 } from "react";
2062
+ import { CopilotContext as CopilotContext3 } from "@copilotkit/react-core";
2063
+ import { useCallback as useCallback4, useContext as useContext4 } from "react";
2240
2064
  function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCategories, insertionApiConfig, editingApiConfig) {
2241
- const { getContextString, copilotApiConfig } = useContext3(CopilotContext2);
2065
+ const { getContextString, copilotApiConfig } = useContext4(CopilotContext3);
2242
2066
  const insertionFunction = useCallback4(
2243
2067
  (editorState2, insertionPrompt, abortSignal) => __async(this, null, function* () {
2244
2068
  const res = yield retry(() => __async(this, null, function* () {