@nexface/chat 0.1.19 → 0.1.20-alpha.1

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.
@@ -7887,7 +7887,7 @@ var getGroupStatus = (parts) => {
7887
7887
  return parts.at(-1)?.status ?? COMPLETE_STATUS;
7888
7888
  };
7889
7889
  var getGroupSummary = (parts, indices) => {
7890
- const counts = {
7890
+ const counts2 = {
7891
7891
  running: 0,
7892
7892
  complete: 0,
7893
7893
  incomplete: 0,
@@ -7899,22 +7899,22 @@ var getGroupSummary = (parts, indices) => {
7899
7899
  status = parts[index5]?.status ?? COMPLETE_STATUS;
7900
7900
  switch (status.type) {
7901
7901
  case "running":
7902
- counts.running++;
7902
+ counts2.running++;
7903
7903
  isRunning = true;
7904
7904
  break;
7905
7905
  case "complete":
7906
- counts.complete++;
7906
+ counts2.complete++;
7907
7907
  break;
7908
7908
  case "incomplete":
7909
- counts.incomplete++;
7909
+ counts2.incomplete++;
7910
7910
  break;
7911
7911
  case "requires-action":
7912
- counts.requiresAction++;
7912
+ counts2.requiresAction++;
7913
7913
  }
7914
7914
  }
7915
7915
  return {
7916
7916
  status: isRunning ? RUNNING_STATUS : status,
7917
- counts
7917
+ counts: counts2
7918
7918
  };
7919
7919
  };
7920
7920
 
@@ -12173,11 +12173,11 @@ var ThreadMessageComponent = (t0) => {
12173
12173
  $[2] = role;
12174
12174
  $[3] = t1;
12175
12175
  } else t1 = $[3];
12176
- const Component = t1;
12176
+ const Component2 = t1;
12177
12177
  let t2;
12178
- if ($[4] !== Component) {
12179
- t2 = /* @__PURE__ */ jsx10(Component, {});
12180
- $[4] = Component;
12178
+ if ($[4] !== Component2) {
12179
+ t2 = /* @__PURE__ */ jsx10(Component2, {});
12180
+ $[4] = Component2;
12181
12181
  $[5] = t2;
12182
12182
  } else t2 = $[5];
12183
12183
  return t2;
@@ -12778,16 +12778,16 @@ var MessagePrimitivePartByIndex = memo((t0) => {
12778
12778
  MessagePrimitivePartByIndex.displayName = "MessagePrimitive.PartByIndex";
12779
12779
  var EmptyPartFallback = (t0) => {
12780
12780
  const $ = c(6);
12781
- const { status, component: Component } = t0;
12781
+ const { status, component: Component2 } = t0;
12782
12782
  const t1 = status.type === "running";
12783
12783
  let t2;
12784
- if ($[0] !== Component || $[1] !== status) {
12785
- t2 = /* @__PURE__ */ jsx12(Component, {
12784
+ if ($[0] !== Component2 || $[1] !== status) {
12785
+ t2 = /* @__PURE__ */ jsx12(Component2, {
12786
12786
  type: "text",
12787
12787
  text: "",
12788
12788
  status
12789
12789
  });
12790
- $[0] = Component;
12790
+ $[0] = Component2;
12791
12791
  $[1] = status;
12792
12792
  $[2] = t2;
12793
12793
  } else t2 = $[2];
@@ -13324,11 +13324,11 @@ var renderNode2 = (node2, parts, render) => {
13324
13324
  children: /* @__PURE__ */ jsx13(PartChildrenSentinel, {})
13325
13325
  })
13326
13326
  }, node2.idKey ? `part-${node2.idKey}` : `part-${node2.index}`);
13327
- const { status, counts } = getGroupSummary(parts, node2.indices);
13327
+ const { status, counts: counts2 } = getGroupSummary(parts, node2.indices);
13328
13328
  const groupPart = {
13329
13329
  type: node2.key,
13330
13330
  status,
13331
- counts,
13331
+ counts: counts2,
13332
13332
  indices: node2.indices
13333
13333
  };
13334
13334
  return /* @__PURE__ */ jsx13(Fragment, { children: render({
@@ -13383,12 +13383,12 @@ var AttachmentComponent = (t0) => {
13383
13383
  $[1] = t1;
13384
13384
  $[2] = t2;
13385
13385
  } else t2 = $[2];
13386
- const Component = t2;
13387
- if (!Component) return null;
13386
+ const Component2 = t2;
13387
+ if (!Component2) return null;
13388
13388
  let t3;
13389
- if ($[3] !== Component) {
13390
- t3 = /* @__PURE__ */ jsx14(Component, {});
13391
- $[3] = Component;
13389
+ if ($[3] !== Component2) {
13390
+ t3 = /* @__PURE__ */ jsx14(Component2, {});
13391
+ $[3] = Component2;
13392
13392
  $[4] = t3;
13393
13393
  } else t3 = $[4];
13394
13394
  return t3;
@@ -13438,9 +13438,9 @@ var MessagePrimitiveAttachments = (t0) => {
13438
13438
  if ($[0] !== components) {
13439
13439
  t12 = /* @__PURE__ */ jsx14(MessagePrimitiveAttachmentsInner, { children: (t2) => {
13440
13440
  const { attachment } = t2;
13441
- const Component = getComponent2(components, attachment);
13442
- if (!Component) return null;
13443
- return /* @__PURE__ */ jsx14(Component, {});
13441
+ const Component2 = getComponent2(components, attachment);
13442
+ if (!Component2) return null;
13443
+ return /* @__PURE__ */ jsx14(Component2, {});
13444
13444
  } });
13445
13445
  $[0] = components;
13446
13446
  $[1] = t12;
@@ -13486,12 +13486,12 @@ var AttachmentComponent2 = (t0) => {
13486
13486
  $[1] = components;
13487
13487
  $[2] = t1;
13488
13488
  } else t1 = $[2];
13489
- const Component = t1;
13490
- if (!Component) return null;
13489
+ const Component2 = t1;
13490
+ if (!Component2) return null;
13491
13491
  let t2;
13492
- if ($[3] !== Component) {
13493
- t2 = /* @__PURE__ */ jsx15(Component, {});
13494
- $[3] = Component;
13492
+ if ($[3] !== Component2) {
13493
+ t2 = /* @__PURE__ */ jsx15(Component2, {});
13494
+ $[3] = Component2;
13495
13495
  $[4] = t2;
13496
13496
  } else t2 = $[4];
13497
13497
  return t2;
@@ -13538,9 +13538,9 @@ var ComposerPrimitiveAttachments = (t0) => {
13538
13538
  if ($[0] !== components) {
13539
13539
  t12 = /* @__PURE__ */ jsx15(ComposerPrimitiveAttachmentsInner, { children: (t2) => {
13540
13540
  const { attachment } = t2;
13541
- const Component = getComponent3(components, attachment);
13542
- if (!Component) return null;
13543
- return /* @__PURE__ */ jsx15(Component, {});
13541
+ const Component2 = getComponent3(components, attachment);
13542
+ if (!Component2) return null;
13543
+ return /* @__PURE__ */ jsx15(Component2, {});
13544
13544
  } });
13545
13545
  $[0] = components;
13546
13546
  $[1] = t12;
@@ -21962,7 +21962,7 @@ function renderSlot(render, children, props) {
21962
21962
  children: composeRenderElement(render, children)
21963
21963
  });
21964
21964
  }
21965
- function withRenderProp(Component) {
21965
+ function withRenderProp(Component2) {
21966
21966
  const Wrapped = forwardRef((t0, ref) => {
21967
21967
  const $ = c(17);
21968
21968
  let asChild;
@@ -21982,7 +21982,7 @@ function withRenderProp(Component) {
21982
21982
  render = $[3];
21983
21983
  rest = $[4];
21984
21984
  }
21985
- const Comp = Component;
21985
+ const Comp = Component2;
21986
21986
  if (render && isValidElement(render)) {
21987
21987
  const t12 = rest;
21988
21988
  let t22;
@@ -22024,14 +22024,14 @@ function withRenderProp(Component) {
22024
22024
  } else t2 = $[16];
22025
22025
  return t2;
22026
22026
  });
22027
- Wrapped.displayName = typeof Component === "string" ? Component : Component.displayName ?? Component.name ?? "Component";
22027
+ Wrapped.displayName = typeof Component2 === "string" ? Component2 : Component2.displayName ?? Component2.name ?? "Component";
22028
22028
  return Wrapped;
22029
22029
  }
22030
22030
  function createPrimitive(node2) {
22031
22031
  const RadixComp = Primitive2[node2];
22032
- const Component = withRenderProp(RadixComp);
22033
- Component.displayName = `Primitive.${node2}`;
22034
- return Component;
22032
+ const Component2 = withRenderProp(RadixComp);
22033
+ Component2.displayName = `Primitive.${node2}`;
22034
+ return Component2;
22035
22035
  }
22036
22036
  var Primitive3 = NODES2.reduce((acc, node2) => {
22037
22037
  acc[node2] = createPrimitive(node2);
@@ -23289,8 +23289,8 @@ var ComposerPrimitiveInput = forwardRef(({ autoFocus = false, asChild, render, d
23289
23289
  ...compactContext ? { onHeightChange: handleHeightChange } : onHeightChange !== void 0 ? { onHeightChange } : {}
23290
23290
  };
23291
23291
  if (render && isValidElement(render)) return renderSlot(render, rest.children, inputProps);
23292
- const Component = asChild ? dist_exports.Root : index3;
23293
- return /* @__PURE__ */ jsx47(Component, { ...inputProps });
23292
+ const Component2 = asChild ? dist_exports.Root : index3;
23293
+ return /* @__PURE__ */ jsx47(Component2, { ...inputProps });
23294
23294
  });
23295
23295
  ComposerPrimitiveInput.displayName = "ComposerPrimitive.Input";
23296
23296
 
@@ -23451,13 +23451,13 @@ var SmoothContextProvider = (t0) => {
23451
23451
  } else t3 = $[5];
23452
23452
  return t3;
23453
23453
  };
23454
- var withSmoothContextProvider = (Component) => {
23454
+ var withSmoothContextProvider = (Component2) => {
23455
23455
  const Wrapped = forwardRef((props, ref) => {
23456
23456
  const $ = c(3);
23457
23457
  const t0 = props;
23458
23458
  let t1;
23459
23459
  if ($[0] !== ref || $[1] !== t0) {
23460
- t1 = /* @__PURE__ */ jsx49(SmoothContextProvider, { children: /* @__PURE__ */ jsx49(Component, {
23460
+ t1 = /* @__PURE__ */ jsx49(SmoothContextProvider, { children: /* @__PURE__ */ jsx49(Component2, {
23461
23461
  ...t0,
23462
23462
  ref
23463
23463
  }) });
@@ -23467,7 +23467,7 @@ var withSmoothContextProvider = (Component) => {
23467
23467
  } else t1 = $[2];
23468
23468
  return t1;
23469
23469
  });
23470
- Wrapped.displayName = Component.displayName;
23470
+ Wrapped.displayName = Component2.displayName;
23471
23471
  return Wrapped;
23472
23472
  };
23473
23473
  function useSmoothContext(options2) {
@@ -23657,7 +23657,7 @@ function _temp47(s) {
23657
23657
 
23658
23658
  // ../../node_modules/.pnpm/@assistant-ui+react@0.15.21_@opentelemetry+api@1.9.0_@types+react-dom@19.2.3_@types+rea_c35c1873a3528ad63a8637c81c57a418/node_modules/@assistant-ui/react/dist/primitives/messagePart/MessagePartText.js
23659
23659
  import { jsx as jsx50 } from "react/jsx-runtime";
23660
- var MessagePartPrimitiveText = forwardRef(({ smooth = true, component: Component = Primitive3.span, render, ...rest }, forwardedRef) => {
23660
+ var MessagePartPrimitiveText = forwardRef(({ smooth = true, component: Component2 = Primitive3.span, render, ...rest }, forwardedRef) => {
23661
23661
  const { text: text7, status } = useSmooth(useMessagePartText(), smooth);
23662
23662
  const mergedProps = {
23663
23663
  "data-status": status.type,
@@ -23665,7 +23665,7 @@ var MessagePartPrimitiveText = forwardRef(({ smooth = true, component: Component
23665
23665
  ref: forwardedRef
23666
23666
  };
23667
23667
  if (render && isValidElement(render)) return renderSlot(render, text7, mergedProps);
23668
- return /* @__PURE__ */ jsx50(Component, {
23668
+ return /* @__PURE__ */ jsx50(Component2, {
23669
23669
  ...mergedProps,
23670
23670
  children: text7
23671
23671
  });
@@ -25137,7 +25137,7 @@ var Icon = (0, react_compat_exports.forwardRef)(
25137
25137
 
25138
25138
  // ../../node_modules/.pnpm/lucide-react@0.506.0_react@19.2.7/node_modules/lucide-react/dist/esm/createLucideIcon.js
25139
25139
  var createLucideIcon = (iconName, iconNode) => {
25140
- const Component = (0, react_compat_exports.forwardRef)(
25140
+ const Component2 = (0, react_compat_exports.forwardRef)(
25141
25141
  ({ className, ...props }, ref) => (0, react_compat_exports.createElement)(Icon, {
25142
25142
  ref,
25143
25143
  iconNode,
@@ -25149,8 +25149,8 @@ var createLucideIcon = (iconName, iconNode) => {
25149
25149
  ...props
25150
25150
  })
25151
25151
  );
25152
- Component.displayName = toPascalCase(iconName);
25153
- return Component;
25152
+ Component2.displayName = toPascalCase(iconName);
25153
+ return Component2;
25154
25154
  };
25155
25155
 
25156
25156
  // ../../node_modules/.pnpm/lucide-react@0.506.0_react@19.2.7/node_modules/lucide-react/dist/esm/icons/arrow-up.js
@@ -29216,7 +29216,8 @@ var typeDeck = "text-muted-foreground max-w-[40ch] text-[15px] leading-relaxed t
29216
29216
  import { jsx as jsx70, jsxs as jsxs13 } from "react/jsx-runtime";
29217
29217
  function Greeting({
29218
29218
  title,
29219
- description
29219
+ description,
29220
+ icon
29220
29221
  }) {
29221
29222
  return /* @__PURE__ */ jsxs13(
29222
29223
  "div",
@@ -29225,6 +29226,7 @@ function Greeting({
29225
29226
  "animate-in fade-in slide-in-from-bottom-1 mx-auto mb-8 flex w-full max-w-(--nxf-thread-max-width) flex-col items-center text-center duration-200"
29226
29227
  ),
29227
29228
  children: [
29229
+ icon != null ? /* @__PURE__ */ jsx70("div", { className: cn("mb-4 flex max-w-full justify-center [&_img]:max-w-full"), children: icon }) : null,
29228
29230
  /* @__PURE__ */ jsx70("p", { className: cn(typeSection), children: title }),
29229
29231
  description ? /* @__PURE__ */ jsx70("p", { className: cn(typeDeck), children: description }) : null
29230
29232
  ]
@@ -29233,8 +29235,8 @@ function Greeting({
29233
29235
  }
29234
29236
 
29235
29237
  // src/ui/home-demo/suggestions.tsx
29236
- import { jsx as jsx71 } from "react/jsx-runtime";
29237
- var suggestionChipClass = "border-foreground/10 bg-background text-muted-foreground hover:border-foreground/25 hover:text-foreground rounded-control h-8 border px-3 text-[13px] transition-colors";
29238
+ import { jsx as jsx71, jsxs as jsxs14 } from "react/jsx-runtime";
29239
+ var suggestionChipClass = "bg-background text-suggestion hover:text-foreground font-suggestion inset-ring inset-ring-foreground/8 hover:inset-ring-foreground/25 rounded-xl inline-flex min-h-[46px] min-w-0 max-w-full items-center gap-2 px-4 py-3 text-sm font-medium leading-[1.57143] transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring";
29238
29240
  function Suggestions2({
29239
29241
  suggestions,
29240
29242
  disabled,
@@ -29254,7 +29256,7 @@ function Suggestions2({
29254
29256
  "animate-in fade-in mx-auto flex max-w-[34rem] flex-wrap items-center justify-center gap-2 transition-opacity duration-200 motion-reduce:animate-none",
29255
29257
  hidden && "opacity-0"
29256
29258
  ),
29257
- children: suggestions.map((suggestion) => /* @__PURE__ */ jsx71(
29259
+ children: suggestions.map((suggestion) => /* @__PURE__ */ jsxs14(
29258
29260
  ThreadPrimitiveSuggestion,
29259
29261
  {
29260
29262
  prompt: suggestion.prompt,
@@ -29265,7 +29267,19 @@ function Suggestions2({
29265
29267
  onSend(suggestion.prompt);
29266
29268
  },
29267
29269
  className: cn(suggestionChipClass),
29268
- children: suggestion.label
29270
+ children: [
29271
+ suggestion.icon != null ? /* @__PURE__ */ jsx71(
29272
+ "span",
29273
+ {
29274
+ "aria-hidden": "true",
29275
+ className: cn(
29276
+ "inline-flex size-4 shrink-0 items-center justify-center [&>svg]:size-4 [&>img]:size-4"
29277
+ ),
29278
+ children: suggestion.icon
29279
+ }
29280
+ ) : null,
29281
+ /* @__PURE__ */ jsx71("span", { className: cn("min-w-0 wrap-anywhere"), children: suggestion.label })
29282
+ ]
29269
29283
  },
29270
29284
  suggestion.prompt
29271
29285
  ))
@@ -29325,22 +29339,22 @@ function useNextMessage(chat, suggest, open) {
29325
29339
  }
29326
29340
 
29327
29341
  // src/ui/home-demo/action-bar.tsx
29328
- import { jsx as jsx72, jsxs as jsxs14 } from "react/jsx-runtime";
29342
+ import { jsx as jsx72, jsxs as jsxs15 } from "react/jsx-runtime";
29329
29343
  function AssistantActionBar() {
29330
- return /* @__PURE__ */ jsx72(ActionBarPrimitiveRoot, { autohide: "never", className: cn("flex items-center gap-1.5"), children: /* @__PURE__ */ jsxs14(ActionBarPrimitiveCopy, { "aria-label": "\u590D\u5236\u56DE\u590D", className: cn(actionButtonClass), children: [
29344
+ return /* @__PURE__ */ jsx72(ActionBarPrimitiveRoot, { autohide: "never", className: cn("flex items-center gap-1.5"), children: /* @__PURE__ */ jsxs15(ActionBarPrimitiveCopy, { "aria-label": "\u590D\u5236\u56DE\u590D", className: cn(actionButtonClass), children: [
29331
29345
  /* @__PURE__ */ jsx72(AuiIf, { condition: (s) => s.message.isCopied, children: /* @__PURE__ */ jsx72(Check, { className: cn("size-4") }) }),
29332
29346
  /* @__PURE__ */ jsx72(AuiIf, { condition: (s) => !s.message.isCopied, children: /* @__PURE__ */ jsx72(Copy, { className: cn("size-4") }) })
29333
29347
  ] }) });
29334
29348
  }
29335
29349
 
29336
29350
  // src/ui/home-demo/messages.tsx
29337
- import { jsx as jsx73, jsxs as jsxs15 } from "react/jsx-runtime";
29351
+ import { jsx as jsx73, jsxs as jsxs16 } from "react/jsx-runtime";
29338
29352
  function UserMessage({
29339
29353
  children,
29340
29354
  attachments,
29341
29355
  actions
29342
29356
  }) {
29343
- return /* @__PURE__ */ jsxs15(
29357
+ return /* @__PURE__ */ jsxs16(
29344
29358
  MessagePrimitiveRoot,
29345
29359
  {
29346
29360
  "data-role": "user",
@@ -29350,7 +29364,7 @@ function UserMessage({
29350
29364
  ),
29351
29365
  children: [
29352
29366
  /* @__PURE__ */ jsx73("div", { className: cn("w-full has-[.aui-attachment-root]:mb-2"), children: attachments }),
29353
- /* @__PURE__ */ jsxs15("div", { className: cn("relative max-w-[80%]"), children: [
29367
+ /* @__PURE__ */ jsxs16("div", { className: cn("relative max-w-[80%]"), children: [
29354
29368
  /* @__PURE__ */ jsx73(
29355
29369
  "div",
29356
29370
  {
@@ -29377,7 +29391,7 @@ function UserMessage({
29377
29391
  );
29378
29392
  }
29379
29393
  function AssistantMessage({ children }) {
29380
- return /* @__PURE__ */ jsxs15(
29394
+ return /* @__PURE__ */ jsxs16(
29381
29395
  MessagePrimitiveRoot,
29382
29396
  {
29383
29397
  "data-role": "assistant",
@@ -29386,7 +29400,7 @@ function AssistantMessage({ children }) {
29386
29400
  "animate-in fade-in slide-in-from-bottom-1 mx-auto w-full max-w-(--nxf-thread-max-width) duration-150"
29387
29401
  ),
29388
29402
  children: [
29389
- /* @__PURE__ */ jsxs15(
29403
+ /* @__PURE__ */ jsxs16(
29390
29404
  "div",
29391
29405
  {
29392
29406
  "data-slot": "aui_assistant-message-content",
@@ -29419,7 +29433,7 @@ function MessageError() {
29419
29433
  }
29420
29434
 
29421
29435
  // src/ui/home-demo/composer.tsx
29422
- import { jsx as jsx74, jsxs as jsxs16 } from "react/jsx-runtime";
29436
+ import { jsx as jsx74, jsxs as jsxs17 } from "react/jsx-runtime";
29423
29437
  function Composer({
29424
29438
  children,
29425
29439
  inputProps,
@@ -29437,7 +29451,7 @@ function Composer({
29437
29451
  onDragOverCapture: (event) => {
29438
29452
  if (inputProps.disabled) event.preventDefault();
29439
29453
  },
29440
- children: /* @__PURE__ */ jsxs16(
29454
+ children: /* @__PURE__ */ jsxs17(
29441
29455
  "div",
29442
29456
  {
29443
29457
  "data-slot": "aui_composer-shell",
@@ -29476,7 +29490,7 @@ function EditComposer({
29476
29490
  "data-role": "user",
29477
29491
  "data-slot": "aui_edit-composer-wrapper",
29478
29492
  className: cn("mx-auto flex w-full max-w-(--nxf-thread-max-width) flex-col items-end"),
29479
- children: /* @__PURE__ */ jsxs16(
29493
+ children: /* @__PURE__ */ jsxs17(
29480
29494
  ComposerPrimitiveRoot,
29481
29495
  {
29482
29496
  className: cn(
@@ -29495,7 +29509,7 @@ function EditComposer({
29495
29509
  }
29496
29510
  ) }),
29497
29511
  children,
29498
- /* @__PURE__ */ jsxs16("div", { className: cn("flex items-center justify-end gap-1.5 px-2.5 pb-2.5"), children: [
29512
+ /* @__PURE__ */ jsxs17("div", { className: cn("flex items-center justify-end gap-1.5 px-2.5 pb-2.5"), children: [
29499
29513
  /* @__PURE__ */ jsx74(ComposerPrimitiveCancel, { asChild: true, children: /* @__PURE__ */ jsx74(
29500
29514
  "button",
29501
29515
  {
@@ -29531,7 +29545,7 @@ import { forwardRef as forwardRef29 } from "react";
29531
29545
 
29532
29546
  // src/ui/tooltip.tsx
29533
29547
  import * as React6 from "react";
29534
- import { jsx as jsx75, jsxs as jsxs17 } from "react/jsx-runtime";
29548
+ import { jsx as jsx75, jsxs as jsxs18 } from "react/jsx-runtime";
29535
29549
  function TooltipProvider2({
29536
29550
  delayDuration = 0,
29537
29551
  ...props
@@ -29559,7 +29573,7 @@ function TooltipContent3({
29559
29573
  }) {
29560
29574
  const container = usePortalContainer();
29561
29575
  if (!container) return null;
29562
- return /* @__PURE__ */ jsx75(dist_exports12.Portal, { container, children: /* @__PURE__ */ jsxs17(
29576
+ return /* @__PURE__ */ jsx75(dist_exports12.Portal, { container, children: /* @__PURE__ */ jsxs18(
29563
29577
  dist_exports12.Content,
29564
29578
  {
29565
29579
  "data-slot": "tooltip-content",
@@ -29586,11 +29600,11 @@ function TooltipContent3({
29586
29600
  }
29587
29601
 
29588
29602
  // src/ui/tooltip-icon-button.tsx
29589
- import { jsx as jsx76, jsxs as jsxs18 } from "react/jsx-runtime";
29603
+ import { jsx as jsx76, jsxs as jsxs19 } from "react/jsx-runtime";
29590
29604
  var TooltipIconButton = forwardRef29(
29591
29605
  ({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
29592
- return /* @__PURE__ */ jsx76(TooltipProvider2, { delayDuration: 0, children: /* @__PURE__ */ jsxs18(Tooltip2, { children: [
29593
- /* @__PURE__ */ jsx76(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsxs18(
29606
+ return /* @__PURE__ */ jsx76(TooltipProvider2, { delayDuration: 0, children: /* @__PURE__ */ jsxs19(Tooltip2, { children: [
29607
+ /* @__PURE__ */ jsx76(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsxs19(
29594
29608
  Button,
29595
29609
  {
29596
29610
  variant: "ghost",
@@ -29662,7 +29676,7 @@ import {
29662
29676
  forwardRef as forwardRef33,
29663
29677
  useEffect as useEffect34,
29664
29678
  useLayoutEffect as useLayoutEffect14,
29665
- useMemo as useMemo13,
29679
+ useMemo as useMemo14,
29666
29680
  useRef as useRef39,
29667
29681
  useState as useState39
29668
29682
  } from "react";
@@ -30236,7 +30250,7 @@ var useAttachmentSrc = () => {
30236
30250
  };
30237
30251
 
30238
30252
  // src/ui/attachment.aui.tsx
30239
- import { Fragment as Fragment9, jsx as jsx79, jsxs as jsxs19 } from "react/jsx-runtime";
30253
+ import { Fragment as Fragment9, jsx as jsx79, jsxs as jsxs20 } from "react/jsx-runtime";
30240
30254
  var PreviewContext = createContext6(void 0);
30241
30255
  var usePreview = () => {
30242
30256
  const fallback = useAttachmentSrc();
@@ -30260,9 +30274,9 @@ var AttachmentPreview = ({ src }) => {
30260
30274
  var AttachmentPreviewDialog = ({ children }) => {
30261
30275
  const src = usePreview();
30262
30276
  if (!src) return /* @__PURE__ */ jsx79(Fragment9, { children });
30263
- return /* @__PURE__ */ jsxs19(Dialog2, { children: [
30277
+ return /* @__PURE__ */ jsxs20(Dialog2, { children: [
30264
30278
  /* @__PURE__ */ jsx79(DialogTrigger3, { className: cn("aui-attachment-preview-trigger cursor-zoom-in"), asChild: true, children: isValidElement3(children) ? children : /* @__PURE__ */ jsx79("button", { type: "button", children }) }),
30265
- /* @__PURE__ */ jsxs19(
30279
+ /* @__PURE__ */ jsxs20(
30266
30280
  DialogContent3,
30267
30281
  {
30268
30282
  className: cn(
@@ -30334,8 +30348,8 @@ var AttachmentContent = ({ children }) => {
30334
30348
  const errorMessage = useAuiState(
30335
30349
  (s) => s.attachment.status.type === "incomplete" && s.attachment.status.reason === "error" ? s.attachment.status.message ?? "Attachment processing failed" : void 0
30336
30350
  );
30337
- return /* @__PURE__ */ jsx79(TooltipProvider2, { children: /* @__PURE__ */ jsxs19(Tooltip2, { children: [
30338
- /* @__PURE__ */ jsxs19(
30351
+ return /* @__PURE__ */ jsx79(TooltipProvider2, { children: /* @__PURE__ */ jsxs20(Tooltip2, { children: [
30352
+ /* @__PURE__ */ jsxs20(
30339
30353
  AttachmentPrimitiveRoot,
30340
30354
  {
30341
30355
  className: cn(
@@ -30344,7 +30358,7 @@ var AttachmentContent = ({ children }) => {
30344
30358
  isImage2 && !isComposer && "aui-attachment-root-message only:*:first:size-24"
30345
30359
  ),
30346
30360
  children: [
30347
- /* @__PURE__ */ jsx79(AttachmentPreviewDialog, { children: /* @__PURE__ */ jsx79(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsxs19(
30361
+ /* @__PURE__ */ jsx79(AttachmentPreviewDialog, { children: /* @__PURE__ */ jsx79(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsxs20(
30348
30362
  "div",
30349
30363
  {
30350
30364
  className: cn(
@@ -30395,7 +30409,7 @@ var AttachmentContent = ({ children }) => {
30395
30409
  ]
30396
30410
  }
30397
30411
  ),
30398
- /* @__PURE__ */ jsxs19(TooltipContent3, { side: "top", children: [
30412
+ /* @__PURE__ */ jsxs20(TooltipContent3, { side: "top", children: [
30399
30413
  /* @__PURE__ */ jsx79(AttachmentPrimitiveName, {}),
30400
30414
  errorMessage && /* @__PURE__ */ jsx79("p", { className: cn("aui-attachment-error-message"), children: errorMessage })
30401
30415
  ] })
@@ -30440,9 +30454,9 @@ var memoCompareNodes = (prev, next) => {
30440
30454
  var memoizeMarkdownComponents = (components = {}) => {
30441
30455
  return Object.fromEntries(Object.entries(components ?? {}).map(([key, value]) => {
30442
30456
  if (!value) return [key, value];
30443
- const Component = value;
30457
+ const Component2 = value;
30444
30458
  const WithoutNode = ({ node: node2, ...props }) => {
30445
- return /* @__PURE__ */ jsx80(Component, { ...props });
30459
+ return /* @__PURE__ */ jsx80(Component2, { ...props });
30446
30460
  };
30447
30461
  return [key, (0, react_compat_exports.memo)(WithoutNode, memoCompareNodes)];
30448
30462
  }));
@@ -30480,13 +30494,13 @@ var DefaultCodeHeader = () => null;
30480
30494
  var parseLanguageClass = (className) => /language-([^\s]+)/.exec(className ?? "")?.[1] ?? "";
30481
30495
 
30482
30496
  // ../../node_modules/.pnpm/@assistant-ui+react-markdown@0.14.16_@assistant-ui+react@0.15.21_@opentelemetry+api@1.9_51b9d4047c9ca5e4912afe903880d312/node_modules/@assistant-ui/react-markdown/dist/overrides/CodeBlock.js
30483
- import { Fragment as Fragment10, jsx as jsx83, jsxs as jsxs20 } from "react/jsx-runtime";
30497
+ import { Fragment as Fragment10, jsx as jsx83, jsxs as jsxs21 } from "react/jsx-runtime";
30484
30498
  var DefaultCodeBlock = ({ node: node2, components: { Pre, Code: Code2, SyntaxHighlighter: SyntaxHighlighter2, CodeHeader }, language, code: code4 }) => {
30485
30499
  const components = (0, react_compat_exports.useMemo)(() => ({
30486
30500
  Pre,
30487
30501
  Code: Code2
30488
30502
  }), [Pre, Code2]);
30489
- return /* @__PURE__ */ jsxs20(Fragment10, { children: [/* @__PURE__ */ jsx83(CodeHeader, {
30503
+ return /* @__PURE__ */ jsxs21(Fragment10, { children: [/* @__PURE__ */ jsx83(CodeHeader, {
30490
30504
  node: node2,
30491
30505
  language,
30492
30506
  code: code4
@@ -30509,7 +30523,7 @@ var withDefaultProps = ({ className, ...defaultProps }) => ({ className: classNa
30509
30523
  };
30510
30524
 
30511
30525
  // ../../node_modules/.pnpm/@assistant-ui+react-markdown@0.14.16_@assistant-ui+react@0.15.21_@opentelemetry+api@1.9_51b9d4047c9ca5e4912afe903880d312/node_modules/@assistant-ui/react-markdown/dist/overrides/CodeOverride.js
30512
- import { Fragment as Fragment11, jsx as jsx84, jsxs as jsxs21 } from "react/jsx-runtime";
30526
+ import { Fragment as Fragment11, jsx as jsx84, jsxs as jsxs22 } from "react/jsx-runtime";
30513
30527
  function extractCode(children) {
30514
30528
  if (typeof children === "string") return children;
30515
30529
  if (Array.isArray(children)) {
@@ -30529,7 +30543,7 @@ var CodeBlockOverride = ({ node: node2, components: { Pre, Code: Code2, SyntaxHi
30529
30543
  const language = parseLanguageClass(codeProps.className);
30530
30544
  const SyntaxHighlighter2 = componentsByLanguage[language]?.SyntaxHighlighter ?? FallbackSyntaxHighlighter;
30531
30545
  const CodeHeader = componentsByLanguage[language]?.CodeHeader ?? FallbackCodeHeader;
30532
- if (children != null && typeof children !== "string") return /* @__PURE__ */ jsxs21(Fragment11, { children: [/* @__PURE__ */ jsx84(CodeHeader, {
30546
+ if (children != null && typeof children !== "string") return /* @__PURE__ */ jsxs22(Fragment11, { children: [/* @__PURE__ */ jsx84(CodeHeader, {
30533
30547
  node: node2,
30534
30548
  language,
30535
30549
  code: extractCode(children)
@@ -32216,11 +32230,11 @@ function addChildren(props, children) {
32216
32230
  }
32217
32231
  }
32218
32232
  }
32219
- function productionCreate(_, jsx99, jsxs30) {
32233
+ function productionCreate(_, jsx100, jsxs32) {
32220
32234
  return create3;
32221
32235
  function create3(_2, type, props, key) {
32222
32236
  const isStaticChildren = Array.isArray(props.children);
32223
- const fn = isStaticChildren ? jsxs30 : jsx99;
32237
+ const fn = isStaticChildren ? jsxs32 : jsx100;
32224
32238
  return key ? fn(type, props, key) : fn(type, props);
32225
32239
  }
32226
32240
  }
@@ -32465,7 +32479,7 @@ var urlAttributes = {
32465
32479
  };
32466
32480
 
32467
32481
  // ../../node_modules/.pnpm/react-markdown@10.1.0_@types+react@19.2.17_react@19.2.7/node_modules/react-markdown/lib/index.js
32468
- import { Fragment as Fragment12, jsx as jsx85, jsxs as jsxs22 } from "react/jsx-runtime";
32482
+ import { Fragment as Fragment12, jsx as jsx85, jsxs as jsxs23 } from "react/jsx-runtime";
32469
32483
 
32470
32484
  // ../../node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.js
32471
32485
  var emptyOptions2 = {};
@@ -40235,8 +40249,8 @@ function footer(state) {
40235
40249
  const safeId = normalizeUri(id.toLowerCase());
40236
40250
  let rereferenceIndex = 0;
40237
40251
  const backReferences = [];
40238
- const counts = state.footnoteCounts.get(id);
40239
- while (counts !== void 0 && ++rereferenceIndex <= counts) {
40252
+ const counts2 = state.footnoteCounts.get(id);
40253
+ while (counts2 !== void 0 && ++rereferenceIndex <= counts2) {
40240
40254
  if (backReferences.length > 0) {
40241
40255
  backReferences.push({ type: "text", value: " " });
40242
40256
  }
@@ -42266,7 +42280,7 @@ function post(tree, options2) {
42266
42280
  components,
42267
42281
  ignoreInvalidStyle: true,
42268
42282
  jsx: jsx85,
42269
- jsxs: jsxs22,
42283
+ jsxs: jsxs23,
42270
42284
  passKeys: true,
42271
42285
  passNode: true
42272
42286
  });
@@ -45487,7 +45501,7 @@ import { memo as memo6, useRef as useRef33 } from "react";
45487
45501
 
45488
45502
  // src/ui/code-block.tsx
45489
45503
  import { useEffect as useEffect29, useRef as useRef32, useState as useState32 } from "react";
45490
- import { jsx as jsx87, jsxs as jsxs23 } from "react/jsx-runtime";
45504
+ import { jsx as jsx87, jsxs as jsxs24 } from "react/jsx-runtime";
45491
45505
  function CopyButton({
45492
45506
  getText,
45493
45507
  onCopied,
@@ -45541,7 +45555,7 @@ function CodeBlock({
45541
45555
  }) {
45542
45556
  const viewportRef = useRef32(null);
45543
45557
  const getText = () => copyText ?? viewportRef.current?.querySelector("pre")?.textContent ?? "";
45544
- return /* @__PURE__ */ jsxs23(
45558
+ return /* @__PURE__ */ jsxs24(
45545
45559
  "figure",
45546
45560
  {
45547
45561
  className: cn(
@@ -45550,7 +45564,7 @@ function CodeBlock({
45550
45564
  ),
45551
45565
  ...props,
45552
45566
  children: [
45553
- title ? /* @__PURE__ */ jsxs23(
45567
+ title ? /* @__PURE__ */ jsxs24(
45554
45568
  "figcaption",
45555
45569
  {
45556
45570
  className: cn(
@@ -45628,7 +45642,7 @@ var useCopyToClipboard = ({ copiedDuration = 3e3 } = {}) => {
45628
45642
  };
45629
45643
 
45630
45644
  // src/ui/markdown-text.tsx
45631
- import { jsx as jsx88, jsxs as jsxs24 } from "react/jsx-runtime";
45645
+ import { jsx as jsx88, jsxs as jsxs25 } from "react/jsx-runtime";
45632
45646
  var MarkdownTextImpl = () => /* @__PURE__ */ jsx88(
45633
45647
  MarkdownTextPrimitive,
45634
45648
  {
@@ -45663,8 +45677,8 @@ function MarkdownTable({ className, children, ...props }) {
45663
45677
  ].join("\n")
45664
45678
  );
45665
45679
  };
45666
- return /* @__PURE__ */ jsxs24("figure", { className: cn("border-foreground/10 rounded-document my-3 border"), children: [
45667
- /* @__PURE__ */ jsxs24(
45680
+ return /* @__PURE__ */ jsxs25("figure", { className: cn("border-foreground/10 rounded-document my-3 border"), children: [
45681
+ /* @__PURE__ */ jsxs25(
45668
45682
  "div",
45669
45683
  {
45670
45684
  className: cn(
@@ -46025,7 +46039,7 @@ function ShimmerLabel({
46025
46039
 
46026
46040
  // src/ui/home-demo/trace-line.tsx
46027
46041
  import { useEffect as useEffect31, useRef as useRef35, useState as useState36 } from "react";
46028
- import { Fragment as Fragment13, jsx as jsx93, jsxs as jsxs25 } from "react/jsx-runtime";
46042
+ import { Fragment as Fragment13, jsx as jsx93, jsxs as jsxs26 } from "react/jsx-runtime";
46029
46043
  function TraceMarker({ live, className }) {
46030
46044
  return /* @__PURE__ */ jsx93(
46031
46045
  "span",
@@ -46064,7 +46078,7 @@ function TraceLine({
46064
46078
  detail,
46065
46079
  meta
46066
46080
  }) {
46067
- return /* @__PURE__ */ jsxs25(
46081
+ return /* @__PURE__ */ jsxs26(
46068
46082
  "div",
46069
46083
  {
46070
46084
  className: cn(
@@ -46072,10 +46086,10 @@ function TraceLine({
46072
46086
  ),
46073
46087
  children: [
46074
46088
  /* @__PURE__ */ jsx93(TraceMarker, { live }),
46075
- /* @__PURE__ */ jsx93("span", { className: cn("text-muted-foreground min-w-0 flex-1 truncate"), children: live ? /* @__PURE__ */ jsxs25(ShimmerLabel, { children: [
46089
+ /* @__PURE__ */ jsx93("span", { className: cn("text-muted-foreground min-w-0 flex-1 truncate"), children: live ? /* @__PURE__ */ jsxs26(ShimmerLabel, { children: [
46076
46090
  label,
46077
46091
  detail ? ` ${detail}` : null
46078
- ] }) : /* @__PURE__ */ jsxs25(Fragment13, { children: [
46092
+ ] }) : /* @__PURE__ */ jsxs26(Fragment13, { children: [
46079
46093
  label,
46080
46094
  detail ? ` ${detail}` : null
46081
46095
  ] }) }),
@@ -46085,15 +46099,37 @@ function TraceLine({
46085
46099
  );
46086
46100
  }
46087
46101
 
46102
+ // src/tool-result.ts
46103
+ function decodeToolResult(content3, toolName) {
46104
+ try {
46105
+ const payload = JSON.parse(content3);
46106
+ if (payload && typeof payload === "object" && !Array.isArray(payload)) {
46107
+ const record = payload;
46108
+ if (record.contentOmitted === true && typeof record.preview === "string" && Object.keys(record).length === 2)
46109
+ return { value: record.preview, omitted: true };
46110
+ if (Object.hasOwn(record, "result") && (Object.keys(record).length === 1 || toolName !== void 0 && record.toolName === toolName && Object.keys(record).length === 2))
46111
+ return { value: record.result, omitted: false };
46112
+ }
46113
+ return { value: payload, omitted: false };
46114
+ } catch {
46115
+ return { value: content3, omitted: false };
46116
+ }
46117
+ }
46118
+ function toolResultPreview(result) {
46119
+ const decoded = typeof result === "string" ? decodeToolResult(result) : void 0;
46120
+ const text7 = decoded?.omitted ? String(decoded.value) : typeof result === "string" ? result : JSON.stringify(result, null, 2) ?? "";
46121
+ return text7.length > 4e3 || decoded?.omitted ? `${text7.slice(0, 4e3)}\u2026` : text7;
46122
+ }
46123
+
46088
46124
  // src/ui/home-demo/trace.tsx
46089
- import { Fragment as Fragment14, jsx as jsx94, jsxs as jsxs26 } from "react/jsx-runtime";
46125
+ import { Fragment as Fragment14, jsx as jsx94, jsxs as jsxs27 } from "react/jsx-runtime";
46090
46126
  var disclosureContentClass = "border-foreground/10 ms-[5px] border-s ps-4";
46091
46127
  function DisclosureTrigger({
46092
46128
  live,
46093
46129
  label,
46094
46130
  detail
46095
46131
  }) {
46096
- return /* @__PURE__ */ jsxs26(
46132
+ return /* @__PURE__ */ jsxs27(
46097
46133
  CollapsibleTrigger3,
46098
46134
  {
46099
46135
  "data-slot": "tool-group-trigger",
@@ -46108,10 +46144,10 @@ function DisclosureTrigger({
46108
46144
  className: cn(
46109
46145
  "text-muted-foreground group-hover/trigger:text-foreground min-w-0 truncate transition-colors"
46110
46146
  ),
46111
- children: live ? /* @__PURE__ */ jsxs26(ShimmerLabel, { children: [
46147
+ children: live ? /* @__PURE__ */ jsxs27(ShimmerLabel, { children: [
46112
46148
  label,
46113
46149
  detail ? ` ${detail}` : null
46114
- ] }) : /* @__PURE__ */ jsxs26(Fragment14, { children: [
46150
+ ] }) : /* @__PURE__ */ jsxs27(Fragment14, { children: [
46115
46151
  label,
46116
46152
  detail ? ` ${detail}` : null
46117
46153
  ] })
@@ -46154,18 +46190,18 @@ function ToolCall({
46154
46190
  }
46155
46191
  ) : null;
46156
46192
  if (!showDetails)
46157
- return /* @__PURE__ */ jsxs26(Fragment14, { children: [
46193
+ return /* @__PURE__ */ jsxs27(Fragment14, { children: [
46158
46194
  line,
46159
46195
  reason
46160
46196
  ] });
46161
- return /* @__PURE__ */ jsxs26(Fragment14, { children: [
46197
+ return /* @__PURE__ */ jsxs27(Fragment14, { children: [
46162
46198
  line,
46163
46199
  reason,
46164
- /* @__PURE__ */ jsxs26(Collapsible3, { children: [
46200
+ /* @__PURE__ */ jsxs27(Collapsible3, { children: [
46165
46201
  /* @__PURE__ */ jsx94(DisclosureTrigger, { live: false, label: "\u64CD\u4F5C\u660E\u7EC6" }),
46166
- /* @__PURE__ */ jsxs26(CollapsibleContent3, { className: cn(disclosureContentClass), children: [
46202
+ /* @__PURE__ */ jsxs27(CollapsibleContent3, { className: cn(disclosureContentClass), children: [
46167
46203
  /* @__PURE__ */ jsx94("pre", { className: cn("overflow-x-auto text-xs"), "aria-label": "\u64CD\u4F5C\u8F93\u5165", children: argsText || JSON.stringify(args, null, 2) }),
46168
- result !== void 0 ? /* @__PURE__ */ jsx94("pre", { className: cn("overflow-x-auto text-xs"), "aria-label": "\u64CD\u4F5C\u8F93\u51FA", children: error ? error.userMessage : tool2?.toolState === "cancelled" ? "Stopped" : tool2?.toolState === "rejected" ? "Rejected" : tool2?.toolState === "not_started" ? "Not started" : typeof result === "string" ? result : JSON.stringify(result, null, 2) }) : null
46204
+ result !== void 0 ? /* @__PURE__ */ jsx94("pre", { className: cn("overflow-x-auto text-xs"), "aria-label": "\u64CD\u4F5C\u8F93\u51FA", children: error ? error.userMessage : tool2?.toolState === "cancelled" ? "Stopped" : tool2?.toolState === "rejected" ? "Rejected" : tool2?.toolState === "not_started" ? "Not started" : toolResultPreview(result) }) : null
46169
46205
  ] })
46170
46206
  ] })
46171
46207
  ] });
@@ -46185,7 +46221,7 @@ import {
46185
46221
  useRef as useRef36,
46186
46222
  useState as useState37
46187
46223
  } from "react";
46188
- import { jsx as jsx95, jsxs as jsxs27 } from "react/jsx-runtime";
46224
+ import { jsx as jsx95, jsxs as jsxs28 } from "react/jsx-runtime";
46189
46225
  var ANIMATION_DURATION2 = 200;
46190
46226
  var ReasoningPreviewContext = createContext8(false);
46191
46227
  var reasoningVariants = cva("aui-reasoning-root mb-4 w-full", {
@@ -46295,7 +46331,7 @@ function ReasoningContent({
46295
46331
  ...props
46296
46332
  }) {
46297
46333
  const isPreview = useContext10(ReasoningPreviewContext);
46298
- return /* @__PURE__ */ jsxs27(
46334
+ return /* @__PURE__ */ jsxs28(
46299
46335
  CollapsibleContent3,
46300
46336
  {
46301
46337
  "data-slot": "reasoning-content",
@@ -46408,18 +46444,241 @@ Reasoning.displayName = "Reasoning";
46408
46444
 
46409
46445
  // src/assistant-components.tsx
46410
46446
  import { attachmentAccept } from "./attachments.js";
46411
- import { Fragment as Fragment15, jsx as jsx97, jsxs as jsxs28 } from "react/jsx-runtime";
46447
+ import { useToolPresentations as useToolPresentations2 } from "./react.js";
46448
+
46449
+ // src/tool-presentation.tsx
46450
+ import { Component, memo as memo8, useMemo as useMemo13 } from "react";
46451
+
46452
+ // src/shared/schema.ts
46453
+ var counts = ["minLength", "maxLength", "minItems", "maxItems"];
46454
+ var bounds = ["minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum"];
46455
+ var keywords = /* @__PURE__ */ new Set([
46456
+ "type",
46457
+ "description",
46458
+ "properties",
46459
+ "required",
46460
+ "items",
46461
+ "enum",
46462
+ "additionalProperties",
46463
+ ...counts,
46464
+ ...bounds,
46465
+ "pattern",
46466
+ "uniqueItems"
46467
+ ]);
46468
+ var patterns = /* @__PURE__ */ new WeakMap();
46469
+ function invalid(path2, message) {
46470
+ throw new TypeError(`${path2} ${message}`);
46471
+ }
46472
+ function isRecord2(value) {
46473
+ return value !== null && typeof value === "object" && !Array.isArray(value);
46474
+ }
46475
+ function patternFor(schema, path2) {
46476
+ const source = schema.pattern;
46477
+ const cached = patterns.get(schema);
46478
+ if (cached?.source === source) return cached.regex;
46479
+ let regex;
46480
+ try {
46481
+ regex = new RegExp(source, "u");
46482
+ } catch {
46483
+ invalid(`${path2}.pattern`, "must be a valid Unicode regular expression.");
46484
+ }
46485
+ patterns.set(schema, { source, regex });
46486
+ return regex;
46487
+ }
46488
+ function jsonEqual(left, right) {
46489
+ if (left === right) return true;
46490
+ if (Array.isArray(left) && Array.isArray(right))
46491
+ return left.length === right.length && left.every((item, index5) => jsonEqual(item, right[index5]));
46492
+ if (!isRecord2(left) || !isRecord2(right)) return false;
46493
+ const keys2 = Object.keys(left);
46494
+ return keys2.length === Object.keys(right).length && keys2.every((key) => Object.hasOwn(right, key) && jsonEqual(left[key], right[key]));
46495
+ }
46496
+ function typeMatches(schema, value) {
46497
+ switch (schema.type) {
46498
+ case void 0:
46499
+ return true;
46500
+ case "null":
46501
+ return value === null;
46502
+ case "array":
46503
+ return Array.isArray(value);
46504
+ case "object":
46505
+ return isRecord2(value);
46506
+ case "integer":
46507
+ return typeof value === "number" && Number.isInteger(value);
46508
+ case "number":
46509
+ return typeof value === "number" && Number.isFinite(value);
46510
+ default:
46511
+ return typeof value === schema.type;
46512
+ }
46513
+ }
46514
+ function validateAgentToolInput(schema, value, path2 = "input") {
46515
+ if (!typeMatches(schema, value)) return [`${path2} must be ${schema.type}.`];
46516
+ const errors = [];
46517
+ if (schema.enum && !schema.enum.some((item) => jsonEqual(item, value)))
46518
+ errors.push(`${path2} must be one of the declared enum values.`);
46519
+ if (typeof value === "string") {
46520
+ const length = Array.from(value).length;
46521
+ if (schema.minLength !== void 0 && length < schema.minLength)
46522
+ errors.push(`${path2} must have at least ${schema.minLength} characters.`);
46523
+ if (schema.maxLength !== void 0 && length > schema.maxLength)
46524
+ errors.push(`${path2} must have at most ${schema.maxLength} characters.`);
46525
+ if (schema.pattern !== void 0 && !patternFor(schema, path2).test(value))
46526
+ errors.push(`${path2} must match pattern ${schema.pattern}.`);
46527
+ }
46528
+ if (typeof value === "number") {
46529
+ if (schema.minimum !== void 0 && value < schema.minimum)
46530
+ errors.push(`${path2} must be >= ${schema.minimum}.`);
46531
+ if (schema.maximum !== void 0 && value > schema.maximum)
46532
+ errors.push(`${path2} must be <= ${schema.maximum}.`);
46533
+ if (schema.exclusiveMinimum !== void 0 && value <= schema.exclusiveMinimum)
46534
+ errors.push(`${path2} must be > ${schema.exclusiveMinimum}.`);
46535
+ if (schema.exclusiveMaximum !== void 0 && value >= schema.exclusiveMaximum)
46536
+ errors.push(`${path2} must be < ${schema.exclusiveMaximum}.`);
46537
+ }
46538
+ if (Array.isArray(value)) {
46539
+ if (schema.minItems !== void 0 && value.length < schema.minItems)
46540
+ errors.push(`${path2} must have at least ${schema.minItems} items.`);
46541
+ if (schema.maxItems !== void 0 && value.length > schema.maxItems)
46542
+ errors.push(`${path2} must have at most ${schema.maxItems} items.`);
46543
+ if (schema.uniqueItems && value.some((item, index5) => value.slice(0, index5).some((other) => jsonEqual(item, other))))
46544
+ errors.push(`${path2} must contain unique items.`);
46545
+ if (schema.items)
46546
+ value.forEach(
46547
+ (item, index5) => errors.push(...validateAgentToolInput(schema.items, item, `${path2}[${index5}]`))
46548
+ );
46549
+ }
46550
+ if (isRecord2(value)) {
46551
+ for (const key of schema.required ?? []) {
46552
+ if (!Object.hasOwn(value, key)) errors.push(`${path2}.${key} is required.`);
46553
+ }
46554
+ for (const [key, item] of Object.entries(value)) {
46555
+ const property = schema.properties && Object.hasOwn(schema.properties, key) ? schema.properties[key] : void 0;
46556
+ if (property) errors.push(...validateAgentToolInput(property, item, `${path2}.${key}`));
46557
+ else if (schema.additionalProperties === false) errors.push(`${path2}.${key} is not allowed.`);
46558
+ }
46559
+ }
46560
+ return errors;
46561
+ }
46562
+
46563
+ // src/tool-presentation.tsx
46564
+ import { useChat, useToolPresentations } from "./react.js";
46565
+ import { Fragment as Fragment15, jsx as jsx97, jsxs as jsxs29 } from "react/jsx-runtime";
46566
+ function confirmationInputText(argsText, toolName, toolCallId, messages) {
46567
+ try {
46568
+ const wire = JSON.parse(argsText);
46569
+ if (!wire || typeof wire !== "object" || Array.isArray(wire)) return;
46570
+ if (Object.keys(wire).length !== 1) return;
46571
+ if (Object.hasOwn(wire, "input")) return JSON.stringify(wire.input);
46572
+ const answer = wire.confirmation;
46573
+ if (!answer || typeof answer.requestId !== "string" || typeof answer.approved !== "boolean")
46574
+ return;
46575
+ for (const message of messages)
46576
+ for (const part of message.parts) {
46577
+ if (part.type !== "tool") continue;
46578
+ if (part.toolCallId === toolCallId) return;
46579
+ if (part.name !== toolName || part.result === void 0) continue;
46580
+ const { value, omitted } = decodeToolResult(part.result, toolName);
46581
+ if (!omitted && value && typeof value === "object" && "status" in value && value.status === "confirmation_required" && "requestId" in value && value.requestId === answer.requestId) {
46582
+ const original = JSON.parse(part.arguments);
46583
+ if (original && Object.hasOwn(original, "input")) return JSON.stringify(original.input);
46584
+ }
46585
+ }
46586
+ } catch {
46587
+ }
46588
+ return;
46589
+ }
46590
+ var RenderBoundary = class extends Component {
46591
+ state = { failed: false };
46592
+ static getDerivedStateFromError() {
46593
+ return { failed: true };
46594
+ }
46595
+ componentDidCatch(error) {
46596
+ this.props.report(error);
46597
+ }
46598
+ render() {
46599
+ return this.state.failed ? this.props.fallback : this.props.children;
46600
+ }
46601
+ };
46602
+ var ToolContent = memo8(function ToolContent2({
46603
+ presentation,
46604
+ context
46605
+ }) {
46606
+ return /* @__PURE__ */ jsx97(Fragment15, { children: presentation.render(context) });
46607
+ });
46608
+ function ToolPresentationUI({
46609
+ presentation: tool2,
46610
+ ...props
46611
+ }) {
46612
+ const registry = useToolPresentations();
46613
+ const chat = useChat();
46614
+ const presentation = registry?.controller?.get(props.toolName);
46615
+ const schema = presentation?.definition.inputSchema;
46616
+ const argsText = useMemo13(
46617
+ () => presentation?.confirmationProtocol ? confirmationInputText(props.argsText, props.toolName, props.toolCallId, chat.messages) : props.argsText,
46618
+ [
46619
+ presentation?.confirmationProtocol,
46620
+ props.argsText,
46621
+ props.toolName,
46622
+ props.toolCallId,
46623
+ chat.messages
46624
+ ]
46625
+ );
46626
+ const parsed = useMemo13(() => {
46627
+ if (!schema || argsText === void 0) return;
46628
+ try {
46629
+ const input = JSON.parse(argsText);
46630
+ if (!validateAgentToolInput(schema, input).length) return { input };
46631
+ } catch {
46632
+ }
46633
+ return;
46634
+ }, [schema, argsText]);
46635
+ const decoded = useMemo13(
46636
+ () => typeof props.result === "string" ? decodeToolResult(props.result, props.toolName) : void 0,
46637
+ [props.result, props.toolName]
46638
+ );
46639
+ const confirmation = presentation?.confirmationProtocol && decoded?.value && typeof decoded.value === "object" ? decoded.value : void 0;
46640
+ const confirmationPending = confirmation?.status === "confirmation_required" && typeof confirmation.requestId === "string" && typeof confirmation.message === "string" && typeof confirmation.nextAction === "string" && Object.keys(confirmation).length === 4;
46641
+ const confirmationRejected = confirmation?.status === "rejected" && confirmation.toolExecuted === false && Object.keys(confirmation).every((key) => ["status", "requestId", "toolExecuted"].includes(key));
46642
+ const state = tool2?.type === "tool" ? tool2.toolState : void 0;
46643
+ const status = confirmationRejected || state === "cancelled" || state === "rejected" || props.result === void 0 && props.status.type === "incomplete" && props.status.reason === "cancelled" ? "cancelled" : state || props.isError || props.result === void 0 && props.status.type === "incomplete" ? "error" : props.result === void 0 ? "running" : "success";
46644
+ const context = useMemo13(
46645
+ () => parsed ? {
46646
+ input: parsed.input,
46647
+ status,
46648
+ ...status === "success" ? { result: decoded ? decoded.value : props.result } : {}
46649
+ } : void 0,
46650
+ [parsed, status, decoded, props.result]
46651
+ );
46652
+ const fallback = /* @__PURE__ */ jsx97(ToolCall, { ...props, presentation: tool2 });
46653
+ if (!presentation || !context || confirmationPending || decoded?.omitted || chat.interrupt?.toolName === props.toolName && tool2?.type === "tool" && tool2.result === void 0)
46654
+ return fallback;
46655
+ return /* @__PURE__ */ jsxs29(
46656
+ RenderBoundary,
46657
+ {
46658
+ fallback,
46659
+ report: (error) => registry?.report(error, chat.activeSessionId, props.toolCallId),
46660
+ children: [
46661
+ /* @__PURE__ */ jsx97("div", { className: cn("my-2 min-w-0 max-w-full"), "data-slot": "nexface-tool-content", children: /* @__PURE__ */ jsx97(ToolContent, { presentation, context }) }),
46662
+ props.showDetails ? fallback : null
46663
+ ]
46664
+ },
46665
+ props.toolCallId
46666
+ );
46667
+ }
46668
+
46669
+ // src/assistant-components.tsx
46670
+ import { Fragment as Fragment16, jsx as jsx98, jsxs as jsxs30 } from "react/jsx-runtime";
46412
46671
  function AttachmentTile({
46413
46672
  binding,
46414
46673
  savedPreview
46415
46674
  }) {
46416
46675
  const attachment = useAuiState((s) => s.attachment);
46417
46676
  const preview = binding?.attachments.preview(attachment.id) ?? savedPreview ?? attachment.content?.find((part) => part.type === "image")?.image;
46418
- return /* @__PURE__ */ jsx97(AttachmentUI, { preview, children: /* @__PURE__ */ jsxs28("div", { className: cn("flex max-w-40 flex-col text-xs wrap-anywhere"), children: [
46419
- /* @__PURE__ */ jsx97(AttachmentPrimitiveName, {}),
46420
- binding && attachment.status.type === "requires-action" ? /* @__PURE__ */ jsx97("small", { className: cn("text-muted-foreground"), children: "\u5DF2\u5C31\u7EEA" }) : null,
46421
- attachment.status.type === "running" ? /* @__PURE__ */ jsx97("small", { className: cn("text-muted-foreground"), children: "\u6B63\u5728\u5904\u7406\u2026" }) : null,
46422
- attachment.status.type === "incomplete" ? /* @__PURE__ */ jsx97("small", { className: cn("text-destructive"), role: "alert", children: attachment.status.message ?? "Attachment processing failed" }) : null
46677
+ return /* @__PURE__ */ jsx98(AttachmentUI, { preview, children: /* @__PURE__ */ jsxs30("div", { className: cn("flex max-w-40 flex-col text-xs wrap-anywhere"), children: [
46678
+ /* @__PURE__ */ jsx98(AttachmentPrimitiveName, {}),
46679
+ binding && attachment.status.type === "requires-action" ? /* @__PURE__ */ jsx98("small", { className: cn("text-muted-foreground"), children: "\u5DF2\u5C31\u7EEA" }) : null,
46680
+ attachment.status.type === "running" ? /* @__PURE__ */ jsx98("small", { className: cn("text-muted-foreground"), children: "\u6B63\u5728\u5904\u7406\u2026" }) : null,
46681
+ attachment.status.type === "incomplete" ? /* @__PURE__ */ jsx98("small", { className: cn("text-destructive"), role: "alert", children: attachment.status.message ?? "Attachment processing failed" }) : null
46423
46682
  ] }) });
46424
46683
  }
46425
46684
  function AssistantComposer({
@@ -46447,7 +46706,7 @@ function AssistantComposer({
46447
46706
  (error) => binding.setNotice(error instanceof Error ? error.message : String(error))
46448
46707
  );
46449
46708
  };
46450
- return /* @__PURE__ */ jsxs28(
46709
+ return /* @__PURE__ */ jsxs30(
46451
46710
  Composer,
46452
46711
  {
46453
46712
  onSubmit: (event) => {
@@ -46471,19 +46730,19 @@ function AssistantComposer({
46471
46730
  }
46472
46731
  }
46473
46732
  },
46474
- actions: /* @__PURE__ */ jsxs28(Fragment15, { children: [
46475
- voiceBusy ? /* @__PURE__ */ jsx97("span", { role: "status", className: cn("sr-only"), children: binding.voice.status === "starting" ? "\u6B63\u5728\u51C6\u5907\u8BED\u97F3\u8F93\u5165\uFF0C\u8BF7\u786E\u8BA4\u9EA6\u514B\u98CE\u5DF2\u6388\u6743\u2026" : binding.voice.status === "transcribing" ? "\u6B63\u5728\u8BC6\u522B\uFF0C\u8BF7\u7A0D\u5019\u2026" : "\u6B63\u5728\u5F55\u97F3" }) : null,
46476
- voiceBusy ? /* @__PURE__ */ jsx97(
46733
+ actions: /* @__PURE__ */ jsxs30(Fragment16, { children: [
46734
+ voiceBusy ? /* @__PURE__ */ jsx98("span", { role: "status", className: cn("sr-only"), children: binding.voice.status === "starting" ? "\u6B63\u5728\u51C6\u5907\u8BED\u97F3\u8F93\u5165\uFF0C\u8BF7\u786E\u8BA4\u9EA6\u514B\u98CE\u5DF2\u6388\u6743\u2026" : binding.voice.status === "transcribing" ? "\u6B63\u5728\u8BC6\u522B\uFF0C\u8BF7\u7A0D\u5019\u2026" : "\u6B63\u5728\u5F55\u97F3" }) : null,
46735
+ voiceBusy ? /* @__PURE__ */ jsx98(
46477
46736
  TooltipIconButton,
46478
46737
  {
46479
46738
  tooltip: "\u53D6\u6D88\u5F55\u97F3",
46480
46739
  "aria-label": "\u53D6\u6D88\u8BED\u97F3\u8F93\u5165",
46481
46740
  className: cn("size-7 shrink-0"),
46482
46741
  onClick: binding.voice.cancel,
46483
- children: /* @__PURE__ */ jsx97(X, { className: cn("size-4") })
46742
+ children: /* @__PURE__ */ jsx98(X, { className: cn("size-4") })
46484
46743
  }
46485
- ) : options2 !== false ? /* @__PURE__ */ jsxs28(Fragment15, { children: [
46486
- /* @__PURE__ */ jsx97(
46744
+ ) : options2 !== false ? /* @__PURE__ */ jsxs30(Fragment16, { children: [
46745
+ /* @__PURE__ */ jsx98(
46487
46746
  "input",
46488
46747
  {
46489
46748
  ref: input,
@@ -46498,7 +46757,7 @@ function AssistantComposer({
46498
46757
  }
46499
46758
  }
46500
46759
  ),
46501
- /* @__PURE__ */ jsx97(
46760
+ /* @__PURE__ */ jsx98(
46502
46761
  "button",
46503
46762
  {
46504
46763
  type: "button",
@@ -46508,21 +46767,21 @@ function AssistantComposer({
46508
46767
  "aria-label": "\u6DFB\u52A0\u9644\u4EF6",
46509
46768
  disabled: inputDisabled,
46510
46769
  onClick: () => input.current?.click(),
46511
- children: /* @__PURE__ */ jsx97(Plus, { className: cn("size-4") })
46770
+ children: /* @__PURE__ */ jsx98(Plus, { className: cn("size-4") })
46512
46771
  }
46513
46772
  )
46514
- ] }) : /* @__PURE__ */ jsx97("span", {}),
46515
- voiceBusy ? /* @__PURE__ */ jsx97(ComposerVoice, { recording: binding.voice.status === "recording" }) : null,
46516
- /* @__PURE__ */ jsxs28("div", { className: cn("flex shrink-0 items-center gap-1"), children: [
46517
- /* @__PURE__ */ jsxs28(AuiIf, { condition: (state) => state.thread.capabilities.dictation, children: [
46518
- /* @__PURE__ */ jsx97(AuiIf, { condition: (state) => state.composer.dictation == null, children: /* @__PURE__ */ jsx97(TooltipProvider2, { delayDuration: 0, children: /* @__PURE__ */ jsxs28(Tooltip2, { children: [
46519
- /* @__PURE__ */ jsx97(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx97(
46773
+ ] }) : /* @__PURE__ */ jsx98("span", {}),
46774
+ voiceBusy ? /* @__PURE__ */ jsx98(ComposerVoice, { recording: binding.voice.status === "recording" }) : null,
46775
+ /* @__PURE__ */ jsxs30("div", { className: cn("flex shrink-0 items-center gap-1"), children: [
46776
+ /* @__PURE__ */ jsxs30(AuiIf, { condition: (state) => state.thread.capabilities.dictation, children: [
46777
+ /* @__PURE__ */ jsx98(AuiIf, { condition: (state) => state.composer.dictation == null, children: /* @__PURE__ */ jsx98(TooltipProvider2, { delayDuration: 0, children: /* @__PURE__ */ jsxs30(Tooltip2, { children: [
46778
+ /* @__PURE__ */ jsx98(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx98(
46520
46779
  "span",
46521
46780
  {
46522
46781
  className: cn("inline-flex"),
46523
46782
  tabIndex: voiceDisabledReason ? 0 : void 0,
46524
46783
  "aria-label": voiceDisabledReason,
46525
- children: /* @__PURE__ */ jsx97(ComposerPrimitiveDictate, { asChild: true, disabled: busy || sending, children: /* @__PURE__ */ jsx97(
46784
+ children: /* @__PURE__ */ jsx98(ComposerPrimitiveDictate, { asChild: true, disabled: busy || sending, children: /* @__PURE__ */ jsx98(
46526
46785
  Button,
46527
46786
  {
46528
46787
  variant: "ghost",
@@ -46530,19 +46789,19 @@ function AssistantComposer({
46530
46789
  "aria-label": "\u5F00\u59CB\u8BED\u97F3\u8F93\u5165",
46531
46790
  "aria-description": voiceDisabledReason,
46532
46791
  className: cn("size-7 p-1"),
46533
- children: /* @__PURE__ */ jsx97(Mic, { className: cn("size-4") })
46792
+ children: /* @__PURE__ */ jsx98(Mic, { className: cn("size-4") })
46534
46793
  }
46535
46794
  ) })
46536
46795
  }
46537
46796
  ) }),
46538
- /* @__PURE__ */ jsx97(TooltipContent3, { children: voiceDisabledReason ?? "\u8BED\u97F3\u8F93\u5165" })
46797
+ /* @__PURE__ */ jsx98(TooltipContent3, { children: voiceDisabledReason ?? "\u8BED\u97F3\u8F93\u5165" })
46539
46798
  ] }) }) }),
46540
- /* @__PURE__ */ jsx97(AuiIf, { condition: (state) => state.composer.dictation != null, children: /* @__PURE__ */ jsx97(
46799
+ /* @__PURE__ */ jsx98(AuiIf, { condition: (state) => state.composer.dictation != null, children: /* @__PURE__ */ jsx98(
46541
46800
  ComposerPrimitiveStopDictation,
46542
46801
  {
46543
46802
  asChild: true,
46544
46803
  disabled: binding.voice.status !== "recording",
46545
- children: /* @__PURE__ */ jsx97(
46804
+ children: /* @__PURE__ */ jsx98(
46546
46805
  "button",
46547
46806
  {
46548
46807
  type: "button",
@@ -46551,13 +46810,13 @@ function AssistantComposer({
46551
46810
  className: cn(
46552
46811
  "text-destructive rounded-control grid size-7 place-items-center transition-colors disabled:opacity-50"
46553
46812
  ),
46554
- children: /* @__PURE__ */ jsx97(Square, { className: cn("size-3 animate-pulse fill-current") })
46813
+ children: /* @__PURE__ */ jsx98(Square, { className: cn("size-3 animate-pulse fill-current") })
46555
46814
  }
46556
46815
  )
46557
46816
  }
46558
46817
  ) })
46559
46818
  ] }),
46560
- showCancel ? /* @__PURE__ */ jsx97(
46819
+ showCancel ? /* @__PURE__ */ jsx98(
46561
46820
  "button",
46562
46821
  {
46563
46822
  type: "button",
@@ -46567,9 +46826,9 @@ function AssistantComposer({
46567
46826
  ),
46568
46827
  disabled: cancelling,
46569
46828
  onClick: cancel,
46570
- children: /* @__PURE__ */ jsx97(Square, { className: cn("size-3 fill-current") })
46829
+ children: /* @__PURE__ */ jsx98(Square, { className: cn("size-3 fill-current") })
46571
46830
  }
46572
- ) : /* @__PURE__ */ jsx97(ComposerPrimitiveSend, { asChild: true, disabled: inputDisabled, children: /* @__PURE__ */ jsx97(
46831
+ ) : /* @__PURE__ */ jsx98(ComposerPrimitiveSend, { asChild: true, disabled: inputDisabled, children: /* @__PURE__ */ jsx98(
46573
46832
  "button",
46574
46833
  {
46575
46834
  type: "button",
@@ -46581,13 +46840,13 @@ function AssistantComposer({
46581
46840
  className: cn(
46582
46841
  "bg-primary text-primary-foreground rounded-control grid size-7 place-items-center transition-opacity disabled:opacity-40"
46583
46842
  ),
46584
- children: /* @__PURE__ */ jsx97(ArrowUp, { className: cn("size-4") })
46843
+ children: /* @__PURE__ */ jsx98(ArrowUp, { className: cn("size-4") })
46585
46844
  }
46586
46845
  ) })
46587
46846
  ] })
46588
46847
  ] }),
46589
46848
  children: [
46590
- /* @__PURE__ */ jsx97(
46849
+ /* @__PURE__ */ jsx98(
46591
46850
  "div",
46592
46851
  {
46593
46852
  ref: (element2) => {
@@ -46596,10 +46855,10 @@ function AssistantComposer({
46596
46855
  className: cn(
46597
46856
  "aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden"
46598
46857
  ),
46599
- children: /* @__PURE__ */ jsx97(ComposerPrimitiveAttachments, { children: () => /* @__PURE__ */ jsx97(AttachmentTile, { binding }) })
46858
+ children: /* @__PURE__ */ jsx98(ComposerPrimitiveAttachments, { children: () => /* @__PURE__ */ jsx98(AttachmentTile, { binding }) })
46600
46859
  }
46601
46860
  ),
46602
- sending ? /* @__PURE__ */ jsx97("small", { role: "status", children: "\u6B63\u5728\u5904\u7406\u9644\u4EF6\u2026" }) : null
46861
+ sending ? /* @__PURE__ */ jsx98("small", { role: "status", children: "\u6B63\u5728\u5904\u7406\u9644\u4EF6\u2026" }) : null
46603
46862
  ]
46604
46863
  }
46605
46864
  );
@@ -46618,8 +46877,8 @@ function ToolGroup({
46618
46877
  if (errorIds !== "[]") setOpen(true);
46619
46878
  }, [errorIds]);
46620
46879
  const unknown = hasErrors && errors.every((error) => error.scope === "tool" && error.execution === "unknown");
46621
- return /* @__PURE__ */ jsxs28(ToolGroupRoot, { variant: "ghost", className: cn("my-1"), open, onOpenChange: setOpen, children: [
46622
- /* @__PURE__ */ jsx97(
46880
+ return /* @__PURE__ */ jsxs30(ToolGroupRoot, { variant: "ghost", className: cn("my-1"), open, onOpenChange: setOpen, children: [
46881
+ /* @__PURE__ */ jsx98(
46623
46882
  DisclosureTrigger,
46624
46883
  {
46625
46884
  live: running && !hasErrors,
@@ -46627,7 +46886,7 @@ function ToolGroup({
46627
46886
  detail: `${count3} tools`
46628
46887
  }
46629
46888
  ),
46630
- /* @__PURE__ */ jsx97(ToolGroupContent, { className: cn(disclosureContentClass), children })
46889
+ /* @__PURE__ */ jsx98(ToolGroupContent, { className: cn(disclosureContentClass), children })
46631
46890
  ] });
46632
46891
  }
46633
46892
  var GroupedParts = MessagePrimitiveGroupedParts;
@@ -46641,81 +46900,88 @@ function AssistantParts({
46641
46900
  showDetails,
46642
46901
  tools = []
46643
46902
  }) {
46644
- return /* @__PURE__ */ jsx97(Fragment15, { children: /* @__PURE__ */ jsx97(GroupedParts, { groupBy: groupAssistantParts, children: ({ part, children }) => {
46645
- switch (part.type) {
46646
- case "group-chainOfThought":
46647
- return /* @__PURE__ */ jsx97("div", { className: cn("mb-3"), children });
46648
- case "group-tool":
46649
- return part.indices.length === 1 ? /* @__PURE__ */ jsx97(Fragment15, { children }) : /* @__PURE__ */ jsx97(
46650
- ToolGroup,
46651
- {
46652
- tools: tools.filter((_, index5) => part.indices.includes(index5)),
46653
- running: part.status.type === "running",
46654
- count: part.indices.length,
46655
- children
46656
- }
46657
- );
46658
- case "group-reasoning":
46659
- return /* @__PURE__ */ jsxs28(
46660
- ReasoningRoot3,
46661
- {
46662
- variant: "ghost",
46663
- streaming: part.status.type === "running",
46664
- className: cn("my-1"),
46665
- children: [
46666
- /* @__PURE__ */ jsx97(
46667
- DisclosureTrigger,
46668
- {
46669
- live: part.status.type === "running",
46670
- label: part.status.type === "running" ? "thinking" : "reasoning"
46671
- }
46672
- ),
46673
- /* @__PURE__ */ jsx97(
46674
- ReasoningContent,
46675
- {
46676
- "aria-busy": part.status.type === "running",
46677
- className: cn(disclosureContentClass),
46678
- children: /* @__PURE__ */ jsx97(ReasoningText, { className: cn("ps-0"), children })
46679
- }
46680
- )
46681
- ]
46682
- }
46683
- );
46684
- case "reasoning":
46685
- return /* @__PURE__ */ jsx97(Reasoning, { ...part });
46686
- case "group-source":
46687
- case "source":
46688
- return null;
46689
- case "data":
46690
- return part.dataRendererUI;
46691
- case "text":
46692
- return part.text === "" && part.status?.type === "running" ? /* @__PURE__ */ jsx97(TraceLine, { live: true, label: "thinking" }) : /* @__PURE__ */ jsx97(MarkdownText, {});
46693
- case "tool-call":
46694
- return part.toolUI ?? /* @__PURE__ */ jsx97(
46695
- ToolCall,
46696
- {
46697
- ...part,
46698
- showDetails,
46699
- presentation: tools.find(
46700
- (tool2) => tool2.type === "tool" && tool2.toolCallId === part.toolCallId
46701
- )
46702
- }
46703
- );
46704
- case "indicator":
46705
- return /* @__PURE__ */ jsx97(TraceLine, { live: true, label: "thinking" });
46706
- default:
46707
- return null;
46903
+ const registry = useToolPresentations2();
46904
+ return /* @__PURE__ */ jsx98(Fragment16, { children: /* @__PURE__ */ jsx98(
46905
+ GroupedParts,
46906
+ {
46907
+ groupBy: (part, context) => part.type === "tool-call" && registry?.controller?.get(part.toolName) ? [] : groupAssistantParts(part, context),
46908
+ children: ({ part, children }) => {
46909
+ switch (part.type) {
46910
+ case "group-chainOfThought":
46911
+ return /* @__PURE__ */ jsx98("div", { className: cn("mb-3"), children });
46912
+ case "group-tool":
46913
+ return part.indices.length === 1 ? /* @__PURE__ */ jsx98(Fragment16, { children }) : /* @__PURE__ */ jsx98(
46914
+ ToolGroup,
46915
+ {
46916
+ tools: tools.filter((_, index5) => part.indices.includes(index5)),
46917
+ running: part.status.type === "running",
46918
+ count: part.indices.length,
46919
+ children
46920
+ }
46921
+ );
46922
+ case "group-reasoning":
46923
+ return /* @__PURE__ */ jsxs30(
46924
+ ReasoningRoot3,
46925
+ {
46926
+ variant: "ghost",
46927
+ streaming: part.status.type === "running",
46928
+ className: cn("my-1"),
46929
+ children: [
46930
+ /* @__PURE__ */ jsx98(
46931
+ DisclosureTrigger,
46932
+ {
46933
+ live: part.status.type === "running",
46934
+ label: part.status.type === "running" ? "thinking" : "reasoning"
46935
+ }
46936
+ ),
46937
+ /* @__PURE__ */ jsx98(
46938
+ ReasoningContent,
46939
+ {
46940
+ "aria-busy": part.status.type === "running",
46941
+ className: cn(disclosureContentClass),
46942
+ children: /* @__PURE__ */ jsx98(ReasoningText, { className: cn("ps-0"), children })
46943
+ }
46944
+ )
46945
+ ]
46946
+ }
46947
+ );
46948
+ case "reasoning":
46949
+ return /* @__PURE__ */ jsx98(Reasoning, { ...part });
46950
+ case "group-source":
46951
+ case "source":
46952
+ return null;
46953
+ case "data":
46954
+ return part.dataRendererUI;
46955
+ case "text":
46956
+ return part.text === "" && part.status?.type === "running" ? /* @__PURE__ */ jsx98(TraceLine, { live: true, label: "thinking" }) : /* @__PURE__ */ jsx98(MarkdownText, {});
46957
+ case "tool-call":
46958
+ return part.toolUI ?? /* @__PURE__ */ jsx98(
46959
+ ToolPresentationUI,
46960
+ {
46961
+ ...part,
46962
+ showDetails,
46963
+ presentation: tools.find(
46964
+ (tool2) => tool2.type === "tool" && tool2.toolCallId === part.toolCallId
46965
+ )
46966
+ }
46967
+ );
46968
+ case "indicator":
46969
+ return /* @__PURE__ */ jsx98(TraceLine, { live: true, label: "thinking" });
46970
+ default:
46971
+ return null;
46972
+ }
46973
+ }
46708
46974
  }
46709
- } }) });
46975
+ ) });
46710
46976
  }
46711
46977
 
46712
46978
  // src/default-chat.tsx
46713
- import { useChat } from "./react.js";
46979
+ import { useChat as useChat2 } from "./react.js";
46714
46980
  import { sendErrorNotice } from "./errors.js";
46715
- import { Fragment as Fragment16, jsx as jsx98, jsxs as jsxs29 } from "react/jsx-runtime";
46981
+ import { Fragment as Fragment17, jsx as jsx99, jsxs as jsxs31 } from "react/jsx-runtime";
46716
46982
  var textOf = (message) => message.parts.flatMap((part) => part.type === "text" ? [part.text] : []).join("");
46717
46983
  var Icon2 = forwardRef33(function Icon3({ label, children, className, ...props }, ref) {
46718
- return /* @__PURE__ */ jsx98(
46984
+ return /* @__PURE__ */ jsx99(
46719
46985
  "button",
46720
46986
  {
46721
46987
  ref,
@@ -46760,7 +47026,7 @@ function Resize({
46760
47026
  return () => observer.disconnect();
46761
47027
  }, [min2, max2]);
46762
47028
  const clamp2 = (value) => Math.max(min2, Math.min(max2, window.innerWidth - 32, value));
46763
- return /* @__PURE__ */ jsx98(
47029
+ return /* @__PURE__ */ jsx99(
46764
47030
  "div",
46765
47031
  {
46766
47032
  ref: handle2,
@@ -46805,6 +47071,7 @@ function Chat({
46805
47071
  avatar,
46806
47072
  welcomeMessage = "\u4ECA\u5929\u60F3\u8BA9\u6211\u5E2E\u4F60\u505A\u4EC0\u4E48\uFF1F",
46807
47073
  welcomeDescription,
47074
+ welcomeIcon,
46808
47075
  open = true,
46809
47076
  onOpenChange,
46810
47077
  placeholder = "\u63CF\u8FF0\u4F60\u7684\u4EFB\u52A1...",
@@ -46821,7 +47088,7 @@ function Chat({
46821
47088
  onFullscreenChange,
46822
47089
  onRunResult
46823
47090
  }) {
46824
- const chat = useChat();
47091
+ const chat = useChat2();
46825
47092
  const nextMessage = useNextMessage(chat, suggestNextMessage, open);
46826
47093
  const { activeSessionId: sessionId, messages, status, interrupt } = chat;
46827
47094
  const busy = status !== "idle" && status !== "error";
@@ -46874,7 +47141,7 @@ function Chat({
46874
47141
  }
46875
47142
  updateDialog(next);
46876
47143
  };
46877
- const byId = useMemo13(
47144
+ const byId = useMemo14(
46878
47145
  () => new Map(projectMessages(messages).map((message) => [message.id, message])),
46879
47146
  [messages]
46880
47147
  );
@@ -46925,7 +47192,7 @@ function Chat({
46925
47192
  throw error;
46926
47193
  }
46927
47194
  };
46928
- return /* @__PURE__ */ jsx98(Fragment16, { children: chat.sessions.filter((session) => visited.current.has(session.id)).map((session) => /* @__PURE__ */ jsx98(
47195
+ return /* @__PURE__ */ jsx99(Fragment17, { children: chat.sessions.filter((session) => visited.current.has(session.id)).map((session) => /* @__PURE__ */ jsx99(
46929
47196
  SessionRuntime,
46930
47197
  {
46931
47198
  id: session.id,
@@ -46937,7 +47204,7 @@ function Chat({
46937
47204
  open,
46938
47205
  onEdit: editThroughRuntime,
46939
47206
  children: (binding) => {
46940
- const history = sidebarOpen ? /* @__PURE__ */ jsxs29(
47207
+ const history = sidebarOpen ? /* @__PURE__ */ jsxs31(
46941
47208
  "nav",
46942
47209
  {
46943
47210
  ref: sidebarNav,
@@ -46963,7 +47230,7 @@ function Chat({
46963
47230
  style: sidebarLayout === "overlay" && sidebarWidth !== void 0 ? { width: sidebarWidth } : void 0,
46964
47231
  "aria-label": "\u4F1A\u8BDD\u5386\u53F2",
46965
47232
  children: [
46966
- sidebarLayout === "overlay" ? /* @__PURE__ */ jsx98(
47233
+ sidebarLayout === "overlay" ? /* @__PURE__ */ jsx99(
46967
47234
  Resize,
46968
47235
  {
46969
47236
  label: "\u8C03\u6574\u4F1A\u8BDD\u5386\u53F2\u680F\u5BBD\u5EA6",
@@ -46974,33 +47241,33 @@ function Chat({
46974
47241
  max: 400
46975
47242
  }
46976
47243
  ) : null,
46977
- /* @__PURE__ */ jsxs29(
47244
+ /* @__PURE__ */ jsxs31(
46978
47245
  "div",
46979
47246
  {
46980
47247
  className: cn(
46981
47248
  "flex h-12 shrink-0 items-center gap-2 border-b border-foreground/10 px-4 md:px-5"
46982
47249
  ),
46983
47250
  children: [
46984
- sidebarLayout === "overlay" ? /* @__PURE__ */ jsx98(
47251
+ sidebarLayout === "overlay" ? /* @__PURE__ */ jsx99(
46985
47252
  Icon2,
46986
47253
  {
46987
47254
  label: "\u6536\u8D77\u4F1A\u8BDD\u5386\u53F2",
46988
47255
  "aria-expanded": sidebarOpen,
46989
47256
  className: cn("size-7 shrink-0"),
46990
47257
  onClick: () => setSidebar(false),
46991
- children: /* @__PURE__ */ jsx98(PanelLeft, { className: cn("size-4") })
47258
+ children: /* @__PURE__ */ jsx99(PanelLeft, { className: cn("size-4") })
46992
47259
  }
46993
47260
  ) : null,
46994
- /* @__PURE__ */ jsxs29(Avatar3, { children: [
46995
- avatar ? /* @__PURE__ */ jsx98(AvatarImage3, { src: avatar, alt: "" }) : null,
46996
- /* @__PURE__ */ jsx98(AvatarFallback3, { children: /* @__PURE__ */ jsx98(Bot, { size: 20 }) })
47261
+ /* @__PURE__ */ jsxs31(Avatar3, { children: [
47262
+ avatar ? /* @__PURE__ */ jsx99(AvatarImage3, { src: avatar, alt: "" }) : null,
47263
+ /* @__PURE__ */ jsx99(AvatarFallback3, { children: /* @__PURE__ */ jsx99(Bot, { size: 20 }) })
46997
47264
  ] }),
46998
- /* @__PURE__ */ jsx98("strong", { className: cn("min-w-0 flex-1 truncate text-[13px] font-medium"), children: title })
47265
+ /* @__PURE__ */ jsx99("strong", { className: cn("min-w-0 flex-1 truncate text-[13px] font-medium"), children: title })
46999
47266
  ]
47000
47267
  }
47001
47268
  ),
47002
- /* @__PURE__ */ jsxs29("div", { className: cn("flex min-h-0 flex-1 flex-col p-3"), children: [
47003
- /* @__PURE__ */ jsx98(
47269
+ /* @__PURE__ */ jsxs31("div", { className: cn("flex min-h-0 flex-1 flex-col p-3"), children: [
47270
+ /* @__PURE__ */ jsx99(
47004
47271
  ThreadListNew,
47005
47272
  {
47006
47273
  disabled: sessionBusy || binding.sending,
@@ -47010,20 +47277,20 @@ function Chat({
47010
47277
  }
47011
47278
  }
47012
47279
  ),
47013
- /* @__PURE__ */ jsx98(ThreadListSearch, { value: threadSearch, onValueChange: setThreadSearch }),
47014
- /* @__PURE__ */ jsx98(
47280
+ /* @__PURE__ */ jsx99(ThreadListSearch, { value: threadSearch, onValueChange: setThreadSearch }),
47281
+ /* @__PURE__ */ jsx99(
47015
47282
  "small",
47016
47283
  {
47017
47284
  className: cn("text-muted-foreground mt-5 mb-1 px-2 text-xs font-medium"),
47018
47285
  children: "\u6700\u8FD1\u4F1A\u8BDD"
47019
47286
  }
47020
47287
  ),
47021
- /* @__PURE__ */ jsx98(ThreadListRoot, { children: /* @__PURE__ */ jsx98(ThreadListPrimitiveItems, { children: ({ threadListItem: session2 }) => (session2.title ?? "\u65B0\u4F1A\u8BDD").toLocaleLowerCase().includes(threadSearch.trim().toLocaleLowerCase()) ? /* @__PURE__ */ jsx98(
47288
+ /* @__PURE__ */ jsx99(ThreadListRoot, { children: /* @__PURE__ */ jsx99(ThreadListPrimitiveItems, { children: ({ threadListItem: session2 }) => (session2.title ?? "\u65B0\u4F1A\u8BDD").toLocaleLowerCase().includes(threadSearch.trim().toLocaleLowerCase()) ? /* @__PURE__ */ jsx99(
47022
47289
  ThreadListItem,
47023
47290
  {
47024
47291
  disabled: sessionBusy || binding.sending,
47025
- menu: (beginRename) => /* @__PURE__ */ jsxs29(Fragment16, { children: [
47026
- /* @__PURE__ */ jsx98(
47292
+ menu: (beginRename) => /* @__PURE__ */ jsxs31(Fragment17, { children: [
47293
+ /* @__PURE__ */ jsx99(
47027
47294
  DropdownMenuItem3,
47028
47295
  {
47029
47296
  disabled: sessionBusy || binding.sending,
@@ -47031,7 +47298,7 @@ function Chat({
47031
47298
  children: "\u91CD\u547D\u540D"
47032
47299
  }
47033
47300
  ),
47034
- /* @__PURE__ */ jsx98(
47301
+ /* @__PURE__ */ jsx99(
47035
47302
  DropdownMenuItem3,
47036
47303
  {
47037
47304
  variant: "destructive",
@@ -47045,7 +47312,7 @@ function Chat({
47045
47312
  children: "\u6E05\u7A7A\u6D88\u606F"
47046
47313
  }
47047
47314
  ),
47048
- /* @__PURE__ */ jsx98(
47315
+ /* @__PURE__ */ jsx99(
47049
47316
  DropdownMenuItem3,
47050
47317
  {
47051
47318
  variant: "destructive",
@@ -47064,7 +47331,7 @@ function Chat({
47064
47331
  ) : null }) }),
47065
47332
  threadSearch.trim() && !chat.sessions.some(
47066
47333
  (session2) => session2.title.toLocaleLowerCase().includes(threadSearch.trim().toLocaleLowerCase())
47067
- ) ? /* @__PURE__ */ jsx98(
47334
+ ) ? /* @__PURE__ */ jsx99(
47068
47335
  "div",
47069
47336
  {
47070
47337
  "data-slot": "aui_thread-list-empty",
@@ -47076,7 +47343,7 @@ function Chat({
47076
47343
  ]
47077
47344
  }
47078
47345
  ) : null;
47079
- return open ? /* @__PURE__ */ jsxs29(
47346
+ return open ? /* @__PURE__ */ jsxs31(
47080
47347
  ChatSurface,
47081
47348
  {
47082
47349
  className: `nexface-chat${className ? ` ${className}` : ""}`,
@@ -47092,7 +47359,7 @@ function Chat({
47092
47359
  ...fullscreen ? { border: 0, borderRadius: 0 } : {}
47093
47360
  },
47094
47361
  children: [
47095
- layout === "docked" && !fullscreen ? /* @__PURE__ */ jsx98(
47362
+ layout === "docked" && !fullscreen ? /* @__PURE__ */ jsx99(
47096
47363
  Resize,
47097
47364
  {
47098
47365
  label: "\u8C03\u6574\u804A\u5929\u5BBD\u5EA6",
@@ -47105,7 +47372,7 @@ function Chat({
47105
47372
  }
47106
47373
  ) : null,
47107
47374
  sidebarLayout === "outside" ? history : null,
47108
- /* @__PURE__ */ jsxs29(
47375
+ /* @__PURE__ */ jsxs31(
47109
47376
  "section",
47110
47377
  {
47111
47378
  ref: panel,
@@ -47114,8 +47381,8 @@ function Chat({
47114
47381
  ),
47115
47382
  "aria-label": `${title} chat`,
47116
47383
  children: [
47117
- sidebarOpen && sidebarLayout === "overlay" ? /* @__PURE__ */ jsxs29(Fragment16, { children: [
47118
- /* @__PURE__ */ jsx98(
47384
+ sidebarOpen && sidebarLayout === "overlay" ? /* @__PURE__ */ jsxs31(Fragment17, { children: [
47385
+ /* @__PURE__ */ jsx99(
47119
47386
  "button",
47120
47387
  {
47121
47388
  type: "button",
@@ -47127,7 +47394,7 @@ function Chat({
47127
47394
  ),
47128
47395
  history
47129
47396
  ] }) : null,
47130
- /* @__PURE__ */ jsxs29(
47397
+ /* @__PURE__ */ jsxs31(
47131
47398
  "div",
47132
47399
  {
47133
47400
  ref: (element2) => {
@@ -47138,7 +47405,7 @@ function Chat({
47138
47405
  },
47139
47406
  className: cn("flex min-h-0 min-w-0 flex-1 flex-col"),
47140
47407
  children: [
47141
- /* @__PURE__ */ jsxs29(
47408
+ /* @__PURE__ */ jsxs31(
47142
47409
  "header",
47143
47410
  {
47144
47411
  "data-slot": "nexface_chat_header",
@@ -47146,12 +47413,12 @@ function Chat({
47146
47413
  "border-foreground/10 flex h-12 shrink-0 min-w-0 items-center gap-2 border-b px-4 md:px-5"
47147
47414
  ),
47148
47415
  children: [
47149
- /* @__PURE__ */ jsxs29(
47416
+ /* @__PURE__ */ jsxs31(
47150
47417
  "div",
47151
47418
  {
47152
47419
  className: cn("flex min-w-0 flex-1 items-center gap-2 whitespace-nowrap"),
47153
47420
  children: [
47154
- sidebarEnabled && (sidebarLayout === "outside" || !sidebarOpen) ? /* @__PURE__ */ jsx98(
47421
+ sidebarEnabled && (sidebarLayout === "outside" || !sidebarOpen) ? /* @__PURE__ */ jsx99(
47155
47422
  Icon2,
47156
47423
  {
47157
47424
  ref: sidebarTrigger,
@@ -47159,17 +47426,17 @@ function Chat({
47159
47426
  "aria-expanded": sidebarOpen,
47160
47427
  className: cn("size-7 shrink-0"),
47161
47428
  onClick: () => setSidebar((value) => !value),
47162
- children: /* @__PURE__ */ jsx98(PanelLeft, { className: cn("size-4") })
47429
+ children: /* @__PURE__ */ jsx99(PanelLeft, { className: cn("size-4") })
47163
47430
  }
47164
47431
  ) : null,
47165
- /* @__PURE__ */ jsx98("strong", { className: cn("truncate text-[13px] font-medium"), children: activeTitle })
47432
+ /* @__PURE__ */ jsx99("strong", { className: cn("truncate text-[13px] font-medium"), children: activeTitle })
47166
47433
  ]
47167
47434
  }
47168
47435
  ),
47169
- /* @__PURE__ */ jsxs29("div", { className: cn("-me-1.5 ml-auto flex shrink-0 items-center gap-1.5"), children: [
47170
- /* @__PURE__ */ jsxs29(DropdownMenu2, { modal: false, children: [
47171
- /* @__PURE__ */ jsx98(DropdownMenuTrigger3, { asChild: true, children: /* @__PURE__ */ jsx98(Icon2, { label: "\u66F4\u591A\u4F1A\u8BDD\u64CD\u4F5C", children: /* @__PURE__ */ jsx98(Ellipsis, {}) }) }),
47172
- /* @__PURE__ */ jsx98(DropdownMenuContent3, { align: "end", children: /* @__PURE__ */ jsx98(
47436
+ /* @__PURE__ */ jsxs31("div", { className: cn("-me-1.5 ml-auto flex shrink-0 items-center gap-1.5"), children: [
47437
+ /* @__PURE__ */ jsxs31(DropdownMenu2, { modal: false, children: [
47438
+ /* @__PURE__ */ jsx99(DropdownMenuTrigger3, { asChild: true, children: /* @__PURE__ */ jsx99(Icon2, { label: "\u66F4\u591A\u4F1A\u8BDD\u64CD\u4F5C", children: /* @__PURE__ */ jsx99(Ellipsis, {}) }) }),
47439
+ /* @__PURE__ */ jsx99(DropdownMenuContent3, { align: "end", children: /* @__PURE__ */ jsx99(
47173
47440
  DropdownMenuItem3,
47174
47441
  {
47175
47442
  variant: "destructive",
@@ -47184,40 +47451,47 @@ function Chat({
47184
47451
  }
47185
47452
  ) })
47186
47453
  ] }),
47187
- /* @__PURE__ */ jsx98(
47454
+ /* @__PURE__ */ jsx99(
47188
47455
  Icon2,
47189
47456
  {
47190
47457
  label: "\u65B0\u5EFA\u804A\u5929\u4F1A\u8BDD",
47191
47458
  disabled: sessionBusy || binding.sending,
47192
47459
  onClick: () => safe(() => chat.createSession()),
47193
- children: /* @__PURE__ */ jsx98(Plus, {})
47460
+ children: /* @__PURE__ */ jsx99(Plus, {})
47194
47461
  }
47195
47462
  ),
47196
- /* @__PURE__ */ jsx98(
47463
+ /* @__PURE__ */ jsx99(
47197
47464
  Icon2,
47198
47465
  {
47199
47466
  ref: headerFocusButton,
47200
47467
  label: fullscreen ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F",
47201
47468
  onClick: () => changeFullscreen(!fullscreen),
47202
- children: fullscreen ? /* @__PURE__ */ jsx98(Minimize2, {}) : /* @__PURE__ */ jsx98(Maximize2, {})
47469
+ children: fullscreen ? /* @__PURE__ */ jsx99(Minimize2, {}) : /* @__PURE__ */ jsx99(Maximize2, {})
47203
47470
  }
47204
47471
  ),
47205
- onOpenChange ? /* @__PURE__ */ jsx98(Icon2, { label: "\u5173\u95ED Agent \u5BF9\u8BDD", onClick: () => onOpenChange(false), children: /* @__PURE__ */ jsx98(X, {}) }) : null
47472
+ onOpenChange ? /* @__PURE__ */ jsx99(Icon2, { label: "\u5173\u95ED Agent \u5BF9\u8BDD", onClick: () => onOpenChange(false), children: /* @__PURE__ */ jsx99(X, {}) }) : null
47206
47473
  ] })
47207
47474
  ]
47208
47475
  }
47209
47476
  ),
47210
- /* @__PURE__ */ jsx98(
47477
+ /* @__PURE__ */ jsx99(
47211
47478
  "div",
47212
47479
  {
47213
47480
  "data-slot": "nexface_chat_body",
47214
47481
  className: cn("relative flex min-h-0 flex-1"),
47215
- children: /* @__PURE__ */ jsx98(
47482
+ children: /* @__PURE__ */ jsx99(
47216
47483
  Thread,
47217
47484
  {
47218
47485
  empty: !messages.length,
47219
- welcome: /* @__PURE__ */ jsx98(Greeting, { title: welcomeMessage, description: welcomeDescription }),
47220
- suggestions: /* @__PURE__ */ jsx98(
47486
+ welcome: /* @__PURE__ */ jsx99(
47487
+ Greeting,
47488
+ {
47489
+ title: welcomeMessage,
47490
+ description: welcomeDescription,
47491
+ icon: welcomeIcon
47492
+ }
47493
+ ),
47494
+ suggestions: /* @__PURE__ */ jsx99(
47221
47495
  Suggestions2,
47222
47496
  {
47223
47497
  suggestions,
@@ -47225,21 +47499,21 @@ function Chat({
47225
47499
  onSend: (prompt) => void execute(prompt)
47226
47500
  }
47227
47501
  ),
47228
- footer: /* @__PURE__ */ jsxs29(Fragment16, { children: [
47229
- chat.storageWarning ? /* @__PURE__ */ jsx98("div", { role: "alert", className: cn("text-muted-foreground text-xs"), children: chat.storageWarning }) : null,
47230
- notice ? /* @__PURE__ */ jsxs29("div", { role: "status", className: cn("text-muted-foreground text-xs"), children: [
47502
+ footer: /* @__PURE__ */ jsxs31(Fragment17, { children: [
47503
+ chat.storageWarning ? /* @__PURE__ */ jsx99("div", { role: "alert", className: cn("text-muted-foreground text-xs"), children: chat.storageWarning }) : null,
47504
+ notice ? /* @__PURE__ */ jsxs31("div", { role: "status", className: cn("text-muted-foreground text-xs"), children: [
47231
47505
  notice,
47232
- /* @__PURE__ */ jsx98("button", { onClick: () => setNotice(""), children: "\xD7" })
47506
+ /* @__PURE__ */ jsx99("button", { onClick: () => setNotice(""), children: "\xD7" })
47233
47507
  ] }) : null,
47234
- binding.notice ? /* @__PURE__ */ jsxs29(
47508
+ binding.notice ? /* @__PURE__ */ jsxs31(
47235
47509
  ErrorPrimitiveRoot,
47236
47510
  {
47237
47511
  className: cn(
47238
47512
  "border-destructive/60 text-destructive flex items-start gap-3 border-l-2 pl-3 text-[13px] leading-relaxed"
47239
47513
  ),
47240
47514
  children: [
47241
- /* @__PURE__ */ jsx98("span", { className: cn("min-w-0 flex-1 break-words"), children: binding.notice }),
47242
- /* @__PURE__ */ jsx98(
47515
+ /* @__PURE__ */ jsx99("span", { className: cn("min-w-0 flex-1 break-words"), children: binding.notice }),
47516
+ /* @__PURE__ */ jsx99(
47243
47517
  Icon2,
47244
47518
  {
47245
47519
  label: "\u5173\u95ED\u63D0\u793A",
@@ -47247,14 +47521,14 @@ function Chat({
47247
47521
  "text-destructive hover:text-destructive -mt-1 -mr-1 shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive/30"
47248
47522
  ),
47249
47523
  onClick: () => binding.setNotice(""),
47250
- children: /* @__PURE__ */ jsx98(X, {})
47524
+ children: /* @__PURE__ */ jsx99(X, {})
47251
47525
  }
47252
47526
  )
47253
47527
  ]
47254
47528
  }
47255
47529
  ) : null
47256
47530
  ] }),
47257
- composer: /* @__PURE__ */ jsx98(
47531
+ composer: /* @__PURE__ */ jsx99(
47258
47532
  AssistantComposer,
47259
47533
  {
47260
47534
  binding,
@@ -47268,7 +47542,7 @@ function Chat({
47268
47542
  ),
47269
47543
  renderMessage: ({ message: rendered }) => {
47270
47544
  const message = byId.get(rendered.id);
47271
- return message ? /* @__PURE__ */ jsx98(Fragment16, { children: editing?.id === message.id ? /* @__PURE__ */ jsx98(
47545
+ return message ? /* @__PURE__ */ jsx99(Fragment17, { children: editing?.id === message.id ? /* @__PURE__ */ jsx99(
47272
47546
  EditComposer,
47273
47547
  {
47274
47548
  onKeyDown: (event) => {
@@ -47289,16 +47563,16 @@ function Chat({
47289
47563
  type: "button",
47290
47564
  disabled: busy || binding.sending || binding.voice.status !== "idle" || !editing.text.trim() && !editing.files.length
47291
47565
  },
47292
- children: editing.files.map((file) => /* @__PURE__ */ jsxs29(
47566
+ children: editing.files.map((file) => /* @__PURE__ */ jsxs31(
47293
47567
  "div",
47294
47568
  {
47295
47569
  className: cn(
47296
47570
  "bg-muted flex min-w-0 items-center gap-2 rounded-md px-3 py-2 text-sm"
47297
47571
  ),
47298
47572
  children: [
47299
- /* @__PURE__ */ jsx98(Paperclip, { className: cn("size-4 shrink-0") }),
47300
- /* @__PURE__ */ jsx98("span", { className: cn("min-w-0 flex-1 truncate"), children: file.name }),
47301
- /* @__PURE__ */ jsx98(
47573
+ /* @__PURE__ */ jsx99(Paperclip, { className: cn("size-4 shrink-0") }),
47574
+ /* @__PURE__ */ jsx99("span", { className: cn("min-w-0 flex-1 truncate"), children: file.name }),
47575
+ /* @__PURE__ */ jsx99(
47302
47576
  TooltipIconButton,
47303
47577
  {
47304
47578
  tooltip: "\u79FB\u9664\u9644\u4EF6",
@@ -47311,7 +47585,7 @@ function Chat({
47311
47585
  (item) => item.id !== file.id
47312
47586
  )
47313
47587
  }),
47314
- children: /* @__PURE__ */ jsx98(X, {})
47588
+ children: /* @__PURE__ */ jsx99(X, {})
47315
47589
  }
47316
47590
  )
47317
47591
  ]
@@ -47319,16 +47593,16 @@ function Chat({
47319
47593
  file.id
47320
47594
  ))
47321
47595
  }
47322
- ) : /* @__PURE__ */ jsx98(Fragment16, { children: message.role === "user" ? /* @__PURE__ */ jsx98(
47596
+ ) : /* @__PURE__ */ jsx99(Fragment17, { children: message.role === "user" ? /* @__PURE__ */ jsx99(
47323
47597
  UserMessage,
47324
47598
  {
47325
- attachments: /* @__PURE__ */ jsx98(
47599
+ attachments: /* @__PURE__ */ jsx99(
47326
47600
  "div",
47327
47601
  {
47328
47602
  className: cn(
47329
47603
  "aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row flex-wrap justify-end gap-2 empty:hidden"
47330
47604
  ),
47331
- children: /* @__PURE__ */ jsx98(MessagePrimitiveAttachments, { children: ({ attachment }) => /* @__PURE__ */ jsx98(
47605
+ children: /* @__PURE__ */ jsx99(MessagePrimitiveAttachments, { children: ({ attachment }) => /* @__PURE__ */ jsx99(
47332
47606
  AttachmentTile,
47333
47607
  {
47334
47608
  savedPreview: message.attachments?.find(
@@ -47338,7 +47612,7 @@ function Chat({
47338
47612
  ) })
47339
47613
  }
47340
47614
  ),
47341
- actions: message.id === latestUser?.id ? /* @__PURE__ */ jsx98(ActionBarPrimitiveEdit, { asChild: true, children: /* @__PURE__ */ jsx98(
47615
+ actions: message.id === latestUser?.id ? /* @__PURE__ */ jsx99(ActionBarPrimitiveEdit, { asChild: true, children: /* @__PURE__ */ jsx99(
47342
47616
  "button",
47343
47617
  {
47344
47618
  type: "button",
@@ -47350,32 +47624,32 @@ function Chat({
47350
47624
  text: textOf(message),
47351
47625
  files: message.attachments ?? []
47352
47626
  }),
47353
- children: /* @__PURE__ */ jsx98(Pencil, { className: cn("size-4") })
47627
+ children: /* @__PURE__ */ jsx99(Pencil, { className: cn("size-4") })
47354
47628
  }
47355
47629
  ) }) : null,
47356
- children: /* @__PURE__ */ jsx98(MessagePrimitiveParts2, {})
47630
+ children: /* @__PURE__ */ jsx99(MessagePrimitiveParts2, {})
47357
47631
  }
47358
- ) : /* @__PURE__ */ jsx98(AssistantMessage, { children: /* @__PURE__ */ jsx98(
47632
+ ) : /* @__PURE__ */ jsx99(AssistantMessage, { children: /* @__PURE__ */ jsx99(
47359
47633
  AssistantParts,
47360
47634
  {
47361
47635
  showDetails: showToolDetails,
47362
47636
  tools: message.parts
47363
47637
  }
47364
- ) }) }) }) : /* @__PURE__ */ jsx98(AssistantMessage, { children: /* @__PURE__ */ jsx98(AssistantParts, { showDetails: showToolDetails }) });
47638
+ ) }) }) }) : /* @__PURE__ */ jsx99(AssistantMessage, { children: /* @__PURE__ */ jsx99(AssistantParts, { showDetails: showToolDetails }) });
47365
47639
  },
47366
- children: interrupt ? /* @__PURE__ */ jsxs29(
47640
+ children: interrupt ? /* @__PURE__ */ jsxs31(
47367
47641
  "section",
47368
47642
  {
47369
47643
  "aria-label": interrupt.title ?? `\u786E\u8BA4\u6267\u884C ${interrupt.toolName}\uFF1F`,
47370
47644
  className: cn("rounded-lg bg-muted p-4"),
47371
47645
  "data-mode": interrupt.mode,
47372
47646
  children: [
47373
- /* @__PURE__ */ jsx98("strong", { children: interrupt.title ?? `\u786E\u8BA4\u6267\u884C ${interrupt.toolName}\uFF1F` }),
47374
- interrupt.description ? /* @__PURE__ */ jsx98("p", { className: cn("mt-1 text-muted-foreground"), children: interrupt.description }) : null,
47375
- interrupt.mode === "chat" ? /* @__PURE__ */ jsxs29("div", { className: cn("mt-3 flex gap-2"), children: [
47376
- /* @__PURE__ */ jsx98(Button, { onClick: chat.confirmInterrupt, children: interrupt.confirmLabel ?? "\u786E\u8BA4" }),
47377
- /* @__PURE__ */ jsx98(Button, { variant: "outline", onClick: chat.rejectInterrupt, children: interrupt.rejectLabel ?? "\u62D2\u7EDD" })
47378
- ] }) : /* @__PURE__ */ jsx98("p", { className: cn("mt-1 text-muted-foreground"), children: "\u8BF7\u5728\u4E1A\u52A1\u9875\u9762\u5B8C\u6210\u786E\u8BA4\u3002" })
47647
+ /* @__PURE__ */ jsx99("strong", { children: interrupt.title ?? `\u786E\u8BA4\u6267\u884C ${interrupt.toolName}\uFF1F` }),
47648
+ interrupt.description ? /* @__PURE__ */ jsx99("p", { className: cn("mt-1 text-muted-foreground"), children: interrupt.description }) : null,
47649
+ interrupt.mode === "chat" ? /* @__PURE__ */ jsxs31("div", { className: cn("mt-3 flex gap-2"), children: [
47650
+ /* @__PURE__ */ jsx99(Button, { onClick: chat.confirmInterrupt, children: interrupt.confirmLabel ?? "\u786E\u8BA4" }),
47651
+ /* @__PURE__ */ jsx99(Button, { variant: "outline", onClick: chat.rejectInterrupt, children: interrupt.rejectLabel ?? "\u62D2\u7EDD" })
47652
+ ] }) : /* @__PURE__ */ jsx99("p", { className: cn("mt-1 text-muted-foreground"), children: "\u8BF7\u5728\u4E1A\u52A1\u9875\u9762\u5B8C\u6210\u786E\u8BA4\u3002" })
47379
47653
  ]
47380
47654
  }
47381
47655
  ) : null
@@ -47386,7 +47660,7 @@ function Chat({
47386
47660
  ]
47387
47661
  }
47388
47662
  ),
47389
- /* @__PURE__ */ jsx98(
47663
+ /* @__PURE__ */ jsx99(
47390
47664
  Dialog2,
47391
47665
  {
47392
47666
  open: Boolean(dialog),
@@ -47395,7 +47669,7 @@ function Chat({
47395
47669
  setDialog(void 0);
47396
47670
  }
47397
47671
  },
47398
- children: /* @__PURE__ */ jsxs29(
47672
+ children: /* @__PURE__ */ jsxs31(
47399
47673
  DialogContent3,
47400
47674
  {
47401
47675
  showCloseButton: false,
@@ -47409,10 +47683,10 @@ function Chat({
47409
47683
  });
47410
47684
  },
47411
47685
  children: [
47412
- /* @__PURE__ */ jsx98(DialogTitle3, { children: dialog?.title }),
47413
- /* @__PURE__ */ jsx98(DialogDescription3, { children: dialog?.description }),
47414
- /* @__PURE__ */ jsxs29(DialogFooter, { children: [
47415
- /* @__PURE__ */ jsx98(
47686
+ /* @__PURE__ */ jsx99(DialogTitle3, { children: dialog?.title }),
47687
+ /* @__PURE__ */ jsx99(DialogDescription3, { children: dialog?.description }),
47688
+ /* @__PURE__ */ jsxs31(DialogFooter, { children: [
47689
+ /* @__PURE__ */ jsx99(
47416
47690
  Button,
47417
47691
  {
47418
47692
  variant: "outline",
@@ -47423,7 +47697,7 @@ function Chat({
47423
47697
  children: "\u53D6\u6D88"
47424
47698
  }
47425
47699
  ),
47426
- /* @__PURE__ */ jsx98(
47700
+ /* @__PURE__ */ jsx99(
47427
47701
  Button,
47428
47702
  {
47429
47703
  variant: dialog?.dangerous ? "destructive" : "default",