@adecore/agents-react 0.70.1 → 0.71.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 (82) hide show
  1. package/dist/chat/ui/CodeBlock.d.ts +6 -1
  2. package/dist/chat/ui/CodeBlock.js +39 -23
  3. package/dist/chat/ui/intelligent-ui/UiReply.js +11 -2
  4. package/dist/chat/ui/intelligent-ui/key-caps.d.ts +1 -0
  5. package/dist/chat/ui/intelligent-ui/key-caps.js +45 -0
  6. package/dist/chat/ui/intelligent-ui/link-action.d.ts +9 -0
  7. package/dist/chat/ui/intelligent-ui/link-action.js +32 -0
  8. package/dist/chat/ui/intelligent-ui/node-text.js +1 -1
  9. package/dist/chat/ui/intelligent-ui/patch-clip.d.ts +4 -0
  10. package/dist/chat/ui/intelligent-ui/patch-clip.js +64 -0
  11. package/dist/chat/ui/intelligent-ui/registry.js +31 -5
  12. package/dist/chat/ui/intelligent-ui/render-context.d.ts +13 -0
  13. package/dist/chat/ui/intelligent-ui/renderers/alternatives.d.ts +6 -0
  14. package/dist/chat/ui/intelligent-ui/renderers/alternatives.js +296 -0
  15. package/dist/chat/ui/intelligent-ui/renderers/changes.d.ts +4 -0
  16. package/dist/chat/ui/intelligent-ui/renderers/changes.js +266 -0
  17. package/dist/chat/ui/intelligent-ui/renderers/chart.js +522 -371
  18. package/dist/chat/ui/intelligent-ui/renderers/content.d.ts +1 -1
  19. package/dist/chat/ui/intelligent-ui/renderers/content.js +94 -43
  20. package/dist/chat/ui/intelligent-ui/renderers/data.js +478 -245
  21. package/dist/chat/ui/intelligent-ui/renderers/diff.d.ts +4 -0
  22. package/dist/chat/ui/intelligent-ui/renderers/diff.js +427 -0
  23. package/dist/chat/ui/intelligent-ui/renderers/inputs.d.ts +1 -0
  24. package/dist/chat/ui/intelligent-ui/renderers/inputs.js +354 -110
  25. package/dist/chat/ui/intelligent-ui/renderers/keys.d.ts +3 -0
  26. package/dist/chat/ui/intelligent-ui/renderers/keys.js +60 -0
  27. package/dist/chat/ui/intelligent-ui/renderers/links.d.ts +13 -2
  28. package/dist/chat/ui/intelligent-ui/renderers/links.js +65 -85
  29. package/dist/chat/ui/intelligent-ui/renderers/meter.d.ts +4 -0
  30. package/dist/chat/ui/intelligent-ui/renderers/meter.js +371 -0
  31. package/dist/chat/ui/intelligent-ui/renderers/quote.d.ts +3 -0
  32. package/dist/chat/ui/intelligent-ui/renderers/quote.js +123 -0
  33. package/dist/chat/ui/intelligent-ui/renderers/radio.d.ts +3 -0
  34. package/dist/chat/ui/intelligent-ui/renderers/radio.js +205 -0
  35. package/dist/chat/ui/intelligent-ui/renderers/structure.d.ts +2 -0
  36. package/dist/chat/ui/intelligent-ui/renderers/structure.js +156 -45
  37. package/dist/chat/ui/intelligent-ui/renderers/text.js +365 -215
  38. package/dist/chat/ui/intelligent-ui/renderers/tree.d.ts +5 -0
  39. package/dist/chat/ui/intelligent-ui/renderers/tree.js +284 -0
  40. package/dist/chat/ui/intelligent-ui/table-data.d.ts +9 -2
  41. package/dist/chat/ui/intelligent-ui/table-data.js +68 -3
  42. package/dist/chat/ui/intelligent-ui/tones.d.ts +1 -1
  43. package/dist/chat/ui/intelligent-ui/tones.js +7 -7
  44. package/dist/chat/ui/intelligent-ui/use-ui-diffs.d.ts +4 -0
  45. package/dist/chat/ui/intelligent-ui/use-ui-diffs.js +201 -0
  46. package/dist/host/host.d.ts +2 -1
  47. package/dist/locales/en/agent-chat.d.ts +56 -0
  48. package/dist/locales/en/agent-chat.js +57 -1
  49. package/dist/locales/nl/agent-chat.d.ts +56 -0
  50. package/dist/locales/nl/agent-chat.js +57 -1
  51. package/dist/theme.css +6 -0
  52. package/package.json +9 -9
  53. package/src/chat/ui/CodeBlock.tsx +38 -18
  54. package/src/chat/ui/intelligent-ui/UiReply.tsx +13 -2
  55. package/src/chat/ui/intelligent-ui/key-caps.ts +51 -0
  56. package/src/chat/ui/intelligent-ui/link-action.ts +32 -0
  57. package/src/chat/ui/intelligent-ui/node-text.ts +1 -0
  58. package/src/chat/ui/intelligent-ui/patch-clip.ts +83 -0
  59. package/src/chat/ui/intelligent-ui/registry.ts +31 -4
  60. package/src/chat/ui/intelligent-ui/render-context.ts +21 -0
  61. package/src/chat/ui/intelligent-ui/renderers/alternatives.tsx +76 -0
  62. package/src/chat/ui/intelligent-ui/renderers/changes.tsx +97 -0
  63. package/src/chat/ui/intelligent-ui/renderers/chart.tsx +122 -46
  64. package/src/chat/ui/intelligent-ui/renderers/content.tsx +27 -7
  65. package/src/chat/ui/intelligent-ui/renderers/data.tsx +165 -52
  66. package/src/chat/ui/intelligent-ui/renderers/diff.tsx +144 -0
  67. package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +111 -19
  68. package/src/chat/ui/intelligent-ui/renderers/keys.tsx +26 -0
  69. package/src/chat/ui/intelligent-ui/renderers/links.tsx +40 -24
  70. package/src/chat/ui/intelligent-ui/renderers/meter.tsx +105 -0
  71. package/src/chat/ui/intelligent-ui/renderers/quote.tsx +29 -0
  72. package/src/chat/ui/intelligent-ui/renderers/radio.tsx +130 -0
  73. package/src/chat/ui/intelligent-ui/renderers/structure.tsx +54 -7
  74. package/src/chat/ui/intelligent-ui/renderers/text.tsx +70 -36
  75. package/src/chat/ui/intelligent-ui/renderers/tree.tsx +85 -0
  76. package/src/chat/ui/intelligent-ui/table-data.ts +84 -6
  77. package/src/chat/ui/intelligent-ui/tones.ts +7 -7
  78. package/src/chat/ui/intelligent-ui/use-ui-diffs.ts +119 -0
  79. package/src/host/host.ts +4 -0
  80. package/src/locales/en/agent-chat.ts +57 -1
  81. package/src/locales/nl/agent-chat.ts +57 -1
  82. package/src/theme.css +6 -0
