@adecore/agents-react 0.54.12 → 0.54.13

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.
@@ -1,9 +1,18 @@
1
- interface PlaceholderInput {
1
+ import type { TFunction } from 'i18next';
2
+ interface PlaceholderHint {
3
+ key: string;
4
+ label: string;
5
+ }
6
+ interface HintConditions {
7
+ mentionable: boolean;
8
+ referable: boolean;
9
+ hasSkills: boolean;
10
+ }
11
+ export declare function placeholderHints(t: TFunction<'agent-chat'>, { mentionable, referable, hasSkills }: HintConditions): PlaceholderHint[];
12
+ interface PlaceholderInput extends HintConditions {
2
13
  chatId: string;
3
14
  disabled: boolean;
4
15
  readOnly: boolean;
5
- mentionable: boolean;
6
- hasSkills: boolean;
7
16
  }
8
- export declare function useHintedPlaceholder({ chatId, disabled, readOnly, mentionable, hasSkills }: PlaceholderInput): string | HTMLElement;
17
+ export declare function useHintedPlaceholder({ chatId, disabled, readOnly, mentionable, referable, hasSkills }: PlaceholderInput): string | HTMLElement;
9
18
  export {};
@@ -3,6 +3,26 @@ import { useMemo } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useHostComposerPlaceholder } from '../../../host-hooks.js';
5
5
  import { useChatScope } from '../../../scope.js';
6
+ /* The keys that open a picker in this chat, in the order a person reads them. */
7
+ export function placeholderHints(t, {
8
+ mentionable,
9
+ referable,
10
+ hasSkills
11
+ }) {
12
+ return [{
13
+ key: '/',
14
+ label: t('composer.placeholder.commands')
15
+ }, ...(mentionable ? [{
16
+ key: '@',
17
+ label: t('composer.placeholder.files')
18
+ }] : []), ...(referable ? [{
19
+ key: '#',
20
+ label: t('composer.placeholder.references')
21
+ }] : []), ...(hasSkills ? [{
22
+ key: '$',
23
+ label: t('composer.placeholder.skills')
24
+ }] : [])];
25
+ }
6
26
  /* The empty box names its sigils as key caps, so they read as keys to press rather than as punctuation. */
