@adecore/agents-react 0.32.0 → 0.33.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/README.md +1 -1
- package/dist/chat/logic/workflow.d.ts +10 -0
- package/dist/chat/logic/workflow.js +91 -4
- package/dist/chat/ui/MermaidBlock.js +172 -136
- package/dist/chat/ui/mermaid.d.ts +8 -20
- package/dist/chat/ui/mermaid.js +40 -65
- package/dist/chat/ui/rows/WorkRows.d.ts +3 -0
- package/dist/chat/ui/rows/WorkRows.js +1 -1
- package/dist/chat/ui/rows/WorkflowRow.js +628 -168
- package/dist/locales/en/agent-chat.d.ts +8 -0
- package/dist/locales/en/agent-chat.js +9 -1
- package/dist/locales/nl/agent-chat.d.ts +8 -0
- package/dist/locales/nl/agent-chat.js +9 -1
- package/package.json +9 -9
- package/src/chat/logic/workflow.ts +86 -4
- package/src/chat/ui/MermaidBlock.tsx +55 -46
- package/src/chat/ui/mermaid.ts +52 -96
- package/src/chat/ui/rows/WorkRows.tsx +1 -1
- package/src/chat/ui/rows/WorkflowRow.tsx +144 -54
- package/src/locales/en/agent-chat.ts +9 -1
- package/src/locales/nl/agent-chat.ts +9 -1
package/dist/chat/ui/mermaid.js
CHANGED
|
@@ -1,80 +1,55 @@
|
|
|
1
|
-
/* The
|
|
2
|
-
export const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
/* The variable of Pele each token of the theme fills. Borders carry an alpha, so every color is resolved over the ground. */
|
|
2
|
+
export const DIAGRAM_TOKENS = {
|
|
3
|
+
'--pele-bg': '--chat-code-bg',
|
|
4
|
+
'--pele-fg': '--text',
|
|
5
|
+
'--pele-muted': '--text-muted',
|
|
6
|
+
'--pele-line': '--text-muted',
|
|
7
|
+
'--pele-surface': '--surface-raised',
|
|
8
|
+
'--pele-surface-alt': '--surface',
|
|
9
|
+
'--pele-border': '--border-strong',
|
|
10
|
+
'--pele-accent': '--accent',
|
|
11
|
+
'--pele-critical': '--status-error',
|
|
12
|
+
'--pele-series-1': '--accent',
|
|
13
|
+
'--pele-series-2': '--chart-2',
|
|
14
|
+
'--pele-series-3': '--chart-3',
|
|
15
|
+
'--pele-series-4': '--chart-4',
|
|
16
|
+
'--pele-series-5': '--chart-5',
|
|
17
|
+
'--pele-series-6': '--chart-6'
|
|
11
18
|
};
|
|
12
|
-
|
|
13
|
-
const SECURE_KEYS = ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize', 'maxEdges', 'suppressErrorRendering', 'htmlLabels', 'theme', 'themeVariables', 'themeCSS', 'darkMode', 'fontFamily'];
|
|
19
|
+
export const GROUND_TOKEN = DIAGRAM_TOKENS['--pele-bg'];
|
|
14
20
|
/*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
21
|
+
* At the size it was laid out at, since an image has no container to shrink to. No links and no images, and no
|
|
22
|
+
* math or icon resolver, which are the only markup Pele inserts unfiltered. What comes out is drawn as an image as
|
|
23
|
+
* well, which never runs script and loads nothing, whatever the text of the diagram says.
|
|
17
24
|
*/
|
|
18
|
-
export function
|
|
25
|
+
export function renderOptions(font, idPrefix) {
|
|
19
26
|
return {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
htmlLabels: false,
|
|
23
|
-
suppressErrorRendering: true,
|
|
24
|
-
secure: SECURE_KEYS,
|
|
25
|
-
theme: 'base',
|
|
26
|
-
darkMode: dark,
|
|
27
|
+
responsive: false,
|
|
28
|
+
idPrefix,
|
|
27
29
|
fontFamily: font.family,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
background: colors.ground,
|
|
33
|
-
primaryColor: colors.node,
|
|
34
|
-
primaryTextColor: colors.text,
|
|
35
|
-
primaryBorderColor: colors.nodeBorder,
|
|
36
|
-
secondaryColor: colors.note,
|
|
37
|
-
tertiaryColor: colors.cluster,
|
|
38
|
-
mainBkg: colors.node,
|
|
39
|
-
nodeBorder: colors.nodeBorder,
|
|
40
|
-
textColor: colors.text,
|
|
41
|
-
titleColor: colors.text,
|
|
42
|
-
lineColor: colors.line,
|
|
43
|
-
clusterBkg: colors.cluster,
|
|
44
|
-
clusterBorder: colors.clusterBorder,
|
|
45
|
-
edgeLabelBackground: colors.ground,
|
|
46
|
-
noteBkgColor: colors.note,
|
|
47
|
-
noteTextColor: colors.text,
|
|
48
|
-
noteBorderColor: colors.nodeBorder
|
|
49
|
-
}
|
|
30
|
+
fontFamilyMono: font.mono,
|
|
31
|
+
fontSize: font.size,
|
|
32
|
+
links: false,
|
|
33
|
+
images: false
|
|
50
34
|
};
|
|
51
35
|
}
|
|
52
36
|
const ROOT = /<svg\b[^>]*>/;
|
|
53
|
-
const
|
|
54
|
-
|
|
37
|
+
const STYLE = /\sstyle="/;
|
|
38
|
+
function attributeText(value) {
|
|
39
|
+
return value.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<');
|
|
40
|
+
}
|
|
55
41
|
/*
|
|
56
|
-
* The
|
|
57
|
-
*
|
|
58
|
-
* without one.
|
|
42
|
+
* The drawing with the colors set on its root. An image does not see the variables of the page, so they are
|
|
43
|
+
* written in, and a change of the theme only writes them again.
|
|
59
44
|
*/
|
|
60
|
-
export function
|
|
45
|
+
export function themedSvg(svg, colors) {
|
|
61
46
|
const root = ROOT.exec(svg);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
const [,, boxWidth, boxHeight] = viewBox[1].trim().split(/[\s,]+/).map(Number);
|
|
67
|
-
if (!Number.isFinite(boxWidth) || !Number.isFinite(boxHeight) || boxWidth <= 0 || boxHeight <= 0) {
|
|
68
|
-
return null;
|
|
47
|
+
if (root === null) {
|
|
48
|
+
return svg;
|
|
69
49
|
}
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
svg: svg.slice(0, root.index) + tag + svg.slice(root.index + root[0].length),
|
|
75
|
-
width,
|
|
76
|
-
height
|
|
77
|
-
};
|
|
50
|
+
const variables = attributeText(Object.entries(colors).map(([name, value]) => `${name}:${value};`).join(''));
|
|
51
|
+
const tag = STYLE.test(root[0]) ? root[0].replace(STYLE, style => style + variables) : root[0].replace(/^<svg\b/, `<svg style="${variables}"`);
|
|
52
|
+
return svg.slice(0, root.index) + tag + svg.slice(root.index + root[0].length);
|
|
78
53
|
}
|
|
79
54
|
export function svgDataUrl(svg) {
|
|
80
55
|
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
|
@@ -22,6 +22,9 @@ export declare function ToggleLine({ icon, label, brand, detail, command, look,
|
|
|
22
22
|
time?: number;
|
|
23
23
|
className?: string;
|
|
24
24
|
}): import("react").JSX.Element;
|
|
25
|
+
export declare function ToolBody({ tool }: {
|
|
26
|
+
tool: ChatToolItem;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
25
28
|
export declare function WorkRow({ tool, chatId, nested, detail, icon, label, failed }: {
|
|
26
29
|
tool: ChatToolItem;
|
|
27
30
|
chatId?: string;
|
|
@@ -678,7 +678,7 @@ function ToolOutput(t0) {
|
|
|
678
678
|
return t3;
|
|
679
679
|
}
|
|
680
680
|
/* An opened call without a card: what it was asked in the foreground, what it answered muted below. */
|
|
681
|
-
function ToolBody(t0) {
|
|
681
|
+
export function ToolBody(t0) {
|
|
682
682
|
const $ = _c(16);
|
|
683
683
|
const {
|
|
684
684
|
tool
|