@adecore/agents-react 0.37.2 → 0.37.3

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 (98) hide show
  1. package/dist/chat/chat-client.d.ts +1 -0
  2. package/dist/chat/chat-client.js +2 -1
  3. package/dist/chat/chat-references.d.ts +16 -1
  4. package/dist/chat/chat-references.js +29 -3
  5. package/dist/chat/drafts.d.ts +2 -0
  6. package/dist/chat/drafts.js +21 -5
  7. package/dist/chat/index.d.ts +1 -1
  8. package/dist/chat/mentions.d.ts +31 -14
  9. package/dist/chat/mentions.js +186 -41
  10. package/dist/chat/stash.d.ts +1 -0
  11. package/dist/chat/stash.js +4 -2
  12. package/dist/chat/ui/Composer.js +438 -429
  13. package/dist/chat/ui/ComposerInput.d.ts +1 -0
  14. package/dist/chat/ui/ComposerInput.js +2 -0
  15. package/dist/chat/ui/Markdown.d.ts +3 -1
  16. package/dist/chat/ui/Markdown.js +194 -120
  17. package/dist/chat/ui/MessageActions.js +70 -66
  18. package/dist/chat/ui/ReferenceChip.d.ts +15 -0
  19. package/dist/chat/ui/ReferenceChip.js +255 -0
  20. package/dist/chat/ui/Timeline.js +52 -29
  21. package/dist/chat/ui/TimelineMenu.js +84 -78
  22. package/dist/chat/ui/chip-clipboard.d.ts +9 -0
  23. package/dist/chat/ui/chip-clipboard.js +105 -0
  24. package/dist/chat/ui/chips.d.ts +5 -0
  25. package/dist/chat/ui/chips.js +15 -1
  26. package/dist/chat/ui/composer/ComposerMenu.js +140 -79
  27. package/dist/chat/ui/composer/DraftParts.d.ts +0 -4
  28. package/dist/chat/ui/composer/DraftParts.js +0 -41
  29. package/dist/chat/ui/composer/chip-paste.d.ts +15 -0
  30. package/dist/chat/ui/composer/chip-paste.js +104 -0
  31. package/dist/chat/ui/composer/chips.d.ts +5 -0
  32. package/dist/chat/ui/composer/chips.js +59 -9
  33. package/dist/chat/ui/composer/key-handler.js +9 -0
  34. package/dist/chat/ui/composer/use-composer-draft.d.ts +0 -1
  35. package/dist/chat/ui/composer/use-composer-draft.js +2 -10
  36. package/dist/chat/ui/composer/use-composer-menus.d.ts +12 -2
  37. package/dist/chat/ui/composer/use-composer-menus.js +192 -149
  38. package/dist/chat/ui/composer/use-composer-submit.js +17 -12
  39. package/dist/chat/ui/composer/use-draft-files.d.ts +7 -1
  40. package/dist/chat/ui/composer/use-draft-files.js +90 -58
  41. package/dist/chat/ui/composer/use-take-back.js +2 -1
  42. package/dist/chat/ui/index.d.ts +0 -1
  43. package/dist/chat/ui/index.js +0 -1
  44. package/dist/chat/ui/reference-icons.d.ts +3 -0
  45. package/dist/chat/ui/reference-icons.js +15 -0
  46. package/dist/chat/ui/reference-lookup.d.ts +7 -0
  47. package/dist/chat/ui/reference-lookup.js +6 -0
  48. package/dist/chat/ui/rehype-chips.d.ts +8 -1
  49. package/dist/chat/ui/rehype-chips.js +35 -11
  50. package/dist/chat/ui/rows/MessageRows.js +218 -158
  51. package/dist/chat/ui/thread-references.d.ts +4 -0
  52. package/dist/chat/ui/thread-references.js +78 -0
  53. package/dist/host-hooks.d.ts +2 -0
  54. package/dist/host-hooks.js +7 -0
  55. package/dist/host.d.ts +3 -0
  56. package/dist/locales/en/agent-chat.d.ts +20 -3
  57. package/dist/locales/en/agent-chat.js +24 -7
  58. package/dist/locales/nl/agent-chat.d.ts +20 -3
  59. package/dist/locales/nl/agent-chat.js +24 -7
  60. package/package.json +8 -8
  61. package/src/chat/chat-client.ts +4 -1
  62. package/src/chat/chat-references.ts +44 -3
  63. package/src/chat/drafts.ts +24 -6
  64. package/src/chat/index.ts +1 -1
  65. package/src/chat/mentions.ts +202 -36
  66. package/src/chat/stash.ts +6 -2
  67. package/src/chat/ui/Composer.tsx +14 -4
  68. package/src/chat/ui/ComposerInput.tsx +4 -0
  69. package/src/chat/ui/Markdown.tsx +57 -25
  70. package/src/chat/ui/MessageActions.tsx +5 -2
  71. package/src/chat/ui/ReferenceChip.tsx +74 -0
  72. package/src/chat/ui/Timeline.tsx +24 -2
  73. package/src/chat/ui/TimelineMenu.tsx +7 -3
  74. package/src/chat/ui/chip-clipboard.ts +115 -0
  75. package/src/chat/ui/chips.ts +20 -1
  76. package/src/chat/ui/composer/ComposerMenu.tsx +53 -37
  77. package/src/chat/ui/composer/DraftParts.tsx +0 -12
  78. package/src/chat/ui/composer/chip-paste.ts +122 -0
  79. package/src/chat/ui/composer/chips.ts +60 -10
  80. package/src/chat/ui/composer/key-handler.ts +9 -0
  81. package/src/chat/ui/composer/use-composer-draft.ts +1 -7
  82. package/src/chat/ui/composer/use-composer-menus.ts +68 -29
  83. package/src/chat/ui/composer/use-composer-submit.ts +13 -6
  84. package/src/chat/ui/composer/use-draft-files.ts +39 -5
  85. package/src/chat/ui/composer/use-take-back.ts +2 -1
  86. package/src/chat/ui/index.ts +0 -1
  87. package/src/chat/ui/reference-icons.ts +17 -0
  88. package/src/chat/ui/reference-lookup.ts +13 -0
  89. package/src/chat/ui/rehype-chips.ts +38 -13
  90. package/src/chat/ui/rows/MessageRows.tsx +88 -64
  91. package/src/chat/ui/thread-references.ts +47 -0
  92. package/src/host-hooks.ts +9 -0
  93. package/src/host.ts +6 -1
  94. package/src/locales/en/agent-chat.ts +24 -7
  95. package/src/locales/nl/agent-chat.ts +24 -7
  96. package/dist/chat/ui/ChatReferenceChip.d.ts +0 -4
  97. package/dist/chat/ui/ChatReferenceChip.js +0 -110
  98. package/src/chat/ui/ChatReferenceChip.tsx +0 -26
