@marimo-team/islands 0.23.7-dev9 → 0.23.7-dev90

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 (153) hide show
  1. package/dist/{ConnectedDataExplorerComponent-DnRhpPMJ.js → ConnectedDataExplorerComponent-2lBNiUv6.js} +13 -13
  2. package/dist/{ErrorBoundary-Da4UeYxT.js → ErrorBoundary-D3wrPNma.js} +1 -1
  3. package/dist/{any-language-editor-DDubl8YH.js → any-language-editor-VWs_7v27.js} +5 -5
  4. package/dist/assets/__vite-browser-external-CAdMKBac.js +1 -0
  5. package/dist/assets/worker-CpBbwbQo.js +73 -0
  6. package/dist/{button-CA5pI2YF.js → button-Dj4BTre0.js} +5 -0
  7. package/dist/{capabilities-6laDasij.js → capabilities-C9rrYCzf.js} +1 -1
  8. package/dist/{chat-ui-BmWZZ3mE.js → chat-ui-D3XBept8.js} +625 -233
  9. package/dist/{check-CFM2mVDr.js → check-BcUIXnUT.js} +1 -1
  10. package/dist/{code-visibility-CRHzv49w.js → code-visibility-C5NrPsUC.js} +11480 -1992
  11. package/dist/{copy-TGGAUEWp.js → copy-DLf4aN7I.js} +2 -2
  12. package/dist/{dist-ESg7xyoD.js → dist-D3ZI9nhS.js} +2 -2
  13. package/dist/{error-banner-DnBPzEWg.js → error-banner-CVkfBUT3.js} +2 -2
  14. package/dist/{esm-Dd1z1auZ.js → esm-CWp0KQeK.js} +1 -1
  15. package/dist/{extends-CzJgxo2J.js → extends-vAi97cpa.js} +4 -4
  16. package/dist/{formats-CgaK7Gmx.js → formats-Dsy9kkZu.js} +3 -3
  17. package/dist/{glide-data-editor-B-3A3G02.js → glide-data-editor-DucgdjRo.js} +9 -9
  18. package/dist/{html-to-image-BwZL1Pkk.js → html-to-image-CpggM7u1.js} +2667 -2408
  19. package/dist/{input-BAOe64zx.js → input-D4kjoQUB.js} +8 -6
  20. package/dist/{label-BCWi-Oqu.js → label-BLqV33b1.js} +2 -2
  21. package/dist/{loader-BvW0-YWZ.js → loader-Dr8Qem8p.js} +1 -1
  22. package/dist/main.js +1697 -10282
  23. package/dist/{mermaid-cXSZ1pfD.js → mermaid-DO-Daq7u.js} +5 -5
  24. package/dist/{process-output-lpVrk7d5.js → process-output-X8TR20AK.js} +3 -3
  25. package/dist/reveal-component-kMIwe09M.js +7447 -0
  26. package/dist/{spec-DSIuqd3f.js → spec-hVaaZsY5.js} +4 -4
  27. package/dist/{strings-B_FOH6eV.js → strings-BiIhGaI8.js} +4 -4
  28. package/dist/style.css +1 -1
  29. package/dist/{swiper-component-BHs0PWwp.js → swiper-component-DlD2GU2g.js} +2 -2
  30. package/dist/{toDate-CHtl9vts.js → toDate-CIpC_34u.js} +33 -20
  31. package/dist/{tooltip-B0mtKTXm.js → tooltip-DRaMBu06.js} +3 -3
  32. package/dist/{types-DBtDeUKD.js → types-Dzuoc3LN.js} +1 -1
  33. package/dist/{useAsyncData-B6hCGywC.js → useAsyncData-C56Khv_R.js} +1 -1
  34. package/dist/{useDateFormatter-B3mCQMP3.js → useDateFormatter-B_9k85Ex.js} +2 -2
  35. package/dist/{useDeepCompareMemoize-CmwDuYUH.js → useDeepCompareMemoize-Dt98v2ua.js} +1 -1
  36. package/dist/{useIframeCapabilities-DbdLoEDm.js → useIframeCapabilities-BkYHTrss.js} +1 -1
  37. package/dist/{useLifecycle-CjMjllqy.js → useLifecycle-BF6-z62y.js} +3 -3
  38. package/dist/{useTheme-CByZUW0p.js → useTheme-DykuNHR2.js} +2 -2
  39. package/dist/{vega-component-C2BYPkfd.js → vega-component-cSdqoAxe.js} +10 -10
  40. package/dist/{zod-BxdsqRPd.js → zod-BWkcDORu.js} +1 -1
  41. package/package.json +3 -3
  42. package/src/components/chat/chat-components.tsx +47 -0
  43. package/src/components/chat/chat-display.tsx +41 -7
  44. package/src/components/chat/chat-panel.tsx +37 -10
  45. package/src/components/chat/chat-utils.ts +42 -20
  46. package/src/components/chat/reasoning-accordion.tsx +14 -3
  47. package/src/components/chat/tool-call/shared.ts +13 -0
  48. package/src/components/chat/tool-call/tool-approval-card.tsx +62 -0
  49. package/src/components/chat/tool-call/tool-args.tsx +26 -0
  50. package/src/components/chat/tool-call/tool-call-view.tsx +99 -0
  51. package/src/components/chat/tool-call/tool-error-card.tsx +81 -0
  52. package/src/components/chat/tool-call/tool-history-row.tsx +153 -0
  53. package/src/components/chat/tool-call/tool-result.tsx +101 -0
  54. package/src/components/data-table/__tests__/column-header.test.ts +3 -1
  55. package/src/components/data-table/__tests__/column-header.test.tsx +308 -0
  56. package/src/components/data-table/__tests__/filter-by-values-picker.test.tsx +112 -0
  57. package/src/components/data-table/__tests__/filter-pill-editor.test.tsx +261 -0
  58. package/src/components/data-table/__tests__/filters.test.ts +196 -49
  59. package/src/components/data-table/charts/components/form-fields.tsx +1 -0
  60. package/src/components/data-table/column-header.tsx +349 -170
  61. package/src/components/data-table/date-filter-inputs.tsx +325 -0
  62. package/src/components/data-table/filter-by-values-picker.tsx +70 -9
  63. package/src/components/data-table/filter-pill-editor.tsx +410 -156
  64. package/src/components/data-table/filter-pills.tsx +69 -54
  65. package/src/components/data-table/filters.ts +218 -101
  66. package/src/components/data-table/header-items.tsx +8 -1
  67. package/src/components/data-table/operator-labels.ts +25 -0
  68. package/src/components/data-table/regex-input.tsx +61 -0
  69. package/src/components/dependency-graph/minimap-content.tsx +14 -3
  70. package/src/components/editor/actions/pair-with-agent-modal.tsx +140 -49
  71. package/src/components/editor/actions/useNotebookActions.tsx +3 -1
  72. package/src/components/editor/app-container.tsx +7 -1
  73. package/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx +10 -2
  74. package/src/components/editor/chrome/wrapper/app-chrome.tsx +1 -0
  75. package/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx +1 -1
  76. package/src/components/editor/chrome/wrapper/footer.tsx +4 -1
  77. package/src/components/editor/chrome/wrapper/panels.tsx +4 -1
  78. package/src/components/editor/chrome/wrapper/sidebar.tsx +4 -1
  79. package/src/components/editor/controls/Controls.tsx +11 -3
  80. package/src/components/editor/file-tree/file-explorer.tsx +12 -2
  81. package/src/components/editor/header/__tests__/status.test.tsx +108 -0
  82. package/src/components/editor/header/status.tsx +44 -10
  83. package/src/components/editor/navigation/__tests__/clipboard.test.ts +106 -0
  84. package/src/components/editor/navigation/__tests__/navigation.test.ts +70 -0
  85. package/src/components/editor/navigation/clipboard.ts +99 -25
  86. package/src/components/editor/navigation/navigation.ts +15 -1
  87. package/src/components/editor/notebook-cell.tsx +5 -0
  88. package/src/components/editor/output/console/ConsoleOutput.tsx +23 -5
  89. package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +114 -0
  90. package/src/components/editor/renderers/slides-layout/__tests__/compute-slide-cells.test.ts +5 -4
  91. package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +55 -15
  92. package/src/components/editor/renderers/slides-layout/plugin.tsx +8 -25
  93. package/src/components/editor/renderers/slides-layout/slides-layout.tsx +19 -6
  94. package/src/components/editor/renderers/slides-layout/types.ts +40 -31
  95. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +1 -0
  96. package/src/components/home/components.tsx +6 -0
  97. package/src/components/pages/run-page.tsx +4 -1
  98. package/src/components/scratchpad/scratchpad.tsx +1 -0
  99. package/src/components/slides/__tests__/slide-notes.test.ts +131 -0
  100. package/src/components/slides/reveal-component.tsx +252 -147
  101. package/src/components/slides/slide-notes-editor.tsx +127 -0
  102. package/src/components/slides/slide-notes.ts +64 -0
  103. package/src/components/slides/slides.css +14 -0
  104. package/src/components/ui/combobox.tsx +24 -5
  105. package/src/components/ui/number-field.tsx +2 -0
  106. package/src/core/ai/tools/__tests__/registry.test.ts +10 -12
  107. package/src/core/ai/tools/registry.ts +9 -5
  108. package/src/core/cells/__tests__/cells.test.ts +187 -0
  109. package/src/core/cells/__tests__/pending-cut-service.test.tsx +123 -0
  110. package/src/core/cells/cells.ts +102 -17
  111. package/src/core/cells/document-changes.ts +6 -1
  112. package/src/core/cells/pending-cut-service.ts +55 -0
  113. package/src/core/cells/utils.ts +11 -0
  114. package/src/core/codemirror/cells/extensions.ts +10 -0
  115. package/src/core/codemirror/go-to-definition/__tests__/commands.test.ts +152 -0
  116. package/src/core/codemirror/go-to-definition/__tests__/utils.test.ts +99 -0
  117. package/src/core/codemirror/go-to-definition/commands.ts +382 -22
  118. package/src/core/codemirror/go-to-definition/utils.ts +23 -5
  119. package/src/core/edit-app.tsx +3 -2
  120. package/src/core/hotkeys/hotkeys.ts +5 -0
  121. package/src/core/islands/worker/worker.tsx +3 -2
  122. package/src/core/run-app.tsx +2 -1
  123. package/src/core/runtime/__tests__/runtime.test.ts +38 -17
  124. package/src/core/runtime/runtime.ts +57 -34
  125. package/src/core/wasm/__tests__/utils.test.ts +34 -0
  126. package/src/core/wasm/utils.ts +14 -0
  127. package/src/core/wasm/worker/bootstrap.ts +3 -2
  128. package/src/core/wasm/worker/worker.ts +3 -2
  129. package/src/core/websocket/__tests__/useMarimoKernelConnection.hook.test.tsx +156 -0
  130. package/src/core/websocket/__tests__/useMarimoKernelConnection.test.ts +101 -0
  131. package/src/core/websocket/transports/__tests__/ws.test.ts +125 -0
  132. package/src/core/websocket/transports/basic.ts +1 -1
  133. package/src/core/websocket/transports/ws.ts +96 -0
  134. package/src/core/websocket/useMarimoKernelConnection.tsx +133 -54
  135. package/src/core/websocket/useWebSocket.tsx +3 -15
  136. package/src/css/app/Cell.css +10 -0
  137. package/src/plugins/core/__test__/sanitize.test.ts +30 -0
  138. package/src/plugins/impl/DropdownPlugin.tsx +12 -1
  139. package/src/plugins/impl/MultiselectPlugin.tsx +4 -0
  140. package/src/plugins/impl/SearchableSelect.tsx +11 -1
  141. package/src/plugins/impl/TabsPlugin.tsx +35 -7
  142. package/src/plugins/impl/__tests__/DropdownPlugin.test.tsx +56 -0
  143. package/src/plugins/impl/__tests__/TabsPlugin.test.tsx +154 -0
  144. package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +48 -36
  145. package/src/plugins/impl/data-frames/schema.ts +4 -1
  146. package/src/plugins/layout/DownloadPlugin.tsx +9 -7
  147. package/src/utils/__tests__/id-tree.test.ts +71 -0
  148. package/src/utils/download.ts +4 -2
  149. package/src/utils/id-tree.tsx +89 -0
  150. package/dist/assets/__vite-browser-external-rrUYDKRl.js +0 -1
  151. package/dist/assets/worker-Bfy15ViQ.js +0 -73
  152. package/dist/reveal-component-C97Ceb7e.js +0 -4863
  153. package/src/components/chat/tool-call-accordion.tsx +0 -247
