@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.
- 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,6 +1,13 @@
|
|
|
1
1
|
import type { AgentKind } from '@adecore/agent-contracts';
|
|
2
|
+
import { type AgentMark } from '../host/host.js';
|
|
2
3
|
export declare function AgentIcon({ kind, size, className }: {
|
|
3
4
|
kind: AgentKind;
|
|
4
5
|
size?: number;
|
|
5
6
|
className?: string;
|
|
6
7
|
}): import("react").JSX.Element;
|
|
8
|
+
export declare function MarkGlyph({ mark, size, className, decorative }: {
|
|
9
|
+
mark: AgentMark;
|
|
10
|
+
size?: number;
|
|
11
|
+
className?: string;
|
|
12
|
+
decorative?: boolean;
|
|
13
|
+
}): import("react").JSX.Element;
|
package/dist/agents/AgentIcon.js
CHANGED
|
@@ -26,7 +26,7 @@ const BUILT_IN_MARKS = {
|
|
|
26
26
|
copilot: siGithubcopilot
|
|
27
27
|
};
|
|
28
28
|
export function AgentIcon(t0) {
|
|
29
|
-
const $ = _c(
|
|
29
|
+
const $ = _c(7);
|
|
30
30
|
const {
|
|
31
31
|
kind,
|
|
32
32
|
size: t1,
|
|
@@ -50,49 +50,88 @@ export function AgentIcon(t0) {
|
|
|
50
50
|
}
|
|
51
51
|
return t2;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
let t2;
|
|
54
|
+
if ($[3] !== className || $[4] !== mark || $[5] !== size) {
|
|
55
|
+
t2 = /*#__PURE__*/_jsx(MarkGlyph, {
|
|
56
|
+
mark: mark,
|
|
57
|
+
size: size,
|
|
58
|
+
className: className
|
|
59
|
+
});
|
|
60
|
+
$[3] = className;
|
|
61
|
+
$[4] = mark;
|
|
62
|
+
$[5] = size;
|
|
63
|
+
$[6] = t2;
|
|
64
|
+
} else {
|
|
65
|
+
t2 = $[6];
|
|
66
|
+
}
|
|
67
|
+
return t2;
|
|
68
|
+
}
|
|
69
|
+
/* A mark in the current text color; `decorative` hides it from a screen reader where a label beside it says the same. */
|
|
70
|
+
export function MarkGlyph(t0) {
|
|
71
|
+
const $ = _c(14);
|
|
72
|
+
const {
|
|
73
|
+
mark,
|
|
74
|
+
size: t1,
|
|
75
|
+
className,
|
|
76
|
+
decorative: t2
|
|
77
|
+
} = t0;
|
|
78
|
+
const size = t1 === undefined ? 14 : t1;
|
|
79
|
+
const decorative = t2 === undefined ? false : t2;
|
|
80
|
+
let t3;
|
|
81
|
+
if ($[0] !== decorative || $[1] !== mark.title) {
|
|
82
|
+
t3 = decorative ? {
|
|
83
|
+
"aria-hidden": true
|
|
84
|
+
} : {
|
|
85
|
+
role: "img",
|
|
86
|
+
"aria-label": mark.title
|
|
87
|
+
};
|
|
88
|
+
$[0] = decorative;
|
|
89
|
+
$[1] = mark.title;
|
|
90
|
+
$[2] = t3;
|
|
91
|
+
} else {
|
|
92
|
+
t3 = $[2];
|
|
93
|
+
}
|
|
94
|
+
const t4 = mark.viewBox ?? "0 0 24 24";
|
|
95
|
+
let t5;
|
|
56
96
|
if ($[3] !== className) {
|
|
57
|
-
|
|
97
|
+
t5 = clsx("align-middle", className);
|
|
58
98
|
$[3] = className;
|
|
59
|
-
$[4] =
|
|
99
|
+
$[4] = t5;
|
|
60
100
|
} else {
|
|
61
|
-
|
|
101
|
+
t5 = $[4];
|
|
62
102
|
}
|
|
63
|
-
const
|
|
64
|
-
let
|
|
65
|
-
if ($[5] !== mark.path || $[6] !==
|
|
66
|
-
|
|
103
|
+
const t6 = mark.fillRule ?? "nonzero";
|
|
104
|
+
let t7;
|
|
105
|
+
if ($[5] !== mark.path || $[6] !== t6) {
|
|
106
|
+
t7 = /*#__PURE__*/_jsx("path", {
|
|
67
107
|
d: mark.path,
|
|
68
|
-
fillRule:
|
|
108
|
+
fillRule: t6
|
|
69
109
|
});
|
|
70
110
|
$[5] = mark.path;
|
|
71
|
-
$[6] =
|
|
72
|
-
$[7] =
|
|
111
|
+
$[6] = t6;
|
|
112
|
+
$[7] = t7;
|
|
73
113
|
} else {
|
|
74
|
-
|
|
114
|
+
t7 = $[7];
|
|
75
115
|
}
|
|
76
|
-
let
|
|
77
|
-
if ($[8] !==
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
viewBox: t3,
|
|
116
|
+
let t8;
|
|
117
|
+
if ($[8] !== size || $[9] !== t3 || $[10] !== t4 || $[11] !== t5 || $[12] !== t7) {
|
|
118
|
+
t8 = /*#__PURE__*/_jsx("svg", {
|
|
119
|
+
...t3,
|
|
120
|
+
viewBox: t4,
|
|
82
121
|
width: size,
|
|
83
122
|
height: size,
|
|
84
123
|
fill: "currentColor",
|
|
85
|
-
className:
|
|
86
|
-
children:
|
|
124
|
+
className: t5,
|
|
125
|
+
children: t7
|
|
87
126
|
});
|
|
88
|
-
$[8] =
|
|
89
|
-
$[9] =
|
|
90
|
-
$[10] =
|
|
91
|
-
$[11] =
|
|
92
|
-
$[12] =
|
|
93
|
-
$[13] =
|
|
127
|
+
$[8] = size;
|
|
128
|
+
$[9] = t3;
|
|
129
|
+
$[10] = t4;
|
|
130
|
+
$[11] = t5;
|
|
131
|
+
$[12] = t7;
|
|
132
|
+
$[13] = t8;
|
|
94
133
|
} else {
|
|
95
|
-
|
|
134
|
+
t8 = $[13];
|
|
96
135
|
}
|
|
97
|
-
return
|
|
136
|
+
return t8;
|
|
98
137
|
}
|
|
@@ -22,4 +22,6 @@ export declare function findSubagentBranch(rows: readonly TimelineRow[], toolUse
|
|
|
22
22
|
branch: SubagentBranch;
|
|
23
23
|
} | null;
|
|
24
24
|
export declare function deriveTimelineRows(items: ChatThreadItem[], options: TimelineOptions): TimelineRow[];
|
|
25
|
+
export declare function keepUnchangedRows(previous: TimelineRow[], next: TimelineRow[]): TimelineRow[];
|
|
26
|
+
export declare function createRowKeeper(): (rows: TimelineRow[]) => TimelineRow[];
|
|
25
27
|
export {};
|
|
@@ -674,4 +674,51 @@ export function deriveTimelineRows(items, options) {
|
|
|
674
674
|
}
|
|
675
675
|
}
|
|
676
676
|
return rows;
|
|
677
|
+
}
|
|
678
|
+
function isPlainObject(value) {
|
|
679
|
+
if (typeof value !== 'object' || value === null) {
|
|
680
|
+
return false;
|
|
681
|
+
}
|
|
682
|
+
const prototype = Object.getPrototypeOf(value);
|
|
683
|
+
return prototype === Object.prototype || prototype === null;
|
|
684
|
+
}
|
|
685
|
+
/* Equal all the way down; an item the store left alone is the same object, so a row is compared without opening it. */
|
|
686
|
+
function sameValue(left, right) {
|
|
687
|
+
if (Object.is(left, right)) {
|
|
688
|
+
return true;
|
|
689
|
+
}
|
|
690
|
+
if (Array.isArray(left)) {
|
|
691
|
+
return Array.isArray(right) && left.length === right.length && left.every((value, index) => sameValue(value, right[index]));
|
|
692
|
+
}
|
|
693
|
+
if (!isPlainObject(left) || !isPlainObject(right)) {
|
|
694
|
+
return false;
|
|
695
|
+
}
|
|
696
|
+
const keys = Object.keys(left);
|
|
697
|
+
return keys.length === Object.keys(right).length && keys.every(key => Object.hasOwn(right, key) && sameValue(left[key], right[key]));
|
|
698
|
+
}
|
|
699
|
+
/*
|
|
700
|
+
* `next`, with every row that holds what the row of the same id in `previous` held swapped for that
|
|
701
|
+
* row, and `previous` itself when nothing changed. Deriving the rows makes every row anew, so without
|
|
702
|
+
* this one tool that starts would draw every row of the thread again.
|
|
703
|
+
*/
|
|
704
|
+
export function keepUnchangedRows(previous, next) {
|
|
705
|
+
const byId = new Map(previous.map(row => [row.id, row]));
|
|
706
|
+
let changed = previous.length !== next.length;
|
|
707
|
+
const kept = next.map((row, index) => {
|
|
708
|
+
const before = byId.get(row.id);
|
|
709
|
+
const keep = before !== undefined && sameValue(before, row) ? before : row;
|
|
710
|
+
if (keep !== previous[index]) {
|
|
711
|
+
changed = true;
|
|
712
|
+
}
|
|
713
|
+
return keep;
|
|
714
|
+
});
|
|
715
|
+
return changed ? kept : previous;
|
|
716
|
+
}
|
|
717
|
+
/* A `keepUnchangedRows` that remembers the rows it handed out last, for a thread that derives its rows again. */
|
|
718
|
+
export function createRowKeeper() {
|
|
719
|
+
let kept = [];
|
|
720
|
+
return rows => {
|
|
721
|
+
kept = keepUnchangedRows(kept, rows);
|
|
722
|
+
return kept;
|
|
723
|
+
};
|
|
677
724
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { type ChatSubagentItem } from '@adecore/agent-contracts';
|
|
2
2
|
import type { StatusWord } from '../agents/status-look.js';
|
|
3
3
|
import type { ChatThreadInfo, ChatThreadItem } from '../chat-sink.js';
|
|
4
|
-
import type { SubagentTask } from '../host/host.js';
|
|
4
|
+
import type { SubagentTask, TaskRowState } from '../host/host.js';
|
|
5
5
|
export declare function subagentTitle(item: ChatSubagentItem): string;
|
|
6
6
|
export declare function statusWordOf(item: ChatSubagentItem, task: SubagentTask | null): StatusWord;
|
|
7
|
-
export type TaskRowState = StatusWord | 'waiting';
|
|
8
7
|
export declare function taskRowStateOf(item: ChatSubagentItem, task: SubagentTask | null, child: ChatThreadInfo | undefined): TaskRowState;
|
|
9
8
|
export declare function progressOf(states: readonly TaskRowState[]): {
|
|
10
9
|
done: number;
|