@agent-native/toolkit 0.198.4 → 0.198.6
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.
- package/dist/app/agentkit/react/components.d.ts +6 -3
- package/dist/app/agentkit/react/components.d.ts.map +1 -1
- package/dist/app/agentkit/react/components.js +98 -68
- package/dist/app/agentkit/react/components.js.map +1 -1
- package/dist/app/agentkit/react/styles.css +36 -24
- package/dist/app/chat/AgentKitAssistantChat.d.ts.map +1 -1
- package/dist/app/chat/AgentKitAssistantChat.js +32 -15
- package/dist/app/chat/AgentKitAssistantChat.js.map +1 -1
- package/dist/app/chat/AgentPanel.d.ts +1 -1
- package/dist/app/chat/AgentPanel.d.ts.map +1 -1
- package/dist/app/chat/AgentPanel.js +11 -38
- package/dist/app/chat/AgentPanel.js.map +1 -1
- package/dist/app/chat/AgentSidebar.d.ts.map +1 -1
- package/dist/app/chat/AgentSidebar.js +3 -11
- package/dist/app/chat/AgentSidebar.js.map +1 -1
- package/dist/app/chat/chat/tool-call-display.d.ts +2 -1
- package/dist/app/chat/chat/tool-call-display.d.ts.map +1 -1
- package/dist/app/chat/chat/tool-call-display.js +83 -55
- package/dist/app/chat/chat/tool-call-display.js.map +1 -1
- package/dist/app/i18n/catalogs/ar-SA.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/ar-SA.js +1 -0
- package/dist/app/i18n/catalogs/ar-SA.js.map +1 -1
- package/dist/app/i18n/catalogs/de-DE.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/de-DE.js +1 -0
- package/dist/app/i18n/catalogs/de-DE.js.map +1 -1
- package/dist/app/i18n/catalogs/en-US.d.ts +1 -0
- package/dist/app/i18n/catalogs/en-US.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/en-US.js +1 -0
- package/dist/app/i18n/catalogs/en-US.js.map +1 -1
- package/dist/app/i18n/catalogs/es-ES.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/es-ES.js +1 -0
- package/dist/app/i18n/catalogs/es-ES.js.map +1 -1
- package/dist/app/i18n/catalogs/fr-FR.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/fr-FR.js +1 -0
- package/dist/app/i18n/catalogs/fr-FR.js.map +1 -1
- package/dist/app/i18n/catalogs/hi-IN.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/hi-IN.js +1 -0
- package/dist/app/i18n/catalogs/hi-IN.js.map +1 -1
- package/dist/app/i18n/catalogs/ja-JP.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/ja-JP.js +1 -0
- package/dist/app/i18n/catalogs/ja-JP.js.map +1 -1
- package/dist/app/i18n/catalogs/ko-KR.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/ko-KR.js +1 -0
- package/dist/app/i18n/catalogs/ko-KR.js.map +1 -1
- package/dist/app/i18n/catalogs/pt-BR.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/pt-BR.js +1 -0
- package/dist/app/i18n/catalogs/pt-BR.js.map +1 -1
- package/dist/app/i18n/catalogs/zh-CN.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/zh-CN.js +1 -0
- package/dist/app/i18n/catalogs/zh-CN.js.map +1 -1
- package/dist/app/i18n/catalogs/zh-TW.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/zh-TW.js +1 -0
- package/dist/app/i18n/catalogs/zh-TW.js.map +1 -1
- package/dist/composer/PromptComposer.d.ts +3 -0
- package/dist/composer/PromptComposer.d.ts.map +1 -1
- package/dist/composer/PromptComposer.js +2 -2
- package/dist/composer/PromptComposer.js.map +1 -1
- package/dist/composer/TiptapComposer.d.ts +4 -1
- package/dist/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/composer/TiptapComposer.js +32 -25
- package/dist/composer/TiptapComposer.js.map +1 -1
- package/dist/ui/sonner.js +1 -1
- package/dist/ui/sonner.js.map +1 -1
- package/package.json +3 -3
- package/src/app/agentkit/react/components.interaction.spec.tsx +93 -0
- package/src/app/agentkit/react/components.spec.tsx +1 -2
- package/src/app/agentkit/react/components.tsx +185 -132
- package/src/app/agentkit/react/composer-context.spec.tsx +7 -0
- package/src/app/agentkit/react/lifecycle.spec.tsx +556 -39
- package/src/app/agentkit/react/styles.css +36 -24
- package/src/app/chat/AgentKitAssistantChat.spec.tsx +60 -1
- package/src/app/chat/AgentKitAssistantChat.tsx +45 -14
- package/src/app/chat/AgentPanel.overlay.spec.tsx +28 -4
- package/src/app/chat/AgentPanel.tsx +51 -168
- package/src/app/chat/AgentSidebar.spec.tsx +19 -19
- package/src/app/chat/AgentSidebar.tsx +59 -94
- package/src/app/chat/chat/tool-call-display.spec.tsx +371 -15
- package/src/app/chat/chat/tool-call-display.tsx +154 -80
- package/src/app/i18n/catalogs/ar-SA.ts +1 -0
- package/src/app/i18n/catalogs/de-DE.ts +1 -0
- package/src/app/i18n/catalogs/en-US.ts +1 -0
- package/src/app/i18n/catalogs/es-ES.ts +1 -0
- package/src/app/i18n/catalogs/fr-FR.ts +1 -0
- package/src/app/i18n/catalogs/hi-IN.ts +1 -0
- package/src/app/i18n/catalogs/ja-JP.ts +1 -0
- package/src/app/i18n/catalogs/ko-KR.ts +1 -0
- package/src/app/i18n/catalogs/pt-BR.ts +1 -0
- package/src/app/i18n/catalogs/zh-CN.ts +1 -0
- package/src/app/i18n/catalogs/zh-TW.ts +1 -0
- package/src/app-shell/sidebar-overflow.spec.tsx +2 -1
- package/src/composer/PromptComposer.context.spec.tsx +28 -15
- package/src/composer/PromptComposer.tsx +7 -0
- package/src/composer/TiptapComposer.spec.ts +40 -6
- package/src/composer/TiptapComposer.tsx +89 -89
- package/src/ui/sonner.spec.ts +15 -0
- package/src/ui/sonner.tsx +1 -1
|
@@ -402,6 +402,254 @@ describe("ToolCallDisplay native renderers", () => {
|
|
|
402
402
|
expect(container.textContent).not.toContain("Recent rows");
|
|
403
403
|
});
|
|
404
404
|
|
|
405
|
+
it("shows delegated tool errors only after explicitly expanding the call", () => {
|
|
406
|
+
const errorMessage = "The analytics provider rejected the request.";
|
|
407
|
+
act(() => {
|
|
408
|
+
root.render(
|
|
409
|
+
<ToolCallDisplay
|
|
410
|
+
toolName="agent:Analytics"
|
|
411
|
+
args={{}}
|
|
412
|
+
result={errorMessage}
|
|
413
|
+
isError
|
|
414
|
+
isRunning={false}
|
|
415
|
+
/>,
|
|
416
|
+
);
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
const disclosure = container.querySelector<HTMLButtonElement>(
|
|
420
|
+
"button[aria-expanded]",
|
|
421
|
+
);
|
|
422
|
+
expect(disclosure?.getAttribute("aria-expanded")).toBe("false");
|
|
423
|
+
expect(disclosure?.textContent).toContain("Asked Analytics");
|
|
424
|
+
expect(disclosure?.textContent).not.toContain("failed");
|
|
425
|
+
expect(container.textContent).not.toContain(errorMessage);
|
|
426
|
+
|
|
427
|
+
act(() => disclosure?.click());
|
|
428
|
+
|
|
429
|
+
expect(disclosure?.getAttribute("aria-expanded")).toBe("true");
|
|
430
|
+
expect(container.textContent).toContain(errorMessage);
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
it("shows regular tool errors only after explicitly expanding the call", () => {
|
|
434
|
+
const errorMessage =
|
|
435
|
+
"Error running update-slide: replace found no matches.";
|
|
436
|
+
act(() => {
|
|
437
|
+
root.render(
|
|
438
|
+
<ToolCallDisplay
|
|
439
|
+
toolName="update-slide"
|
|
440
|
+
args={{}}
|
|
441
|
+
result={errorMessage}
|
|
442
|
+
isError
|
|
443
|
+
isRunning={false}
|
|
444
|
+
/>,
|
|
445
|
+
);
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
const disclosure = container.querySelector<HTMLButtonElement>(
|
|
449
|
+
"button[aria-expanded]",
|
|
450
|
+
);
|
|
451
|
+
expect(disclosure?.getAttribute("aria-expanded")).toBe("false");
|
|
452
|
+
expect(disclosure?.textContent).toContain("update slide");
|
|
453
|
+
expect(container.textContent).not.toContain(errorMessage);
|
|
454
|
+
|
|
455
|
+
act(() => disclosure?.click());
|
|
456
|
+
|
|
457
|
+
expect(disclosure?.getAttribute("aria-expanded")).toBe("true");
|
|
458
|
+
expect(container.textContent).toContain(errorMessage);
|
|
459
|
+
expect(container.querySelector(".text-destructive")).toBeNull();
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
it("shows specialized tool errors only after explicitly expanding the call", () => {
|
|
463
|
+
const errorMessage = "The command failed.";
|
|
464
|
+
act(() => {
|
|
465
|
+
root.render(
|
|
466
|
+
<ToolCallDisplay
|
|
467
|
+
toolName="run-command"
|
|
468
|
+
args={{}}
|
|
469
|
+
result={errorMessage}
|
|
470
|
+
isError
|
|
471
|
+
isRunning={false}
|
|
472
|
+
structuredMeta={{
|
|
473
|
+
toolKind: "bash",
|
|
474
|
+
command: "pnpm test",
|
|
475
|
+
cwd: "/repo",
|
|
476
|
+
exitCode: 1,
|
|
477
|
+
}}
|
|
478
|
+
/>,
|
|
479
|
+
);
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
const disclosure = container.querySelector<HTMLButtonElement>(
|
|
483
|
+
"button[aria-expanded]",
|
|
484
|
+
);
|
|
485
|
+
expect(disclosure?.getAttribute("aria-expanded")).toBe("false");
|
|
486
|
+
expect(container.textContent).not.toContain(errorMessage);
|
|
487
|
+
expect(container.querySelector(".text-destructive")).toBeNull();
|
|
488
|
+
|
|
489
|
+
act(() => disclosure?.click());
|
|
490
|
+
|
|
491
|
+
expect(container.textContent).toContain(errorMessage);
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
it("bypasses native tool renderers for failures and keeps details collapsed", () => {
|
|
495
|
+
const errorMessage = "The action failed.";
|
|
496
|
+
registerToolRenderer({
|
|
497
|
+
id: "app.response-insights",
|
|
498
|
+
match: "response-insights",
|
|
499
|
+
Component: AppRenderer,
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
act(() => {
|
|
503
|
+
root.render(
|
|
504
|
+
<ToolCallDisplay
|
|
505
|
+
toolName="response-insights"
|
|
506
|
+
args={{}}
|
|
507
|
+
result={errorMessage}
|
|
508
|
+
isError
|
|
509
|
+
isRunning={false}
|
|
510
|
+
/>,
|
|
511
|
+
);
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
const disclosure = container.querySelector<HTMLButtonElement>(
|
|
515
|
+
"button[aria-expanded]",
|
|
516
|
+
);
|
|
517
|
+
expect(container.textContent).not.toContain("App renderer wins");
|
|
518
|
+
expect(disclosure?.getAttribute("aria-expanded")).toBe("false");
|
|
519
|
+
expect(container.textContent).not.toContain(errorMessage);
|
|
520
|
+
|
|
521
|
+
act(() => disclosure?.click());
|
|
522
|
+
|
|
523
|
+
expect(container.textContent).toContain(errorMessage);
|
|
524
|
+
expect(container.querySelector(".text-destructive")).toBeNull();
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
it("shows fallback details for delegated failures without error text", () => {
|
|
528
|
+
act(() => {
|
|
529
|
+
root.render(
|
|
530
|
+
<ToolCallDisplay
|
|
531
|
+
toolName="agent:Analytics"
|
|
532
|
+
args={{}}
|
|
533
|
+
isError
|
|
534
|
+
isRunning={false}
|
|
535
|
+
/>,
|
|
536
|
+
);
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
const disclosure = container.querySelector<HTMLButtonElement>(
|
|
540
|
+
"button[aria-expanded]",
|
|
541
|
+
);
|
|
542
|
+
expect(disclosure?.getAttribute("aria-expanded")).toBe("false");
|
|
543
|
+
expect(disclosure?.textContent).toContain("Asked Analytics");
|
|
544
|
+
expect(disclosure?.textContent).not.toContain("Error");
|
|
545
|
+
expect(container.textContent).not.toContain(
|
|
546
|
+
"No error details are available.",
|
|
547
|
+
);
|
|
548
|
+
expect(container.querySelector(".text-destructive")).toBeNull();
|
|
549
|
+
|
|
550
|
+
act(() => disclosure?.click());
|
|
551
|
+
|
|
552
|
+
expect(container.textContent).toContain("No error details are available.");
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
it("shows failed delegated subtool details only after that tool is expanded", () => {
|
|
556
|
+
const errorMessage = "The warehouse query failed.";
|
|
557
|
+
act(() => {
|
|
558
|
+
root.render(
|
|
559
|
+
<ToolCallDisplay
|
|
560
|
+
toolName="agent:Analytics"
|
|
561
|
+
args={{}}
|
|
562
|
+
argsText='{"task":"query the warehouse"}'
|
|
563
|
+
isRunning={false}
|
|
564
|
+
structuredMeta={{
|
|
565
|
+
agentActivity: {
|
|
566
|
+
kind: "agent-native/agent-activity",
|
|
567
|
+
version: 1,
|
|
568
|
+
sequence: 2,
|
|
569
|
+
startedAt: 1,
|
|
570
|
+
updatedAt: 2,
|
|
571
|
+
durationMs: 1,
|
|
572
|
+
activePhase: "complete",
|
|
573
|
+
reasoning: [],
|
|
574
|
+
toolCalls: [
|
|
575
|
+
{
|
|
576
|
+
id: "query-1",
|
|
577
|
+
name: "query-warehouse",
|
|
578
|
+
status: "failed",
|
|
579
|
+
result: errorMessage,
|
|
580
|
+
},
|
|
581
|
+
],
|
|
582
|
+
},
|
|
583
|
+
}}
|
|
584
|
+
/>,
|
|
585
|
+
);
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
const delegation = container.querySelector<HTMLButtonElement>(
|
|
589
|
+
"button[aria-expanded]",
|
|
590
|
+
);
|
|
591
|
+
act(() => delegation?.click());
|
|
592
|
+
const subtool = Array.from(
|
|
593
|
+
container.querySelectorAll<HTMLButtonElement>("button[aria-expanded]"),
|
|
594
|
+
).find((button) => button.textContent?.includes("query warehouse"));
|
|
595
|
+
expect(subtool?.getAttribute("aria-expanded")).toBe("false");
|
|
596
|
+
expect(container.textContent).not.toContain(errorMessage);
|
|
597
|
+
|
|
598
|
+
act(() => subtool?.click());
|
|
599
|
+
|
|
600
|
+
expect(subtool?.getAttribute("aria-expanded")).toBe("true");
|
|
601
|
+
expect(container.textContent).toContain(errorMessage);
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
it("keeps failed delegated subtools expandable without error text", () => {
|
|
605
|
+
act(() => {
|
|
606
|
+
root.render(
|
|
607
|
+
<ToolCallDisplay
|
|
608
|
+
toolName="agent:Analytics"
|
|
609
|
+
args={{}}
|
|
610
|
+
argsText='{"task":"query the warehouse"}'
|
|
611
|
+
isRunning={false}
|
|
612
|
+
structuredMeta={{
|
|
613
|
+
agentActivity: {
|
|
614
|
+
kind: "agent-native/agent-activity",
|
|
615
|
+
version: 1,
|
|
616
|
+
sequence: 2,
|
|
617
|
+
startedAt: 1,
|
|
618
|
+
updatedAt: 2,
|
|
619
|
+
durationMs: 1,
|
|
620
|
+
activePhase: "complete",
|
|
621
|
+
reasoning: [],
|
|
622
|
+
toolCalls: [
|
|
623
|
+
{
|
|
624
|
+
id: "query-1",
|
|
625
|
+
name: "query-warehouse",
|
|
626
|
+
status: "failed",
|
|
627
|
+
},
|
|
628
|
+
],
|
|
629
|
+
},
|
|
630
|
+
}}
|
|
631
|
+
/>,
|
|
632
|
+
);
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
const delegation = container.querySelector<HTMLButtonElement>(
|
|
636
|
+
"button[aria-expanded]",
|
|
637
|
+
);
|
|
638
|
+
act(() => delegation?.click());
|
|
639
|
+
const subtool = Array.from(
|
|
640
|
+
container.querySelectorAll<HTMLButtonElement>("button[aria-expanded]"),
|
|
641
|
+
).find((button) => button.textContent?.includes("query warehouse"));
|
|
642
|
+
expect(subtool?.getAttribute("aria-expanded")).toBe("false");
|
|
643
|
+
expect(container.textContent).not.toContain(
|
|
644
|
+
"No error details are available.",
|
|
645
|
+
);
|
|
646
|
+
|
|
647
|
+
act(() => subtool?.click());
|
|
648
|
+
|
|
649
|
+
expect(subtool?.getAttribute("aria-expanded")).toBe("true");
|
|
650
|
+
expect(container.textContent).toContain("No error details are available.");
|
|
651
|
+
});
|
|
652
|
+
|
|
405
653
|
it("keeps an unresolved delegated agent visibly running when chat state dips", () => {
|
|
406
654
|
act(() => {
|
|
407
655
|
root.render(
|
|
@@ -528,6 +776,35 @@ describe("ToolCallDisplay native renderers", () => {
|
|
|
528
776
|
).toBeNull();
|
|
529
777
|
});
|
|
530
778
|
|
|
779
|
+
it("keeps fallback tool errors collapsed until explicitly expanded", () => {
|
|
780
|
+
const errorMessage =
|
|
781
|
+
"Error running update-slide: replace found no matches.";
|
|
782
|
+
act(() => {
|
|
783
|
+
root.render(
|
|
784
|
+
<ToolCallFallback
|
|
785
|
+
toolName="update-slide"
|
|
786
|
+
args={{}}
|
|
787
|
+
argsText="{}"
|
|
788
|
+
result={errorMessage}
|
|
789
|
+
isError
|
|
790
|
+
/>,
|
|
791
|
+
);
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
const disclosure = container.querySelector<HTMLButtonElement>(
|
|
795
|
+
"button[aria-expanded]",
|
|
796
|
+
);
|
|
797
|
+
expect(disclosure?.getAttribute("aria-expanded")).toBe("false");
|
|
798
|
+
expect(container.textContent).not.toContain(errorMessage);
|
|
799
|
+
expect(container.querySelector(".text-destructive")).toBeNull();
|
|
800
|
+
|
|
801
|
+
act(() => disclosure?.click());
|
|
802
|
+
|
|
803
|
+
expect(disclosure?.getAttribute("aria-expanded")).toBe("true");
|
|
804
|
+
expect(container.textContent).toContain(errorMessage);
|
|
805
|
+
expect(container.querySelector(".text-destructive")).toBeNull();
|
|
806
|
+
});
|
|
807
|
+
|
|
531
808
|
it("does not animate a tool row that mounts already resolved", () => {
|
|
532
809
|
act(() => {
|
|
533
810
|
root.render(
|
|
@@ -1332,6 +1609,44 @@ describe("ToolCallDisplay native renderers", () => {
|
|
|
1332
1609
|
).not.toBeNull();
|
|
1333
1610
|
});
|
|
1334
1611
|
|
|
1612
|
+
it("keeps reconnect tool errors expandable without showing them in the row", () => {
|
|
1613
|
+
const content: ContentPart[] = [
|
|
1614
|
+
{
|
|
1615
|
+
type: "tool-call",
|
|
1616
|
+
toolCallId: "failed-tool-1",
|
|
1617
|
+
toolName: "update-slide",
|
|
1618
|
+
argsText: "",
|
|
1619
|
+
args: {},
|
|
1620
|
+
isError: true,
|
|
1621
|
+
},
|
|
1622
|
+
];
|
|
1623
|
+
|
|
1624
|
+
act(() => {
|
|
1625
|
+
root.render(
|
|
1626
|
+
<ChatRunningContext.Provider value={true}>
|
|
1627
|
+
<ReconnectStreamMessage content={content} />
|
|
1628
|
+
</ChatRunningContext.Provider>,
|
|
1629
|
+
);
|
|
1630
|
+
});
|
|
1631
|
+
|
|
1632
|
+
const disclosure = container.querySelector<HTMLButtonElement>(
|
|
1633
|
+
"button[aria-expanded]",
|
|
1634
|
+
);
|
|
1635
|
+
expect(disclosure?.getAttribute("aria-expanded")).toBe("false");
|
|
1636
|
+
expect(container.textContent).toContain("update slide");
|
|
1637
|
+
expect(container.textContent).not.toContain(
|
|
1638
|
+
"No error details are available.",
|
|
1639
|
+
);
|
|
1640
|
+
expect(
|
|
1641
|
+
container.querySelector("[data-agent-native-cube-loader]"),
|
|
1642
|
+
).toBeNull();
|
|
1643
|
+
|
|
1644
|
+
act(() => disclosure?.click());
|
|
1645
|
+
|
|
1646
|
+
expect(container.textContent).toContain("No error details are available.");
|
|
1647
|
+
expect(container.querySelector(".text-destructive")).toBeNull();
|
|
1648
|
+
});
|
|
1649
|
+
|
|
1335
1650
|
it("does not spin frozen reconnect activity cards", () => {
|
|
1336
1651
|
const content: ContentPart[] = [
|
|
1337
1652
|
{
|
|
@@ -2029,32 +2344,25 @@ describe("ReasoningCell", () => {
|
|
|
2029
2344
|
expect(container.textContent).toContain("verify the join keys first.");
|
|
2030
2345
|
});
|
|
2031
2346
|
|
|
2032
|
-
it("keeps
|
|
2347
|
+
it("keeps work details inside the shared work disclosure", () => {
|
|
2033
2348
|
act(() => {
|
|
2034
2349
|
root.render(
|
|
2035
2350
|
<WorkedForSummary>
|
|
2036
|
-
<
|
|
2351
|
+
<div>Tool call details</div>
|
|
2037
2352
|
</WorkedForSummary>,
|
|
2038
2353
|
);
|
|
2039
2354
|
});
|
|
2040
2355
|
|
|
2041
|
-
|
|
2042
|
-
expect(
|
|
2043
|
-
|
|
2044
|
-
act(() => {
|
|
2045
|
-
container.querySelector("button")?.click();
|
|
2046
|
-
});
|
|
2047
|
-
|
|
2048
|
-
const buttons = Array.from(container.querySelectorAll("button"));
|
|
2049
|
-
expect(buttons).toHaveLength(2);
|
|
2050
|
-
expect(container.textContent).toContain("Thought");
|
|
2051
|
-
expect(container.textContent).not.toContain("verify the join keys first.");
|
|
2356
|
+
const button = container.querySelector("button");
|
|
2357
|
+
expect(button?.getAttribute("aria-expanded")).toBe("false");
|
|
2358
|
+
expect(container.textContent).not.toContain("Tool call details");
|
|
2052
2359
|
|
|
2053
2360
|
act(() => {
|
|
2054
|
-
|
|
2361
|
+
button?.click();
|
|
2055
2362
|
});
|
|
2056
2363
|
|
|
2057
|
-
expect(
|
|
2364
|
+
expect(button?.getAttribute("aria-expanded")).toBe("true");
|
|
2365
|
+
expect(container.textContent).toContain("Tool call details");
|
|
2058
2366
|
});
|
|
2059
2367
|
|
|
2060
2368
|
it('shows a shimmering "Thinking" label while streaming', () => {
|
|
@@ -2280,6 +2588,54 @@ describe("WorkedForSummary", () => {
|
|
|
2280
2588
|
vi.unstubAllGlobals();
|
|
2281
2589
|
});
|
|
2282
2590
|
|
|
2591
|
+
it("omits completed reasoning while preserving tools and the final response", () => {
|
|
2592
|
+
const finalResponse = "The warehouse shows 12% growth.";
|
|
2593
|
+
act(() => {
|
|
2594
|
+
root.render(
|
|
2595
|
+
<ToolCallDisplay
|
|
2596
|
+
toolName="agent:Analytics"
|
|
2597
|
+
args={{}}
|
|
2598
|
+
argsText={finalResponse}
|
|
2599
|
+
result="Agent call completed"
|
|
2600
|
+
isRunning={false}
|
|
2601
|
+
structuredMeta={{
|
|
2602
|
+
agentActivity: {
|
|
2603
|
+
kind: "agent-native/agent-activity",
|
|
2604
|
+
version: 1,
|
|
2605
|
+
sequence: 3,
|
|
2606
|
+
startedAt: 1,
|
|
2607
|
+
updatedAt: 3,
|
|
2608
|
+
durationMs: 5_000,
|
|
2609
|
+
activePhase: "complete",
|
|
2610
|
+
reasoning: ["This private thought should not appear."],
|
|
2611
|
+
toolCalls: [
|
|
2612
|
+
{
|
|
2613
|
+
id: "query-1",
|
|
2614
|
+
name: "query-warehouse",
|
|
2615
|
+
status: "completed",
|
|
2616
|
+
},
|
|
2617
|
+
],
|
|
2618
|
+
response: ["The query returned a 12% increase."],
|
|
2619
|
+
},
|
|
2620
|
+
}}
|
|
2621
|
+
/>,
|
|
2622
|
+
);
|
|
2623
|
+
});
|
|
2624
|
+
|
|
2625
|
+
const workedFor = Array.from(
|
|
2626
|
+
container.querySelectorAll<HTMLButtonElement>("button[aria-expanded]"),
|
|
2627
|
+
).find((button) => button.textContent?.includes("Worked for"));
|
|
2628
|
+
expect(workedFor).not.toBeNull();
|
|
2629
|
+
act(() => workedFor?.click());
|
|
2630
|
+
|
|
2631
|
+
expect(container.textContent).not.toContain("This private thought");
|
|
2632
|
+
expect(container.textContent).toContain("query warehouse");
|
|
2633
|
+
expect(container.textContent).toContain(
|
|
2634
|
+
"The query returned a 12% increase.",
|
|
2635
|
+
);
|
|
2636
|
+
expect(container.textContent).toContain(finalResponse);
|
|
2637
|
+
});
|
|
2638
|
+
|
|
2283
2639
|
it("does not flash open when a completed summary remounts", () => {
|
|
2284
2640
|
function Harness({ visible }: { visible: boolean }) {
|
|
2285
2641
|
return visible ? (
|