@@ -2,26 +2,26 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import { s as __toESM, t as __commonJSMin } from "./chunk-BNovOVIE.js";
5
- import { _ as Logger, c as Objects, g as cn, l as useEventListener, t as Button } from "./button-CA5pI2YF.js";
5
+ import { _ as Logger, c as Objects, g as cn, l as useEventListener, t as Button } from "./button-Dj4BTre0.js";
6
6
  import { t as require_react } from "./react-DA-nE2FX.js";
7
7
  import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
8
- import { r as toast } from "./copy-TGGAUEWp.js";
9
- import { C as AccordionContent, D as ChatBubbleIcon, En as Trash2, Ft as jotaiJsonStorage, G as cellErrorsAtom, Ht as allTablesAtom, It as variablesAtom, Kt as getRequestClient, Lt as PluralWord, Nn as Info, Ot as moveToEndOfEditor, P as base64ToDataURL, Rn as CircleX, S as Accordion, T as AccordionTrigger, Tn as Wrench, Tt as createVariableInfoElement, Ut as dataSourceConnectionsAtom, V as renderHTML, Wt as getTableType, Xt as singleFacet, Y as notebookAtom, _ as Boosts, _n as atomWithStorage, b as AIContextProvider, c as Popover, d as PopoverTrigger, f as isOutputEmpty, h as DatasourceContextProvider, jn as LoaderCircle, n as MarkdownRenderer, on as CellOutputId, s as Spinner, t as toPng, tn as ZodLocalStorage, u as PopoverContent, v as Sections, vt as displayCellName, w as AccordionItem, x as AIContextRegistry, y as contextToXml, yn as Anchor2 } from "./html-to-image-BwZL1Pkk.js";
8
+ import { r as toast } from "./copy-DLf4aN7I.js";
9
+ import { C as AccordionContent, D as ChatBubbleIcon, En as Trash2, Ft as jotaiJsonStorage, G as cellErrorsAtom, Ht as allTablesAtom, In as ExternalLink, It as variablesAtom, Kt as getRequestClient, Lt as PluralWord, Nn as Info, Ot as moveToEndOfEditor, P as base64ToDataURL, Pn as FileText, S as Accordion, T as AccordionTrigger, Tn as Wrench, Tt as createVariableInfoElement, Ut as dataSourceConnectionsAtom, V as renderHTML, Wt as getTableType, Xt as singleFacet, Y as notebookAtom, _ as Boosts, _n as atomWithStorage, b as AIContextProvider, c as Popover, d as PopoverTrigger, f as isOutputEmpty, h as DatasourceContextProvider, jn as LoaderCircle, n as MarkdownRenderer, on as CellOutputId, s as Spinner, t as toPng, tn as ZodLocalStorage, u as PopoverContent, v as Sections, vt as displayCellName, w as AccordionItem, x as AIContextRegistry, y as contextToXml, yn as Anchor2, zn as CircleX } from "./html-to-image-CpggM7u1.js";
10
10
  import "./chunk-5FQGJX7Z-BOg95xG5.js";
11
- import { u as createLucideIcon } from "./dist-ESg7xyoD.js";
12
- import { F as X, S as logNever, t as Strings } from "./strings-B_FOH6eV.js";
13
- import { a as NumberField, b as DropdownMenuTrigger, d as DropdownMenuContent, p as DropdownMenuItem, r as Input, u as DropdownMenu } from "./input-BAOe64zx.js";
14
- import { v as CircleQuestionMark } from "./toDate-CHtl9vts.js";
15
- import { a as MarimoIncomingMessageEvent, d as File$1, n as blobToString, t as processOutput, u as deserializeBlob } from "./process-output-lpVrk7d5.js";
11
+ import { u as createLucideIcon } from "./dist-D3ZI9nhS.js";
12
+ import { F as X, L as ChevronDown, S as logNever, t as Strings } from "./strings-BiIhGaI8.js";
13
+ import { a as NumberField, b as DropdownMenuTrigger, d as DropdownMenuContent, p as DropdownMenuItem, r as Input, u as DropdownMenu } from "./input-D4kjoQUB.js";
14
+ import { p as isUrl, v as CircleQuestionMark } from "./toDate-CIpC_34u.js";
15
+ import { a as MarimoIncomingMessageEvent, d as File$1, n as blobToString, t as processOutput, u as deserializeBlob } from "./process-output-X8TR20AK.js";
16
16
  import "./react-dom-BWRJ_g_k.js";
17
17
  import { t as require_jsx_runtime } from "./jsx-runtime-COBk7ree.js";
18
- import { B as union, C as any, D as discriminatedUnion, E as custom, H as safeParseAsync, I as record, L as strictObject, M as never, N as number, O as lazy, P as object$1, R as string, S as _null, T as boolean, V as unknown, W as toJSONSchema, b as _enum, k as literal, w as array$1, x as _instanceof } from "./zod-BxdsqRPd.js";
19
- import { n as ErrorBanner } from "./error-banner-DnBPzEWg.js";
20
- import { t as Label } from "./label-BCWi-Oqu.js";
21
- import { t as Tooltip } from "./tooltip-B0mtKTXm.js";
22
- import { f as CopyClipboardIcon } from "./extends-CzJgxo2J.js";
18
+ import { A as looseObject, B as union, C as any, D as discriminatedUnion, E as custom, H as safeParseAsync, I as record, L as strictObject, M as never, N as number, O as lazy, P as object$1, R as string, S as _null, T as boolean, V as unknown, W as toJSONSchema, b as _enum, k as literal, w as array$1, x as _instanceof } from "./zod-BWkcDORu.js";
19
+ import { n as ErrorBanner } from "./error-banner-CVkfBUT3.js";
20
+ import { t as Label } from "./label-BLqV33b1.js";
21
+ import { t as Tooltip } from "./tooltip-DRaMBu06.js";
22
+ import { f as CopyClipboardIcon } from "./extends-vAi97cpa.js";
23
23
  import { t as isEmpty_default } from "./isEmpty-Dd8mx_WL.js";
