@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
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { getBrowserTabId } from "@agent-native/core/client/hooks";
|
|
2
|
+
import { buildSettingsRoute } from "@agent-native/core/navigation";
|
|
3
|
+
import {
|
|
4
|
+
isSettingsSectionId,
|
|
5
|
+
SETTINGS_SECTION_ALIASES,
|
|
6
|
+
} from "@agent-native/core/navigation";
|
|
2
7
|
import type { AgentRun } from "@agent-native/core/progress";
|
|
8
|
+
import { withBuilderUtmTrackingParams } from "@agent-native/core/shared/builder-link-tracking";
|
|
3
9
|
import { Tooltip as DesignSystemTooltip } from "@agent-native/toolkit/design-system";
|
|
4
10
|
import {
|
|
5
11
|
DropdownMenu,
|
|
@@ -36,30 +42,23 @@ import React, {
|
|
|
36
42
|
Suspense,
|
|
37
43
|
startTransition,
|
|
38
44
|
} from "react";
|
|
45
|
+
import { useLocation, useNavigate } from "react-router";
|
|
39
46
|
|
|
40
47
|
import { resolveFeedbackUrl } from "../feedback/FeedbackButton.js";
|
|
41
48
|
import { ErrorReportActions, FeedbackButton } from "../feedback/index.js";
|
|
42
49
|
import { RunsTrayMenuItem } from "../progress/index.js";
|
|
43
50
|
import { ShareButton } from "../sharing/index.js";
|
|
44
|
-
import { ThinkingDisplayProvider } from "./thinking-display.js";
|
|
45
|
-
const loadMultiTabAssistantChat = () =>
|
|
46
|
-
import("./MultiTabAssistantChat.js").then((m) => ({
|
|
47
|
-
default: m.MultiTabAssistantChat,
|
|
48
|
-
}));
|
|
49
|
-
const MultiTabAssistantChatLazy = lazy(loadMultiTabAssistantChat);
|
|
50
|
-
import { buildSettingsRoute } from "@agent-native/core/navigation";
|
|
51
|
-
import {
|
|
52
|
-
isSettingsSectionId,
|
|
53
|
-
SETTINGS_SECTION_ALIASES,
|
|
54
|
-
} from "@agent-native/core/navigation";
|
|
55
|
-
import { withBuilderUtmTrackingParams } from "@agent-native/core/shared/builder-link-tracking";
|
|
56
|
-
import { useLocation, useNavigate } from "react-router";
|
|
57
|
-
|
|
58
51
|
import {
|
|
59
52
|
AGENT_PANEL_OPEN_SETTINGS_EVENT,
|
|
60
53
|
AGENT_PANEL_SET_MODE_EVENT,
|
|
61
54
|
} from "./agent-sidebar-events.js";
|
|
62
55
|
import type { AgentChatSurfaceKind } from "./chat/surface-types.js";
|
|
56
|
+
import {
|
|
57
|
+
MultiTabAssistantChat,
|
|
58
|
+
type MultiTabAssistantChatHeaderProps,
|
|
59
|
+
type MultiTabAssistantChatProps,
|
|
60
|
+
} from "./MultiTabAssistantChat.js";
|
|
61
|
+
import { ThinkingDisplayProvider } from "./thinking-display.js";
|
|
63
62
|
export {
|
|
64
63
|
shouldHandleAgentPanelChatShortcut,
|
|
65
64
|
shouldHandleAgentSidebarToggle,
|
|
@@ -99,11 +98,6 @@ import {
|
|
|
99
98
|
} from "./agent-sidebar-url-sync.js";
|
|
100
99
|
import type { AssistantChatProps } from "./chat/surface-types.js";
|
|
101
100
|
import { assistantUiRecoverableRenderErrorKind } from "./composer/assistant-ui-recovery.js";
|
|
102
|
-
import type {
|
|
103
|
-
MultiTabAssistantChatHeaderProps,
|
|
104
|
-
MultiTabAssistantChatProps,
|
|
105
|
-
} from "./MultiTabAssistantChat.js";
|
|
106
|
-
|
|
107
101
|
function parentFrameTargetOrigin(): string {
|
|
108
102
|
return getFramePostMessageTargetOrigin() ?? window.location.origin;
|
|
109
103
|
}
|
|
@@ -293,6 +287,7 @@ const AGENT_PANEL_CONTROL_STYLE = {
|
|
|
293
287
|
lineHeight: 1,
|
|
294
288
|
} satisfies React.CSSProperties;
|
|
295
289
|
const ACTIVATE_KEYS = new Set(["Enter", " "]);
|
|
290
|
+
const AGENT_PANEL_MENU_EXIT_DURATION_MS = 100;
|
|
296
291
|
type AgentPanelOverlayOpenTiming = "animation-frame" | "timeout";
|
|
297
292
|
|
|
298
293
|
export function deferAgentPanelOverlayOpen(
|
|
@@ -304,7 +299,7 @@ export function deferAgentPanelOverlayOpen(
|
|
|
304
299
|
event.preventDefault();
|
|
305
300
|
closeMenu();
|
|
306
301
|
if (timing === "timeout") {
|
|
307
|
-
setTimeout(openOverlay,
|
|
302
|
+
setTimeout(openOverlay, AGENT_PANEL_MENU_EXIT_DURATION_MS);
|
|
308
303
|
return;
|
|
309
304
|
}
|
|
310
305
|
if (
|
|
@@ -379,96 +374,6 @@ function IconTooltip({
|
|
|
379
374
|
);
|
|
380
375
|
}
|
|
381
376
|
|
|
382
|
-
type ChatHeaderRenderer = (
|
|
383
|
-
props: MultiTabAssistantChatHeaderProps,
|
|
384
|
-
) => React.ReactNode;
|
|
385
|
-
|
|
386
|
-
function ChatLoadingSkeleton({
|
|
387
|
-
renderHeader,
|
|
388
|
-
centerComposerWhenEmpty = false,
|
|
389
|
-
composerSlot,
|
|
390
|
-
composerAreaClassName,
|
|
391
|
-
composerLayoutVariant = "default",
|
|
392
|
-
}: {
|
|
393
|
-
renderHeader?: ChatHeaderRenderer;
|
|
394
|
-
centerComposerWhenEmpty?: boolean;
|
|
395
|
-
composerSlot?: React.ReactNode;
|
|
396
|
-
composerAreaClassName?: string;
|
|
397
|
-
composerLayoutVariant?: AssistantChatProps["composerLayoutVariant"];
|
|
398
|
-
}) {
|
|
399
|
-
const t = useT();
|
|
400
|
-
const noop = useCallback(() => {}, []);
|
|
401
|
-
const noopStr = useCallback((_id: string) => {}, []);
|
|
402
|
-
const stubProps: MultiTabAssistantChatHeaderProps = {
|
|
403
|
-
tabs: [],
|
|
404
|
-
activeTabId: "",
|
|
405
|
-
activeTabMessageCount: 0,
|
|
406
|
-
setActiveTabId: noopStr,
|
|
407
|
-
addTab: noop,
|
|
408
|
-
closeTab: noopStr,
|
|
409
|
-
closeOtherTabs: noopStr,
|
|
410
|
-
closeAllTabs: noop,
|
|
411
|
-
clearActiveTab: noop,
|
|
412
|
-
showHistory: false,
|
|
413
|
-
tabCount: 0,
|
|
414
|
-
toggleHistory: noop,
|
|
415
|
-
};
|
|
416
|
-
if (centerComposerWhenEmpty) {
|
|
417
|
-
return (
|
|
418
|
-
<div className="flex flex-col flex-1 min-h-0">
|
|
419
|
-
{renderHeader ? renderHeader(stubProps) : null}
|
|
420
|
-
<div
|
|
421
|
-
data-agent-empty-state="centered"
|
|
422
|
-
className="relative flex flex-1 flex-col h-full min-h-0 text-foreground"
|
|
423
|
-
>
|
|
424
|
-
<div className="agent-chat-scroll flex-1 overflow-y-auto overflow-x-hidden min-h-0">
|
|
425
|
-
<div className="agent-empty-state sr-only" aria-busy="true">
|
|
426
|
-
{t("agentChat.empty.loadingChat")}
|
|
427
|
-
</div>
|
|
428
|
-
</div>
|
|
429
|
-
{composerSlot}
|
|
430
|
-
<div className="agent-composer-stack">
|
|
431
|
-
<div
|
|
432
|
-
className={cn(
|
|
433
|
-
"agent-composer-area shrink-0 px-3 py-2",
|
|
434
|
-
composerLayoutVariant !== "default" &&
|
|
435
|
-
`agent-composer-area--${composerLayoutVariant}`,
|
|
436
|
-
composerAreaClassName,
|
|
437
|
-
)}
|
|
438
|
-
>
|
|
439
|
-
<div
|
|
440
|
-
className={cn(
|
|
441
|
-
"agent-composer-root flex flex-col rounded-lg border border-input bg-muted/45 transition-colors",
|
|
442
|
-
composerLayoutVariant !== "default" &&
|
|
443
|
-
`agent-composer-root--${composerLayoutVariant}`,
|
|
444
|
-
)}
|
|
445
|
-
>
|
|
446
|
-
<div className="px-3 pt-3">
|
|
447
|
-
<div className="h-5 w-3/5 rounded bg-muted animate-pulse motion-reduce:animate-none" />
|
|
448
|
-
</div>
|
|
449
|
-
<div className="mt-auto flex items-center gap-2 px-3 py-2">
|
|
450
|
-
<div className="h-5 w-5 rounded bg-muted animate-pulse motion-reduce:animate-none" />
|
|
451
|
-
<div className="ml-auto h-4 w-28 rounded bg-muted animate-pulse motion-reduce:animate-none" />
|
|
452
|
-
<div className="h-7 w-7 rounded-md bg-muted animate-pulse motion-reduce:animate-none" />
|
|
453
|
-
</div>
|
|
454
|
-
</div>
|
|
455
|
-
</div>
|
|
456
|
-
</div>
|
|
457
|
-
</div>
|
|
458
|
-
</div>
|
|
459
|
-
);
|
|
460
|
-
}
|
|
461
|
-
return (
|
|
462
|
-
<div className="flex flex-col flex-1 min-h-0">
|
|
463
|
-
{renderHeader ? renderHeader(stubProps) : null}
|
|
464
|
-
{/* Composer-shaped placeholder keeps layout stable during chunk load */}
|
|
465
|
-
<div className="mt-auto shrink-0 border-t border-border p-3">
|
|
466
|
-
<div className="h-16 rounded-xl bg-muted/40 animate-pulse motion-reduce:animate-none" />
|
|
467
|
-
</div>
|
|
468
|
-
</div>
|
|
469
|
-
);
|
|
470
|
-
}
|
|
471
|
-
|
|
472
377
|
export function getAgentPanelChatTabGroups(
|
|
473
378
|
tabs: MultiTabAssistantChatHeaderProps["tabs"],
|
|
474
379
|
activeTabId: string,
|
|
@@ -2544,13 +2449,9 @@ function AgentPanelInner({
|
|
|
2544
2449
|
</Suspense>
|
|
2545
2450
|
)}
|
|
2546
2451
|
|
|
2547
|
-
{/* Chat view
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
The wrapper collapses (no flex-1) when another mode is active
|
|
2551
|
-
so it only takes the height of its header.
|
|
2552
|
-
The Suspense boundary renders the header chrome immediately while
|
|
2553
|
-
the lazy assistant-ui chunk loads in the background. */}
|
|
2452
|
+
{/* Chat view stays mounted to preserve state. MultiTabAssistantChat
|
|
2453
|
+
owns its transcript loading state; mounting it here keeps the
|
|
2454
|
+
interactive composer available while that data loads. */}
|
|
2554
2455
|
<div
|
|
2555
2456
|
className={cn(
|
|
2556
2457
|
"flex flex-col min-h-0",
|
|
@@ -2558,58 +2459,40 @@ function AgentPanelInner({
|
|
|
2558
2459
|
)}
|
|
2559
2460
|
>
|
|
2560
2461
|
{mounted && (
|
|
2561
|
-
<
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
assistantChatProps.composerLayoutVariant
|
|
2574
|
-
}
|
|
2575
|
-
/>
|
|
2462
|
+
<MultiTabAssistantChat
|
|
2463
|
+
{...assistantChatProps}
|
|
2464
|
+
threadContentSlot={assistantChatProps.threadContentSlot}
|
|
2465
|
+
agentChatSurface={effectiveAgentChatSurface}
|
|
2466
|
+
apiUrl={apiUrl}
|
|
2467
|
+
showHeader={false}
|
|
2468
|
+
renderHeader={showHeader ? renderChatHeader : undefined}
|
|
2469
|
+
showTabBar={showTabBar}
|
|
2470
|
+
renderOverlay={
|
|
2471
|
+
showPageHeader && !showHeader
|
|
2472
|
+
? renderPageChatOverlay
|
|
2473
|
+
: undefined
|
|
2576
2474
|
}
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
suggestionPlacement={
|
|
2599
|
-
assistantChatProps.suggestionPlacement ?? "context-chips"
|
|
2600
|
-
}
|
|
2601
|
-
onSwitchToCli={() => switchMode("cli")}
|
|
2602
|
-
execMode={execMode}
|
|
2603
|
-
onExecModeChange={switchExecMode}
|
|
2604
|
-
storageKey={storageKey}
|
|
2605
|
-
restoreActiveThread={restoreActiveThread}
|
|
2606
|
-
scope={scope}
|
|
2607
|
-
isolateHistoryByScope={isolateHistoryByScope}
|
|
2608
|
-
showScopeBadge={showScopeBadge}
|
|
2609
|
-
browserTabId={browserTabId}
|
|
2610
|
-
threadUrlSync={threadUrlSync}
|
|
2611
|
-
/>
|
|
2612
|
-
</Suspense>
|
|
2475
|
+
contentHidden={mode !== "chat"}
|
|
2476
|
+
emptyStateText={emptyStateText}
|
|
2477
|
+
emptyStateAddon={emptyStateAddon}
|
|
2478
|
+
emptyStateFooter={emptyStateFooter}
|
|
2479
|
+
onMessageCountChange={onMessageCountChange}
|
|
2480
|
+
suggestions={suggestions}
|
|
2481
|
+
dynamicSuggestions={dynamicSuggestions}
|
|
2482
|
+
suggestionPlacement={
|
|
2483
|
+
assistantChatProps.suggestionPlacement ?? "context-chips"
|
|
2484
|
+
}
|
|
2485
|
+
onSwitchToCli={() => switchMode("cli")}
|
|
2486
|
+
execMode={execMode}
|
|
2487
|
+
onExecModeChange={switchExecMode}
|
|
2488
|
+
storageKey={storageKey}
|
|
2489
|
+
restoreActiveThread={restoreActiveThread}
|
|
2490
|
+
scope={scope}
|
|
2491
|
+
isolateHistoryByScope={isolateHistoryByScope}
|
|
2492
|
+
showScopeBadge={showScopeBadge}
|
|
2493
|
+
browserTabId={browserTabId}
|
|
2494
|
+
threadUrlSync={threadUrlSync}
|
|
2495
|
+
/>
|
|
2613
2496
|
)}
|
|
2614
2497
|
</div>
|
|
2615
2498
|
|
|
@@ -12,7 +12,11 @@ const mockHostedHarness = vi.hoisted(() => ({
|
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
14
|
vi.mock("./AgentSidebarPanel.js", () => ({
|
|
15
|
-
AgentSidebarPanel: () =>
|
|
15
|
+
AgentSidebarPanel: () => (
|
|
16
|
+
<div data-agent-sidebar-panel-loaded="true">
|
|
17
|
+
<textarea aria-label="Chat composer" />
|
|
18
|
+
</div>
|
|
19
|
+
),
|
|
16
20
|
}));
|
|
17
21
|
vi.mock("./agent-sidebar-url-sync.js", () => ({
|
|
18
22
|
ScreenRefreshBoundary: ({
|
|
@@ -146,7 +150,7 @@ beforeEach(() => {
|
|
|
146
150
|
});
|
|
147
151
|
});
|
|
148
152
|
|
|
149
|
-
describe("AgentSidebar
|
|
153
|
+
describe("AgentSidebar panel", () => {
|
|
150
154
|
it("pauses screen refresh until the panel is active", () => {
|
|
151
155
|
renderSidebar(false);
|
|
152
156
|
|
|
@@ -229,7 +233,7 @@ describe("AgentSidebar lazy panel boundary", () => {
|
|
|
229
233
|
).toBeTruthy();
|
|
230
234
|
});
|
|
231
235
|
|
|
232
|
-
it("
|
|
236
|
+
it("renders an interactive composer without a loading skeleton", () => {
|
|
233
237
|
localStorage.setItem("agent-native-sidebar-open", "true");
|
|
234
238
|
renderSidebar(true);
|
|
235
239
|
|
|
@@ -238,10 +242,11 @@ describe("AgentSidebar lazy panel boundary", () => {
|
|
|
238
242
|
).toBeTruthy();
|
|
239
243
|
expect(
|
|
240
244
|
container?.querySelector("[data-agent-sidebar-panel-skeleton='true']"),
|
|
241
|
-
).toBeTruthy();
|
|
242
|
-
expect(
|
|
243
|
-
container?.querySelector("[data-agent-sidebar-panel-loaded='true']"),
|
|
244
245
|
).toBeNull();
|
|
246
|
+
const composer = container?.querySelector<HTMLTextAreaElement>(
|
|
247
|
+
"textarea[aria-label='Chat composer']",
|
|
248
|
+
);
|
|
249
|
+
expect(composer).toBeTruthy();
|
|
245
250
|
const panel = container?.querySelector<HTMLElement>(
|
|
246
251
|
".agent-sidebar-panel[data-agent-sidebar-layout='desktop']",
|
|
247
252
|
);
|
|
@@ -249,16 +254,13 @@ describe("AgentSidebar lazy panel boundary", () => {
|
|
|
249
254
|
"var(--agent-kit-nav-surface)",
|
|
250
255
|
);
|
|
251
256
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
expect(
|
|
257
|
-
container?.querySelector("[data-agent-sidebar-panel-loaded='true']"),
|
|
258
|
-
).toBeTruthy();
|
|
257
|
+
expect(composer?.isConnected).toBe(true);
|
|
258
|
+
expect(composer?.disabled).toBe(false);
|
|
259
|
+
composer!.value = "hello";
|
|
260
|
+
expect(composer?.value).toBe("hello");
|
|
259
261
|
});
|
|
260
262
|
|
|
261
|
-
it("opens from the global shortcut
|
|
263
|
+
it("opens from the global shortcut with the composer available", async () => {
|
|
262
264
|
renderSidebar(false);
|
|
263
265
|
await act(async () => {});
|
|
264
266
|
|
|
@@ -278,14 +280,12 @@ describe("AgentSidebar lazy panel boundary", () => {
|
|
|
278
280
|
".agent-sidebar-panel[data-agent-sidebar-state='open']",
|
|
279
281
|
),
|
|
280
282
|
).toBeTruthy();
|
|
281
|
-
|
|
282
|
-
await act(async () => {
|
|
283
|
-
await Promise.resolve();
|
|
284
|
-
});
|
|
285
|
-
|
|
286
283
|
expect(
|
|
287
284
|
container?.querySelector("[data-agent-sidebar-panel-loaded='true']"),
|
|
288
285
|
).toBeTruthy();
|
|
286
|
+
expect(
|
|
287
|
+
container?.querySelector("textarea[aria-label='Chat composer']"),
|
|
288
|
+
).toBeTruthy();
|
|
289
289
|
});
|
|
290
290
|
|
|
291
291
|
it("leaves Cmd+I available to the app when the chat shortcut is disabled", async () => {
|
|
@@ -58,7 +58,6 @@ import React, {
|
|
|
58
58
|
import { flushSync } from "react-dom";
|
|
59
59
|
|
|
60
60
|
import { useFirstRunOnboardingGateOwnsSurface } from "../onboarding/first-run-startup-gate.js";
|
|
61
|
-
import { LazyChunkErrorBoundary } from "../shared/LazyChunkErrorBoundary.js";
|
|
62
61
|
import { AgentSidebarOnboardingContext } from "./agent-sidebar-context.js";
|
|
63
62
|
import {
|
|
64
63
|
AGENT_CHAT_RUNNING_EVENT,
|
|
@@ -73,19 +72,14 @@ import {
|
|
|
73
72
|
SettingsReturnPathRecorder,
|
|
74
73
|
URLSync,
|
|
75
74
|
} from "./agent-sidebar-url-sync.js";
|
|
75
|
+
import { AgentSidebarPanel } from "./AgentSidebarPanel.js";
|
|
76
76
|
import type { AgentChatSurfaceKind } from "./chat/surface-types.js";
|
|
77
77
|
import type { AssistantChatProps } from "./chat/surface-types.js";
|
|
78
78
|
import type { MultiTabAssistantChatProps } from "./MultiTabAssistantChat.js";
|
|
79
79
|
import "@agent-native/core/client/mcp-app-host";
|
|
80
80
|
|
|
81
|
-
const loadAgentSidebarPanel = () =>
|
|
82
|
-
import("./AgentSidebarPanel.js").then((m) => ({
|
|
83
|
-
default: m.AgentSidebarPanel,
|
|
84
|
-
}));
|
|
85
|
-
const AgentSidebarPanelLazy = lazy(loadAgentSidebarPanel);
|
|
86
|
-
|
|
87
81
|
export function preloadAgentChatSurface(): Promise<void> {
|
|
88
|
-
return
|
|
82
|
+
return Promise.resolve();
|
|
89
83
|
}
|
|
90
84
|
|
|
91
85
|
const SHOW_FIRST_RUN_ONBOARDING = isFirstRunOnboardingEnabled();
|
|
@@ -223,31 +217,6 @@ function parentFrameTargetOrigin(): string {
|
|
|
223
217
|
return getFramePostMessageTargetOrigin() ?? window.location.origin;
|
|
224
218
|
}
|
|
225
219
|
|
|
226
|
-
function AgentSidebarPanelSkeleton() {
|
|
227
|
-
const t = useT();
|
|
228
|
-
return (
|
|
229
|
-
<div
|
|
230
|
-
className="flex min-h-0 flex-1 flex-col bg-background animate-pulse"
|
|
231
|
-
data-agent-sidebar-panel-skeleton="true"
|
|
232
|
-
role="status"
|
|
233
|
-
aria-label={t("agentChat.common.loading")}
|
|
234
|
-
>
|
|
235
|
-
<div className="flex h-12 shrink-0 items-center gap-2 border-b border-border px-3">
|
|
236
|
-
<div className="h-5 w-5 rounded bg-muted" />
|
|
237
|
-
<div className="h-4 w-24 rounded bg-muted" />
|
|
238
|
-
</div>
|
|
239
|
-
<div className="flex-1 space-y-4 p-4">
|
|
240
|
-
<div className="h-4 w-2/3 rounded bg-muted" />
|
|
241
|
-
<div className="h-4 w-5/6 rounded bg-muted" />
|
|
242
|
-
<div className="h-24 rounded-lg bg-muted" />
|
|
243
|
-
</div>
|
|
244
|
-
<div className="border-t border-border p-3">
|
|
245
|
-
<div className="h-10 rounded-lg bg-muted" />
|
|
246
|
-
</div>
|
|
247
|
-
</div>
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
220
|
export interface AgentSidebarProps {
|
|
252
221
|
children: React.ReactNode;
|
|
253
222
|
enabled?: boolean;
|
|
@@ -1160,67 +1129,63 @@ export function AgentSidebar({
|
|
|
1160
1129
|
aria-hidden={sidebarAnimationEnabled && !panelOpen ? true : undefined}
|
|
1161
1130
|
>
|
|
1162
1131
|
<div className="agent-sidebar-panel-inner relative flex min-h-0 flex-1 flex-col">
|
|
1163
|
-
<
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
chatOnly={chatOnly}
|
|
1221
|
-
/>
|
|
1222
|
-
</Suspense>
|
|
1223
|
-
</LazyChunkErrorBoundary>
|
|
1132
|
+
<AgentSidebarPanel
|
|
1133
|
+
emptyStateText={emptyStateText}
|
|
1134
|
+
suggestions={suggestions}
|
|
1135
|
+
dynamicSuggestions={dynamicSuggestions}
|
|
1136
|
+
suggestionPlacement="context-chips"
|
|
1137
|
+
composerToolbarSlot={composerToolbarSlot}
|
|
1138
|
+
composerSlot={composerSlot}
|
|
1139
|
+
composerContextProvider={composerContextProvider}
|
|
1140
|
+
onComposerTextChange={onComposerTextChange}
|
|
1141
|
+
imageModelMenu={imageModelMenu}
|
|
1142
|
+
availableAgents={effectiveAvailableAgents}
|
|
1143
|
+
availableModels={availableModels}
|
|
1144
|
+
modelListLoading={modelListLoading}
|
|
1145
|
+
selectedAgent={effectiveSelectedAgent}
|
|
1146
|
+
onAgentChange={effectiveOnAgentChange}
|
|
1147
|
+
hostedHarness={hostedHarnessEnabled}
|
|
1148
|
+
onConnectProvider={onConnectProvider}
|
|
1149
|
+
onConnectLocalRuntime={onConnectLocalRuntime}
|
|
1150
|
+
runtime={runtime}
|
|
1151
|
+
adapterReloadKey={adapterReloadKey}
|
|
1152
|
+
threadFooterSlot={threadFooterSlot}
|
|
1153
|
+
apiUrl={apiUrl}
|
|
1154
|
+
agentChatSurface={agentChatSurface}
|
|
1155
|
+
desktopIdentityUnauthenticated={desktopIdentityUnauthenticated}
|
|
1156
|
+
desktopIdentityAuthenticated={desktopIdentityAuthenticated}
|
|
1157
|
+
showTabBar={effectiveShowTabBar}
|
|
1158
|
+
suppressInlineOpenApp={suppressInlineOpenApp}
|
|
1159
|
+
composerPlaceholder={composerPlaceholder}
|
|
1160
|
+
showMissingApiKeySetup={showMissingApiKeySetup}
|
|
1161
|
+
missingApiKeySetupLayout="sidebar"
|
|
1162
|
+
defaultMode={defaultMode}
|
|
1163
|
+
onCollapse={() => setOpenPersisted(false)}
|
|
1164
|
+
showCollapseButton={showCollapseButton}
|
|
1165
|
+
onSnapTo75Percent={isMobile ? undefined : snapTo75Percent}
|
|
1166
|
+
isWideDrawer={isMobile ? false : isWideDrawer}
|
|
1167
|
+
onExitWideDrawer={isMobile ? undefined : exitWideDrawer}
|
|
1168
|
+
onFullViewRequest={onFullscreenRequest}
|
|
1169
|
+
onOpenSettings={onOpenSettings}
|
|
1170
|
+
onNewCliTab={onNewCliTab}
|
|
1171
|
+
onNewUiTab={onNewUiTab}
|
|
1172
|
+
renderCliTab={renderCliTab}
|
|
1173
|
+
newTabMode={newTabMode}
|
|
1174
|
+
newCliTabLabel={newCliTabLabel}
|
|
1175
|
+
newUiTabLabel={newUiTabLabel}
|
|
1176
|
+
storageKey={storageKey}
|
|
1177
|
+
restoreActiveThread={restoreActiveThread}
|
|
1178
|
+
scope={scope}
|
|
1179
|
+
chatHistory={chatHistory}
|
|
1180
|
+
isolateHistoryByScope={isolateHistoryByScope}
|
|
1181
|
+
showScopeBadge={showScopeBadge}
|
|
1182
|
+
browserTabId={resolvedBrowserTabId}
|
|
1183
|
+
threadUrlSync={threadUrlSync}
|
|
1184
|
+
agentPageHref={agentPageHref}
|
|
1185
|
+
thinkingDisplay={thinkingDisplay}
|
|
1186
|
+
showModelSelector={showModelSelector}
|
|
1187
|
+
chatOnly={chatOnly}
|
|
1188
|
+
/>
|
|
1224
1189
|
</div>
|
|
1225
1190
|
</div>
|
|
1226
1191
|
{showResizeHandle && isLeft && (
|