@adecore/agents-react 0.67.1 → 0.68.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 (77) hide show
  1. package/dist/agents/AgentIcon.d.ts +7 -0
  2. package/dist/agents/AgentIcon.js +70 -31
  3. package/dist/chat/logic/timeline.d.ts +2 -0
  4. package/dist/chat/logic/timeline.js +47 -0
  5. package/dist/chat/subagent-list.d.ts +1 -2
  6. package/dist/chat/ui/Composer.js +491 -447
  7. package/dist/chat/ui/Markdown.d.ts +1 -1
  8. package/dist/chat/ui/Markdown.js +277 -203
  9. package/dist/chat/ui/PromptEditor.d.ts +3 -1
  10. package/dist/chat/ui/PromptEditor.js +4 -1
  11. package/dist/chat/ui/Timeline.js +5 -4
  12. package/dist/chat/ui/composer/ComposerMenu.js +22 -12
  13. package/dist/chat/ui/composer/chips.d.ts +2 -1
  14. package/dist/chat/ui/composer/chips.js +44 -1
  15. package/dist/chat/ui/composer/key-handler.d.ts +2 -0
  16. package/dist/chat/ui/composer/key-handler.js +12 -2
  17. package/dist/chat/ui/composer/placeholder.d.ts +2 -1
  18. package/dist/chat/ui/composer/placeholder.js +31 -10
  19. package/dist/chat/ui/composer/use-composer-menus.js +49 -39
  20. package/dist/chat/ui/composer/use-prompt-menus.d.ts +10 -7
  21. package/dist/chat/ui/composer/use-prompt-menus.js +183 -157
  22. package/dist/chat/ui/composer/use-prompt-suggestion.d.ts +16 -0
  23. package/dist/chat/ui/composer/use-prompt-suggestion.js +55 -0
  24. package/dist/chat/ui/index.d.ts +1 -1
  25. package/dist/chat/ui/index.js +1 -1
  26. package/dist/chat/ui/markdown-cache.d.ts +4 -0
  27. package/dist/chat/ui/markdown-cache.js +47 -0
  28. package/dist/chat/ui/reference-lookup.d.ts +2 -1
  29. package/dist/chat/ui/reference-lookup.js +1 -1
  30. package/dist/chat/ui/rows/SubagentRow.js +26 -24
  31. package/dist/chat/ui/rows/TaskRow.d.ts +11 -1
  32. package/dist/chat/ui/rows/TaskRow.js +281 -197
  33. package/dist/chat/ui/thread-references.js +12 -9
  34. package/dist/chat-client.d.ts +3 -1
  35. package/dist/chat-client.js +82 -30
  36. package/dist/chat-sink.d.ts +1 -0
  37. package/dist/host/host-hooks.d.ts +4 -1
  38. package/dist/host/host-hooks.js +11 -0
  39. package/dist/host/host.d.ts +18 -0
  40. package/dist/index.d.ts +1 -1
  41. package/dist/locales/en/agent-chat.d.ts +1 -0
  42. package/dist/locales/en/agent-chat.js +2 -1
  43. package/dist/locales/nl/agent-chat.d.ts +1 -0
  44. package/dist/locales/nl/agent-chat.js +2 -1
  45. package/dist/state/chats.d.ts +2 -0
  46. package/dist/state/chats.js +21 -5
  47. package/dist/theme.css +6 -0
  48. package/package.json +9 -9
  49. package/src/agents/AgentIcon.tsx +6 -2
  50. package/src/chat/logic/timeline.ts +63 -0
  51. package/src/chat/subagent-list.ts +1 -4
  52. package/src/chat/ui/Composer.tsx +15 -2
  53. package/src/chat/ui/Markdown.tsx +97 -55
  54. package/src/chat/ui/PromptEditor.tsx +7 -2
  55. package/src/chat/ui/Timeline.tsx +17 -14
  56. package/src/chat/ui/composer/ComposerMenu.tsx +14 -6
  57. package/src/chat/ui/composer/chips.ts +51 -2
  58. package/src/chat/ui/composer/key-handler.ts +17 -2
  59. package/src/chat/ui/composer/placeholder.ts +14 -3
  60. package/src/chat/ui/composer/use-composer-menus.ts +8 -3
  61. package/src/chat/ui/composer/use-prompt-menus.ts +33 -4
  62. package/src/chat/ui/composer/use-prompt-suggestion.ts +36 -0
  63. package/src/chat/ui/index.ts +1 -1
  64. package/src/chat/ui/markdown-cache.ts +60 -0
  65. package/src/chat/ui/reference-lookup.ts +4 -2
  66. package/src/chat/ui/rows/SubagentRow.tsx +1 -1
  67. package/src/chat/ui/rows/TaskRow.tsx +54 -9
  68. package/src/chat/ui/thread-references.ts +4 -2
  69. package/src/chat-client.ts +79 -22
  70. package/src/chat-sink.ts +6 -1
  71. package/src/host/host-hooks.ts +19 -1
  72. package/src/host/host.ts +41 -0
  73. package/src/index.ts +3 -0
  74. package/src/locales/en/agent-chat.ts +2 -1
  75. package/src/locales/nl/agent-chat.ts +2 -1
  76. package/src/state/chats.ts +22 -6
  77. package/src/theme.css +6 -0