@@ -18,7 +18,10 @@ import { useChatScope } from '../../../scope';
18
18
  import { splitQuote } from '../../quote';
19
19
  import { jumpToTimelineItem } from '../../timeline-scroll';
20
20
  import { useProviders } from '../../../state/providers';
21
- import { ChatReferenceChip } from '../ChatReferenceChip';
21
+ import { referenceTokens } from '../../chat-references';
22
+ import { presentReferences } from '../../mentions';
23
+ import { ReferenceChip } from '../ReferenceChip';
24
+ import { ReferenceLookupContext } from '../reference-lookup';
22
25
  import { ImageThumb } from '../ImageView';
23
26
  import { Markdown, MessageMarkdown, ReplyMarkdown } from '../Markdown';
24
27
  import { FadingWords } from '../FadingWords';
@@ -34,6 +37,8 @@ import { useOpenForFind } from '../find-reveal';
34
37
  import { ReplyContext, UiReplyNavigationContext } from '../reply-context';
35
38
  import { UiReply } from '../intelligent-ui/UiReply';
36
39
  import { useHostAttachmentUrl, useHostChatPlace, useHostReplyAuthor, useHostStreaming } from '../../../host-hooks';
40
+ import { copySelectionWithChips } from '../chip-clipboard';
41
+ import { useReferenceLookup } from '../thread-references';
37
42
 
38
43
  // A long prompt folds so the answer stays in view; the reader can open it.
39
44
  const USER_FOLD_LINES = 8;