7
27
  function hintedPlaceholder(lead, joiner, hints) {
8
28
  const root = document.createElement('span');
@@ -11,21 +31,25 @@ function hintedPlaceholder(lead, joiner, hints) {
11
31
  extra.className = 'composer-hints-extra';
12
32
  extra.append(joiner);
13
33
  for (const hint of hints) {
34
+ const pair = document.createElement('span');
35
+ pair.className = hint.key === '#' ? 'composer-hint composer-hint-references' : 'composer-hint';
14
36
  const cap = document.createElement('kbd');
15
37
  cap.textContent = hint.key;
16
- extra.append(cap, hint.label);
38
+ pair.append(cap, hint.label);
39
+ extra.append(pair);
17
40
  }
18
41
  root.append(lead, extra);
19
42
  return root;
20
43
  }
21
44
  /* What the empty box says: why nothing can be written, or the host's words and the keys that open a picker. */
22
45
  export function useHintedPlaceholder(t0) {
23
- const $ = _c(9);
46
+ const $ = _c(10);
24
47
  const {
25
48
  chatId,
26
49
  disabled,
27
50
  readOnly,
28
51
  mentionable,
52
+ referable,
29
53
  hasSkills
30
54
  } = t0;
31
55
  const {
@@ -60,24 +84,20 @@ export function useHintedPlaceholder(t0) {
60
84
  break bb0;
61
85
  }
62
86
  let t2;
63
- if ($[4] !== hasSkills || $[5] !== lead || $[6] !== mentionable || $[7] !== t) {
64
- t2 = hintedPlaceholder(lead ?? t("composer.placeholder.lead"), t("composer.placeholder.joiner"), [{
65
- key: "/",
66
- label: t("composer.placeholder.commands")
67
- }, ...(mentionable ? [{
68
- key: "@",
69
- label: t("composer.placeholder.files")
70
- }] : []), ...(hasSkills ? [{
71
- key: "$",
72
- label: t("composer.placeholder.skills")
73
- }] : [])]);
87
+ if ($[4] !== hasSkills || $[5] !== lead || $[6] !== mentionable || $[7] !== referable || $[8] !== t) {
88
+ t2 = hintedPlaceholder(lead ?? t("composer.placeholder.lead"), t("composer.placeholder.joiner"), placeholderHints(t, {
89
+ mentionable,
90
+ referable,
91
+ hasSkills
92
+ }));
74
93
  $[4] = hasSkills;
75
94
  $[5] = lead;
76
95
  $[6] = mentionable;
77
- $[7] = t;
78
- $[8] = t2;
96
+ $[7] = referable;
97
+ $[8] = t;
98
+ $[9] = t2;
79
99
  } else {
80
- t2 = $[8];
100
+ t2 = $[9];
81
101
  }
82
102
  t1 = t2;
83
103
  }
@@ -37,6 +37,7 @@ export declare function usePromptMenus<D extends PromptDraft>({ draft: { draft,
37
37
  inputAria: Record<string, string>;
38
38
  menuOpen: boolean;
39
39
  hasSkills: boolean;
40
+ offersViews: boolean;
40
41
  skillNames: string[];
41
42
  commandQuery: string | null;
42
43
  commands: ComposerCommand[];
@@ -24,7 +24,7 @@ function sameQuery(left, right) {
24
24
  * follow that one.
25
25
  */
26
26
  export function usePromptMenus(t0) {
27
- const $ = _c(95);
27
+ const $ = _c(96);
28
28
  const {
29
29
  draft: t1,
30
30
  inputRef,
@@ -425,23 +425,25 @@ export function usePromptMenus(t0) {
425
425
  }
426
426
  const moveInMenu = t19;
427
427
  const t20 = skills.length > 0;
428
- let t21;
428
+ const t21 = offersReferences && !referables.chatsOnly;
429
+ let t22;
429
430
  if ($[65] !== skills) {
430
- t21 = skills.map(_temp4);
431
+ t22 = skills.map(_temp4);
431
432
  $[65] = skills;
432
- $[66] = t21;
433
+ $[66] = t22;
433
434
  } else {
434
- t21 = $[66];
435
+ t22 = $[66];
435
436
  }
436
- let t22;
437
- if ($[67] !== activeIndex || $[68] !== chooseMention || $[69] !== chooseMentionAt || $[70] !== chooseReference || $[71] !== chooseReferenceAt || $[72] !== chooseSkill || $[73] !== commandMenuOpen || $[74] !== commandQuery || $[75] !== commands || $[76] !== completeCommand || $[77] !== files_0 || $[78] !== inputAria || $[79] !== listId || $[80] !== mention || $[81] !== mentionCount || $[82] !== mentionMenuOpen || $[83] !== menuOpen || $[84] !== pickCommand || $[85] !== referables || $[86] !== referenceChips || $[87] !== referenceMatches || $[88] !== referenceMenuOpen || $[89] !== skillMatches || $[90] !== skillMenuOpen || $[91] !== t20 || $[92] !== t21 || $[93] !== trackTriggers) {
438
- t22 = {
437
+ let t23;
438
+ if ($[67] !== activeIndex || $[68] !== chooseMention || $[69] !== chooseMentionAt || $[70] !== chooseReference || $[71] !== chooseReferenceAt || $[72] !== chooseSkill || $[73] !== commandMenuOpen || $[74] !== commandQuery || $[75] !== commands || $[76] !== completeCommand || $[77] !== files_0 || $[78] !== inputAria || $[79] !== listId || $[80] !== mention || $[81] !== mentionCount || $[82] !== mentionMenuOpen || $[83] !== menuOpen || $[84] !== pickCommand || $[85] !== referables || $[86] !== referenceChips || $[87] !== referenceMatches || $[88] !== referenceMenuOpen || $[89] !== skillMatches || $[90] !== skillMenuOpen || $[91] !== t20 || $[92] !== t21 || $[93] !== t22 || $[94] !== trackTriggers) {
439
+ t23 = {
439
440
  listId,
440
441
  activeIndex,
441
442
  inputAria,
442
443
  menuOpen,
443
444
  hasSkills: t20,
444
- skillNames: t21,
445
+ offersViews: t21,
446
+ skillNames: t22,
445
447
  commandQuery,
446
448
  commands,
447
449
  commandMenuOpen,
@@ -493,12 +495,13 @@ export function usePromptMenus(t0) {
493
495
  $[90] = skillMenuOpen;
494
496
  $[91] = t20;
495
497
  $[92] = t21;
496
- $[93] = trackTriggers;
497
- $[94] = t22;
498
+ $[93] = t22;
499
+ $[94] = trackTriggers;
500
+ $[95] = t23;
498
501
  } else {
499
- t22 = $[94];
502
+ t23 = $[95];
500
503
  }
501
- return t22;
504
+ return t23;
502
505
  }
503
506
  function _temp4(skill_2) {
504
507
  return skill_2.name;
@@ -376,6 +376,7 @@ declare const _default: {
376
376
  joiner: string;
377
377
  commands: string;
378
378
  files: string;
379
+ references: string;
379
380
  skills: string;
380
381
  readOnly: string;
381
382
  };
@@ -376,6 +376,7 @@ export default {
376
376
  joiner: ', or',
377
377
  commands: 'commands',
378
378
  files: 'files',
379
+ references: 'views',
379
380
  skills: 'skills',
380
381
  readOnly: 'Go back to the main agent to write'
381
382
  },
@@ -376,6 +376,7 @@ declare const _default: {
376
376
  joiner: string;
377
377
  commands: string;
378
378
  files: string;
379
+ references: string;
379
380
  skills: string;
380
381
  readOnly: string;
381
382
  };
@@ -376,6 +376,7 @@ export default {
376
376
  joiner: ', of',
377
377
  commands: "commando's",
378
378
  files: 'bestanden',
379
+ references: 'weergaven',
379
380
  skills: 'skills',
380
381
  readOnly: 'Ga terug naar de main agent om te schrijven'
381
382
  },
package/dist/theme.css CHANGED
@@ -293,7 +293,7 @@
293
293
  /* The same editor as a form field (`PromptEditor`): the field's inset, and room for a few lines before it scrolls. */
294
294
  .composer-input.prompt-editor .cm-editor { max-height: 240px; }
295
295
  .composer-input.prompt-editor .cm-editor .cm-scroller .cm-content { min-height: 80px; padding: 6px 10px; }
296
- .composer-hints, .composer-hints-extra { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
296
+ .composer-hints, .composer-hints-extra, .composer-hint { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
297
297
  /* The joiner starts with its own comma, so it sits against the lead without the gap. */
298
298
  .composer-hints-extra { margin-left: -8px; }
299
299
  .composer-hints kbd { padding: 0 6px; border-radius: 5px; background: var(--surface-active); color: var(--text-muted); font-family: var(--font-mono); font-size: var(--text-code); line-height: var(--text-code--line-height); }
@@ -305,6 +305,10 @@
305
305
  @container composer (width < 36rem) {
306
306
  .composer-hints-extra { display: none; }
307
307
  }
308
+ /* The longest line, in Dutch on a 14px root, needs 38rem; until then `#` goes first and the rest stay. */
309
+ @container composer (width < 39rem) {
310
+ .composer-hint-references { display: none; }
311
+ }
308
312
  /* Markdown stays source while you type: the markers stay put and dim, and what they wrap takes its look. */
309
313
  .composer-input .cm-md-mark { color: var(--text-faint); }
310
314
  .composer-input .cm-md-strong, .composer-input .cm-md-heading { font-weight: 600; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agents-react",
3
- "version": "0.54.12",
3
+ "version": "0.54.13",
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.54.12",
76
- "@adecore/editor": "0.54.12",
77
- "@adecore/editor-react": "0.54.12",
78
- "@adecore/intelligent-ui": "0.54.12",
79
- "@adecore/merge": "0.54.12",
80
- "@adecore/utils": "0.54.12",
75
+ "@adecore/agent-contracts": "0.54.13",
76
+ "@adecore/editor": "0.54.13",
77
+ "@adecore/editor-react": "0.54.13",
78
+ "@adecore/intelligent-ui": "0.54.13",
79
+ "@adecore/merge": "0.54.13",
80
+ "@adecore/utils": "0.54.13",
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.0.16"
102
102
  },
103
103
  "peerDependencies": {
104
- "@adecore/ui": "^0.54.12",
104
+ "@adecore/ui": "^0.54.13",
105
105
  "i18next": "^26.4.2",
106
106
  "react": "^19.3.0",
107
107
  "react-dom": "^19.3.0",
108
108
  "react-i18next": "^17.0.15"
109
109
  },
110
110
  "devDependencies": {
111
- "@adecore/ui": "0.54.12",
111
+ "@adecore/ui": "0.54.13",
112
112
  "@types/bun": "^1.4.4",
113
113
  "@types/react": "^19.3.0",
114
114
  "@types/react-dom": "^19.3.0",
@@ -189,7 +189,14 @@ export function Composer({
189
189
 
190
190
  const pending = usePendingRequests(chatId);
191
191
  const compactionOffer = useCompactionOffer(chatId, info, capabilities?.compaction);
192
- const placeholder = useHintedPlaceholder({ chatId, disabled, readOnly, mentionable: capabilities?.mentions !== false, hasSkills: menus.hasSkills });
192
+ const placeholder = useHintedPlaceholder({
193
+ chatId,
194
+ disabled,
195
+ readOnly,
196
+ mentionable: capabilities?.mentions !== false,
197
+ referable: menus.offersViews,
198
+ hasSkills: menus.hasSkills
199
+ });
193
200
  const editorExtensions = [
194
201
  chipDecorations({ mentions: draft.mentions, skills: draft.skills, references: menus.referenceChips, referenceIcon: host.ReferenceIcon }),
195
202
  LEAVE_DROPS_TO_THE_CARD
@@ -1,10 +1,32 @@
1
+ import type { TFunction } from 'i18next';
1
2
  import { useMemo } from 'react';
2
3
  import { useTranslation } from 'react-i18next';
3
4
  import { useHostComposerPlaceholder } from '../../../host-hooks';
4
5
  import { useChatScope } from '../../../scope';
5
6
 
7
+ interface PlaceholderHint {
8
+ key: string;
9
+ label: string;
10
+ }
11
+
12
+ interface HintConditions {
13
+ mentionable: boolean;
14
+ referable: boolean;
15
+ hasSkills: boolean;
16
+ }
17
+
18
+ /* The keys that open a picker in this chat, in the order a person reads them. */
19
+ export function placeholderHints(t: TFunction<'agent-chat'>, { mentionable, referable, hasSkills }: HintConditions): PlaceholderHint[] {
20
+ return [
21
+ { key: '/', label: t('composer.placeholder.commands') },
22
+ ...(mentionable ? [{ key: '@', label: t('composer.placeholder.files') }] : []),
23
+ ...(referable ? [{ key: '#', label: t('composer.placeholder.references') }] : []),
24
+ ...(hasSkills ? [{ key: '$', label: t('composer.placeholder.skills') }] : [])
25
+ ];
26
+ }
27
+
6
28
  /* The empty box names its sigils as key caps, so they read as keys to press rather than as punctuation. */
7
- function hintedPlaceholder(lead: string, joiner: string, hints: ReadonlyArray<{ key: string; label: string }>): HTMLElement {
29
+ function hintedPlaceholder(lead: string, joiner: string, hints: ReadonlyArray<PlaceholderHint>): HTMLElement {
8
30
  const root = document.createElement('span');
9
31
  root.className = 'composer-hints';
10
32
  const extra = document.createElement('span');
@@ -12,9 +34,12 @@ function hintedPlaceholder(lead: string, joiner: string, hints: ReadonlyArray<{
12
34
  extra.append(joiner);
13
35
 
14
36
  for (const hint of hints) {
37
+ const pair = document.createElement('span');
38
+ pair.className = hint.key === '#' ? 'composer-hint composer-hint-references' : 'composer-hint';
15
39
  const cap = document.createElement('kbd');
16
40
  cap.textContent = hint.key;
17
- extra.append(cap, hint.label);
41
+ pair.append(cap, hint.label);
42
+ extra.append(pair);
18
43
  }
19
44
 
20
45
  root.append(lead, extra);
@@ -22,16 +47,14 @@ function hintedPlaceholder(lead: string, joiner: string, hints: ReadonlyArray<{
22
47
  return root;
23
48
  }
24
49
 
25
- interface PlaceholderInput {
50
+ interface PlaceholderInput extends HintConditions {
26
51
  chatId: string;
27
52
  disabled: boolean;
28
53
  readOnly: boolean;
29
- mentionable: boolean;
30
- hasSkills: boolean;
31
54
  }
32
55
 
33
56
  /* What the empty box says: why nothing can be written, or the host's words and the keys that open a picker. */
34
- export function useHintedPlaceholder({ chatId, disabled, readOnly, mentionable, hasSkills }: PlaceholderInput): string | HTMLElement {
57
+ export function useHintedPlaceholder({ chatId, disabled, readOnly, mentionable, referable, hasSkills }: PlaceholderInput): string | HTMLElement {
35
58
  const { t } = useTranslation('agent-chat');
36
59
  const scope = useChatScope();
37
60
  const lead = useHostComposerPlaceholder(scope.id, chatId);
@@ -45,10 +68,10 @@ export function useHintedPlaceholder({ chatId, disabled, readOnly, mentionable,
45
68
  return t('composer.placeholder.readOnly');
46
69
  }
47
70
 
48
- return hintedPlaceholder(lead ?? t('composer.placeholder.lead'), t('composer.placeholder.joiner'), [
49
- { key: '/', label: t('composer.placeholder.commands') },
50
- ...(mentionable ? [{ key: '@', label: t('composer.placeholder.files') }] : []),
51
- ...(hasSkills ? [{ key: '$', label: t('composer.placeholder.skills') }] : [])
52
- ]);
53
- }, [disabled, readOnly, lead, mentionable, hasSkills, t]);
71
+ return hintedPlaceholder(
72
+ lead ?? t('composer.placeholder.lead'),
73
+ t('composer.placeholder.joiner'),
74
+ placeholderHints(t, { mentionable, referable, hasSkills })
75
+ );
76
+ }, [disabled, readOnly, lead, mentionable, referable, hasSkills, t]);
54
77
  }
@@ -366,6 +366,8 @@ export function usePromptMenus<D extends PromptDraft>({
366
366
  inputAria,
367
367
  menuOpen,
368
368
  hasSkills: skills.length > 0,
369
+ // While only chats can be pointed at, the hint that names views would promise what `#` does not open.
370
+ offersViews: offersReferences && !referables.chatsOnly,
369
371
  skillNames: skills.map((skill) => skill.name),
370
372
  commandQuery,
371
373
  commands,
@@ -376,6 +376,7 @@ export default {
376
376
  joiner: ', or',
377
377
  commands: 'commands',
378
378
  files: 'files',
379
+ references: 'views',
379
380
  skills: 'skills',
380
381
  readOnly: 'Go back to the main agent to write'
381
382
  },
@@ -376,6 +376,7 @@ export default {
376
376
  joiner: ', of',
377
377
  commands: "commando's",
378
378
  files: 'bestanden',
379
+ references: 'weergaven',
379
380
  skills: 'skills',
380
381
  readOnly: 'Ga terug naar de main agent om te schrijven'
381
382
  },
package/src/theme.css CHANGED
@@ -293,7 +293,7 @@
293
293
  /* The same editor as a form field (`PromptEditor`): the field's inset, and room for a few lines before it scrolls. */
294
294
  .composer-input.prompt-editor .cm-editor { max-height: 240px; }
295
295
  .composer-input.prompt-editor .cm-editor .cm-scroller .cm-content { min-height: 80px; padding: 6px 10px; }
296
- .composer-hints, .composer-hints-extra { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
296
+ .composer-hints, .composer-hints-extra, .composer-hint { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
297
297
  /* The joiner starts with its own comma, so it sits against the lead without the gap. */
298
298
  .composer-hints-extra { margin-left: -8px; }
299
299
  .composer-hints kbd { padding: 0 6px; border-radius: 5px; background: var(--surface-active); color: var(--text-muted); font-family: var(--font-mono); font-size: var(--text-code); line-height: var(--text-code--line-height); }
@@ -305,6 +305,10 @@
305
305
  @container composer (width < 36rem) {
306
306
  .composer-hints-extra { display: none; }
307
307
  }
308
+ /* The longest line, in Dutch on a 14px root, needs 38rem; until then `#` goes first and the rest stay. */
309
+ @container composer (width < 39rem) {
310
+ .composer-hint-references { display: none; }
311
+ }
308
312
  /* Markdown stays source while you type: the markers stay put and dim, and what they wrap takes its look. */
309
313
  .composer-input .cm-md-mark { color: var(--text-faint); }
310
314
  .composer-input .cm-md-strong, .composer-input .cm-md-heading { font-weight: 600; }