@@ -1,4 +1,4 @@
1
- import { type Components, type Options } from 'react-markdown';
1
+ import type { Components, Options } from 'react-markdown';
2
2
  import { type ShellCodeBlockContext } from '../../host/host.js';
3
3
  import type { ReferenceToken } from '../mentions.js';
4
4
  type ShellCodeBlockReply = Pick<ShellCodeBlockContext, 'scopeId' | 'chatId' | 'itemId'> & {
@@ -4,9 +4,9 @@ import clsx from 'clsx';
4
4
  import { Zap } from 'lucide-react';
5
5
  import { createContext, memo, useContext, useState } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
- import ReactMarkdown from 'react-markdown';
8
7
  import remarkBreaks from 'remark-breaks';
9
8
  import remarkGfm from 'remark-gfm';
9
+ import { MarkGlyph } from '../../agents/AgentIcon.js';
10
10
  import { useChatHost } from '../../host/host.js';
11
11
  import { MENTION_TONE, SKILL_TONE, TOKEN_ICON } from './chips.js';
12
12
  import { CodeStreamingContext } from './code-streaming.js';
@@ -14,6 +14,7 @@ import { CodeBlock } from './CodeBlock.js';
14
14
  import { DisplayImage } from './DisplayImage.js';
15
15
  import { useFileLinkCwd, useFileLinkScopeId, useFileLinkTarget, useOpenFileLink } from './file-links.js';
16
16
  import { createMarkdownBlockSplitter } from './markdown-blocks.js';
17
+ import { parseMarkdown } from './markdown-cache.js';
17
18
  import { MermaidBlock } from './MermaidBlock.js';
18
19
  import { NamedChip } from './NamedChip.js';
19
20
  import { ReferenceLookupContext } from './reference-lookup.js';
@@ -681,7 +682,7 @@ function ReplyCode(t0) {
681
682
  }
682
683
  /* A picked file, skill or reference in a sent message. The glyph stands in for the sigil the text still carries. */
683
684
  function Chip(t0) {
684
- const $ = _c(17);
685
+ const $ = _c(16);
685
686
  const {
686
687
  kind,
687
688
  value
@@ -716,62 +717,46 @@ function Chip(t0) {
716
717
  }
717
718
  if (kind === "skill") {
718
719
  let t1;
719
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
720
- t1 = /*#__PURE__*/_jsx(Icon, {
721
- icon: Zap,
722
- size: 14,
723
- className: clsx(TOKEN_ICON, "opacity-85")
724
- });
725
- $[5] = t1;
726
- } else {
727
- t1 = $[5];
728
- }
729
- let t2;
730
- if ($[6] !== value) {
731
- t2 = /*#__PURE__*/_jsx(TokenChip, {
732
- kind: "skill",
733
- value: value,
734
- sigil: "$",
735
- icon: t1,
736
- label: value,
737
- tone: SKILL_TONE
720
+ if ($[5] !== value) {
721
+ t1 = /*#__PURE__*/_jsx(SkillChip, {
722
+ name: value
738
723
  });
739
- $[6] = value;
740
- $[7] = t2;
724
+ $[5] = value;
725
+ $[6] = t1;
741
726
  } else {
742
- t2 = $[7];
727
+ t1 = $[6];
743
728
  }
744
- return t2;
729
+ return t1;
745
730
  }
746
731
  let t1;
747
- if ($[8] !== value) {
732
+ if ($[7] !== value) {
748
733
  t1 = /*#__PURE__*/_jsx(FileIcon, {
749
734
  path: value,
750
735
  size: 14,
751
736
  className: TOKEN_ICON
752
737
  });
753
- $[8] = value;
754
- $[9] = t1;
738
+ $[7] = value;
739
+ $[8] = t1;
755
740
  } else {
756
- t1 = $[9];
741
+ t1 = $[8];
757
742
  }
758
743
  let t2;
759
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
744
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
760
745
  t2 = /[\\/]$/;
761
- $[10] = t2;
746
+ $[9] = t2;
762
747
  } else {
763
- t2 = $[10];
748
+ t2 = $[9];
764
749
  }
765
750
  let t3;
766
- if ($[11] !== value) {
751
+ if ($[10] !== value) {
767
752
  t3 = t2.test(value);
768
- $[11] = value;
769
- $[12] = t3;
753
+ $[10] = value;
754
+ $[11] = t3;
770
755
  } else {
771
- t3 = $[12];
756
+ t3 = $[11];
772
757
  }
773
758
  let t4;
774
- if ($[13] !== t1 || $[14] !== t3 || $[15] !== value) {
759
+ if ($[12] !== t1 || $[13] !== t3 || $[14] !== value) {
775
760
  t4 = /*#__PURE__*/_jsx(TokenChip, {
776
761
  kind: "mention",
777
762
  value: value,
@@ -782,15 +767,94 @@ function Chip(t0) {
782
767
  "data-file-path": value,
783
768
  "data-file-directory": t3
784
769
  });
785
- $[13] = t1;
786
- $[14] = t3;
787
- $[15] = value;
788
- $[16] = t4;
770
+ $[12] = t1;
771
+ $[13] = t3;
772
+ $[14] = value;
773
+ $[15] = t4;
789
774
  } else {
790
- t4 = $[16];
775
+ t4 = $[15];
791
776
  }
792
777
  return t4;
793
778
  }
779
+ /* A host's own skill shows its title under the host's mark, while a selection still copies `$name`. */
780
+ function SkillChip(t0) {
781
+ const $ = _c(11);
782
+ const {
783
+ name
784
+ } = t0;
785
+ const host = useContext(ReferenceLookupContext).skills?.find(skill => skill.name === name);
786
+ if (host !== undefined) {
787
+ const t1 = host.icon;
788
+ let t2;
789
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
790
+ t2 = clsx(TOKEN_ICON, "opacity-85");
791
+ $[0] = t2;
792
+ } else {
793
+ t2 = $[0];
794
+ }
795
+ let t3;
796
+ if ($[1] !== host.icon) {
797
+ t3 = /*#__PURE__*/_jsx(MarkGlyph, {
798
+ mark: t1,
799
+ size: 14,
800
+ decorative: true,
801
+ className: t2
802
+ });
803
+ $[1] = host.icon;
804
+ $[2] = t3;
805
+ } else {
806
+ t3 = $[2];
807
+ }
808
+ const t4 = host.title === name ? undefined : name;
809
+ let t5;
810
+ if ($[3] !== host.title || $[4] !== name || $[5] !== t3 || $[6] !== t4) {
811
+ t5 = /*#__PURE__*/_jsx(TokenChip, {
812
+ kind: "skill",
813
+ value: name,
814
+ sigil: "$",
815
+ icon: t3,
816
+ label: host.title,
817
+ spelled: t4,
818
+ tone: SKILL_TONE
819
+ });
820
+ $[3] = host.title;
821
+ $[4] = name;
822
+ $[5] = t3;
823
+ $[6] = t4;
824
+ $[7] = t5;
825
+ } else {
826
+ t5 = $[7];
827
+ }
828
+ return t5;
829
+ }
830
+ let t1;
831
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
832
+ t1 = /*#__PURE__*/_jsx(Icon, {
833
+ icon: Zap,
834
+ size: 14,
835
+ className: clsx(TOKEN_ICON, "opacity-85")
836
+ });
837
+ $[8] = t1;
838
+ } else {
839
+ t1 = $[8];
840
+ }
841
+ let t2;
842
+ if ($[9] !== name) {
843
+ t2 = /*#__PURE__*/_jsx(TokenChip, {
844
+ kind: "skill",
845
+ value: name,
846
+ sigil: "$",
847
+ icon: t1,
848
+ label: name,
849
+ tone: SKILL_TONE
850
+ });
851
+ $[9] = name;
852
+ $[10] = t2;
853
+ } else {
854
+ t2 = $[10];
855
+ }
856
+ return t2;
857
+ }
794
858
  /* A span the chip plugins made is a chip; any other, such as a fading word, stays the span it was. */
795
859
  function ChipSpan(t0) {
796
860
  const $ = _c(11);
@@ -857,83 +921,83 @@ const PLUGINS_WITH_BREAKS = [remarkGfm, remarkBreaks];
857
921
  const MESSAGE_PLUGINS = [remarkGfm, remarkHtmlAsText, remarkBreaks];
858
922
  const FADE_PLUGINS = [rehypeFadeWords];
859
923
  const NO_PLUGINS = [];
924
+ const namesKeys = new WeakMap();
925
+ /* What of the named references the chip plugin reads, as the part of a cache key it decides. */
926
+ function namesKey(items) {
927
+ let key = namesKeys.get(items);
928
+ if (key === undefined) {
929
+ key = items.map(item => `${item.id}\u0001${item.name}`).join('\u0002');
930
+ namesKeys.set(items, key);
931
+ }
932
+ return key;
933
+ }
860
934
  /* One block of a reply. It renders no element of its own, so prose keeps its first and last margins. */
861
935
  const ReplyBlock = memo(function ReplyBlock(t0) {
862
936
  const $ = _c(16);
863
937
  const {
864
938
  text,
865
939
  fade,
866
- open,
867
- reply
940
+ open
868
941
  } = t0;
869
942
  const {
870
943
  items,
871
944
  referenced
872
945
  } = useContext(ReferenceLookupContext);
946
+ let T0;
873
947
  let t1;
874
- if ($[0] !== items || $[1] !== referenced) {
875
- t1 = {
948
+ let t2;
949
+ if ($[0] !== fade || $[1] !== items || $[2] !== open || $[3] !== referenced || $[4] !== text) {
950
+ const named = {
876
951
  items,
877
952
  referenced
878
953
  };
879
- $[0] = items;
880
- $[1] = referenced;
881
- $[2] = t1;
882
- } else {
883
- t1 = $[2];
884
- }
885
- const named = t1;
886
- let t2;
887
- if ($[3] !== fade || $[4] !== items.length || $[5] !== named) {
888
- t2 = items.length === 0 ? fade ? FADE_PLUGINS : NO_PLUGINS : [[rehypeNamedReferences, named], ...(fade ? FADE_PLUGINS : [])];
889
- $[3] = fade;
890
- $[4] = items.length;
891
- $[5] = named;
892
- $[6] = t2;
893
- } else {
894
- t2 = $[6];
895
- }
896
- const rehypePlugins = t2;
897
- const t3 = reply ?? null;
898
- let t4;
899
- if ($[7] !== rehypePlugins || $[8] !== text) {
900
- t4 = /*#__PURE__*/_jsx(ReactMarkdown, {
954
+ const rehypePlugins = items.length === 0 ? fade ? FADE_PLUGINS : NO_PLUGINS : [[rehypeNamedReferences, named], ...(fade ? FADE_PLUGINS : [])];
955
+ let t3;
956
+ if ($[8] !== fade || $[9] !== items || $[10] !== referenced) {
957
+ t3 = fade ? null : items.length === 0 ? "reply" : `reply\u0003${namesKey(items)}\u0003${(referenced ?? []).join("\x02")}`;
958
+ $[8] = fade;
959
+ $[9] = items;
960
+ $[10] = referenced;
961
+ $[11] = t3;
962
+ } else {
963
+ t3 = $[11];
964
+ }
965
+ const variant = t3;
966
+ T0 = CodeStreamingContext.Provider;
967
+ t1 = open;
968
+ t2 = parseMarkdown(variant, {
901
969
  remarkPlugins: REPLY_PLUGINS,
902
- rehypePlugins: rehypePlugins,
970
+ rehypePlugins,
903
971
  components: replyComponents,
904
972
  children: text
905
973
  });
906
- $[7] = rehypePlugins;
907
- $[8] = text;
908
- $[9] = t4;
909
- } else {
910
- t4 = $[9];
911
- }
912
- let t5;
913
- if ($[10] !== t3 || $[11] !== t4) {
914
- t5 = /*#__PURE__*/_jsx(ShellCodeBlockReplyContext.Provider, {
915
- value: t3,
916
- children: t4
917
- });
918
- $[10] = t3;
919
- $[11] = t4;
920
- $[12] = t5;
974
+ $[0] = fade;
975
+ $[1] = items;
976
+ $[2] = open;
977
+ $[3] = referenced;
978
+ $[4] = text;
979
+ $[5] = T0;
980
+ $[6] = t1;
981
+ $[7] = t2;
921
982
  } else {
922
- t5 = $[12];
983
+ T0 = $[5];
984
+ t1 = $[6];
985
+ t2 = $[7];
923
986
  }
924
- let t6;
925
- if ($[13] !== open || $[14] !== t5) {
926
- t6 = /*#__PURE__*/_jsx(CodeStreamingContext.Provider, {
927
- value: open,
928
- children: t5
987
+ let t3;
988
+ if ($[12] !== T0 || $[13] !== t1 || $[14] !== t2) {
989
+ t3 = /*#__PURE__*/_jsx(T0, {
990
+ value: t1,
991
+ children: t2
929
992
  });
930
- $[13] = open;
931
- $[14] = t5;
932
- $[15] = t6;
993
+ $[12] = T0;
994
+ $[13] = t1;
995
+ $[14] = t2;
996
+ $[15] = t3;
933
997
  } else {
934
- t6 = $[15];
998
+ t3 = $[15];
935
999
  }
936
- return t6;
1000
+ return t3;
937
1001
  });
938
1002
  /*
939
1003
  * A code fence at the top level of a reply, drawn as markdown draws it but without parsing, so a word
@@ -946,9 +1010,9 @@ const ReplyFence = memo(function ReplyFence(t0) {
946
1010
  info,
947
1011
  body,
948
1012
  source,
949
- open,
950
- reply
1013
+ open
951
1014
  } = t0;
1015
+ const reply = useContext(ShellCodeBlockReplyContext);
952
1016
  const {
953
1017
  renderCodeFence,
954
1018
  renderShellCodeBlock
@@ -974,7 +1038,7 @@ const ReplyFence = memo(function ReplyFence(t0) {
974
1038
  t3 = $[10];
975
1039
  }
976
1040
  const lang = languageOf(`language-${t3[0]}`);
977
- const shell = reply === undefined ? null : shellFence(source);
1041
+ const shell = reply === null ? null : shellFence(source);
978
1042
  const drawn = open ? null : renderCodeFence?.(lang, body);
979
1043
  if (drawn !== undefined && drawn !== null) {
980
1044
  t2 = drawn;
@@ -987,7 +1051,7 @@ const ReplyFence = memo(function ReplyFence(t0) {
987
1051
  }) : /*#__PURE__*/_jsx(CodeBlock, {
988
1052
  code: body,
989
1053
  lang: lang,
990
- actions: shellCodeBlockActions(reply ?? null, shell, renderShellCodeBlock)
1054
+ actions: shellCodeBlockActions(reply, shell, renderShellCodeBlock)
991
1055
  })
992
1056
  });
993
1057
  }
@@ -1016,7 +1080,7 @@ const ReplyFence = memo(function ReplyFence(t0) {
1016
1080
  * as it is added instead, for a reply that is shown a block at a time.
1017
1081
  */
1018
1082
  export const ReplyMarkdown = memo(function ReplyMarkdown(t0) {
1019
- const $ = _c(15);
1083
+ const $ = _c(11);
1020
1084
  const {
1021
1085
  text,
1022
1086
  streaming,
@@ -1025,69 +1089,71 @@ export const ReplyMarkdown = memo(function ReplyMarkdown(t0) {
1025
1089
  } = t0;
1026
1090
  const arriving = t1 === undefined ? false : t1;
1027
1091
  const [split] = useState(createMarkdownBlockSplitter);
1028
- let t2;
1029
- let t3;
1030
- let t4;
1031
- if ($[0] !== arriving || $[1] !== reply || $[2] !== split || $[3] !== streaming || $[4] !== text) {
1032
- const blocks = split(text);
1033
- t2 = "chat-markdown prose prose-sm max-w-none text-sm";
1034
- t3 = arriving || undefined;
1035
- let t5;
1036
- if ($[8] !== reply || $[9] !== streaming) {
1037
- t5 = (block, index) => block.fence !== undefined ? /*#__PURE__*/_jsx(ReplyFence, {
1038
- info: block.fence.info,
1039
- body: block.fence.body,
1040
- source: block.fence.source,
1041
- open: streaming && !block.fence.closed,
1042
- reply: reply
1043
- }, index) : /*#__PURE__*/_jsx(ReplyBlock, {
1044
- text: block.text,
1045
- fade: streaming,
1046
- open: streaming && block.openFence,
1047
- reply: reply
1048
- }, index);
1049
- $[8] = reply;
1050
- $[9] = streaming;
1051
- $[10] = t5;
1052
- } else {
1053
- t5 = $[10];
1054
- }
1055
- t4 = blocks.map(t5);
1056
- $[0] = arriving;
1057
- $[1] = reply;
1058
- $[2] = split;
1059
- $[3] = streaming;
1060
- $[4] = text;
1061
- $[5] = t2;
1062
- $[6] = t3;
1063
- $[7] = t4;
1092
+ const blocks = split(text);
1093
+ const [faded, setFaded] = useState(streaming);
1094
+ if (streaming && !faded) {
1095
+ setFaded(true);
1096
+ }
1097
+ const t2 = "chat-markdown prose prose-sm max-w-none text-sm";
1098
+ const t3 = arriving || undefined;
1099
+ const t4 = faded && !streaming || undefined;
1100
+ const t5 = ShellCodeBlockReplyContext;
1101
+ const t6 = reply ?? null;
1102
+ let t7;
1103
+ if ($[0] !== faded || $[1] !== streaming) {
1104
+ t7 = (block, index) => block.fence !== undefined ? /*#__PURE__*/_jsx(ReplyFence, {
1105
+ info: block.fence.info,
1106
+ body: block.fence.body,
1107
+ source: block.fence.source,
1108
+ open: streaming && !block.fence.closed
1109
+ }, index) : /*#__PURE__*/_jsx(ReplyBlock, {
1110
+ text: block.text,
1111
+ fade: streaming || faded,
1112
+ open: streaming && block.openFence
1113
+ }, index);
1114
+ $[0] = faded;
1115
+ $[1] = streaming;
1116
+ $[2] = t7;
1064
1117
  } else {
1065
- t2 = $[5];
1066
- t3 = $[6];
1067
- t4 = $[7];
1118
+ t7 = $[2];
1068
1119
  }
1069
- let t5;
1070
- if ($[11] !== t2 || $[12] !== t3 || $[13] !== t4) {
1071
- t5 = /*#__PURE__*/_jsx("div", {
1120
+ const t8 = blocks.map(t7);
1121
+ let t9;
1122
+ if ($[3] !== t5.Provider || $[4] !== t6 || $[5] !== t8) {
1123
+ t9 = /*#__PURE__*/_jsx(t5.Provider, {
1124
+ value: t6,
1125
+ children: t8
1126
+ });
1127
+ $[3] = t5.Provider;
1128
+ $[4] = t6;
1129
+ $[5] = t8;
1130
+ $[6] = t9;
1131
+ } else {
1132
+ t9 = $[6];
1133
+ }
1134
+ let t10;
1135
+ if ($[7] !== t3 || $[8] !== t4 || $[9] !== t9) {
1136
+ t10 = /*#__PURE__*/_jsx("div", {
1072
1137
  className: t2,
1073
1138
  "data-arriving": t3,
1074
- children: t4
1139
+ "data-faded-in": t4,
1140
+ children: t9
1075
1141
  });
1076
- $[11] = t2;
1077
- $[12] = t3;
1078
- $[13] = t4;
1079
- $[14] = t5;
1142
+ $[7] = t3;
1143
+ $[8] = t4;
1144
+ $[9] = t9;
1145
+ $[10] = t10;
1080
1146
  } else {
1081
- t5 = $[14];
1147
+ t10 = $[10];
1082
1148
  }
1083
- return t5;
1149
+ return t10;
1084
1150
  });
1085
1151
  /*
1086
1152
  * A message a person sent. Enter meant a line break, a tag typed without backticks stays the text
1087
1153
  * it was, and the files, skills and references picked in the composer are chips again.
1088
1154
  */
1089
1155
  export const MessageMarkdown = memo(function MessageMarkdown(t0) {
1090
- const $ = _c(7);
1156
+ const $ = _c(9);
1091
1157
  const {
1092
1158
  text,
1093
1159
  mentions,
@@ -1095,45 +1161,51 @@ export const MessageMarkdown = memo(function MessageMarkdown(t0) {
1095
1161
  references
1096
1162
  } = t0;
1097
1163
  let t1;
1098
- if ($[0] !== mentions || $[1] !== references || $[2] !== skills) {
1099
- t1 = [[rehypeChips, {
1164
+ let t2;
1165
+ if ($[0] !== mentions || $[1] !== references || $[2] !== skills || $[3] !== text) {
1166
+ const chips = {
1100
1167
  mentions,
1101
1168
  skills,
1102
1169
  references
1103
- }]];
1170
+ };
1171
+ const rehypePlugins = [[rehypeChips, chips]];
1172
+ t1 = "chat-markdown prose prose-sm max-w-none text-sm";
1173
+ t2 = parseMarkdown(`message\u0003${JSON.stringify(chips)}`, {
1174
+ remarkPlugins: MESSAGE_PLUGINS,
1175
+ rehypePlugins,
1176
+ components: replyComponents,
1177
+ children: text
1178
+ });
1104
1179
  $[0] = mentions;
1105
1180
  $[1] = references;
1106
1181
  $[2] = skills;
1107
- $[3] = t1;
1182
+ $[3] = text;
1183
+ $[4] = t1;
1184
+ $[5] = t2;
1108
1185
  } else {
1109
- t1 = $[3];
1186
+ t1 = $[4];
1187
+ t2 = $[5];
1110
1188
  }
1111
- const rehypePlugins = t1;
1112
- let t2;
1113
- if ($[4] !== rehypePlugins || $[5] !== text) {
1114
- t2 = /*#__PURE__*/_jsx("div", {
1115
- className: "chat-markdown prose prose-sm max-w-none text-sm",
1116
- children: /*#__PURE__*/_jsx(ReactMarkdown, {
1117
- remarkPlugins: MESSAGE_PLUGINS,
1118
- rehypePlugins: rehypePlugins,
1119
- components: replyComponents,
1120
- children: text
1121
- })
1189
+ let t3;
1190
+ if ($[6] !== t1 || $[7] !== t2) {
1191
+ t3 = /*#__PURE__*/_jsx("div", {
1192
+ className: t1,
1193
+ children: t2
1122
1194
  });
1123
- $[4] = rehypePlugins;
1124
- $[5] = text;
1125
- $[6] = t2;
1195
+ $[6] = t1;
1196
+ $[7] = t2;
1197
+ $[8] = t3;
1126
1198
  } else {
1127
- t2 = $[6];
1199
+ t3 = $[8];
1128
1200
  }
1129
- return t2;
1201
+ return t3;
1130
1202
  });
1131
1203
  /*
1132
1204
  * `breaks` is for person-authored notes; applying it to CLI markdown would change its layout. `muted`
1133
1205
  * sets the text a step back, for what stands beside an answer rather than being one.
1134
1206
  */
1135
1207
  export const Markdown = memo(function Markdown(t0) {
1136
- const $ = _c(11);
1208
+ const $ = _c(14);
1137
1209
  const {
1138
1210
  text,
1139
1211
  breaks: t1,
@@ -1147,48 +1219,50 @@ export const Markdown = memo(function Markdown(t0) {
1147
1219
  const muted = t3 === undefined ? false : t3;
1148
1220
  const t4 = fileLinks ? components : plainComponents;
1149
1221
  let t5;
1150
- if ($[0] !== componentOverrides || $[1] !== t4) {
1151
- t5 = {
1222
+ let t6;
1223
+ let t7;
1224
+ if ($[0] !== breaks || $[1] !== componentOverrides || $[2] !== fileLinks || $[3] !== muted || $[4] !== rehypePlugins || $[5] !== t4 || $[6] !== text) {
1225
+ const renderComponents = {
1152
1226
  ...t4,
1153
1227
  ...componentOverrides
1154
1228
  };
1155
- $[0] = componentOverrides;
1156
- $[1] = t4;
1157
- $[2] = t5;
1158
- } else {
1159
- t5 = $[2];
1160
- }
1161
- const renderComponents = t5;
1162
- const t6 = muted || undefined;
1163
- const t7 = breaks ? PLUGINS_WITH_BREAKS : PLUGINS;
1164
- let t8;
1165
- if ($[3] !== rehypePlugins || $[4] !== renderComponents || $[5] !== t7 || $[6] !== text) {
1166
- t8 = /*#__PURE__*/_jsx(ReactMarkdown, {
1167
- remarkPlugins: t7,
1168
- rehypePlugins: rehypePlugins,
1229
+ const variant = rehypePlugins === undefined && componentOverrides === undefined ? `markdown\u0003${breaks}\u0003${fileLinks}` : null;
1230
+ t5 = "chat-markdown prose prose-sm max-w-none text-sm";
1231
+ t6 = muted || undefined;
1232
+ t7 = parseMarkdown(variant, {
1233
+ remarkPlugins: breaks ? PLUGINS_WITH_BREAKS : PLUGINS,
1234
+ rehypePlugins,
1169
1235
  components: renderComponents,
1170
1236
  children: text
1171
1237
  });
1172
- $[3] = rehypePlugins;
1173
- $[4] = renderComponents;
1174
- $[5] = t7;
1238
+ $[0] = breaks;
1239
+ $[1] = componentOverrides;
1240
+ $[2] = fileLinks;
1241
+ $[3] = muted;
1242
+ $[4] = rehypePlugins;
1243
+ $[5] = t4;
1175
1244
  $[6] = text;
1176
- $[7] = t8;
1245
+ $[7] = t5;
1246
+ $[8] = t6;
1247
+ $[9] = t7;
1177
1248
  } else {
1178
- t8 = $[7];
1249
+ t5 = $[7];
1250
+ t6 = $[8];
1251
+ t7 = $[9];
1179
1252
  }
1180
- let t9;
1181
- if ($[8] !== t6 || $[9] !== t8) {
1182
- t9 = /*#__PURE__*/_jsx("div", {
1183
- className: "chat-markdown prose prose-sm max-w-none text-sm",
1253
+ let t8;
1254
+ if ($[10] !== t5 || $[11] !== t6 || $[12] !== t7) {
1255
+ t8 = /*#__PURE__*/_jsx("div", {
1256
+ className: t5,
1184
1257
  "data-muted": t6,
1185
- children: t8
1258
+ children: t7
1186
1259
  });
1187
- $[8] = t6;
1188
- $[9] = t8;
1189
- $[10] = t9;
1260
+ $[10] = t5;
1261
+ $[11] = t6;
1262
+ $[12] = t7;
1263
+ $[13] = t8;
1190
1264
  } else {
1191
- t9 = $[10];
1265
+ t8 = $[13];
1192
1266
  }
1193
- return t9;
1267
+ return t8;
1194
1268
  });
@@ -1,4 +1,5 @@
1
1
  import type { ChatSkill } from '@adecore/agent-contracts';
2
+ import { type HostSkill } from '../../host/host.js';
2
3
  import type { Referables } from '../../host/references.js';
3
4
  import { type PromptDraft } from './composer/use-prompt-menus.js';
4
5
  interface PromptEditorProps {
@@ -7,6 +8,7 @@ interface PromptEditorProps {
7
8
  label: string;
8
9
  placeholder: string;
9
10
  skills: readonly ChatSkill[];
11
+ hostSkills?: readonly HostSkill[];
10
12
  slashCommands?: readonly string[];
11
13
  goals?: boolean;
12
14
  cwd: string | null;
@@ -15,5 +17,5 @@ interface PromptEditorProps {
15
17
  disabled?: boolean;
16
18
  className?: string;
17
19
  }
18
- export declare function PromptEditor({ value, onChange, label, placeholder, skills, slashCommands, goals, cwd, referables, providerName, disabled, className }: PromptEditorProps): import("react").JSX.Element;
20
+ export declare function PromptEditor({ value, onChange, label, placeholder, skills, hostSkills, slashCommands, goals, cwd, referables, providerName, disabled, className }: PromptEditorProps): import("react").JSX.Element;
19
21
  export {};