@@ -89,9 +94,14 @@ export function UserRow({ chatId, item }: { chatId: string; item: ChatUserItem }
89
94
  const [open, setOpen] = useState(false);
90
95
  const long = item.text.split('\n').length > USER_FOLD_LINES || item.text.length > USER_FOLD_CHARS;
91
96
  const attachments = item.attachments ?? [];
92
- const chats = item.chats ?? [];
93
97
  const [missing, setMissing] = useState(false);
94
98
  const { keyOf } = useChatScope();
99
+ const lookup = useReferenceLookup(chatId);
100
+ const referenced = [...(item.chats ?? []), ...(item.references ?? [])];
101
+ const references = referenceTokens(referenced, lookup.items);
102
+ // A chat attached before `#` existed, or a view renamed or gone since, is not in the text; it stands beside it.
103
+ const placed = presentReferences(item.text, referenced, references);
104
+ const beside = referenced.filter((id) => !placed.includes(id));
95
105
  useOpenForFind(item.id, 'text', setOpen);
96
106
  // A quote only leads somewhere when the message still opens with the blockquote it was sent with.
97
107
  const quoted = item.quoteSource === undefined ? null : splitQuote(item.text);
@@ -104,65 +114,69 @@ export function UserRow({ chatId, item }: { chatId: string; item: ChatUserItem }
104
114
  }
105
115
  }
