@adecore/agents-react 0.51.0 → 0.52.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 (41) hide show
  1. package/dist/chat/index.d.ts +2 -1
  2. package/dist/chat/index.js +2 -1
  3. package/dist/chat/logic/command-looks.d.ts +17 -5
  4. package/dist/chat/logic/command-looks.js +35 -7
  5. package/dist/chat/logic/timeline.d.ts +6 -4
  6. package/dist/chat/logic/timeline.js +19 -21
  7. package/dist/chat/logic/tool-looks.d.ts +16 -0
  8. package/dist/chat/logic/tool-looks.js +188 -0
  9. package/dist/chat/ui/ShellCommand.d.ts +2 -1
  10. package/dist/chat/ui/ShellCommand.js +73 -22
  11. package/dist/chat/ui/SubagentTimeline.js +5 -2
  12. package/dist/chat/ui/Timeline.js +2 -1
  13. package/dist/chat/ui/rows/RowContainer.js +26 -23
  14. package/dist/chat/ui/rows/WorkRows.d.ts +3 -4
  15. package/dist/chat/ui/rows/WorkRows.js +592 -519
  16. package/dist/chat/ui/rows/row-rhythm.d.ts +2 -2
  17. package/dist/chat/ui/rows/row-rhythm.js +9 -6
  18. package/dist/chat/ui/thread-references.d.ts +1 -0
  19. package/dist/chat/ui/thread-references.js +4 -3
  20. package/dist/host.d.ts +28 -0
  21. package/dist/index.d.ts +1 -1
  22. package/dist/locales/en/agent-chat.d.ts +3 -0
  23. package/dist/locales/en/agent-chat.js +3 -0
  24. package/dist/locales/nl/agent-chat.d.ts +3 -0
  25. package/dist/locales/nl/agent-chat.js +3 -0
  26. package/package.json +8 -8
  27. package/src/chat/index.ts +2 -1
  28. package/src/chat/logic/command-looks.ts +51 -10
  29. package/src/chat/logic/timeline.ts +28 -24
  30. package/src/chat/logic/tool-looks.ts +228 -0
  31. package/src/chat/ui/ShellCommand.tsx +33 -6
  32. package/src/chat/ui/SubagentTimeline.tsx +3 -2
  33. package/src/chat/ui/Timeline.tsx +2 -1
  34. package/src/chat/ui/rows/RowContainer.tsx +4 -2
  35. package/src/chat/ui/rows/WorkRows.tsx +46 -33
  36. package/src/chat/ui/rows/row-rhythm.ts +9 -6
  37. package/src/chat/ui/thread-references.ts +5 -1
  38. package/src/host.ts +51 -0
  39. package/src/index.ts +3 -0
  40. package/src/locales/en/agent-chat.ts +3 -0
  41. package/src/locales/nl/agent-chat.ts +3 -0
package/src/host.ts CHANGED
@@ -262,6 +262,11 @@ export interface CommandName {
262
262
  name: string;
263
263
  /* Drawn before the name, at the size of the detail. */
264
264
  icon?: ReactNode;
265
+ /*
266
+ * The id of the view, node or chat the word stands for, drawn as the `#` chip a message draws for it and
267
+ * opened as that chip opens; `name` is then what the chip says once what it stood for is gone.
268
+ */
269
+ reference?: string;
265
270
  }
266
271
 
267
272
  /* What one run of a program is about, as its look reads it from the words. */
@@ -327,6 +332,50 @@ export interface CommandLook {
327
332
  sent?(call: CommandLookCall): CommandLookSent | null;
328
333
  }
329
334
 
