@iblai/web-containers 2.3.0 → 2.5.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.
Files changed (79) hide show
  1. package/dist/cjs/components/chat/ai-message-bubble.js +2 -1
  2. package/dist/cjs/components/chat/ai-message-bubble.js.map +1 -1
  3. package/dist/cjs/components/chat/chat-host-context.js.map +1 -1
  4. package/dist/cjs/components/chat/client-ui-tools/definitions.js +187 -0
  5. package/dist/cjs/components/chat/client-ui-tools/definitions.js.map +1 -0
  6. package/dist/cjs/components/chat/client-ui-tools/panel-list.js +91 -0
  7. package/dist/cjs/components/chat/client-ui-tools/panel-list.js.map +1 -0
  8. package/dist/cjs/components/chat/client-ui-tools/panels.js +242 -0
  9. package/dist/cjs/components/chat/client-ui-tools/panels.js.map +1 -0
  10. package/dist/cjs/components/chat/client-ui-tools/runner.js +285 -0
  11. package/dist/cjs/components/chat/client-ui-tools/runner.js.map +1 -0
  12. package/dist/cjs/components/chat/client-ui-tools/store.js +119 -0
  13. package/dist/cjs/components/chat/client-ui-tools/store.js.map +1 -0
  14. package/dist/cjs/components/chat/client-ui-tools/use-client-ui-tools.js +29 -0
  15. package/dist/cjs/components/chat/client-ui-tools/use-client-ui-tools.js.map +1 -0
  16. package/dist/cjs/components/chat/index.js +39 -2
  17. package/dist/cjs/components/chat/index.js.map +1 -1
  18. package/dist/cjs/components/modals/edit-mentor-modal/tabs/settings-tab/capabilities-sub-tab.js +5 -1
  19. package/dist/cjs/components/modals/edit-mentor-modal/tabs/settings-tab/capabilities-sub-tab.js.map +1 -1
  20. package/dist/cjs/components/modals/edit-mentor-modal/tabs/settings-tab/labels.js +8 -0
  21. package/dist/cjs/components/modals/edit-mentor-modal/tabs/settings-tab/labels.js.map +1 -1
  22. package/dist/cjs/components/modals/edit-mentor-modal/tabs/settings-tab/use-edit-mentor-settings.js +5 -1
  23. package/dist/cjs/components/modals/edit-mentor-modal/tabs/settings-tab/use-edit-mentor-settings.js.map +1 -1
  24. package/dist/cjs/components/ui/chart.js +2 -0
  25. package/dist/cjs/components/ui/chart.js.map +1 -1
  26. package/dist/cjs/hooks/use-extension-client-tools.js +98 -0
  27. package/dist/cjs/hooks/use-extension-client-tools.js.map +1 -0
  28. package/dist/cjs/i18n/messages/en.json.js +22 -0
  29. package/dist/cjs/i18n/messages/en.json.js.map +1 -1
  30. package/dist/cjs/i18n/messages/es.json.js +22 -0
  31. package/dist/cjs/i18n/messages/es.json.js.map +1 -1
  32. package/dist/cjs/i18n/messages/fr.json.js +22 -0
  33. package/dist/cjs/i18n/messages/fr.json.js.map +1 -1
  34. package/dist/cjs/i18n/messages/zh.json.js +22 -0
  35. package/dist/cjs/i18n/messages/zh.json.js.map +1 -1
  36. package/dist/cjs/next/index.js +16 -0
  37. package/dist/cjs/next/index.js.map +1 -1
  38. package/dist/cjs/web-containers/tsconfig.build.tsbuildinfo +1 -1
  39. package/dist/esm/components/chat/ai-message-bubble.js +2 -1
  40. package/dist/esm/components/chat/ai-message-bubble.js.map +1 -1
  41. package/dist/esm/components/chat/chat-host-context.js.map +1 -1
  42. package/dist/esm/components/chat/client-ui-tools/definitions.js +183 -0
  43. package/dist/esm/components/chat/client-ui-tools/definitions.js.map +1 -0
  44. package/dist/esm/components/chat/client-ui-tools/panel-list.js +89 -0
  45. package/dist/esm/components/chat/client-ui-tools/panel-list.js.map +1 -0
  46. package/dist/esm/components/chat/client-ui-tools/panels.js +240 -0
  47. package/dist/esm/components/chat/client-ui-tools/panels.js.map +1 -0
  48. package/dist/esm/components/chat/client-ui-tools/runner.js +278 -0
  49. package/dist/esm/components/chat/client-ui-tools/runner.js.map +1 -0
  50. package/dist/esm/components/chat/client-ui-tools/store.js +113 -0
  51. package/dist/esm/components/chat/client-ui-tools/store.js.map +1 -0
  52. package/dist/esm/components/chat/client-ui-tools/use-client-ui-tools.js +27 -0
  53. package/dist/esm/components/chat/client-ui-tools/use-client-ui-tools.js.map +1 -0
  54. package/dist/esm/components/chat/index.js +39 -2
  55. package/dist/esm/components/chat/index.js.map +1 -1
  56. package/dist/esm/components/modals/edit-mentor-modal/tabs/settings-tab/capabilities-sub-tab.js +5 -1
  57. package/dist/esm/components/modals/edit-mentor-modal/tabs/settings-tab/capabilities-sub-tab.js.map +1 -1
  58. package/dist/esm/components/modals/edit-mentor-modal/tabs/settings-tab/labels.js +8 -0
  59. package/dist/esm/components/modals/edit-mentor-modal/tabs/settings-tab/labels.js.map +1 -1
  60. package/dist/esm/components/modals/edit-mentor-modal/tabs/settings-tab/use-edit-mentor-settings.js +5 -1
  61. package/dist/esm/components/modals/edit-mentor-modal/tabs/settings-tab/use-edit-mentor-settings.js.map +1 -1
  62. package/dist/esm/components/ui/chart.js +2 -1
  63. package/dist/esm/components/ui/chart.js.map +1 -1
  64. package/dist/esm/hooks/use-extension-client-tools.js +96 -0
  65. package/dist/esm/hooks/use-extension-client-tools.js.map +1 -0
  66. package/dist/esm/i18n/messages/en.json.js +22 -1
  67. package/dist/esm/i18n/messages/en.json.js.map +1 -1
  68. package/dist/esm/i18n/messages/es.json.js +22 -1
  69. package/dist/esm/i18n/messages/es.json.js.map +1 -1
  70. package/dist/esm/i18n/messages/fr.json.js +22 -1
  71. package/dist/esm/i18n/messages/fr.json.js.map +1 -1
  72. package/dist/esm/i18n/messages/zh.json.js +22 -1
  73. package/dist/esm/i18n/messages/zh.json.js.map +1 -1
  74. package/dist/esm/next/index.js +6 -0
  75. package/dist/esm/next/index.js.map +1 -1
  76. package/dist/esm/web-containers/tsconfig.build.tsbuildinfo +1 -1
  77. package/dist/next/index.d.ts +176 -4
  78. package/dist/package.json +6 -2
  79. package/package.json +7 -3
@@ -18,6 +18,7 @@ import { MessagePreview } from './chat-messages/message-preview.js';
18
18
  import { ReasoningSection } from './reasoning-section.js';
19
19
  import { ToolCallIndicator } from './tool-call-indicator.js';
20
20
  import { useCodePermissionRequests, CodePermissionCards } from './code-permission-card.js';
21
+ import { ClientUiPanels } from './client-ui-tools/panel-list.js';
21
22
  import { AgentTodoList } from './agent-todo-list.js';
22
23
  import { useCodeTurn, codeTurnPhase, CodeActivity } from './code-activity.js';
23
24
  import { hasVisibleBubbleContent, hasGenericToolCalls, bubbleTodos, AIMessageFrame, hasArtifactVersions } from './ai-message-frame.js';