24
- import { n as useTheme, v as useStore, w as useEvent_default } from "./useTheme-CByZUW0p.js";
24
+ import { n as useTheme, v as useStore, w as useEvent_default } from "./useTheme-DykuNHR2.js";
25
25
  import { $ as ViewPlugin, At as Prec, Dt as EditorState, Ft as StateField, Lt as Transaction, Ot as Facet, Pt as StateEffect, Y as Decoration, Z as EditorView, dt as keymap, et as WidgetType, ut as hoverTooltip } from "./dist-CCADb07R.js";
26
26
  import { n as acceptCompletion, o as closeCompletion, r as autocompletion } from "./dist-JEhxD_cn.js";
27
27
  import "./main-CThhXnXU.js";
@@ -30,10 +30,18 @@ import "./dist-UcOPnRMa.js";
30
30
  import "./dist-BTyJtnNg.js";
31
31
  import "./dist-DGAfI2rB.js";
32
32
  import "./dist-nuW5EDYT.js";
33
- import { n as minimalSetup, t as esm_default } from "./esm-Dd1z1auZ.js";
33
+ import { n as minimalSetup, t as esm_default } from "./esm-CWp0KQeK.js";
34
34
  import "./purify.es-DT70lfR0.js";
35
- import { t as useAsyncData } from "./useAsyncData-B6hCGywC.js";
36
- var BotMessageSquare = createLucideIcon("bot-message-square", [
35
+ import { t as useAsyncData } from "./useAsyncData-C56Khv_R.js";
36
+ var Ban = createLucideIcon("ban", [["path", {
37
+ d: "M4.929 4.929 19.07 19.071",
38
+ key: "196cmz"
39
+ }], ["circle", {
40
+ cx: "12",
41
+ cy: "12",
42
+ r: "10",
43
+ key: "1mglay"
44
+ }]]), BotMessageSquare = createLucideIcon("bot-message-square", [
37
45
  ["path", {
38
46
  d: "M12 6V2H8",
39
47
  key: "1155em"
@@ -87,7 +95,20 @@ var BotMessageSquare = createLucideIcon("bot-message-square", [
87
95
  cy: "12",
88
96
  r: "3",
89
97
  key: "1v7zrd"
90
- }]]);
98
+ }]]), ShieldQuestionMark = createLucideIcon("shield-question-mark", [
99
+ ["path", {
100
+ d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
101
+ key: "oel41y"
102
+ }],
103
+ ["path", {
104
+ d: "M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",
105
+ key: "mhlwft"
106
+ }],
107
+ ["path", {
108
+ d: "M12 17h.01",
109
+ key: "p32p05"
110
+ }]
111
+ ]);
91
112
  require_compiler_runtime();