335
+ /* What one call of a look's MCP server is about, as its look reads it from the tool and its input. */
336
+ export interface ToolLookMatch {
337
+ /* Drawn where the tool name is, after the brand; empty draws the brand alone. */
338
+ label: string;
339
+ /* Words before the input, such as what the tool does. */
340
+ lead?: string;
341
+ /* The fields of the input drawn after the lead as `field=value`, in this order; left out, every field in the input's own order. */
342
+ fields?: readonly string[];
343
+ /* Calls with the same key read as one sentence in a group or a folded turn. */
344
+ group?: { key: string; sentence(count: number): string };
345
+ }
346
+
347
+ /* A call of a look's MCP server that may be a message, as `ToolLook.sent` gets it. */
348
+ export interface ToolLookCall {
349
+ /* The tool's name on its server, without the server. */
350
+ readonly tool: string;
351
+ readonly input: Readonly<Record<string, unknown>>;
352
+ readonly state: 'running' | 'done' | 'error';
353
+ /* What the tool answered, out of any envelope the CLI wraps it in. */
354
+ readonly output: string | null;
355
+ }
356
+
357
+ /*
358
+ * An MCP server the app recognizes in a thread and draws as a tool of its own. A call of one of its tools
359
+ * matches whichever shape the CLI gives it: `mcp__<server>__<tool>`, `<server>/<tool>`, or a generic ACP
360
+ * call titled `<server>__<tool>`, `<server>_<tool>` or `<server>-<tool>` (`mcpCallOf`).
361
+ */
362
+ export interface ToolLook {
363
+ /* The server's name, as the app registers it with the CLIs. */
364
+ server: string;
365
+ /* Drawn in semibold before every label of this look, such as a product name. */
366
+ brand?: string;
367
+ /* The mark in the gutter, drawn in `currentColor` at the size of a tool icon. */
368
+ Mark: ComponentType<{ size: number }>;
369
+ /* What one call is about, from the tool's name on its server and its input; null leaves it the CLI's own tool line. */
370
+ describe(tool: string, input: Readonly<Record<string, unknown>>): ToolLookMatch | null;
371
+ /* Calls of this look under different group keys, as one sentence; left out, such a run reads as tool calls. */
372
+ sentence?(count: number): string;
373
+ /* Names for values in the detail, as `CommandLook.useNames` names words; `option` is the field the value is of. */
374
+ useNames?(scopeId: string, chatId: string): (word: string, option: string | null) => CommandName | null;
375
+ /* The message a call sent; null leaves it a tool line. Asked again as the call goes on. */
376
+ sent?(call: ToolLookCall): CommandLookSent | null;
377
+ }
378
+
330
379
  /*
331
380
  * Where the tiles of a Map come from. The host owns the service and whatever admits a request to it, so
332
381
  * a chat never knows an address, a key or a vendor: it asks for the style of the theme and lets the host
@@ -575,6 +624,8 @@ export interface ChatHost {
575
624
  visuals: VisualHost | null;
576
625
  /* Programs drawn as tools of their own; left out, every shell call reads as itself. */
577
626
  commandLooks?: readonly CommandLook[];
627
+ /* MCP servers whose tools are drawn as tools of their own; left out, every MCP call reads as the CLI names it. */
628
+ toolLooks?: readonly ToolLook[];
578
629
  }
579
630
 
580
631
  const NO_PROMPTS: readonly HostPrompt[] = [];
package/src/index.ts CHANGED
@@ -26,6 +26,9 @@ export {
26
26
  type CommandLookSent,
27
27
  type CommandLookMatch,
28
28
  type CommandName,
29
+ type ToolLook,
30
+ type ToolLookCall,
31
+ type ToolLookMatch,
29
32
  ChatHostProvider,
30
33
  useChatHost,
31
34
  type AccentChoice,
@@ -213,6 +213,7 @@ export default {
213
213
  loadingDiff: 'Loading diff',
214
214
  diffUnavailable: 'Could not load this diff',
215
215
  runningFor: 'running for {{elapsed}}',
216
+ failed: 'Failed',
216
217
  awaitingApproval: 'waiting for you',
217
218
  forksAfter_one: 'Forked after this turn',
218
219
  forksAfter_other: '{{count}} forks after this turn',
@@ -273,6 +274,8 @@ export default {
273
274
  group: {
274
275
  running_one: '{{count}} running',
275
276
  running_other: '{{count}} running',
277
+ failed_one: '{{count}} failed',
278
+ failed_other: '{{count}} failed',
276
279
  tools: {
277
280
  Read_one: 'Read {{count}} file',
278
281
  Read_other: 'Read {{count}} files',
@@ -213,6 +213,7 @@ export default {
213
213
  loadingDiff: 'Diff laden',
214
214
  diffUnavailable: 'Kon deze diff niet laden',
215
215
  runningFor: 'loopt al {{elapsed}}',
216
+ failed: 'Mislukt',
216
217
  awaitingApproval: 'wacht op jou',
217
218
  forksAfter_one: 'Fork na deze turn',
218
219
  forksAfter_other: '{{count}} forks na deze turn',
@@ -273,6 +274,8 @@ export default {
273
274
  group: {
274
275
  running_one: '{{count}} actief',
275
276
  running_other: '{{count}} actief',
277
+ failed_one: '{{count}} mislukt',
278
+ failed_other: '{{count}} mislukt',
276
279
  tools: {
277
280
  Read_one: '{{count}} bestand gelezen',
278
281
  Read_other: '{{count}} bestanden gelezen',