@@ -1,6 +1,6 @@
1
1
  import type { UiProps } from '@adecore/intelligent-ui';
2
2
  import type { UiRendererProps } from '../render-context.js';
3
- export declare function CodeBlockRenderer({ node }: UiRendererProps<UiProps<'CodeBlock'>>): import("react").JSX.Element;
3
+ export declare function CodeBlockRenderer({ node, context }: UiRendererProps<UiProps<'CodeBlock'>>): import("react").JSX.Element;
4
4
  export declare function ImageRenderer({ node, children, context }: UiRendererProps<UiProps<'Image'>>): import("react").JSX.Element;
5
5
  export declare function GalleryRenderer({ node, children }: UiRendererProps<UiProps<'Gallery'>>): import("react").JSX.Element;
6
6
  export declare function CompareRenderer({ node, children, context }: UiRendererProps<UiProps<'Compare'>>): import("react").JSX.Element;
@@ -13,86 +13,137 @@ import { DisplayImage } from '../../DisplayImage.js';
13
13
  import { ImageGroup, ImageThumb } from '../../ImageView.js';
14
14
  import { uiChildrenOf, uiNodeLabel, uiNodeText, uiUrlDomain } from '../node-text.js';
15
15
  import { useTruncated } from '../use-truncated.js';
16
+ import { UiLinkChip } from './links.js';
16
17
  // The number of every source by its node id, which the list counts in its own order.
17
18
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
18
19
  const SourceNumbers = createContext(new Map());