106
116
  return (
107
- <div data-find-item={item.id} className="flex flex-col items-end">
108
- <MessageHeading>{t('rows.user.heading')}</MessageHeading>
109
- {attachments.length > 0 && (
110
- <div className="mb-1.5 flex max-w-[80%] flex-wrap justify-end gap-1.5">
111
- {attachments.map((attachment) =>
112
- isImageAttachment(attachment.mime) ? (
113
- <AttachmentThumb key={attachment.id} chatId={chatId} attachment={attachment} />
114
- ) : (
115
- <AttachmentLink key={attachment.id} chatId={chatId} attachment={attachment} />
116
- )
117
- )}
118
- </div>
119
- )}
120
- {chats.length > 0 && (
121
- <div className="mb-1.5 flex max-w-[80%] flex-wrap justify-end gap-1.5">
122
- {chats.map((id) => (
123
- <ChatReferenceChip key={id} chatId={id} />
124
- ))}
125
- </div>
126
- )}
127
- {item.uiChoice !== undefined && <ChoiceLine chatId={chatId} choice={item.uiChoice} />}
128
- {item.text !== '' && (
129
- <div className="relative max-w-[80%] rounded-2xl bg-surface-active px-3.5 py-2.5 text-sm wrap-anywhere text-text select-text">
130
- <div data-find-field="text" className={clsx(long && !open && FOLD)}>
131
- {quoted !== null && source !== undefined ? (
132
- <>
133
- {/* A div, since the quote is block markdown and a button holds none. */}
134
- <Tooltip label={t('composer.quote.goToSource')}>
135
- <div
136
- role="button"
137
- tabIndex={0}
138
- className="mb-2 cursor-pointer rounded-sm border-l-2 border-border-strong pl-2.5 text-text-muted hover:bg-text/5 hover:text-text focus-visible:outline-2 focus-visible:outline-accent"
139
- onClick={goToSource}
140
- onKeyDown={(e) => {
141
- if (e.key === 'Enter' || e.key === ' ') {
142
- e.preventDefault();
143
- goToSource();
144
- }
145
- }}
146
- >
147
- <MessageMarkdown text={quoted.quote} />
148
- </div>
149
- </Tooltip>
150
- {missing && <div className="mb-2 text-xs text-text-faint">{t('rows.user.quoteGone')}</div>}
151
- {quoted.rest !== '' && <MessageMarkdown text={quoted.rest} mentions={item.mentions} skills={item.skills} />}
152
- </>
153
- ) : (
154
- <MessageMarkdown text={item.text} mentions={item.mentions} skills={item.skills} />
117
+ <ReferenceLookupContext value={lookup}>
118
+ <div data-find-item={item.id} className="flex flex-col items-end" onCopy={(e) => copySelectionWithChips(e.nativeEvent)}>
119
+ <MessageHeading>{t('rows.user.heading')}</MessageHeading>
120
+ {attachments.length > 0 && (
121
+ <div className="mb-1.5 flex max-w-[80%] flex-wrap justify-end gap-1.5">
122
+ {attachments.map((attachment) =>
123
+ isImageAttachment(attachment.mime) ? (
124
+ <AttachmentThumb key={attachment.id} chatId={chatId} attachment={attachment} />
125
+ ) : (
126
+ <AttachmentLink key={attachment.id} chatId={chatId} attachment={attachment} />
127
+ )
155
128
  )}
156
129
  </div>
157
- {long && (
158
- <button className="mt-1 flex items-center gap-1 text-xs text-text-muted hover:text-text" onClick={() => setOpen((o) => !o)}>
159
- <Icon icon={ChevronDown} size={12} className={clsx('transition-transform', open && 'rotate-180')} />{' '}
160
- {open ? t('rows.user.showLess') : t('rows.user.showAll')}
161
- </button>
162
- )}
163
- </div>
164
- )}
165
- </div>
130
+ )}
131
+ {beside.length > 0 && (
132
+ <div className="mb-1.5 flex max-w-[80%] flex-wrap justify-end gap-1.5">
133
+ {beside.map((id) => (
134
+ <ReferenceChip key={id} id={id} />
135
+ ))}
136
+ </div>
137
+ )}
138
+ {item.uiChoice !== undefined && <ChoiceLine chatId={chatId} choice={item.uiChoice} />}
139
+ {item.text !== '' && (
140
+ <div className="relative max-w-[80%] rounded-2xl bg-surface-active px-3.5 py-2.5 text-sm wrap-anywhere text-text select-text">
141
+ <div data-find-field="text" className={clsx(long && !open && FOLD)}>
142
+ {quoted !== null && source !== undefined ? (
143
+ <>
144
+ {/* A div, since the quote is block markdown and a button holds none. */}
145
+ <Tooltip label={t('composer.quote.goToSource')}>
146
+ <div
147
+ role="button"
148
+ tabIndex={0}
149
+ className="mb-2 cursor-pointer rounded-sm border-l-2 border-border-strong pl-2.5 text-text-muted hover:bg-text/5 hover:text-text focus-visible:outline-2 focus-visible:outline-accent"
150
+ onClick={goToSource}
151
+ onKeyDown={(e) => {
152
+ if (e.key === 'Enter' || e.key === ' ') {
153
+ e.preventDefault();
154
+ goToSource();
155
+ }
156
+ }}
157
+ >
158
+ <MessageMarkdown text={quoted.quote} />
159
+ </div>
160
+ </Tooltip>
161
+ {missing && <div className="mb-2 text-xs text-text-faint">{t('rows.user.quoteGone')}</div>}
162
+ {quoted.rest !== '' && (
163
+ <MessageMarkdown text={quoted.rest} mentions={item.mentions} skills={item.skills} references={references} />
164
+ )}
165
+ </>
166
+ ) : (
167
+ <MessageMarkdown text={item.text} mentions={item.mentions} skills={item.skills} references={references} />
168
+ )}
169
+ </div>
170
+ {long && (
171
+ <button className="mt-1 flex items-center gap-1 text-xs text-text-muted hover:text-text" onClick={() => setOpen((o) => !o)}>
172
+ <Icon icon={ChevronDown} size={12} className={clsx('transition-transform', open && 'rotate-180')} />{' '}
173
+ {open ? t('rows.user.showLess') : t('rows.user.showAll')}
174
+ </button>
175
+ )}
176
+ </div>
177
+ )}
178
+ </div>
179
+ </ReferenceLookupContext>
166
180
  );
167
181
  }
168
182
 
@@ -262,10 +276,12 @@ function Writing() {
262
276
  * A reply. A word at a time, it follows the text as it arrives. A block at a time, the blocks that
263
277
  * closed are drawn and fade in as they land, with "Writing…" where the next one will stand. Whole,
264
278
  * it says it is being written and fades in once it is done. Only a row that saw the reply being
265
- * written fades anything: an old reply scrolled back into view just stands there.
279
+ * written fades anything: an old reply scrolled back into view just stands there. A `#Name` it
280
+ * spells for a view, node or chat of the project is a chip that opens it.
266
281
  */
267
282
  export function AssistantRow({ chatId, item: derived }: { chatId: string; item: ChatAssistantItem }) {
268
283
  const item = useCurrentItem(chatId, derived);
284
+ const lookup = useReferenceLookup(chatId);
269
285
  const scope = useChatScope();
270
286
  const context = useContext(ReplyContext);
271
287
  const reply = context === null && !item.parentToolUseId ? { scopeId: scope.id, chatId, itemId: item.id, streaming: item.streaming } : undefined;
@@ -295,11 +311,13 @@ export function AssistantRow({ chatId, item: derived }: { chatId: string; item:
295
311
  if (mode === 'blocks') {
296
312
  const settled = item.streaming ? settledBlocksText(item.text) : item.text;
297
313
  return (
298
- <div data-find-item={item.id} className="-mx-1 px-1 pb-2">
314
+ <div data-find-item={item.id} className="-mx-1 px-1 pb-2" onCopy={(e) => copySelectionWithChips(e.nativeEvent)}>
299
315
  <ReplyHeading chatId={chatId} />
300
316
  {settled !== '' && (
301
317
  <div data-find-field="text" data-quote-answer className="contents">
302
- <ReplyMarkdown text={settled} streaming={false} arriving={sawWriting} reply={reply} />
318
+ <ReferenceLookupContext value={lookup}>
319
+ <ReplyMarkdown text={settled} streaming={false} arriving={sawWriting} reply={reply} />
320
+ </ReferenceLookupContext>
303
321
  </div>
304
322
  )}
305
323
  {item.streaming && <Writing />}
@@ -315,10 +333,16 @@ export function AssistantRow({ chatId, item: derived }: { chatId: string; item:
315
333
  );
316
334
  }
317
335
  return (
318
- <div data-find-item={item.id} className={clsx('-mx-1 px-1 pb-2', mode === 'whole' && sawWriting && WHOLE_FADE_CLASS)}>
336
+ <div
337
+ data-find-item={item.id}
338
+ className={clsx('-mx-1 px-1 pb-2', mode === 'whole' && sawWriting && WHOLE_FADE_CLASS)}
339
+ onCopy={(e) => copySelectionWithChips(e.nativeEvent)}
340
+ >
319
341
  <ReplyHeading chatId={chatId} />
320
342
  <div data-find-field="text" data-quote-answer className="contents">
321
- <ReplyMarkdown text={reveal.text} streaming={reveal.active} reply={reply} />
343
+ <ReferenceLookupContext value={lookup}>
344
+ <ReplyMarkdown text={reveal.text} streaming={reveal.active} reply={reply} />
345
+ </ReferenceLookupContext>
322
346
  </div>
323
347
  {live && item.text === '' && <span className="inline-block h-3.5 w-1.5 animate-pulse rounded-sm bg-text-faint align-middle" />}
324
348
  </div>
@@ -0,0 +1,47 @@
1
+ import type { ChatItem } from '@adecore/agent-contracts';
2
+ import { useChatHost } from '../../host';
3
+ import { useHostReferables } from '../../host-hooks';
4
+ import { useChatScope } from '../../scope';
5
+ import { useChatRow } from '../../state/chats';
6
+ import type { ReferenceLookup } from './reference-lookup';
7
+
8
+ const referencedOf = new WeakMap<Record<string, ChatItem>, string>();
9
+
10
+ /*
11
+ * The ids a person pointed at with `#` in a thread, one per line. A string, so the selector that reads
12
+ * it answers the same value until a message with another one comes; the structure a streamed word
13
+ * leaves alone is what it is cached on.
14
+ */
15
+ export function threadReferencedKey(structure: Record<string, ChatItem> | undefined): string {
16
+ if (structure === undefined) {
17
+ return '';
18
+ }
19
+ const cached = referencedOf.get(structure);
20
+ if (cached !== undefined) {
21
+ return cached;
22
+ }
23
+ const ids = new Set<string>();
24
+ for (const item of Object.values(structure)) {
25
+ if (item.kind === 'user') {
26
+ for (const id of [...(item.chats ?? []), ...(item.references ?? [])]) {
27
+ ids.add(id);
28
+ }
29
+ }
30
+ }
31
+ const key = [...ids].join('\n');
32
+ referencedOf.set(structure, key);
33
+ return key;
34
+ }
35
+
36
+ /* What the views, nodes and chats of a thread stand for now, and how one opens, for the rows that draw chips. */
37
+ export function useReferenceLookup(chatId: string): ReferenceLookup {
38
+ const { id: scopeId } = useChatScope();
39
+ const { openReference } = useChatHost();
40
+ const referables = useHostReferables(scopeId, chatId);
41
+ const key = useChatRow(chatId, (chat) => threadReferencedKey(chat?.structure));
42
+ return {
43
+ items: referables.items,
44
+ open: openReference ? (id: string) => openReference(scopeId, id) : null,
45
+ referenced: key === '' ? [] : key.split('\n')
46
+ };
47
+ }
package/src/host-hooks.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  * key, so they never change under a mounted view; only these wrappers go uncompiled for it.
7
7
  */
8
8
  import type { ProviderPlatform } from '@adecore/agent-contracts';
9
+ import { referablesOfChats, type Referables } from './chat/chat-references';
9
10
  import { useChatHost, type ChatHost, type CommandLook } from './host';
10
11
 
11
12
  export function useHostCodeMode(): 'light' | 'dark' {
@@ -48,6 +49,14 @@ export function useHostReferableChats(): ReturnType<ChatHost['useReferableChats'
48
49
  return useChatHost().useReferableChats();
49
50
  }
50
51
 
52
+ const useReferablesFromChats = (_scopeId: string, _chatId: string): Referables => referablesOfChats(useHostReferableChats());
53
+
54
+ /* A host without views of its own offers its chats. */
55
+ export function useHostReferables(scopeId: string, chatId: string): Referables {
56
+ const useReferables = useChatHost().useReferables ?? useReferablesFromChats;
57
+ return useReferables(scopeId, chatId);
58
+ }
59
+
51
60
  export function useHostLoginBlocked(...args: Parameters<ChatHost['useLoginBlocked']>): ReturnType<ChatHost['useLoginBlocked']> {
52
61
  return useChatHost().useLoginBlocked(...args);
53
62
  }
package/src/host.ts CHANGED
@@ -18,6 +18,7 @@ import type {
18
18
  ProviderPlatform
19
19
  } from '@adecore/agent-contracts';
20
20
  import { isApplePlatform } from '@adecore/ui';
21
+ import type { Referables } from './chat/chat-references';
21
22
  import type { TimelineRow } from './chat/logic/timeline';
22
23
  import type { FindReveal } from './chat/ui/find-reveal';
23
24
  import type { PromptAction } from './prompts/logic/prompts';
@@ -379,8 +380,12 @@ export interface ChatHost {
379
380
  render(prompt: HostPrompt, props: PromptViewProps): ReactNode;
380
381
  answer(prompt: HostPrompt, action: PromptAction): Promise<void>;
381
382
  };
382
- /* Other chats a message may point at with `@`, beside the files. */
383
+ /* Other chats a message may point at with `#`, for a host that has no views; `useReferables` takes over where it is given. */
383
384
  useReferableChats(): ReadonlyArray<{ id: string; title: string }>;
385
+ /* The views and nodes a message of this chat may point at with `#`, under the names they have right now. */
386
+ useReferables?(scopeId: string, chatId: string): Referables;
387
+ /* Opens a view or zooms to a node a message points at; left out, a chip opens nothing. */
388
+ openReference?(scopeId: string, id: string): void;
384
389
  /* Opens the CLI's own login for an account, somewhere the app can run a command; null offers none. */
385
390
  openLogin: ((scopeId: string, kind: AgentKind, accountId: string, name: string) => Promise<void>) | null;
386
391
  /* Why a login cannot start from here right now, or null when it can. */
@@ -16,10 +16,9 @@ export default {
16
16
  unreadable: 'Could not read {{name}}',
17
17
  unreadableThumbnail: 'Could not read the thumbnail'
18
18
  },
19
- chatReference: {
20
- gone: 'Chat not in this project',
21
- untitled: 'Untitled chat',
22
- remove: 'Remove {{title}}'
19
+ references: {
20
+ gone: 'Not in this project',
21
+ untitled: 'Untitled'
23
22
  },
24
23
  fork: {
25
24
  refusal: {
@@ -304,7 +303,8 @@ export default {
304
303
  menu: {
305
304
  commands: 'Commands',
306
305
  skills: 'Skills',
307
- mentions: 'Mentions'
306
+ mentions: 'Mentions',
307
+ references: 'Views and nodes'
308
308
  },
309
309
  held: {
310
310
  question: 'Question waiting. Opens when you pause typing.',
@@ -349,10 +349,27 @@ export default {
349
349
  mentions: {
350
350
  here: 'Files in this folder',
351
351
  files: 'Files',
352
- chats: 'Chats in this project',
353
- noMatch: 'No files or chats match',
352
+ noMatch: 'No files match',
354
353
  empty: 'No files here'
355
354
  },
355
+ references: {
356
+ canvas: 'On this canvas',
357
+ views: 'Views',
358
+ noMatch: 'No view or node matches',
359
+ kinds: {
360
+ canvas: 'canvas',
361
+ chat: 'chat',
362
+ terminal: 'terminal',
363
+ note: 'note',
364
+ text: 'text',
365
+ drawing: 'drawing',
366
+ diagram: 'diagram',
367
+ browser: 'browser',
368
+ device: 'device',
369
+ file: 'file',
370
+ database: 'table'
371
+ }
372
+ },
356
373
  queue: {
357
374
  attachments_one: '{{count}} attachment',
358
375
  attachments_other: '{{count}} attachments',
@@ -16,10 +16,9 @@ export default {
16
16
  unreadable: 'Kon {{name}} niet lezen',
17
17
  unreadableThumbnail: 'Kon de miniatuur niet lezen'
18
18
  },
19
- chatReference: {
20
- gone: 'Chat niet in dit project',
21
- untitled: 'Naamloze chat',
22
- remove: '{{title}} verwijderen'
19
+ references: {
20
+ gone: 'Niet in dit project',
21
+ untitled: 'Naamloos'
23
22
  },
24
23
  fork: {
25
24
  refusal: {
@@ -304,7 +303,8 @@ export default {
304
303
  menu: {
305
304
  commands: "Commando's",
306
305
  skills: 'Skills',
307
- mentions: 'Vermeldingen'
306
+ mentions: 'Vermeldingen',
307
+ references: 'Views en nodes'
308
308
  },
309
309
  held: {
310
310
  question: 'Er wacht een vraag. Opent zodra je stopt met typen.',
@@ -349,10 +349,27 @@ export default {
349
349
  mentions: {
350
350
  here: 'Bestanden in deze map',
351
351
  files: 'Bestanden',
352
- chats: 'Chats in dit project',
353
- noMatch: 'Geen bestanden of chats gevonden',
352
+ noMatch: 'Geen bestanden gevonden',
354
353
  empty: 'Hier staan geen bestanden'
355
354
  },
355
+ references: {
356
+ canvas: 'Op dit canvas',
357
+ views: 'Views',
358
+ noMatch: 'Geen view of node gevonden',
359
+ kinds: {
360
+ canvas: 'canvas',
361
+ chat: 'chat',
362
+ terminal: 'terminal',
363
+ note: 'notitie',
364
+ text: 'tekst',
365
+ drawing: 'tekening',
366
+ diagram: 'diagram',
367
+ browser: 'browser',
368
+ device: 'apparaat',
369
+ file: 'bestand',
370
+ database: 'tabel'
371
+ }
372
+ },
356
373
  queue: {
357
374
  attachments_one: '{{count}} bijlage',
358
375
  attachments_other: '{{count}} bijlagen',
@@ -1,4 +0,0 @@
1
- export declare function ChatReferenceChip({ chatId, onRemove }: {
2
- chatId: string;
3
- onRemove?: () => void;
4
- }): import("react").JSX.Element;
@@ -1,110 +0,0 @@
1
- import { c as _c } from "react/compiler-runtime";
2
- import clsx from 'clsx';
3
- import { useTranslation } from 'react-i18next';
4
- import { MessageSquare, X } from 'lucide-react';
5
- import { CHIP_IN_MESSAGE, MENTION_TONE } from './chips.js';
6
- import { Icon, Tooltip } from '@adecore/ui';
7
- import { useHostReferableChats } from '../../host-hooks.js';
8
- /* A chat attached to a message, under the title it has now rather than the one it had when it was attached. */
9
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
- export function ChatReferenceChip(t0) {
11
- const $ = _c(19);
12
- const {
13
- chatId,
14
- onRemove
15
- } = t0;
16
- const {
17
- t
18
- } = useTranslation("agent-chat");
19
- const t1 = useHostReferableChats();
20
- let t2;
21
- if ($[0] !== chatId || $[1] !== t1) {
22
- let t3;
23
- if ($[3] !== chatId) {
24
- t3 = candidate => candidate.id === chatId;
25
- $[3] = chatId;
26
- $[4] = t3;
27
- } else {
28
- t3 = $[4];
29
- }
30
- t2 = t1.find(t3);
31
- $[0] = chatId;
32
- $[1] = t1;
33
- $[2] = t2;
34
- } else {
35
- t2 = $[2];
36
- }
37
- const chat = t2;
38
- let t3;
39
- if ($[5] !== chat || $[6] !== t) {
40
- t3 = chat === undefined ? t("chatReference.gone") : chat.title || t("chatReference.untitled");
41
- $[5] = chat;
42
- $[6] = t;
43
- $[7] = t3;
44
- } else {
45
- t3 = $[7];
46
- }
47
- const title = t3;
48
- let t4;
49
- let t5;
50
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
51
- t4 = clsx(MENTION_TONE, CHIP_IN_MESSAGE);
52
- t5 = /*#__PURE__*/_jsx(Icon, {
53
- icon: MessageSquare,
54
- size: 12,
55
- className: "shrink-0"
56
- });
57
- $[8] = t4;
58
- $[9] = t5;
59
- } else {
60
- t4 = $[8];
61
- t5 = $[9];
62
- }
63
- let t6;
64
- if ($[10] !== title) {
65
- t6 = /*#__PURE__*/_jsx("span", {
66
- className: "truncate",
67
- children: title
68
- });
69
- $[10] = title;
70
- $[11] = t6;
71
- } else {
72
- t6 = $[11];
73
- }
74
- let t7;
75
- if ($[12] !== onRemove || $[13] !== t || $[14] !== title) {
76
- t7 = onRemove && /*#__PURE__*/_jsx(Tooltip, {
77
- label: t("chatReference.remove", {
78
- title
79
- }),
80
- name: true,
81
- children: /*#__PURE__*/_jsx("button", {
82
- className: "-mr-0.5 shrink-0 rounded-sm opacity-70 hover:opacity-100",
83
- onClick: onRemove,
84
- children: /*#__PURE__*/_jsx(Icon, {
85
- icon: X,
86
- size: 12
87
- })
88
- })
89
- });
90
- $[12] = onRemove;
91
- $[13] = t;
92
- $[14] = title;
93
- $[15] = t7;
94
- } else {
95
- t7 = $[15];
96
- }
97
- let t8;
98
- if ($[16] !== t6 || $[17] !== t7) {
99
- t8 = /*#__PURE__*/_jsxs("span", {
100
- className: t4,
101
- children: [t5, t6, t7]
102
- });
103
- $[16] = t6;
104
- $[17] = t7;
105
- $[18] = t8;
106
- } else {
107
- t8 = $[18];
108
- }
109
- return t8;
110
- }
@@ -1,26 +0,0 @@
1
- import clsx from 'clsx';
2
- import { useTranslation } from 'react-i18next';
3
- import { MessageSquare, X } from 'lucide-react';
4
- import { CHIP_IN_MESSAGE, MENTION_TONE } from './chips';
5
- import { Icon, Tooltip } from '@adecore/ui';
6
- import { useHostReferableChats } from '../../host-hooks';
7
-
8
- /* A chat attached to a message, under the title it has now rather than the one it had when it was attached. */
9
- export function ChatReferenceChip({ chatId, onRemove }: { chatId: string; onRemove?: () => void }) {
10
- const { t } = useTranslation('agent-chat');
11
- const chat = useHostReferableChats().find((candidate) => candidate.id === chatId);
12
- const title = chat === undefined ? t('chatReference.gone') : chat.title || t('chatReference.untitled');
13
- return (
14
- <span className={clsx(MENTION_TONE, CHIP_IN_MESSAGE)}>
15
- <Icon icon={MessageSquare} size={12} className="shrink-0" />
16
- <span className="truncate">{title}</span>
17
- {onRemove && (
18
- <Tooltip label={t('chatReference.remove', { title })} name>
19
- <button className="-mr-0.5 shrink-0 rounded-sm opacity-70 hover:opacity-100" onClick={onRemove}>
20
- <Icon icon={X} size={12} />
21
- </button>
22
- </Tooltip>
23
- )}
24
- </span>
25
- );
26
- }