@adecore/agents-react 0.67.0 → 0.68.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 (77) hide show
  1. package/dist/agents/AgentIcon.d.ts +7 -0
  2. package/dist/agents/AgentIcon.js +70 -31
  3. package/dist/chat/logic/timeline.d.ts +2 -0
  4. package/dist/chat/logic/timeline.js +47 -0
  5. package/dist/chat/subagent-list.d.ts +1 -2
  6. package/dist/chat/ui/Composer.js +491 -447
  7. package/dist/chat/ui/Markdown.d.ts +1 -1
  8. package/dist/chat/ui/Markdown.js +277 -203
  9. package/dist/chat/ui/PromptEditor.d.ts +3 -1
  10. package/dist/chat/ui/PromptEditor.js +4 -1
  11. package/dist/chat/ui/Timeline.js +5 -4
  12. package/dist/chat/ui/composer/ComposerMenu.js +22 -12
  13. package/dist/chat/ui/composer/chips.d.ts +2 -1
  14. package/dist/chat/ui/composer/chips.js +44 -1
  15. package/dist/chat/ui/composer/key-handler.d.ts +2 -0
  16. package/dist/chat/ui/composer/key-handler.js +12 -2
  17. package/dist/chat/ui/composer/placeholder.d.ts +2 -1
  18. package/dist/chat/ui/composer/placeholder.js +31 -10
  19. package/dist/chat/ui/composer/use-composer-menus.js +49 -39
  20. package/dist/chat/ui/composer/use-prompt-menus.d.ts +10 -7
  21. package/dist/chat/ui/composer/use-prompt-menus.js +183 -157
  22. package/dist/chat/ui/composer/use-prompt-suggestion.d.ts +16 -0
  23. package/dist/chat/ui/composer/use-prompt-suggestion.js +55 -0
  24. package/dist/chat/ui/index.d.ts +1 -1
  25. package/dist/chat/ui/index.js +1 -1
  26. package/dist/chat/ui/markdown-cache.d.ts +4 -0
  27. package/dist/chat/ui/markdown-cache.js +47 -0
  28. package/dist/chat/ui/reference-lookup.d.ts +2 -1
  29. package/dist/chat/ui/reference-lookup.js +1 -1
  30. package/dist/chat/ui/rows/SubagentRow.js +26 -24
  31. package/dist/chat/ui/rows/TaskRow.d.ts +11 -1
  32. package/dist/chat/ui/rows/TaskRow.js +281 -197
  33. package/dist/chat/ui/thread-references.js +12 -9
  34. package/dist/chat-client.d.ts +3 -1
  35. package/dist/chat-client.js +82 -30
  36. package/dist/chat-sink.d.ts +1 -0
  37. package/dist/host/host-hooks.d.ts +4 -1
  38. package/dist/host/host-hooks.js +11 -0
  39. package/dist/host/host.d.ts +18 -0
  40. package/dist/index.d.ts +1 -1
  41. package/dist/locales/en/agent-chat.d.ts +1 -0
  42. package/dist/locales/en/agent-chat.js +2 -1
  43. package/dist/locales/nl/agent-chat.d.ts +1 -0
  44. package/dist/locales/nl/agent-chat.js +2 -1
  45. package/dist/state/chats.d.ts +2 -0
  46. package/dist/state/chats.js +21 -5
  47. package/dist/theme.css +6 -0
  48. package/package.json +9 -9
  49. package/src/agents/AgentIcon.tsx +6 -2
  50. package/src/chat/logic/timeline.ts +63 -0
  51. package/src/chat/subagent-list.ts +1 -4
  52. package/src/chat/ui/Composer.tsx +15 -2
  53. package/src/chat/ui/Markdown.tsx +97 -55
  54. package/src/chat/ui/PromptEditor.tsx +7 -2
  55. package/src/chat/ui/Timeline.tsx +17 -14
  56. package/src/chat/ui/composer/ComposerMenu.tsx +14 -6
  57. package/src/chat/ui/composer/chips.ts +51 -2
  58. package/src/chat/ui/composer/key-handler.ts +17 -2
  59. package/src/chat/ui/composer/placeholder.ts +14 -3
  60. package/src/chat/ui/composer/use-composer-menus.ts +8 -3
  61. package/src/chat/ui/composer/use-prompt-menus.ts +33 -4
  62. package/src/chat/ui/composer/use-prompt-suggestion.ts +36 -0
  63. package/src/chat/ui/index.ts +1 -1
  64. package/src/chat/ui/markdown-cache.ts +60 -0
  65. package/src/chat/ui/reference-lookup.ts +4 -2
  66. package/src/chat/ui/rows/SubagentRow.tsx +1 -1
  67. package/src/chat/ui/rows/TaskRow.tsx +54 -9
  68. package/src/chat/ui/thread-references.ts +4 -2
  69. package/src/chat-client.ts +79 -22
  70. package/src/chat-sink.ts +6 -1
  71. package/src/host/host-hooks.ts +19 -1
  72. package/src/host/host.ts +41 -0
  73. package/src/index.ts +3 -0
  74. package/src/locales/en/agent-chat.ts +2 -1
  75. package/src/locales/nl/agent-chat.ts +2 -1
  76. package/src/state/chats.ts +22 -6
  77. package/src/theme.css +6 -0
