@agent-native/toolkit 0.216.0 → 0.218.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.
- package/agent-native.eject.json +26 -0
- package/dist/app/agent-page/AgentContextTab.d.ts.map +1 -1
- package/dist/app/agent-page/AgentContextTab.js +1 -0
- package/dist/app/agent-page/AgentContextTab.js.map +1 -1
- package/dist/app/agentkit/react/components.d.ts.map +1 -1
- package/dist/app/agentkit/react/components.js +1 -1
- package/dist/app/agentkit/react/components.js.map +1 -1
- package/dist/app/agentkit/react/context.d.ts +4 -1
- package/dist/app/agentkit/react/context.d.ts.map +1 -1
- package/dist/app/agentkit/react/context.js +3 -1
- package/dist/app/agentkit/react/context.js.map +1 -1
- package/dist/app/agentkit/react/data-chart-layout.d.ts +30 -0
- package/dist/app/agentkit/react/data-chart-layout.d.ts.map +1 -0
- package/dist/app/agentkit/react/data-chart-layout.js +2 -0
- package/dist/app/agentkit/react/data-chart-layout.js.map +1 -0
- package/dist/app/agentkit/react/index.d.ts +1 -0
- package/dist/app/agentkit/react/index.d.ts.map +1 -1
- package/dist/app/agentkit/react/index.js +1 -0
- package/dist/app/agentkit/react/index.js.map +1 -1
- package/dist/app/agentkit/react/root.d.ts +3 -1
- package/dist/app/agentkit/react/root.d.ts.map +1 -1
- package/dist/app/agentkit/react/root.js +2 -2
- package/dist/app/agentkit/react/root.js.map +1 -1
- package/dist/app/agentkit/react/styles.css +18 -0
- package/dist/app/agentkit/react/transcript-layout.d.ts +2 -0
- package/dist/app/agentkit/react/transcript-layout.d.ts.map +1 -1
- package/dist/app/agentkit/react/transcript-layout.js.map +1 -1
- package/dist/app/auth/AuthPage.d.ts.map +1 -1
- package/dist/app/auth/AuthPage.js +33 -44
- package/dist/app/auth/AuthPage.js.map +1 -1
- package/dist/app/chat/AgentKitAssistantChat.d.ts.map +1 -1
- package/dist/app/chat/AgentKitAssistantChat.js +2 -2
- package/dist/app/chat/AgentKitAssistantChat.js.map +1 -1
- package/dist/app/chat/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/app/chat/MultiTabAssistantChat.js +51 -93
- package/dist/app/chat/MultiTabAssistantChat.js.map +1 -1
- package/dist/app/chat/agentkit-chat/action-widget.d.ts.map +1 -1
- package/dist/app/chat/agentkit-chat/action-widget.js +3 -1
- package/dist/app/chat/agentkit-chat/action-widget.js.map +1 -1
- package/dist/app/chat/agentkit-chat/rail.d.ts +1 -1
- package/dist/app/chat/agentkit-chat/rail.d.ts.map +1 -1
- package/dist/app/chat/agentkit-chat/rail.js +1 -1
- package/dist/app/chat/agentkit-chat/rail.js.map +1 -1
- package/dist/app/chat/chat/index.d.ts +2 -1
- package/dist/app/chat/chat/index.d.ts.map +1 -1
- package/dist/app/chat/chat/index.js +1 -1
- package/dist/app/chat/chat/index.js.map +1 -1
- package/dist/app/chat/chat/surface-types.d.ts +3 -0
- package/dist/app/chat/chat/surface-types.d.ts.map +1 -1
- package/dist/app/chat/chat/surface-types.js.map +1 -1
- package/dist/app/chat/chat/tool-call-display.d.ts +3 -1
- package/dist/app/chat/chat/tool-call-display.d.ts.map +1 -1
- package/dist/app/chat/chat/tool-call-display.js +4 -3
- package/dist/app/chat/chat/tool-call-display.js.map +1 -1
- package/dist/app/chat/chat/tool-render-registry.d.ts +2 -0
- package/dist/app/chat/chat/tool-render-registry.d.ts.map +1 -1
- package/dist/app/chat/chat/tool-render-registry.js.map +1 -1
- package/dist/app/chat/chat/widgets/DataChartRenderer.d.ts +3 -1
- package/dist/app/chat/chat/widgets/DataChartRenderer.d.ts.map +1 -1
- package/dist/app/chat/chat/widgets/DataChartRenderer.js +116 -26
- package/dist/app/chat/chat/widgets/DataChartRenderer.js.map +1 -1
- package/dist/app/chat/chat/widgets/DataChartWidget.d.ts +3 -1
- package/dist/app/chat/chat/widgets/DataChartWidget.d.ts.map +1 -1
- package/dist/app/chat/chat/widgets/DataChartWidget.js +21 -2
- package/dist/app/chat/chat/widgets/DataChartWidget.js.map +1 -1
- package/dist/app/chat/chat/widgets/DataInsightsWidget.d.ts +3 -1
- package/dist/app/chat/chat/widgets/DataInsightsWidget.d.ts.map +1 -1
- package/dist/app/chat/chat/widgets/DataInsightsWidget.js +2 -2
- package/dist/app/chat/chat/widgets/DataInsightsWidget.js.map +1 -1
- package/dist/app/chat/chat/widgets/DataWidgetDisplayControls.d.ts +1 -1
- package/dist/app/chat/chat/widgets/DataWidgetDisplayControls.d.ts.map +1 -1
- package/dist/app/chat/chat/widgets/DataWidgetDisplayControls.js +3 -1
- package/dist/app/chat/chat/widgets/DataWidgetDisplayControls.js.map +1 -1
- package/dist/app/chat/chat/widgets/builtin-tool-renderers.d.ts.map +1 -1
- package/dist/app/chat/chat/widgets/builtin-tool-renderers.js +2 -2
- package/dist/app/chat/chat/widgets/builtin-tool-renderers.js.map +1 -1
- package/dist/app/chat/chat-first/chat-history.d.ts +13 -2
- package/dist/app/chat/chat-first/chat-history.d.ts.map +1 -1
- package/dist/app/chat/chat-first/chat-history.js +24 -3
- package/dist/app/chat/chat-first/chat-history.js.map +1 -1
- package/dist/app/chat/ownership-history/ChatOwnerAvatar.d.ts +6 -0
- package/dist/app/chat/ownership-history/ChatOwnerAvatar.d.ts.map +1 -0
- package/dist/app/chat/ownership-history/ChatOwnerAvatar.js +9 -0
- package/dist/app/chat/ownership-history/ChatOwnerAvatar.js.map +1 -0
- package/dist/app/chat/ownership-history/index.d.ts +11 -0
- package/dist/app/chat/ownership-history/index.d.ts.map +1 -0
- package/dist/app/chat/ownership-history/index.js +22 -0
- package/dist/app/chat/ownership-history/index.js.map +1 -0
- package/dist/app/chat/ownership-history/rows.d.ts +27 -0
- package/dist/app/chat/ownership-history/rows.d.ts.map +1 -0
- package/dist/app/chat/ownership-history/rows.js +101 -0
- package/dist/app/chat/ownership-history/rows.js.map +1 -0
- package/dist/app/chat/ownership-history/useOwnershipChatHistory.d.ts +52 -0
- package/dist/app/chat/ownership-history/useOwnershipChatHistory.d.ts.map +1 -0
- package/dist/app/chat/ownership-history/useOwnershipChatHistory.js +497 -0
- package/dist/app/chat/ownership-history/useOwnershipChatHistory.js.map +1 -0
- package/dist/app/i18n/catalogs/ar-SA.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/ar-SA.js +3 -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 +3 -0
- package/dist/app/i18n/catalogs/de-DE.js.map +1 -1
- package/dist/app/i18n/catalogs/en-US.d.ts +3 -0
- package/dist/app/i18n/catalogs/en-US.d.ts.map +1 -1
- package/dist/app/i18n/catalogs/en-US.js +3 -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 +3 -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 +3 -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 +3 -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 +3 -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 +3 -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 +3 -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 +3 -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 +3 -0
- package/dist/app/i18n/catalogs/zh-TW.js.map +1 -1
- package/dist/app/onboarding/GettingStartedCard.d.ts +35 -0
- package/dist/app/onboarding/GettingStartedCard.d.ts.map +1 -0
- package/dist/app/onboarding/GettingStartedCard.js +38 -0
- package/dist/app/onboarding/GettingStartedCard.js.map +1 -0
- package/dist/app/onboarding/index.d.ts +1 -0
- package/dist/app/onboarding/index.d.ts.map +1 -1
- package/dist/app/onboarding/index.js +1 -0
- package/dist/app/onboarding/index.js.map +1 -1
- package/dist/app/providers/AppProviders.d.ts.map +1 -1
- package/dist/app/providers/AppProviders.js +3 -1
- package/dist/app/providers/AppProviders.js.map +1 -1
- package/dist/app/settings/AccountSettingsCard.d.ts.map +1 -1
- package/dist/app/settings/AccountSettingsCard.js +2 -1
- package/dist/app/settings/AccountSettingsCard.js.map +1 -1
- package/dist/app/settings/index.d.ts +1 -0
- package/dist/app/settings/index.d.ts.map +1 -1
- package/dist/app/settings/index.js +1 -0
- package/dist/app/settings/index.js.map +1 -1
- package/dist/app/settings/shell/SettingsShell.d.ts +40 -1
- package/dist/app/settings/shell/SettingsShell.d.ts.map +1 -1
- package/dist/app/settings/shell/SettingsShell.js +87 -20
- package/dist/app/settings/shell/SettingsShell.js.map +1 -1
- package/dist/app/settings/shell/bridge.d.ts +5 -3
- package/dist/app/settings/shell/bridge.d.ts.map +1 -1
- package/dist/app/settings/shell/bridge.js +8 -5
- package/dist/app/settings/shell/bridge.js.map +1 -1
- package/dist/app/settings/shell/index.d.ts +2 -2
- package/dist/app/settings/shell/index.d.ts.map +1 -1
- package/dist/app/settings/shell/index.js.map +1 -1
- package/dist/app/settings/shell/registry.d.ts +9 -1
- package/dist/app/settings/shell/registry.d.ts.map +1 -1
- package/dist/app/settings/shell/registry.js +16 -0
- package/dist/app/settings/shell/registry.js.map +1 -1
- package/dist/app/settings/shell/routing.d.ts +5 -4
- package/dist/app/settings/shell/routing.d.ts.map +1 -1
- package/dist/app/settings/shell/routing.js +38 -10
- package/dist/app/settings/shell/routing.js.map +1 -1
- package/dist/app/shared/CommandMenu.d.ts +86 -6
- package/dist/app/shared/CommandMenu.d.ts.map +1 -1
- package/dist/app/shared/CommandMenu.js +303 -41
- package/dist/app/shared/CommandMenu.js.map +1 -1
- package/dist/app/shared/ConsentBanner.d.ts +9 -0
- package/dist/app/shared/ConsentBanner.d.ts.map +1 -0
- package/dist/app/shared/ConsentBanner.js +35 -0
- package/dist/app/shared/ConsentBanner.js.map +1 -0
- package/dist/app/sharing/ShareButton.d.ts.map +1 -1
- package/dist/app/sharing/ShareButton.js +9 -8
- package/dist/app/sharing/ShareButton.js.map +1 -1
- package/dist/chat-history/ChatHistoryList.d.ts +16 -3
- package/dist/chat-history/ChatHistoryList.d.ts.map +1 -1
- package/dist/chat-history/ChatHistoryList.js +25 -15
- package/dist/chat-history/ChatHistoryList.js.map +1 -1
- package/dist/chat-history.css +109 -9
- package/dist/ui/sonner.d.ts +2 -2
- package/dist/ui/sonner.d.ts.map +1 -1
- package/dist/ui/sonner.js +2 -2
- package/dist/ui/sonner.js.map +1 -1
- package/package.json +10 -3
- package/src/app/agent-page/AgentContextTab.spec.ts +50 -2
- package/src/app/agent-page/AgentContextTab.tsx +1 -0
- package/src/app/agentkit/react/components.interaction.spec.tsx +2 -0
- package/src/app/agentkit/react/components.spec.tsx +4 -1
- package/src/app/agentkit/react/components.tsx +3 -0
- package/src/app/agentkit/react/context.tsx +6 -0
- package/src/app/agentkit/react/data-chart-layout.ts +25 -0
- package/src/app/agentkit/react/index.ts +1 -0
- package/src/app/agentkit/react/root.tsx +4 -0
- package/src/app/agentkit/react/styles.css +18 -0
- package/src/app/agentkit/react/transcript-layout.ts +2 -0
- package/src/app/auth/AuthPage.interaction.spec.tsx +74 -0
- package/src/app/auth/AuthPage.tsx +32 -39
- package/src/app/chat/AgentKitAssistantChat.tsx +2 -0
- package/src/app/chat/MultiTabAssistantChat.spec.tsx +270 -3
- package/src/app/chat/MultiTabAssistantChat.tsx +79 -156
- package/src/app/chat/agentkit-chat/action-widget.tsx +3 -0
- package/src/app/chat/agentkit-chat/rail.ts +11 -0
- package/src/app/chat/chat/index.ts +10 -0
- package/src/app/chat/chat/surface-types.ts +3 -0
- package/src/app/chat/chat/tool-call-display.spec.tsx +29 -0
- package/src/app/chat/chat/tool-call-display.tsx +7 -0
- package/src/app/chat/chat/tool-render-registry.tsx +3 -0
- package/src/app/chat/chat/widgets/DataChartRenderer.spec.tsx +377 -17
- package/src/app/chat/chat/widgets/DataChartRenderer.tsx +232 -63
- package/src/app/chat/chat/widgets/DataChartWidget.spec.tsx +67 -0
- package/src/app/chat/chat/widgets/DataChartWidget.tsx +39 -5
- package/src/app/chat/chat/widgets/DataInsightsWidget.tsx +13 -2
- package/src/app/chat/chat/widgets/DataWidgetDisplayControls.tsx +6 -4
- package/src/app/chat/chat/widgets/builtin-tool-renderers.tsx +5 -1
- package/src/app/chat/chat-first/chat-history.spec.tsx +79 -0
- package/src/app/chat/chat-first/chat-history.tsx +75 -22
- package/src/app/chat/ownership-history/ChatOwnerAvatar.tsx +27 -0
- package/src/app/chat/ownership-history/index.tsx +67 -0
- package/src/app/chat/ownership-history/ownership-history.spec.tsx +3146 -0
- package/src/app/chat/ownership-history/rows.ts +156 -0
- package/src/app/chat/ownership-history/useOwnershipChatHistory.ts +709 -0
- package/src/app/i18n/catalogs/ar-SA.ts +3 -0
- package/src/app/i18n/catalogs/de-DE.ts +3 -0
- package/src/app/i18n/catalogs/en-US.ts +3 -0
- package/src/app/i18n/catalogs/es-ES.ts +3 -0
- package/src/app/i18n/catalogs/fr-FR.ts +3 -0
- package/src/app/i18n/catalogs/hi-IN.ts +3 -0
- package/src/app/i18n/catalogs/ja-JP.ts +3 -0
- package/src/app/i18n/catalogs/ko-KR.ts +3 -0
- package/src/app/i18n/catalogs/pt-BR.ts +3 -0
- package/src/app/i18n/catalogs/zh-CN.ts +3 -0
- package/src/app/i18n/catalogs/zh-TW.ts +3 -0
- package/src/app/onboarding/GettingStartedCard.tsx +203 -0
- package/src/app/onboarding/index.ts +1 -0
- package/src/app/providers/AppProviders.tsx +7 -1
- package/src/app/settings/AccountSettingsCard.spec.tsx +31 -0
- package/src/app/settings/AccountSettingsCard.tsx +8 -0
- package/src/app/settings/index.ts +1 -0
- package/src/app/settings/shell/SettingsShell.spec.tsx +472 -1
- package/src/app/settings/shell/SettingsShell.tsx +245 -31
- package/src/app/settings/shell/bridge.spec.ts +12 -0
- package/src/app/settings/shell/bridge.ts +17 -4
- package/src/app/settings/shell/index.ts +6 -1
- package/src/app/settings/shell/registry.ts +33 -1
- package/src/app/settings/shell/routing.spec.ts +92 -1
- package/src/app/settings/shell/routing.ts +52 -9
- package/src/app/shared/CommandMenu.spec.tsx +1662 -1
- package/src/app/shared/CommandMenu.tsx +763 -164
- package/src/app/shared/ConsentBanner.spec.tsx +141 -0
- package/src/app/shared/ConsentBanner.tsx +141 -0
- package/src/app/sharing/ShareButton.tsx +12 -10
- package/src/chat-history/ChatHistoryList.spec.tsx +51 -0
- package/src/chat-history/ChatHistoryList.tsx +87 -26
- package/src/chat-history/ChatHistoryRailSections.spec.tsx +12 -4
- package/src/chat-history.css +109 -9
- package/src/ui/sonner.spec.ts +10 -0
- package/src/ui/sonner.tsx +2 -2
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
import {
|
|
34
34
|
useChatThreads,
|
|
35
35
|
type ChatThreadScope,
|
|
36
|
-
type ChatThreadSummary,
|
|
37
36
|
} from "@agent-native/core/client/agent-chat";
|
|
38
37
|
import { agentNativePath, appPath } from "@agent-native/core/client/api-path";
|
|
39
38
|
import { getBrowserTabId } from "@agent-native/core/client/hooks";
|
|
@@ -80,17 +79,13 @@ import React, {
|
|
|
80
79
|
useLayoutEffect,
|
|
81
80
|
useCallback,
|
|
82
81
|
} from "react";
|
|
82
|
+
import { toast } from "sonner";
|
|
83
83
|
|
|
84
84
|
import {
|
|
85
85
|
getAgentChatNavigationKey,
|
|
86
86
|
type AgentChatNavigationKey,
|
|
87
87
|
} from "./agent-sidebar-events.js";
|
|
88
88
|
import { AgentKitAssistantChat } from "./AgentKitAssistantChat.js";
|
|
89
|
-
import {
|
|
90
|
-
ChatHistoryList,
|
|
91
|
-
type ChatHistoryItem,
|
|
92
|
-
type ChatHistorySection,
|
|
93
|
-
} from "./chat/ChatHistoryList.js";
|
|
94
89
|
import type {
|
|
95
90
|
AssistantChatProps,
|
|
96
91
|
AssistantChatHandle,
|
|
@@ -98,6 +93,12 @@ import type {
|
|
|
98
93
|
AssistantChatSendOptions,
|
|
99
94
|
} from "./chat/surface-types.js";
|
|
100
95
|
import { fallbackChatTitle } from "./fallback-chat-title.js";
|
|
96
|
+
import {
|
|
97
|
+
OwnershipChatHistoryRail,
|
|
98
|
+
ownDraftRows,
|
|
99
|
+
useOwnershipChatHistory,
|
|
100
|
+
type OwnDraftRow,
|
|
101
|
+
} from "./ownership-history/index.js";
|
|
101
102
|
|
|
102
103
|
type AgentActionScope = NonNullable<AgentChatMessage["actionScope"]>;
|
|
103
104
|
const PREFILL_CONTEXT_KEY = "agent-chat-prefill-context";
|
|
@@ -488,139 +489,75 @@ function formatThreadTime(
|
|
|
488
489
|
}
|
|
489
490
|
|
|
490
491
|
function HistoryPopover({
|
|
491
|
-
|
|
492
|
+
apiUrl,
|
|
493
|
+
scope,
|
|
494
|
+
localMineRows,
|
|
492
495
|
openTabIds,
|
|
493
496
|
activeThreadId,
|
|
494
|
-
hasMoreThreads = false,
|
|
495
|
-
isLoadingMoreThreads = false,
|
|
496
|
-
loadError,
|
|
497
497
|
onSelect,
|
|
498
|
+
onNewChat,
|
|
498
499
|
onClose,
|
|
499
|
-
onLoadMore,
|
|
500
|
-
onSearch,
|
|
501
500
|
onTogglePin,
|
|
502
501
|
onRename,
|
|
502
|
+
getThreadUrl,
|
|
503
503
|
popoverAlign = "end",
|
|
504
504
|
}: {
|
|
505
|
-
|
|
505
|
+
apiUrl?: string;
|
|
506
|
+
scope?: ChatThreadScope;
|
|
507
|
+
localMineRows: OwnDraftRow[];
|
|
506
508
|
openTabIds: Set<string>;
|
|
507
509
|
activeThreadId: string | null;
|
|
508
|
-
hasMoreThreads?: boolean;
|
|
509
|
-
isLoadingMoreThreads?: boolean;
|
|
510
|
-
loadError?: string | null;
|
|
511
510
|
onSelect: (id: string) => void;
|
|
511
|
+
onNewChat: () => void;
|
|
512
512
|
onClose: () => void;
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
* current pinned state so the caller can flip it. */
|
|
517
|
-
onTogglePin?: (id: string, pinned: boolean) => void;
|
|
518
|
-
/** Presence enables the inline rename row action. */
|
|
519
|
-
onRename?: (id: string, nextTitle: string) => void;
|
|
513
|
+
onTogglePin: (id: string, pinned: boolean) => Promise<boolean>;
|
|
514
|
+
onRename: (id: string, nextTitle: string) => Promise<boolean>;
|
|
515
|
+
getThreadUrl: (id: string) => string;
|
|
520
516
|
popoverAlign?: "start" | "end";
|
|
521
517
|
}) {
|
|
522
518
|
const t = useT();
|
|
523
519
|
const locale = useOptionalLocale()?.locale ?? DEFAULT_LOCALE;
|
|
524
520
|
const [search, setSearch] = useState("");
|
|
525
|
-
const [
|
|
526
|
-
ChatThreadSummary[] | null
|
|
527
|
-
>(null);
|
|
528
|
-
const [isSearching, setIsSearching] = useState(false);
|
|
521
|
+
const [query, setQuery] = useState("");
|
|
529
522
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
530
|
-
const debounceRef = useRef<ReturnType<typeof setTimeout>>(undefined);
|
|
531
523
|
|
|
532
524
|
useEffect(() => {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
setSearchResults(results);
|
|
554
|
-
} else {
|
|
555
|
-
// Fallback to client-side filtering
|
|
556
|
-
setSearchResults(null);
|
|
557
|
-
}
|
|
558
|
-
setIsSearching(false);
|
|
559
|
-
}, 250);
|
|
560
|
-
return () => {
|
|
561
|
-
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
562
|
-
};
|
|
563
|
-
}, [search, onSearch]);
|
|
564
|
-
|
|
565
|
-
// Hide empty threads from the history list — except the currently-active
|
|
566
|
-
// one. The active thread always belongs in the list so the user can see
|
|
567
|
-
// they're in it (the previous filter dropped a brand-new chat the user
|
|
568
|
-
// had just opened, making them think their chat had vanished).
|
|
569
|
-
const visibleThreads = threads.filter(
|
|
570
|
-
(t) => t.messageCount > 0 || t.id === activeThreadId,
|
|
571
|
-
);
|
|
572
|
-
|
|
573
|
-
const filtered = search.trim()
|
|
574
|
-
? (searchResults ?? visibleThreads).filter(
|
|
575
|
-
(t) => t.messageCount > 0 || t.id === activeThreadId,
|
|
576
|
-
)
|
|
577
|
-
: visibleThreads;
|
|
578
|
-
|
|
579
|
-
// Pinned threads always float to the top of `threads` already (see
|
|
580
|
-
// `sortThreadSummaries` in use-chat-threads.ts and the matching server
|
|
581
|
-
// ORDER BY), but pulling them into their own labeled section — instead of
|
|
582
|
-
// just relying on sort order within "All chats" — makes the pin affordance
|
|
583
|
-
// visible at a glance, matching common chat-history UX.
|
|
584
|
-
const pinnedThreads = filtered.filter((t) => t.pinnedAt != null);
|
|
585
|
-
const unpinnedThreads = filtered.filter((t) => t.pinnedAt == null);
|
|
586
|
-
|
|
587
|
-
const toHistoryItem = (thread: ChatThreadSummary): ChatHistoryItem => {
|
|
588
|
-
const isActive = thread.id === activeThreadId;
|
|
589
|
-
const hasTitle = Boolean(thread.title);
|
|
590
|
-
const title = thread.title || t("agentChat.history.untitledChat");
|
|
591
|
-
return {
|
|
592
|
-
id: thread.id,
|
|
593
|
-
title,
|
|
594
|
-
titleText: title,
|
|
525
|
+
const timer = setTimeout(() => setQuery(search.trim()), 250);
|
|
526
|
+
return () => clearTimeout(timer);
|
|
527
|
+
}, [search]);
|
|
528
|
+
|
|
529
|
+
// This component is mounted only while the popover is open.
|
|
530
|
+
const history = useOwnershipChatHistory({
|
|
531
|
+
apiUrl,
|
|
532
|
+
scope,
|
|
533
|
+
enabled: true,
|
|
534
|
+
query,
|
|
535
|
+
activeId: activeThreadId,
|
|
536
|
+
pinned: true,
|
|
537
|
+
localMineRows,
|
|
538
|
+
mutations: { pin: onTogglePin, rename: onRename },
|
|
539
|
+
getThreadUrl,
|
|
540
|
+
onMutationFailed: () => toast.error(t("agentChat.common.saveFailed")),
|
|
541
|
+
decorateItem: (item, row) => ({
|
|
542
|
+
...item,
|
|
543
|
+
title: row.title || t("agentChat.history.untitledChat"),
|
|
544
|
+
titleText: row.title || t("agentChat.history.untitledChat"),
|
|
595
545
|
subtitle:
|
|
596
|
-
|
|
597
|
-
?
|
|
546
|
+
row.title && row.preview && row.title !== row.preview
|
|
547
|
+
? row.preview
|
|
598
548
|
: undefined,
|
|
599
|
-
timestamp:
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
}
|
|
610
|
-
};
|
|
611
|
-
|
|
612
|
-
const historySections: ChatHistorySection[] = [
|
|
613
|
-
...(pinnedThreads.length > 0
|
|
614
|
-
? [
|
|
615
|
-
{
|
|
616
|
-
id: "pinned",
|
|
617
|
-
label: t("agentChat.history.pinned"),
|
|
618
|
-
items: pinnedThreads.map(toHistoryItem),
|
|
619
|
-
},
|
|
620
|
-
]
|
|
621
|
-
: []),
|
|
622
|
-
{ id: "all", items: unpinnedThreads.map(toHistoryItem) },
|
|
623
|
-
];
|
|
549
|
+
timestamp:
|
|
550
|
+
row.id === activeThreadId
|
|
551
|
+
? t("agentChat.history.active")
|
|
552
|
+
: openTabIds.has(row.id)
|
|
553
|
+
? t("agentChat.history.open")
|
|
554
|
+
: formatThreadTime(
|
|
555
|
+
row.updatedAt,
|
|
556
|
+
locale,
|
|
557
|
+
t("agentChat.history.yesterday"),
|
|
558
|
+
),
|
|
559
|
+
}),
|
|
560
|
+
});
|
|
624
561
|
|
|
625
562
|
return (
|
|
626
563
|
<Popover open onOpenChange={(open) => !open && onClose()}>
|
|
@@ -640,46 +577,23 @@ function HistoryPopover({
|
|
|
640
577
|
}}
|
|
641
578
|
className="w-72 rounded-lg p-0"
|
|
642
579
|
>
|
|
643
|
-
<
|
|
644
|
-
|
|
580
|
+
<OwnershipChatHistoryRail
|
|
581
|
+
{...history}
|
|
645
582
|
activeId={activeThreadId}
|
|
583
|
+
onNewChat={onNewChat}
|
|
584
|
+
showNewChat={false}
|
|
646
585
|
onSelect={(id) => {
|
|
647
586
|
onSelect(id);
|
|
648
587
|
onClose();
|
|
649
588
|
}}
|
|
650
|
-
onTogglePin={
|
|
651
|
-
onTogglePin
|
|
652
|
-
? (id) => {
|
|
653
|
-
const isPinned =
|
|
654
|
-
threads.find((t) => t.id === id)?.pinnedAt != null;
|
|
655
|
-
onTogglePin(id, !isPinned);
|
|
656
|
-
}
|
|
657
|
-
: undefined
|
|
658
|
-
}
|
|
659
|
-
onRename={onRename}
|
|
660
589
|
searchValue={search}
|
|
661
590
|
onSearchChange={setSearch}
|
|
662
591
|
searchPlaceholder={t("agentChat.history.search")}
|
|
663
592
|
searchInputRef={inputRef}
|
|
664
|
-
loading={isSearching}
|
|
665
593
|
loadingLabel={t("agentChat.history.searching")}
|
|
666
|
-
error={loadError && !search.trim() ? loadError : undefined}
|
|
667
594
|
emptyLabel={t("agentChat.history.empty")}
|
|
668
595
|
emptySearchLabel={t("agentChat.history.noMatches")}
|
|
669
|
-
|
|
670
|
-
!search.trim() && hasMoreThreads ? (
|
|
671
|
-
<button
|
|
672
|
-
type="button"
|
|
673
|
-
onClick={() => onLoadMore?.()}
|
|
674
|
-
disabled={isLoadingMoreThreads}
|
|
675
|
-
className="mx-1 mt-1 flex w-[calc(100%-0.5rem)] items-center justify-center rounded-md px-3 py-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground disabled:cursor-default disabled:opacity-60"
|
|
676
|
-
>
|
|
677
|
-
{isLoadingMoreThreads
|
|
678
|
-
? t("agentChat.common.loading")
|
|
679
|
-
: t("agentChat.history.loadOlder")}
|
|
680
|
-
</button>
|
|
681
|
-
) : undefined
|
|
682
|
-
}
|
|
596
|
+
className="an-chat-history--capped"
|
|
683
597
|
/>
|
|
684
598
|
</PopoverContent>
|
|
685
599
|
</Popover>
|
|
@@ -1284,12 +1198,7 @@ export function MultiTabAssistantChat({
|
|
|
1284
1198
|
forkThread,
|
|
1285
1199
|
saveThreadData,
|
|
1286
1200
|
generateTitle,
|
|
1287
|
-
searchThreads,
|
|
1288
|
-
loadMoreThreads,
|
|
1289
1201
|
refreshThreads,
|
|
1290
|
-
hasMoreThreads,
|
|
1291
|
-
isLoadingMoreThreads,
|
|
1292
|
-
threadsLoadError,
|
|
1293
1202
|
restoredThreadIdOnListFailure,
|
|
1294
1203
|
evictedThreadIds,
|
|
1295
1204
|
isNewThread,
|
|
@@ -1333,6 +1242,7 @@ export function MultiTabAssistantChat({
|
|
|
1333
1242
|
const [showHistory, setShowHistory] = useState(false);
|
|
1334
1243
|
const [pageOverlayScrolled, setPageOverlayScrolled] = useState(false);
|
|
1335
1244
|
const newThreadIds = useRef<Set<string>>(new Set());
|
|
1245
|
+
const observedThreadStarts = useRef(new Map<string, number>());
|
|
1336
1246
|
const [, setThreadPersistenceVersion] = useState(0);
|
|
1337
1247
|
const handleThreadSnapshotPersisted = useCallback(
|
|
1338
1248
|
(threadId: string, messageCount: number) => {
|
|
@@ -2732,6 +2642,7 @@ export function MultiTabAssistantChat({
|
|
|
2732
2642
|
if (!detail) return;
|
|
2733
2643
|
const { isRunning, tabId } = detail;
|
|
2734
2644
|
if (!tabId) return;
|
|
2645
|
+
if (isRunning) observedThreadStarts.current.set(tabId, Date.now());
|
|
2735
2646
|
|
|
2736
2647
|
setRunningThreads((prev) => {
|
|
2737
2648
|
const next = new Set(prev);
|
|
@@ -3939,18 +3850,30 @@ export function MultiTabAssistantChat({
|
|
|
3939
3850
|
{/* History popover — rendered inside relative container so positioning works */}
|
|
3940
3851
|
{showHistory && (
|
|
3941
3852
|
<HistoryPopover
|
|
3942
|
-
|
|
3853
|
+
apiUrl={apiUrl}
|
|
3854
|
+
scope={isolateHistoryByScope ? (scope ?? undefined) : undefined}
|
|
3855
|
+
localMineRows={ownDraftRows({
|
|
3856
|
+
threads: threads.map((thread) => ({
|
|
3857
|
+
...thread,
|
|
3858
|
+
messageCount: messageCounts[thread.id] ?? thread.messageCount,
|
|
3859
|
+
})),
|
|
3860
|
+
isNewThread,
|
|
3861
|
+
activeId: activeThreadId,
|
|
3862
|
+
observedThreadStarts: observedThreadStarts.current,
|
|
3863
|
+
})}
|
|
3943
3864
|
openTabIds={new Set(openTabIds)}
|
|
3944
3865
|
activeThreadId={activeThreadId}
|
|
3945
|
-
hasMoreThreads={hasMoreThreads}
|
|
3946
|
-
isLoadingMoreThreads={isLoadingMoreThreads}
|
|
3947
|
-
loadError={threadsLoadError}
|
|
3948
3866
|
onSelect={openFromHistory}
|
|
3867
|
+
onNewChat={addTab}
|
|
3949
3868
|
onClose={() => setShowHistory(false)}
|
|
3950
|
-
onLoadMore={loadMoreThreads}
|
|
3951
|
-
onSearch={searchThreads}
|
|
3952
3869
|
onTogglePin={pinThread}
|
|
3953
3870
|
onRename={renameThread}
|
|
3871
|
+
getThreadUrl={(threadId) => {
|
|
3872
|
+
if (getThreadPath) return appPath(getThreadPath(threadId));
|
|
3873
|
+
const url = new URL(window.location.href);
|
|
3874
|
+
url.searchParams.set(threadUrlParamName, threadId);
|
|
3875
|
+
return url.toString();
|
|
3876
|
+
}}
|
|
3954
3877
|
popoverAlign={renderOverlay ? "start" : "end"}
|
|
3955
3878
|
/>
|
|
3956
3879
|
)}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
|
|
7
7
|
import { AgentWidgetView } from "../../agentkit/react/components.js";
|
|
8
8
|
import {
|
|
9
|
+
useAgentKit,
|
|
9
10
|
useAgentThread,
|
|
10
11
|
type AgentKitRenderProps,
|
|
11
12
|
} from "../../agentkit/react/context.js";
|
|
@@ -30,6 +31,7 @@ export function AgentKitActionWidget({
|
|
|
30
31
|
value: widget,
|
|
31
32
|
threadId,
|
|
32
33
|
}: AgentKitRenderProps<AgentWidget>) {
|
|
34
|
+
const { dataChartLayout } = useAgentKit();
|
|
33
35
|
const thread = useAgentThread(threadId);
|
|
34
36
|
const data = asRecord(widget.data);
|
|
35
37
|
const toolCallId = data?.toolCallId;
|
|
@@ -93,6 +95,7 @@ export function AgentKitActionWidget({
|
|
|
93
95
|
...(relatedResults.length > 1 ? { relatedResults } : {}),
|
|
94
96
|
widgetId: widget.id,
|
|
95
97
|
isRunning: tool.status === "running",
|
|
98
|
+
dataChartLayout,
|
|
96
99
|
chatUI: {
|
|
97
100
|
renderer: widget.kind,
|
|
98
101
|
...(widget.title ? { title: widget.title } : {}),
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
export {
|
|
2
2
|
useChatThreads,
|
|
3
|
+
useChatThreadList,
|
|
4
|
+
notifyChatThreadsUpdated,
|
|
5
|
+
type ChatThreadListRow,
|
|
6
|
+
type ChatThreadAccessBasis,
|
|
7
|
+
type ChatThreadOwnership,
|
|
8
|
+
type ChatThreadVisibility,
|
|
9
|
+
type ChatThreadListRefreshOutcome,
|
|
10
|
+
type ChatThreadScope,
|
|
11
|
+
type UseChatThreadsOptions,
|
|
12
|
+
type UseChatThreadListOptions,
|
|
13
|
+
type UseChatThreadListResult,
|
|
3
14
|
type ChatThreadSummary,
|
|
4
15
|
} from "@agent-native/core/client/agent-chat";
|
|
5
16
|
export {
|
|
@@ -54,6 +54,7 @@ export type {
|
|
|
54
54
|
AgentChatSurfaceKind,
|
|
55
55
|
} from "./surface-types.js";
|
|
56
56
|
export type { AgentChatTranscriptLayout } from "../../agentkit/react/transcript-layout.js";
|
|
57
|
+
export type { AgentChatDataChartLayout } from "../../agentkit/react/data-chart-layout.js";
|
|
57
58
|
export type { AgentChatWorkedForRowLayout } from "../../agentkit/react/transcript-layout.js";
|
|
58
59
|
export type {
|
|
59
60
|
MultiTabAssistantChatProps,
|
|
@@ -222,6 +223,15 @@ export {
|
|
|
222
223
|
} from "@agent-native/core/client/agent-chat";
|
|
223
224
|
export {
|
|
224
225
|
useChatThreads,
|
|
226
|
+
useChatThreadList,
|
|
227
|
+
notifyChatThreadsUpdated,
|
|
228
|
+
type ChatThreadListRow,
|
|
229
|
+
type ChatThreadAccessBasis,
|
|
230
|
+
type ChatThreadOwnership,
|
|
231
|
+
type ChatThreadVisibility,
|
|
232
|
+
type ChatThreadListRefreshOutcome,
|
|
233
|
+
type UseChatThreadListOptions,
|
|
234
|
+
type UseChatThreadListResult,
|
|
225
235
|
type ChatThreadScope,
|
|
226
236
|
type ChatThreadSnapshot,
|
|
227
237
|
type ChatThreadSummary,
|
|
@@ -27,6 +27,7 @@ import type { ExportedMessageRepository } from "@assistant-ui/react";
|
|
|
27
27
|
import type * as React from "react";
|
|
28
28
|
|
|
29
29
|
import type { AgentKitWorkedForSummaryRenderProps } from "../../agentkit/react/context.js";
|
|
30
|
+
import type { AgentChatDataChartLayout } from "../../agentkit/react/data-chart-layout.js";
|
|
30
31
|
import type { AgentMessageContentOrderResolver } from "../../agentkit/react/message-content-order.js";
|
|
31
32
|
import type {
|
|
32
33
|
AgentChatTranscriptLayout,
|
|
@@ -244,6 +245,8 @@ export interface AssistantChatProps {
|
|
|
244
245
|
emptyStateFooter?: React.ReactNode;
|
|
245
246
|
/** Optional transcript geometry. Omitted values keep the shared defaults. */
|
|
246
247
|
transcriptLayout?: AgentChatTranscriptLayout;
|
|
248
|
+
/** Optional sizing and typography for built-in chat data charts. */
|
|
249
|
+
dataChartLayout?: AgentChatDataChartLayout;
|
|
247
250
|
/** Optional elapsed-work row geometry. Omitted values keep the shared defaults. */
|
|
248
251
|
workedForRowLayout?: AgentChatWorkedForRowLayout;
|
|
249
252
|
/** Optional duration text for the shared completed-work row. */
|
|
@@ -352,6 +352,35 @@ describe("ToolCallDisplay native renderers", () => {
|
|
|
352
352
|
expect(container.textContent).not.toContain("Ada");
|
|
353
353
|
});
|
|
354
354
|
|
|
355
|
+
it("passes the app chart layout to regular tool renderers", () => {
|
|
356
|
+
const layout = { maxWidth: 760, labelFontSize: 14 };
|
|
357
|
+
registerToolRenderer({
|
|
358
|
+
id: "app.chart-layout",
|
|
359
|
+
match: "app-chart-layout",
|
|
360
|
+
Component: ({ context }) => (
|
|
361
|
+
<div data-chart-layout-width={context.dataChartLayout?.maxWidth} />
|
|
362
|
+
),
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
act(() => {
|
|
366
|
+
root.render(
|
|
367
|
+
<ToolCallDisplay
|
|
368
|
+
toolName="app-chart-layout"
|
|
369
|
+
args={{}}
|
|
370
|
+
result="ready"
|
|
371
|
+
isRunning={false}
|
|
372
|
+
dataChartLayout={layout}
|
|
373
|
+
/>,
|
|
374
|
+
);
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
expect(
|
|
378
|
+
container
|
|
379
|
+
.querySelector("[data-chart-layout-width]")
|
|
380
|
+
?.getAttribute("data-chart-layout-width"),
|
|
381
|
+
).toBe("760");
|
|
382
|
+
});
|
|
383
|
+
|
|
355
384
|
it("renders table-only data insight payloads without a chart", async () => {
|
|
356
385
|
await act(async () => {
|
|
357
386
|
root.render(
|
|
@@ -47,6 +47,7 @@ import React, {
|
|
|
47
47
|
useRef,
|
|
48
48
|
} from "react";
|
|
49
49
|
|
|
50
|
+
import type { AgentChatDataChartLayout } from "../../agentkit/react/data-chart-layout.js";
|
|
50
51
|
import {
|
|
51
52
|
workedForRowChevronStyle,
|
|
52
53
|
workedForRowSummaryStyle,
|
|
@@ -647,6 +648,7 @@ export function ToolCallDisplay({
|
|
|
647
648
|
isLatestRunning = isRunning,
|
|
648
649
|
isActiveTail,
|
|
649
650
|
workedForRowLayout,
|
|
651
|
+
dataChartLayout,
|
|
650
652
|
formatWorkedForDuration,
|
|
651
653
|
}: {
|
|
652
654
|
toolName: string;
|
|
@@ -670,6 +672,7 @@ export function ToolCallDisplay({
|
|
|
670
672
|
repeatCount?: number;
|
|
671
673
|
isActiveTail?: boolean;
|
|
672
674
|
workedForRowLayout?: AgentChatWorkedForRowLayout;
|
|
675
|
+
dataChartLayout?: AgentChatDataChartLayout;
|
|
673
676
|
formatWorkedForDuration?: (durationMs: number) => string;
|
|
674
677
|
/** @deprecated Use isActiveTail. */
|
|
675
678
|
isLatestRunning?: boolean;
|
|
@@ -758,6 +761,7 @@ export function ToolCallDisplay({
|
|
|
758
761
|
repeatCount={repeatCount}
|
|
759
762
|
context={builderContext}
|
|
760
763
|
workedForRowLayout={workedForRowLayout}
|
|
764
|
+
dataChartLayout={dataChartLayout}
|
|
761
765
|
formatWorkedForDuration={formatWorkedForDuration}
|
|
762
766
|
/>,
|
|
763
767
|
);
|
|
@@ -782,6 +786,7 @@ function ToolCallDisplayGeneric({
|
|
|
782
786
|
repeatCount,
|
|
783
787
|
context,
|
|
784
788
|
workedForRowLayout,
|
|
789
|
+
dataChartLayout,
|
|
785
790
|
formatWorkedForDuration,
|
|
786
791
|
}: {
|
|
787
792
|
toolName: string;
|
|
@@ -805,6 +810,7 @@ function ToolCallDisplayGeneric({
|
|
|
805
810
|
repeatCount?: number;
|
|
806
811
|
context?: string;
|
|
807
812
|
workedForRowLayout?: AgentChatWorkedForRowLayout;
|
|
813
|
+
dataChartLayout?: AgentChatDataChartLayout;
|
|
808
814
|
formatWorkedForDuration?: (durationMs: number) => string;
|
|
809
815
|
}) {
|
|
810
816
|
const t = useT();
|
|
@@ -919,6 +925,7 @@ function ToolCallDisplayGeneric({
|
|
|
919
925
|
resultJson: parsedResult,
|
|
920
926
|
isRunning,
|
|
921
927
|
isActiveTail,
|
|
928
|
+
dataChartLayout,
|
|
922
929
|
...(typeof toolCallId === "string"
|
|
923
930
|
? { widgetId: `${toolCallId}:chat-ui` }
|
|
924
931
|
: {}),
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ActionChatUIConfig } from "@agent-native/core/action-ui";
|
|
2
2
|
import type { ComponentType } from "react";
|
|
3
3
|
|
|
4
|
+
import type { AgentChatDataChartLayout } from "../../agentkit/react/data-chart-layout.js";
|
|
5
|
+
|
|
4
6
|
export interface ToolRendererContext {
|
|
5
7
|
toolName: string;
|
|
6
8
|
args: Record<string, unknown>;
|
|
@@ -15,6 +17,7 @@ export interface ToolRendererContext {
|
|
|
15
17
|
isRunning: boolean;
|
|
16
18
|
isActiveTail?: boolean;
|
|
17
19
|
chatUI?: ActionChatUIConfig;
|
|
20
|
+
dataChartLayout?: AgentChatDataChartLayout;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export interface ToolRendererProps {
|