92
113
  var import_react = /* @__PURE__ */ __toESM(require_react(), 1), marker$2 = "vercel.ai.error", symbol$2 = Symbol.for(marker$2), _a$2, _b$1, AISDKError = class e extends (_b$1 = Error, _a$2 = symbol$2, _b$1) {
93
114
  constructor({ name: e18, message: h, cause: g }) {
@@ -2885,42 +2906,107 @@ var ParseError = class extends Error {
2885
2906
  constructor(e18, h) {
2886
2907
  super(e18), this.name = "ParseError", this.type = h.type, this.field = h.field, this.value = h.value, this.line = h.line;
2887
2908
  }
2888
- };
2909
+ }, LF = 10, CR = 13, SPACE = 32;
2889
2910
  function noop(e18) {
2890
2911
  }
2891
2912
  function createParser(e18) {
2892
2913
  if (typeof e18 == "function") throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");
2893
- let { onEvent: h = noop, onError: g = noop, onRetry: _ = noop, onComment: v } = e18, y = "", b = true, x, S = "", C = "";
2894
- function w(e19) {
2895
- let h2 = b ? e19.replace(/^\xEF\xBB\xBF/, "") : e19, [g2, _2] = splitLines(`${y}${h2}`);
2896
- for (let e20 of g2) T(e20);
2897
- y = _2, b = false;
2898
- }
2914
+ let { onEvent: h = noop, onError: g = noop, onRetry: _ = noop, onComment: v } = e18, y = [], b = true, x, S = "", C = 0, w;
2899
2915
  function T(e19) {
2900
- if (e19 === "") {
2901
- D();
2916
+ if (b && (b = false, e19.charCodeAt(0) === 239 && e19.charCodeAt(1) === 187 && e19.charCodeAt(2) === 191 && (e19 = e19.slice(3))), y.length === 0) {
2917
+ let h3 = E(e19);
2918
+ h3 !== "" && y.push(h3);
2919
+ return;
2920
+ }
2921
+ if (e19.indexOf("\n") === -1 && e19.indexOf("\r") === -1) {
2922
+ y.push(e19);
2923
+ return;
2924
+ }
2925
+ y.push(e19);
2926
+ let h2 = y.join("");
2927
+ y.length = 0;
2928
+ let g2 = E(h2);
2929
+ g2 !== "" && y.push(g2);
2930
+ }
2931
+ function E(e19) {
2932
+ let g2 = 0;
2933
+ if (e19.indexOf("\r") === -1) {
2934
+ let _2 = e19.indexOf("\n", g2);
2935
+ for (; _2 !== -1; ) {
2936
+ if (g2 === _2) {
2937
+ C > 0 && h({
2938
+ id: x,
2939
+ event: w,
2940
+ data: S
2941
+ }), x = void 0, S = "", C = 0, w = void 0, g2 = _2 + 1, _2 = e19.indexOf("\n", g2);
2942
+ continue;
2943
+ }
2944
+ let v2 = e19.charCodeAt(g2);
2945
+ if (isDataPrefix(e19, g2, v2)) {
2946
+ let v3 = e19.charCodeAt(g2 + 5) === SPACE ? g2 + 6 : g2 + 5, y2 = e19.slice(v3, _2);
2947
+ if (C === 0 && e19.charCodeAt(_2 + 1) === LF) {
2948
+ h({
2949
+ id: x,
2950
+ event: w,
2951
+ data: y2
2952
+ }), x = void 0, S = "", w = void 0, g2 = _2 + 2, _2 = e19.indexOf("\n", g2);
2953
+ continue;
2954
+ }
2955
+ S = C === 0 ? y2 : `${S}
2956
+ ${y2}`, C++;
2957
+ } else isEventPrefix(e19, g2, v2) ? w = e19.slice(e19.charCodeAt(g2 + 6) === SPACE ? g2 + 7 : g2 + 6, _2) || void 0 : D(e19, g2, _2);
2958
+ g2 = _2 + 1, _2 = e19.indexOf("\n", g2);
2959
+ }
2960
+ return e19.slice(g2);
2961
+ }
2962
+ for (; g2 < e19.length; ) {
2963
+ let h2 = e19.indexOf("\r", g2), _2 = e19.indexOf("\n", g2), v2 = -1;
2964
+ if (h2 !== -1 && _2 !== -1 ? v2 = h2 < _2 ? h2 : _2 : h2 === -1 ? _2 !== -1 && (v2 = _2) : v2 = h2 === e19.length - 1 ? -1 : h2, v2 === -1) break;
2965
+ D(e19, g2, v2), g2 = v2 + 1, e19.charCodeAt(g2 - 1) === CR && e19.charCodeAt(g2) === LF && g2++;
2966
+ }
2967
+ return e19.slice(g2);
2968
+ }
2969
+ function D(e19, h2, g2) {
2970
+ if (h2 === g2) {
2971
+ k();
2972
+ return;
2973
+ }
2974
+ let _2 = e19.charCodeAt(h2);
2975
+ if (isDataPrefix(e19, h2, _2)) {
2976
+ let _3 = e19.charCodeAt(h2 + 5) === SPACE ? h2 + 6 : h2 + 5, v2 = e19.slice(_3, g2);
2977
+ S = C === 0 ? v2 : `${S}
2978
+ ${v2}`, C++;
2902
2979
  return;
2903
2980
  }
2904
- if (e19.startsWith(":")) {
2905
- v && v(e19.slice(e19.startsWith(": ") ? 2 : 1));
2981
+ if (isEventPrefix(e19, h2, _2)) {
2982
+ w = e19.slice(e19.charCodeAt(h2 + 6) === SPACE ? h2 + 7 : h2 + 6, g2) || void 0;
2906
2983
  return;
2907
2984
  }
2908
- let h2 = e19.indexOf(":");
2909
- if (h2 !== -1) {
2910
- let g2 = e19.slice(0, h2), _2 = e19[h2 + 1] === " " ? 2 : 1;
2911
- E(g2, e19.slice(h2 + _2), e19);
2985
+ if (_2 === 105 && e19.charCodeAt(h2 + 1) === 100 && e19.charCodeAt(h2 + 2) === 58) {
2986
+ let _3 = e19.slice(e19.charCodeAt(h2 + 3) === SPACE ? h2 + 4 : h2 + 3, g2);
2987
+ x = _3.includes("\0") ? void 0 : _3;
2912
2988
  return;
2913
2989
  }
2914
- E(e19, "", e19);
2990
+ if (_2 === 58) {
2991
+ v && v(e19.slice(h2, g2).slice(e19.charCodeAt(h2 + 1) === SPACE ? 2 : 1));
2992
+ return;
2993
+ }
2994
+ let y2 = e19.slice(h2, g2), b2 = y2.indexOf(":");
2995
+ if (b2 === -1) {
2996
+ O(y2, "", y2);
2997
+ return;
2998
+ }
2999
+ let T2 = y2.slice(0, b2), E2 = y2.charCodeAt(b2 + 1) === SPACE ? 2 : 1;
3000
+ O(T2, y2.slice(b2 + E2), y2);
2915
3001
  }
2916
- function E(e19, h2, v2) {
3002
+ function O(e19, h2, v2) {
2917
3003
  switch (e19) {
2918
3004
  case "event":
2919
- C = h2;
3005
+ w = h2 || void 0;
2920
3006
  break;
2921
3007
  case "data":
2922
- S = `${S}${h2}
2923
- `;
3008
+ S = C === 0 ? h2 : `${S}
3009
+ ${h2}`, C++;
2924
3010
  break;
2925
3011
  case "id":
2926
3012
  x = h2.includes("\0") ? void 0 : h2;
@@ -2942,34 +3028,30 @@ function createParser(e18) {
2942
3028
  break;
2943
3029
  }
2944
3030
  }
2945
- function D() {
2946
- S.length > 0 && h({
3031
+ function k() {
3032
+ C > 0 && h({
2947
3033
  id: x,
2948
- event: C || void 0,
2949
- data: S.endsWith("\n") ? S.slice(0, -1) : S
2950
- }), x = void 0, S = "", C = "";
2951
- }
2952
- function O(e19 = {}) {
2953
- y && e19.consume && T(y), b = true, x = void 0, S = "", C = "", y = "";
3034
+ event: w,
3035
+ data: S
3036
+ }), x = void 0, S = "", C = 0, w = void 0;
3037
+ }
3038
+ function A(e19 = {}) {
3039
+ if (e19.consume && y.length > 0) {
3040
+ let e20 = y.join("");
3041
+ D(e20, 0, e20.length);
3042
+ }
3043
+ b = true, x = void 0, S = "", C = 0, w = void 0, y.length = 0;
2954
3044
  }
2955
3045
  return {
2956
- feed: w,
2957
- reset: O
3046
+ feed: T,
3047
+ reset: A
2958
3048
  };
2959
3049
  }
2960
- function splitLines(e18) {
2961
- let h = [], g = "", _ = 0;
2962
- for (; _ < e18.length; ) {
2963
- let v = e18.indexOf("\r", _), y = e18.indexOf("\n", _), b = -1;
2964
- if (v !== -1 && y !== -1 ? b = Math.min(v, y) : v === -1 ? y !== -1 && (b = y) : b = v === e18.length - 1 ? -1 : v, b === -1) {
2965
- g = e18.slice(_);
2966
- break;
2967
- } else {
2968
- let g2 = e18.slice(_, b);
2969
- h.push(g2), _ = b + 1, e18[_ - 1] === "\r" && e18[_] === "\n" && _++;
2970
- }
2971
- }
2972
- return [h, g];
3050
+ function isDataPrefix(e18, h, g) {
3051
+ return g === 100 && e18.charCodeAt(h + 1) === 97 && e18.charCodeAt(h + 2) === 116 && e18.charCodeAt(h + 3) === 97 && e18.charCodeAt(h + 4) === 58;
3052
+ }
3053
+ function isEventPrefix(e18, h, g) {
3054
+ return g === 101 && e18.charCodeAt(h + 1) === 118 && e18.charCodeAt(h + 2) === 101 && e18.charCodeAt(h + 3) === 110 && e18.charCodeAt(h + 4) === 116 && e18.charCodeAt(h + 5) === 58;
2973
3055
  }
2974
3056
  var EventSourceParserStream = class extends TransformStream {
2975
3057
  constructor({ onError: e18, onRetry: h, onComment: g } = {}) {
@@ -5291,6 +5373,12 @@ async function consumeStream({ stream: e18, onError: h }) {
5291
5373
  createIdGenerator({
5292
5374
  prefix: "aitxt",
5293
5375
  size: 24
5376
+ }), createIdGenerator({
5377
+ prefix: "call",
5378
+ size: 24
5379
+ }), createIdGenerator({
5380
+ prefix: "call",
5381
+ size: 24
5294
5382
  }), createIdGenerator({
5295
5383
  prefix: "aiobj",
5296
5384
  size: 24
@@ -6334,10 +6422,10 @@ async function convertToFileUIPart(e18) {
6334
6422
  url: await blobToString(e19, "dataUrl")
6335
6423
  })));
6336
6424
  }
6337
- var import_compiler_runtime$4 = require_compiler_runtime();
6425
+ var import_compiler_runtime$9 = require_compiler_runtime();
6338
6426
  const AttachmentRenderer = (e18) => {
6339
6427
  var _a;
6340
- let h = (0, import_compiler_runtime$4.c)(6), { attachment: g } = e18;
6428
+ let h = (0, import_compiler_runtime$9.c)(6), { attachment: g } = e18;
6341
6429
  if ((_a = g.mediaType) == null ? void 0 : _a.startsWith("image/")) {
6342
6430
  let e19 = g.filename || "Attachment", _2;
6343
6431
  return h[0] !== g.url || h[1] !== e19 ? (_2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
@@ -6353,28 +6441,66 @@ const AttachmentRenderer = (e18) => {
6353
6441
  className: "flex flex-row gap-1 items-center text-xs",
6354
6442
  children: [_, v]
6355
6443
  }), h[4] = v, h[5] = y), y;
6444
+ }, SourceChip = (e18) => {
6445
+ let h = (0, import_compiler_runtime$9.c)(15), { icon: g, title: _, subtitle: v, href: y } = e18, b;
6446
+ h[0] === _ ? b = h[1] : (b = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6447
+ className: "truncate font-medium",
6448
+ children: _
6449
+ }), h[0] = _, h[1] = b);
6450
+ let x;
6451
+ h[2] === v ? x = h[3] : (x = v && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
6452
+ className: "truncate opacity-70",
6453
+ children: [
6454
+ "(",
6455
+ v,
6456
+ ")"
6457
+ ]
6458
+ }), h[2] = v, h[3] = x);
6459
+ let S;
6460
+ h[4] !== g || h[5] !== b || h[6] !== x ? (S = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
6461
+ g,
6462
+ b,
6463
+ x
6464
+ ] }), h[4] = g, h[5] = b, h[6] = x, h[7] = S) : S = h[7];
6465
+ let C = S;
6466
+ if (y && isUrl(y)) {
6467
+ let e19 = v ?? _, g2;
6468
+ return h[8] !== C || h[9] !== y || h[10] !== e19 ? (g2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
6469
+ href: y,
6470
+ target: "_blank",
6471
+ rel: "noopener noreferrer",
6472
+ title: e19,
6473
+ className: "inline-flex max-w-full items-center gap-1.5 rounded-md border bg-muted/50 px-2 py-1 my-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",
6474
+ children: C
6475
+ }), h[8] = C, h[9] = y, h[10] = e19, h[11] = g2) : g2 = h[11], g2;
6476
+ }
6477
+ let w = v ?? _, T;
6478
+ return h[12] !== C || h[13] !== w ? (T = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6479
+ className: "inline-flex max-w-full items-center gap-1.5 rounded-md border bg-muted/50 px-2 py-1 my-1 text-xs text-muted-foreground",
6480
+ title: w,
6481
+ children: C
6482
+ }), h[12] = C, h[13] = w, h[14] = T) : T = h[14], T;
6356
6483
  };
6357
- var import_compiler_runtime$3 = require_compiler_runtime();
6484
+ var import_compiler_runtime$8 = require_compiler_runtime();
6358
6485
  const ReasoningAccordion = (e18) => {
6359
- let h = (0, import_compiler_runtime$3.c)(13), { reasoning: g, index: _, isStreaming: v } = e18, y = _ === void 0 ? 0 : _, b = v === void 0 ? false : v, x = b ? "reasoning" : void 0, S;
6360
- h[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BotMessageSquare, { className: "h-3 w-3" }), h[0] = S) : S = h[0];
6361
- let C = b ? "Thinking" : "View reasoning", T;
6362
- h[1] !== g.length || h[2] !== C ? (T = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
6486
+ let h = (0, import_compiler_runtime$8.c)(13), { reasoning: g, index: _, isStreaming: v } = e18, y = _ === void 0 ? 0 : _, b = v === void 0 ? false : v, [x, S] = import_react.useState("");
6487
+ if (!g && !b) return null;
6488
+ let C = b ? "reasoning" : x, T;
6489
+ h[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BotMessageSquare, { className: "h-3 w-3" }), h[0] = T) : T = h[0];
6490
+ let E = b ? "Thinking" : "View reasoning", D = g.length > 0 && ` (${g.length} chars)`, O;
6491
+ h[1] !== E || h[2] !== D ? (O = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
6363
6492
  className: "text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",
6364
6493
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
6365
6494
  className: "flex items-center gap-2",
6366
6495
  children: [
6367
- S,
6368
- C,
6369
- " (",
6370
- g.length,
6371
- " ",
6372
- "chars)"
6496
+ T,
6497
+ E,
6498
+ D
6373
6499
  ]
6374
6500
  })
