@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,7 +1,12 @@
1
1
  import { type ReactNode } from 'react';
2
- export declare function CodeBlock({ code, lang, actions, view }: {
2
+ export interface CodeBlockLines {
3
+ start?: number;
4
+ marked?: readonly number[];
5
+ }
6
+ export declare function CodeBlock({ code, lang, actions, view, lines }: {
3
7
  code: string;
4
8
  lang: string;
5
9
  actions?: ReactNode;
6
10
  view?: ReactNode;
11
+ lines?: CodeBlockLines;
7
12
  }): import("react").JSX.Element;
@@ -12,44 +12,52 @@ import { tokenStyle, useCodeHighlighter } from './highlighter.js';
12
12
  import { WHOLE_FADE_CLASS } from './rehype-fade.js';
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  const COPIED_MS = 1500;
15
- /* A line whose tokens did not change keeps its elements, so a selection in it survives the next delta. */
15
+ /* A line whose tokens did not change keeps its elements, so a selection in it survives the next delta. A line not highlighted yet is its text. */
16
16
  const CodeLine = memo(function CodeLine(t0) {
17
- const $ = _c(4);
17
+ const $ = _c(6);
18
18
  const {
19
- tokens
19
+ tokens,
20
+ number,
21
+ marked
20
22
  } = t0;
21
- let t1;
23
+ const t1 = marked ? "" : undefined;
24
+ let t2;
22
25
  if ($[0] !== tokens) {
23
- t1 = tokens.map(_temp);
26
+ t2 = typeof tokens === "string" ? tokens : tokens.map(_temp);
24
27
  $[0] = tokens;
25
- $[1] = t1;
28
+ $[1] = t2;
26
29
  } else {
27
- t1 = $[1];
30
+ t2 = $[1];
28
31
  }
29
- let t2;
30
- if ($[2] !== t1) {
31
- t2 = /*#__PURE__*/_jsx("span", {
32
+ let t3;
33
+ if ($[2] !== number || $[3] !== t1 || $[4] !== t2) {
34
+ t3 = /*#__PURE__*/_jsx("span", {
32
35
  className: "line",
33
- children: t1
36
+ "data-line": number,
37
+ "data-marked": t1,
38
+ children: t2
34
39
  });
35
- $[2] = t1;
36
- $[3] = t2;
40
+ $[2] = number;
41
+ $[3] = t1;
42
+ $[4] = t2;
43
+ $[5] = t3;
37
44
  } else {
38
- t2 = $[3];
45
+ t3 = $[5];
39
46
  }
40
- return t2;
47
+ return t3;
41
48
  });
42
49
  /*
43
50
  * A fenced block, highlighted a line at a time. Until shiki and the grammar are there it holds its
44
51
  * place invisibly, so bare code never turns colored. An open fence is tokenized as it grows, and
45
52
  * closing it does not draw it again. `view` takes the place of the code, such as what the code draws,
46
- * and Copy still copies the code.
53
+ * and Copy still copies the code. `lines` numbers and marks lines; a number is never part of a selection.
47
54
  */
48
55
  export function CodeBlock({
49
56
  code,
50
57
  lang,
51
58
  actions,
52
- view
59
+ view,
60
+ lines
53
61
  }) {
54
62
  const {
55
63
  t
@@ -67,8 +75,8 @@ export function CodeBlock({
67
75
  const tokenizer = highlighter.tokenizer(lang, theme);
68
76
  // Only a block that had to wait fades in; one drawn highlighted from its first frame just stands there.
69
77
  const [waited] = useState(tokenizer === null);
70
- const lines = useMemo(() => tokenizer ? new IncrementalLines(tokenizer.tokenize) : null, [tokenizer]);
71
- const tokens = useMemo(() => lines?.update(code, !streaming) ?? null, [lines, code, streaming]);
78
+ const incremental = useMemo(() => tokenizer ? new IncrementalLines(tokenizer.tokenize) : null, [tokenizer]);
79
+ const tokens = useMemo(() => incremental?.update(code, !streaming) ?? null, [incremental, code, streaming]);
72
80
  useEffect(() => {
73
81
  if (copyState !== 'copied') {
74
82
  return;
@@ -103,6 +111,10 @@ export function CodeBlock({
103
111
  };
104
112
  }, [highlighter, lang, theme, custom, tokenizer]);
105
113
  const pending = (tokenizer === null || tokens === null) && loaded !== 'failed';
114
+ // Numbered or marked code is drawn a line at a time before it is highlighted too, so a line never changes its box.
115
+ const drawn = tokens ?? (lines === undefined ? null : code.split('\n'));
116
+ const first = lines?.start ?? 1;
117
+ const digits = lines?.start === undefined || drawn === null ? undefined : String(first + drawn.length - 1).length;
106
118
  return /*#__PURE__*/_jsxs("div", {
107
119
  className: "chat-code",
108
120
  "data-copy-state": copyState,
@@ -111,17 +123,21 @@ export function CodeBlock({
111
123
  render: /*#__PURE__*/_jsx("pre", {}),
112
124
  viewportClassName: clsx(pending && 'invisible', !pending && tokens !== null && waited && WHOLE_FADE_CLASS),
113
125
  "aria-hidden": pending || undefined,
126
+ "data-lined": lines === undefined ? undefined : '',
114
127
  style: {
115
- color: tokenizer?.fg
128
+ color: tokenizer?.fg,
129
+ '--chat-code-digits': digits
116
130
  },
117
131
  children: /*#__PURE__*/_jsx("code", {
118
- children: tokens === null ? code : tokens.map((line, index) =>
132
+ children: drawn === null ? code : drawn.map((line, index) =>
119
133
  /*#__PURE__*/
120
134
  // Lines only ever grow at the end, so the place of a line is a stable key.
121
135
  _jsxs(Fragment, {
122
136
  children: [/*#__PURE__*/_jsx(CodeLine, {
123
- tokens: line
124
- }), index < tokens.length - 1 && '\n']
137
+ tokens: line,
138
+ number: lines?.start === undefined ? undefined : first + index,
139
+ marked: lines?.marked?.includes(first + index)
140
+ }), index < drawn.length - 1 && '\n']
125
141
  }, index))
126
142
  })
127
143
  }), /*#__PURE__*/_jsxs(ButtonGroup, {
@@ -15,6 +15,7 @@ import { UiSourceCitation } from './renderers/content.js';
15
15
  import { uiReplyParts } from './reply-parts.js';
16
16
  import { UiBlockFrame } from './UiBlockFrame.js';
17
17
  import { UiFallbackPart } from './UiFallbackPart.js';
18
+ import { useUiDiffs } from './use-ui-diffs.js';
18
19
  import { useUiLinks } from './use-ui-links.js';
19
20
  import { useUiQueries, useUiLiveValues } from './use-ui-queries.js';
20
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -38,11 +39,12 @@ const BLOCK = '$block';
38
39
  * Parents whose text is read as written: code, a short tag, and the labels of controls, whose
39
40
  * accessible name and sent text are that same string.
40
41
  */
41
- const LITERAL_PARENTS = new Set(['CodeBlock', 'Tag', 'Choice', 'Item', 'Switch', 'Slider', 'Segmented', 'Option', 'Button', 'Column']);
42
+ const LITERAL_PARENTS = new Set(['CodeBlock', 'Tag', 'Choice', 'Item', 'Switch', 'Slider', 'Segmented', 'Option', 'Button', 'Column', 'Leaf']);
42
43
  /* Parents that stack their children, where a run of text and inline nodes is one paragraph. */
43
44
  const PARAGRAPHS = {
44
45
  [BLOCK]: 'text-xs text-text',
45
46
  Tab: 'text-xs text-text',
47
+ Pane: 'text-xs text-text',
46
48
  Section: 'text-xs text-text-muted'
47
49
  };
48
50
  const LINKS = new Set(['File', 'Diff', 'Commit', 'Node']);
@@ -334,7 +336,12 @@ function isInline(node) {
334
336
  if (node.type === '$text') {
335
337
  return true;
336
338
  }
337
- return node.error === undefined && (node.type === 'Tag' || LINKS.has(node.type) && node.children.length === 0);
339
+ if (node.error !== undefined) {
340
+ return false;
341
+ }
342
+ // An open Diff is a tile of its own, also while its host has not answered or never will.
343
+ const chip = LINKS.has(node.type) && node.children.length === 0 && !(node.type === 'Diff' && node.props.open === true);
344
+ return node.type === 'Tag' || node.type === 'Keys' || chip;
338
345
  }
339
346
  function isBlank(node) {
340
347
  return node.type === '$text' && String(node.props.text ?? '').trim() === '';
@@ -607,6 +614,7 @@ function UiBlockBody({
607
614
  void revealUiSource(element, source.id, source.ancestors);
608
615
  } : undefined
609
616
  }), [sources, element]);
617
+ const diff = useUiDiffs(block, state, context, queries.reads, evaluation.nodes);
610
618
  const {
611
619
  liveValue,
612
620
  liveNode
@@ -616,6 +624,7 @@ function UiBlockBody({
616
624
  const rendering = {
617
625
  ...context,
618
626
  ...links,
627
+ diff,
619
628
  place,
620
629
  answer,
621
630
  failedChoiceId,
@@ -0,0 +1 @@
1
+ export declare function uiKeyCaps(text: string, apple: boolean): string[];
@@ -0,0 +1,45 @@
1
+ import { shortcut, shortcutParts } from '@adecore/ui';
2
+ /* How an agent may write a key, by its lower case, as the word a shortcut is parsed from. */
3
+ const KEY_WORDS = {
4
+ mod: 'Mod',
5
+ ctrl: 'Ctrl',
6
+ control: 'Ctrl',
7
+ alt: 'Alt',
8
+ option: 'Alt',
9
+ opt: 'Alt',
10
+ shift: 'Shift',
11
+ meta: 'Meta',
12
+ cmd: 'Meta',
13
+ command: 'Meta',
14
+ enter: 'Enter',
15
+ return: 'Enter',
16
+ escape: 'Escape',
17
+ esc: 'Escape',
18
+ backspace: 'Backspace',
19
+ delete: 'Delete',
20
+ del: 'Delete',
21
+ tab: 'Tab',
22
+ space: 'Space',
23
+ left: 'ArrowLeft',
24
+ right: 'ArrowRight',
25
+ up: 'ArrowUp',
26
+ down: 'ArrowDown',
27
+ arrowleft: 'ArrowLeft',
28
+ arrowright: 'ArrowRight',
29
+ arrowup: 'ArrowUp',
30
+ arrowdown: 'ArrowDown'
31
+ };
32
+ /*
33
+ * The caps of a shortcut written as `mod+K`, the way this platform prints them. Keys a shortcut cannot
34
+ * hold, such as two letters or a key it has no name for, stand as written, with only `mod` translated.
35
+ */
36
+ export function uiKeyCaps(text, apple) {
37
+ const written = text.trim();
38
+ // A trailing `++` is the plus key itself, which a plain split would read as two empty words.
39
+ const words = (written.endsWith('++') ? [...written.slice(0, -2).split('+'), '+'] : written === '+' ? ['+'] : written.split('+')).map(word => word.trim()).filter(word => word !== '').map(word => KEY_WORDS[word.toLowerCase()] ?? (/^f\d{1,2}$/i.test(word) ? word.toUpperCase() : word));
40
+ try {
41
+ return shortcutParts(shortcut(words.join('+')), apple);
42
+ } catch {
43
+ return words.map(word => word === 'Mod' ? apple ? '⌘' : 'Ctrl' : word);
44
+ }
45
+ }
@@ -0,0 +1,9 @@
1
+ import type { TFunction } from 'i18next';
2
+ import type { UiLink, UiLinkTarget, UiRenderContext } from './render-context.js';
3
+ export declare const UI_PLAIN_LINK: UiLink;
4
+ export declare function uiBaseName(path: string): string;
5
+ export declare function uiPlainLinkReason(t: TFunction<'agent-chat'>, link: UiLink, context: UiRenderContext): string | null;
6
+ export declare function uiLinkAction(t: TFunction<'agent-chat'>, target: UiLinkTarget, context: UiRenderContext): {
7
+ open: (() => void) | null;
8
+ reason: string | null;
9
+ };
@@ -0,0 +1,32 @@
1
+ import { uiReasonText } from './node-text.js';
2
+ export const UI_PLAIN_LINK = {
3
+ state: 'plain'
4
+ };
5
+ export function uiBaseName(path) {
6
+ const trimmed = path.replace(/\/+$/, '');
7
+ return trimmed.slice(trimmed.lastIndexOf('/') + 1) || path;
8
+ }
9
+ /* Why the host leaves a link as text, for its tooltip; null where no host checks links at all. */
10
+ export function uiPlainLinkReason(t, link, context) {
11
+ return uiReasonText(t, link.code, link.reason) ?? (context.link === undefined ? null : t('blocks.outsideProject'));
12
+ }
13
+ /*
14
+ * A link that is a whole row rather than a chip, such as a changed file: `open` once the host can open the
15
+ * target, otherwise the reason it stays text.
16
+ */
17
+ export function uiLinkAction(t, target, context) {
18
+ const link = context.link?.(target) ?? UI_PLAIN_LINK;
19
+ if (link.state === 'plain') {
20
+ return {
21
+ open: null,
22
+ reason: uiPlainLinkReason(t, link, context)
23
+ };
24
+ }
25
+ const {
26
+ openLink
27
+ } = context;
28
+ return {
29
+ open: openLink === undefined ? null : () => openLink(target),
30
+ reason: null
31
+ };
32
+ }
@@ -62,7 +62,7 @@ export async function revealUiSource(root, nodeId, ancestors = []) {
62
62
  return true;
63
63
  }
64
64
  /* The reason codes this version says in its own words; any other code reads as the reason the machine gave. */
65
- const UI_REASON_CODES = new Set(['access-unavailable', 'block-stale', 'busy', 'link-unchecked', 'link-unsupported', 'links-unsupported', 'no-unique-match', 'outside-project', 'query-undeclared', 'refresh-limit', 'result-too-large', 'snapshot-too-large', 'source-unregistered', 'stale-read', 'target-unavailable', 'timed-out', 'unreadable']);
65
+ const UI_REASON_CODES = new Set(['access-unavailable', 'block-stale', 'busy', 'diffs-unsupported', 'link-unchecked', 'link-unsupported', 'links-unsupported', 'no-unique-match', 'outside-project', 'query-undeclared', 'refresh-limit', 'result-too-large', 'snapshot-too-large', 'source-unregistered', 'stale-read', 'target-unavailable', 'timed-out', 'unreadable']);
66
66
  /* Why a reading failed or a link stayed plain, in the person's language where the code is known. */
67
67
  export function uiReasonText(t, code, reason) {
68
68
  return code !== undefined && UI_REASON_CODES.has(code) ? t(`blocks.live.reasons.${code}`) : reason;
@@ -0,0 +1,4 @@
1
+ export declare function uiClipPatch(patch: string, limit: number): {
2
+ patch: string;
3
+ clipped: boolean;
4
+ };
@@ -0,0 +1,64 @@
1
+ const HUNK = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(.*)$/;
2
+ /* A side the cut left without lines names the line before it, as a hunk that never had lines on that side does. */
3
+ function side(start, count, written) {
4
+ return `${count === 0 && written > 0 ? Math.max(0, start - 1) : start},${count}`;
5
+ }
6
+ /*
7
+ * A unified patch cut to its first `limit` lines of change and context. The file header stays, and the hunk
8
+ * the cut falls in gets the counts of what is left of it, so the shorter patch still parses as a whole one.
9
+ */
10
+ export function uiClipPatch(patch, limit) {
11
+ const lines = patch.split('\n');
12
+ const kept = [];
13
+ let hunk = null;
14
+ let count = 0;
15
+ for (const [index, line] of lines.entries()) {
16
+ const header = HUNK.exec(line);
17
+ if (header !== null) {
18
+ if (count >= limit) {
19
+ return {
20
+ patch: kept.join('\n'),
21
+ clipped: true
22
+ };
23
+ }
24
+ hunk = {
25
+ at: kept.length,
26
+ oldStart: Number(header[1]),
27
+ newStart: Number(header[3]),
28
+ oldWritten: Number(header[2] ?? 1),
29
+ newWritten: Number(header[4] ?? 1),
30
+ rest: header[5] ?? '',
31
+ old: 0,
32
+ new: 0
33
+ };
34
+ kept.push(line);
35
+ continue;
36
+ }
37
+ // A stripped empty line inside a hunk is context; the one a final newline leaves at the very end is not.
38
+ const body = hunk !== null && (/^[ +-]/.test(line) || line === '' && index < lines.length - 1);
39
+ if (hunk === null || !body && !line.startsWith('\\')) {
40
+ hunk = null;
41
+ kept.push(line);
42
+ continue;
43
+ }
44
+ if (!body) {
45
+ kept.push(line);
46
+ continue;
47
+ }
48
+ if (count >= limit) {
49
+ kept[hunk.at] = `@@ -${side(hunk.oldStart, hunk.old, hunk.oldWritten)} +${side(hunk.newStart, hunk.new, hunk.newWritten)} @@${hunk.rest}`;
50
+ return {
51
+ patch: kept.join('\n'),
52
+ clipped: true
53
+ };
54
+ }
55
+ hunk.old += line.startsWith('+') ? 0 : 1;
56
+ hunk.new += line.startsWith('-') ? 0 : 1;
57
+ count += 1;
58
+ kept.push(line);
59
+ }
60
+ return {
61
+ patch,
62
+ clipped: false
63
+ };
64
+ }
@@ -1,17 +1,25 @@
1
+ import { AlternativeRenderer, AlternativesRenderer, ConRenderer, ProRenderer } from './renderers/alternatives.js';
2
+ import { ChangeRenderer, ChangesRenderer } from './renderers/changes.js';
1
3
  import { ChartRenderer } from './renderers/chart.js';
2
4
  import { ChoiceRenderer, ChoicesRenderer } from './renderers/choices.js';
3
5
  import { CodeBlockRenderer, CompareRenderer, GalleryRenderer, ImageRenderer, ModelRenderer, SourceRenderer, SourcesRenderer } from './renderers/content.js';
4
6
  import { EntityListRenderer, EntryRenderer, StatRenderer, StatsRenderer, TableRenderer } from './renderers/data.js';
5
- import { ButtonRenderer, ChecklistRenderer, ItemRenderer, SegmentedRenderer, SelectRenderer, SliderRenderer, SwitchRenderer, TextFieldRenderer } from './renderers/inputs.js';
6
- import { CommitRenderer, DiffRenderer, FileRenderer, NodeRenderer } from './renderers/links.js';
7
+ import { DiffRenderer } from './renderers/diff.js';
8
+ import { ButtonRenderer, ChecklistRenderer, ItemRenderer, NumberFieldRenderer, SegmentedRenderer, SelectRenderer, SliderRenderer, SwitchRenderer, TextFieldRenderer } from './renderers/inputs.js';
9
+ import { KeysRenderer } from './renderers/keys.js';
10
+ import { CommitRenderer, FileRenderer, NodeRenderer } from './renderers/links.js';
7
11
  import { MapRenderer } from './renderers/map.js';
8
- import { SectionRenderer, SectionsRenderer, TabRenderer, TabsRenderer } from './renderers/structure.js';
12
+ import { MeterRenderer, PartsRenderer } from './renderers/meter.js';
13
+ import { QuoteRenderer } from './renderers/quote.js';
14
+ import { RadioRenderer } from './renderers/radio.js';
15
+ import { ColumnsRenderer, PaneRenderer, SectionRenderer, SectionsRenderer, TabRenderer, TabsRenderer } from './renderers/structure.js';
9
16
  import { CalloutRenderer, EventRenderer, ProgressRenderer, StepRenderer, StepsRenderer, SummaryRenderer, TagRenderer, TimelineRenderer } from './renderers/text.js';
17
+ import { BranchRenderer, LeafRenderer, TreeRenderer } from './renderers/tree.js';
10
18
  /*
11
19
  * A renderer for every component of the catalog; a name missing here fails the typecheck. Null draws
12
20
  * nothing for the node itself: the runtime resolves Show and Each before rendering, and Column,
13
- * Option and Place are metadata their parent reads from its node (a table its columns, Segmented and
14
- * Select their options, a map its places).
21
+ * Option, Part and Place are metadata their parent reads from its node (a table its columns, Segmented,
22
+ * Select and Radio their options, a bar its parts, a map its places).
15
23
  */
16
24
  export const UI_RENDERERS = {
17
25
  Summary: SummaryRenderer,
@@ -24,6 +32,9 @@ export const UI_RENDERERS = {
24
32
  Event: EventRenderer,
25
33
  Stats: StatsRenderer,
26
34
  Stat: StatRenderer,
35
+ Meter: MeterRenderer,
36
+ Parts: PartsRenderer,
37
+ Part: null,
27
38
  EntityList: EntityListRenderer,
28
39
  Entry: EntryRenderer,
29
40
  Table: TableRenderer,
@@ -33,7 +44,18 @@ export const UI_RENDERERS = {
33
44
  Tab: TabRenderer,
34
45
  Sections: SectionsRenderer,
35
46
  Section: SectionRenderer,
47
+ Columns: ColumnsRenderer,
48
+ Pane: PaneRenderer,
49
+ Alternatives: AlternativesRenderer,
50
+ Alternative: AlternativeRenderer,
51
+ Pro: ProRenderer,
52
+ Con: ConRenderer,
53
+ Tree: TreeRenderer,
54
+ Branch: BranchRenderer,
55
+ Leaf: LeafRenderer,
36
56
  CodeBlock: CodeBlockRenderer,
57
+ Quote: QuoteRenderer,
58
+ Keys: KeysRenderer,
37
59
  Image: ImageRenderer,
38
60
  Gallery: GalleryRenderer,
39
61
  Compare: CompareRenderer,
@@ -44,6 +66,8 @@ export const UI_RENDERERS = {
44
66
  Source: SourceRenderer,
45
67
  File: FileRenderer,
46
68
  Diff: DiffRenderer,
69
+ Changes: ChangesRenderer,
70
+ Change: ChangeRenderer,
47
71
  Commit: CommitRenderer,
48
72
  Node: NodeRenderer,
49
73
  Checklist: ChecklistRenderer,
@@ -52,8 +76,10 @@ export const UI_RENDERERS = {
52
76
  Slider: SliderRenderer,
53
77
  Segmented: SegmentedRenderer,
54
78
  Select: SelectRenderer,
79
+ Radio: RadioRenderer,
55
80
  Option: null,
56
81
  TextField: TextFieldRenderer,
82
+ NumberField: NumberFieldRenderer,
57
83
  Button: ButtonRenderer,
58
84
  Show: null,
59
85
  Each: null,
@@ -8,7 +8,19 @@ export interface UiLink {
8
8
  detail?: string;
9
9
  reason?: string;
10
10
  code?: string;
11
+ status?: string;
11
12
  }
13
+ export type UiDiff = {
14
+ state: 'reading';
15
+ } | {
16
+ state: 'patch';
17
+ patch: string;
18
+ truncated: boolean;
19
+ } | {
20
+ state: 'refused';
21
+ reason?: string;
22
+ code?: string;
23
+ };
12
24
  export interface UiPlacePoint {
13
25
  lat: number;
14
26
  lon: number;
@@ -43,6 +55,7 @@ export interface UiRenderContext {
43
55
  live?: UiLiveStatus | null;
44
56
  link?(target: UiLinkTarget): UiLink;
45
57
  openLink?(target: UiLinkTarget): void;
58
+ diff?(nodeId: string): UiDiff | undefined;
46
59
  openUrl?(url: string): void;
47
60
  onChoose?(nodeId: string): void;
48
61
  choiceReason?: string | null;
@@ -0,0 +1,6 @@
1
+ import type { UiProps } from '@adecore/intelligent-ui';
2
+ import type { UiRendererProps } from '../render-context.js';
3
+ export declare function AlternativesRenderer({ node, children }: UiRendererProps<UiProps<'Alternatives'>>): import("react").JSX.Element;
4
+ export declare function AlternativeRenderer({ node, children }: UiRendererProps<UiProps<'Alternative'>>): import("react").JSX.Element;
5
+ export declare function ProRenderer({ children }: UiRendererProps<UiProps<'Pro'>>): import("react").JSX.Element;
6
+ export declare function ConRenderer({ children }: UiRendererProps<UiProps<'Con'>>): import("react").JSX.Element;