@adecore/agents-react 0.67.1 → 0.69.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.
- package/dist/agents/AgentIcon.d.ts +7 -0
- package/dist/agents/AgentIcon.js +70 -31
- package/dist/chat/logic/timeline.d.ts +2 -0
- package/dist/chat/logic/timeline.js +47 -0
- package/dist/chat/subagent-list.d.ts +1 -2
- package/dist/chat/ui/Composer.js +491 -447
- package/dist/chat/ui/Markdown.d.ts +1 -1
- package/dist/chat/ui/Markdown.js +277 -203
- package/dist/chat/ui/PromptEditor.d.ts +3 -1
- package/dist/chat/ui/PromptEditor.js +4 -1
- package/dist/chat/ui/Timeline.js +5 -4
- package/dist/chat/ui/composer/ComposerMenu.js +22 -12
- package/dist/chat/ui/composer/chips.d.ts +2 -1
- package/dist/chat/ui/composer/chips.js +44 -1
- package/dist/chat/ui/composer/key-handler.d.ts +2 -0
- package/dist/chat/ui/composer/key-handler.js +12 -2
- package/dist/chat/ui/composer/placeholder.d.ts +2 -1
- package/dist/chat/ui/composer/placeholder.js +31 -10
- package/dist/chat/ui/composer/use-composer-menus.js +49 -39
- package/dist/chat/ui/composer/use-prompt-menus.d.ts +10 -7
- package/dist/chat/ui/composer/use-prompt-menus.js +183 -157
- package/dist/chat/ui/composer/use-prompt-suggestion.d.ts +16 -0
- package/dist/chat/ui/composer/use-prompt-suggestion.js +55 -0
- package/dist/chat/ui/index.d.ts +1 -1
- package/dist/chat/ui/index.js +1 -1
- package/dist/chat/ui/markdown-cache.d.ts +4 -0
- package/dist/chat/ui/markdown-cache.js +47 -0
- package/dist/chat/ui/reference-lookup.d.ts +2 -1
- package/dist/chat/ui/reference-lookup.js +1 -1
- package/dist/chat/ui/rows/SubagentRow.js +26 -24
- package/dist/chat/ui/rows/TaskRow.d.ts +11 -1
- package/dist/chat/ui/rows/TaskRow.js +281 -197
- package/dist/chat/ui/thread-references.js +12 -9
- package/dist/chat-client.d.ts +3 -1
- package/dist/chat-client.js +82 -30
- package/dist/chat-sink.d.ts +1 -0
- package/dist/host/host-hooks.d.ts +4 -1
- package/dist/host/host-hooks.js +11 -0
- package/dist/host/host.d.ts +18 -0
- package/dist/index.d.ts +1 -1
- package/dist/locales/en/agent-chat.d.ts +1 -0
- package/dist/locales/en/agent-chat.js +2 -1
- package/dist/locales/nl/agent-chat.d.ts +1 -0
- package/dist/locales/nl/agent-chat.js +2 -1
- package/dist/state/chats.d.ts +2 -0
- package/dist/state/chats.js +21 -5
- package/dist/theme.css +6 -0
- package/package.json +9 -9
- package/src/agents/AgentIcon.tsx +6 -2
- package/src/chat/logic/timeline.ts +63 -0
- package/src/chat/subagent-list.ts +1 -4
- package/src/chat/ui/Composer.tsx +15 -2
- package/src/chat/ui/Markdown.tsx +97 -55
- package/src/chat/ui/PromptEditor.tsx +7 -2
- package/src/chat/ui/Timeline.tsx +17 -14
- package/src/chat/ui/composer/ComposerMenu.tsx +14 -6
- package/src/chat/ui/composer/chips.ts +51 -2
- package/src/chat/ui/composer/key-handler.ts +17 -2
- package/src/chat/ui/composer/placeholder.ts +14 -3
- package/src/chat/ui/composer/use-composer-menus.ts +8 -3
- package/src/chat/ui/composer/use-prompt-menus.ts +33 -4
- package/src/chat/ui/composer/use-prompt-suggestion.ts +36 -0
- package/src/chat/ui/index.ts +1 -1
- package/src/chat/ui/markdown-cache.ts +60 -0
- package/src/chat/ui/reference-lookup.ts +4 -2
- package/src/chat/ui/rows/SubagentRow.tsx +1 -1
- package/src/chat/ui/rows/TaskRow.tsx +54 -9
- package/src/chat/ui/thread-references.ts +4 -2
- package/src/chat-client.ts +79 -22
- package/src/chat-sink.ts +6 -1
- package/src/host/host-hooks.ts +19 -1
- package/src/host/host.ts +41 -0
- package/src/index.ts +3 -0
- package/src/locales/en/agent-chat.ts +2 -1
- package/src/locales/nl/agent-chat.ts +2 -1
- package/src/state/chats.ts +22 -6
- package/src/theme.css +6 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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'> & {
|
package/dist/chat/ui/Markdown.js
CHANGED
|
@@ -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(
|
|
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]
|
|
720
|
-
t1 = /*#__PURE__*/_jsx(
|
|
721
|
-
|
|
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
|
-
$[
|
|
740
|
-
$[
|
|
724
|
+
$[5] = value;
|
|
725
|
+
$[6] = t1;
|
|
741
726
|
} else {
|
|
742
|
-
|
|
727
|
+
t1 = $[6];
|
|
743
728
|
}
|
|
744
|
-
return
|
|
729
|
+
return t1;
|
|
745
730
|
}
|
|
746
731
|
let t1;
|
|
747
|
-
if ($[
|
|
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
|
-
$[
|
|
754
|
-
$[
|
|
738
|
+
$[7] = value;
|
|
739
|
+
$[8] = t1;
|
|
755
740
|
} else {
|
|
756
|
-
t1 = $[
|
|
741
|
+
t1 = $[8];
|
|
757
742
|
}
|
|
758
743
|
let t2;
|
|
759
|
-
if ($[
|
|
744
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
760
745
|
t2 = /[\\/]$/;
|
|
761
|
-
$[
|
|
746
|
+
$[9] = t2;
|
|
762
747
|
} else {
|
|
763
|
-
t2 = $[
|
|
748
|
+
t2 = $[9];
|
|
764
749
|
}
|
|
765
750
|
let t3;
|
|
766
|
-
if ($[
|
|
751
|
+
if ($[10] !== value) {
|
|
767
752
|
t3 = t2.test(value);
|
|
768
|
-
$[
|
|
769
|
-
$[
|
|
753
|
+
$[10] = value;
|
|
754
|
+
$[11] = t3;
|
|
770
755
|
} else {
|
|
771
|
-
t3 = $[
|
|
756
|
+
t3 = $[11];
|
|
772
757
|
}
|
|
773
758
|
let t4;
|
|
774
|
-
if ($[
|
|
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
|
-
$[
|
|
786
|
-
$[
|
|
787
|
-
$[
|
|
788
|
-
$[
|
|
770
|
+
$[12] = t1;
|
|
771
|
+
$[13] = t3;
|
|
772
|
+
$[14] = value;
|
|
773
|
+
$[15] = t4;
|
|
789
774
|
} else {
|
|
790
|
-
t4 = $[
|
|
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
|
-
|
|
875
|
-
|
|
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
|
-
|
|
880
|
-
|
|
881
|
-
$[
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
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
|
|
970
|
+
rehypePlugins,
|
|
903
971
|
components: replyComponents,
|
|
904
972
|
children: text
|
|
905
973
|
});
|
|
906
|
-
$[
|
|
907
|
-
$[
|
|
908
|
-
$[
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
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
|
-
|
|
983
|
+
T0 = $[5];
|
|
984
|
+
t1 = $[6];
|
|
985
|
+
t2 = $[7];
|
|
923
986
|
}
|
|
924
|
-
let
|
|
925
|
-
if ($[13] !==
|
|
926
|
-
|
|
927
|
-
value:
|
|
928
|
-
children:
|
|
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
|
-
$[
|
|
931
|
-
$[
|
|
932
|
-
$[
|
|
993
|
+
$[12] = T0;
|
|
994
|
+
$[13] = t1;
|
|
995
|
+
$[14] = t2;
|
|
996
|
+
$[15] = t3;
|
|
933
997
|
} else {
|
|
934
|
-
|
|
998
|
+
t3 = $[15];
|
|
935
999
|
}
|
|
936
|
-
return
|
|
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 ===
|
|
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
|
|
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(
|
|
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
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
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
|
-
|
|
1066
|
-
t3 = $[6];
|
|
1067
|
-
t4 = $[7];
|
|
1118
|
+
t7 = $[2];
|
|
1068
1119
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
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
|
-
|
|
1139
|
+
"data-faded-in": t4,
|
|
1140
|
+
children: t9
|
|
1075
1141
|
});
|
|
1076
|
-
$[
|
|
1077
|
-
$[
|
|
1078
|
-
$[
|
|
1079
|
-
$[
|
|
1142
|
+
$[7] = t3;
|
|
1143
|
+
$[8] = t4;
|
|
1144
|
+
$[9] = t9;
|
|
1145
|
+
$[10] = t10;
|
|
1080
1146
|
} else {
|
|
1081
|
-
|
|
1147
|
+
t10 = $[10];
|
|
1082
1148
|
}
|
|
1083
|
-
return
|
|
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(
|
|
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
|
-
|
|
1099
|
-
|
|
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] =
|
|
1182
|
+
$[3] = text;
|
|
1183
|
+
$[4] = t1;
|
|
1184
|
+
$[5] = t2;
|
|
1108
1185
|
} else {
|
|
1109
|
-
t1 = $[
|
|
1186
|
+
t1 = $[4];
|
|
1187
|
+
t2 = $[5];
|
|
1110
1188
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
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
|
-
$[
|
|
1124
|
-
$[
|
|
1125
|
-
$[
|
|
1195
|
+
$[6] = t1;
|
|
1196
|
+
$[7] = t2;
|
|
1197
|
+
$[8] = t3;
|
|
1126
1198
|
} else {
|
|
1127
|
-
|
|
1199
|
+
t3 = $[8];
|
|
1128
1200
|
}
|
|
1129
|
-
return
|
|
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(
|
|
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
|
-
|
|
1151
|
-
|
|
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
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
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
|
-
$[
|
|
1173
|
-
$[
|
|
1174
|
-
$[
|
|
1238
|
+
$[0] = breaks;
|
|
1239
|
+
$[1] = componentOverrides;
|
|
1240
|
+
$[2] = fileLinks;
|
|
1241
|
+
$[3] = muted;
|
|
1242
|
+
$[4] = rehypePlugins;
|
|
1243
|
+
$[5] = t4;
|
|
1175
1244
|
$[6] = text;
|
|
1176
|
-
$[7] =
|
|
1245
|
+
$[7] = t5;
|
|
1246
|
+
$[8] = t6;
|
|
1247
|
+
$[9] = t7;
|
|
1177
1248
|
} else {
|
|
1178
|
-
|
|
1249
|
+
t5 = $[7];
|
|
1250
|
+
t6 = $[8];
|
|
1251
|
+
t7 = $[9];
|
|
1179
1252
|
}
|
|
1180
|
-
let
|
|
1181
|
-
if ($[
|
|
1182
|
-
|
|
1183
|
-
className:
|
|
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:
|
|
1258
|
+
children: t7
|
|
1186
1259
|
});
|
|
1187
|
-
$[
|
|
1188
|
-
$[
|
|
1189
|
-
$[
|
|
1260
|
+
$[10] = t5;
|
|
1261
|
+
$[11] = t6;
|
|
1262
|
+
$[12] = t7;
|
|
1263
|
+
$[13] = t8;
|
|
1190
1264
|
} else {
|
|
1191
|
-
|
|
1265
|
+
t8 = $[13];
|
|
1192
1266
|
}
|
|
1193
|
-
return
|
|
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 {};
|