6375
- }), h[1] = g.length, h[2] = C, h[3] = T) : T = h[3];
6376
- let E;
6377
- h[4] === g ? E = h[5] : (E = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
6501
+ }), h[1] = E, h[2] = D, h[3] = O) : O = h[3];
6502
+ let k;
6503
+ h[4] === g ? k = h[5] : (k = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
6378
6504
  className: "pb-2 px-2",
6379
6505
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6380
6506
  className: "bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",
@@ -6383,31 +6509,194 @@ const ReasoningAccordion = (e18) => {
6383
6509
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownRenderer, { content: g })
6384
6510
  })
6385
6511
  })
6386
- }), h[4] = g, h[5] = E);
6387
- let D;
6388
- h[6] !== T || h[7] !== E ? (D = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
6512
+ }), h[4] = g, h[5] = k);
6513
+ let A;
6514
+ h[6] !== O || h[7] !== k ? (A = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
6389
6515
  value: "reasoning",
6390
6516
  className: "border-0",
6391
- children: [T, E]
6392
- }), h[6] = T, h[7] = E, h[8] = D) : D = h[8];
6393
- let O;
6394
- return h[9] !== y || h[10] !== x || h[11] !== D ? (O = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
6517
+ children: [O, k]
6518
+ }), h[6] = O, h[7] = k, h[8] = A) : A = h[8];
6519
+ let j;
6520
+ return h[9] !== y || h[10] !== C || h[11] !== A ? (j = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
6395
6521
  type: "single",
6396
6522
  collapsible: true,
6397
6523
  className: "w-full mb-2",
6398
- value: x,
6399
- children: D
6400
- }, y), h[9] = y, h[10] = x, h[11] = D, h[12] = O) : O = h[12], O;
6524
+ value: C,
6525
+ onValueChange: S,
6526
+ children: A
6527
+ }, y), h[9] = y, h[10] = C, h[11] = A, h[12] = j) : j = h[12], j;
6528
+ };
6529
+ function formatToolName(e18) {
6530
+ return e18.replace("tool-", "");
6531
+ }
6532
+ var import_compiler_runtime$7 = require_compiler_runtime();
6533
+ const ToolArgsRenderer = (e18) => {
6534
+ let h = (0, import_compiler_runtime$7.c)(9), { input: g, label: _ } = e18, v = _ === void 0 ? "Tool Request" : _;
6535
+ if (g == null) return null;
6536
+ let y;
6537
+ h[0] === v ? y = h[1] : (y = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
6538
+ className: "text-xs font-semibold text-muted-foreground",
6539
+ children: v
6540
+ }), h[0] = v, h[1] = y);
6541
+ let b;
6542
+ h[2] === g ? b = h[3] : (b = JSON.stringify(g, null, 2), h[2] = g, h[3] = b);
6543
+ let x;
6544
+ h[4] === b ? x = h[5] : (x = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
6545
+ className: "bg-(--slate-2) p-2 text-muted-foreground border border-(--slate-4) rounded text-xs overflow-auto scrollbar-thin max-h-64",
6546
+ children: b
6547
+ }), h[4] = b, h[5] = x);
6548
+ let S;
6549
+ return h[6] !== y || h[7] !== x ? (S = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6550
+ className: "space-y-2",
6551
+ children: [y, x]
6552
+ }), h[6] = y, h[7] = x, h[8] = S) : S = h[8], S;
6553
+ };
6554
+ var import_compiler_runtime$6 = require_compiler_runtime();
6555
+ const ToolApprovalCard = (e18) => {
6556
+ let h = (0, import_compiler_runtime$6.c)(25), { toolName: g, input: _, approval: y, onApprove: x, className: S } = e18, C;
6557
+ h[0] === S ? C = h[1] : (C = cn("rounded-md border border-(--amber-6) bg-(--amber-2) p-3 space-y-3", S), h[0] = S, h[1] = C);
6558
+ let w = `Approval required for ${formatToolName(g)}`, T;
6559
+ h[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShieldQuestionMark, { className: "h-4 w-4 text-(--amber-11) mt-0.5 shrink-0" }), h[2] = T) : T = h[2];
6560
+ let E;
6561
+ h[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6562
+ className: "font-semibold",
6563
+ children: "Approval required:"
6564
+ }), h[3] = E) : E = h[3];
6565
+ let D;
6566
+ h[4] === g ? D = h[5] : (D = formatToolName(g), h[4] = g, h[5] = D);
6567
+ let O;
6568
+ h[6] === D ? O = h[7] : (O = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6569
+ className: "flex items-start gap-2",
6570
+ children: [T, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6571
+ className: "text-xs text-(--amber-11) leading-relaxed",
6572
+ children: [
6573
+ E,
6574
+ " ",
6575
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
6576
+ className: "font-mono",
6577
+ children: D
6578
+ })
6579
+ ]
6580
+ })]
6581
+ }), h[6] = D, h[7] = O);
6582
+ let k;
6583
+ h[8] === _ ? k = h[9] : (k = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: _ }), h[8] = _, h[9] = k);
6584
+ let A;
6585
+ h[10] !== y.id || h[11] !== x ? (A = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
6586
+ size: "xs",
6587
+ variant: "outline",
6588
+ onClick: () => x({
6589
+ id: y.id,
6590
+ approved: false
6591
+ }),
6592
+ children: "Deny"
6593
+ }), h[10] = y.id, h[11] = x, h[12] = A) : A = h[12];
6594
+ let j;
6595
+ h[13] !== y.id || h[14] !== x ? (j = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
6596
+ size: "xs",
6597
+ onClick: () => x({
6598
+ id: y.id,
6599
+ approved: true
6600
+ }),
6601
+ children: "Approve"
6602
+ }), h[13] = y.id, h[14] = x, h[15] = j) : j = h[15];
6603
+ let M;
6604
+ h[16] !== A || h[17] !== j ? (M = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6605
+ className: "flex items-center justify-end gap-2",
6606
+ children: [A, j]
6607
+ }), h[16] = A, h[17] = j, h[18] = M) : M = h[18];
6608
+ let N;
6609
+ return h[19] !== C || h[20] !== M || h[21] !== w || h[22] !== O || h[23] !== k ? (N = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6610
+ className: C,
6611
+ role: "alertdialog",
6612
+ "aria-label": w,
6613
+ children: [
6614
+ O,
6615
+ k,
6616
+ M
6617
+ ]
6618
+ }), h[19] = C, h[20] = M, h[21] = w, h[22] = O, h[23] = k, h[24] = N) : N = h[24], N;
6619
+ };
6620
+ var import_compiler_runtime$5 = require_compiler_runtime();
6621
+ const ToolErrorCard = (e18) => {
6622
+ let h = (0, import_compiler_runtime$5.c)(28), { toolName: g, input: _, errorText: y, isLive: b, className: x } = e18, [S, C] = import_react.useState(b), w = import_react.useRef(b), T, E;
6623
+ h[0] === b ? (T = h[1], E = h[2]) : (T = () => {
6624
+ w.current && !b && C(false), w.current = b;
6625
+ }, E = [b], h[0] = b, h[1] = T, h[2] = E), import_react.useEffect(T, E);
6626
+ let D;
6627
+ h[3] === x ? D = h[4] : (D = cn("rounded-md border border-(--red-6) bg-(--red-2)", x), h[3] = x, h[4] = D);
6628
+ let O;
6629
+ h[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (O = () => C(_temp$2), h[5] = O) : O = h[5];
6630
+ let k;
6631
+ h[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleX, { className: "h-3.5 w-3.5 shrink-0" }), h[6] = k) : k = h[6];
6632
+ let A;
6633
+ h[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (A = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6634
+ className: "font-semibold",
6635
+ children: "Failed:"
6636
+ }), h[7] = A) : A = h[7];
6637
+ let j;
6638
+ h[8] === g ? j = h[9] : (j = formatToolName(g), h[8] = g, h[9] = j);
6639
+ let M;
6640
+ h[10] === j ? M = h[11] : (M = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
6641
+ className: "flex-1 text-left",
6642
+ children: [
6643
+ A,
6644
+ " ",
6645
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
6646
+ className: "font-mono",
6647
+ children: j
6648
+ })
6649
+ ]
6650
+ }), h[10] = j, h[11] = M);
6651
+ let N = S && "rotate-180", P;
6652
+ h[12] === N ? P = h[13] : (P = cn("h-3.5 w-3.5 shrink-0 transition-transform", N), h[12] = N, h[13] = P);
6653
+ let F;
6654
+ h[14] === P ? F = h[15] : (F = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: P }), h[14] = P, h[15] = F);
6655
+ let I;
6656
+ h[16] !== S || h[17] !== F || h[18] !== M ? (I = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
6657
+ type: "button",
6658
+ onClick: O,
6659
+ className: "w-full flex items-center gap-2 px-3 py-2 text-xs text-(--red-11) hover:bg-(--red-3) rounded-md transition-colors",
6660
+ "aria-expanded": S,
6661
+ children: [
6662
+ k,
6663
+ M,
6664
+ F
6665
+ ]
6666
+ }), h[16] = S, h[17] = F, h[18] = M, h[19] = I) : I = h[19];
6667
+ let L;
6668
+ h[20] !== y || h[21] !== _ || h[22] !== S ? (L = S && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6669
+ className: "px-3 pb-3 space-y-3 border-t border-(--red-6)/40 pt-3",
6670
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: _ }), y && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
6671
+ className: "text-xs font-semibold text-(--red-11) mb-1",
6672
+ children: "Error"
6673
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
6674
+ className: "bg-(--red-2) border border-(--red-6) rounded p-2 text-xs text-(--red-11) leading-relaxed overflow-auto scrollbar-thin max-h-64 whitespace-pre-wrap",
6675
+ children: y
6676
+ })] })]
6677
+ }), h[20] = y, h[21] = _, h[22] = S, h[23] = L) : L = h[23];
6678
+ let R;
6679
+ return h[24] !== I || h[25] !== L || h[26] !== D ? (R = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6680
+ className: D,
6681
+ children: [I, L]
6682
+ }), h[24] = I, h[25] = L, h[26] = D, h[27] = R) : R = h[27], R;
6401
6683
  };
