@agent-native/toolkit 0.217.0 → 0.219.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 +21 -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 +31 -6
- 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/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/AgentPanel.js +6 -6
- package/dist/app/chat/AgentPanel.js.map +1 -1
- package/dist/app/chat/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/app/chat/MultiTabAssistantChat.js +53 -95
- 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 +4 -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 +5 -1
- package/dist/app/chat/chat/tool-call-display.d.ts.map +1 -1
- package/dist/app/chat/chat/tool-call-display.js +6 -4
- package/dist/app/chat/chat/tool-call-display.js.map +1 -1
- package/dist/app/chat/chat/tool-render-registry.d.ts +4 -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/conversation/AgentConversation.d.ts.map +1 -1
- package/dist/app/chat/conversation/AgentConversation.js +6 -1
- package/dist/app/chat/conversation/AgentConversation.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/shared/CommandMenu.d.ts +2 -0
- package/dist/app/shared/CommandMenu.d.ts.map +1 -1
- package/dist/app/shared/CommandMenu.js +11 -6
- package/dist/app/shared/CommandMenu.js.map +1 -1
- 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/composer/TiptapComposer.js +1 -1
- package/dist/composer/TiptapComposer.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 +11 -6
- 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 +31 -6
- package/src/app/agentkit/react/transcript-layout.ts +2 -0
- package/src/app/chat/AgentKitAssistantChat.spec.tsx +201 -27
- package/src/app/chat/AgentKitAssistantChat.tsx +3 -0
- package/src/app/chat/AgentPanel.tsx +8 -8
- package/src/app/chat/MultiTabAssistantChat.spec.tsx +270 -3
- package/src/app/chat/MultiTabAssistantChat.tsx +81 -158
- package/src/app/chat/agentkit-chat/action-widget.spec.tsx +62 -0
- package/src/app/chat/agentkit-chat/action-widget.tsx +4 -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 +17 -1
- package/src/app/chat/chat/tool-render-registry.tsx +5 -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/conversation/AgentConversation.spec.tsx +51 -1
- package/src/app/chat/conversation/AgentConversation.tsx +11 -2
- 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/shared/CommandMenu.spec.tsx +175 -6
- package/src/app/shared/CommandMenu.tsx +24 -7
- 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/composer/TiptapComposer.tsx +1 -1
|
@@ -32,6 +32,68 @@ import { AgentKitActionWidget } from "./action-widget.js";
|
|
|
32
32
|
const catalog = createToolkitI18nCatalog({ messages: {} });
|
|
33
33
|
|
|
34
34
|
describe("AgentKitActionWidget", () => {
|
|
35
|
+
it.each(["running", "completed", "failed", "cancelled"] as const)(
|
|
36
|
+
"exposes the %s tool status to renderers while retaining isRunning",
|
|
37
|
+
async (status) => {
|
|
38
|
+
const toolCall: AgentToolCall = {
|
|
39
|
+
id: "tool-1",
|
|
40
|
+
name: "preview-inbox",
|
|
41
|
+
input: {},
|
|
42
|
+
output: { ok: true },
|
|
43
|
+
status,
|
|
44
|
+
};
|
|
45
|
+
const widget: AgentWidget = {
|
|
46
|
+
id: "tool-1:chat-ui",
|
|
47
|
+
kind: "mail.inbox-preview",
|
|
48
|
+
data: { toolCallId: toolCall.id, toolName: toolCall.name },
|
|
49
|
+
};
|
|
50
|
+
const client = new AgentKitClient({
|
|
51
|
+
transport: {
|
|
52
|
+
async startRun() {
|
|
53
|
+
return { runId: "run-1" };
|
|
54
|
+
},
|
|
55
|
+
async *subscribeToRun() {},
|
|
56
|
+
async cancelRun() {},
|
|
57
|
+
async getThreadSnapshot() {
|
|
58
|
+
return {
|
|
59
|
+
id: "thread-1",
|
|
60
|
+
createdAt: "2026-09-26T00:00:00.000Z",
|
|
61
|
+
updatedAt: "2026-09-26T00:00:00.000Z",
|
|
62
|
+
messages: [],
|
|
63
|
+
toolCalls: [toolCall],
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
await client.loadThread("thread-1");
|
|
69
|
+
const unregister = registerActionChatRenderer({
|
|
70
|
+
id: `test.agentkit-action-widget-status-${status}`,
|
|
71
|
+
renderer: widget.kind,
|
|
72
|
+
Component: ({ context }: ToolRendererProps) => (
|
|
73
|
+
<output
|
|
74
|
+
data-status={context.status}
|
|
75
|
+
data-running={String(context.isRunning)}
|
|
76
|
+
/>
|
|
77
|
+
),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
const html = renderToStaticMarkup(
|
|
82
|
+
<AgentKitProvider controller={client} threadId="thread-1">
|
|
83
|
+
<AgentKitActionWidget value={widget} threadId="thread-1" />
|
|
84
|
+
</AgentKitProvider>,
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
expect(html).toContain(`data-status="${status}"`);
|
|
88
|
+
expect(html).toContain(
|
|
89
|
+
`data-running="${String(status === "running")}"`,
|
|
90
|
+
);
|
|
91
|
+
} finally {
|
|
92
|
+
unregister();
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
);
|
|
96
|
+
|
|
35
97
|
it("resolves the renderer with stored action args and structured result", async () => {
|
|
36
98
|
const toolCall: AgentToolCall = {
|
|
37
99
|
id: "tool-1",
|
|
@@ -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;
|
|
@@ -92,7 +94,9 @@ export function AgentKitActionWidget({
|
|
|
92
94
|
resultJson,
|
|
93
95
|
...(relatedResults.length > 1 ? { relatedResults } : {}),
|
|
94
96
|
widgetId: widget.id,
|
|
97
|
+
status: tool.status,
|
|
95
98
|
isRunning: tool.status === "running",
|
|
99
|
+
dataChartLayout,
|
|
96
100
|
chatUI: {
|
|
97
101
|
renderer: widget.kind,
|
|
98
102
|
...(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,
|
|
@@ -78,7 +79,10 @@ import {
|
|
|
78
79
|
IntegrationToolBadge,
|
|
79
80
|
resolveToolIntegration,
|
|
80
81
|
} from "./tool-integration.js";
|
|
81
|
-
import {
|
|
82
|
+
import {
|
|
83
|
+
resolveToolRenderer,
|
|
84
|
+
type ToolRendererContext,
|
|
85
|
+
} from "./tool-render-registry.js";
|
|
82
86
|
import {
|
|
83
87
|
isBuiltinDataWidgetActionRenderer,
|
|
84
88
|
isBuiltinWorkspaceFileResult,
|
|
@@ -635,6 +639,7 @@ export function ToolCallDisplay({
|
|
|
635
639
|
argsText,
|
|
636
640
|
args,
|
|
637
641
|
result,
|
|
642
|
+
status,
|
|
638
643
|
mcpApp,
|
|
639
644
|
chatUI,
|
|
640
645
|
isRunning,
|
|
@@ -647,6 +652,7 @@ export function ToolCallDisplay({
|
|
|
647
652
|
isLatestRunning = isRunning,
|
|
648
653
|
isActiveTail,
|
|
649
654
|
workedForRowLayout,
|
|
655
|
+
dataChartLayout,
|
|
650
656
|
formatWorkedForDuration,
|
|
651
657
|
}: {
|
|
652
658
|
toolName: string;
|
|
@@ -654,6 +660,7 @@ export function ToolCallDisplay({
|
|
|
654
660
|
argsText?: string;
|
|
655
661
|
args: Record<string, unknown>;
|
|
656
662
|
result?: string;
|
|
663
|
+
status?: ToolRendererContext["status"];
|
|
657
664
|
mcpApp?: AgentMcpAppPayload;
|
|
658
665
|
chatUI?: ActionChatUIConfig;
|
|
659
666
|
isRunning: boolean;
|
|
@@ -670,6 +677,7 @@ export function ToolCallDisplay({
|
|
|
670
677
|
repeatCount?: number;
|
|
671
678
|
isActiveTail?: boolean;
|
|
672
679
|
workedForRowLayout?: AgentChatWorkedForRowLayout;
|
|
680
|
+
dataChartLayout?: AgentChatDataChartLayout;
|
|
673
681
|
formatWorkedForDuration?: (durationMs: number) => string;
|
|
674
682
|
/** @deprecated Use isActiveTail. */
|
|
675
683
|
isLatestRunning?: boolean;
|
|
@@ -747,6 +755,7 @@ export function ToolCallDisplay({
|
|
|
747
755
|
argsText={argsText}
|
|
748
756
|
args={args}
|
|
749
757
|
result={result}
|
|
758
|
+
status={status}
|
|
750
759
|
mcpApp={mcpApp}
|
|
751
760
|
chatUI={chatUI}
|
|
752
761
|
isRunning={effectiveIsRunning}
|
|
@@ -758,6 +767,7 @@ export function ToolCallDisplay({
|
|
|
758
767
|
repeatCount={repeatCount}
|
|
759
768
|
context={builderContext}
|
|
760
769
|
workedForRowLayout={workedForRowLayout}
|
|
770
|
+
dataChartLayout={dataChartLayout}
|
|
761
771
|
formatWorkedForDuration={formatWorkedForDuration}
|
|
762
772
|
/>,
|
|
763
773
|
);
|
|
@@ -771,6 +781,7 @@ function ToolCallDisplayGeneric({
|
|
|
771
781
|
argsText,
|
|
772
782
|
args,
|
|
773
783
|
result,
|
|
784
|
+
status,
|
|
774
785
|
mcpApp,
|
|
775
786
|
chatUI,
|
|
776
787
|
isRunning,
|
|
@@ -782,6 +793,7 @@ function ToolCallDisplayGeneric({
|
|
|
782
793
|
repeatCount,
|
|
783
794
|
context,
|
|
784
795
|
workedForRowLayout,
|
|
796
|
+
dataChartLayout,
|
|
785
797
|
formatWorkedForDuration,
|
|
786
798
|
}: {
|
|
787
799
|
toolName: string;
|
|
@@ -789,6 +801,7 @@ function ToolCallDisplayGeneric({
|
|
|
789
801
|
argsText?: string;
|
|
790
802
|
args: Record<string, unknown>;
|
|
791
803
|
result?: string;
|
|
804
|
+
status?: ToolRendererContext["status"];
|
|
792
805
|
mcpApp?: AgentMcpAppPayload;
|
|
793
806
|
chatUI?: ActionChatUIConfig;
|
|
794
807
|
isRunning: boolean;
|
|
@@ -805,6 +818,7 @@ function ToolCallDisplayGeneric({
|
|
|
805
818
|
repeatCount?: number;
|
|
806
819
|
context?: string;
|
|
807
820
|
workedForRowLayout?: AgentChatWorkedForRowLayout;
|
|
821
|
+
dataChartLayout?: AgentChatDataChartLayout;
|
|
808
822
|
formatWorkedForDuration?: (durationMs: number) => string;
|
|
809
823
|
}) {
|
|
810
824
|
const t = useT();
|
|
@@ -917,8 +931,10 @@ function ToolCallDisplayGeneric({
|
|
|
917
931
|
args,
|
|
918
932
|
resultText: result,
|
|
919
933
|
resultJson: parsedResult,
|
|
934
|
+
status,
|
|
920
935
|
isRunning,
|
|
921
936
|
isActiveTail,
|
|
937
|
+
dataChartLayout,
|
|
922
938
|
...(typeof toolCallId === "string"
|
|
923
939
|
? { widgetId: `${toolCallId}:chat-ui` }
|
|
924
940
|
: {}),
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import type { AgentToolCall } from "@agent-native/agentkit/protocol";
|
|
1
2
|
import type { ActionChatUIConfig } from "@agent-native/core/action-ui";
|
|
2
3
|
import type { ComponentType } from "react";
|
|
3
4
|
|
|
5
|
+
import type { AgentChatDataChartLayout } from "../../agentkit/react/data-chart-layout.js";
|
|
6
|
+
|
|
4
7
|
export interface ToolRendererContext {
|
|
5
8
|
toolName: string;
|
|
6
9
|
args: Record<string, unknown>;
|
|
@@ -12,9 +15,11 @@ export interface ToolRendererContext {
|
|
|
12
15
|
toolName?: string;
|
|
13
16
|
}>;
|
|
14
17
|
widgetId?: string;
|
|
18
|
+
status?: AgentToolCall["status"];
|
|
15
19
|
isRunning: boolean;
|
|
16
20
|
isActiveTail?: boolean;
|
|
17
21
|
chatUI?: ActionChatUIConfig;
|
|
22
|
+
dataChartLayout?: AgentChatDataChartLayout;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
export interface ToolRendererProps {
|