@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
package/dist/chat/ui/index.js
CHANGED
|
@@ -37,7 +37,7 @@ export { uiTableColumns } from './intelligent-ui/table-data.js';
|
|
|
37
37
|
export { ForksRow } from './rows/ForksRow.js';
|
|
38
38
|
export { GeneratedImageRow } from './rows/GeneratedImageRow.js';
|
|
39
39
|
export { ReportRow, NoteRow, AgentTurnRow, CompactionRow } from './rows/MessageRows.js';
|
|
40
|
-
export { TaskRow } from './rows/TaskRow.js';
|
|
40
|
+
export { TaskRow, TaskRowHead } from './rows/TaskRow.js';
|
|
41
41
|
export { WorkRow, WorkGroupRow, WorkingRow } from './rows/WorkRows.js';
|
|
42
42
|
export { WorkflowRow } from './rows/WorkflowRow.js';
|
|
43
43
|
export { WorkflowAgentLine } from './WorkflowAgentLine.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import ReactMarkdown from 'react-markdown';
|
|
2
|
+
// What the cache may hold, counted in the characters of its keys, which hold the text. A parsed tree
|
|
3
|
+
// takes some tens of bytes per character, so this keeps it to a few tens of megabytes.
|
|
4
|
+
const MAX_CHARACTERS = 500_000;
|
|
5
|
+
const MAX_ENTRIES = 1000;
|
|
6
|
+
const parsed = new Map();
|
|
7
|
+
let characters = 0;
|
|
8
|
+
function remember(key, element) {
|
|
9
|
+
parsed.set(key, element);
|
|
10
|
+
characters += key.length;
|
|
11
|
+
for (const [oldest] of parsed) {
|
|
12
|
+
if (characters <= MAX_CHARACTERS && parsed.size <= MAX_ENTRIES) {
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
parsed.delete(oldest);
|
|
16
|
+
characters -= oldest.length;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/*
|
|
20
|
+
* Markdown drawn as react-markdown draws it, parsed once for a text a thread showed before, so a
|
|
21
|
+
* thread that mounts again (another chat in the same place, and back) parses none of it. `variant`
|
|
22
|
+
* names everything of `options` besides the text (plugins, their options, components); null leaves
|
|
23
|
+
* the cache out, for text that is still growing. react-markdown's own `Markdown` uses no hooks, so it
|
|
24
|
+
* is called as the function it is, and a parsed tree is the same elements wherever it is drawn: its
|
|
25
|
+
* components read their context when they render.
|
|
26
|
+
*/
|
|
27
|
+
export function parseMarkdown(variant, options) {
|
|
28
|
+
if (variant === null) {
|
|
29
|
+
return ReactMarkdown(options);
|
|
30
|
+
}
|
|
31
|
+
const key = `${variant}\u0000${options.children ?? ''}`;
|
|
32
|
+
const known = parsed.get(key);
|
|
33
|
+
if (known !== undefined) {
|
|
34
|
+
// Taken out and put back, so the Map's order stays the order of last use.
|
|
35
|
+
parsed.delete(key);
|
|
36
|
+
parsed.set(key, known);
|
|
37
|
+
return known;
|
|
38
|
+
}
|
|
39
|
+
const element = ReactMarkdown(options);
|
|
40
|
+
remember(key, element);
|
|
41
|
+
return element;
|
|
42
|
+
}
|
|
43
|
+
/* Empties the cache, for a test that counts parses from a clean start. */
|
|
44
|
+
export function forgetParsedMarkdown() {
|
|
45
|
+
parsed.clear();
|
|
46
|
+
characters = 0;
|
|
47
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { OutsideReference } from '../../host/host.js';
|
|
1
|
+
import type { HostSkill, OutsideReference } from '../../host/host.js';
|
|
2
2
|
import type { Referable } from '../../host/references.js';
|
|
3
3
|
export interface ReferenceLookup {
|
|
4
4
|
items: readonly Referable[];
|
|
5
5
|
open: ((id: string) => void) | null;
|
|
6
6
|
outside?(id: string): OutsideReference | null;
|
|
7
7
|
referenced?: readonly string[];
|
|
8
|
+
skills?: readonly HostSkill[];
|
|
8
9
|
}
|
|
9
10
|
export declare const ReferenceLookupContext: import("react").Context<ReferenceLookup>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
|
-
/* What the views and
|
|
2
|
+
/* What the views, nodes and host skills of a message stand for now, handed down by the row that draws it. */
|
|
3
3
|
export const ReferenceLookupContext = createContext({
|
|
4
4
|
items: [],
|
|
5
5
|
open: null
|
|
@@ -436,7 +436,7 @@ function _temp2(o) {
|
|
|
436
436
|
return !o;
|
|
437
437
|
}
|
|
438
438
|
export function SubagentRow(t0) {
|
|
439
|
-
const $ = _c(
|
|
439
|
+
const $ = _c(25);
|
|
440
440
|
const {
|
|
441
441
|
chatId,
|
|
442
442
|
item,
|
|
@@ -483,8 +483,9 @@ export function SubagentRow(t0) {
|
|
|
483
483
|
const refused = useSubagentSupport(t3);
|
|
484
484
|
const press = onOpenConversation !== undefined && canOpenSubagent(item, refused) ? onOpenConversation : onToggle;
|
|
485
485
|
let t4;
|
|
486
|
-
if ($[7] !==
|
|
486
|
+
if ($[7] !== chatId || $[8] !== detail || $[9] !== expanded || $[10] !== item || $[11] !== press || $[12] !== running || $[13] !== t || $[14] !== task) {
|
|
487
487
|
t4 = item.origin === HOST_TASK_ORIGIN ? /*#__PURE__*/_jsx(TaskRow, {
|
|
488
|
+
chatId: chatId,
|
|
488
489
|
item: item,
|
|
489
490
|
task: task,
|
|
490
491
|
open: expanded,
|
|
@@ -513,19 +514,20 @@ export function SubagentRow(t0) {
|
|
|
513
514
|
})]
|
|
514
515
|
})
|
|
515
516
|
});
|
|
516
|
-
$[7] =
|
|
517
|
-
$[8] =
|
|
518
|
-
$[9] =
|
|
519
|
-
$[10] =
|
|
520
|
-
$[11] =
|
|
521
|
-
$[12] =
|
|
522
|
-
$[13] =
|
|
523
|
-
$[14] =
|
|
517
|
+
$[7] = chatId;
|
|
518
|
+
$[8] = detail;
|
|
519
|
+
$[9] = expanded;
|
|
520
|
+
$[10] = item;
|
|
521
|
+
$[11] = press;
|
|
522
|
+
$[12] = running;
|
|
523
|
+
$[13] = t;
|
|
524
|
+
$[14] = task;
|
|
525
|
+
$[15] = t4;
|
|
524
526
|
} else {
|
|
525
|
-
t4 = $[
|
|
527
|
+
t4 = $[15];
|
|
526
528
|
}
|
|
527
529
|
let t5;
|
|
528
|
-
if ($[
|
|
530
|
+
if ($[16] !== chatId || $[17] !== expanded || $[18] !== item || $[19] !== work) {
|
|
529
531
|
t5 = expanded && /*#__PURE__*/_jsxs("div", {
|
|
530
532
|
className: "mb-1",
|
|
531
533
|
children: [/*#__PURE__*/_jsx(SubagentWork, {
|
|
@@ -537,26 +539,26 @@ export function SubagentRow(t0) {
|
|
|
537
539
|
result: item.result
|
|
538
540
|
})]
|
|
539
541
|
});
|
|
540
|
-
$[
|
|
541
|
-
$[
|
|
542
|
-
$[
|
|
543
|
-
$[
|
|
544
|
-
$[
|
|
542
|
+
$[16] = chatId;
|
|
543
|
+
$[17] = expanded;
|
|
544
|
+
$[18] = item;
|
|
545
|
+
$[19] = work;
|
|
546
|
+
$[20] = t5;
|
|
545
547
|
} else {
|
|
546
|
-
t5 = $[
|
|
548
|
+
t5 = $[20];
|
|
547
549
|
}
|
|
548
550
|
let t6;
|
|
549
|
-
if ($[
|
|
551
|
+
if ($[21] !== item.id || $[22] !== t4 || $[23] !== t5) {
|
|
550
552
|
t6 = /*#__PURE__*/_jsxs("div", {
|
|
551
553
|
"data-find-item": item.id,
|
|
552
554
|
children: [t4, t5]
|
|
553
555
|
});
|
|
554
|
-
$[
|
|
555
|
-
$[
|
|
556
|
-
$[
|
|
557
|
-
$[
|
|
556
|
+
$[21] = item.id;
|
|
557
|
+
$[22] = t4;
|
|
558
|
+
$[23] = t5;
|
|
559
|
+
$[24] = t6;
|
|
558
560
|
} else {
|
|
559
|
-
t6 = $[
|
|
561
|
+
t6 = $[24];
|
|
560
562
|
}
|
|
561
563
|
return t6;
|
|
562
564
|
}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import type { ChatSubagentItem } from '@adecore/agent-contracts';
|
|
2
2
|
import type { SubagentTask } from '../../../host/host.js';
|
|
3
|
-
|
|
3
|
+
interface TaskRowProps {
|
|
4
|
+
chatId: string;
|
|
4
5
|
item: ChatSubagentItem;
|
|
5
6
|
task: SubagentTask | null;
|
|
6
7
|
open: boolean;
|
|
7
8
|
onPress(): void;
|
|
9
|
+
}
|
|
10
|
+
export declare function TaskRow({ chatId, item, task, open, onPress }: TaskRowProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | Iterable<import("react").ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined>;
|
|
11
|
+
export declare function TaskRowHead({ item, task, open, onPress, line }: {
|
|
12
|
+
item: ChatSubagentItem;
|
|
13
|
+
task: SubagentTask | null;
|
|
14
|
+
open: boolean;
|
|
15
|
+
onPress(): void;
|
|
16
|
+
line?: string;
|
|
8
17
|
}): import("react").JSX.Element;
|
|
18
|
+
export {};
|