6402
- var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema = object$1({
6684
+ function _temp$2(e18) {
6685
+ return !e18;
6686
+ }
6687
+ var import_compiler_runtime$4 = require_compiler_runtime();
6688
+ function isUninformative(e18) {
6689
+ return e18 == null ? true : typeof e18 == "object" ? isEmpty_default(e18) : false;
6690
+ }
6691
+ var SuccessResultSchema = looseObject({
6403
6692
  status: string().default("success"),
6404
6693
  auth_required: boolean().default(false),
6405
6694
  action_url: any(),
6406
6695
  next_steps: any(),
6407
6696
  meta: any(),
6408
6697
  message: string().nullish()
6409
- }).passthrough(), PrettySuccessResult = (e18) => {
6410
- let h = (0, import_compiler_runtime$2.c)(12), { data: g } = e18, _;
6698
+ }), PrettySuccessResult = (e18) => {
6699
+ let h = (0, import_compiler_runtime$4.c)(12), { data: g } = e18, _;
6411
6700
  if (h[0] !== g) {
6412
6701
  let { status: e19, auth_required: v, action_url: y, meta: b, next_steps: x, message: S, ...C } = g, w;
6413
6702
  h[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
@@ -6416,12 +6705,12 @@ var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema
6416
6705
  }), h[2] = w) : w = h[2];
6417
6706
  let T;
6418
6707
  h[3] === e19 ? T = h[4] : (T = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6419
- className: "text-xs px-2 py-0.5 bg-[var(--grass-2)] text-[var(--grass-11)] rounded-full font-medium capitalize",
6708
+ className: "text-xs px-2 py-0.5 bg-(--grass-2) text-(--grass-11) rounded-full font-medium capitalize",
6420
6709
  children: e19
6421
6710
  }), h[3] = e19, h[4] = T);
6422
6711
  let E;
6423
6712
  h[5] === v ? E = h[6] : (E = v && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6424
- className: "text-xs px-2 py-0.5 bg-[var(--amber-2)] text-[var(--amber-11)] rounded-full",
6713
+ className: "text-xs px-2 py-0.5 bg-(--amber-2) text-(--amber-11) rounded-full",
6425
6714
  children: "Auth Required"
6426
6715
  }), h[5] = v, h[6] = E);
6427
6716
  let D;
@@ -6435,7 +6724,7 @@ var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema
6435
6724
  let O;
6436
6725
  h[10] === S ? O = h[11] : (O = S && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6437
6726
  className: "flex items-start gap-2",
6438
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "h-3 w-3 text-[var(--blue-11)] mt-0.5 flex-shrink-0" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6727
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "h-3 w-3 text-(--blue-11) mt-0.5 shrink-0" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6439
6728
  className: "text-xs text-foreground",
6440
6729
  children: S
6441
6730
  })]
@@ -6452,8 +6741,9 @@ var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema
6452
6741
  }), h[0] = g, h[1] = _;
6453
6742
  } else _ = h[1];
6454
6743
  return _;
6455
- }, ResultRenderer = (e18) => {
6456
- let h = (0, import_compiler_runtime$2.c)(8), { result: g } = e18, _;
6744
+ };
6745
+ const ResultRenderer = (e18) => {
6746
+ let h = (0, import_compiler_runtime$4.c)(8), { result: g } = e18, _;
6457
6747
  h[0] === g ? _ = h[1] : (_ = SuccessResultSchema.safeParse(g), h[0] = g, h[1] = _);
6458
6748
  let v = _;
6459
6749
  if (v.success) {
@@ -6467,160 +6757,262 @@ var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema
6467
6757
  className: "text-xs font-medium text-muted-foreground mb-1 max-h-64 overflow-y-auto scrollbar-thin",
6468
6758
  children: y
6469
6759
  }), h[6] = y, h[7] = b), b;
6470
- }, ToolArgsRenderer = (e18) => {
6471
- let h = (0, import_compiler_runtime$2.c)(9), { input: g } = e18;
6472
- if (!(g && g !== null)) return null;
6473
- let _;
6474
- h[0] === g ? _ = h[1] : (_ = isEmpty_default(g), h[0] = g, h[1] = _);
6475
- let v = _, y = typeof g == "object" && !Array.isArray(g) && Object.keys(g).length > 0, b;
6476
- h[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
6477
- className: "text-xs font-semibold text-muted-foreground",
6478
- children: "Tool Request"
6479
- }), h[2] = b) : b = h[2];
6480
- let x;
6481
- h[3] !== g || h[4] !== v || h[5] !== y ? (x = v ? "{}" : y ? JSON.stringify(g, null, 2) : String(g), h[3] = g, h[4] = v, h[5] = y, h[6] = x) : x = h[6];
6482
- let S;
6483
- return h[7] === x ? S = h[8] : (S = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6484
- className: "space-y-2",
6485
- children: [b, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
6486
- className: "bg-[var(--slate-2)] p-2 text-muted-foreground border border-[var(--slate-4)] rounded text-xs overflow-auto scrollbar-thin max-h-64",
6487
- children: x
6488
- })]
6489
- }), h[7] = x, h[8] = S), S;
6490
6760
  };
6491
- const ToolCallAccordion = (e18) => {
6492
- let h = (0, import_compiler_runtime$2.c)(38), { toolName: g, result: _, error: y, index: b, state: x, className: S, input: C } = e18, T = b === void 0 ? 0 : b, E = x === "output-available" && (_ || y), D = y ? "error" : E ? "success" : "loading", O;
6493
- h[0] === D ? O = h[1] : (O = () => {
6494
- switch (D) {
6495
- case "loading":
6496
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "h-3 w-3 animate-spin" });
6497
- case "error":
6498
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleX, { className: "h-3 w-3 text-[var(--red-11)]" });
6499
- case "success":
6500
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleCheckBig, { className: "h-3 w-3 text-[var(--grass-11)]" });
6501
- default:
6502
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Wrench, { className: "h-3 w-3" });
6761
+ function _temp$1(e18) {
6762
+ let [h, g] = e18;
6763
+ return isUninformative(g) ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6764
+ className: "space-y-1.5",
6765
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6766
+ className: "text-xs text-muted-foreground",
6767
+ children: h
6768
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
6769
+ className: "bg-(--slate-2) p-2 text-muted-foreground border border-(--slate-4) rounded text-xs overflow-auto scrollbar-thin max-h-64",
6770
+ children: JSON.stringify(g, null, 2)
6771
+ })]
6772
+ }, h);
6773
+ }
6774
+ var import_compiler_runtime$3 = require_compiler_runtime(), STATUS_LABEL = {
6775
+ "input-streaming": "Generating",
6776
+ "input-available": "Running",
6777
+ "approval-responded": "Awaiting result",
6778
+ "output-available": "Done",
6779
+ "output-denied": "Denied"
6780
+ }, StatusIcon = (e18) => {
6781
+ let h = (0, import_compiler_runtime$3.c)(4), { state: g } = e18;
6782
+ switch (g) {
6783
+ case "input-streaming":
6784
+ case "input-available":
6785
+ case "approval-responded": {
6786
+ let e19;
6787
+ return h[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "h-3 w-3 animate-spin" }), h[0] = e19) : e19 = h[0], e19;
6503
6788
  }