@@ -43,6 +43,8 @@ export interface ChatState {
43
43
  bookmarks?: ChatBookmark[];
44
44
  /* The pages agents published in the chat, as the host last said; absent until it said anything. */
45
45
  visuals?: ChatVisual[];
46
+ /* The next prompt the CLI predicted after the last turn; absent or null while it predicts none. */
47
+ suggestion?: string | null;
46
48
  }
47
49
 
48
50
  /* Rows keyed with the scope's `keyOf`, so a thread says which host it runs on. */
@@ -62,6 +64,7 @@ interface ChatsStore {
62
64
  status(key: string, info: ChatThreadInfo): void;
63
65
  bookmarks(key: string, bookmarks: ChatBookmark[]): void;
64
66
  visuals(key: string, visuals: ChatVisual[]): void;
67
+ suggestion(key: string, suggestion: string | null): void;
65
68
  forget(key: string): void;
66
69
  /* Drops the threads whose key matches, such as every thread of one host. They keep running there; this client is done looking at them. */
67
70
  forgetWhere(matches: (key: string) => boolean): void;
@@ -283,7 +286,7 @@ function applyUpdate(state: ChatState, event: ChatThreadEvent, write: ItemWriter
283
286
  }
284
287
 
285
288
  /* Fields of a held chat that are not part of its thread; a chat this client does not hold stays as it is. */
286
- function withFields(store: ChatsStore, key: string, fields: Pick<ChatState, 'bookmarks' | 'visuals'>): Partial<ChatsStore> {
289
+ function withFields(store: ChatsStore, key: string, fields: Pick<ChatState, 'bookmarks' | 'visuals' | 'suggestion'>): Partial<ChatsStore> {
287
290
  const current = store.byKey[key];
288
291
 
289
292
  if (!current) {
@@ -298,9 +301,15 @@ export const useChats = create<ChatsStore>((set) => ({
298
301
  statusByKey: {},
299
302
  reset(key, info, items, page) {
300
303
  set((s) => {
301
- // The bookmarks and the visuals are not part of the thread; they come in on their own and outlive a reset of it.
302
- const { bookmarks, visuals } = s.byKey[key] ?? {};
303
- const next = { ...stateOf(info, items, page), ...(bookmarks === undefined ? {} : { bookmarks }), ...(visuals === undefined ? {} : { visuals }) };
304
+ // The bookmarks, the visuals and the suggestion are not part of the thread; they come in on their own and outlive a reset of it.
305
+ const { bookmarks, visuals, suggestion } = s.byKey[key] ?? {};
306
+
307
+ const next = {
308
+ ...stateOf(info, items, page),
309
+ ...(bookmarks === undefined ? {} : { bookmarks }),
310
+ ...(visuals === undefined ? {} : { visuals }),
311
+ ...(suggestion === undefined ? {} : { suggestion })
312
+ };
304
313
 
305
314
  return {
306
315
  byKey: { ...s.byKey, [key]: next },
@@ -359,12 +368,15 @@ export const useChats = create<ChatsStore>((set) => ({
359
368
  return { byKey: { ...s.byKey, [key]: { ...stateOf(info, []), historyPending: true } }, statusByKey: withStatus(s.statusByKey, key, info) };
360
369
  }
361
370
 
371
+ // The commands come from the attach and its events; a status may come from a list that left them out.
372
+ const next = { ...info, slashCommands: current.info.slashCommands, skills: current.info.skills };
373
+
362
374
  // An attached client already had this on `chat.event`; writing it again would redraw the thread.
363
- if (sameInfo(current.info, info)) {
375
+ if (sameInfo(current.info, next)) {
364
376
  return {};
365
377
  }
366
378
 
367
- return { byKey: { ...s.byKey, [key]: { ...current, info } }, statusByKey: withStatus(s.statusByKey, key, info) };
379
+ return { byKey: { ...s.byKey, [key]: { ...current, info: next } }, statusByKey: withStatus(s.statusByKey, key, next) };
368
380
  });
369
381
  },
370
382
  bookmarks(key, bookmarks) {
@@ -373,6 +385,9 @@ export const useChats = create<ChatsStore>((set) => ({
373
385
  visuals(key, visuals) {
374
386
  set((s) => withFields(s, key, { visuals }));
375
387
  },
388
+ suggestion(key, suggestion) {
389
+ set((s) => withFields(s, key, { suggestion }));
390
+ },
376
391
  forget(key) {
377
392
  set((s) => {
378
393
  const next = { ...s.byKey };
@@ -399,6 +414,7 @@ export function chatSink(keyOf: (chatId: string) => string): ChatSink {
399
414
  status: (chatId, info) => useChats.getState().status(keyOf(chatId), info),
400
415
  bookmarks: (chatId, bookmarks) => useChats.getState().bookmarks(keyOf(chatId), bookmarks),
401
416
  visuals: (chatId, visuals) => useChats.getState().visuals(keyOf(chatId), visuals),
417
+ suggestion: (chatId, suggestion) => useChats.getState().suggestion(keyOf(chatId), suggestion),
402
418
  forget: (chatId) => useChats.getState().forget(keyOf(chatId))
403
419
  };
404
420
  }
package/src/theme.css CHANGED
@@ -144,6 +144,9 @@
144
144
  /* A word of a reply that just arrived. The duration is REVEAL_FADE_MS in chat/ui/reveal.ts, which
145
145
  keeps the spans until it is over; ease-in-out, because ease-out jumps up and then trails. */
146
146
  .chat-fade { animation: chat-fade 300ms ease-in-out both; }
147
+ /* A reply keeps its spans once the reveal is over; without the animation, a thread hidden and shown
148
+ again does not fade the whole reply in a second time. */
149
+ .chat-markdown[data-faded-in] .chat-fade { animation: none; }
147
150
  /* A whole reply that was written out of sight. */
148
151
  .chat-fade-whole { animation: chat-fade 220ms ease-out both; }
149
152
  /* A block of a reply streamed a block at a time, faded in when it is inserted and never when a
@@ -301,6 +304,9 @@
301
304
  .composer-hints, .composer-hints-extra, .composer-hint { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
302
305
  /* The joiner starts with its own comma, so it sits against the lead without the gap. */
303
306
  .composer-hints-extra { margin-left: -8px; }
307
+ /* A predicted prompt wraps like the text it stands for; its key has no joiner to lean on. */
308
+ .composer-hints.composer-suggestion { display: inline; white-space: normal; }
309
+ .composer-suggestion .composer-hints-extra { margin-left: 8px; }
304
310
  .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
311
  /* The widths of Tailwind's `@md` container variant, which the rest of the composer narrows at. */
306
312
  @container composer (width < 28rem) {