@@ -133,7 +134,7 @@ const AIMessageBubble = forwardRef(function AIMessageBubble({ content, profileIm
133
134
  // A waiting permission card is the thing needing attention, not the line.
134
135
  const isRestatedByVisibleRow = isReasoningRowActive || isToolRowActive || hasPermissionPrompts;
135
136
  return (jsx(TooltipProvider, { children: jsx(AIMessageFrame, { profileImage: profileImage, mentorName: mentorName, timestamp: timestamp, children: jsxs(Fragment, { children: [jsxs("div", { className: cn('mb-1.5 rounded-2xl bg-gray-100 p-3 wrap-anywhere', CHAT_CSS_CLASS_NAMES.CHAT.AI_MESSAGE_RESPONSE, hasArtifactVersions(message) && 'bg-white p-0'), children: [showReasoningSection && (jsx(ReasoningSection, { reasoningContent: reasoningContent, isActive: isReasoningRowActive })), showToolCalls &&
136
- (isCodeTurn ? (jsx(CodeActivity, { generationId: message.id, isCurrentlyStreaming: isCurrentlyStreaming })) : (jsx(ToolCallIndicator, { toolCalls: toolCalls, isActive: isToolRowActive }))), hasTodosToShow && (jsx(AgentTodoList, { todos: todos, isCurrentlyStreaming: isCurrentlyStreaming })), (hasPermissionPrompts || hostsPermissionCards) && (jsx(CodePermissionCards, { generationId: message.id })), jsx("div", { "data-testid": "ai-message-body", className: "overflow-x-auto text-sm/6 text-gray-800 [&_.katex-display]:overflow-x-auto [&_.katex-display]:overflow-y-hidden [&_code]:rounded [&_code]:bg-gray-200 [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_em]:italic [&_li]:mb-1 [&_ol]:list-decimal [&_ol]:pl-4 [&_pre]:overflow-x-auto [&_pre]:rounded [&_pre]:bg-gray-200 [&_pre]:p-2 [&_strong]:font-bold [&_ul]:list-disc [&_ul]:pl-4", children: jsx(MessagePreview, { content: content, artifactVersions: message === null || message === void 0 ? void 0 : message.artifactVersions, onOpenCanvas: onOpenCanvas, streamingArtifactId: streamingArtifactId }) }), (message === null || message === void 0 ? void 0 : message.actions) && (jsx("div", { className: "flex flex-wrap", children: message.actions.map((action, index) => (jsx(Button, { onClick: mapActionToCallback(action.actionType, joinTenant), className: "ibl-button-primary cursor-pointer", children: action.text }, index))) })), phase && (jsx(WorkingIndicator, { phase: phase, restatedByVisibleRow: isRestatedByVisibleRow, content: content, className: "mt-2" }))] }), jsxs("div", { className: cn('flex items-center space-x-4', isCurrentlyStreaming && 'hidden'), children: [jsx(AIMessageCopy, { ref: ref, content: content }), isLoggedIn() && !showingSharedChat && (jsx(AIMessageRating, { content: content, messages: messages, sessionId: sessionId, mentorId: mentorId, tenantKey: tenantKey })), (((_c = host.config) === null || _c === void 0 ? void 0 : _c.showMessageActionsWhenLoggedOut) || isLoggedIn()) &&
137
+ (isCodeTurn ? (jsx(CodeActivity, { generationId: message.id, isCurrentlyStreaming: isCurrentlyStreaming })) : (jsx(ToolCallIndicator, { toolCalls: toolCalls, isActive: isToolRowActive }))), hasTodosToShow && (jsx(AgentTodoList, { todos: todos, isCurrentlyStreaming: isCurrentlyStreaming })), (hasPermissionPrompts || hostsPermissionCards) && (jsx(CodePermissionCards, { generationId: message.id })), jsx(ClientUiPanels, { generationId: message.id, toolCalls: message.toolCalls }), jsx("div", { "data-testid": "ai-message-body", className: "overflow-x-auto text-sm/6 text-gray-800 [&_.katex-display]:overflow-x-auto [&_.katex-display]:overflow-y-hidden [&_code]:rounded [&_code]:bg-gray-200 [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_em]:italic [&_li]:mb-1 [&_ol]:list-decimal [&_ol]:pl-4 [&_pre]:overflow-x-auto [&_pre]:rounded [&_pre]:bg-gray-200 [&_pre]:p-2 [&_strong]:font-bold [&_ul]:list-disc [&_ul]:pl-4", children: jsx(MessagePreview, { content: content, artifactVersions: message === null || message === void 0 ? void 0 : message.artifactVersions, onOpenCanvas: onOpenCanvas, streamingArtifactId: streamingArtifactId }) }), (message === null || message === void 0 ? void 0 : message.actions) && (jsx("div", { className: "flex flex-wrap", children: message.actions.map((action, index) => (jsx(Button, { onClick: mapActionToCallback(action.actionType, joinTenant), className: "ibl-button-primary cursor-pointer", children: action.text }, index))) })), phase && (jsx(WorkingIndicator, { phase: phase, restatedByVisibleRow: isRestatedByVisibleRow, content: content, className: "mt-2" }))] }), jsxs("div", { className: cn('flex items-center space-x-4', isCurrentlyStreaming && 'hidden'), children: [jsx(AIMessageCopy, { ref: ref, content: content }), isLoggedIn() && !showingSharedChat && (jsx(AIMessageRating, { content: content, messages: messages, sessionId: sessionId, mentorId: mentorId, tenantKey: tenantKey })), (((_c = host.config) === null || _c === void 0 ? void 0 : _c.showMessageActionsWhenLoggedOut) || isLoggedIn()) &&
137
138
  !showingSharedChat &&
138
139
  !chatPrivacyActive && (jsxs(Fragment, { children: [jsx(AIMessageShare, { sessionId: sessionId, tenantKey: tenantKey }), jsx(AIMessageDownload, { message: message, messages: messages, mentorName: mentorName, tenantKey: tenantKey, sessionId: sessionId })] })), isLoggedIn() && !showingSharedChat && isMentorInappropriateContentEnabled && (jsx(AIMessageReportInappropriateContent, { mentorName: mentorName, messages: messages, supportEmail: supportEmail })), jsx(AIMessageSpeak, { message: message, mentorId: mentorId, tenantKey: tenantKey }), isLastAssistant && isLoggedIn() && !showingSharedChat && (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsxs("button", { onClick: () => {
139
140
  const question = getUserMessageFor(messages, message);
@@ -1 +1 @@
1
- {"version":3,"file":"ai-message-bubble.js","sources":["../../../../../../../src/components/chat/ai-message-bubble.tsx"],"sourcesContent":[null],"names":["redirectToAuthSpaJoinTenantWithUrl","useAppSelector","useTenantMetadataHook","_jsx","_jsxs","_Fragment","CSS_CLASS_NAMES"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CM,SAAU,iBAAiB,CAAC,QAAmB,EAAE,OAAgB,EAAA;IACrE,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AmC,EAAA,EAClC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,GAC1B,CACH,EAEDA,GAAA,CAAC,cAAc,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAA,CAAI,EAE7E,eAAe,IAAI,UAAU,EAAE,IAAI,CAAC,iBAAiB,KACpDC,KAAC,OAAO,EAAA,EAAA,QAAA,EAAA,CACND,GAAA,CAAC,cAAc,EAAA,EAAC,OAAO,kBACrBC,IAAA,CAAA,QAAA,EAAA,EACE,OAAO,EAAE,MAAK;gDACZ,MAAM,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC;gDACrD,IAAI,QAAQ,EAAE;AACZ,oDAAA,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;gDAC3B;4CACF,CAAC,EACD,SAAS,EAAC,yCAAyC,aAEnDD,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,SAAS,EAAA,QAAA,EACtB,CAAC,CAAC,4CAA4C,CAAC,EAAA,CAC3C,EACPA,IAAC,UAAU,EAAA,EAAC,SAAS,EAAC,SAAS,GAAG,CAAA,EAAA,CAC3B,EAAA,CACM,EACjBA,GAAA,CAAC,cAAc,IAAC,SAAS,EAAC,qBAAqB,EAAA,QAAA,EAC5C,CAAC,CAAC,uCAAuC,CAAC,GAC5B,CAAA,EAAA,CACT,CACX,IACG,CAAA,EAAA,CACL,EAAA,CACY,EAAA,CACD;AAEtB,CAAC;;;;"}
1
+ {"version":3,"file":"ai-message-bubble.js","sources":["../../../../../../../src/components/chat/ai-message-bubble.tsx"],"sourcesContent":[null],"names":["redirectToAuthSpaJoinTenantWithUrl","useAppSelector","useTenantMetadataHook","_jsx","_jsxs","_Fragment","CSS_CLASS_NAMES"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CM,SAAU,iBAAiB,CAAC,QAAmB,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,EAAE,SAAS,GACpB,CAAA,EAAA,CACD,CACJ,EAEF,UAAU,EAAE,IAAI,CAAC,iBAAiB,IAAI,mCAAmC,KACxEA,GAAA,CAAC,mCAAmC,EAAA,EAClC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,GAC1B,CACH,EAEDA,GAAA,CAAC,cAAc,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAA,CAAI,EAE7E,eAAe,IAAI,UAAU,EAAE,IAAI,CAAC,iBAAiB,KACpDC,KAAC,OAAO,EAAA,EAAA,QAAA,EAAA,CACND,GAAA,CAAC,cAAc,EAAA,EAAC,OAAO,kBACrBC,IAAA,CAAA,QAAA,EAAA,EACE,OAAO,EAAE,MAAK;gDACZ,MAAM,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC;gDACrD,IAAI,QAAQ,EAAE;AACZ,oDAAA,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;gDAC3B;4CACF,CAAC,EACD,SAAS,EAAC,yCAAyC,aAEnDD,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,SAAS,EAAA,QAAA,EACtB,CAAC,CAAC,4CAA4C,CAAC,EAAA,CAC3C,EACPA,IAAC,UAAU,EAAA,EAAC,SAAS,EAAC,SAAS,GAAG,CAAA,EAAA,CAC3B,EAAA,CACM,EACjBA,GAAA,CAAC,cAAc,IAAC,SAAS,EAAC,qBAAqB,EAAA,QAAA,EAC5C,CAAC,CAAC,uCAAuC,CAAC,GAC5B,CAAA,EAAA,CACT,CACX,IACG,CAAA,EAAA,CACL,EAAA,CACY,EAAA,CACD;AAEtB,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"chat-host-context.js","sources":["../../../../../../../src/components/chat/chat-host-context.tsx"],"sourcesContent":[null],"names":["_jsx","ChatMarkdown"],"mappings":";;;;;;AA4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ACP;AACH;AAEA;;;AAGG;SACa,eAAe,GAAA;;AAC7B,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE;IAChC,OAAO,CAAA,EAAA,GAAA,MAAM,KAAA,IAAA,IAAN,MAAM,KAAA,MAAA,GAAA,MAAA,GAAN,MAAM,CAAE,iBAAiB,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAIC,QAAY;AAClD;;;;"}
1
+ {"version":3,"file":"chat-host-context.js","sources":["../../../../../../../src/components/chat/chat-host-context.tsx"],"sourcesContent":[null],"names":["_jsx","ChatMarkdown"],"mappings":";;;;;;AAgSO,MAAM,qBAAqB,GAA2B;AAC3D,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,gBAAgB,EAAE,IAAI;AACtB,IAAA,MAAM,EAAE,IAAI;;AAGR,SAAU,mBAAmB,CAAC,QAAuB,EAAA;AACzD,IAAA,MAAM,QAAQ,GAAG,EAAE,GAAG,qBAAqB,EAAE;IAC7C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAA2B,EAAE;QACjE,IAAI,CAAA,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAA,MAAA,GAAA,MAAA,GAAR,QAAQ,CAAG,GAAG,CAAC,MAAK,KAAK;AAAE,YAAA,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK;IACtD;AACA,IAAA,OAAO,QAAQ;AACjB;AAEA,MAAM,YAAY,GAAkB;AAClC,IAAA,SAAS,EAAE,EAAE;AACb,IAAA,QAAQ,EAAE,EAAE;AACZ,IAAA,QA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AAC,CAAC,EAAE,MAAM,CAAC,CACZ;AACH;AAEA;;;AAGG;SACa,kBAAkB,GAAA;AAChC,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE;IAChC,MAAM,IAAI,GAAG,MAAM,KAAA,IAAA,IAAN,MAAM,KAAA,MAAA,GAAA,MAAA,GAAN,MAAM,CAAE,iBAAiB;AACtC,IAAA,OAAO,WAAW,CAChB,CAAC,OAAsB,EAAE,aAAA,GAAyB,IAAI,KACpD,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG,OAAO,EAAE,EACjD,CAAC,IAAI,CAAC,CACP;AACH;AAEA;;;AAGG;SACa,eAAe,GAAA;;AAC7B,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE;IAChC,OAAO,CAAA,EAAA,GAAA,MAAM,KAAA,IAAA,IAAN,MAAM,KAAA,MAAA,GAAA,MAAA,GAAN,MAAM,CAAE,iBAAiB,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAIC,QAAY;AAClD;;;;"}
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Tools the agent calls to put rich UI in the chat: a chart instead of a table
3
+ * of numbers in prose, a form instead of asking for six fields one at a time.
4
+ *
5
+ * They are client tools like any other — declared on the turn, called by the
6
+ * agent, run here — but what "running" means is rendering. Most answer as soon
7
+ * as the panel is on screen; `ui_form` answers when the person submits it,
8
+ * which is what the contract's long wait is for.
9
+ *
10
+ * Names are prefixed `ui_` so they cannot collide with the agent's own tools
11
+ * or the backend's built-ins (`execute`, `glob`, `read_file`, …).
12
+ */
13
+ const CHART_KINDS = [
14
+ 'bar',
15
+ 'stacked-bar',
16
+ 'line',
17
+ 'area',
18
+ 'pie',
19
+ 'donut',
20
+ 'scatter',
21
+ 'radar',
22
+ 'combo',
23
+ 'treemap',
24
+ 'radial',
25
+ 'funnel',
26
+ ];
27
+ const FIELD_KINDS = [
28
+ 'text',
29
+ 'textarea',
30
+ 'number',
31
+ 'email',
32
+ 'select',
33
+ 'checkbox',
34
+ 'radio',
35
+ 'date',
36
+ ];
37
+ const UI_TOOL_NAMES = {
38
+ chart: 'ui_chart',
39
+ diagram: 'ui_diagram',
40
+ table: 'ui_table',
41
+ form: 'ui_form',
42
+ metrics: 'ui_metrics',
43
+ };
44
+ /**
45
+ * Where a panel sits among the others of its turn. The agent decides the
46
+ * arrangement — two charts side by side, a wide table under them — rather than
47
+ * everything stacking full width down the page.
48
+ */
49
+ const LAYOUT = {
50
+ type: 'object',
51
+ description: "Where this sits among the turn's other panels. Omit for a full-width row of its own.",
52
+ properties: {
53
+ columns: {
54
+ type: 'number',
55
+ enum: [1, 2, 3],
56
+ description: 'How many panels share this row. 2 puts this beside the next one.',
57
+ },
58
+ span: {
59
+ type: 'number',
60
+ enum: [1, 2, 3],
61
+ description: 'How many of those columns this panel takes.',
62
+ },
63
+ },
64
+ };
65
+ const fn = (name, description, parameters) => ({
66
+ type: 'function',
67
+ function: { name, description, parameters },
68
+ });
69
+ const UI_TOOL_DEFINITIONS = [
70
+ fn(UI_TOOL_NAMES.chart, 'Draw a chart in the chat. Use it whenever numbers are easier to see than to read — trends over time, comparisons between categories, parts of a whole.', {
71
+ type: 'object',
72
+ properties: {
73
+ layout: LAYOUT,
74
+ kind: {
75
+ type: 'string',
76
+ enum: [...CHART_KINDS],
77
+ description: 'bar or line to compare and to show a trend; stacked-bar for parts adding to a total per label; area for volume over time; pie or donut for parts of one whole; treemap when there are too many parts for a pie and their size is the point; radial for a few values read as rings; funnel for stages that fall away in order; scatter for how two measures relate; radar to compare several measures on one shape; combo to draw the first series as bars and the rest as lines.',
78
+ },
79
+ xTitle: { type: 'string', description: 'Label under the x axis.' },
80
+ yTitle: { type: 'string', description: 'Label beside the y axis.' },
81
+ title: { type: 'string', description: 'Short heading shown above the chart.' },
82
+ labels: {
83
+ type: 'array',
84
+ items: { type: 'string' },
85
+ description: 'One label per point, along the x axis (or per slice for a pie).',
86
+ },
87
+ series: {
88
+ type: 'array',
89
+ description: 'One entry per line or set of bars. A pie uses the first entry only.',
90
+ items: {
91
+ type: 'object',
92
+ properties: {
93
+ name: { type: 'string' },
94
+ data: { type: 'array', items: { type: 'number' } },
95
+ },
96
+ required: ['name', 'data'],
97
+ },
98
+ },
99
+ },
100
+ required: ['kind', 'labels', 'series'],
101
+ }),
102
+ fn(UI_TOOL_NAMES.diagram, 'Draw a diagram in the chat from Mermaid source: a flow chart, sequence, state machine, ER or Gantt. Use it for how things connect or what happens in what order — not for numbers, which belong in a chart.', {
103
+ type: 'object',
104
+ properties: {
105
+ title: { type: 'string' },
106
+ layout: LAYOUT,
107
+ source: {
108
+ type: 'string',
109
+ description: 'Mermaid source, starting with its diagram type (for example "flowchart TD" or "sequenceDiagram"). No code fences.',
110
+ },
111
+ },
112
+ required: ['source'],
113
+ }),
114
+ fn(UI_TOOL_NAMES.table, 'Show rows and columns in the chat. Use it for records that need to line up and be scanned, not for two or three numbers.', {
115
+ type: 'object',
116
+ properties: {
117
+ title: { type: 'string' },
118
+ layout: LAYOUT,
119
+ columns: { type: 'array', items: { type: 'string' } },
120
+ rows: {
121
+ type: 'array',
122
+ description: 'One array of cells per row, in the order of the columns.',
123
+ items: { type: 'array', items: { type: 'string' } },
124
+ },
125
+ },
126
+ required: ['columns', 'rows'],
127
+ }),
128
+ fn(UI_TOOL_NAMES.form, 'Ask for several pieces of information at once, as a form. Use it instead of asking one question per message. The answer comes back when the person submits it, which may take minutes.', {
129
+ type: 'object',
130
+ properties: {
131
+ title: { type: 'string' },
132
+ description: { type: 'string', description: 'One plain sentence about what this is for.' },
133
+ submitLabel: { type: 'string', description: 'Wording of the button. Defaults to Submit.' },
134
+ fields: {
135
+ type: 'array',
136
+ items: {
137
+ type: 'object',
138
+ properties: {
139
+ name: { type: 'string', description: 'Key this field is returned under.' },
140
+ label: { type: 'string' },
141
+ kind: { type: 'string', enum: [...FIELD_KINDS] },
142
+ placeholder: { type: 'string' },
143
+ required: { type: 'boolean' },
144
+ options: {
145
+ type: 'array',
146
+ items: { type: 'string' },
147
+ description: 'Choices, for select and radio.',
148
+ },
149
+ },
150
+ required: ['name', 'label', 'kind'],
151
+ },
152
+ },
153
+ },
154
+ required: ['fields'],
155
+ }),
156
+ fn(UI_TOOL_NAMES.metrics, 'Show a few headline numbers as tiles. Use it for three to six figures that matter on their own, each with a label.', {
157
+ type: 'object',
158
+ properties: {
159
+ title: { type: 'string' },
160
+ layout: LAYOUT,
161
+ items: {
162
+ type: 'array',
163
+ items: {
164
+ type: 'object',
165
+ properties: {
166
+ label: { type: 'string' },
167
+ value: {
168
+ type: 'string',
169
+ description: 'Already formatted, including any unit or sign.',
170
+ },
171
+ hint: { type: 'string', description: 'Optional smaller line under the value.' },
172
+ },
173
+ required: ['label', 'value'],
174
+ },
175
+ },
176
+ },
177
+ required: ['items'],
178
+ }),
179
+ ];
180
+ const isUiToolName = (name) => Object.values(UI_TOOL_NAMES).includes(name);
181
+
182
+ export { UI_TOOL_DEFINITIONS, UI_TOOL_NAMES, isUiToolName };
183
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sources":["../../../../../../../../src/components/chat/client-ui-tools/definitions.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;;;;;;;AAWG;AAEH,MAAM,WAAW,GAAG;IAClB,KAAK;IACL,aAAa;IACb,MAAM;IACN,MAAM;IACN,KAAK;IACL,OAAO;IACP,SAAS;IACT,OAAO;IACP,OAAO;IACP,SAAS;IACT,QAAQ;IACR,QAAQ;CACA;AAGV,MAAM,WAAW,GAAG;IAClB,MAAM;IACN,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,UAAU;IACV,OAAO;IACP,MAAM;CACE;AAGH,MAAM,aAAa,GAAG;AAC3B,IAAA,KAAK,EAAE,UAAU;AACjB,IAAA,OAAO,EAAE,YAAY;AACrB,IAAA,KAAK,EAAE,UAAU;AACjB,IAAA,IAAI,E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OAAO;AACb,4BAAA,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AACzB,4BAAA,WAAW,EAAE,gCAAgC;AAC9C,yBAAA;AACF,qBAAA;AACD,oBAAA,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC;AACpC,iBAAA;AACF,aAAA;AACF,SAAA;QACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;KACrB,CACF;AACD,IAAA,EAAE,CACA,aAAa,CAAC,OAAO,EACrB,oHAAoH,EACpH;AACE,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,UAAU,EAAE;AACV,YAAA,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AACzB,YAAA,MAAM,EAAE,MAAM;AACd,YAAA,KAAK,EAAE;AACL,gBAAA,IAAI,EAAE,OAAO;AACb,gBAAA,KAAK,EAAE;AACL,oBAAA,IAAI,EAAE,QAAQ;AACd,oBAAA,UAAU,EAAE;AACV,wBAAA,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AACzB,wBAAA,KAAK,EAAE;AACL,4BAAA,IAAI,EAAE,QAAQ;AACd,4BAAA,WAAW,EAAE,gDAAgD;AAC9D,yBAAA;wBACD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wCAAwC,EAAE;AAChF,qBAAA;AACD,oBAAA,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;AAC7B,iBAAA;AACF,aAAA;AACF,SAAA;QACD,QAAQ,EAAE,CAAC,OAAO,CAAC;KACpB,CACF;;MAGU,YAAY,GAAG,CAAC,IAAY,KACvC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,IAAkB;;;;"}
@@ -0,0 +1,89 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
3
+ import { ClientUiPanelView } from './panels.js';
4
+ import { isUiToolName } from './definitions.js';
5
+ import { panelFromToolCall } from './runner.js';
6
+ import { useClientUiPanels } from './store.js';
7
+
8
+ /**
9
+ * The panels one turn put in the chat, under that turn's message.
10
+ *
11
+ * Matched on the tool call rather than the turn: a finished turn's messages
12
+ * are replaced by the server's own, with its ids, so a panel keyed only on
13
+ * the generation id is orphaned the moment that lands — the chart appears,
14
+ * then vanishes. The call id travels with the message's `toolCalls`, which
15
+ * survives the swap, and the generation id stays as the fallback for the
16
+ * window before the server's copy arrives.
17
+ *
18
+ * A panel the live store no longer holds — anything drawn before a reload —
19
+ * is rebuilt from the call's own arguments, so a transcript keeps its charts.
20
+ */
21
+ function ClientUiPanels({ generationId, toolCalls, }) {
22
+ var _a, _b, _c, _d, _e, _f;
23
+ const live = useClientUiPanels();
24
+ const panels = useMemo(() => {
25
+ const drawnThisTurn = live.filter((panel) => panel.generationId === generationId);
26
+ const calls = toolCalls !== null && toolCalls !== void 0 ? toolCalls : [];
27
+ // A call is matched by id, then by position among this turn's drawings —
28
+ // history can return a call with no id, where the id match alone would
29
+ // silently find nothing — and finally rebuilt from its own arguments.
30
+ const fromCalls = calls
31
+ .map((call, index) => {
32
+ var _a;
33
+ const byId = call.id ? live.find((panel) => panel.id === call.id) : undefined;
34
+ return (_a = byId !== null && byId !== void 0 ? byId : drawnThisTurn[index]) !== null && _a !== void 0 ? _a : panelFromToolCall(call);
35
+ })
36
+ .filter((panel) => panel != null);
37
+ // Anything drawn this turn that no call accounted for still belongs here:
38
+ // the turn is live and its calls have not been recorded yet.
39
+ const extra = drawnThisTurn.filter((panel) => !fromCalls.includes(panel));
40
+ const unique = new Map([...fromCalls, ...extra].map((panel) => [panel.id, panel]));
41
+ const found = [...unique.values()];
42
+ // A drawing tool that produced nothing is worth saying out loud: it means
43
+ // the stored call carried no usable arguments, which is the difference
44
+ // between "the agent drew nothing" and "the transcript lost it".
45
+ const undrawn = calls.filter((call) => isUiToolName(call.name) && !found.some((panel) => panel.id === call.id));
46
+ if (undrawn.length) {
47
+ console.warn('[client-ui-tools] a stored drawing could not be restored', undrawn.map((call) => ({ name: call.name, id: call.id, hasArgs: !!call.input })));
48
+ }
49
+ return found;
50
+ }, [live, toolCalls, generationId]);
51
+ if (!panels.length)
52
+ return null;
53
+ // Written out rather than built: Tailwind compiles the classes it can see in
54
+ // the source, so `grid-cols-${n}` would simply not exist at runtime.
55
+ const GRID = {
56
+ 2: 'grid grid-cols-1 gap-3 md:grid-cols-2',
57
+ 3: 'grid grid-cols-1 gap-3 md:grid-cols-3',
58
+ };
59
+ const SPAN = { 2: 'md:col-span-2', 3: 'md:col-span-3' };
60
+ // Consecutive panels asking for the same number of columns share a row; one
61
+ // that asks for nothing takes a row of its own, which is the old behaviour.
62
+ const rows = [];
63
+ for (const panel of panels) {
64
+ const columns = (_b = (_a = panel.layout) === null || _a === void 0 ? void 0 : _a.columns) !== null && _b !== void 0 ? _b : 1;
65
+ const current = rows[rows.length - 1];
66
+ const currentColumns = (_e = (_d = (_c = current === null || current === void 0 ? void 0 : current[0]) === null || _c === void 0 ? void 0 : _c.layout) === null || _d === void 0 ? void 0 : _d.columns) !== null && _e !== void 0 ? _e : 1;
67
+ const used = (_f = current === null || current === void 0 ? void 0 : current.reduce((n, p) => { var _a, _b; return n + ((_b = (_a = p.layout) === null || _a === void 0 ? void 0 : _a.span) !== null && _b !== void 0 ? _b : 1); }, 0)) !== null && _f !== void 0 ? _f : 0;
68
+ if (current && columns > 1 && currentColumns === columns && used + 1 <= columns) {
69
+ current.push(panel);
70
+ }
71
+ else {
72
+ rows.push([panel]);
73
+ }
74
+ }
75
+ return (jsx("div", { "data-testid": "client-ui-panels", children: rows.map((row, index) => {
76
+ var _a, _b, _c, _d, _e;
77
+ const columns = (_c = (_b = (_a = row[0]) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.columns) !== null && _c !== void 0 ? _c : 1;
78
+ return (jsx("div", {
79
+ // One column on a narrow screen whatever was asked for: two charts
80
+ // side by side on a phone are two charts nobody can read.
81
+ className: GRID[columns], children: row.map((panel) => {
82
+ var _a, _b;
83
+ return (jsx("div", { className: SPAN[((_b = (_a = panel.layout) === null || _a === void 0 ? void 0 : _a.span) !== null && _b !== void 0 ? _b : 1)], children: jsx(ClientUiPanelView, { panel: panel }) }, panel.id));
84
+ }) }, (_e = (_d = row[0]) === null || _d === void 0 ? void 0 : _d.id) !== null && _e !== void 0 ? _e : index));
85
+ }) }));
86
+ }
87
+
88
+ export { ClientUiPanels };
89
+ //# sourceMappingURL=panel-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel-list.js","sources":["../../../../../../../../src/components/chat/client-ui-tools/panel-list.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;;AAgBA;;;;;;;;;;;;AAYG;SACa,cAAc,CAAC,EAC7B,YAAY,EACZ,SAAS,GAIV,EAAA;;AACC,IAAA,MAAM,IAAI,GAAG,iBAAiB,EAAE;AAEhC,IAAA,MAAM,MAAM,GAAG,OAAO,CAAkB,MAAK;AAC3C,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,YAAY,KAAK,YAAY,CAAC;QACjF,MAAM,KAAK,GAAG,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,MAAA,GAAT,SAAS,GAAI,EAAE;;;;QAK7B,MAAM,SAAS,GAAG;AACf,aAAA,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,KAAI;;AACnB,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,SAAS;AAC7E,YAAA,OAAO,MAAA,IAAI,KAAA,IAAA,IAAJ,IAAI,KAAA,MAAA,GAAJ,IAAI,GAAI,aAAa,CAAC,KAAK,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,iBAAiB,CAAC,IAAI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EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,EAAE,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,KAAK,CAUpB;QAEV,CAAC,CAAC,EAAA,CACE;AAEV;;;;"}
@@ -0,0 +1,240 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { useState, useEffect } from 'react';
3
+ import { PieChart, Pie, Cell, Legend, Treemap, LabelList, FunnelChart, Funnel, RadialBarChart, RadialBar, RadarChart, PolarGrid, PolarAngleAxis, PolarRadiusAxis, Radar, ScatterChart, CartesianGrid, XAxis, YAxis, ZAxis, Scatter, ReferenceLine, BarChart, Bar, ComposedChart, Line, AreaChart, Area, LineChart } from 'recharts';
4
+ import { ChartContainer, ChartTooltip, ChartTooltipContent } from '../../ui/chart.js';
5
+ import { Button } from '../../ui/button.js';
6
+ import { Input } from '../../ui/input.js';
7
+ import { Label } from '../../ui/label.js';
8
+ import { Textarea } from '../../ui/textarea.js';
9
+ import { useT } from '../../../i18n/context.js';
10
+ import '../../../packages/i18n/dist/index.esm.js';
11
+ import Markdown from '../markdown/index.js';
12
+ import ChevronDown from '../../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/chevron-down.js';
13
+
14
+ /**
15
+ * How a panel the agent put in the chat is drawn.
16
+ *
17
+ * Every shape here has already been checked by the runner, so a renderer can
18
+ * read its own fields without guarding — the validation lives in one place
19
+ * rather than being half-repeated in JSX.
20
+ */
21
+ /** Chart colours, in order. The theme's own, so panels match the app. */
22
+ const SERIES_COLORS = [
23
+ 'var(--chart-1, #38A1E5)',
24
+ 'var(--chart-2, #7C5CFF)',
25
+ 'var(--chart-3, #22C55E)',
26
+ 'var(--chart-4, #F59E0B)',
27
+ 'var(--chart-5, #EF4444)',
28
+ 'var(--chart-6, #14B8A6)',
29
+ 'var(--chart-7, #EC4899)',
30
+ 'var(--chart-8, #8B5CF6)',
31
+ ];
32
+ /**
33
+ * A panel's card, collapsible.
34
+ *
35
+ * A chart is tall, and several in one answer push the reply itself off the
36
+ * screen — so a reader who has taken it in can fold it away and keep the
37
+ * thread. Open by default: it was drawn to be looked at.
38
+ */
39
+ function Frame({ title, kind, children, }) {
40
+ const t = useT();
41
+ const [open, setOpen] = useState(true);
42
+ const heading = title || t(`chatClientUiTools.kind.${kind}`);
43
+ return (jsxs("div", { className: "my-3 overflow-hidden rounded-xl border border-gray-200/80 bg-gradient-to-b from-white to-gray-50/60 shadow-sm", children: [jsxs("button", { type: "button", onClick: () => setOpen((wasOpen) => !wasOpen), "aria-expanded": open, className: "flex w-full items-center gap-2 px-4 py-3 text-left transition-colors hover:bg-gray-50/80", children: [jsx(ChevronDown, { "aria-hidden": true, className: `h-4 w-4 shrink-0 text-gray-400 transition-transform ${open ? '' : '-rotate-90'}` }), jsx("span", { className: "min-w-0 flex-1 text-[0.9375rem] leading-snug font-semibold tracking-tight text-gray-900", children: jsx(Markdown, { children: heading }) }), jsx("span", { className: "shrink-0 text-xs text-gray-400", children: open ? t('chatClientUiTools.hide') : t('chatClientUiTools.show') })] }), open ? jsx("div", { className: "px-4 pt-0 pb-4", children: children }) : null] }));
44
+ }
45
+ /**
46
+ * Scrubbing a chart: a slider over the x axis with each series' value at that
47
+ * point. Hover already shows a tooltip, but a reader following an explanation
48
+ * wants to move along the curve deliberately — and on a touch screen there is
49
+ * no hover at all.
50
+ */
51
+ function ChartScrubber({ panel, at, onChange, }) {
52
+ return (jsxs("div", { className: "mt-3 border-t border-gray-100 pt-3", children: [jsxs("div", { className: "flex items-baseline justify-between", children: [jsx("label", { htmlFor: `${panel.id}-scrub`, className: "text-xs font-medium tracking-wide text-gray-500 uppercase", children: panel.labels[at] }), jsx("div", { className: "flex flex-wrap items-baseline justify-end gap-x-4 gap-y-1", children: panel.series.map((series, i) => {
53
+ var _a;
54
+ return (jsxs("span", { className: "flex items-baseline gap-1.5", children: [jsx("span", { "aria-hidden": true, className: "inline-block h-2 w-2 shrink-0 rounded-full", style: { background: SERIES_COLORS[i % SERIES_COLORS.length] } }), jsx("span", { className: "text-xs text-gray-500", children: series.name }), jsx("span", { className: "text-sm font-semibold text-gray-900 tabular-nums", children: (_a = series.data[at]) !== null && _a !== void 0 ? _a : 0 })] }, series.name));
55
+ }) })] }), jsx("input", { id: `${panel.id}-scrub`, type: "range", min: 0, max: panel.labels.length - 1, value: at, onChange: (event) => onChange(Number(event.target.value)), className: "mt-2 h-1.5 w-full cursor-pointer appearance-none rounded-full bg-gray-200 accent-[#38A1E5]" })] }));
56
+ }
57
+ function ChartView({ panel }) {
58
+ // Opens on the last point: the end of a trend is what a reader looks at first.
59
+ const [at, setAt] = useState(Math.max(0, panel.labels.length - 1));
60
+ const scrubbable = panel.chartKind !== 'pie' && panel.labels.length > 2;
61
+ const config = Object.fromEntries(panel.series.map((s, i) => [
62
+ s.name,
63
+ { label: s.name, color: SERIES_COLORS[i % SERIES_COLORS.length] },
64
+ ]));
65
+ const rows = panel.labels.map((label, i) => ({
66
+ label,
67
+ ...Object.fromEntries(panel.series.map((s) => { var _a; return [s.name, (_a = s.data[i]) !== null && _a !== void 0 ? _a : 0]; })),
68
+ }));
69
+ const axisLabel = (text, where) => text
70
+ ? {
71
+ value: text,
72
+ position: where === 'bottom' ? 'insideBottom' : 'insideLeft',
73
+ offset: where === 'bottom' ? -4 : 8,
74
+ angle: where === 'left' ? -90 : 0,
75
+ style: { fontSize: 11, fill: '#6B7280' },
76
+ }
77
+ : undefined;
78
+ if (panel.chartKind === 'pie' || panel.chartKind === 'donut') {
79
+ const first = panel.series[0];
80
+ const slices = panel.labels.map((label, i) => { var _a; return ({ label, value: (_a = first.data[i]) !== null && _a !== void 0 ? _a : 0 }); });
81
+ return (jsx(ChartContainer, { config: config, className: "h-64 w-full", children: jsxs(PieChart, { children: [jsx(ChartTooltip, { content: jsx(ChartTooltipContent, {}) }), jsx(Pie, { data: slices, dataKey: "value", nameKey: "label", outerRadius: 88,
82
+ // A donut's hole is where the total belongs; a pie has none.
83
+ innerRadius: panel.chartKind === 'donut' ? 52 : 0, paddingAngle: panel.chartKind === 'donut' ? 2 : 0, label: ({ name, percent }) => `${name} ${Math.round((percent !== null && percent !== void 0 ? percent : 0) * 100)}%`, labelLine: false, children: slices.map((_, i) => (jsx(Cell, { fill: SERIES_COLORS[i % SERIES_COLORS.length] }, i))) }), jsx(Legend, { verticalAlign: "bottom", height: 24, iconType: "circle", iconSize: 8 })] }) }));
84
+ }
85
+ if (panel.chartKind === 'treemap' || panel.chartKind === 'funnel') {
86
+ // One series only: both read a single set of magnitudes, and a second
87
+ // would have nowhere to go.
88
+ const first = panel.series[0];
89
+ const data = panel.labels.map((label, i) => {
90
+ var _a;
91
+ return ({
92
+ name: label,
93
+ value: Math.max(0, (_a = first.data[i]) !== null && _a !== void 0 ? _a : 0),
94
+ fill: SERIES_COLORS[i % SERIES_COLORS.length],
95
+ });
96
+ });
97
+ return (jsx(ChartContainer, { config: config, className: "h-64 w-full", children: panel.chartKind === 'treemap' ? (jsxs(Treemap, { data: data, dataKey: "value", stroke: "#fff", isAnimationActive: false, children: [jsx(ChartTooltip, { content: jsx(ChartTooltipContent, {}) }), jsx(LabelList, { dataKey: "name", position: "insideTopLeft", style: { fontSize: 11 } })] })) : (jsxs(FunnelChart, { children: [jsx(ChartTooltip, { content: jsx(ChartTooltipContent, {}) }), jsx(Funnel, { dataKey: "value", data: [...data].sort((a, b) => b.value - a.value), isAnimationActive: false, children: jsx(LabelList, { position: "right", dataKey: "name", style: { fontSize: 11 } }) })] })) }));
98
+ }
99
+ if (panel.chartKind === 'radial') {
100
+ const first = panel.series[0];
101
+ const data = panel.labels.map((label, i) => {
102
+ var _a;
103
+ return ({
104
+ name: label,
105
+ value: (_a = first.data[i]) !== null && _a !== void 0 ? _a : 0,
106
+ fill: SERIES_COLORS[i % SERIES_COLORS.length],
107
+ });
108
+ });
109
+ return (jsx(ChartContainer, { config: config, className: "h-64 w-full", children: jsxs(RadialBarChart, { data: data, innerRadius: "28%", outerRadius: "94%", startAngle: 90, endAngle: -270, children: [jsx(ChartTooltip, { content: jsx(ChartTooltipContent, {}) }), jsx(RadialBar, { dataKey: "value", background: true, cornerRadius: 6 }), jsx(Legend, { verticalAlign: "bottom", height: 24, iconType: "circle", iconSize: 8 })] }) }));
110
+ }
111
+ if (panel.chartKind === 'radar') {
112
+ return (jsx(ChartContainer, { config: config, className: "h-64 w-full", children: jsxs(RadarChart, { data: rows, outerRadius: 88, children: [jsx(PolarGrid, { strokeOpacity: 0.5 }), jsx(PolarAngleAxis, { dataKey: "label", tick: { fontSize: 11 } }), jsx(PolarRadiusAxis, { tick: { fontSize: 10 } }), jsx(ChartTooltip, { content: jsx(ChartTooltipContent, {}) }), panel.series.map((series, i) => (jsx(Radar, { dataKey: series.name, stroke: SERIES_COLORS[i % SERIES_COLORS.length], fill: SERIES_COLORS[i % SERIES_COLORS.length], fillOpacity: 0.25 }, series.name))), panel.series.length > 1 ? jsx(Legend, { iconType: "circle", iconSize: 8 }) : null] }) }));
113
+ }
114
+ if (panel.chartKind === 'scatter') {
115
+ // Points, not a sequence: the x value is the label read as a number when
116
+ // it is one, so "how these two relate" is readable rather than ordinal.
117
+ const points = panel.series.map((series) => ({
118
+ name: series.name,
119
+ data: panel.labels.map((label, i) => {
120
+ var _a;
121
+ return ({
122
+ x: Number(label) || i,
123
+ y: (_a = series.data[i]) !== null && _a !== void 0 ? _a : 0,
124
+ label,
125
+ });
126
+ }),
127
+ }));
128
+ return (jsx(ChartContainer, { config: config, className: "h-64 w-full", children: jsxs(ScatterChart, { children: [jsx(CartesianGrid, { strokeDasharray: "3 3", strokeOpacity: 0.6 }), jsx(XAxis, { type: "number", dataKey: "x", tickLine: false, axisLine: false, tick: { fontSize: 11 }, label: axisLabel(panel.xTitle, 'bottom') }), jsx(YAxis, { type: "number", dataKey: "y", tickLine: false, axisLine: false, width: 44, tick: { fontSize: 11 }, label: axisLabel(panel.yTitle, 'left') }), jsx(ZAxis, { range: [60, 60] }), jsx(ChartTooltip, { content: jsx(ChartTooltipContent, {}) }), points.map((series, i) => (jsx(Scatter, { name: series.name, data: series.data, fill: SERIES_COLORS[i % SERIES_COLORS.length] }, series.name))), points.length > 1 ? jsx(Legend, { iconType: "circle", iconSize: 8 }) : null] }) }));
129
+ }
130
+ const marker = scrubbable ? (jsx(ReferenceLine, { x: panel.labels[at], stroke: "#9CA3AF", strokeDasharray: "3 3" })) : null;
131
+ const axes = (jsxs(Fragment, { children: [jsx(CartesianGrid, { vertical: false, strokeDasharray: "3 3", strokeOpacity: 0.6 }), jsx(XAxis, { dataKey: "label", tickLine: false, axisLine: false, tickMargin: 8, tick: { fontSize: 11 }, label: axisLabel(panel.xTitle, 'bottom') }), jsx(YAxis, { tickLine: false, axisLine: false, width: 44, tick: { fontSize: 11 }, label: axisLabel(panel.yTitle, 'left') }), jsx(ChartTooltip, { content: jsx(ChartTooltipContent, {}) }), panel.series.length > 1 ? (jsx(Legend, { verticalAlign: "bottom", height: 24, iconType: "circle", iconSize: 8 })) : null] }));
132
+ return (jsxs(Fragment, { children: [jsx(ChartContainer, { config: config, className: "h-64 w-full", children: panel.chartKind === 'bar' || panel.chartKind === 'stacked-bar' ? (jsxs(BarChart, { data: rows, children: [axes, marker, panel.series.map((s, i) => (jsx(Bar, { dataKey: s.name, fill: SERIES_COLORS[i % SERIES_COLORS.length],
133
+ // One stack id puts every series in the same column.
134
+ stackId: panel.chartKind === 'stacked-bar' ? 'a' : undefined, radius: panel.chartKind === 'stacked-bar' ? 0 : 4 }, s.name)))] })) : panel.chartKind === 'combo' ? (jsxs(ComposedChart, { data: rows, children: [axes, marker, panel.series.map((s, i) =>
135
+ // The first series carries the volume, the rest ride over it.
136
+ i === 0 ? (jsx(Bar, { dataKey: s.name, fill: SERIES_COLORS[0], radius: 4 }, s.name)) : (jsx(Line, { type: "monotone", dataKey: s.name, stroke: SERIES_COLORS[i % SERIES_COLORS.length], strokeWidth: 2, dot: false }, s.name)))] })) : panel.chartKind === 'area' ? (jsxs(AreaChart, { data: rows, children: [axes, marker, panel.series.map((s, i) => (jsx(Area, { type: "monotone", dataKey: s.name, stroke: SERIES_COLORS[i % SERIES_COLORS.length], strokeWidth: 2, fill: SERIES_COLORS[i % SERIES_COLORS.length], fillOpacity: 0.18 }, s.name)))] })) : (jsxs(LineChart, { data: rows, children: [axes, marker, panel.series.map((s, i) => (jsx(Line, { type: "monotone", dataKey: s.name, stroke: SERIES_COLORS[i % SERIES_COLORS.length], strokeWidth: 2,
137
+ // Points only while there are few enough to read.
138
+ dot: panel.labels.length <= 24 ? { r: 3, strokeWidth: 0 } : false, activeDot: { r: 5 } }, s.name)))] })) }), scrubbable ? jsx(ChartScrubber, { panel: panel, at: at, onChange: setAt }) : null] }));
139
+ }
140
+ /**
141
+ * Drawn with Mermaid, loaded the first time a diagram appears.
142
+ *
143
+ * Deliberately not through the chat's markdown component: it overrides `pre`
144
+ * with its own fenced-code renderer, so a mermaid fence comes out as
145
+ * highlighted source rather than a diagram. Mermaid is an optional peer, so a
146
+ * host without it falls back to the source instead of an empty card.
147
+ */
148
+ function DiagramView({ panel }) {
149
+ const t = useT();
150
+ const [svg, setSvg] = useState(null);
151
+ const [failed, setFailed] = useState(false);
152
+ useEffect(() => {
153
+ let cancelled = false;
154
+ void (async () => {
155
+ try {
156
+ const mermaid = (await import('mermaid')).default;
157
+ mermaid.initialize({
158
+ startOnLoad: false,
159
+ theme: 'neutral',
160
+ // Labels come from a model, so Mermaid sanitises them.
161
+ securityLevel: 'strict',
162
+ fontFamily: 'inherit',
163
+ });
164
+ // A DOM id, so anything the call id may contain is stripped.
165
+ const id = `mermaid-${panel.id.replace(/[^A-Za-z0-9_-]/g, '')}`;
166
+ const { svg: drawn } = await mermaid.render(id, panel.source);
167
+ if (!cancelled)
168
+ setSvg(drawn);
169
+ }
170
+ catch (_a) {
171
+ if (!cancelled)
172
+ setFailed(true);
173
+ }
174
+ })();
175
+ return () => {
176
+ cancelled = true;
177
+ };
178
+ }, [panel.id, panel.source]);
179
+ if (failed) {
180
+ return (jsxs("div", { children: [jsx("p", { className: "mb-2 text-xs text-gray-500", children: t('chatClientUiTools.diagramFailed') }), jsx("pre", { className: "overflow-x-auto rounded-lg bg-gray-50 p-3 text-xs text-gray-700", children: panel.source })] }));
181
+ }
182
+ if (!svg) {
183
+ return jsx("div", { className: "h-32 animate-pulse rounded-lg bg-gray-100" });
184
+ }
185
+ return (jsx("div", { className: "flex justify-center overflow-x-auto [&_svg]:h-auto [&_svg]:max-w-full", "data-testid": "diagram-svg",
186
+ // Mermaid's own output, sanitised by its strict security level.
187
+ dangerouslySetInnerHTML: { __html: svg } }));
188
+ }
189
+ const TableView = ({ panel }) => (
190
+ // Its own scroller: a wide table must never make the chat scroll sideways.
191
+ jsx("div", { className: "overflow-x-auto", children: jsxs("table", { className: "w-full text-left text-sm", children: [jsx("thead", { className: "sticky top-0 bg-gray-50/90 backdrop-blur", children: jsx("tr", { className: "border-b border-gray-200", children: panel.columns.map((column) => (jsx("th", { className: "px-3 py-2 text-xs font-semibold tracking-wide text-gray-600 uppercase", children: column }, column))) }) }), jsx("tbody", { children: panel.rows.map((row, i) => (jsx("tr", { className: "border-b border-gray-100 transition-colors last:border-0 odd:bg-white even:bg-gray-50/40 hover:bg-blue-50/40", children: row.map((cell, j) => (jsx("td", { className: `px-3 py-2 text-gray-700 ${
192
+ // Figures line up when they are read down a column.
193
+ /^[-+$€£]?[\d,.\s]+%?$/.test(cell) ? 'text-right tabular-nums' : ''}`, children: cell }, j))) }, i))) })] }) }));
194
+ const MetricsView = ({ panel }) => (jsx("div", { className: "grid grid-cols-2 gap-2.5 md:grid-cols-3", children: panel.items.map((item) => (jsxs("div", { className: "rounded-lg border border-gray-100 bg-white p-3 transition-colors hover:border-gray-200", children: [jsx("div", { className: "text-xs font-medium tracking-wide text-gray-500 uppercase", children: item.label }), jsx("div", { className: "mt-1 text-2xl font-semibold tracking-tight text-gray-900 tabular-nums", children: item.value }), item.hint ? jsx("div", { className: "mt-0.5 text-xs text-gray-400", children: item.hint }) : null] }, item.label))) }));
195
+ function FormView({ panel }) {
196
+ const t = useT();
197
+ const [values, setValues] = useState({});
198
+ const [missing, setMissing] = useState([]);
199
+ const set = (name, value) => setValues((v) => ({ ...v, [name]: value }));
200
+ const submit = (event) => {
201
+ event.preventDefault();
202
+ const blank = panel.fields
203
+ .filter((f) => { var _a; return f.required && !((_a = values[f.name]) !== null && _a !== void 0 ? _a : '').trim(); })
204
+ .map((f) => f.name);
205
+ setMissing(blank);
206
+ if (blank.length)
207
+ return;
208
+ panel.settle(values);
209
+ };
210
+ const disabled = panel.settled === true;
211
+ return (jsxs("form", { onSubmit: submit, className: "space-y-3", children: [panel.description ? jsx("p", { className: "text-sm text-gray-600", children: panel.description }) : null, panel.fields.map((field) => {
212
+ var _a, _b, _c, _d, _e, _f, _g;
213
+ const id = `${panel.id}-${field.name}`;
214
+ const invalid = missing.includes(field.name);
215
+ return (jsxs("div", { className: "space-y-1", children: [jsx(Label, { htmlFor: id, className: "text-sm font-medium text-gray-700", children: field.label }), field.kind === 'textarea' ? (jsx(Textarea, { id: id, disabled: disabled, placeholder: field.placeholder, value: (_a = values[field.name]) !== null && _a !== void 0 ? _a : '', onChange: (e) => set(field.name, e.target.value) })) : field.kind === 'select' ? (jsxs("select", { id: id, disabled: disabled, className: "h-9 w-full rounded-md border border-gray-200 px-2 text-sm", value: (_b = values[field.name]) !== null && _b !== void 0 ? _b : '', onChange: (e) => set(field.name, e.target.value), children: [jsx("option", { value: "", children: (_c = field.placeholder) !== null && _c !== void 0 ? _c : '' }), (_d = field.options) === null || _d === void 0 ? void 0 : _d.map((option) => (jsx("option", { value: option, children: option }, option)))] })) : field.kind === 'radio' ? (jsx("div", { className: "space-y-1", children: (_e = field.options) === null || _e === void 0 ? void 0 : _e.map((option) => (jsxs("label", { className: "flex items-center gap-2 text-sm text-gray-700", children: [jsx("input", { type: "radio", name: id, disabled: disabled, checked: values[field.name] === option, onChange: () => set(field.name, option) }), option] }, option))) })) : field.kind === 'checkbox' ? (jsxs("label", { className: "flex items-center gap-2 text-sm text-gray-700", children: [jsx("input", { id: id, type: "checkbox", disabled: disabled, checked: values[field.name] === 'true', onChange: (e) => set(field.name, String(e.target.checked)) }), (_f = field.placeholder) !== null && _f !== void 0 ? _f : field.label] })) : (jsx(Input, { id: id, type: field.kind === 'number'
216
+ ? 'number'
217
+ : field.kind === 'email'
218
+ ? 'email'
219
+ : field.kind === 'date'
220
+ ? 'date'
221
+ : 'text', disabled: disabled, placeholder: field.placeholder, value: (_g = values[field.name]) !== null && _g !== void 0 ? _g : '', onChange: (e) => set(field.name, e.target.value) })), invalid ? (jsx("p", { className: "text-xs text-red-500", children: t('chatClientUiTools.fieldRequired', { field: field.label }) })) : null] }, field.name));
222
+ }), jsxs("div", { className: "flex items-center gap-2", children: [jsx(Button, { type: "submit", size: "sm", disabled: disabled, children: panel.submitLabel || t('chatClientUiTools.submit') }), disabled ? (jsx("span", { className: "text-xs text-gray-500", children: t('chatClientUiTools.sent') })) : null] })] }));
223
+ }
224
+ function ClientUiPanelView({ panel }) {
225
+ switch (panel.kind) {
226
+ case 'chart':
227
+ return (jsx(Frame, { title: panel.title, kind: "chart", children: jsx(ChartView, { panel: panel }) }));
228
+ case 'diagram':
229
+ return (jsx(Frame, { title: panel.title, kind: "diagram", children: jsx(DiagramView, { panel: panel }) }));
230
+ case 'table':
231
+ return (jsx(Frame, { title: panel.title, kind: "table", children: jsx(TableView, { panel: panel }) }));
232
+ case 'metrics':
233
+ return (jsx(Frame, { title: panel.title, kind: "metrics", children: jsx(MetricsView, { panel: panel }) }));
234
+ case 'form':
235
+ return (jsx(Frame, { title: panel.title, kind: "form", children: jsx(FormView, { panel: panel }) }));
236
+ }
237
+ }
238
+
239
+ export { ClientUiPanelView };
240
+ //# sourceMappingURL=panels.js.map