19
- /* Plain text in the same measure until the node closes, so highlighting never makes it jump. */
20
+ /* What a file is written in, by its extension, for code that names its file and no language. */
21
+ function languageOfFile(path) {
22
+ return /\.([A-Za-z\d]+)$/.exec(path)?.[1]?.toLowerCase();
23
+ }
24
+ /*
25
+ * Plain text in the same measure until the node closes, so highlighting never makes it jump. With a file
26
+ * the header is its chip, which opens the file at `start` once the host checked it, in place of the language.
27
+ */
20
28
  export function CodeBlockRenderer(t0) {
21
- const $ = _c(14);
29
+ const $ = _c(28);
22
30
  const {
23
- node
31
+ node,
32
+ context
24
33
  } = t0;
25
34
  const {
26
- language
35
+ language,
36
+ file,
37
+ start,
38
+ highlight
27
39
  } = node.props;
40
+ const filed = file !== undefined && file !== "";
41
+ const labeled = language !== undefined && language !== "";
42
+ const lined = start !== undefined || highlight !== undefined && highlight.length > 0;
28
43
  let t1;
29
- if ($[0] !== language) {
30
- t1 = language !== undefined && language !== "" && /*#__PURE__*/_jsx("div", {
31
- className: "chat-ui-flat-inner flex px-1.5 pt-0.5 pb-1.5",
32
- children: /*#__PURE__*/_jsx("span", {
44
+ if ($[0] !== context || $[1] !== file || $[2] !== filed || $[3] !== labeled || $[4] !== language || $[5] !== start) {
45
+ t1 = (filed || labeled) && /*#__PURE__*/_jsx("div", {
46
+ className: "chat-ui-flat-inner flex min-w-0 px-1.5 pt-0.5 pb-1.5",
47
+ children: filed ? /*#__PURE__*/_jsx(UiLinkChip, {
48
+ target: {
49
+ type: "File",
50
+ path: file,
51
+ line: start
52
+ },
53
+ context: context
54
+ }) : /*#__PURE__*/_jsx("span", {
33
55
  className: "rounded-md bg-ui-inset px-1.5 font-mono text-2xs text-text shadow-[inset_0_0_0_1px_var(--border)]",
34
56
  children: language
35
57
  })
36
58
  });
37
- $[0] = language;
38
- $[1] = t1;
59
+ $[0] = context;
60
+ $[1] = file;
61
+ $[2] = filed;
62
+ $[3] = labeled;
63
+ $[4] = language;
64
+ $[5] = start;
65
+ $[6] = t1;
39
66
  } else {
40
- t1 = $[1];
67
+ t1 = $[6];
41
68
  }
42
69
  const t2 = !node.complete;
43
70
  let t3;
44
- if ($[2] !== node) {
71
+ if ($[7] !== node) {
45
72
  let t4;
46
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
73
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
47
74
  t4 = /^\n|\n$/g;
48
- $[4] = t4;
75
+ $[9] = t4;
49
76
  } else {
50
- t4 = $[4];
77
+ t4 = $[9];
51
78
  }
52
79
  t3 = uiNodeText(node).replace(t4, "");
53
- $[2] = node;
54
- $[3] = t3;
80
+ $[7] = node;
81
+ $[8] = t3;
55
82
  } else {
56
- t3 = $[3];
83
+ t3 = $[8];
84
+ }
85
+ let t4;
86
+ if ($[10] !== file || $[11] !== filed || $[12] !== language) {
87
+ t4 = language ?? (filed ? languageOfFile(file) : undefined) ?? "text";
88
+ $[10] = file;
89
+ $[11] = filed;
90
+ $[12] = language;
91
+ $[13] = t4;
92
+ } else {
93
+ t4 = $[13];
57
94
  }
58
- const t4 = language ?? "text";
59
95
  let t5;
60
- if ($[5] !== t3 || $[6] !== t4) {
61
- t5 = /*#__PURE__*/_jsx(CodeBlock, {
96
+ if ($[14] !== highlight || $[15] !== lined || $[16] !== start) {
97
+ t5 = lined ? {
98
+ start,
99
+ marked: highlight
100
+ } : undefined;
101
+ $[14] = highlight;
102
+ $[15] = lined;
103
+ $[16] = start;
104
+ $[17] = t5;
105
+ } else {
106
+ t5 = $[17];
107
+ }
108
+ let t6;
109
+ if ($[18] !== t3 || $[19] !== t4 || $[20] !== t5) {
110
+ t6 = /*#__PURE__*/_jsx(CodeBlock, {
62
111
  code: t3,
63
- lang: t4
112
+ lang: t4,
113
+ lines: t5
64
114
  });
65
- $[5] = t3;
66
- $[6] = t4;
67
- $[7] = t5;
115
+ $[18] = t3;
116
+ $[19] = t4;
117
+ $[20] = t5;
118
+ $[21] = t6;
68
119
  } else {
69
- t5 = $[7];
120
+ t6 = $[21];
70
121
  }
71
- let t6;
72
- if ($[8] !== t2 || $[9] !== t5) {
73
- t6 = /*#__PURE__*/_jsx(CodeStreamingContext.Provider, {
122
+ let t7;
123
+ if ($[22] !== t2 || $[23] !== t6) {
124
+ t7 = /*#__PURE__*/_jsx(CodeStreamingContext.Provider, {
74
125
  value: t2,
75
- children: t5
126
+ children: t6
76
127
  });
77
- $[8] = t2;
78
- $[9] = t5;
79
- $[10] = t6;
128
+ $[22] = t2;
129
+ $[23] = t6;
130
+ $[24] = t7;
80
131
  } else {
81
- t6 = $[10];
132
+ t7 = $[24];
82
133
  }
83
- let t7;
84
- if ($[11] !== t1 || $[12] !== t6) {
85
- t7 = /*#__PURE__*/_jsxs("div", {
134
+ let t8;
135
+ if ($[25] !== t1 || $[26] !== t7) {
136
+ t8 = /*#__PURE__*/_jsxs("div", {
86
137
  className: "chat-ui-code chat-ui-flat flex flex-col rounded-xl bg-ui-tile p-1.5",
87
- children: [t1, t6]
138
+ children: [t1, t7]
88
139
  });
89
- $[11] = t1;
90
- $[12] = t6;
91
- $[13] = t7;
140
+ $[25] = t1;
141
+ $[26] = t7;
142
+ $[27] = t8;
92
143
  } else {
93
- t7 = $[13];
144
+ t8 = $[27];
94
145
  }
95
- return t7;
146
+ return t8;
96
147
  }
97
148
  // Set by a Gallery, so the images inside it draw as cells of its grid.
98
149
  const GalleryContext = createContext(false);