@adecore/agents-react 0.71.0 → 0.71.2

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.
@@ -29,9 +29,19 @@ function createCodeHighlighter(source) {
29
29
  highlighterLoad ??= source().then(loaded => {
30
30
  highlighter = loaded;
31
31
  return loaded;
32
+ }, error => {
33
+ // A chunk that failed to load once may load the next time; kept, it would leave code plain until a reload.
34
+ highlighterLoad = null;
35
+ throw error;
32
36
  });
33
37
  return highlighterLoad;
34
38
  };
39
+ // A load that failed is asked again by the next block that needs it.
40
+ const retried = (loads, key, pending) => {
41
+ loads.set(key, pending);
42
+ pending.catch(() => loads.delete(key));
43
+ return pending;
44
+ };
35
45
  const ready = (langs, theme) => {
36
46
  if (highlighter === null || !themes.has(theme)) {
37
47
  return null;
@@ -48,24 +58,22 @@ function createCodeHighlighter(source) {
48
58
  loadLanguage(lang) {
49
59
  let pending = languageLoads.get(lang);
50
60
  if (!pending) {
51
- pending = load().then(async loaded => {
61
+ pending = retried(languageLoads, lang, load().then(async loaded => {
52
62
  languages.set(lang, await grammarOf(loaded, lang));
53
- });
54
- languageLoads.set(lang, pending);
63
+ }));
55
64
  }
56
65
  return pending;
57
66
  },
58
67
  loadTheme(theme, custom) {
59
68
  let pending = themeLoads.get(theme);
60
69
  if (!pending) {
61
- pending = load().then(async loaded => {
70
+ pending = retried(themeLoads, theme, load().then(async loaded => {
62
71
  // Loading a theme the highlighter already has replaces it, under whatever else of the host draws with it.
63
72
  if (!loaded.getLoadedThemes().includes(theme)) {
64
73
  await loaded.loadTheme(shikiThemeOf(theme, custom));
65
74
  }
66
75
  themes.add(theme);
67
- });
68
- themeLoads.set(theme, pending);
76
+ }));
69
77
  }
70
78
  return pending;
71
79
  },
@@ -6,6 +6,7 @@ import clsx from 'clsx';
6
6
  import { Bot, Brain, ChevronDown, CircleAlert, CircleCheck, CircleMinus, CircleX, Clock, File, Info, MessageCircleQuestionMark, Reply, Send, SquareTerminal, TriangleAlert } from 'lucide-react';
7
7
  import { useContext, useState } from 'react';
8
8
  import { useTranslation } from 'react-i18next';
9
+ import { CliMark } from '../../../agents/AgentModelLabel.js';
9
10
  import { useChatHost } from '../../../host/host.js';
10
11
  import { useHostAttachmentUrl, useHostChatPlace, useHostReplyAuthor, useHostStreaming, useHostUnknownItemWords } from '../../../host/host-hooks.js';
11
12
  import { useChatScope } from '../../../scope.js';
@@ -2428,7 +2429,7 @@ export function CompactionRow(t0) {
2428
2429
  }
2429
2430
  /* A solid line where the model or effort changed, so a reader can tell which answers came from which. */
2430
2431
  export function SelectionSwitchRow(t0) {
2431
- const $ = _c(26);
2432
+ const $ = _c(33);
2432
2433
  const {
2433
2434
  chatId,
2434
2435
  from,
@@ -2453,103 +2454,124 @@ export function SelectionSwitchRow(t0) {
2453
2454
  let t4;
2454
2455
  let t5;
2455
2456
  let t6;
2456
- if ($[2] !== from || $[3] !== models || $[4] !== t || $[5] !== to) {
2457
- t6 = Symbol.for("react.early_return_sentinel");
2457
+ let t7;
2458
+ let t8;
2459
+ if ($[2] !== from || $[3] !== models || $[4] !== provider || $[5] !== t || $[6] !== to) {
2460
+ t8 = Symbol.for("react.early_return_sentinel");
2458
2461
  bb0: {
2459
2462
  const text = selectionSwitchText(from, to, models);
2460
2463
  if (text === null) {
2461
- t6 = null;
2464
+ t8 = null;
2462
2465
  break bb0;
2463
2466
  }
2464
- t4 = "flex items-center gap-3 pb-3 text-xs text-text-faint";
2465
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
2466
- t5 = /*#__PURE__*/_jsx("span", {
2467
+ t6 = "flex items-center gap-3 pb-3 text-xs text-text-faint";
2468
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
2469
+ t7 = /*#__PURE__*/_jsx("span", {
2467
2470
  className: "grow border-t border-border"
2468
2471
  });
2469
- $[12] = t5;
2472
+ $[15] = t7;
2470
2473
  } else {
2471
- t5 = $[12];
2474
+ t7 = $[15];
2472
2475
  }
2473
2476
  T0 = Tooltip;
2474
- if ($[13] !== t) {
2475
- t3 = t("rows.selectionSwitch.summary");
2476
- $[13] = t;
2477
- $[14] = t3;
2477
+ if ($[16] !== t) {
2478
+ t5 = t("rows.selectionSwitch.summary");
2479
+ $[16] = t;
2480
+ $[17] = t5;
2481
+ } else {
2482
+ t5 = $[17];
2483
+ }
2484
+ t2 = "flex items-center gap-1.5";
2485
+ if ($[18] !== provider) {
2486
+ t3 = provider !== undefined && /*#__PURE__*/_jsx(CliMark, {
2487
+ kind: provider,
2488
+ size: 12
2489
+ });
2490
+ $[18] = provider;
2491
+ $[19] = t3;
2478
2492
  } else {
2479
- t3 = $[14];
2493
+ t3 = $[19];
2480
2494
  }
2481
- t2 = t("rows.selectionSwitch.label", {
2495
+ t4 = t("rows.selectionSwitch.label", {
2482
2496
  from: text.from,
2483
2497
  to: text.to
2484
2498
  });
2485
2499
  }
2486
2500
  $[2] = from;
2487
2501
  $[3] = models;
2488
- $[4] = t;
2489
- $[5] = to;
2490
- $[6] = T0;
2491
- $[7] = t2;
2492
- $[8] = t3;
2493
- $[9] = t4;
2494
- $[10] = t5;
2495
- $[11] = t6;
2502
+ $[4] = provider;
2503
+ $[5] = t;
2504
+ $[6] = to;
2505
+ $[7] = T0;
2506
+ $[8] = t2;
2507
+ $[9] = t3;
2508
+ $[10] = t4;
2509
+ $[11] = t5;
2510
+ $[12] = t6;
2511
+ $[13] = t7;
2512
+ $[14] = t8;
2496
2513
  } else {
2497
- T0 = $[6];
2498
- t2 = $[7];
2499
- t3 = $[8];
2500
- t4 = $[9];
2501
- t5 = $[10];
2502
- t6 = $[11];
2514
+ T0 = $[7];
2515
+ t2 = $[8];
2516
+ t3 = $[9];
2517
+ t4 = $[10];
2518
+ t5 = $[11];
2519
+ t6 = $[12];
2520
+ t7 = $[13];
2521
+ t8 = $[14];
2503
2522
  }
2504
- if (t6 !== Symbol.for("react.early_return_sentinel")) {
2505
- return t6;
2523
+ if (t8 !== Symbol.for("react.early_return_sentinel")) {
2524
+ return t8;
2506
2525
  }
2507
- let t7;
2508
- if ($[15] !== t2) {
2509
- t7 = /*#__PURE__*/_jsx("span", {
2510
- children: t2
2526
+ let t9;
2527
+ if ($[20] !== t2 || $[21] !== t3 || $[22] !== t4) {
2528
+ t9 = /*#__PURE__*/_jsxs("span", {
2529
+ className: t2,
2530
+ children: [t3, t4]
2511
2531
  });
2512
- $[15] = t2;
2513
- $[16] = t7;
2532
+ $[20] = t2;
2533
+ $[21] = t3;
2534
+ $[22] = t4;
2535
+ $[23] = t9;
2514
2536
  } else {
2515
- t7 = $[16];
2537
+ t9 = $[23];
2516
2538
  }
2517
- let t8;
2518
- if ($[17] !== T0 || $[18] !== t3 || $[19] !== t7) {
2519
- t8 = /*#__PURE__*/_jsx(T0, {
2520
- label: t3,
2521
- children: t7
2539
+ let t10;
2540
+ if ($[24] !== T0 || $[25] !== t5 || $[26] !== t9) {
2541
+ t10 = /*#__PURE__*/_jsx(T0, {
2542
+ label: t5,
2543
+ children: t9
2522
2544
  });
2523
- $[17] = T0;
2524
- $[18] = t3;
2525
- $[19] = t7;
2526
- $[20] = t8;
2545
+ $[24] = T0;
2546
+ $[25] = t5;
2547
+ $[26] = t9;
2548
+ $[27] = t10;
2527
2549
  } else {
2528
- t8 = $[20];
2550
+ t10 = $[27];
2529
2551
  }
2530
- let t9;
2531
- if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
2532
- t9 = /*#__PURE__*/_jsx("span", {
2552
+ let t11;
2553
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
2554
+ t11 = /*#__PURE__*/_jsx("span", {
2533
2555
  className: "grow border-t border-border"
2534
2556
  });
2535
- $[21] = t9;
2557
+ $[28] = t11;
2536
2558
  } else {
2537
- t9 = $[21];
2559
+ t11 = $[28];
2538
2560
  }
2539
- let t10;
2540
- if ($[22] !== t4 || $[23] !== t5 || $[24] !== t8) {
2541
- t10 = /*#__PURE__*/_jsxs("div", {
2542
- className: t4,
2543
- children: [t5, t8, t9]
2561
+ let t12;
2562
+ if ($[29] !== t10 || $[30] !== t6 || $[31] !== t7) {
2563
+ t12 = /*#__PURE__*/_jsxs("div", {
2564
+ className: t6,
2565
+ children: [t7, t10, t11]
2544
2566
  });
2545
- $[22] = t4;
2546
- $[23] = t5;
2547
- $[24] = t8;
2548
- $[25] = t10;
2567
+ $[29] = t10;
2568
+ $[30] = t6;
2569
+ $[31] = t7;
2570
+ $[32] = t12;
2549
2571
  } else {
2550
- t10 = $[25];
2572
+ t12 = $[32];
2551
2573
  }
2552
- return t10;
2574
+ return t12;
2553
2575
  }
2554
2576
  function _temp0(row) {
2555
2577
  return row?.info.provider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agents-react",
3
- "version": "0.71.0",
3
+ "version": "0.71.2",
4
4
  "description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -72,12 +72,12 @@
72
72
  "test:visuals": "bun --config=integration.bunfig.toml --conditions=source test ./src/chat/visual-viewport.integration.test.ts"
73
73
  },
74
74
  "dependencies": {
75
- "@adecore/agent-contracts": "0.71.0",
76
- "@adecore/editor": "0.71.0",
77
- "@adecore/editor-react": "0.71.0",
78
- "@adecore/intelligent-ui": "0.71.0",
79
- "@adecore/merge": "0.71.0",
80
- "@adecore/utils": "0.71.0",
75
+ "@adecore/agent-contracts": "0.71.2",
76
+ "@adecore/editor": "0.71.2",
77
+ "@adecore/editor-react": "0.71.2",
78
+ "@adecore/intelligent-ui": "0.71.2",
79
+ "@adecore/merge": "0.71.2",
80
+ "@adecore/utils": "0.71.2",
81
81
  "@codemirror/commands": "^6.11.1",
82
82
  "@codemirror/language": "^6.13.1",
83
83
  "@codemirror/state": "^6.7.6",
@@ -101,14 +101,14 @@
101
101
  "zustand": "^5.1.0"
102
102
  },
103
103
  "peerDependencies": {
104
- "@adecore/ui": "^0.71.0",
104
+ "@adecore/ui": "^0.71.2",
105
105
  "i18next": "^26.4.2 || ^27.0.0",
106
106
  "react": "^19.3.0",
107
107
  "react-dom": "^19.3.0",
108
108
  "react-i18next": "^17.0.15 || ^18.0.0"
109
109
  },
110
110
  "devDependencies": {
111
- "@adecore/ui": "0.71.0",
111
+ "@adecore/ui": "0.71.2",
112
112
  "@types/bun": "^1.4.4",
113
113
  "@types/react": "^19.3.0",
114
114
  "@types/react-dom": "^19.3.0",
@@ -50,15 +50,31 @@ function createCodeHighlighter(source: () => Promise<Highlighter>): CodeHighligh
50
50
  const tokenizers = new Map<string, { tokenize: Tokenize<GrammarState>; fg: string | undefined }>();
51
51
 
52
52
  const load = (): Promise<Highlighter> => {
53
- highlighterLoad ??= source().then((loaded) => {
54
- highlighter = loaded;
53
+ highlighterLoad ??= source().then(
54
+ (loaded) => {
55
+ highlighter = loaded;
55
56
 
56
- return loaded;
57
- });
57
+ return loaded;
58
+ },
59
+ (error: unknown) => {
60
+ // A chunk that failed to load once may load the next time; kept, it would leave code plain until a reload.
61
+ highlighterLoad = null;
62
+
63
+ throw error;
64
+ }
65
+ );
58
66
 
59
67
  return highlighterLoad;
60
68
  };
61
69
 
70
+ // A load that failed is asked again by the next block that needs it.
71
+ const retried = (loads: Map<string, Promise<void>>, key: string, pending: Promise<void>): Promise<void> => {
72
+ loads.set(key, pending);
73
+ pending.catch(() => loads.delete(key));
74
+
75
+ return pending;
76
+ };
77
+
62
78
  const ready = (langs: Iterable<string>, theme: string): Highlighter | null => {
63
79
  if (highlighter === null || !themes.has(theme)) {
64
80
  return null;
@@ -80,11 +96,13 @@ function createCodeHighlighter(source: () => Promise<Highlighter>): CodeHighligh
80
96
  let pending = languageLoads.get(lang);
81
97
 
82
98
  if (!pending) {
83
- pending = load().then(async (loaded) => {
84
- languages.set(lang, await grammarOf(loaded, lang));
85
- });
86
-
87
- languageLoads.set(lang, pending);
99
+ pending = retried(
100
+ languageLoads,
101
+ lang,
102
+ load().then(async (loaded) => {
103
+ languages.set(lang, await grammarOf(loaded, lang));
104
+ })
105
+ );
88
106
  }
89
107
 
90
108
  return pending;
@@ -93,16 +111,18 @@ function createCodeHighlighter(source: () => Promise<Highlighter>): CodeHighligh
93
111
  let pending = themeLoads.get(theme);
94
112
 
95
113
  if (!pending) {
96
- pending = load().then(async (loaded) => {
97
- // Loading a theme the highlighter already has replaces it, under whatever else of the host draws with it.
98
- if (!loaded.getLoadedThemes().includes(theme)) {
99
- await loaded.loadTheme(shikiThemeOf(theme, custom) as BundledTheme | ThemeRegistration);
100
- }
101
-
102
- themes.add(theme);
103
- });
104
-
105
- themeLoads.set(theme, pending);
114
+ pending = retried(
115
+ themeLoads,
116
+ theme,
117
+ load().then(async (loaded) => {
118
+ // Loading a theme the highlighter already has replaces it, under whatever else of the host draws with it.
119
+ if (!loaded.getLoadedThemes().includes(theme)) {
120
+ await loaded.loadTheme(shikiThemeOf(theme, custom) as BundledTheme | ThemeRegistration);
121
+ }
122
+
123
+ themes.add(theme);
124
+ })
125
+ );
106
126
  }
107
127
 
108
128
  return pending;
@@ -34,6 +34,7 @@ import {
34
34
  } from 'lucide-react';
35
35
  import { useContext, useState, type ReactNode } from 'react';
36
36
  import { useTranslation } from 'react-i18next';
37
+ import { CliMark } from '../../../agents/AgentModelLabel';
37
38
  import { useChatHost, type CommandLookSent, type ReplyAuthor } from '../../../host/host';
38
39
  import { useHostAttachmentUrl, useHostChatPlace, useHostReplyAuthor, useHostStreaming, useHostUnknownItemWords } from '../../../host/host-hooks';
39
40
  import { useChatScope } from '../../../scope';
@@ -805,7 +806,10 @@ export function SelectionSwitchRow({ chatId, from, to }: { chatId: string; from:
805
806
  <div className="flex items-center gap-3 pb-3 text-xs text-text-faint">
806
807
  <span className="grow border-t border-border" />
807
808
  <Tooltip label={t('rows.selectionSwitch.summary')}>
808
- <span>{t('rows.selectionSwitch.label', { from: text.from, to: text.to })}</span>
809
+ <span className="flex items-center gap-1.5">
810
+ {provider !== undefined && <CliMark kind={provider} size={12} />}
811
+ {t('rows.selectionSwitch.label', { from: text.from, to: text.to })}
812
+ </span>
809
813
  </Tooltip>
810
814
  <span className="grow border-t border-border" />
811
815
  </div>