6504
- }, h[0] = D, h[1] = O);
6505
- let k = O, A;
6506
- h[2] !== y || h[3] !== E || h[4] !== D ? (A = () => D === "loading" ? "Running" : y ? "Failed" : E ? "Done" : "Tool call", h[2] = y, h[3] = E, h[4] = D, h[5] = A) : A = h[5];
6507
- let j = A, M = `tool-${T}`, N;
6508
- h[6] === S ? N = h[7] : (N = cn("w-full", S), h[6] = S, h[7] = N);
6509
- let P = D === "error" && "text-[var(--red-11)]/80", F = D === "success" && "text-[var(--grass-11)]/80", B;
6510
- h[8] !== P || h[9] !== F ? (B = cn("h-6 text-xs border-border shadow-none! ring-0! bg-muted/60 hover:bg-muted py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180 hover:no-underline", P, F), h[8] = P, h[9] = F, h[10] = B) : B = h[10];
6511
- let V;
6512
- h[11] === k ? V = h[12] : (V = k(), h[11] = k, h[12] = V);
6513
- let H = j(), U;
6514
- h[13] === g ? U = h[14] : (U = formatToolName(g), h[13] = g, h[14] = U);
6515
- let W;
6516
- h[15] === U ? W = h[16] : (W = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
6789
+ case "output-available": {
6790
+ let e19;
6791
+ return h[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleCheckBig, { className: "h-3 w-3 text-(--grass-11)" }), h[1] = e19) : e19 = h[1], e19;
6792
+ }
6793
+ case "output-denied": {
6794
+ let e19;
6795
+ return h[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ban, { className: "h-3 w-3 text-muted-foreground" }), h[2] = e19) : e19 = h[2], e19;
6796
+ }
6797
+ default: {
6798
+ logNever(g);
6799
+ let e19;
6800
+ return h[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Wrench, { className: "h-3 w-3" }), h[3] = e19) : e19 = h[3], e19;
6801
+ }
6802
+ }
6803
+ };
6804
+ function getTriggerToneClass(e18) {
6805
+ switch (e18) {
6806
+ case "output-available":
6807
+ return "text-(--grass-11)/80";
6808
+ case "output-denied":
6809
+ return "text-muted-foreground";
6810
+ case "input-streaming":
6811
+ case "input-available":
6812
+ case "approval-responded":
6813
+ return "";
6814
+ default:
6815
+ return logNever(e18), "";
6816
+ }
6817
+ }
6818
+ const ToolHistoryRow = (e18) => {
6819
+ let h = (0, import_compiler_runtime$3.c)(29), { toolName: g, state: _, input: y, result: b, approval: x, index: S, className: C } = e18, T = `tool-${S === void 0 ? 0 : S}`, E;
6820
+ h[0] === C ? E = h[1] : (E = cn("w-full", C), h[0] = C, h[1] = E);
6821
+ let D;
6822
+ h[2] === _ ? D = h[3] : (D = cn("h-6 text-xs border-border shadow-none! ring-0! bg-muted/60 hover:bg-muted py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180 hover:no-underline", getTriggerToneClass(_)), h[2] = _, h[3] = D);
6823
+ let O;
6824
+ h[4] === _ ? O = h[5] : (O = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusIcon, { state: _ }), h[4] = _, h[5] = O);
6825
+ let k = STATUS_LABEL[_], A;
6826
+ h[6] === g ? A = h[7] : (A = formatToolName(g), h[6] = g, h[7] = A);
6827
+ let j;
6828
+ h[8] === A ? j = h[9] : (j = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
6517
6829
  className: "font-mono text-xs",
6518
- children: U
6519
- }), h[15] = U, h[16] = W);
6520
- let G;
6521
- h[17] !== H || h[18] !== W || h[19] !== V ? (G = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
6830
+ children: A
6831
+ }), h[8] = A, h[9] = j);
6832
+ let M;
6833
+ h[10] !== O || h[11] !== k || h[12] !== j ? (M = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
6522
6834
  className: "flex items-center gap-1",
6523
6835
  children: [
6524
- V,
6525
- H,
6836
+ O,
6837
+ k,
6526
6838
  ":",
6527
- W
6528
- ]
6529
- }), h[17] = H, h[18] = W, h[19] = V, h[20] = G) : G = h[20];
6530
- let K;
6531
- h[21] !== G || h[22] !== B ? (K = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
6532
- className: B,
6533
- children: G
6534
- }), h[21] = G, h[22] = B, h[23] = K) : K = h[23];
6535
- let q;
6536
- h[24] !== y || h[25] !== E || h[26] !== C || h[27] !== _ ? (q = E && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6537
- className: "space-y-3",
6538
- children: [
6539
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: C }),
6540
- _ != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResultRenderer, { result: _ }),
6541
- y && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6542
- className: "bg-[var(--red-2)] border border-[var(--red-6)] rounded-lg p-3",
6543
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6544
- className: "text-xs font-semibold text-[var(--red-11)] mb-2 flex items-center gap-2",
6545
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "w-1.5 h-1.5 bg-[var(--red-9)] rounded-full" }), "Error"]
6546
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6547
- className: "text-sm text-[var(--red-11)] leading-relaxed",
6548
- children: y
6549
- })]
6550
- })
6839
+ j
6551
6840
  ]
6552
- }), h[24] = y, h[25] = E, h[26] = C, h[27] = _, h[28] = q) : q = h[28];
6553
- let J;
6554
- h[29] === q ? J = h[30] : (J = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
6841
+ }), h[10] = O, h[11] = k, h[12] = j, h[13] = M) : M = h[13];
6842
+ let N;
6843
+ h[14] !== D || h[15] !== M ? (N = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
6844
+ className: D,
6845
+ children: M
6846
+ }), h[14] = D, h[15] = M, h[16] = N) : N = h[16];
6847
+ let P;
6848
+ h[17] !== x || h[18] !== y || h[19] !== b || h[20] !== _ ? (P = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
6555
6849
  className: "py-2 px-2",
6556
- children: q
6557
- }), h[29] = q, h[30] = J);
6558
- let Y;
6559
- h[31] !== K || h[32] !== J ? (Y = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
6850
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HistoryContent, {
6851
+ state: _,
6852
+ input: y,
6853
+ result: b,
6854
+ approval: x
6855
+ })
6856
+ }), h[17] = x, h[18] = y, h[19] = b, h[20] = _, h[21] = P) : P = h[21];
6857
+ let F;
6858
+ h[22] !== N || h[23] !== P ? (F = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
6560
6859
  value: "tool-call",
6561
6860
  className: "border-0",
6562
- children: [K, J]
6563
- }), h[31] = K, h[32] = J, h[33] = Y) : Y = h[33];
6564
- let Z;
6565
- return h[34] !== Y || h[35] !== M || h[36] !== N ? (Z = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
6861
+ children: [N, P]
6862
+ }), h[22] = N, h[23] = P, h[24] = F) : F = h[24];
6863
+ let I;
6864
+ return h[25] !== F || h[26] !== T || h[27] !== E ? (I = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
6566
6865
  type: "single",
6567
6866
  collapsible: true,
6568
- className: N,
6569
- children: Y
6570
- }, M), h[34] = Y, h[35] = M, h[36] = N, h[37] = Z) : Z = h[37], Z;
6867
+ className: E,
6868
+ children: F
6869
+ }, T), h[25] = F, h[26] = T, h[27] = E, h[28] = I) : I = h[28], I;
6571
6870
  };
