@adecore/agents-react 0.44.3 → 0.45.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.
@@ -561,30 +561,31 @@ export function TurnFoldRow({
561
561
  label,
562
562
  work,
563
563
  expanded,
564
+ expandable,
564
565
  onToggle
565
566
  }: {
566
567
  turn: ChatTurnItem;
567
568
  label: string;
568
569
  work: readonly string[];
569
570
  expanded: boolean;
571
+ /* False when the fold hides nothing a person may see, so it stays a label. */
572
+ expandable: boolean;
570
573
  onToggle(): void;
571
574
  }) {
572
575
  const { commandLooks } = useChatHost();
573
576
  const brands = commandLooks?.flatMap(({ brand }) => (brand === undefined ? [] : [brand])) ?? [];
577
+ const className = clsx(
578
+ 'group group/line -mx-1 mb-2 flex h-7 w-[calc(100%+8px)] min-w-0 items-center gap-2 rounded-md px-1 text-left text-xs text-text-muted',
579
+ expandable && 'hover:bg-surface-hover',
580
+ turn.state === 'error' && 'text-status-error'
581
+ );
574
582
 
575
- return (
576
- <button
577
- className={clsx(
578
- 'group group/line -mx-1 mb-2 flex h-7 w-[calc(100%+8px)] min-w-0 items-center gap-2 rounded-md px-1 text-left text-xs text-text-muted hover:bg-surface-hover',
579
- turn.state === 'error' && 'text-status-error'
580
- )}
581
- aria-expanded={expanded}
582
- onClick={onToggle}
583
- >
583
+ const content = (
584
+ <>
584
585
  <span className={ROW_GUTTER}>
585
- <Icon icon={ChevronRight} size={12} className={clsx('transition-transform', expanded && 'rotate-90')} />
586
+ {expandable && <Icon icon={ChevronRight} size={12} className={clsx('transition-transform', expanded && 'rotate-90')} />}
586
587
  </span>
587
- <span className="shrink-0 group-hover:text-text">{label}</span>
588
+ <span className={clsx('shrink-0', expandable && 'group-hover:text-text')}>{label}</span>
588
589
  {work.length > 0 && (
589
590
  <span className="min-w-0 truncate text-text-faint">
590
591
  {work.map((part, index) => (
@@ -597,6 +598,16 @@ export function TurnFoldRow({
597
598
  )}
598
599
  <span className="grow" />
599
600
  <RowTime at={turn.createdAt} />
601
+ </>
602
+ );
603
+
604
+ if (!expandable) {
605
+ return <div className={className}>{content}</div>;
606
+ }
607
+
608
+ return (
609
+ <button className={className} aria-expanded={expanded} onClick={onToggle}>
610
+ {content}
600
611
  </button>
601
612
  );
602
613
  }
package/src/host-hooks.ts CHANGED
@@ -39,6 +39,10 @@ export function useHostSendDelivery(): ReturnType<ChatHost['useSendDelivery']> {
39
39
  return useChatHost().useSendDelivery();
40
40
  }
41
41
 
42
+ export function useHostHidesToolCalls(...args: Parameters<ChatHost['useHidesToolCalls']>): ReturnType<ChatHost['useHidesToolCalls']> {
43
+ return useChatHost().useHidesToolCalls(...args);
44
+ }
45
+
42
46
  export function useHostTimelineFind(...args: Parameters<ChatHost['useTimelineFind']>): ReturnType<ChatHost['useTimelineFind']> {
43
47
  return useChatHost().useTimelineFind(...args);
44
48
  }
package/src/host.ts CHANGED
@@ -172,6 +172,15 @@ export interface ComposerSlotProps {
172
172
  insert(text: string): void;
173
173
  }
174
174
 
175
+ /* What an app's own bar over the composer gets: the chat it stands on, which may be one the bar has nothing for. */
176
+ export interface ComposerHeaderSlotProps {
177
+ scopeId: string;
178
+ chatId: string;
179
+ disabled: boolean;
180
+ /* Whether this composer has the focus; a bar keeps its controls out of the tab order while it does not, as the editor does. */
181
+ focused: boolean;
182
+ }
183
+
175
184
  /* What a send action of the app's gets: the message as it stands when a person picks the action. */
176
185
  export interface ComposerSendDraft {
177
186
  scopeId: string;
@@ -402,6 +411,8 @@ export interface ChatHost {
402
411
  useStreaming(): 'words' | 'blocks' | 'whole';
403
412
  /* How Send handles a running turn; Option or Alt selects the other behavior. */
404
413
  useSendDelivery(): 'queue' | 'steer';
414
+ /* Whether a thread leaves out its tool lines; a settled turn still says how long it worked. */
415
+ useHidesToolCalls(scopeId: string, chatId: string): boolean;
405
416
  /* Paths in an answer as links; null leaves them text. */
406
417
  fileLinks: {
407
418
  /* The reference a piece of text names, where the folder it counts from lets it be opened. */
@@ -479,6 +490,8 @@ export interface ChatHost {
479
490
  useComposerPlaceholder(scopeId: string, chatId: string): string | null;
480
491
  /* The app's own control in the composer's row, after the pickers; null draws none. */
481
492
  ComposerSlot: ComponentType<ComposerSlotProps> | null;
493
+ /* The app's own bar at the top of the composer, inside its card, such as a switch between chats of one thing; left out, or a slot that renders nothing, draws none. */
494
+ ComposerHeaderSlot?: ComponentType<ComposerHeaderSlotProps> | null;
482
495
  /* Actions of the app's own behind a chevron on the send button, in the order given; left out, or none, Send stands alone. */
483
496
  useComposerSendActions?(scopeId: string, chatId: string): readonly ComposerSendAction[];
484
497
  /* The app's own chips for a chat's sub-agents over the composer; null draws the one flyout. */
@@ -514,6 +527,7 @@ const DEFAULT_HOST: ChatHost = {
514
527
  code: { useMode: () => 'light', useThemes: () => ({ light: 'github-light', dark: 'github-dark' }), custom: [] },
515
528
  useStreaming: () => 'words',
516
529
  useSendDelivery: () => 'queue',
530
+ useHidesToolCalls: () => false,
517
531
  fileLinks: null,
518
532
  useTimelineFind: () => NO_FIND,
519
533
  dictation: { Textarea: PlainTextarea, composer: null },
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ export {
8
8
  type TimelineFindOptions,
9
9
  type TimelineFind,
10
10
  type ComposerDictationProps,
11
+ type ComposerHeaderSlotProps,
11
12
  type ComposerSlotProps,
12
13
  type ComposerSendAction,
13
14
  type ComposerSendDraft,