6572
- function formatToolName(e18) {
6573
- return e18.replace("tool-", "");
6574
- }
6575
- function _temp$1(e18) {
6576
- let [h, g] = e18;
6577
- return isEmpty_default(g) ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6578
- className: "space-y-1.5",
6579
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6580
- className: "text-xs font-medium text-muted-foreground capitalize flex items-center gap-2",
6581
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "w-1.5 h-1.5 bg-[var(--blue-9)] rounded-full" }), h]
6582
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
6583
- className: "bg-[var(--slate-2)] p-2 text-muted-foreground border border-[var(--slate-4)] rounded text-xs overflow-auto scrollbar-thin max-h-64",
6584
- children: JSON.stringify(g, null, 2)
6585
- })]
6586
- }, h);
6587
- }
6588
- const renderUIMessage = ({ message: e18, isStreamingReasoning: h, isLast: _ }) => {
6589
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: e18.parts.map((e19, h2) => v(e19, h2)) });
6590
- function v(v2, y) {
6591
- if (isToolPart(v2)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallAccordion, {
6592
- index: y,
6593
- toolName: v2.type,
6594
- result: v2.output,
6871
+ var HistoryContent = (e18) => {
6872
+ let h = (0, import_compiler_runtime$3.c)(16), { state: g, input: _, result: v, approval: y } = e18;
6873
+ switch (g) {
6874
+ case "input-streaming":
6875
+ case "input-available":
6876
+ case "approval-responded": {
6877
+ let e19;
6878
+ return h[0] === _ ? e19 = h[1] : (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: _ }), h[0] = _, h[1] = e19), e19;
6879
+ }
6880
+ case "output-available": {
6881
+ let e19;
6882
+ h[2] === _ ? e19 = h[3] : (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: _ }), h[2] = _, h[3] = e19);
6883
+ let g2;
6884
+ h[4] === v ? g2 = h[5] : (g2 = v != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResultRenderer, { result: v }), h[4] = v, h[5] = g2);
6885
+ let y2;
6886
+ return h[6] !== e19 || h[7] !== g2 ? (y2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6887
+ className: "space-y-3",
6888
+ children: [e19, g2]
6889
+ }), h[6] = e19, h[7] = g2, h[8] = y2) : y2 = h[8], y2;
6890
+ }
6891
+ case "output-denied": {
6892
+ let e19;
6893
+ h[9] === _ ? e19 = h[10] : (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: _ }), h[9] = _, h[10] = e19);
6894
+ let g2 = (y == null ? void 0 : y.reason) ? `: ${y.reason}` : ".", v2;
6895
+ h[11] === g2 ? v2 = h[12] : (v2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6896
+ className: "bg-muted/40 border border-border rounded-md p-3 text-xs text-muted-foreground leading-relaxed",
6897
+ children: ["Tool execution was denied", g2]
6898
+ }), h[11] = g2, h[12] = v2);
6899
+ let b;
6900
+ return h[13] !== e19 || h[14] !== v2 ? (b = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6901
+ className: "space-y-3",
6902
+ children: [e19, v2]
6903
+ }), h[13] = e19, h[14] = v2, h[15] = b) : b = h[15], b;
6904
+ }
6905
+ default:
6906
+ return logNever(g), null;
6907
+ }
6908
+ }, import_compiler_runtime$2 = require_compiler_runtime();
6909
+ const ToolCallView = (e18) => {
6910
+ let h = (0, import_compiler_runtime$2.c)(25), { toolName: g, state: _, result: v, errorText: y, input: b, approval: x, onApprove: S, index: C, className: w, isLive: T } = e18, E = T === void 0 ? true : T;
6911
+ switch (_) {
6912
+ case "approval-requested": {
6913
+ if (x != null && S != null) {
6914
+ let e20;
6915
+ return h[0] !== x || h[1] !== w || h[2] !== b || h[3] !== S || h[4] !== g ? (e20 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolApprovalCard, {
6916
+ toolName: g,
6917
+ input: b,
6918
+ approval: x,
6919
+ onApprove: S,
6920
+ className: w
6921
+ }), h[0] = x, h[1] = w, h[2] = b, h[3] = S, h[4] = g, h[5] = e20) : e20 = h[5], e20;
6922
+ }
6923
+ let e19;
6924
+ return h[6] !== w || h[7] !== C || h[8] !== b || h[9] !== g ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolHistoryRow, {
6925
+ toolName: g,
6926
+ state: "input-available",
6927
+ input: b,
6928
+ index: C,
6929
+ className: w
6930
+ }), h[6] = w, h[7] = C, h[8] = b, h[9] = g, h[10] = e19) : e19 = h[10], e19;
6931
+ }
6932
+ case "output-error": {
6933
+ let e19;
6934
+ return h[11] !== w || h[12] !== y || h[13] !== b || h[14] !== E || h[15] !== g ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolErrorCard, {
6935
+ toolName: g,
6936
+ input: b,
6937
+ errorText: y,
6938
+ isLive: E,
6939
+ className: w
6940
+ }), h[11] = w, h[12] = y, h[13] = b, h[14] = E, h[15] = g, h[16] = e19) : e19 = h[16], e19;
6941
+ }
6942
+ case "input-streaming":
6943
+ case "input-available":
6944
+ case "approval-responded":
6945
+ case "output-available":
6946
+ case "output-denied": {
6947
+ let e19;
6948
+ return h[17] !== x || h[18] !== w || h[19] !== C || h[20] !== b || h[21] !== v || h[22] !== _ || h[23] !== g ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolHistoryRow, {
6949
+ toolName: g,
6950
+ state: _,
6951
+ input: b,
6952
+ result: v,
6953
+ approval: x,
6954
+ index: C,
6955
+ className: w
6956
+ }), h[17] = x, h[18] = w, h[19] = C, h[20] = b, h[21] = v, h[22] = _, h[23] = g, h[24] = e19) : e19 = h[24], e19;
6957
+ }
6958
+ default:
6959
+ return logNever(_), null;
6960
+ }
6961
+ }, renderUIMessage = ({ message: e18, isStreamingReasoning: h, isLast: _, addToolApprovalResponse: v }) => {
6962
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: e18.parts.map((e19, h2) => y(e19, h2)) });
6963
+ function y(y2, b) {
6964
+ if (isToolPart(y2)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallView, {
6965
+ index: b,
6966
+ toolName: y2.type,
6967
+ result: y2.output,
6968
+ errorText: y2.state === "output-error" ? y2.errorText : void 0,
6595
6969
  className: "my-2",
6596
- state: v2.state,
6597
- input: v2.input
6598
- }, y);
6599
- if (isDataPart(v2)) return Logger.debug("Found data part", v2), null;
6600
- switch (v2.type) {
6970
+ state: y2.state,
6971
+ input: y2.input,
6972
+ approval: y2.approval,
6973
+ onApprove: v,
6974
+ isLive: _
6975
+ }, b);
6976
+ if (isDataPart(y2)) return Logger.debug("Found data part", y2), null;
6977
+ switch (y2.type) {
6601
6978
  case "text":
6602
- return v2.text.includes("<marimo-") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: renderHTML({ html: v2.text }) }, y) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownRenderer, { content: v2.text }, y);
6979
+ return y2.text.includes("<marimo-") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: renderHTML({ html: y2.text }) }, b) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownRenderer, { content: y2.text }, b);
6603
6980
  case "reasoning":
6604
6981
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReasoningAccordion, {
6605
- reasoning: v2.text,
6606
- index: y,
6607
- isStreaming: h && _ && y === (e18.parts.length || 0) - 1
6608
- }, y);
6982
+ reasoning: y2.text,
6983
+ index: b,
6984
+ isStreaming: h && _ && b === (e18.parts.length || 0) - 1
6985
+ }, b);
6609
6986
  case "file":
6610
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AttachmentRenderer, { attachment: v2 }, y);
6987
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AttachmentRenderer, { attachment: y2 }, b);
6611
6988
  case "dynamic-tool":
6612
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallAccordion, {
6613
- toolName: v2.toolName,
6614
- result: v2.output,
6615
- state: v2.state,
6616
- input: v2.input
6617
- }, y);
6989
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallView, {
6990
+ toolName: y2.toolName,
6991
+ result: y2.output,
6992
+ errorText: y2.state === "output-error" ? y2.errorText : void 0,
6993
+ state: y2.state,
6994
+ input: y2.input,
6995
+ approval: y2.approval,
6996
+ onApprove: v,
6997
+ isLive: _
6998
+ }, b);
6618
6999
  case "source-document":
7000
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SourceChip, {
7001
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FileText, { className: "h-3 w-3 shrink-0" }),
7002
+ title: y2.title,
7003
+ subtitle: y2.filename
7004
+ }, b);
6619
7005
  case "source-url":
7006
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SourceChip, {
7007
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExternalLink, { className: "h-3 w-3 shrink-0" }),
7008
+ title: y2.title ?? y2.url,
7009
+ subtitle: y2.title ? y2.url : void 0,
7010
+ href: y2.url
7011
+ }, b);
6620
7012
  case "step-start":
6621
- return Logger.debug("Found non-renderable part", v2), null;
7013
+ return null;
6622
7014
  default:
6623
- return logNever(v2), null;
7015
+ return logNever(y2), null;
6624
7016
  }
6625
7017
  }
6626
7018
  };
@@ -7171,7 +7563,7 @@ const Chatbot = (e18) => {
7171
7563
  let N = (0, import_react.useRef)({
7172
7564
  backendMessageId: null,
7173
7565
  frontendMessageIndex: null
7174
- }), F = (0, import_react.useRef)(null), { data: I } = useAsyncData(async () => (await e18.get_chat_history({})).messages, []), L = e18.value.length > 0 ? e18.value : I, { messages: R, sendMessage: z, setMessages: B, status: V, stop: H, error: U, regenerate: W, clearError: G } = useChat({
7566
+ }), P = (0, import_react.useRef)(null), { data: I } = useAsyncData(async () => (await e18.get_chat_history({})).messages, []), L = e18.value.length > 0 ? e18.value : I, { messages: R, sendMessage: z, setMessages: B, status: V, stop: H, error: U, regenerate: W, clearError: G } = useChat({
7175
7567
  transport: new DefaultChatTransport({ fetch: async (h2, _2) => {
7176
7568
  var _a2;
7177
7569
  if (_2 === void 0) return fetch(h2);
@@ -7192,21 +7584,21 @@ const Chatbot = (e18) => {
7192
7584
  };
7193
7585
  }), _3 = new ReadableStream({
7194
7586
  start(e19) {
7195
- F.current = e19;
7587
+ P.current = e19;
7196
7588
  let h4 = () => {
7197
7589
  try {
7198
7590
  e19.close();
7199
7591
  } catch (e20) {
7200
7592
  Logger.debug("Controller may already be closed", { error: e20 });
7201
7593
  }
7202
- F.current = null;
7594
+ P.current = null;
7203
7595
  };
7204
7596
  return y == null ? void 0 : y.addEventListener("abort", h4), () => {
7205
7597
  y == null ? void 0 : y.removeEventListener("abort", h4);
7206
7598
  };
7207
7599
  },
7208
7600
  cancel() {
7209
- F.current = null;
7601
+ P.current = null;
7210
7602
  }
7211
7603
  });
7212
7604
  return e18.send_prompt({
@@ -7214,7 +7606,7 @@ const Chatbot = (e18) => {
7214
7606
  config: b
7215
7607
  }).catch((e19) => {
7216
7608
  var _a3;
7217
- (_a3 = F.current) == null ? void 0 : _a3.error(e19), F.current = null;
7609
+ (_a3 = P.current) == null ? void 0 : _a3.error(e19), P.current = null;
7218
7610
  }), createUIMessageStreamResponse({ stream: _3 });
7219
7611
  } catch (e19) {
7220
7612
  if (N.current = {
@@ -7242,8 +7634,8 @@ const Chatbot = (e18) => {
7242
7634
  useEventListener(e18.host, MarimoIncomingMessageEvent.TYPE, (e19) => {
7243
7635
  let h2 = ChatMessageIncomingSchema.safeParse(e19.detail.message);
7244
7636
  if (!h2.success) return;
7245
- let g = h2.data, _2 = F.current;
7246
- _2 && (g.content && _2.enqueue(g.content), g.is_final && (_2.close(), F.current = null));
7637
+ let g = h2.data, _2 = P.current;
7638
+ _2 && (g.content && _2.enqueue(g.content), g.is_final && (_2.close(), P.current = null));
7247
7639
  });
7248
7640
  let K = V === "submitted" || V === "streaming", q = (h2) => {
7249
7641
  let g = R.findIndex((e19) => e19.id === h2);